From 57e91ccacb780f8a0275dbb5d2526e200987dbeb Mon Sep 17 00:00:00 2001 From: Steve Ebersole Date: Wed, 21 Jul 2010 01:11:34 +0000 Subject: [PATCH] HHH-5397 - Odds and ends from documentation merge : initial POT and PO synchs git-svn-id: https://svn.jboss.org/repos/hibernate/core/trunk@19979 1b8cb986-b30d-0410-93ca-fae66ebed9b2 --- ...lational_Persistence_for_Idiomatic_Java.po | 6 +- .../src/main/docbook/de-DE/author_group.po | 190 +- .../de-DE/content/additionalmodules.po | 439 + .../docbook/de-DE/content/basic_mapping.po | 10711 ++++++++++----- .../de-DE/content/collection_mapping.po | 3677 ++++-- .../docbook/de-DE/content/configuration.po | 1567 ++- .../src/main/docbook/de-DE/content/filters.po | 390 +- .../main/docbook/de-DE/content/performance.po | 1574 ++- .../de-DE/content/persistent_classes.po | 1367 +- .../src/main/docbook/de-DE/content/preface.po | 178 +- .../main/docbook/de-DE/content/query_sql.po | 2180 +-- .../main/docbook/de-DE/content/session_api.po | 1725 ++- .../main/docbook/de-DE/content/tutorial.po | 2648 ++-- .../src/main/docbook/es-ES/author_group.po | 322 +- .../docbook/es-ES/content/basic_mapping.po | 8645 +++++++++--- .../es-ES/content/collection_mapping.po | 2846 +++- .../docbook/es-ES/content/configuration.po | 1392 +- .../src/main/docbook/es-ES/content/filters.po | 388 +- .../main/docbook/es-ES/content/performance.po | 1024 +- .../es-ES/content/persistent_classes.po | 900 +- .../src/main/docbook/es-ES/content/preface.po | 218 +- .../main/docbook/es-ES/content/query_sql.po | 1257 +- .../main/docbook/es-ES/content/session_api.po | 891 +- .../main/docbook/es-ES/content/tutorial.po | 1035 +- .../src/main/docbook/fr-FR/author_group.po | 188 +- .../docbook/fr-FR/content/basic_mapping.po | 8655 +++++++++--- .../fr-FR/content/collection_mapping.po | 2851 +++- .../docbook/fr-FR/content/configuration.po | 1276 +- .../src/main/docbook/fr-FR/content/filters.po | 388 +- .../main/docbook/fr-FR/content/performance.po | 993 +- .../fr-FR/content/persistent_classes.po | 873 +- .../src/main/docbook/fr-FR/content/preface.po | 188 +- .../main/docbook/fr-FR/content/query_sql.po | 1396 +- .../main/docbook/fr-FR/content/session_api.po | 836 +- .../main/docbook/fr-FR/content/tutorial.po | 963 +- .../src/main/docbook/ja-JP/author_group.po | 188 +- .../docbook/ja-JP/content/basic_mapping.po | 10117 +++++++++----- .../ja-JP/content/collection_mapping.po | 3627 +++-- .../docbook/ja-JP/content/configuration.po | 1764 ++- .../src/main/docbook/ja-JP/content/filters.po | 392 +- .../main/docbook/ja-JP/content/performance.po | 1578 ++- .../ja-JP/content/persistent_classes.po | 1387 +- .../src/main/docbook/ja-JP/content/preface.po | 188 +- .../main/docbook/ja-JP/content/query_sql.po | 2149 +-- .../main/docbook/ja-JP/content/session_api.po | 1725 ++- .../main/docbook/ja-JP/content/tutorial.po | 2650 ++-- ...ational_Persistence_for_Idiomatic_Java.pot | 18 +- .../src/main/docbook/pot/author_group.pot | 171 +- .../docbook/pot/content/basic_mapping.pot | 5440 ++++++-- .../pot/content/collection_mapping.pot | 2159 ++- .../docbook/pot/content/configuration.pot | 1049 +- .../src/main/docbook/pot/content/filters.pot | 179 +- .../main/docbook/pot/content/performance.pot | 873 +- .../pot/content/persistent_classes.pot | 593 +- .../src/main/docbook/pot/content/preface.pot | 106 +- .../main/docbook/pot/content/query_sql.pot | 1124 +- .../main/docbook/pot/content/session_api.pot | 770 +- .../src/main/docbook/pot/content/tutorial.pot | 920 +- .../src/main/docbook/pt-BR/author_group.po | 322 +- .../docbook/pt-BR/content/basic_mapping.po | 8352 +++++++++--- .../pt-BR/content/collection_mapping.po | 2855 +++- .../docbook/pt-BR/content/configuration.po | 1392 +- .../src/main/docbook/pt-BR/content/filters.po | 388 +- .../main/docbook/pt-BR/content/performance.po | 1024 +- .../pt-BR/content/persistent_classes.po | 890 +- .../src/main/docbook/pt-BR/content/preface.po | 212 +- .../main/docbook/pt-BR/content/query_sql.po | 1252 +- .../main/docbook/pt-BR/content/session_api.po | 880 +- .../main/docbook/pt-BR/content/tutorial.po | 1023 +- .../src/main/docbook/zh-CN/author_group.po | 322 +- .../docbook/zh-CN/content/basic_mapping.po | 11003 ++++++++++++---- .../zh-CN/content/collection_mapping.po | 3977 ++++-- .../docbook/zh-CN/content/configuration.po | 3099 +++-- .../src/main/docbook/zh-CN/content/filters.po | 388 +- .../main/docbook/zh-CN/content/performance.po | 1585 ++- .../zh-CN/content/persistent_classes.po | 2027 +-- .../src/main/docbook/zh-CN/content/preface.po | 257 +- .../main/docbook/zh-CN/content/query_sql.po | 2612 ++-- .../main/docbook/zh-CN/content/session_api.po | 2806 ++-- .../main/docbook/zh-CN/content/tutorial.po | 4132 +++--- 80 files changed, 116523 insertions(+), 37619 deletions(-) create mode 100644 documentation/manual/src/main/docbook/de-DE/content/additionalmodules.po diff --git a/documentation/manual/src/main/docbook/de-DE/HIBERNATE_-_Relational_Persistence_for_Idiomatic_Java.po b/documentation/manual/src/main/docbook/de-DE/HIBERNATE_-_Relational_Persistence_for_Idiomatic_Java.po index 516596c6ee..d10d77553c 100644 --- a/documentation/manual/src/main/docbook/de-DE/HIBERNATE_-_Relational_Persistence_for_Idiomatic_Java.po +++ b/documentation/manual/src/main/docbook/de-DE/HIBERNATE_-_Relational_Persistence_for_Idiomatic_Java.po @@ -1,14 +1,14 @@ -# +# # AUTHOR , YEAR. # msgid "" msgstr "" "Project-Id-Version: 0\n" -"POT-Creation-Date: 2010-02-11T05:38:14\n" +"Report-Msgid-Bugs-To: http://bugs.kde.org\n" +"POT-Creation-Date: 2010-07-20 21:02+0000\n" "PO-Revision-Date: 2010-02-11T05:38:14\n" "Last-Translator: Automatically generated\n" "Language-Team: None\n" "MIME-Version: 1.0\n" "Content-Type: application/x-publican; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" - diff --git a/documentation/manual/src/main/docbook/de-DE/author_group.po b/documentation/manual/src/main/docbook/de-DE/author_group.po index 36dbc2487b..f80a2377d7 100644 --- a/documentation/manual/src/main/docbook/de-DE/author_group.po +++ b/documentation/manual/src/main/docbook/de-DE/author_group.po @@ -1,10 +1,11 @@ -# +# # AUTHOR , YEAR. # msgid "" msgstr "" "Project-Id-Version: 0\n" -"POT-Creation-Date: 2010-02-11T05:38:14\n" +"Report-Msgid-Bugs-To: http://bugs.kde.org\n" +"POT-Creation-Date: 2010-07-20 21:02+0000\n" "PO-Revision-Date: 2010-02-11T05:38:14\n" "Last-Translator: Automatically generated\n" "Language-Team: None\n" @@ -12,138 +13,215 @@ msgstr "" "Content-Type: application/x-publican; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" -#. Tag: firstname +#. Tag: author +#: author_group.xml:28 #, no-c-format -msgid "Gavin" +msgid "Gavin King" msgstr "" -#. Tag: firstname +#. Tag: author +#: author_group.xml:32 #, no-c-format -msgid "Christian" +msgid "Christian Bauer" msgstr "" -#. Tag: firstname +#. Tag: author +#: author_group.xml:36 #, no-c-format -msgid "Max" +msgid "" +"Max Rydahl Andersen" msgstr "" -#. Tag: firstname +#. Tag: author +#: author_group.xml:41 #, no-c-format -msgid "Emmanuel" +msgid "" +"Emmanuel Bernard" msgstr "" -#. Tag: firstname +#. Tag: author +#: author_group.xml:45 #, no-c-format -msgid "Steve" +msgid "Steve Ebersole" msgstr "" -#. Tag: firstname +#. Tag: author +#: author_group.xml:49 #, no-c-format -msgid "James" +msgid "Hardy Ferentschik" msgstr "" -#. Tag: firstname +#. Tag: othercredit +#: author_group.xml:54 #, no-c-format -msgid "Cheyenne" +msgid "James Cobb" msgstr "" -#. Tag: firstname +#. Tag: shortaffil +#: author_group.xml:58 author_group.xml:65 #, no-c-format -msgid "Vincent" +msgid "Graphic Design" msgstr "" -#. Tag: firstname +#. Tag: othercredit +#: author_group.xml:61 #, no-c-format -msgid "Sebastien" +msgid "Cheyenne Weaver" msgstr "" -#. Tag: firstname +#. Tag: othercredit +#: author_group.xml:74 #, no-c-format -msgid "Michael" +msgid "" +" " +"kreimer@bbs.frc.utn.edu.ar" msgstr "" -#. Tag: firstname +#. Tag: othercredit +#: author_group.xml:84 #, no-c-format -msgid "Baptiste" +msgid "Vincent Ricard" msgstr "" -#. Tag: firstname +#. Tag: othercredit +#: author_group.xml:88 #, no-c-format -msgid "Anthony" +msgid "Sebastien Cesbron" msgstr "" -#. Tag: firstname +#. Tag: othercredit +#: author_group.xml:92 #, no-c-format -msgid "Alvaro" +msgid "Michael Courcy" msgstr "" -#. Tag: firstname +#. Tag: othercredit +#: author_group.xml:96 #, no-c-format -msgid "Anderson" +msgid "Vincent Giguère" msgstr "" -#. Tag: firstname +#. Tag: othercredit +#: author_group.xml:100 #, no-c-format -msgid "Daniel Vieira" +msgid "Baptiste Mathus" msgstr "" -#. Tag: firstname +#. Tag: othercredit +#: author_group.xml:104 #, no-c-format -msgid "Francisco" +msgid "" +"Emmanuel Bernard" msgstr "" -#. Tag: firstname +#. Tag: othercredit +#: author_group.xml:108 #, no-c-format -msgid "Gamarra" +msgid "Anthony Patricio" msgstr "" -#. Tag: firstname +#. Tag: othercredit +#: author_group.xml:118 #, no-c-format -msgid "Luiz Carlos" +msgid "" +"Alvaro Netto " +"alvaronetto@cetip.com.br" msgstr "" -#. Tag: firstname +#. Tag: othercredit +#: author_group.xml:123 #, no-c-format -msgid "Marcel" +msgid "" +"Anderson Braulio " +"andersonbraulio@gmail.com" msgstr "" -#. Tag: firstname +#. Tag: othercredit +#: author_group.xml:128 #, no-c-format -msgid "Paulo" +msgid "" +"Daniel Vieira Costa " +"danielvc@gmail.com" msgstr "" -#. Tag: firstname +#. Tag: othercredit +#: author_group.xml:133 #, no-c-format -msgid "Pablo L." +msgid "" +"Francisco gamarra francisco." +"gamarra@gmail.com" msgstr "" -#. Tag: firstname +#. Tag: othercredit +#: author_group.xml:138 #, no-c-format -msgid "Renato" +msgid "" +"Gamarra mauricio.gamarra@gmail.com" msgstr "" -#. Tag: firstname +#. Tag: othercredit +#: author_group.xml:142 #, no-c-format -msgid "Rogério" +msgid "" +"Luiz Carlos Rodrigues " +"luizcarlos_rodrigues@yahoo.com.br" msgstr "" -#. Tag: firstname +#. Tag: othercredit +#: author_group.xml:147 #, no-c-format -msgid "Wanderson" +msgid "" +"Marcel Castelo marcel." +"castelo@gmail.com" msgstr "" -#. Tag: firstname +#. Tag: othercredit +#: author_group.xml:152 #, no-c-format -msgid "Cao" +msgid "" +"Paulo César paulocol@gmail." +"com" msgstr "" -#. Tag: orgname +#. Tag: othercredit +#: author_group.xml:157 #, no-c-format -msgid "RedSaga" +msgid "" +"Pablo L. de Miranda " +"pablolmiranda@gmail.com" msgstr "" -#. Tag: contrib +#. Tag: othercredit +#: author_group.xml:162 #, no-c-format -msgid "Translation Lead" +msgid "" +"Renato Deggau rdeggau@gmail." +"com" msgstr "" +#. Tag: othercredit +#: author_group.xml:167 +#, no-c-format +msgid "" +"Rogério Araújo " +"rgildoaraujo@yahoo.com.br" +msgstr "" + +#. Tag: othercredit +#: author_group.xml:172 +#, no-c-format +msgid "" +"Wanderson Siqueira " +"wandersonxs@gmail.com" +msgstr "" + +#. Tag: othercredit +#: author_group.xml:183 +#, no-c-format +msgid "" +"Cao Xiaogang " +"RedSaga Translation Lead caoxg@yahoo.com" +msgstr "" diff --git a/documentation/manual/src/main/docbook/de-DE/content/additionalmodules.po b/documentation/manual/src/main/docbook/de-DE/content/additionalmodules.po new file mode 100644 index 0000000000..fbea2fe38f --- /dev/null +++ b/documentation/manual/src/main/docbook/de-DE/content/additionalmodules.po @@ -0,0 +1,439 @@ +# Language de-DE translations for PACKAGE package. +# Automatically generated, 2010. +# +msgid "" +msgstr "" +"Project-Id-Version: PACKAGE VERSION\n" +"Report-Msgid-Bugs-To: http://bugs.kde.org\n" +"POT-Creation-Date: 2010-07-20 21:02+0000\n" +"PO-Revision-Date: 2010-07-20 21:02+0000\n" +"Last-Translator: Automatically generated\n" +"Language-Team: none\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" + +#. Tag: title +#: additionalmodules.xml:28 +#, no-c-format +msgid "Additional modules" +msgstr "" + +#. Tag: para +#: additionalmodules.xml:30 +#, no-c-format +msgid "" +"Hibernate Core also offers integration with some external modules/projects. " +"This includes Hibernate Validator the reference implementation of Bean " +"Validation (JSR 303) and Hibernate Search." +msgstr "" + +#. Tag: title +#: additionalmodules.xml:35 +#, no-c-format +msgid "Bean Validation" +msgstr "" + +#. Tag: para +#: additionalmodules.xml:37 +#, no-c-format +msgid "" +"Bean Validation standardizes how to define and declare domain model level " +"constraints. You can, for example, express that a property should never be " +"null, that the account balance should be strictly positive, etc. These " +"domain model constraints are declared in the bean itself by annotating its " +"properties. Bean Validation can then read them and check for constraint " +"violations. The validation mechanism can be executed in different layers in " +"your application without having to duplicate any of these rules " +"(presentation layer, data access layer). Following the DRY principle, Bean " +"Validation and its reference implementation Hibernate Validator has been " +"designed for that purpose." +msgstr "" + +#. Tag: para +#: additionalmodules.xml:48 +#, no-c-format +msgid "" +"The integration between Hibernate and Bean Validation works at two levels. " +"First, it is able to check in-memory instances of a class for constraint " +"violations. Second, it can apply the constraints to the Hibernate metamodel " +"and incorporate them into the generated database schema." +msgstr "" + +#. Tag: para +#: additionalmodules.xml:54 +#, no-c-format +msgid "" +"Each constraint annotation is associated to a validator implementation " +"responsible for checking the constraint on the entity instance. A validator " +"can also (optionally) apply the constraint to the Hibernate metamodel, " +"allowing Hibernate to generate DDL that expresses the constraint. With the " +"appropriate event listener, you can execute the checking operation on " +"inserts, updates and deletes done by Hibernate." +msgstr "" + +#. Tag: para +#: additionalmodules.xml:62 +#, no-c-format +msgid "" +"When checking instances at runtime, Hibernate Validator returns information " +"about constraint violations in a set of ConstraintViolations. Among other information, the ConstraintViolation contains an error description message that can embed the " +"parameter values bundle with the annotation (eg. size limit), and message " +"strings that may be externalized to a ResourceBundle." +msgstr "" + +#. Tag: title +#: additionalmodules.xml:71 +#, no-c-format +msgid "Adding Bean Validation" +msgstr "" + +#. Tag: para +#: additionalmodules.xml:73 +#, no-c-format +msgid "" +"To enable Hibernate's Bean Validation integration, simply add a Bean " +"Validation provider (preferably Hibernate Validation 4) on your classpath." +msgstr "" + +#. Tag: title +#: additionalmodules.xml:79 +#, no-c-format +msgid "Configuration" +msgstr "" + +#. Tag: para +#: additionalmodules.xml:81 +#, no-c-format +msgid "By default, no configuration is necessary." +msgstr "" + +#. Tag: para +#: additionalmodules.xml:83 +#, no-c-format +msgid "" +"The Default group is validated on entity insert and " +"update and the database model is updated accordingly based on the " +"Default group as well." +msgstr "" + +#. Tag: para +#: additionalmodules.xml:87 +#, no-c-format +msgid "" +"You can customize the Bean Validation integration by setting the validation " +"mode. Use the javax.persistence.validation.mode property " +"and set it up for example in your persistence.xml file " +"or your hibernate.cfg.xml file. Several options are " +"possible:" +msgstr "" + +#. Tag: para +#: additionalmodules.xml:96 +#, no-c-format +msgid "" +"auto (default): enable integration between Bean " +"Validation and Hibernate (callback and ddl generation) only if Bean " +"Validation is present in the classpath." +msgstr "" + +#. Tag: para +#: additionalmodules.xml:102 +#, no-c-format +msgid "" +"none: disable all integration between Bean Validation and " +"Hibernate" +msgstr "" + +#. Tag: para +#: additionalmodules.xml:107 +#, no-c-format +msgid "" +"callback: only validate entities when they are either " +"inserted, updated or deleted. An exception is raised if no Bean Validation " +"provider is present in the classpath." +msgstr "" + +#. Tag: para +#: additionalmodules.xml:113 +#, no-c-format +msgid "" +"ddl: only apply constraints to the database schema when " +"generated by Hibernate. An exception is raised if no Bean Validation " +"provider is present in the classpath. This value is not defined by the Java " +"Persistence spec and is specific to Hibernate." +msgstr "" + +#. Tag: para +#: additionalmodules.xml:122 +#, no-c-format +msgid "" +"You can use both callback and ddl " +"together by setting the property to callback, dll" +msgstr "" + +#. Tag: programlisting +#: additionalmodules.xml:126 +#, no-c-format +msgid "" +"<persistence ...>\n" +" <persistence-unit ...>\n" +" ...\n" +" <properties>\n" +" <property name=\"javax.persistence.validation.mode\"\n" +" value=\"callback, ddl\"/>\n" +" </properties>\n" +" </persistence-unit>\n" +"</persistence>" +msgstr "" + +#. Tag: para +#: additionalmodules.xml:128 +#, no-c-format +msgid "" +"This is equivalent to auto except that if no Bean " +"Validation provider is present, an exception is raised." +msgstr "" + +#. Tag: para +#: additionalmodules.xml:132 +#, no-c-format +msgid "" +"If you want to validate different groups during insertion, update and " +"deletion, use:" +msgstr "" + +#. Tag: para +#: additionalmodules.xml:137 +#, no-c-format +msgid "" +"javax.persistence.validation.group.pre-persist: groups " +"validated when an entity is about to be persisted (default to " +"Default)" +msgstr "" + +#. Tag: para +#: additionalmodules.xml:143 +#, no-c-format +msgid "" +"javax.persistence.validation.group.pre-update: groups " +"validated when an entity is about to be updated (default to " +"Default)" +msgstr "" + +#. Tag: para +#: additionalmodules.xml:149 +#, no-c-format +msgid "" +"javax.persistence.validation.group.pre-remove: groups " +"validated when an entity is about to be deleted (default to no group)" +msgstr "" + +#. Tag: para +#: additionalmodules.xml:155 +#, no-c-format +msgid "" +"org.hibernate.validator.group.ddl: groups considered when " +"applying constraints on the database schema (default to Default)" +msgstr "" + +#. Tag: para +#: additionalmodules.xml:161 +#, no-c-format +msgid "" +"Each property accepts the fully qualified class names of the groups " +"validated separated by a comma (,)" +msgstr "" + +#. Tag: title +#: additionalmodules.xml:165 +#, no-c-format +msgid "Using custom groups for validation" +msgstr "" + +#. Tag: programlisting +#: additionalmodules.xml:167 +#, no-c-format +msgid "" +"<persistence ...>\n" +" <persistence-unit ...>\n" +" ...\n" +" <properties>\n" +" <property name=\"javax.persistence.validation.group.pre-update\"\n" +" value=\"javax.validation.group.Default, com.acme.group.Strict" +"\"/>\n" +" <property name=\"javax.persistence.validation.group.pre-remove\"\n" +" value=\"com.acme.group.OnDelete\"/>\n" +" <property name=\"org.hibernate.validator.group.ddl\"\n" +" value=\"com.acme.group.DDL\"/>\n" +" </properties>\n" +" </persistence-unit>\n" +"</persistence>" +msgstr "" + +#. Tag: para +#: additionalmodules.xml:171 +#, no-c-format +msgid "" +"You can set these properties in hibernate.cfg.xml, " +"hibernate.properties or programmatically." +msgstr "" + +#. Tag: title +#: additionalmodules.xml:178 +#, no-c-format +msgid "Catching violations" +msgstr "" + +#. Tag: para +#: additionalmodules.xml:180 +#, no-c-format +msgid "" +"If an entity is found to be invalid, the list of constraint violations is " +"propagated by the ConstraintViolationException which " +"exposes the set of ConstraintViolations." +msgstr "" + +#. Tag: para +#: additionalmodules.xml:185 +#, no-c-format +msgid "" +"This exception is wrapped in a RollbackException when " +"the violation happens at commit time. Otherwise the " +"ConstraintViolationException is returned (for example " +"when calling flush(). Note that generally, " +"catchable violations are validated at a higher level (for example in Seam / " +"JSF 2 via the JSF - Bean Validation integration or in your business layer by " +"explicitly calling Bean Validation)." +msgstr "" + +#. Tag: para +#: additionalmodules.xml:194 +#, no-c-format +msgid "" +"An application code will rarely be looking for a " +"ConstraintViolationException raised by Hibernate. " +"This exception should be treated as fatal and the persistence context should " +"be discarded (EntityManager or Session)." +msgstr "" + +#. Tag: title +#: additionalmodules.xml:202 +#, no-c-format +msgid "Database schema" +msgstr "" + +#. Tag: para +#: additionalmodules.xml:204 +#, no-c-format +msgid "" +"Hibernate uses Bean Validation constraints to generate an accurate database " +"schema:" +msgstr "" + +#. Tag: para +#: additionalmodules.xml:209 +#, no-c-format +msgid "" +"@NotNull leads to a not null column (unless it " +"conflicts with components or table inheritance)" +msgstr "" + +#. Tag: para +#: additionalmodules.xml:214 +#, no-c-format +msgid "" +"@Size.max leads to a varchar(max) " +"definition for Strings" +msgstr "" + +#. Tag: para +#: additionalmodules.xml:219 +#, no-c-format +msgid "" +"@Min, @Max lead to column " +"checks (like value <= max)" +msgstr "" + +#. Tag: para +#: additionalmodules.xml:224 +#, no-c-format +msgid "" +"@Digits leads to the definition of precision and " +"scale (ever wondered which is which? It's easy now with @Digits :) )" +msgstr "" + +#. Tag: para +#: additionalmodules.xml:230 +#, no-c-format +msgid "" +"These constraints can be declared directly on the entity properties or " +"indirectly by using constraint composition." +msgstr "" + +#. Tag: para +#: additionalmodules.xml:233 +#, no-c-format +msgid "" +"For more information check the Hibernate Validator reference " +"documentation." +msgstr "" + +#. Tag: title +#: additionalmodules.xml:240 +#, no-c-format +msgid "Hibernate Search" +msgstr "" + +#. Tag: title +#: additionalmodules.xml:243 +#, no-c-format +msgid "Description" +msgstr "" + +#. Tag: para +#: additionalmodules.xml:245 +#, no-c-format +msgid "" +"Full text search engines like Apache Lucene are a " +"very powerful technology to bring free text/efficient queries to " +"applications. If suffers several mismatches when dealing with a object " +"domain model (keeping the index up to date, mismatch between the index " +"structure and the domain model, querying mismatch...) Hibernate Search " +"indexes your domain model thanks to a few annotations, takes care of the " +"database / index synchronization and brings you back regular managed objects " +"from free text queries. Hibernate Search is using Apache Lucene under the cover." +msgstr "" + +#. Tag: title +#: additionalmodules.xml:258 +#, no-c-format +msgid "Integration with Hibernate Annotations" +msgstr "" + +#. Tag: para +#: additionalmodules.xml:260 +#, no-c-format +msgid "" +"Hibernate Search integrates with Hibernate Core transparently provided that " +"the Hibernate Search jar is present on the classpath. If you do not wish to " +"automatically register Hibernate Search event listeners, you can set " +"hibernate.search.autoregister_listeners to false. Such a " +"need is very uncommon and not recommended." +msgstr "" + +#. Tag: para +#: additionalmodules.xml:267 +#, no-c-format +msgid "" +"Check the Hibernate Search reference documentation for " +"more information." +msgstr "" diff --git a/documentation/manual/src/main/docbook/de-DE/content/basic_mapping.po b/documentation/manual/src/main/docbook/de-DE/content/basic_mapping.po index 8947cdb52b..8ea584f33a 100644 --- a/documentation/manual/src/main/docbook/de-DE/content/basic_mapping.po +++ b/documentation/manual/src/main/docbook/de-DE/content/basic_mapping.po @@ -275,7 +275,7 @@ msgid "" msgstr "" "Project-Id-Version: Collection_Mapping\n" "Report-Msgid-Bugs-To: http://bugs.kde.org\n" -"POT-Creation-Date: 2010-02-11T05:38:15\n" +"POT-Creation-Date: 2010-07-20 21:02+0000\n" "PO-Revision-Date: 2007-02-26 10:27+1000\n" "Last-Translator: \n" "Language-Team: \n" @@ -285,22 +285,143 @@ msgstr "" "X-Generator: KBabel 1.9.1\n" #. Tag: title +#: basic_mapping.xml:31 #, no-c-format msgid "Basic O/R Mapping" msgstr "Grundlagen des O/R Mappings" #. Tag: title +#: basic_mapping.xml:34 #, no-c-format msgid "Mapping declaration" msgstr "Mapping-Deklaration" #. Tag: para +#: basic_mapping.xml:36 +#, no-c-format +msgid "Object/relational mappings can be defined in three approaches:" +msgstr "" + +#. Tag: para +#: basic_mapping.xml:41 +#, no-c-format +msgid "using Java 5 annotations (via the Java Persistence 2 annotations)" +msgstr "" + +#. Tag: para +#: basic_mapping.xml:46 +#, no-c-format +msgid "using JPA 2 XML deployment descriptors (described in chapter XXX)" +msgstr "" + +#. Tag: para +#: basic_mapping.xml:51 +#, no-c-format +msgid "using the Hibernate legacy XML files approach known as hbm.xml" +msgstr "" + +#. Tag: para +#: basic_mapping.xml:56 +#, no-c-format +msgid "" +"Annotations are split in two categories, the logical mapping annotations " +"(describing the object model, the association between two entities etc.) and " +"the physical mapping annotations (describing the physical schema, tables, " +"columns, indexes, etc). We will mix annotations from both categories in the " +"following code examples." +msgstr "" + +#. Tag: para +#: basic_mapping.xml:62 +#, no-c-format +msgid "" +"JPA annotations are in the javax.persistence.* package. " +"Hibernate specific extensions are in org.hibernate.annotations.*. You favorite IDE can auto-complete annotations and their " +"attributes for you (even without a specific \"JPA\" plugin, since JPA " +"annotations are plain Java 5 annotations)." +msgstr "" + +#. Tag: para +#: basic_mapping.xml:69 +#, fuzzy, no-c-format +msgid "Here is an example of mapping" +msgstr "Beginnen wir mit einem Beispiel-Mapping:" + +#. Tag: programlisting +#: basic_mapping.xml:71 +#, no-c-format +msgid "" +"package eg;\n" +"\n" +"@Entity \n" +"@Table(name=\"cats\") @Inheritance(strategy=SINGLE_TABLE)\n" +"@DiscriminatorValue(\"C\") @DiscriminatorColumn(name=\"subclass\", " +"discriminatorType=CHAR)\n" +"public class Cat {\n" +" \n" +" @Id @GeneratedValue\n" +" public Integer getId() { return id; }\n" +" public void setId(Integer id) { this.id = id; }\n" +" private Integer id;\n" +"\n" +" public BigDecimal getWeight() { return weight; }\n" +" public void setWeight(BigDecimal weight) { this.weight = weight; }\n" +" private BigDecimal weight;\n" +"\n" +" @Temporal(DATE) @NotNull @Column(updatable=false)\n" +" public Date getBirthdate() { return birthdate; }\n" +" public void setBirthdate(Date birthdate) { this.birthdate = birthdate; }\n" +" private Date birthdate;\n" +"\n" +" @org.hibernate.annotations.Type(type=\"eg.types.ColorUserType\")\n" +" @NotNull @Column(updatable=false)\n" +" public ColorType getColor() { return color; }\n" +" public void setColor(ColorType color) { this.color = color; }\n" +" private ColorType color;\n" +"\n" +" @NotNull @Column(updatable=false)\n" +" public String getSex() { return sex; }\n" +" public void setSex(String sex) { this.sex = sex; }\n" +" private String sex;\n" +"\n" +" @NotNull @Column(updatable=false)\n" +" public Integer getLitterId() { return litterId; }\n" +" public void setLitterId(Integer litterId) { this.litterId = litterId; }\n" +" private Integer litterId;\n" +"\n" +" @ManyToOne @JoinColumn(name=\"mother_id\", updatable=false)\n" +" public Cat getMother() { return mother; }\n" +" public void setMother(Cat mother) { this.mother = mother; }\n" +" private Cat mother;\n" +"\n" +" @OneToMany(mappedBy=\"mother\") @OrderBy(\"litterId\")\n" +" public Set<Cat> getKittens() { return kittens; }\n" +" public void setKittens(Set<Cat> kittens) { this.kittens = " +"kittens; }\n" +" private Set<Cat> kittens = new HashSet<Cat>();\n" +"}\n" +"\n" +"@Entity @DiscriminatorValue(\"D\")\n" +"public class DomesticCat extends Cat {\n" +"\n" +" public String getName() { return name; }\n" +" public void setName(String name) { this.name = name }\n" +" private String name;\n" +"}\n" +"\n" +"@Entity\n" +"public class Dog { ... }" +msgstr "" + +#. Tag: para +#: basic_mapping.xml:73 #, fuzzy, no-c-format msgid "" -"Object/relational mappings are usually defined in an XML document. The " -"mapping document is designed to be readable and hand-editable. The mapping " -"language is Java-centric, meaning that mappings are constructed around " -"persistent class declarations and not table declarations." +"The legacy hbm.xml approach uses an XML schema designed to be readable and " +"hand-editable. The mapping language is Java-centric, meaning that mappings " +"are constructed around persistent class declarations and not table " +"declarations." msgstr "" "Objekt/relationale Mappings sind in der Regel in einem XML-Dokument " "definiert. Das Mapping-Dokument ist so angelegt, dass es lesbar und manuell " @@ -309,6 +430,7 @@ msgstr "" "Deklarationen konstruiert." #. Tag: para +#: basic_mapping.xml:78 #, fuzzy, no-c-format msgid "" "Please note that even though many Hibernate users choose to write the XML by " @@ -320,18 +442,157 @@ msgstr "" "gibt, darunter XDoclet, Middlegen und AndroMDA." #. Tag: para +#: basic_mapping.xml:82 #, fuzzy, no-c-format msgid "Here is an example mapping:" msgstr "Beginnen wir mit einem Beispiel-Mapping:" -#. Tag: para +#. Tag: programlisting +#: basic_mapping.xml:84 #, fuzzy, no-c-format msgid "" -"We will now discuss the content of the mapping document. We will only " -"describe, however, the document elements and attributes that are used by " -"Hibernate at runtime. The mapping document also contains some extra optional " -"attributes and elements that affect the database schemas exported by the " -"schema export tool (for example, the not-null attribute)." +"<?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 name=\"Cat\"\n" +" table=\"cats\"\n" +" discriminator-value=\"C\">\n" +"\n" +" <id name=\"id\">\n" +" <generator class=\"native\"/>\n" +" </id>\n" +"\n" +" <discriminator column=\"subclass\"\n" +" type=\"character\"/>\n" +"\n" +" <property name=\"weight\"/>\n" +"\n" +" <property name=\"birthdate\"\n" +" type=\"date\"\n" +" not-null=\"true\"\n" +" update=\"false\"/>\n" +"\n" +" <property name=\"color\"\n" +" type=\"eg.types.ColorUserType\"\n" +" not-null=\"true\"\n" +" update=\"false\"/>\n" +"\n" +" <property name=\"sex\"\n" +" not-null=\"true\"\n" +" update=\"false\"/>\n" +"\n" +" <property name=\"litterId\"\n" +" column=\"litterId\"\n" +" update=\"false\"/>\n" +"\n" +" <many-to-one name=\"mother\"\n" +" column=\"mother_id\"\n" +" update=\"false\"/>\n" +"\n" +" <set name=\"kittens\"\n" +" inverse=\"true\"\n" +" order-by=\"litter_id\">\n" +" <key column=\"mother_id\"/>\n" +" <one-to-many class=\"Cat\"/>\n" +" </set>\n" +"\n" +" <subclass name=\"DomesticCat\"\n" +" discriminator-value=\"D\">\n" +"\n" +" <property name=\"name\"\n" +" type=\"string\"/>\n" +"\n" +" </subclass>\n" +"\n" +" </class>\n" +"\n" +" <class name=\"Dog\">\n" +" <!-- mapping for Dog could go here -->\n" +" </class>\n" +"\n" +"</hibernate-mapping>" +msgstr "" +"<?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 name=\"Cat\" \n" +" table=\"cats\"\n" +" discriminator-value=\"C\">\n" +" \n" +" <id name=\"id\">\n" +" <generator class=\"native\"/>\n" +" </id>\n" +"\n" +" <discriminator column=\"subclass\" \n" +" type=\"character\"/>\n" +"\n" +" <property name=\"weight\"/>\n" +"\n" +" <property name=\"birthdate\"\n" +" type=\"date\" \n" +" not-null=\"true\" \n" +" update=\"false\"/>\n" +"\n" +" <property name=\"color\"\n" +" type=\"eg.types.ColorUserType\"\n" +" not-null=\"true\"\n" +" update=\"false\"/>\n" +"\n" +" <property name=\"sex\"\n" +" not-null=\"true\" \n" +" update=\"false\"/>\n" +"\n" +" <property name=\"litterId\"\n" +" column=\"litterId\"\n" +" update=\"false\"/>\n" +"\n" +" <many-to-one name=\"mother\"\n" +" column=\"mother_id\"\n" +" update=\"false\"/>\n" +"\n" +" <set name=\"kittens\"\n" +" inverse=\"true\"\n" +" order-by=\"litter_id\">\n" +" <key column=\"mother_id\"/>\n" +" <one-to-many class=\"Cat\"/>\n" +" </set>\n" +"\n" +" <subclass name=\"DomesticCat\"\n" +" discriminator-value=\"D\">\n" +"\n" +" <property name=\"name\" \n" +" type=\"string\"/>\n" +"\n" +" </subclass>\n" +"\n" +" </class>\n" +"\n" +" <class name=\"Dog\">\n" +" <!-- mapping for Dog could go here -->\n" +" </class>\n" +"\n" +"</hibernate-mapping>" + +#. Tag: para +#: basic_mapping.xml:86 +#, fuzzy, no-c-format +msgid "" +"We will now discuss the concepts of the mapping documents (both annotations " +"and XML). We will only describe, however, the document elements and " +"attributes that are used by Hibernate at runtime. The mapping document also " +"contains some extra optional attributes and elements that affect the " +"database schemas exported by the schema export tool (for example, the " +" not-null attribute)." msgstr "" "Wir gehen nun auf den Inhalt des Mapping-Dokuments ein. Es werden nur die " "von Hibernate zur Runtime verwendeten Elemente und Attribute des Dokuments " @@ -341,343 +602,141 @@ msgstr "" "Attribut)." #. Tag: title +#: basic_mapping.xml:94 +#, fuzzy, no-c-format +msgid "Entity" +msgstr "identity" + +#. Tag: para +#: basic_mapping.xml:96 #, no-c-format -msgid "Doctype" -msgstr "Doctype" +msgid "" +"An entity is a regular Java object (aka POJO) which will be persisted by " +"Hibernate." +msgstr "" #. Tag: para -#, fuzzy, no-c-format -msgid "" -"All XML mappings should declare the doctype shown. The actual DTD can be " -"found at the URL above, in the directory hibernate-x.x.x/src/org/" -"hibernate , or in hibernate3.jar. Hibernate " -"will always look for the DTD in its classpath first. If you experience " -"lookups of the DTD using an Internet connection, check the DTD declaration " -"against the contents of your classpath." -msgstr "" -"Alle XML-Mappings sollten den gezeigten doctype deklarieren. Die " -"tatsächliche Dokumenttyp-Definition (\"DTD\") kann in der URL oben, im " -"Verzeichnis hibernate-x.x.x/src/org/hibernate oder in " -"hibernate3.jar gefunden werden. Hibernate wird stets " -"zuerst in seinem Klassenpfad nach der DTD suchen. Falls es bei Ihnen zu " -"Suchläufen der DTD mittels einer Internetverbindung kommt, überprüfen Sie " -"Ihre DTD-Deklaration hinsichtlich der Inhalte Ihres Klassenpfads." - -#. Tag: title +#: basic_mapping.xml:99 #, no-c-format -msgid "EntityResolver" -msgstr "EntityResolver" +msgid "" +"To mark an object as an entity in annotations, use the @Entity annotation." +msgstr "" + +#. Tag: programlisting +#: basic_mapping.xml:102 +#, no-c-format +msgid "" +"@Entity\n" +"public class Flight implements Serializable {\n" +" Long id;\n" +"\n" +" @Id\n" +" public Long getId() { return id; }\n" +"\n" +" public void setId(Long id) { this.id = id; }\n" +"}" +msgstr "" #. Tag: para +#: basic_mapping.xml:104 +#, no-c-format +msgid "" +"That's pretty much it, the rest is optional. There are however any options " +"to tweak your entity mapping, let's explore them." +msgstr "" + +#. Tag: para +#: basic_mapping.xml:107 +#, no-c-format +msgid "" +"@Table lets you define the table the entity will be " +"persisted into. If undefined, the table name is the unqualified class name " +"of the entity. You can also optionally define the catalog, the schema as " +"well as unique constraints on the table." +msgstr "" + +#. Tag: programlisting +#: basic_mapping.xml:112 +#, no-c-format +msgid "" +"@Entity\n" +"@Table(name=\"TBL_FLIGHT\", \n" +" schema=\"AIR_COMMAND\", \n" +" uniqueConstraints=\n" +" @UniqueConstraint(\n" +" name=\"flight_number\", \n" +" columnNames={\"comp_prefix\", \"flight_number\"} ) )\n" +"public class Flight implements Serializable {\n" +" @Column(name=\"comp_prefix\")\n" +" public String getCompagnyPrefix() { return companyPrefix; }\n" +"\n" +" @Column(name=\"flight_number\")\n" +" public String getNumber() { return number; }\n" +"}" +msgstr "" + +#. Tag: para +#: basic_mapping.xml:114 +#, no-c-format +msgid "" +"The constraint name is optional (generated if left undefined). The column " +"names composing the constraint correspond to the column names as defined " +"before the Hibernate NamingStrategy is applied." +msgstr "" + +#. Tag: para +#: basic_mapping.xml:119 +#, no-c-format +msgid "" +"@Entity.name lets you define the shortcut name of the " +"entity you can used in JP-QL and HQL queries. It defaults to the unqualified " +"class name of the class." +msgstr "" + +#. Tag: para +#: basic_mapping.xml:123 +#, no-c-format +msgid "" +"Hibernate goes beyond the JPA specification and provide additional " +"configurations. Some of them are hosted on @org.hibernate." +"annotations.Entity:" +msgstr "" + +#. Tag: para +#: basic_mapping.xml:129 #, fuzzy, no-c-format msgid "" -"Hibernate will first attempt to resolve DTDs in its classpath. It does this " -"is by registering a custom org.xml.sax.EntityResolver " -"implementation with the SAXReader it uses to read in the xml files. This " -"custom EntityResolver recognizes two different systemId " -"namespaces:" +"dynamicInsert / dynamicUpdate " +"(defaults to false): specifies that INSERT / " +"UPDATE SQL should be generated at runtime and contain " +"only the columns whose values are not null. The dynamic-update and dynamic-insert settings are not inherited by " +"subclasses. Although these settings can increase performance in some cases, " +"they can actually decrease performance in others." msgstr "" -"Wie bereits erwähnt, wird Hibernate zuerst versuchen, DTDs in seinem " -"Klassenpfad aufzulösen. Dies geschieht, indem eine anwenderdefinierte " -"org.xml.sax.EntityResolver-Implementierung mit dem " -"SAXReader, der zum Lesen der xml-Dateien verwendet wird, registriert wird. " -"Dieser anwenderorientierte EntityResolver erkennt zwei " -"verschiedene \"systemId\"-Namensräume." +"Bitte beachten Sie, dass die dynamic-update und " +"dynamic-insert Einstellungen nicht an die Subklassen " +"vererbt werden und daher auch in den <subclass> " +"oder <joined-subclass>-Elementen spezifiziert " +"werden können. Diese Einstellungen können die Performance in einigen Fällen " +"verbessern, in anderen Fällen jedoch auch verschlechtern. Verwenden Sie sie " +"daher umsichtig." #. Tag: para +#: basic_mapping.xml:140 #, fuzzy, no-c-format msgid "" -"a hibernate namespace is recognized whenever the resolver " -"encounters a systemId starting with http://hibernate.sourceforge." -"net/. The resolver attempts to resolve these entities via the " -"classloader which loaded the Hibernate classes." -msgstr "" -"ein hibernate namespace wird erkannt, sobald der " -"\"Resolver\" (Auflöser) einer mit http://hibernate.sourceforge.net/" -" beginnenden systemId begegnet. Der Resolver versucht diese " -"Entities über den Klassenlader (sog. \"Classloader\"), der die Hibernate-" -"Klassen geladen hat, aufzulösen." - -#. Tag: para -#, fuzzy, no-c-format -msgid "" -"a user namespace is recognized whenever the resolver " -"encounters a systemId using a classpath:// URL protocol. " -"The resolver will attempt to resolve these entities via (1) the current " -"thread context classloader and (2) the classloader which loaded the " -"Hibernate classes." -msgstr "" -"ein user namespace wird erkannt, sobald der Resolver " -"einem classpath:// URL-Protokoll verwendenden systemId " -"begegnet. Der Resolver wird versuchen, diese Entities über (1) den aktuellen " -"Thread-Kontext-Klassenlader und (2) den Klassenlader, der die Hibernate-" -"Klassen geladen hat, aufzulösen." - -#. Tag: para -#, fuzzy, no-c-format -msgid "The following is an example of utilizing user namespacing:" -msgstr "Ein Beispiel der Verwendung des Benutzer-Namespacing:" - -#. Tag: para -#, fuzzy, no-c-format -msgid "" -"Where types.xml is a resource in the your." -"domain package and contains a custom typedef." -msgstr "" -"Wo types.xml eine Ressource in im your.domain Paket ist und eine anwenderdefinierte -Typedef enthält." - -#. Tag: title -#, fuzzy, no-c-format -msgid "Hibernate-mapping" -msgstr "hibernate-mapping" - -#. Tag: para -#, fuzzy, no-c-format -msgid "" -"This element has several optional attributes. The schema " -"and catalog attributes specify that tables referred to in " -"this mapping belong to the named schema and/or catalog. If they are " -"specified, tablenames will be qualified by the given schema and catalog " -"names. If they are missing, tablenames will be unqualified. The " -"default-cascade attribute specifies what cascade style " -"should be assumed for properties and collections that do not specify a " -"cascade attribute. By default, the auto-import attribute allows you to use unqualified class names in the query " -"language." -msgstr "" -"Dieses Element besitzt mehrere optionale Attribute. Die schema und catalog-Attribute spezifizieren, dass die in " -"diesem Mapping aufgeführten Tabellen zum genannten Schema und/oder Katalog " -"gehören. Falls bestimmt, werden Tabellennamen durch die gegebenen Schema- " -"und Katalognamen definiert. Falls nicht vorhanden, so bleiben die " -"Tabellennamen undefiniert. Das default-cascade-Attribut " -"bestimmt, welcher Weitergabestil (sog. \"Cascade-Style\" für Properties und " -"Collections angenommen werden sollte, die kein cascade-" -"Attribut spezifizieren. Das auto-import-Attribut erlaubt " -"die Verwendung undefinierter Klassennamen in der Abfragensprache in der " -"Standardeinstellung." - -#. Tag: para -#, fuzzy, no-c-format -msgid "schema (optional): the name of a database schema." -msgstr "schema (optional): Der Name eines Datenbankschemas." - -#. Tag: para -#, fuzzy, no-c-format -msgid "catalog (optional): the name of a database catalog." -msgstr "" -"catalog (optional): Der Name eines Datenbankkatalogs." - -#. Tag: para -#, fuzzy, no-c-format -msgid "" -"default-cascade (optional - defaults to none): a default cascade style." -msgstr "" -"default-cascade (optional - die Standardeinstellung " -"lautet none): Ein standardmäßiger Weitergabestil " -"(\"Cascade-Style\")." - -#. Tag: para -#, fuzzy, no-c-format -msgid "" -"default-access (optional - defaults to property): the strategy Hibernate should use for accessing all properties. " -"It can be a custom implementation of PropertyAccessor." -msgstr "" -"default-access (optional - der Standard ist " -"property): Die Strategie, die Hibernate für den Zugriff " -"auf alle Properties benutzen sollte. Kann eine anwenderdefinierte " -"Implementierung von PropertyAccessor sein." - -#. Tag: para -#, fuzzy, no-c-format -msgid "" -"default-lazy (optional - defaults to true): the default value for unspecified lazy " -"attributes of class and collection mappings." -msgstr "" -"default-lazy (optional - die Standardeinstellung lautet " -"true): Der Standardwert für nicht spezifizierte " -"lazy Attribute von Klassen- und Collection-Mappings." - -#. Tag: para -#, fuzzy, no-c-format -msgid "" -"auto-import (optional - defaults to true): specifies whether we can use unqualified class names of classes " -"in this mapping in the query language." -msgstr "" -"auto-import (optional - die Standardeinstellung lautet " -"true): Legt fest, ob in der Abfragensprache ein " -"undefinierter Klassenname verwendet werden kann (von Klassen in diesem " -"Mapping)." - -#. Tag: para -#, fuzzy, no-c-format -msgid "" -"package (optional): specifies a package prefix to use for " -"unqualified class names in the mapping document." -msgstr "" -"package (optional): Spezifiziert einen Paket-Präfix, der " -"für undefinierte Klassennamen im Mapping-Dokument angenommen werden soll." - -#. Tag: para -#, fuzzy, no-c-format -msgid "" -"If you have two persistent classes with the same unqualified name, you " -"should set auto-import=\"false\". An exception will " -"result if you attempt to assign two classes to the same \"imported\" name." -msgstr "" -"Falls Sie zwei persistente Klassen mit demselben (undefinierten) Namen " -"besitzen, sollten Sie die Einstellung auto-import=\"false\" vornehmen. Hibernate wird eine Ausnahme melden, wenn Sie versuchen, " -"zwei Klassen demselben \"importierten\" Namen zuzuordnen." - -#. Tag: para -#, fuzzy, no-c-format -msgid "" -"The hibernate-mapping element allows you to nest several " -"persistent <class> mappings, as shown above. It is, " -"however, good practice (and expected by some tools) to map only a single " -"persistent class, or a single class hierarchy, in one mapping file and name " -"it after the persistent superclass. For example, Cat.hbm.xml, Dog.hbm.xml, or if using inheritance, " -"Animal.hbm.xml." -msgstr "" -"Bitte beachten Sie, dass das hibernate-mapping-Element es " -"Ihnen ermöglicht, mehrere persistente <class>-" -"Mappings (wie oben dargestellt) zu verschachteln. Es ist jedoch eine gute " -"Angewohnheit (und wird von einigen Tools vorausgesetzt) nur eine einzelne " -"persistente Klasse (oder eine Einzelklassenhierarchie) in einer Mapping-" -"Datei zu mappen und diese nach der persistenten Superklasse zu benennen, z." -"B. Cat.hbm.xml, Dog.hbm.xml oder - " -"falls Sie \"Inheritance\" (d.h. Vererbung) verwenden - Animal.hbm." -"xml." - -#. Tag: title -#, fuzzy, no-c-format -msgid "Class" -msgstr "subclass" - -#. Tag: para -#, fuzzy, no-c-format -msgid "" -"You can declare a persistent class using the class " -"element. For example:" -msgstr "" -"Sie können unter Verwendung des class-Elements eine " -"persistente Klasse deklarieren:" - -#. Tag: para -#, fuzzy, no-c-format -msgid "" -"name (optional): the fully qualified Java class name of " -"the persistent class or interface. If this attribute is missing, it is " -"assumed that the mapping is for a non-POJO entity." -msgstr "" -"name (optional): Der vollständige Java-Klassenname der " -"persistenten Klasse (oder des Interface). Falls dieses Attribut fehlt, wird " -"angenommen, dass es sich um das Mapping für eine nicht-POJO Entity handelt." - -#. Tag: para -#, fuzzy, no-c-format -msgid "" -"table (optional - defaults to the unqualified class " -"name): the name of its database table." -msgstr "" -"table (optional - Standardeinstellung ist der " -"undefinierte Klassenname): Der Name der Datenbanktabelle." - -#. Tag: para -#, fuzzy, no-c-format -msgid "" -"discriminator-value (optional - defaults to the class " -"name): a value that distinguishes individual subclasses that is used for " -"polymorphic behavior. Acceptable values include null and " -"not null." -msgstr "" -"discriminator-value (optional - Standard ist der " -"Klassenname): Ein Wert, der zwischen individuellen Subklassen unterscheidet " -"und für polymorphes Verhalten verwendet wird. Akzeptierte Werte sind " -"null und not null." - -#. Tag: para -#, fuzzy, no-c-format -msgid "" -"mutable (optional - defaults to true): " -"specifies that instances of the class are (not) mutable." -msgstr "" -"mutable (optional, Standardeinstellung true): Legt fest, dass die Instanzen der Klasse (nicht) variabel sind." - -#. Tag: para -#, fuzzy, no-c-format -msgid "" -"schema (optional): overrides the schema name specified by " -"the root <hibernate-mapping> element." -msgstr "" -"schema (optional): Setzt den vom Hauptverzeichnis " -"<hibernate-mapping>-Element spezifizierten " -"Schemanamen außer Kraft." - -#. Tag: para -#, fuzzy, no-c-format -msgid "" -"catalog (optional): overrides the catalog name specified " -"by the root <hibernate-mapping> element." -msgstr "" -"catalog (optional): Setzt den vom Hauptverzeichnis (\"Root" -"\") <hibernate-mapping>-Element spezifizierten " -"Katalognamen außer Kraft." - -#. Tag: para -#, fuzzy, no-c-format -msgid "" -"proxy (optional): specifies an interface to use for lazy " -"initializing proxies. You can specify the name of the class itself." -msgstr "" -"proxy (optional): Bestimmt ein zu verwendendes Interface " -"für die Initialisierung von Proxies nur bei Bedarf (sog. \"Lazy Initializing " -"Proxies\"). Sie können den Namen der Klasse selbst festlegen." - -#. Tag: para -#, fuzzy, no-c-format -msgid "" -"dynamic-update (optional - defaults to false): specifies that UPDATE SQL should be generated " -"at runtime and can contain only those columns whose values have changed." -msgstr "" -"dynamic-update (optional, Standardeinstellung " -"false): Bestimmt, dass UPDATE SQL zur " -"Runtime generiert wird und nur diejenigen Spalten enthalten soll, deren " -"Werte sich geändert haben." - -#. Tag: para -#, fuzzy, no-c-format -msgid "" -"dynamic-insert (optional - defaults to false): specifies that INSERT SQL should be generated " -"at runtime and contain only the columns whose values are not null." -msgstr "" -"dynamic-insert (optional, Standardeinstellung " -"false): Bestimmt, dass INSERT SQL zur " -"Runtime generiert wird und nur diejenigen Spalten enthalten soll, deren " -"Werte nicht \"Null\" sind." - -#. Tag: para -#, fuzzy, no-c-format -msgid "" -"select-before-update (optional - defaults to " -"false): specifies that Hibernate should never perform an SQL UPDATE unless it is certain that " -"an object is actually modified. Only when a transient object has been " -"associated with a new session using update(), will " -"Hibernate perform an extra SQL SELECT to determine if an " -"UPDATE is actually required." +"selectBeforeUpdate (defaults to false): specifies that " +"Hibernate should never perform an SQL UPDATE unless it is certain that an object is actually modified. Only when " +"a transient object has been associated with a new session using " +"update(), will Hibernate perform an extra SQL " +"SELECT to determine if an UPDATE is " +"actually required. Use of select-before-update will " +"usually decrease performance. It is useful to prevent a database update " +"trigger being called unnecessarily if you reattach a graph of detached " +"instances to a Session." msgstr "" "select-before-update (optional, Standardeinstellung " "false): Bestimmt, dass Hibernate nie " @@ -689,191 +748,20 @@ msgstr "" "bestimmen, ob ein UPDATE tatsächlich erforderlich ist." #. Tag: para +#: basic_mapping.xml:154 #, fuzzy, no-c-format msgid "" -"polymorphism (optional - defaults to implicit): determines whether implicit or explicit query polymorphism is " -"used." -msgstr "" -"polymorphism (optional, Standardeinstellung " -"implicit): Bestimmt, ob implizite oder explizite " -"Polymorphie für Anfragen verwendet wird." - -#. Tag: para -#, fuzzy, no-c-format -msgid "" -"where (optional): specifies an arbitrary SQL " -"WHERE condition to be used when retrieving objects of " -"this class." -msgstr "" -"where (optional) legt eine beliebige SQL WHERE-Bedingung zur Verwendung beim Aufruf von Objekten dieser Klasse fest" - -#. Tag: para -#, fuzzy, no-c-format -msgid "" -"persister (optional): specifies a custom " -"ClassPersister." -msgstr "" -"persister (optional): Spezifiziert einen " -"anwenderdefinierten ClassPersister." - -#. Tag: para -#, fuzzy, no-c-format -msgid "" -"batch-size (optional - defaults to 1): " -"specifies a \"batch size\" for fetching instances of this class by " -"identifier." -msgstr "" -"batch-size (optional, Standardeinstellung 1) bestimmt eine Stapelgröße (sog. \"Batch Size\") für den Abruf von " -"Instanzen dieser Klasse durch den Bezeichner." - -#. Tag: para -#, fuzzy, no-c-format -msgid "" -"optimistic-lock (optional - defaults to version): determines the optimistic locking strategy." -msgstr "" -"optimistic-lock (optional, die Standardeinstellung lautet " -"version): Bestimmt die Strategie für das optimistische " -"Sperren (sog. \"Optimistic Locking\")." - -#. Tag: para -#, fuzzy, no-c-format -msgid "" -"lazy (optional): lazy fetching can be disabled by setting " -"lazy=\"false\"." -msgstr "" -"lazy (optional): Mit der Einstellung lazy=\"false" -"\" deaktivieren Sie \"Lazy Fetching\" (d.h. das Nachladen " -"assoziierter Objekte bei Bedarf) vollständig." - -#. Tag: para -#, fuzzy, no-c-format -msgid "" -"entity-name (optional - defaults to the class name): " -"Hibernate3 allows a class to be mapped multiple times, potentially to " -"different tables. It also allows entity mappings that are represented by " -"Maps or XML at the Java level. In these cases, you should provide an " -"explicit arbitrary name for the entity. See and for more information." -msgstr "" -"entity-name (optional, Standardeinstellung ist der " -"Klassenname): Hibernate3 ermöglicht das mehrfache Mappen einer Klasse " -"(eventuell zu verschiedenen Tabellen) sowie durch Maps oder XML " -"repräsentierte Entity-Mappings auf Java-Ebene. In diesen Fällen sollte Sie " -"einen expliziten arbiträren Namen für die Entity bereitstellen. Unter und " -"finden Sie weitere Information hierzu." - -#. Tag: para -#, fuzzy, no-c-format -msgid "" -"check (optional): an SQL expression used to generate a " -"multi-row check constraint for automatic schema " -"generation." -msgstr "" -"check (optional): Ein SQL-Ausdruck wird verwendet, um " -"eine Datenüberprüfungsbedingung mehrerer Reihen für die " -"automatische Schemagenerierung zu erstellen. " - -#. Tag: para -#, fuzzy, no-c-format -msgid "" -"rowid (optional): Hibernate can use ROWIDs on databases. " -"On Oracle, for example, Hibernate can use the rowid extra " -"column for fast updates once this option has been set to rowid. A ROWID is an implementation detail and represents the physical " -"location of a stored tuple." -msgstr "" -"rowid (optional): Hibernate kann so genannte ROWIDs bei " -"Datenbanken verwenden, die z.B. Oracle unterstützen. Hibernate kann die " -"Extraspalte vonrowid für schnelle Aktualisierungen " -"verwenden, wenn Sie diese Option mit der Einstellung rowid wählen. Eine ROWID ist ein Implementierungsdetail und repräsentiert " -"den realen Standort eines gespeicherten Tupel." - -#. Tag: para -#, fuzzy, no-c-format -msgid "" -"subselect (optional): maps an immutable and read-only " -"entity to a database subselect. This is useful if you want to have a view " -"instead of a base table. See below for more information." -msgstr "" -"subselect (optional): Mappt eine unveränderbare und " -"schreibgeschützte Entity zu einer Datenbankunterauswahl (sog. \"Database " -"Subselect\"). Das ist von Nutzen, wenn Sie statt der Basistabelle eine " -"Ansicht wünschen, aber nicht haben. Weitere Informationen finden Sie unten." - -#. Tag: para -#, fuzzy, no-c-format -msgid "" -"abstract (optional): is used to mark abstract " -"superclasses in <union-subclass> hierarchies." -msgstr "" -"abstract (optional): Wird verwendet, um abstrakte " -"Superklassen in <union-subclass>-Hierarchien zu " -"kennzeichnen." - -#. Tag: para -#, fuzzy, no-c-format -msgid "" -"It is acceptable for the named persistent class to be an interface. You can " -"declare implementing classes of that interface using the <" -"subclass> element. You can persist any static inner class. Specify the class name using the standard form i.e. " -"e.g.Foo$Bar." -msgstr "" -"Es ist völlig in Ordnung, wenn es sich bei der benannten persistenten Klasse " -"um ein Interface handelt. Sie würden in diesem Fall implemetierende Klassen " -"dieses Interface unter Verwendung des <subclass>-" -"Elements deklarieren. Sie können jegliche static innere " -"Klassen (sog. \"inner class\") persistieren. Der Klassenname sollte unter " -"Verwendung des Standardformulars d.h. eg.Foo$Bar " -"spezifiziert werden." - -#. Tag: para -#, fuzzy, no-c-format -msgid "" -"Immutable classes, mutable=\"false\", cannot be updated " -"or deleted by the application. This allows Hibernate to make some minor " -"performance optimizations." -msgstr "" -"Unveränderliche Klassen, mutable=\"false\", können durch " -"die Anwendung nicht aktualisiert oder gelöscht werden. Dies ermöglicht " -"Hibernate kleinere Optimierungen hinsichtlich der Performance." - -#. Tag: para -#, fuzzy, no-c-format -msgid "" -"The optional proxy attribute enables lazy initialization " -"of persistent instances of the class. Hibernate will initially return CGLIB " -"proxies that implement the named interface. The persistent object will load " -"when a method of the proxy is invoked. See \"Initializing collections and " -"proxies\" below." -msgstr "" -"Das optionale proxy-Attribut aktiviert die \"lazy " -"Initialization\" persistenter Instanzen der Klasse. Hibernate wird anfangs " -"mit CGLIB-Proxies reagieren, die das benannte Interface implementieren. Das " -"eigentliche persistente Objekt wird geladen, wenn eine Methode des Proxy " -"aufgerufen wird. Sehen Sie dazu \"Proxies für die Lazy Initialization\" " -"unten." - -#. Tag: para -#, fuzzy, no-c-format -msgid "" -"Implicit polymorphism means that instances of the class " -"will be returned by a query that names any superclass or implemented " +"polymorphisms (defaults to IMPLICIT): " +"determines whether implicit or explicit query polymorphisms is used. " +"Implicit polymorphisms means that instances of the " +"class will be returned by a query that names any superclass or implemented " "interface or class, and that instances of any subclass of the class will be " "returned by a query that names the class itself. Explicit polymorphism means that class instances will be returned only by " +"emphasis> polymorphisms means that class instances will be returned only by " "queries that explicitly name that class. Queries that name the class will " -"return only instances of subclasses mapped inside this <class>" -" declaration as a <subclass> or " -"<joined-subclass>. For most purposes, the default " -"polymorphism=\"implicit\" is appropriate. Explicit " -"polymorphism is useful when two different classes are mapped to the same " +"return only instances of subclasses mapped. For most purposes, the default " +"polymorphisms=IMPLICIT is appropriate. Explicit " +"polymorphisms is useful when two different classes are mapped to the same " "table This allows a \"lightweight\" class that contains a subset of the " "table columns." msgstr "" @@ -894,9 +782,11 @@ msgstr "" "Tabellenspalten als Teilsatz enthaltenden Klasse)." #. Tag: para +#: basic_mapping.xml:171 #, fuzzy, no-c-format msgid "" -"The persister attribute lets you customize the " +"persister: specifies a custom ClassPersister. The persister attribute lets you customize the " "persistence strategy used for the class. You can, for example, specify your " "own subclass of org.hibernate.persister.EntityPersister, " "or you can even provide a completely new implementation of the interface " @@ -917,56 +807,31 @@ msgstr "" "\" zu einer Hashtable)." #. Tag: para +#: basic_mapping.xml:185 #, fuzzy, no-c-format msgid "" -"The dynamic-update and dynamic-insert " -"settings are not inherited by subclasses, so they can also be specified on " -"the <subclass> or <joined-subclass> elements. Although these settings can increase performance in some " -"cases, they can actually decrease performance in others." -msgstr "" -"Bitte beachten Sie, dass die dynamic-update und " -"dynamic-insert Einstellungen nicht an die Subklassen " -"vererbt werden und daher auch in den <subclass> " -"oder <joined-subclass>-Elementen spezifiziert " -"werden können. Diese Einstellungen können die Performance in einigen Fällen " -"verbessern, in anderen Fällen jedoch auch verschlechtern. Verwenden Sie sie " -"daher umsichtig." - -#. Tag: para -#, fuzzy, no-c-format -msgid "" -"Use of select-before-update will usually decrease " -"performance. It is useful to prevent a database update trigger being called " -"unnecessarily if you reattach a graph of detached instances to a " -"Session." -msgstr "" -"Die Verwendung von select-before-update wird die " -"Performance in der Regel verschlechtern. Es ist sehr hilfreich, um den " -"Aufruf eines Datenbankaktualisierungs-Triggers abzufangen, wenn Sie einen " -"Graph abgesetzter Instanzen wieder an eine Session binden " -"möchten." - -#. Tag: para -#, no-c-format -msgid "" -"If you enable dynamic-update, you will have a choice of " -"optimistic locking strategies:" +"optimisticLock (defaults to VERSION): " +"determines the optimistic locking strategy. If you enable " +"dynamicUpdate, you will have a choice of optimistic " +"locking strategies:" msgstr "" "Wenn Sie dynamic-update aktivieren, haben Sie die Wahl " "zwischen verschiedenen Strategien für das optimistische Sperren:" #. Tag: para +#: basic_mapping.xml:192 #, fuzzy, no-c-format msgid "version: check the version/timestamp columns" msgstr "version Prüfung der Version-/Zeitstempel-Spalten" #. Tag: para +#: basic_mapping.xml:197 #, fuzzy, no-c-format msgid "all: check all columns" msgstr "all Prüfung aller Spalten" #. Tag: para +#: basic_mapping.xml:201 #, fuzzy, no-c-format msgid "" "dirty: check the changed columns, allowing some " @@ -976,11 +841,13 @@ msgstr "" "einiger simultaner Aktualisierungen" #. Tag: para +#: basic_mapping.xml:206 #, fuzzy, no-c-format msgid "none: do not use optimistic locking" msgstr "none verwendet kein optimistisches Sperren" #. Tag: para +#: basic_mapping.xml:211 #, fuzzy, no-c-format msgid "" "It is strongly recommended that you use version/" @@ -996,6 +863,79 @@ msgstr "" "wird)." #. Tag: para +#: basic_mapping.xml:220 +#, no-c-format +msgid "" +"Be sure to import @javax.persistence.Entity to mark a " +"class as an entity. It's a common mistake to import @org." +"hibernate.annotations.Entity by accident." +msgstr "" + +#. Tag: para +#: basic_mapping.xml:227 +#, fuzzy, no-c-format +msgid "" +"Some entities are not mutable. They cannot be updated or deleted by the " +"application. This allows Hibernate to make some minor performance " +"optimizations.. Use the @Immutable annotation." +msgstr "" +"Unveränderliche Klassen, mutable=\"false\", können durch " +"die Anwendung nicht aktualisiert oder gelöscht werden. Dies ermöglicht " +"Hibernate kleinere Optimierungen hinsichtlich der Performance." + +#. Tag: para +#: basic_mapping.xml:232 +#, fuzzy, no-c-format +msgid "" +"You can also alter how Hibernate deals with lazy initialization for this " +"class. On @Proxy, use lazy=false " +"to disable lazy fetching (not recommended). You can also specify an " +"interface to use for lazy initializing proxies (defaults to the class " +"itself): use proxyClass on @Proxy. " +"Hibernate will initially return proxies (Javassist or CGLIB) that implement " +"the named interface. The persistent object will load when a method of the " +"proxy is invoked. See \"Initializing collections and proxies\" below." +msgstr "" +"Das optionale proxy-Attribut aktiviert die \"lazy " +"Initialization\" persistenter Instanzen der Klasse. Hibernate wird anfangs " +"mit CGLIB-Proxies reagieren, die das benannte Interface implementieren. Das " +"eigentliche persistente Objekt wird geladen, wenn eine Methode des Proxy " +"aufgerufen wird. Sehen Sie dazu \"Proxies für die Lazy Initialization\" " +"unten." + +#. Tag: para +#: basic_mapping.xml:243 +#, no-c-format +msgid "" +"@BatchSize specifies a \"batch size\" for fetching " +"instances of this class by identifier. Not yet loaded instances are loaded " +"batch-size at a time (default 1)." +msgstr "" + +#. Tag: para +#: basic_mapping.xml:247 +#, fuzzy, no-c-format +msgid "" +"You can specific an arbitrary SQL WHERE condition to be used when retrieving " +"objects of this class. Use @Where for that." +msgstr "" +"where (optional) legt eine beliebige SQL WHERE-Bedingung zur Verwendung beim Aufruf von Objekten dieser Klasse fest" + +#. Tag: para +#: basic_mapping.xml:251 +#, fuzzy, no-c-format +msgid "" +"In the same vein, @Check lets you define an SQL " +"expression used to generate a multi-row check " +"constraint for automatic schema generation." +msgstr "" +"check (optional): Ein SQL-Ausdruck wird verwendet, um " +"eine Datenüberprüfungsbedingung mehrerer Reihen für die " +"automatische Schemagenerierung zu erstellen. " + +#. Tag: para +#: basic_mapping.xml:255 #, fuzzy, no-c-format msgid "" "There is no difference between a view and a base table for a Hibernate " @@ -1003,7 +943,8 @@ msgid "" "not support views properly, especially with updates. Sometimes you want to " "use a view, but you cannot create one in the database (i.e. with a legacy " "schema). In this case, you can map an immutable and read-only entity to a " -"given SQL subselect expression:" +"given SQL subselect expression using @org.hibernate.annotations." +"Subselect:" msgstr "" "Es gibt keinen Unterschied zwischen einer Ansicht und einer Basistabelle für " "ein Hibernate Mapping, und wie erwartet ist dies auf Datenbankebene " @@ -1014,7 +955,37 @@ msgstr "" "eine unveränderbare und schreibgeschützte Entity zu einem gegebenen SQL " "Subselect-Ausdruck mappen:" +#. Tag: programlisting +#: basic_mapping.xml:263 +#, fuzzy, no-c-format +msgid "" +"@Entity\n" +"@Subselect(\"select item.name, max(bid.amount), count(*) \"\n" +" + \"from item \"\n" +" + \"join bid on bid.item_id = item.id \"\n" +" + \"group by item.name\")\n" +"@Synchronize( {\"item\", \"bid\"} ) //tables impacted\n" +"public class Summary {\n" +" @Id\n" +" public String getId() { return id; }\n" +" ...\n" +"}" +msgstr "" +"<class name=\"Summary\">\n" +" <subselect>\n" +" select item.name, max(bid.amount), count(*)\n" +" from item\n" +" join bid on bid.item_id = item.id\n" +" group by item.name\n" +" </subselect>\n" +" <synchronize table=\"item\"/>\n" +" <synchronize table=\"bid\"/>\n" +" <id name=\"name\"/>\n" +" ...\n" +"</class>" + #. Tag: para +#: basic_mapping.xml:265 #, fuzzy, no-c-format msgid "" "Declare the tables to synchronize this entity with, ensuring that auto-flush " @@ -1028,19 +999,411 @@ msgstr "" "<subselect> ist sowohl als Attribut als auch als " "verschachteltes Mapping-Element verfügbar." -#. Tag: title +#. Tag: para +#: basic_mapping.xml:270 #, fuzzy, no-c-format -msgid "id" -msgstr "uuid" +msgid "" +"We will now explore the same options using the hbm.xml structure. You can " +"declare a persistent class using the class element. For " +"example:" +msgstr "" +"Sie können unter Verwendung des class-Elements eine " +"persistente Klasse deklarieren:" + +#. Tag: programlisting +#: basic_mapping.xml:319 +#, fuzzy, no-c-format +msgid "" +"<class\n" +" name=\"ClassName\"\n" +" table=\"tableName\"\n" +" discriminator-value=\"discriminator_value\"\n" +" mutable=\"true|false\"\n" +" schema=\"owner\"\n" +" catalog=\"catalog\"\n" +" proxy=\"ProxyInterface\"\n" +" dynamic-update=\"true|false\"\n" +" dynamic-insert=\"true|false\"\n" +" select-before-update=\"true|false\"\n" +" polymorphism=\"implicit|explicit\"\n" +" where=\"arbitrary sql where condition\"\n" +" persister=\"PersisterClass\"\n" +" batch-size=\"N\"\n" +" optimistic-lock=\"none|version|dirty|all\"\n" +" lazy=\"true|false\"\n" +" entity-name=\"EntityName\"\n" +" check=\"arbitrary sql check condition\"\n" +" rowid=\"rowid\"\n" +" subselect=\"SQL expression\"\n" +" abstract=\"true|false\"\n" +" node=\"element-name\"\n" +"/>" +msgstr "" +"<class\n" +" name=\"ClassName\"\n" +" table=\"tableName\"\n" +" discriminator-value=\"discriminator_value\"\n" +" mutable=\"true|false\"\n" +" schema=\"owner\"\n" +" catalog=\"catalog\"\n" +" proxy=\"ProxyInterface\"\n" +" dynamic-update=\"true|false\"\n" +" dynamic-insert=\"true|false\"\n" +" select-before-update=\"true|false\"\n" +" polymorphism=\"implicit|explicit\"\n" +" where=\"arbitrary sql where condition\"\n" +" persister=\"PersisterClass\"\n" +" batch-size=\"N\"\n" +" optimistic-lock=\"none|version|dirty|all\"\n" +" lazy=\"true|false\"\n" +" entity-name=\"EntityName\"\n" +" check=\"arbitrary sql check condition\"\n" +" rowid=\"rowid\"\n" +" subselect=\"SQL expression\"\n" +" abstract=\"true|false\"\n" +" node=\"element-name\"\n" +"/>" #. Tag: para +#: basic_mapping.xml:323 +#, fuzzy, no-c-format +msgid "" +"name (optional): the fully qualified Java class name of " +"the persistent class or interface. If this attribute is missing, it is " +"assumed that the mapping is for a non-POJO entity." +msgstr "" +"name (optional): Der vollständige Java-Klassenname der " +"persistenten Klasse (oder des Interface). Falls dieses Attribut fehlt, wird " +"angenommen, dass es sich um das Mapping für eine nicht-POJO Entity handelt." + +#. Tag: para +#: basic_mapping.xml:330 +#, fuzzy, no-c-format +msgid "" +"table (optional - defaults to the unqualified class " +"name): the name of its database table." +msgstr "" +"table (optional - Standardeinstellung ist der " +"undefinierte Klassenname): Der Name der Datenbanktabelle." + +#. Tag: para +#: basic_mapping.xml:335 +#, fuzzy, no-c-format +msgid "" +"discriminator-value (optional - defaults to the class " +"name): a value that distinguishes individual subclasses that is used for " +"polymorphic behavior. Acceptable values include null and " +"not null." +msgstr "" +"discriminator-value (optional - Standard ist der " +"Klassenname): Ein Wert, der zwischen individuellen Subklassen unterscheidet " +"und für polymorphes Verhalten verwendet wird. Akzeptierte Werte sind " +"null und not null." + +#. Tag: para +#: basic_mapping.xml:343 +#, fuzzy, no-c-format +msgid "" +"mutable (optional - defaults to true): " +"specifies that instances of the class are (not) mutable." +msgstr "" +"mutable (optional, Standardeinstellung true): Legt fest, dass die Instanzen der Klasse (nicht) variabel sind." + +#. Tag: para +#: basic_mapping.xml:349 basic_mapping.xml:2912 +#, fuzzy, no-c-format +msgid "" +"schema (optional): overrides the schema name specified by " +"the root <hibernate-mapping> element." +msgstr "" +"schema (optional): Setzt den vom Hauptverzeichnis " +"<hibernate-mapping>-Element spezifizierten " +"Schemanamen außer Kraft." + +#. Tag: para +#: basic_mapping.xml:355 basic_mapping.xml:2918 +#, fuzzy, no-c-format +msgid "" +"catalog (optional): overrides the catalog name specified " +"by the root <hibernate-mapping> element." +msgstr "" +"catalog (optional): Setzt den vom Hauptverzeichnis (\"Root" +"\") <hibernate-mapping>-Element spezifizierten " +"Katalognamen außer Kraft." + +#. Tag: para +#: basic_mapping.xml:361 +#, fuzzy, no-c-format +msgid "" +"proxy (optional): specifies an interface to use for lazy " +"initializing proxies. You can specify the name of the class itself." +msgstr "" +"proxy (optional): Bestimmt ein zu verwendendes Interface " +"für die Initialisierung von Proxies nur bei Bedarf (sog. \"Lazy Initializing " +"Proxies\"). Sie können den Namen der Klasse selbst festlegen." + +#. Tag: para +#: basic_mapping.xml:367 +#, fuzzy, no-c-format +msgid "" +"dynamic-update (optional - defaults to false): specifies that UPDATE SQL should be generated " +"at runtime and can contain only those columns whose values have changed." +msgstr "" +"dynamic-update (optional, Standardeinstellung " +"false): Bestimmt, dass UPDATE SQL zur " +"Runtime generiert wird und nur diejenigen Spalten enthalten soll, deren " +"Werte sich geändert haben." + +#. Tag: para +#: basic_mapping.xml:374 +#, fuzzy, no-c-format +msgid "" +"dynamic-insert (optional - defaults to false): specifies that INSERT SQL should be generated " +"at runtime and contain only the columns whose values are not null." +msgstr "" +"dynamic-insert (optional, Standardeinstellung " +"false): Bestimmt, dass INSERT SQL zur " +"Runtime generiert wird und nur diejenigen Spalten enthalten soll, deren " +"Werte nicht \"Null\" sind." + +#. Tag: para +#: basic_mapping.xml:381 +#, fuzzy, no-c-format +msgid "" +"select-before-update (optional - defaults to " +"false): specifies that Hibernate should never perform an SQL UPDATE unless it is certain that " +"an object is actually modified. Only when a transient object has been " +"associated with a new session using update(), will " +"Hibernate perform an extra SQL SELECT to determine if an " +"UPDATE is actually required." +msgstr "" +"select-before-update (optional, Standardeinstellung " +"false): Bestimmt, dass Hibernate nie " +"ein SQL UPDATE durchführt, außer es ist ganz sicher, dass " +"ein Objekt tatsächlich verändert wurde. In bestimmten Fällen (nur wenn ein " +"transientes Objekt unter Verwendung von update() mit " +"einer neuen Session in Verbindung gebracht wird), bedeutet dies, dass " +"Hibernate ein extra SQL SELECT durchführen wird, um zu " +"bestimmen, ob ein UPDATE tatsächlich erforderlich ist." + +#. Tag: para +#: basic_mapping.xml:393 +#, fuzzy, no-c-format +msgid "" +"polymorphisms (optional - defaults to implicit): determines whether implicit or explicit query polymorphisms is " +"used." +msgstr "" +"polymorphism (optional, Standardeinstellung " +"implicit): Bestimmt, ob implizite oder explizite " +"Polymorphie für Anfragen verwendet wird." + +#. Tag: para +#: basic_mapping.xml:399 +#, fuzzy, no-c-format +msgid "" +"where (optional): specifies an arbitrary SQL " +"WHERE condition to be used when retrieving objects of " +"this class." +msgstr "" +"where (optional) legt eine beliebige SQL WHERE-Bedingung zur Verwendung beim Aufruf von Objekten dieser Klasse fest" + +#. Tag: para +#: basic_mapping.xml:405 +#, fuzzy, no-c-format +msgid "" +"persister (optional): specifies a custom " +"ClassPersister." +msgstr "" +"persister (optional): Spezifiziert einen " +"anwenderdefinierten ClassPersister." + +#. Tag: para +#: basic_mapping.xml:410 +#, fuzzy, no-c-format +msgid "" +"batch-size (optional - defaults to 1): " +"specifies a \"batch size\" for fetching instances of this class by " +"identifier." +msgstr "" +"batch-size (optional, Standardeinstellung 1) bestimmt eine Stapelgröße (sog. \"Batch Size\") für den Abruf von " +"Instanzen dieser Klasse durch den Bezeichner." + +#. Tag: para +#: basic_mapping.xml:416 +#, fuzzy, no-c-format +msgid "" +"optimistic-lock (optional - defaults to version): determines the optimistic locking strategy." +msgstr "" +"optimistic-lock (optional, die Standardeinstellung lautet " +"version): Bestimmt die Strategie für das optimistische " +"Sperren (sog. \"Optimistic Locking\")." + +#. Tag: para +#: basic_mapping.xml:422 +#, fuzzy, no-c-format +msgid "" +"lazy (optional): lazy fetching can be disabled by setting " +"lazy=\"false\"." +msgstr "" +"lazy (optional): Mit der Einstellung lazy=\"false" +"\" deaktivieren Sie \"Lazy Fetching\" (d.h. das Nachladen " +"assoziierter Objekte bei Bedarf) vollständig." + +#. Tag: para +#: basic_mapping.xml:427 +#, fuzzy, no-c-format +msgid "" +"entity-name (optional - defaults to the class name): " +"Hibernate3 allows a class to be mapped multiple times, potentially to " +"different tables. It also allows entity mappings that are represented by " +"Maps or XML at the Java level. In these cases, you should provide an " +"explicit arbitrary name for the entity. See and for more information." +msgstr "" +"entity-name (optional, Standardeinstellung ist der " +"Klassenname): Hibernate3 ermöglicht das mehrfache Mappen einer Klasse " +"(eventuell zu verschiedenen Tabellen) sowie durch Maps oder XML " +"repräsentierte Entity-Mappings auf Java-Ebene. In diesen Fällen sollte Sie " +"einen expliziten arbiträren Namen für die Entity bereitstellen. Unter und " +"finden Sie weitere Information hierzu." + +#. Tag: para +#: basic_mapping.xml:437 +#, fuzzy, no-c-format +msgid "" +"check (optional): an SQL expression used to generate a " +"multi-row check constraint for automatic schema " +"generation." +msgstr "" +"check (optional): Ein SQL-Ausdruck wird verwendet, um " +"eine Datenüberprüfungsbedingung mehrerer Reihen für die " +"automatische Schemagenerierung zu erstellen. " + +#. Tag: para +#: basic_mapping.xml:443 +#, fuzzy, no-c-format +msgid "" +"rowid (optional): Hibernate can use ROWIDs on databases. " +"On Oracle, for example, Hibernate can use the rowid extra " +"column for fast updates once this option has been set to rowid. A ROWID is an implementation detail and represents the physical " +"location of a stored tuple." +msgstr "" +"rowid (optional): Hibernate kann so genannte ROWIDs bei " +"Datenbanken verwenden, die z.B. Oracle unterstützen. Hibernate kann die " +"Extraspalte vonrowid für schnelle Aktualisierungen " +"verwenden, wenn Sie diese Option mit der Einstellung rowid wählen. Eine ROWID ist ein Implementierungsdetail und repräsentiert " +"den realen Standort eines gespeicherten Tupel." + +#. Tag: para +#: basic_mapping.xml:452 +#, fuzzy, no-c-format +msgid "" +"subselect (optional): maps an immutable and read-only " +"entity to a database subselect. This is useful if you want to have a view " +"instead of a base table. See below for more information." +msgstr "" +"subselect (optional): Mappt eine unveränderbare und " +"schreibgeschützte Entity zu einer Datenbankunterauswahl (sog. \"Database " +"Subselect\"). Das ist von Nutzen, wenn Sie statt der Basistabelle eine " +"Ansicht wünschen, aber nicht haben. Weitere Informationen finden Sie unten." + +#. Tag: para +#: basic_mapping.xml:459 +#, fuzzy, no-c-format +msgid "" +"abstract (optional): is used to mark abstract " +"superclasses in <union-subclass> hierarchies." +msgstr "" +"abstract (optional): Wird verwendet, um abstrakte " +"Superklassen in <union-subclass>-Hierarchien zu " +"kennzeichnen." + +#. Tag: para +#: basic_mapping.xml:466 +#, fuzzy, no-c-format +msgid "" +"It is acceptable for the named persistent class to be an interface. You can " +"declare implementing classes of that interface using the <" +"subclass> element. You can persist any static inner class. Specify the class name using the standard form i.e. " +"e.g.Foo$Bar." +msgstr "" +"Es ist völlig in Ordnung, wenn es sich bei der benannten persistenten Klasse " +"um ein Interface handelt. Sie würden in diesem Fall implemetierende Klassen " +"dieses Interface unter Verwendung des <subclass>-" +"Elements deklarieren. Sie können jegliche static innere " +"Klassen (sog. \"inner class\") persistieren. Der Klassenname sollte unter " +"Verwendung des Standardformulars d.h. eg.Foo$Bar " +"spezifiziert werden." + +#. Tag: para +#: basic_mapping.xml:472 #, no-c-format +msgid "Here is how to do a virtual view (subselect) in XML:" +msgstr "" + +#. Tag: programlisting +#: basic_mapping.xml:474 +#, fuzzy, no-c-format +msgid "" +"<class name=\"Summary\">\n" +" <subselect>\n" +" select item.name, max(bid.amount), count(*)\n" +" from item\n" +" join bid on bid.item_id = item.id\n" +" group by item.name\n" +" </subselect>\n" +" <synchronize table=\"item\"/>\n" +" <synchronize table=\"bid\"/>\n" +" <id name=\"name\"/>\n" +" ...\n" +"</class>" +msgstr "" +"<class name=\"Summary\">\n" +" <subselect>\n" +" select item.name, max(bid.amount), count(*)\n" +" from item\n" +" join bid on bid.item_id = item.id\n" +" group by item.name\n" +" </subselect>\n" +" <synchronize table=\"item\"/>\n" +" <synchronize table=\"bid\"/>\n" +" <id name=\"name\"/>\n" +" ...\n" +"</class>" + +#. Tag: para +#: basic_mapping.xml:476 +#, no-c-format +msgid "" +"The <subselect> is available both as an attribute " +"and a nested mapping element." +msgstr "" + +#. Tag: title +#: basic_mapping.xml:481 +#, fuzzy, no-c-format +msgid "Identifiers" +msgstr "Zugeordnete Bezeichner" + +#. Tag: para +#: basic_mapping.xml:483 +#, fuzzy, no-c-format msgid "" "Mapped classes must declare the primary key column of " "the database table. Most classes will also have a JavaBeans-style property " -"holding the unique identifier of an instance. The <id> element defines the mapping from that property to the primary key " -"column." +"holding the unique identifier of an instance." msgstr "" "Gemappte Klassen müssen die Spalte des Primärschlüssels " "der Datenbanktabelle deklarieren. Die meisten Klassen werden außerdem eine " @@ -1049,12 +1412,67 @@ msgstr "" "das Mapping von der Property zur Spalte des Primärschlüssels." #. Tag: para +#: basic_mapping.xml:488 +#, no-c-format +msgid "Mark the identifier property with @Id." +msgstr "" + +#. Tag: programlisting +#: basic_mapping.xml:491 +#, no-c-format +msgid "" +"@Entity\n" +"public class Person {\n" +" @Id Integer getId() { ... }\n" +" ...\n" +"}" +msgstr "" + +#. Tag: para +#: basic_mapping.xml:493 +#, fuzzy, no-c-format +msgid "" +"In hbm.xml, use the <id> element which defines the " +"mapping from that property to the primary key column." +msgstr "" +"Beachten Sie die Verwendung von <column>-Tags beim " +"Mappen einer Property zu mehreren Spalten." + +#. Tag: programlisting +#: basic_mapping.xml:509 +#, fuzzy, no-c-format +msgid "" +"<id\n" +" name=\"propertyName\"\n" +" type=\"typename\"\n" +" column=\"column_name\"\n" +" unsaved-value=\"null|any|none|undefined|id_value\"\n" +" access=\"field|property|ClassName\">\n" +" node=\"element-name|@attribute-name|element/@attribute|.\"\n" +"\n" +" <generator class=\"generatorClass\"/>\n" +"</id>" +msgstr "" +"<id\n" +" name=\"propertyName\"\n" +" type=\"typename\"\n" +" column=\"column_name\"\n" +" unsaved-value=\"null|any|none|undefined|id_value\"\n" +" access=\"field|property|ClassName\">\n" +" node=\"element-name|@attribute-name|element/@attribute|.\"\n" +"\n" +" <generator class=\"generatorClass\"/>\n" +"</id>" + +#. Tag: para +#: basic_mapping.xml:513 #, fuzzy, no-c-format msgid "" "name (optional): the name of the identifier property." msgstr "name (optional): Name der Bezeichner-Property." #. Tag: para +#: basic_mapping.xml:518 basic_mapping.xml:2141 #, no-c-format msgid "" "type (optional): a name that indicates the Hibernate type." @@ -1062,6 +1480,7 @@ msgstr "" "type (optional): Ein Name, der den Hibernate-Typ anzeigt." #. Tag: para +#: basic_mapping.xml:523 #, fuzzy, no-c-format msgid "" "column (optional - defaults to the property name): the " @@ -1071,6 +1490,7 @@ msgstr "" "Name): Der Name der Primärschlüsselspalte." #. Tag: para +#: basic_mapping.xml:528 #, fuzzy, no-c-format msgid "" "unsaved-value (optional - defaults to a \"sensible\" " @@ -1085,6 +1505,7 @@ msgstr "" "gespeichert oder geladen wurden." #. Tag: para +#: basic_mapping.xml:536 #, fuzzy, no-c-format msgid "" "access (optional - defaults to propertyname attribute is missing, it is assumed that the " @@ -1105,20 +1527,22 @@ msgstr "" "dass die Klasse keine Bezeichner-Property besitzt." #. Tag: para -#, no-c-format +#: basic_mapping.xml:546 +#, fuzzy, no-c-format msgid "" "The unsaved-value attribute is almost never needed in " -"Hibernate3." +"Hibernate3 and indeed has no corresponding element in annotations." msgstr "" "Das unsaved-value-Attribut wird in Hibernate3 fast nie " "benötigt." #. Tag: para +#: basic_mapping.xml:550 #, fuzzy, no-c-format msgid "" -"There is an alternative <composite-id> declaration " -"that allows access to legacy data with composite keys. Its use is strongly " -"discouraged for anything else." +"You can also declare the identifier as a composite identifier. This allows " +"access to legacy data with composite keys. Its use is strongly discouraged " +"for anything else." msgstr "" "Es existiert eine alternative <composite-id>-" "Deklaration, die Zugriff auf Stammdaten mit zusammengesetzten Schlüsseln " @@ -1126,18 +1550,1034 @@ msgstr "" "ausschließlich hierfür zur verwenden." #. Tag: title -#, no-c-format -msgid "Generator" -msgstr "Programmgenerator" +#: basic_mapping.xml:555 +#, fuzzy, no-c-format +msgid "Composite identifier" +msgstr "Zugeordnete Bezeichner" #. Tag: para +#: basic_mapping.xml:557 +#, no-c-format +msgid "You can define a composite primary key through several syntaxes:" +msgstr "" + +#. Tag: para +#: basic_mapping.xml:562 #, no-c-format msgid "" -"The optional <generator> child element names a Java " -"class used to generate unique identifiers for instances of the persistent " -"class. If any parameters are required to configure or initialize the " -"generator instance, they are passed using the <param> element." +"use a component type to represent the identifier and map it as a property in " +"the entity: you then annotated the property as @EmbeddedId. The component type has to be Serializable." +msgstr "" + +#. Tag: para +#: basic_mapping.xml:569 +#, no-c-format +msgid "" +"map multiple properties as @Id properties: the " +"identifier type is then the entity class itself and needs to be " +"Serializable. This approach is unfortunately not " +"standard and only supported by Hibernate." +msgstr "" + +#. Tag: para +#: basic_mapping.xml:577 +#, no-c-format +msgid "" +"map multiple properties as @Id properties and declare " +"an external class to be the identifier type. This class, which needs to be " +"Serializable, is declared on the entity via the " +"@IdClass annotation. The identifier type must contain " +"the same properties as the identifier properties of the entity: each " +"property name must be the same, its type must be the same as well if the " +"entity property is of a basic type, its type must be the type of the primary " +"key of the associated entity if the entity property is an association " +"(either a @OneToOne or a @ManyToOne)." +msgstr "" + +#. Tag: para +#: basic_mapping.xml:592 +#, no-c-format +msgid "" +"As you can see the last case is far from obvious. It has been inherited from " +"the dark ages of EJB 2 for backward compatibilities and we recommend you not " +"to use it (for simplicity sake)." +msgstr "" + +#. Tag: para +#: basic_mapping.xml:596 +#, no-c-format +msgid "Let's explore all three cases using examples." +msgstr "" + +#. Tag: title +#: basic_mapping.xml:599 +#, no-c-format +msgid "id as a property using a component type" +msgstr "" + +#. Tag: para +#: basic_mapping.xml:601 +#, no-c-format +msgid "Here is a simple example of @EmbeddedId." +msgstr "" + +#. Tag: programlisting +#: basic_mapping.xml:604 +#, no-c-format +msgid "" +"@Entity\n" +"class User {\n" +" @EmbeddedId\n" +" @AttributeOverride(name=\"firstName\", column=@Column(name=\"fld_firstname" +"\")\n" +" UserId id;\n" +"\n" +" Integer age;\n" +"}\n" +"\n" +"@Embeddable\n" +"class UserId implements Serializable {\n" +" String firstName;\n" +" String lastName;\n" +"}" +msgstr "" + +#. Tag: para +#: basic_mapping.xml:606 +#, no-c-format +msgid "" +"You can notice that the UserId class is serializable. " +"To override the column mapping, use @AttributeOverride." +msgstr "" + +#. Tag: para +#: basic_mapping.xml:610 +#, no-c-format +msgid "" +"An embedded id can itself contains the primary key of an associated entity." +msgstr "" + +#. Tag: programlisting +#: basic_mapping.xml:613 +#, no-c-format +msgid "" +"@Entity\n" +"class Customer {\n" +" @EmbeddedId CustomerId id;\n" +" boolean preferredCustomer;\n" +"\n" +" @MapsId(\"userId\")\n" +" @JoinColumns({\n" +" @JoinColumn(name=\"userfirstname_fk\", referencedColumnName=\"firstName" +"\"),\n" +" @JoinColumn(name=\"userlastname_fk\", referencedColumnName=\"lastName" +"\")\n" +" })\n" +" @OneToOne User user;\n" +"}\n" +"\n" +"@Embeddable\n" +"class CustomerId implements Serializable {\n" +" UserId userId;\n" +" String customerNumber;\n" +"\n" +" //implements equals and hashCode\n" +"}\n" +"\n" +"@Entity \n" +"class User {\n" +" @EmbeddedId UserId id;\n" +" Integer age;\n" +"}\n" +"\n" +"@Embeddable\n" +"class UserId implements Serializable {\n" +" String firstName;\n" +" String lastName;\n" +"\n" +" //implements equals and hashCode\n" +"}" +msgstr "" + +#. Tag: para +#: basic_mapping.xml:615 +#, no-c-format +msgid "" +"In the embedded id object, the association is represented as the identifier " +"of the associated entity. But you can link its value to a regular " +"association in the entity via the @MapsId annotation. " +"The @MapsId value correspond to the property name of " +"the embedded id object containing the associated entity's identifier. In the " +"database, it means that the Customer.user and the " +"CustomerId.userId properties share the same underlying " +"column (user_fk in this case)." +msgstr "" + +#. Tag: para +#: basic_mapping.xml:627 +#, no-c-format +msgid "" +"The component type used as identifier must implement equals() and hashCode()." +msgstr "" + +#. Tag: para +#: basic_mapping.xml:632 +#, no-c-format +msgid "" +"In practice, your code only sets the Customer.user " +"property and the user id value is copied by Hibernate into the " +"CustomerId.userId property." +msgstr "" + +#. Tag: para +#: basic_mapping.xml:638 +#, no-c-format +msgid "" +"The id value can be copied as late as flush time, don't rely on it until " +"after flush time." +msgstr "" + +#. Tag: para +#: basic_mapping.xml:642 +#, no-c-format +msgid "" +"While not supported in JPA, Hibernate lets you place your association " +"directly in the embedded id component (instead of having to use the " +"@MapsId annotation)." +msgstr "" + +#. Tag: programlisting +#: basic_mapping.xml:646 +#, no-c-format +msgid "" +"@Entity\n" +"class Customer {\n" +" @EmbeddedId CustomerId id;\n" +" boolean preferredCustomer;\n" +"}\n" +"\n" +"@Embeddable\n" +"class CustomerId implements Serializable {\n" +" @OneToOne\n" +" @JoinColumns({\n" +" @JoinColumn(name=\"userfirstname_fk\", referencedColumnName=\"firstName" +"\"),\n" +" @JoinColumn(name=\"userlastname_fk\", referencedColumnName=\"lastName" +"\")\n" +" }) \n" +" User user;\n" +" String customerNumber;\n" +"\n" +" //implements equals and hashCode\n" +"}\n" +"\n" +"@Entity \n" +"class User {\n" +" @EmbeddedId UserId id;\n" +" Integer age;\n" +"}\n" +"\n" +"@Embeddable\n" +"class UserId implements Serializable {\n" +" String firstName;\n" +" String lastName;\n" +"\n" +"\n" +" //implements equals and hashCode\n" +"}" +msgstr "" + +#. Tag: para +#: basic_mapping.xml:648 +#, no-c-format +msgid "Let's now rewrite these examples using the hbm.xml syntax." +msgstr "" + +#. Tag: programlisting +#: basic_mapping.xml:651 +#, fuzzy, no-c-format +msgid "" +"<composite-id\n" +" name=\"propertyName\"\n" +" class=\"ClassName\"\n" +" mapped=\"true|false\"\n" +" access=\"field|property|ClassName\"\n" +" node=\"element-name|.\">\n" +"\n" +" <key-property name=\"propertyName\" type=\"typename\" column=" +"\"column_name\"/>\n" +" <key-many-to-one name=\"propertyName\" class=\"ClassName\" column=" +"\"column_name\"/>\n" +" ......\n" +"</composite-id>" +msgstr "" +"<composite-id\n" +" name=\"propertyName\"\n" +" class=\"ClassName\"\n" +" mapped=\"true|false\"\n" +" access=\"field|property|ClassName\">\n" +" node=\"element-name|.\"\n" +"\n" +" <key-property name=\"propertyName\" type=\"typename\" column=" +"\"column_name\"/>\n" +" <key-many-to-one name=\"propertyName class=\"ClassName\" column=" +"\"column_name\"/>\n" +" ......\n" +"</composite-id>" + +#. Tag: para +#: basic_mapping.xml:653 +#, no-c-format +msgid "First a simple example:" +msgstr "" + +#. Tag: programlisting +#: basic_mapping.xml:655 +#, no-c-format +msgid "" +"<class name=\"User\">\n" +" <composite-id name=\"id\" class=\"UserId\">\n" +" <key-property name=\"firstName\" column=\"fld_firstname\"/>\n" +" <key-property name=\"lastName\"/>\n" +" </composite-id>\n" +"</class>" +msgstr "" + +#. Tag: para +#: basic_mapping.xml:657 +#, no-c-format +msgid "Then an example showing how an association can be mapped." +msgstr "" + +#. Tag: programlisting +#: basic_mapping.xml:660 +#, no-c-format +msgid "" +"<class name=\"Customer\">\n" +" <composite-id name=\"id\" class=\"CustomerId\">\n" +" <key-property name=\"firstName\" column=\"userfirstname_fk\"/>\n" +" <key-property name=\"lastName\" column=\"userfirstname_fk\"/>\n" +" <key-property name=\"customerNumber\"/>\n" +" </composite-id>\n" +"\n" +" <property name=\"preferredCustomer\"/>\n" +"\n" +" <many-to-one name=\"user\">\n" +" <column name=\"userfirstname_fk\" updatable=\"false\" insertable=" +"\"false\"/>\n" +" <column name=\"userlastname_fk\" updatable=\"false\" insertable=" +"\"false\"/>\n" +" </many-to-one>\n" +"</class>\n" +"\n" +"<class name=\"User\">\n" +" <composite-id name=\"id\" class=\"UserId\">\n" +" <key-property name=\"firstName\"/>\n" +" <key-property name=\"lastName\"/>\n" +" </composite-id>\n" +"\n" +" <property name=\"age\"/>\n" +"</class>" +msgstr "" + +#. Tag: para +#: basic_mapping.xml:662 +#, no-c-format +msgid "Notice a few things in the previous example:" +msgstr "" + +#. Tag: para +#: basic_mapping.xml:666 +#, no-c-format +msgid "" +"the order of the properties (and column) matters. It must be the same " +"between the association and the primary key of the associated entity" +msgstr "" + +#. Tag: para +#: basic_mapping.xml:672 +#, no-c-format +msgid "" +"the many to one uses the same columns as the primary key and thus must be " +"marked as read only (insertable and updatable to false)." +msgstr "" + +#. Tag: para +#: basic_mapping.xml:679 +#, no-c-format +msgid "" +"unlike with @MapsId, the id value of the associated " +"entity is not transparently copied, check the foreign id " +"generator for more information." +msgstr "" + +#. Tag: para +#: basic_mapping.xml:686 +#, no-c-format +msgid "" +"The last example shows how to map association directly in the embedded id " +"component." +msgstr "" + +#. Tag: programlisting +#: basic_mapping.xml:689 +#, no-c-format +msgid "" +"<class name=\"Customer\">\n" +" <composite-id name=\"id\" class=\"CustomerId\">\n" +" <key-many-to-one name=\"user\">\n" +" <column name=\"userfirstname_fk\"/>\n" +" <column name=\"userlastname_fk\"/>\n" +" </key-many-to-one>\n" +" <key-property name=\"customerNumber\"/>\n" +" </composite-id>\n" +"\n" +" <property name=\"preferredCustomer\"/>\n" +"</class>\n" +"\n" +"<class name=\"User\">\n" +" <composite-id name=\"id\" class=\"UserId\">\n" +" <key-property name=\"firstName\"/>\n" +" <key-property name=\"lastName\"/>\n" +" </composite-id>\n" +"\n" +" <property name=\"age\"/>\n" +"</class>" +msgstr "" + +#. Tag: para +#: basic_mapping.xml:691 +#, no-c-format +msgid "" +"This is the recommended approach to map composite identifier. The following " +"options should not be considered unless some constraint are present." +msgstr "" + +#. Tag: title +#: basic_mapping.xml:697 +#, no-c-format +msgid "Multiple id properties without identifier type" +msgstr "" + +#. Tag: para +#: basic_mapping.xml:699 +#, no-c-format +msgid "" +"Another, arguably more natural, approach is to place @Id on multiple properties of your entity. This approach is only " +"supported by Hibernate (not JPA compliant) but does not require an extra " +"embeddable component." +msgstr "" + +#. Tag: programlisting +#: basic_mapping.xml:704 +#, no-c-format +msgid "" +"@Entity\n" +"class Customer implements Serializable {\n" +" @Id @OneToOne\n" +" @JoinColumns({\n" +" @JoinColumn(name=\"userfirstname_fk\", referencedColumnName=\"firstName" +"\"),\n" +" @JoinColumn(name=\"userlastname_fk\", referencedColumnName=\"lastName" +"\")\n" +" })\n" +" User user;\n" +" \n" +" @Id String customerNumber;\n" +"\n" +" boolean preferredCustomer;\n" +"\n" +" //implements equals and hashCode\n" +"}\n" +"\n" +"@Entity \n" +"class User {\n" +" @EmbeddedId UserId id;\n" +" Integer age;\n" +"}\n" +"\n" +"@Embeddable\n" +"class UserId implements Serializable {\n" +" String firstName;\n" +" String lastName;\n" +"\n" +" //implements equals and hashCode\n" +"}" +msgstr "" + +#. Tag: para +#: basic_mapping.xml:706 +#, no-c-format +msgid "" +"In this case Customer is its own identifier " +"representation: it must implement Serializable and " +"must implement equals() and hashCode()." +msgstr "" + +#. Tag: para +#: basic_mapping.xml:712 +#, no-c-format +msgid "In hbm.xml, the same mapping is:" +msgstr "" + +#. Tag: programlisting +#: basic_mapping.xml:714 +#, no-c-format +msgid "" +"<class name=\"Customer\">\n" +" <composite-id>\n" +" <key-many-to-one name=\"user\">\n" +" <column name=\"userfirstname_fk\"/>\n" +" <column name=\"userlastname_fk\"/>\n" +" </key-many-to-one>\n" +" <key-property name=\"customerNumber\"/>\n" +" </composite-id>\n" +"\n" +" <property name=\"preferredCustomer\"/>\n" +"</class>\n" +"\n" +"<class name=\"User\">\n" +" <composite-id name=\"id\" class=\"UserId\">\n" +" <key-property name=\"firstName\"/>\n" +" <key-property name=\"lastName\"/>\n" +" </composite-id>\n" +"\n" +" <property name=\"age\"/>\n" +"</class>" +msgstr "" + +#. Tag: title +#: basic_mapping.xml:718 +#, no-c-format +msgid "Multiple id properties with with a dedicated identifier type" +msgstr "" + +#. Tag: para +#: basic_mapping.xml:721 +#, no-c-format +msgid "" +"@IdClass on an entity points to the class (component) " +"representing the identifier of the class. The properties marked " +"@Id on the entity must have their corresponding " +"property on the @IdClass. The return type of search " +"twin property must be either identical for basic properties or must " +"correspond to the identifier class of the associated entity for an " +"association." +msgstr "" + +#. Tag: para +#: basic_mapping.xml:730 +#, no-c-format +msgid "" +"This approach is inherited from the EJB 2 days and we recommend against its " +"use. But, after all it's your application and Hibernate supports it." +msgstr "" + +#. Tag: programlisting +#: basic_mapping.xml:735 +#, no-c-format +msgid "" +"@Entity\n" +"@IdClass(CustomerId.class)\n" +"class Customer implements Serializable {\n" +" @Id @OneToOne\n" +" @JoinColumns({\n" +" @JoinColumn(name=\"userfirstname_fk\", referencedColumnName=\"firstName" +"\"),\n" +" @JoinColumn(name=\"userlastname_fk\", referencedColumnName=\"lastName" +"\")\n" +" }) \n" +" User user;\n" +" \n" +" @Id String customerNumber;\n" +"\n" +" boolean preferredCustomer;\n" +"}\n" +"\n" +"class CustomerId implements Serializable {\n" +" UserId user;\n" +" String customerNumber;\n" +"\n" +" //implements equals and hashCode\n" +"}\n" +"\n" +"@Entity \n" +"class User {\n" +" @EmbeddedId UserId id;\n" +" Integer age;\n" +"\n" +" //implements equals and hashCode\n" +"}\n" +"\n" +"@Embeddable\n" +"class UserId implements Serializable {\n" +" String firstName;\n" +" String lastName;\n" +"\n" +" //implements equals and hashCode\n" +"}" +msgstr "" + +#. Tag: para +#: basic_mapping.xml:737 +#, no-c-format +msgid "" +"Customer and CustomerId do " +"have the same properties customerNumber as well as " +"user. CustomerId must be " +"Serializable and implement equals() and hashCode()." +msgstr "" + +#. Tag: para +#: basic_mapping.xml:745 +#, no-c-format +msgid "" +"While not JPA standard, Hibernate let's you declare the vanilla associated " +"property in the @IdClass." +msgstr "" + +#. Tag: programlisting +#: basic_mapping.xml:749 +#, no-c-format +msgid "" +"@Entity\n" +"@IdClass(CustomerId.class)\n" +"class Customer implements Serializable {\n" +" @Id @OneToOne\n" +" @JoinColumns({\n" +" @JoinColumn(name=\"userfirstname_fk\", referencedColumnName=\"firstName" +"\"),\n" +" @JoinColumn(name=\"userlastname_fk\", referencedColumnName=\"lastName" +"\")\n" +" }) \n" +" User user;\n" +" \n" +" @Id String customerNumber;\n" +"\n" +" boolean preferredCustomer;\n" +"}\n" +"\n" +"class CustomerId implements Serializable {\n" +" @OneToOne User user;\n" +" String customerNumber;\n" +"\n" +" //implements equals and hashCode\n" +"}\n" +"\n" +"@Entity \n" +"class User {\n" +" @EmbeddedId UserId id;\n" +" Integer age;\n" +"\n" +" //implements equals and hashCode\n" +"}\n" +"\n" +"@Embeddable\n" +"class UserId implements Serializable {\n" +" String firstName;\n" +" String lastName;\n" +"}" +msgstr "" + +#. Tag: para +#: basic_mapping.xml:751 +#, no-c-format +msgid "" +"This feature is of limited interest though as you are likely to have chosen " +"the @IdClass approach to stay JPA compliant or you " +"have a quite twisted mind." +msgstr "" + +#. Tag: para +#: basic_mapping.xml:755 +#, no-c-format +msgid "Here are the equivalent on hbm.xml files:" +msgstr "" + +#. Tag: programlisting +#: basic_mapping.xml:757 +#, no-c-format +msgid "" +"<class name=\"Customer\">\n" +" <composite-id class=\"CustomerId\" mapped=\"true\">\n" +" <key-many-to-one name=\"user\">\n" +" <column name=\"userfirstname_fk\"/>\n" +" <column name=\"userlastname_fk\"/>\n" +" </key-many-to-one>\n" +" <key-property name=\"customerNumber\"/>\n" +" </composite-id>\n" +"\n" +" <property name=\"preferredCustomer\"/>\n" +"</class>\n" +"\n" +"<class name=\"User\">\n" +" <composite-id name=\"id\" class=\"UserId\">\n" +" <key-property name=\"firstName\"/>\n" +" <key-property name=\"lastName\"/>\n" +" </composite-id>\n" +"\n" +" <property name=\"age\"/>\n" +"</class>" +msgstr "" + +#. Tag: title +#: basic_mapping.xml:762 +#, fuzzy, no-c-format +msgid "Identifier generator" +msgstr "Die \"Getter\"-Methode des Bezeichners" + +#. Tag: para +#: basic_mapping.xml:764 +#, no-c-format +msgid "" +"Hibernate can generate and populate identifier values for you automatically. " +"This is the recommended approach over \"business\" or \"natural\" id " +"(especially composite ids)." +msgstr "" + +#. Tag: para +#: basic_mapping.xml:768 +#, no-c-format +msgid "" +"Hibernate offers various generation strategies, let's explore the most " +"common ones first that happens to be standardized by JPA:" +msgstr "" + +#. Tag: para +#: basic_mapping.xml:774 +#, fuzzy, no-c-format +msgid "" +"IDENTITY: supports identity columns in DB2, MySQL, MS SQL Server, Sybase and " +"HypersonicSQL. The returned identifier is of type long, " +"short or int." +msgstr "" +"unterstützt die Identitätsspalten in DB2, MySQL, MS SQL Server, Sybase und " +"HypersonicSQL. Der zurückgesendete Bezeichner ist vom Typ long, short oder int." + +#. Tag: para +#: basic_mapping.xml:781 +#, fuzzy, no-c-format +msgid "" +"SEQUENCE (called seqhilo in Hibernate): uses a hi/lo " +"algorithm to efficiently generate identifiers of type long, short or int, given a named " +"database sequence." +msgstr "" +"verwendet einen hi/lo-Algorithmus um effizient Bezeichner des Typs " +"long, short oder int zu generieren, bei einer vorgegebenen und benannten " +"Datenbanksequenz." + +#. Tag: para +#: basic_mapping.xml:788 +#, fuzzy, no-c-format +msgid "" +"TABLE (called MultipleHiLoPerTableGenerator in " +"Hibernate) : uses a hi/lo algorithm to efficiently generate identifiers of " +"type long, short or int, given a table and column as a source of hi values. The hi/lo " +"algorithm generates identifiers that are unique only for a particular " +"database." +msgstr "" +"verwendet einen hi/lo Algorithmus um effizient Bezeichner des Typs " +"long, short oder int zu generieren, bei gegebener Tabelle und Spalte " +"(Standardeinstellung lautet hibernate_unique_key bzw. " +"next_hi) als Quelle der hi-Werte. Der hi/lo-Algorithmus " +"generiert Bezeichner, die für eine bestimmte Datenbank eindeutig sind." + +#. Tag: para +#: basic_mapping.xml:798 +#, fuzzy, no-c-format +msgid "" +"AUTO: selects IDENTITY, SEQUENCE or " +"TABLE depending upon the capabilities of the underlying " +"database." +msgstr "" +"wählt identity, sequence oder " +"hilo je nach Leistungsfähigkeit der zu Grunde liegenden " +"Datenbank." + +#. Tag: para +#: basic_mapping.xml:805 +#, no-c-format +msgid "" +"We recommend all new projects to use the new enhanced identifier generators. " +"They are deactivated by default for entities using annotations but can be " +"activated using hibernate.id.new_generator_mappings=true. These " +"new generators are more efficient and closer to the JPA 2 specification " +"semantic." +msgstr "" + +#. Tag: para +#: basic_mapping.xml:812 +#, no-c-format +msgid "" +"However they are not backward compatible with existing Hibernate based " +"application (if a sequence or a table is used for id generation). See " +"XXXXXXX for more information on how " +"to activate them." +msgstr "" + +#. Tag: para +#: basic_mapping.xml:818 +#, no-c-format +msgid "" +"To mark an id property as generated, use the @GeneratedValue annotation. You can specify the strategy used (default to " +"AUTO) by setting strategy." +msgstr "" + +#. Tag: programlisting +#: basic_mapping.xml:823 +#, no-c-format +msgid "" +"@Entity\n" +"public class Customer {\n" +" @Id @GeneratedValue\n" +" Integer getId() { ... };\n" +"}\n" +"\n" +"@Entity \n" +"public class Invoice {\n" +" @Id @GeneratedValue(strategy=GenerationType.IDENTITY)\n" +" Integer getId() { ... };\n" +"}" +msgstr "" + +#. Tag: para +#: basic_mapping.xml:825 +#, no-c-format +msgid "" +"SEQUENCE and TABLE require additional " +"configurations that you can set using @SequenceGenerator and @TableGenerator:" +msgstr "" + +#. Tag: para +#: basic_mapping.xml:832 +#, fuzzy, no-c-format +msgid "name: name of the generator" +msgstr "name: Der Name der Property." + +#. Tag: para +#: basic_mapping.xml:836 +#, fuzzy, no-c-format +msgid "" +"table / sequenceName: name of the " +"table or the sequence (defaulting respectively to " +"hibernate_sequences and hibernate_sequence)" +msgstr "" +"column (optional - Standardeinstellung lautet " +"class) der Name der Diskriminatorspalte." + +#. Tag: para +#: basic_mapping.xml:843 +#, fuzzy, no-c-format +msgid "catalog / schema:" +msgstr "all Prüfung aller Spalten" + +#. Tag: para +#: basic_mapping.xml:848 +#, fuzzy, no-c-format +msgid "" +"initialValue: the value from which the id is to start " +"generating" +msgstr "table: Der Name der verbundenen Tabelle." + +#. Tag: para +#: basic_mapping.xml:853 +#, no-c-format +msgid "" +"allocationSize: the amount to increment by when " +"allocating id numbers from the generator" +msgstr "" + +#. Tag: para +#: basic_mapping.xml:858 +#, no-c-format +msgid "" +"In addition, the TABLE strategy also let you " +"customize:" +msgstr "" + +#. Tag: para +#: basic_mapping.xml:863 +#, fuzzy, no-c-format +msgid "" +"pkColumnName: the column name containing the entity " +"identifier" +msgstr "name: Der Name der Property." + +#. Tag: para +#: basic_mapping.xml:868 +#, fuzzy, no-c-format +msgid "" +"valueColumnName: the column name containing the " +"identifier value" +msgstr "name (optional): Name der Bezeichner-Property." + +#. Tag: para +#: basic_mapping.xml:873 +#, fuzzy, no-c-format +msgid "pkColumnValue: the entity identifier" +msgstr "id-type: Der Bezeichnertyp." + +#. Tag: para +#: basic_mapping.xml:878 +#, no-c-format +msgid "" +"uniqueConstraints: any potential column constraint on the " +"table containing the ids" +msgstr "" + +#. Tag: para +#: basic_mapping.xml:883 +#, no-c-format +msgid "" +"To link a table or sequence generator definition with an actual generated " +"property, use the same name in both the definition name " +"and the generator value generator as shown below." +msgstr "" + +#. Tag: programlisting +#: basic_mapping.xml:888 +#, no-c-format +msgid "" +"@Id \n" +"@GeneratedValue(\n" +" strategy=GenerationType.SEQUENCE, \n" +" generator=\"SEQ_GEN\")\n" +"@javax.persistence.SequenceGenerator(\n" +" name=\"SEQ_GEN\",\n" +" sequenceName=\"my_sequence\",\n" +" allocationSize=20\n" +")\n" +"public Integer getId() { ... }" +msgstr "" + +#. Tag: para +#: basic_mapping.xml:890 +#, no-c-format +msgid "" +"The scope of a generator definition can be the application or the class. " +"Class-defined generators are not visible outside the class and can override " +"application level generators. Application level generators are defined in " +"JPA's XML deployment descriptors (see XXXXXX ):" +msgstr "" + +#. Tag: programlisting +#: basic_mapping.xml:896 +#, no-c-format +msgid "" +"<table-generator name=\"EMP_GEN\"\n" +" table=\"GENERATOR_TABLE\"\n" +" pk-column-name=\"key\"\n" +" value-column-name=\"hi\"\n" +" pk-column-value=\"EMP\"\n" +" allocation-size=\"20\"/>\n" +"\n" +"//and the annotation equivalent\n" +"\n" +"@javax.persistence.TableGenerator(\n" +" name=\"EMP_GEN\",\n" +" table=\"GENERATOR_TABLE\",\n" +" pkColumnName = \"key\",\n" +" valueColumnName = \"hi\"\n" +" pkColumnValue=\"EMP\",\n" +" allocationSize=20\n" +")\n" +"\n" +"<sequence-generator name=\"SEQ_GEN\" \n" +" sequence-name=\"my_sequence\"\n" +" allocation-size=\"20\"/>\n" +"\n" +"//and the annotation equivalent\n" +"\n" +"@javax.persistence.SequenceGenerator(\n" +" name=\"SEQ_GEN\",\n" +" sequenceName=\"my_sequence\",\n" +" allocationSize=20\n" +")" +msgstr "" + +#. Tag: para +#: basic_mapping.xml:898 +#, no-c-format +msgid "" +"If a JPA XML descriptor (like META-INF/orm.xml) is used " +"to define the generators, EMP_GEN and SEQ_GEN are application level generators." +msgstr "" + +#. Tag: para +#: basic_mapping.xml:904 +#, no-c-format +msgid "" +"Package level definition is not supported by the JPA specification. However, " +"you can use the @GenericGenerator at the package level " +"(see )." +msgstr "" + +#. Tag: para +#: basic_mapping.xml:910 +#, no-c-format +msgid "" +"These are the four standard JPA generators. Hibernate goes beyond that and " +"provide additional generators or additional options as we will see below. " +"You can also write your own custom identifier generator by implementing " +"org.hibernate.id.IdentifierGenerator." +msgstr "" + +#. Tag: para +#: basic_mapping.xml:916 +#, no-c-format +msgid "" +"To define a custom generator, use the @GenericGenerator annotation (and its plural counter part " +"@GenericGenerators) that describes the class of the " +"identifier generator or its short cut name (as described below) and a list " +"of key/value parameters. When using @GenericGenerator " +"and assigning it via @GeneratedValue.generator, the " +"@GeneratedValue.strategy is ignored: leave it blank." +msgstr "" + +#. Tag: programlisting +#: basic_mapping.xml:926 +#, no-c-format +msgid "" +"@Id @GeneratedValue(generator=\"system-uuid\")\n" +"@GenericGenerator(name=\"system-uuid\", strategy = \"uuid\")\n" +"public String getId() {\n" +"\n" +"@Id @GeneratedValue(generator=\"trigger-generated\")\n" +"@GenericGenerator(\n" +" name=\"trigger-generated\", \n" +" strategy = \"select\",\n" +" parameters = @Parameter(name=\"key\", value = \"socialSecurityNumber\")\n" +")\n" +"public String getId() {" +msgstr "" + +#. Tag: para +#: basic_mapping.xml:928 +#, fuzzy, no-c-format +msgid "" +"The hbm.xml approach uses the optional <generator> " +"child element inside <id>. If any parameters are " +"required to configure or initialize the generator instance, they are passed " +"using the <param> element." msgstr "" "Das optionale <generator>-Unterelement benennt eine " "Java-Klasse, die zur Generierung eindeutiger Bezeichner für Instanzen der " @@ -1145,7 +2585,34 @@ msgstr "" "Initialisierung der Generatorinstanz benötigt werden, werden Sie unter " "Verwendung des <param>-Elements weitergeleitet." +#. Tag: programlisting +#: basic_mapping.xml:934 +#, fuzzy, no-c-format +msgid "" +"<id name=\"id\" type=\"long\" column=\"cat_id\">\n" +" <generator class=\"org.hibernate.id.TableHiLoGenerator\">\n" +" <param name=\"table\">uid_table</param>\n" +" <param name=\"column\">next_hi_value_column</" +"param>\n" +" </generator>\n" +"</id>" +msgstr "" +"<id name=\"id\" type=\"long\" column=\"cat_id\">\n" +" <generator class=\"org.hibernate.id.TableHiLoGenerator\">\n" +" <param name=\"table\">uid_table</param>\n" +" <param name=\"column\">next_hi_value_column</" +"param>\n" +" </generator>\n" +"</id>" + +#. Tag: title +#: basic_mapping.xml:937 +#, no-c-format +msgid "Various additional generators" +msgstr "" + #. Tag: para +#: basic_mapping.xml:939 #, fuzzy, no-c-format msgid "" "All generators implement the interface org.hibernate.id." @@ -1160,12 +2627,14 @@ msgstr "" "bereit. Hiberante bietet jedoch eine Reihe eingebauter Implementierungen. " "Für die eingebauten Generatoren existieren abgekürzte Namen:" -#. Tag: term -#, fuzzy, no-c-format -msgid "increment" -msgstr "name: Der Property-Name." +#. Tag: literal +#: basic_mapping.xml:946 +#, no-c-format +msgid "increment" +msgstr "increment" #. Tag: para +#: basic_mapping.xml:949 #, no-c-format msgid "" "generates identifiers of type long, shortNicht in einem " "Cluster zu verwenden." -#. Tag: term -#, fuzzy, no-c-format -msgid "identity" -msgstr "id-type: Der Bezeichnertyp." +#. Tag: literal +#: basic_mapping.xml:958 +#, no-c-format +msgid "identity" +msgstr "identity" #. Tag: para +#: basic_mapping.xml:961 #, no-c-format msgid "" "supports identity columns in DB2, MySQL, MS SQL Server, Sybase and " @@ -1194,12 +2665,14 @@ msgstr "" "HypersonicSQL. Der zurückgesendete Bezeichner ist vom Typ long, short oder int." -#. Tag: term -#, fuzzy, no-c-format -msgid "sequence" -msgstr "name: Der Property-Name." +#. Tag: literal +#: basic_mapping.xml:969 +#, no-c-format +msgid "sequence" +msgstr "sequence" #. Tag: para +#: basic_mapping.xml:972 #, no-c-format msgid "" "uses a sequence in DB2, PostgreSQL, Oracle, SAP DB, McKoi or a generator in " @@ -1210,12 +2683,14 @@ msgstr "" "Generator in Interbase. Der zurückgeschickte Bezeichner ist vom Typ " "long, short oder int" -#. Tag: term -#, fuzzy, no-c-format -msgid "hilo" -msgstr "all Prüfung aller Spalten" +#. Tag: literal +#: basic_mapping.xml:980 +#, no-c-format +msgid "hilo" +msgstr "hilo" #. Tag: para +#: basic_mapping.xml:984 #, no-c-format msgid "" "uses a hi/lo algorithm to efficiently generate identifiers of type " @@ -1232,12 +2707,14 @@ msgstr "" "next_hi) als Quelle der hi-Werte. Der hi/lo-Algorithmus " "generiert Bezeichner, die für eine bestimmte Datenbank eindeutig sind." -#. Tag: term -#, fuzzy, no-c-format -msgid "seqhilo" -msgstr "all Prüfung aller Spalten" +#. Tag: literal +#: basic_mapping.xml:996 +#, no-c-format +msgid "seqhilo" +msgstr "seqhilo" #. Tag: para +#: basic_mapping.xml:999 #, no-c-format msgid "" "uses a hi/lo algorithm to efficiently generate identifiers of type " @@ -1249,42 +2726,123 @@ msgstr "" "literal> zu generieren, bei einer vorgegebenen und benannten " "Datenbanksequenz." -#. Tag: term +#. Tag: literal +#: basic_mapping.xml:1007 #, fuzzy, no-c-format -msgid "uuid" -msgstr "id" +msgid "uuid" +msgstr "guid" #. Tag: para -#, fuzzy, no-c-format +#: basic_mapping.xml:1010 +#, no-c-format msgid "" -"uses a 128-bit UUID algorithm to generate identifiers of type string that " -"are unique within a network (the IP address is used). The UUID is encoded as " -"a string of 32 hexadecimal digits in length." +"Generates a 128-bit UUID based on a custom algorithm. The value generated is " +"represented as a string of 32 hexidecimal digits. Users can also configure " +"it to use a separator (config parameter \"separator\") which separates the " +"hexidecimal digits into 8{sep}8{sep}4{sep}8{sep}4. Note specifically that " +"this is different than the IETF RFC 4122 representation of 8-4-4-4-12. If " +"you need RFC 4122 compliant UUIDs, consider using \"uuid2\" generator " +"discussed below." msgstr "" -"verwendet einen 128-bit UUID-Algorithmus, um Bezeichner des String-Typs " -"(Zeichenkettentyp) zu generieren, die innerhalb eines Netzwerks eindeutig " -"sind (die IP-Adresse wird verwendet). Der UUID (Universally Unique " -"Identifier) ist als Zeichenkette hexadezimaler Ziffern von 32 Zeichen Länge " -"verschlüsselt." -#. Tag: term +#. Tag: literal +#: basic_mapping.xml:1023 #, fuzzy, no-c-format -msgid "guid" -msgstr "id" +msgid "uuid2" +msgstr "guid" #. Tag: para +#: basic_mapping.xml:1026 +#, no-c-format +msgid "" +"Generates a IETF RFC 4122 compliant (variant 2) 128-bit UUID. The exact " +"\"version\" (the RFC term) generated depends on the pluggable \"generation " +"strategy\" used (see below). Capable of generating values as java." +"util.UUID, java.lang.String or as a byte " +"array of length 16 (byte[16]). The \"generation strategy" +"\" is defined by the interface org.hibernate.id." +"UUIDGenerationStrategy. The generator defines 2 " +"configuration parameters for defining which generation strategy to use:" +msgstr "" + +#. Tag: literal +#: basic_mapping.xml:1038 +#, no-c-format +msgid "uuid_gen_strategy_class" +msgstr "" + +#. Tag: para +#: basic_mapping.xml:1041 +#, no-c-format +msgid "Names the UUIDGenerationStrategy class to use" +msgstr "" + +#. Tag: literal +#: basic_mapping.xml:1047 +#, no-c-format +msgid "uuid_gen_strategy" +msgstr "" + +#. Tag: para +#: basic_mapping.xml:1050 +#, no-c-format +msgid "Names the UUIDGenerationStrategy instance to use" +msgstr "" + +#. Tag: para +#: basic_mapping.xml:1056 +#, no-c-format +msgid "Out of the box, comes with the following strategies:" +msgstr "" + +#. Tag: para +#: basic_mapping.xml:1059 +#, no-c-format +msgid "" +"org.hibernate.id.uuid.StandardRandomStrategy (the " +"default) - generates \"version 3\" (aka, \"random\") UUID values via the " +"randomUUID method of java.util.UUID" +msgstr "" + +#. Tag: para +#: basic_mapping.xml:1067 +#, no-c-format +msgid "" +"org.hibernate.id.uuid.CustomVersionOneStrategy - " +"generates \"version 1\" UUID values, using IP address since mac address not " +"available. If you need mac address to be used, consider leveraging one of " +"the existing third party UUID generators which sniff out mac address and " +"integrating it via the org.hibernate.id." +"UUIDGenerationStrategy contract. Two such libraries known at " +"time of this writing include http://johannburkard.de/software/uuid/ and http://commons.apache.org/" +"sandbox/id/uuid.html" +msgstr "" + +#. Tag: literal +#: basic_mapping.xml:1085 +#, no-c-format +msgid "guid" +msgstr "guid" + +#. Tag: para +#: basic_mapping.xml:1088 #, no-c-format msgid "uses a database-generated GUID string on MS SQL Server and MySQL." msgstr "" "verwendet einen von der Datenbank generierten GUID-String auf dem MS SQL " "Server und MySQL." -#. Tag: term -#, fuzzy, no-c-format -msgid "native" -msgstr "name: Der Property-Name." +#. Tag: literal +#: basic_mapping.xml:1094 +#, no-c-format +msgid "native" +msgstr "native" #. Tag: para +#: basic_mapping.xml:1097 #, fuzzy, no-c-format msgid "" "selects identity, sequence or " @@ -1295,12 +2853,14 @@ msgstr "" "hilo je nach Leistungsfähigkeit der zu Grunde liegenden " "Datenbank." -#. Tag: term -#, fuzzy, no-c-format -msgid "assigned" -msgstr "name: Der Property-Name." +#. Tag: literal +#: basic_mapping.xml:1105 +#, no-c-format +msgid "assigned" +msgstr "assigned" #. Tag: para +#: basic_mapping.xml:1108 #, fuzzy, no-c-format msgid "" "lets the application assign an identifier to the object before save" @@ -1311,12 +2871,14 @@ msgstr "" " aufgerufen wird. Falls kein <generator>-" "Element festgelegt ist, so ist dies die Standardstrategie." -#. Tag: term -#, fuzzy, no-c-format -msgid "select" -msgstr "all Prüfung aller Spalten" +#. Tag: literal +#: basic_mapping.xml:1117 +#, no-c-format +msgid "select" +msgstr "select" #. Tag: para +#: basic_mapping.xml:1120 #, fuzzy, no-c-format msgid "" "retrieves a primary key, assigned by a database trigger, by selecting the " @@ -1326,12 +2888,14 @@ msgstr "" "Reihe durch einen eindeutigen Schlüssel ausgewählt und der Wert des " "Primärschlüssels abgefragt wird." -#. Tag: term -#, fuzzy, no-c-format -msgid "foreign" -msgstr "name: Der Property-Name." +#. Tag: literal +#: basic_mapping.xml:1127 +#, no-c-format +msgid "foreign" +msgstr "foreign" #. Tag: para +#: basic_mapping.xml:1130 #, fuzzy, no-c-format msgid "" "uses the identifier of another associated object. It is usually used in " @@ -1342,12 +2906,14 @@ msgstr "" "Verbindung mit einer <one-to-one>-Assoziation des " "Primärschlüssels verwendet." -#. Tag: term +#. Tag: literal +#: basic_mapping.xml:1138 #, fuzzy, no-c-format -msgid "sequence-identity" +msgid "sequence-identity" msgstr "sequence-identity" #. Tag: para +#: basic_mapping.xml:1141 #, fuzzy, no-c-format msgid "" "a specialized sequence generation strategy that utilizes a database sequence " @@ -1366,11 +2932,13 @@ msgstr "" "eines Bugs innerhalb der Oracle Treiber deaktiviert sind." #. Tag: title +#: basic_mapping.xml:1155 #, no-c-format msgid "Hi/lo algorithm" msgstr "Hi/lo-Algorithmus" #. Tag: para +#: basic_mapping.xml:1157 #, fuzzy, no-c-format msgid "" "The hilo and seqhilo generators " @@ -1386,7 +2954,46 @@ msgstr "" "nächstverfügbaren \"hi\"-Wert enthält. Die zweite verwendet eine Sequenz " "nach Oracle-Art (falls unterstützt)." +#. Tag: programlisting +#: basic_mapping.xml:1163 +#, fuzzy, no-c-format +msgid "" +"<id name=\"id\" type=\"long\" column=\"cat_id\">\n" +" <generator class=\"hilo\">\n" +" <param name=\"table\">hi_value</param>\n" +" <param name=\"column\">next_value</param>\n" +" <param name=\"max_lo\">100</param>\n" +" </generator>\n" +"</id>" +msgstr "" +"<id name=\"id\" type=\"long\" column=\"cat_id\">\n" +" <generator class=\"hilo\">\n" +" <param name=\"table\">hi_value</param>\n" +" <param name=\"column\">next_value</param>\n" +" <param name=\"max_lo\">100</param>\n" +" </generator>\n" +"</id>" + +#. Tag: programlisting +#: basic_mapping.xml:1165 +#, fuzzy, no-c-format +msgid "" +"<id name=\"id\" type=\"long\" column=\"cat_id\">\n" +" <generator class=\"seqhilo\">\n" +" <param name=\"sequence\">hi_value</param>\n" +" <param name=\"max_lo\">100</param>\n" +" </generator>\n" +"</id>" +msgstr "" +"<id name=\"id\" type=\"long\" column=\"cat_id\">\n" +" <generator class=\"seqhilo\">\n" +" <param name=\"sequence\">hi_value</param>\n" +" <param name=\"max_lo\">100</param>\n" +" </generator>\n" +"</id>" + #. Tag: para +#: basic_mapping.xml:1167 #, fuzzy, no-c-format msgid "" "Unfortunately, you cannot use hilo when supplying your " @@ -1402,11 +3009,13 @@ msgstr "" "transaction.manager_lookup_class korrekt konfigurieren." #. Tag: title +#: basic_mapping.xml:1175 #, no-c-format msgid "UUID algorithm" msgstr "UUID-Algorithmus" #. Tag: para +#: basic_mapping.xml:1177 #, fuzzy, no-c-format msgid "" "The UUID contains: IP address, startup time of the JVM that is accurate to a " @@ -1421,11 +3030,13 @@ msgstr "" "Option ohne Verwendung von JNI handelt." #. Tag: title +#: basic_mapping.xml:1185 #, no-c-format msgid "Identity columns and sequences" msgstr "Identitätsspalten und Sequenzen" #. Tag: para +#: basic_mapping.xml:1187 #, fuzzy, no-c-format msgid "" "For databases that support identity columns (DB2, MySQL, Sybase, MS SQL), " @@ -1441,7 +3052,40 @@ msgstr "" "sequence-Art verwenden. Bei beiden Strategien muss ein " "neues Objekt durch zwei SQL-Anfragen eingefügt werden." +#. Tag: programlisting +#: basic_mapping.xml:1195 +#, fuzzy, no-c-format +msgid "" +"<id name=\"id\" type=\"long\" column=\"person_id\">\n" +" <generator class=\"sequence\">\n" +" <param name=\"sequence\">person_id_sequence</" +"param>\n" +" </generator>\n" +"</id>" +msgstr "" +"<id name=\"id\" type=\"long\" column=\"person_id\">\n" +" <generator class=\"sequence\">\n" +" <param name=\"sequence\">person_id_sequence</" +"param>\n" +" </generator>\n" +"</id>" + +#. Tag: programlisting +#: basic_mapping.xml:1197 +#, fuzzy, no-c-format +msgid "" +"<id name=\"id\" type=\"long\" column=\"person_id\" unsaved-value=\"0" +"\">\n" +" <generator class=\"identity\"/>\n" +"</id>" +msgstr "" +"<id name=\"id\" type=\"long\" column=\"person_id\" unsaved-value=\"0" +"\">\n" +" <generator class=\"identity\"/>\n" +"</id>" + #. Tag: para +#: basic_mapping.xml:1199 #, fuzzy, no-c-format msgid "" "For cross-platform development, the native strategy will, " @@ -1455,11 +3099,13 @@ msgstr "" "der zu Grunde liegenden Datenbank die entsprechende aus." #. Tag: title +#: basic_mapping.xml:1207 #, no-c-format msgid "Assigned identifiers" msgstr "Zugeordnete Bezeichner" #. Tag: para +#: basic_mapping.xml:1209 #, fuzzy, no-c-format msgid "" "If you want the application to assign identifiers, as opposed to having " @@ -1467,8 +3113,8 @@ msgid "" "generator. This special generator uses the identifier value already assigned " "to the object's identifier property. The generator is used when the primary " "key is a natural key instead of a surrogate key. This is the default " -"behavior if you do not specify a <generator> " -"element." +"behavior if you do not specify @GeneratedValue nor " +"<generator> elements." msgstr "" "Falls die Anwendung Bezeichner zuordnen soll (statt deren Generierung durch " "Hibernate), so können Sie den assigned-Generator " @@ -1479,6 +3125,7 @@ msgstr "" "wenn Sie kein <generator>-Element festlegen." #. Tag: para +#: basic_mapping.xml:1218 #, fuzzy, no-c-format msgid "" "The assigned generator makes Hibernate use " @@ -1494,17 +3141,38 @@ msgstr "" "Interceptor.isUnsaved() definieren." #. Tag: title +#: basic_mapping.xml:1226 #, no-c-format msgid "Primary keys assigned by triggers" msgstr "Durch Trigger zugeordnete Primärschlüssel" #. Tag: para +#: basic_mapping.xml:1228 #, fuzzy, no-c-format msgid "" "Hibernate does not generate DDL with triggers. It is for legacy schemas only." msgstr "Nur für Legacy-Schemas (Hibernate generiert DDL nicht mit Triggern)." +#. Tag: programlisting +#: basic_mapping.xml:1231 +#, fuzzy, no-c-format +msgid "" +"<id name=\"id\" type=\"long\" column=\"person_id\">\n" +" <generator class=\"select\">\n" +" <param name=\"key\">socialSecurityNumber</" +"param>\n" +" </generator>\n" +"</id>" +msgstr "" +"<id name=\"id\" type=\"long\" column=\"person_id\">\n" +" <generator class=\"select\">\n" +" <param name=\"key\">socialSecurityNumber</" +"param>\n" +" </generator>\n" +"</id>" + #. Tag: para +#: basic_mapping.xml:1233 #, fuzzy, no-c-format msgid "" "In the above example, there is a unique valued property named " @@ -1518,11 +3186,102 @@ msgstr "" "person_id, dessen Wert durch einen Trigger generiert wird." #. Tag: title +#: basic_mapping.xml:1241 +#, no-c-format +msgid "Identity copy (foreign generator)" +msgstr "" + +#. Tag: para +#: basic_mapping.xml:1243 +#, no-c-format +msgid "" +"Finally, you can ask Hibernate to copy the identifier from another " +"associated entity. In the Hibernate jargon, it is known as a foreign " +"generator but the JPA mapping reads better and is encouraged." +msgstr "" + +#. Tag: programlisting +#: basic_mapping.xml:1248 +#, no-c-format +msgid "" +"@Entity\n" +"class MedicalHistory implements Serializable {\n" +" @Id @OneToOne\n" +" @JoinColumn(name = \"person_id\")\n" +" Person patient;\n" +"}\n" +"\n" +"@Entity\n" +"public class Person implements Serializable {\n" +" @Id @GeneratedValue Integer id;\n" +"}" +msgstr "" + +#. Tag: para +#: basic_mapping.xml:1250 +#, fuzzy, no-c-format +msgid "Or alternatively" +msgstr "Metadata-Alternativen" + +#. Tag: programlisting +#: basic_mapping.xml:1252 +#, no-c-format +msgid "" +"@Entity\n" +"class MedicalHistory implements Serializable {\n" +" @Id Integer id;\n" +"\n" +" @MapsId @OneToOne\n" +" @JoinColumn(name = \"patient_id\")\n" +" Person patient;\n" +"}\n" +"\n" +"@Entity\n" +"class Person {\n" +" @Id @GeneratedValue Integer id;\n" +"}" +msgstr "" + +#. Tag: para +#: basic_mapping.xml:1254 +#, no-c-format +msgid "In hbm.xml use the following approach:" +msgstr "" + +#. Tag: programlisting +#: basic_mapping.xml:1256 +#, fuzzy, no-c-format +msgid "" +"<class name=\"MedicalHistory\">\n" +" <id name=\"id\">\n" +" <generator class=\"foreign\">\n" +" <param name=\"property\">patient</param>\n" +" </generator>\n" +" </id>\n" +" <one-to-one name=\"patient\" class=\"Person\" constrained=\"true\"/" +">\n" +"</class>" +msgstr "" +"<class name=\"person\" table=\"PERSON\">\n" +" <id name=\"id\" column=\"PERSON_ID\">\n" +" <generator class=\"foreign\">\n" +" <param name=\"property\">employee</param>\n" +" </generator>\n" +" </id>\n" +" ...\n" +" <one-to-one name=\"employee\"\n" +" class=\"Employee\"\n" +" constrained=\"true\"/>\n" +"</class>" + +#. Tag: title +#: basic_mapping.xml:1261 #, fuzzy, no-c-format msgid "Enhanced identifier generators" msgstr "Die \"Getter\"-Methode des Bezeichners" #. Tag: para +#: basic_mapping.xml:1263 #, no-c-format msgid "" "Starting with release 3.2.3, there are 2 new generators which represent a re-" @@ -1535,6 +3294,7 @@ msgid "" msgstr "" #. Tag: para +#: basic_mapping.xml:1272 #, no-c-format msgid "" "The first of these new generators is org.hibernate.id.enhanced." @@ -1556,6 +3316,7 @@ msgid "" msgstr "" #. Tag: para +#: basic_mapping.xml:1291 #, fuzzy, no-c-format msgid "" "sequence_name (optional, defaults to " @@ -1566,6 +3327,7 @@ msgstr "" "class) der Name der Diskriminatorspalte." #. Tag: para +#: basic_mapping.xml:1297 #, fuzzy, no-c-format msgid "" "initial_value (optional, defaults to 1increment_size (optional - defaults to 1force_table_use (optional - defaults to falsevalue_column (optional - defaults to next_valclass) der Name der Diskriminatorspalte." #. Tag: para +#: basic_mapping.xml:1326 #, fuzzy, no-c-format msgid "" "optimizer (optional - defaults to none): See " +"literal>): See" msgstr "" "cascade (optional- die Standardeinstellung lautet " "none): der \"Cascade-Style\" (Weitergabestil)." #. Tag: para +#: basic_mapping.xml:1332 #, no-c-format msgid "" "The second of these new generators is org.hibernate.id.enhanced." @@ -1636,6 +3402,7 @@ msgid "" msgstr "" #. Tag: para +#: basic_mapping.xml:1345 #, fuzzy, no-c-format msgid "" "table_name (optional - defaults to " @@ -1645,6 +3412,7 @@ msgstr "" "integer): Der Versionsnummerntyp." #. Tag: para +#: basic_mapping.xml:1351 #, fuzzy, no-c-format msgid "" "value_column_name (optional - defaults to " @@ -1655,6 +3423,7 @@ msgstr "" "class) der Name der Diskriminatorspalte." #. Tag: para +#: basic_mapping.xml:1357 #, fuzzy, no-c-format msgid "" "segment_column_name (optional - defaults to " @@ -1667,6 +3436,7 @@ msgstr "" "korrespondiert." #. Tag: para +#: basic_mapping.xml:1365 #, fuzzy, no-c-format msgid "" "segment_value (optional - defaults to defaultsegment_value_length (optional - defaults to " @@ -1688,6 +3459,7 @@ msgstr "" "class) der Name der Diskriminatorspalte." #. Tag: para +#: basic_mapping.xml:1378 #, fuzzy, no-c-format msgid "" "initial_value (optional - defaults to 1integer): Der Versionsnummerntyp." #. Tag: para +#: basic_mapping.xml:1384 #, fuzzy, no-c-format msgid "" "increment_size (optional - defaults to 1integer): Der Versionsnummerntyp." #. Tag: para +#: basic_mapping.xml:1390 #, fuzzy, no-c-format msgid "" -"optimizer (optional - defaults to ): " -"See " +"optimizer (optional - defaults to ??): " +"See ." msgstr "" "cascade (optional- die Standardeinstellung lautet " "none): der \"Cascade-Style\" (Weitergabestil)." #. Tag: title +#: basic_mapping.xml:1397 #, fuzzy, no-c-format msgid "Identifier generator optimization" msgstr "Die \"Getter\"-Methode des Bezeichners" #. Tag: para +#: basic_mapping.xml:1399 #, no-c-format msgid "" "For identifier generators that store values in the database, it is " @@ -1727,11 +3503,12 @@ msgid "" "a new identifier value. Instead, you can group a bunch of them in memory and " "only hit the database when you have exhausted your in-memory value group. " "This is the role of the pluggable optimizers. Currently only the two " -"enhanced generators ( " +"enhanced generators ( " "support this operation." msgstr "" #. Tag: para +#: basic_mapping.xml:1410 #, no-c-format msgid "" "none (generally this is the default if no optimizer was " @@ -1740,6 +3517,7 @@ msgid "" msgstr "" #. Tag: para +#: basic_mapping.xml:1417 #, no-c-format msgid "" "hilo: applies a hi/lo algorithm around the database " @@ -1751,6 +3529,7 @@ msgid "" msgstr "" #. Tag: para +#: basic_mapping.xml:1427 #, no-c-format msgid "" "pooled: as with the case of hilo, this " @@ -1762,398 +3541,91 @@ msgid "" msgstr "" #. Tag: title -#, no-c-format -msgid "composite-id" -msgstr "composite-id" - -#. Tag: para +#: basic_mapping.xml:1441 #, fuzzy, no-c-format -msgid "" -"A table with a composite key can be mapped with multiple properties of the " -"class as identifier properties. The <composite-id> " -"element accepts <key-property> property mappings " -"and <key-many-to-one> mappings as child elements." -msgstr "" -"Für eine Tabelle mit einem zusammengesetzten Schlüssel, können Sie mehrere " -"Properties der Klasse als Bezeichner-Properties mappen. Das <" -"composite-id>-Element akzeptiert <key-property>-Property-Mappings und <key-many-to-one>-" -"Mappings als untergeordnete Elemente." - -#. Tag: para -#, fuzzy, no-c-format -msgid "" -"The persistent class must override equals() and hashCode() to implement composite identifier " -"equality. It must also implement Serializable." -msgstr "" -"Ihre persistente Klasse muss sowohl equals() als auch hashCode() außer Kraft setzen, um die " -"Gleichwertigkeit zusammengesetzter Bezeichner zu implementieren. Sie muss " -"außerdem Serializable implementieren." - -#. Tag: para -#, fuzzy, no-c-format -msgid "" -"Unfortunately, this approach means that a persistent object is its own " -"identifier. There is no convenient \"handle\" other than the object itself. " -"You must instantiate an instance of the persistent class itself and populate " -"its identifier properties before you can load() the " -"persistent state associated with a composite key. We call this approach an " -"embedded composite identifier, and discourage it for " -"serious applications." -msgstr "" -"Leider bedeutet diese Vorgehensweise bei zusammengesetzten Bezeichnern, dass " -"ein persistentes Objekt sein eigener Bezeichner ist. Es existiert keine " -"praktische \"Handhabung\" außer dem Objekt selbst. Sie müssen eine Instanz " -"der persistenten Klasse selbst instanziieren und deren Bezeichner-Properties " -"auffüllen, ehe Sie mit load() den persistenten Status " -"eines zugehörigen zusammengesetzten Schlüssels laden können. Diese " -"Vorgehensweise gilt als eingebetteter (\"embedded\") " -"zusammengesetzter Bezeichner und wird nicht für ernsthafte Anwendungen " -"empfohlen." +msgid "Partial identifier generation" +msgstr "Die \"Getter\"-Methode des Bezeichners" #. Tag: para +#: basic_mapping.xml:1443 #, no-c-format msgid "" -"A second approach is what we call a mapped composite " -"identifier, where the identifier properties named inside the <" -"composite-id> element are duplicated on both the persistent " -"class and a separate identifier class." +"Hibernate supports the automatic generation of some of the identifier " +"properties. Simply use the @GeneratedValue annotation " +"on one or several id properties." msgstr "" -"Eine zweite Vorgehensweise trägt den Namen gemappter " -"zusammengesetzter Bezeichner (sog. \"mapped composite identifier\"), wobei " -"die innerhalb des <composite-id>-Elements genannten " -"Bezeichner-Properties sowohl an der persistenten Klasse als auch einer " -"separaten Bezeichnerklasse dupliziert werden." - -#. Tag: para -#, fuzzy, no-c-format -msgid "" -"In this example, both the composite identifier class, MedicareId, and the entity class itself have properties named " -"medicareNumber and dependent. The " -"identifier class must override equals() and " -"hashCode() and implement Serializable. " -"The main disadvantage of this approach is code duplication." -msgstr "" -"In diesem Beispiel besitzen sowohl die Klasse des zusammengesetzten " -"Bezeichners MedicareId als auch die Entity-Klasse selbst " -"Properties mit dem Namen medicareNumber und " -"dependent. Die Bezeichnerklasse muss equals() und hashCode() außer Kraft setzen und " -"Serializable implementieren. Der Nachteil dieser " -"Vorgehensweise ist offensichtlich— Code-Duplizierung." #. Tag: para +#: basic_mapping.xml:1449 #, no-c-format msgid "" -"The following attributes are used to specify a mapped composite identifier:" +"The Hibernate team has always felt such a construct as fundamentally wrong. " +"Try hard to fix your data model before using this feature." +msgstr "" + +#. Tag: programlisting +#: basic_mapping.xml:1454 +#, no-c-format +msgid "" +"@Entity\n" +"public class CustomerInventory implements Serializable {\n" +" @Id\n" +" @TableGenerator(name = \"inventory\",\n" +" table = \"U_SEQUENCES\",\n" +" pkColumnName = \"S_ID\",\n" +" valueColumnName = \"S_NEXTNUM\",\n" +" pkColumnValue = \"inventory\",\n" +" allocationSize = 1000)\n" +" @GeneratedValue(strategy = GenerationType.TABLE, generator = \"inventory" +"\")\n" +" Integer id;\n" +"\n" +"\n" +" @Id @ManyToOne(cascade = CascadeType.MERGE)\n" +" Customer customer;\n" +"}\n" +"\n" +"@Entity\n" +"public class Customer implements Serializable {\n" +" @Id\n" +" private int id;\n" +"}" msgstr "" -"Die folgenden Attribute werden verwendet, um einen gemappten " -"zusammengesetzten Bezeichner zu bestimmen:" #. Tag: para -#, fuzzy, no-c-format +#: basic_mapping.xml:1456 +#, no-c-format msgid "" -"mapped (optional - defaults to false): " -"indicates that a mapped composite identifier is used, and that the contained " -"property mappings refer to both the entity class and the composite " -"identifier class." +"You can also generate properties inside an @EmbeddedId class." msgstr "" -"mapped (optional, Standardeinstellung false): zeigt an, dass ein gemappter zusammengesetzter Bezeichner " -"verwendet wird und die enthaltenen Property-Mappings auf die Entity-Klasse " -"und die zusammengesetzte Bezeichnerklasse verweisen." - -#. Tag: para -#, fuzzy, no-c-format -msgid "" -"class (optional - but required for a mapped composite " -"identifier): the class used as a composite identifier." -msgstr "" -"class (optional, für einen gemappten Bezeichner jedoch " -"erforderlich): Die als zusammengesetzter Bezeichner verwendete Klasse." - -#. Tag: para -#, fuzzy, no-c-format -msgid "" -"We will describe a third, even more convenient approach, where the composite " -"identifier is implemented as a component class in . The attributes described below apply only to this " -"alternative approach:" -msgstr "" -"Abschließend erläutern wir einen dritte, noch praktischere Vorgehensweise, " -"bei der der zusammengesetzte Bezeichner als Komponentenklasse in implementiert wird. Die unten " -"beschriebenen Attribute gelten nur für diese Vorgehensweise:" - -#. Tag: para -#, fuzzy, no-c-format -msgid "" -"name (optional - required for this approach): a property " -"of component type that holds the composite identifier. Please see chapter 9 " -"for more information." -msgstr "" -"name (optional, bei dieser Vorgehensweise erforderlich): " -"Eine Property nach Komponententyp, die den zusammengesetzten Bezeichner " -"enthält (siehe Kapitel 9)." - -#. Tag: para -#, fuzzy, no-c-format -msgid "" -"access (optional - defaults to property): the strategy Hibernate uses for accessing the property value." -msgstr "" -"access (optional - Standardeinstellung ist " -"property): Die Strategie, die Hibernate für den Zugriff " -"auf den Property-Wert verwenden soll." - -#. Tag: para -#, fuzzy, no-c-format -msgid "" -"class (optional - defaults to the property type " -"determined by reflection): the component class used as a composite " -"identifier. Please see the next section for more information." -msgstr "" -"class (optional - Standardeinstellung ist der durch die " -"Reflexion bestimmte Property-Typ): Die als ein zusammengesetzter " -"Bezeichnerverwendete Komponentenklasse (siehe nächster Abschnitt)." - -#. Tag: para -#, fuzzy, no-c-format -msgid "" -"The third approach, an identifier component, is " -"recommended for almost all applications." -msgstr "" -"Bei dieser dritten Vorhegensweise empfehlen wir eine " -"Bezeichnerkomponente für fast alle Anwendungen." #. Tag: title -#, fuzzy, no-c-format -msgid "Discriminator" -msgstr "discriminator" - -#. Tag: para -#, fuzzy, no-c-format -msgid "" -"The <discriminator> element is required for " -"polymorphic persistence using the table-per-class-hierarchy mapping " -"strategy. It declares a discriminator column of the table. The discriminator " -"column contains marker values that tell the persistence layer what subclass " -"to instantiate for a particular row. A restricted set of types can be used: " -"string, character, integer, byte, short, " -"boolean, yes_no, true_false." +#: basic_mapping.xml:1462 +#, no-c-format +msgid "Optimistic locking properties (optional)" msgstr "" -"Das <discriminator>-Element wird für die polymorphe " -"Persistenz unter Verwendung der Tabelle-pro-Klasse-Hierarchie (sog. \"table-" -"per-class-hierarchy\") Mapping-Strategie benötigt und deklariert eine " -"Diskriminatorspalte der Tabelle. Diese Diskriminatorspalte enthält " -"Markierungswerte, die der Persistenzschicht mitteilen, welche Subklasse für " -"eine bestimmte Reihe instanziiert werden soll. Ein beschränkter Typensatz " -"kann hierfür verwendet werden: string, " -"character, integer, byte, short, boolean, " -"yes_no, true_false." - -#. Tag: para -#, fuzzy, no-c-format -msgid "" -"column (optional - defaults to class): " -"the name of the discriminator column." -msgstr "" -"column (optional - Standardeinstellung lautet " -"class) der Name der Diskriminatorspalte." - -#. Tag: para -#, fuzzy, no-c-format -msgid "" -"type (optional - defaults to string): " -"a name that indicates the Hibernate type" -msgstr "" -"type (optional - die Standardeinstellung lautet " -"string) ein Name, der den Hibernate-Typ angibt." - -#. Tag: para -#, fuzzy, no-c-format -msgid "" -"force (optional - defaults to false): " -"\"forces\" Hibernate to specify the allowed discriminator values, even when " -"retrieving all instances of the root class." -msgstr "" -"force (optional - die Standardeinstellung lautet " -"false) \"zwingt\" Hibernate dazu, die erlaubten " -"Diskriminatorwerte beim Abruf aller Instanzen der Stammklasse zu " -"spezifizieren." - -#. Tag: para -#, fuzzy, no-c-format -msgid "" -"insert (optional - defaults to true): " -"set this to false if your discriminator column is also " -"part of a mapped composite identifier. It tells Hibernate not to include the " -"column in SQL INSERTs." -msgstr "" -"insert (optional - die Standardeinstellung lautet " -"true) wählen Sie hier die Einstellung false, falls Ihre Diskriminatortspalte auch Teil des zusammengesetzten " -"Bezeichners ist. (Hibernate wird mitgeteilt, die Spalte nicht in SQL " -"INSERTs mit einzuschließen)." - -#. Tag: para -#, fuzzy, no-c-format -msgid "" -"formula (optional): an arbitrary SQL expression that is " -"executed when a type has to be evaluated. It allows content-based " -"discrimination." -msgstr "" -"formula (optional) ein beliebiger SQL-Ausdruck, der " -"ausgeführt wird, wenn ein Typ evaluiert werden muss. Erlaubt inhaltsbasierte " -"Unterscheidung (sog. \"discrimination\")." #. Tag: para +#: basic_mapping.xml:1464 #, no-c-format msgid "" -"Actual values of the discriminator column are specified by the " -"discriminator-value attribute of the <" -"class> and <subclass> elements." +"When using long transactions or conversations that span several database " +"transactions, it is useful to store versioning data to ensure that if the " +"same entity is updated by two conversations, the last to commit changes will " +"be informed and not override the other conversation's work. It guarantees " +"some isolation while still allowing for good scalability and works " +"particularly well in read-often write-sometimes situations." msgstr "" -"Die tatsächlichen Werte der Diskriminatorspalte werden durch das " -"discriminator-value-Attribut der <class> und <subclass>-Elemente spezifiziert." #. Tag: para -#, fuzzy, no-c-format -msgid "" -"The force attribute is only useful if the table contains " -"rows with \"extra\" discriminator values that are not mapped to a persistent " -"class. This will not usually be the case." +#: basic_mapping.xml:1472 +#, no-c-format +msgid "You can use two approaches: a dedicated version number or a timestamp." msgstr "" -"Das force-Attribut ist (nur) von Nutzen, wenn die Tabelle " -"eine Reihe mit \"zusätzlichen\" Diskriminatorwerten enthält, die nicht zu " -"einer persistenten Klasse gemappt sind. Dies ist in der Regel jedoch nicht " -"der Fall." - -#. Tag: para -#, fuzzy, no-c-format -msgid "" -"The formula attribute allows you to declare an arbitrary " -"SQL expression that will be used to evaluate the type of a row. For example:" -msgstr "" -"Mit dem formula-Attribut können Sie einen beliebigen SQL-" -"Ausdruck deklarieren, der dann zur Evaluierung des Reihentyps verwendet wird:" - -#. Tag: title -#, fuzzy, no-c-format -msgid "Version (optional)" -msgstr "version (optional)" - -#. Tag: para -#, fuzzy, no-c-format -msgid "" -"The <version> element is optional and indicates " -"that the table contains versioned data. This is particularly useful if you " -"plan to use long transactions. See below for more " -"information:" -msgstr "" -"Das <version>-Element ist optional und zeigt an, " -"dass die Tabelle versionierte Daten enthält. Das ist insbesondere dann " -"nützlich, wenn Sie vorhaben, lange Transaktionen zu " -"verwenden (siehe unten)." - -#. Tag: para -#, fuzzy, no-c-format -msgid "" -"column (optional - defaults to the property name): the " -"name of the column holding the version number." -msgstr "" -"column (optional - Standardeinstellung ist der Property-" -"Name): Der Name der Spalte, die die Versionsnummer enthält." - -#. Tag: para -#, fuzzy, no-c-format -msgid "" -"name: the name of a property of the persistent class." -msgstr "" -"name: Der Name einer Property der persistenten Klasse." - -#. Tag: para -#, fuzzy, no-c-format -msgid "" -"type (optional - defaults to integer): " -"the type of the version number." -msgstr "" -"type (optional - die Standardeinstellung lautet " -"integer): Der Versionsnummerntyp." - -#. Tag: para -#, fuzzy, no-c-format -msgid "" -"access (optional - defaults to property): the strategy Hibernate uses to access the property value." -msgstr "" -"access (optional - Standardeinstellung ist " -"property): Die Strategie, die Hibernate für den Zugriff " -"auf den Property-Wert verwenden soll." - -#. Tag: para -#, fuzzy, no-c-format -msgid "" -"unsaved-value (optional - defaults to undefined): a version property value that indicates that an instance is newly " -"instantiated (unsaved), distinguishing it from detached instances that were " -"saved or loaded in a previous session. Undefined " -"specifies that the identifier property value should be used." -msgstr "" -"unsaved-value (optional - die Standardeinstellung lautet " -"undefined): Ein Property-Wert der Version, der anzeigt, " -"dass eine Instanz neu instanziiert wurde (ungespeichert) und diese von " -"abgesetzten Instanzen, die in einer vorhergehenden Session bereits " -"gespeichert oder geladen wurden, unterscheidet. (undefined legt fest, dass der Property-Wert des Bezeichners verwendet werden " -"sollte)." - -#. Tag: para -#, fuzzy, no-c-format -msgid "" -"generated (optional - defaults to never): specifies that this version property value is generated by the " -"database. See the discussion of generated properties for more information." -msgstr "" -"generated (optional - die Standardeinstellung lautet " -"never): Legt fest, dass der Property-Wert dieser Version " -"von der Datenbank generiert wird. Siehe dazu auch die Erläuterungen in ." - -#. Tag: para -#, fuzzy, no-c-format -msgid "" -"insert (optional - defaults to true): " -"specifies whether the version column should be included in SQL insert " -"statements. It can be set to false if the database column " -"is defined with a default value of 0." -msgstr "" -"insert (optional - die Standardeinstellung lautet " -"true): Legt fest, ob die Versionsspalte in die SQL " -"Einfügungsanweisungen eingeschlossen werden soll. Die Einstellung kann " -"false lauten, wenn (und nur in diesem Fall) die " -"Datenbankspalte mit dem Standardwert 0 definiert ist." - -#. Tag: para -#, fuzzy, no-c-format -msgid "" -"Version numbers can be of Hibernate type long, " -"integer, short, timestamp or calendar." -msgstr "" -"Die Versionsnummern können vom Hibernate-Typ long, " -"integer, short, timestamp oder calendar sein." #. Tag: para +#: basic_mapping.xml:1475 #, fuzzy, no-c-format msgid "" "A version or timestamp property should never be null for a detached " @@ -2174,17 +3646,202 @@ msgstr "" "Bezeichner oder zusammengesetzte Schlüssel verwenden!" #. Tag: title +#: basic_mapping.xml:1485 +#, no-c-format +msgid "Version number" +msgstr "" + +#. Tag: para +#: basic_mapping.xml:1487 +#, no-c-format +msgid "" +"You can add optimistic locking capability to an entity using the " +"@Version annotation:" +msgstr "" + +#. Tag: programlisting +#: basic_mapping.xml:1490 +#, no-c-format +msgid "" +"@Entity\n" +"public class Flight implements Serializable {\n" +"...\n" +" @Version\n" +" @Column(name=\"OPTLOCK\")\n" +" public Integer getVersion() { ... }\n" +"}" +msgstr "" + +#. Tag: para +#: basic_mapping.xml:1492 +#, no-c-format +msgid "" +"The version property will be mapped to the OPTLOCK " +"column, and the entity manager will use it to detect conflicting updates " +"(preventing lost updates you might otherwise see with the last-commit-wins " +"strategy)." +msgstr "" + +#. Tag: para +#: basic_mapping.xml:1497 +#, no-c-format +msgid "" +"The version column may be a numeric. Hibernate supports any kind of type " +"provided that you define and implement the appropriate " +"UserVersionType." +msgstr "" + +#. Tag: para +#: basic_mapping.xml:1501 +#, no-c-format +msgid "" +"The application must not alter the version number set up by Hibernate in any " +"way. To artificially increase the version number, check in Hibernate Entity " +"Manager's reference documentation LockModeType." +"OPTIMISTIC_FORCE_INCREMENT or LockModeType." +"PESSIMISTIC_FORCE_INCREMENT." +msgstr "" + +#. Tag: para +#: basic_mapping.xml:1507 +#, no-c-format +msgid "" +"If the version number is generated by the database (via a trigger for " +"example), make sure to use @org.hibernate.annotations.Generated" +"(GenerationTime.ALWAYS)." +msgstr "" + +#. Tag: para +#: basic_mapping.xml:1511 +#, no-c-format +msgid "To declare a version property in hbm.xml, use:" +msgstr "" + +#. Tag: programlisting +#: basic_mapping.xml:1530 #, fuzzy, no-c-format -msgid "Timestamp (optional)" +msgid "" +"<version\n" +" column=\"version_column\"\n" +" name=\"propertyName\"\n" +" type=\"typename\"\n" +" access=\"field|property|ClassName\"\n" +" unsaved-value=\"null|negative|undefined\"\n" +" generated=\"never|always\"\n" +" insert=\"true|false\"\n" +" node=\"element-name|@attribute-name|element/@attribute|.\"\n" +"/>" +msgstr "" +"<version\n" +" column=\"version_column\"\n" +" name=\"propertyName\"\n" +" type=\"typename\"\n" +" access=\"field|property|ClassName\"\n" +" unsaved-value=\"null|negative|undefined\"\n" +" generated=\"never|always\"\n" +" insert=\"true|false\"\n" +" node=\"element-name|@attribute-name|element/@attribute|.\"\n" +"/>" + +#. Tag: para +#: basic_mapping.xml:1534 +#, fuzzy, no-c-format +msgid "" +"column (optional - defaults to the property name): the " +"name of the column holding the version number." +msgstr "" +"column (optional - Standardeinstellung ist der Property-" +"Name): Der Name der Spalte, die die Versionsnummer enthält." + +#. Tag: para +#: basic_mapping.xml:1540 +#, fuzzy, no-c-format +msgid "" +"name: the name of a property of the persistent class." +msgstr "" +"name: Der Name einer Property der persistenten Klasse." + +#. Tag: para +#: basic_mapping.xml:1545 +#, fuzzy, no-c-format +msgid "" +"type (optional - defaults to integer): " +"the type of the version number." +msgstr "" +"type (optional - die Standardeinstellung lautet " +"integer): Der Versionsnummerntyp." + +#. Tag: para +#: basic_mapping.xml:1551 +#, fuzzy, no-c-format +msgid "" +"access (optional - defaults to property): the strategy Hibernate uses to access the property value." +msgstr "" +"access (optional - Standardeinstellung ist " +"property): Die Strategie, die Hibernate für den Zugriff " +"auf den Property-Wert verwenden soll." + +#. Tag: para +#: basic_mapping.xml:1557 +#, fuzzy, no-c-format +msgid "" +"unsaved-value (optional - defaults to undefined): a version property value that indicates that an instance is newly " +"instantiated (unsaved), distinguishing it from detached instances that were " +"saved or loaded in a previous session. Undefined " +"specifies that the identifier property value should be used." +msgstr "" +"unsaved-value (optional - die Standardeinstellung lautet " +"undefined): Ein Property-Wert der Version, der anzeigt, " +"dass eine Instanz neu instanziiert wurde (ungespeichert) und diese von " +"abgesetzten Instanzen, die in einer vorhergehenden Session bereits " +"gespeichert oder geladen wurden, unterscheidet. (undefined legt fest, dass der Property-Wert des Bezeichners verwendet werden " +"sollte)." + +#. Tag: para +#: basic_mapping.xml:1567 +#, fuzzy, no-c-format +msgid "" +"generated (optional - defaults to never): specifies that this version property value is generated by the " +"database. See the discussion of generated properties for more information." +msgstr "" +"generated (optional - die Standardeinstellung lautet " +"never): Legt fest, dass der Property-Wert dieser Version " +"von der Datenbank generiert wird. Siehe dazu auch die Erläuterungen in ." + +#. Tag: para +#: basic_mapping.xml:1575 +#, fuzzy, no-c-format +msgid "" +"insert (optional - defaults to true): " +"specifies whether the version column should be included in SQL insert " +"statements. It can be set to false if the database column " +"is defined with a default value of 0." +msgstr "" +"insert (optional - die Standardeinstellung lautet " +"true): Legt fest, ob die Versionsspalte in die SQL " +"Einfügungsanweisungen eingeschlossen werden soll. Die Einstellung kann " +"false lauten, wenn (und nur in diesem Fall) die " +"Datenbankspalte mit dem Standardwert 0 definiert ist." + +#. Tag: title +#: basic_mapping.xml:1586 +#, fuzzy, no-c-format +msgid "Timestamp" msgstr "Zeitstempel (optional)" #. Tag: para +#: basic_mapping.xml:1588 #, fuzzy, no-c-format msgid "" -"The optional <timestamp> element indicates that the " -"table contains timestamped data. This provides an alternative to versioning. " -"Timestamps are a less safe implementation of optimistic locking. However, " -"sometimes the application might use the timestamps in other ways." +"Alternatively, you can use a timestamp. Timestamps are a less safe " +"implementation of optimistic locking. However, sometimes the application " +"might use the timestamps in other ways." msgstr "" "Das optionale <timestamp>-Element zeigt an, dass " "die Tabelle Daten mit Zeitstempel enthält. Dies ist als Alternative zur " @@ -2193,6 +3850,67 @@ msgstr "" "Zeitstempel manchmal auf andere Weise benutzen." #. Tag: para +#: basic_mapping.xml:1592 +#, no-c-format +msgid "" +"Simply mark a property of type Date or " +"Calendar as @Version." +msgstr "" + +#. Tag: programlisting +#: basic_mapping.xml:1596 +#, no-c-format +msgid "" +"@Entity\n" +"public class Flight implements Serializable {\n" +"...\n" +" @Version\n" +" public Date getLastUpdate() { ... }\n" +"}" +msgstr "" + +#. Tag: para +#: basic_mapping.xml:1598 +#, no-c-format +msgid "" +"Like version numbers, the timestamp can be generated by the database instead " +"of Hibernate. To do that, use @org.hibernate.annotations.Generated" +"(GenerationTime.ALWAYS)." +msgstr "" + +#. Tag: para +#: basic_mapping.xml:1602 +#, fuzzy, no-c-format +msgid "In hbm.xml, use the <timestamp> element:" +msgstr "" +"Nehmen wir etwa das folgende <properties>-Mapping:" + +#. Tag: programlisting +#: basic_mapping.xml:1620 +#, fuzzy, no-c-format +msgid "" +"<timestamp\n" +" column=\"timestamp_column\"\n" +" name=\"propertyName\"\n" +" access=\"field|property|ClassName\"\n" +" unsaved-value=\"null|undefined\"\n" +" source=\"vm|db\"\n" +" generated=\"never|always\"\n" +" node=\"element-name|@attribute-name|element/@attribute|.\"\n" +"/>" +msgstr "" +"<timestamp\n" +" column=\"timestamp_column\"\n" +" name=\"propertyName\"\n" +" access=\"field|property|ClassName\"\n" +" unsaved-value=\"null|undefined\"\n" +" source=\"vm|db\"\n" +" generated=\"never|always\"\n" +" node=\"element-name|@attribute-name|element/@attribute|.\"\n" +"/>" + +#. Tag: para +#: basic_mapping.xml:1624 #, fuzzy, no-c-format msgid "" "column (optional - defaults to the property name): the " @@ -2202,6 +3920,7 @@ msgstr "" "Property-Name): Der Name einer Spalte, die den Zeitstempel enthält." #. Tag: para +#: basic_mapping.xml:1630 #, fuzzy, no-c-format msgid "" "name: the name of a JavaBeans style property of Java type " @@ -2213,6 +3932,19 @@ msgstr "" "persistenten Klasse." #. Tag: para +#: basic_mapping.xml:1636 basic_mapping.xml:2163 basic_mapping.xml:2380 +#: basic_mapping.xml:3226 basic_mapping.xml:3420 basic_mapping.xml:3593 +#, fuzzy, no-c-format +msgid "" +"access (optional - defaults to property): the strategy Hibernate uses for accessing the property value." +msgstr "" +"access (optional - Standardeinstellung ist " +"property): Die Strategie, die Hibernate für den Zugriff " +"auf den Property-Wert verwenden soll." + +#. Tag: para +#: basic_mapping.xml:1642 #, fuzzy, no-c-format msgid "" "unsaved-value (optional - defaults to nullsource (optional - defaults to vm): " @@ -2252,6 +3985,7 @@ msgstr "" "8)." #. Tag: para +#: basic_mapping.xml:1665 #, fuzzy, no-c-format msgid "" "generated (optional - defaults to never." #. Tag: title +#: basic_mapping.xml:1675 #, no-c-format msgid "Note" msgstr "" #. Tag: para +#: basic_mapping.xml:1677 #, fuzzy, no-c-format msgid "" "<Timestamp> is equivalent to <version " @@ -2283,11 +4019,793 @@ msgstr "" "type=\"dbtimestamp\"> ist" #. Tag: title +#: basic_mapping.xml:1686 #, fuzzy, no-c-format msgid "Property" msgstr "property" #. Tag: para +#: basic_mapping.xml:1688 +#, no-c-format +msgid "" +"You need to decide which property needs to be made persistent in a given " +"entity. This differs slightly between the annotation driven metadata and the " +"hbm.xml files." +msgstr "" + +#. Tag: title +#: basic_mapping.xml:1693 +#, no-c-format +msgid "Property mapping with annotations" +msgstr "" + +#. Tag: para +#: basic_mapping.xml:1695 +#, no-c-format +msgid "" +"In the annotations world, every non static non transient property (field or " +"method depending on the access type) of an entity is considered persistent, " +"unless you annotate it as @Transient. Not having an " +"annotation for your property is equivalent to the appropriate " +"@Basic annotation." +msgstr "" + +#. Tag: para +#: basic_mapping.xml:1702 +#, no-c-format +msgid "" +"The @Basic annotation allows you to declare the fetching " +"strategy for a property. If set to LAZY, specifies that " +"this property should be fetched lazily when the instance variable is first " +"accessed. It requires build-time bytecode instrumentation, if your classes " +"are not instrumented, property level lazy loading is silently ignored. The " +"default is EAGER. You can also mark a property as not " +"optional thanks to the @Basic.optional attribute. " +"This will ensure that the underlying column are not nullable (if possible). " +"Note that a better approach is to use the @NotNull " +"annotation of the Bean Validation specification." +msgstr "" + +#. Tag: para +#: basic_mapping.xml:1715 +#, no-c-format +msgid "Let's look at a few examples:" +msgstr "" + +#. Tag: programlisting +#: basic_mapping.xml:1717 +#, no-c-format +msgid "" +"public transient int counter; //transient property\n" +"\n" +"private String firstname; //persistent property\n" +"\n" +"@Transient\n" +"String getLengthInMeter() { ... } //transient property\n" +"\n" +"String getName() {... } // persistent property\n" +"\n" +"@Basic\n" +"int getLength() { ... } // persistent property\n" +"\n" +"@Basic(fetch = FetchType.LAZY)\n" +"String getDetailedComment() { ... } // persistent property\n" +"\n" +"@Temporal(TemporalType.TIME)\n" +"java.util.Date getDepartureTime() { ... } // persistent property \n" +"\n" +"@Enumerated(EnumType.STRING)\n" +"Starred getNote() { ... } //enum persisted as String in database" +msgstr "" + +#. Tag: para +#: basic_mapping.xml:1719 +#, no-c-format +msgid "" +"counter, a transient field, and lengthInMeter, a method annotated as @Transient, and will be " +"ignored by the Hibernate. name, length, and firstname properties are mapped persistent " +"and eagerly fetched (the default for simple properties). The " +"detailedComment property value will be lazily fetched " +"from the database once a lazy property of the entity is accessed for the " +"first time. Usually you don't need to lazy simple properties (not to be " +"confused with lazy association fetching). The recommended alternative is to " +"use the projection capability of JP-QL (Java Persistence Query Language) or " +"Criteria queries." +msgstr "" + +#. Tag: para +#: basic_mapping.xml:1732 +#, no-c-format +msgid "" +"JPA support property mapping of all basic types supported by Hibernate (all " +"basic Java types , their respective wrappers and serializable classes). " +"Hibernate Annotations supports out of the box enum type mapping either into " +"a ordinal column (saving the enum ordinal) or a string based column (saving " +"the enum string representation): the persistence representation, defaulted " +"to ordinal, can be overridden through the @Enumerated " +"annotation as shown in the note property example." +msgstr "" + +#. Tag: para +#: basic_mapping.xml:1742 +#, no-c-format +msgid "" +"In plain Java APIs, the temporal precision of time is not defined. When " +"dealing with temporal data you might want to describe the expected precision " +"in database. Temporal data can have DATE, TIME, or TIMESTAMP precision (ie the actual date, " +"only the time, or both). Use the @Temporal annotation to " +"fine tune that." +msgstr "" + +#. Tag: para +#: basic_mapping.xml:1750 +#, no-c-format +msgid "" +"@Lob indicates that the property should be persisted in a " +"Blob or a Clob depending on the property type: java.sql.Clob, Character[], char[] and java.lang.String will be persisted in " +"a Clob. java.sql.Blob, Byte[], " +"byte[] and Serializable type " +"will be persisted in a Blob." +msgstr "" + +#. Tag: programlisting +#: basic_mapping.xml:1759 +#, no-c-format +msgid "" +"@Lob\n" +"public String getFullText() {\n" +" return fullText;\n" +"}\n" +"\n" +"@Lob\n" +"public byte[] getFullCode() {\n" +" return fullCode;\n" +"}" +msgstr "" + +#. Tag: para +#: basic_mapping.xml:1761 +#, no-c-format +msgid "" +"If the property type implements java.io.Serializable " +"and is not a basic type, and if the property is not annotated with " +"@Lob, then the Hibernate serializable " +"type is used." +msgstr "" + +#. Tag: title +#: basic_mapping.xml:1768 +#, no-c-format +msgid "Type" +msgstr "" + +#. Tag: para +#: basic_mapping.xml:1770 +#, no-c-format +msgid "" +"You can also manually specify a type using the @org.hibernate." +"annotations.Type and some parameters if needed. @Type." +"type could be:" +msgstr "" + +#. Tag: para +#: basic_mapping.xml:1777 basic_mapping.xml:2209 +#, fuzzy, no-c-format +msgid "" +"The name of a Hibernate basic type: integer, string, character, " +"date, timestamp, float, binary, serializable, object, blob etc." +msgstr "" +"Der Name eines Hibernate Grundtyps (z.B. integer, string, " +"character, date, timestamp, float, binary, serializable, object, blob)." + +#. Tag: para +#: basic_mapping.xml:1783 basic_mapping.xml:2215 +#, fuzzy, no-c-format +msgid "" +"The name of a Java class with a default basic type: int, float, " +"char, java.lang.String, java.util.Date, java.lang.Integer, java.sql.Clob etc." +msgstr "" +"Der Name einer Java-Klasse mit einem Grundtyp als Standard (z.B. " +"int, float, char, java.lang.String, java.util.Date, java.lang." +"Integer, java.sql.Clob)." + +#. Tag: para +#: basic_mapping.xml:1789 basic_mapping.xml:2221 +#, no-c-format +msgid "The name of a serializable Java class." +msgstr "Der Name einer serialisierbaren Java-Klasse." + +#. Tag: para +#: basic_mapping.xml:1793 basic_mapping.xml:2225 +#, fuzzy, no-c-format +msgid "" +"The class name of a custom type: com.illflow.type.MyCustomType etc." +msgstr "" +"Der Klassenname eines anwenderdefinierten Typs (z.B. com.illflow." +"type.MyCustomType)." + +#. Tag: para +#: basic_mapping.xml:1798 +#, fuzzy, no-c-format +msgid "" +"If you do not specify a type, Hibernate will use reflection upon the named " +"property and guess the correct Hibernate type. Hibernate will attempt to " +"interpret the name of the return class of the property getter using, in " +"order, rules 2, 3, and 4." +msgstr "" +"Falls Sie keinen Typ festlegen, so wird Hibernate mittels Reflexion an der " +"genannten Property versuchen, den korrekten Typ zu ermitteln. Hibernate wird " +"dabei versuchen, den Namen der Rückgabeklasse des Property-\"Getters\" unter " +"Verwendung der Regeln 2, 3, 4 (in dieser Reihenfolge) zu ermitteln. Das " +"reicht jedoch nicht immer. In bestimmten Fällen wird nach wie vor das " +"type-Attribut benötigt. (Um zum Beispiel zwischen " +"Hibernate.DATE und Hibernate.TIMESTAMP " +"zu unterscheiden oder einen anwenderdefinierten Typ zu bestimmen)." + +#. Tag: para +#: basic_mapping.xml:1803 +#, no-c-format +msgid "" +"@org.hibernate.annotations.TypeDef and @org." +"hibernate.annotations.TypeDefs allows you to declare type " +"definitions. These annotations can be placed at the class or package level. " +"Note that these definitions are global for the session factory (even when " +"defined at the class level). If the type is used on a single entity, you can " +"place the definition on the entity itself. Otherwise, it is recommended to " +"place the definition at the package level. In the example below, when " +"Hibernate encounters a property of class PhoneNumer, it " +"delegates the persistence strategy to the custom mapping type " +"PhoneNumberType. However, properties belonging to other " +"classes, too, can delegate their persistence strategy to " +"PhoneNumberType, by explicitly using the @Type annotation." +msgstr "" + +#. Tag: para +#: basic_mapping.xml:1819 +#, no-c-format +msgid "" +"Package level annotations are placed in a file named package-info." +"java in the appropriate package. Place your annotations before " +"the package declaration." +msgstr "" + +#. Tag: programlisting +#: basic_mapping.xml:1824 +#, no-c-format +msgid "" +"@TypeDef(\n" +" name = \"phoneNumber\",\n" +" defaultForType = PhoneNumber.class,\n" +" typeClass = PhoneNumberType.class\n" +")\n" +"\n" +"@Entity\n" +"public class ContactDetails {\n" +" [...]\n" +" private PhoneNumber localPhoneNumber;\n" +" @Type(type=\"phoneNumber\")\n" +" private OverseasPhoneNumber overseasPhoneNumber;\n" +" [...]\n" +"}" +msgstr "" + +#. Tag: para +#: basic_mapping.xml:1826 +#, no-c-format +msgid "" +"The following example shows the usage of the parameters " +"attribute to customize the TypeDef." +msgstr "" + +#. Tag: programlisting +#: basic_mapping.xml:1830 +#, no-c-format +msgid "" +"//in org/hibernate/test/annotations/entity/package-info.java\n" +"@TypeDefs(\n" +" {\n" +" @TypeDef(\n" +" name=\"caster\",\n" +" typeClass = CasterStringType.class,\n" +" parameters = {\n" +" @Parameter(name=\"cast\", value=\"lower\")\n" +" }\n" +" )\n" +" }\n" +")\n" +"package org.hibernate.test.annotations.entity;\n" +"\n" +"//in org/hibernate/test/annotations/entity/Forest.java\n" +"public class Forest {\n" +" @Type(type=\"caster\")\n" +" public String getSmallText() {\n" +" ...\n" +"}" +msgstr "" + +#. Tag: para +#: basic_mapping.xml:1832 +#, no-c-format +msgid "" +"When using composite user type, you will have to express column definitions. " +"The @Columns has been introduced for that purpose." +msgstr "" + +#. Tag: programlisting +#: basic_mapping.xml:1836 +#, no-c-format +msgid "" +"@Type(type=\"org.hibernate.test.annotations.entity.MonetaryAmountUserType" +"\")\n" +"@Columns(columns = {\n" +" @Column(name=\"r_amount\"),\n" +" @Column(name=\"r_currency\")\n" +"})\n" +"public MonetaryAmount getAmount() {\n" +" return amount;\n" +"}\n" +"\n" +"\n" +"public class MonetaryAmount implements Serializable {\n" +" private BigDecimal amount;\n" +" private Currency currency;\n" +" ...\n" +"}" +msgstr "" + +#. Tag: title +#: basic_mapping.xml:1840 +#, no-c-format +msgid "Access type" +msgstr "" + +#. Tag: para +#: basic_mapping.xml:1842 +#, no-c-format +msgid "" +"By default the access type of a class hierarchy is defined by the position " +"of the @Id or @EmbeddedId " +"annotations. If these annotations are on a field, then only fields are " +"considered for persistence and the state is accessed via the field. If there " +"annotations are on a getter, then only the getters are considered for " +"persistence and the state is accessed via the getter/setter. That works well " +"in practice and is the recommended approach." +msgstr "" + +#. Tag: para +#: basic_mapping.xml:1850 +#, no-c-format +msgid "" +"The placement of annotations within a class hierarchy has to be consistent " +"(either field or on property) to be able to determine the default access " +"type. It is recommended to stick to one single annotation placement strategy " +"throughout your whole application." +msgstr "" + +#. Tag: para +#: basic_mapping.xml:1857 +#, no-c-format +msgid "However in some situations, you need to:" +msgstr "" + +#. Tag: para +#: basic_mapping.xml:1861 +#, no-c-format +msgid "force the access type of the entity hierarchy" +msgstr "" + +#. Tag: para +#: basic_mapping.xml:1865 +#, no-c-format +msgid "override the access type of a specific entity in the class hierarchy" +msgstr "" + +#. Tag: para +#: basic_mapping.xml:1870 +#, no-c-format +msgid "override the access type of an embeddable type" +msgstr "" + +#. Tag: para +#: basic_mapping.xml:1874 +#, no-c-format +msgid "" +"The best use case is an embeddable class used by several entities that might " +"not use the same access type. In this case it is better to force the access " +"type at the embeddable class level." +msgstr "" + +#. Tag: para +#: basic_mapping.xml:1879 +#, no-c-format +msgid "" +"To force the access type on a given class, use the @Access annotation as showed below:" +msgstr "" + +#. Tag: programlisting +#: basic_mapping.xml:1882 +#, no-c-format +msgid "" +"@Entity\n" +"public class Order {\n" +" @Id private Long id;\n" +" public Long getId() { return id; }\n" +" public void setId(Long id) { this.id = id; }\n" +"\n" +" @Embedded private Address address;\n" +" public Address getAddress() { return address; }\n" +" public void setAddress() { this.address = address; }\n" +"}\n" +"\n" +"@Entity\n" +"public class User {\n" +" private Long id;\n" +" @Id public Long getId() { return id; }\n" +" public void setId(Long id) { this.id = id; }\n" +"\n" +" private Address address;\n" +" @Embedded public Address getAddress() { return address; }\n" +" public void setAddress() { this.address = address; }\n" +"}\n" +"\n" +"@Embeddable\n" +"@Access(AcessType.PROPERTY)\n" +"public class Address {\n" +" private String street1;\n" +" public String getStreet1() { return street1; }\n" +" public void setStreet1() { this.street1 = street1; }\n" +"\n" +" private hashCode; //not persistent\n" +"}" +msgstr "" + +#. Tag: para +#: basic_mapping.xml:1884 +#, no-c-format +msgid "" +"You can also override the access type of a single property while keeping the " +"other properties standard." +msgstr "" + +#. Tag: programlisting +#: basic_mapping.xml:1887 +#, no-c-format +msgid "" +"@Entity\n" +"public class Order {\n" +" @Id private Long id;\n" +" public Long getId() { return id; }\n" +" public void setId(Long id) { this.id = id; }\n" +" @Transient private String userId;\n" +" @Transient private String orderId;\n" +"\n" +" @Access(AccessType.PROPERTY)\n" +" public String getOrderNumber() { return userId + \":\" + orderId; }\n" +" public void setOrderNumber() { this.userId = ...; this.orderId = ...; }\n" +"}" +msgstr "" + +#. Tag: para +#: basic_mapping.xml:1889 +#, no-c-format +msgid "" +"In this example, the default access type is FIELD " +"except for the orderNumber property. Note that the " +"corresponding field, if any must be marked as @Transient or transient." +msgstr "" + +#. Tag: title +#: basic_mapping.xml:1896 +#, no-c-format +msgid "@org.hibernate.annotations.AccessType" +msgstr "" + +#. Tag: para +#: basic_mapping.xml:1898 +#, no-c-format +msgid "" +"The annotation @org.hibernate.annotations.AccessType " +"should be considered deprecated for FIELD and PROPERTY access. It is still " +"useful however if you need to use a custom access type." +msgstr "" + +#. Tag: title +#: basic_mapping.xml:1907 +#, no-c-format +msgid "Optimistic lock" +msgstr "" + +#. Tag: para +#: basic_mapping.xml:1909 +#, no-c-format +msgid "" +"It is sometimes useful to avoid increasing the version number even if a " +"given property is dirty (particularly collections). You can do that by " +"annotating the property (or collection) with @OptimisticLock" +"(excluded=true)." +msgstr "" + +#. Tag: para +#: basic_mapping.xml:1914 +#, no-c-format +msgid "" +"More formally, specifies that updates to this property do not require " +"acquisition of the optimistic lock." +msgstr "" + +#. Tag: title +#: basic_mapping.xml:1919 +#, no-c-format +msgid "Declaring column attributes" +msgstr "" + +#. Tag: para +#: basic_mapping.xml:1921 +#, no-c-format +msgid "" +"The column(s) used for a property mapping can be defined using the " +"@Column annotation. Use it to override default values " +"(see the JPA specification for more information on the defaults). You can " +"use this annotation at the property level for properties that are:" +msgstr "" + +#. Tag: para +#: basic_mapping.xml:1929 +#, no-c-format +msgid "not annotated at all" +msgstr "" + +#. Tag: para +#: basic_mapping.xml:1933 +#, fuzzy, no-c-format +msgid "annotated with @Basic" +msgstr "name: Der Property-Name." + +#. Tag: para +#: basic_mapping.xml:1937 +#, fuzzy, no-c-format +msgid "annotated with @Version" +msgstr "name: Der Property-Name." + +#. Tag: para +#: basic_mapping.xml:1941 +#, fuzzy, no-c-format +msgid "annotated with @Lob" +msgstr "all Prüfung aller Spalten" + +#. Tag: para +#: basic_mapping.xml:1945 +#, fuzzy, no-c-format +msgid "annotated with @Temporal" +msgstr "all Prüfung aller Spalten" + +#. Tag: programlisting +#: basic_mapping.xml:1949 +#, no-c-format +msgid "" +"@Entity\n" +"public class Flight implements Serializable {\n" +"...\n" +"@Column(updatable = false, name = \"flight_name\", nullable = false, " +"length=50)\n" +"public String getName() { ... }" +msgstr "" + +#. Tag: para +#: basic_mapping.xml:1951 +#, no-c-format +msgid "" +"The name property is mapped to the flight_name column, which is not nullable, has a length of 50 and is not " +"updatable (making the property immutable)." +msgstr "" + +#. Tag: para +#: basic_mapping.xml:1956 +#, no-c-format +msgid "" +"This annotation can be applied to regular properties as well as " +"@Id or @Version properties." +msgstr "" + +#. Tag: programlisting +#: basic_mapping.xml:1983 +#, no-c-format +msgid "" +"@Column(\n" +" name=\"columnName\";\n" +" boolean unique() default false;\n" +" boolean nullable() default true;\n" +" boolean insertable() default true;\n" +" boolean updatable() default true;\n" +" String columnDefinition() default \"\";\n" +" String table() default \"\";\n" +" int length() default 255;\n" +" int precision() default 0; // decimal precision\n" +" int scale() default 0; // decimal scale" +msgstr "" + +#. Tag: para +#: basic_mapping.xml:1987 +#, fuzzy, no-c-format +msgid "" +"name (optional): the column name (default to the property " +"name)" +msgstr "name (optional): Name der Bezeichner-Property." + +#. Tag: para +#: basic_mapping.xml:1992 +#, fuzzy, no-c-format +msgid "" +"unique (optional): set a unique constraint on this column " +"or not (default false)" +msgstr "" +"unique (optional): Aktiviert die DDL-Generierung einer " +"eindeutigen Bedingung für die Spalten. Dies kann auch das Ziel (sog. \"target" +"\") einer property-ref sein." + +#. Tag: para +#: basic_mapping.xml:1997 +#, fuzzy, no-c-format +msgid "" +"nullable (optional): set the column as nullable (default " +"true)." +msgstr "name (optional): Name der Bezeichner-Property." + +#. Tag: para +#: basic_mapping.xml:2002 +#, fuzzy, no-c-format +msgid "" +"insertable (optional): whether or not the column will be " +"part of the insert statement (default true)" +msgstr "name (optional): Name der Bezeichner-Property." + +#. Tag: para +#: basic_mapping.xml:2008 +#, fuzzy, no-c-format +msgid "" +"updatable (optional): whether or not the column will be " +"part of the update statement (default true)" +msgstr "" +"catalog (optional): Der Name eines Datenbankkatalogs." + +#. Tag: para +#: basic_mapping.xml:2014 +#, no-c-format +msgid "" +"columnDefinition (optional): override the sql DDL " +"fragment for this particular column (non portable)" +msgstr "" + +#. Tag: para +#: basic_mapping.xml:2020 +#, fuzzy, no-c-format +msgid "" +"table (optional): define the targeted table (default " +"primary table)" +msgstr "" +"catalog (optional): Der Name eines Datenbankkatalogs." + +#. Tag: para +#: basic_mapping.xml:2025 +#, no-c-format +msgid "" +"length (optional): column length " +"(default 255)" +msgstr "" + +#. Tag: para +#: basic_mapping.xml:2030 +#, no-c-format +msgid "" +"precision (optional): column decimal " +"precision (default 0)" +msgstr "" + +#. Tag: para +#: basic_mapping.xml:2035 +#, no-c-format +msgid "" +"scale (optional): column decimal scale " +"if useful (default 0)" +msgstr "" + +#. Tag: title +#: basic_mapping.xml:2043 +#, no-c-format +msgid "Formula" +msgstr "" + +#. Tag: para +#: basic_mapping.xml:2045 +#, no-c-format +msgid "" +"Sometimes, you want the Database to do some computation for you rather than " +"in the JVM, you might also create some kind of virtual column. You can use a " +"SQL fragment (aka formula) instead of mapping a property into a column. This " +"kind of property is read only (its value is calculated by your formula " +"fragment)." +msgstr "" + +#. Tag: programlisting +#: basic_mapping.xml:2051 +#, no-c-format +msgid "" +"@Formula(\"obj_length * obj_height * obj_width\")\n" +"public long getObjectVolume()" +msgstr "" + +#. Tag: para +#: basic_mapping.xml:2053 +#, no-c-format +msgid "" +"The SQL fragment can be as complex as you want and even include subselects." +msgstr "" + +#. Tag: title +#: basic_mapping.xml:2058 +#, no-c-format +msgid "Non-annotated property defaults" +msgstr "" + +#. Tag: para +#: basic_mapping.xml:2060 +#, no-c-format +msgid "If a property is not annotated, the following rules apply:" +msgstr "" + +#. Tag: para +#: basic_mapping.xml:2063 +#, no-c-format +msgid "If the property is of a single type, it is mapped as @Basic" +msgstr "" + +#. Tag: para +#: basic_mapping.xml:2068 +#, no-c-format +msgid "" +"Otherwise, if the type of the property is annotated as @Embeddable, it is " +"mapped as @Embedded" +msgstr "" + +#. Tag: para +#: basic_mapping.xml:2073 +#, no-c-format +msgid "" +"Otherwise, if the type of the property is Serializable, it is mapped as @Basic in a column " +"holding the object in its serialized version" +msgstr "" + +#. Tag: para +#: basic_mapping.xml:2080 +#, no-c-format +msgid "" +"Otherwise, if the type of the property is java.sql.Clob or java.sql.Blob, it is mapped as " +"@Lob with the appropriate LobType" +msgstr "" + +#. Tag: title +#: basic_mapping.xml:2091 +#, no-c-format +msgid "Property mapping with hbm.xml" +msgstr "" + +#. Tag: para +#: basic_mapping.xml:2093 #, fuzzy, no-c-format msgid "" "The <property> element declares a persistent " @@ -2296,7 +4814,54 @@ msgstr "" "Das <property>-Element deklariert eine persistente " "Property der Klasse nach Art von JavaBean." +#. Tag: programlisting +#: basic_mapping.xml:2125 +#, fuzzy, no-c-format +msgid "" +"<property\n" +" name=\"propertyName\"\n" +" column=\"column_name\"\n" +" type=\"typename\"\n" +" update=\"true|false\"\n" +" insert=\"true|false\"\n" +" formula=\"arbitrary SQL expression\"\n" +" access=\"field|property|ClassName\"\n" +" lazy=\"true|false\"\n" +" unique=\"true|false\"\n" +" not-null=\"true|false\"\n" +" optimistic-lock=\"true|false\"\n" +" generated=\"never|insert|always\"\n" +" node=\"element-name|@attribute-name|element/@attribute|.\"\n" +" index=\"index_name\"\n" +" unique_key=\"unique_key_id\"\n" +" length=\"L\"\n" +" precision=\"P\"\n" +" scale=\"S\"\n" +"/>" +msgstr "" +"<property\n" +" name=\"propertyName\"\n" +" column=\"column_name\"\n" +" type=\"typename\"\n" +" update=\"true|false\"\n" +" insert=\"true|false\"\n" +" formula=\"arbitrary SQL expression\"\n" +" access=\"field|property|ClassName\"\n" +" lazy=\"true|false\"\n" +" unique=\"true|false\"\n" +" not-null=\"true|false\"\n" +" optimistic-lock=\"true|false\"\n" +" generated=\"never|insert|always\"\n" +" node=\"element-name|@attribute-name|element/@attribute|.\"\n" +" index=\"index_name\"\n" +" unique_key=\"unique_key_id\"\n" +" length=\"L\"\n" +" precision=\"P\"\n" +" scale=\"S\"\n" +"/>" + #. Tag: para +#: basic_mapping.xml:2129 #, no-c-format msgid "" "name: the name of the property, with an initial lowercase " @@ -2306,6 +4871,7 @@ msgstr "" "Anfangsbuchstaben." #. Tag: para +#: basic_mapping.xml:2134 #, fuzzy, no-c-format msgid "" "column (optional - defaults to the property name): the " @@ -2318,6 +4884,7 @@ msgstr "" "spezifiziert werden." #. Tag: para +#: basic_mapping.xml:2146 #, fuzzy, no-c-format msgid "" "update, insert (optional - defaults to trueformula (optional): an SQL expression that defines the " @@ -2347,6 +4915,7 @@ msgstr "" "Properties besitzen kein eigenes Spalten-Mapping." #. Tag: para +#: basic_mapping.xml:2169 #, fuzzy, no-c-format msgid "" "lazy (optional - defaults to false): " @@ -2360,6 +4929,7 @@ msgstr "" "Build-time Bytecode Instrumentierung)." #. Tag: para +#: basic_mapping.xml:2176 #, fuzzy, no-c-format msgid "" "unique (optional): enables the DDL generation of a unique " @@ -2371,6 +4941,7 @@ msgstr "" "\") einer property-ref sein." #. Tag: para +#: basic_mapping.xml:2183 #, fuzzy, no-c-format msgid "" "not-null (optional): enables the DDL generation of a " @@ -2380,6 +4951,7 @@ msgstr "" "\"Nullability\"-Bedingung für die Spalten." #. Tag: para +#: basic_mapping.xml:2188 basic_mapping.xml:3246 #, fuzzy, no-c-format msgid "" "optimistic-lock (optional - defaults to truegenerated (optional - defaults to never." #. Tag: para +#: basic_mapping.xml:2205 #, no-c-format msgid "typename could be:" msgstr "typename könnte sein:" #. Tag: para -#, fuzzy, no-c-format -msgid "" -"The name of a Hibernate basic type: integer, string, character, " -"date, timestamp, float, binary, serializable, object, blob etc." -msgstr "" -"Der Name eines Hibernate Grundtyps (z.B. integer, string, " -"character, date, timestamp, float, binary, serializable, object, blob)." - -#. Tag: para -#, fuzzy, no-c-format -msgid "" -"The name of a Java class with a default basic type: int, float, " -"char, java.lang.String, java.util.Date, java.lang.Integer, java.sql.Clob etc." -msgstr "" -"Der Name einer Java-Klasse mit einem Grundtyp als Standard (z.B. " -"int, float, char, java.lang.String, java.util.Date, java.lang." -"Integer, java.sql.Clob)." - -#. Tag: para -#, no-c-format -msgid "The name of a serializable Java class." -msgstr "Der Name einer serialisierbaren Java-Klasse." - -#. Tag: para -#, fuzzy, no-c-format -msgid "" -"The class name of a custom type: com.illflow.type.MyCustomType etc." -msgstr "" -"Der Klassenname eines anwenderdefinierten Typs (z.B. com.illflow." -"type.MyCustomType)." - -#. Tag: para +#: basic_mapping.xml:2230 #, fuzzy, no-c-format msgid "" "If you do not specify a type, Hibernate will use reflection upon the named " @@ -2468,6 +5008,7 @@ msgstr "" "zu unterscheiden oder einen anwenderdefinierten Typ zu bestimmen)." #. Tag: para +#: basic_mapping.xml:2239 #, fuzzy, no-c-format msgid "" "The access attribute allows you to control how Hibernate " @@ -2488,6 +5029,7 @@ msgstr "" "hibernate.property.PropertyAccessor implementiert." #. Tag: para +#: basic_mapping.xml:2248 #, fuzzy, no-c-format msgid "" "A powerful feature is derived properties. These properties are by definition " @@ -2501,7 +5043,26 @@ msgstr "" "Ausdruck, was in eine SELECT-Klausel Unteranfrage in der " "eine Instanz ladenden SQL-Anfrage übersetzt wird:" +#. Tag: programlisting +#: basic_mapping.xml:2254 +#, fuzzy, no-c-format +msgid "" +"<property name=\"totalPrice\"\n" +" formula=\"( SELECT SUM (li.quantity*p.price) FROM LineItem li, Product " +"p\n" +" WHERE li.productId = p.productId\n" +" AND li.customerId = customerId\n" +" AND li.orderNumber = orderNumber )\"/>" +msgstr "" +"<property name=\"totalPrice\"\n" +" formula=\"( SELECT SUM (li.quantity*p.price) FROM LineItem li, Product " +"p\n" +" WHERE li.productId = p.productId\n" +" AND li.customerId = customerId\n" +" AND li.orderNumber = orderNumber )\"/>" + #. Tag: para +#: basic_mapping.xml:2256 #, fuzzy, no-c-format msgid "" "You can reference the entity table by not declaring an alias on a particular " @@ -2516,496 +5077,18 @@ msgstr "" "Mapping-Element statt des Attributs verwenden können." #. Tag: title -#, fuzzy, no-c-format -msgid "Many-to-one" -msgstr "many-to-one" - -#. Tag: para -#, fuzzy, no-c-format -msgid "" -"An ordinary association to another persistent class is declared using a " -"many-to-one element. The relational model is a many-to-" -"one association; a foreign key in one table is referencing the primary key " -"column(s) of the target table." -msgstr "" -"Eine reguläre Assoziation zu einer anderen persistenten Klasse wird unter " -"Verwendung eines many-to-one-Elements deklariert. Das " -"relationale Modell ist eine \"Many-to-One\"-Assoziation: Der Fremdschlüssel " -"in einer Tabelle verweist auf die Spalte(n) des Primärschlüssels der " -"Zieltabelle." - -#. Tag: para -#, fuzzy, no-c-format -msgid "name: the name of the property." -msgstr "name: Der Name der Property." - -#. Tag: para -#, fuzzy, no-c-format -msgid "" -"column (optional): the name of the foreign key column. " -"This can also be specified by nested <column> " -"element(s)." -msgstr "" -"column (optional): Der Spaltenname des Fremdschlüssels. " -"Kann auch durch verschachtelte <column>-Element(e) " -"spezifiziert werden." - -#. Tag: para -#, fuzzy, no-c-format -msgid "" -"class (optional - defaults to the property type " -"determined by reflection): the name of the associated class." -msgstr "" -"class (optional - Standard ist der durch die Reflexion " -"bestimmte Property-Typ): Der Name der assoziierten Klasse." - -#. Tag: para -#, fuzzy, no-c-format -msgid "" -"cascade (optional): specifies which operations should be " -"cascaded from the parent object to the associated object." -msgstr "" -"cascade (optional) legt fest, welche Vorgänge vom " -"übergeordneten Objekt an das assoziierte Objekt weitergegeben werden sollen." - -#. Tag: para -#, fuzzy, no-c-format -msgid "" -"fetch (optional - defaults to select): " -"chooses between outer-join fetching or sequential select fetching." -msgstr "" -"fetch (optional - die Standardeinstellung lautet " -"select): Wählt zwischen \"Outer-Join-Fetching\" oder " -"sequentiellem \"Select-Fetching\"." - -#. Tag: para -#, fuzzy, no-c-format -msgid "" -"update, insert (optional - defaults to true): specifies that the mapped columns should be included in SQL " -"UPDATE and/or INSERT statements. " -"Setting both to false allows a pure \"derived\" " -"association whose value is initialized from another property that maps to " -"the same column(s), or by a trigger or other application." -msgstr "" -"update, insert (optional - die Standardeinstellung lautet " -"true) legt fest, dass die gemappten Spalten in SQL " -"UPDATE und/oder INSERT-Anweisungen " -"eingeschlossen werden sollten. Wählt man bei beiden die Einstellung " -"false, so ist eine reine, \"abgeleitete\" Assoziation " -"möglich, deren Wert aus einer anderen Property, die zu derselben/denselben " -"Spalte(n) mappt oder durch einen Trigger oder eine andere Anwendung " -"initialisiert wird, möglich." - -#. Tag: para -#, fuzzy, no-c-format -msgid "" -"property-ref (optional): the name of a property of the " -"associated class that is joined to this foreign key. If not specified, the " -"primary key of the associated class is used." -msgstr "" -"property-ref: (optional) Der Name einer Property der " -"assoziierten Klasse die mit diesem Fremdschlüssel verbunden ist. Falls nicht " -"festgelegt, so wird der Primärschlüssel der assoziierten Klasse verwendet." - -#. Tag: para -#, fuzzy, no-c-format -msgid "" -"unique (optional): enables the DDL generation of a unique " -"constraint for the foreign-key column. By allowing this to be the target of " -"a property-ref, you can make the association multiplicity " -"one-to-one." -msgstr "" -"unique (optional): Aktiviert die DDL-Generierung einer " -"eindeutigen Bedingung für die Spalte des Fremdschlüssels. Kann auch das Ziel " -"einer property-ref sein. Dadurch ist die " -"Assoziationsmultiplizität \"one-to-one\" effektiv." - -#. Tag: para -#, fuzzy, no-c-format -msgid "" -"not-null (optional): enables the DDL generation of a " -"nullability constraint for the foreign key columns." -msgstr "" -"not-null (optional): Aktiviert die DDL-Generierung einer " -"\"Nullability\"-Bedingung für die Fremdschlüsselspalten." - -#. Tag: para -#, fuzzy, no-c-format -msgid "" -"lazy (optional - defaults to proxy): " -"by default, single point associations are proxied. lazy=\"no-proxy" -"\" specifies that the property should be fetched lazily when the " -"instance variable is first accessed. This requires build-time bytecode " -"instrumentation. lazy=\"false\" specifies that the " -"association will always be eagerly fetched." -msgstr "" -"lazy (optional - die Standardeinstellung lautet " -"proxy): In der Standardeinstellung werden \"Single-Point" -"\"-Assoziationen geproxied. lazy=\"no-proxy\" bestimmt, " -"dass für die Property \"lazy Fetching\" gilt (d.h. assoziierte Objekte " -"werden bei Bedarf nachgeladen), wenn erstmals auf die Instanzvariable " -"zugegriffen wird (erfordert Build-time Bytecode Instrumentierung). " -"lazy=\"false\" bestimmt, dass für die Assoziation stets " -"\"eager Fetching\" gilt (d.h. zusammengefasstes Laden von Objekt und " -"assoziierten Objekten mit Verbundoperationen)." - -#. Tag: para -#, fuzzy, no-c-format -msgid "" -"not-found (optional - defaults to exception): specifies how foreign keys that reference missing rows will be " -"handled. ignore will treat a missing row as a null " -"association." -msgstr "" -"not-found (optional - standardmäßig exception): Bestimmt, wie Fremdschlüssel, die auf fehlende Reihen verweisen, " -"behandelt werden. Mit ignore wird eine fehlende Reihe als " -"Null-Assoziation angesehen." - -#. Tag: para -#, fuzzy, no-c-format -msgid "" -"entity-name (optional): the entity name of the associated " -"class." -msgstr "" -"entity-name (optional): Der Entity-Name der assoziierten " -"Klasse." - -#. Tag: para +#: basic_mapping.xml:2265 #, no-c-format -msgid "" -"formula (optional): an SQL expression that defines the " -"value for a computed foreign key." +msgid "Embedded objects (aka components)" msgstr "" -"formula (optional): Ein SQL-Ausdruck, der den Wert für " -"einen errechneten Fremdschlüssel definiert." #. Tag: para +#: basic_mapping.xml:2267 #, fuzzy, no-c-format msgid "" -"Setting a value of the cascade attribute to any " -"meaningful value other than none will propagate certain " -"operations to the associated object. The meaningful values are divided into " -"three categories. First, basic operations, which include: persist, " -"merge, delete, save-update, evict, replicate, lock and refresh; " -"second, special values: delete-orphan; and third," -"all comma-separated combinations of operation names: " -"cascade=\"persist,merge,evict\" or cascade=\"all," -"delete-orphan\". See " -"for a full explanation. Note that single valued, many-to-one and one-to-one, " -"associations do not support orphan delete." -msgstr "" -"Wird der Wert des cascade-Attributs auf einen anderen " -"sinnvollen Wert als none gesetzt, so pflanzen sich " -"bestimmte Vorgänge zum zugehörigen Objekt fort. Zu den sinnvollen Werten " -"gehören Hibernates Grundvorgänge persist, merge, delete, save-" -"update, evict, replicate, lock, refresh, die Sonderwerte " -"delete-orphan und all sowie durch " -"Komma getrennte Kombinationen von Vorgangsnamen, zum Beispiel " -"cascade=\"persist,merge,evict\" oder cascade=" -"\"all,delete-orphan\". Eine vollständige Erläuterung hierzu finden " -"Sie unter . Bitte beachten Sie, " -"dass einwertige Assoziationen (Many-to-One und One-to-One Assoziationen) " -"\"Orphan Delete\" nicht unterstützen." - -#. Tag: para -#, fuzzy, no-c-format -msgid "" -"Here is an example of a typical many-to-one declaration:" -msgstr "" -"Eine typische many-to-one-Deklaration sieht so " -"unkompliziert wie die Folgende aus:" - -#. Tag: para -#, fuzzy, no-c-format -msgid "" -"The property-ref attribute should only be used for " -"mapping legacy data where a foreign key refers to a unique key of the " -"associated table other than the primary key. This is a complicated and " -"confusing relational model. For example, if the Product " -"class had a unique serial number that is not the primary key. The " -"unique attribute controls Hibernate's DDL generation with " -"the SchemaExport tool." -msgstr "" -"Das property-ref-Attribut sollte nur für das Mapping von " -"Stammdaten verwendet werden, in denen ein Fremdschlüssel auf einen " -"eindeutigen Schlüssel der assoziierten Tabelle verweist, der nicht der " -"Primärschlüssel ist. Es handelt sich dabei um ein nicht besonders " -"ansehnliches relationales Modell. Nehmen wir zum Beispiel an, dass die " -"Product-Klasse eine eindeutige Seriennummer besitzt, die " -"nicht der Primärschlüssel ist. (Das unique-Attribut " -"steuert Hibernates DDL-Generierung mittels dem SchemaExport-Tool)." - -#. Tag: para -#, no-c-format -msgid "Then the mapping for OrderItem might use:" -msgstr "" -"Dann könnte das Mapping für OrderItem folgendes verwenden:" - -#. Tag: para -#, fuzzy, no-c-format -msgid "This is not encouraged, however." -msgstr "Allerdings wird dies nicht empfohlen." - -#. Tag: para -#, no-c-format -msgid "" -"If the referenced unique key comprises multiple properties of the associated " -"entity, you should map the referenced properties inside a named <" -"properties> element." -msgstr "" -"Wenn der eindeutige Schlüssel, auf den verwiesen wird, mehrere Properties " -"der zugehörigen Entity enthält, so sollten die Properties, auf die verwiesen " -"wird, in einem benannten <properties>-Element " -"gemappt werden." - -#. Tag: para -#, fuzzy, no-c-format -msgid "" -"If the referenced unique key is the property of a component, you can specify " -"a property path:" -msgstr "" -"Falls der eindeutige Schlüssel, auf den verwiesen wird, die Property einer " -"Komponente ist, so können Sie einen Property-Pfad festlegen:" - -#. Tag: title -#, fuzzy, no-c-format -msgid "One-to-one" -msgstr "one-to-one" - -#. Tag: para -#, no-c-format -msgid "" -"A one-to-one association to another persistent class is declared using a " -"one-to-one element." -msgstr "" -"Eine \"One-to-One\"-Assoziation mit einer anderen persistenten Klasse wird " -"unter Verwendung eines one-to-one-Elements deklariert." - -#. Tag: para -#, fuzzy, no-c-format -msgid "" -"constrained (optional): specifies that a foreign key " -"constraint on the primary key of the mapped table and references the table " -"of the associated class. This option affects the order in which save" -"() and delete() are cascaded, and determines " -"whether the association can be proxied. It is also used by the schema export " -"tool." -msgstr "" -"constrained (optional) legt fest, dass eine " -"Fremdschlüsselbedingung auf dem Primärschlüssel der gemappten Tabelle auf " -"die Tabelle der assoziierten Klasse verweist. Diese Option hat Einfluss auf " -"die Reihenfolge in der save() und delete() aufeinander folgen und bestimmt, ob die Assoziation geproxied " -"werden kann (wird auch vom Schema-Export-Tool verwendet)." - -#. Tag: para -#, fuzzy, no-c-format -msgid "" -"property-ref (optional): the name of a property of the " -"associated class that is joined to the primary key of this class. If not " -"specified, the primary key of the associated class is used." -msgstr "" -"property-ref: (optional) Der Name einer Property der " -"assoziierten Klasse, die mit dem Primärschlüssel dieser Klasse verbunden " -"ist. Falls nicht anders festgelegt, so wird der Primärschlüssel der " -"assoziierten Klasse verwendet." - -#. Tag: para -#, fuzzy, no-c-format -msgid "" -"formula (optional): almost all one-to-one associations " -"map to the primary key of the owning entity. If this is not the case, you " -"can specify another column, columns or expression to join on using an SQL " -"formula. See org.hibernate.test.onetooneformula for an " -"example." -msgstr "" -"formula (optional): Fast alle \"One-to-One\" -" -"Assoziationen mappen zum Primärschlüssel der Entity, die sie besitzt. Im " -"seltenen Falle, dass dem nicht so ist, können Sie festlegen, dass sich eine " -"andere Spalte, Spalten oder Ausdruck unter Verwendung einer SQL-Formel " -"verbinden. (Siehe zum Beispiel org.hibernate.test.onetooneformula)." - -#. Tag: para -#, fuzzy, no-c-format -msgid "" -"lazy (optional - defaults to proxy): " -"by default, single point associations are proxied. lazy=\"no-proxy" -"\" specifies that the property should be fetched lazily when the " -"instance variable is first accessed. It requires build-time bytecode " -"instrumentation. lazy=\"false\" specifies that the " -"association will always be eagerly fetched. Note that if " -"constrained=\"false\", proxying is impossible and " -"Hibernate will eagerly fetch the association." -msgstr "" -"lazy (optional - die Standardeinstellung lautet " -"proxy): In der Standardeinstellung werden \"Single-Point" -"\"-Assoziationen geproxied. lazy=\"no-proxy\" legt fest, " -"dass für die Property \"lazy Fetching\" gilt (d.h. assoziierte Objekte " -"werden bei Bedarf nachgeladen), wenn erstmals auf die Instanzvariable " -"zugegriffen wird (erfordert Build-time Bytecode Instrumentierung). " -"lazy=\"false\" legt fest, dass für die Assoziation stets " -"\"eager Fetching\" gilt (d.h. zusammengefasstes Laden von Objekt und " -"assoziierten Objekten mit Verbundoperationen).Bitte beachten Sie, " -"dass bei constrained=\"false\" das Erstellen von Proxies " -"nicht möglich ist und Hibernate bei der Assoziation \"eager Fetching\" " -"anwendet!" - -#. Tag: para -#, fuzzy, no-c-format -msgid "There are two varieties of one-to-one associations:" -msgstr "Es existieren zwei Arten von \"One-to-One\"-Assoziation:" - -#. Tag: para -#, no-c-format -msgid "primary key associations" -msgstr "Assoziationen des Primärschlüssels" - -#. Tag: para -#, no-c-format -msgid "unique foreign key associations" -msgstr "Assoziationen eines eindeutigen Fremdschlüssels" - -#. Tag: para -#, fuzzy, no-c-format -msgid "" -"Primary key associations do not need an extra table column. If two rows are " -"related by the association, then the two table rows share the same primary " -"key value. To relate two objects by a primary key association, ensure that " -"they are assigned the same identifier value." -msgstr "" -"Assoziationen von Primärschlüsseln benötigen keine Extra-Tabellenspalte. " -"Wenn zwei Reihen durch die Assoziation verbunden sind, dann teilen die " -"beiden Tabellenspalten denselben Primärschlüsselwert. Falls Sie also " -"wünschen, dass zwei Objekte mittels Assoziation des Primärschlüssels " -"verbunden werden, müssen Sie sicherstellen, dass ihnen derselbe " -"Bezeichnerwert zugeschrieben wird!" - -#. Tag: para -#, fuzzy, no-c-format -msgid "" -"For a primary key association, add the following mappings to " -"Employee and Person respectively:" -msgstr "" -"Für eine Assoziation des Primärschlüssels fügen Sie die folgenden Mappings " -"zu Employee beziehungsweise Person " -"hinzu." - -#. Tag: para -#, fuzzy, no-c-format -msgid "" -"Ensure that the primary keys of the related rows in the PERSON and EMPLOYEE " -"tables are equal. You use a special Hibernate identifier generation strategy " -"called foreign:" -msgstr "" -"Nun muss sicher gestellt werden, dass die Primärschlüssel verbundener Reihen " -"in den PERSON- und EMPLOYEE-Tabellen gleich sind. Dabei kommt eine besondere " -"Strategie namens foreign für die Generierung des " -"Bezeichners durch Hibernate zum Einsatz:" - -#. Tag: para -#, fuzzy, no-c-format -msgid "" -"A newly saved instance of Person is assigned the same " -"primary key value as the Employee instance referred with " -"the employee property of that Person." -msgstr "" -"Einer neu gespeicherten Instanz von Person wird dann " -"derselbe Wert des Primärschlüssels zugeschrieben wie der Employee-Instanz, die mit der employee-Property dieser " -"Person referenziert ist." - -#. Tag: para -#, fuzzy, no-c-format -msgid "" -"Alternatively, a foreign key with a unique constraint, from " -"Employee to Person, can be expressed " -"as:" -msgstr "" -"Alternativ kann ein Fremdschlüssel mit eindeutiger Bedingung von " -"Employee zu Person wie folgt " -"ausgedrückt werden:" - -#. Tag: para -#, fuzzy, no-c-format -msgid "" -"This association can be made bidirectional by adding the following to the " -"Person mapping:" -msgstr "" -"Und diese Assoziation kann durch Hinzufügen des Folgenden zum " -"Person-Mapping bidirektional gemacht werden:" - -#. Tag: title -#, fuzzy, no-c-format -msgid "Natural-id" -msgstr "natural-id" - -#. Tag: para -#, fuzzy, no-c-format -msgid "" -"Although we recommend the use of surrogate keys as primary keys, you should " -"try to identify natural keys for all entities. A natural key is a property " -"or combination of properties that is unique and non-null. It is also " -"immutable. Map the properties of the natural key inside the <" -"natural-id> element. Hibernate will generate the necessary " -"unique key and nullability constraints and, as a result, your mapping will " -"be more self-documenting." -msgstr "" -"Obwohl wir die Verwendung von Surrogatschlüsseln als Primärschlüssel " -"empfehlen, sollten Sie nach wie vor versuchen natürliche Schlüssel für alle " -"Entities zu identifizieren. Ein natürlicher Schlüssel ist eine Property oder " -"Kombination von Properties die eindeutig und ungleich Null ist. Falls sie " -"außerdem unveränderbar ist, umso besser. Mappen Sie die Properties des " -"natürlichen Schlüssels innerhalb des <natural-id>-" -"Elements. Hibernate generiert den nötigen eindeutigen Schlüssel sowie " -"\"Nullability\"-Bedingungen, und Ihr Mapping wird selbst-dokumentierender." - -#. Tag: para -#, fuzzy, no-c-format -msgid "" -"It is recommended that you implement equals() and " -"hashCode() to compare the natural key properties of the " -"entity." -msgstr "" -"Wir empfehlen dringend die Implementierung von equals() " -"und hashCode(), um die Properties des natürlischen " -"Schlüssels der Entity zu vergleichen." - -#. Tag: para -#, fuzzy, no-c-format -msgid "" -"This mapping is not intended for use with entities that have natural primary " -"keys." -msgstr "" -"Dieses Mapping ist nicht für die Verwendung mit Entities mit natürlichen " -"Primärschlüsseln vorgesehen." - -#. Tag: para -#, fuzzy, no-c-format -msgid "" -"mutable (optional - defaults to false): by default, natural identifier properties are assumed to be " -"immutable (constant)." -msgstr "" -"mutable (optional, die Standardeinstellung lautet " -"false): In der Standardeinstellung wird davon " -"ausgegangen, dass die natürlichen Bezeichner-Properties unveränderbar " -"(konstant) sind." - -#. Tag: title -#, fuzzy, no-c-format -msgid "Component and dynamic-component" -msgstr "component, dynamic-component" - -#. Tag: para -#, fuzzy, no-c-format -msgid "" -"The <component> element maps properties of a child " -"object to columns of the table of a parent class. Components can, in turn, " -"declare their own properties, components or collections. See the \"Component" -"\" examples below:" +"Embeddable objects (or components) are objects whose properties are mapped " +"to the same table as the owning entity's table. Components can, in turn, " +"declare their own properties, components or collections" msgstr "" "Das <component>-Element mappt die Properties eines " "untergeordneten Objekts zu den Spalten der Tabelle der übergeordneten " @@ -3013,6 +5096,209 @@ msgstr "" "oder \"Collections\" deklarieren. Siehe \"Komponenten\" unten." #. Tag: para +#: basic_mapping.xml:2272 +#, no-c-format +msgid "" +"It is possible to declare an embedded component inside an entity and even " +"override its column mapping. Component classes have to be annotated at the " +"class level with the @Embeddable annotation. It is " +"possible to override the column mapping of an embedded object for a " +"particular entity using the @Embedded and " +"@AttributeOverride annotation in the associated property:" +msgstr "" + +#. Tag: programlisting +#: basic_mapping.xml:2280 +#, no-c-format +msgid "" +"@Entity\n" +"public class Person implements Serializable {\n" +"\n" +" // Persistent component using defaults\n" +" Address homeAddress;\n" +"\n" +" @Embedded\n" +" @AttributeOverrides( {\n" +" @AttributeOverride(name=\"iso2\", column = @Column(name=" +"\"bornIso2\") ),\n" +" @AttributeOverride(name=\"name\", column = @Column(name=" +"\"bornCountryName\") )\n" +" } )\n" +" Country bornIn;\n" +" ...\n" +"}" +msgstr "" + +#. Tag: programlisting +#: basic_mapping.xml:2282 +#, no-c-format +msgid "" +"@Embeddable\n" +"public class Address implements Serializable {\n" +" String city;\n" +" Country nationality; //no overriding here\n" +"}" +msgstr "" + +#. Tag: programlisting +#: basic_mapping.xml:2284 +#, no-c-format +msgid "" +"@Embeddable\n" +"public class Country implements Serializable {\n" +" private String iso2;\n" +" @Column(name=\"countryName\") private String name;\n" +"\n" +" public String getIso2() { return iso2; }\n" +" public void setIso2(String iso2) { this.iso2 = iso2; }\n" +"\n" +" \n" +" public String getName() { return name; }\n" +" public void setName(String name) { this.name = name; }\n" +" ...\n" +"}" +msgstr "" + +#. Tag: para +#: basic_mapping.xml:2286 +#, no-c-format +msgid "" +"An embeddable object inherits the access type of its owning entity (note " +"that you can override that using the @Access annotation)." +msgstr "" + +#. Tag: para +#: basic_mapping.xml:2290 +#, no-c-format +msgid "" +"The Person entity has two component properties, " +"homeAddress and bornIn. " +"homeAddress property has not been annotated, but " +"Hibernate will guess that it is a persistent component by looking for the " +"@Embeddable annotation in the Address class. We also " +"override the mapping of a column name (to bornCountryName) with the @Embedded and " +"@AttributeOverride annotations for each mapped attribute " +"of Country. As you can see, Country is " +"also a nested component of Address, again using auto-" +"detection by Hibernate and JPA defaults. Overriding columns of embedded " +"objects of embedded objects is through dotted expressions." +msgstr "" + +#. Tag: programlisting +#: basic_mapping.xml:2305 +#, no-c-format +msgid "" +"@Embedded\n" +" @AttributeOverrides( {\n" +" @AttributeOverride(name=\"city\", column = @Column(name=" +"\"fld_city\") ),\n" +" @AttributeOverride(name=\"nationality.iso2\", column = @Column" +"(name=\"nat_Iso2\") ),\n" +" @AttributeOverride(name=\"nationality.name\", column = @Column" +"(name=\"nat_CountryName\") )\n" +" //nationality columns in homeAddress are overridden\n" +" } )\n" +" Address homeAddress;" +msgstr "" + +#. Tag: para +#: basic_mapping.xml:2307 +#, no-c-format +msgid "" +"Hibernate Annotations supports something that is not explicitly supported by " +"the JPA specification. You can annotate a embedded object with the " +"@MappedSuperclass annotation to make the superclass " +"properties persistent (see @MappedSuperclass for more " +"informations)." +msgstr "" + +#. Tag: para +#: basic_mapping.xml:2313 +#, no-c-format +msgid "" +"You can also use association annotations in an embeddable object (ie " +"@OneToOne, @ManyToOne, " +"@OneToMany or @ManyToMany). To " +"override the association columns you can use @AssociationOverride." +msgstr "" + +#. Tag: para +#: basic_mapping.xml:2319 +#, no-c-format +msgid "" +"If you want to have the same embeddable object type twice in the same " +"entity, the column name defaulting will not work as several embedded objects " +"would share the same set of columns. In plain JPA, you need to override at " +"least one set of columns. Hibernate, however, allows you to enhance the " +"default naming mechanism through the NamingStrategy " +"interface. You can write a strategy that prevent name clashing in such a " +"situation. DefaultComponentSafeNamingStrategy is an " +"example of this." +msgstr "" + +#. Tag: para +#: basic_mapping.xml:2329 +#, no-c-format +msgid "" +"If a property of the embedded object points back to the owning entity, " +"annotate it with the @Parent annotation. Hibernate " +"will make sure this property is properly loaded with the entity reference." +msgstr "" + +#. Tag: para +#: basic_mapping.xml:2334 +#, no-c-format +msgid "In XML, use the <component> element." +msgstr "" + +#. Tag: programlisting +#: basic_mapping.xml:2356 +#, fuzzy, no-c-format +msgid "" +"<component\n" +" name=\"propertyName\"\n" +" class=\"className\"\n" +" insert=\"true|false\"\n" +" update=\"true|false\"\n" +" access=\"field|property|ClassName\"\n" +" lazy=\"true|false\"\n" +" optimistic-lock=\"true|false\"\n" +" unique=\"true|false\"\n" +" node=\"element-name|.\"\n" +">\n" +"\n" +" <property ...../>\n" +" <many-to-one .... />\n" +" ........\n" +"</component>" +msgstr "" +"<component \n" +" name=\"propertyName\" \n" +" class=\"className\"\n" +" insert=\"true|false\"\n" +" update=\"true|false\"\n" +" access=\"field|property|ClassName\"\n" +" lazy=\"true|false\"\n" +" optimistic-lock=\"true|false\"\n" +" unique=\"true|false\"\n" +" node=\"element-name|.\"\n" +">\n" +" \n" +" <property ...../>\n" +" <many-to-one .... />\n" +" ........\n" +"</component>" + +#. Tag: para +#: basic_mapping.xml:2360 basic_mapping.xml:3181 basic_mapping.xml:3381 +#, fuzzy, no-c-format +msgid "name: the name of the property." +msgstr "name: Der Name der Property." + +#. Tag: para +#: basic_mapping.xml:2364 #, fuzzy, no-c-format msgid "" "class (optional - defaults to the property type " @@ -3023,6 +5309,7 @@ msgstr "" "Komponentenklasse." #. Tag: para +#: basic_mapping.xml:2370 basic_mapping.xml:3641 #, fuzzy, no-c-format msgid "" "insert: do the mapped columns appear in SQL " @@ -3032,6 +5319,7 @@ msgstr "" "INSERTs?" #. Tag: para +#: basic_mapping.xml:2375 basic_mapping.xml:3646 #, fuzzy, no-c-format msgid "" "update: do the mapped columns appear in SQL " @@ -3041,6 +5329,7 @@ msgstr "" "UPDATEs?" #. Tag: para +#: basic_mapping.xml:2386 #, fuzzy, no-c-format msgid "" "lazy (optional - defaults to false): " @@ -3053,6 +5342,7 @@ msgstr "" "(erfordert Build-time Bytecode Instrumentierung)." #. Tag: para +#: basic_mapping.xml:2393 #, fuzzy, no-c-format msgid "" "optimistic-lock (optional - defaults to trueunique (optional - defaults to false): " @@ -3079,6 +5370,7 @@ msgstr "" "gemappten Spalten der Komponente existiert." #. Tag: para +#: basic_mapping.xml:2408 #, no-c-format msgid "" "The child <property> tags map properties of the " @@ -3088,6 +5380,7 @@ msgstr "" "Properties der untergeordneten Klasse zu den Spalten der Tabelle." #. Tag: para +#: basic_mapping.xml:2411 #, no-c-format msgid "" "The <component> element allows a <" @@ -3099,12 +5392,13 @@ msgstr "" "Rückreferenz zur enthaltenden Entity mappt." #. Tag: para +#: basic_mapping.xml:2415 #, fuzzy, no-c-format msgid "" "The <dynamic-component> element allows a " "Map to be mapped as a component, where the property names " -"refer to keys of the map. See for " -"more information." +"refer to keys of the map. See for " +"more information. This feature is not supported in annotations." msgstr "" "Das <dynamic-component>-Element erlaubt es einer " "Map als Komponente gemappt zu werden, wenn die Namen der " @@ -3112,101 +5406,150 @@ msgstr "" "dynamic\"/>." #. Tag: title +#: basic_mapping.xml:2423 #, no-c-format -msgid "Properties" -msgstr "Properties" - -#. Tag: para -#, fuzzy, no-c-format -msgid "" -"The <properties> element allows the definition of a " -"named, logical grouping of the properties of a class. The most important use " -"of the construct is that it allows a combination of properties to be the " -"target of a property-ref. It is also a convenient way to " -"define a multi-column unique constraint. For example:" +msgid "Inheritance strategy" msgstr "" -"Das <properties>-Element erlaubt die Definition " -"einer benannten, logischen Gruppierung der Properties einer Klasse. Der " -"wichtigste Aspekt des Konstrukts ist, dass es die Verwendung einer Gruppe " -"von Properties als Ziel einer property-ref ermöglicht. Es " -"bietet außerdem eine gute Möglichkeit, eine eindeutige Mehrspalten-Bedingung " -"zu definieren." - -#. Tag: para -#, fuzzy, no-c-format -msgid "" -"name: the logical name of the grouping. It is " -"not an actual property name." -msgstr "" -"name: Der logische Name der Gruppierung - kein tatsächlicher Property-Name." - -#. Tag: para -#, fuzzy, no-c-format -msgid "" -"optimistic-lock (optional - defaults to true): specifies that updates to these properties either do or do not " -"require acquisition of the optimistic lock. It determines if a version " -"increment should occur when these properties are dirty." -msgstr "" -"optimistic-lock (optional - die Standardeinstellung " -"lautet true): Legt fest, ob Aktualisierungen dieser " -"Properties die Erfassung einer optimistischen Sperre benötigen oder nicht. " -"Mit anderen Worten, es wird bestimmt, ob eine Erhöhung der Version " -"stattfinden soll, wenn die Inhalte dieser Properties sich verändert haben " -"(man sagt sie seien dann \"dirty\")." #. Tag: para +#: basic_mapping.xml:2425 #, no-c-format msgid "" -"For example, if we have the following <properties> " -"mapping:" +"Java is a language supporting polymorphism: a class can inherit from " +"another. Several strategies are possible to persist a class hierarchy:" msgstr "" -"Nehmen wir etwa das folgende <properties>-Mapping:" #. Tag: para -#, fuzzy, no-c-format +#: basic_mapping.xml:2431 +#, no-c-format msgid "" -"You might have some legacy data association that refers to this unique key " -"of the Person table, instead of to the primary key:" +"Single table per class hierarchy strategy: a single table hosts all the " +"instances of a class hierarchy" msgstr "" -"Und wir könnten eine Stammdatenassoziation haben, die auf diesen eindeutigen " -"Schlüssel der Person-Tabelle verweist, statt auf den " -"Primärschlüssel:" #. Tag: para -#, fuzzy, no-c-format +#: basic_mapping.xml:2436 +#, no-c-format msgid "" -"The use of this outside the context of mapping legacy data is not " -"recommended." +"Joined subclass strategy: one table per class and subclass is present and " +"each table persist the properties specific to a given subclass. The state of " +"the entity is then stored in its corresponding class table and all its " +"superclasses" +msgstr "" + +#. Tag: para +#: basic_mapping.xml:2443 +#, no-c-format +msgid "" +"Table per class strategy: one table per concrete class and subclass is " +"present and each table persist the properties of the class and its " +"superclasses. The state of the entity is then stored entirely in the " +"dedicated table for its class." msgstr "" -"Außerhalb vom Kontext des Mappens von Stammdaten wird diese Vorgehensweise " -"jedoch nicht empfohlen." #. Tag: title -#, fuzzy, no-c-format -msgid "Subclass" -msgstr "subclass" +#: basic_mapping.xml:2451 +#, no-c-format +msgid "Single table per class hierarchy strategy" +msgstr "" #. Tag: para +#: basic_mapping.xml:2453 +#, no-c-format +msgid "" +"With this approach the properties of all the subclasses in a given mapped " +"class hierarchy are stored in a single table." +msgstr "" + +#. Tag: para +#: basic_mapping.xml:2456 #, fuzzy, no-c-format msgid "" -"Polymorphic persistence requires the declaration of each subclass of the " -"root persistent class. For the table-per-class-hierarchy mapping strategy, " -"the <subclass> declaration is used. For example:" +"Each subclass declares its own persistent properties and subclasses. Version " +"and id properties are assumed to be inherited from the root class. Each " +"subclass in a hierarchy must define a unique discriminator value. If this is " +"not specified, the fully qualified Java class name is used." +msgstr "" +"Jede Subklasse sollte ihre eigenen persistenten Properties und Subklassen " +"deklarieren. Die <version> und <id>-Properties werden als von der Stammklasse vererbt vorausgesetzt. " +"Jede Subklasse einer Hierarchie muss einen eindeutigen " +"discriminator-value definieren. Ist keiner festgelegt, so " +"wird der vollständige Java Klassenname verwendet." + +#. Tag: programlisting +#: basic_mapping.xml:2462 basic_mapping.xml:2540 +#, no-c-format +msgid "" +"@Entity\n" +"@Inheritance(strategy=InheritanceType.SINGLE_TABLE)\n" +"@DiscriminatorColumn(\n" +" name=\"planetype\",\n" +" discriminatorType=DiscriminatorType.STRING\n" +")\n" +"@DiscriminatorValue(\"Plane\")\n" +"public class Plane { ... }\n" +"\n" +"@Entity\n" +"@DiscriminatorValue(\"A320\")\n" +"public class A320 extends Plane { ... }" +msgstr "" + +#. Tag: para +#: basic_mapping.xml:2464 +#, fuzzy, no-c-format +msgid "" +"In hbm.xml, for the table-per-class-hierarchy mapping strategy, the " +"<subclass> declaration is used. For example:" msgstr "" "Schließlich erfordert die polymorphe Persistenz die Deklaration jeder " "Subklasse der persistenten Stammklasse. Für die Tabelle-pro-Klasse-" "Hierarchie (sog. \"table-per-class-hierarchy\") Mapping-Strategie wird die " "<subclass>-Deklaration verwendet." +#. Tag: programlisting +#: basic_mapping.xml:2479 +#, fuzzy, no-c-format +msgid "" +"<subclass\n" +" name=\"ClassName\"\n" +" discriminator-value=\"discriminator_value\"\n" +" proxy=\"ProxyInterface\"\n" +" lazy=\"true|false\"\n" +" dynamic-update=\"true|false\"\n" +" dynamic-insert=\"true|false\"\n" +" entity-name=\"EntityName\"\n" +" node=\"element-name\"\n" +" extends=\"SuperclassName\">\n" +"\n" +" <property .... />\n" +" .....\n" +"</subclass>" +msgstr "" +"<subclass\n" +" name=\"ClassName\"\n" +" discriminator-value=\"discriminator_value\"\n" +" proxy=\"ProxyInterface\"\n" +" lazy=\"true|false\"\n" +" dynamic-update=\"true|false\"\n" +" dynamic-insert=\"true|false\"\n" +" entity-name=\"EntityName\"\n" +" node=\"element-name\"\n" +" extends=\"SuperclassName\">\n" +"\n" +" <property .... />\n" +" .....\n" +"</subclass>" + #. Tag: para +#: basic_mapping.xml:2483 basic_mapping.xml:2656 basic_mapping.xml:2720 #, fuzzy, no-c-format msgid "" "name: the fully qualified class name of the subclass." msgstr "name: Der vollständige Klassenname der Subklasse." #. Tag: para +#: basic_mapping.xml:2488 #, fuzzy, no-c-format msgid "" "discriminator-value (optional - defaults to the class " @@ -3216,6 +5559,7 @@ msgstr "" "ist der Klassenname): Ein Wert, der einzelne Subklassen unterscheidet." #. Tag: para +#: basic_mapping.xml:2494 #, fuzzy, no-c-format msgid "" "proxy (optional): specifies a class or interface used for " @@ -3226,6 +5570,7 @@ msgstr "" "\"lazy initializing proxies\") verwendet werden soll." #. Tag: para +#: basic_mapping.xml:2499 #, fuzzy, no-c-format msgid "" "lazy (optional - defaults to true): " @@ -3236,54 +5581,323 @@ msgstr "" "deaktiviert die Verwendung von \"Lazy Fetching\"." #. Tag: para +#: basic_mapping.xml:2507 basic_mapping.xml:2685 basic_mapping.xml:2746 #, fuzzy, no-c-format msgid "" -"Each subclass declares its own persistent properties and subclasses. " -"<version> and <id> " -"properties are assumed to be inherited from the root class. Each subclass in " -"a hierarchy must define a unique discriminator-value. If " -"this is not specified, the fully qualified Java class name is used." -msgstr "" -"Jede Subklasse sollte ihre eigenen persistenten Properties und Subklassen " -"deklarieren. Die <version> und <id>-Properties werden als von der Stammklasse vererbt vorausgesetzt. " -"Jede Subklasse einer Hierarchie muss einen eindeutigen " -"discriminator-value definieren. Ist keiner festgelegt, so " -"wird der vollständige Java Klassenname verwendet." - -#. Tag: para -#, fuzzy, no-c-format -msgid "" -"For information about inheritance mappings see ." +"For information about inheritance mappings see ." msgstr "" "Informationen zu Vererbungsmappings (\"sog. \"inheritance mappings\") finden " "Sie unter ." #. Tag: title +#: basic_mapping.xml:2511 #, fuzzy, no-c-format -msgid "Joined-subclass" +msgid "Discriminator" +msgstr "discriminator" + +#. Tag: para +#: basic_mapping.xml:2513 +#, fuzzy, no-c-format +msgid "" +"Discriminators are required for polymorphic persistence using the table-per-" +"class-hierarchy mapping strategy. It declares a discriminator column of the " +"table. The discriminator column contains marker values that tell the " +"persistence layer what subclass to instantiate for a particular row. A " +"restricted set of types can be used: string, " +"character, integer, byte, short, boolean, " +"yes_no, true_false." +msgstr "" +"Das <discriminator>-Element wird für die polymorphe " +"Persistenz unter Verwendung der Tabelle-pro-Klasse-Hierarchie (sog. \"table-" +"per-class-hierarchy\") Mapping-Strategie benötigt und deklariert eine " +"Diskriminatorspalte der Tabelle. Diese Diskriminatorspalte enthält " +"Markierungswerte, die der Persistenzschicht mitteilen, welche Subklasse für " +"eine bestimmte Reihe instanziiert werden soll. Ein beschränkter Typensatz " +"kann hierfür verwendet werden: string, " +"character, integer, byte, short, boolean, " +"yes_no, true_false." + +#. Tag: para +#: basic_mapping.xml:2523 +#, no-c-format +msgid "" +"Use the @DiscriminatorColumn to define the " +"discriminator column as well as the discriminator type. Alternatively, you " +"can also use @DiscriminatorFormula to express in SQL " +"what would be in a virtual discriminator column. This is particularly handy " +"when the discriminator value can be extracted from one or more columns of " +"the table. Both @DiscriminatorColumn and " +"@DiscriminatorFormula are to be set on the root " +"entity (once per persisted hierarchy)." +msgstr "" + +#. Tag: para +#: basic_mapping.xml:2534 +#, no-c-format +msgid "" +"Finally, use @DiscriminatorValue on each class of the " +"hierarchy to specify the value stored in the discriminator column for a " +"given entity. If you do not set @DiscriminatorValue " +"on a class, the fully qualified class name is used." +msgstr "" + +#. Tag: para +#: basic_mapping.xml:2542 +#, no-c-format +msgid "" +"In hbm.xml, the <discriminator> element is used to " +"define the discriminator column or formula:" +msgstr "" + +#. Tag: programlisting +#: basic_mapping.xml:2559 +#, fuzzy, no-c-format +msgid "" +"<discriminator\n" +" column=\"discriminator_column\"\n" +" type=\"discriminator_type\"\n" +" force=\"true|false\"\n" +" insert=\"true|false\"\n" +" formula=\"arbitrary sql expression\"\n" +"/>" +msgstr "" +"<discriminator\n" +" column=\"discriminator_column\"\n" +" type=\"discriminator_type\"\n" +" force=\"true|false\"\n" +" insert=\"true|false\"\n" +" formula=\"arbitrary sql expression\"\n" +"/>" + +#. Tag: para +#: basic_mapping.xml:2563 +#, fuzzy, no-c-format +msgid "" +"column (optional - defaults to class): " +"the name of the discriminator column." +msgstr "" +"column (optional - Standardeinstellung lautet " +"class) der Name der Diskriminatorspalte." + +#. Tag: para +#: basic_mapping.xml:2569 +#, fuzzy, no-c-format +msgid "" +"type (optional - defaults to string): " +"a name that indicates the Hibernate type" +msgstr "" +"type (optional - die Standardeinstellung lautet " +"string) ein Name, der den Hibernate-Typ angibt." + +#. Tag: para +#: basic_mapping.xml:2575 +#, fuzzy, no-c-format +msgid "" +"force (optional - defaults to false): " +"\"forces\" Hibernate to specify the allowed discriminator values, even when " +"retrieving all instances of the root class." +msgstr "" +"force (optional - die Standardeinstellung lautet " +"false) \"zwingt\" Hibernate dazu, die erlaubten " +"Diskriminatorwerte beim Abruf aller Instanzen der Stammklasse zu " +"spezifizieren." + +#. Tag: para +#: basic_mapping.xml:2582 +#, fuzzy, no-c-format +msgid "" +"insert (optional - defaults to true): " +"set this to false if your discriminator column is also " +"part of a mapped composite identifier. It tells Hibernate not to include the " +"column in SQL INSERTs." +msgstr "" +"insert (optional - die Standardeinstellung lautet " +"true) wählen Sie hier die Einstellung false, falls Ihre Diskriminatortspalte auch Teil des zusammengesetzten " +"Bezeichners ist. (Hibernate wird mitgeteilt, die Spalte nicht in SQL " +"INSERTs mit einzuschließen)." + +#. Tag: para +#: basic_mapping.xml:2590 +#, fuzzy, no-c-format +msgid "" +"formula (optional): an arbitrary SQL expression that is " +"executed when a type has to be evaluated. It allows content-based " +"discrimination." +msgstr "" +"formula (optional) ein beliebiger SQL-Ausdruck, der " +"ausgeführt wird, wenn ein Typ evaluiert werden muss. Erlaubt inhaltsbasierte " +"Unterscheidung (sog. \"discrimination\")." + +#. Tag: para +#: basic_mapping.xml:2597 +#, no-c-format +msgid "" +"Actual values of the discriminator column are specified by the " +"discriminator-value attribute of the <" +"class> and <subclass> elements." +msgstr "" +"Die tatsächlichen Werte der Diskriminatorspalte werden durch das " +"discriminator-value-Attribut der <class> und <subclass>-Elemente spezifiziert." + +#. Tag: para +#: basic_mapping.xml:2602 +#, fuzzy, no-c-format +msgid "" +"The force attribute is only useful if the table contains " +"rows with \"extra\" discriminator values that are not mapped to a persistent " +"class. This will not usually be the case." +msgstr "" +"Das force-Attribut ist (nur) von Nutzen, wenn die Tabelle " +"eine Reihe mit \"zusätzlichen\" Diskriminatorwerten enthält, die nicht zu " +"einer persistenten Klasse gemappt sind. Dies ist in der Regel jedoch nicht " +"der Fall." + +#. Tag: para +#: basic_mapping.xml:2607 +#, fuzzy, no-c-format +msgid "" +"The formula attribute allows you to declare an arbitrary " +"SQL expression that will be used to evaluate the type of a row. For example:" +msgstr "" +"Mit dem formula-Attribut können Sie einen beliebigen SQL-" +"Ausdruck deklarieren, der dann zur Evaluierung des Reihentyps verwendet wird:" + +#. Tag: programlisting +#: basic_mapping.xml:2611 +#, fuzzy, no-c-format +msgid "" +"<discriminator\n" +" formula=\"case when CLASS_TYPE in ('a', 'b', 'c') then 0 else 1 end\"\n" +" type=\"integer\"/>" +msgstr "" +"<discriminator\n" +" formula=\"case when CLASS_TYPE in ('a', 'b', 'c') then 0 else 1 end\"\n" +" type=\"integer\"/>" + +#. Tag: title +#: basic_mapping.xml:2616 +#, fuzzy, no-c-format +msgid "Joined subclass strategy" msgstr "joined-subclass" #. Tag: para +#: basic_mapping.xml:2618 #, fuzzy, no-c-format msgid "" "Each subclass can also be mapped to its own table. This is called the table-" "per-subclass mapping strategy. An inherited state is retrieved by joining " -"with the table of the superclass. To do this you use the <joined-" -"subclass> element. For example:" +"with the table of the superclass. A discriminator column is not required for " +"this mapping strategy. Each subclass must, however, declare a table column " +"holding the object identifier. The primary key of this table is also a " +"foreign key to the superclass table and described by the " +"@PrimaryKeyJoinColumns or the <key> element." msgstr "" "Alternativ kann jede Subklasse zu ihrer eigenen Tabelle gemappt werden (sog. " "\"Table-per-Subclass\" Mapping-Strategie). Der vererbte Status wird durch " "Verbindung mit der Tabelle der Superklasse abgerufen. Es wird das " "<joined-subclass>-Element verwendet." +#. Tag: programlisting +#: basic_mapping.xml:2628 +#, no-c-format +msgid "" +"@Entity @Table(name=\"CATS\")\n" +"@Inheritance(strategy=InheritanceType.JOINED)\n" +"public class Cat implements Serializable { \n" +" @Id @GeneratedValue(generator=\"cat-uuid\") \n" +" @GenericGenerator(name=\"cat-uuid\", strategy=\"uuid\")\n" +" String getId() { return id; }\n" +"\n" +" ...\n" +"}\n" +"\n" +"@Entity @Table(name=\"DOMESTIC_CATS\")\n" +"@PrimaryKeyJoinColumn(name=\"CAT\")\n" +"public class DomesticCat extends Cat { \n" +" public String getName() { return name; }\n" +"}" +msgstr "" + #. Tag: para +#: basic_mapping.xml:2631 +#, no-c-format +msgid "" +"The table name still defaults to the non qualified class name. Also if " +"@PrimaryKeyJoinColumn is not set, the primary key / " +"foreign key columns are assumed to have the same names as the primary key " +"columns of the primary table of the superclass." +msgstr "" + +#. Tag: para +#: basic_mapping.xml:2638 +#, fuzzy, no-c-format +msgid "" +"In hbm.xml, use the <joined-subclass> element. For " +"example:" +msgstr "" +"Sie können unter Verwendung des class-Elements eine " +"persistente Klasse deklarieren:" + +#. Tag: programlisting +#: basic_mapping.xml:2652 +#, fuzzy, no-c-format +msgid "" +"<joined-subclass\n" +" name=\"ClassName\"\n" +" table=\"tablename\"\n" +" proxy=\"ProxyInterface\"\n" +" lazy=\"true|false\"\n" +" dynamic-update=\"true|false\"\n" +" dynamic-insert=\"true|false\"\n" +" schema=\"schema\"\n" +" catalog=\"catalog\"\n" +" extends=\"SuperclassName\"\n" +" persister=\"ClassName\"\n" +" subselect=\"SQL expression\"\n" +" entity-name=\"EntityName\"\n" +" node=\"element-name\">\n" +"\n" +" <key .... >\n" +"\n" +" <property .... />\n" +" .....\n" +"</joined-subclass>" +msgstr "" +"<joined-subclass\n" +" name=\"ClassName\"\n" +" table=\"tablename\"\n" +" proxy=\"ProxyInterface\"\n" +" lazy=\"true|false\"\n" +" dynamic-update=\"true|false\"\n" +" dynamic-insert=\"true|false\"\n" +" schema=\"schema\"\n" +" catalog=\"catalog\"\n" +" extends=\"SuperclassName\"\n" +" persister=\"ClassName\"\n" +" subselect=\"SQL expression\"\n" +" entity-name=\"EntityName\"\n" +" node=\"element-name\">\n" +"\n" +" <key .... >\n" +"\n" +" <property .... />\n" +" .....\n" +"</joined-subclass>" + +#. Tag: para +#: basic_mapping.xml:2661 basic_mapping.xml:2725 #, fuzzy, no-c-format msgid "table: the name of the subclass table." msgstr "table: Der Name der Subklassentabelle." #. Tag: para +#: basic_mapping.xml:2666 basic_mapping.xml:2730 #, fuzzy, no-c-format msgid "" "proxy (optional): specifies a class or interface to use " @@ -3294,6 +5908,7 @@ msgstr "" "\"lazy initializing proxies\") verwendet werden soll." #. Tag: para +#: basic_mapping.xml:2671 basic_mapping.xml:2735 #, fuzzy, no-c-format msgid "" "lazy (optional, defaults to true): " @@ -3304,35 +5919,102 @@ msgstr "" "deaktiviert die Verwendung von \"Lazy Fetching\"." #. Tag: para +#: basic_mapping.xml:2679 +#, no-c-format +msgid "" +"Use the <key> element to declare the primary key / " +"foreign key column. The mapping at the start of the chapter would then be re-" +"written as:" +msgstr "" + +#. Tag: programlisting +#: basic_mapping.xml:2683 #, fuzzy, no-c-format msgid "" -"A discriminator column is not required for this mapping strategy. Each " -"subclass must, however, declare a table column holding the object identifier " -"using the <key> element. The mapping at the start " -"of the chapter would then be re-written as:" +"<?xml version=\"1.0\"?>\n" +"<!DOCTYPE hibernate-mapping PUBLIC\n" +" \"-//Hibernate/Hibernate Mapping DTD//EN\"\n" +" \"http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd\">\n" +"\n" +"<hibernate-mapping package=\"eg\">\n" +"\n" +" <class name=\"Cat\" table=\"CATS\">\n" +" <id name=\"id\" column=\"uid\" type=\"long\">\n" +" <generator class=\"hilo\"/>\n" +" </id>\n" +" <property name=\"birthdate\" type=\"date\"/>\n" +" <property name=\"color\" not-null=\"true\"/>\n" +" <property name=\"sex\" not-null=\"true\"/>\n" +" <property name=\"weight\"/>\n" +" <many-to-one name=\"mate\"/>\n" +" <set name=\"kittens\">\n" +" <key column=\"MOTHER\"/>\n" +" <one-to-many class=\"Cat\"/>\n" +" </set>\n" +" <joined-subclass name=\"DomesticCat\" table=" +"\"DOMESTIC_CATS\">\n" +" <key column=\"CAT\"/>\n" +" <property name=\"name\" type=\"string\"/>\n" +" </joined-subclass>\n" +" </class>\n" +"\n" +" <class name=\"eg.Dog\">\n" +" <!-- mapping for Dog could go here -->\n" +" </class>\n" +"\n" +"</hibernate-mapping>" msgstr "" -"Bei dieser Mapping-Strategie ist keine Diskriminatortabelle erforderlich. " -"Jede Subklasse muss jedoch unter Verwendung des <key>-Elements eine Tabellenspalte deklarieren, die den Objektbezeichner " -"enthält. Das Mapping vom Kapitelbeginn würde dann wie folgt umgeschrieben:" +"<?xml version=\"1.0\"?>\n" +"<!DOCTYPE hibernate-mapping PUBLIC\n" +" \"-//Hibernate/Hibernate Mapping DTD//EN\"\n" +" \"http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd\">\n" +"\n" +"<hibernate-mapping package=\"eg\">\n" +"\n" +" <class name=\"Cat\" table=\"CATS\">\n" +" <id name=\"id\" column=\"uid\" type=\"long\">\n" +" <generator class=\"hilo\"/>\n" +" </id>\n" +" <property name=\"birthdate\" type=\"date\"/>\n" +" <property name=\"color\" not-null=\"true\"/>\n" +" <property name=\"sex\" not-null=\"true\"/>\n" +" <property name=\"weight\"/>\n" +" <many-to-one name=\"mate\"/>\n" +" <set name=\"kittens\">\n" +" <key column=\"MOTHER\"/>\n" +" <one-to-many class=\"Cat\"/>\n" +" </set>\n" +" <joined-subclass name=\"DomesticCat\" table=" +"\"DOMESTIC_CATS\">\n" +" <key column=\"CAT\"/>\n" +" <property name=\"name\" type=\"string\"/>\n" +" </joined-subclass>\n" +" </class>\n" +"\n" +" <class name=\"eg.Dog\">\n" +" <!-- mapping for Dog could go here -->\n" +" </class>\n" +"\n" +"</hibernate-mapping>" #. Tag: title -#, fuzzy, no-c-format -msgid "Union-subclass" -msgstr "union-subclass" +#: basic_mapping.xml:2690 +#, no-c-format +msgid "Table per class strategy" +msgstr "" #. Tag: para +#: basic_mapping.xml:2692 #, fuzzy, no-c-format msgid "" "A third option is to map only the concrete classes of an inheritance " "hierarchy to tables. This is called the table-per-concrete-class strategy. " "Each table defines all persistent states of the class, including the " "inherited state. In Hibernate, it is not necessary to explicitly map such " -"inheritance hierarchies. You can map each class with a separate <" -"class> declaration. However, if you wish use polymorphic " -"associations (e.g. an association to the superclass of your hierarchy), you " -"need to use the <union-subclass> mapping. For " -"example:" +"inheritance hierarchies. You can map each class as a separate entity root. " +"However, if you wish use polymorphic associations (e.g. an association to " +"the superclass of your hierarchy), you need to use the union subclass " +"mapping." msgstr "" "Eine dritte Möglichkeit besteht darin, nur die konkreten Klassen einer " "Vererbungshierarchie zu Tabellen zu mappen (sog. \"table-per-concrete-class" @@ -3344,7 +6026,67 @@ msgstr "" "wollen (z.B. eine Assoziation zur Superklasse Ihrer Hierarchie), so müssen " "Sie das <union-subclass>-Mapping verwenden." +#. Tag: programlisting +#: basic_mapping.xml:2701 +#, no-c-format +msgid "" +"@Entity\n" +"@Inheritance(strategy = InheritanceType.TABLE_PER_CLASS)\n" +"public class Flight implements Serializable { ... }" +msgstr "" + #. Tag: para +#: basic_mapping.xml:2703 +#, no-c-format +msgid "Or in hbm.xml:" +msgstr "" + +#. Tag: programlisting +#: basic_mapping.xml:2716 +#, fuzzy, no-c-format +msgid "" +"<union-subclass\n" +" name=\"ClassName\"\n" +" table=\"tablename\"\n" +" proxy=\"ProxyInterface\"\n" +" lazy=\"true|false\"\n" +" dynamic-update=\"true|false\"\n" +" dynamic-insert=\"true|false\"\n" +" schema=\"schema\"\n" +" catalog=\"catalog\"\n" +" extends=\"SuperclassName\"\n" +" abstract=\"true|false\"\n" +" persister=\"ClassName\"\n" +" subselect=\"SQL expression\"\n" +" entity-name=\"EntityName\"\n" +" node=\"element-name\">\n" +"\n" +" <property .... />\n" +" .....\n" +"</union-subclass>" +msgstr "" +"<union-subclass\n" +" name=\"ClassName\"\n" +" table=\"tablename\"\n" +" proxy=\"ProxyInterface\"\n" +" lazy=\"true|false\"\n" +" dynamic-update=\"true|false\"\n" +" dynamic-insert=\"true|false\"\n" +" schema=\"schema\"\n" +" catalog=\"catalog\"\n" +" extends=\"SuperclassName\"\n" +" abstract=\"true|false\"\n" +" persister=\"ClassName\"\n" +" subselect=\"SQL expression\"\n" +" entity-name=\"EntityName\"\n" +" node=\"element-name\">\n" +"\n" +" <property .... />\n" +" .....\n" +"</union-subclass>" + +#. Tag: para +#: basic_mapping.xml:2743 #, no-c-format msgid "" "No discriminator column or key column is required for this mapping strategy." @@ -3353,27 +6095,405 @@ msgstr "" "Schlüsselspalte erforderlich." #. Tag: title -#, fuzzy, no-c-format -msgid "Join" -msgstr "join" +#: basic_mapping.xml:2751 +#, no-c-format +msgid "Inherit properties from superclasses" +msgstr "" #. Tag: para +#: basic_mapping.xml:2753 +#, no-c-format +msgid "" +"This is sometimes useful to share common properties through a technical or a " +"business superclass without including it as a regular mapped entity (ie no " +"specific table for this entity). For that purpose you can map them as " +"@MappedSuperclass." +msgstr "" + +#. Tag: programlisting +#: basic_mapping.xml:2758 +#, no-c-format +msgid "" +"@MappedSuperclass\n" +"public class BaseEntity {\n" +" @Basic\n" +" @Temporal(TemporalType.TIMESTAMP)\n" +" public Date getLastUpdate() { ... }\n" +" public String getLastUpdater() { ... }\n" +" ...\n" +"}\n" +"\n" +"@Entity class Order extends BaseEntity {\n" +" @Id public Integer getId() { ... }\n" +" ...\n" +"}" +msgstr "" + +#. Tag: para +#: basic_mapping.xml:2760 +#, no-c-format +msgid "" +"In database, this hierarchy will be represented as an Order table having the id, lastUpdate and lastUpdater columns. The embedded superclass " +"property mappings are copied into their entity subclasses. Remember that the " +"embeddable superclass is not the root of the hierarchy though." +msgstr "" + +#. Tag: para +#: basic_mapping.xml:2768 +#, no-c-format +msgid "" +"Properties from superclasses not mapped as @MappedSuperclass are ignored." +msgstr "" + +#. Tag: para +#: basic_mapping.xml:2773 +#, no-c-format +msgid "" +"The default access type (field or methods) is used, unless you use the " +"@Access annotation." +msgstr "" + +#. Tag: para +#: basic_mapping.xml:2778 +#, no-c-format +msgid "" +"The same notion can be applied to @Embeddable objects to " +"persist properties from their superclasses. You also need to use " +"@MappedSuperclass to do that (this should not be " +"considered as a standard EJB3 feature though)" +msgstr "" + +#. Tag: para +#: basic_mapping.xml:2786 +#, no-c-format +msgid "" +"It is allowed to mark a class as @MappedSuperclass in the " +"middle of the mapped inheritance hierarchy." +msgstr "" + +#. Tag: para +#: basic_mapping.xml:2792 +#, no-c-format +msgid "" +"Any class in the hierarchy non annotated with @MappedSuperclass nor @Entity will be ignored." +msgstr "" + +#. Tag: para +#: basic_mapping.xml:2797 +#, no-c-format +msgid "" +"You can override columns defined in entity superclasses at the root entity " +"level using the @AttributeOverride annotation." +msgstr "" + +#. Tag: programlisting +#: basic_mapping.xml:2801 +#, no-c-format +msgid "" +"@MappedSuperclass\n" +"public class FlyingObject implements Serializable {\n" +"\n" +" public int getAltitude() {\n" +" return altitude;\n" +" }\n" +"\n" +" @Transient\n" +" public int getMetricAltitude() {\n" +" return metricAltitude;\n" +" }\n" +"\n" +" @ManyToOne\n" +" public PropulsionType getPropulsion() {\n" +" return metricAltitude;\n" +" }\n" +" ...\n" +"}\n" +"\n" +"@Entity\n" +"@AttributeOverride( name=\"altitude\", column = @Column(name=\"fld_altitude" +"\") )\n" +"@AssociationOverride( \n" +" name=\"propulsion\", \n" +" joinColumns = @JoinColumn(name=\"fld_propulsion_fk\") \n" +")\n" +"public class Plane extends FlyingObject {\n" +" ...\n" +"}" +msgstr "" + +#. Tag: para +#: basic_mapping.xml:2803 +#, no-c-format +msgid "" +"The altitude property will be persisted in an " +"fld_altitude column of table Plane and " +"the propulsion association will be materialized in a " +"fld_propulsion_fk foreign key column." +msgstr "" + +#. Tag: para +#: basic_mapping.xml:2809 +#, no-c-format +msgid "" +"You can define @AttributeOverride(s) and " +"@AssociationOverride(s) on @Entity " +"classes, @MappedSuperclass classes and properties " +"pointing to an @Embeddable object." +msgstr "" + +#. Tag: para +#: basic_mapping.xml:2815 +#, no-c-format +msgid "" +"In hbm.xml, simply map the properties of the superclass in the <" +"class> element of the entity that needs to inherit them." +msgstr "" + +#. Tag: title +#: basic_mapping.xml:2821 +#, no-c-format +msgid "Mapping one entity to several tables" +msgstr "" + +#. Tag: para +#: basic_mapping.xml:2823 +#, no-c-format +msgid "" +"While not recommended for a fresh schema, some legacy databases force your " +"to map a single entity on several tables." +msgstr "" + +#. Tag: para +#: basic_mapping.xml:2826 +#, no-c-format +msgid "" +"Using the @SecondaryTable or @SecondaryTables class level annotations. To express that a column is in a " +"particular table, use the table parameter of " +"@Column or @JoinColumn." +msgstr "" + +#. Tag: programlisting +#: basic_mapping.xml:2832 +#, no-c-format +msgid "" +"@Entity\n" +"@Table(name=\"MainCat\")\n" +"@SecondaryTables({\n" +" @SecondaryTable(name=\"Cat1\", pkJoinColumns={\n" +" @PrimaryKeyJoinColumn(name=\"cat_id\", referencedColumnName=\"id\")\n" +" ),\n" +" @SecondaryTable(name=\"Cat2\", uniqueConstraints={@UniqueConstraint" +"(columnNames={\"storyPart2\"})})\n" +"})\n" +"public class Cat implements Serializable {\n" +"\n" +" private Integer id;\n" +" private String name;\n" +" private String storyPart1;\n" +" private String storyPart2;\n" +"\n" +" @Id @GeneratedValue\n" +" public Integer getId() {\n" +" return id;\n" +" }\n" +"\n" +" public String getName() {\n" +" return name;\n" +" }\n" +" \n" +" @Column(table=\"Cat1\")\n" +" public String getStoryPart1() {\n" +" return storyPart1;\n" +" }\n" +"\n" +" @Column(table=\"Cat2\")\n" +" public String getStoryPart2() {\n" +" return storyPart2;\n" +" }\n" +"}" +msgstr "" + +#. Tag: para +#: basic_mapping.xml:2834 +#, no-c-format +msgid "" +"In this example, name will be in MainCat. storyPart1 will be in Cat1 " +"and storyPart2 will be in Cat2. " +"Cat1 will be joined to MainCat using " +"the cat_id as a foreign key, and Cat2 " +"using id (ie the same column name, the MainCat id column has). Plus a unique constraint on storyPart2 has been set." +msgstr "" + +#. Tag: para +#: basic_mapping.xml:2844 +#, no-c-format +msgid "" +"There is also additional tuning accessible via the @org.hibernate." +"annotations.Table annotation:" +msgstr "" + +#. Tag: para +#: basic_mapping.xml:2850 #, fuzzy, no-c-format msgid "" -"Using the <join> element, it is possible to map " -"properties of one class to several tables that have a one-to-one " -"relationship. For example:" +"fetch: If set to JOIN, the default, Hibernate will use an " +"inner join to retrieve a secondary table defined by a class or its " +"superclasses and an outer join for a secondary table defined by a subclass. " +"If set to SELECT then Hibernate will use a sequential " +"select for a secondary table defined on a subclass, which will be issued " +"only if a row turns out to represent an instance of the subclass. Inner " +"joins will still be used to retrieve a secondary defined by the class and " +"its superclasses." msgstr "" -"Mittels des <join>-Elements können Properties einer " -"Klasse zu mehreren Tabellen gemappt werden, wenn eine 1-zu-1 Beziehung " -"zwischen den Tabellen besteht." +"fetch (optional - die Standardeinstellung lautet " +"join): Falls im Standard auf join " +"eingestellt, so verwendet Hibernate einen inneren Verbund (sog. \"inner join" +"\"), um einen durch eine Klasse oder deren Superklasse definierten " +"<join> und einen äußeren Verbund (sog. \"outer join" +"\") für einen durch eine Subklasse definierten <join> abzurufen. Bei der Einstellung select verwendet " +"Hibernate eine sequentielle Auswahl für einen an einer Subklasse definierten " +"<join>, welcher nur herausgegeben wird, wenn " +"festgestellt wird, dass eine Reihe eine Instanz der Subklasse repräsentiert. " +"Innere Verbünde werden nach wie vor verwendet, um einen durch eine Klasse " +"oder deren Superklasse definierten <join> abzurufen." #. Tag: para +#: basic_mapping.xml:2862 +#, fuzzy, no-c-format +msgid "" +"inverse: If true, Hibernate will not try to insert or " +"update the properties defined by this join. Default to false." +msgstr "" +"inverse (optional - die Standardeinstellung lautet " +"false): Falls aktiviert, wird Hibernate nicht versuchen, " +"die durch diese Verknüpfung definierten Properties einzufügen oder zu " +"aktualisieren." + +#. Tag: para +#: basic_mapping.xml:2868 +#, fuzzy, no-c-format +msgid "" +"optional: If enabled (the default), Hibernate will insert " +"a row only if the properties defined by this join are non-null and will " +"always use an outer join to retrieve the properties." +msgstr "" +"optional (optional - die Standardeinstellung lautet " +"false): Falls aktiviert, wird Hibernate nur dann eine " +"Reihe einfügen, wenn die durch diese Verknüpfung definierten Properties " +"ungleich Null sind. Es wird außerdem stets einen äußeren Verbund beim Abruf " +"der Properties verwenden." + +#. Tag: para +#: basic_mapping.xml:2875 +#, no-c-format +msgid "" +"foreignKey: defines the Foreign Key name of a secondary " +"table pointing back to the primary table." +msgstr "" + +#. Tag: para +#: basic_mapping.xml:2880 +#, no-c-format +msgid "" +"Make sure to use the secondary table name in the appliesto property" +msgstr "" + +#. Tag: programlisting +#: basic_mapping.xml:2883 +#, no-c-format +msgid "" +"@Entity\n" +"@Table(name=\"MainCat\")\n" +"@SecondaryTable(name=\"Cat1\")\n" +"@org.hibernate.annotations.Table(\n" +" appliesTo=\"Cat1\",\n" +" fetch=FetchMode.SELECT,\n" +" optional=true)\n" +"public class Cat implements Serializable {\n" +"\n" +" private Integer id;\n" +" private String name;\n" +" private String storyPart1;\n" +" private String storyPart2;\n" +"\n" +" @Id @GeneratedValue\n" +" public Integer getId() {\n" +" return id;\n" +" }\n" +"\n" +" public String getName() {\n" +" return name;\n" +" }\n" +" \n" +" @Column(table=\"Cat1\")\n" +" public String getStoryPart1() {\n" +" return storyPart1;\n" +" }\n" +"\n" +" @Column(table=\"Cat2\")\n" +" public String getStoryPart2() {\n" +" return storyPart2;\n" +" }\n" +"}" +msgstr "" + +#. Tag: para +#: basic_mapping.xml:2885 +#, fuzzy, no-c-format +msgid "In hbm.xml, use the <join> element." +msgstr "" +"Nehmen wir etwa das folgende <properties>-Mapping:" + +#. Tag: programlisting +#: basic_mapping.xml:2903 +#, fuzzy, no-c-format +msgid "" +"<join\n" +" table=\"tablename\"\n" +" schema=\"owner\"\n" +" catalog=\"catalog\"\n" +" fetch=\"join|select\"\n" +" inverse=\"true|false\"\n" +" optional=\"true|false\">\n" +"\n" +" <key ... />\n" +"\n" +" <property ... />\n" +" ...\n" +"</join>" +msgstr "" +"<join\n" +" table=\"tablename\"\n" +" schema=\"owner\"\n" +" catalog=\"catalog\"\n" +" fetch=\"join|select\"\n" +" inverse=\"true|false\"\n" +" optional=\"true|false\">\n" +" \n" +" <key ... />\n" +" \n" +" <property ... />\n" +" ...\n" +"</join>" + +#. Tag: para +#: basic_mapping.xml:2907 #, fuzzy, no-c-format msgid "table: the name of the joined table." msgstr "table: Der Name der verbundenen Tabelle." #. Tag: para +#: basic_mapping.xml:2924 #, fuzzy, no-c-format msgid "" "fetch (optional - defaults to join): " @@ -3400,6 +6520,7 @@ msgstr "" "oder deren Superklasse definierten <join> abzurufen." #. Tag: para +#: basic_mapping.xml:2939 #, fuzzy, no-c-format msgid "" "inverse (optional - defaults to falseoptional (optional - defaults to false@ManyToOne or " +"@OnetoOne." +msgstr "" + +#. Tag: para +#: basic_mapping.xml:2978 +#, no-c-format +msgid "" +"@ManyToOne and @OneToOne have a " +"parameter named targetEntity which describes the target " +"entity name. You usually don't need this parameter since the default value " +"(the type of the property that stores the association) is good in almost all " +"cases. However this is useful when you want to use interfaces as the return " +"type instead of the regular entity." +msgstr "" + +#. Tag: para +#: basic_mapping.xml:2985 +#, no-c-format +msgid "" +"Setting a value of the cascade attribute to any " +"meaningful value other than nothing will propagate certain operations to the " +"associated object. The meaningful values are divided into three categories." +msgstr "" + +#. Tag: para +#: basic_mapping.xml:2992 +#, no-c-format +msgid "" +"basic operations, which include: persist, merge, delete, save-" +"update, evict, replicate, lock and refresh;" +msgstr "" + +#. Tag: para +#: basic_mapping.xml:2998 #, fuzzy, no-c-format msgid "" -"The <key> element has featured a few times within " +"special values: delete-orphan or all ;" +msgstr "" +"Beachten Sie, wie Assoziationen nun unter Verwendung von entity-" +"name statt class spezifiziert werden." + +#. Tag: para +#: basic_mapping.xml:3003 +#, no-c-format +msgid "" +"comma-separated combinations of operation names: cascade=\"persist," +"merge,evict\" or cascade=\"all,delete-orphan\". " +"See for a full explanation. Note " +"that single valued many-to-one associations do not support orphan delete." +msgstr "" + +#. Tag: para +#: basic_mapping.xml:3012 +#, no-c-format +msgid "" +"By default, single point associations are eagerly fetched in JPA 2. You can " +"mark it as lazily fetched by using @ManyToOne(fetch=FetchType." +"LAZY) in which case Hibernate will proxy the association and " +"load it when the state of the associated entity is reached. You can force " +"Hibernate not to use a proxy by using @LazyToOne(NO_PROXY). In this case, the property is fetched lazily when the instance " +"variable is first accessed. This requires build-time bytecode " +"instrumentation. lazy=\"false\" specifies that the association will always " +"be eagerly fetched." +msgstr "" + +#. Tag: para +#: basic_mapping.xml:3022 +#, no-c-format +msgid "" +"With the default JPA options, single-ended associations are loaded with a " +"subsequent select if set to LAZY, or a SQL JOIN is used " +"for EAGER associations. You can however adjust the " +"fetching strategy, ie how data is fetched by using @Fetch. FetchMode can be SELECT (a " +"select is triggered when the association needs to be loaded) or " +"JOIN (use a SQL JOIN to load the association while " +"loading the owner entity). JOIN overrides any lazy " +"attribute (an association loaded through a JOIN strategy " +"cannot be lazy)." +msgstr "" + +#. Tag: title +#: basic_mapping.xml:3034 +#, fuzzy, no-c-format +msgid "Using a foreign key or an association table" +msgstr "Assoziationen eines eindeutigen Fremdschlüssels" + +#. Tag: para +#: basic_mapping.xml:3036 +#, fuzzy, no-c-format +msgid "An ordinary association to another persistent class is declared using a" +msgstr "" +"Eine \"One-to-One\"-Assoziation mit einer anderen persistenten Klasse wird " +"unter Verwendung eines one-to-one-Elements deklariert." + +#. Tag: para +#: basic_mapping.xml:3041 +#, no-c-format +msgid "" +"@ManyToOne if several entities can point to the the " +"target entity" +msgstr "" + +#. Tag: para +#: basic_mapping.xml:3046 +#, no-c-format +msgid "" +"@OneToOne if only a single entity can point to the " +"the target entity" +msgstr "" + +#. Tag: para +#: basic_mapping.xml:3051 +#, no-c-format +msgid "" +"and a foreign key in one table is referencing the primary key column(s) of " +"the target table." +msgstr "" + +#. Tag: programlisting +#: basic_mapping.xml:3054 +#, no-c-format +msgid "" +"@Entity\n" +"public class Flight implements Serializable {\n" +" @ManyToOne( cascade = {CascadeType.PERSIST, CascadeType.MERGE} )\n" +" @JoinColumn(name=\"COMP_ID\")\n" +" public Company getCompany() {\n" +" return company;\n" +" }\n" +" ...\n" +"}" +msgstr "" + +#. Tag: para +#: basic_mapping.xml:3056 +#, no-c-format +msgid "" +"The @JoinColumn attribute is optional, the default value" +"(s) is the concatenation of the name of the relationship in the owner side, " +"_ (underscore), and the name of the primary key column in " +"the owned side. In this example company_id because the " +"property name is company and the column id of Company is " +"id." +msgstr "" + +#. Tag: programlisting +#: basic_mapping.xml:3064 +#, no-c-format +msgid "" +"@Entity\n" +"public class Flight implements Serializable {\n" +" @ManyToOne( cascade = {CascadeType.PERSIST, CascadeType.MERGE}, " +"targetEntity=CompanyImpl.class )\n" +" @JoinColumn(name=\"COMP_ID\")\n" +" public Company getCompany() {\n" +" return company;\n" +" }\n" +" ...\n" +"}\n" +"\n" +"public interface Company {\n" +" ...\n" +"}" +msgstr "" + +#. Tag: para +#: basic_mapping.xml:3066 +#, no-c-format +msgid "" +"You can also map a to one association through an association table. This " +"association table described by the @JoinTable annotation " +"will contains a foreign key referencing back the entity table (through " +"@JoinTable.joinColumns) and a a foreign key referencing " +"the target entity table (through @JoinTable.inverseJoinColumns)." +msgstr "" + +#. Tag: programlisting +#: basic_mapping.xml:3074 +#, no-c-format +msgid "" +"@Entity\n" +"public class Flight implements Serializable {\n" +" @ManyToOne( cascade = {CascadeType.PERSIST, CascadeType.MERGE} )\n" +" @JoinTable(name=\"Flight_Company\",\n" +" joinColumns = @JoinColumn(name=\"FLIGHT_ID\"),\n" +" inverseJoinColumns = @JoinColumn(name=\"COMP_ID\")\n" +" )\n" +" public Company getCompany() {\n" +" return company;\n" +" }\n" +" ...\n" +"}" +msgstr "" + +#. Tag: para +#: basic_mapping.xml:3077 +#, no-c-format +msgid "" +"You can use a SQL fragment to simulate a physical join column using the " +"@JoinColumnOrFormula / " +"@JoinColumnOrformulas annotations (just like you can " +"use a SQL fragment to simulate a property column via the " +"@Formula annotation)." +msgstr "" + +#. Tag: programlisting +#: basic_mapping.xml:3083 +#, no-c-format +msgid "" +"@Entity\n" +"public class Ticket implements Serializable {\n" +" @ManyToOne\n" +" @JoinColumnOrFormula(formula=\"(firstname + ' ' + lastname)\")\n" +" public Person getOwner() {\n" +" return person;\n" +" }\n" +" ...\n" +"}" +msgstr "" + +#. Tag: para +#: basic_mapping.xml:3086 +#, no-c-format +msgid "" +"You can mark an association as mandatory by using the " +"optional=false attribute. We recommend to use Bean " +"Validation's @NotNull annotation as a better " +"alternative however. As a consequence, the foreign key column(s) will be " +"marked as not nullable (if possible)." +msgstr "" + +#. Tag: para +#: basic_mapping.xml:3092 +#, no-c-format +msgid "" +"When Hibernate cannot resolve the association because the expected " +"associated element is not in database (wrong id on the association column), " +"an exception is raised. This might be inconvenient for legacy and badly " +"maintained schemas. You can ask Hibernate to ignore such elements instead of " +"raising an exception using the @NotFound annotation." +msgstr "" + +#. Tag: title +#: basic_mapping.xml:3100 +#, no-c-format +msgid "@NotFound annotation" +msgstr "" + +#. Tag: programlisting +#: basic_mapping.xml:3102 +#, no-c-format +msgid "" +"@Entity\n" +"public class Child {\n" +" ...\n" +" @ManyToOne\n" +" @NotFound(action=NotFoundAction.IGNORE)\n" +" public Parent getParent() { ... }\n" +" ...\n" +"}" +msgstr "" + +#. Tag: para +#: basic_mapping.xml:3105 +#, no-c-format +msgid "" +"Sometimes you want to delegate to your database the deletion of cascade when " +"a given entity is deleted. In this case Hibernate generates a cascade delete " +"constraint at the database level." +msgstr "" + +#. Tag: title +#: basic_mapping.xml:3110 +#, no-c-format +msgid "@OnDelete annotation" +msgstr "" + +#. Tag: programlisting +#: basic_mapping.xml:3112 +#, no-c-format +msgid "" +"@Entity\n" +"public class Child {\n" +" ...\n" +" @ManyToOne\n" +" @OnDelete(action=OnDeleteAction.CASCADE)\n" +" public Parent getParent() { ... }\n" +" ...\n" +"}" +msgstr "" + +#. Tag: para +#: basic_mapping.xml:3115 +#, no-c-format +msgid "" +"Foreign key constraints, while generated by Hibernate, have a fairly " +"unreadable name. You can override the constraint name using " +"@ForeignKey." +msgstr "" + +#. Tag: title +#: basic_mapping.xml:3120 +#, fuzzy, no-c-format +msgid "@ForeignKey annotation" +msgstr "Assoziationen eines eindeutigen Fremdschlüssels" + +#. Tag: programlisting +#: basic_mapping.xml:3122 +#, no-c-format +msgid "" +"@Entity\n" +"public class Child {\n" +" ...\n" +" @ManyToOne\n" +" @ForeignKey(name=\"FK_PARENT\")\n" +" public Parent getParent() { ... }\n" +" ...\n" +"}\n" +"\n" +"alter table Child add constraint FK_PARENT foreign key (parent_id) " +"references Parent" +msgstr "" + +#. Tag: para +#: basic_mapping.xml:3125 +#, no-c-format +msgid "" +"Sometimes, you want to link one entity to an other not by the target entity " +"primary key but by a different unique key. You can achieve that by " +"referencing the unique key column(s) in @JoinColumn." +"referenceColumnName." +msgstr "" + +#. Tag: programlisting +#: basic_mapping.xml:3130 basic_mapping.xml:3682 +#, no-c-format +msgid "" +"@Entity\n" +"class Person {\n" +" @Id Integer personNumber;\n" +" String firstName;\n" +" @Column(name=\"I\")\n" +" String initial;\n" +" String lastName;\n" +"}\n" +"\n" +"@Entity\n" +"class Home {\n" +" @ManyToOne\n" +" @JoinColumns({\n" +" @JoinColumn(name=\"first_name\", referencedColumnName=\"firstName\"),\n" +" @JoinColumn(name=\"init\", referencedColumnName=\"I\"),\n" +" @JoinColumn(name=\"last_name\", referencedColumnName=\"lastName\"),\n" +" })\n" +" Person owner\n" +"}" +msgstr "" + +#. Tag: para +#: basic_mapping.xml:3132 +#, no-c-format +msgid "" +"This is not encouraged however and should be reserved to legacy mappings." +msgstr "" + +#. Tag: para +#: basic_mapping.xml:3135 +#, no-c-format +msgid "" +"In hbm.xml, mapping an association is similar. The main difference is that a " +"@OneToOne is mapped as <many-to-one " +"unique=\"true\"/>, let's dive into the subject." +msgstr "" + +#. Tag: programlisting +#: basic_mapping.xml:3177 +#, fuzzy, no-c-format +msgid "" +"<many-to-one\n" +" name=\"propertyName\"\n" +" column=\"column_name\"\n" +" class=\"ClassName\"\n" +" cascade=\"cascade_style\"\n" +" fetch=\"join|select\"\n" +" update=\"true|false\"\n" +" insert=\"true|false\"\n" +" property-ref=\"propertyNameFromAssociatedClass\"\n" +" access=\"field|property|ClassName\"\n" +" unique=\"true|false\"\n" +" not-null=\"true|false\"\n" +" optimistic-lock=\"true|false\"\n" +" lazy=\"proxy|no-proxy|false\"\n" +" not-found=\"ignore|exception\"\n" +" entity-name=\"EntityName\"\n" +" formula=\"arbitrary SQL expression\"\n" +" node=\"element-name|@attribute-name|element/@attribute|.\"\n" +" embed-xml=\"true|false\"\n" +" index=\"index_name\"\n" +" unique_key=\"unique_key_id\"\n" +" foreign-key=\"foreign_key_name\"\n" +"/>" +msgstr "" +"<many-to-one\n" +" name=\"propertyName\"\n" +" column=\"column_name\"\n" +" class=\"ClassName\"\n" +" cascade=\"cascade_style\"\n" +" fetch=\"join|select\"\n" +" update=\"true|false\"\n" +" insert=\"true|false\"\n" +" property-ref=\"propertyNameFromAssociatedClass\"\n" +" access=\"field|property|ClassName\"\n" +" unique=\"true|false\"\n" +" not-null=\"true|false\"\n" +" optimistic-lock=\"true|false\"\n" +" lazy=\"proxy|no-proxy|false\"\n" +" not-found=\"ignore|exception\"\n" +" entity-name=\"EntityName\"\n" +" formula=\"arbitrary SQL expression\"\n" +" node=\"element-name|@attribute-name|element/@attribute|.\"\n" +" embed-xml=\"true|false\"\n" +" index=\"index_name\"\n" +" unique_key=\"unique_key_id\"\n" +" foreign-key=\"foreign_key_name\"\n" +"/>" + +#. Tag: para +#: basic_mapping.xml:3185 basic_mapping.xml:3868 +#, fuzzy, no-c-format +msgid "" +"column (optional): the name of the foreign key column. " +"This can also be specified by nested <column> " +"element(s)." +msgstr "" +"column (optional): Der Spaltenname des Fremdschlüssels. " +"Kann auch durch verschachtelte <column>-Element(e) " +"spezifiziert werden." + +#. Tag: para +#: basic_mapping.xml:3191 basic_mapping.xml:3385 +#, fuzzy, no-c-format +msgid "" +"class (optional - defaults to the property type " +"determined by reflection): the name of the associated class." +msgstr "" +"class (optional - Standard ist der durch die Reflexion " +"bestimmte Property-Typ): Der Name der assoziierten Klasse." + +#. Tag: para +#: basic_mapping.xml:3197 basic_mapping.xml:3391 +#, fuzzy, no-c-format +msgid "" +"cascade (optional): specifies which operations should be " +"cascaded from the parent object to the associated object." +msgstr "" +"cascade (optional) legt fest, welche Vorgänge vom " +"übergeordneten Objekt an das assoziierte Objekt weitergegeben werden sollen." + +#. Tag: para +#: basic_mapping.xml:3203 basic_mapping.xml:3407 +#, fuzzy, no-c-format +msgid "" +"fetch (optional - defaults to select): " +"chooses between outer-join fetching or sequential select fetching." +msgstr "" +"fetch (optional - die Standardeinstellung lautet " +"select): Wählt zwischen \"Outer-Join-Fetching\" oder " +"sequentiellem \"Select-Fetching\"." + +#. Tag: para +#: basic_mapping.xml:3209 +#, fuzzy, no-c-format +msgid "" +"update, insert (optional - defaults to true): specifies that the mapped columns should be included in SQL " +"UPDATE and/or INSERT statements. " +"Setting both to false allows a pure \"derived\" " +"association whose value is initialized from another property that maps to " +"the same column(s), or by a trigger or other application." +msgstr "" +"update, insert (optional - die Standardeinstellung lautet " +"true) legt fest, dass die gemappten Spalten in SQL " +"UPDATE und/oder INSERT-Anweisungen " +"eingeschlossen werden sollten. Wählt man bei beiden die Einstellung " +"false, so ist eine reine, \"abgeleitete\" Assoziation " +"möglich, deren Wert aus einer anderen Property, die zu derselben/denselben " +"Spalte(n) mappt oder durch einen Trigger oder eine andere Anwendung " +"initialisiert wird, möglich." + +#. Tag: para +#: basic_mapping.xml:3219 +#, fuzzy, no-c-format +msgid "" +"property-ref (optional): the name of a property of the " +"associated class that is joined to this foreign key. If not specified, the " +"primary key of the associated class is used." +msgstr "" +"property-ref: (optional) Der Name einer Property der " +"assoziierten Klasse die mit diesem Fremdschlüssel verbunden ist. Falls nicht " +"festgelegt, so wird der Primärschlüssel der assoziierten Klasse verwendet." + +#. Tag: para +#: basic_mapping.xml:3232 +#, fuzzy, no-c-format +msgid "" +"unique (optional): enables the DDL generation of a unique " +"constraint for the foreign-key column. By allowing this to be the target of " +"a property-ref, you can make the association multiplicity " +"one-to-one." +msgstr "" +"unique (optional): Aktiviert die DDL-Generierung einer " +"eindeutigen Bedingung für die Spalte des Fremdschlüssels. Kann auch das Ziel " +"einer property-ref sein. Dadurch ist die " +"Assoziationsmultiplizität \"one-to-one\" effektiv." + +#. Tag: para +#: basic_mapping.xml:3240 +#, fuzzy, no-c-format +msgid "" +"not-null (optional): enables the DDL generation of a " +"nullability constraint for the foreign key columns." +msgstr "" +"not-null (optional): Aktiviert die DDL-Generierung einer " +"\"Nullability\"-Bedingung für die Fremdschlüsselspalten." + +#. Tag: para +#: basic_mapping.xml:3254 +#, fuzzy, no-c-format +msgid "" +"lazy (optional - defaults to proxy): " +"by default, single point associations are proxied. lazy=\"no-proxy" +"\" specifies that the property should be fetched lazily when the " +"instance variable is first accessed. This requires build-time bytecode " +"instrumentation. lazy=\"false\" specifies that the " +"association will always be eagerly fetched." +msgstr "" +"lazy (optional - die Standardeinstellung lautet " +"proxy): In der Standardeinstellung werden \"Single-Point" +"\"-Assoziationen geproxied. lazy=\"no-proxy\" bestimmt, " +"dass für die Property \"lazy Fetching\" gilt (d.h. assoziierte Objekte " +"werden bei Bedarf nachgeladen), wenn erstmals auf die Instanzvariable " +"zugegriffen wird (erfordert Build-time Bytecode Instrumentierung). " +"lazy=\"false\" bestimmt, dass für die Assoziation stets " +"\"eager Fetching\" gilt (d.h. zusammengefasstes Laden von Objekt und " +"assoziierten Objekten mit Verbundoperationen)." + +#. Tag: para +#: basic_mapping.xml:3264 +#, fuzzy, no-c-format +msgid "" +"not-found (optional - defaults to exception): specifies how foreign keys that reference missing rows will be " +"handled. ignore will treat a missing row as a null " +"association." +msgstr "" +"not-found (optional - standardmäßig exception): Bestimmt, wie Fremdschlüssel, die auf fehlende Reihen verweisen, " +"behandelt werden. Mit ignore wird eine fehlende Reihe als " +"Null-Assoziation angesehen." + +#. Tag: para +#: basic_mapping.xml:3272 basic_mapping.xml:3448 +#, fuzzy, no-c-format +msgid "" +"entity-name (optional): the entity name of the associated " +"class." +msgstr "" +"entity-name (optional): Der Entity-Name der assoziierten " +"Klasse." + +#. Tag: para +#: basic_mapping.xml:3277 +#, no-c-format +msgid "" +"formula (optional): an SQL expression that defines the " +"value for a computed foreign key." +msgstr "" +"formula (optional): Ein SQL-Ausdruck, der den Wert für " +"einen errechneten Fremdschlüssel definiert." + +#. Tag: para +#: basic_mapping.xml:3284 +#, fuzzy, no-c-format +msgid "" +"Setting a value of the cascade attribute to any " +"meaningful value other than none will propagate certain " +"operations to the associated object. The meaningful values are divided into " +"three categories. First, basic operations, which include: persist, " +"merge, delete, save-update, evict, replicate, lock and refresh; " +"second, special values: delete-orphan; and third," +"all comma-separated combinations of operation names: " +"cascade=\"persist,merge,evict\" or cascade=\"all," +"delete-orphan\". See " +"for a full explanation. Note that single valued, many-to-one and one-to-one, " +"associations do not support orphan delete." +msgstr "" +"Wird der Wert des cascade-Attributs auf einen anderen " +"sinnvollen Wert als none gesetzt, so pflanzen sich " +"bestimmte Vorgänge zum zugehörigen Objekt fort. Zu den sinnvollen Werten " +"gehören Hibernates Grundvorgänge persist, merge, delete, save-" +"update, evict, replicate, lock, refresh, die Sonderwerte " +"delete-orphan und all sowie durch " +"Komma getrennte Kombinationen von Vorgangsnamen, zum Beispiel " +"cascade=\"persist,merge,evict\" oder cascade=" +"\"all,delete-orphan\". Eine vollständige Erläuterung hierzu finden " +"Sie unter . Bitte beachten Sie, " +"dass einwertige Assoziationen (Many-to-One und One-to-One Assoziationen) " +"\"Orphan Delete\" nicht unterstützen." + +#. Tag: para +#: basic_mapping.xml:3298 +#, fuzzy, no-c-format +msgid "" +"Here is an example of a typical many-to-one declaration:" +msgstr "" +"Eine typische many-to-one-Deklaration sieht so " +"unkompliziert wie die Folgende aus:" + +#. Tag: programlisting +#: basic_mapping.xml:3301 +#, fuzzy, no-c-format +msgid "" +"<many-to-one name=\"product\" class=\"Product\" column=\"PRODUCT_ID\"/>" +msgstr "" +"<many-to-one name=\"product\" class=\"Product\" column=\"PRODUCT_ID\"/>" + +#. Tag: para +#: basic_mapping.xml:3303 +#, fuzzy, no-c-format +msgid "" +"The property-ref attribute should only be used for " +"mapping legacy data where a foreign key refers to a unique key of the " +"associated table other than the primary key. This is a complicated and " +"confusing relational model. For example, if the Product " +"class had a unique serial number that is not the primary key. The " +"unique attribute controls Hibernate's DDL generation with " +"the SchemaExport tool." +msgstr "" +"Das property-ref-Attribut sollte nur für das Mapping von " +"Stammdaten verwendet werden, in denen ein Fremdschlüssel auf einen " +"eindeutigen Schlüssel der assoziierten Tabelle verweist, der nicht der " +"Primärschlüssel ist. Es handelt sich dabei um ein nicht besonders " +"ansehnliches relationales Modell. Nehmen wir zum Beispiel an, dass die " +"Product-Klasse eine eindeutige Seriennummer besitzt, die " +"nicht der Primärschlüssel ist. (Das unique-Attribut " +"steuert Hibernates DDL-Generierung mittels dem SchemaExport-Tool)." + +#. Tag: programlisting +#: basic_mapping.xml:3311 +#, fuzzy, no-c-format +msgid "" +"<property name=\"serialNumber\" unique=\"true\" type=\"string\" column=" +"\"SERIAL_NUMBER\"/>" +msgstr "" +"<property name=\"serialNumber\" unique=\"true\" type=\"string\" column=" +"\"SERIAL_NUMBER\"/>" + +#. Tag: para +#: basic_mapping.xml:3313 +#, no-c-format +msgid "Then the mapping for OrderItem might use:" +msgstr "" +"Dann könnte das Mapping für OrderItem folgendes verwenden:" + +#. Tag: programlisting +#: basic_mapping.xml:3316 +#, fuzzy, no-c-format +msgid "" +"<many-to-one name=\"product\" property-ref=\"serialNumber\" column=" +"\"PRODUCT_SERIAL_NUMBER\"/>" +msgstr "" +"<many-to-one name=\"product\" property-ref=\"serialNumber\" column=" +"\"PRODUCT_SERIAL_NUMBER\"/>" + +#. Tag: para +#: basic_mapping.xml:3318 +#, fuzzy, no-c-format +msgid "This is not encouraged, however." +msgstr "Allerdings wird dies nicht empfohlen." + +#. Tag: para +#: basic_mapping.xml:3320 +#, no-c-format +msgid "" +"If the referenced unique key comprises multiple properties of the associated " +"entity, you should map the referenced properties inside a named <" +"properties> element." +msgstr "" +"Wenn der eindeutige Schlüssel, auf den verwiesen wird, mehrere Properties " +"der zugehörigen Entity enthält, so sollten die Properties, auf die verwiesen " +"wird, in einem benannten <properties>-Element " +"gemappt werden." + +#. Tag: para +#: basic_mapping.xml:3324 +#, fuzzy, no-c-format +msgid "" +"If the referenced unique key is the property of a component, you can specify " +"a property path:" +msgstr "" +"Falls der eindeutige Schlüssel, auf den verwiesen wird, die Property einer " +"Komponente ist, so können Sie einen Property-Pfad festlegen:" + +#. Tag: programlisting +#: basic_mapping.xml:3327 +#, fuzzy, no-c-format +msgid "" +"<many-to-one name=\"owner\" property-ref=\"identity.ssn\" column=" +"\"OWNER_SSN\"/>" +msgstr "" +"<many-to-one name=\"owner\" property-ref=\"identity.ssn\" column=" +"\"OWNER_SSN\"/>" + +#. Tag: title +#: basic_mapping.xml:3331 +#, no-c-format +msgid "Sharing the primary key with the associated entity" +msgstr "" + +#. Tag: para +#: basic_mapping.xml:3333 +#, no-c-format +msgid "" +"The second approach is to ensure an entity and its associated entity share " +"the same primary key. In this case the primary key column is also a foreign " +"key and there is no extra column. These associations are always one to one." +msgstr "" + +#. Tag: title +#: basic_mapping.xml:3339 +#, fuzzy, no-c-format +msgid "One to One association" +msgstr "Assoziationen eines eindeutigen Fremdschlüssels" + +#. Tag: programlisting +#: basic_mapping.xml:3341 +#, no-c-format +msgid "" +"@Entity\n" +"public class Body {\n" +" @Id\n" +" public Long getId() { return id; }\n" +"\n" +" @OneToOne(cascade = CascadeType.ALL)\n" +" @MapsId\n" +" public Heart getHeart() {\n" +" return heart;\n" +" }\n" +" ...\n" +"} \n" +"\n" +"@Entity\n" +"public class Heart {\n" +" @Id\n" +" public Long getId() { ...}\n" +"}" +msgstr "" + +#. Tag: para +#: basic_mapping.xml:3345 +#, no-c-format +msgid "" +"Many people got confused by these primary key based one to one associations. " +"They can only be lazily loaded if Hibernate knows that the other side of the " +"association is always present. To indicate to Hibernate that it is the case, " +"use @OneToOne(optional=false)." +msgstr "" + +#. Tag: para +#: basic_mapping.xml:3352 +#, no-c-format +msgid "In hbm.xml, use the following mapping." +msgstr "" + +#. Tag: programlisting +#: basic_mapping.xml:3377 +#, fuzzy, no-c-format +msgid "" +"<one-to-one\n" +" name=\"propertyName\"\n" +" class=\"ClassName\"\n" +" cascade=\"cascade_style\"\n" +" constrained=\"true|false\"\n" +" fetch=\"join|select\"\n" +" property-ref=\"propertyNameFromAssociatedClass\"\n" +" access=\"field|property|ClassName\"\n" +" formula=\"any SQL expression\"\n" +" lazy=\"proxy|no-proxy|false\"\n" +" entity-name=\"EntityName\"\n" +" node=\"element-name|@attribute-name|element/@attribute|.\"\n" +" embed-xml=\"true|false\"\n" +" foreign-key=\"foreign_key_name\"\n" +"/>" +msgstr "" +"<one-to-one\n" +" name=\"propertyName\"\n" +" class=\"ClassName\"\n" +" cascade=\"cascade_style\"\n" +" constrained=\"true|false\"\n" +" fetch=\"join|select\"\n" +" property-ref=\"propertyNameFromAssociatedClass\"\n" +" access=\"field|property|ClassName\"\n" +" formula=\"any SQL expression\"\n" +" lazy=\"proxy|no-proxy|false\"\n" +" entity-name=\"EntityName\"\n" +" node=\"element-name|@attribute-name|element/@attribute|.\"\n" +" embed-xml=\"true|false\"\n" +" foreign-key=\"foreign_key_name\"\n" +"/>" + +#. Tag: para +#: basic_mapping.xml:3397 +#, fuzzy, no-c-format +msgid "" +"constrained (optional): specifies that a foreign key " +"constraint on the primary key of the mapped table and references the table " +"of the associated class. This option affects the order in which save" +"() and delete() are cascaded, and determines " +"whether the association can be proxied. It is also used by the schema export " +"tool." +msgstr "" +"constrained (optional) legt fest, dass eine " +"Fremdschlüsselbedingung auf dem Primärschlüssel der gemappten Tabelle auf " +"die Tabelle der assoziierten Klasse verweist. Diese Option hat Einfluss auf " +"die Reihenfolge in der save() und delete() aufeinander folgen und bestimmt, ob die Assoziation geproxied " +"werden kann (wird auch vom Schema-Export-Tool verwendet)." + +#. Tag: para +#: basic_mapping.xml:3413 +#, fuzzy, no-c-format +msgid "" +"property-ref (optional): the name of a property of the " +"associated class that is joined to the primary key of this class. If not " +"specified, the primary key of the associated class is used." +msgstr "" +"property-ref: (optional) Der Name einer Property der " +"assoziierten Klasse, die mit dem Primärschlüssel dieser Klasse verbunden " +"ist. Falls nicht anders festgelegt, so wird der Primärschlüssel der " +"assoziierten Klasse verwendet." + +#. Tag: para +#: basic_mapping.xml:3426 +#, fuzzy, no-c-format +msgid "" +"formula (optional): almost all one-to-one associations " +"map to the primary key of the owning entity. If this is not the case, you " +"can specify another column, columns or expression to join on using an SQL " +"formula. See org.hibernate.test.onetooneformula for an " +"example." +msgstr "" +"formula (optional): Fast alle \"One-to-One\" -" +"Assoziationen mappen zum Primärschlüssel der Entity, die sie besitzt. Im " +"seltenen Falle, dass dem nicht so ist, können Sie festlegen, dass sich eine " +"andere Spalte, Spalten oder Ausdruck unter Verwendung einer SQL-Formel " +"verbinden. (Siehe zum Beispiel org.hibernate.test.onetooneformula)." + +#. Tag: para +#: basic_mapping.xml:3435 +#, fuzzy, no-c-format +msgid "" +"lazy (optional - defaults to proxy): " +"by default, single point associations are proxied. lazy=\"no-proxy" +"\" specifies that the property should be fetched lazily when the " +"instance variable is first accessed. It requires build-time bytecode " +"instrumentation. lazy=\"false\" specifies that the " +"association will always be eagerly fetched. Note that if " +"constrained=\"false\", proxying is impossible and " +"Hibernate will eagerly fetch the association." +msgstr "" +"lazy (optional - die Standardeinstellung lautet " +"proxy): In der Standardeinstellung werden \"Single-Point" +"\"-Assoziationen geproxied. lazy=\"no-proxy\" legt fest, " +"dass für die Property \"lazy Fetching\" gilt (d.h. assoziierte Objekte " +"werden bei Bedarf nachgeladen), wenn erstmals auf die Instanzvariable " +"zugegriffen wird (erfordert Build-time Bytecode Instrumentierung). " +"lazy=\"false\" legt fest, dass für die Assoziation stets " +"\"eager Fetching\" gilt (d.h. zusammengefasstes Laden von Objekt und " +"assoziierten Objekten mit Verbundoperationen).Bitte beachten Sie, " +"dass bei constrained=\"false\" das Erstellen von Proxies " +"nicht möglich ist und Hibernate bei der Assoziation \"eager Fetching\" " +"anwendet!" + +#. Tag: para +#: basic_mapping.xml:3454 +#, fuzzy, no-c-format +msgid "" +"Primary key associations do not need an extra table column. If two rows are " +"related by the association, then the two table rows share the same primary " +"key value. To relate two objects by a primary key association, ensure that " +"they are assigned the same identifier value." +msgstr "" +"Assoziationen von Primärschlüsseln benötigen keine Extra-Tabellenspalte. " +"Wenn zwei Reihen durch die Assoziation verbunden sind, dann teilen die " +"beiden Tabellenspalten denselben Primärschlüsselwert. Falls Sie also " +"wünschen, dass zwei Objekte mittels Assoziation des Primärschlüssels " +"verbunden werden, müssen Sie sicherstellen, dass ihnen derselbe " +"Bezeichnerwert zugeschrieben wird!" + +#. Tag: para +#: basic_mapping.xml:3460 +#, fuzzy, no-c-format +msgid "" +"For a primary key association, add the following mappings to " +"Employee and Person respectively:" +msgstr "" +"Für eine Assoziation des Primärschlüssels fügen Sie die folgenden Mappings " +"zu Employee beziehungsweise Person " +"hinzu." + +#. Tag: programlisting +#: basic_mapping.xml:3464 +#, fuzzy, no-c-format +msgid "<one-to-one name=\"person\" class=\"Person\"/>" +msgstr "<one-to-one name=\"person\" class=\"Person\"/>" + +#. Tag: programlisting +#: basic_mapping.xml:3466 +#, fuzzy, no-c-format +msgid "" +"<one-to-one name=\"employee\" class=\"Employee\" constrained=\"true\"/>" +msgstr "" +"<one-to-one name=\"employee\" class=\"Employee\" constrained=\"true\"/>" + +#. Tag: para +#: basic_mapping.xml:3468 +#, fuzzy, no-c-format +msgid "" +"Ensure that the primary keys of the related rows in the PERSON and EMPLOYEE " +"tables are equal. You use a special Hibernate identifier generation strategy " +"called foreign:" +msgstr "" +"Nun muss sicher gestellt werden, dass die Primärschlüssel verbundener Reihen " +"in den PERSON- und EMPLOYEE-Tabellen gleich sind. Dabei kommt eine besondere " +"Strategie namens foreign für die Generierung des " +"Bezeichners durch Hibernate zum Einsatz:" + +#. Tag: programlisting +#: basic_mapping.xml:3472 +#, fuzzy, no-c-format +msgid "" +"<class name=\"person\" table=\"PERSON\">\n" +" <id name=\"id\" column=\"PERSON_ID\">\n" +" <generator class=\"foreign\">\n" +" <param name=\"property\">employee</param>\n" +" </generator>\n" +" </id>\n" +" ...\n" +" <one-to-one name=\"employee\"\n" +" class=\"Employee\"\n" +" constrained=\"true\"/>\n" +"</class>" +msgstr "" +"<class name=\"person\" table=\"PERSON\">\n" +" <id name=\"id\" column=\"PERSON_ID\">\n" +" <generator class=\"foreign\">\n" +" <param name=\"property\">employee</param>\n" +" </generator>\n" +" </id>\n" +" ...\n" +" <one-to-one name=\"employee\"\n" +" class=\"Employee\"\n" +" constrained=\"true\"/>\n" +"</class>" + +#. Tag: para +#: basic_mapping.xml:3474 +#, fuzzy, no-c-format +msgid "" +"A newly saved instance of Person is assigned the same " +"primary key value as the Employee instance referred with " +"the employee property of that Person." +msgstr "" +"Einer neu gespeicherten Instanz von Person wird dann " +"derselbe Wert des Primärschlüssels zugeschrieben wie der Employee-Instanz, die mit der employee-Property dieser " +"Person referenziert ist." + +#. Tag: title +#: basic_mapping.xml:3482 +#, fuzzy, no-c-format +msgid "Natural-id" +msgstr "natural-id" + +#. Tag: para +#: basic_mapping.xml:3484 +#, fuzzy, no-c-format +msgid "" +"Although we recommend the use of surrogate keys as primary keys, you should " +"try to identify natural keys for all entities. A natural key is a property " +"or combination of properties that is unique and non-null. It is also " +"immutable. Map the properties of the natural key as @NaturalId or map them inside the <natural-id> " +"element. Hibernate will generate the necessary unique key and nullability " +"constraints and, as a result, your mapping will be more self-documenting." +msgstr "" +"Obwohl wir die Verwendung von Surrogatschlüsseln als Primärschlüssel " +"empfehlen, sollten Sie nach wie vor versuchen natürliche Schlüssel für alle " +"Entities zu identifizieren. Ein natürlicher Schlüssel ist eine Property oder " +"Kombination von Properties die eindeutig und ungleich Null ist. Falls sie " +"außerdem unveränderbar ist, umso besser. Mappen Sie die Properties des " +"natürlichen Schlüssels innerhalb des <natural-id>-" +"Elements. Hibernate generiert den nötigen eindeutigen Schlüssel sowie " +"\"Nullability\"-Bedingungen, und Ihr Mapping wird selbst-dokumentierender." + +#. Tag: programlisting +#: basic_mapping.xml:3493 +#, no-c-format +msgid "" +"@Entity\n" +"public class Citizen {\n" +" @Id\n" +" @GeneratedValue\n" +" private Integer id;\n" +" private String firstname;\n" +" private String lastname;\n" +" \n" +" @NaturalId\n" +" @ManyToOne\n" +" private State state;\n" +"\n" +" @NaturalId\n" +" private String ssn;\n" +" ...\n" +"}\n" +"\n" +"\n" +"\n" +"//and later on query\n" +"List results = s.createCriteria( Citizen.class )\n" +" .add( Restrictions.naturalId().set( \"ssn\", \"1234\" ).set" +"( \"state\", ste ) )\n" +" .list();" +msgstr "" + +#. Tag: para +#: basic_mapping.xml:3495 +#, no-c-format +msgid "Or in XML," +msgstr "" + +#. Tag: programlisting +#: basic_mapping.xml:3497 +#, fuzzy, no-c-format +msgid "" +"<natural-id mutable=\"true|false\"/>\n" +" <property ... />\n" +" <many-to-one ... />\n" +" ......\n" +"</natural-id>" +msgstr "" +"<natural-id mutable=\"true|false\"/>\n" +" <property ... />\n" +" <many-to-one ... />\n" +" ......\n" +"</natural-id>" + +#. Tag: para +#: basic_mapping.xml:3499 +#, fuzzy, no-c-format +msgid "" +"It is recommended that you implement equals() and " +"hashCode() to compare the natural key properties of the " +"entity." +msgstr "" +"Wir empfehlen dringend die Implementierung von equals() " +"und hashCode(), um die Properties des natürlischen " +"Schlüssels der Entity zu vergleichen." + +#. Tag: para +#: basic_mapping.xml:3503 +#, fuzzy, no-c-format +msgid "" +"This mapping is not intended for use with entities that have natural primary " +"keys." +msgstr "" +"Dieses Mapping ist nicht für die Verwendung mit Entities mit natürlichen " +"Primärschlüsseln vorgesehen." + +#. Tag: para +#: basic_mapping.xml:3508 +#, fuzzy, no-c-format +msgid "" +"mutable (optional - defaults to false): by default, natural identifier properties are assumed to be " +"immutable (constant)." +msgstr "" +"mutable (optional, die Standardeinstellung lautet " +"false): In der Standardeinstellung wird davon " +"ausgegangen, dass die natürlichen Bezeichner-Properties unveränderbar " +"(konstant) sind." + +#. Tag: title +#: basic_mapping.xml:3516 +#, fuzzy, no-c-format +msgid "Any" +msgstr "any" + +#. Tag: para +#: basic_mapping.xml:3518 +#, fuzzy, no-c-format +msgid "" +"There is one more type of property mapping. The @Any " +"mapping defines a polymorphic association to classes from multiple tables. " +"This type of mapping requires more than one column. The first column " +"contains the type of the associated entity. The remaining columns contain " +"the identifier. It is impossible to specify a foreign key constraint for " +"this kind of association. This is not the usual way of mapping polymorphic " +"associations and you should use this only in special cases. For example, for " +"audit logs, user session data, etc." +msgstr "" +"Es gibt noch einen weiteren Typ von Property-Mapping. Das <" +"any> Mapping-Element definiert eine polymorphe Assoziation zu " +"Klassen mehrerer Tabellen. Diese Art von Mapping erfordert immer mehr als " +"eine Spalte. Die erste Spalte enthält den Typ der zugehörigen Entity. Die " +"übrigen Spalten enthalten den Bezeichner. Es ist unmöglich, eine Bedingung " +"für den Fremdschlüssel für diese Art von Assoziation festzulegen, daher ist " +"dies nicht als reguläre Art des Mappings (polymorpher) Assoziationen " +"gedacht. Sie sollten diesen Typ von Mapping nur in ganz besonderen Fällen " +"anwenden (z.B. für Überprüfungsprotokolle, Daten der Benutzersession usw.)." + +#. Tag: para +#: basic_mapping.xml:3528 +#, fuzzy, no-c-format +msgid "" +"The @Any annotation describes the column holding the " +"metadata information. To link the value of the metadata information and an " +"actual entity type, The @AnyDef and " +"@AnyDefs annotations are used. The metaType attribute allows the application to specify a custom type that maps " +"database column values to persistent classes that have identifier properties " +"of the type specified by idType. You must specify the " +"mapping from values of the metaType to class names." +msgstr "" +"Das meta-type-Attribut ermöglicht es der Anwendung einen " +"anwenderdefinierten Typ festzulegen, der die Werte der Datenbankspalte zu " +"persistenten Klassen mit durch id-type bestimmte " +"Bezeichner-Properties mappt. Das Mapping muss aus Werten des Meta-Typs zu " +"Klassennamen bestimmt werden." + +#. Tag: programlisting +#: basic_mapping.xml:3538 +#, no-c-format +msgid "" +"@Any( metaColumn = @Column( name = \"property_type\" ), fetch=FetchType." +"EAGER )\n" +"@AnyMetaDef( \n" +" idType = \"integer\", \n" +" metaType = \"string\", \n" +" metaValues = {\n" +" @MetaValue( value = \"S\", targetEntity = StringProperty.class ),\n" +" @MetaValue( value = \"I\", targetEntity = IntegerProperty.class )\n" +" } )\n" +"@JoinColumn( name = \"property_id\" )\n" +"public Property getMainProperty() {\n" +" return mainProperty;\n" +"}" +msgstr "" + +#. Tag: para +#: basic_mapping.xml:3540 +#, no-c-format +msgid "" +"Note that @AnyDef can be mutualized and reused. It is " +"recommended to place it as a package metadata in this case." +msgstr "" + +#. Tag: programlisting +#: basic_mapping.xml:3544 +#, no-c-format +msgid "" +"//on a package\n" +"@AnyMetaDef( name=\"property\" \n" +" idType = \"integer\", \n" +" metaType = \"string\", \n" +" metaValues = {\n" +" @MetaValue( value = \"S\", targetEntity = StringProperty.class ),\n" +" @MetaValue( value = \"I\", targetEntity = IntegerProperty.class )\n" +" } )\n" +"package org.hibernate.test.annotations.any;\n" +"\n" +"\n" +"//in a class\n" +" @Any( metaDef=\"property\", metaColumn = @Column( name = \"property_type" +"\" ), fetch=FetchType.EAGER )\n" +" @JoinColumn( name = \"property_id\" )\n" +" public Property getMainProperty() {\n" +" return mainProperty;\n" +" }" +msgstr "" + +#. Tag: para +#: basic_mapping.xml:3546 +#, no-c-format +msgid "The hbm.xml equivalent is:" +msgstr "" + +#. Tag: programlisting +#: basic_mapping.xml:3548 +#, fuzzy, no-c-format +msgid "" +"<any name=\"being\" id-type=\"long\" meta-type=\"string\">\n" +" <meta-value value=\"TBL_ANIMAL\" class=\"Animal\"/>\n" +" <meta-value value=\"TBL_HUMAN\" class=\"Human\"/>\n" +" <meta-value value=\"TBL_ALIEN\" class=\"Alien\"/>\n" +" <column name=\"table_name\"/>\n" +" <column name=\"id\"/>\n" +"</any>" +msgstr "" +"<any name=\"being\" id-type=\"long\" meta-type=\"string\">\n" +" <meta-value value=\"TBL_ANIMAL\" class=\"Animal\"/>\n" +" <meta-value value=\"TBL_HUMAN\" class=\"Human\"/>\n" +" <meta-value value=\"TBL_ALIEN\" class=\"Alien\"/>\n" +" <column name=\"table_name\"/>\n" +" <column name=\"id\"/>\n" +"</any>" + +#. Tag: para +#: basic_mapping.xml:3551 +#, no-c-format +msgid "You cannot mutualize the metadata in hbm.xml as you can in annotations." +msgstr "" + +#. Tag: programlisting +#: basic_mapping.xml:3570 +#, fuzzy, no-c-format +msgid "" +"<any\n" +" name=\"propertyName\"\n" +" id-type=\"idtypename\"\n" +" meta-type=\"metatypename\"\n" +" cascade=\"cascade_style\"\n" +" access=\"field|property|ClassName\"\n" +" optimistic-lock=\"true|false\"\n" +">\n" +" <meta-value ... />\n" +" <meta-value ... />\n" +" .....\n" +" <column .... />\n" +" <column .... />\n" +" .....\n" +"</any>" +msgstr "" +"<any\n" +" name=\"propertyName\"\n" +" id-type=\"idtypename\"\n" +" meta-type=\"metatypename\"\n" +" cascade=\"cascade_style\"\n" +" access=\"field|property|ClassName\"\n" +" optimistic-lock=\"true|false\"\n" +">\n" +" <meta-value ... />\n" +" <meta-value ... />\n" +" .....\n" +" <column .... />\n" +" <column .... />\n" +" .....\n" +"</any>" + +#. Tag: para +#: basic_mapping.xml:3574 +#, no-c-format +msgid "name: the property name." +msgstr "name: Der Property-Name." + +#. Tag: para +#: basic_mapping.xml:3578 +#, no-c-format +msgid "id-type: the identifier type." +msgstr "id-type: Der Bezeichnertyp." + +#. Tag: para +#: basic_mapping.xml:3582 +#, fuzzy, no-c-format +msgid "" +"meta-type (optional - defaults to string): any type that is allowed for a discriminator mapping." +msgstr "" +"meta-type (optional - die Standardeinstellung lautet " +"string): Jeder Typ, der für ein Diskriminator-Mapping " +"gestattet ist." + +#. Tag: para +#: basic_mapping.xml:3588 +#, no-c-format +msgid "" +"cascade (optional- defaults to none): " +"the cascade style." +msgstr "" +"cascade (optional- die Standardeinstellung lautet " +"none): der \"Cascade-Style\" (Weitergabestil)." + +#. Tag: para +#: basic_mapping.xml:3599 +#, fuzzy, no-c-format +msgid "" +"optimistic-lock (optional - defaults to true): specifies that updates to this property either do or do not " +"require acquisition of the optimistic lock. It defines whether a version " +"increment should occur if this property is dirty." +msgstr "" +"optimistic-lock (optional - die Standardeinstellung " +"lautet true): Legt fest, ob Aktualisierungen dieser " +"Property die Erfassung einer optimistischen Sperre benötigen oder nicht. Mit " +"anderen Worten, es wird bestimmt ob eine Erhöhung der Version stattfinden " +"soll, wenn die Inhalte dieser Property sich verändert haben." + +#. Tag: title +#: basic_mapping.xml:3610 +#, no-c-format +msgid "Properties" +msgstr "Properties" + +#. Tag: para +#: basic_mapping.xml:3612 +#, fuzzy, no-c-format +msgid "" +"The <properties> element allows the definition of a " +"named, logical grouping of the properties of a class. The most important use " +"of the construct is that it allows a combination of properties to be the " +"target of a property-ref. It is also a convenient way to " +"define a multi-column unique constraint. For example:" +msgstr "" +"Das <properties>-Element erlaubt die Definition " +"einer benannten, logischen Gruppierung der Properties einer Klasse. Der " +"wichtigste Aspekt des Konstrukts ist, dass es die Verwendung einer Gruppe " +"von Properties als Ziel einer property-ref ermöglicht. Es " +"bietet außerdem eine gute Möglichkeit, eine eindeutige Mehrspalten-Bedingung " +"zu definieren." + +#. Tag: programlisting +#: basic_mapping.xml:3632 +#, fuzzy, no-c-format +msgid "" +"<properties\n" +" name=\"logicalName\"\n" +" insert=\"true|false\"\n" +" update=\"true|false\"\n" +" optimistic-lock=\"true|false\"\n" +" unique=\"true|false\"\n" +">\n" +"\n" +" <property ...../>\n" +" <many-to-one .... />\n" +" ........\n" +"</properties>" +msgstr "" +"<properties \n" +" name=\"logicalName\" \n" +" insert=\"true|false\"\n" +" update=\"true|false\"\n" +" optimistic-lock=\"true|false\"\n" +" unique=\"true|false\"\n" +">\n" +" \n" +" <property ...../>\n" +" <many-to-one .... />\n" +" ........\n" +"</properties>" + +#. Tag: para +#: basic_mapping.xml:3636 +#, fuzzy, no-c-format +msgid "" +"name: the logical name of the grouping. It is " +"not an actual property name." +msgstr "" +"name: Der logische Name der Gruppierung - kein tatsächlicher Property-Name." + +#. Tag: para +#: basic_mapping.xml:3651 +#, fuzzy, no-c-format +msgid "" +"optimistic-lock (optional - defaults to true): specifies that updates to these properties either do or do not " +"require acquisition of the optimistic lock. It determines if a version " +"increment should occur when these properties are dirty." +msgstr "" +"optimistic-lock (optional - die Standardeinstellung " +"lautet true): Legt fest, ob Aktualisierungen dieser " +"Properties die Erfassung einer optimistischen Sperre benötigen oder nicht. " +"Mit anderen Worten, es wird bestimmt, ob eine Erhöhung der Version " +"stattfinden soll, wenn die Inhalte dieser Properties sich verändert haben " +"(man sagt sie seien dann \"dirty\")." + +#. Tag: para +#: basic_mapping.xml:3666 +#, no-c-format +msgid "" +"For example, if we have the following <properties> " +"mapping:" +msgstr "" +"Nehmen wir etwa das folgende <properties>-Mapping:" + +#. Tag: programlisting +#: basic_mapping.xml:3669 +#, fuzzy, no-c-format +msgid "" +"<class name=\"Person\">\n" +" <id name=\"personNumber\"/>\n" +"\n" +" ...\n" +" <properties name=\"name\"\n" +" unique=\"true\" update=\"false\">\n" +" <property name=\"firstName\"/>\n" +" <property name=\"initial\"/>\n" +" <property name=\"lastName\"/>\n" +" </properties>\n" +"</class>" +msgstr "" +"<class name=\"Person\">\n" +" <id name=\"personNumber\"/>\n" +" ...\n" +" <properties name=\"name\" \n" +" unique=\"true\" update=\"false\">\n" +" <property name=\"firstName\"/>\n" +" <property name=\"initial\"/>\n" +" <property name=\"lastName\"/>\n" +" </properties>\n" +"</class>" + +#. Tag: para +#: basic_mapping.xml:3671 +#, fuzzy, no-c-format +msgid "" +"You might have some legacy data association that refers to this unique key " +"of the Person table, instead of to the primary key:" +msgstr "" +"Und wir könnten eine Stammdatenassoziation haben, die auf diesen eindeutigen " +"Schlüssel der Person-Tabelle verweist, statt auf den " +"Primärschlüssel:" + +#. Tag: programlisting +#: basic_mapping.xml:3675 +#, fuzzy, no-c-format +msgid "" +"<many-to-one name=\"owner\"\n" +" class=\"Person\" property-ref=\"name\">\n" +" <column name=\"firstName\"/>\n" +" <column name=\"initial\"/>\n" +" <column name=\"lastName\"/>\n" +"</many-to-one>" +msgstr "" +"<many-to-one name=\"person\" \n" +" class=\"Person\" property-ref=\"name\">\n" +" <column name=\"firstName\"/>\n" +" <column name=\"initial\"/>\n" +" <column name=\"lastName\"/>\n" +"</many-to-one>" + +#. Tag: para +#: basic_mapping.xml:3678 +#, no-c-format +msgid "" +"When using annotations as a mapping strategy, such construct is not " +"necessary as the binding between a column and its related column on the " +"associated table is done directly" +msgstr "" + +#. Tag: para +#: basic_mapping.xml:3685 +#, fuzzy, no-c-format +msgid "" +"The use of this outside the context of mapping legacy data is not " +"recommended." +msgstr "" +"Außerhalb vom Kontext des Mappens von Stammdaten wird diese Vorgehensweise " +"jedoch nicht empfohlen." + +#. Tag: title +#: basic_mapping.xml:3690 +#, no-c-format +msgid "Some hbm.xml specificities" +msgstr "" + +#. Tag: para +#: basic_mapping.xml:3692 +#, no-c-format +msgid "" +"The hbm.xml structure has some specificities naturally not present when " +"using annotations, let's describe them briefly." +msgstr "" + +#. Tag: title +#: basic_mapping.xml:3696 +#, no-c-format +msgid "Doctype" +msgstr "Doctype" + +#. Tag: para +#: basic_mapping.xml:3698 +#, fuzzy, no-c-format +msgid "" +"All XML mappings should declare the doctype shown. The actual DTD can be " +"found at the URL above, in the directory hibernate-x.x.x/src/org/" +"hibernate , or in hibernate3.jar. Hibernate " +"will always look for the DTD in its classpath first. If you experience " +"lookups of the DTD using an Internet connection, check the DTD declaration " +"against the contents of your classpath." +msgstr "" +"Alle XML-Mappings sollten den gezeigten doctype deklarieren. Die " +"tatsächliche Dokumenttyp-Definition (\"DTD\") kann in der URL oben, im " +"Verzeichnis hibernate-x.x.x/src/org/hibernate oder in " +"hibernate3.jar gefunden werden. Hibernate wird stets " +"zuerst in seinem Klassenpfad nach der DTD suchen. Falls es bei Ihnen zu " +"Suchläufen der DTD mittels einer Internetverbindung kommt, überprüfen Sie " +"Ihre DTD-Deklaration hinsichtlich der Inhalte Ihres Klassenpfads." + +#. Tag: title +#: basic_mapping.xml:3707 +#, no-c-format +msgid "EntityResolver" +msgstr "EntityResolver" + +#. Tag: para +#: basic_mapping.xml:3709 +#, fuzzy, no-c-format +msgid "" +"Hibernate will first attempt to resolve DTDs in its classpath. It does this " +"is by registering a custom org.xml.sax.EntityResolver " +"implementation with the SAXReader it uses to read in the xml files. This " +"custom EntityResolver recognizes two different systemId " +"namespaces:" +msgstr "" +"Wie bereits erwähnt, wird Hibernate zuerst versuchen, DTDs in seinem " +"Klassenpfad aufzulösen. Dies geschieht, indem eine anwenderdefinierte " +"org.xml.sax.EntityResolver-Implementierung mit dem " +"SAXReader, der zum Lesen der xml-Dateien verwendet wird, registriert wird. " +"Dieser anwenderorientierte EntityResolver erkennt zwei " +"verschiedene \"systemId\"-Namensräume." + +#. Tag: para +#: basic_mapping.xml:3718 +#, fuzzy, no-c-format +msgid "" +"a hibernate namespace is recognized whenever the resolver " +"encounters a systemId starting with http://hibernate.sourceforge." +"net/. The resolver attempts to resolve these entities via the " +"classloader which loaded the Hibernate classes." +msgstr "" +"ein hibernate namespace wird erkannt, sobald der " +"\"Resolver\" (Auflöser) einer mit http://hibernate.sourceforge.net/" +" beginnenden systemId begegnet. Der Resolver versucht diese " +"Entities über den Klassenlader (sog. \"Classloader\"), der die Hibernate-" +"Klassen geladen hat, aufzulösen." + +#. Tag: para +#: basic_mapping.xml:3726 +#, fuzzy, no-c-format +msgid "" +"a user namespace is recognized whenever the resolver " +"encounters a systemId using a classpath:// URL protocol. " +"The resolver will attempt to resolve these entities via (1) the current " +"thread context classloader and (2) the classloader which loaded the " +"Hibernate classes." +msgstr "" +"ein user namespace wird erkannt, sobald der Resolver " +"einem classpath:// URL-Protokoll verwendenden systemId " +"begegnet. Der Resolver wird versuchen, diese Entities über (1) den aktuellen " +"Thread-Kontext-Klassenlader und (2) den Klassenlader, der die Hibernate-" +"Klassen geladen hat, aufzulösen." + +#. Tag: para +#: basic_mapping.xml:3735 +#, fuzzy, no-c-format +msgid "The following is an example of utilizing user namespacing:" +msgstr "Ein Beispiel der Verwendung des Benutzer-Namespacing:" + +#. Tag: programlisting +#: basic_mapping.xml:3738 +#, no-c-format +msgid "" +"" +msgstr "" + +#. Tag: para +#: basic_mapping.xml:3740 +#, fuzzy, no-c-format +msgid "" +"Where types.xml is a resource in the your." +"domain package and contains a custom typedef." +msgstr "" +"Wo types.xml eine Ressource in im your.domain Paket ist und eine anwenderdefinierte -Typedef enthält." + +#. Tag: title +#: basic_mapping.xml:3747 +#, fuzzy, no-c-format +msgid "Hibernate-mapping" +msgstr "hibernate-mapping" + +#. Tag: para +#: basic_mapping.xml:3749 +#, fuzzy, no-c-format +msgid "" +"This element has several optional attributes. The schema " +"and catalog attributes specify that tables referred to in " +"this mapping belong to the named schema and/or catalog. If they are " +"specified, tablenames will be qualified by the given schema and catalog " +"names. If they are missing, tablenames will be unqualified. The " +"default-cascade attribute specifies what cascade style " +"should be assumed for properties and collections that do not specify a " +"cascade attribute. By default, the auto-import attribute allows you to use unqualified class names in the query " +"language." +msgstr "" +"Dieses Element besitzt mehrere optionale Attribute. Die schema und catalog-Attribute spezifizieren, dass die in " +"diesem Mapping aufgeführten Tabellen zum genannten Schema und/oder Katalog " +"gehören. Falls bestimmt, werden Tabellennamen durch die gegebenen Schema- " +"und Katalognamen definiert. Falls nicht vorhanden, so bleiben die " +"Tabellennamen undefiniert. Das default-cascade-Attribut " +"bestimmt, welcher Weitergabestil (sog. \"Cascade-Style\" für Properties und " +"Collections angenommen werden sollte, die kein cascade-" +"Attribut spezifizieren. Das auto-import-Attribut erlaubt " +"die Verwendung undefinierter Klassennamen in der Abfragensprache in der " +"Standardeinstellung." + +#. Tag: programlisting +#: basic_mapping.xml:3778 +#, fuzzy, no-c-format +msgid "" +"<hibernate-mapping\n" +" schema=\"schemaName\"\n" +" catalog=\"catalogName\"\n" +" default-cascade=\"cascade_style\"\n" +" default-access=\"field|property|ClassName\"\n" +" default-lazy=\"true|false\"\n" +" auto-import=\"true|false\"\n" +" package=\"package.name\"\n" +" />" +msgstr "" +"<hibernate-mapping\n" +" schema=\"schemaName\"\n" +" catalog=\"catalogName\"\n" +" default-cascade=\"cascade_style\"\n" +" default-access=\"field|property|ClassName\"\n" +" default-lazy=\"true|false\"\n" +" auto-import=\"true|false\"\n" +" package=\"package.name\"\n" +" />" + +#. Tag: para +#: basic_mapping.xml:3782 +#, fuzzy, no-c-format +msgid "schema (optional): the name of a database schema." +msgstr "schema (optional): Der Name eines Datenbankschemas." + +#. Tag: para +#: basic_mapping.xml:3787 +#, fuzzy, no-c-format +msgid "catalog (optional): the name of a database catalog." +msgstr "" +"catalog (optional): Der Name eines Datenbankkatalogs." + +#. Tag: para +#: basic_mapping.xml:3792 +#, fuzzy, no-c-format +msgid "" +"default-cascade (optional - defaults to none): a default cascade style." +msgstr "" +"default-cascade (optional - die Standardeinstellung " +"lautet none): Ein standardmäßiger Weitergabestil " +"(\"Cascade-Style\")." + +#. Tag: para +#: basic_mapping.xml:3797 +#, fuzzy, no-c-format +msgid "" +"default-access (optional - defaults to property): the strategy Hibernate should use for accessing all properties. " +"It can be a custom implementation of PropertyAccessor." +msgstr "" +"default-access (optional - der Standard ist " +"property): Die Strategie, die Hibernate für den Zugriff " +"auf alle Properties benutzen sollte. Kann eine anwenderdefinierte " +"Implementierung von PropertyAccessor sein." + +#. Tag: para +#: basic_mapping.xml:3804 +#, fuzzy, no-c-format +msgid "" +"default-lazy (optional - defaults to true): the default value for unspecified lazy " +"attributes of class and collection mappings." +msgstr "" +"default-lazy (optional - die Standardeinstellung lautet " +"true): Der Standardwert für nicht spezifizierte " +"lazy Attribute von Klassen- und Collection-Mappings." + +#. Tag: para +#: basic_mapping.xml:3811 +#, fuzzy, no-c-format +msgid "" +"auto-import (optional - defaults to true): specifies whether we can use unqualified class names of classes " +"in this mapping in the query language." +msgstr "" +"auto-import (optional - die Standardeinstellung lautet " +"true): Legt fest, ob in der Abfragensprache ein " +"undefinierter Klassenname verwendet werden kann (von Klassen in diesem " +"Mapping)." + +#. Tag: para +#: basic_mapping.xml:3818 +#, fuzzy, no-c-format +msgid "" +"package (optional): specifies a package prefix to use for " +"unqualified class names in the mapping document." +msgstr "" +"package (optional): Spezifiziert einen Paket-Präfix, der " +"für undefinierte Klassennamen im Mapping-Dokument angenommen werden soll." + +#. Tag: para +#: basic_mapping.xml:3825 +#, fuzzy, no-c-format +msgid "" +"If you have two persistent classes with the same unqualified name, you " +"should set auto-import=\"false\". An exception will " +"result if you attempt to assign two classes to the same \"imported\" name." +msgstr "" +"Falls Sie zwei persistente Klassen mit demselben (undefinierten) Namen " +"besitzen, sollten Sie die Einstellung auto-import=\"false\" vornehmen. Hibernate wird eine Ausnahme melden, wenn Sie versuchen, " +"zwei Klassen demselben \"importierten\" Namen zuzuordnen." + +#. Tag: para +#: basic_mapping.xml:3830 +#, fuzzy, no-c-format +msgid "" +"The hibernate-mapping element allows you to nest several " +"persistent <class> mappings, as shown above. It is, " +"however, good practice (and expected by some tools) to map only a single " +"persistent class, or a single class hierarchy, in one mapping file and name " +"it after the persistent superclass. For example, Cat.hbm.xml, Dog.hbm.xml, or if using inheritance, " +"Animal.hbm.xml." +msgstr "" +"Bitte beachten Sie, dass das hibernate-mapping-Element es " +"Ihnen ermöglicht, mehrere persistente <class>-" +"Mappings (wie oben dargestellt) zu verschachteln. Es ist jedoch eine gute " +"Angewohnheit (und wird von einigen Tools vorausgesetzt) nur eine einzelne " +"persistente Klasse (oder eine Einzelklassenhierarchie) in einer Mapping-" +"Datei zu mappen und diese nach der persistenten Superklasse zu benennen, z." +"B. Cat.hbm.xml, Dog.hbm.xml oder - " +"falls Sie \"Inheritance\" (d.h. Vererbung) verwenden - Animal.hbm." +"xml." + +#. Tag: title +#: basic_mapping.xml:3841 +#, fuzzy, no-c-format +msgid "Key" +msgstr "key" + +#. Tag: para +#: basic_mapping.xml:3843 +#, fuzzy, no-c-format +msgid "" +"The <key> element is featured a few times within " "this guide. It appears anywhere the parent mapping element defines a join to " "a new table that references the primary key of the original table. It also " "defines the foreign key in the joined table:" @@ -3467,7 +8401,30 @@ msgstr "" "Fremdschlüssel in der verknüpften Tabelle, der auf den Primärschlüssel der " "Originaltabelle verweist." +#. Tag: programlisting +#: basic_mapping.xml:3864 +#, fuzzy, no-c-format +msgid "" +"<key\n" +" column=\"columnname\"\n" +" on-delete=\"noaction|cascade\"\n" +" property-ref=\"propertyName\"\n" +" not-null=\"true|false\"\n" +" update=\"true|false\"\n" +" unique=\"true|false\"\n" +"/>" +msgstr "" +"<key\n" +" column=\"columnname\"\n" +" on-delete=\"noaction|cascade\"\n" +" property-ref=\"propertyName\"\n" +" not-null=\"true|false\"\n" +" update=\"true|false\"\n" +" unique=\"true|false\"\n" +"/>" + #. Tag: para +#: basic_mapping.xml:3874 #, fuzzy, no-c-format msgid "" "on-delete (optional - defaults to noactionproperty-ref (optional): specifies that the foreign key " @@ -3490,6 +8448,7 @@ msgstr "" "Originaltabelle sind (für existierende Daten, sog. \"Legacy Data\")." #. Tag: para +#: basic_mapping.xml:3886 #, fuzzy, no-c-format msgid "" "not-null (optional): specifies that the foreign key " @@ -3501,6 +8460,7 @@ msgstr "" "vorausgesetzt, wenn der Fremdschlüssel auch Teil des Primärschlüssels ist)." #. Tag: para +#: basic_mapping.xml:3892 #, fuzzy, no-c-format msgid "" "update (optional): specifies that the foreign key should " @@ -3512,6 +8472,7 @@ msgstr "" "Fremdschlüssel auch Teil des Primärschlüssels ist)." #. Tag: para +#: basic_mapping.xml:3898 #, fuzzy, no-c-format msgid "" "unique (optional): specifies that the foreign key should " @@ -3523,6 +8484,7 @@ msgstr "" "der Fremdschlüssel auch der Primärschlüssel ist)." #. Tag: para +#: basic_mapping.xml:3905 #, fuzzy, no-c-format msgid "" "For systems where delete performance is important, we recommend that all " @@ -3540,6 +8502,7 @@ msgstr "" "Strategie für optimistisches Sperren für versionierte Daten umgeht." #. Tag: para +#: basic_mapping.xml:3913 #, fuzzy, no-c-format msgid "" "The not-null and update attributes are " @@ -3556,52 +8519,13 @@ msgstr "" "\"> deklarieren." #. Tag: title -#, fuzzy, no-c-format -msgid "Column and formula elements" -msgstr "Spalten- und Formel-Elemente" - -#. Tag: para -#, fuzzy, no-c-format -msgid "" -"Mapping elements which accept a column attribute will " -"alternatively accept a <column> subelement. " -"Likewise, <formula> is an alternative to the " -"formula attribute. For example:" -msgstr "" -"Jedes Mapping-Element das ein column-Attribut akzeptiert, " -"akzeptiert alternativ auch ein <column>-Subelement. " -"Ebenso ist <formula> eine Alternative zum " -"formula-Attribut." - -#. Tag: para -#, no-c-format -msgid "" -"Most of the attributes on column provide a means of " -"tailoring the DDL during automatic schema generation. The read and write attributes allow you to specify custom " -"SQL that Hibernate will use to access the column's value. For more on this, " -"see the discussion of column " -"read and write expressions." -msgstr "" - -#. Tag: para -#, fuzzy, no-c-format -msgid "" -"The column and formula elements can " -"even be combined within the same property or association mapping to express, " -"for example, exotic join conditions." -msgstr "" -"Die column und formula-Attribute " -"können sogar innerhalb desselben auszudrückenden Property- oder " -"Assoziationsmappings kombiniert werden, zum Beispiel ausgefallene " -"Verbundbedingungen." - -#. Tag: title +#: basic_mapping.xml:3922 #, fuzzy, no-c-format msgid "Import" msgstr "import" #. Tag: para +#: basic_mapping.xml:3924 #, fuzzy, no-c-format msgid "" "If your application has two persistent classes with the same name, and you " @@ -3616,7 +8540,28 @@ msgstr "" "auf auto-import=\"true\" angewiesen zu sein. Sie können " "sogar Klassen und Interfaces importieren, die nicht explizit gemappt sind." +#. Tag: programlisting +#: basic_mapping.xml:3930 +#, fuzzy, no-c-format +msgid "<import class=\"java.lang.Object\" rename=\"Universe\"/>" +msgstr "<import class=\"java.lang.Object\" rename=\"Universe\"/>" + +#. Tag: programlisting +#: basic_mapping.xml:3939 +#, fuzzy, no-c-format +msgid "" +"<import\n" +" class=\"ClassName\"\n" +" rename=\"ShortName\"\n" +"/>" +msgstr "" +"<import\n" +" class=\"ClassName\"\n" +" rename=\"ShortName\"\n" +"/>" + #. Tag: para +#: basic_mapping.xml:3943 #, fuzzy, no-c-format msgid "" "class: the fully qualified class name of any Java class." @@ -3624,6 +8569,7 @@ msgstr "" "class: Der vollständige Klassenname einer Java-Klasse." #. Tag: para +#: basic_mapping.xml:3948 #, fuzzy, no-c-format msgid "" "rename (optional - defaults to the unqualified class " @@ -3633,102 +8579,125 @@ msgstr "" "definierte Klassenname): Ein Name, der in der Anfragensprache verwendet " "werden kann." -#. Tag: title +#. Tag: para +#: basic_mapping.xml:3956 #, no-c-format -msgid "Any" +msgid "This feature is unique to hbm.xml and is not supported in annotations." msgstr "" -#. Tag: para -#, fuzzy, no-c-format -msgid "" -"There is one more type of property mapping. The <any> mapping element defines a polymorphic association to classes from " -"multiple tables. This type of mapping requires more than one column. The " -"first column contains the type of the associated entity. The remaining " -"columns contain the identifier. It is impossible to specify a foreign key " -"constraint for this kind of association. This is not the usual way of " -"mapping polymorphic associations and you should use this only in special " -"cases. For example, for audit logs, user session data, etc." -msgstr "" -"Es gibt noch einen weiteren Typ von Property-Mapping. Das <" -"any> Mapping-Element definiert eine polymorphe Assoziation zu " -"Klassen mehrerer Tabellen. Diese Art von Mapping erfordert immer mehr als " -"eine Spalte. Die erste Spalte enthält den Typ der zugehörigen Entity. Die " -"übrigen Spalten enthalten den Bezeichner. Es ist unmöglich, eine Bedingung " -"für den Fremdschlüssel für diese Art von Assoziation festzulegen, daher ist " -"dies nicht als reguläre Art des Mappings (polymorpher) Assoziationen " -"gedacht. Sie sollten diesen Typ von Mapping nur in ganz besonderen Fällen " -"anwenden (z.B. für Überprüfungsprotokolle, Daten der Benutzersession usw.)." - -#. Tag: para -#, fuzzy, no-c-format -msgid "" -"The meta-type attribute allows the application to specify " -"a custom type that maps database column values to persistent classes that " -"have identifier properties of the type specified by id-type. You must specify the mapping from values of the meta-type to class " -"names." -msgstr "" -"Das meta-type-Attribut ermöglicht es der Anwendung einen " -"anwenderdefinierten Typ festzulegen, der die Werte der Datenbankspalte zu " -"persistenten Klassen mit durch id-type bestimmte " -"Bezeichner-Properties mappt. Das Mapping muss aus Werten des Meta-Typs zu " -"Klassennamen bestimmt werden." - -#. Tag: para -#, no-c-format -msgid "name: the property name." -msgstr "name: Der Property-Name." - -#. Tag: para -#, no-c-format -msgid "id-type: the identifier type." -msgstr "id-type: Der Bezeichnertyp." - -#. Tag: para -#, fuzzy, no-c-format -msgid "" -"meta-type (optional - defaults to string): any type that is allowed for a discriminator mapping." -msgstr "" -"meta-type (optional - die Standardeinstellung lautet " -"string): Jeder Typ, der für ein Diskriminator-Mapping " -"gestattet ist." - -#. Tag: para -#, no-c-format -msgid "" -"cascade (optional- defaults to none): " -"the cascade style." -msgstr "" -"cascade (optional- die Standardeinstellung lautet " -"none): der \"Cascade-Style\" (Weitergabestil)." - -#. Tag: para -#, fuzzy, no-c-format -msgid "" -"optimistic-lock (optional - defaults to true): specifies that updates to this property either do or do not " -"require acquisition of the optimistic lock. It defines whether a version " -"increment should occur if this property is dirty." -msgstr "" -"optimistic-lock (optional - die Standardeinstellung " -"lautet true): Legt fest, ob Aktualisierungen dieser " -"Property die Erfassung einer optimistischen Sperre benötigen oder nicht. Mit " -"anderen Worten, es wird bestimmt ob eine Erhöhung der Version stattfinden " -"soll, wenn die Inhalte dieser Property sich verändert haben." - #. Tag: title +#: basic_mapping.xml:3962 +#, fuzzy, no-c-format +msgid "Column and formula elements" +msgstr "Spalten- und Formel-Elemente" + +#. Tag: para +#: basic_mapping.xml:3964 +#, fuzzy, no-c-format +msgid "" +"Mapping elements which accept a column attribute will " +"alternatively accept a <column> subelement. " +"Likewise, <formula> is an alternative to the " +"formula attribute. For example:" +msgstr "" +"Jedes Mapping-Element das ein column-Attribut akzeptiert, " +"akzeptiert alternativ auch ein <column>-Subelement. " +"Ebenso ist <formula> eine Alternative zum " +"formula-Attribut." + +#. Tag: programlisting +#: basic_mapping.xml:3970 +#, fuzzy, no-c-format +msgid "" +"<column\n" +" name=\"column_name\"\n" +" length=\"N\"\n" +" precision=\"N\"\n" +" scale=\"N\"\n" +" not-null=\"true|false\"\n" +" unique=\"true|false\"\n" +" unique-key=\"multicolumn_unique_key_name\"\n" +" index=\"index_name\"\n" +" sql-type=\"sql_type_name\"\n" +" check=\"SQL expression\"\n" +" default=\"SQL expression\"\n" +" read=\"SQL expression\"\n" +" write=\"SQL expression\"/>" +msgstr "" +"<column\n" +" name=\"column_name\"\n" +" length=\"N\"\n" +" precision=\"N\"\n" +" scale=\"N\"\n" +" not-null=\"true|false\"\n" +" unique=\"true|false\"\n" +" unique-key=\"multicolumn_unique_key_name\"\n" +" index=\"index_name\"\n" +" sql-type=\"sql_type_name\"\n" +" check=\"SQL expression\"\n" +" default=\"SQL expression\"/>" + +#. Tag: programlisting +#: basic_mapping.xml:3972 +#, fuzzy, no-c-format +msgid "<formula>SQL expression</formula>" +msgstr "<formula>SQL expression</formula>" + +#. Tag: para +#: basic_mapping.xml:3974 +#, no-c-format +msgid "" +"Most of the attributes on column provide a means of " +"tailoring the DDL during automatic schema generation. The read and write attributes allow you to specify custom " +"SQL that Hibernate will use to access the column's value. For more on this, " +"see the discussion of column " +"read and write expressions." +msgstr "" + +#. Tag: para +#: basic_mapping.xml:3982 +#, fuzzy, no-c-format +msgid "" +"The column and formula elements can " +"even be combined within the same property or association mapping to express, " +"for example, exotic join conditions." +msgstr "" +"Die column und formula-Attribute " +"können sogar innerhalb desselben auszudrückenden Property- oder " +"Assoziationsmappings kombiniert werden, zum Beispiel ausgefallene " +"Verbundbedingungen." + +#. Tag: programlisting +#: basic_mapping.xml:3986 +#, fuzzy, no-c-format +msgid "" +"<many-to-one name=\"homeAddress\" class=\"Address\"\n" +" insert=\"false\" update=\"false\">\n" +" <column name=\"person_id\" not-null=\"true\" length=\"10\"/>\n" +" <formula>'MAILING'</formula>\n" +"</many-to-one>" +msgstr "" +"<many-to-one name=\"homeAddress\" class=\"Address\"\n" +" insert=\"false\" update=\"false\">\n" +" <column name=\"person_id\" not-null=\"true\" length=\"10\"/>\n" +" <formula>'MAILING'</formula>\n" +"</many-to-one>" + +#. Tag: title +#: basic_mapping.xml:3992 #, fuzzy, no-c-format msgid "Hibernate types" msgstr "Hibernate-Typen" #. Tag: title +#: basic_mapping.xml:3995 #, no-c-format msgid "Entities and values" msgstr "Entities und Werte" #. Tag: para +#: basic_mapping.xml:3997 #, no-c-format msgid "" "In relation to the persistence service, Java language-level objects are " @@ -3736,6 +8705,7 @@ msgid "" msgstr "" #. Tag: para +#: basic_mapping.xml:4000 #, fuzzy, no-c-format msgid "" "An entity exists independently of any other objects " @@ -3760,6 +8730,7 @@ msgstr "" "zirkulare und geteilte Verweise. Sie können auch versioniert werden." #. Tag: para +#: basic_mapping.xml:4010 #, fuzzy, no-c-format msgid "" "An entity's persistent state consists of references to other entities and " @@ -3784,6 +8755,7 @@ msgstr "" "Entities oder Collections geteilt werden." #. Tag: para +#: basic_mapping.xml:4020 #, fuzzy, no-c-format msgid "" "Until now, we have been using the term \"persistent class\" to refer to " @@ -3813,6 +8785,7 @@ msgstr "" "Komposition oder Aggregation in der Regel für einen Wertetyp geeignet sind. " #. Tag: para +#: basic_mapping.xml:4033 #, fuzzy, no-c-format msgid "We will revisit both concepts throughout this reference guide." msgstr "" @@ -3820,6 +8793,7 @@ msgstr "" "aufgegriffen." #. Tag: para +#: basic_mapping.xml:4036 #, fuzzy, no-c-format msgid "" "The challenge is to map the Java type system, and the developers' definition " @@ -3847,6 +8821,7 @@ msgstr "" "Darauf gehen wir später noch ein." #. Tag: para +#: basic_mapping.xml:4049 #, fuzzy, no-c-format msgid "" "With the exception of collections, all built-in Hibernate types support null " @@ -3856,11 +8831,13 @@ msgstr "" "Semantik (sog. \"null semantics\"." #. Tag: title +#: basic_mapping.xml:4054 #, no-c-format msgid "Basic value types" msgstr "Grundlegende Wertetypen" #. Tag: para +#: basic_mapping.xml:4056 #, fuzzy, no-c-format msgid "" "The built-in basic mapping types can be roughly " @@ -3869,16 +8846,18 @@ msgstr "" "Die eingebauten, grundlegenden Mapping-Typen können im " "Wesentlichen wie folgt kategorisiert werden" -#. Tag: term +#. Tag: literal +#: basic_mapping.xml:4059 #, fuzzy, no-c-format msgid "" -"integer, long, short, float, double, character, byte, boolean, " -"yes_no, true_false" +"integer, long, short, float, double, character, byte, boolean, yes_no, " +"true_false" msgstr "" "integer, long, short, float, double, character, byte, boolean, yes_no, " "true_false" #. Tag: para +#: basic_mapping.xml:4063 #, no-c-format msgid "" "Type mappings from Java primitives or wrapper classes to appropriate (vendor-" @@ -3892,12 +8871,14 @@ msgstr "" "einen Java boolean oder java.lang.Boolean." -#. Tag: term -#, fuzzy, no-c-format -msgid "string" -msgstr "name: Der Property-Name." +#. Tag: literal +#: basic_mapping.xml:4073 +#, no-c-format +msgid "string" +msgstr "string" #. Tag: para +#: basic_mapping.xml:4076 #, no-c-format msgid "" "A type mapping from java.lang.String to VARCHARjava.lang.String zu " "VARCHAR (oder Oracle VARCHAR2)." -#. Tag: term +#. Tag: literal +#: basic_mapping.xml:4083 #, fuzzy, no-c-format -msgid "date, time, timestamp" +msgid "date, time, timestamp" msgstr "date, time, timestamp" #. Tag: para +#: basic_mapping.xml:4086 #, no-c-format msgid "" "Type mappings from java.util.Date and its subclasses to " @@ -3922,12 +8905,14 @@ msgstr "" "SQL-Typen DATE, TIME und " "TIMESTAMP (oder äquivalent)." -#. Tag: term +#. Tag: literal +#: basic_mapping.xml:4094 #, fuzzy, no-c-format -msgid "calendar, calendar_date" +msgid "calendar, calendar_date" msgstr "calendar, calendar_date" #. Tag: para +#: basic_mapping.xml:4097 #, no-c-format msgid "" "Type mappings from java.util.Calendar to SQL types " @@ -3936,12 +8921,14 @@ msgstr "" "Type-Mappings von java.util.Calendar zu SQL-Typen " "TIMESTAMP und DATE (oder äquivalent)." -#. Tag: term +#. Tag: literal +#: basic_mapping.xml:4104 #, fuzzy, no-c-format -msgid "big_decimal, big_integer" +msgid "big_decimal, big_integer" msgstr "big_decimal, big_integer" #. Tag: para +#: basic_mapping.xml:4107 #, no-c-format msgid "" "Type mappings from java.math.BigDecimal and java." @@ -3952,12 +8939,14 @@ msgstr "" "math.BigInteger zu NUMERIC (oder Oracle " "NUMBER)." -#. Tag: term +#. Tag: literal +#: basic_mapping.xml:4115 #, fuzzy, no-c-format -msgid "locale, timezone, currency" +msgid "locale, timezone, currency" msgstr "locale, timezone, currency" #. Tag: para +#: basic_mapping.xml:4118 #, no-c-format msgid "" "Type mappings from java.util.Locale, java.util." @@ -3974,12 +8963,14 @@ msgstr "" "werden zu ihren ISO-Codes gemappt. Instanzen von TimeZone " "werden zu ihrer ID gemappt." -#. Tag: term +#. Tag: literal +#: basic_mapping.xml:4131 #, fuzzy, no-c-format -msgid "class" -msgstr "all Prüfung aller Spalten" +msgid "class" +msgstr "subclass" #. Tag: para +#: basic_mapping.xml:4134 #, no-c-format msgid "" "A type mapping from java.lang.Class to VARCHAR (oder Oracle VARCHAR2). Eine Class wird zu ihrem vollständigen Namen gemappt." -#. Tag: term -#, fuzzy, no-c-format -msgid "binary" -msgstr "name: Der Property-Name." +#. Tag: literal +#: basic_mapping.xml:4142 +#, no-c-format +msgid "binary" +msgstr "binary" #. Tag: para +#: basic_mapping.xml:4145 #, no-c-format msgid "Maps byte arrays to an appropriate SQL binary type." msgstr "Mappt Byte-Arrays zum zugehörigen SQL-Binärtyp." -#. Tag: term -#, fuzzy, no-c-format -msgid "text" -msgstr "name: Der Property-Name." +#. Tag: literal +#: basic_mapping.xml:4150 +#, no-c-format +msgid "text" +msgstr "text" #. Tag: para +#: basic_mapping.xml:4153 #, no-c-format msgid "" "Maps long Java strings to a SQL CLOB or TEXTCLOB oder TEXT-Typ." -#. Tag: term -#, fuzzy, no-c-format -msgid "serializable" -msgstr "all Prüfung aller Spalten" +#. Tag: literal +#: basic_mapping.xml:4159 +#, no-c-format +msgid "serializable" +msgstr "serializable" #. Tag: para +#: basic_mapping.xml:4162 #, fuzzy, no-c-format msgid "" "Maps serializable Java types to an appropriate SQL binary type. You can also " @@ -4031,12 +9028,14 @@ msgstr "" "einer serialisierbaren Java-Klasse oder einem Interface (das in der " "Standardeinstellung kein Grundtyp ist) anzeigen." -#. Tag: term -#, fuzzy, no-c-format -msgid "clob, blob" -msgstr "all Prüfung aller Spalten" +#. Tag: literal +#: basic_mapping.xml:4171 +#, no-c-format +msgid "clob, blob" +msgstr "clob, blob" #. Tag: para +#: basic_mapping.xml:4174 #, fuzzy, no-c-format msgid "" "Type mappings for the JDBC classes java.sql.Clob and " @@ -4050,16 +9049,18 @@ msgstr "" "nicht außerhalb einer Transaktion wiederverwendet werden darf. (Auch der " "Treiber-Support ist lückenhaft und uneinheitlich)." -#. Tag: term +#. Tag: literal +#: basic_mapping.xml:4184 #, fuzzy, no-c-format msgid "" -"imm_date, imm_time, imm_timestamp, imm_calendar, imm_calendar_date, " -"imm_serializable, imm_binary" +"imm_date, imm_time, imm_timestamp, imm_calendar, imm_calendar_date, " +"imm_serializable, imm_binary" msgstr "" "imm_date, imm_time, imm_timestamp, imm_calendar, imm_calendar_date, " "imm_serializable, imm_binary" #. Tag: para +#: basic_mapping.xml:4188 #, fuzzy, no-c-format msgid "" "Type mappings for what are considered mutable Java types. This is where " @@ -4080,6 +9081,7 @@ msgstr "" "zuordnen." #. Tag: para +#: basic_mapping.xml:4200 #, fuzzy, no-c-format msgid "" "Unique identifiers of entities and collections can be of any basic type " @@ -4093,6 +9095,7 @@ msgstr "" "siehe unten)." #. Tag: para +#: basic_mapping.xml:4205 #, no-c-format msgid "" "The basic value types have corresponding Type constants " @@ -4106,11 +9109,13 @@ msgstr "" "string-Typ." #. Tag: title +#: basic_mapping.xml:4212 #, no-c-format msgid "Custom value types" msgstr "Angepasste Wertetypen" #. Tag: para +#: basic_mapping.xml:4214 #, fuzzy, no-c-format msgid "" "It is relatively easy for developers to create their own value types. For " @@ -4135,6 +9140,7 @@ msgstr "" "literal>, SURNAME persistiert ist." #. Tag: para +#: basic_mapping.xml:4225 #, fuzzy, no-c-format msgid "" "To implement a custom type, implement either org.hibernate." @@ -4150,7 +9156,24 @@ msgstr "" "DoubleStringType finden Sie die unterschiedlichen Möglichkeiten, " "die es dabei gibt." +#. Tag: programlisting +#: basic_mapping.xml:4232 +#, fuzzy, no-c-format +msgid "" +"<property name=\"twoStrings\" type=\"org.hibernate.test.DoubleStringType" +"\">\n" +" <column name=\"first_string\"/>\n" +" <column name=\"second_string\"/>\n" +"</property>" +msgstr "" +"<property name=\"twoStrings\" type=\"org.hibernate.test.DoubleStringType" +"\">\n" +" <column name=\"first_string\"/>\n" +" <column name=\"second_string\"/>\n" +"</property>" + #. Tag: para +#: basic_mapping.xml:4234 #, no-c-format msgid "" "Notice the use of <column> tags to map a property " @@ -4160,6 +9183,7 @@ msgstr "" "Mappen einer Property zu mehreren Spalten." #. Tag: para +#: basic_mapping.xml:4237 #, no-c-format msgid "" "The CompositeUserType, EnhancedUserTypeUserType in the " @@ -4188,7 +9213,24 @@ msgstr "" "können Sie das <type>-Element in Ihren " "Mappingdateien verwenden." +#. Tag: programlisting +#: basic_mapping.xml:4250 +#, fuzzy, no-c-format +msgid "" +"<property name=\"priority\">\n" +" <type name=\"com.mycompany.usertypes.DefaultValueIntegerType\">\n" +" <param name=\"default\">0</param>\n" +" </type>\n" +"</property>" +msgstr "" +"<property name=\"priority\">\n" +" <type name=\"com.mycompany.usertypes.DefaultValueIntegerType\">\n" +" <param name=\"default\">0</param>\n" +" </type>\n" +"</property>" + #. Tag: para +#: basic_mapping.xml:4252 #, no-c-format msgid "" "The UserType can now retrieve the value for the parameter " @@ -4200,6 +9242,7 @@ msgstr "" "Properties-Objekt abrufen." #. Tag: para +#: basic_mapping.xml:4256 #, fuzzy, no-c-format msgid "" "If you regularly use a certain UserType, it is useful to " @@ -4215,7 +9258,28 @@ msgstr "" "eine Liste standardmäßiger Parameterwerte enthalten, wenn der Typ " "parametriert wird." +#. Tag: programlisting +#: basic_mapping.xml:4262 +#, fuzzy, no-c-format +msgid "" +"<typedef class=\"com.mycompany.usertypes.DefaultValueIntegerType\" name=" +"\"default_zero\">\n" +" <param name=\"default\">0</param>\n" +"</typedef>" +msgstr "" +"<typedef class=\"com.mycompany.usertypes.DefaultValueIntegerType\" name=" +"\"default_zero\">\n" +" <param name=\"default\">0</param>\n" +"</typedef>" + +#. Tag: programlisting +#: basic_mapping.xml:4264 +#, fuzzy, no-c-format +msgid "<property name=\"priority\" type=\"default_zero\"/>" +msgstr "<property name=\"priority\" type=\"default_zero\"/>" + #. Tag: para +#: basic_mapping.xml:4266 #, no-c-format msgid "" "It is also possible to override the parameters supplied in a typedef on a " @@ -4226,6 +9290,7 @@ msgstr "" "Kraft zu setzen." #. Tag: para +#: basic_mapping.xml:4270 #, fuzzy, no-c-format msgid "" "Even though Hibernate's rich range of built-in types and support for " @@ -4249,11 +9314,13 @@ msgstr "" "Geldwerte repräsentiert werden, gesichert." #. Tag: title +#: basic_mapping.xml:4283 #, no-c-format msgid "Mapping a class more than once" msgstr "Das mehrfache Mappen einer Klasse" #. Tag: para +#: basic_mapping.xml:4285 #, fuzzy, no-c-format msgid "" "It is possible to provide more than one mapping for a particular persistent " @@ -4271,7 +9338,48 @@ msgstr "" "festlegen, wenn Sie mit persistenten Objekten arbeiten, wenn Sie Anfragen " "schreiben oder Assoziationen zu der genannten Entity mappen." +#. Tag: programlisting +#: basic_mapping.xml:4293 +#, fuzzy, no-c-format +msgid "" +"<class name=\"Contract\" table=\"Contracts\"\n" +" entity-name=\"CurrentContract\">\n" +" ...\n" +" <set name=\"history\" inverse=\"true\"\n" +" order-by=\"effectiveEndDate desc\">\n" +" <key column=\"currentContractId\"/>\n" +" <one-to-many entity-name=\"HistoricalContract\"/>\n" +" </set>\n" +"</class>\n" +"\n" +"<class name=\"Contract\" table=\"ContractHistory\"\n" +" entity-name=\"HistoricalContract\">\n" +" ...\n" +" <many-to-one name=\"currentContract\"\n" +" column=\"currentContractId\"\n" +" entity-name=\"CurrentContract\"/>\n" +"</class>" +msgstr "" +"<class name=\"Contract\" table=\"Contracts\" \n" +" entity-name=\"CurrentContract\">\n" +" ...\n" +" <set name=\"history\" inverse=\"true\" \n" +" order-by=\"effectiveEndDate desc\">\n" +" <key column=\"currentContractId\"/>\n" +" <one-to-many entity-name=\"HistoricalContract\"/>\n" +" </set>\n" +"</class>\n" +"\n" +"<class name=\"Contract\" table=\"ContractHistory\" \n" +" entity-name=\"HistoricalContract\">\n" +" ...\n" +" <many-to-one name=\"currentContract\" \n" +" column=\"currentContractId\" \n" +" entity-name=\"CurrentContract\"/>\n" +"</class>" + #. Tag: para +#: basic_mapping.xml:4295 #, fuzzy, no-c-format msgid "" "Associations are now specified using entity-name instead " @@ -4280,12 +9388,20 @@ msgstr "" "Beachten Sie, wie Assoziationen nun unter Verwendung von entity-" "name statt class spezifiziert werden." +#. Tag: para +#: basic_mapping.xml:4299 basic_mapping.xml:4379 basic_mapping.xml:4414 +#, no-c-format +msgid "This feature is not supported in Annotations" +msgstr "" + #. Tag: title +#: basic_mapping.xml:4304 #, no-c-format msgid "SQL quoted identifiers" msgstr "SQL angeführte Bezeichner" #. Tag: para +#: basic_mapping.xml:4306 #, fuzzy, no-c-format msgid "" "You can force Hibernate to quote an identifier in the generated SQL by " @@ -4301,103 +9417,38 @@ msgstr "" "Regel doppelte Anführungszeichen, aber Klammern für SQL-Server und Backticks " "für MySQL)." -#. Tag: title -#, no-c-format -msgid "Metadata alternatives" -msgstr "Metadata-Alternativen" - -#. Tag: para +#. Tag: programlisting +#: basic_mapping.xml:4312 #, fuzzy, no-c-format msgid "" -"XML does not suit all users so there are some alternative ways to define O/R " -"mapping metadata in Hibernate." +"@Entity @Table(name=\"`Line Item`\")\n" +"class LineItem {\n" +" @id @Column(name=\"`Item Id`\") Integer id;\n" +" @Column(name=\"`Item #`\") int itemNumber\n" +"}\n" +"\n" +"<class name=\"LineItem\" table=\"`Line Item`\">\n" +" <id name=\"id\" column=\"`Item Id`\"/><generator class=" +"\"assigned\"/></id>\n" +" <property name=\"itemNumber\" column=\"`Item #`\"/>\n" +" ...\n" +"</class>" msgstr "" -"XML ist nicht jedermanns Sache, daher gibt es auch alternative Möglichkeiten " -"O/R Mapping Metadaten in Hibernate zu definieren." - -#. Tag: title -#, no-c-format -msgid "Using XDoclet markup" -msgstr "Die Verwendung von XDoclet-Markup" - -#. Tag: para -#, fuzzy, no-c-format -msgid "" -"Many Hibernate users prefer to embed mapping information directly in " -"sourcecode using XDoclet @hibernate.tags. We do not cover " -"this approach in this reference guide since it is considered part of " -"XDoclet. However, we include the following example of the Cat class with XDoclet mappings:" -msgstr "" -"Viele Benutzer von Hibernate ziehen es vor, Mapping-Informationen unter " -"Verwendung von XDoclet @hibernate.tags direkt im " -"Quellcode einzubetten. Diese Vorgehensweise wird hier nicht behandelt, da es " -"sich ausschließlich um einen Teil von XDoclet handelt. Allerdings zeigen wir " -"das nachfolgende Beispiel der Cat-Klasse mit XDoclet-" -"Mappings." - -#. Tag: para -#, fuzzy, no-c-format -msgid "See the Hibernate website for more examples of XDoclet and Hibernate." -msgstr "" -"Weitere Beispiele zu XDoclet und Hibernate finden Sie auf der Hibernate " -"Website." - -#. Tag: title -#, no-c-format -msgid "Using JDK 5.0 Annotations" -msgstr "Die Verwendung von JDK 5.0 Annotationen" - -#. Tag: para -#, fuzzy, no-c-format -msgid "" -"JDK 5.0 introduced XDoclet-style annotations at the language level that are " -"type-safe and checked at compile time. This mechanism is more powerful than " -"XDoclet annotations and better supported by tools and IDEs. IntelliJ IDEA, " -"for example, supports auto-completion and syntax highlighting of JDK 5.0 " -"annotations. The new revision of the EJB specification (JSR-220) uses JDK " -"5.0 annotations as the primary metadata mechanism for entity beans. " -"Hibernate3 implements the EntityManager of JSR-220 (the " -"persistence API). Support for mapping metadata is available via the " -"Hibernate Annotations package as a separate download. " -"Both EJB3 (JSR-220) and Hibernate3 metadata is supported." -msgstr "" -"JDK 5.0 hat Annotationen im XDoclet-Stil auf der Sprachebene vorgestellt, " -"die typensicher und zum Zeitpunkt der Kompilierung geprüft sind. Dieser " -"Mechanismus ist leistungsstärker als XDoclet-Annotationen und bietet " -"besseren Support durch Tools und IDEs . IntelliJ IDEA zum Beispiel " -"unterstützt Auto-Vervollständigung und Syntax-Hervorhebungen von JDK 5.0 " -"Annotationen. Die neue Revision der EJB-Spezifikation (JSR-220) verwendet " -"JDK 5.0 Annotationen als primären Metadata-Mechanismus für Entity-Beans. " -"Hibernate3 implementiert den EntityManager von JSR-220 " -"(das Persistenz-API), Support für Mapping-Metadata ist mittels des " -"Hibernate Annotations-Pakets als separater Download " -"verfügbar. Sowohl EJB3 (JSR-220) und Hibernate3 Metadata werden unterstützt." - -#. Tag: para -#, no-c-format -msgid "This is an example of a POJO class annotated as an EJB entity bean:" -msgstr "" -"Nachfolgend sehen Sie ein Beispiel für eine als EJB Entity-Bean annotierte " -"POJO-Klasse:" - -#. Tag: para -#, fuzzy, no-c-format -msgid "" -"Support for JDK 5.0 Annotations (and JSR-220) is currently under " -"development. Please refer to the Hibernate Annotations module for more " -"details." -msgstr "" -"Bitte beachten Sie, dass am Support für JDK 5.0 Annotationen (und JSR-220) " -"noch gearbeitet wird und dieser noch nicht vollständig verfügbar ist. " -"Weitere Einzelheiten entnehmen Sie bitte dem Hibernate Annotationsmodul." +"<class name=\"LineItem\" table=\"`Line Item`\">\n" +" <id name=\"id\" column=\"`Item Id`\"/><generator class=" +"\"assigned\"/></id>\n" +" <property name=\"itemNumber\" column=\"`Item #`\"/>\n" +" ...\n" +"</class>" #. Tag: title +#: basic_mapping.xml:4316 #, fuzzy, no-c-format msgid "Generated properties" msgstr "Generierte Properties" #. Tag: para +#: basic_mapping.xml:4318 #, fuzzy, no-c-format msgid "" "Generated properties are properties that have their values generated by the " @@ -4419,6 +9470,7 @@ msgstr "" "abzufragen." #. Tag: para +#: basic_mapping.xml:4327 #, fuzzy, no-c-format msgid "" "Properties marked as generated must additionally be non-insertable and non-" @@ -4435,6 +9487,7 @@ msgstr "" "als generiert gekennzeichnet sein." #. Tag: para +#: basic_mapping.xml:4334 #, fuzzy, no-c-format msgid "" "never (the default): the given property value is not " @@ -4444,6 +9497,7 @@ msgstr "" "Property-Wert nicht innerhalb der Datenbank generiert wird." #. Tag: para +#: basic_mapping.xml:4337 #, fuzzy, no-c-format msgid "" "insert: the given property value is generated on insert, " @@ -4462,6 +9516,7 @@ msgstr "" "diese Option dort jedoch nicht existiert." #. Tag: para +#: basic_mapping.xml:4344 #, fuzzy, no-c-format msgid "" "always: the property value is generated both on insert " @@ -4470,24 +9525,43 @@ msgstr "" "always - besagt, dass der Property-Wert sowohl bei der " "Einfügung als auch bei der Aktualisierung generiert wird." +#. Tag: para +#: basic_mapping.xml:4347 +#, no-c-format +msgid "To mark a property as generated, use @Generated." +msgstr "" + #. Tag: title +#: basic_mapping.xml:4352 #, no-c-format msgid "Column read and write expressions" msgstr "" #. Tag: para +#: basic_mapping.xml:4354 #, no-c-format msgid "" "Hibernate allows you to customize the SQL it uses to read and write the " "values of columns mapped to simple properties. For example, if your database provides a set of " "data encryption functions, you can invoke them for individual columns like " -"this: <property name=\"creditCardNumber" -"\"> <column name=\"credit_card_num\" read=\"decrypt(credit_card_num)\" " -"write=\"encrypt(?)\"/> </property>" +"this:" +msgstr "" + +#. Tag: programlisting +#: basic_mapping.xml:4359 +#, no-c-format +msgid "" +"<property name=\"creditCardNumber\">\n" +" <column \n" +" name=\"credit_card_num\"\n" +" read=\"decrypt(credit_card_num)\"\n" +" write=\"encrypt(?)\"/>\n" +"</property>" msgstr "" #. Tag: para +#: basic_mapping.xml:4361 #, no-c-format msgid "" "Hibernate applies the custom expressions automatically whenever the property " @@ -4496,6 +9570,7 @@ msgid "" msgstr "" #. Tag: para +#: basic_mapping.xml:4366 #, no-c-format msgid "" "The property is backed by one or more columns that are exported as part of " @@ -4503,11 +9578,13 @@ msgid "" msgstr "" #. Tag: para +#: basic_mapping.xml:4371 #, no-c-format msgid "The property is read-write, not read-only." msgstr "" #. Tag: para +#: basic_mapping.xml:4375 #, no-c-format msgid "" "The write expression, if specified, must contain exactly " @@ -4515,11 +9592,13 @@ msgid "" msgstr "" #. Tag: title +#: basic_mapping.xml:4384 #, fuzzy, no-c-format msgid "Auxiliary database objects" msgstr "Datenbankhilfsobjekte" #. Tag: para +#: basic_mapping.xml:4386 #, fuzzy, no-c-format msgid "" "Auxiliary database objects allow for the CREATE and DROP of arbitrary " @@ -4541,6 +9620,7 @@ msgstr "" "gibt im Wesentlichen zwei Modi der Definition von Datenbankhilfsobjekten..." #. Tag: para +#: basic_mapping.xml:4396 #, fuzzy, no-c-format msgid "" "The first mode is to explicitly list the CREATE and DROP commands in the " @@ -4549,7 +9629,28 @@ msgstr "" "Die erste Methode ist die explizite Auflistung der CREATE- und DROP-Befehle " "in der Mapping-Datei:" +#. Tag: programlisting +#: basic_mapping.xml:4399 +#, fuzzy, no-c-format +msgid "" +"<hibernate-mapping>\n" +" ...\n" +" <database-object>\n" +" <create>CREATE TRIGGER my_trigger ...</create>\n" +" <drop>DROP TRIGGER my_trigger</drop>\n" +" </database-object>\n" +"</hibernate-mapping>" +msgstr "" +"<hibernate-mapping>\n" +" ...\n" +" <database-object>\n" +" <create>CREATE TRIGGER my_trigger ...</create>\n" +" <drop>DROP TRIGGER my_trigger</drop>\n" +" </database-object>\n" +"</hibernate-mapping>" + #. Tag: para +#: basic_mapping.xml:4401 #, fuzzy, no-c-format msgid "" "The second mode is to supply a custom class that constructs the CREATE and " @@ -4561,7 +9662,26 @@ msgstr "" "muss das org.hibernate.mapping.AuxiliaryDatabaseObject-" "Interface implementieren." +#. Tag: programlisting +#: basic_mapping.xml:4406 +#, fuzzy, no-c-format +msgid "" +"<hibernate-mapping>\n" +" ...\n" +" <database-object>\n" +" <definition class=\"MyTriggerDefinition\"/>\n" +" </database-object>\n" +"</hibernate-mapping>" +msgstr "" +"<hibernate-mapping>\n" +" ...\n" +" <database-object>\n" +" <definition class=\"MyTriggerDefinition\"/>\n" +" </database-object>\n" +"</hibernate-mapping>" + #. Tag: para +#: basic_mapping.xml:4408 #, fuzzy, no-c-format msgid "" "Additionally, these database objects can be optionally scoped so that they " @@ -4570,139 +9690,464 @@ msgstr "" "Zusätzlich können diese Datenbankobjekte wahlweise so abgegrenzt werden, " "dass Sie nur in Kraft treten, wenn bestimmte Dialekte verwendet werden." +#. Tag: programlisting +#: basic_mapping.xml:4411 +#, fuzzy, no-c-format +msgid "" +"<hibernate-mapping>\n" +" ...\n" +" <database-object>\n" +" <definition class=\"MyTriggerDefinition\"/>\n" +" <dialect-scope name=\"org.hibernate.dialect.Oracle9iDialect\"/" +">\n" +" <dialect-scope name=\"org.hibernate.dialect.Oracle10gDialect\"/" +">\n" +" </database-object>\n" +"</hibernate-mapping>" +msgstr "" +"<hibernate-mapping>\n" +" ...\n" +" <database-object>\n" +" <definition class=\"MyTriggerDefinition\"/>\n" +" <dialect-scope name=\"org.hibernate.dialect.Oracle9Dialect\"/" +">\n" +" <dialect-scope name=\"org.hibernate.dialect.OracleDialect\"/>\n" +" </database-object>\n" +"</hibernate-mapping>" + +#, fuzzy +#~ msgid "Class" +#~ msgstr "subclass" + #, fuzzy #~ msgid "" -#~ "\n" -#~ "\n" -#~ "\n" -#~ "\n" -#~ "\n" -#~ " \n" -#~ "\n" -#~ " \n" -#~ " \n" -#~ " \n" -#~ "\n" -#~ " \n" -#~ "\n" -#~ " \n" -#~ "\n" -#~ " \n" -#~ "\n" -#~ " \n" -#~ "\n" -#~ " \n" -#~ "\n" -#~ " \n" -#~ "\n" -#~ " \n" -#~ "\n" -#~ " \n" -#~ " \n" -#~ " \n" -#~ " \n" -#~ "\n" -#~ " \n" -#~ "\n" -#~ " \n" -#~ "\n" -#~ " \n" -#~ "\n" -#~ " \n" -#~ "\n" -#~ " \n" -#~ " \n" -#~ " \n" -#~ "\n" -#~ "]]>" +#~ "Use of select-before-update will usually decrease " +#~ "performance. It is useful to prevent a database update trigger being " +#~ "called unnecessarily if you reattach a graph of detached instances to a " +#~ "Session." #~ msgstr "" -#~ "<?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 name=\"Cat\" \n" -#~ " table=\"cats\"\n" -#~ " discriminator-value=\"C\">\n" -#~ " \n" -#~ " <id name=\"id\">\n" -#~ " <generator class=\"native\"/>\n" -#~ " </id>\n" -#~ "\n" -#~ " <discriminator column=\"subclass\" \n" -#~ " type=\"character\"/>\n" -#~ "\n" -#~ " <property name=\"weight\"/>\n" -#~ "\n" -#~ " <property name=\"birthdate\"\n" -#~ " type=\"date\" \n" -#~ " not-null=\"true\" \n" -#~ " update=\"false\"/>\n" -#~ "\n" -#~ " <property name=\"color\"\n" -#~ " type=\"eg.types.ColorUserType\"\n" -#~ " not-null=\"true\"\n" -#~ " update=\"false\"/>\n" -#~ "\n" -#~ " <property name=\"sex\"\n" -#~ " not-null=\"true\" \n" -#~ " update=\"false\"/>\n" -#~ "\n" -#~ " <property name=\"litterId\"\n" -#~ " column=\"litterId\"\n" -#~ " update=\"false\"/>\n" -#~ "\n" -#~ " <many-to-one name=\"mother\"\n" -#~ " column=\"mother_id\"\n" -#~ " update=\"false\"/>\n" -#~ "\n" -#~ " <set name=\"kittens\"\n" -#~ " inverse=\"true\"\n" -#~ " order-by=\"litter_id\">\n" -#~ " <key column=\"mother_id\"/>\n" -#~ " <one-to-many class=\"Cat\"/>\n" -#~ " </set>\n" -#~ "\n" -#~ " <subclass name=\"DomesticCat\"\n" -#~ " discriminator-value=\"D\">\n" -#~ "\n" -#~ " <property name=\"name\" \n" -#~ " type=\"string\"/>\n" -#~ "\n" -#~ " </subclass>\n" -#~ "\n" -#~ " </class>\n" -#~ "\n" -#~ " <class name=\"Dog\">\n" -#~ " <!-- mapping for Dog could go here -->\n" -#~ " </class>\n" -#~ "\n" -#~ "</hibernate-mapping>" +#~ "Die Verwendung von select-before-update wird die " +#~ "Performance in der Regel verschlechtern. Es ist sehr hilfreich, um den " +#~ "Aufruf eines Datenbankaktualisierungs-Triggers abzufangen, wenn Sie einen " +#~ "Graph abgesetzter Instanzen wieder an eine Session " +#~ "binden möchten." + +#, fuzzy +#~ msgid "id" +#~ msgstr "uuid" + +#~ msgid "Generator" +#~ msgstr "Programmgenerator" + +#, fuzzy +#~ msgid "increment" +#~ msgstr "name: Der Property-Name." + +#, fuzzy +#~ msgid "identity" +#~ msgstr "id-type: Der Bezeichnertyp." + +#, fuzzy +#~ msgid "sequence" +#~ msgstr "name: Der Property-Name." + +#, fuzzy +#~ msgid "seqhilo" +#~ msgstr "all Prüfung aller Spalten" + +#, fuzzy +#~ msgid "uuid" +#~ msgstr "id" + +#, fuzzy +#~ msgid "" +#~ "uses a 128-bit UUID algorithm to generate identifiers of type string that " +#~ "are unique within a network (the IP address is used). The UUID is encoded " +#~ "as a string of 32 hexadecimal digits in length." +#~ msgstr "" +#~ "verwendet einen 128-bit UUID-Algorithmus, um Bezeichner des String-Typs " +#~ "(Zeichenkettentyp) zu generieren, die innerhalb eines Netzwerks eindeutig " +#~ "sind (die IP-Adresse wird verwendet). Der UUID (Universally Unique " +#~ "Identifier) ist als Zeichenkette hexadezimaler Ziffern von 32 Zeichen " +#~ "Länge verschlüsselt." + +#, fuzzy +#~ msgid "guid" +#~ msgstr "id" + +#, fuzzy +#~ msgid "native" +#~ msgstr "name: Der Property-Name." + +#, fuzzy +#~ msgid "select" +#~ msgstr "all Prüfung aller Spalten" + +#, fuzzy +#~ msgid "foreign" +#~ msgstr "name: Der Property-Name." + +#, fuzzy +#~ msgid "" +#~ "optimizer (optional - defaults to none): See " +#~ msgstr "" +#~ "cascade (optional- die Standardeinstellung lautet " +#~ "none): der \"Cascade-Style\" (Weitergabestil)." + +#~ msgid "composite-id" +#~ msgstr "composite-id" + +#, fuzzy +#~ msgid "" +#~ "A table with a composite key can be mapped with multiple properties of " +#~ "the class as identifier properties. The <composite-id> element accepts <key-property> property " +#~ "mappings and <key-many-to-one> mappings as child " +#~ "elements." +#~ msgstr "" +#~ "Für eine Tabelle mit einem zusammengesetzten Schlüssel, können Sie " +#~ "mehrere Properties der Klasse als Bezeichner-Properties mappen. Das " +#~ "<composite-id>-Element akzeptiert <" +#~ "key-property>-Property-Mappings und <key-many-to-" +#~ "one>-Mappings als untergeordnete Elemente." + +#, fuzzy +#~ msgid "" +#~ "The persistent class must override equals()" +#~ " and hashCode() to implement composite " +#~ "identifier equality. It must also implement Serializable." +#~ msgstr "" +#~ "Ihre persistente Klasse muss sowohl equals()" +#~ " als auch hashCode() außer Kraft setzen, um " +#~ "die Gleichwertigkeit zusammengesetzter Bezeichner zu implementieren. Sie " +#~ "muss außerdem Serializable implementieren." + +#, fuzzy +#~ msgid "" +#~ "Unfortunately, this approach means that a persistent object is its own " +#~ "identifier. There is no convenient \"handle\" other than the object " +#~ "itself. You must instantiate an instance of the persistent class itself " +#~ "and populate its identifier properties before you can load() the persistent state associated with a composite key. We call " +#~ "this approach an embedded composite identifier, and " +#~ "discourage it for serious applications." +#~ msgstr "" +#~ "Leider bedeutet diese Vorgehensweise bei zusammengesetzten Bezeichnern, " +#~ "dass ein persistentes Objekt sein eigener Bezeichner ist. Es existiert " +#~ "keine praktische \"Handhabung\" außer dem Objekt selbst. Sie müssen eine " +#~ "Instanz der persistenten Klasse selbst instanziieren und deren Bezeichner-" +#~ "Properties auffüllen, ehe Sie mit load() den " +#~ "persistenten Status eines zugehörigen zusammengesetzten Schlüssels laden " +#~ "können. Diese Vorgehensweise gilt als eingebetteter " +#~ "(\"embedded\") zusammengesetzter Bezeichner und wird nicht für ernsthafte " +#~ "Anwendungen empfohlen." + +#~ msgid "" +#~ "A second approach is what we call a mapped composite " +#~ "identifier, where the identifier properties named inside the <" +#~ "composite-id> element are duplicated on both the persistent " +#~ "class and a separate identifier class." +#~ msgstr "" +#~ "Eine zweite Vorgehensweise trägt den Namen gemappter " +#~ "zusammengesetzter Bezeichner (sog. \"mapped composite identifier\"), " +#~ "wobei die innerhalb des <composite-id>-Elements " +#~ "genannten Bezeichner-Properties sowohl an der persistenten Klasse als " +#~ "auch einer separaten Bezeichnerklasse dupliziert werden." + +#, fuzzy +#~ msgid "" +#~ "In this example, both the composite identifier class, " +#~ "MedicareId, and the entity class itself have " +#~ "properties named medicareNumber and " +#~ "dependent. The identifier class must override " +#~ "equals() and hashCode() and " +#~ "implement Serializable. The main disadvantage of this " +#~ "approach is code duplication." +#~ msgstr "" +#~ "In diesem Beispiel besitzen sowohl die Klasse des zusammengesetzten " +#~ "Bezeichners MedicareId als auch die Entity-Klasse " +#~ "selbst Properties mit dem Namen medicareNumber und " +#~ "dependent. Die Bezeichnerklasse muss equals()" +#~ " und hashCode() außer Kraft setzen und " +#~ "Serializable implementieren. Der Nachteil dieser " +#~ "Vorgehensweise ist offensichtlich— Code-Duplizierung." + +#~ msgid "" +#~ "The following attributes are used to specify a mapped composite " +#~ "identifier:" +#~ msgstr "" +#~ "Die folgenden Attribute werden verwendet, um einen gemappten " +#~ "zusammengesetzten Bezeichner zu bestimmen:" + +#, fuzzy +#~ msgid "" +#~ "mapped (optional - defaults to false): indicates that a mapped composite identifier is used, and that " +#~ "the contained property mappings refer to both the entity class and the " +#~ "composite identifier class." +#~ msgstr "" +#~ "mapped (optional, Standardeinstellung false): zeigt an, dass ein gemappter zusammengesetzter Bezeichner " +#~ "verwendet wird und die enthaltenen Property-Mappings auf die Entity-" +#~ "Klasse und die zusammengesetzte Bezeichnerklasse verweisen." + +#, fuzzy +#~ msgid "" +#~ "class (optional - but required for a mapped composite " +#~ "identifier): the class used as a composite identifier." +#~ msgstr "" +#~ "class (optional, für einen gemappten Bezeichner jedoch " +#~ "erforderlich): Die als zusammengesetzter Bezeichner verwendete Klasse." + +#, fuzzy +#~ msgid "" +#~ "We will describe a third, even more convenient approach, where the " +#~ "composite identifier is implemented as a component class in . The attributes described below apply only " +#~ "to this alternative approach:" +#~ msgstr "" +#~ "Abschließend erläutern wir einen dritte, noch praktischere " +#~ "Vorgehensweise, bei der der zusammengesetzte Bezeichner als " +#~ "Komponentenklasse in " +#~ "implementiert wird. Die unten beschriebenen Attribute gelten nur für " +#~ "diese Vorgehensweise:" + +#, fuzzy +#~ msgid "" +#~ "name (optional - required for this approach): a " +#~ "property of component type that holds the composite identifier. Please " +#~ "see chapter 9 for more information." +#~ msgstr "" +#~ "name (optional, bei dieser Vorgehensweise " +#~ "erforderlich): Eine Property nach Komponententyp, die den " +#~ "zusammengesetzten Bezeichner enthält (siehe Kapitel 9)." + +#, fuzzy +#~ msgid "" +#~ "class (optional - defaults to the property type " +#~ "determined by reflection): the component class used as a composite " +#~ "identifier. Please see the next section for more information." +#~ msgstr "" +#~ "class (optional - Standardeinstellung ist der durch " +#~ "die Reflexion bestimmte Property-Typ): Die als ein zusammengesetzter " +#~ "Bezeichnerverwendete Komponentenklasse (siehe nächster Abschnitt)." + +#, fuzzy +#~ msgid "" +#~ "The third approach, an identifier component, is " +#~ "recommended for almost all applications." +#~ msgstr "" +#~ "Bei dieser dritten Vorhegensweise empfehlen wir eine " +#~ "Bezeichnerkomponente für fast alle Anwendungen." + +#, fuzzy +#~ msgid "Version (optional)" +#~ msgstr "version (optional)" + +#, fuzzy +#~ msgid "" +#~ "The <version> element is optional and indicates " +#~ "that the table contains versioned data. This is particularly useful if " +#~ "you plan to use long transactions. See below for " +#~ "more information:" +#~ msgstr "" +#~ "Das <version>-Element ist optional und zeigt an, " +#~ "dass die Tabelle versionierte Daten enthält. Das ist insbesondere dann " +#~ "nützlich, wenn Sie vorhaben, lange Transaktionen zu " +#~ "verwenden (siehe unten)." + +#, fuzzy +#~ msgid "" +#~ "Version numbers can be of Hibernate type long, " +#~ "integer, short, timestamp or calendar." +#~ msgstr "" +#~ "Die Versionsnummern können vom Hibernate-Typ long, " +#~ "integer, short, timestamp oder calendar sein." + +#, fuzzy +#~ msgid "Many-to-one" +#~ msgstr "many-to-one" + +#, fuzzy +#~ msgid "" +#~ "An ordinary association to another persistent class is declared using a " +#~ "many-to-one element. The relational model is a many-to-" +#~ "one association; a foreign key in one table is referencing the primary " +#~ "key column(s) of the target table." +#~ msgstr "" +#~ "Eine reguläre Assoziation zu einer anderen persistenten Klasse wird unter " +#~ "Verwendung eines many-to-one-Elements deklariert. Das " +#~ "relationale Modell ist eine \"Many-to-One\"-Assoziation: Der " +#~ "Fremdschlüssel in einer Tabelle verweist auf die Spalte(n) des " +#~ "Primärschlüssels der Zieltabelle." + +#, fuzzy +#~ msgid "One-to-one" +#~ msgstr "one-to-one" + +#, fuzzy +#~ msgid "There are two varieties of one-to-one associations:" +#~ msgstr "Es existieren zwei Arten von \"One-to-One\"-Assoziation:" + +#~ msgid "primary key associations" +#~ msgstr "Assoziationen des Primärschlüssels" + +#, fuzzy +#~ msgid "" +#~ "Alternatively, a foreign key with a unique constraint, from " +#~ "Employee to Person, can be " +#~ "expressed as:" +#~ msgstr "" +#~ "Alternativ kann ein Fremdschlüssel mit eindeutiger Bedingung von " +#~ "Employee zu Person wie folgt " +#~ "ausgedrückt werden:" + +#, fuzzy +#~ msgid "" +#~ "This association can be made bidirectional by adding the following to the " +#~ "Person mapping:" +#~ msgstr "" +#~ "Und diese Assoziation kann durch Hinzufügen des Folgenden zum " +#~ "Person-Mapping bidirektional gemacht werden:" + +#, fuzzy +#~ msgid "Component and dynamic-component" +#~ msgstr "component, dynamic-component" + +#, fuzzy +#~ msgid "Subclass" +#~ msgstr "subclass" + +#, fuzzy +#~ msgid "" +#~ "A discriminator column is not required for this mapping strategy. Each " +#~ "subclass must, however, declare a table column holding the object " +#~ "identifier using the <key> element. The mapping " +#~ "at the start of the chapter would then be re-written as:" +#~ msgstr "" +#~ "Bei dieser Mapping-Strategie ist keine Diskriminatortabelle erforderlich. " +#~ "Jede Subklasse muss jedoch unter Verwendung des <key>-Elements eine Tabellenspalte deklarieren, die den " +#~ "Objektbezeichner enthält. Das Mapping vom Kapitelbeginn würde dann wie " +#~ "folgt umgeschrieben:" + +#, fuzzy +#~ msgid "Union-subclass" +#~ msgstr "union-subclass" + +#, fuzzy +#~ msgid "Join" +#~ msgstr "join" + +#, fuzzy +#~ msgid "" +#~ "Using the <join> element, it is possible to map " +#~ "properties of one class to several tables that have a one-to-one " +#~ "relationship. For example:" +#~ msgstr "" +#~ "Mittels des <join>-Elements können Properties " +#~ "einer Klasse zu mehreren Tabellen gemappt werden, wenn eine 1-zu-1 " +#~ "Beziehung zwischen den Tabellen besteht." + +#, fuzzy +#~ msgid "class" +#~ msgstr "all Prüfung aller Spalten" + +#, fuzzy +#~ msgid "binary" +#~ msgstr "name: Der Property-Name." + +#, fuzzy +#~ msgid "text" +#~ msgstr "name: Der Property-Name." + +#, fuzzy +#~ msgid "clob, blob" +#~ msgstr "all Prüfung aller Spalten" + +#, fuzzy +#~ msgid "" +#~ "XML does not suit all users so there are some alternative ways to define " +#~ "O/R mapping metadata in Hibernate." +#~ msgstr "" +#~ "XML ist nicht jedermanns Sache, daher gibt es auch alternative " +#~ "Möglichkeiten O/R Mapping Metadaten in Hibernate zu definieren." + +#~ msgid "Using XDoclet markup" +#~ msgstr "Die Verwendung von XDoclet-Markup" + +#, fuzzy +#~ msgid "" +#~ "Many Hibernate users prefer to embed mapping information directly in " +#~ "sourcecode using XDoclet @hibernate.tags. We do not " +#~ "cover this approach in this reference guide since it is considered part " +#~ "of XDoclet. However, we include the following example of the " +#~ "Cat class with XDoclet mappings:" +#~ msgstr "" +#~ "Viele Benutzer von Hibernate ziehen es vor, Mapping-Informationen unter " +#~ "Verwendung von XDoclet @hibernate.tags direkt im " +#~ "Quellcode einzubetten. Diese Vorgehensweise wird hier nicht behandelt, da " +#~ "es sich ausschließlich um einen Teil von XDoclet handelt. Allerdings " +#~ "zeigen wir das nachfolgende Beispiel der Cat-Klasse " +#~ "mit XDoclet-Mappings." + +#, fuzzy +#~ msgid "" +#~ "See the Hibernate website for more examples of XDoclet and Hibernate." +#~ msgstr "" +#~ "Weitere Beispiele zu XDoclet und Hibernate finden Sie auf der Hibernate " +#~ "Website." + +#~ msgid "Using JDK 5.0 Annotations" +#~ msgstr "Die Verwendung von JDK 5.0 Annotationen" + +#, fuzzy +#~ msgid "" +#~ "JDK 5.0 introduced XDoclet-style annotations at the language level that " +#~ "are type-safe and checked at compile time. This mechanism is more " +#~ "powerful than XDoclet annotations and better supported by tools and IDEs. " +#~ "IntelliJ IDEA, for example, supports auto-completion and syntax " +#~ "highlighting of JDK 5.0 annotations. The new revision of the EJB " +#~ "specification (JSR-220) uses JDK 5.0 annotations as the primary metadata " +#~ "mechanism for entity beans. Hibernate3 implements the " +#~ "EntityManager of JSR-220 (the persistence API). " +#~ "Support for mapping metadata is available via the Hibernate " +#~ "Annotations package as a separate download. Both EJB3 (JSR-" +#~ "220) and Hibernate3 metadata is supported." +#~ msgstr "" +#~ "JDK 5.0 hat Annotationen im XDoclet-Stil auf der Sprachebene vorgestellt, " +#~ "die typensicher und zum Zeitpunkt der Kompilierung geprüft sind. Dieser " +#~ "Mechanismus ist leistungsstärker als XDoclet-Annotationen und bietet " +#~ "besseren Support durch Tools und IDEs . IntelliJ IDEA zum Beispiel " +#~ "unterstützt Auto-Vervollständigung und Syntax-Hervorhebungen von JDK 5.0 " +#~ "Annotationen. Die neue Revision der EJB-Spezifikation (JSR-220) verwendet " +#~ "JDK 5.0 Annotationen als primären Metadata-Mechanismus für Entity-Beans. " +#~ "Hibernate3 implementiert den EntityManager von JSR-220 " +#~ "(das Persistenz-API), Support für Mapping-Metadata ist mittels des " +#~ "Hibernate Annotations-Pakets als separater Download " +#~ "verfügbar. Sowohl EJB3 (JSR-220) und Hibernate3 Metadata werden " +#~ "unterstützt." + +#~ msgid "This is an example of a POJO class annotated as an EJB entity bean:" +#~ msgstr "" +#~ "Nachfolgend sehen Sie ein Beispiel für eine als EJB Entity-Bean " +#~ "annotierte POJO-Klasse:" + +#, fuzzy +#~ msgid "" +#~ "Support for JDK 5.0 Annotations (and JSR-220) is currently under " +#~ "development. Please refer to the Hibernate Annotations module for more " +#~ "details." +#~ msgstr "" +#~ "Bitte beachten Sie, dass am Support für JDK 5.0 Annotationen (und JSR-" +#~ "220) noch gearbeitet wird und dieser noch nicht vollständig verfügbar " +#~ "ist. Weitere Einzelheiten entnehmen Sie bitte dem Hibernate " +#~ "Annotationsmodul." #, fuzzy #~ msgid "" @@ -4732,285 +10177,6 @@ msgstr "" #~ "[...]\n" #~ "</hibernate-mapping>" -#, fuzzy -#~ msgid "" -#~ "]]>" -#~ msgstr "" -#~ "<hibernate-mapping\n" -#~ " schema=\"schemaName\"\n" -#~ " catalog=\"catalogName\"\n" -#~ " default-cascade=\"cascade_style\"\n" -#~ " default-access=\"field|property|ClassName\"\n" -#~ " default-lazy=\"true|false\"\n" -#~ " auto-import=\"true|false\"\n" -#~ " package=\"package.name\"\n" -#~ " />" - -#, fuzzy -#~ msgid "" -#~ "]]>" -#~ msgstr "" -#~ "<class\n" -#~ " name=\"ClassName\"\n" -#~ " table=\"tableName\"\n" -#~ " discriminator-value=\"discriminator_value\"\n" -#~ " mutable=\"true|false\"\n" -#~ " schema=\"owner\"\n" -#~ " catalog=\"catalog\"\n" -#~ " proxy=\"ProxyInterface\"\n" -#~ " dynamic-update=\"true|false\"\n" -#~ " dynamic-insert=\"true|false\"\n" -#~ " select-before-update=\"true|false\"\n" -#~ " polymorphism=\"implicit|explicit\"\n" -#~ " where=\"arbitrary sql where condition\"\n" -#~ " persister=\"PersisterClass\"\n" -#~ " batch-size=\"N\"\n" -#~ " optimistic-lock=\"none|version|dirty|all\"\n" -#~ " lazy=\"true|false\"\n" -#~ " entity-name=\"EntityName\"\n" -#~ " check=\"arbitrary sql check condition\"\n" -#~ " rowid=\"rowid\"\n" -#~ " subselect=\"SQL expression\"\n" -#~ " abstract=\"true|false\"\n" -#~ " node=\"element-name\"\n" -#~ "/>" - -#, fuzzy -#~ msgid "" -#~ "\n" -#~ " \n" -#~ " select item.name, max(bid.amount), count(*)\n" -#~ " from item\n" -#~ " join bid on bid.item_id = item.id\n" -#~ " group by item.name\n" -#~ " \n" -#~ " \n" -#~ " \n" -#~ " \n" -#~ " ...\n" -#~ "]]>" -#~ msgstr "" -#~ "<class name=\"Summary\">\n" -#~ " <subselect>\n" -#~ " select item.name, max(bid.amount), count(*)\n" -#~ " from item\n" -#~ " join bid on bid.item_id = item.id\n" -#~ " group by item.name\n" -#~ " </subselect>\n" -#~ " <synchronize table=\"item\"/>\n" -#~ " <synchronize table=\"bid\"/>\n" -#~ " <id name=\"name\"/>\n" -#~ " ...\n" -#~ "</class>" - -#, fuzzy -#~ msgid "" -#~ "\n" -#~ " node=\"element-name|@attribute-name|element/@attribute|.\"\n" -#~ "\n" -#~ " \n" -#~ "]]>" -#~ msgstr "" -#~ "<id\n" -#~ " name=\"propertyName\"\n" -#~ " type=\"typename\"\n" -#~ " column=\"column_name\"\n" -#~ " unsaved-value=\"null|any|none|undefined|id_value\"\n" -#~ " access=\"field|property|ClassName\">\n" -#~ " node=\"element-name|@attribute-name|element/@attribute|.\"\n" -#~ "\n" -#~ " <generator class=\"generatorClass\"/>\n" -#~ "</id>" - -#, fuzzy -#~ msgid "" -#~ "\n" -#~ " \n" -#~ " uid_table\n" -#~ " next_hi_value_column\n" -#~ " \n" -#~ "]]>" -#~ msgstr "" -#~ "<id name=\"id\" type=\"long\" column=\"cat_id\">\n" -#~ " <generator class=\"org.hibernate.id.TableHiLoGenerator\">\n" -#~ " <param name=\"table\">uid_table</param>\n" -#~ " <param name=\"column\">next_hi_value_column</" -#~ "param>\n" -#~ " </generator>\n" -#~ "</id>" - -#~ msgid "increment" -#~ msgstr "increment" - -#~ msgid "identity" -#~ msgstr "identity" - -#~ msgid "sequence" -#~ msgstr "sequence" - -#~ msgid "hilo" -#~ msgstr "hilo" - -#~ msgid "seqhilo" -#~ msgstr "seqhilo" - -#~ msgid "guid" -#~ msgstr "guid" - -#~ msgid "native" -#~ msgstr "native" - -#~ msgid "assigned" -#~ msgstr "assigned" - -#~ msgid "select" -#~ msgstr "select" - -#~ msgid "foreign" -#~ msgstr "foreign" - -#, fuzzy -#~ msgid "" -#~ "\n" -#~ " \n" -#~ " hi_value\n" -#~ " next_value\n" -#~ " 100\n" -#~ " \n" -#~ "]]>" -#~ msgstr "" -#~ "<id name=\"id\" type=\"long\" column=\"cat_id\">\n" -#~ " <generator class=\"hilo\">\n" -#~ " <param name=\"table\">hi_value</param>\n" -#~ " <param name=\"column\">next_value</param>\n" -#~ " <param name=\"max_lo\">100</param>\n" -#~ " </generator>\n" -#~ "</id>" - -#, fuzzy -#~ msgid "" -#~ "\n" -#~ " \n" -#~ " hi_value\n" -#~ " 100\n" -#~ " \n" -#~ "]]>" -#~ msgstr "" -#~ "<id name=\"id\" type=\"long\" column=\"cat_id\">\n" -#~ " <generator class=\"seqhilo\">\n" -#~ " <param name=\"sequence\">hi_value</param>\n" -#~ " <param name=\"max_lo\">100</param>\n" -#~ " </generator>\n" -#~ "</id>" - -#, fuzzy -#~ msgid "" -#~ "\n" -#~ " \n" -#~ " person_id_sequence\n" -#~ " \n" -#~ "]]>" -#~ msgstr "" -#~ "<id name=\"id\" type=\"long\" column=\"person_id\">\n" -#~ " <generator class=\"sequence\">\n" -#~ " <param name=\"sequence\">person_id_sequence</" -#~ "param>\n" -#~ " </generator>\n" -#~ "</id>" - -#, fuzzy -#~ msgid "" -#~ "\n" -#~ " \n" -#~ "]]>" -#~ msgstr "" -#~ "<id name=\"id\" type=\"long\" column=\"person_id\" unsaved-value=\"0" -#~ "\">\n" -#~ " <generator class=\"identity\"/>\n" -#~ "</id>" - -#, fuzzy -#~ msgid "" -#~ "\n" -#~ " \n" -#~ " socialSecurityNumber\n" -#~ " \n" -#~ "]]>" -#~ msgstr "" -#~ "<id name=\"id\" type=\"long\" column=\"person_id\">\n" -#~ " <generator class=\"select\">\n" -#~ " <param name=\"key\">socialSecurityNumber</" -#~ "param>\n" -#~ " </generator>\n" -#~ "</id>" - -#, fuzzy -#~ msgid "" -#~ "\n" -#~ " node=\"element-name|.\"\n" -#~ "\n" -#~ " \n" -#~ " \n" -#~ " ......\n" -#~ "]]>" -#~ msgstr "" -#~ "<composite-id\n" -#~ " name=\"propertyName\"\n" -#~ " class=\"ClassName\"\n" -#~ " mapped=\"true|false\"\n" -#~ " access=\"field|property|ClassName\">\n" -#~ " node=\"element-name|.\"\n" -#~ "\n" -#~ " <key-property name=\"propertyName\" type=\"typename\" column=" -#~ "\"column_name\"/>\n" -#~ " <key-many-to-one name=\"propertyName class=\"ClassName\" " -#~ "column=\"column_name\"/>\n" -#~ " ......\n" -#~ "</composite-id>" - #, fuzzy #~ msgid "" #~ "\n" @@ -5035,297 +10201,6 @@ msgstr "" #~ " <key-property name=\"dependent\"/>\n" #~ "</composite-id>" -#, fuzzy -#~ msgid "" -#~ "]]>" -#~ msgstr "" -#~ "<discriminator\n" -#~ " column=\"discriminator_column\"\n" -#~ " type=\"discriminator_type\"\n" -#~ " force=\"true|false\"\n" -#~ " insert=\"true|false\"\n" -#~ " formula=\"arbitrary sql expression\"\n" -#~ "/>" - -#, fuzzy -#~ msgid "" -#~ "]]>" -#~ msgstr "" -#~ "<discriminator\n" -#~ " formula=\"case when CLASS_TYPE in ('a', 'b', 'c') then 0 else 1 end" -#~ "\"\n" -#~ " type=\"integer\"/>" - -#, fuzzy -#~ msgid "" -#~ "]]>" -#~ msgstr "" -#~ "<version\n" -#~ " column=\"version_column\"\n" -#~ " name=\"propertyName\"\n" -#~ " type=\"typename\"\n" -#~ " access=\"field|property|ClassName\"\n" -#~ " unsaved-value=\"null|negative|undefined\"\n" -#~ " generated=\"never|always\"\n" -#~ " insert=\"true|false\"\n" -#~ " node=\"element-name|@attribute-name|element/@attribute|.\"\n" -#~ "/>" - -#, fuzzy -#~ msgid "" -#~ "]]>" -#~ msgstr "" -#~ "<timestamp\n" -#~ " column=\"timestamp_column\"\n" -#~ " name=\"propertyName\"\n" -#~ " access=\"field|property|ClassName\"\n" -#~ " unsaved-value=\"null|undefined\"\n" -#~ " source=\"vm|db\"\n" -#~ " generated=\"never|always\"\n" -#~ " node=\"element-name|@attribute-name|element/@attribute|.\"\n" -#~ "/>" - -#, fuzzy -#~ msgid "" -#~ "]]>" -#~ msgstr "" -#~ "<property\n" -#~ " name=\"propertyName\"\n" -#~ " column=\"column_name\"\n" -#~ " type=\"typename\"\n" -#~ " update=\"true|false\"\n" -#~ " insert=\"true|false\"\n" -#~ " formula=\"arbitrary SQL expression\"\n" -#~ " access=\"field|property|ClassName\"\n" -#~ " lazy=\"true|false\"\n" -#~ " unique=\"true|false\"\n" -#~ " not-null=\"true|false\"\n" -#~ " optimistic-lock=\"true|false\"\n" -#~ " generated=\"never|insert|always\"\n" -#~ " node=\"element-name|@attribute-name|element/@attribute|.\"\n" -#~ " index=\"index_name\"\n" -#~ " unique_key=\"unique_key_id\"\n" -#~ " length=\"L\"\n" -#~ " precision=\"P\"\n" -#~ " scale=\"S\"\n" -#~ "/>" - -#, fuzzy -#~ msgid "" -#~ "]]>" -#~ msgstr "" -#~ "<property name=\"totalPrice\"\n" -#~ " formula=\"( SELECT SUM (li.quantity*p.price) FROM LineItem li, " -#~ "Product p\n" -#~ " WHERE li.productId = p.productId\n" -#~ " AND li.customerId = customerId\n" -#~ " AND li.orderNumber = orderNumber )\"/>" - -#, fuzzy -#~ msgid "" -#~ "]]>" -#~ msgstr "" -#~ "<many-to-one\n" -#~ " name=\"propertyName\"\n" -#~ " column=\"column_name\"\n" -#~ " class=\"ClassName\"\n" -#~ " cascade=\"cascade_style\"\n" -#~ " fetch=\"join|select\"\n" -#~ " update=\"true|false\"\n" -#~ " insert=\"true|false\"\n" -#~ " property-ref=\"propertyNameFromAssociatedClass\"\n" -#~ " access=\"field|property|ClassName\"\n" -#~ " unique=\"true|false\"\n" -#~ " not-null=\"true|false\"\n" -#~ " optimistic-lock=\"true|false\"\n" -#~ " lazy=\"proxy|no-proxy|false\"\n" -#~ " not-found=\"ignore|exception\"\n" -#~ " entity-name=\"EntityName\"\n" -#~ " formula=\"arbitrary SQL expression\"\n" -#~ " node=\"element-name|@attribute-name|element/@attribute|.\"\n" -#~ " embed-xml=\"true|false\"\n" -#~ " index=\"index_name\"\n" -#~ " unique_key=\"unique_key_id\"\n" -#~ " foreign-key=\"foreign_key_name\"\n" -#~ "/>" - -#, fuzzy -#~ msgid "" -#~ "]]>" -#~ msgstr "" -#~ "<many-to-one name=\"product\" class=\"Product\" column=\"PRODUCT_ID\"/" -#~ ">" - -#, fuzzy -#~ msgid "" -#~ "]]>" -#~ msgstr "" -#~ "<property name=\"serialNumber\" unique=\"true\" type=\"string\" column=" -#~ "\"SERIAL_NUMBER\"/>" - -#, fuzzy -#~ msgid "" -#~ "]]>" -#~ msgstr "" -#~ "<many-to-one name=\"product\" property-ref=\"serialNumber\" column=" -#~ "\"PRODUCT_SERIAL_NUMBER\"/>" - -#, fuzzy -#~ msgid "" -#~ "]]>" -#~ msgstr "" -#~ "<many-to-one name=\"owner\" property-ref=\"identity.ssn\" column=" -#~ "\"OWNER_SSN\"/>" - -#, fuzzy -#~ msgid "" -#~ "]]>" -#~ msgstr "" -#~ "<one-to-one\n" -#~ " name=\"propertyName\"\n" -#~ " class=\"ClassName\"\n" -#~ " cascade=\"cascade_style\"\n" -#~ " constrained=\"true|false\"\n" -#~ " fetch=\"join|select\"\n" -#~ " property-ref=\"propertyNameFromAssociatedClass\"\n" -#~ " access=\"field|property|ClassName\"\n" -#~ " formula=\"any SQL expression\"\n" -#~ " lazy=\"proxy|no-proxy|false\"\n" -#~ " entity-name=\"EntityName\"\n" -#~ " node=\"element-name|@attribute-name|element/@attribute|.\"\n" -#~ " embed-xml=\"true|false\"\n" -#~ " foreign-key=\"foreign_key_name\"\n" -#~ "/>" - -#, fuzzy -#~ msgid "]]>" -#~ msgstr "<one-to-one name=\"person\" class=\"Person\"/>" - -#, fuzzy -#~ msgid "" -#~ "]]>" -#~ msgstr "" -#~ "<one-to-one name=\"employee\" class=\"Employee\" constrained=\"true\"/" -#~ ">" - -#, fuzzy -#~ msgid "" -#~ "\n" -#~ " \n" -#~ " \n" -#~ " employee\n" -#~ " \n" -#~ " \n" -#~ " ...\n" -#~ " \n" -#~ "]]>" -#~ msgstr "" -#~ "<class name=\"person\" table=\"PERSON\">\n" -#~ " <id name=\"id\" column=\"PERSON_ID\">\n" -#~ " <generator class=\"foreign\">\n" -#~ " <param name=\"property\">employee</param>\n" -#~ " </generator>\n" -#~ " </id>\n" -#~ " ...\n" -#~ " <one-to-one name=\"employee\"\n" -#~ " class=\"Employee\"\n" -#~ " constrained=\"true\"/>\n" -#~ "</class>" - #, fuzzy #~ msgid "" #~ "\n" -#~ " \n" -#~ " \n" -#~ " ......\n" -#~ "]]>" -#~ msgstr "" -#~ "<natural-id mutable=\"true|false\"/>\n" -#~ " <property ... />\n" -#~ " <many-to-one ... />\n" -#~ " ......\n" -#~ "</natural-id>" - -#, fuzzy -#~ msgid "" -#~ "\n" -#~ "\n" -#~ " \n" -#~ " \n" -#~ " ........\n" -#~ "]]>" -#~ msgstr "" -#~ "<component \n" -#~ " name=\"propertyName\" \n" -#~ " class=\"className\"\n" -#~ " insert=\"true|false\"\n" -#~ " update=\"true|false\"\n" -#~ " access=\"field|property|ClassName\"\n" -#~ " lazy=\"true|false\"\n" -#~ " optimistic-lock=\"true|false\"\n" -#~ " unique=\"true|false\"\n" -#~ " node=\"element-name|.\"\n" -#~ ">\n" -#~ " \n" -#~ " <property ...../>\n" -#~ " <many-to-one .... />\n" -#~ " ........\n" -#~ "</component>" - -#, fuzzy -#~ msgid "" -#~ "\n" -#~ "\n" -#~ " \n" -#~ " \n" -#~ " ........\n" -#~ "]]>" -#~ msgstr "" -#~ "<properties \n" -#~ " name=\"logicalName\" \n" -#~ " insert=\"true|false\"\n" -#~ " update=\"true|false\"\n" -#~ " optimistic-lock=\"true|false\"\n" -#~ " unique=\"true|false\"\n" -#~ ">\n" -#~ " \n" -#~ " <property ...../>\n" -#~ " <many-to-one .... />\n" -#~ " ........\n" -#~ "</properties>" - -#, fuzzy -#~ msgid "" -#~ "\n" -#~ " \n" -#~ "\n" -#~ " ...\n" -#~ " \n" -#~ " \n" -#~ " \n" -#~ " \n" -#~ " \n" -#~ "]]>" -#~ msgstr "" -#~ "<class name=\"Person\">\n" -#~ " <id name=\"personNumber\"/>\n" -#~ " ...\n" -#~ " <properties name=\"name\" \n" -#~ " unique=\"true\" update=\"false\">\n" -#~ " <property name=\"firstName\"/>\n" -#~ " <property name=\"initial\"/>\n" -#~ " <property name=\"lastName\"/>\n" -#~ " </properties>\n" -#~ "</class>" - -#, fuzzy -#~ msgid "" -#~ "\n" -#~ " \n" -#~ " \n" -#~ " \n" -#~ "]]>" -#~ msgstr "" -#~ "<many-to-one name=\"person\" \n" -#~ " class=\"Person\" property-ref=\"name\">\n" -#~ " <column name=\"firstName\"/>\n" -#~ " <column name=\"initial\"/>\n" -#~ " <column name=\"lastName\"/>\n" -#~ "</many-to-one>" - -#, fuzzy -#~ msgid "" -#~ "\n" -#~ "\n" -#~ " \n" -#~ " .....\n" -#~ "]]>" -#~ msgstr "" -#~ "<subclass\n" -#~ " name=\"ClassName\"\n" -#~ " discriminator-value=\"discriminator_value\"\n" -#~ " proxy=\"ProxyInterface\"\n" -#~ " lazy=\"true|false\"\n" -#~ " dynamic-update=\"true|false\"\n" -#~ " dynamic-insert=\"true|false\"\n" -#~ " entity-name=\"EntityName\"\n" -#~ " node=\"element-name\"\n" -#~ " extends=\"SuperclassName\">\n" -#~ "\n" -#~ " <property .... />\n" -#~ " .....\n" -#~ "</subclass>" - -#, fuzzy -#~ msgid "" -#~ "\n" -#~ "\n" -#~ " \n" -#~ "\n" -#~ " \n" -#~ " .....\n" -#~ "]]>" -#~ msgstr "" -#~ "<joined-subclass\n" -#~ " name=\"ClassName\"\n" -#~ " table=\"tablename\"\n" -#~ " proxy=\"ProxyInterface\"\n" -#~ " lazy=\"true|false\"\n" -#~ " dynamic-update=\"true|false\"\n" -#~ " dynamic-insert=\"true|false\"\n" -#~ " schema=\"schema\"\n" -#~ " catalog=\"catalog\"\n" -#~ " extends=\"SuperclassName\"\n" -#~ " persister=\"ClassName\"\n" -#~ " subselect=\"SQL expression\"\n" -#~ " entity-name=\"EntityName\"\n" -#~ " node=\"element-name\">\n" -#~ "\n" -#~ " <key .... >\n" -#~ "\n" -#~ " <property .... />\n" -#~ " .....\n" -#~ "</joined-subclass>" - -#, fuzzy -#~ msgid "" -#~ "\n" -#~ "\n" -#~ "\n" -#~ "\n" -#~ "\n" -#~ " \n" -#~ " \n" -#~ " \n" -#~ " \n" -#~ " \n" -#~ " \n" -#~ " \n" -#~ " \n" -#~ " \n" -#~ " \n" -#~ " \n" -#~ " \n" -#~ " \n" -#~ " \n" -#~ " \n" -#~ " \n" -#~ " \n" -#~ " \n" -#~ "\n" -#~ " \n" -#~ " \n" -#~ " \n" -#~ "\n" -#~ "]]>" -#~ msgstr "" -#~ "<?xml version=\"1.0\"?>\n" -#~ "<!DOCTYPE hibernate-mapping PUBLIC\n" -#~ " \"-//Hibernate/Hibernate Mapping DTD//EN\"\n" -#~ " \"http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd" -#~ "\">\n" -#~ "\n" -#~ "<hibernate-mapping package=\"eg\">\n" -#~ "\n" -#~ " <class name=\"Cat\" table=\"CATS\">\n" -#~ " <id name=\"id\" column=\"uid\" type=\"long\">\n" -#~ " <generator class=\"hilo\"/>\n" -#~ " </id>\n" -#~ " <property name=\"birthdate\" type=\"date\"/>\n" -#~ " <property name=\"color\" not-null=\"true\"/>\n" -#~ " <property name=\"sex\" not-null=\"true\"/>\n" -#~ " <property name=\"weight\"/>\n" -#~ " <many-to-one name=\"mate\"/>\n" -#~ " <set name=\"kittens\">\n" -#~ " <key column=\"MOTHER\"/>\n" -#~ " <one-to-many class=\"Cat\"/>\n" -#~ " </set>\n" -#~ " <joined-subclass name=\"DomesticCat\" table=" -#~ "\"DOMESTIC_CATS\">\n" -#~ " <key column=\"CAT\"/>\n" -#~ " <property name=\"name\" type=\"string\"/>\n" -#~ " </joined-subclass>\n" -#~ " </class>\n" -#~ "\n" -#~ " <class name=\"eg.Dog\">\n" -#~ " <!-- mapping for Dog could go here -->\n" -#~ " </class>\n" -#~ "\n" -#~ "</hibernate-mapping>" - -#, fuzzy -#~ msgid "" -#~ "\n" -#~ "\n" -#~ " \n" -#~ " .....\n" -#~ "]]>" -#~ msgstr "" -#~ "<union-subclass\n" -#~ " name=\"ClassName\"\n" -#~ " table=\"tablename\"\n" -#~ " proxy=\"ProxyInterface\"\n" -#~ " lazy=\"true|false\"\n" -#~ " dynamic-update=\"true|false\"\n" -#~ " dynamic-insert=\"true|false\"\n" -#~ " schema=\"schema\"\n" -#~ " catalog=\"catalog\"\n" -#~ " extends=\"SuperclassName\"\n" -#~ " abstract=\"true|false\"\n" -#~ " persister=\"ClassName\"\n" -#~ " subselect=\"SQL expression\"\n" -#~ " entity-name=\"EntityName\"\n" -#~ " node=\"element-name\">\n" -#~ "\n" -#~ " <property .... />\n" -#~ " .....\n" -#~ "</union-subclass>" - -#, fuzzy -#~ msgid "" -#~ "\n" -#~ "\n" -#~ " \n" -#~ "\n" -#~ " \n" -#~ " ...\n" -#~ "]]>" -#~ msgstr "" -#~ "<join\n" -#~ " table=\"tablename\"\n" -#~ " schema=\"owner\"\n" -#~ " catalog=\"catalog\"\n" -#~ " fetch=\"join|select\"\n" -#~ " inverse=\"true|false\"\n" -#~ " optional=\"true|false\">\n" -#~ " \n" -#~ " <key ... />\n" -#~ " \n" -#~ " <property ... />\n" -#~ " ...\n" -#~ "</join>" - -#, fuzzy -#~ msgid "" -#~ "\n" -#~ "\n" -#~ " ...\n" -#~ "\n" -#~ " \n" -#~ " \n" -#~ " \n" -#~ " \n" -#~ " \n" -#~ " \n" -#~ " ...]]>" -#~ msgstr "" -#~ "<class name=\"Person\"\n" -#~ " table=\"PERSON\">\n" -#~ "\n" -#~ " <id name=\"id\" column=\"PERSON_ID\">...</id>\n" -#~ "\n" -#~ " <join table=\"ADDRESS\">\n" -#~ " <key column=\"ADDRESS_ID\"/>\n" -#~ " <property name=\"address\"/>\n" -#~ " <property name=\"zip\"/>\n" -#~ " <property name=\"country\"/>\n" -#~ " </join>\n" -#~ " ..." - -#, fuzzy -#~ msgid "Key" -#~ msgstr "key" - -#, fuzzy -#~ msgid "" -#~ "]]>" -#~ msgstr "" -#~ "<key\n" -#~ " column=\"columnname\"\n" -#~ " on-delete=\"noaction|cascade\"\n" -#~ " property-ref=\"propertyName\"\n" -#~ " not-null=\"true|false\"\n" -#~ " update=\"true|false\"\n" -#~ " unique=\"true|false\"\n" -#~ "/>" - -#, fuzzy -#~ msgid "" -#~ "]]>" -#~ msgstr "" -#~ "<column\n" -#~ " name=\"column_name\"\n" -#~ " length=\"N\"\n" -#~ " precision=\"N\"\n" -#~ " scale=\"N\"\n" -#~ " not-null=\"true|false\"\n" -#~ " unique=\"true|false\"\n" -#~ " unique-key=\"multicolumn_unique_key_name\"\n" -#~ " index=\"index_name\"\n" -#~ " sql-type=\"sql_type_name\"\n" -#~ " check=\"SQL expression\"\n" -#~ " default=\"SQL expression\"/>" - -#, fuzzy -#~ msgid "SQL expression]]>" -#~ msgstr "<formula>SQL expression</formula>" - -#, fuzzy -#~ msgid "" -#~ "\n" -#~ " \n" -#~ " 'MAILING'\n" -#~ "]]>" -#~ msgstr "" -#~ "<many-to-one name=\"homeAddress\" class=\"Address\"\n" -#~ " insert=\"false\" update=\"false\">\n" -#~ " <column name=\"person_id\" not-null=\"true\" length=\"10\"/>\n" -#~ " <formula>'MAILING'</formula>\n" -#~ "</many-to-one>" - -#, fuzzy -#~ msgid "]]>" -#~ msgstr "<import class=\"java.lang.Object\" rename=\"Universe\"/>" - -#, fuzzy -#~ msgid "" -#~ "]]>" -#~ msgstr "" -#~ "<import\n" -#~ " class=\"ClassName\"\n" -#~ " rename=\"ShortName\"\n" -#~ "/>" - -#, fuzzy -#~ msgid "Any" -#~ msgstr "any" - -#, fuzzy -#~ msgid "" -#~ "\n" -#~ " \n" -#~ " \n" -#~ " \n" -#~ " \n" -#~ " \n" -#~ "]]>" -#~ msgstr "" -#~ "<any name=\"being\" id-type=\"long\" meta-type=\"string\">\n" -#~ " <meta-value value=\"TBL_ANIMAL\" class=\"Animal\"/>\n" -#~ " <meta-value value=\"TBL_HUMAN\" class=\"Human\"/>\n" -#~ " <meta-value value=\"TBL_ALIEN\" class=\"Alien\"/>\n" -#~ " <column name=\"table_name\"/>\n" -#~ " <column name=\"id\"/>\n" -#~ "</any>" - -#, fuzzy -#~ msgid "" -#~ "\n" -#~ " \n" -#~ " \n" -#~ " .....\n" -#~ " \n" -#~ " \n" -#~ " .....\n" -#~ "]]>" -#~ msgstr "" -#~ "<any\n" -#~ " name=\"propertyName\"\n" -#~ " id-type=\"idtypename\"\n" -#~ " meta-type=\"metatypename\"\n" -#~ " cascade=\"cascade_style\"\n" -#~ " access=\"field|property|ClassName\"\n" -#~ " optimistic-lock=\"true|false\"\n" -#~ ">\n" -#~ " <meta-value ... />\n" -#~ " <meta-value ... />\n" -#~ " .....\n" -#~ " <column .... />\n" -#~ " <column .... />\n" -#~ " .....\n" -#~ "</any>" - -#~ msgid "string" -#~ msgstr "string" - -#, fuzzy -#~ msgid "class" -#~ msgstr "subclass" - -#~ msgid "binary" -#~ msgstr "binary" - -#~ msgid "text" -#~ msgstr "text" - -#~ msgid "serializable" -#~ msgstr "serializable" - -#~ msgid "clob, blob" -#~ msgstr "clob, blob" - -#, fuzzy -#~ msgid "" -#~ "\n" -#~ " \n" -#~ " \n" -#~ "]]>" -#~ msgstr "" -#~ "<property name=\"twoStrings\" type=\"org.hibernate.test." -#~ "DoubleStringType\">\n" -#~ " <column name=\"first_string\"/>\n" -#~ " <column name=\"second_string\"/>\n" -#~ "</property>" - -#, fuzzy -#~ msgid "" -#~ "\n" -#~ " \n" -#~ " 0\n" -#~ " \n" -#~ "]]>" -#~ msgstr "" -#~ "<property name=\"priority\">\n" -#~ " <type name=\"com.mycompany.usertypes.DefaultValueIntegerType" -#~ "\">\n" -#~ " <param name=\"default\">0</param>\n" -#~ " </type>\n" -#~ "</property>" - -#, fuzzy -#~ msgid "" -#~ "\n" -#~ " 0\n" -#~ "]]>" -#~ msgstr "" -#~ "<typedef class=\"com.mycompany.usertypes.DefaultValueIntegerType\" " -#~ "name=\"default_zero\">\n" -#~ " <param name=\"default\">0</param>\n" -#~ "</typedef>" - -#, fuzzy -#~ msgid "]]>" -#~ msgstr "<property name=\"priority\" type=\"default_zero\"/>" - -#, fuzzy -#~ msgid "" -#~ "\n" -#~ " ...\n" -#~ " \n" -#~ " \n" -#~ " \n" -#~ " \n" -#~ "\n" -#~ "\n" -#~ "\n" -#~ " ...\n" -#~ " \n" -#~ "]]>" -#~ msgstr "" -#~ "<class name=\"Contract\" table=\"Contracts\" \n" -#~ " entity-name=\"CurrentContract\">\n" -#~ " ...\n" -#~ " <set name=\"history\" inverse=\"true\" \n" -#~ " order-by=\"effectiveEndDate desc\">\n" -#~ " <key column=\"currentContractId\"/>\n" -#~ " <one-to-many entity-name=\"HistoricalContract\"/>\n" -#~ " </set>\n" -#~ "</class>\n" -#~ "\n" -#~ "<class name=\"Contract\" table=\"ContractHistory\" \n" -#~ " entity-name=\"HistoricalContract\">\n" -#~ " ...\n" -#~ " <many-to-one name=\"currentContract\" \n" -#~ " column=\"currentContractId\" \n" -#~ " entity-name=\"CurrentContract\"/>\n" -#~ "</class>" - -#, fuzzy -#~ msgid "" -#~ "\n" -#~ " \n" -#~ " \n" -#~ " ...\n" -#~ "]]>" -#~ msgstr "" -#~ "<class name=\"LineItem\" table=\"`Line Item`\">\n" -#~ " <id name=\"id\" column=\"`Item Id`\"/><generator class=" -#~ "\"assigned\"/></id>\n" -#~ " <property name=\"itemNumber\" column=\"`Item #`\"/>\n" -#~ " ...\n" -#~ "</class>" - #, fuzzy #~ msgid "" #~ "\n" -#~ " ...\n" -#~ " \n" -#~ " CREATE TRIGGER my_trigger ...\n" -#~ " DROP TRIGGER my_trigger\n" -#~ " \n" -#~ "]]>" -#~ msgstr "" -#~ "<hibernate-mapping>\n" -#~ " ...\n" -#~ " <database-object>\n" -#~ " <create>CREATE TRIGGER my_trigger ...</create>\n" -#~ " <drop>DROP TRIGGER my_trigger</drop>\n" -#~ " </database-object>\n" -#~ "</hibernate-mapping>" - -#, fuzzy -#~ msgid "" -#~ "\n" -#~ " ...\n" -#~ " \n" -#~ " \n" -#~ " \n" -#~ "]]>" -#~ msgstr "" -#~ "<hibernate-mapping>\n" -#~ " ...\n" -#~ " <database-object>\n" -#~ " <definition class=\"MyTriggerDefinition\"/>\n" -#~ " </database-object>\n" -#~ "</hibernate-mapping>" - -#, fuzzy -#~ msgid "" -#~ "\n" -#~ " ...\n" -#~ " \n" -#~ " \n" -#~ " \n" -#~ " \n" -#~ " \n" -#~ "]]>" -#~ msgstr "" -#~ "<hibernate-mapping>\n" -#~ " ...\n" -#~ " <database-object>\n" -#~ " <definition class=\"MyTriggerDefinition\"/>\n" -#~ " <dialect-scope name=\"org.hibernate.dialect.Oracle9Dialect\"/" -#~ ">\n" -#~ " <dialect-scope name=\"org.hibernate.dialect.OracleDialect\"/" -#~ ">\n" -#~ " </database-object>\n" -#~ "</hibernate-mapping>" diff --git a/documentation/manual/src/main/docbook/de-DE/content/collection_mapping.po b/documentation/manual/src/main/docbook/de-DE/content/collection_mapping.po index cdec4555a8..1e1c0bf29e 100644 --- a/documentation/manual/src/main/docbook/de-DE/content/collection_mapping.po +++ b/documentation/manual/src/main/docbook/de-DE/content/collection_mapping.po @@ -275,7 +275,7 @@ msgid "" msgstr "" "Project-Id-Version: Collection_Mapping\n" "Report-Msgid-Bugs-To: http://bugs.kde.org\n" -"POT-Creation-Date: 2010-02-10T07:25:34\n" +"POT-Creation-Date: 2010-07-20 21:02+0000\n" "PO-Revision-Date: 2007-02-26 10:27+1000\n" "Last-Translator: \n" "Language-Team: \n" @@ -285,33 +285,52 @@ msgstr "" "X-Generator: KBabel 1.9.1\n" #. Tag: title +#: collection_mapping.xml:31 #, fuzzy, no-c-format msgid "Collection mapping" msgstr "Collection-Mappings" #. Tag: title +#: collection_mapping.xml:34 #, no-c-format msgid "Persistent collections" msgstr "Persistente Collections" #. Tag: para +#: collection_mapping.xml:36 #, fuzzy, no-c-format msgid "" -"Hibernate requires that persistent collection-valued fields be declared as " -"an interface type. For example:" +"Naturally Hibernate also allows to persist collections. These persistent " +"collections can contain almost any other Hibernate type, including: basic " +"types, custom types, components and references to other entities. The " +"distinction between value and reference semantics is in this context very " +"important. An object in a collection might be handled with \"value\" " +"semantics (its life cycle fully depends on the collection owner), or it " +"might be a reference to another entity with its own life cycle. In the " +"latter case, only the \"link\" between the two objects is considered to be a " +"state held by the collection." msgstr "" -"In Hibernate müssen persistente Collection-wertige Felder als Interface-Typ " -"deklariert werden, zum Beispiel:" +"Collections können fast jeden beliebigen anderen Hibernate-Typ enthalten, " +"einschließlich sämtlicher Grundtypen, angepasster Typen, Komponenten und " +"natürlich Referenzen zu anderen Entities. Das ist ein wichtiger Unterschied: " +"Ein Objekt einer Collection könnte mit \"Wert\"semantik bearbeitet werden " +"(sein Lebenszyklus hängt vollständig vom Besitzer der Collection ab) oder es " +"könnte ein Verweis auf eine andere Entity mit ihrem eigenen Lebenszyklus " +"sein. Im letzteren Fall wird nur die \"Verbindung\" zwischen den beiden " +"Objekten als von der Collection gehaltener Status angesehen." #. Tag: para +#: collection_mapping.xml:46 #, fuzzy, no-c-format msgid "" -"The actual interface might be java.util.Set, " +"As a requirement persistent collection-valued fields must be declared as an " +"interface type (see ). The actual interface might be java.util.Set, " "java.util.Collection, java.util.List, " "java.util.Map, java.util.SortedSet, " "java.util.SortedMap or anything you like (\"anything you " "like\" means you will have to write an implementation of org." -"hibernate.usertype.UserCollectionType.)" +"hibernate.usertype.UserCollectionType)." msgstr "" "Das tatsächliche Interface könnte java.util.Set, " "java.util.Collection, java.util.List, " @@ -322,15 +341,17 @@ msgstr "" "schreiben müssen)." #. Tag: para +#: collection_mapping.xml:57 #, fuzzy, no-c-format msgid "" -"Notice how the instance variable was initialized with an instance of " -"HashSet. This is the best way to initialize collection " +"Notice how in the " +"instance variable parts was initialized with an instance " +"of HashSet. This is the best way to initialize collection " "valued properties of newly instantiated (non-persistent) instances. When you " -"make the instance persistent, by calling persist() for " -"example, Hibernate will actually replace the HashSet with " -"an instance of Hibernate's own implementation of Set. Be " -"aware of the following errors:" +"make the instance persistent, by calling persist(), " +"Hibernate will actually replace the HashSet with an " +"instance of Hibernate's own implementation of Set. Be " +"aware of the following error:" msgstr "" "Beachten Sie, wie wir die Instanzvariable mit einer Instanz von " "HashSet initialisiert haben. Dieses ist die beste Art, " @@ -340,7 +361,39 @@ msgstr "" "literal> durch eine Instanz seiner eigenen Implementierung von Set ersetzen. Achten Sie auf mögliche Fehler wie den folgenden:" +#. Tag: title +#: collection_mapping.xml:68 +#, no-c-format +msgid "Hibernate uses its own collection implementations" +msgstr "" + +#. Tag: programlisting +#: collection_mapping.xml:70 +#, fuzzy, no-c-format +msgid "" +"Cat cat = new DomesticCat();\n" +"Cat kitten = new DomesticCat();\n" +"....\n" +"Set kittens = new HashSet();\n" +"kittens.add(kitten);\n" +"cat.setKittens(kittens);\n" +"session.persist(cat);\n" +"\n" +"kittens = cat.getKittens(); // Okay, kittens collection is a Set\n" +"(HashSet) cat.getKittens(); // Error!" +msgstr "" +"Cat cat = new DomesticCat();\n" +"Cat kitten = new DomesticCat();\n" +"....\n" +"Set kittens = new HashSet();\n" +"kittens.add(kitten);\n" +"cat.setKittens(kittens);\n" +"session.persist(cat);\n" +"kittens = cat.getKittens(); // Okay, kittens collection is a Set\n" +"(HashSet) cat.getKittens(); // Error!" + #. Tag: para +#: collection_mapping.xml:73 #, fuzzy, no-c-format msgid "" "The persistent collections injected by Hibernate behave like " @@ -354,6 +407,7 @@ msgstr "" "ArrayList." #. Tag: para +#: collection_mapping.xml:78 #, fuzzy, no-c-format msgid "" "Collections instances have the usual behavior of value types. They are " @@ -377,11 +431,12 @@ msgstr "" "Collection-Verweis und einer leeren Collection." #. Tag: para +#: collection_mapping.xml:89 #, fuzzy, no-c-format msgid "" "Use persistent collections the same way you use ordinary Java collections. " -"However, please ensure you understand the semantics of bidirectional " -"associations (these are discussed later)." +"However, ensure you understand the semantics of bidirectional associations " +"(see )." msgstr "" "Sie werden mit all dem jedoch meist wenig zu tun haben. Verwenden Sie " "persistente Collections genau so, wie sie reguläre Java-Collections " @@ -390,44 +445,311 @@ msgstr "" "ein)." #. Tag: title +#: collection_mapping.xml:97 +#, fuzzy, no-c-format +msgid "How to map collections" +msgstr "Sortierte Collections" + +#. Tag: para +#: collection_mapping.xml:99 #, no-c-format -msgid "Collection mappings" -msgstr "Collection-Mappings" - -#. Tag: para -#, fuzzy, no-c-format msgid "" -"There are quite a range of mappings that can be generated for collections " -"that cover many common relational models. We suggest you experiment with the " -"schema generation tool so that you understand how various mapping " -"declarations translate to database tables." +"Using annotations you can map Collections, " +"Lists, Maps and " +"Sets of associated entities using @OneToMany and " +"@ManyToMany. For collections of a basic or embeddable type use " +"@ElementCollection. In the simplest case a collection mapping looks like " +"this:" msgstr "" -"Es gibt eine ganze Reihe von Mappings, die für Collections generiert werden " -"können und die zahlreiche gängige relationale Modelle abdecken. Es ist " -"wahrscheinlich sinnvoll, wenn Sie mit dem Tool zur Schemagenerierung " -"experimentieren, um zu sehen, wie die verschiedenen Mapping-Deklarationen " -"bei Datenbanktabellen umgesetzt werden." -#. Tag: para +#. Tag: title +#: collection_mapping.xml:107 +#, no-c-format +msgid "Collection mapping using @OneToMany and @JoinColumn" +msgstr "" + +#. Tag: programlisting +#: collection_mapping.xml:109 #, fuzzy, no-c-format msgid "" -"The Hibernate mapping element used for mapping a collection depends upon the " -"type of interface. For example, a <set> element is " -"used for mapping properties of type Set." +"@Entity\n" +"public class Product {\n" +"\n" +" private String serialNumber;\n" +" private Set<Part> parts = new HashSet<Part>();\n" +"\n" +" @Id\n" +" public String getSerialNumber() { return serialNumber; }\n" +" void setSerialNumber(String sn) { serialNumber = sn; }\n" +" \n" +" @OneToMany\n" +" @JoinColumn(name=\"PART_ID\")\n" +" public Set<Part> getParts() { return parts; }\n" +" void setParts(Set parts) { this.parts = parts; }\n" +"}\n" +"\n" +"\n" +"@Entity\n" +"public class Part {\n" +" ...\n" +"}" +msgstr "" +"public class Product {\n" +" private String serialNumber;\n" +" private Set parts = new HashSet();\n" +" \n" +" public Set getParts() { return parts; }\n" +" void setParts(Set parts) { this.parts = parts; }\n" +" public String getSerialNumber() { return serialNumber; }\n" +" void setSerialNumber(String sn) { serialNumber = sn; }\n" +"}" + +#. Tag: para +#: collection_mapping.xml:112 +#, no-c-format +msgid "" +"Product describes a unidirectional relationship with Part using the join " +"column PART_ID. In this unidirectional one to many scenario you can also use " +"a join table as seen in ." +msgstr "" + +#. Tag: title +#: collection_mapping.xml:118 +#, no-c-format +msgid "Collection mapping using @OneToMany and @JoinTable" +msgstr "" + +#. Tag: programlisting +#: collection_mapping.xml:121 +#, no-c-format +msgid "" +"@Entity\n" +"public class Product {\n" +"\n" +" private String serialNumber;\n" +" private Set<Part> parts = new HashSet<Part>();\n" +"\n" +" @Id\n" +" public String getSerialNumber() { return serialNumber; }\n" +" void setSerialNumber(String sn) { serialNumber = sn; }\n" +" \n" +" @OneToMany\n" +" @JoinTable(\n" +" name=\"PRODUCT_PARTS\",\n" +" joinColumns = @JoinColumn( name=\"PRODUCT_ID\"),\n" +" inverseJoinColumns = @JoinColumn( name=\"PART_ID\")\n" +" )\n" +" public Set<Part> getParts() { return parts; }\n" +" void setParts(Set parts) { this.parts = parts; }\n" +"}\n" +"\n" +"\n" +"@Entity\n" +"public class Part {\n" +" ...\n" +"}" +msgstr "" + +#. Tag: para +#: collection_mapping.xml:124 +#, no-c-format +msgid "" +"Without describing any physical mapping (no @JoinColumn or @JoinTable), a unidirectional one to " +"many with join table is used. The table name is the concatenation of the " +"owner table name, _, and the other side table name. The foreign key name(s) " +"referencing the owner table is the concatenation of the owner table, _, and " +"the owner primary key column(s) name. The foreign key name(s) referencing " +"the other side is the concatenation of the owner property name, _, and the " +"other side primary key column(s) name. A unique constraint is added to the " +"foreign key referencing the other side table to reflect the one to many." +msgstr "" + +#. Tag: para +#: collection_mapping.xml:135 +#, fuzzy, no-c-format +msgid "" +"Lets have a look now how collections are mapped using Hibernate mapping " +"files. In this case the first step is to chose the right mapping element. It " +"depends on the type of interface. For example, a <set> element is used for mapping properties of type Set." msgstr "" "Das Hibernate Mapping-Element, das für das Mapping einer Collection " "verwendet wird, hängt vom Typ des Interface ab. Zum Beispiel wird ein " "<set>-Element für Mapping-Properties des Typs " "Set verwendet." +#. Tag: title +#: collection_mapping.xml:142 +#, no-c-format +msgid "Mapping a Set using <set>" +msgstr "" + +#. Tag: programlisting +#: collection_mapping.xml:144 +#, fuzzy, no-c-format +msgid "" +"<class name=\"Product\">\n" +" <id name=\"serialNumber\" column=\"productSerialNumber\"/>\n" +" <set name=\"parts\">\n" +" <key column=\"productSerialNumber\" not-null=\"true\"/>\n" +" <one-to-many class=\"Part\"/>\n" +" </set>\n" +"</class>" +msgstr "" +"<class name=\"Product\">\n" +" <id name=\"serialNumber\" column=\"productSerialNumber\"/>\n" +" <set name=\"parts\">\n" +" <key column=\"productSerialNumber\" not-null=\"true\"/>\n" +" <one-to-many class=\"Part\"/>\n" +" </set>\n" +"</class>" + #. Tag: para +#: collection_mapping.xml:147 +#, fuzzy, no-c-format +msgid "" +"In a one-to-many " +"association links the Product and " +"Part entities. This association requires the existence of " +"a foreign key column and possibly an index column to the Part table. This mapping loses certain semantics of normal Java " +"collections:" +msgstr "" +"Eine Assoziation von Product zu Part " +"macht die Existenz einer Spalte mit Fremdschlüssel und möglicherweise einer " +"Indexspalte zur Part-Tabelle erforderlich. Ein " +"<one-to-many>-Tag zeigt an, dass dies eine \"One-to-" +"Many\"-Assoziation ist." + +#. Tag: para +#: collection_mapping.xml:156 +#, fuzzy, no-c-format +msgid "" +"An instance of the contained entity class cannot belong to more than one " +"instance of the collection." +msgstr "" +"Eine Instanz der enthaltenen Entity-Klasse kann nicht zu mehr als einer " +"Instanz der Collection gehören" + +#. Tag: para +#: collection_mapping.xml:161 +#, fuzzy, no-c-format +msgid "" +"An instance of the contained entity class cannot appear at more than one " +"value of the collection index." +msgstr "" +"Eine Instanz der enthaltenen Entity-Klasse kann nicht an mehr als einem Wert " +"des Collection-Index erscheinen" + +#. Tag: para +#: collection_mapping.xml:166 #, no-c-format msgid "" -"Apart from <set>, there is also <" -"list>, <map>, <bag>, <array> and <primitive-" -"array> mapping elements. The <map> " -"element is representative:" +"Looking closer at the used <one-to-many> tag we see " +"that it has the following options." +msgstr "" + +#. Tag: title +#: collection_mapping.xml:170 +#, no-c-format +msgid "options of <one-to-many> element" +msgstr "" + +#. Tag: programlisting +#: collection_mapping.xml:181 +#, fuzzy, no-c-format +msgid "" +"<one-to-many\n" +" class=\"ClassName\"\n" +" not-found=\"ignore|exception\"\n" +" entity-name=\"EntityName\"\n" +" node=\"element-name\"\n" +" embed-xml=\"true|false\"\n" +" />" +msgstr "" +"<one-to-many \n" +" class=\"ClassName\"\n" +" not-found=\"ignore|exception\"\n" +" entity-name=\"EntityName\"\n" +" node=\"element-name\"\n" +" embed-xml=\"true|false\"\n" +" />" + +#. Tag: para +#: collection_mapping.xml:185 +#, fuzzy, no-c-format +msgid "class (required): the name of the associated class." +msgstr "" +"class (erforderlich): Der Name der zugehörigen Klasse." + +#. Tag: para +#: collection_mapping.xml:190 +#, fuzzy, no-c-format +msgid "" +"not-found (optional - defaults to exception): specifies how cached identifiers that reference missing rows will " +"be handled. ignore will treat a missing row as a null " +"association." +msgstr "" +"not-found (optional - standardmäßig exception): Bestimmt, wie gespeicherte Bezeichner (sog. \"Identifier\"), die " +"auf fehlende Reihen verweisen, behandelt werden. Mit ignore wird eine fehlende Reihe als Null-Assoziation angesehen." + +#. Tag: para +#: collection_mapping.xml:198 +#, fuzzy, no-c-format +msgid "" +"entity-name (optional): the entity name of the associated " +"class, as an alternative to class." +msgstr "" +"entity-name (optional): Der Entity-Name der zugehörigen " +"Klasse als Alternative zu class." + +#. Tag: para +#: collection_mapping.xml:206 +#, fuzzy, no-c-format +msgid "" +"The <one-to-many> element does not need to declare " +"any columns. Nor is it necessary to specify the table " +"name anywhere." +msgstr "" +"Beachten Sie, dass das <one-to-many>-Element keine " +"Spalten deklarieren muss. Es ist außerdem nicht nötig, den table-Namen irgendwo zu bestimmen." + +#. Tag: para +#: collection_mapping.xml:211 +#, fuzzy, no-c-format +msgid "" +"If the foreign key column of a <one-to-many> " +"association is declared NOT NULL, you must declare the " +"<key> mapping not-null=\"true\" " +"or use a bidirectional association with the collection " +"mapping marked inverse=\"true\". See ." +msgstr "" +"Sehr wichtig: Falls die Fremdschlüsselspalte einer " +"<one-to-many>-Assoziation als NOT NULL deklariert ist, müssen Sie beim <key>-" +"Mapping not-null=\"true\" deklarieren oder eine " +"bidirektionale Assoziation mit als inverse=\"true\" gekennzeichnetem Collection-Mapping verwenden. Wir gehen später in " +"diesem Kapitel noch näher auf bidirektionale Assoziationen ein." + +#. Tag: para +#: collection_mapping.xml:221 +#, fuzzy, no-c-format +msgid "" +"Apart from the <set> tag as shown in , there is also <list>, <map>, <bag>, " +"<array> and <primitive-array> mapping elements. The <map> element is " +"representative:" msgstr "" "Neben <set> gibt es auch <list>, <map>, <bag>, " @@ -435,12 +757,72 @@ msgstr "" "literal> Mapping-Elemente. Das <map>-Element ist " "charakteristisch:" +#. Tag: title +#: collection_mapping.xml:229 +#, no-c-format +msgid "Elements of the <map> mapping" +msgstr "" + +#. Tag: programlisting +#: collection_mapping.xml:262 +#, fuzzy, no-c-format +msgid "" +"<map\n" +" name=\"propertyName\"\n" +" table=\"table_name\"\n" +" schema=\"schema_name\"\n" +" lazy=\"true|extra|false\"\n" +" inverse=\"true|false\"\n" +" cascade=\"all|none|save-update|delete|all-delete-orphan|delete-orphan\"\n" +" sort=\"unsorted|natural|comparatorClass\"\n" +" order-by=\"column_name asc|desc\"\n" +" where=\"arbitrary sql where condition\"\n" +" fetch=\"join|select|subselect\"\n" +" batch-size=\"N\"\n" +" access=\"field|property|ClassName\"\n" +" optimistic-lock=\"true|false\"\n" +" mutable=\"true|false\"\n" +" node=\"element-name|.\"\n" +" embed-xml=\"true|false\"\n" +">\n" +"\n" +" <key .... />\n" +" <map-key .... />\n" +" <element .... />\n" +"</map>" +msgstr "" +"<map\n" +" name=\"propertyName\"\n" +" table=\"table_name\"\n" +" schema=\"schema_name\"\n" +" lazy=\"true|extra|false\"\n" +" inverse=\"true|false\"\n" +" cascade=\"all|none|save-update|delete|all-delete-orphan|delete-orphan\"\n" +" sort=\"unsorted|natural|comparatorClass\"\n" +" order-by=\"column_name asc|desc\"\n" +" where=\"arbitrary sql where condition\"\n" +" fetch=\"join|select|subselect\"\n" +" batch-size=\"N\"\n" +" access=\"field|property|ClassName\"\n" +" optimistic-lock=\"true|false\"\n" +" mutable=\"true|false\"\n" +" node=\"element-name|.\"\n" +" embed-xml=\"true|false\"\n" +">\n" +"\n" +" <key .... />\n" +" <map-key .... />\n" +" <element .... />\n" +"</map>" + #. Tag: para +#: collection_mapping.xml:266 #, fuzzy, no-c-format msgid "name: the collection property name" msgstr "name der Property-Name der Collection" #. Tag: para +#: collection_mapping.xml:270 #, fuzzy, no-c-format msgid "" "table (optional - defaults to property name): the name of " @@ -451,6 +833,7 @@ msgstr "" "verwendet)" #. Tag: para +#: collection_mapping.xml:276 #, fuzzy, no-c-format msgid "" "schema (optional): the name of a table schema to override " @@ -460,6 +843,7 @@ msgstr "" "im Stammelement deklarierte Schema außer Kraft setzt" #. Tag: para +#: collection_mapping.xml:281 #, fuzzy, no-c-format msgid "" "lazy (optional - defaults to true): " @@ -478,6 +862,7 @@ msgstr "" "(passend für sehr große Collections)" #. Tag: para +#: collection_mapping.xml:290 #, fuzzy, no-c-format msgid "" "inverse (optional - defaults to falsecascade (optional - defaults to none): " @@ -499,6 +885,7 @@ msgstr "" "\"child entities\")" #. Tag: para +#: collection_mapping.xml:302 #, fuzzy, no-c-format msgid "" "sort (optional): specifies a sorted collection with " @@ -509,12 +896,13 @@ msgstr "" "Vergleichsprogramm" #. Tag: para +#: collection_mapping.xml:308 #, fuzzy, no-c-format msgid "" -"order-by (optional, JDK1.4 only): specifies a table " -"column or columns that define the iteration order of the Map, Set or bag, together with an optional " -"asc or desc." +"order-by (optional): specifies a table column or columns " +"that define the iteration order of the Map, Set or bag, together with an optional asc or " +"desc." msgstr "" "order-by (optional, nur JDK1.4) bestimmt eine (oder " "mehrere) Tabellenspalte(n), die die Iterationsreihenfolge von Mapwhere (optional): specifies an arbitrary SQL " @@ -536,6 +925,7 @@ msgstr "" "Collection nur einen Untersatz der verfügbaren Daten enthalten soll)" #. Tag: para +#: collection_mapping.xml:324 #, fuzzy, no-c-format msgid "" "fetch (optional, defaults to select): " @@ -547,6 +937,7 @@ msgstr "" "sequentieller Auswahl und Fetching nach sequentieller Unterauswahl." #. Tag: para +#: collection_mapping.xml:331 #, fuzzy, no-c-format msgid "" "batch-size (optional, defaults to 1): " @@ -557,6 +948,7 @@ msgstr "" "Collection." #. Tag: para +#: collection_mapping.xml:337 #, fuzzy, no-c-format msgid "" "access (optional - defaults to propertyoptimistic-lock (optional - defaults to truemutable (optional - defaults to true): " @@ -593,19 +987,31 @@ msgstr "" "der Collection sich niemals ändern (in manchen Fällen eine leichte " "Optimierung der Performance)." +#. Tag: para +#: collection_mapping.xml:360 +#, no-c-format +msgid "" +"After exploring the basic mapping of collections in the preceding paragraphs " +"we will now focus details like physical mapping considerations, indexed " +"collections and collections of value types." +msgstr "" + #. Tag: title +#: collection_mapping.xml:365 #, no-c-format msgid "Collection foreign keys" msgstr "Collection-Fremdschlüssel" #. Tag: para +#: collection_mapping.xml:367 #, fuzzy, no-c-format msgid "" -"Collection instances are distinguished in the database by the foreign key of " -"the entity that owns the collection. This foreign key is referred to as the " -"collection key column, or columns, of the collection " -"table. The collection key column is mapped by the <key> element." +"On the database level collection instances are distinguished by the foreign " +"key of the entity that owns the collection. This foreign key is referred to " +"as the collection key column, or columns, of the " +"collection table. The collection key column is mapped by the " +"@JoinColumn annotation respectively the <" +"key> XML element." msgstr "" "Die Instanzen der Collection werden in der Datenbank durch den " "Fremdschlüssel der Entity, zu der die Collection gehört, unterschieden. " @@ -615,12 +1021,12 @@ msgstr "" "Element gemappt." #. Tag: para +#: collection_mapping.xml:374 #, fuzzy, no-c-format msgid "" "There can be a nullability constraint on the foreign key column. For most " "collections, this is implied. For unidirectional one-to-many associations, " -"the foreign key column is nullable by default, so you may need to specify " -"not-null=\"true\"." +"the foreign key column is nullable by default, so you may need to specify" msgstr "" "Es ist möglich, dass eine \"Nullability\"-Bedingung an der Spalte des " "Fremdschlüssels existiert. Für die meisten Collections wird dies " @@ -628,101 +1034,268 @@ msgstr "" "Spalte des Fremdschlüssels standardmäßig \"nullbar\", weswegen es möglich " "ist, dass Sie not-null=\"true\" festlegen müssen." +#. Tag: programlisting +#: collection_mapping.xml:379 +#, no-c-format +msgid "@JoinColumn(nullable=false)" +msgstr "" + #. Tag: para +#: collection_mapping.xml:381 +#, no-c-format +msgid "or" +msgstr "" + +#. Tag: programlisting +#: collection_mapping.xml:383 +#, fuzzy, no-c-format +msgid "<key column=\"productSerialNumber\" not-null=\"true\"/>" +msgstr "<key column=\"productSerialNumber\" not-null=\"true\"/>" + +#. Tag: para +#: collection_mapping.xml:385 #, fuzzy, no-c-format msgid "" -"The foreign key constraint can use ON DELETE CASCADE." +"The foreign key constraint can use ON DELETE CASCADE. In " +"XML this can be expressed via:" msgstr "" "Die Bedingung für den Fremdschlüssel kann ON DELETE CASCADE verwenden." +#. Tag: programlisting +#: collection_mapping.xml:388 +#, fuzzy, no-c-format +msgid "<key column=\"productSerialNumber\" on-delete=\"cascade\"/>" +msgstr "<key column=\"productSerialNumber\" on-delete=\"cascade\"/>" + #. Tag: para +#: collection_mapping.xml:390 #, no-c-format msgid "" -"See the previous chapter for a full definition of the <key> element." +"In annotations the Hibernate specific annotation @OnDelete has to be used." +msgstr "" + +#. Tag: programlisting +#: collection_mapping.xml:393 +#, no-c-format +msgid "@OnDelete(action=OnDeleteAction.CASCADE)" +msgstr "" + +#. Tag: para +#: collection_mapping.xml:395 +#, fuzzy, no-c-format +msgid "" +"See for more information about the " +"<key> element." msgstr "" "Die vollständige Definition des <key>-Elements " "finden Sie im vorangegangenen Kapitel." #. Tag: title -#, no-c-format -msgid "Collection elements" -msgstr "Collection-Elemente" - -#. Tag: para -#, fuzzy, no-c-format -msgid "" -"Collections can contain almost any other Hibernate type, including: basic " -"types, custom types, components and references to other entities. This is an " -"important distinction. An object in a collection might be handled with " -"\"value\" semantics (its life cycle fully depends on the collection owner), " -"or it might be a reference to another entity with its own life cycle. In the " -"latter case, only the \"link\" between the two objects is considered to be a " -"state held by the collection." -msgstr "" -"Collections können fast jeden beliebigen anderen Hibernate-Typ enthalten, " -"einschließlich sämtlicher Grundtypen, angepasster Typen, Komponenten und " -"natürlich Referenzen zu anderen Entities. Das ist ein wichtiger Unterschied: " -"Ein Objekt einer Collection könnte mit \"Wert\"semantik bearbeitet werden " -"(sein Lebenszyklus hängt vollständig vom Besitzer der Collection ab) oder es " -"könnte ein Verweis auf eine andere Entity mit ihrem eigenen Lebenszyklus " -"sein. Im letzteren Fall wird nur die \"Verbindung\" zwischen den beiden " -"Objekten als von der Collection gehaltener Status angesehen." - -#. Tag: para -#, no-c-format -msgid "" -"The contained type is referred to as the collection element type. Collection elements are mapped by <element> or <composite-element>, or in the case of " -"entity references, with <one-to-many> or " -"<many-to-many>. The first two map elements with " -"value semantics, the next two are used to map entity associations." -msgstr "" -"Der enthaltene Typ wird als Typ von Collection-Element " -"bezeichnet. Collection-Elemente werden durch <element> oder <composite-element> - oder im Fall " -"von Entity-Verweisen - durch <one-to-many> oder " -"<many-to-many> gemappt. Die ersten beiden Elemente " -"mappen mit Wertsemantik, die beiden folgenden werden für das Mappen von " -"Entity-Assoziationen verwendet." - -#. Tag: title +#: collection_mapping.xml:400 #, no-c-format msgid "Indexed collections" msgstr "Indizierte Collections" #. Tag: para -#, fuzzy, no-c-format +#: collection_mapping.xml:402 +#, no-c-format msgid "" -"All collection mappings, except those with set and bag semantics, need an " -"index column in the collection table. An index column " -"is a column that maps to an array index, or List index, " -"or Map key. The index of a Map may be " -"of any basic type, mapped with <map-key>. It can be " -"an entity reference mapped with <map-key-many-to-many>, or it can be a composite type mapped with <composite-" -"map-key>. The index of an array or list is always of type " -"integer and is mapped using the <list-" -"index> element. The mapped column contains sequential integers " -"that are numbered from zero by default." +"In the following paragraphs we have a closer at the indexed collections " +"List and Map how the their " +"index can be mapped in Hibernate." +msgstr "" + +#. Tag: title +#: collection_mapping.xml:407 +#, no-c-format +msgid "Lists" msgstr "" -"Alle Collection-Mappings - außer denen mit \"Set\"- und \"Bag\"-Semantik - " -"benötigen eine Indexspalte in der Collection-Tabelle. " -"Es handelt sich dabei um eine Spalte, die zu einem Verzeichnis von " -"Datenelementen, List-Verzeichnis oder Map-Schlüssel mappt. Der Index einer Map kann jeden " -"Grundtyp besitzen, der mit <map-key> gemappt ist. " -"Es kann ein mit <map-key-many-to-many> gemappter " -"Entity-Verweis oder ein mit <composite-map-key> " -"gemappter zusammengesetzter Typ sein. Der Index eines Datenelements oder " -"einer Liste ist immer vom Typ her integer und wird " -"mittels <list-index>-Element gemappt. Die gemappte " -"Spalte enthält sequenzielle ganze Zahlen (im Standard ab Null " -"durchnummeriert)." #. Tag: para +#: collection_mapping.xml:409 +#, no-c-format +msgid "Lists can be mapped in two different ways:" +msgstr "" + +#. Tag: para +#: collection_mapping.xml:413 +#, no-c-format +msgid "as ordered lists, where the order is not materialized in the database" +msgstr "" + +#. Tag: para +#: collection_mapping.xml:418 +#, no-c-format +msgid "as indexed lists, where the order is materialized in the database" +msgstr "" + +#. Tag: para +#: collection_mapping.xml:423 +#, no-c-format +msgid "" +"To order lists in memory, add @javax.persistence.OrderBy " +"to your property. This annotation takes as parameter a list of comma " +"separated properties (of the target entity) and orders the collection " +"accordingly (eg firstname asc, age desc), if the string is " +"empty, the collection will be ordered by the primary key of the target " +"entity." +msgstr "" + +#. Tag: title +#: collection_mapping.xml:432 +#, no-c-format +msgid "Ordered lists using @OrderBy" +msgstr "" + +#. Tag: programlisting +#: collection_mapping.xml:434 +#, no-c-format +msgid "" +"@Entity\n" +"public class Customer {\n" +" @Id @GeneratedValue public Integer getId() { return id; }\n" +" public void setId(Integer id) { this.id = id; }\n" +" private Integer id;\n" +"\n" +" @OneToMany(mappedBy=\"customer\")\n" +" @OrderBy(\"number\")\n" +" public List<Order> getOrders() { return orders; }\n" +" public void setOrders(List<Order> orders) { this.orders = " +"orders; }\n" +" private List<Order> orders;\n" +"}\n" +"\n" +"@Entity\n" +"public class Order {\n" +" @Id @GeneratedValue public Integer getId() { return id; }\n" +" public void setId(Integer id) { this.id = id; }\n" +" private Integer id;\n" +"\n" +" public String getNumber() { return number; }\n" +" public void setNumber(String number) { this.number = number; }\n" +" private String number;\n" +"\n" +" @ManyToOne\n" +" public Customer getCustomer() { return customer; }\n" +" public void setCustomer(Customer customer) { this.customer = customer; }\n" +" private Customer number;\n" +"}\n" +"\n" +"-- Table schema\n" +"|-------------| |----------|\n" +"| Order | | Customer |\n" +"|-------------| |----------|\n" +"| id | | id |\n" +"| number | |----------| \n" +"| customer_id |\n" +"|-------------|" +msgstr "" + +#. Tag: para +#: collection_mapping.xml:437 +#, no-c-format +msgid "" +"To store the index value in a dedicated column, use the @javax." +"persistence.OrderColumn annotation on your property. This " +"annotations describes the column name and attributes of the column keeping " +"the index value. This column is hosted on the table containing the " +"association foreign key. If the column name is not specified, the default is " +"the name of the referencing property, followed by underscore, followed by " +"ORDER (in the following example, it would be " +"orders_ORDER)." +msgstr "" + +#. Tag: title +#: collection_mapping.xml:448 +#, no-c-format +msgid "Explicit index column using @OrderColumn" +msgstr "" + +#. Tag: programlisting +#: collection_mapping.xml:451 +#, no-c-format +msgid "" +"@Entity\n" +"public class Customer {\n" +" @Id @GeneratedValue public Integer getId() { return id; }\n" +" public void setId(Integer id) { this.id = id; }\n" +" private Integer id;\n" +"\n" +" @OneToMany(mappedBy=\"customer\")\n" +" @OrderColumn(name=\"orders_index\")\n" +" public List<Order> getOrders() { return orders; }\n" +" public void setOrders(List<Order> orders) { this.orders = " +"orders; }\n" +" private List<Order> orders;\n" +"}\n" +"\n" +"@Entity\n" +"public class Order {\n" +" @Id @GeneratedValue public Integer getId() { return id; }\n" +" public void setId(Integer id) { this.id = id; }\n" +" private Integer id;\n" +"\n" +" public String getNumber() { return number; }\n" +" public void setNumber(String number) { this.number = number; }\n" +" private String number;\n" +"\n" +" @ManyToOne\n" +" public Customer getCustomer() { return customer; }\n" +" public void setCustomer(Customer customer) { this.customer = customer; }\n" +" private Customer number;\n" +"}\n" +"\n" +"-- Table schema\n" +"|--------------| |----------|\n" +"| Order | | Customer |\n" +"|--------------| |----------|\n" +"| id | | id |\n" +"| number | |----------| \n" +"| customer_id |\n" +"| orders_order |\n" +"|--------------|" +msgstr "" + +#. Tag: para +#: collection_mapping.xml:455 +#, no-c-format +msgid "" +"We recommend you to convert the legacy @org.hibernate.annotations." +"IndexColumn usages to @OrderColumn unless " +"you are making use of the base property. The base " +"property lets you define the index value of the first element (aka as base " +"index). The usual value is 0 or 1. The " +"default is 0 like in Java." +msgstr "" + +#. Tag: para +#: collection_mapping.xml:464 +#, no-c-format +msgid "" +"Looking again at the Hibernate mapping file equivalent, the index of an " +"array or list is always of type integer and is mapped " +"using the <list-index> element. The mapped column " +"contains sequential integers that are numbered from zero by default." +msgstr "" + +#. Tag: title +#: collection_mapping.xml:471 +#, no-c-format +msgid "index-list element for indexed collections in xml mapping" +msgstr "" + +#. Tag: programlisting +#: collection_mapping.xml:481 +#, no-c-format +msgid "" +"<list-index\n" +" column=\"column_name\"\n" +" base=\"0|1|...\"/>" +msgstr "" + +#. Tag: para +#: collection_mapping.xml:485 #, fuzzy, no-c-format msgid "" "column_name (required): the name of the column holding " @@ -731,6 +1304,7 @@ msgstr "" "class (erforderlich): Der Name der zugehörigen Klasse." #. Tag: para +#: collection_mapping.xml:490 #, fuzzy, no-c-format msgid "" "base (optional - defaults to 0): the " @@ -742,55 +1316,7 @@ msgstr "" "\"child entities\")" #. Tag: para -#, fuzzy, no-c-format -msgid "" -"column (optional): the name of the column holding the " -"collection index values." -msgstr "" -"schema (optional) der Name eines Tabellenschemas, der das " -"im Stammelement deklarierte Schema außer Kraft setzt" - -#. Tag: para -#, fuzzy, no-c-format -msgid "" -"formula (optional): a SQL formula used to evaluate the " -"key of the map." -msgstr "" -"schema (optional) der Name eines Tabellenschemas, der das " -"im Stammelement deklarierte Schema außer Kraft setzt" - -#. Tag: para -#, fuzzy, no-c-format -msgid "type (required): the type of the map keys." -msgstr "" -"class (erforderlich): Der Name der zugehörigen Klasse." - -#. Tag: para -#, fuzzy, no-c-format -msgid "" -"column (optional): the name of the foreign key column for " -"the collection index values." -msgstr "" -"schema (optional) der Name eines Tabellenschemas, der das " -"im Stammelement deklarierte Schema außer Kraft setzt" - -#. Tag: para -#, fuzzy, no-c-format -msgid "" -"formula (optional): a SQ formula used to evaluate the " -"foreign key of the map key." -msgstr "" -"schema (optional) der Name eines Tabellenschemas, der das " -"im Stammelement deklarierte Schema außer Kraft setzt" - -#. Tag: para -#, fuzzy, no-c-format -msgid "" -"class (required): the entity class used as the map key." -msgstr "" -"class (erforderlich): Der Name der zugehörigen Klasse." - -#. Tag: para +#: collection_mapping.xml:498 #, fuzzy, no-c-format msgid "" "If your table does not have an index column, and you still wish to use " @@ -806,33 +1332,485 @@ msgstr "" "optional sortiert oder geordnet werden." #. Tag: title +#: collection_mapping.xml:506 #, no-c-format -msgid "Collections of values and many-to-many associations" +msgid "Maps" +msgstr "" + +#. Tag: para +#: collection_mapping.xml:508 +#, no-c-format +msgid "" +"The question with Maps is where the key value is " +"stored. There are everal options. Maps can borrow their keys from one of the " +"associated entity properties or have dedicated columns to store an explicit " +"key." +msgstr "" + +#. Tag: para +#: collection_mapping.xml:513 +#, no-c-format +msgid "" +"To use one of the target entity property as a key of the map, use " +"@MapKey(name=\"myProperty\"), where myProperty is a property name in the target entity. When using " +"@MapKey without the name attribuate, the target entity " +"primary key is used. The map key uses the same column as the property " +"pointed out. There is no additional column defined to hold the map key, " +"because the map key represent a target property. Be aware that once loaded, " +"the key is no longer kept in sync with the property. In other words, if you " +"change the property value, the key will not change automatically in your " +"Java model." +msgstr "" + +#. Tag: title +#: collection_mapping.xml:525 +#, no-c-format +msgid "" +"Use of target entity property as map key via @MapKey" +msgstr "" + +#. Tag: programlisting +#: collection_mapping.xml:528 +#, no-c-format +msgid "" +"@Entity\n" +"public class Customer {\n" +" @Id @GeneratedValue public Integer getId() { return id; }\n" +" public void setId(Integer id) { this.id = id; }\n" +" private Integer id;\n" +"\n" +" @OneToMany(mappedBy=\"customer\")\n" +" @MapKey(name=\"number\")\n" +" public Map<String,Order> getOrders() { return orders; }\n" +" public void setOrders(Map<String,Order> order) { this.orders = " +"orders; }\n" +" private Map<String,Order> orders;\n" +"}\n" +"\n" +"@Entity\n" +"public class Order {\n" +" @Id @GeneratedValue public Integer getId() { return id; }\n" +" public void setId(Integer id) { this.id = id; }\n" +" private Integer id;\n" +"\n" +" public String getNumber() { return number; }\n" +" public void setNumber(String number) { this.number = number; }\n" +" private String number;\n" +"\n" +" @ManyToOne\n" +" public Customer getCustomer() { return customer; }\n" +" public void setCustomer(Customer customer) { this.customer = customer; }\n" +" private Customer number;\n" +"}\n" +"\n" +"-- Table schema\n" +"|-------------| |----------|\n" +"| Order | | Customer |\n" +"|-------------| |----------|\n" +"| id | | id |\n" +"| number | |----------| \n" +"| customer_id |\n" +"|-------------|" +msgstr "" + +#. Tag: para +#: collection_mapping.xml:531 +#, no-c-format +msgid "" +"Alternatively the map key is mapped to a dedicated column or columns. In " +"order to customize the mapping use one of the following annotations:" +msgstr "" + +#. Tag: para +#: collection_mapping.xml:537 +#, no-c-format +msgid "" +"@MapKeyColumn if the map key is a basic type. If you " +"don't specify the column name, the name of the property followed by " +"underscore followed by KEY is used (for example " +"orders_KEY)." +msgstr "" + +#. Tag: para +#: collection_mapping.xml:544 +#, no-c-format +msgid "" +"@MapKeyEnumerated / @MapKeyTemporal if the map key type is respectively an enum or a Date." +msgstr "" + +#. Tag: para +#: collection_mapping.xml:550 +#, no-c-format +msgid "" +"@MapKeyJoinColumn/@MapKeyJoinColumns if the map key type is another entity." +msgstr "" + +#. Tag: para +#: collection_mapping.xml:555 +#, no-c-format +msgid "" +"@AttributeOverride/@AttributeOverrides when the map key is a embeddable object. Use key. as a prefix for your embeddable object property names." +msgstr "" + +#. Tag: para +#: collection_mapping.xml:562 +#, no-c-format +msgid "" +"You can also use @MapKeyClass to define the type of " +"the key if you don't use generics." +msgstr "" + +#. Tag: title +#: collection_mapping.xml:566 +#, no-c-format +msgid "Map key as basic type using @MapKeyColumn" +msgstr "" + +#. Tag: programlisting +#: collection_mapping.xml:569 +#, no-c-format +msgid "" +"@Entity\n" +"public class Customer {\n" +" @Id @GeneratedValue public Integer getId() { return id; }\n" +" public void setId(Integer id) { this.id = id; }\n" +" private Integer id;\n" +"\n" +" @OneToMany @JoinTable(name=\"Cust_Order\")\n" +" @MapKeyColumn(name=\"orders_number\")\n" +" public Map<String,Order> getOrders() { return orders; }\n" +" public void setOrders(Map<String,Order> orders) { this.orders = " +"orders; }\n" +" private Map<String,Order> orders;\n" +"}\n" +"\n" +"@Entity\n" +"public class Order {\n" +" @Id @GeneratedValue public Integer getId() { return id; }\n" +" public void setId(Integer id) { this.id = id; }\n" +" private Integer id;\n" +"\n" +" public String getNumber() { return number; }\n" +" public void setNumber(String number) { this.number = number; }\n" +" private String number;\n" +"\n" +" @ManyToOne\n" +" public Customer getCustomer() { return customer; }\n" +" public void setCustomer(Customer customer) { this.customer = customer; }\n" +" private Customer number;\n" +"}\n" +"\n" +"-- Table schema\n" +"|-------------| |----------| |---------------|\n" +"| Order | | Customer | | Cust_Order |\n" +"|-------------| |----------| |---------------|\n" +"| id | | id | | customer_id |\n" +"| number | |----------| | order_id |\n" +"| customer_id | | orders_number |\n" +"|-------------| |---------------|" +msgstr "" + +#. Tag: para +#: collection_mapping.xml:573 +#, no-c-format +msgid "" +"We recommend you to migrate from @org.hibernate.annotations." +"MapKey / @org.hibernate.annotation.MapKeyManyToMany to the new standard approach described above" +msgstr "" + +#. Tag: para +#: collection_mapping.xml:579 +#, fuzzy, no-c-format +msgid "" +"Using Hibernate mapping files there exists equivalent concepts to the " +"descibed annotations. You have to use <map-key>, " +"<map-key-many-to-many> and <composite-" +"map-key>. <map-key> is used for any " +"basic type, <map-key-many-to-many> for an entity " +"reference and <composite-map-key> for a composite " +"type." +msgstr "" +"Neben <set> gibt es auch <list>, <map>, <bag>, " +"<array> und <primitive-array> Mapping-Elemente. Das <map>-Element ist " +"charakteristisch:" + +#. Tag: title +#: collection_mapping.xml:590 +#, no-c-format +msgid "map-key xml mapping element" +msgstr "" + +#. Tag: programlisting +#: collection_mapping.xml:601 +#, no-c-format +msgid "" +"<map-key\n" +" column=\"column_name\"\n" +" formula=\"any SQL expression\"\n" +" type=\"type_name\"\n" +" node=\"@attribute-name\"\n" +" length=\"N\"/>" +msgstr "" + +#. Tag: para +#: collection_mapping.xml:605 +#, fuzzy, no-c-format +msgid "" +"column (optional): the name of the column holding the " +"collection index values." +msgstr "" +"schema (optional) der Name eines Tabellenschemas, der das " +"im Stammelement deklarierte Schema außer Kraft setzt" + +#. Tag: para +#: collection_mapping.xml:610 +#, fuzzy, no-c-format +msgid "" +"formula (optional): a SQL formula used to evaluate the " +"key of the map." +msgstr "" +"schema (optional) der Name eines Tabellenschemas, der das " +"im Stammelement deklarierte Schema außer Kraft setzt" + +#. Tag: para +#: collection_mapping.xml:615 +#, fuzzy, no-c-format +msgid "type (required): the type of the map keys." +msgstr "" +"class (erforderlich): Der Name der zugehörigen Klasse." + +#. Tag: title +#: collection_mapping.xml:623 +#, fuzzy, no-c-format +msgid "map-key-many-to-many" +msgstr "\"Many-to-Many\"" + +#. Tag: programlisting +#: collection_mapping.xml:634 +#, no-c-format +msgid "" +"<map-key-many-to-many\n" +" column=\"column_name\"\n" +" formula=\"any SQL expression\"\n" +" class=\"ClassName\"\n" +"/>" +msgstr "" + +#. Tag: para +#: collection_mapping.xml:638 +#, fuzzy, no-c-format +msgid "" +"column (optional): the name of the foreign key column for " +"the collection index values." +msgstr "" +"schema (optional) der Name eines Tabellenschemas, der das " +"im Stammelement deklarierte Schema außer Kraft setzt" + +#. Tag: para +#: collection_mapping.xml:643 +#, fuzzy, no-c-format +msgid "" +"formula (optional): a SQ formula used to evaluate the " +"foreign key of the map key." +msgstr "" +"schema (optional) der Name eines Tabellenschemas, der das " +"im Stammelement deklarierte Schema außer Kraft setzt" + +#. Tag: para +#: collection_mapping.xml:648 +#, fuzzy, no-c-format +msgid "" +"class (required): the entity class used as the map key." +msgstr "" +"class (erforderlich): Der Name der zugehörigen Klasse." + +#. Tag: title +#: collection_mapping.xml:658 +#, fuzzy, no-c-format +msgid "Collections of basic types and embeddable objects" msgstr "Collections von Werten und \"Many-to-Many\"-Assoziationen" #. Tag: para -#, fuzzy, no-c-format +#: collection_mapping.xml:660 +#, no-c-format msgid "" -"Any collection of values or many-to-many associations requires a dedicated " -"collection table with a foreign key column or columns, " -"collection element column or columns, and possibly an " -"index column or columns." +"In some situations you don't need to associate two entities but simply " +"create a collection of basic types or embeddable objects. Use the " +"@ElementCollection for this case." +msgstr "" + +#. Tag: title +#: collection_mapping.xml:665 +#, no-c-format +msgid "" +"Collection of basic types mapped via @ElementCollection" +msgstr "" + +#. Tag: programlisting +#: collection_mapping.xml:668 +#, no-c-format +msgid "" +"@Entity\n" +"public class User {\n" +" [...]\n" +" public String getLastname() { ...}\n" +"\n" +" @ElementCollection\n" +" @CollectionTable(name=\"Nicknames\", joinColumns=@JoinColumn(name=" +"\"user_id\"))\n" +" @Column(name=\"nickname\")\n" +" public Set<String> getNicknames() { ... } \n" +"}" msgstr "" -"Jede Collection von Werten oder \"Many-to-Many\"-Assoziation erfordert eine " -"zugeordnete Collection-Tabelle mit einer oder mehreren " -"Fremdschlüsselspalten, Collection-Element-Spalte(n) " -"oder möglicherweise einer oder mehreren Indexspalte(n)." #. Tag: para +#: collection_mapping.xml:671 +#, no-c-format +msgid "" +"The collection table holding the collection data is set using the " +"@CollectionTable annotation. If omitted the " +"collection table name defaults to the concatenation of the name of the " +"containing entity and the name of the collection attribute, separated by an " +"underscore. In our example, it would be User_nicknames." +msgstr "" + +#. Tag: para +#: collection_mapping.xml:678 +#, no-c-format +msgid "" +"The column holding the basic type is set using the @Column annotation. If omitted, the column name defaults to the property " +"name: in our example, it would be nicknames." +msgstr "" + +#. Tag: para +#: collection_mapping.xml:683 +#, no-c-format +msgid "" +"But you are not limited to basic types, the collection type can be any " +"embeddable object. To override the columns of the embeddable object in the " +"collection table, use the @AttributeOverride " +"annotation." +msgstr "" + +#. Tag: title +#: collection_mapping.xml:689 +#, no-c-format +msgid "@ElementCollection for embeddable objects" +msgstr "" + +#. Tag: programlisting +#: collection_mapping.xml:691 +#, no-c-format +msgid "" +"@Entity\n" +"public class User {\n" +" [...]\n" +" public String getLastname() { ...}\n" +"\n" +" @ElementCollection\n" +" @CollectionTable(name=\"Addresses\", joinColumns=@JoinColumn(name=" +"\"user_id\"))\n" +" @AttributeOverrides({\n" +" @AttributeOverride(name=\"street1\", column=@Column(name=\"fld_street" +"\"))\n" +" })\n" +" public Set<Address> getAddresses() { ... } \n" +"}\n" +"\n" +"@Embeddable\n" +"public class Address {\n" +" public String getStreet1() {...}\n" +" [...]\n" +"}" +msgstr "" + +#. Tag: para +#: collection_mapping.xml:694 +#, no-c-format +msgid "Such an embeddable object cannot contains a collection itself." +msgstr "" + +#. Tag: para +#: collection_mapping.xml:698 +#, no-c-format +msgid "" +"in @AttributeOverride, you must use the " +"value. prefix to override properties of the embeddable " +"object used in the map value and the key. prefix to " +"override properties of the embeddable object used in the map key." +msgstr "" + +#. Tag: programlisting +#: collection_mapping.xml:704 +#, no-c-format +msgid "" +"@Entity\n" +"public class User {\n" +" @ElementCollection\n" +" @AttributeOverrides({\n" +" @AttributeOverride(name=\"key.street1\", column=@Column(name=" +"\"fld_street\")),\n" +" @AttributeOverride(name=\"value.stars\", column=@Column(name=\"fld_note" +"\"))\n" +" })\n" +" public Map<Address,Rating> getFavHomes() { ... }" +msgstr "" + +#. Tag: para +#: collection_mapping.xml:708 +#, no-c-format +msgid "" +"We recommend you to migrate from @org.hibernate.annotations." +"CollectionOfElements to the new @ElementCollection annotation." +msgstr "" + +#. Tag: para +#: collection_mapping.xml:714 #, fuzzy, no-c-format msgid "" -"For a collection of values use the <element> tag. " -"For example:" +"Using the mapping file approach a collection of values is mapped using the " +"<element> tag. For example:" msgstr "" "Für eine Collection von Werten wird das <element>-" "Tag verwendet." +#. Tag: title +#: collection_mapping.xml:718 +#, no-c-format +msgid "<element> tag for collection values using mapping files" +msgstr "" + +#. Tag: programlisting +#: collection_mapping.xml:730 +#, no-c-format +msgid "" +"<element\n" +" column=\"column_name\"\n" +" formula=\"any SQL expression\"\n" +" type=\"typename\"\n" +" length=\"L\"\n" +" precision=\"P\"\n" +" scale=\"S\"\n" +" not-null=\"true|false\"\n" +" unique=\"true|false\"\n" +" node=\"element-name\"\n" +"/>" +msgstr "" + #. Tag: para +#: collection_mapping.xml:734 #, fuzzy, no-c-format msgid "" "column (optional): the name of the column holding the " @@ -842,6 +1820,7 @@ msgstr "" "im Stammelement deklarierte Schema außer Kraft setzt" #. Tag: para +#: collection_mapping.xml:739 #, fuzzy, no-c-format msgid "" "formula (optional): an SQL formula used to evaluate the " @@ -851,253 +1830,102 @@ msgstr "" "im Stammelement deklarierte Schema außer Kraft setzt" #. Tag: para +#: collection_mapping.xml:744 #, fuzzy, no-c-format msgid "type (required): the type of the collection element." msgstr "" "class (erforderlich): Der Name der zugehörigen Klasse." -#. Tag: para -#, no-c-format -msgid "" -"A many-to-many association is specified using the " -"<many-to-many> element." -msgstr "" - -#. Tag: para -#, fuzzy, no-c-format -msgid "" -"column (optional): the name of the element foreign key " -"column." -msgstr "" -"class (erforderlich): Der Name der zugehörigen Klasse." - -#. Tag: para -#, fuzzy, no-c-format -msgid "" -"formula (optional): an SQL formula used to evaluate the " -"element foreign key value." -msgstr "" -"schema (optional) der Name eines Tabellenschemas, der das " -"im Stammelement deklarierte Schema außer Kraft setzt" - -#. Tag: para -#, fuzzy, no-c-format -msgid "class (required): the name of the associated class." -msgstr "" -"class (erforderlich): Der Name der zugehörigen Klasse." - -#. Tag: para -#, no-c-format -msgid "" -"fetch (optional - defaults to join): " -"enables outer-join or sequential select fetching for this association. This " -"is a special case; for full eager fetching in a single SELECT of an entity and its many-to-many relationships to other entities, " -"you would enable join fetching,not only of the collection " -"itself, but also with this attribute on the <many-to-many> nested element." -msgstr "" - -#. Tag: para -#, no-c-format -msgid "" -"unique (optional): enables the DDL generation of a unique " -"constraint for the foreign-key column. This makes the association " -"multiplicity effectively one-to-many." -msgstr "" - -#. Tag: para -#, fuzzy, no-c-format -msgid "" -"not-found (optional - defaults to exception): specifies how foreign keys that reference missing rows will be " -"handled: ignore will treat a missing row as a null " -"association." -msgstr "" -"not-found (optional - standardmäßig exception): Bestimmt, wie gespeicherte Bezeichner (sog. \"Identifier\"), die " -"auf fehlende Reihen verweisen, behandelt werden. Mit ignore wird eine fehlende Reihe als Null-Assoziation angesehen." - -#. Tag: para -#, fuzzy, no-c-format -msgid "" -"entity-name (optional): the entity name of the associated " -"class, as an alternative to class." -msgstr "" -"entity-name (optional): Der Entity-Name der zugehörigen " -"Klasse als Alternative zu class." - -#. Tag: para -#, no-c-format -msgid "" -"property-ref (optional): the name of a property of the " -"associated class that is joined to this foreign key. If not specified, the " -"primary key of the associated class is used." -msgstr "" - -#. Tag: para -#, no-c-format -msgid "Here are some examples." -msgstr "" - -#. Tag: para -#, no-c-format -msgid "A set of strings:" -msgstr "" - -#. Tag: para -#, fuzzy, no-c-format -msgid "" -"A bag containing integers with an iteration order determined by the " -"order-by attribute:" -msgstr "" -"Eine ganze Zahlen enthaltende \"Bag\" (mit einer durch das order-" -"by-Attribut bestimmten Reihenfolge):" - -#. Tag: para -#, fuzzy, no-c-format -msgid "An array of entities, in this case, a many-to-many association:" -msgstr "" -"Ein Datenelement von Entities - in diesem Fall eine \"Many-to-Many\"-" -"Assoziation:" - -#. Tag: para -#, no-c-format -msgid "A map from string indices to dates:" -msgstr "Eine Map von String-Indexen zu Daten:" - -#. Tag: para -#, fuzzy, no-c-format -msgid "A list of components (this is discussed in the next chapter):" -msgstr "" -"Eine List von Komponenten (wird im nachfolgenden Kapitel näher erläutert):" - -#. Tag: title -#, no-c-format -msgid "One-to-many associations" -msgstr "\"One-to-Many\"-Assoziationen" - -#. Tag: para -#, fuzzy, no-c-format -msgid "" -"A one-to-many association links the tables of two " -"classes via a foreign key with no intervening collection table. This mapping " -"loses certain semantics of normal Java collections:" -msgstr "" -"Eine \"One-to-Many\"-Assoziation verbindet die Tabellen " -"zweier Klassen mittels des Fremdschlüssels ohne eine intervenierende " -"Collection-Tabelle. Dieses Mapping verliert bestimmte Teile der Semantik " -"regulärer Java-Collections:" - -#. Tag: para -#, fuzzy, no-c-format -msgid "" -"An instance of the contained entity class cannot belong to more than one " -"instance of the collection." -msgstr "" -"Eine Instanz der enthaltenen Entity-Klasse kann nicht zu mehr als einer " -"Instanz der Collection gehören" - -#. Tag: para -#, fuzzy, no-c-format -msgid "" -"An instance of the contained entity class cannot appear at more than one " -"value of the collection index." -msgstr "" -"Eine Instanz der enthaltenen Entity-Klasse kann nicht an mehr als einem Wert " -"des Collection-Index erscheinen" - -#. Tag: para -#, fuzzy, no-c-format -msgid "" -"An association from Product to Part " -"requires the existence of a foreign key column and possibly an index column " -"to the Part table. A <one-to-many> tag indicates that this is a one-to-many association." -msgstr "" -"Eine Assoziation von Product zu Part " -"macht die Existenz einer Spalte mit Fremdschlüssel und möglicherweise einer " -"Indexspalte zur Part-Tabelle erforderlich. Ein " -"<one-to-many>-Tag zeigt an, dass dies eine \"One-to-" -"Many\"-Assoziation ist." - -#. Tag: para -#, fuzzy, no-c-format -msgid "" -"not-found (optional - defaults to exception): specifies how cached identifiers that reference missing rows will " -"be handled. ignore will treat a missing row as a null " -"association." -msgstr "" -"not-found (optional - standardmäßig exception): Bestimmt, wie gespeicherte Bezeichner (sog. \"Identifier\"), die " -"auf fehlende Reihen verweisen, behandelt werden. Mit ignore wird eine fehlende Reihe als Null-Assoziation angesehen." - -#. Tag: para -#, fuzzy, no-c-format -msgid "" -"The <one-to-many> element does not need to declare " -"any columns. Nor is it necessary to specify the table " -"name anywhere." -msgstr "" -"Beachten Sie, dass das <one-to-many>-Element keine " -"Spalten deklarieren muss. Es ist außerdem nicht nötig, den table-Namen irgendwo zu bestimmen." - -#. Tag: para -#, fuzzy, no-c-format -msgid "" -"If the foreign key column of a <one-to-many> " -"association is declared NOT NULL, you must declare the " -"<key> mapping not-null=\"true\" " -"or use a bidirectional association with the collection " -"mapping marked inverse=\"true\". See the discussion of " -"bidirectional associations later in this chapter for more information." -msgstr "" -"Sehr wichtig: Falls die Fremdschlüsselspalte einer " -"<one-to-many>-Assoziation als NOT NULL deklariert ist, müssen Sie beim <key>-" -"Mapping not-null=\"true\" deklarieren oder eine " -"bidirektionale Assoziation mit als inverse=\"true\" gekennzeichnetem Collection-Mapping verwenden. Wir gehen später in " -"diesem Kapitel noch näher auf bidirektionale Assoziationen ein." - -#. Tag: para -#, fuzzy, no-c-format -msgid "" -"The following example shows a map of Part entities by " -"name, where partName is a persistent property of " -"Part. Notice the use of a formula-based index:" -msgstr "" -"Dieses Beispiel zeigt die Map von Part-Entities nach Name " -"(wobei partName eine persistente Property von " -"Part) ist. Beachten Sie die Verwendung eines " -"formelbasierten Index." - #. Tag: title +#: collection_mapping.xml:754 #, no-c-format msgid "Advanced collection mappings" msgstr "Fortgeschrittene Collection-Mappings" #. Tag: title +#: collection_mapping.xml:757 #, no-c-format msgid "Sorted collections" msgstr "Sortierte Collections" #. Tag: para +#: collection_mapping.xml:759 #, no-c-format msgid "" "Hibernate supports collections implementing java.util.SortedMap and java.util.SortedSet. You must specify a " -"comparator in the mapping file:" +"literal> and java.util.SortedSet. With annotations you " +"declare a sort comparator using @Sort. You chose between " +"the comparator types unsorted, natural or custom. If you want to use your " +"own comparator implementation, you'll also have to specify the " +"implementation class using the comparator attribute. Note " +"that you need to use either a SortedSet or a " +"SortedMap interface." +msgstr "" + +#. Tag: title +#: collection_mapping.xml:770 +#, fuzzy, no-c-format +msgid "Sorted collection with @Sort" +msgstr "Sortierte Collections" + +#. Tag: programlisting +#: collection_mapping.xml:772 +#, no-c-format +msgid "" +"@OneToMany(cascade=CascadeType.ALL, fetch=FetchType.EAGER)\n" +"@JoinColumn(name=\"CUST_ID\")\n" +"@Sort(type = SortType.COMPARATOR, comparator = TicketComparator.class)\n" +"public SortedSet<Ticket> getTickets() {\n" +" return tickets;\n" +"}" msgstr "" -"Hibernate unterstützt java.util.SortedMap und " -"java.util.SortedSet implementierende Collections. Sie " -"müssen ein Vergleichsprogramm in der Mapping-Datei bestimmen:" #. Tag: para +#: collection_mapping.xml:775 +#, no-c-format +msgid "" +"Using Hibernate mapping files you specify a comparator in the mapping file " +"with <sort>:" +msgstr "" + +#. Tag: title +#: collection_mapping.xml:779 +#, fuzzy, no-c-format +msgid "Sorted collection using xml mapping" +msgstr "Sortierte Collections" + +#. Tag: programlisting +#: collection_mapping.xml:781 +#, fuzzy, no-c-format +msgid "" +"<set name=\"aliases\"\n" +" table=\"person_aliases\" \n" +" sort=\"natural\">\n" +" <key column=\"person\"/>\n" +" <element column=\"name\" type=\"string\"/>\n" +"</set>\n" +"\n" +"<map name=\"holidays\" sort=\"my.custom.HolidayComparator\">\n" +" <key column=\"year_id\"/>\n" +" <map-key column=\"hol_name\" type=\"string\"/>\n" +" <element column=\"hol_date\" type=\"date\"/>\n" +"</map>" +msgstr "" +"<set name=\"aliases\" \n" +" table=\"person_aliases\" \n" +" sort=\"natural\">\n" +" <key column=\"person\"/>\n" +" <element column=\"name\" type=\"string\"/>\n" +"</set>\n" +"\n" +"<map name=\"holidays\" sort=\"my.custom.HolidayComparator\">\n" +" <key column=\"year_id\"/>\n" +" <map-key column=\"hol_name\" type=\"string\"/>\n" +" <element column=\"hol_date\" type=\"date\"/>\n" +"</map>" + +#. Tag: para +#: collection_mapping.xml:784 #, no-c-format msgid "" "Allowed values of the sort attribute are " @@ -1109,6 +1937,7 @@ msgstr "" "Klassenimplementierung java.util.Comparator." #. Tag: para +#: collection_mapping.xml:789 #, no-c-format msgid "" "Sorted collections actually behave like java.util.TreeSet " @@ -1118,14 +1947,15 @@ msgstr "" "TreeSet oder java.util.TreeMap." #. Tag: para +#: collection_mapping.xml:794 #, fuzzy, no-c-format msgid "" "If you want the database itself to order the collection elements, use the " "order-by attribute of set, " "bag or map mappings. This solution is " -"only available under JDK 1.4 or higher and is implemented using " -"LinkedHashSet or LinkedHashMap. This " -"performs the ordering in the SQL query and not in the memory." +"implemented using LinkedHashSet or " +"LinkedHashMap and performs the ordering in the SQL query " +"and not in the memory." msgstr "" "Falls Sie wollen, dass die Datenbank selbst die Elemente der Collection " "ordnet, verwenden Sie das order-by-Attribut von " @@ -1136,11 +1966,47 @@ msgstr "" "in der SQL-Anfrage - nicht im Speicher - durchgeführt." #. Tag: title +#: collection_mapping.xml:802 +#, no-c-format +msgid "Sorting in database using order-by" +msgstr "" + +#. Tag: programlisting +#: collection_mapping.xml:804 +#, fuzzy, no-c-format +msgid "" +"<set name=\"aliases\" table=\"person_aliases\" order-by=\"lower(name) asc" +"\">\n" +" <key column=\"person\"/>\n" +" <element column=\"name\" type=\"string\"/>\n" +"</set>\n" +"\n" +"<map name=\"holidays\" order-by=\"hol_date, hol_name\">\n" +" <key column=\"year_id\"/>\n" +" <map-key column=\"hol_name\" type=\"string\"/>\n" +" <element column=\"hol_date type=\"date\"/>\n" +"</map>" +msgstr "" +"<set name=\"aliases\" table=\"person_aliases\" order-by=\"lower(name) asc" +"\">\n" +" <key column=\"person\"/>\n" +" <element column=\"name\" type=\"string\"/>\n" +"</set>\n" +"\n" +"<map name=\"holidays\" order-by=\"hol_date, hol_name\">\n" +" <key column=\"year_id\"/>\n" +" <map-key column=\"hol_name\" type=\"string\"/>\n" +" <element column=\"hol_date type=\"date\"/>\n" +"</map>" + +#. Tag: title +#: collection_mapping.xml:808 #, no-c-format msgid "Note" msgstr "" #. Tag: para +#: collection_mapping.xml:810 #, fuzzy, no-c-format msgid "" "The value of the order-by attribute is an SQL ordering, " @@ -1150,6 +2016,7 @@ msgstr "" "SQL-Anordnung, keine HQL-Anordnung ist!" #. Tag: para +#: collection_mapping.xml:814 #, fuzzy, no-c-format msgid "" "Associations can even be sorted by arbitrary criteria at runtime using a " @@ -1159,11 +2026,29 @@ msgstr "" "literal> sogar nach beliebigen Kriterien sortiert werden." #. Tag: title +#: collection_mapping.xml:818 +#, no-c-format +msgid "Sorting via a query filter" +msgstr "" + +#. Tag: programlisting +#: collection_mapping.xml:820 +#, fuzzy, no-c-format +msgid "" +"sortedUsers = s.createFilter( group.getUsers(), \"order by this.name\" ).list" +"();" +msgstr "" +"sortedUsers = s.createFilter( group.getUsers(), \"order by this.name\" ).list" +"();" + +#. Tag: title +#: collection_mapping.xml:825 #, no-c-format msgid "Bidirectional associations" msgstr "Bidirektionale Assoziationen" #. Tag: para +#: collection_mapping.xml:827 #, no-c-format msgid "" "A bidirectional association allows navigation from both " @@ -1175,32 +2060,365 @@ msgstr "" "Assoziationen unterstützt:" #. Tag: term +#: collection_mapping.xml:831 #, no-c-format msgid "one-to-many" msgstr "\"One-to-Many\"" #. Tag: para +#: collection_mapping.xml:834 #, fuzzy, no-c-format msgid "set or bag valued at one end and single-valued at the other" msgstr "" "an einem Ende von \"Set\"- oder \"Bag\"-wertig, am anderen Ende einwertig" #. Tag: term +#: collection_mapping.xml:840 #, no-c-format msgid "many-to-many" msgstr "\"Many-to-Many\"" #. Tag: para +#: collection_mapping.xml:843 #, no-c-format msgid "set or bag valued at both ends" msgstr "an beiden Enden \"Set\"- oder \"Bag\"-wertig" #. Tag: para +#: collection_mapping.xml:848 +#, no-c-format +msgid "" +"Often there exists a many to one association which is the owner side of a " +"bidirectional relationship. The corresponding one to many association is in " +"this case annotated by @OneToMany(mappedBy=...)" +msgstr "" + +#. Tag: title +#: collection_mapping.xml:854 +#, no-c-format +msgid "Bidirectional one to many with many to one side as association owner" +msgstr "" + +#. Tag: programlisting +#: collection_mapping.xml:857 +#, no-c-format +msgid "" +"@Entity\n" +"public class Troop {\n" +" @OneToMany(mappedBy=\"troop\")\n" +" public Set<Soldier> getSoldiers() {\n" +" ...\n" +"}\n" +"\n" +"@Entity\n" +"public class Soldier {\n" +" @ManyToOne\n" +" @JoinColumn(name=\"troop_fk\")\n" +" public Troop getTroop() {\n" +" ...\n" +"}" +msgstr "" + +#. Tag: para +#: collection_mapping.xml:860 +#, no-c-format +msgid "" +"Troop has a bidirectional one to many relationship " +"with Soldier through the troop " +"property. You don't have to (must not) define any physical mapping in the " +"mappedBy side." +msgstr "" + +#. Tag: para +#: collection_mapping.xml:865 +#, no-c-format +msgid "" +"To map a bidirectional one to many, with the one-to-many side as the owning " +"side, you have to remove the mappedBy element and set the " +"many to one @JoinColumn as insertable and updatable to " +"false. This solution is not optimized and will produce additional UPDATE " +"statements." +msgstr "" + +#. Tag: title +#: collection_mapping.xml:872 +#, fuzzy, no-c-format +msgid "Bidirectional associtaion with one to many side as owner" +msgstr "Bidirektionale Assoziationen mit indizierten Collections" + +#. Tag: programlisting +#: collection_mapping.xml:875 +#, no-c-format +msgid "" +"@Entity\n" +"public class Troop {\n" +" @OneToMany\n" +" @JoinColumn(name=\"troop_fk\") //we need to duplicate the physical " +"information\n" +" public Set<Soldier> getSoldiers() {\n" +" ...\n" +"}\n" +"\n" +"@Entity\n" +"public class Soldier {\n" +" @ManyToOne\n" +" @JoinColumn(name=\"troop_fk\", insertable=false, updatable=false)\n" +" public Troop getTroop() {\n" +" ...\n" +"}" +msgstr "" + +#. Tag: para +#: collection_mapping.xml:878 #, fuzzy, no-c-format msgid "" -"You can specify a bidirectional many-to-many association by mapping two many-" -"to-many associations to the same database table and declaring one end as " -"inverse. You cannot select an indexed collection." +"How does the mappping of a bidirectional mapping look like in Hibernate " +"mapping xml? There you define a bidirectional one-to-many association by " +"mapping a one-to-many association to the same table column(s) as a many-to-" +"one association and declaring the many-valued end inverse=\"true\"." +msgstr "" +"Sie können eine bidirektionale \"One-to-Many\"-Assoziation definieren, indem " +"Sie eine \"One-to-Many\"-Assoziation zu derselben (oder denselben) " +"Tabellenspalte(n) wie eine \"Many-to-One\"-Assoziation mappen und für das " +"mehrwertige Ende inverse=\"true\" deklarieren." + +#. Tag: title +#: collection_mapping.xml:885 +#, no-c-format +msgid "Bidirectional one to many via Hibernate mapping files" +msgstr "" + +#. Tag: programlisting +#: collection_mapping.xml:887 +#, fuzzy, no-c-format +msgid "" +"<class name=\"Parent\">\n" +" <id name=\"id\" column=\"parent_id\"/>\n" +" ....\n" +" <set name=\"children\" inverse=\"true\">\n" +" <key column=\"parent_id\"/>\n" +" <one-to-many class=\"Child\"/>\n" +" </set>\n" +"</class>\n" +"\n" +"<class name=\"Child\">\n" +" <id name=\"id\" column=\"child_id\"/>\n" +" ....\n" +" <many-to-one name=\"parent\" \n" +" class=\"Parent\" \n" +" column=\"parent_id\"\n" +" not-null=\"true\"/>\n" +"</class>" +msgstr "" +"<class name=\"Parent\">\n" +" <id name=\"id\" column=\"parent_id\"/>\n" +" ....\n" +" <set name=\"children\" inverse=\"true\">\n" +" <key column=\"parent_id\"/>\n" +" <one-to-many class=\"Child\"/>\n" +" </set>\n" +"</class>\n" +"\n" +"<class name=\"Child\">\n" +" <id name=\"id\" column=\"child_id\"/>\n" +" ....\n" +" <many-to-one name=\"parent\" \n" +" class=\"Parent\" \n" +" column=\"parent_id\"\n" +" not-null=\"true\"/>\n" +"</class>" + +#. Tag: para +#: collection_mapping.xml:890 +#, fuzzy, no-c-format +msgid "" +"Mapping one end of an association with inverse=\"true\" " +"does not affect the operation of cascades as these are orthogonal concepts." +msgstr "" +"Das Mappen eines der Enden einer Assoziation mit inverse=\"true\" hat keinen Einfluss auf die Weitergabevorgänge (sog. \"Cascades\"), " +"es handelt sich um orthogonale Konzepte!" + +#. Tag: para +#: collection_mapping.xml:894 +#, no-c-format +msgid "" +"A many-to-many association is defined logically using the " +"@ManyToMany annotation. You also have to describe the " +"association table and the join conditions using the @JoinTable annotation. If the association is bidirectional, one side has to be " +"the owner and one side has to be the inverse end (ie. it will be ignored " +"when updating the relationship values in the association table):" +msgstr "" + +#. Tag: title +#: collection_mapping.xml:903 +#, no-c-format +msgid "Many to many association via @ManyToMany" +msgstr "" + +#. Tag: programlisting +#: collection_mapping.xml:905 +#, no-c-format +msgid "" +"@Entity\n" +"public class Employer implements Serializable {\n" +" @ManyToMany(\n" +" targetEntity=org.hibernate.test.metadata.manytomany.Employee.class,\n" +" cascade={CascadeType.PERSIST, CascadeType.MERGE}\n" +" )\n" +" @JoinTable(\n" +" name=\"EMPLOYER_EMPLOYEE\",\n" +" joinColumns=@JoinColumn(name=\"EMPER_ID\"),\n" +" inverseJoinColumns=@JoinColumn(name=\"EMPEE_ID\")\n" +" )\n" +" public Collection getEmployees() {\n" +" return employees;\n" +" }\n" +" ...\n" +"}" +msgstr "" + +#. Tag: programlisting +#: collection_mapping.xml:907 +#, no-c-format +msgid "" +"@Entity\n" +"public class Employee implements Serializable {\n" +" @ManyToMany(\n" +" cascade = {CascadeType.PERSIST, CascadeType.MERGE},\n" +" mappedBy = \"employees\",\n" +" targetEntity = Employer.class\n" +" )\n" +" public Collection getEmployers() {\n" +" return employers;\n" +" }\n" +"}" +msgstr "" + +#. Tag: para +#: collection_mapping.xml:910 +#, no-c-format +msgid "" +"In this example @JoinTable defines a name, an array of join columns, and an array of inverse join columns. " +"The latter ones are the columns of the association table which refer to the " +"Employee primary key (the \"other side\"). As seen " +"previously, the other side don't have to (must not) describe the physical " +"mapping: a simple mappedBy argument containing the owner " +"side property name bind the two." +msgstr "" + +#. Tag: para +#: collection_mapping.xml:919 +#, no-c-format +msgid "" +"As any other annotations, most values are guessed in a many to many " +"relationship. Without describing any physical mapping in a unidirectional " +"many to many the following rules applied. The table name is the " +"concatenation of the owner table name, _ and the other side " +"table name. The foreign key name(s) referencing the owner table is the " +"concatenation of the owner table name, _ and the owner " +"primary key column(s). The foreign key name(s) referencing the other side is " +"the concatenation of the owner property name, _, and the " +"other side primary key column(s). These are the same rules used for a " +"unidirectional one to many relationship." +msgstr "" + +#. Tag: title +#: collection_mapping.xml:932 +#, no-c-format +msgid "Default values for @ManyToMany (uni-directional)" +msgstr "" + +#. Tag: programlisting +#: collection_mapping.xml:935 +#, no-c-format +msgid "" +"@Entity\n" +"public class Store {\n" +" @ManyToMany(cascade = CascadeType.PERSIST)\n" +" public Set<City> getImplantedIn() {\n" +" ...\n" +" }\n" +"}\n" +"\n" +"@Entity\n" +"public class City {\n" +" ... //no bidirectional relationship\n" +"}" +msgstr "" + +#. Tag: para +#: collection_mapping.xml:938 +#, no-c-format +msgid "" +"A Store_City is used as the join table. The " +"Store_id column is a foreign key to the Store table. The implantedIn_id column is a foreign " +"key to the City table." +msgstr "" + +#. Tag: para +#: collection_mapping.xml:943 +#, no-c-format +msgid "" +"Without describing any physical mapping in a bidirectional many to many the " +"following rules applied. The table name is the concatenation of the owner " +"table name, _ and the other side table name. The foreign " +"key name(s) referencing the owner table is the concatenation of the other " +"side property name, _, and the owner primary key column(s). " +"The foreign key name(s) referencing the other side is the concatenation of " +"the owner property name, _, and the other side primary key " +"column(s). These are the same rules used for a unidirectional one to many " +"relationship." +msgstr "" + +#. Tag: title +#: collection_mapping.xml:955 +#, no-c-format +msgid "Default values for @ManyToMany (bi-directional)" +msgstr "" + +#. Tag: programlisting +#: collection_mapping.xml:958 +#, no-c-format +msgid "" +"@Entity\n" +"public class Store {\n" +" @ManyToMany(cascade = {CascadeType.PERSIST, CascadeType.MERGE})\n" +" public Set<Customer> getCustomers() {\n" +" ...\n" +" }\n" +"}\n" +"\n" +"@Entity\n" +"public class Customer {\n" +" @ManyToMany(mappedBy=\"customers\")\n" +" public Set<Store> getStores() {\n" +" ...\n" +" }\n" +"}" +msgstr "" + +#. Tag: para +#: collection_mapping.xml:961 +#, no-c-format +msgid "" +"A Store_Customer is used as the join table. The " +"stores_id column is a foreign key to the Store table. The customers_id column is a foreign key " +"to the Customer table." +msgstr "" + +#. Tag: para +#: collection_mapping.xml:966 +#, fuzzy, no-c-format +msgid "" +"Using Hibernate mapping files you can map a bidirectional many-to-many " +"association by mapping two many-to-many associations to the same database " +"table and declaring one end as inverse." msgstr "" "Sie können eine bidirektionale \"Many-to-Many\"-Assoziation ganz einfach " "festlegen, indem Sie zwei \"Many-to-Many\"-Assoziationen zur selben " @@ -1209,17 +2427,76 @@ msgstr "" "indizierte Collection sein)." #. Tag: para +#: collection_mapping.xml:970 +#, no-c-format +msgid "You cannot select an indexed collection." +msgstr "" + +#. Tag: para +#: collection_mapping.xml:973 #, fuzzy, no-c-format msgid "" -"Here is an example of a bidirectional many-to-many association that " -"illustrates how each category can have many items and each item can be in " -"many categories:" +"shows a bidirectional many-to-many association that illustrates how each " +"category can have many items and each item can be in many categories:" msgstr "" "Nachfolgend sehen Sie ein Beispiel für eine bidirektionale \"Many-to-Many\"-" "Assoziation. Jede Kategorie kann viele Posten besitzen und jeder Posten kann " "sich in vielen Kategorien befinden:" +#. Tag: title +#: collection_mapping.xml:979 +#, no-c-format +msgid "Many to many association using Hibernate mapping files" +msgstr "" + +#. Tag: programlisting +#: collection_mapping.xml:981 +#, fuzzy, no-c-format +msgid "" +"<class name=\"Category\">\n" +" <id name=\"id\" column=\"CATEGORY_ID\"/>\n" +" ...\n" +" <bag name=\"items\" table=\"CATEGORY_ITEM\">\n" +" <key column=\"CATEGORY_ID\"/>\n" +" <many-to-many class=\"Item\" column=\"ITEM_ID\"/>\n" +" </bag>\n" +"</class>\n" +"\n" +"<class name=\"Item\">\n" +" <id name=\"id\" column=\"ITEM_ID\"/>\n" +" ...\n" +"\n" +" <!-- inverse end -->\n" +" <bag name=\"categories\" table=\"CATEGORY_ITEM\" inverse=\"true" +"\">\n" +" <key column=\"ITEM_ID\"/>\n" +" <many-to-many class=\"Category\" column=\"CATEGORY_ID\"/>\n" +" </bag>\n" +"</class>" +msgstr "" +"<class name=\"Category\">\n" +" <id name=\"id\" column=\"CATEGORY_ID\"/>\n" +" ...\n" +" <bag name=\"items\" table=\"CATEGORY_ITEM\">\n" +" <key column=\"CATEGORY_ID\"/>\n" +" <many-to-many class=\"Item\" column=\"ITEM_ID\"/>\n" +" </bag>\n" +"</class>\n" +"\n" +"<class name=\"Item\">\n" +" <id name=\"id\" column=\"CATEGORY_ID\"/>\n" +" ...\n" +"\n" +" <!-- inverse end -->\n" +" <bag name=\"categories\" table=\"CATEGORY_ITEM\" inverse=\"true" +"\">\n" +" <key column=\"ITEM_ID\"/>\n" +" <many-to-many class=\"Category\" column=\"CATEGORY_ID\"/>\n" +" </bag>\n" +"</class>" + #. Tag: para +#: collection_mapping.xml:984 #, fuzzy, no-c-format msgid "" "Changes made only to the inverse end of the association are notinverse=\"true\"." -msgstr "" -"Sie können eine bidirektionale \"One-to-Many\"-Assoziation definieren, indem " -"Sie eine \"One-to-Many\"-Assoziation zu derselben (oder denselben) " -"Tabellenspalte(n) wie eine \"Many-to-One\"-Assoziation mappen und für das " -"mehrwertige Ende inverse=\"true\" deklarieren." - -#. Tag: para -#, fuzzy, no-c-format -msgid "" -"Mapping one end of an association with inverse=\"true\" " -"does not affect the operation of cascades as these are orthogonal concepts." -msgstr "" -"Das Mappen eines der Enden einer Assoziation mit inverse=\"true\" hat keinen Einfluss auf die Weitergabevorgänge (sog. \"Cascades\"), " -"es handelt sich um orthogonale Konzepte!" - #. Tag: title +#: collection_mapping.xml:1003 #, no-c-format msgid "Bidirectional associations with indexed collections" msgstr "Bidirektionale Assoziationen mit indizierten Collections" #. Tag: para +#: collection_mapping.xml:1005 #, fuzzy, no-c-format msgid "" -"A bidirectional association where one end is represented as a <" -"list> or <map>, requires special " -"consideration. If there is a property of the child class that maps to the " -"index column you can use inverse=\"true\" on the " -"collection mapping:" +"There are some additional considerations for bidirectional mappings with " +"indexed collections (where one end is represented as a <list>" +" or <map>) when using Hibernate mapping " +"files. If there is a property of the child class that maps to the index " +"column you can use inverse=\"true\" on the collection " +"mapping:" msgstr "" "Eine bidirektionale Assoziation, bei der ein Ende als <list> oder <map> dargestellt ist, erfordert " @@ -1287,7 +2574,62 @@ msgstr "" "Probleme und wir können mit der Verwendung von inverse=\"true\" beim Collection-Mapping fortfahren:" +#. Tag: title +#: collection_mapping.xml:1013 +#, fuzzy, no-c-format +msgid "Bidirectional association with indexed collection" +msgstr "Bidirektionale Assoziationen mit indizierten Collections" + +#. Tag: programlisting +#: collection_mapping.xml:1015 +#, fuzzy, no-c-format +msgid "" +"<class name=\"Parent\">\n" +" <id name=\"id\" column=\"parent_id\"/>\n" +" ....\n" +" <map name=\"children\" inverse=\"true\">\n" +" <key column=\"parent_id\"/>\n" +" <map-key column=\"name\" \n" +" type=\"string\"/>\n" +" <one-to-many class=\"Child\"/>\n" +" </map>\n" +"</class>\n" +"\n" +"<class name=\"Child\">\n" +" <id name=\"id\" column=\"child_id\"/>\n" +" ....\n" +" <property name=\"name\" \n" +" not-null=\"true\"/>\n" +" <many-to-one name=\"parent\" \n" +" class=\"Parent\" \n" +" column=\"parent_id\"\n" +" not-null=\"true\"/>\n" +"</class>" +msgstr "" +"<class name=\"Parent\">\n" +" <id name=\"id\" column=\"parent_id\"/>\n" +" ....\n" +" <map name=\"children\" inverse=\"true\">\n" +" <key column=\"parent_id\"/>\n" +" <map-key column=\"name\" \n" +" type=\"string\"/>\n" +" <one-to-many class=\"Child\"/>\n" +" </map>\n" +"</class>\n" +"\n" +"<class name=\"Child\">\n" +" <id name=\"id\" column=\"child_id\"/>\n" +" ....\n" +" <property name=\"name\" \n" +" not-null=\"true\"/>\n" +" <many-to-one name=\"parent\" \n" +" class=\"Parent\" \n" +" column=\"parent_id\"\n" +" not-null=\"true\"/>\n" +"</class>" + #. Tag: para +#: collection_mapping.xml:1018 #, fuzzy, no-c-format msgid "" "If there is no such property on the child class, the association cannot be " @@ -1303,7 +2645,64 @@ msgstr "" "inverse=\"true\" mappen. Statt dessen empfehlen wir " "folgendes Mapping:" +#. Tag: title +#: collection_mapping.xml:1026 +#, fuzzy, no-c-format +msgid "Bidirectional association with indexed collection, but no index column" +msgstr "Bidirektionale Assoziationen mit indizierten Collections" + +#. Tag: programlisting +#: collection_mapping.xml:1029 +#, fuzzy, no-c-format +msgid "" +"<class name=\"Parent\">\n" +" <id name=\"id\" column=\"parent_id\"/>\n" +" ....\n" +" <map name=\"children\">\n" +" <key column=\"parent_id\"\n" +" not-null=\"true\"/>\n" +" <map-key column=\"name\" \n" +" type=\"string\"/>\n" +" <one-to-many class=\"Child\"/>\n" +" </map>\n" +"</class>\n" +"\n" +"<class name=\"Child\">\n" +" <id name=\"id\" column=\"child_id\"/>\n" +" ....\n" +" <many-to-one name=\"parent\" \n" +" class=\"Parent\" \n" +" column=\"parent_id\"\n" +" insert=\"false\"\n" +" update=\"false\"\n" +" not-null=\"true\"/>\n" +"</class>" +msgstr "" +"<class name=\"Parent\">\n" +" <id name=\"id\" column=\"parent_id\"/>\n" +" ....\n" +" <map name=\"children\">\n" +" <key column=\"parent_id\"\n" +" not-null=\"true\"/>\n" +" <map-key column=\"name\" \n" +" type=\"string\"/>\n" +" <one-to-many class=\"Child\"/>\n" +" </map>\n" +"</class>\n" +"\n" +"<class name=\"Child\">\n" +" <id name=\"id\" column=\"child_id\"/>\n" +" ....\n" +" <many-to-one name=\"parent\" \n" +" class=\"Parent\" \n" +" column=\"parent_id\"\n" +" insert=\"false\"\n" +" update=\"false\"\n" +" not-null=\"true\"/>\n" +"</class>" + #. Tag: para +#: collection_mapping.xml:1032 #, fuzzy, no-c-format msgid "" "Note that in this mapping, the collection-valued end of the association is " @@ -1314,11 +2713,13 @@ msgstr "" "Führt dies zu unnötigen Aktualisierungsanweisungen? " #. Tag: title +#: collection_mapping.xml:1037 #, no-c-format msgid "Ternary associations" msgstr "Dreifache Assoziationen" #. Tag: para +#: collection_mapping.xml:1039 #, fuzzy, no-c-format msgid "" "There are three possible approaches to mapping a ternary association. One " @@ -1328,40 +2729,64 @@ msgstr "" "ist die Verwendung von Map mit einer Assoziation als " "deren Index:" +#. Tag: title +#: collection_mapping.xml:1044 +#, fuzzy, no-c-format +msgid "Ternary association mapping" +msgstr "Dreifache Assoziationen" + +#. Tag: programlisting +#: collection_mapping.xml:1046 +#, no-c-format +msgid "" +"@Entity\n" +"public class Company {\n" +" @Id \n" +" int id;\n" +" ...\n" +" @OneToMany // unidirectional\n" +" @MapKeyJoinColumn(name=\"employee_id\")\n" +" Map<Employee, Contract> contracts;\n" +"}\n" +"\n" +"// or\n" +"\n" +"<map name=\"contracts\">\n" +" <key column=\"employer_id\" not-null=\"true\"/>\n" +" <map-key-many-to-many column=\"employee_id\" class=\"Employee\"/>\n" +" <one-to-many class=\"Contract\"/>\n" +"</map>" +msgstr "" + #. Tag: para +#: collection_mapping.xml:1049 #, fuzzy, no-c-format msgid "" "A second approach is to remodel the association as an entity class. This is " -"the most common approach." +"the most common approach. A final alternative is to use composite elements, " +"which will be discussed later." msgstr "" "Ein zweiter Weg ist es, die Assoziation einfach als eine Entity-Klasse zu " "gestalten. Das ist die am häufigsten gewählte Herangehensweise." -#. Tag: para +#. Tag: literal +#: collection_mapping.xml:1055 #, fuzzy, no-c-format -msgid "" -"A final alternative is to use composite elements, which will be discussed " -"later." -msgstr "" -"Die dritte und letzte Variante besteht in der Verwendung zusammengesetzter " -"Elemente, auf die wir zu einem späteren Zeitpunkt näher eingehen werden." - -#. Tag: title -#, fuzzy, no-c-format -msgid "Using an <idbag>" +msgid "Using an <idbag>" msgstr "Die Verwendung einer <idbag>" #. Tag: para +#: collection_mapping.xml:1057 #, fuzzy, no-c-format msgid "" "The majority of the many-to-many associations and collections of values " "shown previously all map to tables with composite keys, even though it has " -"been have suggested that entities should have synthetic identifiers " -"(surrogate keys). A pure association table does not seem to benefit much " -"from a surrogate key, although a collection of composite values " -"might. It is for this reason that Hibernate provides a " -"feature that allows you to map many-to-many associations and collections of " -"values to a table with a surrogate key." +"been suggested that entities should have synthetic identifiers (surrogate " +"keys). A pure association table does not seem to benefit much from a " +"surrogate key, although a collection of composite values might. For this reason Hibernate provides a feature that allows you to " +"map many-to-many associations and collections of values to a table with a " +"surrogate key." msgstr "" "Falls Sie unsere Ansicht teilen und ebenfalls der Meinung sind, dass " "zusammengesetzte Schlüssel keine gute Sache sind und Entities synthetische " @@ -1376,6 +2801,7 @@ msgstr "" "einer Tabelle mit einem Surrogatschlüssel zu mappen." #. Tag: para +#: collection_mapping.xml:1066 #, fuzzy, no-c-format msgid "" "The <idbag> element lets you map a List<idbag>-Element lässt Sie eine List (oder Collection) mit \"Bag\"-Semantik mappen." +#. Tag: programlisting +#: collection_mapping.xml:1070 +#, fuzzy, no-c-format +msgid "" +"<idbag name=\"lovers\" table=\"LOVERS\">\n" +" <collection-id column=\"ID\" type=\"long\">\n" +" <generator class=\"sequence\"/>\n" +" </collection-id>\n" +" <key column=\"PERSON1\"/>\n" +" <many-to-many column=\"PERSON2\" class=\"Person\" fetch=\"join\"/" +">\n" +"</idbag>" +msgstr "" +"<idbag name=\"lovers\" table=\"LOVERS\">\n" +" <collection-id column=\"ID\" type=\"long\">\n" +" <generator class=\"sequence\"/>\n" +" </collection-id>\n" +" <key column=\"PERSON1\"/>\n" +" <many-to-many column=\"PERSON2\" class=\"Person\" fetch=\"join\"/" +">\n" +"</idbag>" + #. Tag: para +#: collection_mapping.xml:1072 #, fuzzy, no-c-format msgid "" "An <idbag> has a synthetic id generator, just like " @@ -1399,6 +2848,7 @@ msgstr "" "herauszufinden." #. Tag: para +#: collection_mapping.xml:1077 #, fuzzy, no-c-format msgid "" "The update performance of an <idbag> supersedes a " @@ -1413,6 +2863,7 @@ msgstr "" "ganz wie bei einer Liste, einer Map oder einem Set." #. Tag: para +#: collection_mapping.xml:1082 #, no-c-format msgid "" "In the current implementation, the native identifier " @@ -1424,16 +2875,19 @@ msgstr "" "Collection-Bezeichner unterstützt." #. Tag: title +#: collection_mapping.xml:1103 #, no-c-format msgid "Collection examples" msgstr "Collection-Beispiele" #. Tag: para +#: collection_mapping.xml:1105 #, fuzzy, no-c-format msgid "This section covers collection examples." msgstr "Collection-Beispiele" #. Tag: para +#: collection_mapping.xml:1107 #, fuzzy, no-c-format msgid "" "The following class has a collection of Child instances:" @@ -1441,7 +2895,39 @@ msgstr "" "Der folgende Code würde verwendet, um ein neues Child " "hinzuzufügen" +#. Tag: title +#: collection_mapping.xml:1111 +#, no-c-format +msgid "" +"Example classes Parent and Child" +msgstr "" + +#. Tag: programlisting +#: collection_mapping.xml:1114 +#, no-c-format +msgid "" +"public class Parent {\n" +" private long id;\n" +" private Set<Child> children;\n" +"\n" +" // getter/setter\n" +" ...\n" +"}\n" +"\n" +"\n" +"public class Child {\n" +" private long id;\n" +" private String name\n" +"\n" +" \n" +" // getter/setter\n" +" ...\n" +"}" +msgstr "" + #. Tag: para +#: collection_mapping.xml:1117 #, fuzzy, no-c-format msgid "" "If each child has, at most, one parent, the most natural mapping is a one-to-" @@ -1451,12 +2937,127 @@ msgstr "" "\"child\" (untergeordnet) höchstens einen \"parent\" (übergeordnet) besitzt, " "so ist das natürlichste Mapping eine \"One-to-Many\"-Assoziation:" +#. Tag: title +#: collection_mapping.xml:1121 +#, no-c-format +msgid "" +"One to many unidirectional Parent-Child relationship " +"using annotations" +msgstr "" + +#. Tag: programlisting +#: collection_mapping.xml:1124 +#, no-c-format +msgid "" +"public class Parent {\n" +" @Id\n" +" @GeneratedValue\n" +" private long id;\n" +"\n" +" @OneToMany\n" +" private Set<Child> children;\n" +"\n" +" // getter/setter\n" +" ...\n" +"}\n" +"\n" +"\n" +"public class Child {\n" +" @Id\n" +" @GeneratedValue\n" +" private long id;\n" +" private String name;\n" +"\n" +" \n" +" // getter/setter\n" +" ...\n" +"}" +msgstr "" + +#. Tag: title +#: collection_mapping.xml:1128 +#, no-c-format +msgid "" +"One to many unidirectional Parent-Child relationship " +"using mapping files" +msgstr "" + +#. Tag: programlisting +#: collection_mapping.xml:1131 +#, fuzzy, no-c-format +msgid "" +"<hibernate-mapping>\n" +"\n" +" <class name=\"Parent\">\n" +" <id name=\"id\">\n" +" <generator class=\"sequence\"/>\n" +" </id>\n" +" <set name=\"children\">\n" +" <key column=\"parent_id\"/>\n" +" <one-to-many class=\"Child\"/>\n" +" </set>\n" +" </class>\n" +"\n" +" <class name=\"Child\">\n" +" <id name=\"id\">\n" +" <generator class=\"sequence\"/>\n" +" </id>\n" +" <property name=\"name\"/>\n" +" </class>\n" +"\n" +"</hibernate-mapping>" +msgstr "" +"<hibernate-mapping>\n" +"\n" +" <class name=\"Parent\">\n" +" <id name=\"id\">\n" +" <generator class=\"sequence\"/>\n" +" </id>\n" +" <set name=\"children\">\n" +" <key column=\"parent_id\"/>\n" +" <one-to-many class=\"Child\"/>\n" +" </set>\n" +" </class>\n" +"\n" +" <class name=\"Child\">\n" +" <id name=\"id\">\n" +" <generator class=\"sequence\"/>\n" +" </id>\n" +" <property name=\"name\"/>\n" +" </class>\n" +"\n" +"</hibernate-mapping>" + #. Tag: para +#: collection_mapping.xml:1134 #, no-c-format msgid "This maps to the following table definitions:" msgstr "Das mappt zu den folgenden Tabellendefinitionen:" +#. Tag: title +#: collection_mapping.xml:1137 +#, no-c-format +msgid "" +"Table definitions for unidirectional Parent-" +"Child relationship" +msgstr "" + +#. Tag: programlisting +#: collection_mapping.xml:1141 +#, fuzzy, no-c-format +msgid "" +"create table parent ( id bigint not null primary key )\n" +"create table child ( id bigint not null primary key, name varchar(255), " +"parent_id bigint )\n" +"alter table child add constraint childfk0 (parent_id) references parent" +msgstr "" +"create table parent ( id bigint not null primary key )\n" +"create table child ( id bigint not null primary key, name varchar(255), " +"parent_id bigint )\n" +"alter table child add constraint childfk0 (parent_id) references parent" + #. Tag: para +#: collection_mapping.xml:1144 #, no-c-format msgid "" "If the parent is required, use a bidirectional one-to-" @@ -1465,174 +3066,568 @@ msgstr "" "Falls der \"parent\" erforderlich ist, verwenden Sie " "eine bidirektionale \"One-to-Many\"-Assoziation:" +#. Tag: title +#: collection_mapping.xml:1148 +#, no-c-format +msgid "" +"One to many bidirectional Parent-Child relationship " +"using annotations" +msgstr "" + +#. Tag: programlisting +#: collection_mapping.xml:1151 +#, no-c-format +msgid "" +"public class Parent {\n" +" @Id\n" +" @GeneratedValue\n" +" private long id;\n" +"\n" +" @OneToMany(mappedBy=\"parent\")\n" +" private Set<Child> children;\n" +"\n" +" // getter/setter\n" +" ...\n" +"}\n" +"\n" +"\n" +"public class Child {\n" +" @Id\n" +" @GeneratedValue\n" +" private long id;\n" +"\n" +" private String name;\n" +" \n" +" @ManyToOne\n" +" private Parent parent;\n" +"\n" +" \n" +" // getter/setter\n" +" ...\n" +"}" +msgstr "" + +#. Tag: title +#: collection_mapping.xml:1155 +#, no-c-format +msgid "" +"One to many bidirectional Parent-Child relationship " +"using mapping files" +msgstr "" + +#. Tag: programlisting +#: collection_mapping.xml:1158 +#, fuzzy, no-c-format +msgid "" +"<hibernate-mapping>\n" +"\n" +" <class name=\"Parent\">\n" +" <id name=\"id\">\n" +" <generator class=\"sequence\"/>\n" +" </id>\n" +" <set name=\"children\" inverse=\"true\">\n" +" <key column=\"parent_id\"/>\n" +" <one-to-many class=\"Child\"/>\n" +" </set>\n" +" </class>\n" +"\n" +" <class name=\"Child\">\n" +" <id name=\"id\">\n" +" <generator class=\"sequence\"/>\n" +" </id>\n" +" <property name=\"name\"/>\n" +" <many-to-one name=\"parent\" class=\"Parent\" column=\"parent_id" +"\" not-null=\"true\"/>\n" +" </class>\n" +"\n" +"</hibernate-mapping>" +msgstr "" +"<hibernate-mapping>\n" +"\n" +" <class name=\"Parent\">\n" +" <id name=\"id\">\n" +" <generator class=\"sequence\"/>\n" +" </id>\n" +" <set name=\"children\" inverse=\"true\">\n" +" <key column=\"parent_id\"/>\n" +" <one-to-many class=\"Child\"/>\n" +" </set>\n" +" </class>\n" +"\n" +" <class name=\"Child\">\n" +" <id name=\"id\">\n" +" <generator class=\"sequence\"/>\n" +" </id>\n" +" <property name=\"name\"/>\n" +" <many-to-one name=\"parent\" class=\"Parent\" column=\"parent_id" +"\" not-null=\"true\"/>\n" +" </class>\n" +"\n" +"</hibernate-mapping>" + #. Tag: para +#: collection_mapping.xml:1161 #, no-c-format msgid "Notice the NOT NULL constraint:" msgstr "Beachten Sie die NOT NULL-Bedingung:" -#. Tag: para +#. Tag: title +#: collection_mapping.xml:1164 +#, no-c-format +msgid "" +"Table definitions for bidirectional Parent-" +"Child relationship" +msgstr "" + +#. Tag: programlisting +#: collection_mapping.xml:1168 #, fuzzy, no-c-format msgid "" -"Alternatively, if this association must be unidirectional you can declare " -"the NOT NULL constraint on the <key> mapping:" +"create table parent ( id bigint not null primary key )\n" +"create table child ( id bigint not null\n" +" primary key,\n" +" name varchar(255),\n" +" parent_id bigint not null )\n" +"alter table child add constraint childfk0 (parent_id) references parent" +msgstr "" +"create table parent ( id bigint not null primary key )\n" +"create table child ( id bigint not null\n" +" primary key,\n" +" name varchar(255),\n" +" parent_id bigint not null )\n" +"alter table child add constraint childfk0 (parent_id) references parent" + +#. Tag: para +#: collection_mapping.xml:1171 +#, fuzzy, no-c-format +msgid "" +"Alternatively, if this association must be unidirectional you can enforce " +"the NOT NULL constraint." msgstr "" "Andernfalls - falls Sie absolut darauf bestehen, dass diese Assoziation " "unidirektional ist - können Sie die NOT NULL-Bedingung am " "<key>-Mapping deklarieren:" +#. Tag: title +#: collection_mapping.xml:1175 +#, no-c-format +msgid "" +"Enforcing NOT NULL constraint in unidirectional relation using annotations" +msgstr "" + +#. Tag: programlisting +#: collection_mapping.xml:1178 +#, no-c-format +msgid "" +"public class Parent {\n" +" @Id\n" +" @GeneratedValue\n" +" private long id;\n" +"\n" +" @OneToMany(optional=false)\n" +" private Set<Child> children;\n" +"\n" +" // getter/setter\n" +" ...\n" +"}\n" +"\n" +"\n" +"public class Child {\n" +" @Id\n" +" @GeneratedValue\n" +" private long id;\n" +" private String name;\n" +"\n" +" \n" +" // getter/setter\n" +" ...\n" +"}" +msgstr "" + +#. Tag: title +#: collection_mapping.xml:1182 +#, no-c-format +msgid "" +"Enforcing NOT NULL constraint in unidirectional relation using mapping files" +msgstr "" + +#. Tag: programlisting +#: collection_mapping.xml:1185 +#, fuzzy, no-c-format +msgid "" +"<hibernate-mapping>\n" +"\n" +" <class name=\"Parent\">\n" +" <id name=\"id\">\n" +" <generator class=\"sequence\"/>\n" +" </id>\n" +" <set name=\"children\">\n" +" <key column=\"parent_id\" not-null=\"true\"/>\n" +" <one-to-many class=\"Child\"/>\n" +" </set>\n" +" </class>\n" +"\n" +" <class name=\"Child\">\n" +" <id name=\"id\">\n" +" <generator class=\"sequence\"/>\n" +" </id>\n" +" <property name=\"name\"/>\n" +" </class>\n" +"\n" +"</hibernate-mapping>" +msgstr "" +"<hibernate-mapping>\n" +"\n" +" <class name=\"Parent\">\n" +" <id name=\"id\">\n" +" <generator class=\"sequence\"/>\n" +" </id>\n" +" <set name=\"children\">\n" +" <key column=\"parent_id\" not-null=\"true\"/>\n" +" <one-to-many class=\"Child\"/>\n" +" </set>\n" +" </class>\n" +"\n" +" <class name=\"Child\">\n" +" <id name=\"id\">\n" +" <generator class=\"sequence\"/>\n" +" </id>\n" +" <property name=\"name\"/>\n" +" </class>\n" +"\n" +"</hibernate-mapping>" + #. Tag: para +#: collection_mapping.xml:1188 #, fuzzy, no-c-format msgid "" "On the other hand, if a child has multiple parents, a many-to-many " -"association is appropriate:" +"association is appropriate." msgstr "" "Wenn jedoch ein \"child\" mehrere \"parents\" besitzen kann, ist die \"Many-" "to-Many\"-Assoziation passender:" +#. Tag: title +#: collection_mapping.xml:1192 +#, no-c-format +msgid "" +"Many to many Parent-Child relationship using " +"annotations" +msgstr "" + +#. Tag: programlisting +#: collection_mapping.xml:1195 +#, no-c-format +msgid "" +"public class Parent {\n" +" @Id\n" +" @GeneratedValue\n" +" private long id;\n" +"\n" +" @ManyToMany\n" +" private Set<Child> children;\n" +"\n" +" // getter/setter\n" +" ...\n" +"}\n" +"\n" +"\n" +"public class Child {\n" +" @Id\n" +" @GeneratedValue\n" +" private long id;\n" +"\n" +" private String name;\n" +"\n" +" \n" +" // getter/setter\n" +" ...\n" +"}" +msgstr "" + +#. Tag: title +#: collection_mapping.xml:1199 +#, no-c-format +msgid "" +"Many to many Parent-Child relationship using mapping " +"files" +msgstr "" + +#. Tag: programlisting +#: collection_mapping.xml:1202 +#, fuzzy, no-c-format +msgid "" +"<hibernate-mapping>\n" +"\n" +" <class name=\"Parent\">\n" +" <id name=\"id\">\n" +" <generator class=\"sequence\"/>\n" +" </id>\n" +" <set name=\"children\" table=\"childset\">\n" +" <key column=\"parent_id\"/>\n" +" <many-to-many class=\"Child\" column=\"child_id\"/>\n" +" </set>\n" +" </class>\n" +"\n" +" <class name=\"Child\">\n" +" <id name=\"id\">\n" +" <generator class=\"sequence\"/>\n" +" </id>\n" +" <property name=\"name\"/>\n" +" </class>\n" +"\n" +"</hibernate-mapping>" +msgstr "" +"<hibernate-mapping>\n" +"\n" +" <class name=\"Parent\">\n" +" <id name=\"id\">\n" +" <generator class=\"sequence\"/>\n" +" </id>\n" +" <set name=\"children\" table=\"childset\">\n" +" <key column=\"parent_id\"/>\n" +" <many-to-many class=\"Child\" column=\"child_id\"/>\n" +" </set>\n" +" </class>\n" +"\n" +" <class name=\"Child\">\n" +" <id name=\"id\">\n" +" <generator class=\"sequence\"/>\n" +" </id>\n" +" <property name=\"name\"/>\n" +" </class>\n" +"\n" +"</hibernate-mapping>" + #. Tag: para +#: collection_mapping.xml:1205 #, no-c-format msgid "Table definitions:" msgstr "Tabellendefinitionen:" +#. Tag: title +#: collection_mapping.xml:1208 +#, no-c-format +msgid "Table definitions for many to many releationship" +msgstr "" + +#. Tag: programlisting +#: collection_mapping.xml:1210 +#, fuzzy, no-c-format +msgid "" +"create table parent ( id bigint not null primary key )\n" +"create table child ( id bigint not null primary key, name varchar(255) )\n" +"create table childset ( parent_id bigint not null,\n" +" child_id bigint not null,\n" +" primary key ( parent_id, child_id ) )\n" +"alter table childset add constraint childsetfk0 (parent_id) references " +"parent\n" +"alter table childset add constraint childsetfk1 (child_id) references child" +msgstr "" +"create table parent ( id bigint not null primary key )\n" +"create table child ( id bigint not null primary key, name varchar(255) )\n" +"create table childset ( parent_id bigint not null,\n" +" child_id bigint not null,\n" +" primary key ( parent_id, child_id ) )\n" +"alter table childset add constraint childsetfk0 (parent_id) references " +"parent\n" +"alter table childset add constraint childsetfk1 (child_id) references child" + #. Tag: para +#: collection_mapping.xml:1213 #, fuzzy, no-c-format msgid "" "For more examples and a complete explanation of a parent/child relationship " -"mapping, see for more information." +"mapping, see for more information. " +"Even more complex association mappings are covered in the next chapter." msgstr "" "Weitere Beispiele und eine vollständige Abhandlung des Mappings der \"parent/" "child\"-Beziehung finden Sie unter ." -#. Tag: para -#, fuzzy, no-c-format -msgid "Even more complex association mappings are covered in the next chapter." -msgstr "" -"Es sind sogar noch weitaus exotischere Assoziations-Mappings möglich, die " -"wir im nächsten Kapitel ausführen." - #, fuzzy #~ msgid "" -#~ "" +#~ "Hibernate requires that persistent collection-valued fields be declared " +#~ "as an interface type. For example:" #~ msgstr "" -#~ "public class Product {\n" -#~ " private String serialNumber;\n" -#~ " private Set parts = new HashSet();\n" -#~ " \n" -#~ " public Set getParts() { return parts; }\n" -#~ " void setParts(Set parts) { this.parts = parts; }\n" -#~ " public String getSerialNumber() { return serialNumber; }\n" -#~ " void setSerialNumber(String sn) { serialNumber = sn; }\n" -#~ "}" +#~ "In Hibernate müssen persistente Collection-wertige Felder als Interface-" +#~ "Typ deklariert werden, zum Beispiel:" + +#~ msgid "Collection mappings" +#~ msgstr "Collection-Mappings" #, fuzzy #~ msgid "" -#~ "" +#~ "There are quite a range of mappings that can be generated for collections " +#~ "that cover many common relational models. We suggest you experiment with " +#~ "the schema generation tool so that you understand how various mapping " +#~ "declarations translate to database tables." #~ msgstr "" -#~ "Cat cat = new DomesticCat();\n" -#~ "Cat kitten = new DomesticCat();\n" -#~ "....\n" -#~ "Set kittens = new HashSet();\n" -#~ "kittens.add(kitten);\n" -#~ "cat.setKittens(kittens);\n" -#~ "session.persist(cat);\n" -#~ "kittens = cat.getKittens(); // Okay, kittens collection is a Set\n" -#~ "(HashSet) cat.getKittens(); // Error!" +#~ "Es gibt eine ganze Reihe von Mappings, die für Collections generiert " +#~ "werden können und die zahlreiche gängige relationale Modelle abdecken. Es " +#~ "ist wahrscheinlich sinnvoll, wenn Sie mit dem Tool zur Schemagenerierung " +#~ "experimentieren, um zu sehen, wie die verschiedenen Mapping-Deklarationen " +#~ "bei Datenbanktabellen umgesetzt werden." + +#~ msgid "Collection elements" +#~ msgstr "Collection-Elemente" -#, fuzzy #~ msgid "" -#~ "\n" -#~ " \n" -#~ " \n" -#~ " \n" -#~ " \n" -#~ " \n" -#~ "]]>" +#~ "The contained type is referred to as the collection element " +#~ "type. Collection elements are mapped by <" +#~ "element> or <composite-element>, or " +#~ "in the case of entity references, with <one-to-many> or <many-to-many>. The first two map " +#~ "elements with value semantics, the next two are used to map entity " +#~ "associations." #~ msgstr "" -#~ "<class name=\"Product\">\n" -#~ " <id name=\"serialNumber\" column=\"productSerialNumber\"/>\n" -#~ " <set name=\"parts\">\n" -#~ " <key column=\"productSerialNumber\" not-null=\"true\"/>\n" -#~ " <one-to-many class=\"Part\"/>\n" -#~ " </set>\n" -#~ "</class>" +#~ "Der enthaltene Typ wird als Typ von Collection-Element bezeichnet. Collection-Elemente werden durch <" +#~ "element> oder <composite-element> - " +#~ "oder im Fall von Entity-Verweisen - durch <one-to-many> oder <many-to-many> gemappt. Die ersten " +#~ "beiden Elemente mappen mit Wertsemantik, die beiden folgenden werden für " +#~ "das Mappen von Entity-Assoziationen verwendet." #, fuzzy #~ msgid "" -#~ "\n" -#~ "\n" -#~ " \n" -#~ " \n" -#~ " \n" -#~ "]]>" +#~ "All collection mappings, except those with set and bag semantics, need an " +#~ "index column in the collection table. An index " +#~ "column is a column that maps to an array index, or List index, or Map key. The index of a " +#~ "Map may be of any basic type, mapped with <" +#~ "map-key>. It can be an entity reference mapped with " +#~ "<map-key-many-to-many>, or it can be a composite " +#~ "type mapped with <composite-map-key>. The index " +#~ "of an array or list is always of type integer and is " +#~ "mapped using the <list-index> element. The " +#~ "mapped column contains sequential integers that are numbered from zero by " +#~ "default." #~ msgstr "" -#~ "<map\n" -#~ " name=\"propertyName\"\n" -#~ " table=\"table_name\"\n" -#~ " schema=\"schema_name\"\n" -#~ " lazy=\"true|extra|false\"\n" -#~ " inverse=\"true|false\"\n" -#~ " cascade=\"all|none|save-update|delete|all-delete-orphan|delete-orphan" -#~ "\"\n" -#~ " sort=\"unsorted|natural|comparatorClass\"\n" -#~ " order-by=\"column_name asc|desc\"\n" -#~ " where=\"arbitrary sql where condition\"\n" -#~ " fetch=\"join|select|subselect\"\n" -#~ " batch-size=\"N\"\n" -#~ " access=\"field|property|ClassName\"\n" -#~ " optimistic-lock=\"true|false\"\n" -#~ " mutable=\"true|false\"\n" -#~ " node=\"element-name|.\"\n" -#~ " embed-xml=\"true|false\"\n" -#~ ">\n" -#~ "\n" -#~ " <key .... />\n" -#~ " <map-key .... />\n" -#~ " <element .... />\n" -#~ "</map>" - -#, fuzzy -#~ msgid "]]>" -#~ msgstr "<key column=\"productSerialNumber\" not-null=\"true\"/>" +#~ "Alle Collection-Mappings - außer denen mit \"Set\"- und \"Bag\"-Semantik " +#~ "- benötigen eine Indexspalte in der Collection-" +#~ "Tabelle. Es handelt sich dabei um eine Spalte, die zu einem Verzeichnis " +#~ "von Datenelementen, List-Verzeichnis oder " +#~ "Map-Schlüssel mappt. Der Index einer Map kann jeden Grundtyp besitzen, der mit <map-key> gemappt ist. Es kann ein mit <map-key-many-to-" +#~ "many> gemappter Entity-Verweis oder ein mit <" +#~ "composite-map-key> gemappter zusammengesetzter Typ sein. Der " +#~ "Index eines Datenelements oder einer Liste ist immer vom Typ her " +#~ "integer und wird mittels <list-index>-Element gemappt. Die gemappte Spalte enthält sequenzielle ganze " +#~ "Zahlen (im Standard ab Null durchnummeriert)." #, fuzzy #~ msgid "" -#~ "]]>" -#~ msgstr "<key column=\"productSerialNumber\" on-delete=\"cascade\"/>" +#~ "Any collection of values or many-to-many associations requires a " +#~ "dedicated collection table with a foreign key column " +#~ "or columns, collection element column or columns, " +#~ "and possibly an index column or columns." +#~ msgstr "" +#~ "Jede Collection von Werten oder \"Many-to-Many\"-Assoziation erfordert " +#~ "eine zugeordnete Collection-Tabelle mit einer oder " +#~ "mehreren Fremdschlüsselspalten, Collection-Element-Spalte(n) oder möglicherweise einer oder mehreren Indexspalte(n)." + +#, fuzzy +#~ msgid "" +#~ "column (optional): the name of the element foreign key " +#~ "column." +#~ msgstr "" +#~ "class (erforderlich): Der Name der zugehörigen Klasse." + +#, fuzzy +#~ msgid "" +#~ "formula (optional): an SQL formula used to evaluate " +#~ "the element foreign key value." +#~ msgstr "" +#~ "schema (optional) der Name eines Tabellenschemas, der " +#~ "das im Stammelement deklarierte Schema außer Kraft setzt" + +#, fuzzy +#~ msgid "" +#~ "not-found (optional - defaults to exception): specifies how foreign keys that reference missing rows will be " +#~ "handled: ignore will treat a missing row as a null " +#~ "association." +#~ msgstr "" +#~ "not-found (optional - standardmäßig " +#~ "exception): Bestimmt, wie gespeicherte Bezeichner " +#~ "(sog. \"Identifier\"), die auf fehlende Reihen verweisen, behandelt " +#~ "werden. Mit ignore wird eine fehlende Reihe als Null-" +#~ "Assoziation angesehen." + +#, fuzzy +#~ msgid "" +#~ "A bag containing integers with an iteration order determined by the " +#~ "order-by attribute:" +#~ msgstr "" +#~ "Eine ganze Zahlen enthaltende \"Bag\" (mit einer durch das order-" +#~ "by-Attribut bestimmten Reihenfolge):" + +#, fuzzy +#~ msgid "An array of entities, in this case, a many-to-many association:" +#~ msgstr "" +#~ "Ein Datenelement von Entities - in diesem Fall eine \"Many-to-Many\"-" +#~ "Assoziation:" + +#~ msgid "A map from string indices to dates:" +#~ msgstr "Eine Map von String-Indexen zu Daten:" + +#, fuzzy +#~ msgid "A list of components (this is discussed in the next chapter):" +#~ msgstr "" +#~ "Eine List von Komponenten (wird im nachfolgenden Kapitel näher erläutert):" + +#~ msgid "One-to-many associations" +#~ msgstr "\"One-to-Many\"-Assoziationen" + +#, fuzzy +#~ msgid "" +#~ "A one-to-many association links the tables of two " +#~ "classes via a foreign key with no intervening collection table. This " +#~ "mapping loses certain semantics of normal Java collections:" +#~ msgstr "" +#~ "Eine \"One-to-Many\"-Assoziation verbindet die " +#~ "Tabellen zweier Klassen mittels des Fremdschlüssels ohne eine " +#~ "intervenierende Collection-Tabelle. Dieses Mapping verliert bestimmte " +#~ "Teile der Semantik regulärer Java-Collections:" + +#, fuzzy +#~ msgid "" +#~ "The following example shows a map of Part entities by " +#~ "name, where partName is a persistent property of " +#~ "Part. Notice the use of a formula-based index:" +#~ msgstr "" +#~ "Dieses Beispiel zeigt die Map von Part-Entities nach " +#~ "Name (wobei partName eine persistente Property von " +#~ "Part) ist. Beachten Sie die Verwendung eines " +#~ "formelbasierten Index." + +#~ msgid "" +#~ "Hibernate supports collections implementing java.util.SortedMap and java.util.SortedSet. You must specify a " +#~ "comparator in the mapping file:" +#~ msgstr "" +#~ "Hibernate unterstützt java.util.SortedMap und " +#~ "java.util.SortedSet implementierende Collections. Sie " +#~ "müssen ein Vergleichsprogramm in der Mapping-Datei bestimmen:" + +#, fuzzy +#~ msgid "" +#~ "A final alternative is to use composite elements, which will be discussed " +#~ "later." +#~ msgstr "" +#~ "Die dritte und letzte Variante besteht in der Verwendung " +#~ "zusammengesetzter Elemente, auf die wir zu einem späteren Zeitpunkt näher " +#~ "eingehen werden." + +#, fuzzy +#~ msgid "" +#~ "Even more complex association mappings are covered in the next chapter." +#~ msgstr "" +#~ "Es sind sogar noch weitaus exotischere Assoziations-Mappings möglich, die " +#~ "wir im nächsten Kapitel ausführen." #, fuzzy #~ msgid "" @@ -1724,24 +3719,6 @@ msgstr "" #~ " </composite-element>\n" #~ "</list>" -#, fuzzy -#~ msgid "" -#~ "]]>" -#~ msgstr "" -#~ "<one-to-many \n" -#~ " class=\"ClassName\"\n" -#~ " not-found=\"ignore|exception\"\n" -#~ " entity-name=\"EntityName\"\n" -#~ " node=\"element-name\"\n" -#~ " embed-xml=\"true|false\"\n" -#~ " />" - #, fuzzy #~ msgid "" #~ "\n" -#~ " \n" -#~ " \n" -#~ "\n" -#~ "\n" -#~ "\n" -#~ " \n" -#~ " \n" -#~ " \n" -#~ "]]>" -#~ msgstr "" -#~ "<set name=\"aliases\" \n" -#~ " table=\"person_aliases\" \n" -#~ " sort=\"natural\">\n" -#~ " <key column=\"person\"/>\n" -#~ " <element column=\"name\" type=\"string\"/>\n" -#~ "</set>\n" -#~ "\n" -#~ "<map name=\"holidays\" sort=\"my.custom.HolidayComparator\">\n" -#~ " <key column=\"year_id\"/>\n" -#~ " <map-key column=\"hol_name\" type=\"string\"/>\n" -#~ " <element column=\"hol_date\" type=\"date\"/>\n" -#~ "</map>" - -#, fuzzy -#~ msgid "" -#~ "\n" -#~ " \n" -#~ " \n" -#~ "\n" -#~ "\n" -#~ "\n" -#~ " \n" -#~ " \n" -#~ " \n" -#~ "]]>" -#~ msgstr "" -#~ "<set name=\"aliases\" table=\"person_aliases\" order-by=\"lower(name) " -#~ "asc\">\n" -#~ " <key column=\"person\"/>\n" -#~ " <element column=\"name\" type=\"string\"/>\n" -#~ "</set>\n" -#~ "\n" -#~ "<map name=\"holidays\" order-by=\"hol_date, hol_name\">\n" -#~ " <key column=\"year_id\"/>\n" -#~ " <map-key column=\"hol_name\" type=\"string\"/>\n" -#~ " <element column=\"hol_date type=\"date\"/>\n" -#~ "</map>" - -#, fuzzy -#~ msgid "" -#~ "" -#~ msgstr "" -#~ "sortedUsers = s.createFilter( group.getUsers(), \"order by this.name\" )." -#~ "list();" - -#, fuzzy -#~ msgid "" -#~ "\n" -#~ " \n" -#~ " ...\n" -#~ " \n" -#~ " \n" -#~ " \n" -#~ " \n" -#~ "\n" -#~ "\n" -#~ "\n" -#~ " \n" -#~ " ...\n" -#~ "\n" -#~ " \n" -#~ " \n" -#~ " \n" -#~ " \n" -#~ " \n" -#~ "]]>" -#~ msgstr "" -#~ "<class name=\"Category\">\n" -#~ " <id name=\"id\" column=\"CATEGORY_ID\"/>\n" -#~ " ...\n" -#~ " <bag name=\"items\" table=\"CATEGORY_ITEM\">\n" -#~ " <key column=\"CATEGORY_ID\"/>\n" -#~ " <many-to-many class=\"Item\" column=\"ITEM_ID\"/>\n" -#~ " </bag>\n" -#~ "</class>\n" -#~ "\n" -#~ "<class name=\"Item\">\n" -#~ " <id name=\"id\" column=\"CATEGORY_ID\"/>\n" -#~ " ...\n" -#~ "\n" -#~ " <!-- inverse end -->\n" -#~ " <bag name=\"categories\" table=\"CATEGORY_ITEM\" inverse=\"true" -#~ "\">\n" -#~ " <key column=\"ITEM_ID\"/>\n" -#~ " <many-to-many class=\"Category\" column=\"CATEGORY_ID\"/>\n" -#~ " </bag>\n" -#~ "</class>" - -#, fuzzy -#~ msgid "" -#~ "" -#~ msgstr "" -#~ "category.getItems().add(item); // The category now \"knows\" " -#~ "about the relationship\n" -#~ "item.getCategories().add(category); // The item now \"knows\" about " -#~ "the relationship\n" -#~ "\n" -#~ "session.persist(item); // The relationship won't be " -#~ "saved!\n" -#~ "session.persist(category); // The relationship will be saved" - -#, fuzzy -#~ msgid "" -#~ "\n" -#~ " \n" -#~ " ....\n" -#~ " \n" -#~ " \n" -#~ " \n" -#~ " \n" -#~ "\n" -#~ "\n" -#~ "\n" -#~ " \n" -#~ " ....\n" -#~ " \n" -#~ "]]>" -#~ msgstr "" -#~ "<class name=\"Parent\">\n" -#~ " <id name=\"id\" column=\"parent_id\"/>\n" -#~ " ....\n" -#~ " <set name=\"children\" inverse=\"true\">\n" -#~ " <key column=\"parent_id\"/>\n" -#~ " <one-to-many class=\"Child\"/>\n" -#~ " </set>\n" -#~ "</class>\n" -#~ "\n" -#~ "<class name=\"Child\">\n" -#~ " <id name=\"id\" column=\"child_id\"/>\n" -#~ " ....\n" -#~ " <many-to-one name=\"parent\" \n" -#~ " class=\"Parent\" \n" -#~ " column=\"parent_id\"\n" -#~ " not-null=\"true\"/>\n" -#~ "</class>" - -#, fuzzy -#~ msgid "" -#~ "\n" -#~ " \n" -#~ " ....\n" -#~ " \n" -#~ " \n" -#~ " \n" -#~ " \n" -#~ " \n" -#~ "\n" -#~ "\n" -#~ "\n" -#~ " \n" -#~ " ....\n" -#~ " \n" -#~ " \n" -#~ "]]>" -#~ msgstr "" -#~ "<class name=\"Parent\">\n" -#~ " <id name=\"id\" column=\"parent_id\"/>\n" -#~ " ....\n" -#~ " <map name=\"children\" inverse=\"true\">\n" -#~ " <key column=\"parent_id\"/>\n" -#~ " <map-key column=\"name\" \n" -#~ " type=\"string\"/>\n" -#~ " <one-to-many class=\"Child\"/>\n" -#~ " </map>\n" -#~ "</class>\n" -#~ "\n" -#~ "<class name=\"Child\">\n" -#~ " <id name=\"id\" column=\"child_id\"/>\n" -#~ " ....\n" -#~ " <property name=\"name\" \n" -#~ " not-null=\"true\"/>\n" -#~ " <many-to-one name=\"parent\" \n" -#~ " class=\"Parent\" \n" -#~ " column=\"parent_id\"\n" -#~ " not-null=\"true\"/>\n" -#~ "</class>" - -#, fuzzy -#~ msgid "" -#~ "\n" -#~ " \n" -#~ " ....\n" -#~ " \n" -#~ " \n" -#~ " \n" -#~ " \n" -#~ " \n" -#~ "\n" -#~ "\n" -#~ "\n" -#~ " \n" -#~ " ....\n" -#~ " \n" -#~ "]]>" -#~ msgstr "" -#~ "<class name=\"Parent\">\n" -#~ " <id name=\"id\" column=\"parent_id\"/>\n" -#~ " ....\n" -#~ " <map name=\"children\">\n" -#~ " <key column=\"parent_id\"\n" -#~ " not-null=\"true\"/>\n" -#~ " <map-key column=\"name\" \n" -#~ " type=\"string\"/>\n" -#~ " <one-to-many class=\"Child\"/>\n" -#~ " </map>\n" -#~ "</class>\n" -#~ "\n" -#~ "<class name=\"Child\">\n" -#~ " <id name=\"id\" column=\"child_id\"/>\n" -#~ " ....\n" -#~ " <many-to-one name=\"parent\" \n" -#~ " class=\"Parent\" \n" -#~ " column=\"parent_id\"\n" -#~ " insert=\"false\"\n" -#~ " update=\"false\"\n" -#~ " not-null=\"true\"/>\n" -#~ "</class>" - #, fuzzy #~ msgid "" #~ "\n" @@ -2047,25 +3765,6 @@ msgstr "" #~ " <many-to-many column=\"connection_id\" class=\"Connection\"/>\n" #~ "</map>" -#, fuzzy -#~ msgid "" -#~ "\n" -#~ " \n" -#~ " \n" -#~ " \n" -#~ " \n" -#~ " \n" -#~ "]]>" -#~ msgstr "" -#~ "<idbag name=\"lovers\" table=\"LOVERS\">\n" -#~ " <collection-id column=\"ID\" type=\"long\">\n" -#~ " <generator class=\"sequence\"/>\n" -#~ " </collection-id>\n" -#~ " <key column=\"PERSON1\"/>\n" -#~ " <many-to-many column=\"PERSON2\" class=\"Person\" fetch=\"join\"/" -#~ ">\n" -#~ "</idbag>" - #, fuzzy #~ msgid "" #~ "\n" -#~ "\n" -#~ " \n" -#~ " \n" -#~ " \n" -#~ " \n" -#~ " \n" -#~ " \n" -#~ " \n" -#~ " \n" -#~ " \n" -#~ "\n" -#~ " \n" -#~ " \n" -#~ " \n" -#~ " \n" -#~ " \n" -#~ " \n" -#~ "\n" -#~ "]]>" -#~ msgstr "" -#~ "<hibernate-mapping>\n" -#~ "\n" -#~ " <class name=\"Parent\">\n" -#~ " <id name=\"id\">\n" -#~ " <generator class=\"sequence\"/>\n" -#~ " </id>\n" -#~ " <set name=\"children\">\n" -#~ " <key column=\"parent_id\"/>\n" -#~ " <one-to-many class=\"Child\"/>\n" -#~ " </set>\n" -#~ " </class>\n" -#~ "\n" -#~ " <class name=\"Child\">\n" -#~ " <id name=\"id\">\n" -#~ " <generator class=\"sequence\"/>\n" -#~ " </id>\n" -#~ " <property name=\"name\"/>\n" -#~ " </class>\n" -#~ "\n" -#~ "</hibernate-mapping>" - -#, fuzzy -#~ msgid "" -#~ "" -#~ msgstr "" -#~ "create table parent ( id bigint not null primary key )\n" -#~ "create table child ( id bigint not null primary key, name varchar(255), " -#~ "parent_id bigint )\n" -#~ "alter table child add constraint childfk0 (parent_id) references parent" - -#, fuzzy -#~ msgid "" -#~ "\n" -#~ "\n" -#~ " \n" -#~ " \n" -#~ " \n" -#~ " \n" -#~ " \n" -#~ " \n" -#~ " \n" -#~ " \n" -#~ " \n" -#~ "\n" -#~ " \n" -#~ " \n" -#~ " \n" -#~ " \n" -#~ " \n" -#~ " \n" -#~ " \n" -#~ "\n" -#~ "]]>" -#~ msgstr "" -#~ "<hibernate-mapping>\n" -#~ "\n" -#~ " <class name=\"Parent\">\n" -#~ " <id name=\"id\">\n" -#~ " <generator class=\"sequence\"/>\n" -#~ " </id>\n" -#~ " <set name=\"children\" inverse=\"true\">\n" -#~ " <key column=\"parent_id\"/>\n" -#~ " <one-to-many class=\"Child\"/>\n" -#~ " </set>\n" -#~ " </class>\n" -#~ "\n" -#~ " <class name=\"Child\">\n" -#~ " <id name=\"id\">\n" -#~ " <generator class=\"sequence\"/>\n" -#~ " </id>\n" -#~ " <property name=\"name\"/>\n" -#~ " <many-to-one name=\"parent\" class=\"Parent\" column=" -#~ "\"parent_id\" not-null=\"true\"/>\n" -#~ " </class>\n" -#~ "\n" -#~ "</hibernate-mapping>" - -#, fuzzy -#~ msgid "" -#~ "" -#~ msgstr "" -#~ "create table parent ( id bigint not null primary key )\n" -#~ "create table child ( id bigint not null\n" -#~ " primary key,\n" -#~ " name varchar(255),\n" -#~ " parent_id bigint not null )\n" -#~ "alter table child add constraint childfk0 (parent_id) references parent" - -#, fuzzy -#~ msgid "" -#~ "\n" -#~ "\n" -#~ " \n" -#~ " \n" -#~ " \n" -#~ " \n" -#~ " \n" -#~ " \n" -#~ " \n" -#~ " \n" -#~ " \n" -#~ "\n" -#~ " \n" -#~ " \n" -#~ " \n" -#~ " \n" -#~ " \n" -#~ " \n" -#~ "\n" -#~ "]]>" -#~ msgstr "" -#~ "<hibernate-mapping>\n" -#~ "\n" -#~ " <class name=\"Parent\">\n" -#~ " <id name=\"id\">\n" -#~ " <generator class=\"sequence\"/>\n" -#~ " </id>\n" -#~ " <set name=\"children\">\n" -#~ " <key column=\"parent_id\" not-null=\"true\"/>\n" -#~ " <one-to-many class=\"Child\"/>\n" -#~ " </set>\n" -#~ " </class>\n" -#~ "\n" -#~ " <class name=\"Child\">\n" -#~ " <id name=\"id\">\n" -#~ " <generator class=\"sequence\"/>\n" -#~ " </id>\n" -#~ " <property name=\"name\"/>\n" -#~ " </class>\n" -#~ "\n" -#~ "</hibernate-mapping>" - -#, fuzzy -#~ msgid "" -#~ "\n" -#~ "\n" -#~ " \n" -#~ " \n" -#~ " \n" -#~ " \n" -#~ " \n" -#~ " \n" -#~ " \n" -#~ " \n" -#~ " \n" -#~ "\n" -#~ " \n" -#~ " \n" -#~ " \n" -#~ " \n" -#~ " \n" -#~ " \n" -#~ "\n" -#~ "]]>" -#~ msgstr "" -#~ "<hibernate-mapping>\n" -#~ "\n" -#~ " <class name=\"Parent\">\n" -#~ " <id name=\"id\">\n" -#~ " <generator class=\"sequence\"/>\n" -#~ " </id>\n" -#~ " <set name=\"children\" table=\"childset\">\n" -#~ " <key column=\"parent_id\"/>\n" -#~ " <many-to-many class=\"Child\" column=\"child_id\"/>\n" -#~ " </set>\n" -#~ " </class>\n" -#~ "\n" -#~ " <class name=\"Child\">\n" -#~ " <id name=\"id\">\n" -#~ " <generator class=\"sequence\"/>\n" -#~ " </id>\n" -#~ " <property name=\"name\"/>\n" -#~ " </class>\n" -#~ "\n" -#~ "</hibernate-mapping>" - -#, fuzzy -#~ msgid "" -#~ "" -#~ msgstr "" -#~ "create table parent ( id bigint not null primary key )\n" -#~ "create table child ( id bigint not null primary key, name varchar(255) )\n" -#~ "create table childset ( parent_id bigint not null,\n" -#~ " child_id bigint not null,\n" -#~ " primary key ( parent_id, child_id ) )\n" -#~ "alter table childset add constraint childsetfk0 (parent_id) references " -#~ "parent\n" -#~ "alter table childset add constraint childsetfk1 (child_id) references " -#~ "child" diff --git a/documentation/manual/src/main/docbook/de-DE/content/configuration.po b/documentation/manual/src/main/docbook/de-DE/content/configuration.po index ed3bffb8ea..463d2a274c 100644 --- a/documentation/manual/src/main/docbook/de-DE/content/configuration.po +++ b/documentation/manual/src/main/docbook/de-DE/content/configuration.po @@ -275,7 +275,7 @@ msgid "" msgstr "" "Project-Id-Version: Collection_Mapping\n" "Report-Msgid-Bugs-To: http://bugs.kde.org\n" -"POT-Creation-Date: 2010-02-11T05:38:15\n" +"POT-Creation-Date: 2010-07-20 21:02+0000\n" "PO-Revision-Date: 2007-02-26 10:27+1000\n" "Last-Translator: \n" "Language-Team: \n" @@ -285,11 +285,13 @@ msgstr "" "X-Generator: KBabel 1.9.1\n" #. Tag: title +#: configuration.xml:31 #, no-c-format msgid "Configuration" msgstr "Konfiguration" #. Tag: para +#: configuration.xml:33 #, fuzzy, no-c-format msgid "" "Hibernate is designed to operate in many different environments and, as " @@ -308,11 +310,13 @@ msgstr "" "passen Sie sie an." #. Tag: title +#: configuration.xml:41 #, no-c-format msgid "Programmatic configuration" msgstr "Programmatische Konfiguration" #. Tag: para +#: configuration.xml:43 #, fuzzy, no-c-format msgid "" "An instance of org.hibernate.cfg.Configuration " @@ -328,6 +332,7 @@ msgstr "" "bauen. Die Mappings werden aus verschiedenen XML-Mapping-Dateien kompiliert." #. Tag: para +#: configuration.xml:51 #, fuzzy, no-c-format msgid "" "You can obtain a org.hibernate.cfg.Configuration " @@ -340,7 +345,20 @@ msgstr "" "Mapping-Dateien sich im Klassenpfad befinden, verwenden Sie " "addResource():" +#. Tag: programlisting +#: configuration.xml:57 +#, fuzzy, no-c-format +msgid "" +"Configuration cfg = new Configuration()\n" +" .addResource(\"Item.hbm.xml\")\n" +" .addResource(\"Bid.hbm.xml\");" +msgstr "" +"Configuration cfg = new Configuration()\n" +" .addResource(\"Item.hbm.xml\")\n" +" .addResource(\"Bid.hbm.xml\");" + #. Tag: para +#: configuration.xml:59 #, fuzzy, no-c-format msgid "" "An alternative way is to specify the mapped class and allow Hibernate to " @@ -349,7 +367,20 @@ msgstr "" "Eine andere (und manchmal bessere) Weise, die gemappte Klasse zu " "spezifizieren ist es, Hibernate das Mapping-Dokument finden zu lassen:" +#. Tag: programlisting +#: configuration.xml:62 +#, fuzzy, no-c-format +msgid "" +"Configuration cfg = new Configuration()\n" +" .addClass(org.hibernate.auction.Item.class)\n" +" .addClass(org.hibernate.auction.Bid.class);" +msgstr "" +"Configuration cfg = new Configuration()\n" +" .addClass(org.hibernate.auction.Item.class)\n" +" .addClass(org.hibernate.auction.Bid.class);" + #. Tag: para +#: configuration.xml:64 #, fuzzy, no-c-format msgid "" "Hibernate will then search for mapping files named /org/hibernate/" @@ -363,6 +394,7 @@ msgstr "" "jegliche festcodierten Dateinamen." #. Tag: para +#: configuration.xml:69 #, fuzzy, no-c-format msgid "" "A org.hibernate.cfg.Configuration also allows you to " @@ -371,7 +403,30 @@ msgstr "" "Eine Configuration erlaubt es Ihnen auch, " "Konfigurationseigenschaften zu bestimmen:" +#. Tag: programlisting +#: configuration.xml:72 +#, fuzzy, no-c-format +msgid "" +"Configuration cfg = new Configuration()\n" +" .addClass(org.hibernate.auction.Item.class)\n" +" .addClass(org.hibernate.auction.Bid.class)\n" +" .setProperty(\"hibernate.dialect\", \"org.hibernate.dialect." +"MySQLInnoDBDialect\")\n" +" .setProperty(\"hibernate.connection.datasource\", \"java:comp/env/jdbc/" +"test\")\n" +" .setProperty(\"hibernate.order_updates\", \"true\");" +msgstr "" +"Configuration cfg = new Configuration()\n" +" .addClass(org.hibernate.auction.Item.class)\n" +" .addClass(org.hibernate.auction.Bid.class)\n" +" .setProperty(\"hibernate.dialect\", \"org.hibernate.dialect." +"MySQLInnoDBDialect\")\n" +" .setProperty(\"hibernate.connection.datasource\", \"java:comp/env/jdbc/" +"test\")\n" +" .setProperty(\"hibernate.order_updates\", \"true\");" + #. Tag: para +#: configuration.xml:74 #, fuzzy, no-c-format msgid "" "This is not the only way to pass configuration properties to Hibernate. Some " @@ -381,6 +436,7 @@ msgstr "" "Hibernate weiterzugeben. Die verschiedenen Optionen beinhalten:" #. Tag: para +#: configuration.xml:79 #, fuzzy, no-c-format msgid "" "Pass an instance of java.util.Properties to " @@ -390,6 +446,7 @@ msgstr "" "Configuration.setProperties()." #. Tag: para +#: configuration.xml:84 #, fuzzy, no-c-format msgid "" "Place a file named hibernate.properties in a root " @@ -399,6 +456,7 @@ msgstr "" "des Klassenpfads." #. Tag: para +#: configuration.xml:89 #, no-c-format msgid "" "Set System properties using java -" @@ -408,6 +466,7 @@ msgstr "" "Dproperty=value ein." #. Tag: para +#: configuration.xml:94 #, fuzzy, no-c-format msgid "" "Include <property> elements in hibernate." @@ -418,6 +477,7 @@ msgstr "" "erläutert)." #. Tag: para +#: configuration.xml:99 #, fuzzy, no-c-format msgid "" "If you want to get started quicklyhibernate.properties " @@ -427,6 +487,7 @@ msgstr "" "des Klassenpfads." #. Tag: para +#: configuration.xml:103 #, fuzzy, no-c-format msgid "" "The org.hibernate.cfg.Configuration is intended as a " @@ -438,11 +499,13 @@ msgstr "" "literal> verworfen werden." #. Tag: title +#: configuration.xml:109 #, no-c-format msgid "Obtaining a SessionFactory" msgstr "Erstellung einer SessionFactory" #. Tag: para +#: configuration.xml:111 #, fuzzy, no-c-format msgid "" "When all mappings have been parsed by the org.hibernate.cfg." @@ -455,7 +518,14 @@ msgstr "" "Session-Instanzen erstellen. Diese Factory wird von allen " "Anwendungsthreads geteilt:" +#. Tag: programlisting +#: configuration.xml:117 +#, fuzzy, no-c-format +msgid "SessionFactory sessions = cfg.buildSessionFactory();" +msgstr "SessionFactory sessions = cfg.buildSessionFactory();" + #. Tag: para +#: configuration.xml:119 #, fuzzy, no-c-format msgid "" "Hibernate does allow your application to instantiate more than one " @@ -467,11 +537,13 @@ msgstr "" "als eine Datenbank verwenden." #. Tag: title +#: configuration.xml:125 #, no-c-format msgid "JDBC connections" msgstr "JDBC-Verbindungen" #. Tag: para +#: configuration.xml:127 #, fuzzy, no-c-format msgid "" "It is advisable to have the org.hibernate.SessionFactorySession ganz einfach:" +#. Tag: programlisting +#: configuration.xml:133 +#, fuzzy, no-c-format +msgid "Session session = sessions.openSession(); // open a new Session" +msgstr "Session session = sessions.openSession(); // open a new Session" + #. Tag: para +#: configuration.xml:135 #, fuzzy, no-c-format msgid "" "Once you start a task that requires access to the database, a JDBC " @@ -493,6 +572,7 @@ msgstr "" "wird eine JDBC-Verbindung aus dem Pool bereitgestellt." #. Tag: para +#: configuration.xml:138 #, fuzzy, no-c-format msgid "" "Before you can do this, you first need to pass some JDBC connection " @@ -508,6 +588,7 @@ msgstr "" "Konfiguration der JDBC-Verbindungen erläutert." #. Tag: para +#: configuration.xml:144 #, fuzzy, no-c-format msgid "" "Hibernate will obtain and pool connections using java.sql." @@ -518,71 +599,89 @@ msgstr "" "einstellen:" #. Tag: title +#: configuration.xml:149 #, no-c-format msgid "Hibernate JDBC Properties" msgstr "Hibernate JDBC-Properties" #. Tag: entry +#: configuration.xml:158 configuration.xml:236 configuration.xml:327 +#: configuration.xml:495 configuration.xml:657 configuration.xml:753 +#: configuration.xml:826 #, no-c-format msgid "Property name" msgstr "Property-Name" #. Tag: entry +#: configuration.xml:160 configuration.xml:238 configuration.xml:329 +#: configuration.xml:497 configuration.xml:659 configuration.xml:755 +#: configuration.xml:828 #, no-c-format msgid "Purpose" msgstr "Zweck" -#. Tag: entry +#. Tag: property +#: configuration.xml:166 #, fuzzy, no-c-format -msgid "hibernate.connection.driver_class" +msgid "hibernate.connection.driver_class" msgstr "hibernate.connection.driver_class" -#. Tag: entry +#. Tag: emphasis +#: configuration.xml:168 #, fuzzy, no-c-format -msgid "JDBC driver class" +msgid "JDBC driver class" msgstr "jdbc-Treiberklasse" -#. Tag: entry +#. Tag: property +#: configuration.xml:172 #, fuzzy, no-c-format -msgid "hibernate.connection.url" +msgid "hibernate.connection.url" msgstr "hibernate.connection.url" -#. Tag: entry -#, fuzzy, no-c-format -msgid "JDBC URL" -msgstr "jdbc-Treiberklasse" +#. Tag: emphasis +#: configuration.xml:174 +#, no-c-format +msgid "JDBC URL" +msgstr "" -#. Tag: entry +#. Tag: property +#: configuration.xml:178 configuration.xml:265 #, fuzzy, no-c-format -msgid "hibernate.connection.username" +msgid "hibernate.connection.username" msgstr "hibernate.connection.username" -#. Tag: entry -#, fuzzy, no-c-format -msgid "database user" -msgstr "Datenbankbenutzer (optional)" +#. Tag: emphasis +#: configuration.xml:180 +#, no-c-format +msgid "database user" +msgstr "Datenbankbenutzer" -#. Tag: entry +#. Tag: property +#: configuration.xml:184 configuration.xml:271 #, fuzzy, no-c-format -msgid "hibernate.connection.password" +msgid "hibernate.connection.password" msgstr "hibernate.connection.password" -#. Tag: entry -#, fuzzy, no-c-format -msgid "database user password" -msgstr "Passwort des Datenbankbenutzers (optional)" +#. Tag: emphasis +#: configuration.xml:186 +#, no-c-format +msgid "database user password" +msgstr "Datenbankbenutzer-Passwort" -#. Tag: entry +#. Tag: property +#: configuration.xml:190 #, fuzzy, no-c-format -msgid "hibernate.connection.pool_size" +msgid "hibernate.connection.pool_size" msgstr "hibernate.connection.pool_size" -#. Tag: entry +#. Tag: emphasis +#: configuration.xml:192 #, fuzzy, no-c-format -msgid "maximum number of pooled connections" +msgid "maximum number of pooled connections" msgstr "maximale Anzahl gepoolter Verbindungen" #. Tag: para +#: configuration.xml:199 #, fuzzy, no-c-format msgid "" "Hibernate's own connection pooling algorithm is, however, quite rudimentary. " @@ -603,6 +702,7 @@ msgstr "" "interner Pool ausgeschaltet. Sie können zum Beispiel C3P0 verwenden." #. Tag: para +#: configuration.xml:208 #, fuzzy, no-c-format msgid "" "C3P0 is an open source JDBC connection pool distributed along with Hibernate " @@ -622,6 +722,7 @@ msgstr "" "auf der Hibernate Website." #. Tag: para +#: configuration.xml:216 #, fuzzy, no-c-format msgid "" "The following is an example hibernate.properties file " @@ -630,7 +731,32 @@ msgstr "" "Hier sehen Sie das Beispiel einer hibernate.properties-" "Datei für C3P0:" +#. Tag: programlisting +#: configuration.xml:219 +#, fuzzy, no-c-format +msgid "" +"hibernate.connection.driver_class = org.postgresql.Driver\n" +"hibernate.connection.url = jdbc:postgresql://localhost/mydatabase\n" +"hibernate.connection.username = myuser\n" +"hibernate.connection.password = secret\n" +"hibernate.c3p0.min_size=5\n" +"hibernate.c3p0.max_size=20\n" +"hibernate.c3p0.timeout=1800\n" +"hibernate.c3p0.max_statements=50\n" +"hibernate.dialect = org.hibernate.dialect.PostgreSQLDialect" +msgstr "" +"hibernate.connection.driver_class = org.postgresql.Driver\n" +"hibernate.connection.url = jdbc:postgresql://localhost/mydatabase\n" +"hibernate.connection.username = myuser\n" +"hibernate.connection.password = secret\n" +"hibernate.c3p0.min_size=5\n" +"hibernate.c3p0.max_size=20\n" +"hibernate.c3p0.timeout=1800\n" +"hibernate.c3p0.max_statements=50\n" +"hibernate.dialect = org.hibernate.dialect.PostgreSQLDialect" + #. Tag: para +#: configuration.xml:221 #, fuzzy, no-c-format msgid "" "For use inside an application server, you should almost always configure " @@ -645,36 +771,43 @@ msgstr "" "müssen:" #. Tag: title +#: configuration.xml:227 #, no-c-format msgid "Hibernate Datasource Properties" msgstr "Properties der Hibernate Datenquelle (\"Datasource\")" -#. Tag: entry +#. Tag: property +#: configuration.xml:244 #, fuzzy, no-c-format -msgid "hibernate.connection.datasource" +msgid "hibernate.connection.datasource" msgstr "hibernate.connection.datasource" -#. Tag: entry -#, fuzzy, no-c-format -msgid "datasource JNDI name" -msgstr "Datenbankbenutzer (optional)" +#. Tag: emphasis +#: configuration.xml:246 +#, no-c-format +msgid "datasource JNDI name" +msgstr "JNDI-Name der Datenquelle" -#. Tag: entry +#. Tag: property +#: configuration.xml:250 #, fuzzy, no-c-format -msgid "hibernate.jndi.url" +msgid "hibernate.jndi.url" msgstr "hibernate.jndi.url" #. Tag: entry +#: configuration.xml:252 #, no-c-format msgid "URL of the JNDI provider (optional)" msgstr "URL des JNDI-Providers (optional)" -#. Tag: entry +#. Tag: property +#: configuration.xml:257 #, fuzzy, no-c-format -msgid "hibernate.jndi.class" +msgid "hibernate.jndi.class" msgstr "hibernate.jndi.class" #. Tag: entry +#: configuration.xml:259 #, no-c-format msgid "" "class of the JNDI InitialContextFactory (optional)" #. Tag: entry +#: configuration.xml:267 #, no-c-format msgid "database user (optional)" msgstr "Datenbankbenutzer (optional)" #. Tag: entry +#: configuration.xml:273 #, no-c-format msgid "database user password (optional)" msgstr "Passwort des Datenbankbenutzers (optional)" #. Tag: para +#: configuration.xml:280 #, fuzzy, no-c-format msgid "" "Here is an example hibernate.properties file for an " @@ -702,7 +838,26 @@ msgstr "" "Hier sehen Sie das Beispiel einer hibernate.properties-" "Datei für eine vom Applikationsserver bereitgestellte JNDI-Datenquelle:" +#. Tag: programlisting +#: configuration.xml:283 +#, fuzzy, no-c-format +msgid "" +"hibernate.connection.datasource = java:/comp/env/jdbc/test\n" +"hibernate.transaction.factory_class = \\\n" +" org.hibernate.transaction.JTATransactionFactory\n" +"hibernate.transaction.manager_lookup_class = \\\n" +" org.hibernate.transaction.JBossTransactionManagerLookup\n" +"hibernate.dialect = org.hibernate.dialect.PostgreSQLDialect" +msgstr "" +"hibernate.connection.datasource = java:/comp/env/jdbc/test\n" +"hibernate.transaction.factory_class = \\n" +" org.hibernate.transaction.JTATransactionFactory\n" +"hibernate.transaction.manager_lookup_class = \\n" +" org.hibernate.transaction.JBossTransactionManagerLookup\n" +"hibernate.dialect = org.hibernate.dialect.PostgreSQLDialect" + #. Tag: para +#: configuration.xml:285 #, no-c-format msgid "" "JDBC connections obtained from a JNDI datasource will automatically " @@ -712,6 +867,7 @@ msgstr "" "den vom Container verwalteten Transaktionen des Applikationsservers teil." #. Tag: para +#: configuration.xml:289 #, fuzzy, no-c-format msgid "" "Arbitrary connection properties can be given by prepending " @@ -725,6 +881,7 @@ msgstr "" "Verwendung von hibernate.connection.charSet bestimmen." #. Tag: para +#: configuration.xml:294 #, fuzzy, no-c-format msgid "" "You can define your own plugin strategy for obtaining JDBC connections by " @@ -740,11 +897,13 @@ msgstr "" "Ihre eigene anwenderdefinierte Implementierung wählen." #. Tag: title +#: configuration.xml:302 #, no-c-format msgid "Optional configuration properties" msgstr "Optionale Properties der Konfiguration" #. Tag: para +#: configuration.xml:304 #, fuzzy, no-c-format msgid "" "There are a number of other properties that control the behavior of " @@ -755,6 +914,7 @@ msgstr "" "Standardwerte." #. Tag: para +#: configuration.xml:309 #, fuzzy, no-c-format msgid "" "Some of these properties are \"system-level\" only. " @@ -769,16 +929,19 @@ msgstr "" "der anderen, oben beschriebenen Techniken eingestellt werden." #. Tag: title +#: configuration.xml:318 #, no-c-format msgid "Hibernate Configuration Properties" msgstr "Konfigurationseigenschaften von Hibernate" -#. Tag: entry +#. Tag: property +#: configuration.xml:335 #, fuzzy, no-c-format -msgid "hibernate.dialect" +msgid "hibernate.dialect" msgstr "hibernate.dialect" #. Tag: entry +#: configuration.xml:337 #, fuzzy, no-c-format msgid "" "The classname of a Hibernate org.hibernate.dialect.Dialecte.g. full.classname.of." @@ -799,6 +963,7 @@ msgstr "" "literal>" #. Tag: para +#: configuration.xml:341 #, no-c-format msgid "" "In most cases Hibernate will actually be able to choose the correct " @@ -806,12 +971,14 @@ msgid "" "the JDBC metadata returned by the JDBC driver." msgstr "" -#. Tag: entry +#. Tag: property +#: configuration.xml:349 #, fuzzy, no-c-format -msgid "hibernate.show_sql" +msgid "hibernate.show_sql" msgstr "hibernate.show_sql" #. Tag: entry +#: configuration.xml:351 #, no-c-format msgid "" "Write all SQL statements to console. This is an alternative to setting the " @@ -823,6 +990,11 @@ msgstr "" "hibernate.SQL auf debug." #. Tag: para +#: configuration.xml:353 configuration.xml:361 configuration.xml:426 +#: configuration.xml:435 configuration.xml:443 configuration.xml:453 +#: configuration.xml:468 configuration.xml:525 configuration.xml:545 +#: configuration.xml:555 configuration.xml:598 configuration.xml:797 +#: configuration.xml:808 configuration.xml:904 #, fuzzy, no-c-format msgid "" "e.g. true | " @@ -831,22 +1003,26 @@ msgstr "" "eg.true | " "false" -#. Tag: entry +#. Tag: property +#: configuration.xml:359 #, fuzzy, no-c-format -msgid "hibernate.format_sql" +msgid "hibernate.format_sql" msgstr "hibernate.format_sql" #. Tag: entry +#: configuration.xml:361 #, no-c-format msgid "Pretty print the SQL in the log and console." msgstr "SQL in Protokoll und Konsole lesbar ausgeben." -#. Tag: entry +#. Tag: property +#: configuration.xml:367 #, fuzzy, no-c-format -msgid "hibernate.default_schema" +msgid "hibernate.default_schema" msgstr "hibernate.default_schema" #. Tag: entry +#: configuration.xml:369 #, fuzzy, no-c-format msgid "" "Qualify unqualified table names with the given schema/tablespace in " @@ -856,17 +1032,20 @@ msgstr "" "Tabellenraum in generiertem SQL." #. Tag: para +#: configuration.xml:370 #, fuzzy, no-c-format msgid "" "e.g. SCHEMA_NAME" msgstr "eg.SCHEMA_NAME" -#. Tag: entry +#. Tag: property +#: configuration.xml:376 #, fuzzy, no-c-format -msgid "hibernate.default_catalog" +msgid "hibernate.default_catalog" msgstr "hibernate.default_catalog" #. Tag: entry +#: configuration.xml:378 #, fuzzy, no-c-format msgid "" "Qualifies unqualified table names with the given catalog in generated SQL." @@ -875,18 +1054,21 @@ msgstr "" "generierten SQL." #. Tag: para +#: configuration.xml:379 #, fuzzy, no-c-format msgid "" "e.g. CATALOG_NAME" msgstr "" "eg.CATALOG_NAME" -#. Tag: entry +#. Tag: property +#: configuration.xml:384 #, fuzzy, no-c-format -msgid "hibernate.session_factory_name" +msgid "hibernate.session_factory_name" msgstr "hibernate.session_factory_name" #. Tag: entry +#: configuration.xml:386 #, fuzzy, no-c-format msgid "" "The org.hibernate.SessionFactory will be " @@ -896,6 +1078,7 @@ msgstr "" "JNDI gebunden, nachdem sie erstellt wurde." #. Tag: para +#: configuration.xml:389 configuration.xml:776 #, fuzzy, no-c-format msgid "" "e.g. jndi/composite/nameeg.jndi/composite/name" -#. Tag: entry +#. Tag: property +#: configuration.xml:394 #, fuzzy, no-c-format -msgid "hibernate.max_fetch_depth" +msgid "hibernate.max_fetch_depth" msgstr "hibernate.max_fetch_depth" #. Tag: entry +#: configuration.xml:396 #, fuzzy, no-c-format msgid "" "Sets a maximum \"depth\" for the outer join fetch tree for single-ended " @@ -922,6 +1107,7 @@ msgstr "" "Fetching." #. Tag: para +#: configuration.xml:398 #, fuzzy, no-c-format msgid "" "e.g. recommended values between " @@ -930,12 +1116,14 @@ msgstr "" "z.B. empfohlene Werte zwischen " "0 und 3" -#. Tag: entry +#. Tag: property +#: configuration.xml:404 #, fuzzy, no-c-format -msgid "hibernate.default_batch_fetch_size" +msgid "hibernate.default_batch_fetch_size" msgstr "hibernate.default_batch_fetch_size" #. Tag: entry +#: configuration.xml:406 #, fuzzy, no-c-format msgid "Sets a default size for Hibernate batch fetching of associations." msgstr "" @@ -943,6 +1131,7 @@ msgstr "" "Fetching\") von Assoziationen ein." #. Tag: para +#: configuration.xml:407 #, fuzzy, no-c-format msgid "" "e.g. recommended values 4z.B. empfohlene Werte 4, 8, 16" -#. Tag: entry +#. Tag: property +#: configuration.xml:413 #, fuzzy, no-c-format -msgid "hibernate.default_entity_mode" +msgid "hibernate.default_entity_mode" msgstr "hibernate.default_entity_mode" #. Tag: entry +#: configuration.xml:415 #, fuzzy, no-c-format msgid "" "Sets a default mode for entity representation for all sessions opened from " @@ -966,6 +1157,7 @@ msgstr "" "dieser SessionFactory geöffneten Sessions." #. Tag: para +#: configuration.xml:416 #, no-c-format msgid "" "dynamic-map, dom4j, pojodynamic-map, dom4j, pojo" -#. Tag: entry +#. Tag: property +#: configuration.xml:422 #, fuzzy, no-c-format -msgid "hibernate.order_updates" +msgid "hibernate.order_updates" msgstr "hibernate.order_updates" #. Tag: entry +#: configuration.xml:424 #, fuzzy, no-c-format msgid "" "Forces Hibernate to order SQL updates by the primary key value of the items " @@ -990,12 +1184,14 @@ msgstr "" "aktualisierten Posten anzufordern. Dies hat eine Verringerung der Anzahl von " "Transaktionssperren in simultan laufenden Systemen zur Folge." -#. Tag: entry +#. Tag: property +#: configuration.xml:432 #, fuzzy, no-c-format -msgid "hibernate.generate_statistics" -msgstr "hibernate.generate_statistics" +msgid "hibernate.generate_statistics" +msgstr "Die Hibernate Statistik" #. Tag: entry +#: configuration.xml:434 #, no-c-format msgid "" "If enabled, Hibernate will collect statistics useful for performance tuning." @@ -1003,12 +1199,14 @@ msgstr "" "Falls aktiviert, so sammelt Hibernate Statistiken, die bei der " "Feinabstimmung der Performance von Nutzen sind. " -#. Tag: entry +#. Tag: property +#: configuration.xml:440 #, fuzzy, no-c-format -msgid "hibernate.use_identifier_rollback" +msgid "hibernate.use_identifier_rollback" msgstr "hibernate.use_identifer_rollback" #. Tag: entry +#: configuration.xml:442 #, no-c-format msgid "" "If enabled, generated identifier properties will be reset to default values " @@ -1017,12 +1215,14 @@ msgstr "" "Falls aktiviert, so werden die generierten Bezeichner-Properties auf die " "Standardwerte zurückgesetzt, wenn Objekte gelöscht werden." -#. Tag: entry +#. Tag: property +#: configuration.xml:449 #, fuzzy, no-c-format -msgid "hibernate.use_sql_comments" +msgid "hibernate.use_sql_comments" msgstr "hibernate.use_sql_comments" #. Tag: entry +#: configuration.xml:451 #, no-c-format msgid "" "If turned on, Hibernate will generate comments inside the SQL, for easier " @@ -1032,17 +1232,51 @@ msgstr "" "eine vereinfachte Fehlersuche. Die Standardeinstellung lautet " "false." +#. Tag: property +#: configuration.xml:458 +#, no-c-format +msgid "hibernate.id.new_generator_mappings" +msgstr "" + +#. Tag: entry +#: configuration.xml:460 +#, no-c-format +msgid "" +"Setting is relevant when using @GeneratedValue. It " +"indicates whether or not the new IdentifierGenerator " +"implementations are used for javax.persistence.GenerationType." +"AUTO, javax.persistence.GenerationType.TABLE and javax.persistence.GenerationType.SEQUENCE. Default to false to keep backward " +"compatibility." +msgstr "" + +#. Tag: para +#: configuration.xml:476 +#, no-c-format +msgid "" +"We recommend all new projects which make use of to use " +"@GeneratedValue to also set hibernate.id." +"new_generator_mappings=true as the new generators are more efficient " +"and closer to the JPA 2 specification semantic. However they are not " +"backward compatible with existing databases (if a sequence or a table is " +"used for id generation)." +msgstr "" + #. Tag: title +#: configuration.xml:485 #, no-c-format msgid "Hibernate JDBC and Connection Properties" msgstr "Hibernate JDBC- und Connection-Properties" -#. Tag: entry +#. Tag: property +#: configuration.xml:503 #, fuzzy, no-c-format -msgid "hibernate.jdbc.fetch_size" +msgid "hibernate.jdbc.fetch_size" msgstr "hibernate.jdbc.fetch_size" #. Tag: entry +#: configuration.xml:505 #, no-c-format msgid "" "A non-zero value determines the JDBC fetch size (calls Statement." @@ -1052,12 +1286,14 @@ msgstr "" "genannten \"Fetch Size\" (ruft Statement.setFetchSize() " "auf)." -#. Tag: entry +#. Tag: property +#: configuration.xml:510 #, fuzzy, no-c-format -msgid "hibernate.jdbc.batch_size" +msgid "hibernate.jdbc.batch_size" msgstr "hibernate.jdbc.batch_size" #. Tag: entry +#: configuration.xml:512 #, no-c-format msgid "A non-zero value enables use of JDBC2 batch updates by Hibernate." msgstr "" @@ -1065,6 +1301,7 @@ msgstr "" "Stapelaktualisierungen (sog. \"Batch Updates\") durch Hibernate." #. Tag: para +#: configuration.xml:513 #, fuzzy, no-c-format msgid "" "e.g. recommended values between " @@ -1073,16 +1310,18 @@ msgstr "" "z.B. empfohlene Werte zwischen " "5 und 30" -#. Tag: entry +#. Tag: property +#: configuration.xml:519 #, fuzzy, no-c-format -msgid "hibernate.jdbc.batch_versioned_data" +msgid "hibernate.jdbc.batch_versioned_data" msgstr "hibernate.jdbc.batch_versioned_data" #. Tag: entry +#: configuration.xml:521 #, fuzzy, no-c-format msgid "" "Set this property to true if your JDBC driver returns " -"correct row counts from executeBatch(). Iit is usually " +"correct row counts from executeBatch(). It is usually " "safe to turn this option on. Hibernate will then use batched DML for " "automatically versioned data. Defaults to false." msgstr "" @@ -1092,12 +1331,14 @@ msgstr "" "Hibernate verwendet dann gestapelte DML für automatisch versionierte Daten. " "Die Standardeinstellung lautet hier false." -#. Tag: entry +#. Tag: property +#: configuration.xml:531 #, fuzzy, no-c-format -msgid "hibernate.jdbc.factory_class" +msgid "hibernate.jdbc.factory_class" msgstr "hibernate.jdbc.factory_class" #. Tag: entry +#: configuration.xml:533 #, fuzzy, no-c-format msgid "" "Select a custom org.hibernate.jdbc.Batcher. " @@ -1107,6 +1348,7 @@ msgstr "" "Anwendungen benötigen diese Konfigurationseigenschaft nicht." #. Tag: para +#: configuration.xml:535 #, fuzzy, no-c-format msgid "" "e.g. classname.of." @@ -1115,12 +1357,14 @@ msgstr "" "eg.classname.of.Batcher" -#. Tag: entry +#. Tag: property +#: configuration.xml:541 #, fuzzy, no-c-format -msgid "hibernate.jdbc.use_scrollable_resultset" +msgid "hibernate.jdbc.use_scrollable_resultset" msgstr "hibernate.jdbc.use_scrollable_resultset" #. Tag: entry +#: configuration.xml:543 #, fuzzy, no-c-format msgid "" "Enables use of JDBC2 scrollable resultsets by Hibernate. This property is " @@ -1132,12 +1376,14 @@ msgstr "" "Verwendung von Benutzer-gelieferten JDBC-Verbindungen notwendig, Hibernate " "verwendet Metadaten der Verbindung(en) anders." -#. Tag: entry +#. Tag: property +#: configuration.xml:551 #, fuzzy, no-c-format -msgid "hibernate.jdbc.use_streams_for_binary" +msgid "hibernate.jdbc.use_streams_for_binary" msgstr "hibernate.jdbc.use_streams_for_binary" #. Tag: entry +#: configuration.xml:553 #, fuzzy, no-c-format msgid "" "Use streams when writing/reading binary or " @@ -1148,12 +1394,14 @@ msgstr "" "binary oder serializable Typen in/aus " "JDBC (Property der Systemebene)." -#. Tag: entry +#. Tag: property +#: configuration.xml:561 #, fuzzy, no-c-format -msgid "hibernate.jdbc.use_get_generated_keys" +msgid "hibernate.jdbc.use_get_generated_keys" msgstr "hibernate.jdbc.use_get_generated_keys" #. Tag: entry +#: configuration.xml:563 #, fuzzy, no-c-format msgid "" "Enables use of JDBC3 PreparedStatement.getGeneratedKeys() " @@ -1170,16 +1418,20 @@ msgstr "" "Metadaten die Treiberfähigkeiten zu bestimmen." #. Tag: para +#: configuration.xml:569 configuration.xml:678 configuration.xml:687 +#: configuration.xml:696 configuration.xml:723 #, fuzzy, no-c-format msgid "e.g. true|false" msgstr "eg.true|false" -#. Tag: entry +#. Tag: property +#: configuration.xml:574 #, fuzzy, no-c-format -msgid "hibernate.connection.provider_class" +msgid "hibernate.connection.provider_class" msgstr "hibernate.connection.provider_class" #. Tag: entry +#: configuration.xml:576 #, fuzzy, no-c-format msgid "" "The classname of a custom org.hibernate.connection." @@ -1190,6 +1442,7 @@ msgstr "" "literal> der Hibernate JDBC-Verbindungen bereitstellt." #. Tag: para +#: configuration.xml:578 #, fuzzy, no-c-format msgid "" "e.g. classname.of." @@ -1198,12 +1451,14 @@ msgstr "" "eg.classname.of." "ConnectionProvider" -#. Tag: entry +#. Tag: property +#: configuration.xml:584 #, fuzzy, no-c-format -msgid "hibernate.connection.isolation" +msgid "hibernate.connection.isolation" msgstr "hibernate.connection.isolation" #. Tag: entry +#: configuration.xml:586 #, fuzzy, no-c-format msgid "" "Sets the JDBC transaction isolation level. Check java.sql." @@ -1216,27 +1471,32 @@ msgstr "" "Sie, dass die meisten Datenbanken nicht alle Isolationsebenen unterstützen." #. Tag: para +#: configuration.xml:589 #, fuzzy, no-c-format msgid "e.g. 1, 2, 4, 8" msgstr "eg.1, 2, 4, 8" -#. Tag: entry +#. Tag: property +#: configuration.xml:595 #, fuzzy, no-c-format -msgid "hibernate.connection.autocommit" +msgid "hibernate.connection.autocommit" msgstr "hibernate.connection.autocommit" #. Tag: entry +#: configuration.xml:597 #, fuzzy, no-c-format msgid "Enables autocommit for JDBC pooled connections (it is not recommended)." msgstr "" "Aktiviert \"autocommit\" für JDBC gepoolte Verbindungen (nicht empfohlen)." -#. Tag: entry +#. Tag: property +#: configuration.xml:603 #, fuzzy, no-c-format -msgid "hibernate.connection.release_mode" +msgid "hibernate.connection.release_mode" msgstr "hibernate.connection.release_mode" #. Tag: entry +#: configuration.xml:605 #, fuzzy, no-c-format msgid "" "Specifies when Hibernate should release JDBC connections. By default, a JDBC " @@ -1262,6 +1522,7 @@ msgstr "" "Transaktionsstrategie." #. Tag: para +#: configuration.xml:615 #, fuzzy, no-c-format msgid "" "e.g. auto (default) " @@ -1273,6 +1534,7 @@ msgstr "" "after_statement" #. Tag: para +#: configuration.xml:618 #, fuzzy, no-c-format msgid "" "This setting only affects Sessions returned from " @@ -1280,8 +1542,7 @@ msgid "" "literal>s obtained through SessionFactory.getCurrentSession, the CurrentSessionContext implementation " "configured for use controls the connection release mode for those " -"Sessions. See " +"Sessions. See" msgstr "" "Bitte beachten Sie, dass diese Einstellung nur Sessions " "betrifft, die von der SessionFactory.openSession " @@ -1292,6 +1553,7 @@ msgstr "" "\"architecture-current-session\"/>." #. Tag: entry +#: configuration.xml:630 #, fuzzy, no-c-format msgid "" "hibernate.connection.<propertyName><propertyName> to " @@ -1308,6 +1571,7 @@ msgstr "" "DriverManager.getConnection()." #. Tag: entry +#: configuration.xml:638 #, fuzzy, no-c-format msgid "" "hibernate.jndi.<propertyName>" @@ -1316,6 +1580,7 @@ msgstr "" "emphasis>" #. Tag: entry +#: configuration.xml:640 #, fuzzy, no-c-format msgid "" "Pass the property <propertyName> to the JNDI " @@ -1325,22 +1590,26 @@ msgstr "" "InitialContextFactory." #. Tag: title +#: configuration.xml:648 #, no-c-format msgid "Hibernate Cache Properties" msgstr "Hibernate Cache-Properties" -#. Tag: entry +#. Tag: literal +#: configuration.xml:665 #, fuzzy, no-c-format -msgid "hibernate.cache.provider_class" +msgid "hibernate.cache.provider_class" msgstr "hibernate.cache.provider_class" #. Tag: entry +#: configuration.xml:667 #, no-c-format msgid "The classname of a custom CacheProvider." msgstr "" "Der Klassenname eines anwenderdefinierten CacheProvider." #. Tag: para +#: configuration.xml:668 #, fuzzy, no-c-format msgid "" "e.g. classname.of." @@ -1349,12 +1618,14 @@ msgstr "" "eg.classname.of.CacheProvider" -#. Tag: entry +#. Tag: literal +#: configuration.xml:673 #, fuzzy, no-c-format -msgid "hibernate.cache.use_minimal_puts" +msgid "hibernate.cache.use_minimal_puts" msgstr "hibernate.cache.use_minimal_puts" #. Tag: entry +#: configuration.xml:675 #, fuzzy, no-c-format msgid "" "Optimizes second-level cache operation to minimize writes, at the cost of " @@ -1366,12 +1637,14 @@ msgstr "" "ist vor allem für geclusterte Caches sinnvoll und ist bei Hibernate3 " "standardmäßig für geclusterte Cache-Implementierungen aktiviert." -#. Tag: entry +#. Tag: literal +#: configuration.xml:684 #, fuzzy, no-c-format -msgid "hibernate.cache.use_query_cache" +msgid "hibernate.cache.use_query_cache" msgstr "hibernate.cache.use_query_cache" #. Tag: entry +#: configuration.xml:686 #, fuzzy, no-c-format msgid "" "Enables the query cache. Individual queries still have to be set cachable." @@ -1379,12 +1652,14 @@ msgstr "" "Aktivieren Sie das Anfragen-Cache, Einzelanfragen müssen nach wie vor als " "speicherbar eingestellt sein." -#. Tag: entry +#. Tag: literal +#: configuration.xml:692 #, fuzzy, no-c-format -msgid "hibernate.cache.use_second_level_cache" +msgid "hibernate.cache.use_second_level_cache" msgstr "hibernate.cache.use_second_level_cache" #. Tag: entry +#: configuration.xml:694 #, fuzzy, no-c-format msgid "" "Can be used to completely disable the second level cache, which is enabled " @@ -1395,12 +1670,14 @@ msgstr "" "deaktivieren, das für Klassen mit einem <cache>-" "Mapping standardmäßig aktiviert ist." -#. Tag: entry +#. Tag: literal +#: configuration.xml:702 #, fuzzy, no-c-format -msgid "hibernate.cache.query_cache_factory" +msgid "hibernate.cache.query_cache_factory" msgstr "hibernate.cache.query_cache_factory" #. Tag: entry +#: configuration.xml:704 #, no-c-format msgid "" "The classname of a custom QueryCache interface, defaults " @@ -1410,6 +1687,7 @@ msgstr "" "Interface, Standard ist das eingebaute StandardQueryCache." #. Tag: para +#: configuration.xml:706 #, fuzzy, no-c-format msgid "" "e.g. classname.of.QueryCacheeg.classname.of.QueryCache" -#. Tag: entry +#. Tag: literal +#: configuration.xml:712 #, fuzzy, no-c-format -msgid "hibernate.cache.region_prefix" +msgid "hibernate.cache.region_prefix" msgstr "hibernate.cache.region_prefix" #. Tag: entry +#: configuration.xml:714 #, no-c-format msgid "A prefix to use for second-level cache region names." msgstr "Ein für Cache-Bereiche der zweiten Ebene zu verwendender Präfix." #. Tag: para +#: configuration.xml:714 #, fuzzy, no-c-format msgid "e.g. prefix" msgstr "eg.prefix" -#. Tag: entry +#. Tag: literal +#: configuration.xml:720 #, fuzzy, no-c-format -msgid "hibernate.cache.use_structured_entries" +msgid "hibernate.cache.use_structured_entries" msgstr "hibernate.cache.use_structured_entries" #. Tag: entry +#: configuration.xml:722 #, no-c-format msgid "" "Forces Hibernate to store data in the second-level cache in a more human-" @@ -1447,17 +1730,36 @@ msgstr "" "Bringt Hibernate dazu, Daten im Cachespeicher der zweiten Ebene in einer für " "den Benutzer freundlicheren Art zu speichern." +#. Tag: literal +#: configuration.xml:729 +#, no-c-format +msgid "hibernate.cache.default_cache_concurrency_strategy" +msgstr "" + +#. Tag: entry +#: configuration.xml:731 +#, no-c-format +msgid "" +"Setting used to give the name of the default org.hibernate." +"annotations.CacheConcurrencyStrategy to use when either " +"@Cacheable or @Cache is used. " +"@Cache(strategy=\"..\") is used to override this default." +msgstr "" + #. Tag: title +#: configuration.xml:744 #, no-c-format msgid "Hibernate Transaction Properties" msgstr "Hibernate Transaktions-Properties" -#. Tag: entry +#. Tag: literal +#: configuration.xml:761 #, fuzzy, no-c-format -msgid "hibernate.transaction.factory_class" +msgid "hibernate.transaction.factory_class" msgstr "hibernate.transaction.factory_class" #. Tag: entry +#: configuration.xml:763 #, no-c-format msgid "" "The classname of a TransactionFactory to use with " @@ -1470,6 +1772,7 @@ msgstr "" "JDBCTransactionFactory)." #. Tag: para +#: configuration.xml:765 #, fuzzy, no-c-format msgid "" "e.g. classname.of." @@ -1478,12 +1781,14 @@ msgstr "" "eg.classname.of." "TransactionFactory" -#. Tag: entry +#. Tag: literal +#: configuration.xml:771 #, fuzzy, no-c-format -msgid "jta.UserTransaction" +msgid "jta.UserTransaction" msgstr "jta.UserTransaction" #. Tag: entry +#: configuration.xml:773 #, no-c-format msgid "" "A JNDI name used by JTATransactionFactory to obtain the " @@ -1493,12 +1798,14 @@ msgstr "" "UserTransaction vom Applikationsserver verwendeter JNDI-" "Name." -#. Tag: entry +#. Tag: literal +#: configuration.xml:781 #, fuzzy, no-c-format -msgid "hibernate.transaction.manager_lookup_class" +msgid "hibernate.transaction.manager_lookup_class" msgstr "hibernate.transaction.manager_lookup_class" #. Tag: entry +#: configuration.xml:783 #, fuzzy, no-c-format msgid "" "The classname of a TransactionManagerLookup. It is " @@ -1510,6 +1817,7 @@ msgstr "" "einer JTA-Umgebung ein Hilo-Generator verwendet wird." #. Tag: para +#: configuration.xml:786 #, fuzzy, no-c-format msgid "" "e.g. classname.of." @@ -1518,17 +1826,19 @@ msgstr "" "eg.classname.of." "TransactionManagerLookup" -#. Tag: entry +#. Tag: literal +#: configuration.xml:792 #, fuzzy, no-c-format -msgid "hibernate.transaction.flush_before_completion" +msgid "hibernate.transaction.flush_before_completion" msgstr "hibernate.transaction.flush_before_completion" #. Tag: entry +#: configuration.xml:794 #, fuzzy, no-c-format msgid "" "If enabled, the session will be automatically flushed during the before " "completion phase of the transaction. Built-in and automatic session context " -"management is preferred, see ." msgstr "" "Falls aktiviert, wird die Session automatisch während der Vorabschlussphase " @@ -1536,17 +1846,19 @@ msgstr "" "Kontextmanagement wird bevorzugt, siehe ." -#. Tag: entry +#. Tag: literal +#: configuration.xml:803 #, fuzzy, no-c-format -msgid "hibernate.transaction.auto_close_session" +msgid "hibernate.transaction.auto_close_session" msgstr "hibernate.transaction.auto_close_session" #. Tag: entry +#: configuration.xml:805 #, fuzzy, no-c-format msgid "" "If enabled, the session will be automatically closed during the after " "completion phase of the transaction. Built-in and automatic session context " -"management is preferred, see ." msgstr "" "Falls aktiviert, wird die Session während der Nachabschlussphase automatisch " @@ -1554,21 +1866,24 @@ msgstr "" "bevorzugt, siehe ." #. Tag: title +#: configuration.xml:817 #, no-c-format msgid "Miscellaneous Properties" msgstr "Verschiedene Properties" -#. Tag: entry +#. Tag: literal +#: configuration.xml:834 #, fuzzy, no-c-format -msgid "hibernate.current_session_context_class" +msgid "hibernate.current_session_context_class" msgstr "hibernate.current_session_context_class" #. Tag: entry +#: configuration.xml:836 #, fuzzy, no-c-format msgid "" "Supply a custom strategy for the scoping of the \"current\" " "Session. See for more information about the built-in strategies." +"\"/> for more information about the built-in strategies." msgstr "" "Geben Sie eine (anwenderdefinierte) Strategie für den Gültigkeitsbereich der " "\"aktuellen\" Session ein. Weitere Informationen zu " @@ -1576,6 +1891,7 @@ msgstr "" "session\"/>." #. Tag: para +#: configuration.xml:839 #, fuzzy, no-c-format msgid "" "e.g. jta | " @@ -1586,17 +1902,20 @@ msgstr "" "thread | managed | custom." "Class" -#. Tag: entry +#. Tag: literal +#: configuration.xml:846 #, fuzzy, no-c-format -msgid "hibernate.query.factory_class" +msgid "hibernate.query.factory_class" msgstr "hibernate.query.factory_class" #. Tag: entry +#: configuration.xml:848 #, no-c-format msgid "Chooses the HQL parser implementation." msgstr "Wählt die Implemetierung des HQL-Parsers (Analysealgorithmus)." #. Tag: para +#: configuration.xml:848 #, fuzzy, no-c-format msgid "" "e.g. org.hibernate.hql.ast." @@ -1607,12 +1926,14 @@ msgstr "" "ASTQueryTranslatorFactory or org.hibernate.hql.classic." "ClassicQueryTranslatorFactory" -#. Tag: entry +#. Tag: literal +#: configuration.xml:857 #, fuzzy, no-c-format -msgid "hibernate.query.substitutions" -msgstr "hibernate.query.substitutions" +msgid "hibernate.query.substitutions" +msgstr "hibernate.query.substitutions true=1, false=0" #. Tag: entry +#: configuration.xml:859 #, fuzzy, no-c-format msgid "" "Is used to map from tokens in Hibernate queries to SQL tokens (tokens might " @@ -1622,6 +1943,7 @@ msgstr "" "B. Funktions- oder Literalnamen sein)." #. Tag: para +#: configuration.xml:861 #, fuzzy, no-c-format msgid "" "e.g. hqlLiteral=SQL_LITERAL, " @@ -1630,12 +1952,14 @@ msgstr "" "eg.hqlLiteral=SQL_LITERAL, " "hqlFunction=SQLFUNC" -#. Tag: entry +#. Tag: literal +#: configuration.xml:867 #, fuzzy, no-c-format -msgid "hibernate.hbm2ddl.auto" +msgid "hibernate.hbm2ddl.auto" msgstr "hibernate.hbm2ddl.auto" #. Tag: entry +#: configuration.xml:869 #, fuzzy, no-c-format msgid "" "Automatically validates or exports schema DDL to the database when the " @@ -1649,6 +1973,7 @@ msgstr "" "SessionFactory explizit geschlossen wird." #. Tag: para +#: configuration.xml:873 #, fuzzy, no-c-format msgid "" "e.g. validate | " @@ -1659,12 +1984,48 @@ msgstr "" "update | create | create-" "drop" -#. Tag: entry +#. Tag: literal +#: configuration.xml:880 #, fuzzy, no-c-format -msgid "hibernate.cglib.use_reflection_optimizer" +msgid "hibernate.hbm2ddl.import_file" +msgstr "hibernate.hbm2ddl.auto" + +#. Tag: para +#: configuration.xml:882 +#, no-c-format +msgid "" +"Comma-separated names of the optional files containing SQL DML statements " +"executed during the SessionFactory creation. This is " +"useful for testing or demoing: by adding INSERT statements for example you " +"can populate your database with a minimal set of data when it is deployed." +msgstr "" + +#. Tag: para +#: configuration.xml:887 +#, no-c-format +msgid "" +"File order matters, the statements of a give file are executed before the " +"statements of the following files. These statements are only executed if the " +"schema is created ie if hibernate.hbm2ddl.auto is set to " +"create or create-drop." +msgstr "" + +#. Tag: para +#: configuration.xml:892 +#, fuzzy, no-c-format +msgid "" +"e.g. /humans.sql,/dogs.sql" +msgstr "eg.true|false" + +#. Tag: literal +#: configuration.xml:898 +#, fuzzy, no-c-format +msgid "hibernate.cglib.use_reflection_optimizer" msgstr "hibernate.cglib.use_reflection_optimizer" #. Tag: entry +#: configuration.xml:900 #, fuzzy, no-c-format msgid "" "Enables the use of CGLIB instead of runtime reflection (System-level " @@ -1679,11 +2040,13 @@ msgstr "" "hibernate.cfg.xml eingestellt werden." #. Tag: title +#: configuration.xml:913 #, no-c-format msgid "SQL Dialects" msgstr "SQL-Dialekte" #. Tag: para +#: configuration.xml:915 #, fuzzy, no-c-format msgid "" "Always set the hibernate.dialect property to the correct " @@ -1700,256 +2063,307 @@ msgstr "" "bleibt." #. Tag: title +#: configuration.xml:922 #, no-c-format msgid "Hibernate SQL Dialects (hibernate.dialect)" msgstr "Hibernate SQL-Dialekte (hibernate.dialect)" #. Tag: entry +#: configuration.xml:933 #, no-c-format msgid "RDBMS" msgstr "RDBMS" #. Tag: entry +#: configuration.xml:935 #, no-c-format msgid "Dialect" msgstr "Dialekt" #. Tag: entry +#: configuration.xml:941 #, no-c-format -msgid "DB2" -msgstr "" +msgid "DB2" +msgstr "DB2" -#. Tag: entry +#. Tag: literal +#: configuration.xml:943 #, fuzzy, no-c-format -msgid "org.hibernate.dialect.DB2Dialect" +msgid "org.hibernate.dialect.DB2Dialect" msgstr "org.hibernate.dialect.DB2Dialect" #. Tag: entry +#: configuration.xml:947 #, no-c-format msgid "DB2 AS/400" msgstr "DB2 AS/400" -#. Tag: entry +#. Tag: literal +#: configuration.xml:949 #, fuzzy, no-c-format -msgid "org.hibernate.dialect.DB2400Dialect" +msgid "org.hibernate.dialect.DB2400Dialect" msgstr "org.hibernate.dialect.DB2400Dialect" #. Tag: entry +#: configuration.xml:953 #, no-c-format msgid "DB2 OS390" msgstr "DB2 OS390" -#. Tag: entry +#. Tag: literal +#: configuration.xml:955 #, fuzzy, no-c-format -msgid "org.hibernate.dialect.DB2390Dialect" +msgid "org.hibernate.dialect.DB2390Dialect" msgstr "org.hibernate.dialect.DB2390Dialect" #. Tag: entry +#: configuration.xml:959 #, no-c-format msgid "PostgreSQL" msgstr "PostgreSQL" -#. Tag: entry +#. Tag: literal +#: configuration.xml:961 #, fuzzy, no-c-format -msgid "org.hibernate.dialect.PostgreSQLDialect" +msgid "org.hibernate.dialect.PostgreSQLDialect" msgstr "org.hibernate.dialect.PostgreSQLDialect" #. Tag: entry +#: configuration.xml:965 #, no-c-format msgid "MySQL" msgstr "MySQL" -#. Tag: entry +#. Tag: literal +#: configuration.xml:967 #, fuzzy, no-c-format -msgid "org.hibernate.dialect.MySQLDialect" +msgid "org.hibernate.dialect.MySQLDialect" msgstr "org.hibernate.dialect.MySQLDialect" #. Tag: entry +#: configuration.xml:971 #, no-c-format msgid "MySQL with InnoDB" msgstr "MySQL mit InnoDB" -#. Tag: entry +#. Tag: literal +#: configuration.xml:973 #, fuzzy, no-c-format -msgid "org.hibernate.dialect.MySQLInnoDBDialect" +msgid "org.hibernate.dialect.MySQLInnoDBDialect" msgstr "org.hibernate.dialect.MySQLInnoDBDialect" #. Tag: entry +#: configuration.xml:977 #, no-c-format msgid "MySQL with MyISAM" msgstr "MySQL mit MyISAM" -#. Tag: entry +#. Tag: literal +#: configuration.xml:979 #, fuzzy, no-c-format -msgid "org.hibernate.dialect.MySQLMyISAMDialect" +msgid "org.hibernate.dialect.MySQLMyISAMDialect" msgstr "org.hibernate.dialect.MySQLMyISAMDialect" #. Tag: entry +#: configuration.xml:983 #, no-c-format msgid "Oracle (any version)" msgstr "Oracle (alle Versionen)" -#. Tag: entry +#. Tag: literal +#: configuration.xml:985 #, fuzzy, no-c-format -msgid "org.hibernate.dialect.OracleDialect" +msgid "org.hibernate.dialect.OracleDialect" msgstr "org.hibernate.dialect.OracleDialect" #. Tag: entry +#: configuration.xml:989 #, no-c-format msgid "Oracle 9i" msgstr "" -#. Tag: entry +#. Tag: literal +#: configuration.xml:991 #, fuzzy, no-c-format -msgid "org.hibernate.dialect.Oracle9iDialect" +msgid "org.hibernate.dialect.Oracle9iDialect" msgstr "org.hibernate.dialect.OracleDialect" #. Tag: entry +#: configuration.xml:995 #, no-c-format msgid "Oracle 10g" msgstr "" -#. Tag: entry +#. Tag: literal +#: configuration.xml:997 #, fuzzy, no-c-format -msgid "org.hibernate.dialect.Oracle10gDialect" +msgid "org.hibernate.dialect.Oracle10gDialect" msgstr "org.hibernate.dialect.OracleDialect" #. Tag: entry +#: configuration.xml:1001 #, no-c-format msgid "Sybase" msgstr "Sybase" -#. Tag: entry +#. Tag: literal +#: configuration.xml:1003 #, fuzzy, no-c-format -msgid "org.hibernate.dialect.SybaseDialect" +msgid "org.hibernate.dialect.SybaseDialect" msgstr "org.hibernate.dialect.SybaseDialect" #. Tag: entry +#: configuration.xml:1007 #, no-c-format msgid "Sybase Anywhere" msgstr "Sybase Anywhere" -#. Tag: entry +#. Tag: literal +#: configuration.xml:1009 #, fuzzy, no-c-format -msgid "org.hibernate.dialect.SybaseAnywhereDialect" +msgid "org.hibernate.dialect.SybaseAnywhereDialect" msgstr "org.hibernate.dialect.SybaseAnywhereDialect" #. Tag: entry +#: configuration.xml:1013 #, no-c-format msgid "Microsoft SQL Server" msgstr "Microsoft SQL-Server" -#. Tag: entry +#. Tag: literal +#: configuration.xml:1015 #, fuzzy, no-c-format -msgid "org.hibernate.dialect.SQLServerDialect" +msgid "org.hibernate.dialect.SQLServerDialect" msgstr "org.hibernate.dialect.SQLServerDialect" #. Tag: entry +#: configuration.xml:1019 #, no-c-format msgid "SAP DB" msgstr "SAP DB" -#. Tag: entry +#. Tag: literal +#: configuration.xml:1021 #, fuzzy, no-c-format -msgid "org.hibernate.dialect.SAPDBDialect" +msgid "org.hibernate.dialect.SAPDBDialect" msgstr "org.hibernate.dialect.SAPDBDialect" #. Tag: entry +#: configuration.xml:1025 #, no-c-format msgid "Informix" msgstr "Informix" -#. Tag: entry +#. Tag: literal +#: configuration.xml:1027 #, fuzzy, no-c-format -msgid "org.hibernate.dialect.InformixDialect" +msgid "org.hibernate.dialect.InformixDialect" msgstr "org.hibernate.dialect.InformixDialect" #. Tag: entry +#: configuration.xml:1031 #, no-c-format msgid "HypersonicSQL" msgstr "HypersonicSQL" -#. Tag: entry +#. Tag: literal +#: configuration.xml:1033 #, fuzzy, no-c-format -msgid "org.hibernate.dialect.HSQLDialect" +msgid "org.hibernate.dialect.HSQLDialect" msgstr "org.hibernate.dialect.HSQLDialect" #. Tag: entry +#: configuration.xml:1037 #, no-c-format msgid "Ingres" msgstr "Ingres" -#. Tag: entry +#. Tag: literal +#: configuration.xml:1039 #, fuzzy, no-c-format -msgid "org.hibernate.dialect.IngresDialect" +msgid "org.hibernate.dialect.IngresDialect" msgstr "org.hibernate.dialect.IngresDialect" #. Tag: entry +#: configuration.xml:1043 #, no-c-format msgid "Progress" msgstr "Progress" -#. Tag: entry +#. Tag: literal +#: configuration.xml:1045 #, fuzzy, no-c-format -msgid "org.hibernate.dialect.ProgressDialect" +msgid "org.hibernate.dialect.ProgressDialect" msgstr "org.hibernate.dialect.ProgressDialect" #. Tag: entry +#: configuration.xml:1049 #, no-c-format msgid "Mckoi SQL" msgstr "Mckoi SQL" -#. Tag: entry +#. Tag: literal +#: configuration.xml:1051 #, fuzzy, no-c-format -msgid "org.hibernate.dialect.MckoiDialect" +msgid "org.hibernate.dialect.MckoiDialect" msgstr "org.hibernate.dialect.MckoiDialect" #. Tag: entry +#: configuration.xml:1055 #, no-c-format msgid "Interbase" msgstr "Interbase" -#. Tag: entry +#. Tag: literal +#: configuration.xml:1057 #, fuzzy, no-c-format -msgid "org.hibernate.dialect.InterbaseDialect" +msgid "org.hibernate.dialect.InterbaseDialect" msgstr "org.hibernate.dialect.InterbaseDialect" #. Tag: entry +#: configuration.xml:1061 #, no-c-format msgid "Pointbase" msgstr "Pointbase" -#. Tag: entry +#. Tag: literal +#: configuration.xml:1063 #, fuzzy, no-c-format -msgid "org.hibernate.dialect.PointbaseDialect" +msgid "org.hibernate.dialect.PointbaseDialect" msgstr "org.hibernate.dialect.PointbaseDialect" #. Tag: entry +#: configuration.xml:1067 #, no-c-format msgid "FrontBase" msgstr "FrontBase" -#. Tag: entry +#. Tag: literal +#: configuration.xml:1069 #, fuzzy, no-c-format -msgid "org.hibernate.dialect.FrontbaseDialect" +msgid "org.hibernate.dialect.FrontbaseDialect" msgstr "org.hibernate.dialect.FrontbaseDialect" #. Tag: entry +#: configuration.xml:1073 #, no-c-format msgid "Firebird" msgstr "Firebird" -#. Tag: entry +#. Tag: literal +#: configuration.xml:1075 #, fuzzy, no-c-format -msgid "org.hibernate.dialect.FirebirdDialect" +msgid "org.hibernate.dialect.FirebirdDialect" msgstr "org.hibernate.dialect.FirebirdDialect" #. Tag: title +#: configuration.xml:1083 #, no-c-format msgid "Outer Join Fetching" msgstr "\"Outer-Join-Fetching\"" #. Tag: para +#: configuration.xml:1085 #, fuzzy, no-c-format msgid "" "If your database supports ANSI, Oracle or Sybase style outer joins, " @@ -1971,6 +2385,7 @@ msgstr "" "aufzurufen." #. Tag: para +#: configuration.xml:1094 #, fuzzy, no-c-format msgid "" "Outer join fetching can be disabled globally by setting " @@ -1987,18 +2402,21 @@ msgstr "" "\"-Assoziationen." #. Tag: para +#: configuration.xml:1100 #, fuzzy, no-c-format -msgid "See for more information." +msgid "See for more information." msgstr "" "Weitere Informationen finden Sie unter ." #. Tag: title +#: configuration.xml:1105 #, no-c-format msgid "Binary Streams" msgstr "Binäre Datenströme " #. Tag: para +#: configuration.xml:1107 #, fuzzy, no-c-format msgid "" "Oracle limits the size of byte arrays that can be passed " @@ -2015,16 +2433,18 @@ msgstr "" "gilt ausschließlich für die Systemebene." #. Tag: title +#: configuration.xml:1116 #, no-c-format msgid "Second-level and query cache" msgstr "Zweite Ebene und Anfragen-Cache" #. Tag: para +#: configuration.xml:1118 #, fuzzy, no-c-format msgid "" "The properties prefixed by hibernate.cache allow you to " "use a process or cluster scoped second-level cache system with Hibernate. " -"See the for more information." +"See the for more information." msgstr "" "Die Properties mit dem Präfix hibernate.cache erlauben " "die Verwendung eines prozess- oder clusterbegrenzten Cache-Systems der " @@ -2032,11 +2452,13 @@ msgstr "" "\"performance-cache\"/>." #. Tag: title +#: configuration.xml:1125 #, no-c-format msgid "Query Language Substitution" msgstr "\"Query Language Substitution\"" #. Tag: para +#: configuration.xml:1127 #, fuzzy, no-c-format msgid "" "You can define new Hibernate query tokens using hibernate.query." @@ -2045,7 +2467,14 @@ msgstr "" "Sie können neue Hibernate Anfrage-\"Tokens\" mittels hibernate." "query.substitutions definieren. Zum Beispiel:" +#. Tag: programlisting +#: configuration.xml:1130 +#, no-c-format +msgid "hibernate.query.substitutions true=1, false=0" +msgstr "hibernate.query.substitutions true=1, false=0" + #. Tag: para +#: configuration.xml:1132 #, fuzzy, no-c-format msgid "" "This would cause the tokens true and falsefalse in ganzzahlige Literale in der generierten SQL mit " "sich bringen." +#. Tag: programlisting +#: configuration.xml:1136 +#, no-c-format +msgid "hibernate.query.substitutions toLowercase=LOWER" +msgstr "hibernate.query.substitutions toLowercase=LOWER" + #. Tag: para +#: configuration.xml:1138 #, fuzzy, no-c-format msgid "" "This would allow you to rename the SQL LOWER function." @@ -2063,11 +2499,13 @@ msgstr "" "ermöglicht Ihnen die Umbenennung der SQL LOWER-Funktion." #. Tag: title +#: configuration.xml:1143 #, no-c-format msgid "Hibernate statistics" msgstr "Die Hibernate Statistik" #. Tag: para +#: configuration.xml:1145 #, fuzzy, no-c-format msgid "" "If you enable hibernate.generate_statistics, Hibernate " @@ -2084,11 +2522,13 @@ msgstr "" "der Interfaces org.hibernate.stats." #. Tag: title +#: configuration.xml:1155 #, no-c-format msgid "Logging" msgstr "Protokollierung" #. Tag: para +#: configuration.xml:1157 #, no-c-format msgid "" "Hibernate utilizes Simple Logging " @@ -2106,6 +2546,7 @@ msgid "" msgstr "" #. Tag: para +#: configuration.xml:1171 #, fuzzy, no-c-format msgid "" "It is recommended that you familiarize yourself with Hibernate's log " @@ -2121,56 +2562,67 @@ msgstr "" "Fehlerbehebung. Die wichtigsten Protokollkategorien lauten:" #. Tag: title +#: configuration.xml:1178 #, no-c-format msgid "Hibernate Log Categories" msgstr "Die Protokollkategorien von Hibernate" #. Tag: entry +#: configuration.xml:1187 #, no-c-format msgid "Category" msgstr "Kategorie" #. Tag: entry +#: configuration.xml:1189 #, no-c-format msgid "Function" msgstr "Funktion" -#. Tag: entry +#. Tag: literal +#: configuration.xml:1195 #, fuzzy, no-c-format -msgid "org.hibernate.SQL" -msgstr "org.hibernate.SQL" +msgid "org.hibernate.SQL" +msgstr "org.hibernate" #. Tag: entry +#: configuration.xml:1197 #, no-c-format msgid "Log all SQL DML statements as they are executed" msgstr "Protokollierung aller SQL DML-Anweisungen bei deren Ausführung" -#. Tag: entry +#. Tag: literal +#: configuration.xml:1201 #, fuzzy, no-c-format -msgid "org.hibernate.type" -msgstr "org.hibernate.type" +msgid "org.hibernate.type" +msgstr "org.hibernate" #. Tag: entry +#: configuration.xml:1203 #, no-c-format msgid "Log all JDBC parameters" msgstr "Protokollierung aller JDBC-Parameter" -#. Tag: entry +#. Tag: literal +#: configuration.xml:1207 #, fuzzy, no-c-format -msgid "org.hibernate.tool.hbm2ddl" +msgid "org.hibernate.tool.hbm2ddl" msgstr "org.hibernate.tool.hbm2ddl" #. Tag: entry +#: configuration.xml:1209 #, no-c-format msgid "Log all SQL DDL statements as they are executed" msgstr "Protokollierung aller SQL DDL-Anweisungen bei deren Ausführung" -#. Tag: entry +#. Tag: literal +#: configuration.xml:1213 #, fuzzy, no-c-format -msgid "org.hibernate.pretty" -msgstr "org.hibernate.pretty" +msgid "org.hibernate.pretty" +msgstr "org.hibernate" #. Tag: entry +#: configuration.xml:1215 #, no-c-format msgid "" "Log the state of all entities (max 20 entities) associated with the session " @@ -2179,62 +2631,74 @@ msgstr "" "Protokollierung des Status aller Entities (max. 20 Entities) die zum " "Räumungzeitpunkt mit der Session assoziiert werden." -#. Tag: entry +#. Tag: literal +#: configuration.xml:1220 #, fuzzy, no-c-format -msgid "org.hibernate.cache" -msgstr "org.hibernate.cache" +msgid "org.hibernate.cache" +msgstr "org.hibernate" #. Tag: entry +#: configuration.xml:1222 #, no-c-format msgid "Log all second-level cache activity" msgstr "Protokollierung aller Cache-Vorgänge der zweiten Ebene" -#. Tag: entry +#. Tag: literal +#: configuration.xml:1226 #, fuzzy, no-c-format -msgid "org.hibernate.transaction" +msgid "org.hibernate.transaction" msgstr "org.hibernate.transaction" #. Tag: entry +#: configuration.xml:1228 #, no-c-format msgid "Log transaction related activity" msgstr "Protokollierung von transaktionsbezogenen Vorgänge" -#. Tag: entry +#. Tag: literal +#: configuration.xml:1232 #, fuzzy, no-c-format -msgid "org.hibernate.jdbc" -msgstr "org.hibernate.jdbc" +msgid "org.hibernate.jdbc" +msgstr "org.hibernate" #. Tag: entry +#: configuration.xml:1234 #, no-c-format msgid "Log all JDBC resource acquisition" msgstr "Protokollierung sämtlicher JDBC-Ressourcen-Erfassungen" -#. Tag: entry +#. Tag: literal +#: configuration.xml:1238 #, fuzzy, no-c-format -msgid "org.hibernate.hql.ast.AST" +msgid "org.hibernate.hql.ast.AST" msgstr "org.hibernate.hql.ast.AST" #. Tag: entry +#: configuration.xml:1240 #, no-c-format msgid "Log HQL and SQL ASTs during query parsing" msgstr "Protokollierung von HQL und SQL ASTs während Abfragen-Parsing" -#. Tag: entry +#. Tag: literal +#: configuration.xml:1244 #, fuzzy, no-c-format -msgid "org.hibernate.secure" -msgstr "org.hibernate.secure" +msgid "org.hibernate.secure" +msgstr "org.hibernate" #. Tag: entry +#: configuration.xml:1246 #, no-c-format msgid "Log all JAAS authorization requests" msgstr "Protokollierung aller JAAS-Authentifizierungsanfragen" -#. Tag: entry -#, fuzzy, no-c-format -msgid "org.hibernate" -msgstr "JNDI-gebundene SessionFactory" +#. Tag: literal +#: configuration.xml:1250 +#, no-c-format +msgid "org.hibernate" +msgstr "org.hibernate" #. Tag: entry +#: configuration.xml:1252 #, fuzzy, no-c-format msgid "" "Log everything. This is a lot of information but it is useful for " @@ -2244,6 +2708,7 @@ msgstr "" "bei der Fehlerbehebung)" #. Tag: para +#: configuration.xml:1259 #, no-c-format msgid "" "When developing applications with Hibernate, you should almost always work " @@ -2257,11 +2722,13 @@ msgstr "" "mit der aktivierten Property hibernate.show_sql." #. Tag: title +#: configuration.xml:1266 #, fuzzy, no-c-format msgid "Implementing a NamingStrategy" msgstr "wählen Sie eine NamingStrategy" #. Tag: para +#: configuration.xml:1268 #, no-c-format msgid "" "The interface org.hibernate.cfg.NamingStrategy allows you " @@ -2272,6 +2739,7 @@ msgstr "" "Datenbankobjekte und Schema-Elemente zu bestimmen." #. Tag: para +#: configuration.xml:1272 #, fuzzy, no-c-format msgid "" "You can provide rules for automatically generating database identifiers from " @@ -2290,6 +2758,7 @@ msgstr "" "Die von Hibernate verwendete Standardstrategie ist recht minimal." #. Tag: para +#: configuration.xml:1279 #, fuzzy, no-c-format msgid "" "You can specify a different strategy by calling Configuration." @@ -2298,7 +2767,24 @@ msgstr "" "Mit dem Aufruf Configuration.setNamingStrategy() können " "Sie eine andere Strategie festlegen, ehe Sie Mappings hinzufügen:" +#. Tag: programlisting +#: configuration.xml:1283 +#, fuzzy, no-c-format +msgid "" +"SessionFactory sf = new Configuration()\n" +" .setNamingStrategy(ImprovedNamingStrategy.INSTANCE)\n" +" .addFile(\"Item.hbm.xml\")\n" +" .addFile(\"Bid.hbm.xml\")\n" +" .buildSessionFactory();" +msgstr "" +"SessionFactory sf = new Configuration()\n" +" .setNamingStrategy(ImprovedNamingStrategy.INSTANCE)\n" +" .addFile(\"Item.hbm.xml\")\n" +" .addFile(\"Bid.hbm.xml\")\n" +" .buildSessionFactory();" + #. Tag: para +#: configuration.xml:1285 #, no-c-format msgid "" "org.hibernate.cfg.ImprovedNamingStrategy is a built-in " @@ -2309,11 +2795,13 @@ msgstr "" "von Nutzen sein kann." #. Tag: title +#: configuration.xml:1291 #, no-c-format msgid "XML configuration file" msgstr "XML-Konfigurationsdatei" #. Tag: para +#: configuration.xml:1293 #, no-c-format msgid "" "An alternative approach to configuration is to specify a full configuration " @@ -2328,6 +2816,7 @@ msgstr "" "Kraft setzen." #. Tag: para +#: configuration.xml:1299 #, fuzzy, no-c-format msgid "" "The XML configuration file is by default expected to be in the root of your " @@ -2337,7 +2826,92 @@ msgstr "" "Stammverzeichnis Ihres CLASSPATH. Nachfolgend sehen Sie " "ein Beispiel:" +#. Tag: programlisting +#: configuration.xml:1302 +#, fuzzy, no-c-format +msgid "" +"<?xml version='1.0' encoding='utf-8'?>\n" +"<!DOCTYPE hibernate-configuration PUBLIC\n" +" \"-//Hibernate/Hibernate Configuration DTD//EN\"\n" +" \"http://hibernate.sourceforge.net/hibernate-configuration-3.0.dtd" +"\">\n" +"\n" +"<hibernate-configuration>\n" +"\n" +" <!-- a SessionFactory instance listed as /jndi/name -->\n" +" <session-factory\n" +" name=\"java:hibernate/SessionFactory\">\n" +"\n" +" <!-- properties -->\n" +" <property name=\"connection.datasource\">java:/comp/env/jdbc/" +"MyDB</property>\n" +" <property name=\"dialect\">org.hibernate.dialect." +"MySQLDialect</property>\n" +" <property name=\"show_sql\">false</property>\n" +" <property name=\"transaction.factory_class\">\n" +" org.hibernate.transaction.JTATransactionFactory\n" +" </property>\n" +" <property name=\"jta.UserTransaction\">java:comp/" +"UserTransaction</property>\n" +"\n" +" <!-- mapping files -->\n" +" <mapping resource=\"org/hibernate/auction/Item.hbm.xml\"/>\n" +" <mapping resource=\"org/hibernate/auction/Bid.hbm.xml\"/>\n" +"\n" +" <!-- cache settings -->\n" +" <class-cache class=\"org.hibernate.auction.Item\" usage=\"read-" +"write\"/>\n" +" <class-cache class=\"org.hibernate.auction.Bid\" usage=\"read-only" +"\"/>\n" +" <collection-cache collection=\"org.hibernate.auction.Item.bids\" " +"usage=\"read-write\"/>\n" +"\n" +" </session-factory>\n" +"\n" +"</hibernate-configuration>" +msgstr "" +"<?xml version='1.0' encoding='utf-8'?>\n" +"<!DOCTYPE hibernate-configuration PUBLIC\n" +" \"-//Hibernate/Hibernate Configuration DTD//EN\"\n" +" \"http://hibernate.sourceforge.net/hibernate-configuration-3.0.dtd" +"\">\n" +"\n" +"<hibernate-configuration>\n" +"\n" +" <!-- a SessionFactory instance listed as /jndi/name -->\n" +" <session-factory\n" +" name=\"java:hibernate/SessionFactory\">\n" +"\n" +" <!-- properties -->\n" +" <property name=\"connection.datasource\">java:/comp/env/jdbc/" +"MyDB</property>\n" +" <property name=\"dialect\">org.hibernate.dialect." +"MySQLDialect</property>\n" +" <property name=\"show_sql\">false</property>\n" +" <property name=\"transaction.factory_class\">\n" +" org.hibernate.transaction.JTATransactionFactory\n" +" </property>\n" +" <property name=\"jta.UserTransaction\">java:comp/" +"UserTransaction</property>\n" +"\n" +" <!-- mapping files -->\n" +" <mapping resource=\"org/hibernate/auction/Item.hbm.xml\"/>\n" +" <mapping resource=\"org/hibernate/auction/Bid.hbm.xml\"/>\n" +"\n" +" <!-- cache settings -->\n" +" <class-cache class=\"org.hibernate.auction.Item\" usage=\"read-" +"write\"/>\n" +" <class-cache class=\"org.hibernate.auction.Bid\" usage=\"read-only" +"\"/>\n" +" <collection-cache collection=\"org.hibernate.auction.Item.bids\" " +"usage=\"read-write\"/>\n" +"\n" +" </session-factory>\n" +"\n" +"</hibernate-configuration>" + #. Tag: para +#: configuration.xml:1304 #, fuzzy, no-c-format msgid "" "The advantage of this approach is the externalization of the mapping file " @@ -2356,22 +2930,46 @@ msgstr "" "bereitserwähnten Vorteil durch die Benutzung der XML-Syntax gleichwertig." #. Tag: para +#: configuration.xml:1311 #, fuzzy, no-c-format msgid "With the XML configuration, starting Hibernate is then as simple as:" msgstr "" "Mit der XML-Konfiguration wird der Start von Hibernate dann ganz einfach mit" +#. Tag: programlisting +#: configuration.xml:1314 +#, fuzzy, no-c-format +msgid "" +"SessionFactory sf = new Configuration().configure().buildSessionFactory();" +msgstr "" +"SessionFactory sf = new Configuration().configure().buildSessionFactory();" + #. Tag: para +#: configuration.xml:1316 #, fuzzy, no-c-format msgid "You can select a different XML configuration file using:" msgstr "Die Wahl einer anderen XML-Konfigurationsdatei erfolgt mittels" +#. Tag: programlisting +#: configuration.xml:1318 +#, fuzzy, no-c-format +msgid "" +"SessionFactory sf = new Configuration()\n" +" .configure(\"catdb.cfg.xml\")\n" +" .buildSessionFactory();" +msgstr "" +"SessionFactory sf = new Configuration()\n" +" .configure(\"catdb.cfg.xml\")\n" +" .buildSessionFactory();" + #. Tag: title +#: configuration.xml:1322 #, no-c-format msgid "J2EE Application Server integration" msgstr "Integration des J2EE-Applikationsservers" #. Tag: para +#: configuration.xml:1324 #, no-c-format msgid "Hibernate has the following integration points for J2EE infrastructure:" msgstr "" @@ -2379,6 +2977,7 @@ msgstr "" "Infrastruktur:" #. Tag: para +#: configuration.xml:1329 #, fuzzy, no-c-format msgid "" "Container-managed datasources: Hibernate can use JDBC " @@ -2401,6 +3000,7 @@ msgstr "" "Ihren Code übertragbar zu halten." #. Tag: para +#: configuration.xml:1343 #, no-c-format msgid "" "Automatic JNDI binding: Hibernate can bind its " @@ -2410,6 +3010,7 @@ msgstr "" "SessionFactory nach dem Startup an JNDI binden." #. Tag: para +#: configuration.xml:1350 #, fuzzy, no-c-format msgid "" "JTA Session binding: the Hibernate SessionJMX deployment: if you have a JMX capable application " @@ -2449,6 +3051,7 @@ msgstr "" "(Datenquelle muss vor dem Hibernate Start verfügbar sein usw.). " #. Tag: para +#: configuration.xml:1373 #, no-c-format msgid "" "Depending on your environment, you might have to set the configuration " @@ -2461,11 +3064,13 @@ msgstr "" "Verbindungseinschränkungen) anzeigt." #. Tag: title +#: configuration.xml:1379 #, no-c-format msgid "Transaction strategy configuration" msgstr "Konfiguration der Transaktionsstrategie" #. Tag: para +#: configuration.xml:1381 #, fuzzy, no-c-format msgid "" "The Hibernate Session API is independent of any " @@ -2484,6 +3089,7 @@ msgstr "" "Bedarf aufzurufen." #. Tag: para +#: configuration.xml:1389 #, no-c-format msgid "" "To keep your code portable between these two (and other) environments we " @@ -2501,26 +3107,31 @@ msgstr "" "transaction.factory_class einstellen." #. Tag: para +#: configuration.xml:1397 #, fuzzy, no-c-format msgid "There are three standard, or built-in, choices:" msgstr "Es existieren drei Standard-Auswahlmöglichkeiten (eingebaut):" -#. Tag: term +#. Tag: literal +#: configuration.xml:1401 #, fuzzy, no-c-format -msgid "org.hibernate.transaction.JDBCTransactionFactory" +msgid "org.hibernate.transaction.JDBCTransactionFactory" msgstr "org.hibernate.transaction.JDBCTransactionFactory" #. Tag: para +#: configuration.xml:1404 #, no-c-format msgid "delegates to database (JDBC) transactions (default)" msgstr "delegiert an die Datenbank (JDBC) Transaktionen (default)" -#. Tag: term +#. Tag: literal +#: configuration.xml:1409 #, fuzzy, no-c-format -msgid "org.hibernate.transaction.JTATransactionFactory" +msgid "org.hibernate.transaction.JTATransactionFactory" msgstr "org.hibernate.transaction.JTATransactionFactory" #. Tag: para +#: configuration.xml:1412 #, fuzzy, no-c-format msgid "" "delegates to container-managed transactions if an existing transaction is " @@ -2532,17 +3143,20 @@ msgstr "" "Andernfalls wird eine neue Transaktion gestartet und von einem Bean " "gemanagte Transaktionen werden verwendet." -#. Tag: term +#. Tag: literal +#: configuration.xml:1420 #, fuzzy, no-c-format -msgid "org.hibernate.transaction.CMTTransactionFactory" +msgid "org.hibernate.transaction.CMTTransactionFactory" msgstr "org.hibernate.transaction.CMTTransactionFactory" #. Tag: para +#: configuration.xml:1423 #, no-c-format msgid "delegates to container-managed JTA transactions" msgstr "delegiert an containerverwaltete JTA-Transaktionen" #. Tag: para +#: configuration.xml:1428 #, fuzzy, no-c-format msgid "" "You can also define your own transaction strategies (for a CORBA transaction " @@ -2552,6 +3166,7 @@ msgstr "" "einen CORBA-Transaktionsdienst)." #. Tag: para +#: configuration.xml:1431 #, fuzzy, no-c-format msgid "" "Some features in Hibernate (i.e., the second level cache, Contextual " @@ -2569,138 +3184,151 @@ msgstr "" "Mechanismus standardisiert:" #. Tag: title +#: configuration.xml:1439 #, no-c-format msgid "JTA TransactionManagers" msgstr "JTA-TransactionManagers" #. Tag: entry +#: configuration.xml:1448 #, no-c-format msgid "Transaction Factory" msgstr "Transaction-Factory" #. Tag: entry +#: configuration.xml:1450 #, no-c-format msgid "Application Server" msgstr "Applikationsserver" -#. Tag: entry +#. Tag: literal +#: configuration.xml:1456 #, fuzzy, no-c-format -msgid "" -"org.hibernate.transaction.JBossTransactionManagerLookup" +msgid "org.hibernate.transaction.JBossTransactionManagerLookup" msgstr "org.hibernate.transaction.JBossTransactionManagerLookup" #. Tag: entry +#: configuration.xml:1458 #, no-c-format msgid "JBoss" msgstr "JBoss" -#. Tag: entry +#. Tag: literal +#: configuration.xml:1462 #, fuzzy, no-c-format -msgid "" -"org.hibernate.transaction.WeblogicTransactionManagerLookup" +msgid "org.hibernate.transaction.WeblogicTransactionManagerLookup" msgstr "org.hibernate.transaction.WeblogicTransactionManagerLookup" #. Tag: entry +#: configuration.xml:1464 #, no-c-format msgid "Weblogic" msgstr "Weblogic" -#. Tag: entry +#. Tag: literal +#: configuration.xml:1468 #, fuzzy, no-c-format -msgid "" -"org.hibernate.transaction.WebSphereTransactionManagerLookup" +msgid "org.hibernate.transaction.WebSphereTransactionManagerLookup" msgstr "org.hibernate.transaction.WebSphereTransactionManagerLookup" #. Tag: entry +#: configuration.xml:1470 #, no-c-format msgid "WebSphere" msgstr "WebSphere" -#. Tag: entry +#. Tag: literal +#: configuration.xml:1474 #, fuzzy, no-c-format -msgid "" -"org.hibernate.transaction.WebSphereExtendedJTATransactionLookup" +msgid "org.hibernate.transaction.WebSphereExtendedJTATransactionLookup" msgstr "org.hibernate.transaction.WebSphereExtendedJTATransactionLookup" #. Tag: entry +#: configuration.xml:1476 #, no-c-format msgid "WebSphere 6" msgstr "WebSphere 6" -#. Tag: entry +#. Tag: literal +#: configuration.xml:1480 #, fuzzy, no-c-format -msgid "" -"org.hibernate.transaction.OrionTransactionManagerLookup" +msgid "org.hibernate.transaction.OrionTransactionManagerLookup" msgstr "org.hibernate.transaction.OrionTransactionManagerLookup" #. Tag: entry +#: configuration.xml:1482 #, no-c-format msgid "Orion" msgstr "Orion" -#. Tag: entry +#. Tag: literal +#: configuration.xml:1486 #, fuzzy, no-c-format -msgid "" -"org.hibernate.transaction.ResinTransactionManagerLookup" +msgid "org.hibernate.transaction.ResinTransactionManagerLookup" msgstr "org.hibernate.transaction.ResinTransactionManagerLookup" #. Tag: entry +#: configuration.xml:1488 #, no-c-format msgid "Resin" msgstr "Resin" -#. Tag: entry +#. Tag: literal +#: configuration.xml:1492 #, fuzzy, no-c-format -msgid "" -"org.hibernate.transaction.JOTMTransactionManagerLookup" +msgid "org.hibernate.transaction.JOTMTransactionManagerLookup" msgstr "org.hibernate.transaction.JOTMTransactionManagerLookup" #. Tag: entry +#: configuration.xml:1494 #, no-c-format msgid "JOTM" msgstr "JOTM" -#. Tag: entry +#. Tag: literal +#: configuration.xml:1498 #, fuzzy, no-c-format -msgid "" -"org.hibernate.transaction.JOnASTransactionManagerLookup" +msgid "org.hibernate.transaction.JOnASTransactionManagerLookup" msgstr "org.hibernate.transaction.JOnASTransactionManagerLookup" #. Tag: entry +#: configuration.xml:1500 #, no-c-format msgid "JOnAS" msgstr "JOnAS" -#. Tag: entry +#. Tag: literal +#: configuration.xml:1504 #, fuzzy, no-c-format -msgid "" -"org.hibernate.transaction.JRun4TransactionManagerLookup" +msgid "org.hibernate.transaction.JRun4TransactionManagerLookup" msgstr "org.hibernate.transaction.JRun4TransactionManagerLookup" #. Tag: entry +#: configuration.xml:1506 #, no-c-format msgid "JRun4" msgstr "JRun4" -#. Tag: entry +#. Tag: literal +#: configuration.xml:1510 #, fuzzy, no-c-format -msgid "" -"org.hibernate.transaction.BESTransactionManagerLookup" +msgid "org.hibernate.transaction.BESTransactionManagerLookup" msgstr "org.hibernate.transaction.BESTransactionManagerLookup" #. Tag: entry +#: configuration.xml:1512 #, no-c-format msgid "Borland ES" msgstr "Borland ES" #. Tag: title +#: configuration.xml:1520 #, fuzzy, no-c-format msgid "JNDI-bound SessionFactory" msgstr "JNDI-gebundene SessionFactory" #. Tag: para +#: configuration.xml:1522 #, fuzzy, no-c-format msgid "" "A JNDI-bound Hibernate SessionFactory can simplify the " @@ -2715,6 +3343,7 @@ msgstr "" "diesselbe Registry!" #. Tag: para +#: configuration.xml:1528 #, fuzzy, no-c-format msgid "" "If you wish to have the SessionFactory bound to a JNDI " @@ -2734,6 +3363,7 @@ msgstr "" "Tomcat - hilfreich)." #. Tag: para +#: configuration.xml:1536 #, no-c-format msgid "" "When binding the SessionFactory to JNDI, Hibernate will " @@ -2748,6 +3378,7 @@ msgstr "" "literal> verwendet." #. Tag: para +#: configuration.xml:1542 #, fuzzy, no-c-format msgid "" "Hibernate will automatically place the SessionFactory in " @@ -2764,6 +3395,7 @@ msgstr "" "Deployment mit HibernateService (wird später erläutert)." #. Tag: para +#: configuration.xml:1550 #, fuzzy, no-c-format msgid "" "If you use a JNDI SessionFactory, an EJB or any other " @@ -2775,6 +3407,7 @@ msgstr "" "SessionFactory erhalten." #. Tag: para +#: configuration.xml:1554 #, fuzzy, no-c-format msgid "" "It is recommended that you bind the SessionFactory to " @@ -2783,7 +3416,7 @@ msgid "" "recommend to hide the actual lookup code for a SessionFactory in a helper class, such as HibernateUtil.getSessionFactory" "(). Note that such a class is also a convenient way to startup " -"Hibernate—see chapter 1." +"Hibernate—see chapter 1." msgstr "" "Wir empfehlen, dass Sie die SessionFactory in einer " "gemanagten Umgebung an JNDI binden und andernfalls einen staticSessions and transactions is " "Hibernate's automatic \"current\" Session management. For " "a discussion of contextual sessions see . Using the \"jta\" session context, if there " +"session\"/>. Using the \"jta\" session context, if there " "is no Hibernate Session associated with the current JTA " "transaction, one will be started and associated with that JTA transaction " "the first time you call sessionFactory.getCurrentSession(). The Sessions retrieved via " -"getCurrentSession() in the\"jta\" " +"getCurrentSession() in the \"jta\" " "context are set to automatically flush before the transaction completes, " "close after the transaction completes, and aggressively release JDBC " "connections after each statement. This allows the Sessioncfg.buildSessionFactory() still has to be " @@ -2865,6 +3502,7 @@ msgstr "" "emphasis> erfolgen." #. Tag: para +#: configuration.xml:1598 #, fuzzy, no-c-format msgid "" "Hibernate is distributed with org.hibernate.jmx.HibernateServicejboss-" "service.xml for JBoss 4.0.x:" +#. Tag: programlisting +#: configuration.xml:1604 +#, fuzzy, no-c-format +msgid "" +"<?xml version=\"1.0\"?>\n" +"<server>\n" +"\n" +"<mbean code=\"org.hibernate.jmx.HibernateService\"\n" +" name=\"jboss.jca:service=HibernateFactory,name=HibernateFactory\">\n" +"\n" +" <!-- Required services -->\n" +" <depends>jboss.jca:service=RARDeployer</depends>\n" +" <depends>jboss.jca:service=LocalTxCM,name=HsqlDS</depends>\n" +"\n" +" <!-- Bind the Hibernate service to JNDI -->\n" +" <attribute name=\"JndiName\">java:/hibernate/SessionFactory</" +"attribute>\n" +"\n" +" <!-- Datasource settings -->\n" +" <attribute name=\"Datasource\">java:HsqlDS</attribute>\n" +" <attribute name=\"Dialect\">org.hibernate.dialect.HSQLDialect</" +"attribute>\n" +"\n" +" <!-- Transaction integration -->\n" +" <attribute name=\"TransactionStrategy\">\n" +" org.hibernate.transaction.JTATransactionFactory</attribute>\n" +" <attribute name=\"TransactionManagerLookupStrategy\">\n" +" org.hibernate.transaction.JBossTransactionManagerLookup</" +"attribute>\n" +" <attribute name=\"FlushBeforeCompletionEnabled\">true</" +"attribute>\n" +" <attribute name=\"AutoCloseSessionEnabled\">true</" +"attribute>\n" +"\n" +" <!-- Fetching options -->\n" +" <attribute name=\"MaximumFetchDepth\">5</attribute>\n" +"\n" +" <!-- Second-level caching -->\n" +" <attribute name=\"SecondLevelCacheEnabled\">true</" +"attribute>\n" +" <attribute name=\"CacheProviderClass\">org.hibernate.cache." +"EhCacheProvider</attribute>\n" +" <attribute name=\"QueryCacheEnabled\">true</attribute>\n" +"\n" +" <!-- Logging -->\n" +" <attribute name=\"ShowSqlEnabled\">true</attribute>\n" +"\n" +" <!-- Mapping files -->\n" +" <attribute name=\"MapResources\">auction/Item.hbm.xml,auction/" +"Category.hbm.xml</attribute>\n" +"\n" +"</mbean>\n" +"\n" +"</server>" +msgstr "" +"<?xml version=\"1.0\"?>\n" +"<server>\n" +"\n" +"<mbean code=\"org.hibernate.jmx.HibernateService\"\n" +" name=\"jboss.jca:service=HibernateFactory,name=HibernateFactory\">\n" +"\n" +" <!-- Required services -->\n" +" <depends>jboss.jca:service=RARDeployer</depends>\n" +" <depends>jboss.jca:service=LocalTxCM,name=HsqlDS</depends>\n" +"\n" +" <!-- Bind the Hibernate service to JNDI -->\n" +" <attribute name=\"JndiName\">java:/hibernate/SessionFactory</" +"attribute>\n" +"\n" +" <!-- Datasource settings -->\n" +" <attribute name=\"Datasource\">java:HsqlDS</attribute>\n" +" <attribute name=\"Dialect\">org.hibernate.dialect.HSQLDialect</" +"attribute>\n" +"\n" +" <!-- Transaction integration -->\n" +" <attribute name=\"TransactionStrategy\">\n" +" org.hibernate.transaction.JTATransactionFactory</attribute>\n" +" <attribute name=\"TransactionManagerLookupStrategy\">\n" +" org.hibernate.transaction.JBossTransactionManagerLookup</" +"attribute>\n" +" <attribute name=\"FlushBeforeCompletionEnabled\">true</" +"attribute>\n" +" <attribute name=\"AutoCloseSessionEnabled\">true</" +"attribute>\n" +"\n" +" <!-- Fetching options -->\n" +" <attribute name=\"MaximumFetchDepth\">5</attribute>\n" +"\n" +" <!-- Second-level caching -->\n" +" <attribute name=\"SecondLevelCacheEnabled\">true</" +"attribute>\n" +" <attribute name=\"CacheProviderClass\">org.hibernate.cache." +"EhCacheProvider</attribute>\n" +" <attribute name=\"QueryCacheEnabled\">true</attribute>\n" +"\n" +" <!-- Logging -->\n" +" <attribute name=\"ShowSqlEnabled\">true</attribute>\n" +"\n" +" <!-- Mapping files -->\n" +" <attribute name=\"MapResources\">auction/Item.hbm.xml,auction/" +"Category.hbm.xml</attribute>\n" +"\n" +"</mbean>\n" +"\n" +"</server>" + #. Tag: para +#: configuration.xml:1606 #, fuzzy, no-c-format msgid "" "This file is deployed in a directory called META-INF and " @@ -2902,327 +3647,53 @@ msgstr "" "Dienst und EJB-Deployment finden Sie in der JBoss AS Dokumentation." #, fuzzy -#~ msgid "" -#~ "" -#~ msgstr "" -#~ "Configuration cfg = new Configuration()\n" -#~ " .addResource(\"Item.hbm.xml\")\n" -#~ " .addResource(\"Bid.hbm.xml\");" +#~ msgid "JDBC URL" +#~ msgstr "jdbc-Treiberklasse" #, fuzzy -#~ msgid "" -#~ "" -#~ msgstr "" -#~ "Configuration cfg = new Configuration()\n" -#~ " .addClass(org.hibernate.auction.Item.class)\n" -#~ " .addClass(org.hibernate.auction.Bid.class);" +#~ msgid "database user" +#~ msgstr "Datenbankbenutzer (optional)" #, fuzzy -#~ msgid "" -#~ "" -#~ msgstr "" -#~ "Configuration cfg = new Configuration()\n" -#~ " .addClass(org.hibernate.auction.Item.class)\n" -#~ " .addClass(org.hibernate.auction.Bid.class)\n" -#~ " .setProperty(\"hibernate.dialect\", \"org.hibernate.dialect." -#~ "MySQLInnoDBDialect\")\n" -#~ " .setProperty(\"hibernate.connection.datasource\", \"java:comp/env/" -#~ "jdbc/test\")\n" -#~ " .setProperty(\"hibernate.order_updates\", \"true\");" +#~ msgid "database user password" +#~ msgstr "Passwort des Datenbankbenutzers (optional)" #, fuzzy -#~ msgid "" -#~ msgstr "SessionFactory sessions = cfg.buildSessionFactory();" +#~ msgid "datasource JNDI name" +#~ msgstr "Datenbankbenutzer (optional)" #, fuzzy -#~ msgid "" -#~ "" -#~ msgstr "Session session = sessions.openSession(); // open a new Session" - -#~ msgid "database user" -#~ msgstr "Datenbankbenutzer" - -#~ msgid "database user password" -#~ msgstr "Datenbankbenutzer-Passwort" +#~ msgid "hibernate.generate_statistics" +#~ msgstr "hibernate.generate_statistics" #, fuzzy -#~ msgid "" -#~ "" -#~ msgstr "" -#~ "hibernate.connection.driver_class = org.postgresql.Driver\n" -#~ "hibernate.connection.url = jdbc:postgresql://localhost/mydatabase\n" -#~ "hibernate.connection.username = myuser\n" -#~ "hibernate.connection.password = secret\n" -#~ "hibernate.c3p0.min_size=5\n" -#~ "hibernate.c3p0.max_size=20\n" -#~ "hibernate.c3p0.timeout=1800\n" -#~ "hibernate.c3p0.max_statements=50\n" -#~ "hibernate.dialect = org.hibernate.dialect.PostgreSQLDialect" - -#~ msgid "datasource JNDI name" -#~ msgstr "JNDI-Name der Datenquelle" +#~ msgid "hibernate.query.substitutions" +#~ msgstr "hibernate.query.substitutions" #, fuzzy -#~ msgid "" -#~ "" -#~ msgstr "" -#~ "hibernate.connection.datasource = java:/comp/env/jdbc/test\n" -#~ "hibernate.transaction.factory_class = \\n" -#~ " org.hibernate.transaction.JTATransactionFactory\n" -#~ "hibernate.transaction.manager_lookup_class = \\n" -#~ " org.hibernate.transaction.JBossTransactionManagerLookup\n" -#~ "hibernate.dialect = org.hibernate.dialect.PostgreSQLDialect" - -#~ msgid "DB2" -#~ msgstr "DB2" - -#~ msgid "hibernate.query.substitutions true=1, false=0" -#~ msgstr "hibernate.query.substitutions true=1, false=0" - -#~ msgid "hibernate.query.substitutions toLowercase=LOWER" -#~ msgstr "hibernate.query.substitutions toLowercase=LOWER" - -#~ msgid "org.hibernate" -#~ msgstr "org.hibernate" +#~ msgid "org.hibernate.SQL" +#~ msgstr "org.hibernate.SQL" #, fuzzy -#~ msgid "" -#~ "" -#~ msgstr "" -#~ "SessionFactory sf = new Configuration()\n" -#~ " .setNamingStrategy(ImprovedNamingStrategy.INSTANCE)\n" -#~ " .addFile(\"Item.hbm.xml\")\n" -#~ " .addFile(\"Bid.hbm.xml\")\n" -#~ " .buildSessionFactory();" +#~ msgid "org.hibernate.type" +#~ msgstr "org.hibernate.type" #, fuzzy -#~ msgid "" -#~ "\n" -#~ "\n" -#~ "\n" -#~ "\n" -#~ "\n" -#~ " \n" -#~ " \n" -#~ "\n" -#~ " \n" -#~ " java:/comp/env/jdbc/" -#~ "MyDB\n" -#~ " org.hibernate.dialect.MySQLDialect\n" -#~ " false\n" -#~ " \n" -#~ " org.hibernate.transaction.JTATransactionFactory\n" -#~ " \n" -#~ " java:comp/UserTransaction\n" -#~ "\n" -#~ " \n" -#~ " \n" -#~ " \n" -#~ "\n" -#~ " \n" -#~ " \n" -#~ " \n" -#~ " \n" -#~ "\n" -#~ " \n" -#~ "\n" -#~ "]]>" -#~ msgstr "" -#~ "<?xml version='1.0' encoding='utf-8'?>\n" -#~ "<!DOCTYPE hibernate-configuration PUBLIC\n" -#~ " \"-//Hibernate/Hibernate Configuration DTD//EN\"\n" -#~ " \"http://hibernate.sourceforge.net/hibernate-configuration-3.0.dtd" -#~ "\">\n" -#~ "\n" -#~ "<hibernate-configuration>\n" -#~ "\n" -#~ " <!-- a SessionFactory instance listed as /jndi/name -->\n" -#~ " <session-factory\n" -#~ " name=\"java:hibernate/SessionFactory\">\n" -#~ "\n" -#~ " <!-- properties -->\n" -#~ " <property name=\"connection.datasource\">java:/comp/env/" -#~ "jdbc/MyDB</property>\n" -#~ " <property name=\"dialect\">org.hibernate.dialect." -#~ "MySQLDialect</property>\n" -#~ " <property name=\"show_sql\">false</property>\n" -#~ " <property name=\"transaction.factory_class\">\n" -#~ " org.hibernate.transaction.JTATransactionFactory\n" -#~ " </property>\n" -#~ " <property name=\"jta.UserTransaction\">java:comp/" -#~ "UserTransaction</property>\n" -#~ "\n" -#~ " <!-- mapping files -->\n" -#~ " <mapping resource=\"org/hibernate/auction/Item.hbm.xml\"/>\n" -#~ " <mapping resource=\"org/hibernate/auction/Bid.hbm.xml\"/>\n" -#~ "\n" -#~ " <!-- cache settings -->\n" -#~ " <class-cache class=\"org.hibernate.auction.Item\" usage=\"read-" -#~ "write\"/>\n" -#~ " <class-cache class=\"org.hibernate.auction.Bid\" usage=\"read-" -#~ "only\"/>\n" -#~ " <collection-cache collection=\"org.hibernate.auction.Item.bids" -#~ "\" usage=\"read-write\"/>\n" -#~ "\n" -#~ " </session-factory>\n" -#~ "\n" -#~ "</hibernate-configuration>" +#~ msgid "org.hibernate.pretty" +#~ msgstr "org.hibernate.pretty" #, fuzzy -#~ msgid "" -#~ "" -#~ msgstr "" -#~ "SessionFactory sf = new Configuration().configure().buildSessionFactory();" +#~ msgid "org.hibernate.cache" +#~ msgstr "org.hibernate.cache" #, fuzzy -#~ msgid "" -#~ "" -#~ msgstr "" -#~ "SessionFactory sf = new Configuration()\n" -#~ " .configure(\"catdb.cfg.xml\")\n" -#~ " .buildSessionFactory();" +#~ msgid "org.hibernate.jdbc" +#~ msgstr "org.hibernate.jdbc" #, fuzzy -#~ msgid "" -#~ "\n" -#~ "\n" -#~ "\n" -#~ "\n" -#~ "\n" -#~ " \n" -#~ " jboss.jca:service=RARDeployer\n" -#~ " jboss.jca:service=LocalTxCM,name=HsqlDS\n" -#~ "\n" -#~ " \n" -#~ " java:/hibernate/SessionFactory\n" -#~ "\n" -#~ " \n" -#~ " java:HsqlDS\n" -#~ " org.hibernate.dialect.HSQLDialect\n" -#~ "\n" -#~ " \n" -#~ " \n" -#~ " org.hibernate.transaction.JTATransactionFactory\n" -#~ " \n" -#~ " org.hibernate.transaction.JBossTransactionManagerLookup\n" -#~ " true\n" -#~ " true\n" -#~ "\n" -#~ " \n" -#~ " 5\n" -#~ "\n" -#~ " \n" -#~ " true\n" -#~ " org.hibernate.cache." -#~ "EhCacheProvider\n" -#~ " true\n" -#~ "\n" -#~ " \n" -#~ " true\n" -#~ "\n" -#~ " \n" -#~ " auction/Item.hbm.xml,auction/" -#~ "Category.hbm.xml\n" -#~ "\n" -#~ "\n" -#~ "\n" -#~ "]]>" -#~ msgstr "" -#~ "<?xml version=\"1.0\"?>\n" -#~ "<server>\n" -#~ "\n" -#~ "<mbean code=\"org.hibernate.jmx.HibernateService\"\n" -#~ " name=\"jboss.jca:service=HibernateFactory,name=HibernateFactory" -#~ "\">\n" -#~ "\n" -#~ " <!-- Required services -->\n" -#~ " <depends>jboss.jca:service=RARDeployer</depends>\n" -#~ " <depends>jboss.jca:service=LocalTxCM,name=HsqlDS</" -#~ "depends>\n" -#~ "\n" -#~ " <!-- Bind the Hibernate service to JNDI -->\n" -#~ " <attribute name=\"JndiName\">java:/hibernate/SessionFactory</" -#~ "attribute>\n" -#~ "\n" -#~ " <!-- Datasource settings -->\n" -#~ " <attribute name=\"Datasource\">java:HsqlDS</attribute>\n" -#~ " <attribute name=\"Dialect\">org.hibernate.dialect." -#~ "HSQLDialect</attribute>\n" -#~ "\n" -#~ " <!-- Transaction integration -->\n" -#~ " <attribute name=\"TransactionStrategy\">\n" -#~ " org.hibernate.transaction.JTATransactionFactory</" -#~ "attribute>\n" -#~ " <attribute name=\"TransactionManagerLookupStrategy\">\n" -#~ " org.hibernate.transaction.JBossTransactionManagerLookup</" -#~ "attribute>\n" -#~ " <attribute name=\"FlushBeforeCompletionEnabled\">true</" -#~ "attribute>\n" -#~ " <attribute name=\"AutoCloseSessionEnabled\">true</" -#~ "attribute>\n" -#~ "\n" -#~ " <!-- Fetching options -->\n" -#~ " <attribute name=\"MaximumFetchDepth\">5</attribute>\n" -#~ "\n" -#~ " <!-- Second-level caching -->\n" -#~ " <attribute name=\"SecondLevelCacheEnabled\">true</" -#~ "attribute>\n" -#~ " <attribute name=\"CacheProviderClass\">org.hibernate.cache." -#~ "EhCacheProvider</attribute>\n" -#~ " <attribute name=\"QueryCacheEnabled\">true</attribute>\n" -#~ "\n" -#~ " <!-- Logging -->\n" -#~ " <attribute name=\"ShowSqlEnabled\">true</attribute>\n" -#~ "\n" -#~ " <!-- Mapping files -->\n" -#~ " <attribute name=\"MapResources\">auction/Item.hbm.xml,auction/" -#~ "Category.hbm.xml</attribute>\n" -#~ "\n" -#~ "</mbean>\n" -#~ "\n" -#~ "</server>" +#~ msgid "org.hibernate.secure" +#~ msgstr "org.hibernate.secure" + +#, fuzzy +#~ msgid "org.hibernate" +#~ msgstr "JNDI-gebundene SessionFactory" diff --git a/documentation/manual/src/main/docbook/de-DE/content/filters.po b/documentation/manual/src/main/docbook/de-DE/content/filters.po index 208a574915..d0fe932a87 100644 --- a/documentation/manual/src/main/docbook/de-DE/content/filters.po +++ b/documentation/manual/src/main/docbook/de-DE/content/filters.po @@ -275,7 +275,7 @@ msgid "" msgstr "" "Project-Id-Version: Collection_Mapping\n" "Report-Msgid-Bugs-To: http://bugs.kde.org\n" -"POT-Creation-Date: 2010-02-10T07:25:35\n" +"POT-Creation-Date: 2010-07-20 21:02+0000\n" "PO-Revision-Date: 2007-02-26 10:27+1000\n" "Last-Translator: \n" "Language-Team: \n" @@ -285,11 +285,13 @@ msgstr "" "X-Generator: KBabel 1.9.1\n" #. Tag: title +#: filters.xml:31 #, no-c-format msgid "Filtering data" msgstr "Das Filtern von Daten" #. Tag: para +#: filters.xml:33 #, fuzzy, no-c-format msgid "" "Hibernate3 provides an innovative new approach to handling data with " @@ -304,11 +306,13 @@ msgstr "" "oder deaktiviert werden kann." #. Tag: title +#: filters.xml:39 #, no-c-format msgid "Hibernate filters" msgstr "Hibernate Filter" #. Tag: para +#: filters.xml:41 #, fuzzy, no-c-format msgid "" "Hibernate3 has the ability to pre-define filter criteria and attach those " @@ -332,9 +336,95 @@ msgstr "" "innerhalb der Anwendung parametrisiert werden." #. Tag: para +#: filters.xml:50 #, no-c-format msgid "" -"In order to use filters, they must first be defined and then attached to the " +"Using annotatons filters are defined via @org.hibernate.annotations." +"FilterDef or @org.hibernate.annotations.FilterDefs. A filter definition has a name() and an " +"array of parameters(). A parameter will allow you to adjust the behavior of " +"the filter at runtime. Each parameter is defined by a @ParamDef which has a name and a type. You can also define a " +"defaultCondition() parameter for a given " +"@FilterDef to set the default condition to use when none " +"are defined in each individual @Filter. " +"@FilterDef(s) can be defined at the class or package " +"level." +msgstr "" + +#. Tag: para +#: filters.xml:63 +#, no-c-format +msgid "" +"We now need to define the SQL filter clause applied to either the entity " +"load or the collection load. @Filter is used and placed " +"either on the entity or the collection element. The connection between " +"@FilterName and @Filter is a " +"matching name." +msgstr "" + +#. Tag: title +#: filters.xml:70 +#, no-c-format +msgid "@FilterDef and @Filter annotations" +msgstr "" + +#. Tag: programlisting +#: filters.xml:72 +#, no-c-format +msgid "" +"@Entity\n" +"@FilterDef(name=\"minLength\", parameters=@ParamDef( name=\"minLength\", " +"type=\"integer\" ) )\n" +"@Filters( {\n" +" @Filter(name=\"betweenLength\", condition=\":minLength <= length and :" +"maxLength >= length\"),\n" +" @Filter(name=\"minLength\", condition=\":minLength <= length\")\n" +"} )\n" +"public class Forest { ... }" +msgstr "" + +#. Tag: para +#: filters.xml:75 +#, no-c-format +msgid "" +"When the collection use an association table as a relational representation, " +"you might want to apply the filter condition to the association table itself " +"or to the target entity table. To apply the constraint on the target entity, " +"use the regular @Filter annotation. However, if you want " +"to target the association table, use the @FilterJoinTable " +"annotation." +msgstr "" + +#. Tag: title +#: filters.xml:84 +#, no-c-format +msgid "" +"Using @FilterJoinTable for filterting on the " +"association table" +msgstr "" + +#. Tag: programlisting +#: filters.xml:87 +#, no-c-format +msgid "" +"@OneToMany\n" +" @JoinTable\n" +" //filter on the target entity table\n" +" @Filter(name=\"betweenLength\", condition=\":minLength <= length and :" +"maxLength >= length\")\n" +" //filter on the association table\n" +" @FilterJoinTable(name=\"security\", condition=\":userlevel >= " +"requredLevel\")\n" +" public Set<Forest> getForests() { ... }" +msgstr "" + +#. Tag: para +#: filters.xml:90 +#, fuzzy, no-c-format +msgid "" +"Using Hibernate mapping files for defining filters the situtation is very " +"similar. The filters must first be defined and then attached to the " "appropriate mapping elements. To define a filter, use the <" "filter-def/> element within a <hibernate-mapping/" "> element:" @@ -344,22 +434,58 @@ msgstr "" "definieren, verwenden Sie das <filter-def/>-Element " "innerhalb eines <hibernate-mapping/>-Elements:" -#. Tag: para +#. Tag: title +#: filters.xml:97 +#, no-c-format +msgid "Defining a filter definition via <filter-def>" +msgstr "" + +#. Tag: programlisting +#: filters.xml:100 #, fuzzy, no-c-format -msgid "This filter can then be attached to a class:" -msgstr "Anschließend kann dieser Filter einer Klasse zugefügt werden:" +msgid "" +"<filter-def name=\"myFilter\">\n" +" <filter-param name=\"myFilterParam\" type=\"string\"/>\n" +"</filter-def>" +msgstr "" +"<filter-def name=\"myFilter\">\n" +" <filter-param name=\"myFilterParam\" type=\"string\"/>\n" +"</filter-def>" #. Tag: para +#: filters.xml:103 #, fuzzy, no-c-format -msgid "Or, to a collection:" -msgstr "oder einer Collection:" - -#. Tag: para -#, fuzzy, no-c-format -msgid "Or, to both or multiples of each at the same time." +msgid "" +"This filter can then be attached to a class or collection (or, to both or " +"multiples of each at the same time):" msgstr "oder gar beiden (oder mehreren von beiden) gleichzeitig." +#. Tag: title +#: filters.xml:107 +#, no-c-format +msgid "" +"Attaching a filter to a class or collection using <filter>" +msgstr "" + +#. Tag: programlisting +#: filters.xml:110 +#, no-c-format +msgid "" +"<class name=\"myClass\" ...>\n" +" ...\n" +" <filter name=\"myFilter\" condition=\":myFilterParam = " +"MY_FILTERED_COLUMN\"/>\n" +"\n" +" <set ...>\n" +" <filter name=\"myFilter\" condition=\":myFilterParam = " +"MY_FILTERED_COLUMN\"/>\n" +" </set> \n" +"</class>" +msgstr "" + #. Tag: para +#: filters.xml:113 #, fuzzy, no-c-format msgid "" "The methods on Session are: enableFilter(String " @@ -380,7 +506,18 @@ msgstr "" "Interface wiedergibt, explizit aktiviert werden. Die Verwendung des oben " "definierten, einfachen Filters würde wie folgt aussehen:" +#. Tag: programlisting +#: filters.xml:123 +#, fuzzy, no-c-format +msgid "" +"session.enableFilter(\"myFilter\").setParameter(\"myFilterParam\", \"some-" +"value\");" +msgstr "" +"session.enableFilter(\"myFilter\").setParameter(\"myFilterParam\", \"some-" +"value\");" + #. Tag: para +#: filters.xml:125 #, fuzzy, no-c-format msgid "" "Methods on the org.hibernate.Filter interface do allow the method-chaining " @@ -391,6 +528,7 @@ msgstr "" "erlauben." #. Tag: para +#: filters.xml:128 #, fuzzy, no-c-format msgid "" "The following is a full example, using temporal data with an effective " @@ -399,7 +537,80 @@ msgstr "" "Nachfolgend sehen Sie ein vollständiges Beispiel unter Verwendung temporaler " "Daten mit effektivem Datumsformat für den Datensatz:" +#. Tag: programlisting +#: filters.xml:131 +#, fuzzy, no-c-format +msgid "" +"<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 "" +"<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>" + #. Tag: para +#: filters.xml:133 #, fuzzy, no-c-format msgid "" "In order to ensure that you are provided with currently effective records, " @@ -409,7 +620,28 @@ msgstr "" "der Angestelltendaten um sicherzustellen, dass Sie stets die aktuell " "wirksamen Datensätze erhalten:" +#. Tag: programlisting +#: filters.xml:137 +#, fuzzy, no-c-format +msgid "" +"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();" +msgstr "" +"Session session = ...;\n" +"session.enabledFilter(\"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();" + #. Tag: para +#: filters.xml:139 #, fuzzy, no-c-format msgid "" "Even though a salary constraint was mentioned explicitly on the results in " @@ -422,6 +654,7 @@ msgstr "" "Dollar ist, obwohl lediglich eine Gehaltsbedingung formuliert wurde." #. Tag: para +#: filters.xml:144 #, fuzzy, no-c-format msgid "" "If you want to use filters with outer joining, either through HQL or load " @@ -436,6 +669,7 @@ msgstr "" "anschließend der (die) Spaltenname(n) nach dem Operator." #. Tag: para +#: filters.xml:149 #, fuzzy, no-c-format msgid "" "After being defined, a filter might be attached to multiple entities and/or " @@ -450,7 +684,20 @@ msgstr "" "erlaubt <filter-def/> die Definition einer " "Standardbedingung als Attribut oder als CDATA:" +#. Tag: programlisting +#: filters.xml:155 +#, fuzzy, no-c-format +msgid "" +"<filter-def name=\"myFilter\" condition=\"abc > xyz\">...</" +"filter-def>\n" +"<filter-def name=\"myOtherFilter\">abc=xyz</filter-def>" +msgstr "" +"<filter-def name=\"myFilter\" condition=\"abc > xyz\">...</" +"filter-def>\n" +"<filter-def name=\"myOtherFilter\">abc=xyz</filter-def>" + #. Tag: para +#: filters.xml:157 #, fuzzy, no-c-format msgid "" "This default condition will be used whenever the filter is attached to " @@ -465,14 +712,12 @@ msgstr "" "bestimmten Fall außer Kraft setzt." #, fuzzy -#~ msgid "" -#~ "\n" -#~ " \n" -#~ "]]>" -#~ msgstr "" -#~ "<filter-def name=\"myFilter\">\n" -#~ " <filter-param name=\"myFilterParam\" type=\"string\"/>\n" -#~ "</filter-def>" +#~ msgid "This filter can then be attached to a class:" +#~ msgstr "Anschließend kann dieser Filter einer Klasse zugefügt werden:" + +#, fuzzy +#~ msgid "Or, to a collection:" +#~ msgstr "oder einer Collection:" #, fuzzy #~ msgid "" @@ -499,110 +744,3 @@ msgstr "" #~ " <filter name=\"myFilter\" condition=\":myFilterParam = " #~ "MY_FILTERED_COLUMN\"/>\n" #~ "</set>" - -#, fuzzy -#~ msgid "" -#~ "" -#~ msgstr "" -#~ "session.enableFilter(\"myFilter\").setParameter(\"myFilterParam\", \"some-" -#~ "value\");" - -#, fuzzy -#~ msgid "" -#~ "\n" -#~ " \n" -#~ "\n" -#~ "\n" -#~ "\n" -#~ "...\n" -#~ " \n" -#~ " \n" -#~ " \n" -#~ "...\n" -#~ " \n" -#~ " \n" -#~ "\n" -#~ "\n" -#~ "\n" -#~ "...\n" -#~ " \n" -#~ " \n" -#~ " \n" -#~ " \n" -#~ " \n" -#~ "]]>" -#~ msgstr "" -#~ "<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>" - -#, fuzzy -#~ msgid "" -#~ " :" -#~ "targetSalary\")\n" -#~ " .setLong(\"targetSalary\", new Long(1000000))\n" -#~ " .list();\n" -#~ "]]>" -#~ msgstr "" -#~ "Session session = ...;\n" -#~ "session.enabledFilter(\"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();" - -#, fuzzy -#~ msgid "" -#~ " xyz\">...\n" -#~ "abc=xyz]]>" -#~ msgstr "" -#~ "<filter-def name=\"myFilter\" condition=\"abc > xyz\">...</" -#~ "filter-def>\n" -#~ "<filter-def name=\"myOtherFilter\">abc=xyz</filter-def>" diff --git a/documentation/manual/src/main/docbook/de-DE/content/performance.po b/documentation/manual/src/main/docbook/de-DE/content/performance.po index 8cb2cd81cc..2418b0f83e 100644 --- a/documentation/manual/src/main/docbook/de-DE/content/performance.po +++ b/documentation/manual/src/main/docbook/de-DE/content/performance.po @@ -275,7 +275,7 @@ msgid "" msgstr "" "Project-Id-Version: Collection_Mapping\n" "Report-Msgid-Bugs-To: http://bugs.kde.org\n" -"POT-Creation-Date: 2010-02-11T05:38:15\n" +"POT-Creation-Date: 2010-07-20 21:02+0000\n" "PO-Revision-Date: 2007-02-26 10:27+1000\n" "Last-Translator: \n" "Language-Team: \n" @@ -285,16 +285,19 @@ msgstr "" "X-Generator: KBabel 1.9.1\n" #. Tag: title +#: performance.xml:31 #, no-c-format msgid "Improving performance" msgstr "Verbesserung der Performance" #. Tag: title +#: performance.xml:34 #, no-c-format msgid "Fetching strategies" msgstr "Abrufstrategien" #. Tag: para +#: performance.xml:36 #, fuzzy, no-c-format msgid "" "Hibernate uses a fetching strategy to retrieve " @@ -309,11 +312,13 @@ msgstr "" "oder Criteria-Anfrage außer Kraft gesetzt werden." #. Tag: para +#: performance.xml:42 #, no-c-format msgid "Hibernate3 defines the following fetching strategies:" msgstr "Hibernate3 definiert die folgenden Abrufstrategien:" #. Tag: para +#: performance.xml:46 #, fuzzy, no-c-format msgid "" "Join fetching: Hibernate retrieves the associated " @@ -325,6 +330,7 @@ msgstr "" "selben SELECT auf." #. Tag: para +#: performance.xml:53 #, fuzzy, no-c-format msgid "" "Select fetching: a second SELECT is " @@ -340,6 +346,7 @@ msgstr "" "\" nur ausgeführt, wenn Sie tatsächlich auf die Assoziation zugreifen." #. Tag: para +#: performance.xml:61 #, fuzzy, no-c-format msgid "" "Subselect fetching: a second SELECT " @@ -356,6 +363,7 @@ msgstr "" "tatsächlich auf die Assoziation zugreifen." #. Tag: para +#: performance.xml:70 #, fuzzy, no-c-format msgid "" "Batch fetching: an optimization strategy for select " @@ -370,11 +378,13 @@ msgstr "" "bestimmt." #. Tag: para +#: performance.xml:77 #, no-c-format msgid "Hibernate also distinguishes between:" msgstr "Hibernate unterscheidet außerdem zwischen:" #. Tag: para +#: performance.xml:81 #, fuzzy, no-c-format msgid "" "Immediate fetching: an association, collection or " @@ -385,6 +395,7 @@ msgstr "" "sofort abgerufen." #. Tag: para +#: performance.xml:87 #, fuzzy, no-c-format msgid "" "Lazy collection fetching: a collection is fetched when " @@ -396,6 +407,7 @@ msgstr "" "(Das ist die Standardeinstellung für Collections)." #. Tag: para +#: performance.xml:93 #, fuzzy, no-c-format msgid "" "\"Extra-lazy\" collection fetching: individual elements " @@ -409,6 +421,7 @@ msgstr "" "außer es ist unbedingt nötig (besonders geeignet für sehr große Collections)." #. Tag: para +#: performance.xml:101 #, fuzzy, no-c-format msgid "" "Proxy fetching: a single-valued association is fetched " @@ -420,6 +433,7 @@ msgstr "" "\" am zugehörigen Objekt aufgerufen wird." #. Tag: para +#: performance.xml:107 #, fuzzy, no-c-format msgid "" "\"No-proxy\" fetching: a single-valued association is " @@ -438,6 +452,7 @@ msgstr "" "selten benötigt." #. Tag: para +#: performance.xml:117 #, fuzzy, no-c-format msgid "" "Lazy attribute fetching: an attribute or single valued " @@ -450,6 +465,7 @@ msgstr "" "Instrumentierung und wird selten benötigt." #. Tag: para +#: performance.xml:124 #, fuzzy, no-c-format msgid "" "We have two orthogonal notions here: when is the " @@ -468,11 +484,13 @@ msgstr "" "einer bestimmten Klasse stets verfügbar sind." #. Tag: title +#: performance.xml:132 #, no-c-format msgid "Working with lazy associations" msgstr "Der Umgang mit \"lazy\"-Assoziationen" #. Tag: para +#: performance.xml:134 #, fuzzy, no-c-format msgid "" "By default, Hibernate3 uses lazy select fetching for collections and lazy " @@ -485,6 +503,7 @@ msgstr "" "Anwendungen sinnvoll." #. Tag: para +#: performance.xml:138 #, fuzzy, no-c-format msgid "" "If you set hibernate.default_batch_fetch_size, Hibernate " @@ -497,6 +516,7 @@ msgstr "" "auf feinkörnigerer Ebene aktiviert werden)." #. Tag: para +#: performance.xml:142 #, fuzzy, no-c-format msgid "" "Please be aware that access to a lazy association outside of the context of " @@ -507,7 +527,36 @@ msgstr "" "des Kontexts einer geöffneten Hibernate Session führt zu einer " "Ausnahmemeldung. Zum Beispiel:" +#. Tag: programlisting +#: performance.xml:146 +#, fuzzy, no-c-format +msgid "" +"s = sessions.openSession();\n" +"Transaction tx = s.beginTransaction();\n" +" \n" +"User u = (User) s.createQuery(\"from User u where u.name=:userName\")\n" +" .setString(\"userName\", userName).uniqueResult();\n" +"Map permissions = u.getPermissions();\n" +"\n" +"tx.commit();\n" +"s.close();\n" +"\n" +"Integer accessLevel = (Integer) permissions.get(\"accounts\"); // Error!" +msgstr "" +"s = sessions.openSession();\n" +"Transaction tx = s.beginTransaction();\n" +" \n" +"User u = (User) s.createQuery(\"from User u where u.name=:userName\")\n" +" .setString(\"userName\", userName).uniqueResult();\n" +"Map permissions = u.getPermissions();\n" +"\n" +"tx.commit();\n" +"s.close();\n" +"\n" +"Integer accessLevel = (Integer) permissions.get(\"accounts\"); // Error!" + #. Tag: para +#: performance.xml:148 #, fuzzy, no-c-format msgid "" "Since the permissions collection was not initialized when the " @@ -524,6 +573,7 @@ msgstr "" "festgeschrieben wird, zu bewegen." #. Tag: para +#: performance.xml:155 #, fuzzy, no-c-format msgid "" "Alternatively, you can use a non-lazy collection or association, by " @@ -542,6 +592,7 @@ msgstr "" "Datenbank in den Speicher abrufen müssen!" #. Tag: para +#: performance.xml:162 #, fuzzy, no-c-format msgid "" "On the other hand, you can use join fetching, which is non-lazy by nature, " @@ -558,11 +609,13 @@ msgstr "" "Assoziationen und Collections identisch." #. Tag: title +#: performance.xml:170 #, no-c-format msgid "Tuning fetch strategies" msgstr "Abstimmung von Abrufstrategien" #. Tag: para +#: performance.xml:172 #, no-c-format msgid "" "Select fetching (the default) is extremely vulnerable to N+1 selects " @@ -572,7 +625,30 @@ msgstr "" "+1 Auswahlprobleme, weswegen sich die Aktivierung von \"Join-Fetching\" im " "Mapping-Dokument empfiehlt:" +#. Tag: programlisting +#: performance.xml:176 +#, fuzzy, no-c-format +msgid "" +"<set name=\"permissions\"\n" +" fetch=\"join\">\n" +" <key column=\"userId\"/>\n" +" <one-to-many class=\"Permission\"/>\n" +"</set" +msgstr "" +"<set name=\"permissions\" \n" +" fetch=\"join\">\n" +" <key column=\"userId\"/>\n" +" <one-to-many class=\"Permission\"/>\n" +"</set" + +#. Tag: programlisting +#: performance.xml:178 +#, fuzzy, no-c-format +msgid "<many-to-one name=\"mother\" class=\"Cat\" fetch=\"join\"/>" +msgstr "<many-to-one name=\"mother\" class=\"Cat\" fetch=\"join\"/>" + #. Tag: para +#: performance.xml:180 #, no-c-format msgid "" "The fetch strategy defined in the mapping document " @@ -582,26 +658,31 @@ msgstr "" "Auswirkungen auf:" #. Tag: para +#: performance.xml:185 #, no-c-format msgid "retrieval via get() or load()" msgstr "Abruf mittels get() oder load()" #. Tag: para +#: performance.xml:190 #, no-c-format msgid "retrieval that happens implicitly when an association is navigated" msgstr "einem impliziten Abruf, der beim Navigieren der Assoziation erfolgt" #. Tag: para +#: performance.xml:195 #, no-c-format msgid "Criteria queries" msgstr "Criteria-Anfragen" #. Tag: para +#: performance.xml:199 #, no-c-format msgid "HQL queries if subselect fetching is used" msgstr "HQL-Anfragen, wenn subselect-Abruf verwendet wird" #. Tag: para +#: performance.xml:204 #, fuzzy, no-c-format msgid "" "Irrespective of the fetching strategy you use, the defined non-lazy graph is " @@ -614,6 +695,7 @@ msgstr "" "Ausführung einer bestimmten HQL-Anfrage führen kann." #. Tag: para +#: performance.xml:209 #, fuzzy, no-c-format msgid "" "Usually, the mapping document is not used to customize fetching. Instead, we " @@ -632,6 +714,7 @@ msgstr "" "setFetchMode(FetchMode.JOIN) benutzen." #. Tag: para +#: performance.xml:216 #, fuzzy, no-c-format msgid "" "If you want to change the fetching strategy used by get() " @@ -642,7 +725,22 @@ msgstr "" "Sie dies durch get() oder load() tun, " "verwenden Sie einfach eine Criteria-Anfrage, zum Beispiel:" +#. Tag: programlisting +#: performance.xml:220 +#, fuzzy, no-c-format +msgid "" +"User user = (User) session.createCriteria(User.class)\n" +" .setFetchMode(\"permissions\", FetchMode.JOIN)\n" +" .add( Restrictions.idEq(userId) )\n" +" .uniqueResult();" +msgstr "" +"User user = (User) session.createCriteria(User.class)\n" +" .setFetchMode(\"permissions\", FetchMode.JOIN)\n" +" .add( Restrictions.idEq(userId) )\n" +" .uniqueResult();" + #. Tag: para +#: performance.xml:222 #, fuzzy, no-c-format msgid "" "This is Hibernate's equivalent of what some ORM solutions call a \"fetch plan" @@ -652,6 +750,7 @@ msgstr "" "oder \"Fetch Plan\" bezeichnen)." #. Tag: para +#: performance.xml:225 #, fuzzy, no-c-format msgid "" "A completely different approach to problems with N+1 selects is to use the " @@ -661,11 +760,13 @@ msgstr "" "Verwendung des Cachespeichers der zweiten Ebene." #. Tag: title +#: performance.xml:230 #, no-c-format msgid "Single-ended association proxies" msgstr "Einendige Assoziationsproxies" #. Tag: para +#: performance.xml:232 #, fuzzy, no-c-format msgid "" "Lazy fetching for collections is implemented using Hibernate's own " @@ -684,6 +785,7 @@ msgstr "" "Bibliothek)." #. Tag: para +#: performance.xml:239 #, fuzzy, no-c-format msgid "" "At startup, Hibernate3 generates proxies by default for all persistent " @@ -696,6 +798,7 @@ msgstr "" "Assoziationen zu aktivieren." #. Tag: para +#: performance.xml:244 #, fuzzy, no-c-format msgid "" "The mapping file may declare an interface to use as the proxy interface for " @@ -712,6 +815,7 @@ msgstr "" "Konstruktor für alle persistenten Klassen!" #. Tag: para +#: performance.xml:251 #, fuzzy, no-c-format msgid "" "There are potential problems to note when extending this approach to " @@ -720,7 +824,26 @@ msgstr "" "Es gibt einige Fallstricke, derer man sich bewusst sein sollte, wenn man " "diese Vorgehensweise zum Beispiel auf polymorphe Klassen ausweitet." +#. Tag: programlisting +#: performance.xml:254 +#, fuzzy, no-c-format +msgid "" +"<class name=\"Cat\" proxy=\"Cat\">\n" +" ......\n" +" <subclass name=\"DomesticCat\">\n" +" .....\n" +" </subclass>\n" +"</class>" +msgstr "" +"<class name=\"Cat\" proxy=\"Cat\">\n" +" ......\n" +" <subclass name=\"DomesticCat\">\n" +" .....\n" +" </subclass>\n" +"</class>" + #. Tag: para +#: performance.xml:256 #, no-c-format msgid "" "Firstly, instances of Cat will never be castable to " @@ -732,12 +855,52 @@ msgstr "" "sein, selbst wenn die zu Grunde liegende Instanz eine Instanz von " "DomesticCat ist:" +#. Tag: programlisting +#: performance.xml:260 +#, fuzzy, no-c-format +msgid "" +"Cat cat = (Cat) session.load(Cat.class, id); // instantiate a proxy (does " +"not hit the db)\n" +"if ( cat.isDomesticCat() ) { // hit the db to initialize " +"the proxy\n" +" DomesticCat dc = (DomesticCat) cat; // Error!\n" +" ....\n" +"}" +msgstr "" +"Cat cat = (Cat) session.load(Cat.class, id); // instantiate a proxy (does " +"not hit the db)\n" +"if ( cat.isDomesticCat() ) { // hit the db to initialize " +"the proxy\n" +" DomesticCat dc = (DomesticCat) cat; // Error!\n" +" ....\n" +"}" + #. Tag: para +#: performance.xml:262 #, fuzzy, no-c-format msgid "Secondly, it is possible to break proxy ==:" msgstr "Zweitens ist es möglich, Proxy == zu brechen." +#. Tag: programlisting +#: performance.xml:265 +#, fuzzy, no-c-format +msgid "" +"Cat cat = (Cat) session.load(Cat.class, id); // instantiate a Cat " +"proxy\n" +"DomesticCat dc = \n" +" (DomesticCat) session.load(DomesticCat.class, id); // acquire new " +"DomesticCat proxy!\n" +"System.out.println(cat==dc); // false" +msgstr "" +"Cat cat = (Cat) session.load(Cat.class, id); // instantiate a Cat " +"proxy\n" +"DomesticCat dc = \n" +" (DomesticCat) session.load(DomesticCat.class, id); // acquire new " +"DomesticCat proxy!\n" +"System.out.println(cat==dc); // false" + #. Tag: para +#: performance.xml:267 #, no-c-format msgid "" "However, the situation is not quite as bad as it looks. Even though we now " @@ -748,7 +911,18 @@ msgstr "" "jetzt zwei Verweise auf verschiedene Proxy-Objekte besitzen, so bleibt die " "zu Grunde liegende Instanz nach wie vor dasselbe Objekt:" +#. Tag: programlisting +#: performance.xml:271 +#, fuzzy, no-c-format +msgid "" +"cat.setWeight(11.0); // hit the db to initialize the proxy\n" +"System.out.println( dc.getWeight() ); // 11.0" +msgstr "" +"cat.setWeight(11.0); // hit the db to initialize the proxy\n" +"System.out.println( dc.getWeight() ); // 11.0" + #. Tag: para +#: performance.xml:273 #, fuzzy, no-c-format msgid "" "Third, you cannot use a CGLIB proxy for a final class or " @@ -758,6 +932,7 @@ msgstr "" "Klasse oder eine Klasse mit einer final-Methode verwenden." #. Tag: para +#: performance.xml:276 #, fuzzy, no-c-format msgid "" "Finally, if your persistent object acquires any resources upon instantiation " @@ -771,6 +946,7 @@ msgstr "" "Klasse." #. Tag: para +#: performance.xml:281 #, fuzzy, no-c-format msgid "" "These problems are all due to fundamental limitations in Java's single " @@ -787,7 +963,26 @@ msgstr "" "Business-Methoden deklariert. Diese Interfaces sollten Sie z.B. in der " "Mapping-Datei spezifizieren." +#. Tag: programlisting +#: performance.xml:289 +#, fuzzy, no-c-format +msgid "" +"<class name=\"CatImpl\" proxy=\"Cat\">\n" +" ......\n" +" <subclass name=\"DomesticCatImpl\" proxy=\"DomesticCat\">\n" +" .....\n" +" </subclass>\n" +"</class>" +msgstr "" +"<class name=\"CatImpl\" proxy=\"Cat\">\n" +" ......\n" +" <subclass name=\"DomesticCatImpl\" proxy=\"DomesticCat\">\n" +" .....\n" +" </subclass>\n" +"</class>" + #. Tag: para +#: performance.xml:291 #, fuzzy, no-c-format msgid "" "Then proxies for instances of Cat and " @@ -799,17 +994,34 @@ msgstr "" "sein, selbst wenn die zu Grunde liegende Instanz eine Instanz von " "DomesticCat ist:" +#. Tag: programlisting +#: performance.xml:295 +#, fuzzy, no-c-format +msgid "" +"Cat cat = (Cat) session.load(CatImpl.class, catid);\n" +"Iterator iter = session.createQuery(\"from CatImpl as cat where cat." +"name='fritz'\").iterate();\n" +"Cat fritz = (Cat) iter.next();" +msgstr "" +"Cat cat = (Cat) session.load(CatImpl.class, catid);\n" +"Iterator iter = session.iterate(\"from CatImpl as cat where cat." +"name='fritz'\");\n" +"Cat fritz = (Cat) iter.next();" + #. Tag: title +#: performance.xml:298 #, no-c-format msgid "Note" msgstr "" #. Tag: para +#: performance.xml:300 #, fuzzy, no-c-format msgid "list() does not usually return proxies." msgstr "full join (in der Regel nicht sehr nützlich)" #. Tag: para +#: performance.xml:304 #, no-c-format msgid "" "Relationships are also lazily initialized. This means you must declare any " @@ -821,6 +1033,7 @@ msgstr "" "literal> deklarieren müssen." #. Tag: para +#: performance.xml:308 #, fuzzy, no-c-format msgid "" "Certain operations do not require proxy initialization:" @@ -828,6 +1041,7 @@ msgstr "" "Bestimmte Vorgänge benötigen keine Proxy-Initialisierung" #. Tag: para +#: performance.xml:313 #, fuzzy, no-c-format msgid "" "equals(): if the persistent class does not override " @@ -837,6 +1051,7 @@ msgstr "" "literal> nicht außer Kraft setzt" #. Tag: para +#: performance.xml:318 #, fuzzy, no-c-format msgid "" "hashCode(): if the persistent class does not override " @@ -846,11 +1061,13 @@ msgstr "" "() nicht außer Kraft setzt" #. Tag: para +#: performance.xml:323 #, no-c-format msgid "The identifier getter method" msgstr "Die \"Getter\"-Methode des Bezeichners" #. Tag: para +#: performance.xml:327 #, no-c-format msgid "" "Hibernate will detect persistent classes that override equals()hashCode() außer Kraft setzen." #. Tag: para +#: performance.xml:330 #, fuzzy, no-c-format msgid "" "By choosing lazy=\"no-proxy\" instead of the default " @@ -874,11 +1092,13 @@ msgstr "" "unmittelbaren Proxy-Initialisierung." #. Tag: title +#: performance.xml:338 #, no-c-format msgid "Initializing collections and proxies" msgstr "Initialisierung von Collections und Proxies" #. Tag: para +#: performance.xml:340 #, fuzzy, no-c-format msgid "" "A LazyInitializationException will be thrown by Hibernate " @@ -893,6 +1113,7 @@ msgstr "" "auf das Proxy hat, sich in abgesetztem Status befindet." #. Tag: para +#: performance.xml:346 #, fuzzy, no-c-format msgid "" "Sometimes a proxy or collection needs to be initialized before closing the " @@ -909,6 +1130,7 @@ msgstr "" "und nicht praktisch für generischen Code." #. Tag: para +#: performance.xml:353 #, fuzzy, no-c-format msgid "" "The static methods Hibernate.initialize() and " @@ -929,6 +1151,7 @@ msgstr "" "von \"kittens\"." #. Tag: para +#: performance.xml:362 #, fuzzy, no-c-format msgid "" "Another option is to keep the Session open until all " @@ -949,6 +1172,7 @@ msgstr "" "ist. Es gibt zwei einfache Wege, damit umzugehen:" #. Tag: para +#: performance.xml:372 #, fuzzy, no-c-format msgid "" "In a web-based application, a servlet filter can be used to close the " @@ -973,6 +1197,7 @@ msgstr "" "in Ansicht\"-Modell finden Sie im Hibernate Wiki." #. Tag: para +#: performance.xml:385 #, fuzzy, no-c-format msgid "" "In an application with a separate business tier, the business logic must " @@ -1002,6 +1227,7 @@ msgstr "" "Fassade einsetzen." #. Tag: para +#: performance.xml:401 #, fuzzy, no-c-format msgid "" "You can also attach a previously loaded object to a new SessioncreateFilter() method is also used to efficiently " @@ -1048,12 +1287,24 @@ msgstr "" "effizient Untersätze einer Collection abzurufen, ohne die gesamte Collection " "zu initialisieren:" +#. Tag: programlisting +#: performance.xml:423 +#, fuzzy, no-c-format +msgid "" +"s.createFilter( lazyCollection, \"\").setFirstResult(0).setMaxResults(10)." +"list();" +msgstr "" +"s.createFilter( lazyCollection, \"\").setFirstResult(0).setMaxResults(10)." +"list();" + #. Tag: title +#: performance.xml:427 #, no-c-format msgid "Using batch fetching" msgstr "Die Verwendung von Stapelabruf (\"Batch-Fetching\")" #. Tag: para +#: performance.xml:429 #, fuzzy, no-c-format msgid "" "Using batch fetching, Hibernate can load several uninitialized proxies if " @@ -1069,6 +1320,7 @@ msgstr "" "Collection-Ebene." #. Tag: para +#: performance.xml:434 #, fuzzy, no-c-format msgid "" "Batch fetching for classes/entities is easier to understand. Consider the " @@ -1095,7 +1347,14 @@ msgstr "" "Bestimmung eines batch-size im Mapping von " "Person festlegen:" +#. Tag: programlisting +#: performance.xml:447 +#, fuzzy, no-c-format +msgid "<class name=\"Person\" batch-size=\"10\">...</class>" +msgstr "<class name=\"Person\" batch-size=\"10\">...</class>" + #. Tag: para +#: performance.xml:449 #, fuzzy, no-c-format msgid "" "Hibernate will now execute only three queries: the pattern is 10, 10, 5." @@ -1103,6 +1362,7 @@ msgstr "" "Hibernate führt nun nur drei Anfragen aus, das Muster lautet 10, 10, 5." #. Tag: para +#: performance.xml:452 #, fuzzy, no-c-format msgid "" "You can also enable batch fetching of collections. For example, if each " @@ -1122,7 +1382,24 @@ msgstr "" "cats-Collection im Mapping von Person " "aktivieren, kann Hibernate Collections vorab abrufen:" +#. Tag: programlisting +#: performance.xml:461 +#, fuzzy, no-c-format +msgid "" +"<class name=\"Person\">\n" +" <set name=\"cats\" batch-size=\"3\">\n" +" ...\n" +" </set>\n" +"</class>" +msgstr "" +"<class name=\"Person\">\n" +" <set name=\"cats\" batch-size=\"3\">\n" +" ...\n" +" </set>\n" +"</class>" + #. Tag: para +#: performance.xml:463 #, fuzzy, no-c-format msgid "" "With a batch-size of 3, Hibernate will load 3, 3, 3, 1 " @@ -1136,6 +1413,7 @@ msgstr "" "einer bestimmten Session ab." #. Tag: para +#: performance.xml:468 #, fuzzy, no-c-format msgid "" "Batch fetching of collections is particularly useful if you have a nested " @@ -1150,11 +1428,13 @@ msgstr "" "Option für \"read-mostly\"-Bäume ist)." #. Tag: title +#: performance.xml:475 #, no-c-format msgid "Using subselect fetching" msgstr "Die Verwendung von \"Subselect-Fetching\"" #. Tag: para +#: performance.xml:477 #, fuzzy, no-c-format msgid "" "If one lazy collection or single-valued proxy has to be fetched, Hibernate " @@ -1167,11 +1447,13 @@ msgstr "" "Weise wie Stapelabruf, ohne das stückweise Laden." #. Tag: title +#: performance.xml:486 #, fuzzy, no-c-format msgid "Fetch profiles" msgstr "Abrufstrategien" #. Tag: para +#: performance.xml:488 #, no-c-format msgid "" "Another way to affect the fetching strategy for loading associated objects " @@ -1179,19 +1461,112 @@ msgid "" "associated with the org.hibernate.SessionFactory but enabled, by name, on the org.hibernate." "Session. Once enabled on a org.hibernate." -"Session, the fetch profile wull be in affect for that " +"Session, the fetch profile will be in affect for that " "org.hibernate.Session until it is explicitly " "disabled." msgstr "" #. Tag: para +#: performance.xml:498 #, no-c-format msgid "" -"So what does that mean? Well lets explain that by way of an example. Say we " -"have the following mappings:" +"So what does that mean? Well lets explain that by way of an example which " +"show the different available approaches to configure a fetch profile:" +msgstr "" + +#. Tag: title +#: performance.xml:503 +#, no-c-format +msgid "Specifying a fetch profile using @FetchProfile" +msgstr "" + +#. Tag: programlisting +#: performance.xml:506 +#, no-c-format +msgid "" +"@Entity\n" +"@FetchProfile(name = \"customer-with-orders\", fetchOverrides = {\n" +" @FetchProfile.FetchOverride(entity = Customer.class, association = " +"\"orders\", mode = FetchMode.JOIN)\n" +"})\n" +"public class Customer {\n" +" @Id\n" +" @GeneratedValue\n" +" private long id;\n" +"\n" +" private String name;\n" +"\n" +" private long customerNumber;\n" +"\n" +" @OneToMany\n" +" private Set<Order> orders;\n" +"\n" +" // standard getter/setter\n" +" ...\n" +"}" +msgstr "" + +#. Tag: title +#: performance.xml:510 +#, no-c-format +msgid "" +"Specifying a fetch profile using <fetch-profile> " +"outside <class> node" +msgstr "" + +#. Tag: programlisting +#: performance.xml:514 +#, no-c-format +msgid "" +"<hibernate-mapping>\n" +" <class name=\"Customer\">\n" +" ...\n" +" <set name=\"orders\" inverse=\"true\">\n" +" <key column=\"cust_id\"/>\n" +" <one-to-many class=\"Order\"/>\n" +" </set>\n" +" </class>\n" +" <class name=\"Order\">\n" +" ...\n" +" </class>\n" +" <fetch-profile name=\"customer-with-orders\">\n" +" <fetch entity=\"Customer\" association=\"orders\" style=\"join\"/" +">\n" +" </fetch-profile>\n" +"</hibernate-mapping>" +msgstr "" + +#. Tag: title +#: performance.xml:518 +#, no-c-format +msgid "" +"Specifying a fetch profile using <fetch-profile> " +"inside <class> node" +msgstr "" + +#. Tag: programlisting +#: performance.xml:522 +#, no-c-format +msgid "" +"<hibernate-mapping>\n" +" <class name=\"Customer\">\n" +" ...\n" +" <set name=\"orders\" inverse=\"true\">\n" +" <key column=\"cust_id\"/>\n" +" <one-to-many class=\"Order\"/>\n" +" </set>\n" +" <fetch-profile name=\"customer-with-orders\">\n" +" <fetch association=\"orders\" style=\"join\"/>\n" +" </fetch-profile>\n" +" </class>\n" +" <class name=\"Order\">\n" +" ...\n" +" </class>\n" +"</hibernate-mapping>" msgstr "" #. Tag: para +#: performance.xml:525 #, no-c-format msgid "" "Now normally when you get a reference to a particular customer, that " @@ -1200,23 +1575,39 @@ msgid "" "that you have a certain use case where it is more efficient to load the " "customer and their orders together. One way certainly is to use \"dynamic " "fetching\" strategies via an HQL or criteria queries. But another option is " -"to use a fetch profile to achieve that. Just add the following to your " -"mapping:" +"to use a fetch profile to achieve that. The following code will load both " +"the customer andtheir orders:" msgstr "" -#. Tag: para +#. Tag: title +#: performance.xml:536 #, no-c-format -msgid "or even:" +msgid "Activating a fetch profile for a given Session" msgstr "" -#. Tag: para +#. Tag: programlisting +#: performance.xml:539 #, no-c-format msgid "" -"Now the following code will actually load both the customer and " -"their orders:" +"Session session = ...;\n" +"session.enableFetchProfile( \"customer-with-orders\" ); // name matches " +"from mapping\n" +"Customer customer = (Customer) session.get( Customer.class, customerId );" msgstr "" #. Tag: para +#: performance.xml:543 +#, no-c-format +msgid "" +"@FetchProfile definitions are global and it does not " +"matter on which class you place them. You can place the " +"@FetchProfile annotation either onto a class or " +"package (package-info.java). In order to define multiple fetch profiles for " +"the same class or package @FetchProfiles can be used." +msgstr "" + +#. Tag: para +#: performance.xml:551 #, no-c-format msgid "" "Currently only join style fetch profiles are supported, but they plan is to " @@ -1225,11 +1616,13 @@ msgid "" msgstr "" #. Tag: title +#: performance.xml:558 #, no-c-format msgid "Using lazy property fetching" msgstr "Die Verwendung von \"Lazy-Property-Fetching\"" #. Tag: para +#: performance.xml:560 #, fuzzy, no-c-format msgid "" "Hibernate3 supports the lazy fetching of individual properties. This " @@ -1251,6 +1644,7 @@ msgstr "" "kann." #. Tag: para +#: performance.xml:568 #, no-c-format msgid "" "To enable lazy property loading, set the lazy attribute " @@ -1259,7 +1653,34 @@ msgstr "" "Um das \"lazy\" Laden von Properties zu aktivieren, setzen Sie das " "lazy-Attribut auf Ihr bestimmtes Property-Mapping:" +#. Tag: programlisting +#: performance.xml:571 +#, fuzzy, no-c-format +msgid "" +"<class name=\"Document\">\n" +" <id name=\"id\">\n" +" <generator class=\"native\"/>\n" +" </id>\n" +" <property name=\"name\" not-null=\"true\" length=\"50\"/>\n" +" <property name=\"summary\" not-null=\"true\" length=\"200\" lazy=" +"\"true\"/>\n" +" <property name=\"text\" not-null=\"true\" length=\"2000\" lazy=\"true" +"\"/>\n" +"</class>" +msgstr "" +"<class name=\"Document\">\n" +" <id name=\"id\">\n" +" <generator class=\"native\"/>\n" +" </id>\n" +" <property name=\"name\" not-null=\"true\" length=\"50\"/>\n" +" <property name=\"summary\" not-null=\"true\" length=\"200\" lazy=" +"\"true\"/>\n" +" <property name=\"text\" not-null=\"true\" length=\"2000\" lazy=\"true" +"\"/>\n" +"</class>" + #. Tag: para +#: performance.xml:573 #, fuzzy, no-c-format msgid "" "Lazy property loading requires buildtime bytecode instrumentation. If your " @@ -1272,11 +1693,49 @@ msgstr "" "unmittelbaren Abruf (sog. \"immediate Fetching\")." #. Tag: para +#: performance.xml:577 #, no-c-format msgid "For bytecode instrumentation, use the following Ant task:" msgstr "Für die Bytecode-Instrumentierung verwenden Sie folgende Ant-Funktion:" +#. Tag: programlisting +#: performance.xml:579 +#, fuzzy, no-c-format +msgid "" +"<target name=\"instrument\" depends=\"compile\">\n" +" <taskdef name=\"instrument\" classname=\"org.hibernate.tool." +"instrument.InstrumentTask\">\n" +" <classpath path=\"${jar.path}\"/>\n" +" <classpath path=\"${classes.dir}\"/>\n" +" <classpath refid=\"lib.class.path\"/>\n" +" </taskdef>\n" +"\n" +" <instrument verbose=\"true\">\n" +" <fileset dir=\"${testclasses.dir}/org/hibernate/auction/model" +"\">\n" +" <include name=\"*.class\"/>\n" +" </fileset>\n" +" </instrument>\n" +"</target>" +msgstr "" +"<target name=\"instrument\" depends=\"compile\">\n" +" <taskdef name=\"instrument\" classname=\"org.hibernate.tool." +"instrument.InstrumentTask\">\n" +" <classpath path=\"${jar.path}\"/>\n" +" <classpath path=\"${classes.dir}\"/>\n" +" <classpath refid=\"lib.class.path\"/>\n" +" </taskdef>\n" +"\n" +" <instrument verbose=\"true\">\n" +" <fileset dir=\"${testclasses.dir}/org/hibernate/auction/model" +"\">\n" +" <include name=\"*.class\"/>\n" +" </fileset>\n" +" </instrument>\n" +"</target>" + #. Tag: para +#: performance.xml:581 #, fuzzy, no-c-format msgid "" "A different way of avoiding unnecessary column reads, at least for read-only " @@ -1291,6 +1750,7 @@ msgstr "" "und dies ist daher die bevorzugte Lösung." #. Tag: para +#: performance.xml:586 #, fuzzy, no-c-format msgid "" "You can force the usual eager fetching of properties using fetch " @@ -1300,11 +1760,13 @@ msgstr "" "übliche \"eager Fetching\" von Properties erzwingen." #. Tag: title +#: performance.xml:592 #, no-c-format msgid "The Second Level Cache" msgstr "Das Cache der zweiten Ebene" #. Tag: para +#: performance.xml:594 #, fuzzy, no-c-format msgid "" "A Hibernate Session is a transaction-level cache of " @@ -1325,15 +1787,17 @@ msgstr "" "dass gecachte Daten in regelmäßigen Abständen gelöscht werden)." #. Tag: para +#: performance.xml:602 #, fuzzy, no-c-format msgid "" "You have the option to tell Hibernate which caching implementation to use by " "specifying the name of a class that implements org.hibernate.cache." "CacheProvider using the property hibernate.cache." "provider_class. Hibernate is bundled with a number of built-in " -"integrations with the open-source cache providers that are listed below. You " -"can also implement your own and plug it in as outlined above. Note that " -"versions prior to 3.2 use EhCache as the default cache provider." +"integrations with the open-source cache providers that are listed in . You can also implement your own and plug it in " +"as outlined above. Note that versions prior to Hibernate 3.2 use EhCache as " +"the default cache provider." msgstr "" "Sie haben die Möglichkeit Hibernate mitzuteilen, welche Caching-" "Implementierung es verwenden soll, indem Sie den Namen der Klasse bestimmen, " @@ -1347,155 +1811,401 @@ msgstr "" "3.2 jedoch nicht mehr der Fall." #. Tag: title +#: performance.xml:613 #, no-c-format msgid "Cache Providers" msgstr "Cache-Provider" #. Tag: entry +#: performance.xml:628 performance.xml:976 #, no-c-format msgid "Cache" msgstr "Cache" #. Tag: entry +#: performance.xml:630 #, no-c-format msgid "Provider class" msgstr "Provider-Klasse" #. Tag: entry +#: performance.xml:632 #, no-c-format msgid "Type" msgstr "Typ" #. Tag: entry +#: performance.xml:634 #, no-c-format msgid "Cluster Safe" msgstr "Cluster-sicher" #. Tag: entry +#: performance.xml:636 #, no-c-format msgid "Query Cache Supported" msgstr "Anfragen-Cache unterstützt" #. Tag: entry +#: performance.xml:642 performance.xml:990 #, no-c-format msgid "Hashtable (not intended for production use)" msgstr "Hash-Tabelle (nicht für den Produktionsgebrauch vorgesehen)" -#. Tag: entry +#. Tag: literal +#: performance.xml:644 #, fuzzy, no-c-format -msgid "org.hibernate.cache.HashtableCacheProvider" +msgid "org.hibernate.cache.HashtableCacheProvider" msgstr "org.hibernate.cache.HashtableCacheProvider" #. Tag: entry +#: performance.xml:646 #, no-c-format msgid "memory" msgstr "Speicher" #. Tag: entry +#: performance.xml:650 performance.xml:662 performance.xml:674 +#: performance.xml:992 performance.xml:994 performance.xml:996 +#: performance.xml:1004 performance.xml:1006 performance.xml:1008 +#: performance.xml:1016 performance.xml:1018 performance.xml:1020 +#: performance.xml:1028 performance.xml:1030 performance.xml:1040 +#: performance.xml:1046 performance.xml:1052 performance.xml:1058 #, no-c-format -msgid "yes" -msgstr "" +msgid "yes" +msgstr "Ja" #. Tag: entry +#: performance.xml:654 performance.xml:1002 #, no-c-format msgid "EHCache" msgstr "EHCache" -#. Tag: entry +#. Tag: literal +#: performance.xml:656 #, fuzzy, no-c-format -msgid "org.hibernate.cache.EhCacheProvider" +msgid "org.hibernate.cache.EhCacheProvider" msgstr "org.hibernate.cache.EhCacheProvider" #. Tag: entry +#: performance.xml:658 performance.xml:670 #, no-c-format msgid "memory, disk" msgstr "Speicher, Disk" #. Tag: entry +#: performance.xml:666 performance.xml:1014 #, no-c-format msgid "OSCache" msgstr "OSCache" -#. Tag: entry +#. Tag: literal +#: performance.xml:668 #, fuzzy, no-c-format -msgid "org.hibernate.cache.OSCacheProvider" +msgid "org.hibernate.cache.OSCacheProvider" msgstr "org.hibernate.cache.OSCacheProvider" #. Tag: entry +#: performance.xml:678 performance.xml:1026 #, no-c-format msgid "SwarmCache" msgstr "SwarmCache" -#. Tag: entry +#. Tag: literal +#: performance.xml:680 #, fuzzy, no-c-format -msgid "org.hibernate.cache.SwarmCacheProvider" +msgid "org.hibernate.cache.SwarmCacheProvider" msgstr "org.hibernate.cache.SwarmCacheProvider" #. Tag: entry +#: performance.xml:682 #, no-c-format msgid "clustered (ip multicast)" msgstr "geclustert (ip multicast)" #. Tag: entry +#: performance.xml:684 #, no-c-format msgid "yes (clustered invalidation)" msgstr "ja (geclusterte Außerkraftsetzung)" #. Tag: entry +#: performance.xml:690 performance.xml:1038 #, fuzzy, no-c-format msgid "JBoss Cache 1.x" msgstr "JBoss TreeCache" -#. Tag: entry +#. Tag: literal +#: performance.xml:692 #, fuzzy, no-c-format -msgid "org.hibernate.cache.TreeCacheProvider" +msgid "org.hibernate.cache.TreeCacheProvider" msgstr "org.hibernate.cache.TreeCacheProvider" #. Tag: entry +#: performance.xml:694 performance.xml:706 #, no-c-format msgid "clustered (ip multicast), transactional" msgstr "geclustert (ip multicast), transaktional" #. Tag: entry +#: performance.xml:696 #, no-c-format msgid "yes (replication)" msgstr "ja (Replikation)" #. Tag: entry +#: performance.xml:698 performance.xml:710 #, no-c-format msgid "yes (clock sync req.)" msgstr "ja (clock sync req.)" #. Tag: entry +#: performance.xml:702 performance.xml:1050 #, fuzzy, no-c-format msgid "JBoss Cache 2" msgstr "JBoss TreeCache" -#. Tag: entry +#. Tag: literal +#: performance.xml:704 #, fuzzy, no-c-format -msgid "org.hibernate.cache.jbc.JBossCacheRegionFactory" +msgid "org.hibernate.cache.jbc.JBossCacheRegionFactory" msgstr "org.hibernate.transaction.JDBCTransactionFactory" #. Tag: entry +#: performance.xml:708 #, fuzzy, no-c-format msgid "yes (replication or invalidation)" msgstr "ja (geclusterte Außerkraftsetzung)" #. Tag: title +#: performance.xml:717 #, no-c-format msgid "Cache mappings" msgstr "Cache-Mappings" #. Tag: para +#: performance.xml:719 #, no-c-format msgid "" -"The <cache> element of a class or collection " -"mapping has the following form:" +"As we have done in previous chapters we are looking at the two different " +"possibiltites to configure caching. First configuration via annotations and " +"then via Hibernate mapping files." msgstr "" -"Das <cache>-Element des Mappings einer Klasse oder " -"Collection besitzt folgende Form:" #. Tag: para +#: performance.xml:723 +#, no-c-format +msgid "" +"By default, entities are not part of the second level cache and we recommend " +"you to stick to this setting. However, you can override this by setting the " +"shared-cache-mode element in your persistence." +"xml file or by using the javax.persistence.sharedCache." +"mode property in your configuration. The following values are " +"possible:" +msgstr "" + +#. Tag: para +#: performance.xml:732 +#, no-c-format +msgid "" +"ENABLE_SELECTIVE (Default and recommended value): " +"entities are not cached unless explicitly marked as cacheable." +msgstr "" + +#. Tag: para +#: performance.xml:738 +#, no-c-format +msgid "" +"DISABLE_SELECTIVE: entities are cached unless explicitly " +"marked as not cacheable." +msgstr "" + +#. Tag: para +#: performance.xml:743 +#, no-c-format +msgid "" +"ALL: all entities are always cached even if marked as non " +"cacheable." +msgstr "" + +#. Tag: para +#: performance.xml:748 +#, no-c-format +msgid "" +"NONE: no entity are cached even if marked as cacheable. " +"This option can make sense to disable second-level cache altogether." +msgstr "" + +#. Tag: para +#: performance.xml:754 +#, no-c-format +msgid "" +"The cache concurrency strategy used by default can be set globaly via the " +"hibernate.cache.default_cache_concurrency_strategy " +"configuration property. The values for this property are:" +msgstr "" + +#. Tag: literal +#: performance.xml:761 +#, fuzzy, no-c-format +msgid "read-only" +msgstr "Criteria-Anfragen" + +#. Tag: literal +#: performance.xml:765 +#, fuzzy, no-c-format +msgid "read-write" +msgstr "Criteria-Anfragen" + +#. Tag: literal +#: performance.xml:769 +#, fuzzy, no-c-format +msgid "nonstrict-read-write" +msgstr "nonstrict-read-write" + +#. Tag: literal +#: performance.xml:773 +#, fuzzy, no-c-format +msgid "transactional" +msgstr "Criteria-Anfragen" + +#. Tag: para +#: performance.xml:778 +#, no-c-format +msgid "" +"It is recommended to define the cache concurrency strategy per entity rather " +"than using a global one. Use the @org.hibernate.annotations." +"Cache annotation for that." +msgstr "" + +#. Tag: title +#: performance.xml:785 +#, no-c-format +msgid "" +"Definition of cache concurrency strategy via @Cache" +msgstr "" + +#. Tag: programlisting +#: performance.xml:788 +#, no-c-format +msgid "" +"@Entity \n" +"@Cacheable\n" +"@Cache(usage = CacheConcurrencyStrategy.NONSTRICT_READ_WRITE)\n" +"public class Forest { ... }" +msgstr "" + +#. Tag: para +#: performance.xml:791 +#, no-c-format +msgid "" +"Hibernate also let's you cache the content of a collection or the " +"identifiers if the collection contains other entities. Use the " +"@Cache annotation on the collection property." +msgstr "" + +#. Tag: title +#: performance.xml:797 +#, fuzzy, no-c-format +msgid "Caching collections using annotations" +msgstr "Initialisierung von Collections und Proxies" + +#. Tag: programlisting +#: performance.xml:799 +#, no-c-format +msgid "" +"@OneToMany(cascade=CascadeType.ALL, fetch=FetchType.EAGER)\n" +"@JoinColumn(name=\"CUST_ID\")\n" +"@Cache(usage = CacheConcurrencyStrategy.NONSTRICT_READ_WRITE)\n" +"public SortedSet<Ticket> getTickets() {\n" +" return tickets;\n" +"}" +msgstr "" + +#. Tag: para +#: performance.xml:802 +#, no-c-format +msgid "" +"shows the @org.hibernate.annotations.Cache annotations " +"with its attributes. It allows you to define the caching strategy and region " +"of a given second level cache." +msgstr "" + +#. Tag: title +#: performance.xml:808 +#, no-c-format +msgid "@Cache annotation with attributes" +msgstr "" + +#. Tag: programlisting +#: performance.xml:820 +#, no-c-format +msgid "" +"@Cache(\n" +" CacheConcurrencyStrategy usage();\n" +" String region() default \"\";\n" +" String include() default \"all\";\n" +")" +msgstr "" + +#. Tag: para +#: performance.xml:824 +#, no-c-format +msgid "" +"usage: the given cache concurrency strategy (NONE, READ_ONLY, " +"NONSTRICT_READ_WRITE, READ_WRITE, TRANSACTIONAL)" +msgstr "" + +#. Tag: para +#: performance.xml:830 +#, no-c-format +msgid "" +"region (optional): the cache region (default to the fqcn of the class or the " +"fq role name of the collection)" +msgstr "" + +#. Tag: para +#: performance.xml:835 +#, no-c-format +msgid "" +"include (optional): all to include all properties, non-" +"lazy to only include non lazy properties (default all)." +msgstr "" + +#. Tag: para +#: performance.xml:843 +#, no-c-format +msgid "" +"Let's now take a look at Hibernate mapping files. There the <" +"cache> element of a class or collection mapping is used to " +"configure the second level cache. Looking at the parallels to anotations is obvious." +msgstr "" + +#. Tag: title +#: performance.xml:850 +#, no-c-format +msgid "The Hibernate <cache> mapping element" +msgstr "" + +#. Tag: programlisting +#: performance.xml:862 +#, fuzzy, no-c-format +msgid "" +"<cache\n" +" usage=\"transactional|read-write|nonstrict-read-write|read-only\"\n" +" region=\"RegionName\"\n" +" include=\"all|non-lazy\"\n" +"/>" +msgstr "" +"<cache \n" +" usage=\"transactional|read-write|nonstrict-read-write|read-only\"\n" +" region=\"RegionName\"\n" +" include=\"all|non-lazy\"\n" +"/>" + +#. Tag: para +#: performance.xml:866 #, no-c-format msgid "" "usage (required) specifies the caching strategy: " @@ -1507,6 +2217,7 @@ msgstr "" "nonstrict-read-write oder read-only" #. Tag: para +#: performance.xml:874 #, fuzzy, no-c-format msgid "" "region (optional: defaults to the class or collection " @@ -1516,6 +2227,7 @@ msgstr "" "oder Collection) bestimmt den Namen des Cache-Bereichs der zweiten Ebene" #. Tag: para +#: performance.xml:880 #, fuzzy, no-c-format msgid "" "include (optional: defaults to all) " @@ -1529,31 +2241,31 @@ msgstr "" "Attributebene \"lazy Fetching\" aktiviert ist." #. Tag: para +#: performance.xml:890 #, fuzzy, no-c-format msgid "" -"Alternatively, you can specify <class-cache> and " -"<collection-cache> elements in hibernate." -"cfg.xml." +"Alternatively to <cache>, you can use <" +"class-cache> and <collection-cache> " +"elements in hibernate.cfg.xml." msgstr "" "Alternativ (vorzugsweise?) können Sie <class-cache> " "und <collection-cache>-Elemente in " "hibernate.cfg.xml bestimmen." #. Tag: para +#: performance.xml:895 #, no-c-format -msgid "" -"The usage attribute specifies a cache " -"concurrency strategy." +msgid "Let's now have a closer look at the different usage strategies" msgstr "" -"Das usage-Attribut bestimmt eine Cache-" -"Nebenläufigkeitsstrategie." #. Tag: title +#: performance.xml:900 #, no-c-format msgid "Strategy: read only" msgstr "Strategie: \"read only\"" #. Tag: para +#: performance.xml:902 #, fuzzy, no-c-format msgid "" "If your application needs to read, but not modify, instances of a persistent " @@ -1567,11 +2279,13 @@ msgstr "" "sogar bei der Anwendung in einem Cluster völlig sicher." #. Tag: title +#: performance.xml:909 #, no-c-format msgid "Strategy: read/write" msgstr "Strategie: \"read/write\"" #. Tag: para +#: performance.xml:911 #, fuzzy, no-c-format msgid "" "If the application needs to update data, a read-write " @@ -1601,11 +2315,13 @@ msgstr "" "Cache-Provider tun dies nicht." #. Tag: title +#: performance.xml:927 #, no-c-format msgid "Strategy: nonstrict read/write" msgstr "Strategie: \"nonstrict read/write\"" #. Tag: para +#: performance.xml:929 #, fuzzy, no-c-format msgid "" "If the application only occasionally needs to update data (i.e. if it is " @@ -1629,11 +2345,13 @@ msgstr "" "wird." #. Tag: title +#: performance.xml:941 #, no-c-format msgid "Strategy: transactional" msgstr "Strategie: transaktional" #. Tag: para +#: performance.xml:943 #, fuzzy, no-c-format msgid "" "The transactional cache strategy provides support for " @@ -1648,11 +2366,13 @@ msgstr "" "bestimmen." #. Tag: title +#: performance.xml:950 #, fuzzy, no-c-format msgid "Cache-provider/concurrency-strategy compatibility" msgstr "Cache-Nebenläufigkeitsstrategie-Support" #. Tag: para +#: performance.xml:953 #, fuzzy, no-c-format msgid "" "None of the cache providers support all of the cache concurrency strategies." @@ -1662,6 +2382,7 @@ msgstr "" "Nebenläufigkeitsstrategien kompatibel sind." #. Tag: para +#: performance.xml:957 #, fuzzy, no-c-format msgid "" "The following table shows which providers are compatible with which " @@ -1672,36 +2393,43 @@ msgstr "" "Nebenläufigkeitsstrategien kompatibel sind." #. Tag: title +#: performance.xml:961 #, no-c-format msgid "Cache Concurrency Strategy Support" msgstr "Cache-Nebenläufigkeitsstrategie-Support" #. Tag: entry -#, no-c-format -msgid "read-only" -msgstr "read-only" +#: performance.xml:978 +#, fuzzy, no-c-format +msgid "read-only" +msgstr "Ja" #. Tag: entry -#, no-c-format -msgid "nonstrict-read-write" +#: performance.xml:980 +#, fuzzy, no-c-format +msgid "nonstrict-read-write" msgstr "nonstrict-read-write" #. Tag: entry -#, no-c-format -msgid "read-write" -msgstr "read-write" +#: performance.xml:982 +#, fuzzy, no-c-format +msgid "read-write" +msgstr "Ja" #. Tag: entry -#, no-c-format -msgid "transactional" -msgstr "transactional" +#: performance.xml:984 +#, fuzzy, no-c-format +msgid "transactional" +msgstr "Ja" #. Tag: title +#: performance.xml:1067 #, no-c-format msgid "Managing the caches" msgstr "Management der Caches" #. Tag: para +#: performance.xml:1069 #, fuzzy, no-c-format msgid "" "Whenever you pass an object to save(), update()Session hinzugefügt." #. Tag: para +#: performance.xml:1076 #, fuzzy, no-c-format msgid "" "When flush() is subsequently called, the state of that " @@ -1735,7 +2464,36 @@ msgstr "" "müssen, so können mittels der evict()-Methode das Objekt " "und dessen Collections aus dem Cache der ersten Ebene entfernt werden." +#. Tag: title +#: performance.xml:1084 +#, no-c-format +msgid "" +"Explcitly evicting a cached instance from the first level cache using " +"Session.evict()" +msgstr "" + +#. Tag: programlisting +#: performance.xml:1087 +#, fuzzy, no-c-format +msgid "" +"ScrollableResult cats = sess.createQuery(\"from Cat as cat\").scroll(); //a " +"huge result set\n" +"while ( cats.next() ) {\n" +" Cat cat = (Cat) cats.get(0);\n" +" doSomethingWithACat(cat);\n" +" sess.evict(cat);\n" +"}" +msgstr "" +"ScrollableResult cats = sess.createQuery(\"from Cat as cat\").scroll(); //a " +"huge result set\n" +"while ( cats.next() ) {\n" +" Cat cat = (Cat) cats.get(0);\n" +" doSomethingWithACat(cat);\n" +" sess.evict(cat);\n" +"}" + #. Tag: para +#: performance.xml:1090 #, no-c-format msgid "" "The Session also provides a contains() " @@ -1746,6 +2504,7 @@ msgstr "" "gehört." #. Tag: para +#: performance.xml:1094 #, fuzzy, no-c-format msgid "" "To evict all objects from the session cache, call Session.clear()Session.clear()" #. Tag: para +#: performance.xml:1097 #, no-c-format msgid "" "For the second-level cache, there are methods defined on " @@ -1766,7 +2526,34 @@ msgstr "" "gesamten Klasse, Collection-Instanz oder der gesamten Collection-Rolle zu " "räumen." +#. Tag: title +#: performance.xml:1103 +#, no-c-format +msgid "" +"Second-level cache eviction via SessionFactoty.evict() and SessionFacyory.evictCollection()" +msgstr "" + +#. Tag: programlisting +#: performance.xml:1107 +#, fuzzy, no-c-format +msgid "" +"sessionFactory.evict(Cat.class, catId); //evict a particular Cat\n" +"sessionFactory.evict(Cat.class); //evict all Cats\n" +"sessionFactory.evictCollection(\"Cat.kittens\", catId); //evict a particular " +"collection of kittens\n" +"sessionFactory.evictCollection(\"Cat.kittens\"); //evict all kitten " +"collections" +msgstr "" +"sessionFactory.evict(Cat.class, catId); //evict a particular Cat\n" +"sessionFactory.evict(Cat.class); //evict all Cats\n" +"sessionFactory.evictCollection(\"Cat.kittens\", catId); //evict a particular " +"collection of kittens\n" +"sessionFactory.evictCollection(\"Cat.kittens\"); //evict all kitten " +"collections" + #. Tag: para +#: performance.xml:1110 #, fuzzy, no-c-format msgid "" "The CacheMode controls how a particular session interacts " @@ -1776,6 +2563,7 @@ msgstr "" "mit dem Cache der zweiten Ebene interagiert." #. Tag: para +#: performance.xml:1115 #, fuzzy, no-c-format msgid "" "CacheMode.NORMAL: will read items from and write items to " @@ -1785,6 +2573,7 @@ msgstr "" "Posten in das Cache der zweiten Ebene" #. Tag: para +#: performance.xml:1120 #, fuzzy, no-c-format msgid "" "CacheMode.GET: will read items from the second-level " @@ -1795,6 +2584,7 @@ msgstr "" "Aktualisierung der Daten" #. Tag: para +#: performance.xml:1126 #, fuzzy, no-c-format msgid "" "CacheMode.PUT: will write items to the second-level " @@ -1804,6 +2594,7 @@ msgstr "" "Ebene, aber liest nicht aus dem Cache der zweiten Ebene" #. Tag: para +#: performance.xml:1131 #, fuzzy, no-c-format msgid "" "CacheMode.REFRESH: will write items to the second-level " @@ -1818,6 +2609,7 @@ msgstr "" "gelesenen Objekte." #. Tag: para +#: performance.xml:1139 #, no-c-format msgid "" "To browse the contents of a second-level or query cache region, use the " @@ -1826,7 +2618,30 @@ msgstr "" "Um die Inhalte eines Cache der zweiten Ebene oder eines Cache-Bereichs zu " "durchsuchen, verwenden Sie die Statistics-API:" +#. Tag: title +#: performance.xml:1143 +#, fuzzy, no-c-format +msgid "" +"Browsing the second-level cache entries via the Statistics API" +msgstr "" +"Um die Inhalte eines Cache der zweiten Ebene oder eines Cache-Bereichs zu " +"durchsuchen, verwenden Sie die Statistics-API:" + +#. Tag: programlisting +#: performance.xml:1146 +#, fuzzy, no-c-format +msgid "" +"Map cacheEntries = sessionFactory.getStatistics()\n" +" .getSecondLevelCacheStatistics(regionName)\n" +" .getEntries();" +msgstr "" +"Map cacheEntries = sessionFactory.getStatistics()\n" +" .getSecondLevelCacheStatistics(regionName)\n" +" .getEntries();" + #. Tag: para +#: performance.xml:1149 #, fuzzy, no-c-format msgid "" "You will need to enable statistics and, optionally, force Hibernate to keep " @@ -1836,11 +2651,29 @@ msgstr "" "zwingen, Cache-Eingaben in einem lesbaren Format zu halten:" #. Tag: title +#: performance.xml:1153 +#, no-c-format +msgid "Enabling Hibernate statistics" +msgstr "" + +#. Tag: programlisting +#: performance.xml:1155 +#, fuzzy, no-c-format +msgid "" +"hibernate.generate_statistics true\n" +"hibernate.cache.use_structured_entries true" +msgstr "" +"hibernate.generate_statistics true\n" +"hibernate.cache.use_structured_entries true" + +#. Tag: title +#: performance.xml:1160 #, no-c-format msgid "The Query Cache" msgstr "Das Anfragen-Cache" #. Tag: para +#: performance.xml:1162 #, fuzzy, no-c-format msgid "" "Query result sets can also be cached. This is only useful for queries that " @@ -1851,11 +2684,13 @@ msgstr "" "das Anfragen-Cache zu benutzen, müssen Sie es zuerst aktivieren:" #. Tag: title +#: performance.xml:1166 #, no-c-format msgid "Enabling query caching" msgstr "" #. Tag: para +#: performance.xml:1168 #, no-c-format msgid "" "Caching of query results introduces some overhead in terms of your " @@ -1868,12 +2703,20 @@ msgid "" "need to enable the query cache:" msgstr "" +#. Tag: programlisting +#: performance.xml:1177 +#, fuzzy, no-c-format +msgid "hibernate.cache.use_query_cache true" +msgstr "hibernate.cache.use_query_cache true" + #. Tag: para +#: performance.xml:1179 #, no-c-format msgid "This setting creates two new cache regions:" msgstr "" #. Tag: para +#: performance.xml:1181 #, no-c-format msgid "" "org.hibernate.cache.StandardQueryCache, holding the " @@ -1881,6 +2724,7 @@ msgid "" msgstr "" #. Tag: para +#: performance.xml:1186 #, no-c-format msgid "" "org.hibernate.cache.UpdateTimestampsCache, holding " @@ -1889,10 +2733,11 @@ msgid "" msgstr "" #. Tag: para +#: performance.xml:1194 #, no-c-format msgid "" "If you configure your underlying cache implementation to use expiry or " -"timeouts is is very important that the cache timeout of the underlying cache " +"timeouts is very important that the cache timeout of the underlying cache " "region for the UpdateTimestampsCache be set to a higher value than the " "timeouts of any of the query caches. In fact, we recommend that the the " "UpdateTimestampsCache region not be configured for expiry at all. Note, in " @@ -1900,6 +2745,7 @@ msgid "" msgstr "" #. Tag: para +#: performance.xml:1203 #, fuzzy, no-c-format msgid "" "As mentioned above, most queries do not benefit from caching or their " @@ -1916,6 +2762,7 @@ msgstr "" "ihre Ergebnisse dem Cache hinzuzufügen, wenn sie ausgeführt wird." #. Tag: para +#: performance.xml:1211 #, no-c-format msgid "" "The query cache does not cache the state of the actual entities in the " @@ -1926,11 +2773,13 @@ msgid "" msgstr "" #. Tag: title +#: performance.xml:1221 #, fuzzy, no-c-format msgid "Query cache regions" msgstr "Anfragen-Cache unterstützt" #. Tag: para +#: performance.xml:1223 #, fuzzy, no-c-format msgid "" "If you require fine-grained control over query cache expiration policies, " @@ -1941,7 +2790,28 @@ msgstr "" "können Sie einen benannten Cache-Bereich für eine bestimmte Anfrage " "festlegen, indem Sie Query.setCacheRegion() aufrufen." +#. Tag: programlisting +#: performance.xml:1227 +#, fuzzy, no-c-format +msgid "" +"List blogs = sess.createQuery(\"from Blog blog where blog.blogger = :blogger" +"\")\n" +" .setEntity(\"blogger\", blogger)\n" +" .setMaxResults(15)\n" +" .setCacheable(true)\n" +" .setCacheRegion(\"frontpages\")\n" +" .list();" +msgstr "" +"List blogs = sess.createQuery(\"from Blog blog where blog.blogger = :blogger" +"\")\n" +" .setEntity(\"blogger\", blogger)\n" +" .setMaxResults(15)\n" +" .setCacheable(true)\n" +" .setCacheRegion(\"frontpages\")\n" +" .list();" + #. Tag: para +#: performance.xml:1229 #, fuzzy, no-c-format msgid "" "If you want to force the query cache to refresh one of its regions " @@ -1964,11 +2834,13 @@ msgstr "" "durch SessionFactory.evictQueries()." #. Tag: title +#: performance.xml:1242 #, no-c-format msgid "Understanding Collection performance" msgstr "Die Perfomance der Collection verstehen" #. Tag: para +#: performance.xml:1244 #, no-c-format msgid "" "In the previous sections we have covered collections and their applications. " @@ -1977,31 +2849,37 @@ msgid "" msgstr "" #. Tag: title +#: performance.xml:1249 #, no-c-format msgid "Taxonomy" msgstr "Taxonomie" #. Tag: para +#: performance.xml:1251 #, no-c-format msgid "Hibernate defines three basic kinds of collections:" msgstr "Hibernate unterscheidet drei Grundtypen von Collections:" #. Tag: para +#: performance.xml:1255 #, no-c-format msgid "collections of values" msgstr "Collections von Werten" #. Tag: para +#: performance.xml:1259 #, fuzzy, no-c-format msgid "one-to-many associations" msgstr "\"One-to-Many\"-Assoziationen" #. Tag: para +#: performance.xml:1263 #, fuzzy, no-c-format msgid "many-to-many associations" msgstr "\"Many-to-Many\"-Assoziationen" #. Tag: para +#: performance.xml:1267 #, no-c-format msgid "" "This classification distinguishes the various table and foreign key " @@ -2019,21 +2897,25 @@ msgstr "" "Primärschlüssels berücksichtigen. Das legt die folgende Klassifizierung nahe:" #. Tag: para +#: performance.xml:1276 #, no-c-format msgid "indexed collections" msgstr "indizierte Collections" #. Tag: para +#: performance.xml:1280 #, no-c-format msgid "sets" msgstr "Sets" #. Tag: para +#: performance.xml:1284 #, no-c-format msgid "bags" msgstr "Bags" #. Tag: para +#: performance.xml:1288 #, fuzzy, no-c-format msgid "" "All indexed collections (maps, lists, and arrays) have a primary key " @@ -2050,6 +2932,7 @@ msgstr "" "Hibernate diese zu aktualisieren oder löschen versucht." #. Tag: para +#: performance.xml:1295 #, fuzzy, no-c-format msgid "" "Sets have a primary key consisting of <key> and " @@ -2075,6 +2958,7 @@ msgstr "" "deklarieren)." #. Tag: para +#: performance.xml:1306 #, fuzzy, no-c-format msgid "" "<idbag> mappings define a surrogate key, so they " @@ -2085,6 +2969,7 @@ msgstr "" "lassen. Genau genommen, ist das der beste Fall." #. Tag: para +#: performance.xml:1309 #, fuzzy, no-c-format msgid "" "Bags are the worst case since they permit duplicate element values and, as " @@ -2102,6 +2987,7 @@ msgstr "" "ineffizient sein." #. Tag: para +#: performance.xml:1316 #, fuzzy, no-c-format msgid "" "For a one-to-many association, the \"primary key\" may not be the physical " @@ -2116,6 +3002,7 @@ msgstr "" "Hibernate einzelne Reihen der Collection \"lokalisiert\")." #. Tag: title +#: performance.xml:1323 #, no-c-format msgid "" "Lists, maps, idbags and sets are the most efficient collections to update" @@ -2124,6 +3011,7 @@ msgstr "" "aktualisierenden Collections" #. Tag: para +#: performance.xml:1326 #, fuzzy, no-c-format msgid "" "From the discussion above, it should be clear that indexed collections and " @@ -2135,6 +3023,7 @@ msgstr "" "Aktualisierens von Reihen die effizientesten Vorgänge erlauben." #. Tag: para +#: performance.xml:1330 #, fuzzy, no-c-format msgid "" "There is, arguably, one more advantage that indexed collections have over " @@ -2154,6 +3043,7 @@ msgstr "" "ab. Auch hier gilt diese Überlegung nicht für \"One-to-Many\"-Assoziationen." #. Tag: para +#: performance.xml:1338 #, fuzzy, no-c-format msgid "" "After observing that arrays cannot be lazy, you can conclude that lists, " @@ -2170,6 +3060,7 @@ msgstr "" "Modell die natürlichste ist." #. Tag: para +#: performance.xml:1344 #, fuzzy, no-c-format msgid "" "However, in well-designed Hibernate domain models, most collections are in " @@ -2185,11 +3076,13 @@ msgstr "" "hinsichtlich der Performance der Collection-Aktualisierung nicht gelten." #. Tag: title +#: performance.xml:1352 #, no-c-format msgid "Bags and lists are the most efficient inverse collections" msgstr "Bags und Listen sind die effizientesten invertierten Collections" #. Tag: para +#: performance.xml:1354 #, fuzzy, no-c-format msgid "" "There is a particular case, however, in which bags, and also lists, are much " @@ -2212,12 +3105,30 @@ msgstr "" "literal> reagieren müssen (anders als bei einem Set). " "Dadurch kann der folgende Code wesentlich schneller werden." +#. Tag: programlisting +#: performance.xml:1365 +#, fuzzy, no-c-format +msgid "" +"Parent p = (Parent) sess.load(Parent.class, id);\n" +"Child c = new Child();\n" +"c.setParent(p);\n" +"p.getChildren().add(c); //no need to fetch the collection!\n" +"sess.flush();" +msgstr "" +"Parent p = (Parent) sess.load(Parent.class, id);\n" +"Child c = new Child();\n" +"c.setParent(p);\n" +"p.getChildren().add(c); //no need to fetch the collection!\n" +"sess.flush();" + #. Tag: title +#: performance.xml:1369 #, no-c-format msgid "One shot delete" msgstr "\"One-Shot-Löschung\"" #. Tag: para +#: performance.xml:1371 #, fuzzy, no-c-format msgid "" "Deleting collection elements one by one can sometimes be extremely " @@ -2232,6 +3143,7 @@ msgstr "" "literal> heraus, und wir sind fertig!" #. Tag: para +#: performance.xml:1377 #, fuzzy, no-c-format msgid "" "Suppose you added a single element to a collection of size twenty and then " @@ -2246,6 +3158,7 @@ msgstr "" "\"). Das ist auf jeden Fall wünschenswert." #. Tag: para +#: performance.xml:1383 #, no-c-format msgid "" "However, suppose that we remove eighteen elements, leaving two and then add " @@ -2256,6 +3169,7 @@ msgstr "" "Vorgehensweisen:" #. Tag: para +#: performance.xml:1389 #, no-c-format msgid "delete eighteen rows one by one and then insert three rows" msgstr "" @@ -2263,6 +3177,7 @@ msgstr "" "einfügen" #. Tag: para +#: performance.xml:1394 #, fuzzy, no-c-format msgid "" "remove the whole collection in one SQL DELETE and insert " @@ -2272,6 +3187,7 @@ msgstr "" "und die fünf aktuellen Elemente (einzeln) einfügen" #. Tag: para +#: performance.xml:1400 #, fuzzy, no-c-format msgid "" "Hibernate cannot know that the second option is probably quicker. It would " @@ -2284,6 +3200,7 @@ msgstr "" "verwirren könnte usw.)" #. Tag: para +#: performance.xml:1404 #, fuzzy, no-c-format msgid "" "Fortunately, you can force this behavior (i.e. the second strategy) at any " @@ -2297,6 +3214,7 @@ msgstr "" "leistungsfähig erweisen." #. Tag: para +#: performance.xml:1409 #, fuzzy, no-c-format msgid "" "One-shot-delete does not apply to collections mapped inverse=\"true" @@ -2306,11 +3224,13 @@ msgstr "" "\" gemappte Collections." #. Tag: title +#: performance.xml:1415 #, no-c-format msgid "Monitoring performance" msgstr "Leistungsüberwachung" #. Tag: para +#: performance.xml:1417 #, no-c-format msgid "" "Optimization is not much use without monitoring and access to performance " @@ -2324,11 +3244,13 @@ msgstr "" "literal> verfügbar." #. Tag: title +#: performance.xml:1423 #, no-c-format msgid "Monitoring a SessionFactory" msgstr "Die Überwachung einer SessionFactory" #. Tag: para +#: performance.xml:1425 #, no-c-format msgid "" "You can access SessionFactory metrics in two ways. Your " @@ -2341,6 +3263,7 @@ msgstr "" "selbst zu lesen und anzuzeigen." #. Tag: para +#: performance.xml:1430 #, fuzzy, no-c-format msgid "" "Hibernate can also use JMX to publish metrics if you enable the " @@ -2354,7 +3277,56 @@ msgstr "" "eines pro Factory aktivieren. Sehen Sie sich den folgenden Code für " "minimalistische Konfigurationsbeispiele an:" +#. Tag: programlisting +#: performance.xml:1435 +#, fuzzy, no-c-format +msgid "" +"// MBean service registration for a specific SessionFactory\n" +"Hashtable tb = new Hashtable();\n" +"tb.put(\"type\", \"statistics\");\n" +"tb.put(\"sessionFactory\", \"myFinancialApp\");\n" +"ObjectName on = new ObjectName(\"hibernate\", tb); // MBean object name\n" +"\n" +"StatisticsService stats = new StatisticsService(); // MBean implementation\n" +"stats.setSessionFactory(sessionFactory); // Bind the stats to a " +"SessionFactory\n" +"server.registerMBean(stats, on); // Register the Mbean on the server" +msgstr "" +"// MBean service registration for a specific SessionFactory\n" +"Hashtable tb = new Hashtable();\n" +"tb.put(\"type\", \"statistics\");\n" +"tb.put(\"sessionFactory\", \"myFinancialApp\");\n" +"ObjectName on = new ObjectName(\"hibernate\", tb); // MBean object name\n" +"\n" +"StatisticsService stats = new StatisticsService(); // MBean implementation\n" +"stats.setSessionFactory(sessionFactory); // Bind the stats to a " +"SessionFactory\n" +"server.registerMBean(stats, on); // Register the Mbean on the server" + +#. Tag: programlisting +#: performance.xml:1437 +#, fuzzy, no-c-format +msgid "" +"// MBean service registration for all SessionFactory's\n" +"Hashtable tb = new Hashtable();\n" +"tb.put(\"type\", \"statistics\");\n" +"tb.put(\"sessionFactory\", \"all\");\n" +"ObjectName on = new ObjectName(\"hibernate\", tb); // MBean object name\n" +"\n" +"StatisticsService stats = new StatisticsService(); // MBean implementation\n" +"server.registerMBean(stats, on); // Register the MBean on the server" +msgstr "" +"// MBean service registration for all SessionFactory's\n" +"Hashtable tb = new Hashtable();\n" +"tb.put(\"type\", \"statistics\");\n" +"tb.put(\"sessionFactory\", \"all\");\n" +"ObjectName on = new ObjectName(\"hibernate\", tb); // MBean object name\n" +"\n" +"StatisticsService stats = new StatisticsService(); // MBean implementation\n" +"server.registerMBean(stats, on); // Register the MBean on the server" + #. Tag: para +#: performance.xml:1439 #, fuzzy, no-c-format msgid "" "You can activate and deactivate the monitoring for a " @@ -2364,6 +3336,7 @@ msgstr "" "aktivieren" #. Tag: para +#: performance.xml:1444 #, no-c-format msgid "" "at configuration time, set hibernate.generate_statistics " @@ -2373,6 +3346,7 @@ msgstr "" "generate_statistics auf false" #. Tag: para +#: performance.xml:1452 #, no-c-format msgid "" "at runtime: sf.getStatistics().setStatisticsEnabled(true) " @@ -2383,6 +3357,7 @@ msgstr "" "literal>" #. Tag: para +#: performance.xml:1458 #, fuzzy, no-c-format msgid "" "Statistics can be reset programmatically using the clear()Session usage, such as " @@ -2423,6 +3401,7 @@ msgstr "" "Verbindungen usw." #. Tag: para +#: performance.xml:1479 #, fuzzy, no-c-format msgid "" "Metrics related to the entities, collections, queries, and caches as a whole " @@ -2433,6 +3412,7 @@ msgstr "" "\")" #. Tag: para +#: performance.xml:1484 #, no-c-format msgid "" "Detailed metrics related to a particular entity, collection, query or cache " @@ -2442,6 +3422,7 @@ msgstr "" "Anfrage oder Cache-Region beziehen." #. Tag: para +#: performance.xml:1489 #, fuzzy, no-c-format msgid "" "For example, you can check the cache hit, miss, and put ratio of entities, " @@ -2458,6 +3439,7 @@ msgstr "" "auf 10 Sekunden genau sein." #. Tag: para +#: performance.xml:1495 #, fuzzy, no-c-format msgid "" "Simple getters are used to access the global metrics (i.e. not tied to a " @@ -2480,7 +3462,46 @@ msgstr "" "SecondLevelCacheStatistics und QueryStatistics API-Javadoc. Der folgende Code zeigt ein einfaches Beispiel:" +#. Tag: programlisting +#: performance.xml:1506 +#, fuzzy, no-c-format +msgid "" +"Statistics stats = HibernateUtil.sessionFactory.getStatistics();\n" +"\n" +"double queryCacheHitCount = stats.getQueryCacheHitCount();\n" +"double queryCacheMissCount = stats.getQueryCacheMissCount();\n" +"double queryCacheHitRatio =\n" +" queryCacheHitCount / (queryCacheHitCount + queryCacheMissCount);\n" +"\n" +"log.info(\"Query Hit ratio:\" + queryCacheHitRatio);\n" +"\n" +"EntityStatistics entityStats =\n" +" stats.getEntityStatistics( Cat.class.getName() );\n" +"long changes =\n" +" entityStats.getInsertCount()\n" +" + entityStats.getUpdateCount()\n" +" + entityStats.getDeleteCount();\n" +"log.info(Cat.class.getName() + \" changed \" + changes + \"times\" );" +msgstr "" +"Statistics stats = HibernateUtil.sessionFactory.getStatistics();\n" +"\n" +"double queryCacheHitCount = stats.getQueryCacheHitCount();\n" +"double queryCacheMissCount = stats.getQueryCacheMissCount();\n" +"double queryCacheHitRatio =\n" +" queryCacheHitCount / (queryCacheHitCount + queryCacheMissCount);\n" +"\n" +"log.info(\"Query Hit ratio:\" + queryCacheHitRatio);\n" +"\n" +"EntityStatistics entityStats =\n" +" stats.getEntityStatistics( Cat.class.getName() );\n" +"long changes =\n" +" entityStats.getInsertCount()\n" +" + entityStats.getUpdateCount()\n" +" + entityStats.getDeleteCount();\n" +"log.info(Cat.class.getName() + \" changed \" + changes + \"times\" );" + #. Tag: para +#: performance.xml:1508 #, fuzzy, no-c-format msgid "" "You can work on all entities, collections, queries and region caches, by " @@ -2496,6 +3517,29 @@ msgstr "" "getCollectionRoleNames() und " "getSecondLevelCacheRegionNames()." +#~ msgid "" +#~ "The <cache> element of a class or collection " +#~ "mapping has the following form:" +#~ msgstr "" +#~ "Das <cache>-Element des Mappings einer Klasse " +#~ "oder Collection besitzt folgende Form:" + +#~ msgid "" +#~ "The usage attribute specifies a cache " +#~ "concurrency strategy." +#~ msgstr "" +#~ "Das usage-Attribut bestimmt eine Cache-" +#~ "Nebenläufigkeitsstrategie." + +#~ msgid "read-only" +#~ msgstr "read-only" + +#~ msgid "read-write" +#~ msgstr "read-write" + +#~ msgid "transactional" +#~ msgstr "transactional" + #, fuzzy #~ msgid "" #~ "This setting creates two new cache regions: one holding cached query " @@ -2517,258 +3561,6 @@ msgstr "" #~ "Ergebnisse vom Wertetyp. Das Anfragen-Cache sollte daher stets in " #~ "Verbindung mit dem Cache der zweiten Ebene verwendet werden." -#, fuzzy -#~ msgid "" -#~ "" -#~ msgstr "" -#~ "s = sessions.openSession();\n" -#~ "Transaction tx = s.beginTransaction();\n" -#~ " \n" -#~ "User u = (User) s.createQuery(\"from User u where u.name=:userName\")\n" -#~ " .setString(\"userName\", userName).uniqueResult();\n" -#~ "Map permissions = u.getPermissions();\n" -#~ "\n" -#~ "tx.commit();\n" -#~ "s.close();\n" -#~ "\n" -#~ "Integer accessLevel = (Integer) permissions.get(\"accounts\"); // Error!" - -#, fuzzy -#~ msgid "" -#~ "\n" -#~ " \n" -#~ " \n" -#~ "" -#~ msgstr "" -#~ "<set name=\"permissions\" \n" -#~ " fetch=\"join\">\n" -#~ " <key column=\"userId\"/>\n" -#~ " <one-to-many class=\"Permission\"/>\n" -#~ "</set" - -#, fuzzy -#~ msgid "" -#~ "]]>" -#~ msgstr "<many-to-one name=\"mother\" class=\"Cat\" fetch=\"join\"/>" - -#, fuzzy -#~ msgid "" -#~ "" -#~ msgstr "" -#~ "User user = (User) session.createCriteria(User.class)\n" -#~ " .setFetchMode(\"permissions\", FetchMode.JOIN)\n" -#~ " .add( Restrictions.idEq(userId) )\n" -#~ " .uniqueResult();" - -#, fuzzy -#~ msgid "" -#~ "\n" -#~ " ......\n" -#~ " \n" -#~ " .....\n" -#~ " \n" -#~ "]]>" -#~ msgstr "" -#~ "<class name=\"Cat\" proxy=\"Cat\">\n" -#~ " ......\n" -#~ " <subclass name=\"DomesticCat\">\n" -#~ " .....\n" -#~ " </subclass>\n" -#~ "</class>" - -#, fuzzy -#~ msgid "" -#~ "" -#~ msgstr "" -#~ "Cat cat = (Cat) session.load(Cat.class, id); // instantiate a proxy " -#~ "(does not hit the db)\n" -#~ "if ( cat.isDomesticCat() ) { // hit the db to initialize " -#~ "the proxy\n" -#~ " DomesticCat dc = (DomesticCat) cat; // Error!\n" -#~ " ....\n" -#~ "}" - -#, fuzzy -#~ msgid "" -#~ "" -#~ msgstr "" -#~ "Cat cat = (Cat) session.load(Cat.class, id); // instantiate a " -#~ "Cat proxy\n" -#~ "DomesticCat dc = \n" -#~ " (DomesticCat) session.load(DomesticCat.class, id); // acquire " -#~ "new DomesticCat proxy!\n" -#~ "System.out.println(cat==dc); // false" - -#, fuzzy -#~ msgid "" -#~ "" -#~ msgstr "" -#~ "cat.setWeight(11.0); // hit the db to initialize the proxy\n" -#~ "System.out.println( dc.getWeight() ); // 11.0" - -#, fuzzy -#~ msgid "" -#~ "\n" -#~ " ......\n" -#~ " \n" -#~ " .....\n" -#~ " \n" -#~ "]]>" -#~ msgstr "" -#~ "<class name=\"CatImpl\" proxy=\"Cat\">\n" -#~ " ......\n" -#~ " <subclass name=\"DomesticCatImpl\" proxy=\"DomesticCat\">\n" -#~ " .....\n" -#~ " </subclass>\n" -#~ "</class>" - -#, fuzzy -#~ msgid "" -#~ "" -#~ msgstr "" -#~ "Cat cat = (Cat) session.load(CatImpl.class, catid);\n" -#~ "Iterator iter = session.iterate(\"from CatImpl as cat where cat." -#~ "name='fritz'\");\n" -#~ "Cat fritz = (Cat) iter.next();" - -#, fuzzy -#~ msgid "" -#~ "" -#~ msgstr "" -#~ "( (Integer) s.createFilter( collection, \"select count(*)\" ).list().get" -#~ "(0) ).intValue()" - -#, fuzzy -#~ msgid "" -#~ "" -#~ msgstr "" -#~ "s.createFilter( lazyCollection, \"\").setFirstResult(0).setMaxResults(10)." -#~ "list();" - -#, fuzzy -#~ msgid "...]]>" -#~ msgstr "<class name=\"Person\" batch-size=\"10\">...</class>" - -#, fuzzy -#~ msgid "" -#~ "\n" -#~ " \n" -#~ " ...\n" -#~ " \n" -#~ "]]>" -#~ msgstr "" -#~ "<class name=\"Person\">\n" -#~ " <set name=\"cats\" batch-size=\"3\">\n" -#~ " ...\n" -#~ " </set>\n" -#~ "</class>" - -#, fuzzy -#~ msgid "" -#~ "\n" -#~ " \n" -#~ " \n" -#~ " \n" -#~ " \n" -#~ " \n" -#~ " \n" -#~ "]]>" -#~ msgstr "" -#~ "<class name=\"Document\">\n" -#~ " <id name=\"id\">\n" -#~ " <generator class=\"native\"/>\n" -#~ " </id>\n" -#~ " <property name=\"name\" not-null=\"true\" length=\"50\"/>\n" -#~ " <property name=\"summary\" not-null=\"true\" length=\"200\" lazy=" -#~ "\"true\"/>\n" -#~ " <property name=\"text\" not-null=\"true\" length=\"2000\" lazy=" -#~ "\"true\"/>\n" -#~ "</class>" - -#, fuzzy -#~ msgid "" -#~ "\n" -#~ " \n" -#~ " \n" -#~ " \n" -#~ " \n" -#~ " \n" -#~ "\n" -#~ " \n" -#~ " \n" -#~ " \n" -#~ " \n" -#~ " \n" -#~ "]]>" -#~ msgstr "" -#~ "<target name=\"instrument\" depends=\"compile\">\n" -#~ " <taskdef name=\"instrument\" classname=\"org.hibernate.tool." -#~ "instrument.InstrumentTask\">\n" -#~ " <classpath path=\"${jar.path}\"/>\n" -#~ " <classpath path=\"${classes.dir}\"/>\n" -#~ " <classpath refid=\"lib.class.path\"/>\n" -#~ " </taskdef>\n" -#~ "\n" -#~ " <instrument verbose=\"true\">\n" -#~ " <fileset dir=\"${testclasses.dir}/org/hibernate/auction/" -#~ "model\">\n" -#~ " <include name=\"*.class\"/>\n" -#~ " </fileset>\n" -#~ " </instrument>\n" -#~ "</target>" - -#~ msgid "yes" -#~ msgstr "Ja" - -#, fuzzy -#~ msgid "" -#~ "]]>" -#~ msgstr "" -#~ "<cache \n" -#~ " usage=\"transactional|read-write|nonstrict-read-write|read-only\"\n" -#~ " region=\"RegionName\"\n" -#~ " include=\"all|non-lazy\"\n" -#~ "/>" - #, fuzzy #~ msgid "" #~ "\n" @@ -2800,177 +3592,3 @@ msgstr "" #~ " ....\n" #~ " </set>\n" #~ "</class>" - -#, fuzzy -#~ msgid "" -#~ "" -#~ msgstr "" -#~ "ScrollableResult cats = sess.createQuery(\"from Cat as cat\").scroll(); //" -#~ "a huge result set\n" -#~ "while ( cats.next() ) {\n" -#~ " Cat cat = (Cat) cats.get(0);\n" -#~ " doSomethingWithACat(cat);\n" -#~ " sess.evict(cat);\n" -#~ "}" - -#, fuzzy -#~ msgid "" -#~ "" -#~ msgstr "" -#~ "sessionFactory.evict(Cat.class, catId); //evict a particular Cat\n" -#~ "sessionFactory.evict(Cat.class); //evict all Cats\n" -#~ "sessionFactory.evictCollection(\"Cat.kittens\", catId); //evict a " -#~ "particular collection of kittens\n" -#~ "sessionFactory.evictCollection(\"Cat.kittens\"); //evict all kitten " -#~ "collections" - -#, fuzzy -#~ msgid "" -#~ "" -#~ msgstr "" -#~ "Map cacheEntries = sessionFactory.getStatistics()\n" -#~ " .getSecondLevelCacheStatistics(regionName)\n" -#~ " .getEntries();" - -#, fuzzy -#~ msgid "" -#~ "" -#~ msgstr "" -#~ "hibernate.generate_statistics true\n" -#~ "hibernate.cache.use_structured_entries true" - -#, fuzzy -#~ msgid "" -#~ msgstr "hibernate.cache.use_query_cache true" - -#, fuzzy -#~ msgid "" -#~ "" -#~ msgstr "" -#~ "List blogs = sess.createQuery(\"from Blog blog where blog.blogger = :" -#~ "blogger\")\n" -#~ " .setEntity(\"blogger\", blogger)\n" -#~ " .setMaxResults(15)\n" -#~ " .setCacheable(true)\n" -#~ " .setCacheRegion(\"frontpages\")\n" -#~ " .list();" - -#, fuzzy -#~ msgid "" -#~ "" -#~ msgstr "" -#~ "Parent p = (Parent) sess.load(Parent.class, id);\n" -#~ "Child c = new Child();\n" -#~ "c.setParent(p);\n" -#~ "p.getChildren().add(c); //no need to fetch the collection!\n" -#~ "sess.flush();" - -#, fuzzy -#~ msgid "" -#~ "" -#~ msgstr "" -#~ "// MBean service registration for a specific SessionFactory\n" -#~ "Hashtable tb = new Hashtable();\n" -#~ "tb.put(\"type\", \"statistics\");\n" -#~ "tb.put(\"sessionFactory\", \"myFinancialApp\");\n" -#~ "ObjectName on = new ObjectName(\"hibernate\", tb); // MBean object name\n" -#~ "\n" -#~ "StatisticsService stats = new StatisticsService(); // MBean " -#~ "implementation\n" -#~ "stats.setSessionFactory(sessionFactory); // Bind the stats to a " -#~ "SessionFactory\n" -#~ "server.registerMBean(stats, on); // Register the Mbean on the server" - -#, fuzzy -#~ msgid "" -#~ "" -#~ msgstr "" -#~ "// MBean service registration for all SessionFactory's\n" -#~ "Hashtable tb = new Hashtable();\n" -#~ "tb.put(\"type\", \"statistics\");\n" -#~ "tb.put(\"sessionFactory\", \"all\");\n" -#~ "ObjectName on = new ObjectName(\"hibernate\", tb); // MBean object name\n" -#~ "\n" -#~ "StatisticsService stats = new StatisticsService(); // MBean " -#~ "implementation\n" -#~ "server.registerMBean(stats, on); // Register the MBean on the server" - -#, fuzzy -#~ msgid "" -#~ "" -#~ msgstr "" -#~ "Statistics stats = HibernateUtil.sessionFactory.getStatistics();\n" -#~ "\n" -#~ "double queryCacheHitCount = stats.getQueryCacheHitCount();\n" -#~ "double queryCacheMissCount = stats.getQueryCacheMissCount();\n" -#~ "double queryCacheHitRatio =\n" -#~ " queryCacheHitCount / (queryCacheHitCount + queryCacheMissCount);\n" -#~ "\n" -#~ "log.info(\"Query Hit ratio:\" + queryCacheHitRatio);\n" -#~ "\n" -#~ "EntityStatistics entityStats =\n" -#~ " stats.getEntityStatistics( Cat.class.getName() );\n" -#~ "long changes =\n" -#~ " entityStats.getInsertCount()\n" -#~ " + entityStats.getUpdateCount()\n" -#~ " + entityStats.getDeleteCount();\n" -#~ "log.info(Cat.class.getName() + \" changed \" + changes + \"times\" );" diff --git a/documentation/manual/src/main/docbook/de-DE/content/persistent_classes.po b/documentation/manual/src/main/docbook/de-DE/content/persistent_classes.po index 21ce6d13a3..baa356bf27 100644 --- a/documentation/manual/src/main/docbook/de-DE/content/persistent_classes.po +++ b/documentation/manual/src/main/docbook/de-DE/content/persistent_classes.po @@ -275,7 +275,7 @@ msgid "" msgstr "" "Project-Id-Version: Collection_Mapping\n" "Report-Msgid-Bugs-To: http://bugs.kde.org\n" -"POT-Creation-Date: 2010-02-11T05:38:15\n" +"POT-Creation-Date: 2010-07-20 21:02+0000\n" "PO-Revision-Date: 2007-02-26 10:27+1000\n" "Last-Translator: \n" "Language-Team: \n" @@ -285,18 +285,20 @@ msgstr "" "X-Generator: KBabel 1.9.1\n" #. Tag: title +#: persistent_classes.xml:32 #, no-c-format msgid "Persistent Classes" msgstr "Persistente Klassen" #. Tag: para +#: persistent_classes.xml:34 #, fuzzy, 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. For example, an instance can instead be transient " -"or detached." +"application). The term \"persistent\" here means that the classes are able " +"to be persisted, not that they are in the persistent state (see for discussion)." msgstr "" "Unter persistenten Klassen versteht man diejenigen Klassen in einer " "Anwendung, die die Entities des Unternehmensproblems (z.B. Kunde und " @@ -306,13 +308,15 @@ msgstr "" "(\"transient\") oder abgesetzt (\"detached\") sein." #. Tag: para +#: persistent_classes.xml:41 #, fuzzy, 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 " +"these rules are hard requirements. Indeed, Hibernate assumes very little " "about the nature of your persistent objects. You can express a domain model " -"in other ways (using trees of Map instances, for example)." +"in other ways (using trees of java.util.Map " +"instances, for example)." msgstr "" "Hibernate funktioniert am besten, wenn diese Klassen einigen einfachen " "Regeln folgen, die auch als \"Plain Old Java Object\" (POJO) " @@ -323,20 +327,181 @@ msgstr "" "literal>-Instanzen-Trees." #. Tag: title +#: persistent_classes.xml:49 #, no-c-format msgid "A simple POJO example" msgstr "Ein einfaches POJO-Beispiel" -#. Tag: para +#. Tag: title +#: persistent_classes.xml:52 +#, no-c-format +msgid "Simple POJO representing a cat" +msgstr "" + +#. Tag: programlisting +#: persistent_classes.xml:53 #, fuzzy, no-c-format msgid "" -"Most Java applications require a persistent class representing felines. For " -"example:" +"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 "" -"Die meisten Java-Anwendungen erfordern eine persistente Klasse, die Katzen " -"(\"felines\") repräsentiert." +"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" +"}" #. Tag: para +#: persistent_classes.xml:57 #, no-c-format msgid "" "The four main rules of persistent classes are explored in more detail in the " @@ -344,19 +509,21 @@ msgid "" msgstr "" #. Tag: title +#: persistent_classes.xml:62 #, no-c-format msgid "Implement a no-argument constructor" msgstr "Implementierung eines \"No-Argument\"-Konstruktors" #. Tag: para +#: persistent_classes.xml:64 #, fuzzy, no-c-format msgid "" -"Cat has a no-argument constructor. All persistent classes " -"must have a default constructor (which can be non-public) so that Hibernate " -"can instantiate them using Constructor.newInstance(). It " -"is recommended that you have a default constructor with at least " -"package visibility for runtime proxy generation in " -"Hibernate." +"Cat has a no-argument constructor. All persistent " +"classes must have a default constructor (which can be non-public) so that " +"Hibernate can instantiate them using java.lang.reflect." +"Constructor.newInstance(). It is recommended that this " +"constructor be defined with at least package visibility " +"in order for runtime proxy generation to work properly." msgstr "" "Cat besitzt einen \"No-Argument\"-Konstruktor. Alle " "persistenten Klassen müssen über einen Standard-Konstruktor verfügen (der " @@ -367,72 +534,42 @@ msgstr "" "Runtime in Hibernate besitzt." #. Tag: title -#, no-c-format -msgid "Provide an identifier property (optional)" +#: persistent_classes.xml:74 +#, fuzzy, no-c-format +msgid "Provide an identifier property" msgstr "Bereitstellung einer Bezeichner-Property (optional)" #. Tag: para -#, fuzzy, no-c-format -msgid "" -"Cat has a property called id. 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, java.lang.String or " -"java.util.Date. If your legacy database table has " -"composite keys, you can use a user-defined class with properties of these " -"types (see the section on composite identifiers later in the chapter.)" -msgstr "" -"Cat besitzt eine Property mit Namen id. Diese Property mappt zur Spalte des Primärschlüssels der " -"Datenbanktabelle. Die Property könnte auch einen beliebigen Namen tragen und " -"könnte irgendeinen primitiven Typ besitzen, etwa einen primitiven \"Wrapper" -"\"-Typ, java.lang.String oder java.util.Date. (Falls Ihre Legacy-Datenbanktabelle zusammengesetzte Schlüssel " -"besitzt, können Sie sogar eine benutzerdefinierte Klasse mit Properties " -"dieser Typen verwenden - wir gehen in einem späteren Abschnitt auf " -"zusammengesetzte Bezeichner ein)." - -#. Tag: para +#: persistent_classes.xml:77 #, 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." +"Historically this was considered option. While still not (yet) enforced, " +"this should be considered a deprecated feature as it will be completely " +"required to provide a identifier property in an upcoming release." msgstr "" -"Die Bezeichner-Property ist völlig optional. Sie können sie ausgeschaltet " -"lassen und Hibernate verfolgt die Objektbezeichner intern. Allerdings " -"empfehlen wir diese Einstellung nicht." #. Tag: para -#, fuzzy, no-c-format +#: persistent_classes.xml:84 +#, no-c-format msgid "" -"In fact, some functionality is available only to classes that declare an " -"identifier property:" +"Cat has a property named id. This " +"property maps to the primary key column(s) of the underlying database table. " +"The type of the identifier property can be any \"basic\" type (see ). See for information on mapping composite (multi-column) identifiers." msgstr "" -"Tatsächlich sind einige Funktionalitäten nur für Klassen mit deklarierter " -"Bezeichner-Property verfügbar:" #. Tag: para -#, fuzzy, no-c-format +#: persistent_classes.xml:92 +#, no-c-format msgid "" -"Transitive reattachment for detached objects (cascade update or cascade " -"merge) - see " +"Identifiers do not necessarily need to identify column(s) in the database " +"physically defined as a primary key. They should just identify columns that " +"can be used to uniquely identify rows in the underlying table." msgstr "" -"Transitives Reattachment für abgesetzte Objekte (in Reihe erfolgende " -"Aktualisierung oder in Reihe erfolgendes Zusammenfügen (auch: \"Cascade " -"Update\" bzw. \"Cascade Merge\") - siehe" - -#. Tag: para -#, fuzzy, no-c-format -msgid "Session.saveOrUpdate()" -msgstr "Session.saveOrUpdate()" - -#. Tag: para -#, fuzzy, no-c-format -msgid "Session.merge()" -msgstr "Session.merge()" #. Tag: para +#: persistent_classes.xml:99 #, fuzzy, no-c-format msgid "" "We recommend that you declare consistently-named identifier properties on " @@ -443,42 +580,100 @@ msgstr "" "primitiver) Typ ist ebenfalls zu bevorzugen." #. Tag: title -#, no-c-format -msgid "Prefer non-final classes (optional)" +#: persistent_classes.xml:107 +#, fuzzy, no-c-format +msgid "Prefer non-final classes (semi-optional)" msgstr "Bevorzugung nicht-finaler Klassen (optional)" #. Tag: para +#: persistent_classes.xml:109 #, no-c-format msgid "" -"A central feature of Hibernate, proxies, depends upon " -"the persistent class being either non-final, or the implementation of an " -"interface that declares all public methods." +"A central feature of Hibernate, proxies (lazy loading), " +"depends upon the persistent class being either non-final, or the " +"implementation of an interface that declares all public methods. You can " +"persist final classes that do not implement an interface " +"with Hibernate; you will not, however, be able to use proxies for lazy " +"association fetching which will ultimately limit your options for " +"performance tuning. To persist a final class which does " +"not implement a \"full\" interface you must disable proxy generation. See " +" and ." +msgstr "" + +#. Tag: title +#: persistent_classes.xml:121 +#, no-c-format +msgid "Disabling proxies in hbm.xml" +msgstr "" + +#. Tag: programlisting +#: persistent_classes.xml:122 +#, no-c-format +msgid "...]]>" +msgstr "" + +#. Tag: title +#: persistent_classes.xml:126 +#, no-c-format +msgid "Disabling proxies in annotations" +msgstr "" + +#. Tag: programlisting +#: persistent_classes.xml:127 +#, no-c-format +msgid "" msgstr "" -"Ein zentrales Feature von Hibernate, Proxies, hängt " -"davon ab, ob die persistente Klasse entweder nicht-final oder der alle " -"Methoden als öffentlich erklärenden Implemetierung eines Interface." #. Tag: para -#, fuzzy, no-c-format +#: persistent_classes.xml:130 +#, no-c-format msgid "" -"You can persist final classes that do not implement an " -"interface with Hibernate. You will not, however, be able to use proxies for " -"lazy association fetching which will ultimately limit your options for " -"performance tuning." +"If the final class does implement a proper interface, you " +"could alternatively tell Hibernate to use the interface instead when " +"generating the proxies. See and ." +msgstr "" + +#. Tag: title +#: persistent_classes.xml:139 +#, no-c-format +msgid "Proxying an interface in hbm.xml" +msgstr "" + +#. Tag: programlisting +#: persistent_classes.xml:140 +#, no-c-format +msgid "...]]>" +msgstr "" + +#. Tag: title +#: persistent_classes.xml:144 +#, no-c-format +msgid "Proxying an interface in annotations" +msgstr "" + +#. Tag: programlisting +#: persistent_classes.xml:145 +#, no-c-format +msgid "" +"" msgstr "" -"Sie können finale Klassen, die kein Interface mit " -"Hibernate implementieren, persistieren, aber Sie werden keine Proxies für " -"das \"Lazy Fetching\" von Assoziationen (d.h. das Nachladen assoziierter " -"Objekte bei Bedarf) verwenden können - was Ihre Optionen bei der " -"Feinabstimmung der Performance einschränkt." #. Tag: para +#: persistent_classes.xml:148 #, fuzzy, no-c-format msgid "" -"You should also avoid declaring public final methods on " -"the non-final classes. If you want to use a class with a public " -"final method, you must explicitly disable proxying by setting " -"lazy=\"false\"." +"You should also avoid declaring public final methods as " +"this will again limit the ability to generate proxies " +"from this class. If you want to use a class with public final methods, you must explicitly disable proxying. Again, see and " +"." msgstr "" "Sie sollten es vermeiden, public final-Methoden an den " "nicht-finalen Klassen zu deklarieren. Wenn Sie eine Klasse mit einer " @@ -487,6 +682,7 @@ msgstr "" "deaktivieren." #. Tag: title +#: persistent_classes.xml:158 #, no-c-format msgid "Declare accessors and mutators for persistent fields (optional)" msgstr "" @@ -494,9 +690,10 @@ msgstr "" "(optional)" #. Tag: para +#: persistent_classes.xml:160 #, fuzzy, no-c-format msgid "" -"Cat declares accessor methods for all its persistent " +"Cat declares accessor methods for all its persistent " "fields. Many other ORM tools directly persist instance variables. It is " "better to provide an indirection between the relational schema and internal " "data structures of the class. By default, Hibernate persists JavaBeans style " @@ -515,22 +712,26 @@ msgstr "" "Feldzugriff wechseln." #. Tag: para -#, no-c-format +#: persistent_classes.xml:169 +#, fuzzy, no-c-format msgid "" -"Properties need not be declared public - Hibernate can " -"persist a property with a default, protected or " -"private get / set pair." +"Properties need not be declared public. Hibernate can " +"persist a property declared with package, " +"protected or private visibility as " +"well." msgstr "" "Properties müssen nicht als öffentlich deklariert " "werden - Hibernate kann eine Property als protected oder " "private \"Get\"-/ \"Set\"-Paar persistieren." #. Tag: title +#: persistent_classes.xml:178 #, no-c-format msgid "Implementing inheritance" msgstr "Implementierung der Vererbung" #. Tag: para +#: persistent_classes.xml:180 #, fuzzy, no-c-format msgid "" "A subclass must also observe the first and second rules. It inherits its " @@ -539,7 +740,38 @@ msgstr "" "Eine Subklasse muss ebenfalls die ersten und zweiten Regeln berücksichtigen. " "Sie erbt ihre Bezeichner-Property von der Superklasse Cat." +#. Tag: programlisting +#: persistent_classes.xml:184 +#, fuzzy, no-c-format +msgid "" +"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 "" +"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" +"}" + #. Tag: title +#: persistent_classes.xml:188 #, fuzzy, no-c-format msgid "" "Implementing equals() and hashCode()" @@ -548,6 +780,7 @@ msgstr "" "Methoden außer Kraft setzen, falls Sie" #. Tag: para +#: persistent_classes.xml:191 #, fuzzy, no-c-format msgid "" "You have to override the equals() and hashCode()" @@ -557,6 +790,7 @@ msgstr "" "Methoden außer Kraft setzen, falls Sie" #. Tag: para +#: persistent_classes.xml:196 #, fuzzy, no-c-format msgid "" "intend to put instances of persistent classes in a Set " @@ -568,11 +802,13 @@ msgstr "" "repräsentieren) und" #. Tag: para +#: persistent_classes.xml:202 #, no-c-format msgid "intend to use reattachment of detached instances" msgstr "planen, den Wiederanbindung abgesetzter Instanzen zu verwenden" #. Tag: para +#: persistent_classes.xml:206 #, fuzzy, no-c-format msgid "" "Hibernate guarantees equivalence of persistent identity (database row) and " @@ -589,6 +825,7 @@ msgstr "" "aussagekräftige Semantik für Sets wünschen." #. Tag: para +#: persistent_classes.xml:212 #, fuzzy, no-c-format msgid "" "The most obvious way is to implement equals()/" @@ -625,6 +862,7 @@ msgstr "" "Java-Semantik hinsichtlich Objektidentität und Gleichheit basiert." #. Tag: para +#: persistent_classes.xml:228 #, fuzzy, no-c-format msgid "" "It is recommended that you implement equals() and " @@ -642,11 +880,64 @@ msgstr "" "identifiziert Ihre Instanz in der Realität (ein natürlicher Schlüsselkandidat bzw. \"Candidate Key\"):" +#. Tag: programlisting +#: persistent_classes.xml:235 +#, fuzzy, no-c-format +msgid "" +"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 "" +"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" +"}" + #. Tag: para +#: persistent_classes.xml:237 #, fuzzy, no-c-format msgid "" "A business key does not have to be as solid as a database primary key " -"candidate (see ). Immutable " +"candidate (see ). Immutable " "or unique properties are usually good candidates for a business key." msgstr "" "Bitte beachten Sie, dass ein \"Business Key\" nicht so beständig wie ein " @@ -655,25 +946,29 @@ msgstr "" "Properties sind in der Regel eine gute Wahl für einen Business Key." #. Tag: title +#: persistent_classes.xml:244 #, no-c-format msgid "Dynamic models" msgstr "Dynamische Modelle" #. Tag: title +#: persistent_classes.xml:247 #, no-c-format msgid "Note" msgstr "" -#. Tag: para +#. Tag: emphasis +#: persistent_classes.xml:249 #, fuzzy, no-c-format msgid "" -"The following features are currently considered experimental and " -"may change in the near future." +"The following features are currently considered experimental and may change " +"in the near future." msgstr "" "Bitte beachten Sie, dass die folgenden Features als experimentell gelten und " "sich in naher Zukunft ändern können." #. Tag: para +#: persistent_classes.xml:253 #, fuzzy, no-c-format msgid "" "Persistent entities do not necessarily have to be represented as POJO " @@ -690,12 +985,13 @@ msgstr "" "Klassen, sondern nur Mapping-Dateien." #. Tag: para +#: persistent_classes.xml:259 #, fuzzy, no-c-format msgid "" "By default, Hibernate works in normal POJO mode. You can set a default " "entity representation mode for a particular SessionFactory using the default_entity_mode configuration " -"option (see )." +"option (see )." msgstr "" "In der Standardeinstellung arbeitet Hibernate im regulären POJO-Modus. Sie " "können einen Standard-Entity-Repräsentationsmodus für eine bestimmte " @@ -704,6 +1000,7 @@ msgstr "" "(siehe )." #. Tag: para +#: persistent_classes.xml:265 #, fuzzy, no-c-format msgid "" "The following examples demonstrate the representation using Mapentity-name anstelle von (oder zusätzlich zu) einem " "Klassennamen deklariert werden:" +#. Tag: programlisting +#: persistent_classes.xml:270 +#, fuzzy, no-c-format +msgid "" +"<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 "" +"<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>" + #. Tag: para +#: persistent_classes.xml:272 #, fuzzy, no-c-format msgid "" "Even though associations are declared using target class names, the target " @@ -726,6 +1096,7 @@ msgstr "" "Klassennamen deklariert werden." #. Tag: para +#: persistent_classes.xml:276 #, fuzzy, no-c-format msgid "" "After setting the default entity mode to dynamic-map for " @@ -736,7 +1107,55 @@ msgstr "" "für die SessionFactory gesetzt ist, können wir zur " "Runtime mit Maps von Maps arbeiten:" +#. Tag: programlisting +#: persistent_classes.xml:281 +#, fuzzy, no-c-format +msgid "" +"Session s = openSession();\n" +"Transaction tx = s.beginTransaction();\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 "" +"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();" + #. Tag: para +#: persistent_classes.xml:283 #, fuzzy, no-c-format msgid "" "One of the main advantages of dynamic mapping is quick turnaround time for " @@ -756,6 +1175,7 @@ msgstr "" "Modells später problemlos hinzugefügt werden kann." #. Tag: para +#: persistent_classes.xml:290 #, no-c-format msgid "" "Entity representation modes can also be set on a per SessionSession-Basis eingestellt werden:" +#. Tag: programlisting +#: persistent_classes.xml:293 +#, fuzzy, no-c-format +msgid "" +"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" +msgstr "" +"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" + #. Tag: para +#: persistent_classes.xml:295 #, fuzzy, no-c-format msgid "" "Please note that the call to getSession() using an " @@ -786,31 +1235,35 @@ msgstr "" "Transaktion und Verbindung der primären Arbeitseinheit überlassen können." #. Tag: para +#: persistent_classes.xml:304 #, fuzzy, no-c-format msgid "" "More information about the XML representation capabilities can be found in " -"." +"." msgstr "" "Weitere Informationen zum Leistungsvermögen der XML-Repräsentation finden " "Sie unter ." #. Tag: title +#: persistent_classes.xml:310 #, no-c-format msgid "Tuplizers" msgstr "Tuplizer" #. Tag: para +#: persistent_classes.xml:312 #, fuzzy, no-c-format msgid "" -"org.hibernate.tuple.Tuplizer, and its sub-interfaces, are " -"responsible for managing a particular representation of a piece of data " -"given that representation's org.hibernate.EntityMode. If " -"a given piece of data is thought of as a data structure, then a tuplizer is " -"the thing that 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 corresponding tuplizer knows how create the POJO " -"through its constructor. It also knows how to access the POJO properties " -"using the defined property accessors." +"org.hibernate.tuple.Tuplizer and its sub-" +"interfaces are responsible for managing a particular representation of a " +"piece of data given that representation's org.hibernate." +"EntityMode. If a given piece of data is thought of as a data " +"structure, then a tuplizer is the thing that knows how to create such a data " +"structure, how to extract values from such a data structure and how to " +"inject values into such a data structure. For example, for the POJO entity " +"mode, the corresponding tuplizer knows how create the POJO through its " +"constructor. It also knows how to access the POJO properties using the " +"defined property accessors." msgstr "" "org.hibernate.tuple.Tuplizer und seine untergeordneten " "Schnittstellen sind angesichts des org.hibernate.EntityModeorg." -"hibernate.tuple.entity.EntityTuplizer and org.hibernate." -"tuple.component.ComponentTuplizer interfaces. " -"EntityTuplizers are responsible for managing the above " -"mentioned contracts in regards to entities, while " -"ComponentTuplizers do the same for components." +msgid "There are two (high-level) types of Tuplizers:" msgstr "" #. Tag: para +#: persistent_classes.xml:326 +#, no-c-format +msgid "" +"org.hibernate.tuple.entity.EntityTuplizer " +"which is responsible for managing the above mentioned contracts in regards " +"to entities" +msgstr "" + +#. Tag: para +#: persistent_classes.xml:332 +#, no-c-format +msgid "" +"org.hibernate.tuple.component.ComponentTuplizer which does the same for components" +msgstr "" + +#. Tag: para +#: persistent_classes.xml:340 #, fuzzy, no-c-format msgid "" -"Users can also plug in their own tuplizers. Perhaps you require that a " -"java.util.Map implementation other than java." -"util.HashMap 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. Tuplizer definitions are attached to the entity or component " -"mapping they are meant to manage. Going back to the example of our customer " -"entity:" +"Users can also plug in their own tuplizers. Perhaps you require that " +"java.util.Map implementation other than " +"java.util.HashMap 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. Tuplizer definitions are attached to the " +"entity or component mapping they are meant to manage. Going back to the " +"example of our Customer entity, shows how to specify a custom " +"org.hibernate.tuple.entity.EntityTuplizer " +"using annotations while shows how to do the same in hbm.xml" msgstr "" "Benutzer können auch ihre eigenen Tuplizer einbinden. Es ist möglich, dass " "Sie während des \"dynamic-map\" Entity-Modus eine andere Implementierung von " @@ -863,29 +1333,217 @@ msgstr "" "Entity an:" #. Tag: title +#: persistent_classes.xml:353 +#, no-c-format +msgid "Specify custom tuplizers in annotations" +msgstr "" + +#. Tag: programlisting +#: persistent_classes.xml:354 +#, no-c-format +msgid "" +"@Entity\n" +"@Tuplizer(impl = DynamicEntityTuplizer.class)\n" +"public interface Cuisine {\n" +" @Id\n" +" @GeneratedValue\n" +" public Long getId();\n" +" public void setId(Long id);\n" +"\n" +" public String getName();\n" +" public void setName(String name);\n" +"\n" +" @Tuplizer(impl = DynamicComponentTuplizer.class)\n" +" public Country getCountry();\n" +" public void setCountry(Country country);\n" +"}" +msgstr "" + +#. Tag: title +#: persistent_classes.xml:357 +#, no-c-format +msgid "Specify custom tuplizers in hbm.xml" +msgstr "" + +#. Tag: programlisting +#: persistent_classes.xml:358 +#, no-c-format +msgid "" +"<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>" +msgstr "" + +#. Tag: title +#: persistent_classes.xml:363 #, fuzzy, no-c-format msgid "EntityNameResolvers" msgstr "EntityResolver" #. Tag: para +#: persistent_classes.xml:365 #, no-c-format msgid "" -"The org.hibernate.EntityNameResolver " -"interface is a contract for resolving the entity name of a given entity " -"instance. The interface defines a single method " -"resolveEntityName which is passed the entity " -"instance and is expected to return the appropriate entity name (null is " -"allowed and would indicate that the resolver does not know how to resolve " -"the entity name of the given entity instance). Generally speaking, an " -"org.hibernate.EntityNameResolver is going to " -"be most useful in the case of dynamic models. One example might be using " -"proxied interfaces as your domain model. The hibernate test suite has an " -"example of this exact style of usage under the org.hibernate.test." -"dynamicentity.tuplizer2. Here is some of the code from that " -"package for illustration." +"org.hibernate.EntityNameResolver is a " +"contract for resolving the entity name of a given entity instance. The " +"interface defines a single method resolveEntityName " +"which is passed the entity instance and is expected to return the " +"appropriate entity name (null is allowed and would indicate that the " +"resolver does not know how to resolve the entity name of the given entity " +"instance). Generally speaking, an org.hibernate." +"EntityNameResolver is going to be most useful in the case of " +"dynamic models. One example might be using proxied interfaces as your domain " +"model. The hibernate test suite has an example of this exact style of usage " +"under the org.hibernate.test.dynamicentity.tuplizer2. " +"Here is some of the code from that package for illustration." +msgstr "" + +#. Tag: programlisting +#: persistent_classes.xml:377 +#, no-c-format +msgid "" +"/**\n" +" * A very trivial JDK Proxy InvocationHandler implementation where we proxy " +"an\n" +" * interface as the domain model and simply store persistent state in an " +"internal\n" +" * Map. This is an extremely trivial example meant only for illustration.\n" +" */\n" +"public final class DataProxyHandler implements InvocationHandler {\n" +" private String entityName;\n" +" private HashMap data = new HashMap();\n" +"\n" +" public DataProxyHandler(String entityName, Serializable id) {\n" +" this.entityName = entityName;\n" +" data.put( \"Id\", id );\n" +" }\n" +"\n" +" public Object invoke(Object proxy, Method method, Object[] args) " +"throws Throwable {\n" +" String methodName = method.getName();\n" +" if ( methodName.startsWith( \"set\" ) ) {\n" +" String propertyName = methodName.substring( 3 );\n" +" data.put( propertyName, args[0] );\n" +" }\n" +" else if ( methodName.startsWith( \"get\" ) ) {\n" +" String propertyName = methodName.substring( 3 );\n" +" return data.get( propertyName );\n" +" }\n" +" else if ( \"toString\".equals( methodName ) ) {\n" +" return entityName + \"#\" + data.get( \"Id\" );\n" +" }\n" +" else if ( \"hashCode\".equals( methodName ) ) {\n" +" return new Integer( this.hashCode() );\n" +" }\n" +" return null;\n" +" }\n" +"\n" +" public String getEntityName() {\n" +" return entityName;\n" +" }\n" +"\n" +" public HashMap getData() {\n" +" return data;\n" +" }\n" +"}\n" +"\n" +"public class ProxyHelper {\n" +" public static String extractEntityName(Object object) {\n" +" // Our custom java.lang.reflect.Proxy instances actually bundle\n" +" // their appropriate entity name, so we simply extract it from " +"there\n" +" // if this represents one of our proxies; otherwise, we return null\n" +" if ( Proxy.isProxyClass( object.getClass() ) ) {\n" +" InvocationHandler handler = Proxy.getInvocationHandler" +"( object );\n" +" if ( DataProxyHandler.class.isAssignableFrom( handler.getClass" +"() ) ) {\n" +" DataProxyHandler myHandler = ( DataProxyHandler ) handler;\n" +" return myHandler.getEntityName();\n" +" }\n" +" }\n" +" return null;\n" +" }\n" +"\n" +" // various other utility methods ....\n" +"\n" +"}\n" +"\n" +"/**\n" +" * The EntityNameResolver implementation.\n" +" *\n" +" * IMPL NOTE : An EntityNameResolver really defines a strategy for how " +"entity names\n" +" * should be resolved. Since this particular impl can handle resolution for " +"all of our\n" +" * entities we want to take advantage of the fact that SessionFactoryImpl " +"keeps these\n" +" * in a Set so that we only ever have one instance registered. Why? Well, " +"when it\n" +" * comes time to resolve an entity name, Hibernate must iterate over all the " +"registered\n" +" * resolvers. So keeping that number down helps that process be as speedy " +"as possible.\n" +" * Hence the equals and hashCode implementations as is\n" +" */\n" +"public class MyEntityNameResolver implements EntityNameResolver {\n" +" public static final MyEntityNameResolver INSTANCE = new " +"MyEntityNameResolver();\n" +"\n" +" public String resolveEntityName(Object entity) {\n" +" return ProxyHelper.extractEntityName( entity );\n" +" }\n" +"\n" +" public boolean equals(Object obj) {\n" +" return getClass().equals( obj.getClass() );\n" +" }\n" +"\n" +" public int hashCode() {\n" +" return getClass().hashCode();\n" +" }\n" +"}\n" +"\n" +"public class MyEntityTuplizer extends PojoEntityTuplizer {\n" +" public MyEntityTuplizer(EntityMetamodel entityMetamodel, " +"PersistentClass mappedEntity) {\n" +" super( entityMetamodel, mappedEntity );\n" +" }\n" +"\n" +" public EntityNameResolver[] getEntityNameResolvers() {\n" +" return new EntityNameResolver[] { MyEntityNameResolver." +"INSTANCE };\n" +" }\n" +"\n" +" public String determineConcreteSubclassEntityName(Object entityInstance, " +"SessionFactoryImplementor factory) {\n" +" String entityName = ProxyHelper.extractEntityName" +"( entityInstance );\n" +" if ( entityName == null ) {\n" +" entityName = super.determineConcreteSubclassEntityName" +"( entityInstance, factory );\n" +" }\n" +" return entityName;\n" +" }\n" +"\n" +" ..." msgstr "" #. Tag: para +#: persistent_classes.xml:379 #, no-c-format msgid "" "In order to register an org.hibernate.EntityNameResolverTuplizer, implementing the getEntityNameResolvers " -"method." +"Implement a custom tuplizer (see ), implementing the getEntityNameResolvers " +"method" msgstr "" #. Tag: para +#: persistent_classes.xml:389 #, no-c-format msgid "" "Register it with the org.hibernate.impl.SessionFactoryImpl" +#~ "Most Java applications require a persistent class representing felines. " +#~ "For example:" #~ msgstr "" -#~ "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" -#~ "}" +#~ "Die meisten Java-Anwendungen erfordern eine persistente Klasse, die " +#~ "Katzen (\"felines\") repräsentiert." #, fuzzy #~ msgid "" -#~ "" +#~ "Cat has a property called id. 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, java.lang." +#~ "String or java.util.Date. If your legacy " +#~ "database table has composite keys, you can use a user-defined class with " +#~ "properties of these types (see the section on composite identifiers later " +#~ "in the chapter.)" #~ msgstr "" -#~ "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" -#~ "}" +#~ "Cat besitzt eine Property mit Namen id. Diese Property mappt zur Spalte des Primärschlüssels der " +#~ "Datenbanktabelle. Die Property könnte auch einen beliebigen Namen tragen " +#~ "und könnte irgendeinen primitiven Typ besitzen, etwa einen primitiven " +#~ "\"Wrapper\"-Typ, java.lang.String oder java." +#~ "util.Date. (Falls Ihre Legacy-Datenbanktabelle zusammengesetzte " +#~ "Schlüssel besitzt, können Sie sogar eine benutzerdefinierte Klasse mit " +#~ "Properties dieser Typen verwenden - wir gehen in einem späteren Abschnitt " +#~ "auf zusammengesetzte Bezeichner ein)." + +#~ 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 "" +#~ "Die Bezeichner-Property ist völlig optional. Sie können sie ausgeschaltet " +#~ "lassen und Hibernate verfolgt die Objektbezeichner intern. Allerdings " +#~ "empfehlen wir diese Einstellung nicht." #, fuzzy #~ msgid "" -#~ "" +#~ "In fact, some functionality is available only to classes that declare an " +#~ "identifier property:" #~ msgstr "" -#~ "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" -#~ "}" +#~ "Tatsächlich sind einige Funktionalitäten nur für Klassen mit deklarierter " +#~ "Bezeichner-Property verfügbar:" #, fuzzy #~ msgid "" -#~ "\n" -#~ "\n" -#~ " \n" -#~ "\n" -#~ " \n" -#~ " \n" -#~ " \n" -#~ "\n" -#~ " \n" -#~ "\n" -#~ " \n" -#~ "\n" -#~ " \n" -#~ "\n" -#~ " \n" -#~ " \n" -#~ " \n" -#~ " \n" -#~ "\n" -#~ " \n" -#~ " \n" -#~ "]]>" +#~ "Transitive reattachment for detached objects (cascade update or cascade " +#~ "merge) - see " #~ msgstr "" -#~ "<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>" +#~ "Transitives Reattachment für abgesetzte Objekte (in Reihe erfolgende " +#~ "Aktualisierung oder in Reihe erfolgendes Zusammenfügen (auch: \"Cascade " +#~ "Update\" bzw. \"Cascade Merge\") - siehe" + +#, fuzzy +#~ msgid "Session.saveOrUpdate()" +#~ msgstr "Session.saveOrUpdate()" + +#, fuzzy +#~ msgid "Session.merge()" +#~ msgstr "Session.merge()" + +#~ msgid "" +#~ "A central feature of Hibernate, proxies, depends " +#~ "upon the persistent class being either non-final, or the implementation " +#~ "of an interface that declares all public methods." +#~ msgstr "" +#~ "Ein zentrales Feature von Hibernate, Proxies, hängt " +#~ "davon ab, ob die persistente Klasse entweder nicht-final oder der alle " +#~ "Methoden als öffentlich erklärenden Implemetierung eines Interface." #, fuzzy #~ msgid "" -#~ "" +#~ "You can persist final classes that do not implement an " +#~ "interface with Hibernate. You will not, however, be able to use proxies " +#~ "for lazy association fetching which will ultimately limit your options " +#~ "for performance tuning." #~ msgstr "" -#~ "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();" - -#, fuzzy -#~ msgid "" -#~ "" -#~ msgstr "" -#~ "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" +#~ "Sie können finale Klassen, die kein Interface mit " +#~ "Hibernate implementieren, persistieren, aber Sie werden keine Proxies für " +#~ "das \"Lazy Fetching\" von Assoziationen (d.h. das Nachladen assoziierter " +#~ "Objekte bei Bedarf) verwenden können - was Ihre Optionen bei der " +#~ "Feinabstimmung der Performance einschränkt." #, fuzzy #~ msgid "" diff --git a/documentation/manual/src/main/docbook/de-DE/content/preface.po b/documentation/manual/src/main/docbook/de-DE/content/preface.po index b515afa126..5fab7e24f1 100644 --- a/documentation/manual/src/main/docbook/de-DE/content/preface.po +++ b/documentation/manual/src/main/docbook/de-DE/content/preface.po @@ -1,10 +1,11 @@ -# +# # AUTHOR , YEAR. # msgid "" msgstr "" "Project-Id-Version: 0\n" -"POT-Creation-Date: 2010-02-11T05:38:15\n" +"Report-Msgid-Bugs-To: http://bugs.kde.org\n" +"POT-Creation-Date: 2010-07-20 21:02+0000\n" "PO-Revision-Date: 2010-02-11T05:38:15\n" "Last-Translator: Automatically generated\n" "Language-Team: None\n" @@ -13,13 +14,24 @@ msgstr "" "Content-Transfer-Encoding: 8bit\n" #. Tag: title +#: preface.xml:33 #, no-c-format msgid "Preface" msgstr "Vorwort" #. Tag: para -#, 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." +#: preface.xml:35 +#, fuzzy, no-c-format +msgid "" +"Working with both Object-Oriented software and Relational Databases can be " +"cumbersome and time consuming. Development costs are significantly higher " +"due to a paradigm mismatch between how data is represented in objects versus " +"relational databases. Hibernate is an Object/Relational Mapping solution for " +"Java environments. The term Object/Relational Mapping refers to the " +"technique of mapping a data representation from an object model to a " +"relational data model with a SQL-based schema; see http://en.wikipedia.org/wiki/" +"Object-relational_mapping for a discussion." msgstr "" "Die Arbeit mit objektorientierter Software und einer relationalen Datenbank " "kann sich in Unternehmensumgebungen heutzutage als mühsam und zeitaufwendig " @@ -29,8 +41,36 @@ msgstr "" "Objektmodell zu einem relationalen Datenmodell mit SQL-basiertem Schema." #. Tag: para +#: preface.xml:46 +#, no-c-format +msgid "" +"While having a strong background in SQL is not required to use Hibernate, " +"having a basic understanding of the concepts can greatly help you understand " +"Hibernate more fully and quickly. Probably the single best background is an " +"understanding of data modeling principles. You might want to consider these " +"resources as a good starting point:" +msgstr "" + +#. Tag: ulink +#: preface.xml:54 +#, no-c-format +msgid "http://www.agiledata.org/essays/dataModeling101.html" +msgstr "" + +#. Tag: ulink +#: preface.xml:59 +#, no-c-format +msgid "http://en.wikipedia.org/wiki/Data_modeling" +msgstr "" + +#. Tag: para +#: preface.xml:66 #, fuzzy, 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. It can also significantly reduce development time otherwise spent with manual data handling in SQL and JDBC." +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. It can also significantly reduce development " +"time otherwise spent with manual data handling in SQL and JDBC." msgstr "" "Hibernate besorgt nicht nur das Mapping von Java-Klassen zu " "Datenbanktabellen (und von Java-Datentypen zu SQL-Datentypen ), sondern " @@ -39,8 +79,28 @@ msgstr "" "Datenbearbeitung in SQL und JDBC entfällt." #. Tag: para +#: preface.xml:72 +#, no-c-format +msgid "" +"Hibernate’s design goal is to relieve the developer from 95% of common data " +"persistence-related programming tasks by eliminating the need for manual, " +"hand-crafted data processing using SQL and JDBC. However, unlike many other " +"persistence solutions, Hibernate does not hide the power of SQL from you and " +"guarantees that your investment in relational technology and knowledge is as " +"valid as always." +msgstr "" + +#. Tag: para +#: preface.xml:79 #, fuzzy, no-c-format -msgid "Hibernate's 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." +msgid "" +"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 "" "Hibernate will dem Entwickler 95 Prozent der mit gängiger Datenpersistenz " "verbundenen Programmierarbeit abnehmen. Hibernate ist möglicherweise nicht " @@ -54,30 +114,47 @@ msgstr "" "Repräsentation in ein Objektdiagramm." #. Tag: para +#: preface.xml:88 #, no-c-format -msgid "If you are new to Hibernate and Object/Relational Mapping or even Java, please follow these steps:" +msgid "" +"If you are new to Hibernate and Object/Relational Mapping or even Java, " +"please follow these steps:" msgstr "" "Falls Ihnen Hibernate und Objekt/Relationales Mapping oder sogar Java neu " "sind, orientieren Sie sich bitte an folgenden Schritten:" #. Tag: para +#: preface.xml:95 #, fuzzy, no-c-format -msgid "Read for a tutorial with step-by-step instructions. The source code for the tutorial is included in the distribution in the doc/reference/tutorial/ directory." +msgid "" +"Read for a tutorial with step-by-step " +"instructions. The source code for the tutorial is included in the " +"distribution in the doc/reference/tutorial/ directory." msgstr "" "Lesen Sie für eine schrittweise Anleitung. Der " "Quellcode der Anleitung ist Teil der Distrubution im doc/reference/" "tutorial/-Verzeichnis." #. Tag: para -#, no-c-format -msgid "Read to understand the environments where Hibernate can be used." +#: preface.xml:103 +#, fuzzy, no-c-format +msgid "" +"Read to understand the environments where " +"Hibernate can be used." msgstr "" "Lesen Sie , um mehr über die Umgebungen zu " "erfahren, in denen Hibernate eingesetzt werden kann." #. Tag: para +#: preface.xml:109 #, fuzzy, no-c-format -msgid "View the eg/ directory in the Hibernate distribution. It contains a simple standalone application. Copy your JDBC driver to the lib/ directory and edit etc/hibernate.properties, specifying correct values for your database. From a command prompt in the distribution directory, type ant eg (using Ant), or under Windows, type build eg." +msgid "" +"View the eg/ directory in the Hibernate distribution. It " +"contains a simple standalone application. Copy your JDBC driver to the " +"lib/ directory and edit etc/hibernate." +"properties, specifying correct values for your database. From a " +"command prompt in the distribution directory, type ant eg " +"(using Ant), or under Windows, type build eg." msgstr "" "Schauen Sie sich das eg/-Verzeichnis in der Hibernate " "Distribution an, es enthält eine einfache, selbständige Anwendung. Kopieren " @@ -88,8 +165,15 @@ msgstr "" "Verwendung von Ant) oder in Windows tippen Sie build eg." #. Tag: para +#: preface.xml:120 #, fuzzy, no-c-format -msgid "Use this reference documentation as your primary source of information. Consider reading if you need more help with application design, or if you prefer a step-by-step tutorial. Also visit and download the example application from ." +msgid "" +"Use this reference documentation as your primary source of information. " +"Consider reading if you need " +"more help with application design, or if you prefer a step-by-step tutorial. " +"Also visit and " +"download the example application from ." msgstr "" "Verwenden Sie diese Referenzdokumentation als Ihre primäre " "Informationsquelle. Weitere Informationen finden Sie außerdem unter " @@ -100,6 +184,7 @@ msgstr "" "org." #. Tag: para +#: preface.xml:130 #, no-c-format msgid "FAQs are answered on the Hibernate website." msgstr "" @@ -107,15 +192,22 @@ msgstr "" "Hibernate." #. Tag: para +#: preface.xml:135 #, no-c-format -msgid "Links to third party demos, examples, and tutorials are maintained on the Hibernate website." +msgid "" +"Links to third party demos, examples, and tutorials are maintained on the " +"Hibernate website." msgstr "" "Auf der Hibernate Website befinden sich auch Demos, Beispiele und " "Anleitungen Dritter." #. Tag: para +#: preface.xml:141 #, 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.)." +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 "" "Bei Fragen wenden Sie sich an das Benutzerforum, das mit der Hibernate " "Website verlinkt ist. Wir bieten auch ein JIRA-Problemverfolgungssystem für " @@ -126,12 +218,64 @@ msgstr "" "Verbindung." #. Tag: para -#, fuzzy, no-c-format -msgid "If you have questions, use the user forum linked on the Hibernate website. We also provide a JIRA issue tracking 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." +#: preface.xml:149 +#, no-c-format +msgid "" +"There are a number of ways to become involved in the Hibernate community, " +"including" msgstr "" #. Tag: para +#: preface.xml:153 #, 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." +msgid "" +"Trying stuff out and reporting bugs. See http://hibernate.org/issuetracker.html details." msgstr "" +#. Tag: para +#: preface.xml:160 +#, no-c-format +msgid "" +"Trying your hand at fixing some bugs or implementing enhancements. Again, " +"see http://hibernate." +"org/issuetracker.html details." +msgstr "" + +#. Tag: para +#: preface.xml:167 +#, no-c-format +msgid "" +"http://hibernate.org/" +"community.html list a few ways to engage in the community." +msgstr "" + +#. Tag: para +#: preface.xml:172 +#, no-c-format +msgid "" +"There are forums for users to ask questions and receive help from the " +"community." +msgstr "" + +#. Tag: para +#: preface.xml:177 +#, no-c-format +msgid "" +"There are also IRC channels for both user and developer discussions." +msgstr "" + +#. Tag: para +#: preface.xml:186 +#, no-c-format +msgid "" +"Helping improve or translate this documentation. Contact us on the developer " +"mailing list if you have interest." +msgstr "" + +#. Tag: para +#: preface.xml:192 +#, no-c-format +msgid "Evangelizing Hibernate within your organization." +msgstr "" diff --git a/documentation/manual/src/main/docbook/de-DE/content/query_sql.po b/documentation/manual/src/main/docbook/de-DE/content/query_sql.po index aa4c3ace29..10ff7c8ee4 100644 --- a/documentation/manual/src/main/docbook/de-DE/content/query_sql.po +++ b/documentation/manual/src/main/docbook/de-DE/content/query_sql.po @@ -275,7 +275,7 @@ msgid "" msgstr "" "Project-Id-Version: Collection_Mapping\n" "Report-Msgid-Bugs-To: http://bugs.kde.org\n" -"POT-Creation-Date: 2010-02-11T05:38:15\n" +"POT-Creation-Date: 2010-07-20 21:02+0000\n" "PO-Revision-Date: 2007-02-26 10:27+1000\n" "Last-Translator: \n" "Language-Team: \n" @@ -285,11 +285,13 @@ msgstr "" "X-Generator: KBabel 1.9.1\n" #. Tag: title +#: query_sql.xml:31 #, no-c-format msgid "Native SQL" msgstr "Native SQL" #. Tag: para +#: query_sql.xml:33 #, fuzzy, no-c-format msgid "" "You can also express queries in the native SQL dialect of your database. " @@ -305,6 +307,7 @@ msgstr "" "direkten, auf SQL/JDBC basierenden Anwendung zu Hibernate zur Verfügung." #. Tag: para +#: query_sql.xml:39 #, fuzzy, no-c-format msgid "" "Hibernate3 allows you to specify handwritten SQL, including stored " @@ -315,11 +318,13 @@ msgstr "" "festlegen." #. Tag: title +#: query_sql.xml:43 #, fuzzy, no-c-format msgid "Using a SQLQuery" msgstr "oder als eine List," #. Tag: para +#: query_sql.xml:45 #, fuzzy, no-c-format msgid "" "Execution of native SQL queries is controlled via the SQLQueryResultSetMetadata, or " @@ -367,22 +386,40 @@ msgstr "" "vermeiden oder einfach expliziter zu sein, können Sie addScalar() verwenden." +#. Tag: programlisting +#: query_sql.xml:67 +#, fuzzy, no-c-format +msgid "" +"sess.createSQLQuery(\"SELECT * FROM CATS\")\n" +" .addScalar(\"ID\", Hibernate.LONG)\n" +" .addScalar(\"NAME\", Hibernate.STRING)\n" +" .addScalar(\"BIRTHDATE\", Hibernate.DATE)" +msgstr "" +"sess.createSQLQuery(\"SELECT * FROM CATS\")\n" +" .addScalar(\"ID\", Hibernate.LONG)\n" +" .addScalar(\"NAME\", Hibernate.STRING)\n" +" .addScalar(\"BIRTHDATE\", Hibernate.DATE)" + #. Tag: para +#: query_sql.xml:69 query_sql.xml:116 query_sql.xml:197 query_sql.xml:349 #, no-c-format msgid "This query specified:" msgstr "Diese Anfrage spezifiziert:" #. Tag: para +#: query_sql.xml:73 query_sql.xml:120 query_sql.xml:353 #, no-c-format msgid "the SQL query string" msgstr "den SQL-Anfragen-String" #. Tag: para +#: query_sql.xml:77 #, no-c-format msgid "the columns and types to return" msgstr "die wiederzugebenden Spalten und Typen" #. Tag: para +#: query_sql.xml:81 #, fuzzy, no-c-format msgid "" "This will return Object arrays, but now it will not use " @@ -401,6 +438,7 @@ msgstr "" "wiedergeben könnte." #. Tag: para +#: query_sql.xml:89 #, no-c-format msgid "" "It is possible to leave out the type information for all or some of the " @@ -409,7 +447,22 @@ msgstr "" "Es ist möglich, die Typeninformationen für alle oder einige der Skalare " "auszulassen." +#. Tag: programlisting +#: query_sql.xml:92 +#, fuzzy, no-c-format +msgid "" +"sess.createSQLQuery(\"SELECT * FROM CATS\")\n" +" .addScalar(\"ID\", Hibernate.LONG)\n" +" .addScalar(\"NAME\")\n" +" .addScalar(\"BIRTHDATE\")" +msgstr "" +"sess.createSQLQuery(\"SELECT * FROM CATS\")\n" +" .addScalar(\"ID\", Hibernate.LONG)\n" +" .addScalar(\"NAME\")\n" +" .addScalar(\"BIRTHDATE\")" + #. Tag: para +#: query_sql.xml:94 #, fuzzy, no-c-format msgid "" "This is essentially the same query as before, but now " @@ -422,6 +475,7 @@ msgstr "" "wird." #. Tag: para +#: query_sql.xml:99 #, fuzzy, no-c-format msgid "" "How the java.sql.Types returned from ResultSetMetaData is mapped to " @@ -436,11 +490,13 @@ msgstr "" "Dialekt anzupassen." #. Tag: title +#: query_sql.xml:107 #, no-c-format msgid "Entity queries" msgstr "Entity-Anfragen" #. Tag: para +#: query_sql.xml:109 #, no-c-format msgid "" "The above queries were all about returning scalar values, basically " @@ -453,12 +509,26 @@ msgstr "" "Sie, wie Sie Entity-Objekte von einer nativen SQL-Anfrage mittels " "addEntity() erhalten." +#. Tag: programlisting +#: query_sql.xml:114 +#, fuzzy, no-c-format +msgid "" +"sess.createSQLQuery(\"SELECT * FROM CATS\").addEntity(Cat.class);\n" +"sess.createSQLQuery(\"SELECT ID, NAME, BIRTHDATE FROM CATS\").addEntity(Cat." +"class);" +msgstr "" +"sess.createSQLQuery(\"SELECT * FROM CATS\").addEntity(Cat.class);\n" +"sess.createSQLQuery(\"SELECT ID, NAME, BIRTHDATE FROM CATS\").addEntity(Cat." +"class);" + #. Tag: para +#: query_sql.xml:124 #, no-c-format msgid "the entity returned by the query" msgstr "die von der Anfrage wiedergegebene Entity" #. Tag: para +#: query_sql.xml:128 #, no-c-format msgid "" "Assuming that Cat is mapped as a class with the columns ID, NAME and " @@ -470,6 +540,7 @@ msgstr "" "antworten, in der jedes Element eine Entity von Cat ist." #. Tag: para +#: query_sql.xml:132 #, no-c-format msgid "" "If the entity is mapped with a many-to-one to another " @@ -487,17 +558,30 @@ msgstr "" "wie im folgenden Beispiel für eine many-to-one zu " "Dog wollen wir lieber explizit sein:" +#. Tag: programlisting +#: query_sql.xml:140 +#, fuzzy, no-c-format +msgid "" +"sess.createSQLQuery(\"SELECT ID, NAME, BIRTHDATE, DOG_ID FROM CATS\")." +"addEntity(Cat.class);" +msgstr "" +"sess.createSQLQuery(\"SELECT ID, NAME, BIRTHDATE, DOG_ID FROM CATS\")." +"addEntity(Cat.class);" + #. Tag: para +#: query_sql.xml:142 #, no-c-format msgid "This will allow cat.getDog() to function properly." msgstr "Dies ermöglicht die ordnungsgemäße Funktion von cat.getDog()." #. Tag: title +#: query_sql.xml:146 #, no-c-format msgid "Handling associations and collections" msgstr "Umgang mit Assoziationen und Collections" #. Tag: para +#: query_sql.xml:148 #, no-c-format msgid "" "It is possible to eagerly join in the Dog to avoid the " @@ -510,7 +594,23 @@ msgstr "" "geschieht mittels der addJoin()-Methode, die es Ihnen " "ermöglicht, eine Assoziation oder Collection zu verbinden." +#. Tag: programlisting +#: query_sql.xml:153 +#, fuzzy, no-c-format +msgid "" +"sess.createSQLQuery(\"SELECT c.ID, NAME, BIRTHDATE, DOG_ID, D_ID, D_NAME " +"FROM CATS c, DOGS d WHERE c.DOG_ID = d.D_ID\")\n" +" .addEntity(\"cat\", Cat.class)\n" +" .addJoin(\"cat.dog\");" +msgstr "" +"sess.createSQLQuery(\"SELECT c.ID, NAME, BIRTHDATE, DOG_ID, D_ID, D_NAME " +"FROM CATS c, DOGS d \n" +" WHERE c.DOG_ID = d.D_ID\")\n" +" .addEntity(\"cat\", Cat.class)\n" +" .addJoin(\"cat.dog\");" + #. Tag: para +#: query_sql.xml:155 #, fuzzy, no-c-format msgid "" "In this example, the returned Cat's will have their " @@ -528,7 +628,23 @@ msgstr "" "von Collections zu tun, z.B. wenn Cat satt dessen eine " "\"One-to-many\" zu Dog hätte." +#. Tag: programlisting +#: query_sql.xml:163 +#, fuzzy, no-c-format +msgid "" +"sess.createSQLQuery(\"SELECT ID, NAME, BIRTHDATE, D_ID, D_NAME, CAT_ID FROM " +"CATS c, DOGS d WHERE c.ID = d.CAT_ID\")\n" +" .addEntity(\"cat\", Cat.class)\n" +" .addJoin(\"cat.dogs\");" +msgstr "" +"sess.createSQLQuery(\"SELECT ID, NAME, BIRTHDATE, D_ID, D_NAME, CAT_ID FROM " +"CATS c, DOGS d\n" +" WHERE c.ID = d.CAT_ID\")\n" +" .addEntity(\"cat\", Cat.class)\n" +" .addJoin(\"cat.dogs\");" + #. Tag: para +#: query_sql.xml:165 #, fuzzy, no-c-format msgid "" "At this stage you are reaching the limits of what is possible with native " @@ -543,11 +659,13 @@ msgstr "" "Alias-/Spaltennamen nicht ausreichen." #. Tag: title +#: query_sql.xml:173 #, no-c-format msgid "Returning multiple entities" msgstr "Wiedergabe mehrerer Entities" #. Tag: para +#: query_sql.xml:175 #, fuzzy, no-c-format msgid "" "Until now, the result set column names are assumed to be the same as the " @@ -561,6 +679,7 @@ msgstr "" "dieselben Spaltennamen stets in mehr als einer Tabelle vorkommen." #. Tag: para +#: query_sql.xml:180 #, no-c-format msgid "" "Column alias injection is needed in the following query (which most likely " @@ -569,7 +688,22 @@ msgstr "" "Spalten Alias-Einspeisung wird bei der folgenden Anfrage benötigt (die aller " "Wahrscheinlichkeit nach fehlschlagen wird):" +#. Tag: programlisting +#: query_sql.xml:183 +#, fuzzy, no-c-format +msgid "" +"sess.createSQLQuery(\"SELECT c.*, m.* FROM CATS c, CATS m WHERE c.MOTHER_ID " +"= c.ID\")\n" +" .addEntity(\"cat\", Cat.class)\n" +" .addEntity(\"mother\", Cat.class)" +msgstr "" +"sess.createSQLQuery(\"SELECT c.*, m.* FROM CATS c, CATS m WHERE c.MOTHER_ID " +"= c.ID\")\n" +" .addEntity(\"cat\", Cat.class)\n" +" .addEntity(\"mother\", Cat.class)" + #. Tag: para +#: query_sql.xml:185 #, fuzzy, no-c-format msgid "" "The query was intended to return two Cat instances per row: a cat and its " @@ -588,12 +722,28 @@ msgstr "" "Spalten besitzt." #. Tag: para +#: query_sql.xml:192 #, no-c-format msgid "The following form is not vulnerable to column name duplication:" msgstr "" "Die folgende Form ist nicht anfällig für die Duplizierung von Spaltennamen:" +#. Tag: programlisting +#: query_sql.xml:195 +#, fuzzy, no-c-format +msgid "" +"sess.createSQLQuery(\"SELECT {cat.*}, {mother.*} FROM CATS c, CATS m WHERE " +"c.MOTHER_ID = c.ID\")\n" +" .addEntity(\"cat\", Cat.class)\n" +" .addEntity(\"mother\", Cat.class)" +msgstr "" +"sess.createSQLQuery(\"SELECT {cat.*}, {mother.*} FROM CATS c, CATS m WHERE " +"c.MOTHER_ID = c.ID\")\n" +" .addEntity(\"cat\", Cat.class)\n" +" .addEntity(\"mother\", Cat.class)" + #. Tag: para +#: query_sql.xml:201 #, no-c-format msgid "" "the SQL query string, with placeholders for Hibernate to inject column " @@ -603,11 +753,13 @@ msgstr "" "eingespeisten Aliasse" #. Tag: para +#: query_sql.xml:206 #, no-c-format msgid "the entities returned by the query" msgstr "die von der Anfrage erhaltenen Entities" #. Tag: para +#: query_sql.xml:210 #, fuzzy, no-c-format msgid "" "The {cat.*} and {mother.*} notation used above is a shorthand for \"all " @@ -628,12 +780,36 @@ msgstr "" "Sie, dass wir sogar die Property-Aliasse in der \"where\"-Klausel verwenden " "können, wenn wir das möchten." +#. Tag: programlisting +#: query_sql.xml:219 +#, fuzzy, no-c-format +msgid "" +"String sql = \"SELECT ID as {c.id}, NAME as {c.name}, \" +\n" +" \"BIRTHDATE as {c.birthDate}, MOTHER_ID as {c.mother}, {mother.*} " +"\" +\n" +" \"FROM CAT_LOG c, CAT_LOG m WHERE {c.mother} = c.ID\";\n" +"\n" +"List loggedCats = sess.createSQLQuery(sql)\n" +" .addEntity(\"cat\", Cat.class)\n" +" .addEntity(\"mother\", Cat.class).list()" +msgstr "" +"String sql = \"SELECT ID as {c.id}, NAME as {c.name}, \" + \n" +" \"BIRTHDATE as {c.birthDate}, MOTHER_ID as {c.mother}, {mother.*} " +"\" +\n" +" \"FROM CAT_LOG c, CAT_LOG m WHERE {c.mother} = c.ID\";\n" +"\n" +"List loggedCats = sess.createSQLQuery(sql)\n" +" .addEntity(\"cat\", Cat.class)\n" +" .addEntity(\"mother\", Cat.class).list()" + #. Tag: title +#: query_sql.xml:222 #, no-c-format msgid "Alias and property references" msgstr "Alias- und Property-Referenzen" #. Tag: para +#: query_sql.xml:224 #, fuzzy, no-c-format msgid "" "In most cases the above alias injection is needed. For queries relating to " @@ -648,6 +824,7 @@ msgstr "" "einzuspeisen." #. Tag: para +#: query_sql.xml:229 #, fuzzy, no-c-format msgid "" "The following table shows the different ways you can use the alias " @@ -661,178 +838,211 @@ msgstr "" "wahrscheinlich unterschiedlichen Namen besitzen." #. Tag: title +#: query_sql.xml:235 #, no-c-format msgid "Alias injection names" msgstr "Alias-Einspeisungsnamen" #. Tag: entry +#: query_sql.xml:246 #, no-c-format msgid "Description" msgstr "Beschreibung" #. Tag: entry +#: query_sql.xml:248 #, no-c-format msgid "Syntax" msgstr "Syntax" #. Tag: entry +#: query_sql.xml:250 #, no-c-format msgid "Example" msgstr "Beispiel" #. Tag: entry +#: query_sql.xml:256 #, no-c-format msgid "A simple property" msgstr "Eine einfache Property" -#. Tag: entry +#. Tag: literal +#: query_sql.xml:258 #, fuzzy, no-c-format -msgid "{[aliasname].[propertyname]" +msgid "{[aliasname].[propertyname]" msgstr "{[aliasname].[propertyname]" -#. Tag: entry +#. Tag: literal +#: query_sql.xml:260 #, fuzzy, no-c-format -msgid "A_NAME as {item.name}" -msgstr "oder als eine List," +msgid "A_NAME as {item.name}" +msgstr "A_NAME as {item.name}" #. Tag: entry +#: query_sql.xml:264 #, no-c-format msgid "A composite property" msgstr "Eine zusammengesetzte Property" -#. Tag: entry +#. Tag: literal +#: query_sql.xml:266 #, fuzzy, no-c-format -msgid "{[aliasname].[componentname].[propertyname]}" +msgid "{[aliasname].[componentname].[propertyname]}" msgstr "{[aliasname].[componentname].[propertyname]}" -#. Tag: entry +#. Tag: literal +#: query_sql.xml:268 #, fuzzy, no-c-format -msgid "" -"CURRENCY as {item.amount.currency}, VALUE as {item.amount.value}" +msgid "CURRENCY as {item.amount.currency}, VALUE as {item.amount.value}" msgstr "CURRENCY als {item.amount.currency}, VALUE als {item.amount.value}" #. Tag: entry +#: query_sql.xml:273 #, no-c-format msgid "Discriminator of an entity" msgstr "Diskriminator einer Entity" -#. Tag: entry +#. Tag: literal +#: query_sql.xml:275 #, fuzzy, no-c-format -msgid "{[aliasname].class}" -msgstr "oder als eine List," - -#. Tag: entry -#, fuzzy, no-c-format -msgid "DISC as {item.class}" -msgstr "oder als eine List," +msgid "{[aliasname].class}" +msgstr "{[aliasname].class}" + +#. Tag: literal +#: query_sql.xml:277 +#, fuzzy, no-c-format +msgid "DISC as {item.class}" +msgstr "DISC as {item.class}" #. Tag: entry +#: query_sql.xml:281 #, no-c-format msgid "All properties of an entity" msgstr "Alle Properties einer Entity" -#. Tag: entry +#. Tag: literal +#: query_sql.xml:283 query_sql.xml:331 #, fuzzy, no-c-format -msgid "{[aliasname].*}" -msgstr "oder als eine List," - -#. Tag: entry -#, fuzzy, no-c-format -msgid "{item.*}" -msgstr "oder als eine List," +msgid "{[aliasname].*}" +msgstr "{[aliasname].*}" + +#. Tag: literal +#: query_sql.xml:285 +#, no-c-format +msgid "{item.*}" +msgstr "{item.*}" #. Tag: entry +#: query_sql.xml:289 #, no-c-format msgid "A collection key" msgstr "Ein Collection-Schlüssel" -#. Tag: entry +#. Tag: literal +#: query_sql.xml:291 #, fuzzy, no-c-format -msgid "{[aliasname].key}" -msgstr "oder als eine List," - -#. Tag: entry -#, fuzzy, no-c-format -msgid "ORGID as {coll.key}" -msgstr "oder als eine List," +msgid "{[aliasname].key}" +msgstr "{[aliasname].key}" + +#. Tag: literal +#: query_sql.xml:293 +#, fuzzy, no-c-format +msgid "ORGID as {coll.key}" +msgstr "ORGID als {coll.key}" #. Tag: entry +#: query_sql.xml:297 #, no-c-format msgid "The id of an collection" msgstr "Die id einer Collection" -#. Tag: entry +#. Tag: literal +#: query_sql.xml:299 #, fuzzy, no-c-format -msgid "{[aliasname].id}" -msgstr "oder als eine List," - -#. Tag: entry -#, fuzzy, no-c-format -msgid "EMPID as {coll.id}" -msgstr "oder als eine List," +msgid "{[aliasname].id}" +msgstr "{[aliasname].id}" + +#. Tag: literal +#: query_sql.xml:301 +#, fuzzy, no-c-format +msgid "EMPID as {coll.id}" +msgstr "EMPID als {coll.id}" #. Tag: entry +#: query_sql.xml:305 #, no-c-format msgid "The element of an collection" msgstr "Das Element einer Collection" -#. Tag: entry +#. Tag: literal +#: query_sql.xml:307 #, fuzzy, no-c-format -msgid "{[aliasname].element}" -msgstr "{coll.element.*}" - -#. Tag: entry -#, fuzzy, no-c-format -msgid "XID as {coll.element}" -msgstr "{coll.element.*}" +msgid "{[aliasname].element}" +msgstr "{[aliasname].element}" + +#. Tag: literal +#: query_sql.xml:309 +#, fuzzy, no-c-format +msgid "XID as {coll.element}" +msgstr "XID als {coll.element}" #. Tag: entry +#: query_sql.xml:313 #, fuzzy, no-c-format msgid "property of the element in the collection" msgstr "Property des Elements in der Collection" -#. Tag: entry +#. Tag: literal +#: query_sql.xml:315 #, fuzzy, no-c-format -msgid "{[aliasname].element.[propertyname]}" +msgid "{[aliasname].element.[propertyname]}" msgstr "{[aliasname].element.[propertyname]}" -#. Tag: entry +#. Tag: literal +#: query_sql.xml:317 #, fuzzy, no-c-format -msgid "NAME as {coll.element.name}" -msgstr "{coll.element.*}" +msgid "NAME as {coll.element.name}" +msgstr "NAME als {coll.element.name}" #. Tag: entry +#: query_sql.xml:321 #, no-c-format msgid "All properties of the element in the collection" msgstr "Alle Properties des Elements in der Collection" -#. Tag: entry +#. Tag: literal +#: query_sql.xml:323 #, fuzzy, no-c-format -msgid "{[aliasname].element.*}" -msgstr "{coll.element.*}" +msgid "{[aliasname].element.*}" +msgstr "{[aliasname].element.*}" + +#. Tag: literal +#: query_sql.xml:325 +#, fuzzy, no-c-format +msgid "{coll.element.*}" +msgstr "{coll.*}" #. Tag: entry +#: query_sql.xml:329 #, fuzzy, no-c-format -msgid "{coll.element.*}" -msgstr "{coll.element.*}" - -#. Tag: entry -#, fuzzy, no-c-format -msgid "All properties of the the collection" +msgid "All properties of the collection" msgstr "Alle Properties der Collection" -#. Tag: entry -#, fuzzy, no-c-format -msgid "{coll.*}" -msgstr "oder als eine List," +#. Tag: literal +#: query_sql.xml:333 +#, no-c-format +msgid "{coll.*}" +msgstr "{coll.*}" #. Tag: title +#: query_sql.xml:342 #, no-c-format msgid "Returning non-managed entities" msgstr "Wiedergabe nicht gemanagter Entities" #. Tag: para +#: query_sql.xml:344 #, fuzzy, no-c-format msgid "" "It is possible to apply a ResultTransformer to native SQL queries, allowing " @@ -841,12 +1051,24 @@ msgstr "" "Es ist möglich, einen ResultTransformer (Ergebnistransformer) an nativen SQL-" "Anfragen anzuwenden, der die Wiedergabe nicht gemanagter Entities ermöglicht." +#. Tag: programlisting +#: query_sql.xml:347 +#, fuzzy, no-c-format +msgid "" +"sess.createSQLQuery(\"SELECT NAME, BIRTHDATE FROM CATS\")\n" +" .setResultTransformer(Transformers.aliasToBean(CatDTO.class))" +msgstr "" +"sess.createSQLQuery(\"SELECT NAME, BIRTHDATE FROM CATS\")\n" +" .setResultTransformer(Transformers.aliasToBean(CatDTO.class))" + #. Tag: para +#: query_sql.xml:357 #, no-c-format msgid "a result transformer" msgstr "ein Ergebnistransformer" #. Tag: para +#: query_sql.xml:361 #, no-c-format msgid "" "The above query will return a list of CatDTO which has " @@ -858,11 +1080,13 @@ msgstr "" "entsprechenden Properties oder Felder eingespeist hat." #. Tag: title +#: query_sql.xml:367 #, no-c-format msgid "Handling inheritance" msgstr "Umgang mit Vererbung" #. Tag: para +#: query_sql.xml:369 #, fuzzy, no-c-format msgid "" "Native SQL queries which query for entities that are mapped as part of an " @@ -874,35 +1098,109 @@ msgstr "" "enthalten." #. Tag: title +#: query_sql.xml:375 #, no-c-format msgid "Parameters" msgstr "Parameter" #. Tag: para +#: query_sql.xml:377 #, fuzzy, no-c-format msgid "Native SQL queries support positional as well as named parameters:" msgstr "" "Native SQL-Anfragen unterstützen sowohl positionelle als auch benannte " "Parameter:" +#. Tag: programlisting +#: query_sql.xml:380 +#, fuzzy, no-c-format +msgid "" +"Query query = sess.createSQLQuery(\"SELECT * FROM CATS WHERE NAME like ?\")." +"addEntity(Cat.class);\n" +"List pusList = query.setString(0, \"Pus%\").list();\n" +" \n" +"query = sess.createSQLQuery(\"SELECT * FROM CATS WHERE NAME like :name\")." +"addEntity(Cat.class);\n" +"List pusList = query.setString(\"name\", \"Pus%\").list();" +msgstr "" +"Query query = sess.createSQLQuery(\"SELECT * FROM CATS WHERE NAME like ?\")." +"addEntity(Cat.class);\n" +"List pusList = query.setString(0, \"Pus%\").list();\n" +" \n" +"query = sess.createSQLQuery(\"SELECT * FROM CATS WHERE NAME like :name\")." +"addEntity(Cat.class);\n" +"List pusList = query.setString(\"name\", \"Pus%\").list();" + #. Tag: title +#: query_sql.xml:385 #, no-c-format msgid "Named SQL queries" msgstr "Benannte SQL-Anfragen" #. Tag: para +#: query_sql.xml:387 #, fuzzy, no-c-format msgid "" -"Named SQL queries can be defined in the mapping document and called in " -"exactly the same way as a named HQL query. In this case, you do " -"not need to call addEntity()." +"Named SQL queries can also be defined in the mapping document and called in " +"exactly the same way as a named HQL query (see ). In this case, you do not " +"need to call addEntity()." msgstr "" "Benannte SQL-Anfragen können im Mapping-Dokument definiert und auf dieselbe " "Weise wie eine benannte HQL-Anfrage benannt werden. In diesem Fall muss " "nicht der Aufruf addEntity() " "erfolgen." +#. Tag: title +#: query_sql.xml:394 +#, no-c-format +msgid "Named sql query using the <sql-query> maping element" +msgstr "" + +#. Tag: programlisting +#: query_sql.xml:397 +#, fuzzy, no-c-format +msgid "" +"<sql-query name=\"persons\">\n" +" <return alias=\"person\" class=\"eg.Person\"/>\n" +" SELECT person.NAME AS {person.name},\n" +" person.AGE AS {person.age},\n" +" person.SEX AS {person.sex}\n" +" FROM PERSON person\n" +" WHERE person.NAME LIKE :namePattern\n" +"</sql-query>" +msgstr "" +"<sql-query name=\"persons\">\n" +" <return alias=\"person\" class=\"eg.Person\"/>\n" +" SELECT person.NAME AS {person.name},\n" +" person.AGE AS {person.age},\n" +" person.SEX AS {person.sex}\n" +" FROM PERSON person\n" +" WHERE person.NAME LIKE :namePattern\n" +"</sql-query>" + +#. Tag: title +#: query_sql.xml:401 +#, no-c-format +msgid "Execution of a named query" +msgstr "" + +#. Tag: programlisting +#: query_sql.xml:403 +#, fuzzy, no-c-format +msgid "" +"List people = sess.getNamedQuery(\"persons\")\n" +" .setString(\"namePattern\", namePattern)\n" +" .setMaxResults(50)\n" +" .list();" +msgstr "" +"List people = sess.getNamedQuery(\"persons\")\n" +" .setString(\"namePattern\", namePattern)\n" +" .setMaxResults(50)\n" +" .list();" + #. Tag: para +#: query_sql.xml:406 #, fuzzy, no-c-format msgid "" "The <return-join> element is use to join " @@ -913,7 +1211,52 @@ msgstr "" "collection>-Elemente werden verwendet, um Assoziationen zu " "verbinden bzw. Anfragen, die Collections definieren, zu initialisieren." +#. Tag: title +#: query_sql.xml:411 +#, no-c-format +msgid "Named sql query with association" +msgstr "" + +#. Tag: programlisting +#: query_sql.xml:413 +#, fuzzy, no-c-format +msgid "" +"<sql-query name=\"personsWith\">\n" +" <return alias=\"person\" class=\"eg.Person\"/>\n" +" <return-join alias=\"address\" property=\"person.mailingAddress\"/" +">\n" +" SELECT person.NAME AS {person.name},\n" +" person.AGE AS {person.age},\n" +" person.SEX AS {person.sex},\n" +" address.STREET AS {address.street},\n" +" address.CITY AS {address.city},\n" +" address.STATE AS {address.state},\n" +" address.ZIP AS {address.zip}\n" +" FROM PERSON person\n" +" JOIN ADDRESS address\n" +" ON person.ID = address.PERSON_ID AND address.TYPE='MAILING'\n" +" WHERE person.NAME LIKE :namePattern\n" +"</sql-query>" +msgstr "" +"<sql-query name=\"personsWith\">\n" +" <return alias=\"person\" class=\"eg.Person\"/>\n" +" <return-join alias=\"address\" property=\"person.mailingAddress\"/" +">\n" +" SELECT person.NAME AS {person.name},\n" +" person.AGE AS {person.age},\n" +" person.SEX AS {person.sex},\n" +" adddress.STREET AS {address.street},\n" +" adddress.CITY AS {address.city},\n" +" adddress.STATE AS {address.state},\n" +" adddress.ZIP AS {address.zip}\n" +" FROM PERSON person\n" +" JOIN ADDRESS adddress\n" +" ON person.ID = address.PERSON_ID AND address.TYPE='MAILING'\n" +" WHERE person.NAME LIKE :namePattern\n" +"</sql-query>" + #. Tag: para +#: query_sql.xml:416 #, no-c-format msgid "" "A named SQL query may return a scalar value. You must declare the column " @@ -924,7 +1267,34 @@ msgstr "" "unter Verwendung des <return-scalar>-Elements den " "Spalten-Alias und den Hibernate-Typ deklarieren:" +#. Tag: title +#: query_sql.xml:421 +#, no-c-format +msgid "Named query returning a scalar" +msgstr "" + +#. Tag: programlisting +#: query_sql.xml:423 +#, fuzzy, no-c-format +msgid "" +"<sql-query name=\"mySqlQuery\">\n" +" <return-scalar column=\"name\" type=\"string\"/>\n" +" <return-scalar column=\"age\" type=\"long\"/>\n" +" SELECT p.NAME AS name, \n" +" p.AGE AS age,\n" +" FROM PERSON p WHERE p.NAME LIKE 'Hiber%'\n" +"</sql-query>" +msgstr "" +"<sql-query name=\"mySqlQuery\">\n" +" <return-scalar column=\"name\" type=\"string\"/>\n" +" <return-scalar column=\"age\" type=\"long\"/>\n" +" SELECT p.NAME AS name,\n" +" p.AGE AS age,\n" +" FROM PERSON p WHERE p.NAME LIKE 'Hiber%'\n" +"</sql-query>" + #. Tag: para +#: query_sql.xml:426 #, fuzzy, no-c-format msgid "" "You can externalize the resultset mapping information in a <" @@ -937,7 +1307,58 @@ msgstr "" "entweder über mehrere benannte Anfragen hinweg oder durch die " "setResultSetMapping()-API wiederzuverwenden." +#. Tag: title +#: query_sql.xml:432 +#, no-c-format +msgid "<resultset> mapping used to externalize mapping information" +msgstr "" + +#. Tag: programlisting +#: query_sql.xml:435 +#, fuzzy, no-c-format +msgid "" +"<resultset name=\"personAddress\">\n" +" <return alias=\"person\" class=\"eg.Person\"/>\n" +" <return-join alias=\"address\" property=\"person.mailingAddress\"/" +">\n" +"</resultset>\n" +"\n" +"<sql-query name=\"personsWith\" resultset-ref=\"personAddress\">\n" +" SELECT person.NAME AS {person.name},\n" +" person.AGE AS {person.age},\n" +" person.SEX AS {person.sex},\n" +" address.STREET AS {address.street},\n" +" address.CITY AS {address.city},\n" +" address.STATE AS {address.state},\n" +" address.ZIP AS {address.zip}\n" +" FROM PERSON person\n" +" JOIN ADDRESS address\n" +" ON person.ID = address.PERSON_ID AND address.TYPE='MAILING'\n" +" WHERE person.NAME LIKE :namePattern\n" +"</sql-query>" +msgstr "" +"<resultset name=\"personAddress\">\n" +" <return alias=\"person\" class=\"eg.Person\"/>\n" +" <return-join alias=\"address\" property=\"person.mailingAddress\"/" +">\n" +"</resultset>\n" +"\n" +"<sql-query name=\"personsWith\" resultset-ref=\"personAddress\">\n" +" SELECT person.NAME AS {person.name},\n" +" person.AGE AS {person.age},\n" +" person.SEX AS {person.sex},\n" +" adddress.STREET AS {address.street},\n" +" adddress.CITY AS {address.city},\n" +" adddress.STATE AS {address.state},\n" +" adddress.ZIP AS {address.zip}\n" +" FROM PERSON person\n" +" JOIN ADDRESS adddress\n" +" ON person.ID = address.PERSON_ID AND address.TYPE='MAILING'\n" +" WHERE person.NAME LIKE :namePattern\n" +"</sql-query>" + #. Tag: para +#: query_sql.xml:438 #, fuzzy, no-c-format msgid "" "You can, alternatively, use the resultset mapping information in your hbm " @@ -947,6 +1368,338 @@ msgstr "" "Dateien direkt in Java Code verwenden." #. Tag: title +#: query_sql.xml:442 +#, no-c-format +msgid "Programmatically specifying the result mapping information" +msgstr "" + +#. Tag: programlisting +#: query_sql.xml:445 +#, fuzzy, no-c-format +msgid "" +"List cats = sess.createSQLQuery(\n" +" \"select {cat.*}, {kitten.*} from cats cat, cats kitten where kitten." +"mother = cat.id\"\n" +" )\n" +" .setResultSetMapping(\"catAndKitten\")\n" +" .list();" +msgstr "" +"List cats = sess.createSQLQuery(\n" +" \"select {cat.*}, {kitten.*} from cats cat, cats kitten where kitten." +"mother = cat.id\"\n" +" )\n" +" .setResultSetMapping(\"catAndKitten\")\n" +" .list();" + +#. Tag: para +#: query_sql.xml:448 +#, no-c-format +msgid "" +"So far we have only looked at externalizing SQL queries using Hibernate " +"mapping files. The same concept is also available with anntations and is " +"called named native queries. You can use @NamedNativeQuery (@NamedNativeQueries) in conjunction with " +"@SqlResultSetMapping (@SqlResultSetMappings). Like @NamedQuery, " +"@NamedNativeQuery and @SqlResultSetMapping can be defined at class level, but their scope is global to the " +"application. Lets look at a view examples." +msgstr "" + +#. Tag: para +#: query_sql.xml:460 +#, no-c-format +msgid "" +"shows how a resultSetMapping parameter is defined in " +"@NamedNativeQuery. It represents the name of a defined " +"@SqlResultSetMapping. The resultset mapping declares the " +"entities retrieved by this native query. Each field of the entity is bound " +"to an SQL alias (or column name). All fields of the entity including the " +"ones of subclasses and the foreign key columns of related entities have to " +"be present in the SQL query. Field definitions are optional provided that " +"they map to the same column name as the one declared on the class property. " +"In the example 2 entities, Night and Area, are returned and each property is declared and associated to a " +"column name, actually the column name retrieved by the query." +msgstr "" + +#. Tag: para +#: query_sql.xml:475 +#, no-c-format +msgid "" +"In the result set " +"mapping is implicit. We only describe the entity class of the result set " +"mapping. The property / column mappings is done using the entity mapping " +"values. In this case the model property is bound to the model_txt column." +msgstr "" + +#. Tag: para +#: query_sql.xml:481 +#, no-c-format +msgid "" +"Finally, if the association to a related entity involve a composite primary " +"key, a @FieldResult element should be used for each " +"foreign key column. The @FieldResult name is composed of " +"the property name for the relationship, followed by a dot (\".\"), followed " +"by the name or the field or property of the primary key. This can be seen in " +"." +msgstr "" + +#. Tag: title +#: query_sql.xml:490 +#, no-c-format +msgid "" +"Named SQL query using @NamedNativeQuery together with " +"@SqlResultSetMapping" +msgstr "" + +#. Tag: programlisting +#: query_sql.xml:493 +#, no-c-format +msgid "" +"@NamedNativeQuery(name=\"night&area\", query=\"select night.id nid, " +"night.night_duration, \"\n" +" + \" night.night_date, area.id aid, night.area_id, area.name \"\n" +" + \"from Night night, Area area where night.area_id = area.id\", \n" +" resultSetMapping=\"joinMapping\")\n" +"@SqlResultSetMapping(name=\"joinMapping\", entities={\n" +" @EntityResult(entityClass=Night.class, fields = {\n" +" @FieldResult(name=\"id\", column=\"nid\"),\n" +" @FieldResult(name=\"duration\", column=\"night_duration\"),\n" +" @FieldResult(name=\"date\", column=\"night_date\"),\n" +" @FieldResult(name=\"area\", column=\"area_id\"),\n" +" discriminatorColumn=\"disc\"\n" +" }),\n" +" @EntityResult(entityClass=org.hibernate.test.annotations.query.Area." +"class, fields = {\n" +" @FieldResult(name=\"id\", column=\"aid\"),\n" +" @FieldResult(name=\"name\", column=\"name\")\n" +" })\n" +" }\n" +")" +msgstr "" + +#. Tag: title +#: query_sql.xml:497 +#, no-c-format +msgid "Implicit result set mapping" +msgstr "" + +#. Tag: programlisting +#: query_sql.xml:499 +#, no-c-format +msgid "" +"@Entity\n" +"@SqlResultSetMapping(name=\"implicit\",\n" +" entities=@EntityResult(entityClass=SpaceShip.class))\n" +"@NamedNativeQuery(name=\"implicitSample\", \n" +" query=\"select * from SpaceShip\", \n" +" resultSetMapping=\"implicit\")\n" +"public class SpaceShip {\n" +" private String name;\n" +" private String model;\n" +" private double speed;\n" +"\n" +" @Id\n" +" public String getName() {\n" +" return name;\n" +" }\n" +"\n" +" public void setName(String name) {\n" +" this.name = name;\n" +" }\n" +"\n" +" @Column(name=\"model_txt\")\n" +" public String getModel() {\n" +" return model;\n" +" }\n" +"\n" +" public void setModel(String model) {\n" +" this.model = model;\n" +" }\n" +"\n" +" public double getSpeed() {\n" +" return speed;\n" +" }\n" +"\n" +" public void setSpeed(double speed) {\n" +" this.speed = speed;\n" +" }\n" +"}" +msgstr "" + +#. Tag: title +#: query_sql.xml:503 +#, no-c-format +msgid "Using dot notation in @FieldResult for specifying associations" +msgstr "" + +#. Tag: programlisting +#: query_sql.xml:506 +#, no-c-format +msgid "" +"@Entity\n" +"@SqlResultSetMapping(name=\"compositekey\",\n" +" entities=@EntityResult(entityClass=SpaceShip.class,\n" +" fields = {\n" +" @FieldResult(name=\"name\", column = \"name\"),\n" +" @FieldResult(name=\"model\", column = \"model\"),\n" +" @FieldResult(name=\"speed\", column = \"speed\"),\n" +" @FieldResult(name=\"captain.firstname\", column = " +"\"firstn\"),\n" +" @FieldResult(name=\"captain.lastname\", column = \"lastn" +"\"),\n" +" @FieldResult(name=\"dimensions.length\", column = " +"\"length\"),\n" +" @FieldResult(name=\"dimensions.width\", column = \"width" +"\")\n" +" }),\n" +" columns = { @ColumnResult(name = \"surface\"),\n" +" @ColumnResult(name = \"volume\") } )\n" +"\n" +"@NamedNativeQuery(name=\"compositekey\",\n" +" query=\"select name, model, speed, lname as lastn, fname as firstn, " +"length, width, length * width as surface from SpaceShip\", \n" +" resultSetMapping=\"compositekey\")\n" +"} )\n" +"public class SpaceShip {\n" +" private String name;\n" +" private String model;\n" +" private double speed;\n" +" private Captain captain;\n" +" private Dimensions dimensions;\n" +"\n" +" @Id\n" +" public String getName() {\n" +" return name;\n" +" }\n" +"\n" +" public void setName(String name) {\n" +" this.name = name;\n" +" }\n" +"\n" +" @ManyToOne(fetch= FetchType.LAZY)\n" +" @JoinColumns( {\n" +" @JoinColumn(name=\"fname\", referencedColumnName = \"firstname" +"\"),\n" +" @JoinColumn(name=\"lname\", referencedColumnName = \"lastname" +"\")\n" +" } )\n" +" public Captain getCaptain() {\n" +" return captain;\n" +" }\n" +"\n" +" public void setCaptain(Captain captain) {\n" +" this.captain = captain;\n" +" }\n" +"\n" +" public String getModel() {\n" +" return model;\n" +" }\n" +"\n" +" public void setModel(String model) {\n" +" this.model = model;\n" +" }\n" +"\n" +" public double getSpeed() {\n" +" return speed;\n" +" }\n" +"\n" +" public void setSpeed(double speed) {\n" +" this.speed = speed;\n" +" }\n" +"\n" +" public Dimensions getDimensions() {\n" +" return dimensions;\n" +" }\n" +"\n" +" public void setDimensions(Dimensions dimensions) {\n" +" this.dimensions = dimensions;\n" +" }\n" +"}\n" +"\n" +"@Entity\n" +"@IdClass(Identity.class)\n" +"public class Captain implements Serializable {\n" +" private String firstname;\n" +" private String lastname;\n" +"\n" +" @Id\n" +" public String getFirstname() {\n" +" return firstname;\n" +" }\n" +"\n" +" public void setFirstname(String firstname) {\n" +" this.firstname = firstname;\n" +" }\n" +"\n" +" @Id\n" +" public String getLastname() {\n" +" return lastname;\n" +" }\n" +"\n" +" public void setLastname(String lastname) {\n" +" this.lastname = lastname;\n" +" }\n" +"}" +msgstr "" + +#. Tag: para +#: query_sql.xml:510 +#, no-c-format +msgid "" +"If you retrieve a single entity using the default mapping, you can specify " +"the resultClass attribute instead of " +"resultSetMapping:" +msgstr "" + +#. Tag: programlisting +#: query_sql.xml:514 +#, no-c-format +msgid "" +"@NamedNativeQuery(name=\"implicitSample\", query=\"select * from SpaceShip" +"\", resultClass=SpaceShip.class)\n" +"public class SpaceShip {" +msgstr "" + +#. Tag: para +#: query_sql.xml:517 +#, no-c-format +msgid "" +"In some of your native queries, you'll have to return scalar values, for " +"example when building report queries. You can map them in the " +"@SqlResultsetMapping through @ColumnResult. You actually can even mix, entities and scalar returns in the same " +"native query (this is probably not that common though)." +msgstr "" + +#. Tag: title +#: query_sql.xml:525 +#, no-c-format +msgid "Scalar values via @ColumnResult" +msgstr "" + +#. Tag: programlisting +#: query_sql.xml:527 +#, no-c-format +msgid "" +"@SqlResultSetMapping(name=\"scalar\", columns=@ColumnResult(name=\"dimension" +"\"))\n" +"@NamedNativeQuery(name=\"scalar\", query=\"select length*width as dimension " +"from SpaceShip\", resultSetMapping=\"scalar\")" +msgstr "" + +#. Tag: para +#: query_sql.xml:530 +#, no-c-format +msgid "" +"An other query hint specific to native queries has been introduced: " +"org.hibernate.callable which can be true or false " +"depending on whether the query is a stored procedure or not." +msgstr "" + +#. Tag: title +#: query_sql.xml:535 #, no-c-format msgid "Using return-property to explicitly specify column/alias names" msgstr "" @@ -954,6 +1707,7 @@ msgstr "" "Spalten-/Aliasnamen" #. Tag: para +#: query_sql.xml:538 #, fuzzy, no-c-format msgid "" "You can explicitly tell Hibernate what column aliases to use with " @@ -964,7 +1718,36 @@ msgstr "" "anweisen, welche Aliasse es verwenden soll, statt die {}-" "Syntax zu verwenden, bei der Hibernate seine eigenen Aliasse einspeist." +#. Tag: programlisting +#: query_sql.xml:543 +#, fuzzy, no-c-format +msgid "" +"<sql-query name=\"mySqlQuery\">\n" +" <return alias=\"person\" class=\"eg.Person\">\n" +" <return-property name=\"name\" column=\"myName\"/>\n" +" <return-property name=\"age\" column=\"myAge\"/>\n" +" <return-property name=\"sex\" column=\"mySex\"/>\n" +" </return>\n" +" SELECT person.NAME AS myName,\n" +" person.AGE AS myAge,\n" +" person.SEX AS mySex,\n" +" FROM PERSON person WHERE person.NAME LIKE :name\n" +"</sql-query>" +msgstr "" +"<sql-query name=\"mySqlQuery\">\n" +" <return alias=\"person\" class=\"eg.Person\">\n" +" <return-property name=\"name\" column=\"myName\"/>\n" +" <return-property name=\"age\" column=\"myAge\"/>\n" +" <return-property name=\"sex\" column=\"mySex\"/>\n" +" </return>\n" +" SELECT person.NAME AS myName,\n" +" person.AGE AS myAge,\n" +" person.SEX AS mySex,\n" +" FROM PERSON person WHERE person.NAME LIKE :name\n" +"</sql-query>" + #. Tag: para +#: query_sql.xml:545 #, fuzzy, no-c-format msgid "" "<return-property> also works with multiple columns. " @@ -975,7 +1758,44 @@ msgstr "" "Spalten. Dies löst die Einschränkungen der {}-Syntax, die " "keine feinstufige Steuerung mehrspaltiger Properties erlaubt." +#. Tag: programlisting +#: query_sql.xml:550 +#, fuzzy, no-c-format +msgid "" +"<sql-query name=\"organizationCurrentEmployments\">\n" +" <return alias=\"emp\" class=\"Employment\">\n" +" <return-property name=\"salary\">\n" +" <return-column name=\"VALUE\"/>\n" +" <return-column name=\"CURRENCY\"/>\n" +" </return-property>\n" +" <return-property name=\"endDate\" column=\"myEndDate\"/>\n" +" </return>\n" +" SELECT EMPLOYEE AS {emp.employee}, EMPLOYER AS {emp.employer},\n" +" STARTDATE AS {emp.startDate}, ENDDATE AS {emp.endDate},\n" +" REGIONCODE as {emp.regionCode}, EID AS {emp.id}, VALUE, CURRENCY\n" +" FROM EMPLOYMENT\n" +" WHERE EMPLOYER = :id AND ENDDATE IS NULL\n" +" ORDER BY STARTDATE ASC\n" +"</sql-query>" +msgstr "" +"<sql-query name=\"organizationCurrentEmployments\">\n" +" <return alias=\"emp\" class=\"Employment\">\n" +" <return-property name=\"salary\">\n" +" <return-column name=\"VALUE\"/>\n" +" <return-column name=\"CURRENCY\"/>\n" +" </return-property>\n" +" <return-property name=\"endDate\" column=\"myEndDate\"/>\n" +" </return>\n" +" SELECT EMPLOYEE AS {emp.employee}, EMPLOYER AS {emp.employer},\n" +" STARTDATE AS {emp.startDate}, ENDDATE AS {emp.endDate},\n" +" REGIONCODE as {emp.regionCode}, EID AS {emp.id}, VALUE, CURRENCY\n" +" FROM EMPLOYMENT\n" +" WHERE EMPLOYER = :id AND ENDDATE IS NULL\n" +" ORDER BY STARTDATE ASC\n" +"</sql-query>" + #. Tag: para +#: query_sql.xml:552 #, fuzzy, no-c-format msgid "" "In this example <return-property> was used in " @@ -988,6 +1808,7 @@ msgstr "" "entscheiden, wie auf Spalten und Properties verwiesen werden soll." #. Tag: para +#: query_sql.xml:557 #, no-c-format msgid "" "If your mapping has a discriminator you must use <return-" @@ -998,11 +1819,13 @@ msgstr "" "Diskriminator-Spalte festzulegen." #. Tag: title +#: query_sql.xml:563 #, no-c-format msgid "Using stored procedures for querying" msgstr "Die Verwendung gespeicherter Prozeduren für Anfragen" #. Tag: para +#: query_sql.xml:565 #, fuzzy, no-c-format msgid "" "Hibernate3 provides support for queries via stored procedures and functions. " @@ -1018,14 +1841,82 @@ msgstr "" "Ein Beispiel für eine solche gespeicherte Funktion in Oracle 9 und späteren " "Versionen lautet wie folgt:" +#. Tag: programlisting +#: query_sql.xml:571 +#, fuzzy, no-c-format +msgid "" +"CREATE OR REPLACE FUNCTION selectAllEmployments\n" +" RETURN SYS_REFCURSOR\n" +"AS\n" +" st_cursor SYS_REFCURSOR;\n" +"BEGIN\n" +" OPEN st_cursor FOR\n" +" SELECT EMPLOYEE, EMPLOYER,\n" +" STARTDATE, ENDDATE,\n" +" REGIONCODE, EID, VALUE, CURRENCY\n" +" FROM EMPLOYMENT;\n" +" RETURN st_cursor;\n" +" END;" +msgstr "" +"CREATE OR REPLACE FUNCTION selectAllEmployments\n" +" RETURN SYS_REFCURSOR\n" +"AS\n" +" st_cursor SYS_REFCURSOR;\n" +"BEGIN\n" +" OPEN st_cursor FOR\n" +" SELECT EMPLOYEE, EMPLOYER,\n" +" STARTDATE, ENDDATE,\n" +" REGIONCODE, EID, VALUE, CURRENCY\n" +" FROM EMPLOYMENT;\n" +" RETURN st_cursor;\n" +" END;" + #. Tag: para +#: query_sql.xml:573 #, no-c-format msgid "To use this query in Hibernate you need to map it via a named query." msgstr "" "Um diese Anfrage in Hibernate zu verwenden, müssen Sie sie durch eine " "benannte Anfrage mappen." +#. Tag: programlisting +#: query_sql.xml:576 +#, fuzzy, no-c-format +msgid "" +"<sql-query name=\"selectAllEmployees_SP\" callable=\"true\">\n" +" <return alias=\"emp\" class=\"Employment\">\n" +" <return-property name=\"employee\" column=\"EMPLOYEE\"/>\n" +" <return-property name=\"employer\" column=\"EMPLOYER\"/>\n" +" <return-property name=\"startDate\" column=\"STARTDATE\"/>\n" +" <return-property name=\"endDate\" column=\"ENDDATE\"/>\n" +" <return-property name=\"regionCode\" column=\"REGIONCODE\"/>\n" +" <return-property name=\"id\" column=\"EID\"/>\n" +" <return-property name=\"salary\">\n" +" <return-column name=\"VALUE\"/>\n" +" <return-column name=\"CURRENCY\"/>\n" +" </return-property>\n" +" </return>\n" +" { ? = call selectAllEmployments() }\n" +"</sql-query>" +msgstr "" +"<sql-query name=\"selectAllEmployees_SP\" callable=\"true\">\n" +" <return alias=\"emp\" class=\"Employment\">\n" +" <return-property name=\"employee\" column=\"EMPLOYEE\"/>\n" +" <return-property name=\"employer\" column=\"EMPLOYER\"/>\n" +" <return-property name=\"startDate\" column=\"STARTDATE\"/>\n" +" <return-property name=\"endDate\" column=\"ENDDATE\"/>\n" +" <return-property name=\"regionCode\" column=\"REGIONCODE\"/>\n" +" <return-property name=\"id\" column=\"EID\"/>\n" +" <return-property name=\"salary\">\n" +" <return-column name=\"VALUE\"/>\n" +" <return-column name=\"CURRENCY\"/>\n" +" </return-property>\n" +" </return>\n" +" { ? = call selectAllEmployments() }\n" +"</sql-query>" + #. Tag: para +#: query_sql.xml:578 #, fuzzy, no-c-format msgid "" "Stored procedures currently only return scalars and entities. <" @@ -1037,11 +1928,13 @@ msgstr "" "<load-collection> werden nicht unterstützt." #. Tag: title +#: query_sql.xml:583 #, no-c-format msgid "Rules/limitations for using stored procedures" msgstr "Regeln/Einschränkungen bei der Verwendung gespeicherter Prozeduren" #. Tag: para +#: query_sql.xml:585 #, fuzzy, no-c-format msgid "" "You cannot use stored procedures with Hibernate unless you follow some " @@ -1060,6 +1953,7 @@ msgstr "" "für Prozeduren verfügen." #. Tag: para +#: query_sql.xml:593 #, fuzzy, no-c-format msgid "" "Stored procedure queries cannot be paged with setFirstResult()/" @@ -1069,6 +1963,7 @@ msgstr "" "setMaxResults() seitenweise umgespeichert werden." #. Tag: para +#: query_sql.xml:596 #, fuzzy, no-c-format msgid "" "The recommended call form is standard SQL92: { ? = call functionName" @@ -1081,11 +1976,13 @@ msgstr "" "unterstützt." #. Tag: para +#: query_sql.xml:601 #, no-c-format msgid "For Oracle the following rules apply:" msgstr "Für Oracle gelten die folgenden Regeln:" #. Tag: para +#: query_sql.xml:605 #, fuzzy, no-c-format msgid "" "A function must return a result set. The first parameter of a procedure must " @@ -1102,11 +1999,13 @@ msgstr "" "Literatur zu Oracle." #. Tag: para +#: query_sql.xml:614 #, no-c-format msgid "For Sybase or MS SQL server the following rules apply:" msgstr "Für Sybase oder MS SQL Server gelten die folgenden Regeln:" #. Tag: para +#: query_sql.xml:618 #, fuzzy, no-c-format msgid "" "The procedure must return a result set. Note that since these servers can " @@ -1121,6 +2020,7 @@ msgstr "" "Ergebnissatz darstellt. Alles andere wird verworfen." #. Tag: para +#: query_sql.xml:626 #, no-c-format msgid "" "If you can enable SET NOCOUNT ON in your procedure it " @@ -1131,6 +2031,7 @@ msgstr "" "Voraussetzung." #. Tag: title +#: query_sql.xml:636 #, no-c-format msgid "Custom SQL for create, update and delete" msgstr "" @@ -1138,68 +2039,179 @@ msgstr "" "\" (aktualisieren) und \"delete\" (löschen)" #. Tag: para +#: query_sql.xml:638 #, no-c-format msgid "" "Hibernate3 can use custom SQL for create, update, and delete operations. The " "SQL can be overridden at the statement level or inidividual column level. " "This section describes statement overrides. For columns, see ." +"\"mapping-column-read-and-write\"/>. shows how to define custom SQL operatons using annotations." msgstr "" -#. Tag: para -#, fuzzy, no-c-format -msgid "" -"The class and collection persisters in Hibernate already contain a set of " -"configuration time generated strings (insertsql, deletesql, updatesql etc.). " -"The mapping tags <sql-insert>, <sql-" -"delete>, and <sql-update> override " -"these strings:" +#. Tag: title +#: query_sql.xml:646 +#, no-c-format +msgid "Custom CRUD via annotations" msgstr "" -"Hibernate3 kann angepasste SQL-Anweisungen für \"create\", \"update\", und " -"\"delete\" Vorgänge verwenden. Die Klassen- und Collection-Persister in " -"Hibernate enthalten bereits einen Satz von zur Konfigurationszeit " -"generierten Strings (insertsql, deletesql, updatesql usw.). Die Mapping-Tags " -"<sql-insert>, <sql-delete> " -"und <sql-update> setzen diese Strings außer Kraft:" -#. Tag: para -#, fuzzy, no-c-format -msgid "" -"The SQL is directly executed in your database, so you can use any dialect " -"you like. This will reduce the portability of your mapping if you use " -"database specific SQL." -msgstr "" -"Die SQL wird direkt in Ihrer Datenbank ausgeführt, Sie können daher jeden " -"beliebigen Dialekt verwenden. Dies wird natürlich die Übertragbarkeit Ihres " -"Mappings reduzieren, wenn Sie Datenbank-spezifische SQL benutzen." - -#. Tag: para +#. Tag: programlisting +#: query_sql.xml:648 #, no-c-format msgid "" -"Stored procedures are supported if the callable attribute " -"is set:" +"@Entity\n" +"@Table(name=\"CHAOS\")\n" +"@SQLInsert( sql=\"INSERT INTO CHAOS(size, name, nickname, id) VALUES(?,upper" +"(?),?,?)\")\n" +"@SQLUpdate( sql=\"UPDATE CHAOS SET size = ?, name = upper(?), nickname = ? " +"WHERE id = ?\")\n" +"@SQLDelete( sql=\"DELETE CHAOS WHERE id = ?\")\n" +"@SQLDeleteAll( sql=\"DELETE CHAOS\")\n" +"@Loader(namedQuery = \"chaos\")\n" +"@NamedNativeQuery(name=\"chaos\", query=\"select id, size, name, lower" +"( nickname ) as nickname from CHAOS where id= ?\", resultClass = Chaos." +"class)\n" +"public class Chaos {\n" +" @Id\n" +" private Long id;\n" +" private Long size;\n" +" private String name;\n" +" private String nickname;" msgstr "" -"Gespeicherte Prozeduren werden unterstützt, wenn das callable-Attribut wie folgt eingestellt ist:" #. Tag: para +#: query_sql.xml:651 +#, no-c-format +msgid "" +"@SQLInsert, @SQLUpdate, " +"@SQLDelete, @SQLDeleteAll respectively " +"override the INSERT, UPDATE, DELETE, and DELETE all statement. The same can " +"be achieved using Hibernate mapping files and the <sql-insert>" +", <sql-update> and <sql-" +"delete> nodes. This can be seen in ." +msgstr "" + +#. Tag: title +#: query_sql.xml:661 +#, no-c-format +msgid "Custom CRUD XML" +msgstr "" + +#. Tag: programlisting +#: query_sql.xml:663 #, fuzzy, no-c-format msgid "" -"The order of the positional parameters is vital, as they must be in the same " -"sequence as Hibernate expects them." +"<class name=\"Person\">\n" +" <id name=\"id\">\n" +" <generator class=\"increment\"/>\n" +" </id>\n" +" <property name=\"name\" not-null=\"true\"/>\n" +" <sql-insert>INSERT INTO PERSON (NAME, ID) VALUES ( UPPER(?), ? )" +"</sql-insert>\n" +" <sql-update>UPDATE PERSON SET NAME=UPPER(?) WHERE ID=?</sql-" +"update>\n" +" <sql-delete>DELETE FROM PERSON WHERE ID=?</sql-delete>\n" +"</class>" msgstr "" -"Die Reihenfolge der positionellen Parameter ist gegenwärtig entscheidend, da " -"sie dieselbe Sequenz besitzen müssen, wie Hibernate sie erwartet." +"<class name=\"Person\">\n" +" <id name=\"id\">\n" +" <generator class=\"increment\"/>\n" +" </id>\n" +" <property name=\"name\" not-null=\"true\"/>\n" +" <sql-insert>INSERT INTO PERSON (NAME, ID) VALUES ( UPPER(?), ? )" +"</sql-insert>\n" +" <sql-update>UPDATE PERSON SET NAME=UPPER(?) WHERE ID=?</sql-" +"update>\n" +" <sql-delete>DELETE FROM PERSON WHERE ID=?</sql-delete>\n" +"</class>" #. Tag: para +#: query_sql.xml:666 +#, no-c-format +msgid "" +"If you expect to call a store procedure, be sure to set the " +"callable attribute to true. In " +"annotations as well as in xml." +msgstr "" + +#. Tag: para +#: query_sql.xml:670 +#, no-c-format +msgid "" +"To check that the execution happens correctly, Hibernate allows you to " +"define one of those three strategies:" +msgstr "" + +#. Tag: para +#: query_sql.xml:675 +#, no-c-format +msgid "" +"none: no check is performed: the store procedure is expected to fail upon " +"issues" +msgstr "" + +#. Tag: para +#: query_sql.xml:680 +#, no-c-format +msgid "count: use of rowcount to check that the update is successful" +msgstr "" + +#. Tag: para +#: query_sql.xml:685 +#, no-c-format +msgid "" +"param: like COUNT but using an output parameter rather that the standard " +"mechanism" +msgstr "" + +#. Tag: para +#: query_sql.xml:690 +#, no-c-format +msgid "" +"To define the result check style, use the check parameter " +"which is again available in annoations as well as in xml." +msgstr "" + +#. Tag: para +#: query_sql.xml:693 +#, no-c-format +msgid "" +"You can use the exact same set of annotations respectively xml nodes to " +"override the collection related statements -see ." +msgstr "" + +#. Tag: title +#: query_sql.xml:698 +#, no-c-format +msgid "Overriding SQL statements for collections using annotations" +msgstr "" + +#. Tag: programlisting +#: query_sql.xml:701 +#, no-c-format +msgid "" +"@OneToMany\n" +"@JoinColumn(name=\"chaos_fk\")\n" +"@SQLInsert( sql=\"UPDATE CASIMIR_PARTICULE SET chaos_fk = ? where id = ?\")\n" +"@SQLDelete( sql=\"UPDATE CASIMIR_PARTICULE SET chaos_fk = null where id = ?" +"\")\n" +"private Set<CasimirParticle> particles = new HashSet<" +"CasimirParticle>();" +msgstr "" + +#. Tag: para +#: query_sql.xml:705 #, fuzzy, no-c-format msgid "" -"You can view the expected order by enabling debug logging for the " -"org.hibernate.persister.entity level. With this level " -"enabled, Hibernate will print out the static SQL that is used to create, " -"update, delete etc. entities. To view the expected sequence, do not include " -"your custom SQL in the mapping files, as this will override the Hibernate " -"generated static SQL." +"The parameter order is important and is defined by the order Hibernate " +"handles properties. You can see the expected order by enabling debug logging " +"for the org.hibernate.persister.entity level. With this " +"level enabled Hibernate will print out the static SQL that is used to " +"create, update, delete etc. entities. (To see the expected sequence, " +"remember to not include your custom SQL through annotations or mapping files " +"as that will override the Hibernate generated static sql)" msgstr "" "Sie können die erwartete Reihenfolge sehen, indem Sie Debug-Protokollierung " "für dieorg.hibernate.persister.entity-Ebene aktivieren. " @@ -1210,12 +2222,67 @@ msgstr "" "generierte statische sql außer Kraft setzt)." #. Tag: para +#: query_sql.xml:715 +#, no-c-format +msgid "" +"Overriding SQL statements for secondary tables is also possible using " +"@org.hibernate.annotations.Table and either (or all) " +"attributes sqlInsert, sqlUpdate, " +"sqlDelete:" +msgstr "" + +#. Tag: title +#: query_sql.xml:721 +#, no-c-format +msgid "Overriding SQL statements for secondary tables" +msgstr "" + +#. Tag: programlisting +#: query_sql.xml:723 +#, no-c-format +msgid "" +"@Entity\n" +"@SecondaryTables({\n" +" @SecondaryTable(name = \"`Cat nbr1`\"),\n" +" @SecondaryTable(name = \"Cat2\"})\n" +"@org.hibernate.annotations.Tables( {\n" +" @Table(appliesTo = \"Cat\", comment = \"My cat table\" ),\n" +" @Table(appliesTo = \"Cat2\", foreignKey = @ForeignKey(name=\"FK_CAT2_CAT" +"\"), fetch = FetchMode.SELECT,\n" +" sqlInsert=@SQLInsert(sql=\"insert into Cat2(storyPart2, id) values" +"(upper(?), ?)\") )\n" +"} )\n" +"public class Cat implements Serializable {" +msgstr "" + +#. Tag: para +#: query_sql.xml:726 +#, no-c-format +msgid "" +"The previous example also shows that you can give a comment to a given table " +"(primary or secondary): This comment will be used for DDL generation." +msgstr "" + +#. Tag: para +#: query_sql.xml:731 #, fuzzy, no-c-format msgid "" -"The stored procedures are in most cases required to return the number of " -"rows inserted, updated and deleted, as Hibernate has some runtime checks for " -"the success of the statement. Hibernate always registers the first statement " -"parameter as a numeric output parameter for the CUD operations:" +"The SQL is directly executed in your database, so you can use any dialect " +"you like. This will, however, reduce the portability of your mapping if you " +"use database specific SQL." +msgstr "" +"Die SQL wird direkt in Ihrer Datenbank ausgeführt, Sie können daher jeden " +"beliebigen Dialekt verwenden. Dies wird natürlich die Übertragbarkeit Ihres " +"Mappings reduzieren, wenn Sie Datenbank-spezifische SQL benutzen." + +#. Tag: para +#: query_sql.xml:736 +#, fuzzy, no-c-format +msgid "" +"Last but not least, stored procedures are in most cases required to return " +"the number of rows inserted, updated and deleted. Hibernate always registers " +"the first statement parameter as a numeric output parameter for the CUD " +"operations:" msgstr "" "Die gespeicherten Prozeduren sind in den meisten Fällen (bzw. fast immer) " "für die Wiedergabe der Anzahl von eingefügten/aktualisierten/gelöschten " @@ -1224,21 +2291,82 @@ msgstr "" "Anweisungsparameter als numerischen Ausgabeparameter für die CUD-Vorgänge:" #. Tag: title +#: query_sql.xml:742 +#, no-c-format +msgid "Stored procedures and their return value" +msgstr "" + +#. Tag: programlisting +#: query_sql.xml:744 +#, fuzzy, no-c-format +msgid "" +"CREATE OR REPLACE FUNCTION updatePerson (uid IN NUMBER, uname IN VARCHAR2)\n" +" RETURN NUMBER IS\n" +"BEGIN\n" +"\n" +" update PERSON\n" +" set\n" +" NAME = uname,\n" +" where\n" +" ID = uid;\n" +"\n" +" return SQL%ROWCOUNT;\n" +"\n" +"END updatePerson;" +msgstr "" +"CREATE OR REPLACE FUNCTION updatePerson (uid IN NUMBER, uname IN VARCHAR2)\n" +" RETURN NUMBER IS\n" +"BEGIN\n" +"\n" +" update PERSON\n" +" set\n" +" NAME = uname,\n" +" where\n" +" ID = uid;\n" +"\n" +" return SQL%ROWCOUNT;\n" +"\n" +"END updatePerson;" + +#. Tag: title +#: query_sql.xml:749 #, no-c-format msgid "Custom SQL for loading" msgstr "Angepasste SQL für das Laden" #. Tag: para +#: query_sql.xml:751 #, no-c-format msgid "" "You can also declare your own SQL (or HQL) queries for entity loading. As " "with inserts, updates, and deletes, this can be done at the individual " -"column level as described in or at the statement level. Here is an example of a statement level " +"column level as described in or at the statement level. Here is an example of a statement level " "override:" msgstr "" +#. Tag: programlisting +#: query_sql.xml:757 +#, fuzzy, no-c-format +msgid "" +"<sql-query name=\"person\">\n" +" <return alias=\"pers\" class=\"Person\" lock-mode=\"upgrade\"/>\n" +" SELECT NAME AS {pers.name}, ID AS {pers.id}\n" +" FROM PERSON\n" +" WHERE ID=?\n" +" FOR UPDATE\n" +"</sql-query>" +msgstr "" +"<sql-query name=\"person\">\n" +" <return alias=\"pers\" class=\"Person\" lock-mode=\"upgrade\"/>\n" +" SELECT NAME AS {pers.name}, ID AS {pers.id}\n" +" FROM PERSON\n" +" WHERE ID=?\n" +" FOR UPDATE\n" +"</sql-query>" + #. Tag: para +#: query_sql.xml:759 #, fuzzy, no-c-format msgid "" "This is just a named query declaration, as discussed earlier. You can " @@ -1248,18 +2376,77 @@ msgstr "" "erläutert. Sie können auf diese benannte Anfrage in einem Klassen-Mapping " "verweisen:" +#. Tag: programlisting +#: query_sql.xml:762 +#, fuzzy, no-c-format +msgid "" +"<class name=\"Person\">\n" +" <id name=\"id\">\n" +" <generator class=\"increment\"/>\n" +" </id>\n" +" <property name=\"name\" not-null=\"true\"/>\n" +" <loader query-ref=\"person\"/>\n" +"</class>" +msgstr "" +"<class name=\"Person\">\n" +" <id name=\"id\">\n" +" <generator class=\"increment\"/>\n" +" </id>\n" +" <property name=\"name\" not-null=\"true\"/>\n" +" <loader query-ref=\"person\"/>\n" +"</class>" + #. Tag: para +#: query_sql.xml:764 #, no-c-format msgid "This even works with stored procedures." msgstr "Das funktioniert sogar mit gespeicherten Prozeduren." #. Tag: para +#: query_sql.xml:766 #, fuzzy, no-c-format msgid "You can even define a query for collection loading:" msgstr "" "Sie können sogar eine Anfrage für das Laden von Collections definieren:" +#. Tag: programlisting +#: query_sql.xml:768 +#, fuzzy, no-c-format +msgid "" +"<set name=\"employments\" inverse=\"true\">\n" +" <key/>\n" +" <one-to-many class=\"Employment\"/>\n" +" <loader query-ref=\"employments\"/>\n" +"</set>" +msgstr "" +"<set name=\"employments\" inverse=\"true\">\n" +" <key/>\n" +" <one-to-many class=\"Employment\"/>\n" +" <loader query-ref=\"employments\"/>\n" +"</set>" + +#. Tag: programlisting +#: query_sql.xml:770 +#, fuzzy, no-c-format +msgid "" +"<sql-query name=\"employments\">\n" +" <load-collection alias=\"emp\" role=\"Person.employments\"/>\n" +" SELECT {emp.*}\n" +" FROM EMPLOYMENT emp\n" +" WHERE EMPLOYER = :id\n" +" ORDER BY STARTDATE ASC, EMPLOYEE ASC\n" +"</sql-query>" +msgstr "" +"<sql-query name=\"employments\">\n" +" <load-collection alias=\"emp\" role=\"Person.employments\"/>\n" +" SELECT {emp.*}\n" +" FROM EMPLOYMENT emp\n" +" WHERE EMPLOYER = :id\n" +" ORDER BY STARTDATE ASC, EMPLOYEE ASC\n" +"</sql-query>" + #. Tag: para +#: query_sql.xml:772 #, fuzzy, no-c-format msgid "" "You can also define an entity loader that loads a collection by join " @@ -1268,6 +2455,130 @@ msgstr "" "Sie könnten sogar einen Entity-Loader definieren, der eine Collection " "mittels \"Join-Fetching\" lädt:" +#. Tag: programlisting +#: query_sql.xml:775 +#, fuzzy, no-c-format +msgid "" +"<sql-query name=\"person\">\n" +" <return alias=\"pers\" class=\"Person\"/>\n" +" <return-join alias=\"emp\" property=\"pers.employments\"/>\n" +" SELECT NAME AS {pers.*}, {emp.*}\n" +" FROM PERSON pers\n" +" LEFT OUTER JOIN EMPLOYMENT emp\n" +" ON pers.ID = emp.PERSON_ID\n" +" WHERE ID=?\n" +"</sql-query>" +msgstr "" +"<sql-query name=\"person\">\n" +" <return alias=\"pers\" class=\"Person\"/>\n" +" <return-join alias=\"emp\" property=\"pers.employments\"/>\n" +" SELECT NAME AS {pers.*}, {emp.*}\n" +" FROM PERSON pers\n" +" LEFT OUTER JOIN EMPLOYMENT emp\n" +" ON pers.ID = emp.PERSON_ID\n" +" WHERE ID=?\n" +"</sql-query>" + +#. Tag: para +#: query_sql.xml:777 +#, no-c-format +msgid "" +"The annotation equivalent <loader> is the @Loader " +"annotation as seen in ." +msgstr "" + +#, fuzzy +#~ msgid "A_NAME as {item.name}" +#~ msgstr "oder als eine List," + +#, fuzzy +#~ msgid "{[aliasname].class}" +#~ msgstr "oder als eine List," + +#, fuzzy +#~ msgid "DISC as {item.class}" +#~ msgstr "oder als eine List," + +#, fuzzy +#~ msgid "{[aliasname].*}" +#~ msgstr "oder als eine List," + +#, fuzzy +#~ msgid "{item.*}" +#~ msgstr "oder als eine List," + +#, fuzzy +#~ msgid "{[aliasname].key}" +#~ msgstr "oder als eine List," + +#, fuzzy +#~ msgid "ORGID as {coll.key}" +#~ msgstr "oder als eine List," + +#, fuzzy +#~ msgid "{[aliasname].id}" +#~ msgstr "oder als eine List," + +#, fuzzy +#~ msgid "EMPID as {coll.id}" +#~ msgstr "oder als eine List," + +#, fuzzy +#~ msgid "{[aliasname].element}" +#~ msgstr "{coll.element.*}" + +#, fuzzy +#~ msgid "XID as {coll.element}" +#~ msgstr "{coll.element.*}" + +#, fuzzy +#~ msgid "NAME as {coll.element.name}" +#~ msgstr "{coll.element.*}" + +#, fuzzy +#~ msgid "{[aliasname].element.*}" +#~ msgstr "{coll.element.*}" + +#, fuzzy +#~ msgid "{coll.element.*}" +#~ msgstr "{coll.element.*}" + +#, fuzzy +#~ msgid "{coll.*}" +#~ msgstr "oder als eine List," + +#, fuzzy +#~ msgid "" +#~ "The class and collection persisters in Hibernate already contain a set of " +#~ "configuration time generated strings (insertsql, deletesql, updatesql " +#~ "etc.). The mapping tags <sql-insert>, " +#~ "<sql-delete>, and <sql-update> override these strings:" +#~ msgstr "" +#~ "Hibernate3 kann angepasste SQL-Anweisungen für \"create\", \"update\", " +#~ "und \"delete\" Vorgänge verwenden. Die Klassen- und Collection-Persister " +#~ "in Hibernate enthalten bereits einen Satz von zur Konfigurationszeit " +#~ "generierten Strings (insertsql, deletesql, updatesql usw.). Die Mapping-" +#~ "Tags <sql-insert>, <sql-delete> und <sql-update> setzen diese Strings " +#~ "außer Kraft:" + +#~ msgid "" +#~ "Stored procedures are supported if the callable " +#~ "attribute is set:" +#~ msgstr "" +#~ "Gespeicherte Prozeduren werden unterstützt, wenn das callable-Attribut wie folgt eingestellt ist:" + +#, fuzzy +#~ msgid "" +#~ "The order of the positional parameters is vital, as they must be in the " +#~ "same sequence as Hibernate expects them." +#~ msgstr "" +#~ "Die Reihenfolge der positionellen Parameter ist gegenwärtig entscheidend, " +#~ "da sie dieselbe Sequenz besitzen müssen, wie Hibernate sie erwartet." + #, fuzzy #~ msgid "" #~ "You can also declare your own SQL (or HQL) queries for entity loading:" @@ -1275,512 +2586,6 @@ msgstr "" #~ "Sie können auch Ihre eigenen SQL (oder HQL)-Anfragen für das Laden von " #~ "Entities deklarieren:" -#, fuzzy -#~ msgid "" -#~ "" -#~ msgstr "" -#~ "sess.createSQLQuery(\"SELECT * FROM CATS\").list();\n" -#~ "sess.createSQLQuery(\"SELECT ID, NAME, BIRTHDATE FROM CATS\").list();" - -#, fuzzy -#~ msgid "" -#~ "" -#~ msgstr "" -#~ "sess.createSQLQuery(\"SELECT * FROM CATS\")\n" -#~ " .addScalar(\"ID\", Hibernate.LONG)\n" -#~ " .addScalar(\"NAME\", Hibernate.STRING)\n" -#~ " .addScalar(\"BIRTHDATE\", Hibernate.DATE)" - -#, fuzzy -#~ msgid "" -#~ "" -#~ msgstr "" -#~ "sess.createSQLQuery(\"SELECT * FROM CATS\")\n" -#~ " .addScalar(\"ID\", Hibernate.LONG)\n" -#~ " .addScalar(\"NAME\")\n" -#~ " .addScalar(\"BIRTHDATE\")" - -#, fuzzy -#~ msgid "" -#~ "" -#~ msgstr "" -#~ "sess.createSQLQuery(\"SELECT * FROM CATS\").addEntity(Cat.class);\n" -#~ "sess.createSQLQuery(\"SELECT ID, NAME, BIRTHDATE FROM CATS\").addEntity" -#~ "(Cat.class);" - -#, fuzzy -#~ msgid "" -#~ "" -#~ msgstr "" -#~ "sess.createSQLQuery(\"SELECT ID, NAME, BIRTHDATE, DOG_ID FROM CATS\")." -#~ "addEntity(Cat.class);" - -#, fuzzy -#~ msgid "" -#~ "" -#~ msgstr "" -#~ "sess.createSQLQuery(\"SELECT c.ID, NAME, BIRTHDATE, DOG_ID, D_ID, D_NAME " -#~ "FROM CATS c, DOGS d \n" -#~ " WHERE c.DOG_ID = d.D_ID\")\n" -#~ " .addEntity(\"cat\", Cat.class)\n" -#~ " .addJoin(\"cat.dog\");" - -#, fuzzy -#~ msgid "" -#~ "" -#~ msgstr "" -#~ "sess.createSQLQuery(\"SELECT ID, NAME, BIRTHDATE, D_ID, D_NAME, CAT_ID " -#~ "FROM CATS c, DOGS d\n" -#~ " WHERE c.ID = d.CAT_ID\")\n" -#~ " .addEntity(\"cat\", Cat.class)\n" -#~ " .addJoin(\"cat.dogs\");" - -#, fuzzy -#~ msgid "" -#~ "" -#~ msgstr "" -#~ "sess.createSQLQuery(\"SELECT c.*, m.* FROM CATS c, CATS m WHERE c." -#~ "MOTHER_ID = c.ID\")\n" -#~ " .addEntity(\"cat\", Cat.class)\n" -#~ " .addEntity(\"mother\", Cat.class)" - -#, fuzzy -#~ msgid "" -#~ "" -#~ msgstr "" -#~ "sess.createSQLQuery(\"SELECT {cat.*}, {mother.*} FROM CATS c, CATS m " -#~ "WHERE c.MOTHER_ID = c.ID\")\n" -#~ " .addEntity(\"cat\", Cat.class)\n" -#~ " .addEntity(\"mother\", Cat.class)" - -#, fuzzy -#~ msgid "" -#~ "" -#~ msgstr "" -#~ "String sql = \"SELECT ID as {c.id}, NAME as {c.name}, \" + \n" -#~ " \"BIRTHDATE as {c.birthDate}, MOTHER_ID as {c.mother}, {mother." -#~ "*} \" +\n" -#~ " \"FROM CAT_LOG c, CAT_LOG m WHERE {c.mother} = c.ID\";\n" -#~ "\n" -#~ "List loggedCats = sess.createSQLQuery(sql)\n" -#~ " .addEntity(\"cat\", Cat.class)\n" -#~ " .addEntity(\"mother\", Cat.class).list()" - -#, fuzzy -#~ msgid "A_NAME as {item.name}" -#~ msgstr "A_NAME as {item.name}" - -#, fuzzy -#~ msgid "{[aliasname].class}" -#~ msgstr "{[aliasname].class}" - -#, fuzzy -#~ msgid "DISC as {item.class}" -#~ msgstr "DISC as {item.class}" - -#, fuzzy -#~ msgid "{[aliasname].*}" -#~ msgstr "{[aliasname].*}" - -#~ msgid "{item.*}" -#~ msgstr "{item.*}" - -#, fuzzy -#~ msgid "{[aliasname].key}" -#~ msgstr "{[aliasname].key}" - -#, fuzzy -#~ msgid "ORGID as {coll.key}" -#~ msgstr "ORGID als {coll.key}" - -#, fuzzy -#~ msgid "{[aliasname].id}" -#~ msgstr "{[aliasname].id}" - -#, fuzzy -#~ msgid "EMPID as {coll.id}" -#~ msgstr "EMPID als {coll.id}" - -#, fuzzy -#~ msgid "{[aliasname].element}" -#~ msgstr "{[aliasname].element}" - -#, fuzzy -#~ msgid "XID as {coll.element}" -#~ msgstr "XID als {coll.element}" - -#, fuzzy -#~ msgid "NAME as {coll.element.name}" -#~ msgstr "NAME als {coll.element.name}" - -#, fuzzy -#~ msgid "{[aliasname].element.*}" -#~ msgstr "{[aliasname].element.*}" - -#, fuzzy -#~ msgid "{coll.element.*}" -#~ msgstr "{coll.*}" - -#~ msgid "{coll.*}" -#~ msgstr "{coll.*}" - -#, fuzzy -#~ msgid "" -#~ "" -#~ msgstr "" -#~ "sess.createSQLQuery(\"SELECT NAME, BIRTHDATE FROM CATS\")\n" -#~ " .setResultTransformer(Transformers.aliasToBean(CatDTO.class))" - -#, fuzzy -#~ msgid "" -#~ "" -#~ msgstr "" -#~ "Query query = sess.createSQLQuery(\"SELECT * FROM CATS WHERE NAME like ?" -#~ "\").addEntity(Cat.class);\n" -#~ "List pusList = query.setString(0, \"Pus%\").list();\n" -#~ " \n" -#~ "query = sess.createSQLQuery(\"SELECT * FROM CATS WHERE NAME like :name\")." -#~ "addEntity(Cat.class);\n" -#~ "List pusList = query.setString(\"name\", \"Pus%\").list();" - -#, fuzzy -#~ msgid "" -#~ "\n" -#~ " \n" -#~ " SELECT person.NAME AS {person.name},\n" -#~ " person.AGE AS {person.age},\n" -#~ " person.SEX AS {person.sex}\n" -#~ " FROM PERSON person\n" -#~ " WHERE person.NAME LIKE :namePattern\n" -#~ "]]>" -#~ msgstr "" -#~ "<sql-query name=\"persons\">\n" -#~ " <return alias=\"person\" class=\"eg.Person\"/>\n" -#~ " SELECT person.NAME AS {person.name},\n" -#~ " person.AGE AS {person.age},\n" -#~ " person.SEX AS {person.sex}\n" -#~ " FROM PERSON person\n" -#~ " WHERE person.NAME LIKE :namePattern\n" -#~ "</sql-query>" - -#, fuzzy -#~ msgid "" -#~ "" -#~ msgstr "" -#~ "List people = sess.getNamedQuery(\"persons\")\n" -#~ " .setString(\"namePattern\", namePattern)\n" -#~ " .setMaxResults(50)\n" -#~ " .list();" - -#, fuzzy -#~ msgid "" -#~ "\n" -#~ " \n" -#~ " \n" -#~ " SELECT person.NAME AS {person.name},\n" -#~ " person.AGE AS {person.age},\n" -#~ " person.SEX AS {person.sex},\n" -#~ " address.STREET AS {address.street},\n" -#~ " address.CITY AS {address.city},\n" -#~ " address.STATE AS {address.state},\n" -#~ " address.ZIP AS {address.zip}\n" -#~ " FROM PERSON person\n" -#~ " JOIN ADDRESS address\n" -#~ " ON person.ID = address.PERSON_ID AND address.TYPE='MAILING'\n" -#~ " WHERE person.NAME LIKE :namePattern\n" -#~ "]]>" -#~ msgstr "" -#~ "<sql-query name=\"personsWith\">\n" -#~ " <return alias=\"person\" class=\"eg.Person\"/>\n" -#~ " <return-join alias=\"address\" property=\"person.mailingAddress\"/" -#~ ">\n" -#~ " SELECT person.NAME AS {person.name},\n" -#~ " person.AGE AS {person.age},\n" -#~ " person.SEX AS {person.sex},\n" -#~ " adddress.STREET AS {address.street},\n" -#~ " adddress.CITY AS {address.city},\n" -#~ " adddress.STATE AS {address.state},\n" -#~ " adddress.ZIP AS {address.zip}\n" -#~ " FROM PERSON person\n" -#~ " JOIN ADDRESS adddress\n" -#~ " ON person.ID = address.PERSON_ID AND address.TYPE='MAILING'\n" -#~ " WHERE person.NAME LIKE :namePattern\n" -#~ "</sql-query>" - -#, fuzzy -#~ msgid "" -#~ "\n" -#~ " \n" -#~ " \n" -#~ " SELECT p.NAME AS name,\n" -#~ " p.AGE AS age,\n" -#~ " FROM PERSON p WHERE p.NAME LIKE 'Hiber%'\n" -#~ "]]>" -#~ msgstr "" -#~ "<sql-query name=\"mySqlQuery\">\n" -#~ " <return-scalar column=\"name\" type=\"string\"/>\n" -#~ " <return-scalar column=\"age\" type=\"long\"/>\n" -#~ " SELECT p.NAME AS name,\n" -#~ " p.AGE AS age,\n" -#~ " FROM PERSON p WHERE p.NAME LIKE 'Hiber%'\n" -#~ "</sql-query>" - -#, fuzzy -#~ msgid "" -#~ "\n" -#~ " \n" -#~ " \n" -#~ "\n" -#~ "\n" -#~ "\n" -#~ " SELECT person.NAME AS {person.name},\n" -#~ " person.AGE AS {person.age},\n" -#~ " person.SEX AS {person.sex},\n" -#~ " address.STREET AS {address.street},\n" -#~ " address.CITY AS {address.city},\n" -#~ " address.STATE AS {address.state},\n" -#~ " address.ZIP AS {address.zip}\n" -#~ " FROM PERSON person\n" -#~ " JOIN ADDRESS address\n" -#~ " ON person.ID = address.PERSON_ID AND address.TYPE='MAILING'\n" -#~ " WHERE person.NAME LIKE :namePattern\n" -#~ "]]>" -#~ msgstr "" -#~ "<resultset name=\"personAddress\">\n" -#~ " <return alias=\"person\" class=\"eg.Person\"/>\n" -#~ " <return-join alias=\"address\" property=\"person.mailingAddress\"/" -#~ ">\n" -#~ "</resultset>\n" -#~ "\n" -#~ "<sql-query name=\"personsWith\" resultset-ref=\"personAddress\">\n" -#~ " SELECT person.NAME AS {person.name},\n" -#~ " person.AGE AS {person.age},\n" -#~ " person.SEX AS {person.sex},\n" -#~ " adddress.STREET AS {address.street},\n" -#~ " adddress.CITY AS {address.city},\n" -#~ " adddress.STATE AS {address.state},\n" -#~ " adddress.ZIP AS {address.zip}\n" -#~ " FROM PERSON person\n" -#~ " JOIN ADDRESS adddress\n" -#~ " ON person.ID = address.PERSON_ID AND address.TYPE='MAILING'\n" -#~ " WHERE person.NAME LIKE :namePattern\n" -#~ "</sql-query>" - -#, fuzzy -#~ msgid "" -#~ "" -#~ msgstr "" -#~ "List cats = sess.createSQLQuery(\n" -#~ " \"select {cat.*}, {kitten.*} from cats cat, cats kitten where " -#~ "kitten.mother = cat.id\"\n" -#~ " )\n" -#~ " .setResultSetMapping(\"catAndKitten\")\n" -#~ " .list();" - -#, fuzzy -#~ msgid "" -#~ "\n" -#~ " \n" -#~ " \n" -#~ " \n" -#~ " \n" -#~ " \n" -#~ " SELECT person.NAME AS myName,\n" -#~ " person.AGE AS myAge,\n" -#~ " person.SEX AS mySex,\n" -#~ " FROM PERSON person WHERE person.NAME LIKE :name\n" -#~ "\n" -#~ "]]>" -#~ msgstr "" -#~ "<sql-query name=\"mySqlQuery\">\n" -#~ " <return alias=\"person\" class=\"eg.Person\">\n" -#~ " <return-property name=\"name\" column=\"myName\"/>\n" -#~ " <return-property name=\"age\" column=\"myAge\"/>\n" -#~ " <return-property name=\"sex\" column=\"mySex\"/>\n" -#~ " </return>\n" -#~ " SELECT person.NAME AS myName,\n" -#~ " person.AGE AS myAge,\n" -#~ " person.SEX AS mySex,\n" -#~ " FROM PERSON person WHERE person.NAME LIKE :name\n" -#~ "</sql-query>" - -#, fuzzy -#~ msgid "" -#~ "\n" -#~ " \n" -#~ " \n" -#~ " \n" -#~ " \n" -#~ " \n" -#~ " \n" -#~ " \n" -#~ " SELECT EMPLOYEE AS {emp.employee}, EMPLOYER AS {emp.employer},\n" -#~ " STARTDATE AS {emp.startDate}, ENDDATE AS {emp.endDate},\n" -#~ " REGIONCODE as {emp.regionCode}, EID AS {emp.id}, VALUE, CURRENCY\n" -#~ " FROM EMPLOYMENT\n" -#~ " WHERE EMPLOYER = :id AND ENDDATE IS NULL\n" -#~ " ORDER BY STARTDATE ASC\n" -#~ "]]>" -#~ msgstr "" -#~ "<sql-query name=\"organizationCurrentEmployments\">\n" -#~ " <return alias=\"emp\" class=\"Employment\">\n" -#~ " <return-property name=\"salary\">\n" -#~ " <return-column name=\"VALUE\"/>\n" -#~ " <return-column name=\"CURRENCY\"/>\n" -#~ " </return-property>\n" -#~ " <return-property name=\"endDate\" column=\"myEndDate\"/>\n" -#~ " </return>\n" -#~ " SELECT EMPLOYEE AS {emp.employee}, EMPLOYER AS {emp.employer},\n" -#~ " STARTDATE AS {emp.startDate}, ENDDATE AS {emp.endDate},\n" -#~ " REGIONCODE as {emp.regionCode}, EID AS {emp.id}, VALUE, CURRENCY\n" -#~ " FROM EMPLOYMENT\n" -#~ " WHERE EMPLOYER = :id AND ENDDATE IS NULL\n" -#~ " ORDER BY STARTDATE ASC\n" -#~ "</sql-query>" - -#, fuzzy -#~ msgid "" -#~ "" -#~ msgstr "" -#~ "CREATE OR REPLACE FUNCTION selectAllEmployments\n" -#~ " RETURN SYS_REFCURSOR\n" -#~ "AS\n" -#~ " st_cursor SYS_REFCURSOR;\n" -#~ "BEGIN\n" -#~ " OPEN st_cursor FOR\n" -#~ " SELECT EMPLOYEE, EMPLOYER,\n" -#~ " STARTDATE, ENDDATE,\n" -#~ " REGIONCODE, EID, VALUE, CURRENCY\n" -#~ " FROM EMPLOYMENT;\n" -#~ " RETURN st_cursor;\n" -#~ " END;" - -#, fuzzy -#~ msgid "" -#~ "\n" -#~ " \n" -#~ " \n" -#~ " \n" -#~ " \n" -#~ " \n" -#~ " \n" -#~ " \n" -#~ " \n" -#~ " \n" -#~ " \n" -#~ " \n" -#~ " \n" -#~ " { ? = call selectAllEmployments() }\n" -#~ "]]>" -#~ msgstr "" -#~ "<sql-query name=\"selectAllEmployees_SP\" callable=\"true\">\n" -#~ " <return alias=\"emp\" class=\"Employment\">\n" -#~ " <return-property name=\"employee\" column=\"EMPLOYEE\"/>\n" -#~ " <return-property name=\"employer\" column=\"EMPLOYER\"/>\n" -#~ " <return-property name=\"startDate\" column=\"STARTDATE\"/>\n" -#~ " <return-property name=\"endDate\" column=\"ENDDATE\"/>\n" -#~ " <return-property name=\"regionCode\" column=\"REGIONCODE\"/" -#~ ">\n" -#~ " <return-property name=\"id\" column=\"EID\"/>\n" -#~ " <return-property name=\"salary\">\n" -#~ " <return-column name=\"VALUE\"/>\n" -#~ " <return-column name=\"CURRENCY\"/>\n" -#~ " </return-property>\n" -#~ " </return>\n" -#~ " { ? = call selectAllEmployments() }\n" -#~ "</sql-query>" - -#, fuzzy -#~ msgid "" -#~ "\n" -#~ " \n" -#~ " \n" -#~ " \n" -#~ " \n" -#~ " INSERT INTO PERSON (NAME, ID) VALUES ( UPPER(?), ? )\n" -#~ " UPDATE PERSON SET NAME=UPPER(?) WHERE ID=?\n" -#~ " DELETE FROM PERSON WHERE ID=?\n" -#~ "]]>" -#~ msgstr "" -#~ "<class name=\"Person\">\n" -#~ " <id name=\"id\">\n" -#~ " <generator class=\"increment\"/>\n" -#~ " </id>\n" -#~ " <property name=\"name\" not-null=\"true\"/>\n" -#~ " <sql-insert>INSERT INTO PERSON (NAME, ID) VALUES ( UPPER(?), ? )" -#~ "</sql-insert>\n" -#~ " <sql-update>UPDATE PERSON SET NAME=UPPER(?) WHERE ID=?</sql-" -#~ "update>\n" -#~ " <sql-delete>DELETE FROM PERSON WHERE ID=?</sql-delete>\n" -#~ "</class>" - #, fuzzy #~ msgid "" #~ "\n" @@ -1808,126 +2613,3 @@ msgstr "" #~ " <sql-update callable=\"true\">{? = call updatePerson (?, ?)}" #~ "</sql-update>\n" #~ "</class>" - -#, fuzzy -#~ msgid "" -#~ "" -#~ msgstr "" -#~ "CREATE OR REPLACE FUNCTION updatePerson (uid IN NUMBER, uname IN " -#~ "VARCHAR2)\n" -#~ " RETURN NUMBER IS\n" -#~ "BEGIN\n" -#~ "\n" -#~ " update PERSON\n" -#~ " set\n" -#~ " NAME = uname,\n" -#~ " where\n" -#~ " ID = uid;\n" -#~ "\n" -#~ " return SQL%ROWCOUNT;\n" -#~ "\n" -#~ "END updatePerson;" - -#, fuzzy -#~ msgid "" -#~ "\n" -#~ " \n" -#~ " SELECT NAME AS {pers.name}, ID AS {pers.id}\n" -#~ " FROM PERSON\n" -#~ " WHERE ID=?\n" -#~ " FOR UPDATE\n" -#~ "]]>" -#~ msgstr "" -#~ "<sql-query name=\"person\">\n" -#~ " <return alias=\"pers\" class=\"Person\" lock-mode=\"upgrade\"/" -#~ ">\n" -#~ " SELECT NAME AS {pers.name}, ID AS {pers.id}\n" -#~ " FROM PERSON\n" -#~ " WHERE ID=?\n" -#~ " FOR UPDATE\n" -#~ "</sql-query>" - -#, fuzzy -#~ msgid "" -#~ "\n" -#~ " \n" -#~ " \n" -#~ " \n" -#~ " \n" -#~ " \n" -#~ "]]>" -#~ msgstr "" -#~ "<class name=\"Person\">\n" -#~ " <id name=\"id\">\n" -#~ " <generator class=\"increment\"/>\n" -#~ " </id>\n" -#~ " <property name=\"name\" not-null=\"true\"/>\n" -#~ " <loader query-ref=\"person\"/>\n" -#~ "</class>" - -#, fuzzy -#~ msgid "" -#~ "\n" -#~ " \n" -#~ " \n" -#~ " \n" -#~ "]]>" -#~ msgstr "" -#~ "<set name=\"employments\" inverse=\"true\">\n" -#~ " <key/>\n" -#~ " <one-to-many class=\"Employment\"/>\n" -#~ " <loader query-ref=\"employments\"/>\n" -#~ "</set>" - -#, fuzzy -#~ msgid "" -#~ "\n" -#~ " \n" -#~ " SELECT {emp.*}\n" -#~ " FROM EMPLOYMENT emp\n" -#~ " WHERE EMPLOYER = :id\n" -#~ " ORDER BY STARTDATE ASC, EMPLOYEE ASC\n" -#~ "]]>" -#~ msgstr "" -#~ "<sql-query name=\"employments\">\n" -#~ " <load-collection alias=\"emp\" role=\"Person.employments\"/>\n" -#~ " SELECT {emp.*}\n" -#~ " FROM EMPLOYMENT emp\n" -#~ " WHERE EMPLOYER = :id\n" -#~ " ORDER BY STARTDATE ASC, EMPLOYEE ASC\n" -#~ "</sql-query>" - -#, fuzzy -#~ msgid "" -#~ "\n" -#~ " \n" -#~ " \n" -#~ " SELECT NAME AS {pers.*}, {emp.*}\n" -#~ " FROM PERSON pers\n" -#~ " LEFT OUTER JOIN EMPLOYMENT emp\n" -#~ " ON pers.ID = emp.PERSON_ID\n" -#~ " WHERE ID=?\n" -#~ "]]>" -#~ msgstr "" -#~ "<sql-query name=\"person\">\n" -#~ " <return alias=\"pers\" class=\"Person\"/>\n" -#~ " <return-join alias=\"emp\" property=\"pers.employments\"/>\n" -#~ " SELECT NAME AS {pers.*}, {emp.*}\n" -#~ " FROM PERSON pers\n" -#~ " LEFT OUTER JOIN EMPLOYMENT emp\n" -#~ " ON pers.ID = emp.PERSON_ID\n" -#~ " WHERE ID=?\n" -#~ "</sql-query>" diff --git a/documentation/manual/src/main/docbook/de-DE/content/session_api.po b/documentation/manual/src/main/docbook/de-DE/content/session_api.po index a436977426..79b698725e 100644 --- a/documentation/manual/src/main/docbook/de-DE/content/session_api.po +++ b/documentation/manual/src/main/docbook/de-DE/content/session_api.po @@ -275,7 +275,7 @@ msgid "" msgstr "" "Project-Id-Version: Collection_Mapping\n" "Report-Msgid-Bugs-To: http://bugs.kde.org\n" -"POT-Creation-Date: 2010-02-11T05:38:15\n" +"POT-Creation-Date: 2010-07-20 21:02+0000\n" "PO-Revision-Date: 2007-02-26 10:27+1000\n" "Last-Translator: \n" "Language-Team: \n" @@ -285,11 +285,13 @@ msgstr "" "X-Generator: KBabel 1.9.1\n" #. Tag: title +#: session_api.xml:31 #, no-c-format msgid "Working with objects" msgstr "Das Arbeiten mit Objekten" #. Tag: para +#: session_api.xml:33 #, fuzzy, no-c-format msgid "" "Hibernate is a full object/relational mapping solution that not only shields " @@ -308,6 +310,7 @@ msgstr "" "Anwendungen." #. Tag: para +#: session_api.xml:40 #, no-c-format msgid "" "In other words, Hibernate application developers should always think about " @@ -323,17 +326,20 @@ msgstr "" "Bedeutung, wenn die Performance des Systems eingestellt wird." #. Tag: title +#: session_api.xml:47 #, no-c-format msgid "Hibernate object states" msgstr "Statusarten von Hibernate Objekten" #. Tag: para +#: session_api.xml:49 #, no-c-format msgid "Hibernate defines and supports the following object states:" msgstr "" "Hibernate definiert und unterstützt die folgenden Arten des Objektstatus:" #. Tag: para +#: session_api.xml:53 #, fuzzy, no-c-format msgid "" "Transient - an object is transient if it has just been " @@ -358,6 +364,7 @@ msgstr "" "Wechsel nötig sind)." #. Tag: para +#: session_api.xml:65 #, fuzzy, no-c-format msgid "" "Persistent - a persistent instance has a representation " @@ -380,6 +387,7 @@ msgstr "" "wenn ein Objekt transient gemacht werden soll." #. Tag: para +#: session_api.xml:77 #, fuzzy, no-c-format msgid "" "Detached - a detached instance is an object that has " @@ -405,6 +413,7 @@ msgstr "" "Sicht des Benutzers." #. Tag: para +#: session_api.xml:90 #, fuzzy, no-c-format msgid "" "We will now discuss the states and state transitions (and the Hibernate " @@ -414,14 +423,16 @@ msgstr "" "Methoden, die einen Wechsel auslösen) ein." #. Tag: title +#: session_api.xml:95 #, no-c-format msgid "Making objects persistent" msgstr "Objekte persistent machen" #. Tag: para +#: session_api.xml:97 #, fuzzy, no-c-format msgid "" -"Newly instantiated instances of a a persistent class are considered " +"Newly instantiated instances of a persistent class are considered " "transient by Hibernate. We can make a transient " "instance persistent by associating it with a session:" msgstr "" @@ -430,7 +441,24 @@ msgstr "" "Instanz jedoch persistent machen, indem wir sie mit " "einer Session assoziieren:" +#. Tag: programlisting +#: session_api.xml:102 +#, fuzzy, no-c-format +msgid "" +"DomesticCat fritz = new DomesticCat();\n" +"fritz.setColor(Color.GINGER);\n" +"fritz.setSex('M');\n" +"fritz.setName(\"Fritz\");\n" +"Long generatedId = (Long) sess.save(fritz);" +msgstr "" +"DomesticCat fritz = new DomesticCat();\n" +"fritz.setColor(Color.GINGER);\n" +"fritz.setSex('M');\n" +"fritz.setName(\"Fritz\");\n" +"Long generatedId = (Long) sess.save(fritz);" + #. Tag: para +#: session_api.xml:104 #, fuzzy, no-c-format msgid "" "If Cat has a generated identifier, the identifier is " @@ -452,6 +480,7 @@ msgstr "" "verwenden, mit der Semantik der frühen EJB3-Fassung." #. Tag: para +#: session_api.xml:115 #, no-c-format msgid "" "persist() makes a transient instance persistent. However, " @@ -464,6 +493,7 @@ msgid "" msgstr "" #. Tag: para +#: session_api.xml:126 #, no-c-format msgid "" "save() does guarantee to return an identifier. If an " @@ -474,6 +504,7 @@ msgid "" msgstr "" #. Tag: para +#: session_api.xml:135 #, fuzzy, no-c-format msgid "" "Alternatively, you can assign the identifier using an overloaded version of " @@ -482,7 +513,28 @@ msgstr "" "Alternativ können Sie den Bezeichner unter Verwendung einer überladenen " "Version von save() zuordnen." +#. Tag: programlisting +#: session_api.xml:138 +#, fuzzy, no-c-format +msgid "" +"DomesticCat pk = new DomesticCat();\n" +"pk.setColor(Color.TABBY);\n" +"pk.setSex('F');\n" +"pk.setName(\"PK\");\n" +"pk.setKittens( new HashSet() );\n" +"pk.addKitten(fritz);\n" +"sess.save( pk, new Long(1234) );" +msgstr "" +"DomesticCat pk = new DomesticCat();\n" +"pk.setColor(Color.TABBY);\n" +"pk.setSex('F');\n" +"pk.setName(\"PK\");\n" +"pk.setKittens( new HashSet() );\n" +"pk.addKitten(fritz);\n" +"sess.save( pk, new Long(1234) );" + #. Tag: para +#: session_api.xml:140 #, fuzzy, no-c-format msgid "" "If the object you make persistent has associated objects (e.g. the " @@ -503,6 +555,7 @@ msgstr "" "save() die Objekte in der falschen Reihenfolge speichern." #. Tag: para +#: session_api.xml:148 #, fuzzy, no-c-format msgid "" "Usually you do not bother with this detail, as you will normally use " @@ -519,11 +572,13 @@ msgstr "" "diesem Kapitel noch näher auf transitive Persistenz ein." #. Tag: title +#: session_api.xml:157 #, no-c-format msgid "Loading an object" msgstr "Das Laden eines Objekts" #. Tag: para +#: session_api.xml:159 #, fuzzy, no-c-format msgid "" "The load() methods of Session provide " @@ -537,12 +592,46 @@ msgstr "" "und lädt den Status in eine neu instantiierte Instanz der Klasse, in " "persistentem Zustand." +#. Tag: programlisting +#: session_api.xml:165 +#, fuzzy, no-c-format +msgid "Cat fritz = (Cat) sess.load(Cat.class, generatedId);" +msgstr "Cat fritz = (Cat) sess.load(Cat.class, generatedId);" + +#. Tag: programlisting +#: session_api.xml:167 +#, fuzzy, no-c-format +msgid "" +"// you need to wrap primitive identifiers\n" +"long id = 1234;\n" +"DomesticCat pk = (DomesticCat) sess.load( DomesticCat.class, new Long(id) );" +msgstr "" +"// you need to wrap primitive identifiers\n" +"long id = 1234;\n" +"DomesticCat pk = (DomesticCat) sess.load( DomesticCat.class, new Long(id) );" + #. Tag: para +#: session_api.xml:169 #, no-c-format msgid "Alternatively, you can load state into a given instance:" msgstr "Alternativ können Sie den Status in eine beliebige Instanz laden:" +#. Tag: programlisting +#: session_api.xml:171 +#, fuzzy, no-c-format +msgid "" +"Cat cat = new DomesticCat();\n" +"// load pk's state into cat\n" +"sess.load( cat, new Long(pkId) );\n" +"Set kittens = cat.getKittens();" +msgstr "" +"Cat cat = new DomesticCat();\n" +"// load pk's state into cat\n" +"sess.load( cat, new Long(pkId) );\n" +"Set kittens = cat.getKittens();" + #. Tag: para +#: session_api.xml:173 #, fuzzy, no-c-format msgid "" "Be aware that load() will throw an unrecoverable " @@ -565,6 +654,7 @@ msgstr "" "size für das Klassen-Mapping definiert ist." #. Tag: para +#: session_api.xml:182 #, fuzzy, no-c-format msgid "" "If you are not certain that a matching row exists, you should use the " @@ -576,7 +666,26 @@ msgstr "" "die Datenbank zugreift und mit einer Nullmeldung reagiert, falls keine " "passende Reihe existiert." +#. Tag: programlisting +#: session_api.xml:186 +#, fuzzy, no-c-format +msgid "" +"Cat cat = (Cat) sess.get(Cat.class, id);\n" +"if (cat==null) {\n" +" cat = new Cat();\n" +" sess.save(cat, id);\n" +"}\n" +"return cat;" +msgstr "" +"Cat cat = (Cat) sess.get(Cat.class, id);\n" +"if (cat==null) {\n" +" cat = new Cat();\n" +" sess.save(cat, id);\n" +"}\n" +"return cat;" + #. Tag: para +#: session_api.xml:188 #, fuzzy, no-c-format msgid "" "You can even load an object using an SQL SELECT ... FOR UPDATE laden, indem Sie einen LockMode verwenden. Siehe " "dazu auch die API-Dokumentation." +#. Tag: programlisting +#: session_api.xml:192 +#, fuzzy, no-c-format +msgid "Cat cat = (Cat) sess.get(Cat.class, id, LockMode.UPGRADE);" +msgstr "Cat cat = (Cat) sess.get(Cat.class, id, LockMode.UPGRADE);" + #. Tag: para +#: session_api.xml:194 #, fuzzy, no-c-format msgid "" "Any associated instances or contained collections will notSELECTs will it use? This depends on the " "fetching strategy. This is explained in ." +"\"performance-fetching\"/>." msgstr "" "An diesem Punkt stellt sich eine wichtige Frage: Wie viel lädt Hibernate aus " "der Datenbank und wie viele SQL SELECTs werden verwendet? " @@ -628,11 +758,13 @@ msgstr "" "erläutert." #. Tag: title +#: session_api.xml:213 #, no-c-format msgid "Querying" msgstr "Anfragen" #. Tag: para +#: session_api.xml:215 #, fuzzy, no-c-format msgid "" "If you do not know the identifiers of the objects you are looking for, you " @@ -652,11 +784,13 @@ msgstr "" "Ergebnissatzes in die Objekte ausdrücken." #. Tag: title +#: session_api.xml:224 #, no-c-format msgid "Executing queries" msgstr "Ausführen von Anfragen" #. Tag: para +#: session_api.xml:226 #, no-c-format msgid "" "HQL and native SQL queries are represented with an instance of org." @@ -671,7 +805,62 @@ msgstr "" "und für das Ausführen der tatsächlichen Anfrage. Sie können mittels der " "Session immer eine Query erhalten:" +#. Tag: programlisting +#: session_api.xml:232 +#, fuzzy, no-c-format +msgid "" +"List cats = session.createQuery(\n" +" \"from Cat as cat where cat.birthdate < ?\")\n" +" .setDate(0, date)\n" +" .list();\n" +"\n" +"List mothers = session.createQuery(\n" +" \"select mother from Cat as cat join cat.mother as mother where cat.name " +"= ?\")\n" +" .setString(0, name)\n" +" .list();\n" +"\n" +"List kittens = session.createQuery(\n" +" \"from Cat as cat where cat.mother = ?\")\n" +" .setEntity(0, pk)\n" +" .list();\n" +"\n" +"Cat mother = (Cat) session.createQuery(\n" +" \"select cat.mother from Cat as cat where cat = ?\")\n" +" .setEntity(0, izi)\n" +" .uniqueResult();]]\n" +"\n" +"Query mothersWithKittens = (Cat) session.createQuery(\n" +" \"select mother from Cat as mother left join fetch mother.kittens\");\n" +"Set uniqueMothers = new HashSet(mothersWithKittens.list());" +msgstr "" +"List cats = session.createQuery(\n" +" \"from Cat as cat where cat.birthdate < ?\")\n" +" .setDate(0, date)\n" +" .list();\n" +"\n" +"List mothers = session.createQuery(\n" +" \"select mother from Cat as cat join cat.mother as mother where cat.name " +"= ?\")\n" +" .setString(0, name)\n" +" .list();\n" +"\n" +"List kittens = session.createQuery(\n" +" \"from Cat as cat where cat.mother = ?\")\n" +" .setEntity(0, pk)\n" +" .list();\n" +"\n" +"Cat mother = (Cat) session.createQuery(\n" +" \"select cat.mother from Cat as cat where cat = ?\")\n" +" .setEntity(0, izi)\n" +" .uniqueResult();]]\n" +"\n" +"Query mothersWithKittens = (Cat) session.createQuery(\n" +" \"select mother from Cat as mother left join fetch mother.kittens\");\n" +"Set uniqueMothers = new HashSet(mothersWithKittens.list());" + #. Tag: para +#: session_api.xml:234 #, fuzzy, no-c-format msgid "" "A query is usually executed by invoking list(). The " @@ -696,11 +885,13 @@ msgstr "" "Set jedoch ganz einfach filtern." #. Tag: title +#: session_api.xml:244 #, no-c-format msgid "Iterating results" msgstr "Iterationsergebnisse" #. Tag: para +#: session_api.xml:246 #, fuzzy, no-c-format msgid "" "Occasionally, you might be able to achieve better performance by executing " @@ -724,12 +915,46 @@ msgstr "" "lediglich mit den Bezeichnern reagiert und n " "zusätzliche Auswahlen zur Initialisierung der tatsächlichen Instanzen." +#. Tag: programlisting +#: session_api.xml:257 +#, fuzzy, no-c-format +msgid "" +"// fetch ids\n" +"Iterator iter = sess.createQuery(\"from eg.Qux q order by q.likeliness\")." +"iterate();\n" +"while ( iter.hasNext() ) {\n" +" Qux qux = (Qux) iter.next(); // fetch the object\n" +" // something we couldnt express in the query\n" +" if ( qux.calculateComplicatedAlgorithm() ) {\n" +" // delete the current instance\n" +" iter.remove();\n" +" // dont need to process the rest\n" +" break;\n" +" }\n" +"}" +msgstr "" +"// fetch ids\n" +"Iterator iter = sess.createQuery(\"from eg.Qux q order by q.likeliness\")." +"iterate();\n" +"while ( iter.hasNext() ) {\n" +" Qux qux = (Qux) iter.next(); // fetch the object\n" +" // something we couldnt express in the query\n" +" if ( qux.calculateComplicatedAlgorithm() ) {\n" +" // delete the current instance\n" +" iter.remove();\n" +" // dont need to process the rest\n" +" break;\n" +" }\n" +"}" + #. Tag: title +#: session_api.xml:261 #, no-c-format msgid "Queries that return tuples" msgstr "Anfragen, die mit Tupeln reagieren" #. Tag: para +#: session_api.xml:263 #, fuzzy, no-c-format msgid "" "Hibernate queries sometimes return tuples of objects. Each tuple is returned " @@ -738,12 +963,44 @@ msgstr "" "Hibernate Anfragen reagieren manchmal mit Tupeln (d.h. einer Liste " "korrelierter Datenwerte), wobei jeder Tupel als Array wiedergegeben wird:" +#. Tag: programlisting +#: session_api.xml:266 +#, fuzzy, no-c-format +msgid "" +"Iterator kittensAndMothers = sess.createQuery(\n" +" \"select kitten, mother from Cat kitten join kitten.mother mother" +"\")\n" +" .list()\n" +" .iterator();\n" +"\n" +"while ( kittensAndMothers.hasNext() ) {\n" +" Object[] tuple = (Object[]) kittensAndMothers.next();\n" +" Cat kitten = (Cat) tuple[0];\n" +" Cat mother = (Cat) tuple[1];\n" +" ....\n" +"}" +msgstr "" +"Iterator kittensAndMothers = sess.createQuery(\n" +" \"select kitten, mother from Cat kitten join kitten.mother mother" +"\")\n" +" .list()\n" +" .iterator();\n" +"\n" +"while ( kittensAndMothers.hasNext() ) {\n" +" Object[] tuple = (Object[]) kittensAndMothers.next();\n" +" Cat kitten = tuple[0];\n" +" Cat mother = tuple[1];\n" +" ....\n" +"}" + #. Tag: title +#: session_api.xml:270 #, no-c-format msgid "Scalar results" msgstr "Skalare Ergebnisse" #. Tag: para +#: session_api.xml:272 #, fuzzy, no-c-format msgid "" "Queries can specify a property of a class in the select " @@ -755,12 +1012,48 @@ msgstr "" "Properties oder Datengruppen werden als \"skalare\" Ergebnisse angesehen " "(und nicht als Entities in persistentem Zustand)." +#. Tag: programlisting +#: session_api.xml:277 +#, fuzzy, no-c-format +msgid "" +"Iterator results = sess.createQuery(\n" +" \"select cat.color, min(cat.birthdate), count(cat) from Cat cat \" " +"+\n" +" \"group by cat.color\")\n" +" .list()\n" +" .iterator();\n" +"\n" +"while ( results.hasNext() ) {\n" +" Object[] row = (Object[]) results.next();\n" +" Color type = (Color) row[0];\n" +" Date oldest = (Date) row[1];\n" +" Integer count = (Integer) row[2];\n" +" .....\n" +"}" +msgstr "" +"Iterator results = sess.createQuery(\n" +" \"select cat.color, min(cat.birthdate), count(cat) from Cat cat \" " +"+\n" +" \"group by cat.color\")\n" +" .list()\n" +" .iterator();\n" +"\n" +"while ( results.hasNext() ) {\n" +" Object[] row = (Object[]) results.next();\n" +" Color type = (Color) row[0];\n" +" Date oldest = (Date) row[1];\n" +" Integer count = (Integer) row[2];\n" +" .....\n" +"}" + #. Tag: title +#: session_api.xml:281 #, no-c-format msgid "Bind parameters" msgstr "Bind-Parameter" #. Tag: para +#: session_api.xml:283 #, fuzzy, no-c-format msgid "" "Methods on Query are provided for binding values to named " @@ -777,6 +1070,7 @@ msgstr "" "sind:" #. Tag: para +#: session_api.xml:292 #, no-c-format msgid "" "named parameters are insensitive to the order they occur in the query string" @@ -785,21 +1079,77 @@ msgstr "" "sie im Anfragenstring erscheinen" #. Tag: para +#: session_api.xml:297 #, fuzzy, no-c-format msgid "they can occur multiple times in the same query" msgstr "sie können innerhalb derselben Anfrage mehrere Male vorkommen" #. Tag: para +#: session_api.xml:301 #, no-c-format msgid "they are self-documenting" msgstr "sie dokumentieren sich selbst" +#. Tag: programlisting +#: session_api.xml:305 +#, fuzzy, no-c-format +msgid "" +"//named parameter (preferred)\n" +"Query q = sess.createQuery(\"from DomesticCat cat where cat.name = :name" +"\");\n" +"q.setString(\"name\", \"Fritz\");\n" +"Iterator cats = q.iterate();" +msgstr "" +"//named parameter (preferred)\n" +"Query q = sess.createQuery(\"from DomesticCat cat where cat.name = :name" +"\");\n" +"q.setString(\"name\", \"Fritz\");\n" +"Iterator cats = q.iterate();" + +#. Tag: programlisting +#: session_api.xml:307 +#, fuzzy, no-c-format +msgid "" +"//positional parameter\n" +"Query q = sess.createQuery(\"from DomesticCat cat where cat.name = ?\");\n" +"q.setString(0, \"Izi\");\n" +"Iterator cats = q.iterate();" +msgstr "" +"//positional parameter\n" +"Query q = sess.createQuery(\"from DomesticCat cat where cat.name = ?\");\n" +"q.setString(0, \"Izi\");\n" +"Iterator cats = q.iterate();" + +#. Tag: programlisting +#: session_api.xml:309 +#, fuzzy, no-c-format +msgid "" +"//named parameter list\n" +"List names = new ArrayList();\n" +"names.add(\"Izi\");\n" +"names.add(\"Fritz\");\n" +"Query q = sess.createQuery(\"from DomesticCat cat where cat.name in (:" +"namesList)\");\n" +"q.setParameterList(\"namesList\", names);\n" +"List cats = q.list();" +msgstr "" +"//named parameter list\n" +"List names = new ArrayList();\n" +"names.add(\"Izi\");\n" +"names.add(\"Fritz\");\n" +"Query q = sess.createQuery(\"from DomesticCat cat where cat.name in (:" +"namesList)\");\n" +"q.setParameterList(\"namesList\", names);\n" +"List cats = q.list();" + #. Tag: title +#: session_api.xml:313 #, no-c-format msgid "Pagination" msgstr "Nummerierung" #. Tag: para +#: session_api.xml:315 #, fuzzy, no-c-format msgid "" "If you need to specify bounds upon your result set, that is, the maximum " @@ -811,7 +1161,22 @@ msgstr "" "erhalten wollen), sollten Sie Methoden des Query-" "Interface verwenden:" +#. Tag: programlisting +#: session_api.xml:320 +#, fuzzy, no-c-format +msgid "" +"Query q = sess.createQuery(\"from DomesticCat cat\");\n" +"q.setFirstResult(20);\n" +"q.setMaxResults(10);\n" +"List cats = q.list();" +msgstr "" +"Query q = sess.createQuery(\"from DomesticCat cat\");\n" +"q.setFirstResult(20);\n" +"q.setMaxResults(10);\n" +"List cats = q.list();" + #. Tag: para +#: session_api.xml:322 #, no-c-format msgid "" "Hibernate knows how to translate this limit query into the native SQL of " @@ -821,11 +1186,13 @@ msgstr "" "übersetzen ist." #. Tag: title +#: session_api.xml:327 #, no-c-format msgid "Scrollable iteration" msgstr "Scrollbare Iteration" #. Tag: para +#: session_api.xml:329 #, fuzzy, no-c-format msgid "" "If your JDBC driver supports scrollable ResultSets, the " @@ -838,7 +1205,60 @@ msgstr "" "ScrollableResults-Objekt zu erhalten, das die flexible " "Navigation der Anfragenergebnisse ermöglicht." +#. Tag: programlisting +#: session_api.xml:334 +#, fuzzy, no-c-format +msgid "" +"Query q = sess.createQuery(\"select cat.name, cat from DomesticCat cat \" +\n" +" \"order by cat.name\");\n" +"ScrollableResults cats = q.scroll();\n" +"if ( cats.first() ) {\n" +"\n" +" // find the first name on each page of an alphabetical list of cats by " +"name\n" +" firstNamesOfPages = new ArrayList();\n" +" do {\n" +" String name = cats.getString(0);\n" +" firstNamesOfPages.add(name);\n" +" }\n" +" while ( cats.scroll(PAGE_SIZE) );\n" +"\n" +" // Now get the first page of cats\n" +" pageOfCats = new ArrayList();\n" +" cats.beforeFirst();\n" +" int i=0;\n" +" while( ( PAGE_SIZE > i++ ) && cats.next() ) pageOfCats.add" +"( cats.get(1) );\n" +"\n" +"}\n" +"cats.close()" +msgstr "" +"Query q = sess.createQuery(\"select cat.name, cat from DomesticCat cat \" +\n" +" \"order by cat.name\");\n" +"ScrollableResults cats = q.scroll();\n" +"if ( cats.first() ) {\n" +"\n" +" // find the first name on each page of an alphabetical list of cats by " +"name\n" +" firstNamesOfPages = new ArrayList();\n" +" do {\n" +" String name = cats.getString(0);\n" +" firstNamesOfPages.add(name);\n" +" }\n" +" while ( cats.scroll(PAGE_SIZE) );\n" +"\n" +" // Now get the first page of cats\n" +" pageOfCats = new ArrayList();\n" +" cats.beforeFirst();\n" +" int i=0;\n" +" while( ( PAGE_SIZE > i++ ) && cats.next() ) pageOfCats.add" +"( cats.get(1) );\n" +"\n" +"}\n" +"cats.close()" + #. Tag: para +#: session_api.xml:336 #, fuzzy, no-c-format msgid "" "Note that an open database connection and cursor is required for this " @@ -851,27 +1271,115 @@ msgstr "" "Nummerierungsfunktionalität benötigen." #. Tag: title +#: session_api.xml:343 #, no-c-format msgid "Externalizing named queries" msgstr "Externalisierung benannter Anfragen" #. Tag: para +#: session_api.xml:345 +#, no-c-format +msgid "" +"Queries can also be configured as so called named queries using annotations " +"or Hibernate mapping documents. @NamedQuery and " +"@NamedQueries can be defined at the class level as seen " +"in . However their " +"definitions are global to the session factory/entity manager factory scope. " +"A named query is defined by its name and the actual query string." +msgstr "" + +#. Tag: title +#: session_api.xml:355 +#, no-c-format +msgid "Defining a named query using @NamedQuery" +msgstr "" + +#. Tag: programlisting +#: session_api.xml:358 +#, no-c-format +msgid "" +"@Entity\n" +"@NamedQuery(name=\"night.moreRecentThan\", query=\"select n from Night n " +"where n.date >= :date\")\n" +"public class Night {\n" +" ...\n" +"}\n" +"\n" +"public class MyDao {\n" +" doStuff() {\n" +" Query q = s.getNamedQuery(\"night.moreRecentThan\");\n" +" q.setDate( \"date\", aMonthAgo );\n" +" List results = q.list();\n" +" ...\n" +" }\n" +" ...\n" +"}" +msgstr "" + +#. Tag: para +#: session_api.xml:361 #, fuzzy, no-c-format msgid "" -"You can also define named queries in the mapping document. Remember to use a " -"CDATA section if your query contains characters that " -"could be interpreted as markup." +"Using a mapping document can be configured using the <query> node. Remember to use a CDATA section if your " +"query contains characters that could be interpreted as markup." msgstr "" "Sie können benannte Anfragen auch im Mapping-Dokument definieren. (Vergessen " "Sie nicht einen CDATA-Abschnitt zu verwenden, falls Ihre " "Anfrage Zeichen enthält, die als Markup interpretiert werden könnten)." -#. Tag: para +#. Tag: title +#: session_api.xml:367 #, no-c-format -msgid "Parameter binding and executing is done programatically:" -msgstr "Die Bindung und Ausführung der Parameter erfolgen befehlsorientiert:" +msgid "Defining a named query using <query>" +msgstr "" + +#. Tag: programlisting +#: session_api.xml:370 +#, fuzzy, no-c-format +msgid "" +"<query name=\"ByNameAndMaximumWeight\"><![CDATA[\n" +" from eg.DomesticCat as cat\n" +" where cat.name = ?\n" +" and cat.weight > ?\n" +"] ]></query>" +msgstr "" +"<query name=\"ByNameAndMaximumWeight\"><![CDATA[\n" +" from eg.DomesticCat as cat\n" +" where cat.name = ?\n" +" and cat.weight > ?\n" +"] ]></query>" #. Tag: para +#: session_api.xml:373 +#, fuzzy, no-c-format +msgid "" +"Parameter binding and executing is done programatically as seen in ." +msgstr "Die Bindung und Ausführung der Parameter erfolgen befehlsorientiert:" + +#. Tag: title +#: session_api.xml:377 +#, no-c-format +msgid "Parameter binding of a named query" +msgstr "" + +#. Tag: programlisting +#: session_api.xml:379 +#, fuzzy, no-c-format +msgid "" +"Query q = sess.getNamedQuery(\"ByNameAndMaximumWeight\");\n" +"q.setString(0, name);\n" +"q.setInt(1, minWeight);\n" +"List cats = q.list();" +msgstr "" +"Query q = sess.getNamedQuery(\"ByNameAndMaximumWeight\");\n" +"q.setString(0, name);\n" +"q.setInt(1, minWeight);\n" +"List cats = q.list();" + +#. Tag: para +#: session_api.xml:382 #, fuzzy, no-c-format msgid "" "The actual program code is independent of the query language that is used. " @@ -884,6 +1392,7 @@ msgstr "" "Sie sie in Mapping-Dateien platzieren." #. Tag: para +#: session_api.xml:387 #, fuzzy, no-c-format msgid "" "Also note that a query declaration inside a <hibernate-" @@ -901,11 +1410,13 @@ msgstr "" "vorangestellt wird." #. Tag: title +#: session_api.xml:397 #, no-c-format msgid "Filtering collections" msgstr "Das Filtern von Collections" #. Tag: para +#: session_api.xml:399 #, fuzzy, no-c-format msgid "" "A collection filter is a special type of query that can " @@ -917,7 +1428,26 @@ msgstr "" "werden kann. Der Anfragenstring kann auf this verweisen, " "womit das aktuelle Element der Collection gemeint ist." +#. Tag: programlisting +#: session_api.xml:404 +#, fuzzy, no-c-format +msgid "" +"Collection blackKittens = session.createFilter(\n" +" pk.getKittens(), \n" +" \"where this.color = ?\")\n" +" .setParameter( Color.BLACK, Hibernate.custom(ColorUserType.class) )\n" +" .list()\n" +");" +msgstr "" +"Collection blackKittens = session.createFilter(\n" +" pk.getKittens(), \n" +" \"where this.color = ?\")\n" +" .setParameter( Color.BLACK, Hibernate.custom(ColorUserType.class) )\n" +" .list()\n" +");" + #. Tag: para +#: session_api.xml:406 #, fuzzy, no-c-format msgid "" "The returned collection is considered a bag that is a copy of the given " @@ -931,6 +1461,7 @@ msgstr "" "mit dem erwarteten Verhalten)." #. Tag: para +#: session_api.xml:411 #, fuzzy, no-c-format msgid "" "Observe that filters do not require a from clause, " @@ -941,7 +1472,22 @@ msgstr "" "(jedoch bei Bedarf einen besitzen können). Filter sind nicht darauf " "beschränkt, die Elemente der Collection selbst wiederzugeben." +#. Tag: programlisting +#: session_api.xml:415 +#, fuzzy, no-c-format +msgid "" +"Collection blackKittenMates = session.createFilter(\n" +" pk.getKittens(), \n" +" \"select this.mate where this.color = eg.Color.BLACK.intValue\")\n" +" .list();" +msgstr "" +"Collection blackKittenMates = session.createFilter(\n" +" pk.getKittens(), \n" +" \"select this.mate where this.color = eg.Color.BLACK.intValue\")\n" +" .list();" + #. Tag: para +#: session_api.xml:417 #, fuzzy, no-c-format msgid "" "Even an empty filter query is useful, e.g. to load a subset of elements in a " @@ -950,12 +1496,28 @@ msgstr "" "Selbst eine Anfrage mit leerem Filter ist von Nutzen, wenn man etwa einen " "Untersatz von Elementen in einer riesigen Collection lädt." +#. Tag: programlisting +#: session_api.xml:420 +#, fuzzy, no-c-format +msgid "" +"Collection tenKittens = session.createFilter(\n" +" mother.getKittens(), \"\")\n" +" .setFirstResult(0).setMaxResults(10)\n" +" .list();" +msgstr "" +"Collection tenKittens = session.createFilter(\n" +" mother.getKittens(), \"\")\n" +" .setFirstResult(0).setMaxResults(10)\n" +" .list();" + #. Tag: title +#: session_api.xml:424 #, no-c-format msgid "Criteria queries" msgstr "Kriterienanfragen" #. Tag: para +#: session_api.xml:426 #, fuzzy, no-c-format msgid "" "HQL is extremely powerful, but some developers prefer to build queries " @@ -968,22 +1530,39 @@ msgstr "" "statt des Erstellens von Anfragenstrings. Hibernate liefert für diese Fälle " "eine API für intuitive Criteria-Anfragen:" +#. Tag: programlisting +#: session_api.xml:431 +#, fuzzy, no-c-format +msgid "" +"Criteria crit = session.createCriteria(Cat.class);\n" +"crit.add( Restrictions.eq( \"color\", eg.Color.BLACK ) );\n" +"crit.setMaxResults(10);\n" +"List cats = crit.list();" +msgstr "" +"Criteria crit = session.createCriteria(Cat.class);\n" +"crit.add( Expression.eq( \"color\", eg.Color.BLACK ) );\n" +"crit.setMaxResults(10);\n" +"List cats = crit.list();" + #. Tag: para +#: session_api.xml:433 #, fuzzy, no-c-format msgid "" "The Criteria and the associated Example API are discussed in more detail in ." +"literal> API are discussed in more detail in ." msgstr "" "Die Criteria und die zugehörige Example-API werden unter näher erläutert." #. Tag: title +#: session_api.xml:439 #, no-c-format msgid "Queries in native SQL" msgstr "Anfragen in nativer SQL" #. Tag: para +#: session_api.xml:441 #, fuzzy, no-c-format msgid "" "You can express a query in SQL, using createSQLQuery() " @@ -1000,23 +1579,62 @@ msgstr "" "Hibernate API verwenden wollen, müssen Sie die SQL-Aliasse in Klammern mit " "einschließen:" +#. Tag: programlisting +#: session_api.xml:448 +#, fuzzy, no-c-format +msgid "" +"List cats = session.createSQLQuery(\"SELECT {cat.*} FROM CAT {cat} WHERE " +"ROWNUM<10\")\n" +" .addEntity(\"cat\", Cat.class)\n" +".list();" +msgstr "" +"List cats = session.createSQLQuery(\n" +" \"SELECT {cat.*} FROM CAT {cat} WHERE ROWNUM<10\",\n" +" \"cat\",\n" +" Cat.class\n" +").list();" + +#. Tag: programlisting +#: session_api.xml:450 +#, fuzzy, no-c-format +msgid "" +"List cats = session.createSQLQuery(\n" +" \"SELECT {cat}.ID AS {cat.id}, {cat}.SEX AS {cat.sex}, \" +\n" +" \"{cat}.MATE AS {cat.mate}, {cat}.SUBCLASS AS {cat.class}, ... \" " +"+\n" +" \"FROM CAT {cat} WHERE ROWNUM<10\")\n" +" .addEntity(\"cat\", Cat.class)\n" +".list()" +msgstr "" +"List cats = session.createSQLQuery(\n" +" \"SELECT {cat}.ID AS {cat.id}, {cat}.SEX AS {cat.sex}, \" +\n" +" \"{cat}.MATE AS {cat.mate}, {cat}.SUBCLASS AS {cat.class}, ... \" " +"+\n" +" \"FROM CAT {cat} WHERE ROWNUM<10\",\n" +" \"cat\",\n" +" Cat.class\n" +").list()" + #. Tag: para +#: session_api.xml:452 #, fuzzy, no-c-format msgid "" "SQL queries can contain named and positional parameters, just like Hibernate " "queries. More information about native SQL queries in Hibernate can be found " -"in ." +"in ." msgstr "" "SQL-Anfragen können - wie auch Hibernate Anfragen - benannte und " "positionelle Parameter enthalten. Weitere Informationen zu nativen SQL-" "Anfragen in Hibernate finden Sie in ." #. Tag: title +#: session_api.xml:459 #, no-c-format msgid "Modifying persistent objects" msgstr "Änderungen an persistenten Objekten vornehmen" #. Tag: para +#: session_api.xml:461 #, fuzzy, no-c-format msgid "" "Transactional persistent instances (i.e. objects " @@ -1041,7 +1659,20 @@ msgstr "" "() und dessen direkte Modifizierung während die Session geöffnet ist:" +#. Tag: programlisting +#: session_api.xml:473 +#, fuzzy, no-c-format +msgid "" +"DomesticCat cat = (DomesticCat) sess.load( Cat.class, new Long(69) );\n" +"cat.setName(\"PK\");\n" +"sess.flush(); // changes to cat are automatically detected and persisted" +msgstr "" +"DomesticCat cat = (DomesticCat) sess.load( Cat.class, new Long(69) );\n" +"cat.setName(\"PK\");\n" +"sess.flush(); // changes to cat are automatically detected and persisted" + #. Tag: para +#: session_api.xml:475 #, fuzzy, no-c-format msgid "" "Sometimes this programming model is inefficient, as it requires in the same " @@ -1056,6 +1687,7 @@ msgstr "" "Verwendung abgesetzter Instanzen eine alternative Vorgehensweise." #. Tag: para +#: session_api.xml:481 #, fuzzy, no-c-format msgid "" "Hibernate does not offer its own API for direct execution of " @@ -1067,7 +1699,7 @@ msgid "" "the notion of mass operations conflicts with object/relational mapping for " "online transaction processing-oriented applications. Future versions of " "Hibernate can, however, provide special mass operation functions. See for some possible batch operation tricks." +"linkend=\"batch\"/> for some possible batch operation tricks." msgstr "" "Bitte beachten Sie, dass Hibernate keine eigene API für die direkte " "Ausführung von UPDATE oder DELETE-" @@ -1084,11 +1716,13 @@ msgstr "" "mögliche Tricks zur Batch-Bearbeitung." #. Tag: title +#: session_api.xml:497 #, no-c-format msgid "Modifying detached objects" msgstr "Änderungen an abgesetzten Objekten" #. Tag: para +#: session_api.xml:499 #, no-c-format msgid "" "Many applications need to retrieve an object in one transaction, send it to " @@ -1105,6 +1739,7 @@ msgstr "" "um die Isolation der \"langen\" Arbeitseinheit zu gewährleisten." #. Tag: para +#: session_api.xml:505 #, no-c-format msgid "" "Hibernate supports this model by providing for reattachment of detached " @@ -1115,7 +1750,36 @@ msgstr "" "update() oder Session.merge()-Methoden die " "Möglichkeit der Wiederanbindung abgesetzter Instanzen bietet:" +#. Tag: programlisting +#: session_api.xml:509 +#, fuzzy, no-c-format +msgid "" +"// in the first session\n" +"Cat cat = (Cat) firstSession.load(Cat.class, catId);\n" +"Cat potentialMate = new Cat();\n" +"firstSession.save(potentialMate);\n" +"\n" +"// in a higher layer of the application\n" +"cat.setMate(potentialMate);\n" +"\n" +"// later, in a new session\n" +"secondSession.update(cat); // update cat\n" +"secondSession.update(mate); // update mate" +msgstr "" +"// in the first session\n" +"Cat cat = (Cat) firstSession.load(Cat.class, catId);\n" +"Cat potentialMate = new Cat();\n" +"firstSession.save(potentialMate);\n" +"\n" +"// in a higher layer of the application\n" +"cat.setMate(potentialMate);\n" +"\n" +"// later, in a new session\n" +"secondSession.update(cat); // update cat\n" +"secondSession.update(mate); // update mate" + #. Tag: para +#: session_api.xml:511 #, no-c-format msgid "" "If the Cat with identifier catId had " @@ -1128,6 +1792,7 @@ msgstr "" "gemeldet worden." #. Tag: para +#: session_api.xml:516 #, fuzzy, no-c-format msgid "" "Use update() if you are certain that the session does not " @@ -1148,13 +1813,14 @@ msgstr "" "als erstes ausgeführte Vorgang ist." #. Tag: para +#: session_api.xml:524 #, fuzzy, no-c-format msgid "" "The application should individually update() detached " "instances that are reachable from the given detached instance " "only if it wants their state to be updated. This can be " "automated using transitive persistence. See for more information." +"linkend=\"objectstate-transitive\"/> for more information." msgstr "" "Die Anwendung sollte von der gegebenen abgesetzten Instanz aus erreichbare " "abgesetzte Instanzen einzeln mittels update() " @@ -1164,6 +1830,7 @@ msgstr "" "." #. Tag: para +#: session_api.xml:530 #, fuzzy, no-c-format msgid "" "The lock() method also allows an application to " @@ -1174,7 +1841,26 @@ msgstr "" "ebenfalls, ein Objekt mit einer neuen Session zu re-assoziieren. Allerdings " "darf die abgesetzte Instanz in diesem Fall nicht verändert worden sein!" +#. Tag: programlisting +#: session_api.xml:534 +#, fuzzy, no-c-format +msgid "" +"//just reassociate:\n" +"sess.lock(fritz, LockMode.NONE);\n" +"//do a version check, then reassociate:\n" +"sess.lock(izi, LockMode.READ);\n" +"//do a version check, using SELECT ... FOR UPDATE, then reassociate:\n" +"sess.lock(pk, LockMode.UPGRADE);" +msgstr "" +"//just reassociate:\n" +"sess.lock(fritz, LockMode.NONE);\n" +"//do a version check, then reassociate:\n" +"sess.lock(izi, LockMode.READ);\n" +"//do a version check, using SELECT ... FOR UPDATE, then reassociate:\n" +"sess.lock(pk, LockMode.UPGRADE);" + #. Tag: para +#: session_api.xml:536 #, fuzzy, no-c-format msgid "" "Note that lock() can be used with various " @@ -1189,20 +1875,23 @@ msgstr "" "lock()." #. Tag: para +#: session_api.xml:541 #, fuzzy, no-c-format msgid "" "Other models for long units of work are discussed in ." +"\"transactions-optimistic\"/>." msgstr "" "Andere Modelle für lange Arbeitseinheiten werden in erläutert." #. Tag: title +#: session_api.xml:546 #, no-c-format msgid "Automatic state detection" msgstr "Automatische Statuserkennung" #. Tag: para +#: session_api.xml:548 #, no-c-format msgid "" "Hibernate users have requested a general purpose method that either saves a " @@ -1216,7 +1905,38 @@ msgstr "" "abgesetzten Instanzen aktualisiert/erneut hinzufügt. Die " "saveOrUpdate()-Methode implementiert diese Funktionalität." +#. Tag: programlisting +#: session_api.xml:554 +#, fuzzy, no-c-format +msgid "" +"// in the first session\n" +"Cat cat = (Cat) firstSession.load(Cat.class, catID);\n" +"\n" +"// in a higher tier of the application\n" +"Cat mate = new Cat();\n" +"cat.setMate(mate);\n" +"\n" +"// later, in a new session\n" +"secondSession.saveOrUpdate(cat); // update existing state (cat has a non-" +"null id)\n" +"secondSession.saveOrUpdate(mate); // save the new instance (mate has a null " +"id)" +msgstr "" +"// in the first session\n" +"Cat cat = (Cat) firstSession.load(Cat.class, catID);\n" +"\n" +"// in a higher tier of the application\n" +"Cat mate = new Cat();\n" +"cat.setMate(mate);\n" +"\n" +"// later, in a new session\n" +"secondSession.saveOrUpdate(cat); // update existing state (cat has a non-" +"null id)\n" +"secondSession.saveOrUpdate(mate); // save the new instance (mate has a null " +"id)" + #. Tag: para +#: session_api.xml:556 #, no-c-format msgid "" "The usage and semantics of saveOrUpdate() seems to be " @@ -1234,6 +1954,7 @@ msgstr "" "ganze Anwendungen ohne irgendeine dieser Methoden aus." #. Tag: para +#: session_api.xml:563 #, no-c-format msgid "" "Usually update() or saveOrUpdate() are " @@ -1243,26 +1964,31 @@ msgstr "" " in folgenden Situationen zum Einsatz:" #. Tag: para +#: session_api.xml:569 #, no-c-format msgid "the application loads an object in the first session" msgstr "die Anwendung lädt ein Objekt in der ersten Session" #. Tag: para +#: session_api.xml:573 #, no-c-format msgid "the object is passed up to the UI tier" msgstr "das Objekt wird an den UI-\"Tier\" weitergegeben" #. Tag: para +#: session_api.xml:577 #, no-c-format msgid "some modifications are made to the object" msgstr "am Objekt werden einige Modifikationen vorgenommen" #. Tag: para +#: session_api.xml:581 #, no-c-format msgid "the object is passed back down to the business logic tier" msgstr "das Objekt wird zurück an den \"Business-Logic-Tier\" geleitet" #. Tag: para +#: session_api.xml:585 #, no-c-format msgid "" "the application persists these modifications by calling update()update() in einer zweiten Session" #. Tag: para +#: session_api.xml:590 #, no-c-format msgid "saveOrUpdate() does the following:" msgstr "saveOrUpdate() tut folgendes:" #. Tag: para +#: session_api.xml:594 #, no-c-format msgid "if the object is already persistent in this session, do nothing" msgstr "" "falls das Objekt in dieser Session bereits persistent ist, geschieht nichts" #. Tag: para +#: session_api.xml:599 #, no-c-format msgid "" "if another object associated with the session has the same identifier, throw " @@ -1292,6 +2021,7 @@ msgstr "" "besitzt, wird eine Ausnahme gemeldet" #. Tag: para +#: session_api.xml:604 #, no-c-format msgid "if the object has no identifier property, save() it" msgstr "" @@ -1299,6 +2029,7 @@ msgstr "" "save()" #. Tag: para +#: session_api.xml:609 #, no-c-format msgid "" "if the object's identifier has the value assigned to a newly instantiated " @@ -1309,6 +2040,7 @@ msgstr "" "literal>" #. Tag: para +#: session_api.xml:614 #, fuzzy, no-c-format msgid "" "if the object is versioned by a <version> or " @@ -1322,17 +2054,20 @@ msgstr "" "speichern Sie mittels save()" #. Tag: para +#: session_api.xml:622 #, no-c-format msgid "otherwise update() the object" msgstr "" "andernfalls aktualisieren Sie das Objekt mittels update()" #. Tag: para +#: session_api.xml:626 #, no-c-format msgid "and merge() is very different:" msgstr "und merge() ist völlig anders:" #. Tag: para +#: session_api.xml:630 #, no-c-format msgid "" "if there is a persistent instance with the same identifier currently " @@ -1344,6 +2079,7 @@ msgstr "" "vorgegebenen Objekts in die persistente Instanz" #. Tag: para +#: session_api.xml:636 #, no-c-format msgid "" "if there is no persistent instance currently associated with the session, " @@ -1354,11 +2090,13 @@ msgstr "" "erstellen Sie eine neue persistente Instanz" #. Tag: para +#: session_api.xml:642 #, no-c-format msgid "the persistent instance is returned" msgstr "die persistente Instanz wird zurückgeschickt" #. Tag: para +#: session_api.xml:646 #, no-c-format msgid "" "the given instance does not become associated with the session, it remains " @@ -1368,11 +2106,13 @@ msgstr "" "abgesetzt" #. Tag: title +#: session_api.xml:653 #, no-c-format msgid "Deleting persistent objects" msgstr "Das Löschen persistenter Objekte" #. Tag: para +#: session_api.xml:655 #, fuzzy, no-c-format msgid "" "Session.delete() will remove an object's state from the " @@ -1385,7 +2125,14 @@ msgstr "" "Verweis auf ein gelöschtes Objekt beinhalten. Durch delete() wird eine persistente Instanz gewissermaßen transient gemacht." +#. Tag: programlisting +#: session_api.xml:660 +#, fuzzy, no-c-format +msgid "sess.delete(cat);" +msgstr "sess.delete(cat);" + #. Tag: para +#: session_api.xml:662 #, fuzzy, no-c-format msgid "" "You can delete objects in any order, without risk of foreign key constraint " @@ -1401,11 +2148,13 @@ msgstr "" "vergessen, dies mit den untergeordneten Objekten ebenfalls zu tun." #. Tag: title +#: session_api.xml:670 #, no-c-format msgid "Replicating object between two different datastores" msgstr "Objektreplikation zwischen zwei verschiedenen Datenspeichern" #. Tag: para +#: session_api.xml:672 #, fuzzy, no-c-format msgid "" "It is sometimes useful to be able to take a graph of persistent instances " @@ -1416,7 +2165,40 @@ msgstr "" "zu können und diese in einem anderen Datenspeicher persistent machen zu " "können, ohne Bezeichnerwerte erneut generieren zu müssen." +#. Tag: programlisting +#: session_api.xml:676 +#, fuzzy, no-c-format +msgid "" +"//retrieve a cat from one database\n" +"Session session1 = factory1.openSession();\n" +"Transaction tx1 = session1.beginTransaction();\n" +"Cat cat = session1.get(Cat.class, catId);\n" +"tx1.commit();\n" +"session1.close();\n" +"\n" +"//reconcile with a second database\n" +"Session session2 = factory2.openSession();\n" +"Transaction tx2 = session2.beginTransaction();\n" +"session2.replicate(cat, ReplicationMode.LATEST_VERSION);\n" +"tx2.commit();\n" +"session2.close();" +msgstr "" +"//retrieve a cat from one database\n" +"Session session1 = factory1.openSession();\n" +"Transaction tx1 = session1.beginTransaction();\n" +"Cat cat = session1.get(Cat.class, catId);\n" +"tx1.commit();\n" +"session1.close();\n" +"\n" +"//reconcile with a second database\n" +"Session session2 = factory2.openSession();\n" +"Transaction tx2 = session2.beginTransaction();\n" +"session2.replicate(cat, ReplicationMode.LATEST_VERSION);\n" +"tx2.commit();\n" +"session2.close();" + #. Tag: para +#: session_api.xml:678 #, fuzzy, no-c-format msgid "" "The ReplicationMode determines how replicate() mit Konflikten mit bestehenden Reihen in der Datenbank umgeht." #. Tag: para +#: session_api.xml:684 #, fuzzy, no-c-format msgid "" "ReplicationMode.IGNORE: ignores the object when there is " @@ -1435,6 +2218,7 @@ msgstr "" "bereits eine Datenbankreihe mit demselben Bezeichner existiert" #. Tag: para +#: session_api.xml:689 #, fuzzy, no-c-format msgid "" "ReplicationMode.OVERWRITE: overwrites any existing " @@ -1444,6 +2228,7 @@ msgstr "" "Datenbankreihe mit demselben Bezeichner" #. Tag: para +#: session_api.xml:694 #, fuzzy, no-c-format msgid "" "ReplicationMode.EXCEPTION: throws an exception if there " @@ -1453,6 +2238,7 @@ msgstr "" "eine Datenbankreihe mit demselben Bezeichner existiert" #. Tag: para +#: session_api.xml:700 #, fuzzy, no-c-format msgid "" "ReplicationMode.LATEST_VERSION: overwrites the row if its " @@ -1464,6 +2250,7 @@ msgstr "" "oder ignoriert andernfalls das Objekt" #. Tag: para +#: session_api.xml:706 #, no-c-format msgid "" "Usecases for this feature include reconciling data entered into different " @@ -1477,11 +2264,13 @@ msgstr "" "von während nicht-ACID Transaktionen gemachten Änderungen und mehr." #. Tag: title +#: session_api.xml:713 #, no-c-format msgid "Flushing the Session" msgstr "Das Räumen der Session" #. Tag: para +#: session_api.xml:715 #, fuzzy, no-c-format msgid "" "Sometimes the Session will execute the SQL statements " @@ -1496,26 +2285,31 @@ msgstr "" "emphasis>" #. Tag: para +#: session_api.xml:723 #, no-c-format msgid "before some query executions" msgstr "vor dem Ausführen einiger Anfragen" #. Tag: para +#: session_api.xml:727 #, no-c-format msgid "from org.hibernate.Transaction.commit()" msgstr "von org.hibernate.Transaction.commit()" #. Tag: para +#: session_api.xml:732 #, no-c-format msgid "from Session.flush()" msgstr "von Session.flush()" #. Tag: para +#: session_api.xml:736 #, fuzzy, no-c-format msgid "The SQL statements are issued in the following order:" msgstr "Die SQL-Anweisungen werden in der folgenden Reihenfolge herausgegeben" #. Tag: para +#: session_api.xml:740 #, fuzzy, no-c-format msgid "" "all entity insertions in the same order the corresponding objects were saved " @@ -1525,16 +2319,19 @@ msgstr "" "wurden mittels Session.save() gespeichert" #. Tag: para +#: session_api.xml:745 #, no-c-format msgid "all entity updates" msgstr "alle Entity-Aktualisierungen" #. Tag: para +#: session_api.xml:749 #, no-c-format msgid "all collection deletions" msgstr "alle Collection-Löschungen" #. Tag: para +#: session_api.xml:753 #, no-c-format msgid "all collection element deletions, updates and insertions" msgstr "" @@ -1542,11 +2339,13 @@ msgstr "" "Collection" #. Tag: para +#: session_api.xml:757 #, no-c-format msgid "all collection insertions" msgstr "alle Einfügungen in Collections" #. Tag: para +#: session_api.xml:761 #, fuzzy, no-c-format msgid "" "all entity deletions in the same order the corresponding objects were " @@ -1557,6 +2356,7 @@ msgstr "" "literal>" #. Tag: para +#: session_api.xml:766 #, fuzzy, no-c-format msgid "" "An exception is that objects using native ID generation " @@ -1566,6 +2366,7 @@ msgstr "" "Generierung verwenden, beim Speichern eingefügt werden)." #. Tag: para +#: session_api.xml:769 #, fuzzy, no-c-format msgid "" "Except when you explicitly flush(), there are absolutely " @@ -1582,6 +2383,7 @@ msgstr "" "liefert." #. Tag: para +#: session_api.xml:776 #, fuzzy, no-c-format msgid "" "It is possible to change the default behavior so that flush occurs less " @@ -1591,7 +2393,7 @@ msgid "" "never flush unless flush() is called explicitly. The last " "mode is useful for long running units of work, where a Session is kept open and disconnected for a long time (see )." +"\"transactions-optimistic-longsession\"/>)." msgstr "" "Es ist möglich das Verhalten in der Standardeinstellung so zu verändern, " "dass die Räumung seltener erfolgt.Die FlushMode-Klasse " @@ -1604,13 +2406,48 @@ msgstr "" "längere Zeit hinweg geöffnet und abgekuppelt bleibt (siehe )." +#. Tag: programlisting +#: session_api.xml:786 +#, fuzzy, no-c-format +msgid "" +"sess = sf.openSession();\n" +"Transaction tx = sess.beginTransaction();\n" +"sess.setFlushMode(FlushMode.COMMIT); // allow queries to return stale state\n" +"\n" +"Cat izi = (Cat) sess.load(Cat.class, id);\n" +"izi.setName(iznizi);\n" +"\n" +"// might return stale data\n" +"sess.find(\"from Cat as cat left outer join cat.kittens kitten\");\n" +"\n" +"// change to izi is not flushed!\n" +"...\n" +"tx.commit(); // flush occurs\n" +"sess.close();" +msgstr "" +"sess = sf.openSession();\n" +"Transaction tx = sess.beginTransaction();\n" +"sess.setFlushMode(FlushMode.COMMIT); // allow queries to return stale state\n" +"\n" +"Cat izi = (Cat) sess.load(Cat.class, id);\n" +"izi.setName(iznizi);\n" +"\n" +"// might return stale data\n" +"sess.find(\"from Cat as cat left outer join cat.kittens kitten\");\n" +"\n" +"// change to izi is not flushed!\n" +"...\n" +"tx.commit(); // flush occurs\n" +"sess.close();" + #. Tag: para +#: session_api.xml:788 #, fuzzy, no-c-format msgid "" "During flush, an exception might occur (e.g. if a DML operation violates a " "constraint). Since handling exceptions involves some understanding of " "Hibernate's transactional behavior, we discuss it in ." +"\"transactions\"/>." msgstr "" "Während der Räumung kann es zu einer Ausnahmemeldung kommen (wenn z.B. ein " "DML-Vorgang eine Bedingung verletzt). Da der Umgang mit Ausnahmen ein " @@ -1618,11 +2455,13 @@ msgstr "" "voraussetzt, erläutern wir es in ." #. Tag: title +#: session_api.xml:795 #, no-c-format msgid "Transitive persistence" msgstr "Transitive Persistenz" #. Tag: para +#: session_api.xml:797 #, no-c-format msgid "" "It is quite cumbersome to save, delete, or reattach individual objects, " @@ -1636,6 +2475,7 @@ msgstr "" "Beziehung). Sehen Sie sich das folgende Beispiel an:" #. Tag: para +#: session_api.xml:802 #, fuzzy, no-c-format msgid "" "If the children in a parent/child relationship would be value typed (e.g. a " @@ -1660,6 +2500,7 @@ msgstr "" "wird das untergeordnete Objekt aus der Datenbank gelöscht." #. Tag: para +#: session_api.xml:812 #, fuzzy, no-c-format msgid "" "Now consider the same scenario with parent and child objects being entities, " @@ -1681,6 +2522,7 @@ msgstr "" "Erreichbarkeit." #. Tag: para +#: session_api.xml:820 #, no-c-format msgid "" "For each basic operation of the Hibernate session - including " @@ -1699,13 +2541,27 @@ msgstr "" "möchten, dass ein Vorgang entlang einer Assoziation weitergegeben wird, so " "müssen Sie dass im Mapping-Dokument angeben. Zum Beispiel wie folgt aussehen:" +#. Tag: programlisting +#: session_api.xml:828 +#, fuzzy, no-c-format +msgid "<one-to-one name=\"person\" cascade=\"persist\"/>" +msgstr "<one-to-one name=\"person\" cascade=\"persist\"/>" + #. Tag: para +#: session_api.xml:830 #, no-c-format msgid "Cascade styles my be combined:" msgstr "" "Die Arten der Weitergabe (sog. \"Cascade Styles\") können kombiniert werden:" +#. Tag: programlisting +#: session_api.xml:832 +#, fuzzy, no-c-format +msgid "<one-to-one name=\"person\" cascade=\"persist,delete,lock\"/>" +msgstr "<one-to-one name=\"person\" cascade=\"persist,delete,lock\"/>" + #. Tag: para +#: session_api.xml:834 #, fuzzy, no-c-format msgid "" "You can even use cascade=\"all\" to specify that " @@ -1719,30 +2575,133 @@ msgstr "" "festgelegt, dass keine Vorgänge weitergegeben werden." #. Tag: para +#: session_api.xml:839 +#, no-c-format +msgid "" +"In case you are using annotatons you probably have noticed the " +"cascade attribute taking an array of " +"CascadeType as a value. The cascade concept in JPA is " +"very is similar to the transitive persistence and cascading of operations as " +"described above, but with slightly different semantics and cascading types:" +msgstr "" + +#. Tag: para +#: session_api.xml:848 +#, no-c-format +msgid "" +"CascadeType.PERSIST: cascades the persist (create) " +"operation to associated entities persist() is called or if the entity is " +"managed" +msgstr "" + +#. Tag: para +#: session_api.xml:854 +#, no-c-format +msgid "" +"CascadeType.MERGE: cascades the merge operation to " +"associated entities if merge() is called or if the entity is managed" +msgstr "" + +#. Tag: para +#: session_api.xml:860 +#, no-c-format +msgid "" +"CascadeType.REMOVE: cascades the remove operation to " +"associated entities if delete() is called" +msgstr "" + +#. Tag: para +#: session_api.xml:865 +#, no-c-format +msgid "" +"CascadeType.REFRESH: cascades the refresh operation to " +"associated entities if refresh() is called" +msgstr "" + +#. Tag: para +#: session_api.xml:870 +#, no-c-format +msgid "" +"CascadeType.DETACH: cascades the detach operation to " +"associated entities if detach() is called" +msgstr "" + +#. Tag: para +#: session_api.xml:875 +#, fuzzy, no-c-format +msgid "CascadeType.ALL: all of the above" +msgstr "saveOrUpdate() tut folgendes:" + +#. Tag: para +#: session_api.xml:880 +#, no-c-format +msgid "" +"CascadeType.ALL also covers Hibernate specific operations like save-update, " +"lock etc..." +msgstr "" + +#. Tag: para +#: session_api.xml:884 #, no-c-format msgid "" "A special cascade style, delete-orphan, applies only to " "one-to-many associations, and indicates that the delete() " "operation should be applied to any child object that is removed from the " -"association." +"association. Using annotations there is no CascadeType.DELETE-" +"ORPHAN equivalent. Instead you can use the attribute " +"orphanRemoval as seen in . If an entity is removed from a " +"@OneToMany collection or an associated entity is " +"dereferenced from a @OneToOne association, this " +"associated entity can be marked for deletion if orphanRemoval is set to true." +msgstr "" + +#. Tag: title +#: session_api.xml:897 +#, no-c-format +msgid "@OneToMany with orphanRemoval" +msgstr "" + +#. Tag: programlisting +#: session_api.xml:900 +#, no-c-format +msgid "" +"@Entity \n" +"public class Customer {\n" +" private Set<Order> orders;\n" +"\n" +" @OneToMany(cascade=CascadeType.ALL, orphanRemoval=true) \n" +" public Set<Order> getOrders() { return orders; }\n" +"\n" +" public void setOrders(Set<Order> orders) { this.orders = orders; }\n" +"\n" +" [...]\n" +"}\n" +"\n" +"@Entity \n" +"public class Order { ... }\n" +"\n" +"Customer customer = em.find(Customer.class, 1l);\n" +"Order order = em.find(Order.class, 1l);\n" +"customer.getOrders().remove(order); //order will be deleted by cascade" msgstr "" -"Eine besondere Art der Weitergabe namens delete-orphan " -"gilt nur bei \"One-to-Many\"-Assoziationen und zeigt an, dass der " -"delete()-Vorgang angewendet werden soll, wenn ein " -"untergeordnetes Objekt aus der Assoziation entfernt wird." #. Tag: para +#: session_api.xml:903 #, no-c-format msgid "Recommendations:" msgstr "Empfehlungen:" #. Tag: para +#: session_api.xml:907 #, fuzzy, no-c-format msgid "" -"It does not usually make sense to enable cascade on a <many-to-" -"one> or <many-to-many> association. " -"Cascade is often useful for <one-to-one> and " -"<one-to-many> associations." +"It does not usually make sense to enable cascade on a many-to-one or many-to-" +"many association. In fact the @ManyToOne and " +"@ManyToMany don't even offer a orphanRemoval attribute. Cascading is often useful for one-to-one and one-to-many " +"associations." msgstr "" "Es macht in der Regel keinen Sinn, die Weitergabe bei einer <" "many-to-one> oder <many-to-many>-" @@ -1751,11 +2710,13 @@ msgstr "" "Assoziationen von Nutzen." #. Tag: para +#: session_api.xml:915 #, fuzzy, no-c-format msgid "" "If the child object's lifespan is bounded by the lifespan of the parent " "object, make it a life cycle object by specifying " -"cascade=\"all,delete-orphan\"." +"cascade=\"all,delete-orphan\"(@OneToMany" +"(cascade=CascadeType.ALL, orphanRemoval=true))." msgstr "" "Falls die Lebensdauer des untergeordneten Objekts an die Lebensdauer des " "übergeordneten Objekts gebunden ist, erklären Sie es zum " @@ -1763,6 +2724,7 @@ msgstr "" "orphan\" festlegen." #. Tag: para +#: session_api.xml:923 #, no-c-format msgid "" "Otherwise, you might not need cascade at all. But if you think that you will " @@ -1776,6 +2738,7 @@ msgstr "" "cascade=\"persist,merge,save-update\" verwenden." #. Tag: para +#: session_api.xml:931 #, no-c-format msgid "" "Mapping an association (either a single valued association, or a collection) " @@ -1791,15 +2754,16 @@ msgstr "" "untergeordneten Objekts (oder Objekte) führt." #. Tag: para +#: session_api.xml:937 #, fuzzy, no-c-format msgid "" "Furthermore, a mere reference to a child from a persistent parent will " "result in save/update of the child. This metaphor is incomplete, however. A " "child which becomes unreferenced by its parent is not " -"automatically deleted, except in the case of a <one-to-many> association mapped with cascade=\"delete-orphan\". The precise semantics of cascading operations for a parent/child " -"relationship are as follows:" +"automatically deleted, except in the case of a one-to-many association " +"mapped with cascade=\"delete-orphan\". The precise " +"semantics of cascading operations for a parent/child relationship are as " +"follows:" msgstr "" "Desweiteren führt schon der Verweis eines übergeordneten Objektes auf ein " "untergeordnetes Objekt zur Speicherung/Aktualisierung des letzteren. Diese " @@ -1811,6 +2775,7 @@ msgstr "" "\"Parent\"/\"Child\"-Beziehung lautet wie folgt:" #. Tag: para +#: session_api.xml:948 #, no-c-format msgid "" "If a parent is passed to persist(), all children are " @@ -1820,6 +2785,7 @@ msgstr "" "sämtliche \"Children\" ebenfalls persist()" #. Tag: para +#: session_api.xml:953 #, no-c-format msgid "" "If a parent is passed to merge(), all children are passed " @@ -1829,6 +2795,7 @@ msgstr "" "sämtliche \"Children\" ebenfalls merge()" #. Tag: para +#: session_api.xml:958 #, no-c-format msgid "" "If a parent is passed to save(), update()saveOrUpdate()" #. Tag: para +#: session_api.xml:964 #, no-c-format msgid "" "If a transient or detached child becomes referenced by a persistent parent, " @@ -1850,6 +2818,7 @@ msgstr "" "" #. Tag: para +#: session_api.xml:970 #, no-c-format msgid "" "If a parent is deleted, all children are passed to delete()delete()" #. Tag: para +#: session_api.xml:975 #, no-c-format msgid "" "If a child is dereferenced by a persistent parent, nothing special " @@ -1873,6 +2843,7 @@ msgstr "" "\" Child gelöscht wird." #. Tag: para +#: session_api.xml:983 #, fuzzy, no-c-format msgid "" "Finally, note that cascading of operations can be applied to an object graph " @@ -1892,11 +2863,13 @@ msgstr "" "transitiv." #. Tag: title +#: session_api.xml:993 #, no-c-format msgid "Using metadata" msgstr "Die Verwendung von Metadata" #. Tag: para +#: session_api.xml:995 #, fuzzy, no-c-format msgid "" "Hibernate requires a rich meta-level model of all entity and value types. " @@ -1915,6 +2888,7 @@ msgstr "" "und möglicherweise zugehörige Entities)." #. Tag: para +#: session_api.xml:1002 #, fuzzy, no-c-format msgid "" "Hibernate exposes metadata via the ClassMetadata and " @@ -1927,650 +2901,49 @@ msgstr "" "literal>-Hierarchie dar. Instanzen der Metadata-Interfaces sind durch die " "SessionFactory verfügbar." -#, fuzzy +#. Tag: programlisting +#: session_api.xml:1007 +#, fuzzy, no-c-format +msgid "" +"Cat fritz = ......;\n" +"ClassMetadata catMeta = sessionfactory.getClassMetadata(Cat.class);\n" +"\n" +"Object[] propertyValues = catMeta.getPropertyValues(fritz);\n" +"String[] propertyNames = catMeta.getPropertyNames();\n" +"Type[] propertyTypes = catMeta.getPropertyTypes();\n" +"\n" +"// get a Map of all properties which are not collections or associations\n" +"Map namedValues = new HashMap();\n" +"for ( int i=0; i<propertyNames.length; i++ ) {\n" +" if ( !propertyTypes[i].isEntityType() && !propertyTypes[i]." +"isCollectionType() ) {\n" +" namedValues.put( propertyNames[i], propertyValues[i] );\n" +" }\n" +"}" +msgstr "" +"Cat fritz = ......;\n" +"ClassMetadata catMeta = sessionfactory.getClassMetadata(Cat.class);\n" +"\n" +"Object[] propertyValues = catMeta.getPropertyValues(fritz);\n" +"String[] propertyNames = catMeta.getPropertyNames();\n" +"Type[] propertyTypes = catMeta.getPropertyTypes();\n" +"\n" +"// get a Map of all properties which are not collections or associations\n" +"Map namedValues = new HashMap();\n" +"for ( int i=0; i<propertyNames.length; i++ ) {\n" +" if ( !propertyTypes[i].isEntityType() && !propertyTypes[i]." +"isCollectionType() ) {\n" +" namedValues.put( propertyNames[i], propertyValues[i] );\n" +" }\n" +"}" + #~ msgid "" -#~ "" +#~ "A special cascade style, delete-orphan, applies only " +#~ "to one-to-many associations, and indicates that the delete() operation should be applied to any child object that is removed " +#~ "from the association." #~ msgstr "" -#~ "DomesticCat fritz = new DomesticCat();\n" -#~ "fritz.setColor(Color.GINGER);\n" -#~ "fritz.setSex('M');\n" -#~ "fritz.setName(\"Fritz\");\n" -#~ "Long generatedId = (Long) sess.save(fritz);" - -#, fuzzy -#~ msgid "" -#~ "" -#~ msgstr "" -#~ "DomesticCat pk = new DomesticCat();\n" -#~ "pk.setColor(Color.TABBY);\n" -#~ "pk.setSex('F');\n" -#~ "pk.setName(\"PK\");\n" -#~ "pk.setKittens( new HashSet() );\n" -#~ "pk.addKitten(fritz);\n" -#~ "sess.save( pk, new Long(1234) );" - -#, fuzzy -#~ msgid "" -#~ msgstr "Cat fritz = (Cat) sess.load(Cat.class, generatedId);" - -#, fuzzy -#~ msgid "" -#~ "" -#~ msgstr "" -#~ "// you need to wrap primitive identifiers\n" -#~ "long id = 1234;\n" -#~ "DomesticCat pk = (DomesticCat) sess.load( DomesticCat.class, new Long" -#~ "(id) );" - -#, fuzzy -#~ msgid "" -#~ "" -#~ msgstr "" -#~ "Cat cat = new DomesticCat();\n" -#~ "// load pk's state into cat\n" -#~ "sess.load( cat, new Long(pkId) );\n" -#~ "Set kittens = cat.getKittens();" - -#, fuzzy -#~ msgid "" -#~ "" -#~ msgstr "" -#~ "Cat cat = (Cat) sess.get(Cat.class, id);\n" -#~ "if (cat==null) {\n" -#~ " cat = new Cat();\n" -#~ " sess.save(cat, id);\n" -#~ "}\n" -#~ "return cat;" - -#, fuzzy -#~ msgid "" -#~ "" -#~ msgstr "Cat cat = (Cat) sess.get(Cat.class, id, LockMode.UPGRADE);" - -#, fuzzy -#~ msgid "" -#~ "" -#~ msgstr "" -#~ "sess.save(cat);\n" -#~ "sess.flush(); //force the SQL INSERT\n" -#~ "sess.refresh(cat); //re-read the state (after the trigger executes)" - -#, fuzzy -#~ msgid "" -#~ "" -#~ msgstr "" -#~ "List cats = session.createQuery(\n" -#~ " \"from Cat as cat where cat.birthdate < ?\")\n" -#~ " .setDate(0, date)\n" -#~ " .list();\n" -#~ "\n" -#~ "List mothers = session.createQuery(\n" -#~ " \"select mother from Cat as cat join cat.mother as mother where cat." -#~ "name = ?\")\n" -#~ " .setString(0, name)\n" -#~ " .list();\n" -#~ "\n" -#~ "List kittens = session.createQuery(\n" -#~ " \"from Cat as cat where cat.mother = ?\")\n" -#~ " .setEntity(0, pk)\n" -#~ " .list();\n" -#~ "\n" -#~ "Cat mother = (Cat) session.createQuery(\n" -#~ " \"select cat.mother from Cat as cat where cat = ?\")\n" -#~ " .setEntity(0, izi)\n" -#~ " .uniqueResult();]]\n" -#~ "\n" -#~ "Query mothersWithKittens = (Cat) session.createQuery(\n" -#~ " \"select mother from Cat as mother left join fetch mother.kittens" -#~ "\");\n" -#~ "Set uniqueMothers = new HashSet(mothersWithKittens.list());" - -#, fuzzy -#~ msgid "" -#~ "" -#~ msgstr "" -#~ "// fetch ids\n" -#~ "Iterator iter = sess.createQuery(\"from eg.Qux q order by q.likeliness\")." -#~ "iterate();\n" -#~ "while ( iter.hasNext() ) {\n" -#~ " Qux qux = (Qux) iter.next(); // fetch the object\n" -#~ " // something we couldnt express in the query\n" -#~ " if ( qux.calculateComplicatedAlgorithm() ) {\n" -#~ " // delete the current instance\n" -#~ " iter.remove();\n" -#~ " // dont need to process the rest\n" -#~ " break;\n" -#~ " }\n" -#~ "}" - -#, fuzzy -#~ msgid "" -#~ "" -#~ msgstr "" -#~ "Iterator kittensAndMothers = sess.createQuery(\n" -#~ " \"select kitten, mother from Cat kitten join kitten.mother " -#~ "mother\")\n" -#~ " .list()\n" -#~ " .iterator();\n" -#~ "\n" -#~ "while ( kittensAndMothers.hasNext() ) {\n" -#~ " Object[] tuple = (Object[]) kittensAndMothers.next();\n" -#~ " Cat kitten = tuple[0];\n" -#~ " Cat mother = tuple[1];\n" -#~ " ....\n" -#~ "}" - -#, fuzzy -#~ msgid "" -#~ "" -#~ msgstr "" -#~ "Iterator results = sess.createQuery(\n" -#~ " \"select cat.color, min(cat.birthdate), count(cat) from Cat cat " -#~ "\" +\n" -#~ " \"group by cat.color\")\n" -#~ " .list()\n" -#~ " .iterator();\n" -#~ "\n" -#~ "while ( results.hasNext() ) {\n" -#~ " Object[] row = (Object[]) results.next();\n" -#~ " Color type = (Color) row[0];\n" -#~ " Date oldest = (Date) row[1];\n" -#~ " Integer count = (Integer) row[2];\n" -#~ " .....\n" -#~ "}" - -#, fuzzy -#~ msgid "" -#~ "" -#~ msgstr "" -#~ "//named parameter (preferred)\n" -#~ "Query q = sess.createQuery(\"from DomesticCat cat where cat.name = :name" -#~ "\");\n" -#~ "q.setString(\"name\", \"Fritz\");\n" -#~ "Iterator cats = q.iterate();" - -#, fuzzy -#~ msgid "" -#~ "" -#~ msgstr "" -#~ "//positional parameter\n" -#~ "Query q = sess.createQuery(\"from DomesticCat cat where cat.name = ?\");\n" -#~ "q.setString(0, \"Izi\");\n" -#~ "Iterator cats = q.iterate();" - -#, fuzzy -#~ msgid "" -#~ "" -#~ msgstr "" -#~ "//named parameter list\n" -#~ "List names = new ArrayList();\n" -#~ "names.add(\"Izi\");\n" -#~ "names.add(\"Fritz\");\n" -#~ "Query q = sess.createQuery(\"from DomesticCat cat where cat.name in (:" -#~ "namesList)\");\n" -#~ "q.setParameterList(\"namesList\", names);\n" -#~ "List cats = q.list();" - -#, fuzzy -#~ msgid "" -#~ "" -#~ msgstr "" -#~ "Query q = sess.createQuery(\"from DomesticCat cat\");\n" -#~ "q.setFirstResult(20);\n" -#~ "q.setMaxResults(10);\n" -#~ "List cats = q.list();" - -#, fuzzy -#~ msgid "" -#~ " i++ ) && cats.next() ) pageOfCats.add( cats.get" -#~ "(1) );\n" -#~ "\n" -#~ "}\n" -#~ "cats.close()]]>" -#~ msgstr "" -#~ "Query q = sess.createQuery(\"select cat.name, cat from DomesticCat cat \" " -#~ "+\n" -#~ " \"order by cat.name\");\n" -#~ "ScrollableResults cats = q.scroll();\n" -#~ "if ( cats.first() ) {\n" -#~ "\n" -#~ " // find the first name on each page of an alphabetical list of cats " -#~ "by name\n" -#~ " firstNamesOfPages = new ArrayList();\n" -#~ " do {\n" -#~ " String name = cats.getString(0);\n" -#~ " firstNamesOfPages.add(name);\n" -#~ " }\n" -#~ " while ( cats.scroll(PAGE_SIZE) );\n" -#~ "\n" -#~ " // Now get the first page of cats\n" -#~ " pageOfCats = new ArrayList();\n" -#~ " cats.beforeFirst();\n" -#~ " int i=0;\n" -#~ " while( ( PAGE_SIZE > i++ ) && cats.next() ) pageOfCats.add" -#~ "( cats.get(1) );\n" -#~ "\n" -#~ "}\n" -#~ "cats.close()" - -#, fuzzy -#~ msgid "" -#~ " ?\n" -#~ "] ]>]]>" -#~ msgstr "" -#~ "<query name=\"ByNameAndMaximumWeight\"><![CDATA[\n" -#~ " from eg.DomesticCat as cat\n" -#~ " where cat.name = ?\n" -#~ " and cat.weight > ?\n" -#~ "] ]></query>" - -#, fuzzy -#~ msgid "" -#~ "" -#~ msgstr "" -#~ "Query q = sess.getNamedQuery(\"ByNameAndMaximumWeight\");\n" -#~ "q.setString(0, name);\n" -#~ "q.setInt(1, minWeight);\n" -#~ "List cats = q.list();" - -#, fuzzy -#~ msgid "" -#~ "" -#~ msgstr "" -#~ "Collection blackKittens = session.createFilter(\n" -#~ " pk.getKittens(), \n" -#~ " \"where this.color = ?\")\n" -#~ " .setParameter( Color.BLACK, Hibernate.custom(ColorUserType.class) )\n" -#~ " .list()\n" -#~ ");" - -#, fuzzy -#~ msgid "" -#~ "" -#~ msgstr "" -#~ "Collection blackKittenMates = session.createFilter(\n" -#~ " pk.getKittens(), \n" -#~ " \"select this.mate where this.color = eg.Color.BLACK.intValue\")\n" -#~ " .list();" - -#, fuzzy -#~ msgid "" -#~ "" -#~ msgstr "" -#~ "Collection tenKittens = session.createFilter(\n" -#~ " mother.getKittens(), \"\")\n" -#~ " .setFirstResult(0).setMaxResults(10)\n" -#~ " .list();" - -#, fuzzy -#~ msgid "" -#~ "" -#~ msgstr "" -#~ "Criteria crit = session.createCriteria(Cat.class);\n" -#~ "crit.add( Expression.eq( \"color\", eg.Color.BLACK ) );\n" -#~ "crit.setMaxResults(10);\n" -#~ "List cats = crit.list();" - -#, fuzzy -#~ msgid "" -#~ "" -#~ msgstr "" -#~ "List cats = session.createSQLQuery(\n" -#~ " \"SELECT {cat.*} FROM CAT {cat} WHERE ROWNUM<10\",\n" -#~ " \"cat\",\n" -#~ " Cat.class\n" -#~ ").list();" - -#, fuzzy -#~ msgid "" -#~ "" -#~ msgstr "" -#~ "List cats = session.createSQLQuery(\n" -#~ " \"SELECT {cat}.ID AS {cat.id}, {cat}.SEX AS {cat.sex}, \" +\n" -#~ " \"{cat}.MATE AS {cat.mate}, {cat}.SUBCLASS AS {cat.class}, ... " -#~ "\" +\n" -#~ " \"FROM CAT {cat} WHERE ROWNUM<10\",\n" -#~ " \"cat\",\n" -#~ " Cat.class\n" -#~ ").list()" - -#, fuzzy -#~ msgid "" -#~ "" -#~ msgstr "" -#~ "DomesticCat cat = (DomesticCat) sess.load( Cat.class, new Long(69) );\n" -#~ "cat.setName(\"PK\");\n" -#~ "sess.flush(); // changes to cat are automatically detected and persisted" - -#, fuzzy -#~ msgid "" -#~ "" -#~ msgstr "" -#~ "// in the first session\n" -#~ "Cat cat = (Cat) firstSession.load(Cat.class, catId);\n" -#~ "Cat potentialMate = new Cat();\n" -#~ "firstSession.save(potentialMate);\n" -#~ "\n" -#~ "// in a higher layer of the application\n" -#~ "cat.setMate(potentialMate);\n" -#~ "\n" -#~ "// later, in a new session\n" -#~ "secondSession.update(cat); // update cat\n" -#~ "secondSession.update(mate); // update mate" - -#, fuzzy -#~ msgid "" -#~ "" -#~ msgstr "" -#~ "//just reassociate:\n" -#~ "sess.lock(fritz, LockMode.NONE);\n" -#~ "//do a version check, then reassociate:\n" -#~ "sess.lock(izi, LockMode.READ);\n" -#~ "//do a version check, using SELECT ... FOR UPDATE, then reassociate:\n" -#~ "sess.lock(pk, LockMode.UPGRADE);" - -#, fuzzy -#~ msgid "" -#~ "" -#~ msgstr "" -#~ "// in the first session\n" -#~ "Cat cat = (Cat) firstSession.load(Cat.class, catID);\n" -#~ "\n" -#~ "// in a higher tier of the application\n" -#~ "Cat mate = new Cat();\n" -#~ "cat.setMate(mate);\n" -#~ "\n" -#~ "// later, in a new session\n" -#~ "secondSession.saveOrUpdate(cat); // update existing state (cat has a " -#~ "non-null id)\n" -#~ "secondSession.saveOrUpdate(mate); // save the new instance (mate has a " -#~ "null id)" - -#, fuzzy -#~ msgid "" -#~ msgstr "sess.delete(cat);" - -#, fuzzy -#~ msgid "" -#~ "" -#~ msgstr "" -#~ "//retrieve a cat from one database\n" -#~ "Session session1 = factory1.openSession();\n" -#~ "Transaction tx1 = session1.beginTransaction();\n" -#~ "Cat cat = session1.get(Cat.class, catId);\n" -#~ "tx1.commit();\n" -#~ "session1.close();\n" -#~ "\n" -#~ "//reconcile with a second database\n" -#~ "Session session2 = factory2.openSession();\n" -#~ "Transaction tx2 = session2.beginTransaction();\n" -#~ "session2.replicate(cat, ReplicationMode.LATEST_VERSION);\n" -#~ "tx2.commit();\n" -#~ "session2.close();" - -#, fuzzy -#~ msgid "" -#~ "" -#~ msgstr "" -#~ "sess = sf.openSession();\n" -#~ "Transaction tx = sess.beginTransaction();\n" -#~ "sess.setFlushMode(FlushMode.COMMIT); // allow queries to return stale " -#~ "state\n" -#~ "\n" -#~ "Cat izi = (Cat) sess.load(Cat.class, id);\n" -#~ "izi.setName(iznizi);\n" -#~ "\n" -#~ "// might return stale data\n" -#~ "sess.find(\"from Cat as cat left outer join cat.kittens kitten\");\n" -#~ "\n" -#~ "// change to izi is not flushed!\n" -#~ "...\n" -#~ "tx.commit(); // flush occurs\n" -#~ "sess.close();" - -#, fuzzy -#~ msgid "]]>" -#~ msgstr "<one-to-one name=\"person\" cascade=\"persist\"/>" - -#, fuzzy -#~ msgid "" -#~ "]]>" -#~ msgstr "<one-to-one name=\"person\" cascade=\"persist,delete,lock\"/>" - -#, fuzzy -#~ msgid "" -#~ "" -#~ msgstr "" -#~ "Cat fritz = ......;\n" -#~ "ClassMetadata catMeta = sessionfactory.getClassMetadata(Cat.class);\n" -#~ "\n" -#~ "Object[] propertyValues = catMeta.getPropertyValues(fritz);\n" -#~ "String[] propertyNames = catMeta.getPropertyNames();\n" -#~ "Type[] propertyTypes = catMeta.getPropertyTypes();\n" -#~ "\n" -#~ "// get a Map of all properties which are not collections or associations\n" -#~ "Map namedValues = new HashMap();\n" -#~ "for ( int i=0; i<propertyNames.length; i++ ) {\n" -#~ " if ( !propertyTypes[i].isEntityType() && !propertyTypes[i]." -#~ "isCollectionType() ) {\n" -#~ " namedValues.put( propertyNames[i], propertyValues[i] );\n" -#~ " }\n" -#~ "}" +#~ "Eine besondere Art der Weitergabe namens delete-orphan " +#~ "gilt nur bei \"One-to-Many\"-Assoziationen und zeigt an, dass der " +#~ "delete()-Vorgang angewendet werden soll, wenn ein " +#~ "untergeordnetes Objekt aus der Assoziation entfernt wird." diff --git a/documentation/manual/src/main/docbook/de-DE/content/tutorial.po b/documentation/manual/src/main/docbook/de-DE/content/tutorial.po index b54b4a683a..a0d6b473dc 100644 --- a/documentation/manual/src/main/docbook/de-DE/content/tutorial.po +++ b/documentation/manual/src/main/docbook/de-DE/content/tutorial.po @@ -275,7 +275,7 @@ msgid "" msgstr "" "Project-Id-Version: Collection_Mapping\n" "Report-Msgid-Bugs-To: http://bugs.kde.org\n" -"POT-Creation-Date: 2010-02-11T05:38:16\n" +"POT-Creation-Date: 2010-07-20 21:02+0000\n" "PO-Revision-Date: 2007-02-26 10:27+1000\n" "Last-Translator: \n" "Language-Team: \n" @@ -285,11 +285,13 @@ msgstr "" "X-Generator: KBabel 1.9.1\n" #. Tag: title +#: tutorial.xml:34 #, no-c-format msgid "Tutorial" msgstr "" #. Tag: para +#: tutorial.xml:36 #, no-c-format msgid "" "Intended for new users, this chapter provides an step-by-step introduction " @@ -300,6 +302,7 @@ msgid "" msgstr "" #. Tag: para +#: tutorial.xml:45 #, no-c-format msgid "" "This tutorial expects the user have knowledge of both Java and SQL. If you " @@ -308,6 +311,7 @@ msgid "" msgstr "" #. Tag: para +#: tutorial.xml:54 #, no-c-format msgid "" "The distribution contains another example application under the " @@ -315,11 +319,13 @@ msgid "" msgstr "" #. Tag: title +#: tutorial.xml:62 #, no-c-format msgid "Part 1 - The first Hibernate Application" msgstr "Teil 1 - Die erste Hibernate Anwendung" #. Tag: para +#: tutorial.xml:64 #, fuzzy, no-c-format msgid "" "For this example, we will set up a small database application that can store " @@ -330,6 +336,7 @@ msgstr "" "Informationen zu deren Organisatoren." #. Tag: para +#: tutorial.xml:70 #, no-c-format msgid "" "Although you can use whatever database you feel comfortable using, we will " @@ -339,11 +346,13 @@ msgid "" msgstr "" #. Tag: title +#: tutorial.xml:79 #, no-c-format msgid "Setup" msgstr "" #. Tag: para +#: tutorial.xml:81 #, no-c-format msgid "" "The first thing we need to do is to set up the development environment. We " @@ -357,6 +366,7 @@ msgid "" msgstr "" #. Tag: para +#: tutorial.xml:91 #, no-c-format msgid "" "We will be using Maven in this tutorial, taking advantage of its transitive " @@ -364,11 +374,65 @@ msgid "" "automatically set up a project for us based on the maven descriptor." msgstr "" +#. Tag: programlisting +#: tutorial.xml:97 +#, no-c-format +msgid "" +"\n" +"\n" +" 4.0.0\n" +"\n" +" org.hibernate.tutorials\n" +" hibernate-tutorial\n" +" 1.0.0-SNAPSHOT\n" +" First Hibernate Tutorial\n" +"\n" +" \n" +" \n" +" ${artifactId}\n" +" \n" +"\n" +" \n" +" \n" +" org.hibernate\n" +" hibernate-core\n" +" \n" +"\n" +" \n" +" \n" +" javax.servlet\n" +" servlet-api\n" +" \n" +"\n" +" \n" +" \n" +" org.slf4j\n" +" slf4j-simple\n" +" \n" +"\n" +" \n" +" \n" +" javassist\n" +" javassist\n" +" \n" +" \n" +"\n" +"]]>" +msgstr "" + #. Tag: para +#: tutorial.xml:100 #, no-c-format msgid "" "It is not a requirement to use Maven. If you wish to use something else to " -"build this tutoial (such as Ant), the layout will remain the same. The only " +"build this tutorial (such as Ant), the layout will remain the same. The only " "change is that you will need to manually account for all the needed " "dependencies. If you use something like Ivy providing transitive dependency management you would " @@ -383,17 +447,20 @@ msgid "" msgstr "" #. Tag: para +#: tutorial.xml:117 #, no-c-format msgid "" "Save this file as pom.xml in the project root directory." msgstr "" #. Tag: title +#: tutorial.xml:124 #, no-c-format msgid "The first class" msgstr "Die erste Klasse" #. Tag: para +#: tutorial.xml:126 #, fuzzy, no-c-format msgid "" "Next, we create a class that represents the event we want to store in the " @@ -402,7 +469,86 @@ msgstr "" "Anschließend erstellen wir eine Klasse, die die Veranstaltung repräsentiert, " "die in der Datenbank gespeichert werden soll." +#. Tag: programlisting +#: tutorial.xml:131 +#, fuzzy, no-c-format +msgid "" +"" +msgstr "" +"package events;\n" +"\n" +"import java.util.Date;\n" +"\n" +"public class Event {\n" +" private Long id;\n" +"\n" +" private String title;\n" +" private Date date;\n" +"\n" +" public Event() {}\n" +"\n" +" public Long getId() {\n" +" return id;\n" +" }\n" +"\n" +" private void setId(Long id) {\n" +" this.id = id;\n" +" }\n" +"\n" +" public Date getDate() {\n" +" return date;\n" +" }\n" +"\n" +" public void setDate(Date date) {\n" +" this.date = date;\n" +" }\n" +"\n" +" public String getTitle() {\n" +" return title;\n" +" }\n" +"\n" +" public void setTitle(String title) {\n" +" this.title = title;\n" +" }\n" +"}" + #. Tag: para +#: tutorial.xml:133 #, fuzzy, no-c-format msgid "" "This class uses standard JavaBean naming conventions for property getter and " @@ -421,6 +567,7 @@ msgstr "" "Reflexion zu instanziieren." #. Tag: para +#: tutorial.xml:141 #, fuzzy, no-c-format msgid "" "The id property holds a unique identifier value for a " @@ -451,6 +598,7 @@ msgstr "" "persönlichen Bedürfnissen anpassen." #. Tag: para +#: tutorial.xml:156 #, fuzzy, no-c-format msgid "" "The no-argument constructor is a requirement for all persistent classes; " @@ -467,6 +615,7 @@ msgstr "" "Instrumentierung benötigt." #. Tag: para +#: tutorial.xml:164 #, no-c-format msgid "" "Save this file to the src/main/java/org/hibernate/tutorial/domain\n" +"\n" +"\n" +"\n" +"[...]\n" +"]]>" +msgstr "" +"<?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>\n" +"[...]\n" +"</hibernate-mapping>" + #. Tag: para +#: tutorial.xml:187 #, fuzzy, no-c-format msgid "" "Hibernate DTD is sophisticated. You can use it for auto-completion of XML " @@ -520,6 +695,7 @@ msgstr "" "-Verzeichnis der Hibernate-Distribution enthalten." #. Tag: para +#: tutorial.xml:200 #, fuzzy, no-c-format msgid "" "We will omit the DTD declaration in future examples to shorten the code. It " @@ -529,6 +705,7 @@ msgstr "" "Code zu verkürzen. Natürlich ist dies nicht optional." #. Tag: para +#: tutorial.xml:206 #, fuzzy, no-c-format msgid "" "Between the two hibernate-mapping tags, include a " @@ -542,7 +719,28 @@ msgstr "" "ersten Klasse sind) benötigen ein solches Mapping zu einer Tabelle in der " "SQL-Datenbank:" +#. Tag: programlisting +#: tutorial.xml:213 +#, fuzzy, no-c-format +msgid "" +"\n" +"\n" +" \n" +"\n" +" \n" +"\n" +"]]>" +msgstr "" +"<hibernate-mapping>\n" +"\n" +" <class name=\"events.Event\" table=\"EVENTS\">\n" +"\n" +" </class>\n" +"\n" +"</hibernate-mapping>" + #. Tag: para +#: tutorial.xml:215 #, fuzzy, no-c-format msgid "" "So far we have told Hibernate how to persist and load object of class " @@ -562,7 +760,32 @@ msgstr "" "Generierungsstrategie von Hibernate für eine Ersatzspalte des primären " "Kernbegriffs:" +#. Tag: programlisting +#: tutorial.xml:225 +#, fuzzy, no-c-format +msgid "" +"\n" +"\n" +" \n" +" \n" +" \n" +" \n" +" \n" +"\n" +"]]>" +msgstr "" +"<hibernate-mapping>\n" +"\n" +" <class name=\"events.Event\" table=\"EVENTS\">\n" +" <id name=\"id\" column=\"EVENT_ID\">\n" +" <generator class=\"native\"/>\n" +" </id>\n" +" </class>\n" +"\n" +"</hibernate-mapping>" + #. Tag: para +#: tutorial.xml:227 #, no-c-format msgid "" "The id element is the declaration of the identifier " @@ -574,6 +797,7 @@ msgid "" msgstr "" #. Tag: para +#: tutorial.xml:237 #, no-c-format msgid "" "The nested generator element specifies the identifier " @@ -586,14 +810,15 @@ msgid "" msgstr "" #. Tag: para +#: tutorial.xml:249 #, no-c-format msgid "" "native is no longer consider the best strategy in terms " -"of portability. for further discussion, see " +"of portability. for further discussion, see" msgstr "" #. Tag: para +#: tutorial.xml:255 #, fuzzy, no-c-format msgid "" "Lastly, we need to tell Hibernate about the remaining entity class " @@ -603,7 +828,38 @@ msgstr "" "in die Mapping-Datei auf. In der Standardeinstellung werden keine Properties " "der Klasse als persistent angesehen:" +#. Tag: programlisting +#: tutorial.xml:261 +#, fuzzy, no-c-format +msgid "" +"\n" +"\n" +" \n" +" \n" +" \n" +" \n" +" \n" +" \n" +" \n" +"\n" +"]]>" +msgstr "" +"<hibernate-mapping>\n" +"\n" +" <class name=\"events.Event\" table=\"EVENTS\">\n" +" <id name=\"id\" column=\"EVENT_ID\">\n" +" <generator class=\"native\"/>\n" +" </id>\n" +" <property name=\"date\" type=\"timestamp\" column=\"EVENT_DATE\"/" +">\n" +" <property name=\"title\"/>\n" +" </class>\n" +"\n" +"</hibernate-mapping>" + #. Tag: para +#: tutorial.xml:263 #, fuzzy, no-c-format msgid "" "Similar to the id element, the name " @@ -619,6 +875,7 @@ msgstr "" " sowie getTitle()/setTitle() suchen." #. Tag: para +#: tutorial.xml:274 #, fuzzy, no-c-format msgid "" "Why does the date property mapping include the " @@ -637,6 +894,7 @@ msgstr "" "einem anderen Namen gemappt werden sollte." #. Tag: para +#: tutorial.xml:284 #, fuzzy, no-c-format msgid "" "The title mapping also lacks a type " @@ -674,6 +932,7 @@ msgstr "" "verwahrt." #. Tag: para +#: tutorial.xml:300 #, no-c-format msgid "" "Hibernate makes this mapping type determination using reflection when the " @@ -683,6 +942,7 @@ msgid "" msgstr "" #. Tag: para +#: tutorial.xml:307 #, no-c-format msgid "" "Save this mapping file as src/main/resources/org/hibernate/" @@ -690,11 +950,13 @@ msgid "" msgstr "" #. Tag: title +#: tutorial.xml:315 #, no-c-format msgid "Hibernate configuration" msgstr "Die Konfiguration von Hibernate" #. Tag: para +#: tutorial.xml:317 #, no-c-format msgid "" "At this point, you should have the persistent class and its mapping file in " @@ -703,11 +965,13 @@ msgid "" msgstr "" #. Tag: para +#: tutorial.xml:324 #, no-c-format msgid "We do this do that the data remains between runs." msgstr "" #. Tag: para +#: tutorial.xml:329 #, fuzzy, no-c-format msgid "" "We will utilize the Maven exec plugin to launch the HSQLDB server by " @@ -730,6 +994,7 @@ msgstr "" "Sie HSQL DB erneut." #. Tag: para +#: tutorial.xml:340 #, no-c-format msgid "" "Hibernate will be connecting to the database on behalf of your application, " @@ -743,6 +1008,7 @@ msgid "" msgstr "" #. Tag: para +#: tutorial.xml:351 #, fuzzy, no-c-format msgid "" "The built-in Hibernate connection pool is in no way intended for production " @@ -750,6 +1016,7 @@ msgid "" msgstr "Hash-Tabelle (nicht für den Produktionsgebrauch vorgesehen)" #. Tag: para +#: tutorial.xml:357 #, fuzzy, no-c-format msgid "" "For Hibernate's configuration, we can use a simple hibernate." @@ -763,12 +1030,108 @@ msgstr "" "Aufbau verwendet werden. Die meisten Benutzer bevorzugen die XML-" "Konfigurationsdatei:" +#. Tag: programlisting +#: tutorial.xml:363 +#, fuzzy, no-c-format +msgid "" +"\n" +"\n" +"\n" +"\n" +"\n" +" \n" +"\n" +" \n" +" org.hsqldb.jdbcDriver\n" +" jdbc:hsqldb:hsql://localhost\n" +" sa\n" +" \n" +"\n" +" \n" +" 1\n" +"\n" +" \n" +" org.hibernate.dialect.HSQLDialect\n" +"\n" +" \n" +" thread\n" +"\n" +" \n" +" org.hibernate.cache." +"NoCacheProvider\n" +"\n" +" \n" +" true\n" +"\n" +" \n" +" update\n" +"\n" +" \n" +"\n" +" \n" +"\n" +"]]>" +msgstr "" +"<?xml version='1.0' encoding='utf-8'?>\n" +"<!DOCTYPE hibernate-configuration PUBLIC\n" +" \"-//Hibernate/Hibernate Configuration DTD 3.0//EN\"\n" +" \"http://hibernate.sourceforge.net/hibernate-configuration-3.0.dtd" +"\">\n" +"\n" +"<hibernate-configuration>\n" +"\n" +" <session-factory>\n" +"\n" +" <!-- Database connection settings -->\n" +" <property name=\"connection.driver_class\">org.hsqldb." +"jdbcDriver</property>\n" +" <property name=\"connection.url\">jdbc:hsqldb:hsql://" +"localhost</property>\n" +" <property name=\"connection.username\">sa</property>\n" +" <property name=\"connection.password\"></property>\n" +"\n" +" <!-- JDBC connection pool (use the built-in) -->\n" +" <property name=\"connection.pool_size\">1</property>\n" +"\n" +" <!-- SQL dialect -->\n" +" <property name=\"dialect\">org.hibernate.dialect." +"HSQLDialect</property>\n" +"\n" +" <!-- Enable Hibernate's automatic session context management --" +">\n" +" <property name=\"current_session_context_class\">thread</" +"property>\n" +"\n" +" <!-- Disable the second-level cache -->\n" +" <property name=\"cache.provider_class\">org.hibernate.cache." +"NoCacheProvider</property>\n" +"\n" +" <!-- Echo all executed SQL to stdout -->\n" +" <property name=\"show_sql\">true</property>\n" +"\n" +" <!-- Drop and re-create the database schema on startup -->\n" +" <property name=\"hbm2ddl.auto\">create</property>\n" +"\n" +" <mapping resource=\"events/Event.hbm.xml\"/>\n" +"\n" +" </session-factory>\n" +"\n" +"</hibernate-configuration>" + #. Tag: para +#: tutorial.xml:366 #, no-c-format msgid "Notice that this configuration file specifies a different DTD" msgstr "" #. Tag: para +#: tutorial.xml:369 #, fuzzy, no-c-format msgid "" "You configure Hibernate's SessionFactory. SessionFactory " @@ -785,6 +1148,7 @@ msgstr "" "einfachere Inbetriebnahme)." #. Tag: para +#: tutorial.xml:376 #, no-c-format msgid "" "The first four property elements contain the necessary " @@ -793,13 +1157,15 @@ msgid "" msgstr "" #. Tag: para +#: tutorial.xml:383 #, no-c-format msgid "" "In most cases, Hibernate is able to properly determine which dialect to use. " -"See for more information." +"See for more information." msgstr "" #. Tag: para +#: tutorial.xml:389 #, fuzzy, no-c-format msgid "" "Hibernate's automatic session management for persistence contexts is " @@ -823,6 +1189,7 @@ msgstr "" "hinzugefügt." #. Tag: para +#: tutorial.xml:398 #, no-c-format msgid "" "Save this file as hibernate.cfg.xml into the " @@ -830,11 +1197,13 @@ msgid "" msgstr "" #. Tag: title +#: tutorial.xml:406 #, fuzzy, no-c-format msgid "Building with Maven" msgstr "\"Builden\" mit Ant" #. Tag: para +#: tutorial.xml:408 #, no-c-format msgid "" "We will now build the tutorial with Maven. You will need to have Maven " @@ -845,12 +1214,43 @@ msgid "" "make sure we can compile everything so far:" msgstr "" +#. Tag: programlisting +#: tutorial.xml:418 +#, no-c-format +msgid "" +"" +msgstr "" + #. Tag: title +#: tutorial.xml:423 #, no-c-format msgid "Startup and helpers" msgstr "Inbetriebnahme und Helfer" #. Tag: para +#: tutorial.xml:425 #, fuzzy, no-c-format msgid "" "It is time to load and store some Event objects, but " @@ -876,6 +1276,7 @@ msgstr "" "threadsicheres, allgemeingültiges Objekt, das einmal instanziiert ist." #. Tag: para +#: tutorial.xml:439 #, fuzzy, no-c-format msgid "" "We will create a HibernateUtil helper class that takes " @@ -887,7 +1288,69 @@ msgstr "" "SessionFactory ermöglicht. Werfen wir einen Blick auf die " "Implementierung:" +#. Tag: programlisting +#: tutorial.xml:445 +#, fuzzy, no-c-format +msgid "" +"" +msgstr "" +"package util;\n" +"\n" +"import org.hibernate.*;\n" +"import org.hibernate.cfg.*;\n" +"\n" +"public class HibernateUtil {\n" +"\n" +" private static final SessionFactory sessionFactory;\n" +"\n" +" static {\n" +" try {\n" +" // Create the SessionFactory from hibernate.cfg.xml\n" +" sessionFactory = new Configuration().configure()." +"buildSessionFactory();\n" +" } catch (Throwable ex) {\n" +" // Make sure you log the exception, as it might be swallowed\n" +" System.err.println(\"Initial SessionFactory creation failed.\" + " +"ex);\n" +" throw new ExceptionInInitializerError(ex);\n" +" }\n" +" }\n" +"\n" +" public static SessionFactory getSessionFactory() {\n" +" return sessionFactory;\n" +" }\n" +"\n" +"}" + #. Tag: para +#: tutorial.xml:447 #, no-c-format msgid "" "Save this code as src/main/java/org/hibernate/tutorial/util/" @@ -895,6 +1358,7 @@ msgid "" msgstr "" #. Tag: para +#: tutorial.xml:452 #, fuzzy, no-c-format msgid "" "This class not only produces the global org.hibernate." @@ -912,6 +1376,7 @@ msgstr "" "aufsuchen." #. Tag: para +#: tutorial.xml:461 #, fuzzy, no-c-format msgid "" "If you give the org.hibernate.SessionFactory " @@ -929,6 +1394,7 @@ msgstr "" "Optionen werden in der Referenz-Dokumentation von Hibernate näher erläutert." #. Tag: para +#: tutorial.xml:470 #, fuzzy, no-c-format msgid "" "You now need to configure a logging system. Hibernate uses commons logging " @@ -952,6 +1418,7 @@ msgstr "" "werden nur die Hibernate Startup-Nachrichten in stdout dargesellt." #. Tag: para +#: tutorial.xml:480 #, fuzzy, no-c-format msgid "" "The tutorial infrastructure is complete and you are now ready to do some " @@ -961,14 +1428,16 @@ msgstr "" "Benutzung von Hibernate beginnen." #. Tag: title +#: tutorial.xml:488 #, no-c-format msgid "Loading and storing objects" msgstr "Das Laden und Speichern von Objekten" #. Tag: para +#: tutorial.xml:490 #, fuzzy, no-c-format msgid "" -"We are now ready to start doing some real worjk with Hibernate. Let's start " +"We are now ready to start doing some real work with Hibernate. Let's start " "by writing an EventManager class with a main() method:" msgstr "" @@ -976,7 +1445,85 @@ msgstr "" "EventManager-Klasse wird mit einer main()-Methode geschrieben:" +#. Tag: programlisting +#: tutorial.xml:496 +#, fuzzy, no-c-format +msgid "" +"" +msgstr "" +"package events;\n" +"import org.hibernate.Session;\n" +"\n" +"import java.util.Date;\n" +"\n" +"import util.HibernateUtil;\n" +"\n" +"public class EventManager {\n" +"\n" +" public static void main(String[] args) {\n" +" EventManager mgr = new EventManager();\n" +"\n" +" if (args[0].equals(\"store\")) {\n" +" mgr.createAndStoreEvent(\"My Event\", new Date());\n" +" }\n" +"\n" +" HibernateUtil.getSessionFactory().close();\n" +" }\n" +"\n" +" private void createAndStoreEvent(String title, Date theDate) {\n" +"\n" +" Session session = HibernateUtil.getSessionFactory().getCurrentSession" +"();\n" +"\n" +" session.beginTransaction();\n" +"\n" +" Event theEvent = new Event();\n" +" theEvent.setTitle(title);\n" +" theEvent.setDate(theDate);\n" +"\n" +" session.save(theEvent);\n" +"\n" +" session.getTransaction().commit();\n" +" }\n" +"\n" +"}" + #. Tag: para +#: tutorial.xml:498 #, fuzzy, no-c-format msgid "" "In createAndStoreEvent() we created a new Eventorg.hibernate.Session is designed to represent a " -"single unit of work (a single atmoic piece of work to be performed). For now " +"single unit of work (a single atomic piece of work to be performed). For now " "we will keep things simple and assume a one-to-one granularity between a " "Hibernate org.hibernate.Session and a database " "transaction. To shield our code from the actual underlying transaction " @@ -1012,6 +1560,7 @@ msgstr "" "Hibernate Session verfügbar ist." #. Tag: para +#: tutorial.xml:518 #, fuzzy, no-c-format msgid "" "What does sessionFactory.getCurrentSession() do? First, " @@ -1036,6 +1585,7 @@ msgstr "" "sie endet." #. Tag: para +#: tutorial.xml:532 #, no-c-format msgid "" "Hibernate offers three methods of current session tracking. The \"thread\" " @@ -1045,6 +1595,7 @@ msgid "" msgstr "" #. Tag: para +#: tutorial.xml:541 #, fuzzy, no-c-format msgid "" "A org.hibernate.Session begins when the first call to " @@ -1070,6 +1621,7 @@ msgstr "" "gehen darauf später in dieser Anleitung ein)." #. Tag: para +#: tutorial.xml:554 #, fuzzy, no-c-format msgid "" "Related to the unit of work scope, should the Hibernate org." @@ -1099,9 +1651,10 @@ msgstr "" "gezeigt." #. Tag: para +#: tutorial.xml:571 #, fuzzy, no-c-format msgid "" -"See for more information about transaction " +"See for more information about transaction " "handling and demarcation. The previous example also skipped any error " "handling and rollback." msgstr "" @@ -1110,6 +1663,7 @@ msgstr "" "und Zurücksetzen wurden im vorherigen Beispiel weggelassen." #. Tag: para +#: tutorial.xml:577 #, no-c-format msgid "" "To run this, we will make use of the Maven exec plugin to call our class " @@ -1118,11 +1672,13 @@ msgid "" msgstr "" #. Tag: para +#: tutorial.xml:584 #, no-c-format msgid "You may need to perform mvn compile first." msgstr "" #. Tag: para +#: tutorial.xml:589 #, fuzzy, no-c-format msgid "" "You should see Hibernate starting up and, depending on your configuration, " @@ -1132,7 +1688,18 @@ msgstr "" "nach der von Ihnen verwendeten Konfiguration - eine Menge an " "Protokollausgaben. Am Ende sehen Sie die folgende Zeile:" +#. Tag: programlisting +#: tutorial.xml:594 +#, fuzzy, no-c-format +msgid "" +"" +msgstr "" +"[java] Hibernate: insert into EVENTS (EVENT_DATE, title, EVENT_ID) values " +"(?, ?, ?)" + #. Tag: para +#: tutorial.xml:596 #, fuzzy, no-c-format msgid "This is the INSERT executed by Hibernate." msgstr "" @@ -1140,26 +1707,86 @@ msgstr "" "Anweisung:" #. Tag: para +#: tutorial.xml:600 #, fuzzy, no-c-format msgid "To list stored events an option is added to the main method:" msgstr "" "Als nächstes sollen auch die gespeicherten Veranstaltungen gelistet werden, " "daher fügen wir eine Option zur Hauptmethode hinzu:" +#. Tag: programlisting +#: tutorial.xml:604 +#, fuzzy, no-c-format +msgid "" +"" +msgstr "" +"if (args[0].equals(\"store\")) {\n" +" mgr.createAndStoreEvent(\"My Event\", new Date());\n" +"}\n" +"else if (args[0].equals(\"list\")) {\n" +" List events = mgr.listEvents();\n" +" for (int i = 0; i < events.size(); i++) {\n" +" Event theEvent = (Event) events.get(i);\n" +" System.out.println(\"Event: \" + theEvent.getTitle() +\n" +" \" Time: \" + theEvent.getDate());\n" +" }\n" +"}" + #. Tag: para +#: tutorial.xml:606 #, fuzzy, no-c-format msgid "A new listEvents() method is also added:" msgstr "" "Eine neue listEvents() method wird ebenfalls hinzugefügt:" +#. Tag: programlisting +#: tutorial.xml:610 +#, fuzzy, no-c-format +msgid "" +"" +msgstr "" +"private List listEvents() {\n" +"\n" +" Session session = HibernateUtil.getSessionFactory().getCurrentSession" +"();\n" +"\n" +" session.beginTransaction();\n" +"\n" +" List result = session.createQuery(\"from Event\").list();\n" +"\n" +" session.getTransaction().commit();\n" +"\n" +" return result;\n" +"}" + #. Tag: para +#: tutorial.xml:612 #, fuzzy, no-c-format msgid "" "Here, we are using a Hibernate Query Language (HQL) query to load all " "existing Event objects from the database. Hibernate will " "generate the appropriate SQL, send it to the database and populate " "Event objects with the data. You can create more complex " -"queries with HQL. See for more information." +"queries with HQL. See for more information." msgstr "" "Mittels HQL-Anfrage (\"Hibernate Query Language\") werden alle bestehenden " "Event-Objekte aus der Datenbank geladen. Hibernate " @@ -1168,6 +1795,7 @@ msgstr "" "Daten. Natürlich können mit HQL auch komplexere Anfragen erstellt werden." #. Tag: para +#: tutorial.xml:620 #, no-c-format msgid "" "Now we can call our new functionality, again using the Maven exec plugin: " @@ -1176,11 +1804,13 @@ msgid "" msgstr "" #. Tag: title +#: tutorial.xml:630 #, no-c-format msgid "Part 2 - Mapping associations" msgstr "Teil 2 - Mapping-Assoziationen" #. Tag: para +#: tutorial.xml:632 #, fuzzy, no-c-format msgid "" "So far we have mapped a single persistent entity class to a table in " @@ -1194,16 +1824,53 @@ msgstr "" "Veranstaltungen, an denen diese teilnehmen, hinzu." #. Tag: title +#: tutorial.xml:640 #, no-c-format msgid "Mapping the Person class" msgstr "Das Mappen der Personenklasse" #. Tag: para +#: tutorial.xml:642 #, fuzzy, no-c-format msgid "The first cut of the Person class looks like this:" msgstr "Der erste Teil der Person-Klasse ist einfach:" +#. Tag: programlisting +#: tutorial.xml:646 +#, fuzzy, no-c-format +msgid "" +"" +msgstr "" +"package events;\n" +"\n" +"public class Person {\n" +"\n" +" private Long id;\n" +" private int age;\n" +" private String firstname;\n" +" private String lastname;\n" +"\n" +" public Person() {}\n" +"\n" +" // Accessor methods for all properties, private setter for 'id'\n" +"\n" +"}" + #. Tag: para +#: tutorial.xml:648 #, no-c-format msgid "" "Save this to a file named src/main/java/org/hibernate/tutorial/" @@ -1211,20 +1878,63 @@ msgid "" msgstr "" #. Tag: para +#: tutorial.xml:653 #, no-c-format msgid "" "Next, create the new mapping file as src/main/resources/org/" "hibernate/tutorial/domain/Person.hbm.xml" msgstr "" +#. Tag: programlisting +#: tutorial.xml:658 +#, fuzzy, no-c-format +msgid "" +"\n" +"\n" +" \n" +" \n" +" \n" +" \n" +" \n" +" \n" +" \n" +" \n" +"\n" +"]]>" +msgstr "" +"<hibernate-mapping>\n" +"\n" +" <class name=\"events.Person\" table=\"PERSON\">\n" +" <id name=\"id\" column=\"PERSON_ID\">\n" +" <generator class=\"native\"/>\n" +" </id>\n" +" <property name=\"age\"/>\n" +" <property name=\"firstname\"/>\n" +" <property name=\"lastname\"/>\n" +" </class>\n" +"\n" +"</hibernate-mapping>" + #. Tag: para +#: tutorial.xml:660 #, no-c-format msgid "Finally, add the new mapping to Hibernate's configuration:" msgstr "" "Anschließend fügen Sie dann das neue Mapping der Konfiguration von Hibernate " "hinzu:" +#. Tag: programlisting +#: tutorial.xml:664 +#, fuzzy, no-c-format +msgid "" +"\n" +"]]>" +msgstr "" +"<mapping resource=\"events/Event.hbm.xml\"/>\n" +"<mapping resource=\"events/Person.hbm.xml\"/>" + #. Tag: para +#: tutorial.xml:666 #, fuzzy, no-c-format msgid "" "Create an association between these two entities. Persons can participate in " @@ -1237,11 +1947,13 @@ msgstr "" "Richtungsabhängigkeit, Multiplizität und des Collection-Verhaltens." #. Tag: title +#: tutorial.xml:676 #, no-c-format msgid "A unidirectional Set-based association" msgstr "Eine unidirektionale \"Set\"-basierte Assoziation" #. Tag: para +#: tutorial.xml:678 #, fuzzy, no-c-format msgid "" "By adding a collection of events to the Person class, you " @@ -1260,7 +1972,38 @@ msgstr "" "literal>, weil die Collection keine doppelten Elemente enthält und die " "Reihenfolge für uns nicht von Bedeutung ist." +#. Tag: programlisting +#: tutorial.xml:689 +#, fuzzy, no-c-format +msgid "" +"" +msgstr "" +"public class Person {\n" +"\n" +" private Set events = new HashSet();\n" +"\n" +" public Set getEvents() {\n" +" return events;\n" +" }\n" +"\n" +" public void setEvents(Set events) {\n" +" this.events = events;\n" +" }\n" +"}" + #. Tag: para +#: tutorial.xml:691 #, fuzzy, no-c-format msgid "" "Before mapping this association, let's consider the other side. We could " @@ -1285,7 +2028,42 @@ msgstr "" "nennen wir dies eine \"Many-to-Many\"-Assoziation. Wir " "verwenden daher Hibernates \"Many-to-Many\"-Mapping:" +#. Tag: programlisting +#: tutorial.xml:704 +#, fuzzy, no-c-format +msgid "" +"\n" +" \n" +" \n" +" \n" +" \n" +" \n" +" \n" +"\n" +" \n" +" \n" +" \n" +" \n" +"\n" +"]]>" +msgstr "" +"<class name=\"events.Person\" table=\"PERSON\">\n" +" <id name=\"id\" column=\"PERSON_ID\">\n" +" <generator class=\"native\"/>\n" +" </id>\n" +" <property name=\"age\"/>\n" +" <property name=\"firstname\"/>\n" +" <property name=\"lastname\"/>\n" +"\n" +" <set name=\"events\" table=\"PERSON_EVENT\">\n" +" <key column=\"PERSON_ID\"/>\n" +" <many-to-many column=\"EVENT_ID\" class=\"events.Event\"/>\n" +" </set>\n" +"\n" +"</class>" + #. Tag: para +#: tutorial.xml:706 #, fuzzy, no-c-format msgid "" "Hibernate supports a broad range of collection mappings, a set | *EVENT_ID | | |\n" +" | EVENT_DATE | | *PERSON_ID | <--> | *PERSON_ID |\n" +" | TITLE | |__________________| | AGE |\n" +" |_____________| | FIRSTNAME |\n" +" | LASTNAME |\n" +" |_____________|\n" +" ]]>" +msgstr "" +"_____________ __________________\n" +" | | | | _____________\n" +" | EVENTS | | PERSON_EVENT | | |\n" +" |_____________| |__________________| | PERSON |\n" +" | | | | |_____________|\n" +" | *EVENT_ID | <--> | *EVENT_ID | | |\n" +" | EVENT_DATE | | *PERSON_ID | <--> | *PERSON_ID |\n" +" | TITLE | |__________________| | AGE |\n" +" |_____________| | FIRSTNAME |\n" +" | LASTNAME |\n" +" |_____________|" + #. Tag: title +#: tutorial.xml:731 #, no-c-format msgid "Working the association" msgstr "Das Bearbeiten der Assoziation" #. Tag: para +#: tutorial.xml:733 #, fuzzy, no-c-format msgid "" "Now we will bring some people and events together in a new method in " @@ -1332,7 +2143,38 @@ msgstr "" "Nun werden einige Personen und Veranstaltungen in einer neuen Methode im " "EventManager vereint:" +#. Tag: programlisting +#: tutorial.xml:737 +#, fuzzy, no-c-format +msgid "" +"" +msgstr "" +"private void addPersonToEvent(Long personId, Long eventId) {\n" +"\n" +" Session session = HibernateUtil.getSessionFactory().getCurrentSession" +"();\n" +" session.beginTransaction();\n" +"\n" +" Person aPerson = (Person) session.load(Person.class, personId);\n" +" Event anEvent = (Event) session.load(Event.class, eventId);\n" +"\n" +" aPerson.getEvents().add(anEvent);\n" +"\n" +" session.getTransaction().commit();\n" +"}" + #. Tag: para +#: tutorial.xml:739 #, fuzzy, no-c-format msgid "" "After loading a Person and an Event, " @@ -1371,6 +2213,7 @@ msgstr "" "definiert." #. Tag: para +#: tutorial.xml:758 #, fuzzy, no-c-format msgid "" "You can load person and event in different units of work. Or you can modify " @@ -1386,7 +2229,75 @@ msgstr "" "\"detached\" d.h. abgesetzt). Sie können eine " "Collection sogar modifizieren, wenn diese abgesetzt ist:" +#. Tag: programlisting +#: tutorial.xml:767 +#, fuzzy, no-c-format +msgid "" +"" +msgstr "" +"private void addPersonToEvent(Long personId, Long eventId) {\n" +"\n" +" Session session = HibernateUtil.getSessionFactory().getCurrentSession" +"();\n" +" session.beginTransaction();\n" +"\n" +" Person aPerson = (Person) session\n" +" .createQuery(\"select p from Person p left join fetch p.events " +"where p.id = :pid\")\n" +" .setParameter(\"pid\", personId)\n" +" .uniqueResult(); // Eager fetch the collection so we can use it " +"detached\n" +"\n" +" Event anEvent = (Event) session.load(Event.class, eventId);\n" +"\n" +" session.getTransaction().commit();\n" +"\n" +" // End of first unit of work\n" +"\n" +" aPerson.getEvents().add(anEvent); // aPerson (and its collection) is " +"detached\n" +"\n" +" // Begin second unit of work\n" +"\n" +" Session session2 = HibernateUtil.getSessionFactory().getCurrentSession" +"();\n" +" session2.beginTransaction();\n" +"\n" +" session2.update(aPerson); // Reattachment of aPerson\n" +"\n" +" session2.getTransaction().commit();\n" +"}" + #. Tag: para +#: tutorial.xml:769 #, fuzzy, no-c-format msgid "" "The call to update makes a detached object persistent " @@ -1403,6 +2314,7 @@ msgstr "" "Entity-Objekts vorgenommen wurden." #. Tag: para +#: tutorial.xml:778 #, fuzzy, no-c-format msgid "" "This is not much use in our example, but it is an important concept you can " @@ -1422,7 +2334,29 @@ msgstr "" "sein, dass Sie einige der vorherigen Methoden ändern müssen, damit der " "Identifier wiedergegeben wird):" +#. Tag: programlisting +#: tutorial.xml:786 +#, fuzzy, no-c-format +msgid "" +"" +msgstr "" +"else if (args[0].equals(\"addpersontoevent\")) {\n" +" Long eventId = mgr.createAndStoreEvent(\"My Event\", new Date());\n" +" Long personId = mgr.createAndStorePerson(\"Foo\", \"Bar\");\n" +" mgr.addPersonToEvent(personId, eventId);\n" +" System.out.println(\"Added person \" + personId + \" to event \" + " +"eventId);\n" +"}" + #. Tag: para +#: tutorial.xml:788 #, fuzzy, no-c-format msgid "" "This is an example of an association between two equally important classes : " @@ -1454,6 +2388,7 @@ msgstr "" "z.B. Address oder MonetaryAmount." #. Tag: para +#: tutorial.xml:806 #, fuzzy, no-c-format msgid "" "You can also design a collection of value types. This is conceptually " @@ -1465,11 +2400,13 @@ msgstr "" "Entities, sieht aber in Java fast genauso aus." #. Tag: title +#: tutorial.xml:815 #, no-c-format msgid "Collection of values" msgstr "Collection von Werten" #. Tag: para +#: tutorial.xml:817 #, no-c-format msgid "" "Let's add a collection of email addresses to the Person " @@ -1477,12 +2414,52 @@ msgid "" "interfacename> of java.lang.String instances:" msgstr "" +#. Tag: programlisting +#: tutorial.xml:823 +#, fuzzy, no-c-format +msgid "" +"" +msgstr "" +"private Set emailAddresses = new HashSet();\n" +"\n" +"public Set getEmailAddresses() {\n" +" return emailAddresses;\n" +"}\n" +"\n" +"public void setEmailAddresses(Set emailAddresses) {\n" +" this.emailAddresses = emailAddresses;\n" +"}" + #. Tag: para +#: tutorial.xml:825 #, fuzzy, no-c-format msgid "The mapping of this Set is as follows:" msgstr "Das Mapping dieses Set:" +#. Tag: programlisting +#: tutorial.xml:829 +#, fuzzy, no-c-format +msgid "" +"\n" +" \n" +" \n" +" ]]>" +msgstr "" +"<set name=\"emailAddresses\" table=\"PERSON_EMAIL_ADDR\">\n" +" <key column=\"PERSON_ID\"/>\n" +" <element type=\"string\" column=\"EMAIL_ADDR\"/>\n" +"</set>" + #. Tag: para +#: tutorial.xml:831 #, fuzzy, no-c-format msgid "" "The difference compared with the earlier mapping is the use of the " @@ -1510,11 +2487,57 @@ msgstr "" "dem die String-Werte gespeichert werden." #. Tag: para +#: tutorial.xml:847 #, fuzzy, no-c-format msgid "Here is the updated schema:" msgstr "Werfen wir einen Blick auf das aktualisierte Schema:" +#. Tag: programlisting +#: tutorial.xml:851 +#, fuzzy, no-c-format +msgid "" +" | *EVENT_ID | | | |" +"___________________|\n" +" | EVENT_DATE | | *PERSON_ID | <--> | *PERSON_ID | <--> | " +"*PERSON_ID |\n" +" | TITLE | |__________________| | AGE | | " +"*EMAIL_ADDR |\n" +" |_____________| | FIRSTNAME | |" +"___________________|\n" +" | LASTNAME |\n" +" |_____________|\n" +" ]]>" +msgstr "" +"_____________ __________________\n" +" | | | | _____________\n" +" | EVENTS | | PERSON_EVENT | | | " +"___________________\n" +" |_____________| |__________________| | PERSON | " +"| |\n" +" | | | | |_____________| | " +"PERSON_EMAIL_ADDR |\n" +" | *EVENT_ID | <--> | *EVENT_ID | | | |" +"___________________|\n" +" | EVENT_DATE | | *PERSON_ID | <--> | *PERSON_ID | <--" +"> | *PERSON_ID |\n" +" | TITLE | |__________________| | AGE | | " +"*EMAIL_ADDR |\n" +" |_____________| | FIRSTNAME | |" +"___________________|\n" +" | LASTNAME |\n" +" |_____________|" + #. Tag: para +#: tutorial.xml:853 #, fuzzy, no-c-format msgid "" "You can see that the primary key of the collection table is in fact a " @@ -1529,6 +2552,7 @@ msgstr "" "in Java ist." #. Tag: para +#: tutorial.xml:859 #, fuzzy, no-c-format msgid "" "You can now try to add elements to this collection, just like we did before " @@ -1538,7 +2562,40 @@ msgstr "" "dieser zu entnehmen, genau wie wir es zuvor bei der Verbindung von Personen " "und Veranstaltungen getan haben. In Java ist es derselbe Code:" +#. Tag: programlisting +#: tutorial.xml:864 +#, fuzzy, no-c-format +msgid "" +"" +msgstr "" +"private void addEmailToPerson(Long personId, String emailAddress) {\n" +"\n" +" Session session = HibernateUtil.getSessionFactory().getCurrentSession" +"();\n" +" session.beginTransaction();\n" +"\n" +" Person aPerson = (Person) session.load(Person.class, personId);\n" +"\n" +" // The getEmailAddresses() might trigger a lazy load of the collection\n" +" aPerson.getEmailAddresses().add(emailAddress);\n" +"\n" +" session.getTransaction().commit();\n" +"}" + #. Tag: para +#: tutorial.xml:866 #, fuzzy, no-c-format msgid "" "This time we did not use a fetch query to initialize " @@ -1554,11 +2611,13 @@ msgstr "" "optimieren." #. Tag: title +#: tutorial.xml:875 #, no-c-format msgid "Bi-directional associations" msgstr "Bidirektionale Assoziationen" #. Tag: para +#: tutorial.xml:877 #, fuzzy, no-c-format msgid "" "Next you will map a bi-directional association. You will make the " @@ -1575,6 +2634,7 @@ msgstr "" "eingesehen und aufgerufen werden." #. Tag: para +#: tutorial.xml:885 #, no-c-format msgid "" "A relational database is more flexible than a network programming language, " @@ -1583,6 +2643,7 @@ msgid "" msgstr "" #. Tag: para +#: tutorial.xml:893 #, fuzzy, no-c-format msgid "" "First, add a collection of participants to the Event " @@ -1591,7 +2652,32 @@ msgstr "" "Zuerst wird eine Collection von Teilnehmern der Event " "Veranstaltungsklasse hinzugefügt:" +#. Tag: programlisting +#: tutorial.xml:898 +#, fuzzy, no-c-format +msgid "" +"" +msgstr "" +"private Set participants = new HashSet();\n" +"\n" +"public Set getParticipants() {\n" +" return participants;\n" +"}\n" +"\n" +"public void setParticipants(Set participants) {\n" +" this.participants = participants;\n" +"}" + #. Tag: para +#: tutorial.xml:900 #, fuzzy, no-c-format msgid "" "Now map this side of the association in Event.hbm.xml." @@ -1599,7 +2685,23 @@ msgstr "" "Nun mappen Sie auch diese Seite der Assoziation in Event.hbm.xml." +#. Tag: programlisting +#: tutorial.xml:904 +#, fuzzy, no-c-format +msgid "" +"\n" +" \n" +" \n" +" ]]>" +msgstr "" +"<set name=\"participants\" table=\"PERSON_EVENT\" inverse=\"true\">\n" +" <key column=\"EVENT_ID\"/>\n" +" <many-to-many column=\"PERSON_ID\" class=\"events.Person\"/>\n" +"</set>" + #. Tag: para +#: tutorial.xml:906 #, fuzzy, no-c-format msgid "" "These are normal set mappings in both mapping documents. " @@ -1617,6 +2719,7 @@ msgstr "" "Element des Collection-Mappings desEvents." #. Tag: para +#: tutorial.xml:914 #, fuzzy, no-c-format msgid "" "What this means is that Hibernate should take the other side, the " @@ -1630,11 +2733,13 @@ msgstr "" "beiden Entities erstellt wird, wird das noch verständlicher." #. Tag: title +#: tutorial.xml:923 #, no-c-format msgid "Working bi-directional links" msgstr "Die Bearbeitung bidirektionaler Verbindungen" #. Tag: para +#: tutorial.xml:925 #, fuzzy, no-c-format msgid "" "First, keep in mind that Hibernate does not affect normal Java semantics. " @@ -1660,6 +2765,7 @@ msgstr "" "nie vergessen es zu tun." #. Tag: para +#: tutorial.xml:935 #, fuzzy, no-c-format msgid "" "Many developers program defensively and create link management methods to " @@ -1669,7 +2775,48 @@ msgstr "" "Methoden Verbindung, um beide Seiten korrekt einzustellen, z.B. in " "Person:" +#. Tag: programlisting +#: tutorial.xml:940 +#, fuzzy, no-c-format +msgid "" +"" +msgstr "" +"protected Set getEvents() {\n" +" return events;\n" +"}\n" +"\n" +"protected void setEvents(Set events) {\n" +" this.events = events;\n" +"}\n" +"\n" +"public void addToEvent(Event event) {\n" +" this.getEvents().add(event);\n" +" event.getParticipants().add(this);\n" +"}\n" +"\n" +"public void removeFromEvent(Event event) {\n" +" this.getEvents().remove(event);\n" +" event.getParticipants().remove(this);\n" +"}" + #. Tag: para +#: tutorial.xml:942 #, fuzzy, no-c-format msgid "" "The get and set methods for the collection are now protected. This allows " @@ -1684,6 +2831,7 @@ msgstr "" "Collection auf der anderen Seite zu tun." #. Tag: para +#: tutorial.xml:949 #, fuzzy, no-c-format msgid "" "What about the inverse mapping attribute? For you, and " @@ -1718,11 +2866,13 @@ msgstr "" "beiden Seiten sein." #. Tag: title +#: tutorial.xml:965 #, no-c-format msgid "Part 3 - The EventManager web application" msgstr "Teil 3 - Die EventManager-Webanwendung" #. Tag: para +#: tutorial.xml:967 #, fuzzy, no-c-format msgid "" "A Hibernate web application uses Session and " @@ -1739,11 +2889,13 @@ msgstr "" "Formular, in das neue Veranstaltungen eingetragen werden können." #. Tag: title +#: tutorial.xml:975 #, no-c-format msgid "Writing the basic servlet" msgstr "Das Schreiben des Grundservlets" #. Tag: para +#: tutorial.xml:977 #, fuzzy, no-c-format msgid "" "First we need create our basic processing servlet. Since our servlet only " @@ -1753,7 +2905,76 @@ msgstr "" "Das Servlet bearbeitet nur HTTP GET-Anfragen, daher wird " "die doGet()-Methode implementiert:" +#. Tag: programlisting +#: tutorial.xml:983 +#, fuzzy, no-c-format +msgid "" +"" +msgstr "" +"protected void doGet(HttpServletRequest request,\n" +" HttpServletResponse response)\n" +" throws ServletException, IOException {\n" +"\n" +" SimpleDateFormat dateFormatter = new SimpleDateFormat(\"dd.MM.yyyy\");\n" +"\n" +" try {\n" +" // Begin unit of work\n" +" HibernateUtil.getSessionFactory()\n" +" .getCurrentSession().beginTransaction();\n" +"\n" +" // Process request and render page...\n" +"\n" +" // End unit of work\n" +" HibernateUtil.getSessionFactory()\n" +" .getCurrentSession().getTransaction().commit();\n" +"\n" +" } catch (Exception ex) {\n" +" HibernateUtil.getSessionFactory()\n" +" .getCurrentSession().getTransaction().rollback();\n" +" throw new ServletException(ex);\n" +" }\n" +"\n" +"}" + #. Tag: para +#: tutorial.xml:985 #, no-c-format msgid "" "Save this servlet as src/main/java/org/hibernate/tutorial/web/" @@ -1761,6 +2982,7 @@ msgid "" msgstr "" #. Tag: para +#: tutorial.xml:990 #, fuzzy, no-c-format msgid "" "The pattern applied here is called session-per-request. " @@ -1780,6 +3002,7 @@ msgstr "" "Auto-Commit-Modus wird in Anwendungen nicht verwendet)." #. Tag: para +#: tutorial.xml:999 #, no-c-format msgid "" "Do not use a new Hibernate Session " @@ -1794,6 +3017,7 @@ msgstr "" "aktuellen Java-Thread gebunden wird." #. Tag: para +#: tutorial.xml:1006 #, fuzzy, no-c-format msgid "" "Next, the possible actions of the request are processed and the response " @@ -1803,6 +3027,7 @@ msgstr "" "HTML-Antwort gerendert. Dieser Teil wird in Kürze behandelt." #. Tag: para +#: tutorial.xml:1011 #, fuzzy, no-c-format msgid "" "Finally, the unit of work ends when processing and rendering are complete. " @@ -1826,11 +3051,13 @@ msgstr "" "Ihrer Ansicht in JSP in Erwägung ziehen, nicht in einem Servlet." #. Tag: title +#: tutorial.xml:1025 #, no-c-format msgid "Processing and rendering" msgstr "Bearbeitung und Rendering" #. Tag: para +#: tutorial.xml:1027 #, fuzzy, no-c-format msgid "" "Now you can implement the processing of the request and the rendering of the " @@ -1838,7 +3065,73 @@ msgid "" msgstr "" "Implementieren wir nun die Anfragenbearbeitung und das Rendern der Seite." +#. Tag: programlisting +#: tutorial.xml:1031 +#, fuzzy, no-c-format +msgid "" +"Event Manager" +"\");\n" +"\n" +" // Handle actions\n" +" if ( \"store\".equals(request.getParameter(\"action\")) ) {\n" +"\n" +" String eventTitle = request.getParameter(\"eventTitle\");\n" +" String eventDate = request.getParameter(\"eventDate\");\n" +"\n" +" if ( \"\".equals(eventTitle) || \"\".equals(eventDate) ) {\n" +" out.println(\"Please enter event title and date.\");\n" +" }\n" +" else {\n" +" createAndStoreEvent(eventTitle, dateFormatter.parse" +"(eventDate));\n" +" out.println(\"Added event.\");\n" +" }\n" +" }\n" +"\n" +" // Print page\n" +" printEventForm(out);\n" +" listEvents(out, dateFormatter);\n" +"\n" +" // Write HTML footer\n" +" out.println(\"\");\n" +" out.flush();\n" +" out.close();]]>" +msgstr "" +"// Write HTML header\n" +"PrintWriter out = response.getWriter();\n" +"out.println(\"<html><head><title>Event Manager</" +"title></head><body>\");\n" +"\n" +"// Handle actions\n" +"if ( \"store\".equals(request.getParameter(\"action\")) ) {\n" +"\n" +" String eventTitle = request.getParameter(\"eventTitle\");\n" +" String eventDate = request.getParameter(\"eventDate\");\n" +"\n" +" if ( \"\".equals(eventTitle) || \"\".equals(eventDate) ) {\n" +" out.println(\"<b><i>Please enter event title and date." +"</i></b>\");\n" +" } else {\n" +" createAndStoreEvent(eventTitle, dateFormatter.parse(eventDate));\n" +" out.println(\"<b><i>Added event.</i></b>" +"\");\n" +" }\n" +"}\n" +"\n" +"// Print page\n" +"printEventForm(out);\n" +"listEvents(out, dateFormatter);\n" +"\n" +"// Write HTML footer\n" +"out.println(\"</body></html>\");\n" +"out.flush();\n" +"out.close();" + #. Tag: para +#: tutorial.xml:1033 #, fuzzy, no-c-format msgid "" "This coding style, with a mix of Java and HTML, would not scale in a more " @@ -1856,7 +3149,36 @@ msgstr "" "Liste sämtlicher Veranstaltungen in der Datenbank gedruckt. Die erste " "Methode ist trivial und gibt nur HTML aus." +#. Tag: programlisting +#: tutorial.xml:1042 +#, fuzzy, no-c-format +msgid "" +"Add new event:\");\n" +" out.println(\"
\");\n" +" out.println(\"Title:
" +"\");\n" +" out.println(\"Date (e.g. 24.12.2009):
\");\n" +" out.println(\"" +"\");\n" +" out.println(\"
\");\n" +" }]]>" +msgstr "" +"private void printEventForm(PrintWriter out) {\n" +" out.println(\"<h2>Add new event:</h2>\");\n" +" out.println(\"<form>\");\n" +" out.println(\"Title: <input name='eventTitle' length='50'/><br/" +">\");\n" +" out.println(\"Date (e.g. 24.12.2009): <input name='eventDate' " +"length='10'/><br/>\");\n" +" out.println(\"<input type='submit' name='action' value='store'/>" +"\");\n" +" out.println(\"</form>\");\n" +"}" + #. Tag: para +#: tutorial.xml:1044 #, no-c-format msgid "" "The listEvents() method uses the Hibernate " @@ -1866,7 +3188,62 @@ msgstr "" "Thread gebundene Hibernate Session bei der Ausführung " "einer Abfrage:" +#. Tag: programlisting +#: tutorial.xml:1050 +#, fuzzy, no-c-format +msgid "" +" 0) {\n" +" out.println(\"

Events in database:

\");\n" +" out.println(\"\");\n" +" out.println(\"\");\n" +" out.println(\"\");\n" +" out.println(\"\");\n" +" out.println(\"\");\n" +" Iterator it = result.iterator();\n" +" while (it.hasNext()) {\n" +" Event event = (Event) it.next();\n" +" out.println(\"\");\n" +" out.println(\"\");\n" +" out.println(\"\");\n" +" out.println(\"\");\n" +" }\n" +" out.println(\"
Event titleEvent date
\" + event.getTitle() + \"\" + dateFormatter.format(event.getDate()) " +"+ \"
\");\n" +" }\n" +" }]]>" +msgstr "" +"private void listEvents(PrintWriter out, SimpleDateFormat dateFormatter) {\n" +"\n" +" List result = HibernateUtil.getSessionFactory()\n" +" .getCurrentSession().createCriteria(Event.class).list" +"();\n" +" if (result.size() > 0) {\n" +" out.println(\"<h2>Events in database:</h2>\");\n" +" out.println(\"<table border='1'>\");\n" +" out.println(\"<tr>\");\n" +" out.println(\"<th>Event title</th>\");\n" +" out.println(\"<th>Event date</th>\");\n" +" out.println(\"</tr>\");\n" +" for (Iterator it = result.iterator(); it.hasNext();) {\n" +" Event event = (Event) it.next();\n" +" out.println(\"<tr>\");\n" +" out.println(\"<td>\" + event.getTitle() + \"</td>" +"\");\n" +" out.println(\"<td>\" + dateFormatter.format(event.getDate" +"()) + \"</td>\");\n" +" out.println(\"</tr>\");\n" +" }\n" +" out.println(\"</table>\");\n" +" }\n" +"}" + #. Tag: para +#: tutorial.xml:1052 #, no-c-format msgid "" "Finally, the store action is dispatched to the " @@ -1877,7 +3254,31 @@ msgstr "" "createAndStoreEvent()-Methode gesendet, die ebenfalls die " "Session des aktuellen Threads verwendet:" +#. Tag: programlisting +#: tutorial.xml:1058 +#, fuzzy, no-c-format +msgid "" +"" +msgstr "" +"protected void createAndStoreEvent(String title, Date theDate) {\n" +" Event theEvent = new Event();\n" +" theEvent.setTitle(title);\n" +" theEvent.setDate(theDate);\n" +"\n" +" HibernateUtil.getSessionFactory()\n" +" .getCurrentSession().save(theEvent);\n" +"}" + #. Tag: para +#: tutorial.xml:1060 #, fuzzy, no-c-format msgid "" "The servlet is now complete. A request to the servlet will be processed in a " @@ -1900,11 +3301,13 @@ msgstr "" "Sie weitere Beispiele." #. Tag: title +#: tutorial.xml:1074 #, no-c-format msgid "Deploying and testing" msgstr "Deployment und Test" #. Tag: para +#: tutorial.xml:1076 #, no-c-format msgid "" "To deploy this application for testing we must create a Web ARchive (WAR). " @@ -1912,7 +3315,50 @@ msgid "" "web.xml
" msgstr "" +#. Tag: programlisting +#: tutorial.xml:1082 +#, fuzzy, no-c-format +msgid "" +"\n" +"\n" +"\n" +" \n" +" Event Manager\n" +" org.hibernate.tutorial.web.EventManagerServlet\n" +" \n" +"\n" +" \n" +" Event Manager\n" +" /eventmanager\n" +" \n" +"]]>" +msgstr "" +"<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n" +"<web-app version=\"2.4\"\n" +" xmlns=\"http://java.sun.com/xml/ns/j2ee\"\n" +" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"\n" +" xsi:schemaLocation=\"http://java.sun.com/xml/ns/j2ee\n" +" http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd\">\n" +"\n" +" <servlet>\n" +" <servlet-name>Event Manager</servlet-name>\n" +" <servlet-class>events.EventManagerServlet</servlet-" +"class>\n" +" </servlet>\n" +"\n" +" <servlet-mapping>\n" +" <servlet-name>Event Manager</servlet-name>\n" +" <url-pattern>/eventmanager</url-pattern>\n" +" </servlet-mapping>\n" +"</web-app>" + #. Tag: para +#: tutorial.xml:1084 #, fuzzy, no-c-format msgid "" "To build and deploy call mvn package in your project " @@ -1928,14 +3374,16 @@ msgstr "" "ändern, um diese Anwendung auszuführen." #. Tag: para +#: tutorial.xml:1091 #, no-c-format msgid "" "If you do not have Tomcat installed, download it from and follow the installation instructions. Our " +"tomcat.apache.org/\"> and follow the installation instructions. Our " "application requires no changes to the standard Tomcat configuration." msgstr "" #. Tag: para +#: tutorial.xml:1099 #, no-c-format msgid "" "Once deployed and Tomcat is running, access the application at " @@ -1954,11 +3402,13 @@ msgstr "" "Ausnahmen." #. Tag: title +#: tutorial.xml:1112 #, no-c-format msgid "Summary" msgstr "Zusammenfassung" #. Tag: para +#: tutorial.xml:1114 #, fuzzy, no-c-format msgid "" "This tutorial covered the basics of writing a simple standalone Hibernate " @@ -1967,1181 +3417,3 @@ msgid "" msgstr "" "Diese Anleitung behandelt in Grundzügen die Erstellung einer einfachen " "selbständigen Hibernate-Applikation und einer kleinen Webanwendung." - -#, fuzzy -#~ msgid "" -#~ "" -#~ msgstr "" -#~ "package events;\n" -#~ "\n" -#~ "import java.util.Date;\n" -#~ "\n" -#~ "public class Event {\n" -#~ " private Long id;\n" -#~ "\n" -#~ " private String title;\n" -#~ " private Date date;\n" -#~ "\n" -#~ " public Event() {}\n" -#~ "\n" -#~ " public Long getId() {\n" -#~ " return id;\n" -#~ " }\n" -#~ "\n" -#~ " private void setId(Long id) {\n" -#~ " this.id = id;\n" -#~ " }\n" -#~ "\n" -#~ " public Date getDate() {\n" -#~ " return date;\n" -#~ " }\n" -#~ "\n" -#~ " public void setDate(Date date) {\n" -#~ " this.date = date;\n" -#~ " }\n" -#~ "\n" -#~ " public String getTitle() {\n" -#~ " return title;\n" -#~ " }\n" -#~ "\n" -#~ " public void setTitle(String title) {\n" -#~ " this.title = title;\n" -#~ " }\n" -#~ "}" - -#, fuzzy -#~ msgid "" -#~ "\n" -#~ "\n" -#~ "\n" -#~ "\n" -#~ "[...]\n" -#~ "]]>" -#~ msgstr "" -#~ "<?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>\n" -#~ "[...]\n" -#~ "</hibernate-mapping>" - -#, fuzzy -#~ msgid "" -#~ "\n" -#~ "\n" -#~ " \n" -#~ "\n" -#~ " \n" -#~ "\n" -#~ "]]>" -#~ msgstr "" -#~ "<hibernate-mapping>\n" -#~ "\n" -#~ " <class name=\"events.Event\" table=\"EVENTS\">\n" -#~ "\n" -#~ " </class>\n" -#~ "\n" -#~ "</hibernate-mapping>" - -#, fuzzy -#~ msgid "" -#~ "\n" -#~ "\n" -#~ " \n" -#~ " \n" -#~ " \n" -#~ " \n" -#~ " \n" -#~ "\n" -#~ "]]>" -#~ msgstr "" -#~ "<hibernate-mapping>\n" -#~ "\n" -#~ " <class name=\"events.Event\" table=\"EVENTS\">\n" -#~ " <id name=\"id\" column=\"EVENT_ID\">\n" -#~ " <generator class=\"native\"/>\n" -#~ " </id>\n" -#~ " </class>\n" -#~ "\n" -#~ "</hibernate-mapping>" - -#, fuzzy -#~ msgid "" -#~ "\n" -#~ "\n" -#~ " \n" -#~ " \n" -#~ " \n" -#~ " \n" -#~ " \n" -#~ " \n" -#~ " \n" -#~ "\n" -#~ "]]>" -#~ msgstr "" -#~ "<hibernate-mapping>\n" -#~ "\n" -#~ " <class name=\"events.Event\" table=\"EVENTS\">\n" -#~ " <id name=\"id\" column=\"EVENT_ID\">\n" -#~ " <generator class=\"native\"/>\n" -#~ " </id>\n" -#~ " <property name=\"date\" type=\"timestamp\" column=\"EVENT_DATE" -#~ "\"/>\n" -#~ " <property name=\"title\"/>\n" -#~ " </class>\n" -#~ "\n" -#~ "</hibernate-mapping>" - -#, fuzzy -#~ msgid "" -#~ "\n" -#~ "\n" -#~ "\n" -#~ "\n" -#~ "\n" -#~ " \n" -#~ "\n" -#~ " \n" -#~ " org.hsqldb.jdbcDriver\n" -#~ " jdbc:hsqldb:hsql://localhost\n" -#~ " sa\n" -#~ " \n" -#~ "\n" -#~ " \n" -#~ " 1\n" -#~ "\n" -#~ " \n" -#~ " org.hibernate.dialect.HSQLDialect\n" -#~ "\n" -#~ " \n" -#~ " thread\n" -#~ "\n" -#~ " \n" -#~ " org.hibernate.cache." -#~ "NoCacheProvider\n" -#~ "\n" -#~ " \n" -#~ " true\n" -#~ "\n" -#~ " \n" -#~ " update\n" -#~ "\n" -#~ " \n" -#~ "\n" -#~ " \n" -#~ "\n" -#~ "]]>" -#~ msgstr "" -#~ "<?xml version='1.0' encoding='utf-8'?>\n" -#~ "<!DOCTYPE hibernate-configuration PUBLIC\n" -#~ " \"-//Hibernate/Hibernate Configuration DTD 3.0//EN\"\n" -#~ " \"http://hibernate.sourceforge.net/hibernate-configuration-3.0.dtd" -#~ "\">\n" -#~ "\n" -#~ "<hibernate-configuration>\n" -#~ "\n" -#~ " <session-factory>\n" -#~ "\n" -#~ " <!-- Database connection settings -->\n" -#~ " <property name=\"connection.driver_class\">org.hsqldb." -#~ "jdbcDriver</property>\n" -#~ " <property name=\"connection.url\">jdbc:hsqldb:hsql://" -#~ "localhost</property>\n" -#~ " <property name=\"connection.username\">sa</property>\n" -#~ " <property name=\"connection.password\"></property>\n" -#~ "\n" -#~ " <!-- JDBC connection pool (use the built-in) -->\n" -#~ " <property name=\"connection.pool_size\">1</property>\n" -#~ "\n" -#~ " <!-- SQL dialect -->\n" -#~ " <property name=\"dialect\">org.hibernate.dialect." -#~ "HSQLDialect</property>\n" -#~ "\n" -#~ " <!-- Enable Hibernate's automatic session context management --" -#~ ">\n" -#~ " <property name=\"current_session_context_class\">thread</" -#~ "property>\n" -#~ "\n" -#~ " <!-- Disable the second-level cache -->\n" -#~ " <property name=\"cache.provider_class\">org.hibernate.cache." -#~ "NoCacheProvider</property>\n" -#~ "\n" -#~ " <!-- Echo all executed SQL to stdout -->\n" -#~ " <property name=\"show_sql\">true</property>\n" -#~ "\n" -#~ " <!-- Drop and re-create the database schema on startup -->\n" -#~ " <property name=\"hbm2ddl.auto\">create</property>\n" -#~ "\n" -#~ " <mapping resource=\"events/Event.hbm.xml\"/>\n" -#~ "\n" -#~ " </session-factory>\n" -#~ "\n" -#~ "</hibernate-configuration>" - -#, fuzzy -#~ msgid "" -#~ "" -#~ msgstr "" -#~ "package util;\n" -#~ "\n" -#~ "import org.hibernate.*;\n" -#~ "import org.hibernate.cfg.*;\n" -#~ "\n" -#~ "public class HibernateUtil {\n" -#~ "\n" -#~ " private static final SessionFactory sessionFactory;\n" -#~ "\n" -#~ " static {\n" -#~ " try {\n" -#~ " // Create the SessionFactory from hibernate.cfg.xml\n" -#~ " sessionFactory = new Configuration().configure()." -#~ "buildSessionFactory();\n" -#~ " } catch (Throwable ex) {\n" -#~ " // Make sure you log the exception, as it might be swallowed\n" -#~ " System.err.println(\"Initial SessionFactory creation failed." -#~ "\" + ex);\n" -#~ " throw new ExceptionInInitializerError(ex);\n" -#~ " }\n" -#~ " }\n" -#~ "\n" -#~ " public static SessionFactory getSessionFactory() {\n" -#~ " return sessionFactory;\n" -#~ " }\n" -#~ "\n" -#~ "}" - -#, fuzzy -#~ msgid "" -#~ "" -#~ msgstr "" -#~ "package events;\n" -#~ "import org.hibernate.Session;\n" -#~ "\n" -#~ "import java.util.Date;\n" -#~ "\n" -#~ "import util.HibernateUtil;\n" -#~ "\n" -#~ "public class EventManager {\n" -#~ "\n" -#~ " public static void main(String[] args) {\n" -#~ " EventManager mgr = new EventManager();\n" -#~ "\n" -#~ " if (args[0].equals(\"store\")) {\n" -#~ " mgr.createAndStoreEvent(\"My Event\", new Date());\n" -#~ " }\n" -#~ "\n" -#~ " HibernateUtil.getSessionFactory().close();\n" -#~ " }\n" -#~ "\n" -#~ " private void createAndStoreEvent(String title, Date theDate) {\n" -#~ "\n" -#~ " Session session = HibernateUtil.getSessionFactory()." -#~ "getCurrentSession();\n" -#~ "\n" -#~ " session.beginTransaction();\n" -#~ "\n" -#~ " Event theEvent = new Event();\n" -#~ " theEvent.setTitle(title);\n" -#~ " theEvent.setDate(theDate);\n" -#~ "\n" -#~ " session.save(theEvent);\n" -#~ "\n" -#~ " session.getTransaction().commit();\n" -#~ " }\n" -#~ "\n" -#~ "}" - -#, fuzzy -#~ msgid "" -#~ "" -#~ msgstr "" -#~ "[java] Hibernate: insert into EVENTS (EVENT_DATE, title, EVENT_ID) values " -#~ "(?, ?, ?)" - -#, fuzzy -#~ msgid "" -#~ "" -#~ msgstr "" -#~ "if (args[0].equals(\"store\")) {\n" -#~ " mgr.createAndStoreEvent(\"My Event\", new Date());\n" -#~ "}\n" -#~ "else if (args[0].equals(\"list\")) {\n" -#~ " List events = mgr.listEvents();\n" -#~ " for (int i = 0; i < events.size(); i++) {\n" -#~ " Event theEvent = (Event) events.get(i);\n" -#~ " System.out.println(\"Event: \" + theEvent.getTitle() +\n" -#~ " \" Time: \" + theEvent.getDate());\n" -#~ " }\n" -#~ "}" - -#, fuzzy -#~ msgid "" -#~ "" -#~ msgstr "" -#~ "private List listEvents() {\n" -#~ "\n" -#~ " Session session = HibernateUtil.getSessionFactory().getCurrentSession" -#~ "();\n" -#~ "\n" -#~ " session.beginTransaction();\n" -#~ "\n" -#~ " List result = session.createQuery(\"from Event\").list();\n" -#~ "\n" -#~ " session.getTransaction().commit();\n" -#~ "\n" -#~ " return result;\n" -#~ "}" - -#, fuzzy -#~ msgid "" -#~ "" -#~ msgstr "" -#~ "package events;\n" -#~ "\n" -#~ "public class Person {\n" -#~ "\n" -#~ " private Long id;\n" -#~ " private int age;\n" -#~ " private String firstname;\n" -#~ " private String lastname;\n" -#~ "\n" -#~ " public Person() {}\n" -#~ "\n" -#~ " // Accessor methods for all properties, private setter for 'id'\n" -#~ "\n" -#~ "}" - -#, fuzzy -#~ msgid "" -#~ "\n" -#~ "\n" -#~ " \n" -#~ " \n" -#~ " \n" -#~ " \n" -#~ " \n" -#~ " \n" -#~ " \n" -#~ " \n" -#~ "\n" -#~ "]]>" -#~ msgstr "" -#~ "<hibernate-mapping>\n" -#~ "\n" -#~ " <class name=\"events.Person\" table=\"PERSON\">\n" -#~ " <id name=\"id\" column=\"PERSON_ID\">\n" -#~ " <generator class=\"native\"/>\n" -#~ " </id>\n" -#~ " <property name=\"age\"/>\n" -#~ " <property name=\"firstname\"/>\n" -#~ " <property name=\"lastname\"/>\n" -#~ " </class>\n" -#~ "\n" -#~ "</hibernate-mapping>" - -#, fuzzy -#~ msgid "" -#~ "\n" -#~ "]]>" -#~ msgstr "" -#~ "<mapping resource=\"events/Event.hbm.xml\"/>\n" -#~ "<mapping resource=\"events/Person.hbm.xml\"/>" - -#, fuzzy -#~ msgid "" -#~ "" -#~ msgstr "" -#~ "public class Person {\n" -#~ "\n" -#~ " private Set events = new HashSet();\n" -#~ "\n" -#~ " public Set getEvents() {\n" -#~ " return events;\n" -#~ " }\n" -#~ "\n" -#~ " public void setEvents(Set events) {\n" -#~ " this.events = events;\n" -#~ " }\n" -#~ "}" - -#, fuzzy -#~ msgid "" -#~ "\n" -#~ " \n" -#~ " \n" -#~ " \n" -#~ " \n" -#~ " \n" -#~ " \n" -#~ "\n" -#~ " \n" -#~ " \n" -#~ " \n" -#~ " \n" -#~ "\n" -#~ "]]>" -#~ msgstr "" -#~ "<class name=\"events.Person\" table=\"PERSON\">\n" -#~ " <id name=\"id\" column=\"PERSON_ID\">\n" -#~ " <generator class=\"native\"/>\n" -#~ " </id>\n" -#~ " <property name=\"age\"/>\n" -#~ " <property name=\"firstname\"/>\n" -#~ " <property name=\"lastname\"/>\n" -#~ "\n" -#~ " <set name=\"events\" table=\"PERSON_EVENT\">\n" -#~ " <key column=\"PERSON_ID\"/>\n" -#~ " <many-to-many column=\"EVENT_ID\" class=\"events.Event\"/>\n" -#~ " </set>\n" -#~ "\n" -#~ "</class>" - -#, fuzzy -#~ msgid "" -#~ " | *EVENT_ID | | |\n" -#~ " | EVENT_DATE | | *PERSON_ID | <--> | *PERSON_ID |\n" -#~ " | TITLE | |__________________| | AGE |\n" -#~ " |_____________| | FIRSTNAME |\n" -#~ " | LASTNAME |\n" -#~ " |_____________|\n" -#~ " ]]>" -#~ msgstr "" -#~ "_____________ __________________\n" -#~ " | | | | _____________\n" -#~ " | EVENTS | | PERSON_EVENT | | |\n" -#~ " |_____________| |__________________| | PERSON |\n" -#~ " | | | | |_____________|\n" -#~ " | *EVENT_ID | <--> | *EVENT_ID | | |\n" -#~ " | EVENT_DATE | | *PERSON_ID | <--> | *PERSON_ID |\n" -#~ " | TITLE | |__________________| | AGE |\n" -#~ " |_____________| | FIRSTNAME |\n" -#~ " | LASTNAME |\n" -#~ " |_____________|" - -#, fuzzy -#~ msgid "" -#~ "" -#~ msgstr "" -#~ "private void addPersonToEvent(Long personId, Long eventId) {\n" -#~ "\n" -#~ " Session session = HibernateUtil.getSessionFactory().getCurrentSession" -#~ "();\n" -#~ " session.beginTransaction();\n" -#~ "\n" -#~ " Person aPerson = (Person) session.load(Person.class, personId);\n" -#~ " Event anEvent = (Event) session.load(Event.class, eventId);\n" -#~ "\n" -#~ " aPerson.getEvents().add(anEvent);\n" -#~ "\n" -#~ " session.getTransaction().commit();\n" -#~ "}" - -#, fuzzy -#~ msgid "" -#~ "" -#~ msgstr "" -#~ "private void addPersonToEvent(Long personId, Long eventId) {\n" -#~ "\n" -#~ " Session session = HibernateUtil.getSessionFactory().getCurrentSession" -#~ "();\n" -#~ " session.beginTransaction();\n" -#~ "\n" -#~ " Person aPerson = (Person) session\n" -#~ " .createQuery(\"select p from Person p left join fetch p." -#~ "events where p.id = :pid\")\n" -#~ " .setParameter(\"pid\", personId)\n" -#~ " .uniqueResult(); // Eager fetch the collection so we can use " -#~ "it detached\n" -#~ "\n" -#~ " Event anEvent = (Event) session.load(Event.class, eventId);\n" -#~ "\n" -#~ " session.getTransaction().commit();\n" -#~ "\n" -#~ " // End of first unit of work\n" -#~ "\n" -#~ " aPerson.getEvents().add(anEvent); // aPerson (and its collection) is " -#~ "detached\n" -#~ "\n" -#~ " // Begin second unit of work\n" -#~ "\n" -#~ " Session session2 = HibernateUtil.getSessionFactory().getCurrentSession" -#~ "();\n" -#~ " session2.beginTransaction();\n" -#~ "\n" -#~ " session2.update(aPerson); // Reattachment of aPerson\n" -#~ "\n" -#~ " session2.getTransaction().commit();\n" -#~ "}" - -#, fuzzy -#~ msgid "" -#~ "" -#~ msgstr "" -#~ "else if (args[0].equals(\"addpersontoevent\")) {\n" -#~ " Long eventId = mgr.createAndStoreEvent(\"My Event\", new Date());\n" -#~ " Long personId = mgr.createAndStorePerson(\"Foo\", \"Bar\");\n" -#~ " mgr.addPersonToEvent(personId, eventId);\n" -#~ " System.out.println(\"Added person \" + personId + \" to event \" + " -#~ "eventId);\n" -#~ "}" - -#, fuzzy -#~ msgid "" -#~ "" -#~ msgstr "" -#~ "private Set emailAddresses = new HashSet();\n" -#~ "\n" -#~ "public Set getEmailAddresses() {\n" -#~ " return emailAddresses;\n" -#~ "}\n" -#~ "\n" -#~ "public void setEmailAddresses(Set emailAddresses) {\n" -#~ " this.emailAddresses = emailAddresses;\n" -#~ "}" - -#, fuzzy -#~ msgid "" -#~ "\n" -#~ " \n" -#~ " \n" -#~ " ]]>" -#~ msgstr "" -#~ "<set name=\"emailAddresses\" table=\"PERSON_EMAIL_ADDR\">\n" -#~ " <key column=\"PERSON_ID\"/>\n" -#~ " <element type=\"string\" column=\"EMAIL_ADDR\"/>\n" -#~ "</set>" - -#, fuzzy -#~ msgid "" -#~ " | *EVENT_ID | | | |" -#~ "___________________|\n" -#~ " | EVENT_DATE | | *PERSON_ID | <--> | *PERSON_ID | <--> | " -#~ "*PERSON_ID |\n" -#~ " | TITLE | |__________________| | AGE | | " -#~ "*EMAIL_ADDR |\n" -#~ " |_____________| | FIRSTNAME | |" -#~ "___________________|\n" -#~ " | LASTNAME |\n" -#~ " |_____________|\n" -#~ " ]]>" -#~ msgstr "" -#~ "_____________ __________________\n" -#~ " | | | | _____________\n" -#~ " | EVENTS | | PERSON_EVENT | | | " -#~ "___________________\n" -#~ " |_____________| |__________________| | PERSON | " -#~ "| |\n" -#~ " | | | | |_____________| | " -#~ "PERSON_EMAIL_ADDR |\n" -#~ " | *EVENT_ID | <--> | *EVENT_ID | | " -#~ "| |___________________|\n" -#~ " | EVENT_DATE | | *PERSON_ID | <--> | *PERSON_ID | " -#~ "<--> | *PERSON_ID |\n" -#~ " | TITLE | |__________________| | AGE | | " -#~ "*EMAIL_ADDR |\n" -#~ " |_____________| | FIRSTNAME | |" -#~ "___________________|\n" -#~ " | LASTNAME |\n" -#~ " |_____________|" - -#, fuzzy -#~ msgid "" -#~ "" -#~ msgstr "" -#~ "private void addEmailToPerson(Long personId, String emailAddress) {\n" -#~ "\n" -#~ " Session session = HibernateUtil.getSessionFactory().getCurrentSession" -#~ "();\n" -#~ " session.beginTransaction();\n" -#~ "\n" -#~ " Person aPerson = (Person) session.load(Person.class, personId);\n" -#~ "\n" -#~ " // The getEmailAddresses() might trigger a lazy load of the " -#~ "collection\n" -#~ " aPerson.getEmailAddresses().add(emailAddress);\n" -#~ "\n" -#~ " session.getTransaction().commit();\n" -#~ "}" - -#, fuzzy -#~ msgid "" -#~ "" -#~ msgstr "" -#~ "private Set participants = new HashSet();\n" -#~ "\n" -#~ "public Set getParticipants() {\n" -#~ " return participants;\n" -#~ "}\n" -#~ "\n" -#~ "public void setParticipants(Set participants) {\n" -#~ " this.participants = participants;\n" -#~ "}" - -#, fuzzy -#~ msgid "" -#~ "\n" -#~ " \n" -#~ " \n" -#~ " ]]>" -#~ msgstr "" -#~ "<set name=\"participants\" table=\"PERSON_EVENT\" inverse=\"true" -#~ "\">\n" -#~ " <key column=\"EVENT_ID\"/>\n" -#~ " <many-to-many column=\"PERSON_ID\" class=\"events.Person\"/>\n" -#~ "</set>" - -#, fuzzy -#~ msgid "" -#~ "" -#~ msgstr "" -#~ "protected Set getEvents() {\n" -#~ " return events;\n" -#~ "}\n" -#~ "\n" -#~ "protected void setEvents(Set events) {\n" -#~ " this.events = events;\n" -#~ "}\n" -#~ "\n" -#~ "public void addToEvent(Event event) {\n" -#~ " this.getEvents().add(event);\n" -#~ " event.getParticipants().add(this);\n" -#~ "}\n" -#~ "\n" -#~ "public void removeFromEvent(Event event) {\n" -#~ " this.getEvents().remove(event);\n" -#~ " event.getParticipants().remove(this);\n" -#~ "}" - -#, fuzzy -#~ msgid "" -#~ "" -#~ msgstr "" -#~ "protected void doGet(HttpServletRequest request,\n" -#~ " HttpServletResponse response)\n" -#~ " throws ServletException, IOException {\n" -#~ "\n" -#~ " SimpleDateFormat dateFormatter = new SimpleDateFormat(\"dd.MM.yyyy" -#~ "\");\n" -#~ "\n" -#~ " try {\n" -#~ " // Begin unit of work\n" -#~ " HibernateUtil.getSessionFactory()\n" -#~ " .getCurrentSession().beginTransaction();\n" -#~ "\n" -#~ " // Process request and render page...\n" -#~ "\n" -#~ " // End unit of work\n" -#~ " HibernateUtil.getSessionFactory()\n" -#~ " .getCurrentSession().getTransaction().commit();\n" -#~ "\n" -#~ " } catch (Exception ex) {\n" -#~ " HibernateUtil.getSessionFactory()\n" -#~ " .getCurrentSession().getTransaction().rollback();\n" -#~ " throw new ServletException(ex);\n" -#~ " }\n" -#~ "\n" -#~ "}" - -#, fuzzy -#~ msgid "" -#~ "Event Manager\");\n" -#~ "\n" -#~ " // Handle actions\n" -#~ " if ( \"store\".equals(request.getParameter(\"action\")) ) {\n" -#~ "\n" -#~ " String eventTitle = request.getParameter(\"eventTitle\");\n" -#~ " String eventDate = request.getParameter(\"eventDate\");\n" -#~ "\n" -#~ " if ( \"\".equals(eventTitle) || \"\".equals(eventDate) ) {\n" -#~ " out.println(\"Please enter event title and date.\");\n" -#~ " }\n" -#~ " else {\n" -#~ " createAndStoreEvent(eventTitle, dateFormatter.parse" -#~ "(eventDate));\n" -#~ " out.println(\"Added event.\");\n" -#~ " }\n" -#~ " }\n" -#~ "\n" -#~ " // Print page\n" -#~ " printEventForm(out);\n" -#~ " listEvents(out, dateFormatter);\n" -#~ "\n" -#~ " // Write HTML footer\n" -#~ " out.println(\"\");\n" -#~ " out.flush();\n" -#~ " out.close();]]>" -#~ msgstr "" -#~ "// Write HTML header\n" -#~ "PrintWriter out = response.getWriter();\n" -#~ "out.println(\"<html><head><title>Event Manager</" -#~ "title></head><body>\");\n" -#~ "\n" -#~ "// Handle actions\n" -#~ "if ( \"store\".equals(request.getParameter(\"action\")) ) {\n" -#~ "\n" -#~ " String eventTitle = request.getParameter(\"eventTitle\");\n" -#~ " String eventDate = request.getParameter(\"eventDate\");\n" -#~ "\n" -#~ " if ( \"\".equals(eventTitle) || \"\".equals(eventDate) ) {\n" -#~ " out.println(\"<b><i>Please enter event title and date." -#~ "</i></b>\");\n" -#~ " } else {\n" -#~ " createAndStoreEvent(eventTitle, dateFormatter.parse(eventDate));\n" -#~ " out.println(\"<b><i>Added event.</i></b>" -#~ "\");\n" -#~ " }\n" -#~ "}\n" -#~ "\n" -#~ "// Print page\n" -#~ "printEventForm(out);\n" -#~ "listEvents(out, dateFormatter);\n" -#~ "\n" -#~ "// Write HTML footer\n" -#~ "out.println(\"</body></html>\");\n" -#~ "out.flush();\n" -#~ "out.close();" - -#, fuzzy -#~ msgid "" -#~ "Add new event:\");\n" -#~ " out.println(\"
\");\n" -#~ " out.println(\"Title:
" -#~ "\");\n" -#~ " out.println(\"Date (e.g. 24.12.2009):
\");\n" -#~ " out.println(\"" -#~ "\");\n" -#~ " out.println(\"
\");\n" -#~ " }]]>" -#~ msgstr "" -#~ "private void printEventForm(PrintWriter out) {\n" -#~ " out.println(\"<h2>Add new event:</h2>\");\n" -#~ " out.println(\"<form>\");\n" -#~ " out.println(\"Title: <input name='eventTitle' length='50'/><" -#~ "br/>\");\n" -#~ " out.println(\"Date (e.g. 24.12.2009): <input name='eventDate' " -#~ "length='10'/><br/>\");\n" -#~ " out.println(\"<input type='submit' name='action' value='store'/>" -#~ "\");\n" -#~ " out.println(\"</form>\");\n" -#~ "}" - -#, fuzzy -#~ msgid "" -#~ " 0) {\n" -#~ " out.println(\"

Events in database:

\");\n" -#~ " out.println(\"\");\n" -#~ " out.println(\"\");\n" -#~ " out.println(\"\");\n" -#~ " out.println(\"\");\n" -#~ " out.println(\"\");\n" -#~ " Iterator it = result.iterator();\n" -#~ " while (it.hasNext()) {\n" -#~ " Event event = (Event) it.next();\n" -#~ " out.println(\"\");\n" -#~ " out.println(\"\");\n" -#~ " out.println(\"\");\n" -#~ " out.println(\"\");\n" -#~ " }\n" -#~ " out.println(\"
Event titleEvent date
\" + event.getTitle() + \"\" + dateFormatter.format(event.getDate" -#~ "()) + \"
\");\n" -#~ " }\n" -#~ " }]]>" -#~ msgstr "" -#~ "private void listEvents(PrintWriter out, SimpleDateFormat dateFormatter) " -#~ "{\n" -#~ "\n" -#~ " List result = HibernateUtil.getSessionFactory()\n" -#~ " .getCurrentSession().createCriteria(Event.class).list" -#~ "();\n" -#~ " if (result.size() > 0) {\n" -#~ " out.println(\"<h2>Events in database:</h2>\");\n" -#~ " out.println(\"<table border='1'>\");\n" -#~ " out.println(\"<tr>\");\n" -#~ " out.println(\"<th>Event title</th>\");\n" -#~ " out.println(\"<th>Event date</th>\");\n" -#~ " out.println(\"</tr>\");\n" -#~ " for (Iterator it = result.iterator(); it.hasNext();) {\n" -#~ " Event event = (Event) it.next();\n" -#~ " out.println(\"<tr>\");\n" -#~ " out.println(\"<td>\" + event.getTitle() + \"</td>" -#~ "\");\n" -#~ " out.println(\"<td>\" + dateFormatter.format(event." -#~ "getDate()) + \"</td>\");\n" -#~ " out.println(\"</tr>\");\n" -#~ " }\n" -#~ " out.println(\"</table>\");\n" -#~ " }\n" -#~ "}" - -#, fuzzy -#~ msgid "" -#~ "" -#~ msgstr "" -#~ "protected void createAndStoreEvent(String title, Date theDate) {\n" -#~ " Event theEvent = new Event();\n" -#~ " theEvent.setTitle(title);\n" -#~ " theEvent.setDate(theDate);\n" -#~ "\n" -#~ " HibernateUtil.getSessionFactory()\n" -#~ " .getCurrentSession().save(theEvent);\n" -#~ "}" - -#, fuzzy -#~ msgid "" -#~ "\n" -#~ "\n" -#~ "\n" -#~ " \n" -#~ " Event Manager\n" -#~ " org.hibernate.tutorial.web.EventManagerServlet\n" -#~ " \n" -#~ "\n" -#~ " \n" -#~ " Event Manager\n" -#~ " /eventmanager\n" -#~ " \n" -#~ "]]>" -#~ msgstr "" -#~ "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n" -#~ "<web-app version=\"2.4\"\n" -#~ " xmlns=\"http://java.sun.com/xml/ns/j2ee\"\n" -#~ " xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"\n" -#~ " xsi:schemaLocation=\"http://java.sun.com/xml/ns/j2ee\n" -#~ " http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd\">\n" -#~ "\n" -#~ " <servlet>\n" -#~ " <servlet-name>Event Manager</servlet-name>\n" -#~ " <servlet-class>events.EventManagerServlet</servlet-" -#~ "class>\n" -#~ " </servlet>\n" -#~ "\n" -#~ " <servlet-mapping>\n" -#~ " <servlet-name>Event Manager</servlet-name>\n" -#~ " <url-pattern>/eventmanager</url-pattern>\n" -#~ " </servlet-mapping>\n" -#~ "</web-app>" diff --git a/documentation/manual/src/main/docbook/es-ES/author_group.po b/documentation/manual/src/main/docbook/es-ES/author_group.po index 8f9cd416d3..fb9d57121c 100644 --- a/documentation/manual/src/main/docbook/es-ES/author_group.po +++ b/documentation/manual/src/main/docbook/es-ES/author_group.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: author_group\n" "Report-Msgid-Bugs-To: http://bugs.kde.org\n" -"POT-Creation-Date: 2010-02-04T04:51:21\n" +"POT-Creation-Date: 2010-07-20 21:02+0000\n" "PO-Revision-Date: 2010-03-12 11:24+1000\n" "Last-Translator: Angela Garcia \n" "Language-Team: \n" @@ -16,138 +16,296 @@ msgstr "" "Content-Transfer-Encoding: 8bit\n" "X-Generator: KBabel 1.11.4\n" -#. Tag: firstname +#. Tag: author +#: author_group.xml:28 #, no-c-format -msgid "Gavin" -msgstr "Gavin" +msgid "Gavin King" +msgstr "" -#. Tag: firstname +#. Tag: author +#: author_group.xml:32 #, no-c-format -msgid "Christian" -msgstr "Christian" +msgid "Christian Bauer" +msgstr "" -#. Tag: firstname +#. Tag: author +#: author_group.xml:36 #, no-c-format -msgid "Max" -msgstr "Max" +msgid "" +"Max Rydahl Andersen" +msgstr "" -#. Tag: firstname +#. Tag: author +#: author_group.xml:41 #, no-c-format -msgid "Emmanuel" -msgstr "Emmanuel" +msgid "" +"Emmanuel Bernard" +msgstr "" -#. Tag: firstname +#. Tag: author +#: author_group.xml:45 #, no-c-format -msgid "Steve" -msgstr "Steve" +msgid "Steve Ebersole" +msgstr "" -#. Tag: firstname +#. Tag: author +#: author_group.xml:49 #, no-c-format -msgid "James" -msgstr "James" +msgid "Hardy Ferentschik" +msgstr "" -#. Tag: firstname +#. Tag: othercredit +#: author_group.xml:54 #, no-c-format -msgid "Cheyenne" -msgstr "Cheyenne" +msgid "James Cobb" +msgstr "" -#. Tag: firstname +#. Tag: shortaffil +#: author_group.xml:58 author_group.xml:65 #, no-c-format -msgid "Vincent" -msgstr "Vincent" +msgid "Graphic Design" +msgstr "" -#. Tag: firstname +#. Tag: othercredit +#: author_group.xml:61 #, no-c-format -msgid "Sebastien" -msgstr "Sebastien" +msgid "Cheyenne Weaver" +msgstr "" -#. Tag: firstname +#. Tag: othercredit +#: author_group.xml:74 #, no-c-format -msgid "Michael" -msgstr "Michael" +msgid "" +" " +"kreimer@bbs.frc.utn.edu.ar" +msgstr "" -#. Tag: firstname +#. Tag: othercredit +#: author_group.xml:84 #, no-c-format -msgid "Baptiste" -msgstr "Baptiste" +msgid "Vincent Ricard" +msgstr "" -#. Tag: firstname +#. Tag: othercredit +#: author_group.xml:88 #, no-c-format -msgid "Anthony" -msgstr "Anthony" +msgid "Sebastien Cesbron" +msgstr "" -#. Tag: firstname +#. Tag: othercredit +#: author_group.xml:92 #, no-c-format -msgid "Alvaro" -msgstr "Alvaro" +msgid "Michael Courcy" +msgstr "" -#. Tag: firstname +#. Tag: othercredit +#: author_group.xml:96 #, no-c-format -msgid "Anderson" -msgstr "Anderson" +msgid "Vincent Giguère" +msgstr "" -#. Tag: firstname +#. Tag: othercredit +#: author_group.xml:100 #, no-c-format -msgid "Daniel Vieira" -msgstr "Daniel Vieira" +msgid "Baptiste Mathus" +msgstr "" -#. Tag: firstname +#. Tag: othercredit +#: author_group.xml:104 #, no-c-format -msgid "Francisco" -msgstr "Francisco" +msgid "" +"Emmanuel Bernard" +msgstr "" -#. Tag: firstname +#. Tag: othercredit +#: author_group.xml:108 #, no-c-format -msgid "Gamarra" -msgstr "Gamarra" +msgid "Anthony Patricio" +msgstr "" -#. Tag: firstname +#. Tag: othercredit +#: author_group.xml:118 #, no-c-format -msgid "Luiz Carlos" -msgstr "Luiz Carlos" +msgid "" +"Alvaro Netto " +"alvaronetto@cetip.com.br" +msgstr "" -#. Tag: firstname +#. Tag: othercredit +#: author_group.xml:123 #, no-c-format -msgid "Marcel" -msgstr "Marcel" +msgid "" +"Anderson Braulio " +"andersonbraulio@gmail.com" +msgstr "" -#. Tag: firstname +#. Tag: othercredit +#: author_group.xml:128 #, no-c-format -msgid "Paulo" -msgstr "Paulo" +msgid "" +"Daniel Vieira Costa " +"danielvc@gmail.com" +msgstr "" -#. Tag: firstname +#. Tag: othercredit +#: author_group.xml:133 #, no-c-format -msgid "Pablo L." -msgstr "Pablo L." +msgid "" +"Francisco gamarra francisco." +"gamarra@gmail.com" +msgstr "" -#. Tag: firstname +#. Tag: othercredit +#: author_group.xml:138 #, no-c-format -msgid "Renato" -msgstr "Renato" +msgid "" +"Gamarra mauricio.gamarra@gmail.com" +msgstr "" -#. Tag: firstname +#. Tag: othercredit +#: author_group.xml:142 #, no-c-format -msgid "Rogério" -msgstr "Rogério" +msgid "" +"Luiz Carlos Rodrigues " +"luizcarlos_rodrigues@yahoo.com.br" +msgstr "" -#. Tag: firstname +#. Tag: othercredit +#: author_group.xml:147 #, no-c-format -msgid "Wanderson" -msgstr "Wanderson" +msgid "" +"Marcel Castelo marcel." +"castelo@gmail.com" +msgstr "" -#. Tag: firstname +#. Tag: othercredit +#: author_group.xml:152 #, no-c-format -msgid "Cao" -msgstr "Cao" +msgid "" +"Paulo César paulocol@gmail." +"com" +msgstr "" -#. Tag: orgname +#. Tag: othercredit +#: author_group.xml:157 #, no-c-format -msgid "RedSaga" -msgstr "RedSaga" +msgid "" +"Pablo L. de Miranda " +"pablolmiranda@gmail.com" +msgstr "" -#. Tag: contrib +#. Tag: othercredit +#: author_group.xml:162 #, no-c-format -msgid "Translation Lead" -msgstr "Líder de traducción" +msgid "" +"Renato Deggau rdeggau@gmail." +"com" +msgstr "" +#. Tag: othercredit +#: author_group.xml:167 +#, no-c-format +msgid "" +"Rogério Araújo " +"rgildoaraujo@yahoo.com.br" +msgstr "" + +#. Tag: othercredit +#: author_group.xml:172 +#, no-c-format +msgid "" +"Wanderson Siqueira " +"wandersonxs@gmail.com" +msgstr "" + +#. Tag: othercredit +#: author_group.xml:183 +#, no-c-format +msgid "" +"Cao Xiaogang " +"RedSaga Translation Lead caoxg@yahoo.com" +msgstr "" + +#~ msgid "Gavin" +#~ msgstr "Gavin" + +#~ msgid "Christian" +#~ msgstr "Christian" + +#~ msgid "Max" +#~ msgstr "Max" + +#~ msgid "Emmanuel" +#~ msgstr "Emmanuel" + +#~ msgid "Steve" +#~ msgstr "Steve" + +#~ msgid "James" +#~ msgstr "James" + +#~ msgid "Cheyenne" +#~ msgstr "Cheyenne" + +#~ msgid "Vincent" +#~ msgstr "Vincent" + +#~ msgid "Sebastien" +#~ msgstr "Sebastien" + +#~ msgid "Michael" +#~ msgstr "Michael" + +#~ msgid "Baptiste" +#~ msgstr "Baptiste" + +#~ msgid "Anthony" +#~ msgstr "Anthony" + +#~ msgid "Alvaro" +#~ msgstr "Alvaro" + +#~ msgid "Anderson" +#~ msgstr "Anderson" + +#~ msgid "Daniel Vieira" +#~ msgstr "Daniel Vieira" + +#~ msgid "Francisco" +#~ msgstr "Francisco" + +#~ msgid "Gamarra" +#~ msgstr "Gamarra" + +#~ msgid "Luiz Carlos" +#~ msgstr "Luiz Carlos" + +#~ msgid "Marcel" +#~ msgstr "Marcel" + +#~ msgid "Paulo" +#~ msgstr "Paulo" + +#~ msgid "Pablo L." +#~ msgstr "Pablo L." + +#~ msgid "Renato" +#~ msgstr "Renato" + +#~ msgid "Rogério" +#~ msgstr "Rogério" + +#~ msgid "Wanderson" +#~ msgstr "Wanderson" + +#~ msgid "Cao" +#~ msgstr "Cao" + +#~ msgid "RedSaga" +#~ msgstr "RedSaga" + +#~ msgid "Translation Lead" +#~ msgstr "Líder de traducción" diff --git a/documentation/manual/src/main/docbook/es-ES/content/basic_mapping.po b/documentation/manual/src/main/docbook/es-ES/content/basic_mapping.po index 29a9294ff7..ec25c49416 100644 --- a/documentation/manual/src/main/docbook/es-ES/content/basic_mapping.po +++ b/documentation/manual/src/main/docbook/es-ES/content/basic_mapping.po @@ -14,7 +14,7 @@ msgid "" msgstr "" "Project-Id-Version: basic_mapping\n" "Report-Msgid-Bugs-To: http://bugs.kde.org\n" -"POT-Creation-Date: 2010-02-11T05:38:15\n" +"POT-Creation-Date: 2010-07-20 21:02+0000\n" "PO-Revision-Date: 2010-03-15 12:49+1000\n" "Last-Translator: Angela Garcia \n" "Language-Team: \n" @@ -24,22 +24,143 @@ msgstr "" "X-Generator: KBabel 1.11.4\n" #. Tag: title +#: basic_mapping.xml:31 #, no-c-format msgid "Basic O/R Mapping" msgstr "Mapeo O/R Básico" #. Tag: title +#: basic_mapping.xml:34 #, no-c-format msgid "Mapping declaration" msgstr "Declaración de mapeo" #. Tag: para +#: basic_mapping.xml:36 +#, no-c-format +msgid "Object/relational mappings can be defined in three approaches:" +msgstr "" + +#. Tag: para +#: basic_mapping.xml:41 +#, no-c-format +msgid "using Java 5 annotations (via the Java Persistence 2 annotations)" +msgstr "" + +#. Tag: para +#: basic_mapping.xml:46 +#, no-c-format +msgid "using JPA 2 XML deployment descriptors (described in chapter XXX)" +msgstr "" + +#. Tag: para +#: basic_mapping.xml:51 +#, no-c-format +msgid "using the Hibernate legacy XML files approach known as hbm.xml" +msgstr "" + +#. Tag: para +#: basic_mapping.xml:56 #, no-c-format msgid "" -"Object/relational mappings are usually defined in an XML document. The " -"mapping document is designed to be readable and hand-editable. The mapping " -"language is Java-centric, meaning that mappings are constructed around " -"persistent class declarations and not table declarations." +"Annotations are split in two categories, the logical mapping annotations " +"(describing the object model, the association between two entities etc.) and " +"the physical mapping annotations (describing the physical schema, tables, " +"columns, indexes, etc). We will mix annotations from both categories in the " +"following code examples." +msgstr "" + +#. Tag: para +#: basic_mapping.xml:62 +#, no-c-format +msgid "" +"JPA annotations are in the javax.persistence.* package. " +"Hibernate specific extensions are in org.hibernate.annotations.*. You favorite IDE can auto-complete annotations and their " +"attributes for you (even without a specific \"JPA\" plugin, since JPA " +"annotations are plain Java 5 annotations)." +msgstr "" + +#. Tag: para +#: basic_mapping.xml:69 +#, fuzzy, no-c-format +msgid "Here is an example of mapping" +msgstr "Este es un ejemplo de mapeo:" + +#. Tag: programlisting +#: basic_mapping.xml:71 +#, no-c-format +msgid "" +"package eg;\n" +"\n" +"@Entity \n" +"@Table(name=\"cats\") @Inheritance(strategy=SINGLE_TABLE)\n" +"@DiscriminatorValue(\"C\") @DiscriminatorColumn(name=\"subclass\", " +"discriminatorType=CHAR)\n" +"public class Cat {\n" +" \n" +" @Id @GeneratedValue\n" +" public Integer getId() { return id; }\n" +" public void setId(Integer id) { this.id = id; }\n" +" private Integer id;\n" +"\n" +" public BigDecimal getWeight() { return weight; }\n" +" public void setWeight(BigDecimal weight) { this.weight = weight; }\n" +" private BigDecimal weight;\n" +"\n" +" @Temporal(DATE) @NotNull @Column(updatable=false)\n" +" public Date getBirthdate() { return birthdate; }\n" +" public void setBirthdate(Date birthdate) { this.birthdate = birthdate; }\n" +" private Date birthdate;\n" +"\n" +" @org.hibernate.annotations.Type(type=\"eg.types.ColorUserType\")\n" +" @NotNull @Column(updatable=false)\n" +" public ColorType getColor() { return color; }\n" +" public void setColor(ColorType color) { this.color = color; }\n" +" private ColorType color;\n" +"\n" +" @NotNull @Column(updatable=false)\n" +" public String getSex() { return sex; }\n" +" public void setSex(String sex) { this.sex = sex; }\n" +" private String sex;\n" +"\n" +" @NotNull @Column(updatable=false)\n" +" public Integer getLitterId() { return litterId; }\n" +" public void setLitterId(Integer litterId) { this.litterId = litterId; }\n" +" private Integer litterId;\n" +"\n" +" @ManyToOne @JoinColumn(name=\"mother_id\", updatable=false)\n" +" public Cat getMother() { return mother; }\n" +" public void setMother(Cat mother) { this.mother = mother; }\n" +" private Cat mother;\n" +"\n" +" @OneToMany(mappedBy=\"mother\") @OrderBy(\"litterId\")\n" +" public Set<Cat> getKittens() { return kittens; }\n" +" public void setKittens(Set<Cat> kittens) { this.kittens = " +"kittens; }\n" +" private Set<Cat> kittens = new HashSet<Cat>();\n" +"}\n" +"\n" +"@Entity @DiscriminatorValue(\"D\")\n" +"public class DomesticCat extends Cat {\n" +"\n" +" public String getName() { return name; }\n" +" public void setName(String name) { this.name = name }\n" +" private String name;\n" +"}\n" +"\n" +"@Entity\n" +"public class Dog { ... }" +msgstr "" + +#. Tag: para +#: basic_mapping.xml:73 +#, fuzzy, no-c-format +msgid "" +"The legacy hbm.xml approach uses an XML schema designed to be readable and " +"hand-editable. The mapping language is Java-centric, meaning that mappings " +"are constructed around persistent class declarations and not table " +"declarations." msgstr "" "Los mapeos objeto/relacional usualmente se definen en un documento XML. El " "documento de mapeo está diseñado para que se pueda leer y editar a mano. El " @@ -48,6 +169,7 @@ msgstr "" "de declaraciones de tablas." #. Tag: para +#: basic_mapping.xml:78 #, no-c-format msgid "" "Please note that even though many Hibernate users choose to write the XML by " @@ -59,18 +181,92 @@ msgstr "" "documento de mapeo, incluyendo XDoclet, Middlegen y AndroMDA. " #. Tag: para +#: basic_mapping.xml:82 #, no-c-format msgid "Here is an example mapping:" msgstr "Este es un ejemplo de mapeo:" -#. Tag: para +#. Tag: programlisting +#: basic_mapping.xml:84 #, no-c-format msgid "" -"We will now discuss the content of the mapping document. We will only " -"describe, however, the document elements and attributes that are used by " -"Hibernate at runtime. The mapping document also contains some extra optional " -"attributes and elements that affect the database schemas exported by the " -"schema export tool (for example, the not-null attribute)." +"<?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 name=\"Cat\"\n" +" table=\"cats\"\n" +" discriminator-value=\"C\">\n" +"\n" +" <id name=\"id\">\n" +" <generator class=\"native\"/>\n" +" </id>\n" +"\n" +" <discriminator column=\"subclass\"\n" +" type=\"character\"/>\n" +"\n" +" <property name=\"weight\"/>\n" +"\n" +" <property name=\"birthdate\"\n" +" type=\"date\"\n" +" not-null=\"true\"\n" +" update=\"false\"/>\n" +"\n" +" <property name=\"color\"\n" +" type=\"eg.types.ColorUserType\"\n" +" not-null=\"true\"\n" +" update=\"false\"/>\n" +"\n" +" <property name=\"sex\"\n" +" not-null=\"true\"\n" +" update=\"false\"/>\n" +"\n" +" <property name=\"litterId\"\n" +" column=\"litterId\"\n" +" update=\"false\"/>\n" +"\n" +" <many-to-one name=\"mother\"\n" +" column=\"mother_id\"\n" +" update=\"false\"/>\n" +"\n" +" <set name=\"kittens\"\n" +" inverse=\"true\"\n" +" order-by=\"litter_id\">\n" +" <key column=\"mother_id\"/>\n" +" <one-to-many class=\"Cat\"/>\n" +" </set>\n" +"\n" +" <subclass name=\"DomesticCat\"\n" +" discriminator-value=\"D\">\n" +"\n" +" <property name=\"name\"\n" +" type=\"string\"/>\n" +"\n" +" </subclass>\n" +"\n" +" </class>\n" +"\n" +" <class name=\"Dog\">\n" +" <!-- mapping for Dog could go here -->\n" +" </class>\n" +"\n" +"</hibernate-mapping>" +msgstr "" + +#. Tag: para +#: basic_mapping.xml:86 +#, fuzzy, no-c-format +msgid "" +"We will now discuss the concepts of the mapping documents (both annotations " +"and XML). We will only describe, however, the document elements and " +"attributes that are used by Hibernate at runtime. The mapping document also " +"contains some extra optional attributes and elements that affect the " +"database schemas exported by the schema export tool (for example, the " +" not-null attribute)." msgstr "" "Ahora vamos a discutir el contenido del documento de mapeo. Sólamente " "describiremos los elementos y atributos del documento que Hibernate utiliza " @@ -80,340 +276,140 @@ msgstr "" "ejemplo, el atributo not-null)." #. Tag: title -#, no-c-format -msgid "Doctype" -msgstr "Doctype" - -#. Tag: para -#, no-c-format -msgid "" -"All XML mappings should declare the doctype shown. The actual DTD can be " -"found at the URL above, in the directory hibernate-x.x.x/src/org/" -"hibernate , or in hibernate3.jar. Hibernate " -"will always look for the DTD in its classpath first. If you experience " -"lookups of the DTD using an Internet connection, check the DTD declaration " -"against the contents of your classpath." -msgstr "" -"Todos los mapeos XML deben declarar el tipo de documento que se muestra. El " -"DTD en sí se puede encontrar en la URL mencionada anteriormente, en el " -"directorio hibernate-x.x.x/src/org/hibernate , o en " -"hibernate3.jar. Hibernate siempre buscará el DTD primero " -"en la ruta de clase. Si el DTD realiza búsquedas utilizando una conexión de " -"Internet, verifique que su declaración DTD frente al contenido de su ruta de " -"clase." - -#. Tag: title -#, no-c-format -msgid "EntityResolver" +#: basic_mapping.xml:94 +#, fuzzy, no-c-format +msgid "Entity" msgstr "EntityResolver" #. Tag: para +#: basic_mapping.xml:96 #, no-c-format msgid "" -"Hibernate will first attempt to resolve DTDs in its classpath. It does this " -"is by registering a custom org.xml.sax.EntityResolver " -"implementation with the SAXReader it uses to read in the xml files. This " -"custom EntityResolver recognizes two different systemId " -"namespaces:" -msgstr "" -"Hibernate tratará primero de resolver los DTDs en su ruta de clase. La " -"manera en que lo hace es registrando una implementación org.xml.sax." -"EntityResolver personalizada con el SAXReader que utiliza para " -"leer los archivos xml. Este EntityResolver personalizado " -"reconoce dos diferentes espacios de nombre del identificador del sistema." - -#. Tag: para -#, no-c-format -msgid "" -"a hibernate namespace is recognized whenever the resolver " -"encounters a systemId starting with http://hibernate.sourceforge." -"net/. The resolver attempts to resolve these entities via the " -"classloader which loaded the Hibernate classes." -msgstr "" -"un hibernate namespace se reconoce cuando el resolvedor " -"se encuentra con un identificador de sistema que inicia por http://" -"hibernate.sourceforge.net/. El resolvedor intenta resolver estas " -"entidades por medio del cargador de clases, el cual cargó las clases de " +"An entity is a regular Java object (aka POJO) which will be persisted by " "Hibernate." +msgstr "" #. Tag: para +#: basic_mapping.xml:99 #, no-c-format msgid "" -"a user namespace is recognized whenever the resolver " -"encounters a systemId using a classpath:// URL protocol. " -"The resolver will attempt to resolve these entities via (1) the current " -"thread context classloader and (2) the classloader which loaded the " -"Hibernate classes." +"To mark an object as an entity in annotations, use the @Entity annotation." msgstr "" -"un user namespace se reconoce cuando el resolvedor se " -"encuentra con un identificador del sistema utilizando un protocolo URL " -"classpath://. El resolvedor intentará resolver estas " -"entidades por medio de (1) el cargador de clase del contexto del hilo actual " -"y (2) el cargador de clase, el cual cargó las clases de Hibernate." -#. Tag: para -#, no-c-format -msgid "The following is an example of utilizing user namespacing:" -msgstr "Este es un ejemplo de la utilización de los espacios de nombre del usuario: " - -#. Tag: para +#. Tag: programlisting +#: basic_mapping.xml:102 #, no-c-format msgid "" -"Where types.xml is a resource in the your." -"domain package and contains a custom typedef." +"@Entity\n" +"public class Flight implements Serializable {\n" +" Long id;\n" +"\n" +" @Id\n" +" public Long getId() { return id; }\n" +"\n" +" public void setId(Long id) { this.id = id; }\n" +"}" msgstr "" -"En donde types.xml es un recurso en el paquete " -"your.domain y comprende un typedef personalizado." - -#. Tag: title -#, no-c-format -msgid "Hibernate-mapping" -msgstr "Mapeo de Hibernate " #. Tag: para +#: basic_mapping.xml:104 #, no-c-format msgid "" -"This element has several optional attributes. The schema " -"and catalog attributes specify that tables referred to in " -"this mapping belong to the named schema and/or catalog. If they are " -"specified, tablenames will be qualified by the given schema and catalog " -"names. If they are missing, tablenames will be unqualified. The " -"default-cascade attribute specifies what cascade style " -"should be assumed for properties and collections that do not specify a " -"cascade attribute. By default, the auto-import attribute allows you to use unqualified class names in the query " -"language." +"That's pretty much it, the rest is optional. There are however any options " +"to tweak your entity mapping, let's explore them." msgstr "" -"Este elemento tiene varios atributos opcionales. Los atributos " -"schema y catalog especifican que las " -"tablas a las que se refiere en este mapeo pertenecen al esquema y/o catálogo " -"mencionado(s). De especificarse, los nombres de tablas serán calificados por " -"el nombre del esquema y del catálogo dados. De omitirse, los nombres de las " -"tablas no serán calificados. El atributo default-cascade " -"especifica qué estilo de cascada se debe asumir para las propiedades y " -"colecciones que no especifican un atributo cascade. Por " -"defecto, el atributo auto-import nos permite utilizar " -"nombres de clase sin calificar en el lenguaje de consulta." - -#. Tag: para -#, no-c-format -msgid "schema (optional): the name of a database schema." -msgstr "" -"schema (opcional): El nombre de un esquema de la base de " -"datos. " - -#. Tag: para -#, no-c-format -msgid "catalog (optional): the name of a database catalog." -msgstr "" -"catalog (opcional): El nombre de un catálogo de la base " -"de datos. " #. Tag: para +#: basic_mapping.xml:107 #, no-c-format msgid "" -"default-cascade (optional - defaults to none): a default cascade style." +"@Table lets you define the table the entity will be " +"persisted into. If undefined, the table name is the unqualified class name " +"of the entity. You can also optionally define the catalog, the schema as " +"well as unique constraints on the table." msgstr "" -"default-cascade (opcional - por defecto es none): Un estilo de cascada por defecto. " -#. Tag: para +#. Tag: programlisting +#: basic_mapping.xml:112 #, no-c-format msgid "" -"default-access (optional - defaults to property): the strategy Hibernate should use for accessing all properties. " -"It can be a custom implementation of PropertyAccessor." +"@Entity\n" +"@Table(name=\"TBL_FLIGHT\", \n" +" schema=\"AIR_COMMAND\", \n" +" uniqueConstraints=\n" +" @UniqueConstraint(\n" +" name=\"flight_number\", \n" +" columnNames={\"comp_prefix\", \"flight_number\"} ) )\n" +"public class Flight implements Serializable {\n" +" @Column(name=\"comp_prefix\")\n" +" public String getCompagnyPrefix() { return companyPrefix; }\n" +"\n" +" @Column(name=\"flight_number\")\n" +" public String getNumber() { return number; }\n" +"}" msgstr "" -"default-access (opcional - por defecto es " -"property): La estrategia que Hibernate debe utilizar para " -"acceder a todas las propiedades. Puede ser una implementación personalizada " -"de PropertyAccessor." #. Tag: para +#: basic_mapping.xml:114 #, no-c-format msgid "" -"default-lazy (optional - defaults to true): the default value for unspecified lazy " -"attributes of class and collection mappings." +"The constraint name is optional (generated if left undefined). The column " +"names composing the constraint correspond to the column names as defined " +"before the Hibernate NamingStrategy is applied." msgstr "" -"default-lazy (opcional - por defecto es true): El valor por defecto para los atributos lazy " -"no especificados de mapeos de clase y de colección." #. Tag: para +#: basic_mapping.xml:119 #, no-c-format msgid "" -"auto-import (optional - defaults to true): specifies whether we can use unqualified class names of classes " -"in this mapping in the query language." +"@Entity.name lets you define the shortcut name of the " +"entity you can used in JP-QL and HQL queries. It defaults to the unqualified " +"class name of the class." msgstr "" -"auto-import (opcional - por defecto es true): Especifica si podemos utilizar nombres de clases no calificados " -"de clases en este mapeo en el lenguaje de consulta." #. Tag: para +#: basic_mapping.xml:123 #, no-c-format msgid "" -"package (optional): specifies a package prefix to use for " -"unqualified class names in the mapping document." +"Hibernate goes beyond the JPA specification and provide additional " +"configurations. Some of them are hosted on @org.hibernate." +"annotations.Entity:" msgstr "" -"package (opcional): Especifica un prefijo de paquete que " -"se debe utilizar para los nombres de clase no calificados en el documento de " -"mapeo." #. Tag: para -#, no-c-format +#: basic_mapping.xml:129 +#, fuzzy, no-c-format msgid "" -"If you have two persistent classes with the same unqualified name, you " -"should set auto-import=\"false\". An exception will " -"result if you attempt to assign two classes to the same \"imported\" name." +"dynamicInsert / dynamicUpdate " +"(defaults to false): specifies that INSERT / " +"UPDATE SQL should be generated at runtime and contain " +"only the columns whose values are not null. The dynamic-update and dynamic-insert settings are not inherited by " +"subclasses. Although these settings can increase performance in some cases, " +"they can actually decrease performance in others." msgstr "" -"Si tiene dos clases persistentes con el mismo nombre (sin calificar), debe " -"establecer auto-import=\"false\". Se presentará una " -"excepción si usted intenta asignar dos clases al mismo nombre \"importado\"." +"Los valores de dynamic-update y dynamic-insert no son heredados por las subclases y por lo tanto deben " +"especificarse en los elementos <subclass> o " +"<joined-subclass>. Aunque en algunos casos, estos " +"ajustes pueden incrementar el rendimiento, de hecho en otros casos, podrían " +"disminuirlo." #. Tag: para -#, no-c-format +#: basic_mapping.xml:140 +#, fuzzy, no-c-format msgid "" -"The hibernate-mapping element allows you to nest several " -"persistent <class> mappings, as shown above. It is, " -"however, good practice (and expected by some tools) to map only a single " -"persistent class, or a single class hierarchy, in one mapping file and name " -"it after the persistent superclass. For example, Cat.hbm.xml, Dog.hbm.xml, or if using inheritance, " -"Animal.hbm.xml." -msgstr "" -"El elemento hibernate-mapping le permite anidar varios " -"mapeos <class> persistentes, como se mostró " -"anteriormente. Sin embargo, es una buena práctica (y algunas herramientas " -"esperan) que mapee sólamente una clase persistente, o a una sóla jerarquía " -"de clases, en un archivo de mapeo y nombrarlo como la superclase " -"persistente. Por ejemplo, Cat.hbm.xml, Dog.hbm." -"xml, o si utiliza herencia, Animal.hbm.xml." - -#. Tag: title -#, no-c-format -msgid "Class" -msgstr "Clase" - -#. Tag: para -#, no-c-format -msgid "" -"You can declare a persistent class using the class " -"element. For example:" -msgstr "" -"Puede declarar una clase persistente utilizando el elemento class. Por ejemplo:" - -#. Tag: para -#, no-c-format -msgid "" -"name (optional): the fully qualified Java class name of " -"the persistent class or interface. If this attribute is missing, it is " -"assumed that the mapping is for a non-POJO entity." -msgstr "" -"name (opcional): El nombre completamente calificado de la " -"clase Java persistente (o interfaz). Si se omite este atributo, se asume que " -"el mapeo es para una entidad que no es POJO." - -#. Tag: para -#, no-c-format -msgid "" -"table (optional - defaults to the unqualified class " -"name): the name of its database table." -msgstr "" -"table (opcional - por defecto es el nombre de la clase no " -"calificado): El nombre de su tabla en la base de datos." - -#. Tag: para -#, no-c-format -msgid "" -"discriminator-value (optional - defaults to the class " -"name): a value that distinguishes individual subclasses that is used for " -"polymorphic behavior. Acceptable values include null and " -"not null." -msgstr "" -"discriminator-value (opcional - predeterminado al nombre " -"de la clase): Un valor que distingue subclases individuales, usado para el " -"comportamiento polimórfico. Los valores aceptables incluyen null y not null. " - -#. Tag: para -#, no-c-format -msgid "" -"mutable (optional - defaults to true): " -"specifies that instances of the class are (not) mutable." -msgstr "" -"mutable (opcional, por defecto es true): Especifica que las instancias de la clase (no) son mutables. " - -#. Tag: para -#, no-c-format -msgid "" -"schema (optional): overrides the schema name specified by " -"the root <hibernate-mapping> element." -msgstr "" -"schema (opcional): Sobrescribe el nombre del esquema " -"especificado por el elemento raíz <hibernate-mapping>. " - -#. Tag: para -#, no-c-format -msgid "" -"catalog (optional): overrides the catalog name specified " -"by the root <hibernate-mapping> element." -msgstr "" -"catalog (opcional): Sobrescribe el nombre del catálogo " -"especificado por el elemento raíz <hibernate-mapping>. " - -#. Tag: para -#, no-c-format -msgid "" -"proxy (optional): specifies an interface to use for lazy " -"initializing proxies. You can specify the name of the class itself." -msgstr "" -"proxy (opcional): Especifica una interfaz a utilizar para " -"los proxies de inicialización perezosa. Puede especificar el nombre mismo de " -"la clase. " - -#. Tag: para -#, no-c-format -msgid "" -"dynamic-update (optional - defaults to false): specifies that UPDATE SQL should be generated " -"at runtime and can contain only those columns whose values have changed." -msgstr "" -"dynamic-update (opcional, por defecto es false): Especifica que el SQL UPDATE debe ser generado " -"en tiempo de ejecución y puede contener sólamente aquellas columnas cuyos " -"valores hayan cambiado. " - -#. Tag: para -#, no-c-format -msgid "" -"dynamic-insert (optional - defaults to false): specifies that INSERT SQL should be generated " -"at runtime and contain only the columns whose values are not null." -msgstr "" -"dynamic-insert (opcional, por defecto es false): Especifica que el SQL INSERT debe ser generado " -"en tiempo de ejecución y debe contener sólamente aquellas columnas cuyos " -"valores no son nulos. " - -#. Tag: para -#, no-c-format -msgid "" -"select-before-update (optional - defaults to " -"false): specifies that Hibernate should never perform an SQL UPDATE unless it is certain that " -"an object is actually modified. Only when a transient object has been " -"associated with a new session using update(), will " -"Hibernate perform an extra SQL SELECT to determine if an " -"UPDATE is actually required." +"selectBeforeUpdate (defaults to false): specifies that " +"Hibernate should never perform an SQL UPDATE unless it is certain that an object is actually modified. Only when " +"a transient object has been associated with a new session using " +"update(), will Hibernate perform an extra SQL " +"SELECT to determine if an UPDATE is " +"actually required. Use of select-before-update will " +"usually decrease performance. It is useful to prevent a database update " +"trigger being called unnecessarily if you reattach a graph of detached " +"instances to a Session." msgstr "" "select-before-update (opcional, por defecto es " "false): Especifica que Hibernate nunca." #. Tag: para -#, no-c-format +#: basic_mapping.xml:154 +#, fuzzy, no-c-format msgid "" -"polymorphism (optional - defaults to implicit): determines whether implicit or explicit query polymorphism is " -"used." -msgstr "" -"polymorphism (opcional, por defecto es implicit): Determina si se utiliza polimorfismo de consulta implícito o " -"explícito. " - -#. Tag: para -#, no-c-format -msgid "" -"where (optional): specifies an arbitrary SQL " -"WHERE condition to be used when retrieving objects of " -"this class." -msgstr "" -"where (opcional) especifica una condición SQL " -"WHERE arbitraria para utilizarla en la recuperación de " -"objetos de esta clase. " - -#. Tag: para -#, no-c-format -msgid "" -"persister (optional): specifies a custom " -"ClassPersister." -msgstr "" -"persister (opcional): Especifica un " -"ClassPersister personalizado. " - -#. Tag: para -#, no-c-format -msgid "" -"batch-size (optional - defaults to 1): " -"specifies a \"batch size\" for fetching instances of this class by " -"identifier." -msgstr "" -"batch-size (opcional, por defecto es 1) especifica un \"tamaño de lote\" para buscar instancias de esta " -"clase por identificador." - -#. Tag: para -#, no-c-format -msgid "" -"optimistic-lock (optional - defaults to version): determines the optimistic locking strategy." -msgstr "" -"optimistic-lock (opcional, por defecto es " -"version): Determina la estrategia optimista de bloqueo. " - -#. Tag: para -#, no-c-format -msgid "" -"lazy (optional): lazy fetching can be disabled by setting " -"lazy=\"false\"." -msgstr "" -"lazy (opcional): La recuperación perezosa se puede " -"deshabilitar por completo al establecer lazy=\"false\"." - -#. Tag: para -#, no-c-format -msgid "" -"entity-name (optional - defaults to the class name): " -"Hibernate3 allows a class to be mapped multiple times, potentially to " -"different tables. It also allows entity mappings that are represented by " -"Maps or XML at the Java level. In these cases, you should provide an " -"explicit arbitrary name for the entity. See and for more information." -msgstr "" -"entity-name (opcional - por defecto es el nombre de la " -"clase): Hibernate3 permite mapear una clase varias veces, potencialmente a " -"tablas diferentes. También permite que los mapeos de entidad sean " -"representados por Maps o XML al nivel de Java. En estos casos, debe " -"proporcionar un nombre explícito arbitrario para la entidad. Para obtener " -"más información consulte y ." - -#. Tag: para -#, no-c-format -msgid "" -"check (optional): an SQL expression used to generate a " -"multi-row check constraint for automatic schema " -"generation." -msgstr "" -"check (opcional): Una expresión SQL utilizada para " -"generar una restricción check multi-filas para la " -"generación automática de esquemas." - -#. Tag: para -#, no-c-format -msgid "" -"rowid (optional): Hibernate can use ROWIDs on databases. " -"On Oracle, for example, Hibernate can use the rowid extra " -"column for fast updates once this option has been set to rowid. A ROWID is an implementation detail and represents the physical " -"location of a stored tuple." -msgstr "" -"rowid (opcional): Hibernate puede utilizar los llamados " -"ROWIDs en las bases de datos. Por ejemplo, en Oracle, Hibernate puede " -"utilizar la columna extra rowid para actualizaciones " -"rápidas si usted establece esta opción como rowid. Un " -"ROWID es un detalle de implementación y representa la posición física de la " -"tupla almacenada." - -#. Tag: para -#, no-c-format -msgid "" -"subselect (optional): maps an immutable and read-only " -"entity to a database subselect. This is useful if you want to have a view " -"instead of a base table. See below for more information." -msgstr "" -"subselect (opcional): Mapea una entidad inmutable y de " -"sólo lectura a una subselección de base de datos. Es útil si quiere tener " -"una vista en vez de una tabla base. Vea a continuación para obtener más " -"información." - -#. Tag: para -#, no-c-format -msgid "" -"abstract (optional): is used to mark abstract " -"superclasses in <union-subclass> hierarchies." -msgstr "" -"abstract (opcional): Utilizado para marcar superclases " -"abstractas en las jerarquías <union-subclass>." - -#. Tag: para -#, no-c-format -msgid "" -"It is acceptable for the named persistent class to be an interface. You can " -"declare implementing classes of that interface using the <" -"subclass> element. You can persist any static inner class. Specify the class name using the standard form i.e. " -"e.g.Foo$Bar." -msgstr "" -"Es perfectamente aceptable que la clase persistente mencionada sea una " -"interfaz. Puede declarar clases que implementan esa interfaz utilizando el " -"elemento <subclass>. Puede persistir cualquier " -"clase interna estática. Debe especificar el nombre de " -"la clase utilizando la forma estándar, por ejemplo, e.g.Foo$Bar." - -#. Tag: para -#, no-c-format -msgid "" -"Immutable classes, mutable=\"false\", cannot be updated " -"or deleted by the application. This allows Hibernate to make some minor " -"performance optimizations." -msgstr "" -"Las clases inmutables, mutable=\"false\", no pueden ser " -"actualizadas o borradas por la aplicación. Esto le permite a Hibernate " -"realizar ciertas optimizaciones menores de rendimiento. " - -#. Tag: para -#, no-c-format -msgid "" -"The optional proxy attribute enables lazy initialization " -"of persistent instances of the class. Hibernate will initially return CGLIB " -"proxies that implement the named interface. The persistent object will load " -"when a method of the proxy is invoked. See \"Initializing collections and " -"proxies\" below." -msgstr "" -"El atributo opcional proxy activa la inicialización " -"perezosa de instancias persistentes de la clase. Hibernate inicialmente " -"retornará proxies CGLIB que implementan la interfaz mencionada. El objeto " -"persistente real será cargado cuando se invoque un método del proxy. Vea " -"\"Inicialización de colecciones y proxies\" a continuación." - -#. Tag: para -#, no-c-format -msgid "" -"Implicit polymorphism means that instances of the class " -"will be returned by a query that names any superclass or implemented " +"polymorphisms (defaults to IMPLICIT): " +"determines whether implicit or explicit query polymorphisms is used. " +"Implicit polymorphisms means that instances of the " +"class will be returned by a query that names any superclass or implemented " "interface or class, and that instances of any subclass of the class will be " "returned by a query that names the class itself. Explicit polymorphism means that class instances will be returned only by " +"emphasis> polymorphisms means that class instances will be returned only by " "queries that explicitly name that class. Queries that name the class will " -"return only instances of subclasses mapped inside this <class>" -" declaration as a <subclass> or " -"<joined-subclass>. For most purposes, the default " -"polymorphism=\"implicit\" is appropriate. Explicit " -"polymorphism is useful when two different classes are mapped to the same " +"return only instances of subclasses mapped. For most purposes, the default " +"polymorphisms=IMPLICIT is appropriate. Explicit " +"polymorphisms is useful when two different classes are mapped to the same " "table This allows a \"lightweight\" class that contains a subset of the " "table columns." msgstr "" @@ -626,9 +455,11 @@ msgstr "" "de la tabla." #. Tag: para -#, no-c-format +#: basic_mapping.xml:171 +#, fuzzy, no-c-format msgid "" -"The persister attribute lets you customize the " +"persister: specifies a custom ClassPersister. The persister attribute lets you customize the " "persistence strategy used for the class. You can, for example, specify your " "own subclass of org.hibernate.persister.EntityPersister, " "or you can even provide a completely new implementation of the interface " @@ -648,54 +479,32 @@ msgstr "" "literal>) consulte org.hibernate.test.CustomPersister. " #. Tag: para -#, no-c-format +#: basic_mapping.xml:185 +#, fuzzy, no-c-format msgid "" -"The dynamic-update and dynamic-insert " -"settings are not inherited by subclasses, so they can also be specified on " -"the <subclass> or <joined-subclass> elements. Although these settings can increase performance in some " -"cases, they can actually decrease performance in others." -msgstr "" -"Los valores de dynamic-update y dynamic-insert no son heredados por las subclases y por lo tanto deben " -"especificarse en los elementos <subclass> o " -"<joined-subclass>. Aunque en algunos casos, estos " -"ajustes pueden incrementar el rendimiento, de hecho en otros casos, podrían " -"disminuirlo." - -#. Tag: para -#, no-c-format -msgid "" -"Use of select-before-update will usually decrease " -"performance. It is useful to prevent a database update trigger being called " -"unnecessarily if you reattach a graph of detached instances to a " -"Session." -msgstr "" -"El uso de select-before-update disminuirá el rendimiento. " -"Es muy útil prevenir que se llame innecesariamente a un disparador de " -"actualización de la base de datos al volver a unir un gráfico de instancias " -"separadas a una Session." - -#. Tag: para -#, no-c-format -msgid "" -"If you enable dynamic-update, you will have a choice of " -"optimistic locking strategies:" +"optimisticLock (defaults to VERSION): " +"determines the optimistic locking strategy. If you enable " +"dynamicUpdate, you will have a choice of optimistic " +"locking strategies:" msgstr "" "Si activa dynamic-update, usted tendrá la opción de " "estrategias de bloqueo optimistas:" #. Tag: para +#: basic_mapping.xml:192 #, no-c-format msgid "version: check the version/timestamp columns" -msgstr "version: chequea las columnas de versión/sello de fecha" +msgstr "" +"version: chequea las columnas de versión/sello de fecha" #. Tag: para +#: basic_mapping.xml:197 #, no-c-format msgid "all: check all columns" msgstr "all: chequea todas las columnas" #. Tag: para +#: basic_mapping.xml:201 #, no-c-format msgid "" "dirty: check the changed columns, allowing some " @@ -705,11 +514,13 @@ msgstr "" "algunas actualizaciones concurrentes" #. Tag: para +#: basic_mapping.xml:206 #, no-c-format msgid "none: do not use optimistic locking" msgstr "none: no utilice bloqueo optimista" #. Tag: para +#: basic_mapping.xml:211 #, no-c-format msgid "" "It is strongly recommended that you use version/" @@ -724,14 +535,88 @@ msgstr "" "merge())." #. Tag: para +#: basic_mapping.xml:220 #, no-c-format msgid "" +"Be sure to import @javax.persistence.Entity to mark a " +"class as an entity. It's a common mistake to import @org." +"hibernate.annotations.Entity by accident." +msgstr "" + +#. Tag: para +#: basic_mapping.xml:227 +#, fuzzy, no-c-format +msgid "" +"Some entities are not mutable. They cannot be updated or deleted by the " +"application. This allows Hibernate to make some minor performance " +"optimizations.. Use the @Immutable annotation." +msgstr "" +"Las clases inmutables, mutable=\"false\", no pueden ser " +"actualizadas o borradas por la aplicación. Esto le permite a Hibernate " +"realizar ciertas optimizaciones menores de rendimiento. " + +#. Tag: para +#: basic_mapping.xml:232 +#, fuzzy, no-c-format +msgid "" +"You can also alter how Hibernate deals with lazy initialization for this " +"class. On @Proxy, use lazy=false " +"to disable lazy fetching (not recommended). You can also specify an " +"interface to use for lazy initializing proxies (defaults to the class " +"itself): use proxyClass on @Proxy. " +"Hibernate will initially return proxies (Javassist or CGLIB) that implement " +"the named interface. The persistent object will load when a method of the " +"proxy is invoked. See \"Initializing collections and proxies\" below." +msgstr "" +"El atributo opcional proxy activa la inicialización " +"perezosa de instancias persistentes de la clase. Hibernate inicialmente " +"retornará proxies CGLIB que implementan la interfaz mencionada. El objeto " +"persistente real será cargado cuando se invoque un método del proxy. Vea " +"\"Inicialización de colecciones y proxies\" a continuación." + +#. Tag: para +#: basic_mapping.xml:243 +#, no-c-format +msgid "" +"@BatchSize specifies a \"batch size\" for fetching " +"instances of this class by identifier. Not yet loaded instances are loaded " +"batch-size at a time (default 1)." +msgstr "" + +#. Tag: para +#: basic_mapping.xml:247 +#, fuzzy, no-c-format +msgid "" +"You can specific an arbitrary SQL WHERE condition to be used when retrieving " +"objects of this class. Use @Where for that." +msgstr "" +"where (opcional) especifica una condición SQL " +"WHERE arbitraria para utilizarla en la recuperación de " +"objetos de esta clase. " + +#. Tag: para +#: basic_mapping.xml:251 +#, fuzzy, no-c-format +msgid "" +"In the same vein, @Check lets you define an SQL " +"expression used to generate a multi-row check " +"constraint for automatic schema generation." +msgstr "" +"check (opcional): Una expresión SQL utilizada para " +"generar una restricción check multi-filas para la " +"generación automática de esquemas." + +#. Tag: para +#: basic_mapping.xml:255 +#, fuzzy, no-c-format +msgid "" "There is no difference between a view and a base table for a Hibernate " "mapping. This is transparent at the database level, although some DBMS do " "not support views properly, especially with updates. Sometimes you want to " "use a view, but you cannot create one in the database (i.e. with a legacy " "schema). In this case, you can map an immutable and read-only entity to a " -"given SQL subselect expression:" +"given SQL subselect expression using @org.hibernate.annotations." +"Subselect:" msgstr "" "Para un mapeo de Hibernate, no hay diferencia entre una vista y una tabla " "base. Esto es transparente a nivel de base de datos, aunque algunos DBMS no " @@ -741,7 +626,25 @@ msgstr "" "mapear una entidad inmutable de sólo lectura a una expresión de subconsulta " "SQL dada." +#. Tag: programlisting +#: basic_mapping.xml:263 +#, no-c-format +msgid "" +"@Entity\n" +"@Subselect(\"select item.name, max(bid.amount), count(*) \"\n" +" + \"from item \"\n" +" + \"join bid on bid.item_id = item.id \"\n" +" + \"group by item.name\")\n" +"@Synchronize( {\"item\", \"bid\"} ) //tables impacted\n" +"public class Summary {\n" +" @Id\n" +" public String getId() { return id; }\n" +" ...\n" +"}" +msgstr "" + #. Tag: para +#: basic_mapping.xml:265 #, no-c-format msgid "" "Declare the tables to synchronize this entity with, ensuring that auto-flush " @@ -755,19 +658,372 @@ msgstr "" "<subselect> se encuentra disponible tanto como un " "atributo y como un elemento anidado de mapeo." -#. Tag: title +#. Tag: para +#: basic_mapping.xml:270 +#, fuzzy, no-c-format +msgid "" +"We will now explore the same options using the hbm.xml structure. You can " +"declare a persistent class using the class element. For " +"example:" +msgstr "" +"Puede declarar una clase persistente utilizando el elemento class. Por ejemplo:" + +#. Tag: programlisting +#: basic_mapping.xml:319 #, no-c-format -msgid "id" -msgstr "id" +msgid "" +"<class\n" +" name=\"ClassName\"\n" +" table=\"tableName\"\n" +" discriminator-value=\"discriminator_value\"\n" +" mutable=\"true|false\"\n" +" schema=\"owner\"\n" +" catalog=\"catalog\"\n" +" proxy=\"ProxyInterface\"\n" +" dynamic-update=\"true|false\"\n" +" dynamic-insert=\"true|false\"\n" +" select-before-update=\"true|false\"\n" +" polymorphism=\"implicit|explicit\"\n" +" where=\"arbitrary sql where condition\"\n" +" persister=\"PersisterClass\"\n" +" batch-size=\"N\"\n" +" optimistic-lock=\"none|version|dirty|all\"\n" +" lazy=\"true|false\"\n" +" entity-name=\"EntityName\"\n" +" check=\"arbitrary sql check condition\"\n" +" rowid=\"rowid\"\n" +" subselect=\"SQL expression\"\n" +" abstract=\"true|false\"\n" +" node=\"element-name\"\n" +"/>" +msgstr "" #. Tag: para +#: basic_mapping.xml:323 #, no-c-format msgid "" +"name (optional): the fully qualified Java class name of " +"the persistent class or interface. If this attribute is missing, it is " +"assumed that the mapping is for a non-POJO entity." +msgstr "" +"name (opcional): El nombre completamente calificado de la " +"clase Java persistente (o interfaz). Si se omite este atributo, se asume que " +"el mapeo es para una entidad que no es POJO." + +#. Tag: para +#: basic_mapping.xml:330 +#, no-c-format +msgid "" +"table (optional - defaults to the unqualified class " +"name): the name of its database table." +msgstr "" +"table (opcional - por defecto es el nombre de la clase no " +"calificado): El nombre de su tabla en la base de datos." + +#. Tag: para +#: basic_mapping.xml:335 +#, no-c-format +msgid "" +"discriminator-value (optional - defaults to the class " +"name): a value that distinguishes individual subclasses that is used for " +"polymorphic behavior. Acceptable values include null and " +"not null." +msgstr "" +"discriminator-value (opcional - predeterminado al nombre " +"de la clase): Un valor que distingue subclases individuales, usado para el " +"comportamiento polimórfico. Los valores aceptables incluyen null y not null. " + +#. Tag: para +#: basic_mapping.xml:343 +#, no-c-format +msgid "" +"mutable (optional - defaults to true): " +"specifies that instances of the class are (not) mutable." +msgstr "" +"mutable (opcional, por defecto es true): Especifica que las instancias de la clase (no) son mutables. " + +#. Tag: para +#: basic_mapping.xml:349 basic_mapping.xml:2912 +#, no-c-format +msgid "" +"schema (optional): overrides the schema name specified by " +"the root <hibernate-mapping> element." +msgstr "" +"schema (opcional): Sobrescribe el nombre del esquema " +"especificado por el elemento raíz <hibernate-mapping>. " + +#. Tag: para +#: basic_mapping.xml:355 basic_mapping.xml:2918 +#, no-c-format +msgid "" +"catalog (optional): overrides the catalog name specified " +"by the root <hibernate-mapping> element." +msgstr "" +"catalog (opcional): Sobrescribe el nombre del catálogo " +"especificado por el elemento raíz <hibernate-mapping>. " + +#. Tag: para +#: basic_mapping.xml:361 +#, no-c-format +msgid "" +"proxy (optional): specifies an interface to use for lazy " +"initializing proxies. You can specify the name of the class itself." +msgstr "" +"proxy (opcional): Especifica una interfaz a utilizar para " +"los proxies de inicialización perezosa. Puede especificar el nombre mismo de " +"la clase. " + +#. Tag: para +#: basic_mapping.xml:367 +#, no-c-format +msgid "" +"dynamic-update (optional - defaults to false): specifies that UPDATE SQL should be generated " +"at runtime and can contain only those columns whose values have changed." +msgstr "" +"dynamic-update (opcional, por defecto es false): Especifica que el SQL UPDATE debe ser generado " +"en tiempo de ejecución y puede contener sólamente aquellas columnas cuyos " +"valores hayan cambiado. " + +#. Tag: para +#: basic_mapping.xml:374 +#, no-c-format +msgid "" +"dynamic-insert (optional - defaults to false): specifies that INSERT SQL should be generated " +"at runtime and contain only the columns whose values are not null." +msgstr "" +"dynamic-insert (opcional, por defecto es false): Especifica que el SQL INSERT debe ser generado " +"en tiempo de ejecución y debe contener sólamente aquellas columnas cuyos " +"valores no son nulos. " + +#. Tag: para +#: basic_mapping.xml:381 +#, no-c-format +msgid "" +"select-before-update (optional - defaults to " +"false): specifies that Hibernate should never perform an SQL UPDATE unless it is certain that " +"an object is actually modified. Only when a transient object has been " +"associated with a new session using update(), will " +"Hibernate perform an extra SQL SELECT to determine if an " +"UPDATE is actually required." +msgstr "" +"select-before-update (opcional, por defecto es " +"false): Especifica que Hibernate nunca debe realizar un UPDATE SQL a menos de que se " +"tenga certeza de que realmente se haya modificado un objeto. Sólo cuando un " +"objeto transitorio ha sido asociado con una sesión nueva utilizando " +"update()), Hibernate realizará una SQL SELECT extra para determinar si realmente se necesita un UPDATE." + +#. Tag: para +#: basic_mapping.xml:393 +#, fuzzy, no-c-format +msgid "" +"polymorphisms (optional - defaults to implicit): determines whether implicit or explicit query polymorphisms is " +"used." +msgstr "" +"polymorphism (opcional, por defecto es implicit): Determina si se utiliza polimorfismo de consulta implícito o " +"explícito. " + +#. Tag: para +#: basic_mapping.xml:399 +#, no-c-format +msgid "" +"where (optional): specifies an arbitrary SQL " +"WHERE condition to be used when retrieving objects of " +"this class." +msgstr "" +"where (opcional) especifica una condición SQL " +"WHERE arbitraria para utilizarla en la recuperación de " +"objetos de esta clase. " + +#. Tag: para +#: basic_mapping.xml:405 +#, no-c-format +msgid "" +"persister (optional): specifies a custom " +"ClassPersister." +msgstr "" +"persister (opcional): Especifica un " +"ClassPersister personalizado. " + +#. Tag: para +#: basic_mapping.xml:410 +#, no-c-format +msgid "" +"batch-size (optional - defaults to 1): " +"specifies a \"batch size\" for fetching instances of this class by " +"identifier." +msgstr "" +"batch-size (opcional, por defecto es 1) especifica un \"tamaño de lote\" para buscar instancias de esta " +"clase por identificador." + +#. Tag: para +#: basic_mapping.xml:416 +#, no-c-format +msgid "" +"optimistic-lock (optional - defaults to version): determines the optimistic locking strategy." +msgstr "" +"optimistic-lock (opcional, por defecto es " +"version): Determina la estrategia optimista de bloqueo. " + +#. Tag: para +#: basic_mapping.xml:422 +#, no-c-format +msgid "" +"lazy (optional): lazy fetching can be disabled by setting " +"lazy=\"false\"." +msgstr "" +"lazy (opcional): La recuperación perezosa se puede " +"deshabilitar por completo al establecer lazy=\"false\"." + +#. Tag: para +#: basic_mapping.xml:427 +#, fuzzy, no-c-format +msgid "" +"entity-name (optional - defaults to the class name): " +"Hibernate3 allows a class to be mapped multiple times, potentially to " +"different tables. It also allows entity mappings that are represented by " +"Maps or XML at the Java level. In these cases, you should provide an " +"explicit arbitrary name for the entity. See and for more information." +msgstr "" +"entity-name (opcional - por defecto es el nombre de la " +"clase): Hibernate3 permite mapear una clase varias veces, potencialmente a " +"tablas diferentes. También permite que los mapeos de entidad sean " +"representados por Maps o XML al nivel de Java. En estos casos, debe " +"proporcionar un nombre explícito arbitrario para la entidad. Para obtener " +"más información consulte y ." + +#. Tag: para +#: basic_mapping.xml:437 +#, no-c-format +msgid "" +"check (optional): an SQL expression used to generate a " +"multi-row check constraint for automatic schema " +"generation." +msgstr "" +"check (opcional): Una expresión SQL utilizada para " +"generar una restricción check multi-filas para la " +"generación automática de esquemas." + +#. Tag: para +#: basic_mapping.xml:443 +#, no-c-format +msgid "" +"rowid (optional): Hibernate can use ROWIDs on databases. " +"On Oracle, for example, Hibernate can use the rowid extra " +"column for fast updates once this option has been set to rowid. A ROWID is an implementation detail and represents the physical " +"location of a stored tuple." +msgstr "" +"rowid (opcional): Hibernate puede utilizar los llamados " +"ROWIDs en las bases de datos. Por ejemplo, en Oracle, Hibernate puede " +"utilizar la columna extra rowid para actualizaciones " +"rápidas si usted establece esta opción como rowid. Un " +"ROWID es un detalle de implementación y representa la posición física de la " +"tupla almacenada." + +#. Tag: para +#: basic_mapping.xml:452 +#, no-c-format +msgid "" +"subselect (optional): maps an immutable and read-only " +"entity to a database subselect. This is useful if you want to have a view " +"instead of a base table. See below for more information." +msgstr "" +"subselect (opcional): Mapea una entidad inmutable y de " +"sólo lectura a una subselección de base de datos. Es útil si quiere tener " +"una vista en vez de una tabla base. Vea a continuación para obtener más " +"información." + +#. Tag: para +#: basic_mapping.xml:459 +#, no-c-format +msgid "" +"abstract (optional): is used to mark abstract " +"superclasses in <union-subclass> hierarchies." +msgstr "" +"abstract (opcional): Utilizado para marcar superclases " +"abstractas en las jerarquías <union-subclass>." + +#. Tag: para +#: basic_mapping.xml:466 +#, no-c-format +msgid "" +"It is acceptable for the named persistent class to be an interface. You can " +"declare implementing classes of that interface using the <" +"subclass> element. You can persist any static inner class. Specify the class name using the standard form i.e. " +"e.g.Foo$Bar." +msgstr "" +"Es perfectamente aceptable que la clase persistente mencionada sea una " +"interfaz. Puede declarar clases que implementan esa interfaz utilizando el " +"elemento <subclass>. Puede persistir cualquier " +"clase interna estática. Debe especificar el nombre de " +"la clase utilizando la forma estándar, por ejemplo, e.g.Foo$Bar." + +#. Tag: para +#: basic_mapping.xml:472 +#, no-c-format +msgid "Here is how to do a virtual view (subselect) in XML:" +msgstr "" + +#. Tag: programlisting +#: basic_mapping.xml:474 +#, no-c-format +msgid "" +"<class name=\"Summary\">\n" +" <subselect>\n" +" select item.name, max(bid.amount), count(*)\n" +" from item\n" +" join bid on bid.item_id = item.id\n" +" group by item.name\n" +" </subselect>\n" +" <synchronize table=\"item\"/>\n" +" <synchronize table=\"bid\"/>\n" +" <id name=\"name\"/>\n" +" ...\n" +"</class>" +msgstr "" + +#. Tag: para +#: basic_mapping.xml:476 +#, no-c-format +msgid "" +"The <subselect> is available both as an attribute " +"and a nested mapping element." +msgstr "" + +#. Tag: title +#: basic_mapping.xml:481 +#, fuzzy, no-c-format +msgid "Identifiers" +msgstr "Identificadores asignados" + +#. Tag: para +#: basic_mapping.xml:483 +#, fuzzy, no-c-format +msgid "" "Mapped classes must declare the primary key column of " "the database table. Most classes will also have a JavaBeans-style property " -"holding the unique identifier of an instance. The <id> element defines the mapping from that property to the primary key " -"column." +"holding the unique identifier of an instance." msgstr "" "Las clases mapeadas tienen que declarar la columna de " "clave primaria de la tabla de la base de datos. La mayoría de las clases " @@ -776,20 +1032,68 @@ msgstr "" "mapeo de esa propiedad a la columna de clave primaria." #. Tag: para +#: basic_mapping.xml:488 #, no-c-format -msgid "name (optional): the name of the identifier property." +msgid "Mark the identifier property with @Id." +msgstr "" + +#. Tag: programlisting +#: basic_mapping.xml:491 +#, no-c-format +msgid "" +"@Entity\n" +"public class Person {\n" +" @Id Integer getId() { ... }\n" +" ...\n" +"}" +msgstr "" + +#. Tag: para +#: basic_mapping.xml:493 +#, fuzzy, no-c-format +msgid "" +"In hbm.xml, use the <id> element which defines the " +"mapping from that property to the primary key column." +msgstr "" +"Observe el uso de etiquetas <column> para mapear " +"una propiedad a múltiples columnas." + +#. Tag: programlisting +#: basic_mapping.xml:509 +#, no-c-format +msgid "" +"<id\n" +" name=\"propertyName\"\n" +" type=\"typename\"\n" +" column=\"column_name\"\n" +" unsaved-value=\"null|any|none|undefined|id_value\"\n" +" access=\"field|property|ClassName\">\n" +" node=\"element-name|@attribute-name|element/@attribute|.\"\n" +"\n" +" <generator class=\"generatorClass\"/>\n" +"</id>" +msgstr "" + +#. Tag: para +#: basic_mapping.xml:513 +#, no-c-format +msgid "" +"name (optional): the name of the identifier property." msgstr "" "name (opcional): El nombre de la propiedad del " "identificador. s" #. Tag: para +#: basic_mapping.xml:518 basic_mapping.xml:2141 #, no-c-format -msgid "type (optional): a name that indicates the Hibernate type." +msgid "" +"type (optional): a name that indicates the Hibernate type." msgstr "" "type (opcional): un nombre que indica el tipo de " "Hibernate." #. Tag: para +#: basic_mapping.xml:523 #, no-c-format msgid "" "column (optional - defaults to the property name): the " @@ -799,6 +1103,7 @@ msgstr "" "propiedad): El nombre de la columna de la clave principal." #. Tag: para +#: basic_mapping.xml:528 #, no-c-format msgid "" "unsaved-value (optional - defaults to a \"sensible\" " @@ -812,6 +1117,7 @@ msgstr "" "instancias separadas que fueron guardadas o cargadas en una sesión previa." #. Tag: para +#: basic_mapping.xml:536 #, no-c-format msgid "" "access (optional - defaults to propertyname attribute is missing, it is assumed that the " @@ -832,38 +1139,1045 @@ msgstr "" "tiene propiedad identificadora." #. Tag: para -#, no-c-format +#: basic_mapping.xml:546 +#, fuzzy, no-c-format msgid "" "The unsaved-value attribute is almost never needed in " -"Hibernate3." +"Hibernate3 and indeed has no corresponding element in annotations." msgstr "" "El atributo unsaved-value casi nunca se necesita en " "Hibernate3." #. Tag: para -#, no-c-format +#: basic_mapping.xml:550 +#, fuzzy, no-c-format msgid "" -"There is an alternative <composite-id> declaration " -"that allows access to legacy data with composite keys. Its use is strongly " -"discouraged for anything else." +"You can also declare the identifier as a composite identifier. This allows " +"access to legacy data with composite keys. Its use is strongly discouraged " +"for anything else." msgstr "" "Hay una declaración <composite-id> opcional para " "permitir acceso a los datos heredados con claves compuestas. Le disuadimos " "seriamente de su utilización para cualquier otra cosa." #. Tag: title -#, no-c-format -msgid "Generator" -msgstr "Generador" +#: basic_mapping.xml:555 +#, fuzzy, no-c-format +msgid "Composite identifier" +msgstr "Identificadores asignados" #. Tag: para +#: basic_mapping.xml:557 +#, no-c-format +msgid "You can define a composite primary key through several syntaxes:" +msgstr "" + +#. Tag: para +#: basic_mapping.xml:562 #, no-c-format msgid "" -"The optional <generator> child element names a Java " -"class used to generate unique identifiers for instances of the persistent " -"class. If any parameters are required to configure or initialize the " -"generator instance, they are passed using the <param> element." +"use a component type to represent the identifier and map it as a property in " +"the entity: you then annotated the property as @EmbeddedId. The component type has to be Serializable." +msgstr "" + +#. Tag: para +#: basic_mapping.xml:569 +#, no-c-format +msgid "" +"map multiple properties as @Id properties: the " +"identifier type is then the entity class itself and needs to be " +"Serializable. This approach is unfortunately not " +"standard and only supported by Hibernate." +msgstr "" + +#. Tag: para +#: basic_mapping.xml:577 +#, no-c-format +msgid "" +"map multiple properties as @Id properties and declare " +"an external class to be the identifier type. This class, which needs to be " +"Serializable, is declared on the entity via the " +"@IdClass annotation. The identifier type must contain " +"the same properties as the identifier properties of the entity: each " +"property name must be the same, its type must be the same as well if the " +"entity property is of a basic type, its type must be the type of the primary " +"key of the associated entity if the entity property is an association " +"(either a @OneToOne or a @ManyToOne)." +msgstr "" + +#. Tag: para +#: basic_mapping.xml:592 +#, no-c-format +msgid "" +"As you can see the last case is far from obvious. It has been inherited from " +"the dark ages of EJB 2 for backward compatibilities and we recommend you not " +"to use it (for simplicity sake)." +msgstr "" + +#. Tag: para +#: basic_mapping.xml:596 +#, no-c-format +msgid "Let's explore all three cases using examples." +msgstr "" + +#. Tag: title +#: basic_mapping.xml:599 +#, no-c-format +msgid "id as a property using a component type" +msgstr "" + +#. Tag: para +#: basic_mapping.xml:601 +#, no-c-format +msgid "Here is a simple example of @EmbeddedId." +msgstr "" + +#. Tag: programlisting +#: basic_mapping.xml:604 +#, no-c-format +msgid "" +"@Entity\n" +"class User {\n" +" @EmbeddedId\n" +" @AttributeOverride(name=\"firstName\", column=@Column(name=\"fld_firstname" +"\")\n" +" UserId id;\n" +"\n" +" Integer age;\n" +"}\n" +"\n" +"@Embeddable\n" +"class UserId implements Serializable {\n" +" String firstName;\n" +" String lastName;\n" +"}" +msgstr "" + +#. Tag: para +#: basic_mapping.xml:606 +#, no-c-format +msgid "" +"You can notice that the UserId class is serializable. " +"To override the column mapping, use @AttributeOverride." +msgstr "" + +#. Tag: para +#: basic_mapping.xml:610 +#, no-c-format +msgid "" +"An embedded id can itself contains the primary key of an associated entity." +msgstr "" + +#. Tag: programlisting +#: basic_mapping.xml:613 +#, no-c-format +msgid "" +"@Entity\n" +"class Customer {\n" +" @EmbeddedId CustomerId id;\n" +" boolean preferredCustomer;\n" +"\n" +" @MapsId(\"userId\")\n" +" @JoinColumns({\n" +" @JoinColumn(name=\"userfirstname_fk\", referencedColumnName=\"firstName" +"\"),\n" +" @JoinColumn(name=\"userlastname_fk\", referencedColumnName=\"lastName" +"\")\n" +" })\n" +" @OneToOne User user;\n" +"}\n" +"\n" +"@Embeddable\n" +"class CustomerId implements Serializable {\n" +" UserId userId;\n" +" String customerNumber;\n" +"\n" +" //implements equals and hashCode\n" +"}\n" +"\n" +"@Entity \n" +"class User {\n" +" @EmbeddedId UserId id;\n" +" Integer age;\n" +"}\n" +"\n" +"@Embeddable\n" +"class UserId implements Serializable {\n" +" String firstName;\n" +" String lastName;\n" +"\n" +" //implements equals and hashCode\n" +"}" +msgstr "" + +#. Tag: para +#: basic_mapping.xml:615 +#, no-c-format +msgid "" +"In the embedded id object, the association is represented as the identifier " +"of the associated entity. But you can link its value to a regular " +"association in the entity via the @MapsId annotation. " +"The @MapsId value correspond to the property name of " +"the embedded id object containing the associated entity's identifier. In the " +"database, it means that the Customer.user and the " +"CustomerId.userId properties share the same underlying " +"column (user_fk in this case)." +msgstr "" + +#. Tag: para +#: basic_mapping.xml:627 +#, no-c-format +msgid "" +"The component type used as identifier must implement equals() and hashCode()." +msgstr "" + +#. Tag: para +#: basic_mapping.xml:632 +#, no-c-format +msgid "" +"In practice, your code only sets the Customer.user " +"property and the user id value is copied by Hibernate into the " +"CustomerId.userId property." +msgstr "" + +#. Tag: para +#: basic_mapping.xml:638 +#, no-c-format +msgid "" +"The id value can be copied as late as flush time, don't rely on it until " +"after flush time." +msgstr "" + +#. Tag: para +#: basic_mapping.xml:642 +#, no-c-format +msgid "" +"While not supported in JPA, Hibernate lets you place your association " +"directly in the embedded id component (instead of having to use the " +"@MapsId annotation)." +msgstr "" + +#. Tag: programlisting +#: basic_mapping.xml:646 +#, no-c-format +msgid "" +"@Entity\n" +"class Customer {\n" +" @EmbeddedId CustomerId id;\n" +" boolean preferredCustomer;\n" +"}\n" +"\n" +"@Embeddable\n" +"class CustomerId implements Serializable {\n" +" @OneToOne\n" +" @JoinColumns({\n" +" @JoinColumn(name=\"userfirstname_fk\", referencedColumnName=\"firstName" +"\"),\n" +" @JoinColumn(name=\"userlastname_fk\", referencedColumnName=\"lastName" +"\")\n" +" }) \n" +" User user;\n" +" String customerNumber;\n" +"\n" +" //implements equals and hashCode\n" +"}\n" +"\n" +"@Entity \n" +"class User {\n" +" @EmbeddedId UserId id;\n" +" Integer age;\n" +"}\n" +"\n" +"@Embeddable\n" +"class UserId implements Serializable {\n" +" String firstName;\n" +" String lastName;\n" +"\n" +"\n" +" //implements equals and hashCode\n" +"}" +msgstr "" + +#. Tag: para +#: basic_mapping.xml:648 +#, no-c-format +msgid "Let's now rewrite these examples using the hbm.xml syntax." +msgstr "" + +#. Tag: programlisting +#: basic_mapping.xml:651 +#, no-c-format +msgid "" +"<composite-id\n" +" name=\"propertyName\"\n" +" class=\"ClassName\"\n" +" mapped=\"true|false\"\n" +" access=\"field|property|ClassName\"\n" +" node=\"element-name|.\">\n" +"\n" +" <key-property name=\"propertyName\" type=\"typename\" column=" +"\"column_name\"/>\n" +" <key-many-to-one name=\"propertyName\" class=\"ClassName\" column=" +"\"column_name\"/>\n" +" ......\n" +"</composite-id>" +msgstr "" + +#. Tag: para +#: basic_mapping.xml:653 +#, no-c-format +msgid "First a simple example:" +msgstr "" + +#. Tag: programlisting +#: basic_mapping.xml:655 +#, no-c-format +msgid "" +"<class name=\"User\">\n" +" <composite-id name=\"id\" class=\"UserId\">\n" +" <key-property name=\"firstName\" column=\"fld_firstname\"/>\n" +" <key-property name=\"lastName\"/>\n" +" </composite-id>\n" +"</class>" +msgstr "" + +#. Tag: para +#: basic_mapping.xml:657 +#, no-c-format +msgid "Then an example showing how an association can be mapped." +msgstr "" + +#. Tag: programlisting +#: basic_mapping.xml:660 +#, no-c-format +msgid "" +"<class name=\"Customer\">\n" +" <composite-id name=\"id\" class=\"CustomerId\">\n" +" <key-property name=\"firstName\" column=\"userfirstname_fk\"/>\n" +" <key-property name=\"lastName\" column=\"userfirstname_fk\"/>\n" +" <key-property name=\"customerNumber\"/>\n" +" </composite-id>\n" +"\n" +" <property name=\"preferredCustomer\"/>\n" +"\n" +" <many-to-one name=\"user\">\n" +" <column name=\"userfirstname_fk\" updatable=\"false\" insertable=" +"\"false\"/>\n" +" <column name=\"userlastname_fk\" updatable=\"false\" insertable=" +"\"false\"/>\n" +" </many-to-one>\n" +"</class>\n" +"\n" +"<class name=\"User\">\n" +" <composite-id name=\"id\" class=\"UserId\">\n" +" <key-property name=\"firstName\"/>\n" +" <key-property name=\"lastName\"/>\n" +" </composite-id>\n" +"\n" +" <property name=\"age\"/>\n" +"</class>" +msgstr "" + +#. Tag: para +#: basic_mapping.xml:662 +#, no-c-format +msgid "Notice a few things in the previous example:" +msgstr "" + +#. Tag: para +#: basic_mapping.xml:666 +#, no-c-format +msgid "" +"the order of the properties (and column) matters. It must be the same " +"between the association and the primary key of the associated entity" +msgstr "" + +#. Tag: para +#: basic_mapping.xml:672 +#, no-c-format +msgid "" +"the many to one uses the same columns as the primary key and thus must be " +"marked as read only (insertable and updatable to false)." +msgstr "" + +#. Tag: para +#: basic_mapping.xml:679 +#, no-c-format +msgid "" +"unlike with @MapsId, the id value of the associated " +"entity is not transparently copied, check the foreign id " +"generator for more information." +msgstr "" + +#. Tag: para +#: basic_mapping.xml:686 +#, no-c-format +msgid "" +"The last example shows how to map association directly in the embedded id " +"component." +msgstr "" + +#. Tag: programlisting +#: basic_mapping.xml:689 +#, no-c-format +msgid "" +"<class name=\"Customer\">\n" +" <composite-id name=\"id\" class=\"CustomerId\">\n" +" <key-many-to-one name=\"user\">\n" +" <column name=\"userfirstname_fk\"/>\n" +" <column name=\"userlastname_fk\"/>\n" +" </key-many-to-one>\n" +" <key-property name=\"customerNumber\"/>\n" +" </composite-id>\n" +"\n" +" <property name=\"preferredCustomer\"/>\n" +"</class>\n" +"\n" +"<class name=\"User\">\n" +" <composite-id name=\"id\" class=\"UserId\">\n" +" <key-property name=\"firstName\"/>\n" +" <key-property name=\"lastName\"/>\n" +" </composite-id>\n" +"\n" +" <property name=\"age\"/>\n" +"</class>" +msgstr "" + +#. Tag: para +#: basic_mapping.xml:691 +#, no-c-format +msgid "" +"This is the recommended approach to map composite identifier. The following " +"options should not be considered unless some constraint are present." +msgstr "" + +#. Tag: title +#: basic_mapping.xml:697 +#, no-c-format +msgid "Multiple id properties without identifier type" +msgstr "" + +#. Tag: para +#: basic_mapping.xml:699 +#, no-c-format +msgid "" +"Another, arguably more natural, approach is to place @Id on multiple properties of your entity. This approach is only " +"supported by Hibernate (not JPA compliant) but does not require an extra " +"embeddable component." +msgstr "" + +#. Tag: programlisting +#: basic_mapping.xml:704 +#, no-c-format +msgid "" +"@Entity\n" +"class Customer implements Serializable {\n" +" @Id @OneToOne\n" +" @JoinColumns({\n" +" @JoinColumn(name=\"userfirstname_fk\", referencedColumnName=\"firstName" +"\"),\n" +" @JoinColumn(name=\"userlastname_fk\", referencedColumnName=\"lastName" +"\")\n" +" })\n" +" User user;\n" +" \n" +" @Id String customerNumber;\n" +"\n" +" boolean preferredCustomer;\n" +"\n" +" //implements equals and hashCode\n" +"}\n" +"\n" +"@Entity \n" +"class User {\n" +" @EmbeddedId UserId id;\n" +" Integer age;\n" +"}\n" +"\n" +"@Embeddable\n" +"class UserId implements Serializable {\n" +" String firstName;\n" +" String lastName;\n" +"\n" +" //implements equals and hashCode\n" +"}" +msgstr "" + +#. Tag: para +#: basic_mapping.xml:706 +#, no-c-format +msgid "" +"In this case Customer is its own identifier " +"representation: it must implement Serializable and " +"must implement equals() and hashCode()." +msgstr "" + +#. Tag: para +#: basic_mapping.xml:712 +#, no-c-format +msgid "In hbm.xml, the same mapping is:" +msgstr "" + +#. Tag: programlisting +#: basic_mapping.xml:714 +#, no-c-format +msgid "" +"<class name=\"Customer\">\n" +" <composite-id>\n" +" <key-many-to-one name=\"user\">\n" +" <column name=\"userfirstname_fk\"/>\n" +" <column name=\"userlastname_fk\"/>\n" +" </key-many-to-one>\n" +" <key-property name=\"customerNumber\"/>\n" +" </composite-id>\n" +"\n" +" <property name=\"preferredCustomer\"/>\n" +"</class>\n" +"\n" +"<class name=\"User\">\n" +" <composite-id name=\"id\" class=\"UserId\">\n" +" <key-property name=\"firstName\"/>\n" +" <key-property name=\"lastName\"/>\n" +" </composite-id>\n" +"\n" +" <property name=\"age\"/>\n" +"</class>" +msgstr "" + +#. Tag: title +#: basic_mapping.xml:718 +#, no-c-format +msgid "Multiple id properties with with a dedicated identifier type" +msgstr "" + +#. Tag: para +#: basic_mapping.xml:721 +#, no-c-format +msgid "" +"@IdClass on an entity points to the class (component) " +"representing the identifier of the class. The properties marked " +"@Id on the entity must have their corresponding " +"property on the @IdClass. The return type of search " +"twin property must be either identical for basic properties or must " +"correspond to the identifier class of the associated entity for an " +"association." +msgstr "" + +#. Tag: para +#: basic_mapping.xml:730 +#, no-c-format +msgid "" +"This approach is inherited from the EJB 2 days and we recommend against its " +"use. But, after all it's your application and Hibernate supports it." +msgstr "" + +#. Tag: programlisting +#: basic_mapping.xml:735 +#, no-c-format +msgid "" +"@Entity\n" +"@IdClass(CustomerId.class)\n" +"class Customer implements Serializable {\n" +" @Id @OneToOne\n" +" @JoinColumns({\n" +" @JoinColumn(name=\"userfirstname_fk\", referencedColumnName=\"firstName" +"\"),\n" +" @JoinColumn(name=\"userlastname_fk\", referencedColumnName=\"lastName" +"\")\n" +" }) \n" +" User user;\n" +" \n" +" @Id String customerNumber;\n" +"\n" +" boolean preferredCustomer;\n" +"}\n" +"\n" +"class CustomerId implements Serializable {\n" +" UserId user;\n" +" String customerNumber;\n" +"\n" +" //implements equals and hashCode\n" +"}\n" +"\n" +"@Entity \n" +"class User {\n" +" @EmbeddedId UserId id;\n" +" Integer age;\n" +"\n" +" //implements equals and hashCode\n" +"}\n" +"\n" +"@Embeddable\n" +"class UserId implements Serializable {\n" +" String firstName;\n" +" String lastName;\n" +"\n" +" //implements equals and hashCode\n" +"}" +msgstr "" + +#. Tag: para +#: basic_mapping.xml:737 +#, no-c-format +msgid "" +"Customer and CustomerId do " +"have the same properties customerNumber as well as " +"user. CustomerId must be " +"Serializable and implement equals() and hashCode()." +msgstr "" + +#. Tag: para +#: basic_mapping.xml:745 +#, no-c-format +msgid "" +"While not JPA standard, Hibernate let's you declare the vanilla associated " +"property in the @IdClass." +msgstr "" + +#. Tag: programlisting +#: basic_mapping.xml:749 +#, no-c-format +msgid "" +"@Entity\n" +"@IdClass(CustomerId.class)\n" +"class Customer implements Serializable {\n" +" @Id @OneToOne\n" +" @JoinColumns({\n" +" @JoinColumn(name=\"userfirstname_fk\", referencedColumnName=\"firstName" +"\"),\n" +" @JoinColumn(name=\"userlastname_fk\", referencedColumnName=\"lastName" +"\")\n" +" }) \n" +" User user;\n" +" \n" +" @Id String customerNumber;\n" +"\n" +" boolean preferredCustomer;\n" +"}\n" +"\n" +"class CustomerId implements Serializable {\n" +" @OneToOne User user;\n" +" String customerNumber;\n" +"\n" +" //implements equals and hashCode\n" +"}\n" +"\n" +"@Entity \n" +"class User {\n" +" @EmbeddedId UserId id;\n" +" Integer age;\n" +"\n" +" //implements equals and hashCode\n" +"}\n" +"\n" +"@Embeddable\n" +"class UserId implements Serializable {\n" +" String firstName;\n" +" String lastName;\n" +"}" +msgstr "" + +#. Tag: para +#: basic_mapping.xml:751 +#, no-c-format +msgid "" +"This feature is of limited interest though as you are likely to have chosen " +"the @IdClass approach to stay JPA compliant or you " +"have a quite twisted mind." +msgstr "" + +#. Tag: para +#: basic_mapping.xml:755 +#, no-c-format +msgid "Here are the equivalent on hbm.xml files:" +msgstr "" + +#. Tag: programlisting +#: basic_mapping.xml:757 +#, no-c-format +msgid "" +"<class name=\"Customer\">\n" +" <composite-id class=\"CustomerId\" mapped=\"true\">\n" +" <key-many-to-one name=\"user\">\n" +" <column name=\"userfirstname_fk\"/>\n" +" <column name=\"userlastname_fk\"/>\n" +" </key-many-to-one>\n" +" <key-property name=\"customerNumber\"/>\n" +" </composite-id>\n" +"\n" +" <property name=\"preferredCustomer\"/>\n" +"</class>\n" +"\n" +"<class name=\"User\">\n" +" <composite-id name=\"id\" class=\"UserId\">\n" +" <key-property name=\"firstName\"/>\n" +" <key-property name=\"lastName\"/>\n" +" </composite-id>\n" +"\n" +" <property name=\"age\"/>\n" +"</class>" +msgstr "" + +#. Tag: title +#: basic_mapping.xml:762 +#, fuzzy, no-c-format +msgid "Identifier generator" +msgstr "Generadores mejorados del identificador" + +#. Tag: para +#: basic_mapping.xml:764 +#, no-c-format +msgid "" +"Hibernate can generate and populate identifier values for you automatically. " +"This is the recommended approach over \"business\" or \"natural\" id " +"(especially composite ids)." +msgstr "" + +#. Tag: para +#: basic_mapping.xml:768 +#, no-c-format +msgid "" +"Hibernate offers various generation strategies, let's explore the most " +"common ones first that happens to be standardized by JPA:" +msgstr "" + +#. Tag: para +#: basic_mapping.xml:774 +#, fuzzy, no-c-format +msgid "" +"IDENTITY: supports identity columns in DB2, MySQL, MS SQL Server, Sybase and " +"HypersonicSQL. The returned identifier is of type long, " +"short or int." +msgstr "" +"soporta columnas de identidad en DB2, MySQL, MS SQL Server, Sybase y " +"HypersonicSQL. El identificador devuelto es de tipo long, " +"short o int." + +#. Tag: para +#: basic_mapping.xml:781 +#, fuzzy, no-c-format +msgid "" +"SEQUENCE (called seqhilo in Hibernate): uses a hi/lo " +"algorithm to efficiently generate identifiers of type long, short or int, given a named " +"database sequence." +msgstr "" +"utiliza un algoritmo alto/bajo para generar eficientemente identificadores " +"de tipo long, short o int, dada una secuencia de base de datos." + +#. Tag: para +#: basic_mapping.xml:788 +#, fuzzy, no-c-format +msgid "" +"TABLE (called MultipleHiLoPerTableGenerator in " +"Hibernate) : uses a hi/lo algorithm to efficiently generate identifiers of " +"type long, short or int, given a table and column as a source of hi values. The hi/lo " +"algorithm generates identifiers that are unique only for a particular " +"database." +msgstr "" +"utiliza un algoritmo alto/bajo para generar eficientemente identificadores " +"de tipo long, short o int, dada una tabla y columna como fuente de valores altos (por defecto " +"hibernate_unique_key y next_hi " +"respectivamente). El algoritmo alto/bajo genera identificadores que son " +"únicos sólamente para una base de datos particular." + +#. Tag: para +#: basic_mapping.xml:798 +#, fuzzy, no-c-format +msgid "" +"AUTO: selects IDENTITY, SEQUENCE or " +"TABLE depending upon the capabilities of the underlying " +"database." +msgstr "" +"selecciona identity, sequence o " +"hilo dependiendo de las capacidades de la base de datos " +"subyacente. " + +#. Tag: para +#: basic_mapping.xml:805 +#, no-c-format +msgid "" +"We recommend all new projects to use the new enhanced identifier generators. " +"They are deactivated by default for entities using annotations but can be " +"activated using hibernate.id.new_generator_mappings=true. These " +"new generators are more efficient and closer to the JPA 2 specification " +"semantic." +msgstr "" + +#. Tag: para +#: basic_mapping.xml:812 +#, no-c-format +msgid "" +"However they are not backward compatible with existing Hibernate based " +"application (if a sequence or a table is used for id generation). See " +"XXXXXXX for more information on how " +"to activate them." +msgstr "" + +#. Tag: para +#: basic_mapping.xml:818 +#, no-c-format +msgid "" +"To mark an id property as generated, use the @GeneratedValue annotation. You can specify the strategy used (default to " +"AUTO) by setting strategy." +msgstr "" + +#. Tag: programlisting +#: basic_mapping.xml:823 +#, no-c-format +msgid "" +"@Entity\n" +"public class Customer {\n" +" @Id @GeneratedValue\n" +" Integer getId() { ... };\n" +"}\n" +"\n" +"@Entity \n" +"public class Invoice {\n" +" @Id @GeneratedValue(strategy=GenerationType.IDENTITY)\n" +" Integer getId() { ... };\n" +"}" +msgstr "" + +#. Tag: para +#: basic_mapping.xml:825 +#, no-c-format +msgid "" +"SEQUENCE and TABLE require additional " +"configurations that you can set using @SequenceGenerator and @TableGenerator:" +msgstr "" + +#. Tag: para +#: basic_mapping.xml:832 +#, fuzzy, no-c-format +msgid "name: name of the generator" +msgstr "name: El nombre de la propiedad. " + +#. Tag: para +#: basic_mapping.xml:836 +#, fuzzy, no-c-format +msgid "" +"table / sequenceName: name of the " +"table or the sequence (defaulting respectively to " +"hibernate_sequences and hibernate_sequence)" +msgstr "" +"sequence_name (opcional, por defecto es " +"hibernate_sequence): el nombre de la secuencia o la tabla " +"a utilizar." + +#. Tag: para +#: basic_mapping.xml:843 +#, fuzzy, no-c-format +msgid "catalog / schema:" +msgstr "serializable" + +#. Tag: para +#: basic_mapping.xml:848 +#, fuzzy, no-c-format +msgid "" +"initialValue: the value from which the id is to start " +"generating" +msgstr "table: El nombre de la tabla unida. " + +#. Tag: para +#: basic_mapping.xml:853 +#, no-c-format +msgid "" +"allocationSize: the amount to increment by when " +"allocating id numbers from the generator" +msgstr "" + +#. Tag: para +#: basic_mapping.xml:858 +#, no-c-format +msgid "" +"In addition, the TABLE strategy also let you " +"customize:" +msgstr "" + +#. Tag: para +#: basic_mapping.xml:863 +#, fuzzy, no-c-format +msgid "" +"pkColumnName: the column name containing the entity " +"identifier" +msgstr "name: El nombre de la propiedad. " + +#. Tag: para +#: basic_mapping.xml:868 +#, fuzzy, no-c-format +msgid "" +"valueColumnName: the column name containing the " +"identifier value" +msgstr "" +"name (opcional): El nombre de la propiedad del " +"identificador. s" + +#. Tag: para +#: basic_mapping.xml:873 +#, fuzzy, no-c-format +msgid "pkColumnValue: the entity identifier" +msgstr "id-type: el tipo del identificador." + +#. Tag: para +#: basic_mapping.xml:878 +#, no-c-format +msgid "" +"uniqueConstraints: any potential column constraint on the " +"table containing the ids" +msgstr "" + +#. Tag: para +#: basic_mapping.xml:883 +#, no-c-format +msgid "" +"To link a table or sequence generator definition with an actual generated " +"property, use the same name in both the definition name " +"and the generator value generator as shown below." +msgstr "" + +#. Tag: programlisting +#: basic_mapping.xml:888 +#, no-c-format +msgid "" +"@Id \n" +"@GeneratedValue(\n" +" strategy=GenerationType.SEQUENCE, \n" +" generator=\"SEQ_GEN\")\n" +"@javax.persistence.SequenceGenerator(\n" +" name=\"SEQ_GEN\",\n" +" sequenceName=\"my_sequence\",\n" +" allocationSize=20\n" +")\n" +"public Integer getId() { ... }" +msgstr "" + +#. Tag: para +#: basic_mapping.xml:890 +#, no-c-format +msgid "" +"The scope of a generator definition can be the application or the class. " +"Class-defined generators are not visible outside the class and can override " +"application level generators. Application level generators are defined in " +"JPA's XML deployment descriptors (see XXXXXX ):" +msgstr "" + +#. Tag: programlisting +#: basic_mapping.xml:896 +#, no-c-format +msgid "" +"<table-generator name=\"EMP_GEN\"\n" +" table=\"GENERATOR_TABLE\"\n" +" pk-column-name=\"key\"\n" +" value-column-name=\"hi\"\n" +" pk-column-value=\"EMP\"\n" +" allocation-size=\"20\"/>\n" +"\n" +"//and the annotation equivalent\n" +"\n" +"@javax.persistence.TableGenerator(\n" +" name=\"EMP_GEN\",\n" +" table=\"GENERATOR_TABLE\",\n" +" pkColumnName = \"key\",\n" +" valueColumnName = \"hi\"\n" +" pkColumnValue=\"EMP\",\n" +" allocationSize=20\n" +")\n" +"\n" +"<sequence-generator name=\"SEQ_GEN\" \n" +" sequence-name=\"my_sequence\"\n" +" allocation-size=\"20\"/>\n" +"\n" +"//and the annotation equivalent\n" +"\n" +"@javax.persistence.SequenceGenerator(\n" +" name=\"SEQ_GEN\",\n" +" sequenceName=\"my_sequence\",\n" +" allocationSize=20\n" +")" +msgstr "" + +#. Tag: para +#: basic_mapping.xml:898 +#, no-c-format +msgid "" +"If a JPA XML descriptor (like META-INF/orm.xml) is used " +"to define the generators, EMP_GEN and SEQ_GEN are application level generators." +msgstr "" + +#. Tag: para +#: basic_mapping.xml:904 +#, no-c-format +msgid "" +"Package level definition is not supported by the JPA specification. However, " +"you can use the @GenericGenerator at the package level " +"(see )." +msgstr "" + +#. Tag: para +#: basic_mapping.xml:910 +#, no-c-format +msgid "" +"These are the four standard JPA generators. Hibernate goes beyond that and " +"provide additional generators or additional options as we will see below. " +"You can also write your own custom identifier generator by implementing " +"org.hibernate.id.IdentifierGenerator." +msgstr "" + +#. Tag: para +#: basic_mapping.xml:916 +#, no-c-format +msgid "" +"To define a custom generator, use the @GenericGenerator annotation (and its plural counter part " +"@GenericGenerators) that describes the class of the " +"identifier generator or its short cut name (as described below) and a list " +"of key/value parameters. When using @GenericGenerator " +"and assigning it via @GeneratedValue.generator, the " +"@GeneratedValue.strategy is ignored: leave it blank." +msgstr "" + +#. Tag: programlisting +#: basic_mapping.xml:926 +#, no-c-format +msgid "" +"@Id @GeneratedValue(generator=\"system-uuid\")\n" +"@GenericGenerator(name=\"system-uuid\", strategy = \"uuid\")\n" +"public String getId() {\n" +"\n" +"@Id @GeneratedValue(generator=\"trigger-generated\")\n" +"@GenericGenerator(\n" +" name=\"trigger-generated\", \n" +" strategy = \"select\",\n" +" parameters = @Parameter(name=\"key\", value = \"socialSecurityNumber\")\n" +")\n" +"public String getId() {" +msgstr "" + +#. Tag: para +#: basic_mapping.xml:928 +#, fuzzy, no-c-format +msgid "" +"The hbm.xml approach uses the optional <generator> " +"child element inside <id>. If any parameters are " +"required to configure or initialize the generator instance, they are passed " +"using the <param> element." msgstr "" "El elemento hijo opcional <generator> nombra una " "clase Java utilizada para generar identificadores únicos para instancias de " @@ -871,7 +2185,27 @@ msgstr "" "inicializar la instancia del generador, se pasa utilizando el elemento " "<param>." +#. Tag: programlisting +#: basic_mapping.xml:934 +#, no-c-format +msgid "" +"<id name=\"id\" type=\"long\" column=\"cat_id\">\n" +" <generator class=\"org.hibernate.id.TableHiLoGenerator\">\n" +" <param name=\"table\">uid_table</param>\n" +" <param name=\"column\">next_hi_value_column</" +"param>\n" +" </generator>\n" +"</id>" +msgstr "" + +#. Tag: title +#: basic_mapping.xml:937 +#, no-c-format +msgid "Various additional generators" +msgstr "" + #. Tag: para +#: basic_mapping.xml:939 #, no-c-format msgid "" "All generators implement the interface org.hibernate.id." @@ -887,12 +2221,14 @@ msgstr "" "ya incorporadas. Los nombres de atajo para los generadores incorporados son " "los siguientes:" -#. Tag: term +#. Tag: literal +#: basic_mapping.xml:946 #, no-c-format -msgid "increment" -msgstr "increment" +msgid "increment" +msgstr "" #. Tag: para +#: basic_mapping.xml:949 #, no-c-format msgid "" "generates identifiers of type long, shortNo lo " "utilice en un clúster." -#. Tag: term +#. Tag: literal +#: basic_mapping.xml:958 #, no-c-format -msgid "identity" -msgstr "identity" +msgid "identity" +msgstr "" #. Tag: para +#: basic_mapping.xml:961 #, no-c-format msgid "" "supports identity columns in DB2, MySQL, MS SQL Server, Sybase and " @@ -921,12 +2259,14 @@ msgstr "" "HypersonicSQL. El identificador devuelto es de tipo long, " "short o int." -#. Tag: term +#. Tag: literal +#: basic_mapping.xml:969 #, no-c-format -msgid "sequence" -msgstr "sequence" +msgid "sequence" +msgstr "" #. Tag: para +#: basic_mapping.xml:972 #, no-c-format msgid "" "uses a sequence in DB2, PostgreSQL, Oracle, SAP DB, McKoi or a generator in " @@ -937,12 +2277,14 @@ msgstr "" "en Interbase. El identificador devuelto es de tipo long, " "short o int." -#. Tag: term +#. Tag: literal +#: basic_mapping.xml:980 #, no-c-format -msgid "hilo" -msgstr "hilo" +msgid "hilo" +msgstr "" #. Tag: para +#: basic_mapping.xml:984 #, no-c-format msgid "" "uses a hi/lo algorithm to efficiently generate identifiers of type " @@ -959,12 +2301,14 @@ msgstr "" "respectivamente). El algoritmo alto/bajo genera identificadores que son " "únicos sólamente para una base de datos particular." -#. Tag: term +#. Tag: literal +#: basic_mapping.xml:996 #, no-c-format -msgid "seqhilo" -msgstr "seqhilo" +msgid "seqhilo" +msgstr "" #. Tag: para +#: basic_mapping.xml:999 #, no-c-format msgid "" "uses a hi/lo algorithm to efficiently generate identifiers of type " @@ -975,38 +2319,122 @@ msgstr "" "de tipo long, short o int, dada una secuencia de base de datos." -#. Tag: term -#, no-c-format -msgid "uuid" -msgstr "uuid" +#. Tag: literal +#: basic_mapping.xml:1007 +#, fuzzy, no-c-format +msgid "uuid" +msgstr "id" #. Tag: para +#: basic_mapping.xml:1010 #, no-c-format msgid "" -"uses a 128-bit UUID algorithm to generate identifiers of type string that " -"are unique within a network (the IP address is used). The UUID is encoded as " -"a string of 32 hexadecimal digits in length." +"Generates a 128-bit UUID based on a custom algorithm. The value generated is " +"represented as a string of 32 hexidecimal digits. Users can also configure " +"it to use a separator (config parameter \"separator\") which separates the " +"hexidecimal digits into 8{sep}8{sep}4{sep}8{sep}4. Note specifically that " +"this is different than the IETF RFC 4122 representation of 8-4-4-4-12. If " +"you need RFC 4122 compliant UUIDs, consider using \"uuid2\" generator " +"discussed below." msgstr "" -"utiliza un algoritmo UUID de 128 bits para generar identificadores de tipo " -"cadena, únicos dentro de una red (se utiliza la direccón IP). El UUID se " -"codifica como una cadena hexadecimal de 32 dígitos de largo." -#. Tag: term +#. Tag: literal +#: basic_mapping.xml:1023 #, no-c-format -msgid "guid" -msgstr "guid" +msgid "uuid2" +msgstr "" #. Tag: para +#: basic_mapping.xml:1026 +#, no-c-format +msgid "" +"Generates a IETF RFC 4122 compliant (variant 2) 128-bit UUID. The exact " +"\"version\" (the RFC term) generated depends on the pluggable \"generation " +"strategy\" used (see below). Capable of generating values as java." +"util.UUID, java.lang.String or as a byte " +"array of length 16 (byte[16]). The \"generation strategy" +"\" is defined by the interface org.hibernate.id." +"UUIDGenerationStrategy. The generator defines 2 " +"configuration parameters for defining which generation strategy to use:" +msgstr "" + +#. Tag: literal +#: basic_mapping.xml:1038 +#, no-c-format +msgid "uuid_gen_strategy_class" +msgstr "" + +#. Tag: para +#: basic_mapping.xml:1041 +#, no-c-format +msgid "Names the UUIDGenerationStrategy class to use" +msgstr "" + +#. Tag: literal +#: basic_mapping.xml:1047 +#, no-c-format +msgid "uuid_gen_strategy" +msgstr "" + +#. Tag: para +#: basic_mapping.xml:1050 +#, no-c-format +msgid "Names the UUIDGenerationStrategy instance to use" +msgstr "" + +#. Tag: para +#: basic_mapping.xml:1056 +#, no-c-format +msgid "Out of the box, comes with the following strategies:" +msgstr "" + +#. Tag: para +#: basic_mapping.xml:1059 +#, no-c-format +msgid "" +"org.hibernate.id.uuid.StandardRandomStrategy (the " +"default) - generates \"version 3\" (aka, \"random\") UUID values via the " +"randomUUID method of java.util.UUID" +msgstr "" + +#. Tag: para +#: basic_mapping.xml:1067 +#, no-c-format +msgid "" +"org.hibernate.id.uuid.CustomVersionOneStrategy - " +"generates \"version 1\" UUID values, using IP address since mac address not " +"available. If you need mac address to be used, consider leveraging one of " +"the existing third party UUID generators which sniff out mac address and " +"integrating it via the org.hibernate.id." +"UUIDGenerationStrategy contract. Two such libraries known at " +"time of this writing include http://johannburkard.de/software/uuid/ and http://commons.apache.org/" +"sandbox/id/uuid.html" +msgstr "" + +#. Tag: literal +#: basic_mapping.xml:1085 +#, fuzzy, no-c-format +msgid "guid" +msgstr "id" + +#. Tag: para +#: basic_mapping.xml:1088 #, no-c-format msgid "uses a database-generated GUID string on MS SQL Server and MySQL." -msgstr "utiliza una cadena GUID generada por base de datos en MS SQL Server y MySQL." +msgstr "" +"utiliza una cadena GUID generada por base de datos en MS SQL Server y MySQL." -#. Tag: term +#. Tag: literal +#: basic_mapping.xml:1094 #, no-c-format -msgid "native" -msgstr "native" +msgid "native" +msgstr "" #. Tag: para +#: basic_mapping.xml:1097 #, no-c-format msgid "" "selects identity, sequence or " @@ -1017,12 +2445,14 @@ msgstr "" "hilo dependiendo de las capacidades de la base de datos " "subyacente. " -#. Tag: term +#. Tag: literal +#: basic_mapping.xml:1105 #, no-c-format -msgid "assigned" -msgstr "assigned" +msgid "assigned" +msgstr "" #. Tag: para +#: basic_mapping.xml:1108 #, no-c-format msgid "" "lets the application assign an identifier to the object before save" @@ -1033,12 +2463,14 @@ msgstr "" "llame a save(). Esta es la estrategia por defecto si no " "se especifica un elemento <generator>. " -#. Tag: term +#. Tag: literal +#: basic_mapping.xml:1117 #, no-c-format -msgid "select" -msgstr "select" +msgid "select" +msgstr "" #. Tag: para +#: basic_mapping.xml:1120 #, no-c-format msgid "" "retrieves a primary key, assigned by a database trigger, by selecting the " @@ -1048,12 +2480,14 @@ msgstr "" "seleccionando la fila por alguna clave única y recuperando el valor de la " "clave principal." -#. Tag: term +#. Tag: literal +#: basic_mapping.xml:1127 #, no-c-format -msgid "foreign" -msgstr "foreign" +msgid "foreign" +msgstr "" #. Tag: para +#: basic_mapping.xml:1130 #, no-c-format msgid "" "uses the identifier of another associated object. It is usually used in " @@ -1064,12 +2498,14 @@ msgstr "" "conjunto cón a una asociación de clave principal <one-to-one>" "." -#. Tag: term -#, no-c-format -msgid "sequence-identity" +#. Tag: literal +#: basic_mapping.xml:1138 +#, fuzzy, no-c-format +msgid "sequence-identity" msgstr "sequence-identity" #. Tag: para +#: basic_mapping.xml:1141 #, no-c-format msgid "" "a specialized sequence generation strategy that utilizes a database sequence " @@ -1089,11 +2525,13 @@ msgstr "" "Oracle." #. Tag: title +#: basic_mapping.xml:1155 #, no-c-format msgid "Hi/lo algorithm" msgstr "Algoritmo alto/bajo" #. Tag: para +#: basic_mapping.xml:1157 #, no-c-format msgid "" "The hilo and seqhilo generators " @@ -1108,7 +2546,33 @@ msgstr "" "tener el siguiente valor \"alto\" disponible. La segunda utiliza una " "secuencia del estilo de Oracle, donde se encuentre soportada." +#. Tag: programlisting +#: basic_mapping.xml:1163 +#, no-c-format +msgid "" +"<id name=\"id\" type=\"long\" column=\"cat_id\">\n" +" <generator class=\"hilo\">\n" +" <param name=\"table\">hi_value</param>\n" +" <param name=\"column\">next_value</param>\n" +" <param name=\"max_lo\">100</param>\n" +" </generator>\n" +"</id>" +msgstr "" + +#. Tag: programlisting +#: basic_mapping.xml:1165 +#, no-c-format +msgid "" +"<id name=\"id\" type=\"long\" column=\"cat_id\">\n" +" <generator class=\"seqhilo\">\n" +" <param name=\"sequence\">hi_value</param>\n" +" <param name=\"max_lo\">100</param>\n" +" </generator>\n" +"</id>" +msgstr "" + #. Tag: para +#: basic_mapping.xml:1167 #, no-c-format msgid "" "Unfortunately, you cannot use hilo when supplying your " @@ -1124,11 +2588,13 @@ msgstr "" "hibernate.transaction.manager_lookup_class." #. Tag: title +#: basic_mapping.xml:1175 #, no-c-format msgid "UUID algorithm" msgstr "Algoritmo UUID" #. Tag: para +#: basic_mapping.xml:1177 #, no-c-format msgid "" "The UUID contains: IP address, startup time of the JVM that is accurate to a " @@ -1143,11 +2609,13 @@ msgstr "" "sin tener que utilizar JNI." #. Tag: title +#: basic_mapping.xml:1185 #, no-c-format msgid "Identity columns and sequences" msgstr "Columnas de identidad y secuencias" #. Tag: para +#: basic_mapping.xml:1187 #, no-c-format msgid "" "For databases that support identity columns (DB2, MySQL, Sybase, MS SQL), " @@ -1163,7 +2631,30 @@ msgstr "" "del estilo sequence. Ambas estrategias requieren dos " "consultas SQL para insertar un nuevo objeto. Por ejemplo:" +#. Tag: programlisting +#: basic_mapping.xml:1195 +#, no-c-format +msgid "" +"<id name=\"id\" type=\"long\" column=\"person_id\">\n" +" <generator class=\"sequence\">\n" +" <param name=\"sequence\">person_id_sequence</" +"param>\n" +" </generator>\n" +"</id>" +msgstr "" + +#. Tag: programlisting +#: basic_mapping.xml:1197 +#, no-c-format +msgid "" +"<id name=\"id\" type=\"long\" column=\"person_id\" unsaved-value=\"0" +"\">\n" +" <generator class=\"identity\"/>\n" +"</id>" +msgstr "" + #. Tag: para +#: basic_mapping.xml:1199 #, no-c-format msgid "" "For cross-platform development, the native strategy will, " @@ -1177,20 +2668,22 @@ msgstr "" "capacidades de la base de datos subyacente." #. Tag: title +#: basic_mapping.xml:1207 #, no-c-format msgid "Assigned identifiers" msgstr "Identificadores asignados" #. Tag: para -#, no-c-format +#: basic_mapping.xml:1209 +#, fuzzy, no-c-format msgid "" "If you want the application to assign identifiers, as opposed to having " "Hibernate generate them, you can use the assigned " "generator. This special generator uses the identifier value already assigned " "to the object's identifier property. The generator is used when the primary " "key is a natural key instead of a surrogate key. This is the default " -"behavior if you do not specify a <generator> " -"element." +"behavior if you do not specify @GeneratedValue nor " +"<generator> elements." msgstr "" "Si quiere que la aplicación asigne los identificadores, en contraposición a " "que los genere Hibernate, puede utilizar el generador assigned<generator>." #. Tag: para +#: basic_mapping.xml:1218 #, no-c-format msgid "" "The assigned generator makes Hibernate use " @@ -1216,18 +2710,34 @@ msgstr "" "que usted defina Interceptor.isUnsaved()." #. Tag: title +#: basic_mapping.xml:1226 #, no-c-format msgid "Primary keys assigned by triggers" msgstr "Claves primarias asignadas por disparadores" #. Tag: para +#: basic_mapping.xml:1228 #, no-c-format -msgid "Hibernate does not generate DDL with triggers. It is for legacy schemas only." +msgid "" +"Hibernate does not generate DDL with triggers. It is for legacy schemas only." msgstr "" "Hibernate no genera DDL con disparadores. Es para los esquemas heredados " "sólamente." +#. Tag: programlisting +#: basic_mapping.xml:1231 +#, no-c-format +msgid "" +"<id name=\"id\" type=\"long\" column=\"person_id\">\n" +" <generator class=\"select\">\n" +" <param name=\"key\">socialSecurityNumber</" +"param>\n" +" </generator>\n" +"</id>" +msgstr "" + #. Tag: para +#: basic_mapping.xml:1233 #, no-c-format msgid "" "In the above example, there is a unique valued property named " @@ -1241,11 +2751,91 @@ msgstr "" "literal>, cuyo valor es generado por un disparador." #. Tag: title +#: basic_mapping.xml:1241 +#, no-c-format +msgid "Identity copy (foreign generator)" +msgstr "" + +#. Tag: para +#: basic_mapping.xml:1243 +#, no-c-format +msgid "" +"Finally, you can ask Hibernate to copy the identifier from another " +"associated entity. In the Hibernate jargon, it is known as a foreign " +"generator but the JPA mapping reads better and is encouraged." +msgstr "" + +#. Tag: programlisting +#: basic_mapping.xml:1248 +#, no-c-format +msgid "" +"@Entity\n" +"class MedicalHistory implements Serializable {\n" +" @Id @OneToOne\n" +" @JoinColumn(name = \"person_id\")\n" +" Person patient;\n" +"}\n" +"\n" +"@Entity\n" +"public class Person implements Serializable {\n" +" @Id @GeneratedValue Integer id;\n" +"}" +msgstr "" + +#. Tag: para +#: basic_mapping.xml:1250 +#, fuzzy, no-c-format +msgid "Or alternatively" +msgstr "Alternativas de metadatos" + +#. Tag: programlisting +#: basic_mapping.xml:1252 +#, no-c-format +msgid "" +"@Entity\n" +"class MedicalHistory implements Serializable {\n" +" @Id Integer id;\n" +"\n" +" @MapsId @OneToOne\n" +" @JoinColumn(name = \"patient_id\")\n" +" Person patient;\n" +"}\n" +"\n" +"@Entity\n" +"class Person {\n" +" @Id @GeneratedValue Integer id;\n" +"}" +msgstr "" + +#. Tag: para +#: basic_mapping.xml:1254 +#, no-c-format +msgid "In hbm.xml use the following approach:" +msgstr "" + +#. Tag: programlisting +#: basic_mapping.xml:1256 +#, no-c-format +msgid "" +"<class name=\"MedicalHistory\">\n" +" <id name=\"id\">\n" +" <generator class=\"foreign\">\n" +" <param name=\"property\">patient</param>\n" +" </generator>\n" +" </id>\n" +" <one-to-one name=\"patient\" class=\"Person\" constrained=\"true\"/" +">\n" +"</class>" +msgstr "" + +#. Tag: title +#: basic_mapping.xml:1261 #, no-c-format msgid "Enhanced identifier generators" msgstr "Generadores mejorados del identificador" #. Tag: para +#: basic_mapping.xml:1263 #, no-c-format msgid "" "Starting with release 3.2.3, there are 2 new generators which represent a re-" @@ -1267,6 +2857,7 @@ msgstr "" "actuales y puede ser referenciados por FQN." #. Tag: para +#: basic_mapping.xml:1272 #, no-c-format msgid "" "The first of these new generators is org.hibernate.id.enhanced." @@ -1304,6 +2895,7 @@ msgstr "" "un número de parámetros de configuración:" #. Tag: para +#: basic_mapping.xml:1291 #, no-c-format msgid "" "sequence_name (optional, defaults to " @@ -1315,6 +2907,7 @@ msgstr "" "a utilizar." #. Tag: para +#: basic_mapping.xml:1297 #, no-c-format msgid "" "initial_value (optional, defaults to 1increment_size (optional - defaults to 1force_table_use (optional - defaults to falsevalue_column (optional - defaults to next_valoptimizer (optional - defaults to none): See " +"literal>): See" msgstr "" -"optimizer (opcional - por defecto es none): Consulte " +"cascade (opcional- por defecto es none): el estilo de cascada." #. Tag: para +#: basic_mapping.xml:1332 #, no-c-format msgid "" "The second of these new generators is org.hibernate.id.enhanced." @@ -1400,6 +2996,7 @@ msgstr "" "un número de parámetros de configuración:" #. Tag: para +#: basic_mapping.xml:1345 #, no-c-format msgid "" "table_name (optional - defaults to " @@ -1409,6 +3006,7 @@ msgstr "" "hibernate_sequences): el nombre de la tabla a utilizar." #. Tag: para +#: basic_mapping.xml:1351 #, no-c-format msgid "" "value_column_name (optional - defaults to " @@ -1420,6 +3018,7 @@ msgstr "" "utiliza para mantener el valor." #. Tag: para +#: basic_mapping.xml:1357 #, no-c-format msgid "" "segment_column_name (optional - defaults to " @@ -1433,6 +3032,7 @@ msgstr "" "identifica que valor de incremento utilizar." #. Tag: para +#: basic_mapping.xml:1365 #, no-c-format msgid "" "segment_value (optional - defaults to defaultsegment_value_length (optional - defaults to " @@ -1455,6 +3056,7 @@ msgstr "" "tamaño de la columna a crear esta columna de llave de segmento." #. Tag: para +#: basic_mapping.xml:1378 #, no-c-format msgid "" "initial_value (optional - defaults to 1): El valor inicial a recuperar de la tabla." #. Tag: para +#: basic_mapping.xml:1384 #, no-c-format msgid "" "increment_size (optional - defaults to 1optimizer (optional - defaults to ): " -"See " +"optimizer (optional - defaults to ??): " +"See ." msgstr "" "optimizer (opcional - por defecto es ): Consulte " #. Tag: title +#: basic_mapping.xml:1397 #, no-c-format msgid "Identifier generator optimization" msgstr "Optimización del generador del identificador" #. Tag: para -#, no-c-format +#: basic_mapping.xml:1399 +#, fuzzy, no-c-format msgid "" "For identifier generators that store values in the database, it is " "inefficient for them to hit the database on each and every call to generate " "a new identifier value. Instead, you can group a bunch of them in memory and " "only hit the database when you have exhausted your in-memory value group. " "This is the role of the pluggable optimizers. Currently only the two " -"enhanced generators ( " +"enhanced generators ( " "support this operation." msgstr "" "Para los generadores del identificador que almacenan valores en la base de " @@ -1508,6 +3114,7 @@ msgstr "" "\"mapping-declaration-id-enhanced\" />) soportan esta operación." #. Tag: para +#: basic_mapping.xml:1410 #, no-c-format msgid "" "none (generally this is the default if no optimizer was " @@ -1519,6 +3126,7 @@ msgstr "" "accederá a la base de datos para toda petición." #. Tag: para +#: basic_mapping.xml:1417 #, no-c-format msgid "" "hilo: applies a hi/lo algorithm around the database " @@ -1536,6 +3144,7 @@ msgstr "" "para definir un grupo \"hi value\"." #. Tag: para +#: basic_mapping.xml:1427 #, no-c-format msgid "" "pooled: as with the case of hilo, this " @@ -1554,391 +3163,91 @@ msgstr "" "la base de datos." #. Tag: title -#, no-c-format -msgid "composite-id" -msgstr "composite-id" +#: basic_mapping.xml:1441 +#, fuzzy, no-c-format +msgid "Partial identifier generation" +msgstr "Generadores mejorados del identificador" #. Tag: para +#: basic_mapping.xml:1443 #, no-c-format msgid "" -"A table with a composite key can be mapped with multiple properties of the " -"class as identifier properties. The <composite-id> " -"element accepts <key-property> property mappings " -"and <key-many-to-one> mappings as child elements." +"Hibernate supports the automatic generation of some of the identifier " +"properties. Simply use the @GeneratedValue annotation " +"on one or several id properties." msgstr "" -"Una tabla con clave compuesta se puede mapear con múltiples propiedades de " -"la clase como propiedades identificadoras. El elemento <" -"composite-id> acepta los mapeos de propiedad <key-" -"property> y los mapeos <key-many-to-one> como elementos hijos." #. Tag: para +#: basic_mapping.xml:1449 #, no-c-format msgid "" -"The persistent class must override equals() and hashCode() to implement composite identifier " -"equality. It must also implement Serializable." +"The Hibernate team has always felt such a construct as fundamentally wrong. " +"Try hard to fix your data model before using this feature." msgstr "" -"La clase persistente tiene que sobrescribir " -"equals() y hashCode() para implementar " -"la igualdad del identificador compuesto. También tiene que implementar " -"Serializable." -#. Tag: para +#. Tag: programlisting +#: basic_mapping.xml:1454 #, no-c-format msgid "" -"Unfortunately, this approach means that a persistent object is its own " -"identifier. There is no convenient \"handle\" other than the object itself. " -"You must instantiate an instance of the persistent class itself and populate " -"its identifier properties before you can load() the " -"persistent state associated with a composite key. We call this approach an " -"embedded composite identifier, and discourage it for " -"serious applications." +"@Entity\n" +"public class CustomerInventory implements Serializable {\n" +" @Id\n" +" @TableGenerator(name = \"inventory\",\n" +" table = \"U_SEQUENCES\",\n" +" pkColumnName = \"S_ID\",\n" +" valueColumnName = \"S_NEXTNUM\",\n" +" pkColumnValue = \"inventory\",\n" +" allocationSize = 1000)\n" +" @GeneratedValue(strategy = GenerationType.TABLE, generator = \"inventory" +"\")\n" +" Integer id;\n" +"\n" +"\n" +" @Id @ManyToOne(cascade = CascadeType.MERGE)\n" +" Customer customer;\n" +"}\n" +"\n" +"@Entity\n" +"public class Customer implements Serializable {\n" +" @Id\n" +" private int id;\n" +"}" msgstr "" -"Desafortunadamente, este enfoque significa que un objeto persistente es su " -"propio identificador. No existe otra \"asa\" conveniente más que el objeto " -"mismo. Debe instanciar una instancia de la clase persistente y poblar sus " -"propiedades identificadoras antes de que pueda load() el " -"estado persistente asociado a una clave compuesta. Este enfoque lo " -"denominamos un identificador compuesto incluído y no lo " -"recomendamos para aplicaciones serias." #. Tag: para +#: basic_mapping.xml:1456 #, no-c-format msgid "" -"A second approach is what we call a mapped composite " -"identifier, where the identifier properties named inside the <" -"composite-id> element are duplicated on both the persistent " -"class and a separate identifier class." +"You can also generate properties inside an @EmbeddedId class." msgstr "" -"Un segundo enfoque es lo que denominamos un identificador compuesto " -"mapeado, en donde las propiedades del identificador " -"nombradas dentro del elemento <composite-id> son " -"duplicadas tanto en la clase persistente como en la clase identificadora " -"separada." - -#. Tag: para -#, no-c-format -msgid "" -"In this example, both the composite identifier class, MedicareId, and the entity class itself have properties named " -"medicareNumber and dependent. The " -"identifier class must override equals() and " -"hashCode() and implement Serializable. " -"The main disadvantage of this approach is code duplication." -msgstr "" -"En este ejemplo, tanto la clase identificadora compuesta " -"MedicareId como la clase de entidad misma tienen " -"propiedades denominadas medicareNumber y " -"dependent. La clase identificadora tiene que sobrescribir " -"equals() y hashCode() e implementar " -"Serializable. La desventaja principal de este enfoque es " -"la duplicación de código." - -#. Tag: para -#, no-c-format -msgid "The following attributes are used to specify a mapped composite identifier:" -msgstr "" -"Los siguientes atributos se utilizan para especificar un identificador " -"compuesto mapeado:" - -#. Tag: para -#, no-c-format -msgid "" -"mapped (optional - defaults to false): " -"indicates that a mapped composite identifier is used, and that the contained " -"property mappings refer to both the entity class and the composite " -"identifier class." -msgstr "" -"mapped (opcional, por defecto es false): indica que se utiliza un identificador compuesto mapeado y que " -"los mapeos de propiedad contenidos se refieren tanto a la clase de entidad " -"como a la clase identificadora compuesta. " - -#. Tag: para -#, no-c-format -msgid "" -"class (optional - but required for a mapped composite " -"identifier): the class used as a composite identifier." -msgstr "" -"class (opcional, pero requerida por un identificador " -"compuesto mapeado): La clase se utiliza como un identificador compuesto. " - -#. Tag: para -#, no-c-format -msgid "" -"We will describe a third, even more convenient approach, where the composite " -"identifier is implemented as a component class in . The attributes described below apply only to this " -"alternative approach:" -msgstr "" -"Vamos a decribir un tercer enfoque, aún más práctico, en donde se implementa " -"el identificador compuesto como una clase componente en . Los atributos descritos a continuación " -"sólamente aplican a este enfoque alternativo:" - -#. Tag: para -#, no-c-format -msgid "" -"name (optional - required for this approach): a property " -"of component type that holds the composite identifier. Please see chapter 9 " -"for more information." -msgstr "" -"name (opcional, se necesita para este enfoque): Una " -"propiedad de tipo componente que tiene el identificador compuesto. Consulte " -"el capítulo 9 para obtener mayor información. " - -#. Tag: para -#, no-c-format -msgid "" -"access (optional - defaults to property): the strategy Hibernate uses for accessing the property value." -msgstr "" -"access (opcional - por defecto es property): La estrategia que Hibernate utiliza para acceder al valor de la " -"propiedad." - -#. Tag: para -#, no-c-format -msgid "" -"class (optional - defaults to the property type " -"determined by reflection): the component class used as a composite " -"identifier. Please see the next section for more information." -msgstr "" -"class (opcional - por defecto es el tipo de propiedad " -"determinado por la reflección): la clase componente utilizada como un " -"identificador compuesto. Vea la siguiente sección para obtener mayor " -"información." - -#. Tag: para -#, no-c-format -msgid "" -"The third approach, an identifier component, is " -"recommended for almost all applications." -msgstr "" -"Este tercer enfoque, un componente identificador es el " -"que recomendamos para casi todas las aplicaciones. " #. Tag: title +#: basic_mapping.xml:1462 #, no-c-format -msgid "Discriminator" -msgstr "Discriminador" +msgid "Optimistic locking properties (optional)" +msgstr "" #. Tag: para +#: basic_mapping.xml:1464 #, no-c-format msgid "" -"The <discriminator> element is required for " -"polymorphic persistence using the table-per-class-hierarchy mapping " -"strategy. It declares a discriminator column of the table. The discriminator " -"column contains marker values that tell the persistence layer what subclass " -"to instantiate for a particular row. A restricted set of types can be used: " -"string, character, integer, byte, short, " -"boolean, yes_no, true_false." +"When using long transactions or conversations that span several database " +"transactions, it is useful to store versioning data to ensure that if the " +"same entity is updated by two conversations, the last to commit changes will " +"be informed and not override the other conversation's work. It guarantees " +"some isolation while still allowing for good scalability and works " +"particularly well in read-often write-sometimes situations." msgstr "" -"Se necesita el elemento <discriminator> para la " -"persistencia polimórfica utilizando la estrategia de mapeo de tabla-por-" -"jerarquía-de-clases. Declara una columna discriminadora de la tabla. La " -"columna discriminidora contiene valores de marca que le dicen a la capa de " -"persistencia qué subclase instanciar para una fila en particular. Se puede " -"utilizar un conjunto restringido de tipos: string, " -"character, integer, byte, short, boolean, " -"yes_no, true_false." #. Tag: para +#: basic_mapping.xml:1472 #, no-c-format -msgid "" -"column (optional - defaults to class): " -"the name of the discriminator column." +msgid "You can use two approaches: a dedicated version number or a timestamp." msgstr "" -"column (opcional - por defecto es class) el nombre de la columna discriminadora. " - -#. Tag: para -#, no-c-format -msgid "" -"type (optional - defaults to string): " -"a name that indicates the Hibernate type" -msgstr "" -"type (opcional - por defecto es string) un nombre que indica el tipo Hibernate. " - -#. Tag: para -#, no-c-format -msgid "" -"force (optional - defaults to false): " -"\"forces\" Hibernate to specify the allowed discriminator values, even when " -"retrieving all instances of the root class." -msgstr "" -"force (opcional - por defecto es false) \"fuerza\" a Hibernate para especificar los valores " -"discriminadores permitidos incluso cuando se recuperan todas las instancias " -"de la clase raíz. " - -#. Tag: para -#, no-c-format -msgid "" -"insert (optional - defaults to true): " -"set this to false if your discriminator column is also " -"part of a mapped composite identifier. It tells Hibernate not to include the " -"column in SQL INSERTs." -msgstr "" -"insert (opcional - por defecto es true): establecido como false si su columna " -"discriminadora también es parte de un identificador mapeado compuesto. Lle " -"dice a Hibernate que no incluya la columna en los SQLs INSERT." - -#. Tag: para -#, no-c-format -msgid "" -"formula (optional): an arbitrary SQL expression that is " -"executed when a type has to be evaluated. It allows content-based " -"discrimination." -msgstr "" -"formula (opcional): una expresión SQL arbitraria que se " -"ejecuta cuando se tenga que evaluar un tipo. Permite la discriminación con " -"base en el contenido." - -#. Tag: para -#, no-c-format -msgid "" -"Actual values of the discriminator column are specified by the " -"discriminator-value attribute of the <" -"class> and <subclass> elements." -msgstr "" -"Los valores reales de la columna discriminadora están especificados por el " -"atributo discriminator-value de los elementos " -"<class> y <subclass>." - -#. Tag: para -#, no-c-format -msgid "" -"The force attribute is only useful if the table contains " -"rows with \"extra\" discriminator values that are not mapped to a persistent " -"class. This will not usually be the case." -msgstr "" -"El atributo force es sólamente útil si la tabla contiene " -"filas con valores discriminadores \"extra\" que no estén mapeados a una " -"clase persistente. Generalmente este no es el caso." - -#. Tag: para -#, no-c-format -msgid "" -"The formula attribute allows you to declare an arbitrary " -"SQL expression that will be used to evaluate the type of a row. For example:" -msgstr "" -"El atributo formula le permite declarar una expresión SQL " -"arbitraria que será utilizada para evaluar el tipo de una fila. Por ejemplo: " - -#. Tag: title -#, no-c-format -msgid "Version (optional)" -msgstr "Versión (opcional)" - -#. Tag: para -#, no-c-format -msgid "" -"The <version> element is optional and indicates " -"that the table contains versioned data. This is particularly useful if you " -"plan to use long transactions. See below for more " -"information:" -msgstr "" -"El elemento <version> es opcional e indica que la " -"tabla contiene datos versionados. Esto es particularmente útil si planea " -"utilizar transacciones largas. Vea a continuación para " -"obtener mayor información:" - -#. Tag: para -#, no-c-format -msgid "" -"column (optional - defaults to the property name): the " -"name of the column holding the version number." -msgstr "" -"column (opcional - por defecto es el nombre de la " -"propiedad): El nombre de la columna que tiene el número de la versión." - -#. Tag: para -#, no-c-format -msgid "name: the name of a property of the persistent class." -msgstr "name: El nombre de una propiedad de la clase persistente. " - -#. Tag: para -#, no-c-format -msgid "" -"type (optional - defaults to integer): " -"the type of the version number." -msgstr "" -"type (opcional - por defecto es integer): El tipo del número de la versión. " - -#. Tag: para -#, no-c-format -msgid "" -"access (optional - defaults to property): the strategy Hibernate uses to access the property value." -msgstr "" -"access (opcional - por defecto es property): La estrategia que Hibernate utiliza para acceder al valor de la " -"propiedad. " - -#. Tag: para -#, no-c-format -msgid "" -"unsaved-value (optional - defaults to undefined): a version property value that indicates that an instance is newly " -"instantiated (unsaved), distinguishing it from detached instances that were " -"saved or loaded in a previous session. Undefined " -"specifies that the identifier property value should be used." -msgstr "" -"unsaved-value (opcional - por defecto es " -"undefined): Un valor de la propiedad de versión que " -"indica que una instancia se encuentra recién instanciada (sin guardar), " -"distinguiéndola de las instancias separadas que se guardaron o se cargaron " -"en una sesión previa. undefined especifica que se debe " -"utilizar el valor de la propiedad identificadora." - -#. Tag: para -#, no-c-format -msgid "" -"generated (optional - defaults to never): specifies that this version property value is generated by the " -"database. See the discussion of generated properties for more information." -msgstr "" -"generated (opcional - por defecto es never): Especifica que este valor de la propiedad de la versión es " -"generado por la base de datos. Vea la discusión de las propiedades generadas para obtener mayor información." - -#. Tag: para -#, no-c-format -msgid "" -"insert (optional - defaults to true): " -"specifies whether the version column should be included in SQL insert " -"statements. It can be set to false if the database column " -"is defined with a default value of 0." -msgstr "" -"insert (opcional - por defectos es true): Especifica si la columna de la versión debe incluirse en las " -"declaraciones de inserción SQL. Se puede configurar como false si la columna de la base de datos se define con un valor " -"predeterminado de 0." - -#. Tag: para -#, no-c-format -msgid "" -"Version numbers can be of Hibernate type long, " -"integer, short, timestamp or calendar." -msgstr "" -"Los números de versión pueden ser de tipo Hibernate long, " -"integer, short, timestamp o calendar." #. Tag: para +#: basic_mapping.xml:1475 #, no-c-format msgid "" "A version or timestamp property should never be null for a detached " @@ -1959,17 +3268,192 @@ msgstr "" "claves compuestas." #. Tag: title +#: basic_mapping.xml:1485 #, no-c-format -msgid "Timestamp (optional)" +msgid "Version number" +msgstr "" + +#. Tag: para +#: basic_mapping.xml:1487 +#, no-c-format +msgid "" +"You can add optimistic locking capability to an entity using the " +"@Version annotation:" +msgstr "" + +#. Tag: programlisting +#: basic_mapping.xml:1490 +#, no-c-format +msgid "" +"@Entity\n" +"public class Flight implements Serializable {\n" +"...\n" +" @Version\n" +" @Column(name=\"OPTLOCK\")\n" +" public Integer getVersion() { ... }\n" +"}" +msgstr "" + +#. Tag: para +#: basic_mapping.xml:1492 +#, no-c-format +msgid "" +"The version property will be mapped to the OPTLOCK " +"column, and the entity manager will use it to detect conflicting updates " +"(preventing lost updates you might otherwise see with the last-commit-wins " +"strategy)." +msgstr "" + +#. Tag: para +#: basic_mapping.xml:1497 +#, no-c-format +msgid "" +"The version column may be a numeric. Hibernate supports any kind of type " +"provided that you define and implement the appropriate " +"UserVersionType." +msgstr "" + +#. Tag: para +#: basic_mapping.xml:1501 +#, no-c-format +msgid "" +"The application must not alter the version number set up by Hibernate in any " +"way. To artificially increase the version number, check in Hibernate Entity " +"Manager's reference documentation LockModeType." +"OPTIMISTIC_FORCE_INCREMENT or LockModeType." +"PESSIMISTIC_FORCE_INCREMENT." +msgstr "" + +#. Tag: para +#: basic_mapping.xml:1507 +#, no-c-format +msgid "" +"If the version number is generated by the database (via a trigger for " +"example), make sure to use @org.hibernate.annotations.Generated" +"(GenerationTime.ALWAYS)." +msgstr "" + +#. Tag: para +#: basic_mapping.xml:1511 +#, no-c-format +msgid "To declare a version property in hbm.xml, use:" +msgstr "" + +#. Tag: programlisting +#: basic_mapping.xml:1530 +#, no-c-format +msgid "" +"<version\n" +" column=\"version_column\"\n" +" name=\"propertyName\"\n" +" type=\"typename\"\n" +" access=\"field|property|ClassName\"\n" +" unsaved-value=\"null|negative|undefined\"\n" +" generated=\"never|always\"\n" +" insert=\"true|false\"\n" +" node=\"element-name|@attribute-name|element/@attribute|.\"\n" +"/>" +msgstr "" + +#. Tag: para +#: basic_mapping.xml:1534 +#, no-c-format +msgid "" +"column (optional - defaults to the property name): the " +"name of the column holding the version number." +msgstr "" +"column (opcional - por defecto es el nombre de la " +"propiedad): El nombre de la columna que tiene el número de la versión." + +#. Tag: para +#: basic_mapping.xml:1540 +#, no-c-format +msgid "" +"name: the name of a property of the persistent class." +msgstr "" +"name: El nombre de una propiedad de la clase persistente. " + +#. Tag: para +#: basic_mapping.xml:1545 +#, no-c-format +msgid "" +"type (optional - defaults to integer): " +"the type of the version number." +msgstr "" +"type (opcional - por defecto es integer): El tipo del número de la versión. " + +#. Tag: para +#: basic_mapping.xml:1551 +#, no-c-format +msgid "" +"access (optional - defaults to property): the strategy Hibernate uses to access the property value." +msgstr "" +"access (opcional - por defecto es property): La estrategia que Hibernate utiliza para acceder al valor de la " +"propiedad. " + +#. Tag: para +#: basic_mapping.xml:1557 +#, no-c-format +msgid "" +"unsaved-value (optional - defaults to undefined): a version property value that indicates that an instance is newly " +"instantiated (unsaved), distinguishing it from detached instances that were " +"saved or loaded in a previous session. Undefined " +"specifies that the identifier property value should be used." +msgstr "" +"unsaved-value (opcional - por defecto es " +"undefined): Un valor de la propiedad de versión que " +"indica que una instancia se encuentra recién instanciada (sin guardar), " +"distinguiéndola de las instancias separadas que se guardaron o se cargaron " +"en una sesión previa. undefined especifica que se debe " +"utilizar el valor de la propiedad identificadora." + +#. Tag: para +#: basic_mapping.xml:1567 +#, no-c-format +msgid "" +"generated (optional - defaults to never): specifies that this version property value is generated by the " +"database. See the discussion of generated properties for more information." +msgstr "" +"generated (opcional - por defecto es never): Especifica que este valor de la propiedad de la versión es " +"generado por la base de datos. Vea la discusión de las propiedades generadas para obtener mayor " +"información." + +#. Tag: para +#: basic_mapping.xml:1575 +#, no-c-format +msgid "" +"insert (optional - defaults to true): " +"specifies whether the version column should be included in SQL insert " +"statements. It can be set to false if the database column " +"is defined with a default value of 0." +msgstr "" +"insert (opcional - por defectos es true): Especifica si la columna de la versión debe incluirse en las " +"declaraciones de inserción SQL. Se puede configurar como false si la columna de la base de datos se define con un valor " +"predeterminado de 0." + +#. Tag: title +#: basic_mapping.xml:1586 +#, fuzzy, no-c-format +msgid "Timestamp" msgstr "Timestamp (opcional)" #. Tag: para -#, no-c-format +#: basic_mapping.xml:1588 +#, fuzzy, no-c-format msgid "" -"The optional <timestamp> element indicates that the " -"table contains timestamped data. This provides an alternative to versioning. " -"Timestamps are a less safe implementation of optimistic locking. However, " -"sometimes the application might use the timestamps in other ways." +"Alternatively, you can use a timestamp. Timestamps are a less safe " +"implementation of optimistic locking. However, sometimes the application " +"might use the timestamps in other ways." msgstr "" "El elemento opcional <timestamp> indica que la " "tabla contiene datos con sellos de fecha. Esto brinda una alternativa al " @@ -1978,6 +3462,59 @@ msgstr "" "aplicación puede usar los sellos de fecha de otras maneras." #. Tag: para +#: basic_mapping.xml:1592 +#, no-c-format +msgid "" +"Simply mark a property of type Date or " +"Calendar as @Version." +msgstr "" + +#. Tag: programlisting +#: basic_mapping.xml:1596 +#, no-c-format +msgid "" +"@Entity\n" +"public class Flight implements Serializable {\n" +"...\n" +" @Version\n" +" public Date getLastUpdate() { ... }\n" +"}" +msgstr "" + +#. Tag: para +#: basic_mapping.xml:1598 +#, no-c-format +msgid "" +"Like version numbers, the timestamp can be generated by the database instead " +"of Hibernate. To do that, use @org.hibernate.annotations.Generated" +"(GenerationTime.ALWAYS)." +msgstr "" + +#. Tag: para +#: basic_mapping.xml:1602 +#, fuzzy, no-c-format +msgid "In hbm.xml, use the <timestamp> element:" +msgstr "" +"Por ejemplo, si tenemos el siguiente mapeo de <properties>:" + +#. Tag: programlisting +#: basic_mapping.xml:1620 +#, no-c-format +msgid "" +"<timestamp\n" +" column=\"timestamp_column\"\n" +" name=\"propertyName\"\n" +" access=\"field|property|ClassName\"\n" +" unsaved-value=\"null|undefined\"\n" +" source=\"vm|db\"\n" +" generated=\"never|always\"\n" +" node=\"element-name|@attribute-name|element/@attribute|.\"\n" +"/>" +msgstr "" + +#. Tag: para +#: basic_mapping.xml:1624 #, no-c-format msgid "" "column (optional - defaults to the property name): the " @@ -1987,6 +3524,7 @@ msgstr "" "propiedad): El nombre de una columna que tiene el sello de fecha. " #. Tag: para +#: basic_mapping.xml:1630 #, no-c-format msgid "" "name: the name of a JavaBeans style property of Java type " @@ -1998,6 +3536,19 @@ msgstr "" "persistente. " #. Tag: para +#: basic_mapping.xml:1636 basic_mapping.xml:2163 basic_mapping.xml:2380 +#: basic_mapping.xml:3226 basic_mapping.xml:3420 basic_mapping.xml:3593 +#, no-c-format +msgid "" +"access (optional - defaults to property): the strategy Hibernate uses for accessing the property value." +msgstr "" +"access (opcional - por defecto es property): La estrategia que Hibernate utiliza para acceder al valor de la " +"propiedad." + +#. Tag: para +#: basic_mapping.xml:1642 #, no-c-format msgid "" "unsaved-value (optional - defaults to nullsource (optional - defaults to vm): " @@ -2036,6 +3588,7 @@ msgstr "" "debido a la falta de precisión (por ejemplo, Oracle 8)." #. Tag: para +#: basic_mapping.xml:1665 #, no-c-format msgid "" "generated (optional - defaults to nevergenerated (opcional - por defecto es never): Especifica que este valor de la propiedad del sello de fecha en " -"realidad es generado por la base de datos. Consulte la discusión de las propiedades generadas para obtener mayor información." +"realidad es generado por la base de datos. Consulte la discusión de las " +"propiedades generadas para " +"obtener mayor información." #. Tag: title +#: basic_mapping.xml:1675 #, no-c-format msgid "Note" msgstr "Nota" #. Tag: para +#: basic_mapping.xml:1677 #, no-c-format msgid "" "<Timestamp> is equivalent to <version " @@ -2067,11 +3623,800 @@ msgstr "" "literal>." #. Tag: title +#: basic_mapping.xml:1686 #, no-c-format msgid "Property" msgstr "Propiedad" #. Tag: para +#: basic_mapping.xml:1688 +#, no-c-format +msgid "" +"You need to decide which property needs to be made persistent in a given " +"entity. This differs slightly between the annotation driven metadata and the " +"hbm.xml files." +msgstr "" + +#. Tag: title +#: basic_mapping.xml:1693 +#, no-c-format +msgid "Property mapping with annotations" +msgstr "" + +#. Tag: para +#: basic_mapping.xml:1695 +#, no-c-format +msgid "" +"In the annotations world, every non static non transient property (field or " +"method depending on the access type) of an entity is considered persistent, " +"unless you annotate it as @Transient. Not having an " +"annotation for your property is equivalent to the appropriate " +"@Basic annotation." +msgstr "" + +#. Tag: para +#: basic_mapping.xml:1702 +#, no-c-format +msgid "" +"The @Basic annotation allows you to declare the fetching " +"strategy for a property. If set to LAZY, specifies that " +"this property should be fetched lazily when the instance variable is first " +"accessed. It requires build-time bytecode instrumentation, if your classes " +"are not instrumented, property level lazy loading is silently ignored. The " +"default is EAGER. You can also mark a property as not " +"optional thanks to the @Basic.optional attribute. " +"This will ensure that the underlying column are not nullable (if possible). " +"Note that a better approach is to use the @NotNull " +"annotation of the Bean Validation specification." +msgstr "" + +#. Tag: para +#: basic_mapping.xml:1715 +#, no-c-format +msgid "Let's look at a few examples:" +msgstr "" + +#. Tag: programlisting +#: basic_mapping.xml:1717 +#, no-c-format +msgid "" +"public transient int counter; //transient property\n" +"\n" +"private String firstname; //persistent property\n" +"\n" +"@Transient\n" +"String getLengthInMeter() { ... } //transient property\n" +"\n" +"String getName() {... } // persistent property\n" +"\n" +"@Basic\n" +"int getLength() { ... } // persistent property\n" +"\n" +"@Basic(fetch = FetchType.LAZY)\n" +"String getDetailedComment() { ... } // persistent property\n" +"\n" +"@Temporal(TemporalType.TIME)\n" +"java.util.Date getDepartureTime() { ... } // persistent property \n" +"\n" +"@Enumerated(EnumType.STRING)\n" +"Starred getNote() { ... } //enum persisted as String in database" +msgstr "" + +#. Tag: para +#: basic_mapping.xml:1719 +#, no-c-format +msgid "" +"counter, a transient field, and lengthInMeter, a method annotated as @Transient, and will be " +"ignored by the Hibernate. name, length, and firstname properties are mapped persistent " +"and eagerly fetched (the default for simple properties). The " +"detailedComment property value will be lazily fetched " +"from the database once a lazy property of the entity is accessed for the " +"first time. Usually you don't need to lazy simple properties (not to be " +"confused with lazy association fetching). The recommended alternative is to " +"use the projection capability of JP-QL (Java Persistence Query Language) or " +"Criteria queries." +msgstr "" + +#. Tag: para +#: basic_mapping.xml:1732 +#, no-c-format +msgid "" +"JPA support property mapping of all basic types supported by Hibernate (all " +"basic Java types , their respective wrappers and serializable classes). " +"Hibernate Annotations supports out of the box enum type mapping either into " +"a ordinal column (saving the enum ordinal) or a string based column (saving " +"the enum string representation): the persistence representation, defaulted " +"to ordinal, can be overridden through the @Enumerated " +"annotation as shown in the note property example." +msgstr "" + +#. Tag: para +#: basic_mapping.xml:1742 +#, no-c-format +msgid "" +"In plain Java APIs, the temporal precision of time is not defined. When " +"dealing with temporal data you might want to describe the expected precision " +"in database. Temporal data can have DATE, TIME, or TIMESTAMP precision (ie the actual date, " +"only the time, or both). Use the @Temporal annotation to " +"fine tune that." +msgstr "" + +#. Tag: para +#: basic_mapping.xml:1750 +#, no-c-format +msgid "" +"@Lob indicates that the property should be persisted in a " +"Blob or a Clob depending on the property type: java.sql.Clob, Character[], char[] and java.lang.String will be persisted in " +"a Clob. java.sql.Blob, Byte[], " +"byte[] and Serializable type " +"will be persisted in a Blob." +msgstr "" + +#. Tag: programlisting +#: basic_mapping.xml:1759 +#, no-c-format +msgid "" +"@Lob\n" +"public String getFullText() {\n" +" return fullText;\n" +"}\n" +"\n" +"@Lob\n" +"public byte[] getFullCode() {\n" +" return fullCode;\n" +"}" +msgstr "" + +#. Tag: para +#: basic_mapping.xml:1761 +#, no-c-format +msgid "" +"If the property type implements java.io.Serializable " +"and is not a basic type, and if the property is not annotated with " +"@Lob, then the Hibernate serializable " +"type is used." +msgstr "" + +#. Tag: title +#: basic_mapping.xml:1768 +#, no-c-format +msgid "Type" +msgstr "" + +#. Tag: para +#: basic_mapping.xml:1770 +#, no-c-format +msgid "" +"You can also manually specify a type using the @org.hibernate." +"annotations.Type and some parameters if needed. @Type." +"type could be:" +msgstr "" + +#. Tag: para +#: basic_mapping.xml:1777 basic_mapping.xml:2209 +#, no-c-format +msgid "" +"The name of a Hibernate basic type: integer, string, character, " +"date, timestamp, float, binary, serializable, object, blob etc." +msgstr "" +"El nombre de un tipo básico de Hibernate: integer, string, " +"character, date, timestamp, float, binary, serializable, object, blob, etc." + +#. Tag: para +#: basic_mapping.xml:1783 basic_mapping.xml:2215 +#, no-c-format +msgid "" +"The name of a Java class with a default basic type: int, float, " +"char, java.lang.String, java.util.Date, java.lang.Integer, java.sql.Clob etc." +msgstr "" +"El nombre de una clase Java con un tipo básico predeterminado: int, " +"float, char, java.lang.String, java.util.Date, java.lang.Integer, java.sql." +"Clob, etc." + +#. Tag: para +#: basic_mapping.xml:1789 basic_mapping.xml:2221 +#, no-c-format +msgid "The name of a serializable Java class." +msgstr "El nombre de una clase Java serializable." + +#. Tag: para +#: basic_mapping.xml:1793 basic_mapping.xml:2225 +#, no-c-format +msgid "" +"The class name of a custom type: com.illflow.type.MyCustomType etc." +msgstr "" +"El nombre declase de un tipo personalizado: com.illflow.type." +"MyCustomType etc." + +#. Tag: para +#: basic_mapping.xml:1798 +#, fuzzy, no-c-format +msgid "" +"If you do not specify a type, Hibernate will use reflection upon the named " +"property and guess the correct Hibernate type. Hibernate will attempt to " +"interpret the name of the return class of the property getter using, in " +"order, rules 2, 3, and 4." +msgstr "" +"Si no especifica un tipo, Hibernate utilizará reflección sobre la propiedad " +"mencionada para deducir el tipo Hibernate correcto. Hibernate intentará " +"interpretar el nombre de la clase de retorno del getter de la propiedad " +"utilizando las reglas 2, 3 y 4 en ese mismo orden. En algunos casos " +"necesitará el atributo type. Por ejemplo, para distinguir " +"entre Hibernate.DATE y Hibernate.TIMESTAMP, o especificar un tipo personalizado." + +#. Tag: para +#: basic_mapping.xml:1803 +#, no-c-format +msgid "" +"@org.hibernate.annotations.TypeDef and @org." +"hibernate.annotations.TypeDefs allows you to declare type " +"definitions. These annotations can be placed at the class or package level. " +"Note that these definitions are global for the session factory (even when " +"defined at the class level). If the type is used on a single entity, you can " +"place the definition on the entity itself. Otherwise, it is recommended to " +"place the definition at the package level. In the example below, when " +"Hibernate encounters a property of class PhoneNumer, it " +"delegates the persistence strategy to the custom mapping type " +"PhoneNumberType. However, properties belonging to other " +"classes, too, can delegate their persistence strategy to " +"PhoneNumberType, by explicitly using the @Type annotation." +msgstr "" + +#. Tag: para +#: basic_mapping.xml:1819 +#, no-c-format +msgid "" +"Package level annotations are placed in a file named package-info." +"java in the appropriate package. Place your annotations before " +"the package declaration." +msgstr "" + +#. Tag: programlisting +#: basic_mapping.xml:1824 +#, no-c-format +msgid "" +"@TypeDef(\n" +" name = \"phoneNumber\",\n" +" defaultForType = PhoneNumber.class,\n" +" typeClass = PhoneNumberType.class\n" +")\n" +"\n" +"@Entity\n" +"public class ContactDetails {\n" +" [...]\n" +" private PhoneNumber localPhoneNumber;\n" +" @Type(type=\"phoneNumber\")\n" +" private OverseasPhoneNumber overseasPhoneNumber;\n" +" [...]\n" +"}" +msgstr "" + +#. Tag: para +#: basic_mapping.xml:1826 +#, no-c-format +msgid "" +"The following example shows the usage of the parameters " +"attribute to customize the TypeDef." +msgstr "" + +#. Tag: programlisting +#: basic_mapping.xml:1830 +#, no-c-format +msgid "" +"//in org/hibernate/test/annotations/entity/package-info.java\n" +"@TypeDefs(\n" +" {\n" +" @TypeDef(\n" +" name=\"caster\",\n" +" typeClass = CasterStringType.class,\n" +" parameters = {\n" +" @Parameter(name=\"cast\", value=\"lower\")\n" +" }\n" +" )\n" +" }\n" +")\n" +"package org.hibernate.test.annotations.entity;\n" +"\n" +"//in org/hibernate/test/annotations/entity/Forest.java\n" +"public class Forest {\n" +" @Type(type=\"caster\")\n" +" public String getSmallText() {\n" +" ...\n" +"}" +msgstr "" + +#. Tag: para +#: basic_mapping.xml:1832 +#, no-c-format +msgid "" +"When using composite user type, you will have to express column definitions. " +"The @Columns has been introduced for that purpose." +msgstr "" + +#. Tag: programlisting +#: basic_mapping.xml:1836 +#, no-c-format +msgid "" +"@Type(type=\"org.hibernate.test.annotations.entity.MonetaryAmountUserType" +"\")\n" +"@Columns(columns = {\n" +" @Column(name=\"r_amount\"),\n" +" @Column(name=\"r_currency\")\n" +"})\n" +"public MonetaryAmount getAmount() {\n" +" return amount;\n" +"}\n" +"\n" +"\n" +"public class MonetaryAmount implements Serializable {\n" +" private BigDecimal amount;\n" +" private Currency currency;\n" +" ...\n" +"}" +msgstr "" + +#. Tag: title +#: basic_mapping.xml:1840 +#, no-c-format +msgid "Access type" +msgstr "" + +#. Tag: para +#: basic_mapping.xml:1842 +#, no-c-format +msgid "" +"By default the access type of a class hierarchy is defined by the position " +"of the @Id or @EmbeddedId " +"annotations. If these annotations are on a field, then only fields are " +"considered for persistence and the state is accessed via the field. If there " +"annotations are on a getter, then only the getters are considered for " +"persistence and the state is accessed via the getter/setter. That works well " +"in practice and is the recommended approach." +msgstr "" + +#. Tag: para +#: basic_mapping.xml:1850 +#, no-c-format +msgid "" +"The placement of annotations within a class hierarchy has to be consistent " +"(either field or on property) to be able to determine the default access " +"type. It is recommended to stick to one single annotation placement strategy " +"throughout your whole application." +msgstr "" + +#. Tag: para +#: basic_mapping.xml:1857 +#, no-c-format +msgid "However in some situations, you need to:" +msgstr "" + +#. Tag: para +#: basic_mapping.xml:1861 +#, no-c-format +msgid "force the access type of the entity hierarchy" +msgstr "" + +#. Tag: para +#: basic_mapping.xml:1865 +#, no-c-format +msgid "override the access type of a specific entity in the class hierarchy" +msgstr "" + +#. Tag: para +#: basic_mapping.xml:1870 +#, no-c-format +msgid "override the access type of an embeddable type" +msgstr "" + +#. Tag: para +#: basic_mapping.xml:1874 +#, no-c-format +msgid "" +"The best use case is an embeddable class used by several entities that might " +"not use the same access type. In this case it is better to force the access " +"type at the embeddable class level." +msgstr "" + +#. Tag: para +#: basic_mapping.xml:1879 +#, no-c-format +msgid "" +"To force the access type on a given class, use the @Access annotation as showed below:" +msgstr "" + +#. Tag: programlisting +#: basic_mapping.xml:1882 +#, no-c-format +msgid "" +"@Entity\n" +"public class Order {\n" +" @Id private Long id;\n" +" public Long getId() { return id; }\n" +" public void setId(Long id) { this.id = id; }\n" +"\n" +" @Embedded private Address address;\n" +" public Address getAddress() { return address; }\n" +" public void setAddress() { this.address = address; }\n" +"}\n" +"\n" +"@Entity\n" +"public class User {\n" +" private Long id;\n" +" @Id public Long getId() { return id; }\n" +" public void setId(Long id) { this.id = id; }\n" +"\n" +" private Address address;\n" +" @Embedded public Address getAddress() { return address; }\n" +" public void setAddress() { this.address = address; }\n" +"}\n" +"\n" +"@Embeddable\n" +"@Access(AcessType.PROPERTY)\n" +"public class Address {\n" +" private String street1;\n" +" public String getStreet1() { return street1; }\n" +" public void setStreet1() { this.street1 = street1; }\n" +"\n" +" private hashCode; //not persistent\n" +"}" +msgstr "" + +#. Tag: para +#: basic_mapping.xml:1884 +#, no-c-format +msgid "" +"You can also override the access type of a single property while keeping the " +"other properties standard." +msgstr "" + +#. Tag: programlisting +#: basic_mapping.xml:1887 +#, no-c-format +msgid "" +"@Entity\n" +"public class Order {\n" +" @Id private Long id;\n" +" public Long getId() { return id; }\n" +" public void setId(Long id) { this.id = id; }\n" +" @Transient private String userId;\n" +" @Transient private String orderId;\n" +"\n" +" @Access(AccessType.PROPERTY)\n" +" public String getOrderNumber() { return userId + \":\" + orderId; }\n" +" public void setOrderNumber() { this.userId = ...; this.orderId = ...; }\n" +"}" +msgstr "" + +#. Tag: para +#: basic_mapping.xml:1889 +#, no-c-format +msgid "" +"In this example, the default access type is FIELD " +"except for the orderNumber property. Note that the " +"corresponding field, if any must be marked as @Transient or transient." +msgstr "" + +#. Tag: title +#: basic_mapping.xml:1896 +#, no-c-format +msgid "@org.hibernate.annotations.AccessType" +msgstr "" + +#. Tag: para +#: basic_mapping.xml:1898 +#, no-c-format +msgid "" +"The annotation @org.hibernate.annotations.AccessType " +"should be considered deprecated for FIELD and PROPERTY access. It is still " +"useful however if you need to use a custom access type." +msgstr "" + +#. Tag: title +#: basic_mapping.xml:1907 +#, no-c-format +msgid "Optimistic lock" +msgstr "" + +#. Tag: para +#: basic_mapping.xml:1909 +#, no-c-format +msgid "" +"It is sometimes useful to avoid increasing the version number even if a " +"given property is dirty (particularly collections). You can do that by " +"annotating the property (or collection) with @OptimisticLock" +"(excluded=true)." +msgstr "" + +#. Tag: para +#: basic_mapping.xml:1914 +#, no-c-format +msgid "" +"More formally, specifies that updates to this property do not require " +"acquisition of the optimistic lock." +msgstr "" + +#. Tag: title +#: basic_mapping.xml:1919 +#, no-c-format +msgid "Declaring column attributes" +msgstr "" + +#. Tag: para +#: basic_mapping.xml:1921 +#, no-c-format +msgid "" +"The column(s) used for a property mapping can be defined using the " +"@Column annotation. Use it to override default values " +"(see the JPA specification for more information on the defaults). You can " +"use this annotation at the property level for properties that are:" +msgstr "" + +#. Tag: para +#: basic_mapping.xml:1929 +#, no-c-format +msgid "not annotated at all" +msgstr "" + +#. Tag: para +#: basic_mapping.xml:1933 +#, fuzzy, no-c-format +msgid "annotated with @Basic" +msgstr "assigned" + +#. Tag: para +#: basic_mapping.xml:1937 +#, fuzzy, no-c-format +msgid "annotated with @Version" +msgstr "string" + +#. Tag: para +#: basic_mapping.xml:1941 +#, fuzzy, no-c-format +msgid "annotated with @Lob" +msgstr "hilo" + +#. Tag: para +#: basic_mapping.xml:1945 +#, fuzzy, no-c-format +msgid "annotated with @Temporal" +msgstr "serializable" + +#. Tag: programlisting +#: basic_mapping.xml:1949 +#, no-c-format +msgid "" +"@Entity\n" +"public class Flight implements Serializable {\n" +"...\n" +"@Column(updatable = false, name = \"flight_name\", nullable = false, " +"length=50)\n" +"public String getName() { ... }" +msgstr "" + +#. Tag: para +#: basic_mapping.xml:1951 +#, no-c-format +msgid "" +"The name property is mapped to the flight_name column, which is not nullable, has a length of 50 and is not " +"updatable (making the property immutable)." +msgstr "" + +#. Tag: para +#: basic_mapping.xml:1956 +#, no-c-format +msgid "" +"This annotation can be applied to regular properties as well as " +"@Id or @Version properties." +msgstr "" + +#. Tag: programlisting +#: basic_mapping.xml:1983 +#, no-c-format +msgid "" +"@Column(\n" +" name=\"columnName\";\n" +" boolean unique() default false;\n" +" boolean nullable() default true;\n" +" boolean insertable() default true;\n" +" boolean updatable() default true;\n" +" String columnDefinition() default \"\";\n" +" String table() default \"\";\n" +" int length() default 255;\n" +" int precision() default 0; // decimal precision\n" +" int scale() default 0; // decimal scale" +msgstr "" + +#. Tag: para +#: basic_mapping.xml:1987 +#, fuzzy, no-c-format +msgid "" +"name (optional): the column name (default to the property " +"name)" +msgstr "" +"name (opcional): El nombre de la propiedad del " +"identificador. s" + +#. Tag: para +#: basic_mapping.xml:1992 +#, fuzzy, no-c-format +msgid "" +"unique (optional): set a unique constraint on this column " +"or not (default false)" +msgstr "" +"unique (opcional): Activa la generación DDL de una " +"restricción de unicidad para las columnas. Además, permite que ésta sea el " +"objetivo de una property-ref. " + +#. Tag: para +#: basic_mapping.xml:1997 +#, fuzzy, no-c-format +msgid "" +"nullable (optional): set the column as nullable (default " +"true)." +msgstr "" +"name (opcional): El nombre de la propiedad del " +"identificador. s" + +#. Tag: para +#: basic_mapping.xml:2002 +#, fuzzy, no-c-format +msgid "" +"insertable (optional): whether or not the column will be " +"part of the insert statement (default true)" +msgstr "" +"name (opcional): El nombre de la propiedad del " +"identificador. s" + +#. Tag: para +#: basic_mapping.xml:2008 +#, fuzzy, no-c-format +msgid "" +"updatable (optional): whether or not the column will be " +"part of the update statement (default true)" +msgstr "" +"catalog (opcional): El nombre de un catálogo de la base " +"de datos. " + +#. Tag: para +#: basic_mapping.xml:2014 +#, no-c-format +msgid "" +"columnDefinition (optional): override the sql DDL " +"fragment for this particular column (non portable)" +msgstr "" + +#. Tag: para +#: basic_mapping.xml:2020 +#, fuzzy, no-c-format +msgid "" +"table (optional): define the targeted table (default " +"primary table)" +msgstr "" +"catalog (opcional): El nombre de un catálogo de la base " +"de datos. " + +#. Tag: para +#: basic_mapping.xml:2025 +#, no-c-format +msgid "" +"length (optional): column length " +"(default 255)" +msgstr "" + +#. Tag: para +#: basic_mapping.xml:2030 +#, no-c-format +msgid "" +"precision (optional): column decimal " +"precision (default 0)" +msgstr "" + +#. Tag: para +#: basic_mapping.xml:2035 +#, no-c-format +msgid "" +"scale (optional): column decimal scale " +"if useful (default 0)" +msgstr "" + +#. Tag: title +#: basic_mapping.xml:2043 +#, no-c-format +msgid "Formula" +msgstr "" + +#. Tag: para +#: basic_mapping.xml:2045 +#, no-c-format +msgid "" +"Sometimes, you want the Database to do some computation for you rather than " +"in the JVM, you might also create some kind of virtual column. You can use a " +"SQL fragment (aka formula) instead of mapping a property into a column. This " +"kind of property is read only (its value is calculated by your formula " +"fragment)." +msgstr "" + +#. Tag: programlisting +#: basic_mapping.xml:2051 +#, no-c-format +msgid "" +"@Formula(\"obj_length * obj_height * obj_width\")\n" +"public long getObjectVolume()" +msgstr "" + +#. Tag: para +#: basic_mapping.xml:2053 +#, no-c-format +msgid "" +"The SQL fragment can be as complex as you want and even include subselects." +msgstr "" + +#. Tag: title +#: basic_mapping.xml:2058 +#, no-c-format +msgid "Non-annotated property defaults" +msgstr "" + +#. Tag: para +#: basic_mapping.xml:2060 +#, no-c-format +msgid "If a property is not annotated, the following rules apply:" +msgstr "" + +#. Tag: para +#: basic_mapping.xml:2063 +#, no-c-format +msgid "If the property is of a single type, it is mapped as @Basic" +msgstr "" + +#. Tag: para +#: basic_mapping.xml:2068 +#, no-c-format +msgid "" +"Otherwise, if the type of the property is annotated as @Embeddable, it is " +"mapped as @Embedded" +msgstr "" + +#. Tag: para +#: basic_mapping.xml:2073 +#, no-c-format +msgid "" +"Otherwise, if the type of the property is Serializable, it is mapped as @Basic in a column " +"holding the object in its serialized version" +msgstr "" + +#. Tag: para +#: basic_mapping.xml:2080 +#, no-c-format +msgid "" +"Otherwise, if the type of the property is java.sql.Clob or java.sql.Blob, it is mapped as " +"@Lob with the appropriate LobType" +msgstr "" + +#. Tag: title +#: basic_mapping.xml:2091 +#, no-c-format +msgid "Property mapping with hbm.xml" +msgstr "" + +#. Tag: para +#: basic_mapping.xml:2093 #, no-c-format msgid "" "The <property> element declares a persistent " @@ -2080,7 +4425,34 @@ msgstr "" "El elemento <property> declara una propiedad " "persistente estilo JavaBean de la clase. " +#. Tag: programlisting +#: basic_mapping.xml:2125 +#, no-c-format +msgid "" +"<property\n" +" name=\"propertyName\"\n" +" column=\"column_name\"\n" +" type=\"typename\"\n" +" update=\"true|false\"\n" +" insert=\"true|false\"\n" +" formula=\"arbitrary SQL expression\"\n" +" access=\"field|property|ClassName\"\n" +" lazy=\"true|false\"\n" +" unique=\"true|false\"\n" +" not-null=\"true|false\"\n" +" optimistic-lock=\"true|false\"\n" +" generated=\"never|insert|always\"\n" +" node=\"element-name|@attribute-name|element/@attribute|.\"\n" +" index=\"index_name\"\n" +" unique_key=\"unique_key_id\"\n" +" length=\"L\"\n" +" precision=\"P\"\n" +" scale=\"S\"\n" +"/>" +msgstr "" + #. Tag: para +#: basic_mapping.xml:2129 #, no-c-format msgid "" "name: the name of the property, with an initial lowercase " @@ -2090,6 +4462,7 @@ msgstr "" "minúscula." #. Tag: para +#: basic_mapping.xml:2134 #, no-c-format msgid "" "column (optional - defaults to the property name): the " @@ -2102,6 +4475,7 @@ msgstr "" "<column>." #. Tag: para +#: basic_mapping.xml:2146 #, no-c-format msgid "" "update, insert (optional - defaults to trueformula (optional): an SQL expression that defines the " @@ -2130,6 +4505,7 @@ msgstr "" "computadas no tienen una columna mapeada propia." #. Tag: para +#: basic_mapping.xml:2169 #, no-c-format msgid "" "lazy (optional - defaults to false): " @@ -2142,6 +4518,7 @@ msgstr "" "instrumentación de código byte en tiempo de compilación." #. Tag: para +#: basic_mapping.xml:2176 #, no-c-format msgid "" "unique (optional): enables the DDL generation of a unique " @@ -2153,6 +4530,7 @@ msgstr "" "objetivo de una property-ref. " #. Tag: para +#: basic_mapping.xml:2183 #, no-c-format msgid "" "not-null (optional): enables the DDL generation of a " @@ -2162,6 +4540,7 @@ msgstr "" "restricción de nulabilidad para las columnas. " #. Tag: para +#: basic_mapping.xml:2188 basic_mapping.xml:3246 #, no-c-format msgid "" "optimistic-lock (optional - defaults to truegenerated (optional - defaults to neverpropiedades generadas para obtener mayor información. " #. Tag: para +#: basic_mapping.xml:2205 #, no-c-format msgid "typename could be:" msgstr "escribanombre puede ser:" #. Tag: para -#, no-c-format -msgid "" -"The name of a Hibernate basic type: integer, string, character, " -"date, timestamp, float, binary, serializable, object, blob etc." -msgstr "" -"El nombre de un tipo básico de Hibernate: integer, string, " -"character, date, timestamp, float, binary, serializable, object, blob, etc." - -#. Tag: para -#, no-c-format -msgid "" -"The name of a Java class with a default basic type: int, float, " -"char, java.lang.String, java.util.Date, java.lang.Integer, java.sql.Clob etc." -msgstr "" -"El nombre de una clase Java con un tipo básico predeterminado: int, " -"float, char, java.lang.String, java.util.Date, java.lang.Integer, java.sql." -"Clob, etc." - -#. Tag: para -#, no-c-format -msgid "The name of a serializable Java class." -msgstr "El nombre de una clase Java serializable." - -#. Tag: para -#, no-c-format -msgid "" -"The class name of a custom type: com.illflow.type.MyCustomType etc." -msgstr "" -"El nombre declase de un tipo personalizado: com.illflow.type." -"MyCustomType etc." - -#. Tag: para +#: basic_mapping.xml:2230 #, no-c-format msgid "" "If you do not specify a type, Hibernate will use reflection upon the named " @@ -2248,6 +4595,7 @@ msgstr "" "literal>, o especificar un tipo personalizado." #. Tag: para +#: basic_mapping.xml:2239 #, no-c-format msgid "" "The access attribute allows you to control how Hibernate " @@ -2268,6 +4616,7 @@ msgstr "" "literal>." #. Tag: para +#: basic_mapping.xml:2248 #, no-c-format msgid "" "A powerful feature is derived properties. These properties are by definition " @@ -2281,7 +4630,20 @@ msgstr "" "una expresión SQL y ésta se traduce como una cláusula de subconsulta " "SELECT en la consulta SQL que carga una instancia:" +#. Tag: programlisting +#: basic_mapping.xml:2254 +#, no-c-format +msgid "" +"<property name=\"totalPrice\"\n" +" formula=\"( SELECT SUM (li.quantity*p.price) FROM LineItem li, Product " +"p\n" +" WHERE li.productId = p.productId\n" +" AND li.customerId = customerId\n" +" AND li.orderNumber = orderNumber )\"/>" +msgstr "" + #. Tag: para +#: basic_mapping.xml:2256 #, no-c-format msgid "" "You can reference the entity table by not declaring an alias on a particular " @@ -2295,477 +4657,18 @@ msgstr "" " si no quiere utilizar el atributo." #. Tag: title +#: basic_mapping.xml:2265 #, no-c-format -msgid "Many-to-one" -msgstr "Many-to-one" - -#. Tag: para -#, no-c-format -msgid "" -"An ordinary association to another persistent class is declared using a " -"many-to-one element. The relational model is a many-to-" -"one association; a foreign key in one table is referencing the primary key " -"column(s) of the target table." +msgid "Embedded objects (aka components)" msgstr "" -"Una asociación ordinaria a otra clase persistente se declara utilizando el " -"elemento many-to-one. El modelo relacional es una " -"asociación muchos-a-uno; una clave foránea en una tabla referencia la " -"columna (o columnas) de la clave principal de la tabla destino." #. Tag: para -#, no-c-format -msgid "name: the name of the property." -msgstr "name: El nombre de la propiedad. " - -#. Tag: para -#, no-c-format +#: basic_mapping.xml:2267 +#, fuzzy, no-c-format msgid "" -"column (optional): the name of the foreign key column. " -"This can also be specified by nested <column> " -"element(s)." -msgstr "" -"column (opcional): El nombre de la columna de la clave " -"foránea. Esto también se puede especificar por medio de uno o varios " -"elementos anidados <column>. " - -#. Tag: para -#, no-c-format -msgid "" -"class (optional - defaults to the property type " -"determined by reflection): the name of the associated class." -msgstr "" -"class (opcional - por defecto es el tipo de la propiedad " -"determinado por reflección): El nombre de la clase asociada. " - -#. Tag: para -#, no-c-format -msgid "" -"cascade (optional): specifies which operations should be " -"cascaded from the parent object to the associated object." -msgstr "" -"cascade (opcional) especifica qué operaciones deben ir en " -"cascada desde el objeto padre hasta el objeto asociado. " - -#. Tag: para -#, no-c-format -msgid "" -"fetch (optional - defaults to select): " -"chooses between outer-join fetching or sequential select fetching." -msgstr "" -"fetch (opcional - por defecto es select): Escoge entre la recuperación de unión exterior (outer-join) o la " -"recuperación por selección secuencial." - -#. Tag: para -#, no-c-format -msgid "" -"update, insert (optional - defaults to true): specifies that the mapped columns should be included in SQL " -"UPDATE and/or INSERT statements. " -"Setting both to false allows a pure \"derived\" " -"association whose value is initialized from another property that maps to " -"the same column(s), or by a trigger or other application." -msgstr "" -"update, insert (opcional - por defecto es true) especifica que las columnas mapeadas deben ser incluídas en las " -"declaraciones SQL UPDATE y/o INSERT. " -"El establecer ambas como false permite una asociación " -"puramente \"derivada\" cuyo valor es inicializado desde alguna otra " -"propiedad que mapea a la misma columna (o columnas), por un disparador o por " -"otra aplicación." - -#. Tag: para -#, no-c-format -msgid "" -"property-ref (optional): the name of a property of the " -"associated class that is joined to this foreign key. If not specified, the " -"primary key of the associated class is used." -msgstr "" -"property-ref: (opcional): El nombre de una propiedad de " -"la clase asociada que se encuentra unida a su llave foránea. Si no se " -"especifica, se utiliza la llave principal de la clase asociada." - -#. Tag: para -#, no-c-format -msgid "" -"unique (optional): enables the DDL generation of a unique " -"constraint for the foreign-key column. By allowing this to be the target of " -"a property-ref, you can make the association multiplicity " -"one-to-one." -msgstr "" -"unique (opcional): Activa la generación DDL de una " -"restricción de unicidad para la columna de clave foránea. Además, permite " -"que éste sea el objetivo de una property-ref. puede hacer " -"que la asociación sea de multiplicidad uno-a-uno." - -#. Tag: para -#, no-c-format -msgid "" -"not-null (optional): enables the DDL generation of a " -"nullability constraint for the foreign key columns." -msgstr "" -"not-null (opcional): Activa la generación DDL de una " -"restricción de nulabilidad para las columnas de clave foránea. " - -#. Tag: para -#, no-c-format -msgid "" -"lazy (optional - defaults to proxy): " -"by default, single point associations are proxied. lazy=\"no-proxy" -"\" specifies that the property should be fetched lazily when the " -"instance variable is first accessed. This requires build-time bytecode " -"instrumentation. lazy=\"false\" specifies that the " -"association will always be eagerly fetched." -msgstr "" -"lazy (opcional - por defecto es proxy): Por defecto, las asociaciones de punto único van con proxies. " -"lazy=\"no-proxy\" especifica que esta propiedad debe ser " -"recuperada perezosamente cuando se acceda por primera vez a la variable de " -"instancia. Requiere instrumentación del código byte en tiempo de " -"compilación. lazy=\"false\" especifica que la asociación " -"siempre será recuperada tempranamente." - -#. Tag: para -#, no-c-format -msgid "" -"not-found (optional - defaults to exception): specifies how foreign keys that reference missing rows will be " -"handled. ignore will treat a missing row as a null " -"association." -msgstr "" -"not-found (opcional - por defecto es exception): Especifica cómo se manejarán las claves foráneas que referencian " -"las filas que hacen falta. ignore tratará una fila " -"perdida como una asociación nula." - -#. Tag: para -#, no-c-format -msgid "" -"entity-name (optional): the entity name of the associated " -"class." -msgstr "" -"entity-name (opcional): El nombre de entidad de la clase " -"asociada. " - -#. Tag: para -#, no-c-format -msgid "" -"formula (optional): an SQL expression that defines the " -"value for a computed foreign key." -msgstr "" -"formula (opcional): una expresión SQL que define el valor " -"para una clave foránea computada." - -#. Tag: para -#, no-c-format -msgid "" -"Setting a value of the cascade attribute to any " -"meaningful value other than none will propagate certain " -"operations to the associated object. The meaningful values are divided into " -"three categories. First, basic operations, which include: persist, " -"merge, delete, save-update, evict, replicate, lock and refresh; " -"second, special values: delete-orphan; and third," -"all comma-separated combinations of operation names: " -"cascade=\"persist,merge,evict\" or cascade=\"all," -"delete-orphan\". See " -"for a full explanation. Note that single valued, many-to-one and one-to-one, " -"associations do not support orphan delete." -msgstr "" -"Establecer el valor del atributo cascade con cualquier " -"valor significativo diferente de none propagará ciertas " -"operaciones al objeto asociado. Los valores significativos están divididos " -"en tres categorías. Primero, las operaciones básicas, las cuales incluyen: " -"persist, merge, delete, save-update, evict, replicate, lock y " -"refresh; segundo, los valores especiales delete-orphan y tercero, all y las combinaciones de " -"operaciones separadas por comas: cascade=\"persist,merge,evict\" o cascade=\"all,delete-orphan\". Consulte y allí encontrará una explicación " -"completa. Observe que las asociaciones con valores únicos, asociaciones " -"muchos-a-uno y uno-a-uno no soportan el borrado de huérfanos." - -#. Tag: para -#, no-c-format -msgid "Here is an example of a typical many-to-one declaration:" -msgstr "Este es un ejemplo de una declaración típica muchos-a-uno:" - -#. Tag: para -#, no-c-format -msgid "" -"The property-ref attribute should only be used for " -"mapping legacy data where a foreign key refers to a unique key of the " -"associated table other than the primary key. This is a complicated and " -"confusing relational model. For example, if the Product " -"class had a unique serial number that is not the primary key. The " -"unique attribute controls Hibernate's DDL generation with " -"the SchemaExport tool." -msgstr "" -"El atributo property-ref se debe utilizar sólamente para " -"el mapeo de datos heredados donde una clave foránea referencia una clave " -"única de la tabla asociada, distinta de la clave principal. Este es un " -"modelo relacional complicado y confuso. Por ejemplo, si la clase " -"Product tuviera un número único serial que no es la clave " -"principal, el atributo unique controla la generación de " -"DDL de Hibernate con la herramienta SchemaExport." - -#. Tag: para -#, no-c-format -msgid "Then the mapping for OrderItem might use:" -msgstr "Entonces el mapeo para OrderItem puede utilizar:" - -#. Tag: para -#, no-c-format -msgid "This is not encouraged, however." -msgstr "Sin embargo, esto ciertamente no se aconseja. " - -#. Tag: para -#, no-c-format -msgid "" -"If the referenced unique key comprises multiple properties of the associated " -"entity, you should map the referenced properties inside a named <" -"properties> element." -msgstr "" -"Si la clave única referenciada abarca múltiples propiedades de la entidad " -"asociada, debe mapear las propiedades dentro de un elemento nombrado " -"<properties>." - -#. Tag: para -#, no-c-format -msgid "" -"If the referenced unique key is the property of a component, you can specify " -"a property path:" -msgstr "" -"Si la clave única referenciada es propiedad de un componente, usted puede " -"especificar una ruta de propiedad: " - -#. Tag: title -#, no-c-format -msgid "One-to-one" -msgstr "One-to-one" - -#. Tag: para -#, no-c-format -msgid "" -"A one-to-one association to another persistent class is declared using a " -"one-to-one element." -msgstr "" -"Una asociación uno-a-uno (one-to-one) a otra clase persistente se declara " -"utilizando un elemento one-to-one." - -#. Tag: para -#, no-c-format -msgid "" -"constrained (optional): specifies that a foreign key " -"constraint on the primary key of the mapped table and references the table " -"of the associated class. This option affects the order in which save" -"() and delete() are cascaded, and determines " -"whether the association can be proxied. It is also used by the schema export " -"tool." -msgstr "" -"constrained (opcional): especifica que una restricción de " -"clave foránea en la clave principal de la tabla mapeada referencia la tabla " -"de la clase asociada. Esta opción afecta el orden en que van en la cascada " -"save() y delete() y determina si la " -"asociación puede ser virtualizada por proxies. La herramienta de exportación " -"de esquemas también lo utiliza." - -#. Tag: para -#, no-c-format -msgid "" -"property-ref (optional): the name of a property of the " -"associated class that is joined to the primary key of this class. If not " -"specified, the primary key of the associated class is used." -msgstr "" -"property-ref (opcional): El nombre de una propiedad de la " -"clase asociada que esté unida a la clave principal de esta clase. Si no se " -"especifica, se utiliza la clave principal de la clase asociada." - -#. Tag: para -#, no-c-format -msgid "" -"formula (optional): almost all one-to-one associations " -"map to the primary key of the owning entity. If this is not the case, you " -"can specify another column, columns or expression to join on using an SQL " -"formula. See org.hibernate.test.onetooneformula for an " -"example." -msgstr "" -"formula (opcional): Casi todas las asociaciones uno-a-uno " -"mapean a la clave principal de la entidad propietaria. Si este no es el " -"caso, puede especificar otra columna, o columnas, o una expresión para unir " -"utilizando una fórmula SQL. Para un obtener un ejemplo consulte org." -"hibernate.test.onetooneformula." - -#. Tag: para -#, no-c-format -msgid "" -"lazy (optional - defaults to proxy): " -"by default, single point associations are proxied. lazy=\"no-proxy" -"\" specifies that the property should be fetched lazily when the " -"instance variable is first accessed. It requires build-time bytecode " -"instrumentation. lazy=\"false\" specifies that the " -"association will always be eagerly fetched. Note that if " -"constrained=\"false\", proxying is impossible and " -"Hibernate will eagerly fetch the association." -msgstr "" -"lazy (opcional - por defecto es proxy): Por defecto, las asociaciones de punto único van con proxies. " -"lazy=\"no-proxy\" especifica que esta propiedad debe ser " -"traída perezosamente cuando se acceda por primera vez la variable de " -"instancia. Requiere instrumentación del código byte en tiempo de " -"compilación. lazy=\"false\" especifica que la asociación " -"siempre será recuperada tempranamente. Observe que si " -"constrained=\"false\", la aplicación de proxies es " -"imposible e Hibernate recuperará tempranamente la asociación." - -#. Tag: para -#, no-c-format -msgid "There are two varieties of one-to-one associations:" -msgstr "Existen dos variedades de asociaciones uno-a-uno: " - -#. Tag: para -#, no-c-format -msgid "primary key associations" -msgstr "asociaciones de clave primaria" - -#. Tag: para -#, no-c-format -msgid "unique foreign key associations" -msgstr "asociaciones de clave foránea única" - -#. Tag: para -#, no-c-format -msgid "" -"Primary key associations do not need an extra table column. If two rows are " -"related by the association, then the two table rows share the same primary " -"key value. To relate two objects by a primary key association, ensure that " -"they are assigned the same identifier value." -msgstr "" -"Las asociaciones de claves principales no necesitan una columna extra de la " -"tabla. Si dos filas están relacionadas por la asociación entonces las dos " -"filas de tablas comparten el mismo valor de clave principal. Para que dos " -"objetos estén relacionados por una asociación de clave principal, asegúrese " -"de que se les asigne el mismo valor de identificador." - -#. Tag: para -#, no-c-format -msgid "" -"For a primary key association, add the following mappings to " -"Employee and Person respectively:" -msgstr "" -"Para una asociación de clave principal, agregue los siguientes mapeos a " -"Employee y Person respectivamente:" - -#. Tag: para -#, no-c-format -msgid "" -"Ensure that the primary keys of the related rows in the PERSON and EMPLOYEE " -"tables are equal. You use a special Hibernate identifier generation strategy " -"called foreign:" -msgstr "" -"Asegúrese de que las claves principales de las filas relacionadas en las " -"tablas PERSON y EMPLOYEE sean iguales. Utilizamos una estrategia especial de " -"generación de identificador de Hibernate denominada foreign:" - -#. Tag: para -#, no-c-format -msgid "" -"A newly saved instance of Person is assigned the same " -"primary key value as the Employee instance referred with " -"the employee property of that Person." -msgstr "" -"A una instancia recién guardada de Person se le asigna el " -"mismo valor de clave principal que se le asignó a la instancia " -"Employee referida por la propiedad employee de esa Person." - -#. Tag: para -#, no-c-format -msgid "" -"Alternatively, a foreign key with a unique constraint, from " -"Employee to Person, can be expressed " -"as:" -msgstr "" -"Opcionalmente, una clave foránea con una restricción de unicidad, desde " -"Employee a Person, se puede expresar " -"como:" - -#. Tag: para -#, no-c-format -msgid "" -"This association can be made bidirectional by adding the following to the " -"Person mapping:" -msgstr "" -"Esta asociación puede hacerse bidireccional agregando lo siguiente al mapeo " -"de Person:" - -#. Tag: title -#, no-c-format -msgid "Natural-id" -msgstr "Natural-id" - -#. Tag: para -#, no-c-format -msgid "" -"Although we recommend the use of surrogate keys as primary keys, you should " -"try to identify natural keys for all entities. A natural key is a property " -"or combination of properties that is unique and non-null. It is also " -"immutable. Map the properties of the natural key inside the <" -"natural-id> element. Hibernate will generate the necessary " -"unique key and nullability constraints and, as a result, your mapping will " -"be more self-documenting." -msgstr "" -"Aunque recomendamos el uso de claves delegadas como claves principales, debe " -"tratar de identificar claves naturales para todas las entidades. Una clave " -"natural es una propiedad o combinación de propiedades que es única y no " -"nula. También es inmutable. Mapea las propiedades de la clave natural dentro " -"del elemento <natural-id>. Hibernate generará las " -"restricciones de nulabilidad y de clave única necesarias y su mapeo será más " -"auto-documentado." - -#. Tag: para -#, no-c-format -msgid "" -"It is recommended that you implement equals() and " -"hashCode() to compare the natural key properties of the " -"entity." -msgstr "" -"Le recomendamos bastante que implemente equals() y " -"hashCode() para comparar las propiedades de clave natural " -"de la entidad. " - -#. Tag: para -#, no-c-format -msgid "" -"This mapping is not intended for use with entities that have natural primary " -"keys." -msgstr "" -"Este mapeo no está concebido para la utilización con entidades que tienen " -"claves principales naturales." - -#. Tag: para -#, no-c-format -msgid "" -"mutable (optional - defaults to false): by default, natural identifier properties are assumed to be " -"immutable (constant)." -msgstr "" -"mutable (opcional - por defecto es false): Por defecto, se asume que las propiedades de identificadores " -"naturales son inmutables (constantes)." - -#. Tag: title -#, no-c-format -msgid "Component and dynamic-component" -msgstr "Componente y componente dinámico" - -#. Tag: para -#, no-c-format -msgid "" -"The <component> element maps properties of a child " -"object to columns of the table of a parent class. Components can, in turn, " -"declare their own properties, components or collections. See the \"Component" -"\" examples below:" +"Embeddable objects (or components) are objects whose properties are mapped " +"to the same table as the owning entity's table. Components can, in turn, " +"declare their own properties, components or collections" msgstr "" "El elemento <component> mapea propiedades de un " "objeto hijo a columnas de la tabla de la clase padre. Los componentes " @@ -2773,6 +4676,193 @@ msgstr "" "colecciones. Vea a continuación los \"componentes\":" #. Tag: para +#: basic_mapping.xml:2272 +#, no-c-format +msgid "" +"It is possible to declare an embedded component inside an entity and even " +"override its column mapping. Component classes have to be annotated at the " +"class level with the @Embeddable annotation. It is " +"possible to override the column mapping of an embedded object for a " +"particular entity using the @Embedded and " +"@AttributeOverride annotation in the associated property:" +msgstr "" + +#. Tag: programlisting +#: basic_mapping.xml:2280 +#, no-c-format +msgid "" +"@Entity\n" +"public class Person implements Serializable {\n" +"\n" +" // Persistent component using defaults\n" +" Address homeAddress;\n" +"\n" +" @Embedded\n" +" @AttributeOverrides( {\n" +" @AttributeOverride(name=\"iso2\", column = @Column(name=" +"\"bornIso2\") ),\n" +" @AttributeOverride(name=\"name\", column = @Column(name=" +"\"bornCountryName\") )\n" +" } )\n" +" Country bornIn;\n" +" ...\n" +"}" +msgstr "" + +#. Tag: programlisting +#: basic_mapping.xml:2282 +#, no-c-format +msgid "" +"@Embeddable\n" +"public class Address implements Serializable {\n" +" String city;\n" +" Country nationality; //no overriding here\n" +"}" +msgstr "" + +#. Tag: programlisting +#: basic_mapping.xml:2284 +#, no-c-format +msgid "" +"@Embeddable\n" +"public class Country implements Serializable {\n" +" private String iso2;\n" +" @Column(name=\"countryName\") private String name;\n" +"\n" +" public String getIso2() { return iso2; }\n" +" public void setIso2(String iso2) { this.iso2 = iso2; }\n" +"\n" +" \n" +" public String getName() { return name; }\n" +" public void setName(String name) { this.name = name; }\n" +" ...\n" +"}" +msgstr "" + +#. Tag: para +#: basic_mapping.xml:2286 +#, no-c-format +msgid "" +"An embeddable object inherits the access type of its owning entity (note " +"that you can override that using the @Access annotation)." +msgstr "" + +#. Tag: para +#: basic_mapping.xml:2290 +#, no-c-format +msgid "" +"The Person entity has two component properties, " +"homeAddress and bornIn. " +"homeAddress property has not been annotated, but " +"Hibernate will guess that it is a persistent component by looking for the " +"@Embeddable annotation in the Address class. We also " +"override the mapping of a column name (to bornCountryName) with the @Embedded and " +"@AttributeOverride annotations for each mapped attribute " +"of Country. As you can see, Country is " +"also a nested component of Address, again using auto-" +"detection by Hibernate and JPA defaults. Overriding columns of embedded " +"objects of embedded objects is through dotted expressions." +msgstr "" + +#. Tag: programlisting +#: basic_mapping.xml:2305 +#, no-c-format +msgid "" +"@Embedded\n" +" @AttributeOverrides( {\n" +" @AttributeOverride(name=\"city\", column = @Column(name=" +"\"fld_city\") ),\n" +" @AttributeOverride(name=\"nationality.iso2\", column = @Column" +"(name=\"nat_Iso2\") ),\n" +" @AttributeOverride(name=\"nationality.name\", column = @Column" +"(name=\"nat_CountryName\") )\n" +" //nationality columns in homeAddress are overridden\n" +" } )\n" +" Address homeAddress;" +msgstr "" + +#. Tag: para +#: basic_mapping.xml:2307 +#, no-c-format +msgid "" +"Hibernate Annotations supports something that is not explicitly supported by " +"the JPA specification. You can annotate a embedded object with the " +"@MappedSuperclass annotation to make the superclass " +"properties persistent (see @MappedSuperclass for more " +"informations)." +msgstr "" + +#. Tag: para +#: basic_mapping.xml:2313 +#, no-c-format +msgid "" +"You can also use association annotations in an embeddable object (ie " +"@OneToOne, @ManyToOne, " +"@OneToMany or @ManyToMany). To " +"override the association columns you can use @AssociationOverride." +msgstr "" + +#. Tag: para +#: basic_mapping.xml:2319 +#, no-c-format +msgid "" +"If you want to have the same embeddable object type twice in the same " +"entity, the column name defaulting will not work as several embedded objects " +"would share the same set of columns. In plain JPA, you need to override at " +"least one set of columns. Hibernate, however, allows you to enhance the " +"default naming mechanism through the NamingStrategy " +"interface. You can write a strategy that prevent name clashing in such a " +"situation. DefaultComponentSafeNamingStrategy is an " +"example of this." +msgstr "" + +#. Tag: para +#: basic_mapping.xml:2329 +#, no-c-format +msgid "" +"If a property of the embedded object points back to the owning entity, " +"annotate it with the @Parent annotation. Hibernate " +"will make sure this property is properly loaded with the entity reference." +msgstr "" + +#. Tag: para +#: basic_mapping.xml:2334 +#, no-c-format +msgid "In XML, use the <component> element." +msgstr "" + +#. Tag: programlisting +#: basic_mapping.xml:2356 +#, no-c-format +msgid "" +"<component\n" +" name=\"propertyName\"\n" +" class=\"className\"\n" +" insert=\"true|false\"\n" +" update=\"true|false\"\n" +" access=\"field|property|ClassName\"\n" +" lazy=\"true|false\"\n" +" optimistic-lock=\"true|false\"\n" +" unique=\"true|false\"\n" +" node=\"element-name|.\"\n" +">\n" +"\n" +" <property ...../>\n" +" <many-to-one .... />\n" +" ........\n" +"</component>" +msgstr "" + +#. Tag: para +#: basic_mapping.xml:2360 basic_mapping.xml:3181 basic_mapping.xml:3381 +#, no-c-format +msgid "name: the name of the property." +msgstr "name: El nombre de la propiedad. " + +#. Tag: para +#: basic_mapping.xml:2364 #, no-c-format msgid "" "class (optional - defaults to the property type " @@ -2782,6 +4872,7 @@ msgstr "" "determinado por reflección): El nombre de la clase del componente (hijo). " #. Tag: para +#: basic_mapping.xml:2370 basic_mapping.xml:3641 #, no-c-format msgid "" "insert: do the mapped columns appear in SQL " @@ -2791,6 +4882,7 @@ msgstr "" "INSERTs SQL? " #. Tag: para +#: basic_mapping.xml:2375 basic_mapping.xml:3646 #, no-c-format msgid "" "update: do the mapped columns appear in SQL " @@ -2800,6 +4892,7 @@ msgstr "" "UPDATEs SQL?" #. Tag: para +#: basic_mapping.xml:2386 #, no-c-format msgid "" "lazy (optional - defaults to false): " @@ -2812,6 +4905,7 @@ msgstr "" "instrumentación de código byte en tiempo de compilación." #. Tag: para +#: basic_mapping.xml:2393 #, no-c-format msgid "" "optimistic-lock (optional - defaults to trueunique (optional - defaults to false): " @@ -2836,6 +4931,7 @@ msgstr "" "columnas mapeadas del componente." #. Tag: para +#: basic_mapping.xml:2408 #, no-c-format msgid "" "The child <property> tags map properties of the " @@ -2845,6 +4941,7 @@ msgstr "" "de la clase hija a las columnas de la tabla." #. Tag: para +#: basic_mapping.xml:2411 #, no-c-format msgid "" "The <component> element allows a <" @@ -2856,12 +4953,13 @@ msgstr "" "componente como una referencia a la entidad contenedora." #. Tag: para -#, no-c-format +#: basic_mapping.xml:2415 +#, fuzzy, no-c-format msgid "" "The <dynamic-component> element allows a " "Map to be mapped as a component, where the property names " -"refer to keys of the map. See for " -"more information." +"refer to keys of the map. See for " +"more information. This feature is not supported in annotations." msgstr "" "El elemento <dynamic-component> permite que un " "Map sea mapeado como un componente, en donde los nombres " @@ -2869,101 +4967,138 @@ msgstr "" "linkend=\"components-dynamic\" /> para obtener mayor información. " #. Tag: title +#: basic_mapping.xml:2423 #, no-c-format -msgid "Properties" -msgstr "Propiedades" +msgid "Inheritance strategy" +msgstr "" #. Tag: para +#: basic_mapping.xml:2425 #, no-c-format msgid "" -"The <properties> element allows the definition of a " -"named, logical grouping of the properties of a class. The most important use " -"of the construct is that it allows a combination of properties to be the " -"target of a property-ref. It is also a convenient way to " -"define a multi-column unique constraint. For example:" +"Java is a language supporting polymorphism: a class can inherit from " +"another. Several strategies are possible to persist a class hierarchy:" msgstr "" -"El elemento <properties> permite la definición de " -"un grupo de propiedades lógico con nombre de una clase. El uso más " -"importante de la contrucción es que permite que una combinación de " -"propiedades sea el objetivo de una property-ref. También " -"es una forma práctica de definir una restricción de unicidad multicolumna. " -"Por ejemplo:" #. Tag: para +#: basic_mapping.xml:2431 #, no-c-format msgid "" -"name: the logical name of the grouping. It is " -"not an actual property name." +"Single table per class hierarchy strategy: a single table hosts all the " +"instances of a class hierarchy" msgstr "" -"name: El nombre lógico del agrupamiento. No es un nombre de propiedad." #. Tag: para +#: basic_mapping.xml:2436 #, no-c-format msgid "" -"optimistic-lock (optional - defaults to true): specifies that updates to these properties either do or do not " -"require acquisition of the optimistic lock. It determines if a version " -"increment should occur when these properties are dirty." +"Joined subclass strategy: one table per class and subclass is present and " +"each table persist the properties specific to a given subclass. The state of " +"the entity is then stored in its corresponding class table and all its " +"superclasses" msgstr "" -"optimistic-lock (opcional - por defecto es true): Especifica que las actualizaciones de estas propiedades requieren " -"o no de la adquisición de un bloqueo optimista. Determina si debe ocurrir un " -"incremento de versión cuando estas propiedades están desactualizadas." #. Tag: para +#: basic_mapping.xml:2443 #, no-c-format msgid "" -"For example, if we have the following <properties> " -"mapping:" +"Table per class strategy: one table per concrete class and subclass is " +"present and each table persist the properties of the class and its " +"superclasses. The state of the entity is then stored entirely in the " +"dedicated table for its class." msgstr "" -"Por ejemplo, si tenemos el siguiente mapeo de <properties>:" - -#. Tag: para -#, no-c-format -msgid "" -"You might have some legacy data association that refers to this unique key " -"of the Person table, instead of to the primary key:" -msgstr "" -"Puede que tenga alguna asociación de datos heredados que se refiera a esta " -"clave única de la tabla de Person, en lugar de la clave " -"principal:" - -#. Tag: para -#, no-c-format -msgid "" -"The use of this outside the context of mapping legacy data is not " -"recommended." -msgstr "" -"No recomendamos el uso de este tipo de cosas fuera del contexto del mapeo de " -"datos heredados. " #. Tag: title +#: basic_mapping.xml:2451 #, no-c-format -msgid "Subclass" -msgstr "Subclase" +msgid "Single table per class hierarchy strategy" +msgstr "" #. Tag: para +#: basic_mapping.xml:2453 #, no-c-format msgid "" -"Polymorphic persistence requires the declaration of each subclass of the " -"root persistent class. For the table-per-class-hierarchy mapping strategy, " -"the <subclass> declaration is used. For example:" +"With this approach the properties of all the subclasses in a given mapped " +"class hierarchy are stored in a single table." +msgstr "" + +#. Tag: para +#: basic_mapping.xml:2456 +#, fuzzy, no-c-format +msgid "" +"Each subclass declares its own persistent properties and subclasses. Version " +"and id properties are assumed to be inherited from the root class. Each " +"subclass in a hierarchy must define a unique discriminator value. If this is " +"not specified, the fully qualified Java class name is used." +msgstr "" +"Cada subclase debe declarar sus propias propiedades persistentes y " +"subclases. Se asume que las propiedades <version> y " +"<id> son heredadas de la clase raíz. Cada subclase " +"en una jerarquía tiene que definir un discriminator-value " +"único. Si no se especifica ninguno entonces se utiliza el nombre " +"completamente calificado de clase Java." + +#. Tag: programlisting +#: basic_mapping.xml:2462 basic_mapping.xml:2540 +#, no-c-format +msgid "" +"@Entity\n" +"@Inheritance(strategy=InheritanceType.SINGLE_TABLE)\n" +"@DiscriminatorColumn(\n" +" name=\"planetype\",\n" +" discriminatorType=DiscriminatorType.STRING\n" +")\n" +"@DiscriminatorValue(\"Plane\")\n" +"public class Plane { ... }\n" +"\n" +"@Entity\n" +"@DiscriminatorValue(\"A320\")\n" +"public class A320 extends Plane { ... }" +msgstr "" + +#. Tag: para +#: basic_mapping.xml:2464 +#, fuzzy, no-c-format +msgid "" +"In hbm.xml, for the table-per-class-hierarchy mapping strategy, the " +"<subclass> declaration is used. For example:" msgstr "" "La persistencia polimórfica requiere la declaración de cada subclase de la " "clase persistente raíz. Para la estrategia de mapeo tabla-por-jerarquía-de-" "clases, se utiliza la declaración <subclass>. Por " "ejemplo:" -#. Tag: para +#. Tag: programlisting +#: basic_mapping.xml:2479 #, no-c-format -msgid "name: the fully qualified class name of the subclass." +msgid "" +"<subclass\n" +" name=\"ClassName\"\n" +" discriminator-value=\"discriminator_value\"\n" +" proxy=\"ProxyInterface\"\n" +" lazy=\"true|false\"\n" +" dynamic-update=\"true|false\"\n" +" dynamic-insert=\"true|false\"\n" +" entity-name=\"EntityName\"\n" +" node=\"element-name\"\n" +" extends=\"SuperclassName\">\n" +"\n" +" <property .... />\n" +" .....\n" +"</subclass>" +msgstr "" + +#. Tag: para +#: basic_mapping.xml:2483 basic_mapping.xml:2656 basic_mapping.xml:2720 +#, no-c-format +msgid "" +"name: the fully qualified class name of the subclass." msgstr "" "name: El nombre de clase completamente calificado de la " "subclase. " #. Tag: para +#: basic_mapping.xml:2488 #, no-c-format msgid "" "discriminator-value (optional - defaults to the class " @@ -2973,6 +5108,7 @@ msgstr "" "de la clase): Un valor que distingue subclases individuales. " #. Tag: para +#: basic_mapping.xml:2494 #, no-c-format msgid "" "proxy (optional): specifies a class or interface used for " @@ -2982,6 +5118,7 @@ msgstr "" "utiliza para proxies de inicialización perezosa." #. Tag: para +#: basic_mapping.xml:2499 #, no-c-format msgid "" "lazy (optional - defaults to true): " @@ -2992,54 +5129,291 @@ msgstr "" "recuperación perezosa. " #. Tag: para -#, no-c-format +#: basic_mapping.xml:2507 basic_mapping.xml:2685 basic_mapping.xml:2746 +#, fuzzy, no-c-format msgid "" -"Each subclass declares its own persistent properties and subclasses. " -"<version> and <id> " -"properties are assumed to be inherited from the root class. Each subclass in " -"a hierarchy must define a unique discriminator-value. If " -"this is not specified, the fully qualified Java class name is used." -msgstr "" -"Cada subclase debe declarar sus propias propiedades persistentes y " -"subclases. Se asume que las propiedades <version> y " -"<id> son heredadas de la clase raíz. Cada subclase " -"en una jerarquía tiene que definir un discriminator-value " -"único. Si no se especifica ninguno entonces se utiliza el nombre " -"completamente calificado de clase Java." - -#. Tag: para -#, no-c-format -msgid "" -"For information about inheritance mappings see ." +"For information about inheritance mappings see ." msgstr "" "Para obtener información acerca de los mapeos de herencias consulte ." #. Tag: title +#: basic_mapping.xml:2511 #, no-c-format -msgid "Joined-subclass" +msgid "Discriminator" +msgstr "Discriminador" + +#. Tag: para +#: basic_mapping.xml:2513 +#, fuzzy, no-c-format +msgid "" +"Discriminators are required for polymorphic persistence using the table-per-" +"class-hierarchy mapping strategy. It declares a discriminator column of the " +"table. The discriminator column contains marker values that tell the " +"persistence layer what subclass to instantiate for a particular row. A " +"restricted set of types can be used: string, " +"character, integer, byte, short, boolean, " +"yes_no, true_false." +msgstr "" +"Se necesita el elemento <discriminator> para la " +"persistencia polimórfica utilizando la estrategia de mapeo de tabla-por-" +"jerarquía-de-clases. Declara una columna discriminadora de la tabla. La " +"columna discriminidora contiene valores de marca que le dicen a la capa de " +"persistencia qué subclase instanciar para una fila en particular. Se puede " +"utilizar un conjunto restringido de tipos: string, " +"character, integer, byte, short, boolean, " +"yes_no, true_false." + +#. Tag: para +#: basic_mapping.xml:2523 +#, no-c-format +msgid "" +"Use the @DiscriminatorColumn to define the " +"discriminator column as well as the discriminator type. Alternatively, you " +"can also use @DiscriminatorFormula to express in SQL " +"what would be in a virtual discriminator column. This is particularly handy " +"when the discriminator value can be extracted from one or more columns of " +"the table. Both @DiscriminatorColumn and " +"@DiscriminatorFormula are to be set on the root " +"entity (once per persisted hierarchy)." +msgstr "" + +#. Tag: para +#: basic_mapping.xml:2534 +#, no-c-format +msgid "" +"Finally, use @DiscriminatorValue on each class of the " +"hierarchy to specify the value stored in the discriminator column for a " +"given entity. If you do not set @DiscriminatorValue " +"on a class, the fully qualified class name is used." +msgstr "" + +#. Tag: para +#: basic_mapping.xml:2542 +#, no-c-format +msgid "" +"In hbm.xml, the <discriminator> element is used to " +"define the discriminator column or formula:" +msgstr "" + +#. Tag: programlisting +#: basic_mapping.xml:2559 +#, no-c-format +msgid "" +"<discriminator\n" +" column=\"discriminator_column\"\n" +" type=\"discriminator_type\"\n" +" force=\"true|false\"\n" +" insert=\"true|false\"\n" +" formula=\"arbitrary sql expression\"\n" +"/>" +msgstr "" + +#. Tag: para +#: basic_mapping.xml:2563 +#, no-c-format +msgid "" +"column (optional - defaults to class): " +"the name of the discriminator column." +msgstr "" +"column (opcional - por defecto es class) el nombre de la columna discriminadora. " + +#. Tag: para +#: basic_mapping.xml:2569 +#, no-c-format +msgid "" +"type (optional - defaults to string): " +"a name that indicates the Hibernate type" +msgstr "" +"type (opcional - por defecto es string) un nombre que indica el tipo Hibernate. " + +#. Tag: para +#: basic_mapping.xml:2575 +#, no-c-format +msgid "" +"force (optional - defaults to false): " +"\"forces\" Hibernate to specify the allowed discriminator values, even when " +"retrieving all instances of the root class." +msgstr "" +"force (opcional - por defecto es false) \"fuerza\" a Hibernate para especificar los valores " +"discriminadores permitidos incluso cuando se recuperan todas las instancias " +"de la clase raíz. " + +#. Tag: para +#: basic_mapping.xml:2582 +#, no-c-format +msgid "" +"insert (optional - defaults to true): " +"set this to false if your discriminator column is also " +"part of a mapped composite identifier. It tells Hibernate not to include the " +"column in SQL INSERTs." +msgstr "" +"insert (opcional - por defecto es true): establecido como false si su columna " +"discriminadora también es parte de un identificador mapeado compuesto. Lle " +"dice a Hibernate que no incluya la columna en los SQLs INSERT." + +#. Tag: para +#: basic_mapping.xml:2590 +#, no-c-format +msgid "" +"formula (optional): an arbitrary SQL expression that is " +"executed when a type has to be evaluated. It allows content-based " +"discrimination." +msgstr "" +"formula (opcional): una expresión SQL arbitraria que se " +"ejecuta cuando se tenga que evaluar un tipo. Permite la discriminación con " +"base en el contenido." + +#. Tag: para +#: basic_mapping.xml:2597 +#, no-c-format +msgid "" +"Actual values of the discriminator column are specified by the " +"discriminator-value attribute of the <" +"class> and <subclass> elements." +msgstr "" +"Los valores reales de la columna discriminadora están especificados por el " +"atributo discriminator-value de los elementos " +"<class> y <subclass>." + +#. Tag: para +#: basic_mapping.xml:2602 +#, no-c-format +msgid "" +"The force attribute is only useful if the table contains " +"rows with \"extra\" discriminator values that are not mapped to a persistent " +"class. This will not usually be the case." +msgstr "" +"El atributo force es sólamente útil si la tabla contiene " +"filas con valores discriminadores \"extra\" que no estén mapeados a una " +"clase persistente. Generalmente este no es el caso." + +#. Tag: para +#: basic_mapping.xml:2607 +#, no-c-format +msgid "" +"The formula attribute allows you to declare an arbitrary " +"SQL expression that will be used to evaluate the type of a row. For example:" +msgstr "" +"El atributo formula le permite declarar una expresión SQL " +"arbitraria que será utilizada para evaluar el tipo de una fila. Por ejemplo: " + +#. Tag: programlisting +#: basic_mapping.xml:2611 +#, no-c-format +msgid "" +"<discriminator\n" +" formula=\"case when CLASS_TYPE in ('a', 'b', 'c') then 0 else 1 end\"\n" +" type=\"integer\"/>" +msgstr "" + +#. Tag: title +#: basic_mapping.xml:2616 +#, fuzzy, no-c-format +msgid "Joined subclass strategy" msgstr "joined-subclass " #. Tag: para -#, no-c-format +#: basic_mapping.xml:2618 +#, fuzzy, no-c-format msgid "" "Each subclass can also be mapped to its own table. This is called the table-" "per-subclass mapping strategy. An inherited state is retrieved by joining " -"with the table of the superclass. To do this you use the <joined-" -"subclass> element. For example:" +"with the table of the superclass. A discriminator column is not required for " +"this mapping strategy. Each subclass must, however, declare a table column " +"holding the object identifier. The primary key of this table is also a " +"foreign key to the superclass table and described by the " +"@PrimaryKeyJoinColumns or the <key> element." msgstr "" "Se puede mapear cada subclase a su propia tabla. Esto se llama una " "estrategia de mapeo tabla-por-subclase. El estado heredado se recupera " "uniendo con la tabla de la superclase. Para hacer esto utilice elemento " "<joined-subclass>. Por ejemplo:" +#. Tag: programlisting +#: basic_mapping.xml:2628 +#, no-c-format +msgid "" +"@Entity @Table(name=\"CATS\")\n" +"@Inheritance(strategy=InheritanceType.JOINED)\n" +"public class Cat implements Serializable { \n" +" @Id @GeneratedValue(generator=\"cat-uuid\") \n" +" @GenericGenerator(name=\"cat-uuid\", strategy=\"uuid\")\n" +" String getId() { return id; }\n" +"\n" +" ...\n" +"}\n" +"\n" +"@Entity @Table(name=\"DOMESTIC_CATS\")\n" +"@PrimaryKeyJoinColumn(name=\"CAT\")\n" +"public class DomesticCat extends Cat { \n" +" public String getName() { return name; }\n" +"}" +msgstr "" + #. Tag: para +#: basic_mapping.xml:2631 +#, no-c-format +msgid "" +"The table name still defaults to the non qualified class name. Also if " +"@PrimaryKeyJoinColumn is not set, the primary key / " +"foreign key columns are assumed to have the same names as the primary key " +"columns of the primary table of the superclass." +msgstr "" + +#. Tag: para +#: basic_mapping.xml:2638 +#, fuzzy, no-c-format +msgid "" +"In hbm.xml, use the <joined-subclass> element. For " +"example:" +msgstr "" +"Puede declarar una clase persistente utilizando el elemento class. Por ejemplo:" + +#. Tag: programlisting +#: basic_mapping.xml:2652 +#, no-c-format +msgid "" +"<joined-subclass\n" +" name=\"ClassName\"\n" +" table=\"tablename\"\n" +" proxy=\"ProxyInterface\"\n" +" lazy=\"true|false\"\n" +" dynamic-update=\"true|false\"\n" +" dynamic-insert=\"true|false\"\n" +" schema=\"schema\"\n" +" catalog=\"catalog\"\n" +" extends=\"SuperclassName\"\n" +" persister=\"ClassName\"\n" +" subselect=\"SQL expression\"\n" +" entity-name=\"EntityName\"\n" +" node=\"element-name\">\n" +"\n" +" <key .... >\n" +"\n" +" <property .... />\n" +" .....\n" +"</joined-subclass>" +msgstr "" + +#. Tag: para +#: basic_mapping.xml:2661 basic_mapping.xml:2725 #, no-c-format msgid "table: the name of the subclass table." msgstr "table: El nombre de tabla de la subclase. " #. Tag: para +#: basic_mapping.xml:2666 basic_mapping.xml:2730 #, no-c-format msgid "" "proxy (optional): specifies a class or interface to use " @@ -3049,6 +5423,7 @@ msgstr "" "debe utilizar para proxies de inicialización perezosa. " #. Tag: para +#: basic_mapping.xml:2671 basic_mapping.xml:2735 #, no-c-format msgid "" "lazy (optional, defaults to true): " @@ -3059,35 +5434,70 @@ msgstr "" "recuperación perezosa. " #. Tag: para +#: basic_mapping.xml:2679 #, no-c-format msgid "" -"A discriminator column is not required for this mapping strategy. Each " -"subclass must, however, declare a table column holding the object identifier " -"using the <key> element. The mapping at the start " -"of the chapter would then be re-written as:" +"Use the <key> element to declare the primary key / " +"foreign key column. The mapping at the start of the chapter would then be re-" +"written as:" +msgstr "" + +#. Tag: programlisting +#: basic_mapping.xml:2683 +#, no-c-format +msgid "" +"<?xml version=\"1.0\"?>\n" +"<!DOCTYPE hibernate-mapping PUBLIC\n" +" \"-//Hibernate/Hibernate Mapping DTD//EN\"\n" +" \"http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd\">\n" +"\n" +"<hibernate-mapping package=\"eg\">\n" +"\n" +" <class name=\"Cat\" table=\"CATS\">\n" +" <id name=\"id\" column=\"uid\" type=\"long\">\n" +" <generator class=\"hilo\"/>\n" +" </id>\n" +" <property name=\"birthdate\" type=\"date\"/>\n" +" <property name=\"color\" not-null=\"true\"/>\n" +" <property name=\"sex\" not-null=\"true\"/>\n" +" <property name=\"weight\"/>\n" +" <many-to-one name=\"mate\"/>\n" +" <set name=\"kittens\">\n" +" <key column=\"MOTHER\"/>\n" +" <one-to-many class=\"Cat\"/>\n" +" </set>\n" +" <joined-subclass name=\"DomesticCat\" table=" +"\"DOMESTIC_CATS\">\n" +" <key column=\"CAT\"/>\n" +" <property name=\"name\" type=\"string\"/>\n" +" </joined-subclass>\n" +" </class>\n" +"\n" +" <class name=\"eg.Dog\">\n" +" <!-- mapping for Dog could go here -->\n" +" </class>\n" +"\n" +"</hibernate-mapping>" msgstr "" -"No se necesita una columna discriminadora para esta estrategia de mapeo. Sin " -"embargo, cada subclase debe declarar una columna de tabla que tenga el " -"identificador del objeto utilizando el elemento <key>. El mapeo mencionado al comienzo del capítulo se reescribiría así:" #. Tag: title +#: basic_mapping.xml:2690 #, no-c-format -msgid "Union-subclass" -msgstr "Union-subclass" +msgid "Table per class strategy" +msgstr "" #. Tag: para -#, no-c-format +#: basic_mapping.xml:2692 +#, fuzzy, no-c-format msgid "" "A third option is to map only the concrete classes of an inheritance " "hierarchy to tables. This is called the table-per-concrete-class strategy. " "Each table defines all persistent states of the class, including the " "inherited state. In Hibernate, it is not necessary to explicitly map such " -"inheritance hierarchies. You can map each class with a separate <" -"class> declaration. However, if you wish use polymorphic " -"associations (e.g. an association to the superclass of your hierarchy), you " -"need to use the <union-subclass> mapping. For " -"example:" +"inheritance hierarchies. You can map each class as a separate entity root. " +"However, if you wish use polymorphic associations (e.g. an association to " +"the superclass of your hierarchy), you need to use the union subclass " +"mapping." msgstr "" "Una tercera opción es mapear sólo las clases concretas de una jerarquía de " "herencia a tablas. Esta se llama la estrategia clase concreta por tabla). " @@ -3099,35 +5509,440 @@ msgstr "" "necesita utilizar el mapeo <union-subclass>. Por " "ejemplo:" -#. Tag: para +#. Tag: programlisting +#: basic_mapping.xml:2701 #, no-c-format -msgid "No discriminator column or key column is required for this mapping strategy." +msgid "" +"@Entity\n" +"@Inheritance(strategy = InheritanceType.TABLE_PER_CLASS)\n" +"public class Flight implements Serializable { ... }" +msgstr "" + +#. Tag: para +#: basic_mapping.xml:2703 +#, no-c-format +msgid "Or in hbm.xml:" +msgstr "" + +#. Tag: programlisting +#: basic_mapping.xml:2716 +#, no-c-format +msgid "" +"<union-subclass\n" +" name=\"ClassName\"\n" +" table=\"tablename\"\n" +" proxy=\"ProxyInterface\"\n" +" lazy=\"true|false\"\n" +" dynamic-update=\"true|false\"\n" +" dynamic-insert=\"true|false\"\n" +" schema=\"schema\"\n" +" catalog=\"catalog\"\n" +" extends=\"SuperclassName\"\n" +" abstract=\"true|false\"\n" +" persister=\"ClassName\"\n" +" subselect=\"SQL expression\"\n" +" entity-name=\"EntityName\"\n" +" node=\"element-name\">\n" +"\n" +" <property .... />\n" +" .....\n" +"</union-subclass>" +msgstr "" + +#. Tag: para +#: basic_mapping.xml:2743 +#, no-c-format +msgid "" +"No discriminator column or key column is required for this mapping strategy." msgstr "" "No se necesita una columna o una columna clave discriminadora para esta " "estrategia de mapeo." #. Tag: title +#: basic_mapping.xml:2751 #, no-c-format -msgid "Join" -msgstr "Join" +msgid "Inherit properties from superclasses" +msgstr "" #. Tag: para +#: basic_mapping.xml:2753 #, no-c-format msgid "" -"Using the <join> element, it is possible to map " -"properties of one class to several tables that have a one-to-one " -"relationship. For example:" +"This is sometimes useful to share common properties through a technical or a " +"business superclass without including it as a regular mapped entity (ie no " +"specific table for this entity). For that purpose you can map them as " +"@MappedSuperclass." +msgstr "" + +#. Tag: programlisting +#: basic_mapping.xml:2758 +#, no-c-format +msgid "" +"@MappedSuperclass\n" +"public class BaseEntity {\n" +" @Basic\n" +" @Temporal(TemporalType.TIMESTAMP)\n" +" public Date getLastUpdate() { ... }\n" +" public String getLastUpdater() { ... }\n" +" ...\n" +"}\n" +"\n" +"@Entity class Order extends BaseEntity {\n" +" @Id public Integer getId() { ... }\n" +" ...\n" +"}" msgstr "" -"Al utilizar el elemento <join>, es posible mapear " -"las propiedades de una clase a varias tablas que tengan una relación uno-a-" -"uno. Por ejemplo:" #. Tag: para +#: basic_mapping.xml:2760 +#, no-c-format +msgid "" +"In database, this hierarchy will be represented as an Order table having the id, lastUpdate and lastUpdater columns. The embedded superclass " +"property mappings are copied into their entity subclasses. Remember that the " +"embeddable superclass is not the root of the hierarchy though." +msgstr "" + +#. Tag: para +#: basic_mapping.xml:2768 +#, no-c-format +msgid "" +"Properties from superclasses not mapped as @MappedSuperclass are ignored." +msgstr "" + +#. Tag: para +#: basic_mapping.xml:2773 +#, no-c-format +msgid "" +"The default access type (field or methods) is used, unless you use the " +"@Access annotation." +msgstr "" + +#. Tag: para +#: basic_mapping.xml:2778 +#, no-c-format +msgid "" +"The same notion can be applied to @Embeddable objects to " +"persist properties from their superclasses. You also need to use " +"@MappedSuperclass to do that (this should not be " +"considered as a standard EJB3 feature though)" +msgstr "" + +#. Tag: para +#: basic_mapping.xml:2786 +#, no-c-format +msgid "" +"It is allowed to mark a class as @MappedSuperclass in the " +"middle of the mapped inheritance hierarchy." +msgstr "" + +#. Tag: para +#: basic_mapping.xml:2792 +#, no-c-format +msgid "" +"Any class in the hierarchy non annotated with @MappedSuperclass nor @Entity will be ignored." +msgstr "" + +#. Tag: para +#: basic_mapping.xml:2797 +#, no-c-format +msgid "" +"You can override columns defined in entity superclasses at the root entity " +"level using the @AttributeOverride annotation." +msgstr "" + +#. Tag: programlisting +#: basic_mapping.xml:2801 +#, no-c-format +msgid "" +"@MappedSuperclass\n" +"public class FlyingObject implements Serializable {\n" +"\n" +" public int getAltitude() {\n" +" return altitude;\n" +" }\n" +"\n" +" @Transient\n" +" public int getMetricAltitude() {\n" +" return metricAltitude;\n" +" }\n" +"\n" +" @ManyToOne\n" +" public PropulsionType getPropulsion() {\n" +" return metricAltitude;\n" +" }\n" +" ...\n" +"}\n" +"\n" +"@Entity\n" +"@AttributeOverride( name=\"altitude\", column = @Column(name=\"fld_altitude" +"\") )\n" +"@AssociationOverride( \n" +" name=\"propulsion\", \n" +" joinColumns = @JoinColumn(name=\"fld_propulsion_fk\") \n" +")\n" +"public class Plane extends FlyingObject {\n" +" ...\n" +"}" +msgstr "" + +#. Tag: para +#: basic_mapping.xml:2803 +#, no-c-format +msgid "" +"The altitude property will be persisted in an " +"fld_altitude column of table Plane and " +"the propulsion association will be materialized in a " +"fld_propulsion_fk foreign key column." +msgstr "" + +#. Tag: para +#: basic_mapping.xml:2809 +#, no-c-format +msgid "" +"You can define @AttributeOverride(s) and " +"@AssociationOverride(s) on @Entity " +"classes, @MappedSuperclass classes and properties " +"pointing to an @Embeddable object." +msgstr "" + +#. Tag: para +#: basic_mapping.xml:2815 +#, no-c-format +msgid "" +"In hbm.xml, simply map the properties of the superclass in the <" +"class> element of the entity that needs to inherit them." +msgstr "" + +#. Tag: title +#: basic_mapping.xml:2821 +#, no-c-format +msgid "Mapping one entity to several tables" +msgstr "" + +#. Tag: para +#: basic_mapping.xml:2823 +#, no-c-format +msgid "" +"While not recommended for a fresh schema, some legacy databases force your " +"to map a single entity on several tables." +msgstr "" + +#. Tag: para +#: basic_mapping.xml:2826 +#, no-c-format +msgid "" +"Using the @SecondaryTable or @SecondaryTables class level annotations. To express that a column is in a " +"particular table, use the table parameter of " +"@Column or @JoinColumn." +msgstr "" + +#. Tag: programlisting +#: basic_mapping.xml:2832 +#, no-c-format +msgid "" +"@Entity\n" +"@Table(name=\"MainCat\")\n" +"@SecondaryTables({\n" +" @SecondaryTable(name=\"Cat1\", pkJoinColumns={\n" +" @PrimaryKeyJoinColumn(name=\"cat_id\", referencedColumnName=\"id\")\n" +" ),\n" +" @SecondaryTable(name=\"Cat2\", uniqueConstraints={@UniqueConstraint" +"(columnNames={\"storyPart2\"})})\n" +"})\n" +"public class Cat implements Serializable {\n" +"\n" +" private Integer id;\n" +" private String name;\n" +" private String storyPart1;\n" +" private String storyPart2;\n" +"\n" +" @Id @GeneratedValue\n" +" public Integer getId() {\n" +" return id;\n" +" }\n" +"\n" +" public String getName() {\n" +" return name;\n" +" }\n" +" \n" +" @Column(table=\"Cat1\")\n" +" public String getStoryPart1() {\n" +" return storyPart1;\n" +" }\n" +"\n" +" @Column(table=\"Cat2\")\n" +" public String getStoryPart2() {\n" +" return storyPart2;\n" +" }\n" +"}" +msgstr "" + +#. Tag: para +#: basic_mapping.xml:2834 +#, no-c-format +msgid "" +"In this example, name will be in MainCat. storyPart1 will be in Cat1 " +"and storyPart2 will be in Cat2. " +"Cat1 will be joined to MainCat using " +"the cat_id as a foreign key, and Cat2 " +"using id (ie the same column name, the MainCat id column has). Plus a unique constraint on storyPart2 has been set." +msgstr "" + +#. Tag: para +#: basic_mapping.xml:2844 +#, no-c-format +msgid "" +"There is also additional tuning accessible via the @org.hibernate." +"annotations.Table annotation:" +msgstr "" + +#. Tag: para +#: basic_mapping.xml:2850 +#, fuzzy, no-c-format +msgid "" +"fetch: If set to JOIN, the default, Hibernate will use an " +"inner join to retrieve a secondary table defined by a class or its " +"superclasses and an outer join for a secondary table defined by a subclass. " +"If set to SELECT then Hibernate will use a sequential " +"select for a secondary table defined on a subclass, which will be issued " +"only if a row turns out to represent an instance of the subclass. Inner " +"joins will still be used to retrieve a secondary defined by the class and " +"its superclasses." +msgstr "" +"fetch (opcional - por defecto es join): Si se establece como join, por defecto, " +"Hibernate utilizará una unión interior (inner join) para recuperar un " +"<join> definido por una clase o sus superclases. " +"Utilizará una unión externa (outer join) para un <join> definido por una subclase. Si se establece como select, entonces Hibernate utilizará una selección secuencial para un " +"<join> definido en una subclase. Esto se publicará " +"sólamente si una fila representa una instancia de la subclase. Las uniones " +"interiores todavía serán utilizadas para recuperar un <join> definido por la clase y sus superclases." + +#. Tag: para +#: basic_mapping.xml:2862 +#, fuzzy, no-c-format +msgid "" +"inverse: If true, Hibernate will not try to insert or " +"update the properties defined by this join. Default to false." +msgstr "" +"inverse (opcional - por defecto es false): De activarse, Hibernate no tratará de insertar o actualizar las " +"propiedades definidas por esta unión. " + +#. Tag: para +#: basic_mapping.xml:2868 +#, fuzzy, no-c-format +msgid "" +"optional: If enabled (the default), Hibernate will insert " +"a row only if the properties defined by this join are non-null and will " +"always use an outer join to retrieve the properties." +msgstr "" +"optional (opcional - por defecto es false): De activarse, Hibernate insertará una fila sólo si las " +"propiedades definidas por esta unión son no-nulas. Siempre utilizará una " +"unión externa para recuperar las propiedades." + +#. Tag: para +#: basic_mapping.xml:2875 +#, no-c-format +msgid "" +"foreignKey: defines the Foreign Key name of a secondary " +"table pointing back to the primary table." +msgstr "" + +#. Tag: para +#: basic_mapping.xml:2880 +#, no-c-format +msgid "" +"Make sure to use the secondary table name in the appliesto property" +msgstr "" + +#. Tag: programlisting +#: basic_mapping.xml:2883 +#, no-c-format +msgid "" +"@Entity\n" +"@Table(name=\"MainCat\")\n" +"@SecondaryTable(name=\"Cat1\")\n" +"@org.hibernate.annotations.Table(\n" +" appliesTo=\"Cat1\",\n" +" fetch=FetchMode.SELECT,\n" +" optional=true)\n" +"public class Cat implements Serializable {\n" +"\n" +" private Integer id;\n" +" private String name;\n" +" private String storyPart1;\n" +" private String storyPart2;\n" +"\n" +" @Id @GeneratedValue\n" +" public Integer getId() {\n" +" return id;\n" +" }\n" +"\n" +" public String getName() {\n" +" return name;\n" +" }\n" +" \n" +" @Column(table=\"Cat1\")\n" +" public String getStoryPart1() {\n" +" return storyPart1;\n" +" }\n" +"\n" +" @Column(table=\"Cat2\")\n" +" public String getStoryPart2() {\n" +" return storyPart2;\n" +" }\n" +"}" +msgstr "" + +#. Tag: para +#: basic_mapping.xml:2885 +#, fuzzy, no-c-format +msgid "In hbm.xml, use the <join> element." +msgstr "" +"Por ejemplo, si tenemos el siguiente mapeo de <properties>:" + +#. Tag: programlisting +#: basic_mapping.xml:2903 +#, no-c-format +msgid "" +"<join\n" +" table=\"tablename\"\n" +" schema=\"owner\"\n" +" catalog=\"catalog\"\n" +" fetch=\"join|select\"\n" +" inverse=\"true|false\"\n" +" optional=\"true|false\">\n" +"\n" +" <key ... />\n" +"\n" +" <property ... />\n" +" ...\n" +"</join>" +msgstr "" + +#. Tag: para +#: basic_mapping.xml:2907 #, no-c-format msgid "table: the name of the joined table." msgstr "table: El nombre de la tabla unida. " #. Tag: para +#: basic_mapping.xml:2924 #, no-c-format msgid "" "fetch (optional - defaults to join): " @@ -3153,6 +5968,7 @@ msgstr "" "literal> definido por la clase y sus superclases." #. Tag: para +#: basic_mapping.xml:2939 #, no-c-format msgid "" "inverse (optional - defaults to falseoptional (optional - defaults to false<key> element has featured a few times within " +"To link one entity to an other, you need to map the association property as " +"a to one association. In the relational model, you can either use a foreign " +"key or an association table, or (a bit less common) share the same primary " +"key value between the two entities." +msgstr "" + +#. Tag: para +#: basic_mapping.xml:2974 +#, no-c-format +msgid "" +"To mark an association, use either @ManyToOne or " +"@OnetoOne." +msgstr "" + +#. Tag: para +#: basic_mapping.xml:2978 +#, no-c-format +msgid "" +"@ManyToOne and @OneToOne have a " +"parameter named targetEntity which describes the target " +"entity name. You usually don't need this parameter since the default value " +"(the type of the property that stores the association) is good in almost all " +"cases. However this is useful when you want to use interfaces as the return " +"type instead of the regular entity." +msgstr "" + +#. Tag: para +#: basic_mapping.xml:2985 +#, no-c-format +msgid "" +"Setting a value of the cascade attribute to any " +"meaningful value other than nothing will propagate certain operations to the " +"associated object. The meaningful values are divided into three categories." +msgstr "" + +#. Tag: para +#: basic_mapping.xml:2992 +#, no-c-format +msgid "" +"basic operations, which include: persist, merge, delete, save-" +"update, evict, replicate, lock and refresh;" +msgstr "" + +#. Tag: para +#: basic_mapping.xml:2998 +#, fuzzy, no-c-format +msgid "" +"special values: delete-orphan or all ;" +msgstr "" +"Las asociaciones ahora se especifican utilizando entity-name en lugar de class." + +#. Tag: para +#: basic_mapping.xml:3003 +#, no-c-format +msgid "" +"comma-separated combinations of operation names: cascade=\"persist," +"merge,evict\" or cascade=\"all,delete-orphan\". " +"See for a full explanation. Note " +"that single valued many-to-one associations do not support orphan delete." +msgstr "" + +#. Tag: para +#: basic_mapping.xml:3012 +#, no-c-format +msgid "" +"By default, single point associations are eagerly fetched in JPA 2. You can " +"mark it as lazily fetched by using @ManyToOne(fetch=FetchType." +"LAZY) in which case Hibernate will proxy the association and " +"load it when the state of the associated entity is reached. You can force " +"Hibernate not to use a proxy by using @LazyToOne(NO_PROXY). In this case, the property is fetched lazily when the instance " +"variable is first accessed. This requires build-time bytecode " +"instrumentation. lazy=\"false\" specifies that the association will always " +"be eagerly fetched." +msgstr "" + +#. Tag: para +#: basic_mapping.xml:3022 +#, no-c-format +msgid "" +"With the default JPA options, single-ended associations are loaded with a " +"subsequent select if set to LAZY, or a SQL JOIN is used " +"for EAGER associations. You can however adjust the " +"fetching strategy, ie how data is fetched by using @Fetch. FetchMode can be SELECT (a " +"select is triggered when the association needs to be loaded) or " +"JOIN (use a SQL JOIN to load the association while " +"loading the owner entity). JOIN overrides any lazy " +"attribute (an association loaded through a JOIN strategy " +"cannot be lazy)." +msgstr "" + +#. Tag: title +#: basic_mapping.xml:3034 +#, fuzzy, no-c-format +msgid "Using a foreign key or an association table" +msgstr "asociaciones de clave foránea única" + +#. Tag: para +#: basic_mapping.xml:3036 +#, fuzzy, no-c-format +msgid "An ordinary association to another persistent class is declared using a" +msgstr "" +"Una asociación uno-a-uno (one-to-one) a otra clase persistente se declara " +"utilizando un elemento one-to-one." + +#. Tag: para +#: basic_mapping.xml:3041 +#, no-c-format +msgid "" +"@ManyToOne if several entities can point to the the " +"target entity" +msgstr "" + +#. Tag: para +#: basic_mapping.xml:3046 +#, no-c-format +msgid "" +"@OneToOne if only a single entity can point to the " +"the target entity" +msgstr "" + +#. Tag: para +#: basic_mapping.xml:3051 +#, no-c-format +msgid "" +"and a foreign key in one table is referencing the primary key column(s) of " +"the target table." +msgstr "" + +#. Tag: programlisting +#: basic_mapping.xml:3054 +#, no-c-format +msgid "" +"@Entity\n" +"public class Flight implements Serializable {\n" +" @ManyToOne( cascade = {CascadeType.PERSIST, CascadeType.MERGE} )\n" +" @JoinColumn(name=\"COMP_ID\")\n" +" public Company getCompany() {\n" +" return company;\n" +" }\n" +" ...\n" +"}" +msgstr "" + +#. Tag: para +#: basic_mapping.xml:3056 +#, no-c-format +msgid "" +"The @JoinColumn attribute is optional, the default value" +"(s) is the concatenation of the name of the relationship in the owner side, " +"_ (underscore), and the name of the primary key column in " +"the owned side. In this example company_id because the " +"property name is company and the column id of Company is " +"id." +msgstr "" + +#. Tag: programlisting +#: basic_mapping.xml:3064 +#, no-c-format +msgid "" +"@Entity\n" +"public class Flight implements Serializable {\n" +" @ManyToOne( cascade = {CascadeType.PERSIST, CascadeType.MERGE}, " +"targetEntity=CompanyImpl.class )\n" +" @JoinColumn(name=\"COMP_ID\")\n" +" public Company getCompany() {\n" +" return company;\n" +" }\n" +" ...\n" +"}\n" +"\n" +"public interface Company {\n" +" ...\n" +"}" +msgstr "" + +#. Tag: para +#: basic_mapping.xml:3066 +#, no-c-format +msgid "" +"You can also map a to one association through an association table. This " +"association table described by the @JoinTable annotation " +"will contains a foreign key referencing back the entity table (through " +"@JoinTable.joinColumns) and a a foreign key referencing " +"the target entity table (through @JoinTable.inverseJoinColumns)." +msgstr "" + +#. Tag: programlisting +#: basic_mapping.xml:3074 +#, no-c-format +msgid "" +"@Entity\n" +"public class Flight implements Serializable {\n" +" @ManyToOne( cascade = {CascadeType.PERSIST, CascadeType.MERGE} )\n" +" @JoinTable(name=\"Flight_Company\",\n" +" joinColumns = @JoinColumn(name=\"FLIGHT_ID\"),\n" +" inverseJoinColumns = @JoinColumn(name=\"COMP_ID\")\n" +" )\n" +" public Company getCompany() {\n" +" return company;\n" +" }\n" +" ...\n" +"}" +msgstr "" + +#. Tag: para +#: basic_mapping.xml:3077 +#, no-c-format +msgid "" +"You can use a SQL fragment to simulate a physical join column using the " +"@JoinColumnOrFormula / " +"@JoinColumnOrformulas annotations (just like you can " +"use a SQL fragment to simulate a property column via the " +"@Formula annotation)." +msgstr "" + +#. Tag: programlisting +#: basic_mapping.xml:3083 +#, no-c-format +msgid "" +"@Entity\n" +"public class Ticket implements Serializable {\n" +" @ManyToOne\n" +" @JoinColumnOrFormula(formula=\"(firstname + ' ' + lastname)\")\n" +" public Person getOwner() {\n" +" return person;\n" +" }\n" +" ...\n" +"}" +msgstr "" + +#. Tag: para +#: basic_mapping.xml:3086 +#, no-c-format +msgid "" +"You can mark an association as mandatory by using the " +"optional=false attribute. We recommend to use Bean " +"Validation's @NotNull annotation as a better " +"alternative however. As a consequence, the foreign key column(s) will be " +"marked as not nullable (if possible)." +msgstr "" + +#. Tag: para +#: basic_mapping.xml:3092 +#, no-c-format +msgid "" +"When Hibernate cannot resolve the association because the expected " +"associated element is not in database (wrong id on the association column), " +"an exception is raised. This might be inconvenient for legacy and badly " +"maintained schemas. You can ask Hibernate to ignore such elements instead of " +"raising an exception using the @NotFound annotation." +msgstr "" + +#. Tag: title +#: basic_mapping.xml:3100 +#, no-c-format +msgid "@NotFound annotation" +msgstr "" + +#. Tag: programlisting +#: basic_mapping.xml:3102 +#, no-c-format +msgid "" +"@Entity\n" +"public class Child {\n" +" ...\n" +" @ManyToOne\n" +" @NotFound(action=NotFoundAction.IGNORE)\n" +" public Parent getParent() { ... }\n" +" ...\n" +"}" +msgstr "" + +#. Tag: para +#: basic_mapping.xml:3105 +#, no-c-format +msgid "" +"Sometimes you want to delegate to your database the deletion of cascade when " +"a given entity is deleted. In this case Hibernate generates a cascade delete " +"constraint at the database level." +msgstr "" + +#. Tag: title +#: basic_mapping.xml:3110 +#, no-c-format +msgid "@OnDelete annotation" +msgstr "" + +#. Tag: programlisting +#: basic_mapping.xml:3112 +#, no-c-format +msgid "" +"@Entity\n" +"public class Child {\n" +" ...\n" +" @ManyToOne\n" +" @OnDelete(action=OnDeleteAction.CASCADE)\n" +" public Parent getParent() { ... }\n" +" ...\n" +"}" +msgstr "" + +#. Tag: para +#: basic_mapping.xml:3115 +#, no-c-format +msgid "" +"Foreign key constraints, while generated by Hibernate, have a fairly " +"unreadable name. You can override the constraint name using " +"@ForeignKey." +msgstr "" + +#. Tag: title +#: basic_mapping.xml:3120 +#, fuzzy, no-c-format +msgid "@ForeignKey annotation" +msgstr "asociaciones de clave foránea única" + +#. Tag: programlisting +#: basic_mapping.xml:3122 +#, no-c-format +msgid "" +"@Entity\n" +"public class Child {\n" +" ...\n" +" @ManyToOne\n" +" @ForeignKey(name=\"FK_PARENT\")\n" +" public Parent getParent() { ... }\n" +" ...\n" +"}\n" +"\n" +"alter table Child add constraint FK_PARENT foreign key (parent_id) " +"references Parent" +msgstr "" + +#. Tag: para +#: basic_mapping.xml:3125 +#, no-c-format +msgid "" +"Sometimes, you want to link one entity to an other not by the target entity " +"primary key but by a different unique key. You can achieve that by " +"referencing the unique key column(s) in @JoinColumn." +"referenceColumnName." +msgstr "" + +#. Tag: programlisting +#: basic_mapping.xml:3130 basic_mapping.xml:3682 +#, no-c-format +msgid "" +"@Entity\n" +"class Person {\n" +" @Id Integer personNumber;\n" +" String firstName;\n" +" @Column(name=\"I\")\n" +" String initial;\n" +" String lastName;\n" +"}\n" +"\n" +"@Entity\n" +"class Home {\n" +" @ManyToOne\n" +" @JoinColumns({\n" +" @JoinColumn(name=\"first_name\", referencedColumnName=\"firstName\"),\n" +" @JoinColumn(name=\"init\", referencedColumnName=\"I\"),\n" +" @JoinColumn(name=\"last_name\", referencedColumnName=\"lastName\"),\n" +" })\n" +" Person owner\n" +"}" +msgstr "" + +#. Tag: para +#: basic_mapping.xml:3132 +#, no-c-format +msgid "" +"This is not encouraged however and should be reserved to legacy mappings." +msgstr "" + +#. Tag: para +#: basic_mapping.xml:3135 +#, no-c-format +msgid "" +"In hbm.xml, mapping an association is similar. The main difference is that a " +"@OneToOne is mapped as <many-to-one " +"unique=\"true\"/>, let's dive into the subject." +msgstr "" + +#. Tag: programlisting +#: basic_mapping.xml:3177 +#, no-c-format +msgid "" +"<many-to-one\n" +" name=\"propertyName\"\n" +" column=\"column_name\"\n" +" class=\"ClassName\"\n" +" cascade=\"cascade_style\"\n" +" fetch=\"join|select\"\n" +" update=\"true|false\"\n" +" insert=\"true|false\"\n" +" property-ref=\"propertyNameFromAssociatedClass\"\n" +" access=\"field|property|ClassName\"\n" +" unique=\"true|false\"\n" +" not-null=\"true|false\"\n" +" optimistic-lock=\"true|false\"\n" +" lazy=\"proxy|no-proxy|false\"\n" +" not-found=\"ignore|exception\"\n" +" entity-name=\"EntityName\"\n" +" formula=\"arbitrary SQL expression\"\n" +" node=\"element-name|@attribute-name|element/@attribute|.\"\n" +" embed-xml=\"true|false\"\n" +" index=\"index_name\"\n" +" unique_key=\"unique_key_id\"\n" +" foreign-key=\"foreign_key_name\"\n" +"/>" +msgstr "" + +#. Tag: para +#: basic_mapping.xml:3185 basic_mapping.xml:3868 +#, no-c-format +msgid "" +"column (optional): the name of the foreign key column. " +"This can also be specified by nested <column> " +"element(s)." +msgstr "" +"column (opcional): El nombre de la columna de la clave " +"foránea. Esto también se puede especificar por medio de uno o varios " +"elementos anidados <column>. " + +#. Tag: para +#: basic_mapping.xml:3191 basic_mapping.xml:3385 +#, no-c-format +msgid "" +"class (optional - defaults to the property type " +"determined by reflection): the name of the associated class." +msgstr "" +"class (opcional - por defecto es el tipo de la propiedad " +"determinado por reflección): El nombre de la clase asociada. " + +#. Tag: para +#: basic_mapping.xml:3197 basic_mapping.xml:3391 +#, no-c-format +msgid "" +"cascade (optional): specifies which operations should be " +"cascaded from the parent object to the associated object." +msgstr "" +"cascade (opcional) especifica qué operaciones deben ir en " +"cascada desde el objeto padre hasta el objeto asociado. " + +#. Tag: para +#: basic_mapping.xml:3203 basic_mapping.xml:3407 +#, no-c-format +msgid "" +"fetch (optional - defaults to select): " +"chooses between outer-join fetching or sequential select fetching." +msgstr "" +"fetch (opcional - por defecto es select): Escoge entre la recuperación de unión exterior (outer-join) o la " +"recuperación por selección secuencial." + +#. Tag: para +#: basic_mapping.xml:3209 +#, no-c-format +msgid "" +"update, insert (optional - defaults to true): specifies that the mapped columns should be included in SQL " +"UPDATE and/or INSERT statements. " +"Setting both to false allows a pure \"derived\" " +"association whose value is initialized from another property that maps to " +"the same column(s), or by a trigger or other application." +msgstr "" +"update, insert (opcional - por defecto es true) especifica que las columnas mapeadas deben ser incluídas en las " +"declaraciones SQL UPDATE y/o INSERT. " +"El establecer ambas como false permite una asociación " +"puramente \"derivada\" cuyo valor es inicializado desde alguna otra " +"propiedad que mapea a la misma columna (o columnas), por un disparador o por " +"otra aplicación." + +#. Tag: para +#: basic_mapping.xml:3219 +#, no-c-format +msgid "" +"property-ref (optional): the name of a property of the " +"associated class that is joined to this foreign key. If not specified, the " +"primary key of the associated class is used." +msgstr "" +"property-ref: (opcional): El nombre de una propiedad de " +"la clase asociada que se encuentra unida a su llave foránea. Si no se " +"especifica, se utiliza la llave principal de la clase asociada." + +#. Tag: para +#: basic_mapping.xml:3232 +#, no-c-format +msgid "" +"unique (optional): enables the DDL generation of a unique " +"constraint for the foreign-key column. By allowing this to be the target of " +"a property-ref, you can make the association multiplicity " +"one-to-one." +msgstr "" +"unique (opcional): Activa la generación DDL de una " +"restricción de unicidad para la columna de clave foránea. Además, permite " +"que éste sea el objetivo de una property-ref. puede hacer " +"que la asociación sea de multiplicidad uno-a-uno." + +#. Tag: para +#: basic_mapping.xml:3240 +#, no-c-format +msgid "" +"not-null (optional): enables the DDL generation of a " +"nullability constraint for the foreign key columns." +msgstr "" +"not-null (opcional): Activa la generación DDL de una " +"restricción de nulabilidad para las columnas de clave foránea. " + +#. Tag: para +#: basic_mapping.xml:3254 +#, no-c-format +msgid "" +"lazy (optional - defaults to proxy): " +"by default, single point associations are proxied. lazy=\"no-proxy" +"\" specifies that the property should be fetched lazily when the " +"instance variable is first accessed. This requires build-time bytecode " +"instrumentation. lazy=\"false\" specifies that the " +"association will always be eagerly fetched." +msgstr "" +"lazy (opcional - por defecto es proxy): Por defecto, las asociaciones de punto único van con proxies. " +"lazy=\"no-proxy\" especifica que esta propiedad debe ser " +"recuperada perezosamente cuando se acceda por primera vez a la variable de " +"instancia. Requiere instrumentación del código byte en tiempo de " +"compilación. lazy=\"false\" especifica que la asociación " +"siempre será recuperada tempranamente." + +#. Tag: para +#: basic_mapping.xml:3264 +#, no-c-format +msgid "" +"not-found (optional - defaults to exception): specifies how foreign keys that reference missing rows will be " +"handled. ignore will treat a missing row as a null " +"association." +msgstr "" +"not-found (opcional - por defecto es exception): Especifica cómo se manejarán las claves foráneas que referencian " +"las filas que hacen falta. ignore tratará una fila " +"perdida como una asociación nula." + +#. Tag: para +#: basic_mapping.xml:3272 basic_mapping.xml:3448 +#, no-c-format +msgid "" +"entity-name (optional): the entity name of the associated " +"class." +msgstr "" +"entity-name (opcional): El nombre de entidad de la clase " +"asociada. " + +#. Tag: para +#: basic_mapping.xml:3277 +#, no-c-format +msgid "" +"formula (optional): an SQL expression that defines the " +"value for a computed foreign key." +msgstr "" +"formula (opcional): una expresión SQL que define el valor " +"para una clave foránea computada." + +#. Tag: para +#: basic_mapping.xml:3284 +#, fuzzy, no-c-format +msgid "" +"Setting a value of the cascade attribute to any " +"meaningful value other than none will propagate certain " +"operations to the associated object. The meaningful values are divided into " +"three categories. First, basic operations, which include: persist, " +"merge, delete, save-update, evict, replicate, lock and refresh; " +"second, special values: delete-orphan; and third," +"all comma-separated combinations of operation names: " +"cascade=\"persist,merge,evict\" or cascade=\"all," +"delete-orphan\". See " +"for a full explanation. Note that single valued, many-to-one and one-to-one, " +"associations do not support orphan delete." +msgstr "" +"Establecer el valor del atributo cascade con cualquier " +"valor significativo diferente de none propagará ciertas " +"operaciones al objeto asociado. Los valores significativos están divididos " +"en tres categorías. Primero, las operaciones básicas, las cuales incluyen: " +"persist, merge, delete, save-update, evict, replicate, lock y " +"refresh; segundo, los valores especiales delete-orphan y tercero, all y las combinaciones de " +"operaciones separadas por comas: cascade=\"persist,merge,evict\" o cascade=\"all,delete-orphan\". Consulte y allí encontrará una explicación " +"completa. Observe que las asociaciones con valores únicos, asociaciones " +"muchos-a-uno y uno-a-uno no soportan el borrado de huérfanos." + +#. Tag: para +#: basic_mapping.xml:3298 +#, no-c-format +msgid "" +"Here is an example of a typical many-to-one declaration:" +msgstr "" +"Este es un ejemplo de una declaración típica muchos-a-uno:" + +#. Tag: programlisting +#: basic_mapping.xml:3301 +#, no-c-format +msgid "" +"<many-to-one name=\"product\" class=\"Product\" column=\"PRODUCT_ID\"/>" +msgstr "" + +#. Tag: para +#: basic_mapping.xml:3303 +#, no-c-format +msgid "" +"The property-ref attribute should only be used for " +"mapping legacy data where a foreign key refers to a unique key of the " +"associated table other than the primary key. This is a complicated and " +"confusing relational model. For example, if the Product " +"class had a unique serial number that is not the primary key. The " +"unique attribute controls Hibernate's DDL generation with " +"the SchemaExport tool." +msgstr "" +"El atributo property-ref se debe utilizar sólamente para " +"el mapeo de datos heredados donde una clave foránea referencia una clave " +"única de la tabla asociada, distinta de la clave principal. Este es un " +"modelo relacional complicado y confuso. Por ejemplo, si la clase " +"Product tuviera un número único serial que no es la clave " +"principal, el atributo unique controla la generación de " +"DDL de Hibernate con la herramienta SchemaExport." + +#. Tag: programlisting +#: basic_mapping.xml:3311 +#, no-c-format +msgid "" +"<property name=\"serialNumber\" unique=\"true\" type=\"string\" column=" +"\"SERIAL_NUMBER\"/>" +msgstr "" + +#. Tag: para +#: basic_mapping.xml:3313 +#, no-c-format +msgid "Then the mapping for OrderItem might use:" +msgstr "Entonces el mapeo para OrderItem puede utilizar:" + +#. Tag: programlisting +#: basic_mapping.xml:3316 +#, no-c-format +msgid "" +"<many-to-one name=\"product\" property-ref=\"serialNumber\" column=" +"\"PRODUCT_SERIAL_NUMBER\"/>" +msgstr "" + +#. Tag: para +#: basic_mapping.xml:3318 +#, no-c-format +msgid "This is not encouraged, however." +msgstr "Sin embargo, esto ciertamente no se aconseja. " + +#. Tag: para +#: basic_mapping.xml:3320 +#, no-c-format +msgid "" +"If the referenced unique key comprises multiple properties of the associated " +"entity, you should map the referenced properties inside a named <" +"properties> element." +msgstr "" +"Si la clave única referenciada abarca múltiples propiedades de la entidad " +"asociada, debe mapear las propiedades dentro de un elemento nombrado " +"<properties>." + +#. Tag: para +#: basic_mapping.xml:3324 +#, no-c-format +msgid "" +"If the referenced unique key is the property of a component, you can specify " +"a property path:" +msgstr "" +"Si la clave única referenciada es propiedad de un componente, usted puede " +"especificar una ruta de propiedad: " + +#. Tag: programlisting +#: basic_mapping.xml:3327 +#, no-c-format +msgid "" +"<many-to-one name=\"owner\" property-ref=\"identity.ssn\" column=" +"\"OWNER_SSN\"/>" +msgstr "" + +#. Tag: title +#: basic_mapping.xml:3331 +#, no-c-format +msgid "Sharing the primary key with the associated entity" +msgstr "" + +#. Tag: para +#: basic_mapping.xml:3333 +#, no-c-format +msgid "" +"The second approach is to ensure an entity and its associated entity share " +"the same primary key. In this case the primary key column is also a foreign " +"key and there is no extra column. These associations are always one to one." +msgstr "" + +#. Tag: title +#: basic_mapping.xml:3339 +#, fuzzy, no-c-format +msgid "One to One association" +msgstr "asociaciones de clave foránea única" + +#. Tag: programlisting +#: basic_mapping.xml:3341 +#, no-c-format +msgid "" +"@Entity\n" +"public class Body {\n" +" @Id\n" +" public Long getId() { return id; }\n" +"\n" +" @OneToOne(cascade = CascadeType.ALL)\n" +" @MapsId\n" +" public Heart getHeart() {\n" +" return heart;\n" +" }\n" +" ...\n" +"} \n" +"\n" +"@Entity\n" +"public class Heart {\n" +" @Id\n" +" public Long getId() { ...}\n" +"}" +msgstr "" + +#. Tag: para +#: basic_mapping.xml:3345 +#, no-c-format +msgid "" +"Many people got confused by these primary key based one to one associations. " +"They can only be lazily loaded if Hibernate knows that the other side of the " +"association is always present. To indicate to Hibernate that it is the case, " +"use @OneToOne(optional=false)." +msgstr "" + +#. Tag: para +#: basic_mapping.xml:3352 +#, no-c-format +msgid "In hbm.xml, use the following mapping." +msgstr "" + +#. Tag: programlisting +#: basic_mapping.xml:3377 +#, no-c-format +msgid "" +"<one-to-one\n" +" name=\"propertyName\"\n" +" class=\"ClassName\"\n" +" cascade=\"cascade_style\"\n" +" constrained=\"true|false\"\n" +" fetch=\"join|select\"\n" +" property-ref=\"propertyNameFromAssociatedClass\"\n" +" access=\"field|property|ClassName\"\n" +" formula=\"any SQL expression\"\n" +" lazy=\"proxy|no-proxy|false\"\n" +" entity-name=\"EntityName\"\n" +" node=\"element-name|@attribute-name|element/@attribute|.\"\n" +" embed-xml=\"true|false\"\n" +" foreign-key=\"foreign_key_name\"\n" +"/>" +msgstr "" + +#. Tag: para +#: basic_mapping.xml:3397 +#, no-c-format +msgid "" +"constrained (optional): specifies that a foreign key " +"constraint on the primary key of the mapped table and references the table " +"of the associated class. This option affects the order in which save" +"() and delete() are cascaded, and determines " +"whether the association can be proxied. It is also used by the schema export " +"tool." +msgstr "" +"constrained (opcional): especifica que una restricción de " +"clave foránea en la clave principal de la tabla mapeada referencia la tabla " +"de la clase asociada. Esta opción afecta el orden en que van en la cascada " +"save() y delete() y determina si la " +"asociación puede ser virtualizada por proxies. La herramienta de exportación " +"de esquemas también lo utiliza." + +#. Tag: para +#: basic_mapping.xml:3413 +#, no-c-format +msgid "" +"property-ref (optional): the name of a property of the " +"associated class that is joined to the primary key of this class. If not " +"specified, the primary key of the associated class is used." +msgstr "" +"property-ref (opcional): El nombre de una propiedad de la " +"clase asociada que esté unida a la clave principal de esta clase. Si no se " +"especifica, se utiliza la clave principal de la clase asociada." + +#. Tag: para +#: basic_mapping.xml:3426 +#, no-c-format +msgid "" +"formula (optional): almost all one-to-one associations " +"map to the primary key of the owning entity. If this is not the case, you " +"can specify another column, columns or expression to join on using an SQL " +"formula. See org.hibernate.test.onetooneformula for an " +"example." +msgstr "" +"formula (opcional): Casi todas las asociaciones uno-a-uno " +"mapean a la clave principal de la entidad propietaria. Si este no es el " +"caso, puede especificar otra columna, o columnas, o una expresión para unir " +"utilizando una fórmula SQL. Para un obtener un ejemplo consulte org." +"hibernate.test.onetooneformula." + +#. Tag: para +#: basic_mapping.xml:3435 +#, no-c-format +msgid "" +"lazy (optional - defaults to proxy): " +"by default, single point associations are proxied. lazy=\"no-proxy" +"\" specifies that the property should be fetched lazily when the " +"instance variable is first accessed. It requires build-time bytecode " +"instrumentation. lazy=\"false\" specifies that the " +"association will always be eagerly fetched. Note that if " +"constrained=\"false\", proxying is impossible and " +"Hibernate will eagerly fetch the association." +msgstr "" +"lazy (opcional - por defecto es proxy): Por defecto, las asociaciones de punto único van con proxies. " +"lazy=\"no-proxy\" especifica que esta propiedad debe ser " +"traída perezosamente cuando se acceda por primera vez la variable de " +"instancia. Requiere instrumentación del código byte en tiempo de " +"compilación. lazy=\"false\" especifica que la asociación " +"siempre será recuperada tempranamente. Observe que si " +"constrained=\"false\", la aplicación de proxies es " +"imposible e Hibernate recuperará tempranamente la asociación." + +#. Tag: para +#: basic_mapping.xml:3454 +#, no-c-format +msgid "" +"Primary key associations do not need an extra table column. If two rows are " +"related by the association, then the two table rows share the same primary " +"key value. To relate two objects by a primary key association, ensure that " +"they are assigned the same identifier value." +msgstr "" +"Las asociaciones de claves principales no necesitan una columna extra de la " +"tabla. Si dos filas están relacionadas por la asociación entonces las dos " +"filas de tablas comparten el mismo valor de clave principal. Para que dos " +"objetos estén relacionados por una asociación de clave principal, asegúrese " +"de que se les asigne el mismo valor de identificador." + +#. Tag: para +#: basic_mapping.xml:3460 +#, no-c-format +msgid "" +"For a primary key association, add the following mappings to " +"Employee and Person respectively:" +msgstr "" +"Para una asociación de clave principal, agregue los siguientes mapeos a " +"Employee y Person respectivamente:" + +#. Tag: programlisting +#: basic_mapping.xml:3464 +#, no-c-format +msgid "<one-to-one name=\"person\" class=\"Person\"/>" +msgstr "" + +#. Tag: programlisting +#: basic_mapping.xml:3466 +#, no-c-format +msgid "" +"<one-to-one name=\"employee\" class=\"Employee\" constrained=\"true\"/>" +msgstr "" + +#. Tag: para +#: basic_mapping.xml:3468 +#, no-c-format +msgid "" +"Ensure that the primary keys of the related rows in the PERSON and EMPLOYEE " +"tables are equal. You use a special Hibernate identifier generation strategy " +"called foreign:" +msgstr "" +"Asegúrese de que las claves principales de las filas relacionadas en las " +"tablas PERSON y EMPLOYEE sean iguales. Utilizamos una estrategia especial de " +"generación de identificador de Hibernate denominada foreign:" + +#. Tag: programlisting +#: basic_mapping.xml:3472 +#, no-c-format +msgid "" +"<class name=\"person\" table=\"PERSON\">\n" +" <id name=\"id\" column=\"PERSON_ID\">\n" +" <generator class=\"foreign\">\n" +" <param name=\"property\">employee</param>\n" +" </generator>\n" +" </id>\n" +" ...\n" +" <one-to-one name=\"employee\"\n" +" class=\"Employee\"\n" +" constrained=\"true\"/>\n" +"</class>" +msgstr "" + +#. Tag: para +#: basic_mapping.xml:3474 +#, no-c-format +msgid "" +"A newly saved instance of Person is assigned the same " +"primary key value as the Employee instance referred with " +"the employee property of that Person." +msgstr "" +"A una instancia recién guardada de Person se le asigna el " +"mismo valor de clave principal que se le asignó a la instancia " +"Employee referida por la propiedad employee de esa Person." + +#. Tag: title +#: basic_mapping.xml:3482 +#, no-c-format +msgid "Natural-id" +msgstr "Natural-id" + +#. Tag: para +#: basic_mapping.xml:3484 +#, fuzzy, no-c-format +msgid "" +"Although we recommend the use of surrogate keys as primary keys, you should " +"try to identify natural keys for all entities. A natural key is a property " +"or combination of properties that is unique and non-null. It is also " +"immutable. Map the properties of the natural key as @NaturalId or map them inside the <natural-id> " +"element. Hibernate will generate the necessary unique key and nullability " +"constraints and, as a result, your mapping will be more self-documenting." +msgstr "" +"Aunque recomendamos el uso de claves delegadas como claves principales, debe " +"tratar de identificar claves naturales para todas las entidades. Una clave " +"natural es una propiedad o combinación de propiedades que es única y no " +"nula. También es inmutable. Mapea las propiedades de la clave natural dentro " +"del elemento <natural-id>. Hibernate generará las " +"restricciones de nulabilidad y de clave única necesarias y su mapeo será más " +"auto-documentado." + +#. Tag: programlisting +#: basic_mapping.xml:3493 +#, no-c-format +msgid "" +"@Entity\n" +"public class Citizen {\n" +" @Id\n" +" @GeneratedValue\n" +" private Integer id;\n" +" private String firstname;\n" +" private String lastname;\n" +" \n" +" @NaturalId\n" +" @ManyToOne\n" +" private State state;\n" +"\n" +" @NaturalId\n" +" private String ssn;\n" +" ...\n" +"}\n" +"\n" +"\n" +"\n" +"//and later on query\n" +"List results = s.createCriteria( Citizen.class )\n" +" .add( Restrictions.naturalId().set( \"ssn\", \"1234\" ).set" +"( \"state\", ste ) )\n" +" .list();" +msgstr "" + +#. Tag: para +#: basic_mapping.xml:3495 +#, no-c-format +msgid "Or in XML," +msgstr "" + +#. Tag: programlisting +#: basic_mapping.xml:3497 +#, no-c-format +msgid "" +"<natural-id mutable=\"true|false\"/>\n" +" <property ... />\n" +" <many-to-one ... />\n" +" ......\n" +"</natural-id>" +msgstr "" + +#. Tag: para +#: basic_mapping.xml:3499 +#, no-c-format +msgid "" +"It is recommended that you implement equals() and " +"hashCode() to compare the natural key properties of the " +"entity." +msgstr "" +"Le recomendamos bastante que implemente equals() y " +"hashCode() para comparar las propiedades de clave natural " +"de la entidad. " + +#. Tag: para +#: basic_mapping.xml:3503 +#, no-c-format +msgid "" +"This mapping is not intended for use with entities that have natural primary " +"keys." +msgstr "" +"Este mapeo no está concebido para la utilización con entidades que tienen " +"claves principales naturales." + +#. Tag: para +#: basic_mapping.xml:3508 +#, no-c-format +msgid "" +"mutable (optional - defaults to false): by default, natural identifier properties are assumed to be " +"immutable (constant)." +msgstr "" +"mutable (opcional - por defecto es false): Por defecto, se asume que las propiedades de identificadores " +"naturales son inmutables (constantes)." + +#. Tag: title +#: basic_mapping.xml:3516 +#, fuzzy, no-c-format +msgid "Any" +msgstr "binary" + +#. Tag: para +#: basic_mapping.xml:3518 +#, fuzzy, no-c-format +msgid "" +"There is one more type of property mapping. The @Any " +"mapping defines a polymorphic association to classes from multiple tables. " +"This type of mapping requires more than one column. The first column " +"contains the type of the associated entity. The remaining columns contain " +"the identifier. It is impossible to specify a foreign key constraint for " +"this kind of association. This is not the usual way of mapping polymorphic " +"associations and you should use this only in special cases. For example, for " +"audit logs, user session data, etc." +msgstr "" +"Hay un tipo más de mapeo de propiedad. El elemento de mapeo <" +"any> define una asociación polimórfica a clases desde múltiples " +"tablas. Este tipo de mapeo necesita más de una columna. La primera columna " +"contiene el tipo de la entidad asociada. Las columnas restantes contienen el " +"identificador. Es imposible especificar una restricción de clave foránea " +"para este tipo de asociación. Esta no es la manera usual de mapear " +"asociaciones polimórficas y sólamente debe usar esto en casos especiales. " +"Por ejemplo, para registros de auditoría, datos de sesión de usuario, etc." + +#. Tag: para +#: basic_mapping.xml:3528 +#, fuzzy, no-c-format +msgid "" +"The @Any annotation describes the column holding the " +"metadata information. To link the value of the metadata information and an " +"actual entity type, The @AnyDef and " +"@AnyDefs annotations are used. The metaType attribute allows the application to specify a custom type that maps " +"database column values to persistent classes that have identifier properties " +"of the type specified by idType. You must specify the " +"mapping from values of the metaType to class names." +msgstr "" +"El atributo meta-type le permite especificar a la " +"aplicación un tipo personalizado que mapea los valores de columnas de la " +"base de datos a clases persistentes que tengan propiedades identificadoras " +"del tipo especificado por id-type. Tiene que especificar " +"el mapeo de valores del meta-tipo a nombres de clase." + +#. Tag: programlisting +#: basic_mapping.xml:3538 +#, no-c-format +msgid "" +"@Any( metaColumn = @Column( name = \"property_type\" ), fetch=FetchType." +"EAGER )\n" +"@AnyMetaDef( \n" +" idType = \"integer\", \n" +" metaType = \"string\", \n" +" metaValues = {\n" +" @MetaValue( value = \"S\", targetEntity = StringProperty.class ),\n" +" @MetaValue( value = \"I\", targetEntity = IntegerProperty.class )\n" +" } )\n" +"@JoinColumn( name = \"property_id\" )\n" +"public Property getMainProperty() {\n" +" return mainProperty;\n" +"}" +msgstr "" + +#. Tag: para +#: basic_mapping.xml:3540 +#, no-c-format +msgid "" +"Note that @AnyDef can be mutualized and reused. It is " +"recommended to place it as a package metadata in this case." +msgstr "" + +#. Tag: programlisting +#: basic_mapping.xml:3544 +#, no-c-format +msgid "" +"//on a package\n" +"@AnyMetaDef( name=\"property\" \n" +" idType = \"integer\", \n" +" metaType = \"string\", \n" +" metaValues = {\n" +" @MetaValue( value = \"S\", targetEntity = StringProperty.class ),\n" +" @MetaValue( value = \"I\", targetEntity = IntegerProperty.class )\n" +" } )\n" +"package org.hibernate.test.annotations.any;\n" +"\n" +"\n" +"//in a class\n" +" @Any( metaDef=\"property\", metaColumn = @Column( name = \"property_type" +"\" ), fetch=FetchType.EAGER )\n" +" @JoinColumn( name = \"property_id\" )\n" +" public Property getMainProperty() {\n" +" return mainProperty;\n" +" }" +msgstr "" + +#. Tag: para +#: basic_mapping.xml:3546 +#, no-c-format +msgid "The hbm.xml equivalent is:" +msgstr "" + +#. Tag: programlisting +#: basic_mapping.xml:3548 +#, no-c-format +msgid "" +"<any name=\"being\" id-type=\"long\" meta-type=\"string\">\n" +" <meta-value value=\"TBL_ANIMAL\" class=\"Animal\"/>\n" +" <meta-value value=\"TBL_HUMAN\" class=\"Human\"/>\n" +" <meta-value value=\"TBL_ALIEN\" class=\"Alien\"/>\n" +" <column name=\"table_name\"/>\n" +" <column name=\"id\"/>\n" +"</any>" +msgstr "" + +#. Tag: para +#: basic_mapping.xml:3551 +#, no-c-format +msgid "You cannot mutualize the metadata in hbm.xml as you can in annotations." +msgstr "" + +#. Tag: programlisting +#: basic_mapping.xml:3570 +#, no-c-format +msgid "" +"<any\n" +" name=\"propertyName\"\n" +" id-type=\"idtypename\"\n" +" meta-type=\"metatypename\"\n" +" cascade=\"cascade_style\"\n" +" access=\"field|property|ClassName\"\n" +" optimistic-lock=\"true|false\"\n" +">\n" +" <meta-value ... />\n" +" <meta-value ... />\n" +" .....\n" +" <column .... />\n" +" <column .... />\n" +" .....\n" +"</any>" +msgstr "" + +#. Tag: para +#: basic_mapping.xml:3574 +#, no-c-format +msgid "name: the property name." +msgstr "name: el nombre de la propiedad." + +#. Tag: para +#: basic_mapping.xml:3578 +#, no-c-format +msgid "id-type: the identifier type." +msgstr "id-type: el tipo del identificador." + +#. Tag: para +#: basic_mapping.xml:3582 +#, no-c-format +msgid "" +"meta-type (optional - defaults to string): any type that is allowed for a discriminator mapping." +msgstr "" +"meta-type (opcional - por defecto es string): Cualquier tipo que se permita para un mapeo discriminador." + +#. Tag: para +#: basic_mapping.xml:3588 +#, no-c-format +msgid "" +"cascade (optional- defaults to none): " +"the cascade style." +msgstr "" +"cascade (opcional- por defecto es none): el estilo de cascada." + +#. Tag: para +#: basic_mapping.xml:3599 +#, no-c-format +msgid "" +"optimistic-lock (optional - defaults to true): specifies that updates to this property either do or do not " +"require acquisition of the optimistic lock. It defines whether a version " +"increment should occur if this property is dirty." +msgstr "" +"optimistic-lock (opcional - por defecto es true): Especifica si las actualizaciones de esta propiedad requieren o " +"no de la adquisición del bloqueo optimista. Define si debe ocurrir un " +"incremento de versión cuando esta propiedad está desactualizada." + +#. Tag: title +#: basic_mapping.xml:3610 +#, no-c-format +msgid "Properties" +msgstr "Propiedades" + +#. Tag: para +#: basic_mapping.xml:3612 +#, no-c-format +msgid "" +"The <properties> element allows the definition of a " +"named, logical grouping of the properties of a class. The most important use " +"of the construct is that it allows a combination of properties to be the " +"target of a property-ref. It is also a convenient way to " +"define a multi-column unique constraint. For example:" +msgstr "" +"El elemento <properties> permite la definición de " +"un grupo de propiedades lógico con nombre de una clase. El uso más " +"importante de la contrucción es que permite que una combinación de " +"propiedades sea el objetivo de una property-ref. También " +"es una forma práctica de definir una restricción de unicidad multicolumna. " +"Por ejemplo:" + +#. Tag: programlisting +#: basic_mapping.xml:3632 +#, no-c-format +msgid "" +"<properties\n" +" name=\"logicalName\"\n" +" insert=\"true|false\"\n" +" update=\"true|false\"\n" +" optimistic-lock=\"true|false\"\n" +" unique=\"true|false\"\n" +">\n" +"\n" +" <property ...../>\n" +" <many-to-one .... />\n" +" ........\n" +"</properties>" +msgstr "" + +#. Tag: para +#: basic_mapping.xml:3636 +#, no-c-format +msgid "" +"name: the logical name of the grouping. It is " +"not an actual property name." +msgstr "" +"name: El nombre lógico del agrupamiento. No es un nombre de propiedad." + +#. Tag: para +#: basic_mapping.xml:3651 +#, no-c-format +msgid "" +"optimistic-lock (optional - defaults to true): specifies that updates to these properties either do or do not " +"require acquisition of the optimistic lock. It determines if a version " +"increment should occur when these properties are dirty." +msgstr "" +"optimistic-lock (opcional - por defecto es true): Especifica que las actualizaciones de estas propiedades requieren " +"o no de la adquisición de un bloqueo optimista. Determina si debe ocurrir un " +"incremento de versión cuando estas propiedades están desactualizadas." + +#. Tag: para +#: basic_mapping.xml:3666 +#, no-c-format +msgid "" +"For example, if we have the following <properties> " +"mapping:" +msgstr "" +"Por ejemplo, si tenemos el siguiente mapeo de <properties>:" + +#. Tag: programlisting +#: basic_mapping.xml:3669 +#, no-c-format +msgid "" +"<class name=\"Person\">\n" +" <id name=\"personNumber\"/>\n" +"\n" +" ...\n" +" <properties name=\"name\"\n" +" unique=\"true\" update=\"false\">\n" +" <property name=\"firstName\"/>\n" +" <property name=\"initial\"/>\n" +" <property name=\"lastName\"/>\n" +" </properties>\n" +"</class>" +msgstr "" + +#. Tag: para +#: basic_mapping.xml:3671 +#, no-c-format +msgid "" +"You might have some legacy data association that refers to this unique key " +"of the Person table, instead of to the primary key:" +msgstr "" +"Puede que tenga alguna asociación de datos heredados que se refiera a esta " +"clave única de la tabla de Person, en lugar de la clave " +"principal:" + +#. Tag: programlisting +#: basic_mapping.xml:3675 +#, no-c-format +msgid "" +"<many-to-one name=\"owner\"\n" +" class=\"Person\" property-ref=\"name\">\n" +" <column name=\"firstName\"/>\n" +" <column name=\"initial\"/>\n" +" <column name=\"lastName\"/>\n" +"</many-to-one>" +msgstr "" + +#. Tag: para +#: basic_mapping.xml:3678 +#, no-c-format +msgid "" +"When using annotations as a mapping strategy, such construct is not " +"necessary as the binding between a column and its related column on the " +"associated table is done directly" +msgstr "" + +#. Tag: para +#: basic_mapping.xml:3685 +#, no-c-format +msgid "" +"The use of this outside the context of mapping legacy data is not " +"recommended." +msgstr "" +"No recomendamos el uso de este tipo de cosas fuera del contexto del mapeo de " +"datos heredados. " + +#. Tag: title +#: basic_mapping.xml:3690 +#, no-c-format +msgid "Some hbm.xml specificities" +msgstr "" + +#. Tag: para +#: basic_mapping.xml:3692 +#, no-c-format +msgid "" +"The hbm.xml structure has some specificities naturally not present when " +"using annotations, let's describe them briefly." +msgstr "" + +#. Tag: title +#: basic_mapping.xml:3696 +#, no-c-format +msgid "Doctype" +msgstr "Doctype" + +#. Tag: para +#: basic_mapping.xml:3698 +#, no-c-format +msgid "" +"All XML mappings should declare the doctype shown. The actual DTD can be " +"found at the URL above, in the directory hibernate-x.x.x/src/org/" +"hibernate , or in hibernate3.jar. Hibernate " +"will always look for the DTD in its classpath first. If you experience " +"lookups of the DTD using an Internet connection, check the DTD declaration " +"against the contents of your classpath." +msgstr "" +"Todos los mapeos XML deben declarar el tipo de documento que se muestra. El " +"DTD en sí se puede encontrar en la URL mencionada anteriormente, en el " +"directorio hibernate-x.x.x/src/org/hibernate , o en " +"hibernate3.jar. Hibernate siempre buscará el DTD primero " +"en la ruta de clase. Si el DTD realiza búsquedas utilizando una conexión de " +"Internet, verifique que su declaración DTD frente al contenido de su ruta de " +"clase." + +#. Tag: title +#: basic_mapping.xml:3707 +#, no-c-format +msgid "EntityResolver" +msgstr "EntityResolver" + +#. Tag: para +#: basic_mapping.xml:3709 +#, no-c-format +msgid "" +"Hibernate will first attempt to resolve DTDs in its classpath. It does this " +"is by registering a custom org.xml.sax.EntityResolver " +"implementation with the SAXReader it uses to read in the xml files. This " +"custom EntityResolver recognizes two different systemId " +"namespaces:" +msgstr "" +"Hibernate tratará primero de resolver los DTDs en su ruta de clase. La " +"manera en que lo hace es registrando una implementación org.xml.sax." +"EntityResolver personalizada con el SAXReader que utiliza para " +"leer los archivos xml. Este EntityResolver personalizado " +"reconoce dos diferentes espacios de nombre del identificador del sistema." + +#. Tag: para +#: basic_mapping.xml:3718 +#, no-c-format +msgid "" +"a hibernate namespace is recognized whenever the resolver " +"encounters a systemId starting with http://hibernate.sourceforge." +"net/. The resolver attempts to resolve these entities via the " +"classloader which loaded the Hibernate classes." +msgstr "" +"un hibernate namespace se reconoce cuando el resolvedor " +"se encuentra con un identificador de sistema que inicia por http://" +"hibernate.sourceforge.net/. El resolvedor intenta resolver estas " +"entidades por medio del cargador de clases, el cual cargó las clases de " +"Hibernate." + +#. Tag: para +#: basic_mapping.xml:3726 +#, no-c-format +msgid "" +"a user namespace is recognized whenever the resolver " +"encounters a systemId using a classpath:// URL protocol. " +"The resolver will attempt to resolve these entities via (1) the current " +"thread context classloader and (2) the classloader which loaded the " +"Hibernate classes." +msgstr "" +"un user namespace se reconoce cuando el resolvedor se " +"encuentra con un identificador del sistema utilizando un protocolo URL " +"classpath://. El resolvedor intentará resolver estas " +"entidades por medio de (1) el cargador de clase del contexto del hilo actual " +"y (2) el cargador de clase, el cual cargó las clases de Hibernate." + +#. Tag: para +#: basic_mapping.xml:3735 +#, no-c-format +msgid "The following is an example of utilizing user namespacing:" +msgstr "" +"Este es un ejemplo de la utilización de los espacios de nombre del usuario: " + +#. Tag: programlisting +#: basic_mapping.xml:3738 +#, no-c-format +msgid "" +"" +msgstr "" + +#. Tag: para +#: basic_mapping.xml:3740 +#, no-c-format +msgid "" +"Where types.xml is a resource in the your." +"domain package and contains a custom typedef." +msgstr "" +"En donde types.xml es un recurso en el paquete " +"your.domain y comprende un typedef personalizado." + +#. Tag: title +#: basic_mapping.xml:3747 +#, no-c-format +msgid "Hibernate-mapping" +msgstr "Mapeo de Hibernate " + +#. Tag: para +#: basic_mapping.xml:3749 +#, no-c-format +msgid "" +"This element has several optional attributes. The schema " +"and catalog attributes specify that tables referred to in " +"this mapping belong to the named schema and/or catalog. If they are " +"specified, tablenames will be qualified by the given schema and catalog " +"names. If they are missing, tablenames will be unqualified. The " +"default-cascade attribute specifies what cascade style " +"should be assumed for properties and collections that do not specify a " +"cascade attribute. By default, the auto-import attribute allows you to use unqualified class names in the query " +"language." +msgstr "" +"Este elemento tiene varios atributos opcionales. Los atributos " +"schema y catalog especifican que las " +"tablas a las que se refiere en este mapeo pertenecen al esquema y/o catálogo " +"mencionado(s). De especificarse, los nombres de tablas serán calificados por " +"el nombre del esquema y del catálogo dados. De omitirse, los nombres de las " +"tablas no serán calificados. El atributo default-cascade " +"especifica qué estilo de cascada se debe asumir para las propiedades y " +"colecciones que no especifican un atributo cascade. Por " +"defecto, el atributo auto-import nos permite utilizar " +"nombres de clase sin calificar en el lenguaje de consulta." + +#. Tag: programlisting +#: basic_mapping.xml:3778 +#, no-c-format +msgid "" +"<hibernate-mapping\n" +" schema=\"schemaName\"\n" +" catalog=\"catalogName\"\n" +" default-cascade=\"cascade_style\"\n" +" default-access=\"field|property|ClassName\"\n" +" default-lazy=\"true|false\"\n" +" auto-import=\"true|false\"\n" +" package=\"package.name\"\n" +" />" +msgstr "" + +#. Tag: para +#: basic_mapping.xml:3782 +#, no-c-format +msgid "schema (optional): the name of a database schema." +msgstr "" +"schema (opcional): El nombre de un esquema de la base de " +"datos. " + +#. Tag: para +#: basic_mapping.xml:3787 +#, no-c-format +msgid "catalog (optional): the name of a database catalog." +msgstr "" +"catalog (opcional): El nombre de un catálogo de la base " +"de datos. " + +#. Tag: para +#: basic_mapping.xml:3792 +#, no-c-format +msgid "" +"default-cascade (optional - defaults to none): a default cascade style." +msgstr "" +"default-cascade (opcional - por defecto es none): Un estilo de cascada por defecto. " + +#. Tag: para +#: basic_mapping.xml:3797 +#, no-c-format +msgid "" +"default-access (optional - defaults to property): the strategy Hibernate should use for accessing all properties. " +"It can be a custom implementation of PropertyAccessor." +msgstr "" +"default-access (opcional - por defecto es " +"property): La estrategia que Hibernate debe utilizar para " +"acceder a todas las propiedades. Puede ser una implementación personalizada " +"de PropertyAccessor." + +#. Tag: para +#: basic_mapping.xml:3804 +#, no-c-format +msgid "" +"default-lazy (optional - defaults to true): the default value for unspecified lazy " +"attributes of class and collection mappings." +msgstr "" +"default-lazy (opcional - por defecto es true): El valor por defecto para los atributos lazy " +"no especificados de mapeos de clase y de colección." + +#. Tag: para +#: basic_mapping.xml:3811 +#, no-c-format +msgid "" +"auto-import (optional - defaults to true): specifies whether we can use unqualified class names of classes " +"in this mapping in the query language." +msgstr "" +"auto-import (opcional - por defecto es true): Especifica si podemos utilizar nombres de clases no calificados " +"de clases en este mapeo en el lenguaje de consulta." + +#. Tag: para +#: basic_mapping.xml:3818 +#, no-c-format +msgid "" +"package (optional): specifies a package prefix to use for " +"unqualified class names in the mapping document." +msgstr "" +"package (opcional): Especifica un prefijo de paquete que " +"se debe utilizar para los nombres de clase no calificados en el documento de " +"mapeo." + +#. Tag: para +#: basic_mapping.xml:3825 +#, no-c-format +msgid "" +"If you have two persistent classes with the same unqualified name, you " +"should set auto-import=\"false\". An exception will " +"result if you attempt to assign two classes to the same \"imported\" name." +msgstr "" +"Si tiene dos clases persistentes con el mismo nombre (sin calificar), debe " +"establecer auto-import=\"false\". Se presentará una " +"excepción si usted intenta asignar dos clases al mismo nombre \"importado\"." + +#. Tag: para +#: basic_mapping.xml:3830 +#, no-c-format +msgid "" +"The hibernate-mapping element allows you to nest several " +"persistent <class> mappings, as shown above. It is, " +"however, good practice (and expected by some tools) to map only a single " +"persistent class, or a single class hierarchy, in one mapping file and name " +"it after the persistent superclass. For example, Cat.hbm.xml, Dog.hbm.xml, or if using inheritance, " +"Animal.hbm.xml." +msgstr "" +"El elemento hibernate-mapping le permite anidar varios " +"mapeos <class> persistentes, como se mostró " +"anteriormente. Sin embargo, es una buena práctica (y algunas herramientas " +"esperan) que mapee sólamente una clase persistente, o a una sóla jerarquía " +"de clases, en un archivo de mapeo y nombrarlo como la superclase " +"persistente. Por ejemplo, Cat.hbm.xml, Dog.hbm." +"xml, o si utiliza herencia, Animal.hbm.xml." + +#. Tag: title +#: basic_mapping.xml:3841 +#, no-c-format +msgid "Key" +msgstr "" + +#. Tag: para +#: basic_mapping.xml:3843 +#, fuzzy, no-c-format +msgid "" +"The <key> element is featured a few times within " "this guide. It appears anywhere the parent mapping element defines a join to " "a new table that references the primary key of the original table. It also " "defines the foreign key in the joined table:" @@ -3217,7 +7691,22 @@ msgstr "" "defina una unión a una nueva tabla que referencie la clave principal de la " "tabla original. También define la clave foránea en la tabla unida:" +#. Tag: programlisting +#: basic_mapping.xml:3864 +#, no-c-format +msgid "" +"<key\n" +" column=\"columnname\"\n" +" on-delete=\"noaction|cascade\"\n" +" property-ref=\"propertyName\"\n" +" not-null=\"true|false\"\n" +" update=\"true|false\"\n" +" unique=\"true|false\"\n" +"/>" +msgstr "" + #. Tag: para +#: basic_mapping.xml:3874 #, no-c-format msgid "" "on-delete (optional - defaults to noactionproperty-ref (optional): specifies that the foreign key " @@ -3240,6 +7730,7 @@ msgstr "" "proporciona para los datos heredados." #. Tag: para +#: basic_mapping.xml:3886 #, no-c-format msgid "" "not-null (optional): specifies that the foreign key " @@ -3251,6 +7742,7 @@ msgstr "" "también es parte de la clave principal." #. Tag: para +#: basic_mapping.xml:3892 #, no-c-format msgid "" "update (optional): specifies that the foreign key should " @@ -3262,6 +7754,7 @@ msgstr "" "de la clave principal." #. Tag: para +#: basic_mapping.xml:3898 #, no-c-format msgid "" "unique (optional): specifies that the foreign key should " @@ -3273,6 +7766,7 @@ msgstr "" "es la clave principal." #. Tag: para +#: basic_mapping.xml:3905 #, no-c-format msgid "" "For systems where delete performance is important, we recommend that all " @@ -3290,6 +7784,7 @@ msgstr "" "bloqueo optimista normal de Hibernate para datos versionados." #. Tag: para +#: basic_mapping.xml:3913 #, no-c-format msgid "" "The not-null and update attributes are " @@ -3305,53 +7800,13 @@ msgstr "" "\"true\">. " #. Tag: title -#, no-c-format -msgid "Column and formula elements" -msgstr "Los elementos columna y fórmula" - -#. Tag: para -#, no-c-format -msgid "" -"Mapping elements which accept a column attribute will " -"alternatively accept a <column> subelement. " -"Likewise, <formula> is an alternative to the " -"formula attribute. For example:" -msgstr "" -"Los elementos de mapeo que acepten un atributo column " -"aceptarán opcionalmente un subelemento <column>. De " -"manera similar, <formula> es una alternativa al " -"atributo formula. Por ejemplo:" - -#. Tag: para -#, no-c-format -msgid "" -"Most of the attributes on column provide a means of " -"tailoring the DDL during automatic schema generation. The read and write attributes allow you to specify custom " -"SQL that Hibernate will use to access the column's value. For more on this, " -"see the discussion of column " -"read and write expressions." -msgstr "" -"La mayoría de los atributos en column proporcionan una manera de personalizar el DDL durante la generación del esquema automático. Los atributos read y write le permiten especificar SQL personalizado que Hibernate utilizará para acceder el valor de la columna. Para obtener mayor información sobre esto, consulte la discusión sobre expresiones de lectura y escritura de columnas." - -#. Tag: para -#, no-c-format -msgid "" -"The column and formula elements can " -"even be combined within the same property or association mapping to express, " -"for example, exotic join conditions." -msgstr "" -"Los elementos column y formula incluso " -"se pueden combinar dentro del mismo mapeo de propiedad o asociación para " -"expresar, por ejemplo, condiciones de unión exóticas." - -#. Tag: title +#: basic_mapping.xml:3922 #, no-c-format msgid "Import" msgstr "Import" #. Tag: para +#: basic_mapping.xml:3924 #, no-c-format msgid "" "If your application has two persistent classes with the same name, and you " @@ -3366,14 +7821,33 @@ msgstr "" "lugar de depender de auto-import=\"true\". Incluso puede " "importar clases e interfaces que no estén mapeadas explícitamente:" -#. Tag: para +#. Tag: programlisting +#: basic_mapping.xml:3930 #, no-c-format -msgid "class: the fully qualified class name of any Java class." +msgid "<import class=\"java.lang.Object\" rename=\"Universe\"/>" +msgstr "" + +#. Tag: programlisting +#: basic_mapping.xml:3939 +#, no-c-format +msgid "" +"<import\n" +" class=\"ClassName\"\n" +" rename=\"ShortName\"\n" +"/>" +msgstr "" + +#. Tag: para +#: basic_mapping.xml:3943 +#, no-c-format +msgid "" +"class: the fully qualified class name of any Java class." msgstr "" "class: El nombre de clase completamente calificado de " "cualquier clase Java. " #. Tag: para +#: basic_mapping.xml:3948 #, no-c-format msgid "" "rename (optional - defaults to the unqualified class " @@ -3382,99 +7856,114 @@ msgstr "" "rename (opcional - por defecto es el nombre de clase sin " "calificar): Un nombre que se puede utilizar en el lenguaje de consulta." -#. Tag: title -#, no-c-format -msgid "Any" -msgstr "Any" - #. Tag: para +#: basic_mapping.xml:3956 #, no-c-format -msgid "" -"There is one more type of property mapping. The <any> mapping element defines a polymorphic association to classes from " -"multiple tables. This type of mapping requires more than one column. The " -"first column contains the type of the associated entity. The remaining " -"columns contain the identifier. It is impossible to specify a foreign key " -"constraint for this kind of association. This is not the usual way of " -"mapping polymorphic associations and you should use this only in special " -"cases. For example, for audit logs, user session data, etc." +msgid "This feature is unique to hbm.xml and is not supported in annotations." msgstr "" -"Hay un tipo más de mapeo de propiedad. El elemento de mapeo <" -"any> define una asociación polimórfica a clases desde múltiples " -"tablas. Este tipo de mapeo necesita más de una columna. La primera columna " -"contiene el tipo de la entidad asociada. Las columnas restantes contienen el " -"identificador. Es imposible especificar una restricción de clave foránea " -"para este tipo de asociación. Esta no es la manera usual de mapear " -"asociaciones polimórficas y sólamente debe usar esto en casos especiales. " -"Por ejemplo, para registros de auditoría, datos de sesión de usuario, etc." - -#. Tag: para -#, no-c-format -msgid "" -"The meta-type attribute allows the application to specify " -"a custom type that maps database column values to persistent classes that " -"have identifier properties of the type specified by id-type. You must specify the mapping from values of the meta-type to class " -"names." -msgstr "" -"El atributo meta-type le permite especificar a la " -"aplicación un tipo personalizado que mapea los valores de columnas de la " -"base de datos a clases persistentes que tengan propiedades identificadoras " -"del tipo especificado por id-type. Tiene que especificar " -"el mapeo de valores del meta-tipo a nombres de clase." - -#. Tag: para -#, no-c-format -msgid "name: the property name." -msgstr "name: el nombre de la propiedad." - -#. Tag: para -#, no-c-format -msgid "id-type: the identifier type." -msgstr "id-type: el tipo del identificador." - -#. Tag: para -#, no-c-format -msgid "" -"meta-type (optional - defaults to string): any type that is allowed for a discriminator mapping." -msgstr "" -"meta-type (opcional - por defecto es string): Cualquier tipo que se permita para un mapeo discriminador." - -#. Tag: para -#, no-c-format -msgid "" -"cascade (optional- defaults to none): " -"the cascade style." -msgstr "" -"cascade (opcional- por defecto es none): el estilo de cascada." - -#. Tag: para -#, no-c-format -msgid "" -"optimistic-lock (optional - defaults to true): specifies that updates to this property either do or do not " -"require acquisition of the optimistic lock. It defines whether a version " -"increment should occur if this property is dirty." -msgstr "" -"optimistic-lock (opcional - por defecto es true): Especifica si las actualizaciones de esta propiedad requieren o " -"no de la adquisición del bloqueo optimista. Define si debe ocurrir un " -"incremento de versión cuando esta propiedad está desactualizada." #. Tag: title +#: basic_mapping.xml:3962 +#, no-c-format +msgid "Column and formula elements" +msgstr "Los elementos columna y fórmula" + +#. Tag: para +#: basic_mapping.xml:3964 +#, no-c-format +msgid "" +"Mapping elements which accept a column attribute will " +"alternatively accept a <column> subelement. " +"Likewise, <formula> is an alternative to the " +"formula attribute. For example:" +msgstr "" +"Los elementos de mapeo que acepten un atributo column " +"aceptarán opcionalmente un subelemento <column>. De " +"manera similar, <formula> es una alternativa al " +"atributo formula. Por ejemplo:" + +#. Tag: programlisting +#: basic_mapping.xml:3970 +#, no-c-format +msgid "" +"<column\n" +" name=\"column_name\"\n" +" length=\"N\"\n" +" precision=\"N\"\n" +" scale=\"N\"\n" +" not-null=\"true|false\"\n" +" unique=\"true|false\"\n" +" unique-key=\"multicolumn_unique_key_name\"\n" +" index=\"index_name\"\n" +" sql-type=\"sql_type_name\"\n" +" check=\"SQL expression\"\n" +" default=\"SQL expression\"\n" +" read=\"SQL expression\"\n" +" write=\"SQL expression\"/>" +msgstr "" + +#. Tag: programlisting +#: basic_mapping.xml:3972 +#, no-c-format +msgid "<formula>SQL expression</formula>" +msgstr "" + +#. Tag: para +#: basic_mapping.xml:3974 +#, no-c-format +msgid "" +"Most of the attributes on column provide a means of " +"tailoring the DDL during automatic schema generation. The read and write attributes allow you to specify custom " +"SQL that Hibernate will use to access the column's value. For more on this, " +"see the discussion of column " +"read and write expressions." +msgstr "" +"La mayoría de los atributos en column proporcionan una " +"manera de personalizar el DDL durante la generación del esquema automático. " +"Los atributos read y write le permiten " +"especificar SQL personalizado que Hibernate utilizará para acceder el valor " +"de la columna. Para obtener mayor información sobre esto, consulte la " +"discusión sobre expresiones " +"de lectura y escritura de columnas." + +#. Tag: para +#: basic_mapping.xml:3982 +#, no-c-format +msgid "" +"The column and formula elements can " +"even be combined within the same property or association mapping to express, " +"for example, exotic join conditions." +msgstr "" +"Los elementos column y formula incluso " +"se pueden combinar dentro del mismo mapeo de propiedad o asociación para " +"expresar, por ejemplo, condiciones de unión exóticas." + +#. Tag: programlisting +#: basic_mapping.xml:3986 +#, no-c-format +msgid "" +"<many-to-one name=\"homeAddress\" class=\"Address\"\n" +" insert=\"false\" update=\"false\">\n" +" <column name=\"person_id\" not-null=\"true\" length=\"10\"/>\n" +" <formula>'MAILING'</formula>\n" +"</many-to-one>" +msgstr "" + +#. Tag: title +#: basic_mapping.xml:3992 #, no-c-format msgid "Hibernate types" msgstr "Tipos de Hibernate " #. Tag: title +#: basic_mapping.xml:3995 #, no-c-format msgid "Entities and values" msgstr "Entidades y Valores" #. Tag: para +#: basic_mapping.xml:3997 #, no-c-format msgid "" "In relation to the persistence service, Java language-level objects are " @@ -3484,6 +7973,7 @@ msgstr "" "Java se clasifican en dos grupos:" #. Tag: para +#: basic_mapping.xml:4000 #, no-c-format msgid "" "An entity exists independently of any other objects " @@ -3508,6 +7998,7 @@ msgstr "" "versionadas." #. Tag: para +#: basic_mapping.xml:4010 #, no-c-format msgid "" "An entity's persistent state consists of references to other entities and " @@ -3531,6 +8022,7 @@ msgstr "" "por lo que dos entidades o colleciones no los pueden compartir." #. Tag: para +#: basic_mapping.xml:4020 #, no-c-format msgid "" "Until now, we have been using the term \"persistent class\" to refer to " @@ -3560,11 +8052,14 @@ msgstr "" "un tipo de valor." #. Tag: para +#: basic_mapping.xml:4033 #, no-c-format msgid "We will revisit both concepts throughout this reference guide." -msgstr "Volveremos a revisar ambos conceptos a lo largo de este manual de referencia." +msgstr "" +"Volveremos a revisar ambos conceptos a lo largo de este manual de referencia." #. Tag: para +#: basic_mapping.xml:4036 #, no-c-format msgid "" "The challenge is to map the Java type system, and the developers' definition " @@ -3591,6 +8086,7 @@ msgstr "" "estrategias de conversión personalizadas." #. Tag: para +#: basic_mapping.xml:4049 #, no-c-format msgid "" "With the exception of collections, all built-in Hibernate types support null " @@ -3600,11 +8096,13 @@ msgstr "" "excepción de las colecciones." #. Tag: title +#: basic_mapping.xml:4054 #, no-c-format msgid "Basic value types" msgstr "Tipos de valores básicos" #. Tag: para +#: basic_mapping.xml:4056 #, no-c-format msgid "" "The built-in basic mapping types can be roughly " @@ -3613,16 +8111,18 @@ msgstr "" "Los tipos de mapeo básicos incorporados se pueden " "categorizar así:" -#. Tag: term -#, no-c-format +#. Tag: literal +#: basic_mapping.xml:4059 +#, fuzzy, no-c-format msgid "" -"integer, long, short, float, double, character, byte, boolean, " -"yes_no, true_false" +"integer, long, short, float, double, character, byte, boolean, yes_no, " +"true_false" msgstr "" "integer, long, short, float, double, character, byte, boolean, " "yes_no, true_false" #. Tag: para +#: basic_mapping.xml:4063 #, no-c-format msgid "" "Type mappings from Java primitives or wrapper classes to appropriate (vendor-" @@ -3635,12 +8135,14 @@ msgstr "" "y true_false son codificaciones alternativas a " "boolean de Java o java.lang.Boolean." -#. Tag: term +#. Tag: literal +#: basic_mapping.xml:4073 #, no-c-format -msgid "string" -msgstr "string" +msgid "string" +msgstr "" #. Tag: para +#: basic_mapping.xml:4076 #, no-c-format msgid "" "A type mapping from java.lang.String to VARCHARjava.lang.String a VARCHAR (u Oracle VAARCHAR2)." -#. Tag: term -#, no-c-format -msgid "date, time, timestamp" +#. Tag: literal +#: basic_mapping.xml:4083 +#, fuzzy, no-c-format +msgid "date, time, timestamp" msgstr "date, time, timestamp" #. Tag: para +#: basic_mapping.xml:4086 #, no-c-format msgid "" "Type mappings from java.util.Date and its subclasses to " @@ -3665,12 +8169,14 @@ msgstr "" "tipos SQL DATE, TIME y " "TIMESTAMP (o equivalente)." -#. Tag: term -#, no-c-format -msgid "calendar, calendar_date" +#. Tag: literal +#: basic_mapping.xml:4094 +#, fuzzy, no-c-format +msgid "calendar, calendar_date" msgstr "calendar, calendar_date" #. Tag: para +#: basic_mapping.xml:4097 #, no-c-format msgid "" "Type mappings from java.util.Calendar to SQL types " @@ -3679,12 +8185,14 @@ msgstr "" "Mapeos de tipo desde java.util.Date y tipos SQL " "TIMESTAMP y DATE (o equivalente)." -#. Tag: term -#, no-c-format -msgid "big_decimal, big_integer" +#. Tag: literal +#: basic_mapping.xml:4104 +#, fuzzy, no-c-format +msgid "big_decimal, big_integer" msgstr "big_decimal, big_integer" #. Tag: para +#: basic_mapping.xml:4107 #, no-c-format msgid "" "Type mappings from java.math.BigDecimal and java." @@ -3695,12 +8203,14 @@ msgstr "" "math.BigInteger a NUMERIC (o NUMBER de Oracle)." -#. Tag: term -#, no-c-format -msgid "locale, timezone, currency" +#. Tag: literal +#: basic_mapping.xml:4115 +#, fuzzy, no-c-format +msgid "locale, timezone, currency" msgstr "locale, timezone, currency" #. Tag: para +#: basic_mapping.xml:4118 #, no-c-format msgid "" "Type mappings from java.util.Locale, java.util." @@ -3717,12 +8227,14 @@ msgstr "" "mapeadas a sus códigos ISO. Las instancias de TimeZone " "son mapeadas a sus ID." -#. Tag: term -#, no-c-format -msgid "class" -msgstr "class" +#. Tag: literal +#: basic_mapping.xml:4131 +#, fuzzy, no-c-format +msgid "class" +msgstr "Clase" #. Tag: para +#: basic_mapping.xml:4134 #, no-c-format msgid "" "A type mapping from java.lang.Class to VARCHAR (o VARCHAR2 de Oracle). Una Class es mapeada a su nombre completamente calificado." -#. Tag: term +#. Tag: literal +#: basic_mapping.xml:4142 #, no-c-format -msgid "binary" -msgstr "binary" +msgid "binary" +msgstr "" #. Tag: para +#: basic_mapping.xml:4145 #, no-c-format msgid "Maps byte arrays to an appropriate SQL binary type." msgstr "Mapea arreglos de bytes a un tipo binario SQL apropiado." -#. Tag: term +#. Tag: literal +#: basic_mapping.xml:4150 #, no-c-format -msgid "text" -msgstr "text" +msgid "text" +msgstr "" #. Tag: para +#: basic_mapping.xml:4153 #, no-c-format msgid "" "Maps long Java strings to a SQL CLOB or TEXTCLOB o " "TEXT." -#. Tag: term +#. Tag: literal +#: basic_mapping.xml:4159 #, no-c-format -msgid "serializable" -msgstr "serializable" +msgid "serializable" +msgstr "" #. Tag: para +#: basic_mapping.xml:4162 #, no-c-format msgid "" "Maps serializable Java types to an appropriate SQL binary type. You can also " @@ -3774,12 +8292,14 @@ msgstr "" "nombre de una clase o interfaz serializable Java que no sea por defecto un " "tipo básico. " -#. Tag: term +#. Tag: literal +#: basic_mapping.xml:4171 #, no-c-format -msgid "clob, blob" -msgstr "clob, blob" +msgid "clob, blob" +msgstr "" #. Tag: para +#: basic_mapping.xml:4174 #, no-c-format msgid "" "Type mappings for the JDBC classes java.sql.Clob and " @@ -3793,16 +8313,18 @@ msgstr "" "fuera de una transacción. Además, el soporte del controlador suele ser malo " "e inconsistente." -#. Tag: term -#, no-c-format +#. Tag: literal +#: basic_mapping.xml:4184 +#, fuzzy, no-c-format msgid "" -"imm_date, imm_time, imm_timestamp, imm_calendar, imm_calendar_date, " -"imm_serializable, imm_binary" +"imm_date, imm_time, imm_timestamp, imm_calendar, imm_calendar_date, " +"imm_serializable, imm_binary" msgstr "" "imm_date, imm_time, imm_timestamp, imm_calendar, imm_calendar_date, " "imm_serializable, imm_binary" #. Tag: para +#: basic_mapping.xml:4188 #, no-c-format msgid "" "Type mappings for what are considered mutable Java types. This is where " @@ -3822,6 +8344,7 @@ msgstr "" "tiene que asignar un objeto nuevo, no idéntico, a la propiedad." #. Tag: para +#: basic_mapping.xml:4200 #, no-c-format msgid "" "Unique identifiers of entities and collections can be of any basic type " @@ -3835,6 +8358,7 @@ msgstr "" "están permitidos, a continuación encontrará mayor información." #. Tag: para +#: basic_mapping.xml:4205 #, no-c-format msgid "" "The basic value types have corresponding Type constants " @@ -3848,11 +8372,13 @@ msgstr "" "string." #. Tag: title +#: basic_mapping.xml:4212 #, no-c-format msgid "Custom value types" msgstr "Tipos de valor personalizados" #. Tag: para +#: basic_mapping.xml:4214 #, no-c-format msgid "" "It is relatively easy for developers to create their own value types. For " @@ -3877,6 +8403,7 @@ msgstr "" "literal>." #. Tag: para +#: basic_mapping.xml:4225 #, no-c-format msgid "" "To implement a custom type, implement either org.hibernate." @@ -3891,7 +8418,19 @@ msgstr "" "calificado del tipo. Revise org.hibernate.test.DoubleStringType para ver qué clases de cosas son posibles. " +#. Tag: programlisting +#: basic_mapping.xml:4232 +#, no-c-format +msgid "" +"<property name=\"twoStrings\" type=\"org.hibernate.test.DoubleStringType" +"\">\n" +" <column name=\"first_string\"/>\n" +" <column name=\"second_string\"/>\n" +"</property>" +msgstr "" + #. Tag: para +#: basic_mapping.xml:4234 #, no-c-format msgid "" "Notice the use of <column> tags to map a property " @@ -3901,6 +8440,7 @@ msgstr "" "una propiedad a múltiples columnas." #. Tag: para +#: basic_mapping.xml:4237 #, no-c-format msgid "" "The CompositeUserType, EnhancedUserTypeUserType in the " @@ -3929,7 +8470,19 @@ msgstr "" "personalizado, puede utilizar el elemento <type> en " "sus archivos de mapeo. " +#. Tag: programlisting +#: basic_mapping.xml:4250 +#, no-c-format +msgid "" +"<property name=\"priority\">\n" +" <type name=\"com.mycompany.usertypes.DefaultValueIntegerType\">\n" +" <param name=\"default\">0</param>\n" +" </type>\n" +"</property>" +msgstr "" + #. Tag: para +#: basic_mapping.xml:4252 #, no-c-format msgid "" "The UserType can now retrieve the value for the parameter " @@ -3941,6 +8494,7 @@ msgstr "" "literal> que se le pasa." #. Tag: para +#: basic_mapping.xml:4256 #, no-c-format msgid "" "If you regularly use a certain UserType, it is useful to " @@ -3955,7 +8509,24 @@ msgstr "" "nombre a un tipo personalizado y también pueden contener una lista de " "valores predeterminados de parámetros si el tipo se encuentra parametrizado." +#. Tag: programlisting +#: basic_mapping.xml:4262 +#, no-c-format +msgid "" +"<typedef class=\"com.mycompany.usertypes.DefaultValueIntegerType\" name=" +"\"default_zero\">\n" +" <param name=\"default\">0</param>\n" +"</typedef>" +msgstr "" + +#. Tag: programlisting +#: basic_mapping.xml:4264 +#, no-c-format +msgid "<property name=\"priority\" type=\"default_zero\"/>" +msgstr "" + #. Tag: para +#: basic_mapping.xml:4266 #, no-c-format msgid "" "It is also possible to override the parameters supplied in a typedef on a " @@ -3966,6 +8537,7 @@ msgstr "" "propiedad." #. Tag: para +#: basic_mapping.xml:4270 #, no-c-format msgid "" "Even though Hibernate's rich range of built-in types and support for " @@ -3989,11 +8561,13 @@ msgstr "" "valores monetarios." #. Tag: title +#: basic_mapping.xml:4283 #, no-c-format msgid "Mapping a class more than once" msgstr "Mapeo de una clase más de una vez" #. Tag: para +#: basic_mapping.xml:4285 #, no-c-format msgid "" "It is possible to provide more than one mapping for a particular persistent " @@ -4011,7 +8585,31 @@ msgstr "" "objetos persistentes, al escribir consultas, o al mapear asociaciones a la " "entidad mencionada." +#. Tag: programlisting +#: basic_mapping.xml:4293 +#, no-c-format +msgid "" +"<class name=\"Contract\" table=\"Contracts\"\n" +" entity-name=\"CurrentContract\">\n" +" ...\n" +" <set name=\"history\" inverse=\"true\"\n" +" order-by=\"effectiveEndDate desc\">\n" +" <key column=\"currentContractId\"/>\n" +" <one-to-many entity-name=\"HistoricalContract\"/>\n" +" </set>\n" +"</class>\n" +"\n" +"<class name=\"Contract\" table=\"ContractHistory\"\n" +" entity-name=\"HistoricalContract\">\n" +" ...\n" +" <many-to-one name=\"currentContract\"\n" +" column=\"currentContractId\"\n" +" entity-name=\"CurrentContract\"/>\n" +"</class>" +msgstr "" + #. Tag: para +#: basic_mapping.xml:4295 #, no-c-format msgid "" "Associations are now specified using entity-name instead " @@ -4020,12 +8618,20 @@ msgstr "" "Las asociaciones ahora se especifican utilizando entity-name en lugar de class." +#. Tag: para +#: basic_mapping.xml:4299 basic_mapping.xml:4379 basic_mapping.xml:4414 +#, no-c-format +msgid "This feature is not supported in Annotations" +msgstr "" + #. Tag: title +#: basic_mapping.xml:4304 #, no-c-format msgid "SQL quoted identifiers" msgstr "Identificadores SQL en comillas" #. Tag: para +#: basic_mapping.xml:4306 #, no-c-format msgid "" "You can force Hibernate to quote an identifier in the generated SQL by " @@ -4040,101 +8646,32 @@ msgstr "" "comillas para el Dialect SQL. Usualmente comillas dobles, " "a excepción de corchetes para SQL Server y comillas sencillas para MySQL." -#. Tag: title -#, no-c-format -msgid "Metadata alternatives" -msgstr "Alternativas de metadatos" - -#. Tag: para +#. Tag: programlisting +#: basic_mapping.xml:4312 #, no-c-format msgid "" -"XML does not suit all users so there are some alternative ways to define O/R " -"mapping metadata in Hibernate." +"@Entity @Table(name=\"`Line Item`\")\n" +"class LineItem {\n" +" @id @Column(name=\"`Item Id`\") Integer id;\n" +" @Column(name=\"`Item #`\") int itemNumber\n" +"}\n" +"\n" +"<class name=\"LineItem\" table=\"`Line Item`\">\n" +" <id name=\"id\" column=\"`Item Id`\"/><generator class=" +"\"assigned\"/></id>\n" +" <property name=\"itemNumber\" column=\"`Item #`\"/>\n" +" ...\n" +"</class>" msgstr "" -"XML no es para todo el mundo, así que hay algunas formas opcionales de " -"definir metadatos de mapeo O/R en Hibernate." - -#. Tag: title -#, no-c-format -msgid "Using XDoclet markup" -msgstr "Utilización de marcado de XDoclet" - -#. Tag: para -#, no-c-format -msgid "" -"Many Hibernate users prefer to embed mapping information directly in " -"sourcecode using XDoclet @hibernate.tags. We do not cover " -"this approach in this reference guide since it is considered part of " -"XDoclet. However, we include the following example of the Cat class with XDoclet mappings:" -msgstr "" -"Muchos usuarios de Hibernate prefieren incluir la información de mapeo " -"directamente en el código fuente usando las @hibernate.tags XDoclet. No abordaremos este enfoque en este manual de referencia " -"ya que se considera como parte de XDoclet. Sin embargo, incluímos el " -"siguiente ejemplo de la clase Cat con los mapeos XDoclet:" - -#. Tag: para -#, no-c-format -msgid "See the Hibernate website for more examples of XDoclet and Hibernate." -msgstr "" -"Para obtener más ejemplos de XDoclet e Hibernate consulte el sitio web de " -"Hibernate. " - -#. Tag: title -#, no-c-format -msgid "Using JDK 5.0 Annotations" -msgstr "Utlización de Anotaciones JDK 5.0" - -#. Tag: para -#, no-c-format -msgid "" -"JDK 5.0 introduced XDoclet-style annotations at the language level that are " -"type-safe and checked at compile time. This mechanism is more powerful than " -"XDoclet annotations and better supported by tools and IDEs. IntelliJ IDEA, " -"for example, supports auto-completion and syntax highlighting of JDK 5.0 " -"annotations. The new revision of the EJB specification (JSR-220) uses JDK " -"5.0 annotations as the primary metadata mechanism for entity beans. " -"Hibernate3 implements the EntityManager of JSR-220 (the " -"persistence API). Support for mapping metadata is available via the " -"Hibernate Annotations package as a separate download. " -"Both EJB3 (JSR-220) and Hibernate3 metadata is supported." -msgstr "" -"JDK 5.0 introdujo anotaciones del estilo XDoclet a nivel del lenguaje con " -"chequeo seguro de tipos en tiempo de compilación. Este mecanismo es más " -"potente que las anotaciones XDoclet y es mejor soportado por herramientas e " -"IDEs. IntelliJ IDEA, por ejemplo, soporta auto-completación además de " -"resalte de sintaxis de las anotaciones JDK 5.0. La nueva revisión de la " -"especificación de EJB (JSR-220) utiliza anotaciones JDK 5.0 como el " -"mecanismo principal de metadatos para beans de entidad. Hibernate3 " -"implementa el EntityManager del JSR-220 (la API de " -"persistencia). El soporte para metadatos de mapeo está disponible por medio " -"del paquete Anotaciones de Hibernate, como una descarga " -"separada. Tanto los metadatos de EJB3 (JSR-220) como de Hibernate3 se " -"encuentran soportados." - -#. Tag: para -#, no-c-format -msgid "This is an example of a POJO class annotated as an EJB entity bean:" -msgstr "Este es un ejemplo de una clase POJO anotada como un bean de entidad EJB:" - -#. Tag: para -#, no-c-format -msgid "" -"Support for JDK 5.0 Annotations (and JSR-220) is currently under " -"development. Please refer to the Hibernate Annotations module for more " -"details." -msgstr "" -"El soporte para las anotaciones JDK 5.0 (y JSR-220) todavía se encuentra en " -"progreso. Para obtener más información consulte al módulo de anotaciones de " -"Hibernate." #. Tag: title +#: basic_mapping.xml:4316 #, no-c-format msgid "Generated properties" msgstr "Propiedades generadas" #. Tag: para +#: basic_mapping.xml:4318 #, no-c-format msgid "" "Generated properties are properties that have their values generated by the " @@ -4155,6 +8692,7 @@ msgstr "" "emite un select para recuperar los valores generados." #. Tag: para +#: basic_mapping.xml:4327 #, no-c-format msgid "" "Properties marked as generated must additionally be non-insertable and non-" @@ -4164,11 +8702,13 @@ msgid "" "can be marked as generated." msgstr "" "Las propiedades marcadas como generadas tienen que ser además no insertables " -"y no actualizables. Sólamente las versiones, sellos de fecha, " -"y propiedades simples se pueden marcar como generadas." +"y no actualizables. Sólamente las versiones, sellos " +"de fecha, y propiedades simples se pueden marcar como generadas." #. Tag: para +#: basic_mapping.xml:4334 #, no-c-format msgid "" "never (the default): the given property value is not " @@ -4178,6 +8718,7 @@ msgstr "" "generado dentro de la base de datos." #. Tag: para +#: basic_mapping.xml:4337 #, no-c-format msgid "" "insert: the given property value is generated on insert, " @@ -4190,12 +8731,13 @@ msgstr "" "insert: el valor dado de la propiedad es generado en " "insert, pero no es regenerado en las actualizaciones posteriores. Las " "propiedades como fecha-creada (created-date) se encuentran dentro de esta " -"categoría. Aunque las propiedades versión y sello de fecha se pueden marcar " -"como generadas, esta opción no se encuentra disponible." +"categoría. Aunque las propiedades versión y sello de " +"fecha se pueden marcar como generadas, esta opción no se encuentra " +"disponible." #. Tag: para +#: basic_mapping.xml:4344 #, no-c-format msgid "" "always: the property value is generated both on insert " @@ -4204,61 +8746,95 @@ msgstr "" "always: el valor de la propiedad es generado tanto en " "insert como en update." +#. Tag: para +#: basic_mapping.xml:4347 +#, no-c-format +msgid "To mark a property as generated, use @Generated." +msgstr "" + #. Tag: title +#: basic_mapping.xml:4352 #, no-c-format msgid "Column read and write expressions" msgstr "Expresiones de lectura y escritura de columnas" #. Tag: para -#, no-c-format +#: basic_mapping.xml:4354 +#, fuzzy, no-c-format msgid "" "Hibernate allows you to customize the SQL it uses to read and write the " "values of columns mapped to simple properties. For example, if your database provides a set of " "data encryption functions, you can invoke them for individual columns like " -"this: <property name=\"creditCardNumber" -"\"> <column name=\"credit_card_num\" read=\"decrypt(credit_card_num)\" " -"write=\"encrypt(?)\"/> </property>" +"this:" +msgstr "" +"Hibernate le permite personalizar el SQL que utiliza para leer y escribir " +"los valores de las columnas mapeadas a las propiedades simples. Por ejemplo, si su base " +"de datos brinda un grupo de funciones de codificación de datos, puede " +"invocarlas para columnas individuales como esto: <property name=\"creditCardNumber\"> <column name=" +"\"credit_card_num\" read=\"decrypt(credit_card_num)\" write=\"encrypt(?)\"/" +"> </property>" + +#. Tag: programlisting +#: basic_mapping.xml:4359 +#, no-c-format +msgid "" +"<property name=\"creditCardNumber\">\n" +" <column \n" +" name=\"credit_card_num\"\n" +" read=\"decrypt(credit_card_num)\"\n" +" write=\"encrypt(?)\"/>\n" +"</property>" msgstr "" -"Hibernate le permite personalizar el SQL que utiliza para leer y escribir los valores de las columnas mapeadas a las propiedades simples. Por ejemplo, si su base de datos brinda un grupo de funciones de codificación de " -"datos, puede invocarlas para columnas individuales como esto: <property name=\"creditCardNumber" -"\"> <column name=\"credit_card_num\" read=\"decrypt(credit_card_num)\" " -"write=\"encrypt(?)\"/> </property>" #. Tag: para +#: basic_mapping.xml:4361 #, no-c-format msgid "" "Hibernate applies the custom expressions automatically whenever the property " "is referenced in a query. This functionality is similar to a derived-" "property formula with two differences:" -msgstr "Hibernate aplica las expresiones personalizadas de manera automática cuando la propiedad se referencia en una petición. Esta funcionalidad es similar a una propiedad derivada formula con dos diferencias:" +msgstr "" +"Hibernate aplica las expresiones personalizadas de manera automática cuando " +"la propiedad se referencia en una petición. Esta funcionalidad es similar a " +"una propiedad derivada formula con dos diferencias:" #. Tag: para +#: basic_mapping.xml:4366 #, no-c-format msgid "" "The property is backed by one or more columns that are exported as part of " "automatic schema generation." -msgstr "Esta propiedad está respaldada por una o más columnas que se exportan como parte de la generación automática del esquema. " +msgstr "" +"Esta propiedad está respaldada por una o más columnas que se exportan como " +"parte de la generación automática del esquema. " #. Tag: para +#: basic_mapping.xml:4371 #, no-c-format msgid "The property is read-write, not read-only." msgstr "La propiedad es de lectura y escritura no de sólo lectura. " #. Tag: para +#: basic_mapping.xml:4375 #, no-c-format msgid "" "The write expression, if specified, must contain exactly " "one '?' placeholder for the value." -msgstr "Si se especifica la expresión write debe contener exactamente un parémetro de sustitución '?' para el valor." +msgstr "" +"Si se especifica la expresión write debe contener " +"exactamente un parémetro de sustitución '?' para el valor." #. Tag: title +#: basic_mapping.xml:4384 #, no-c-format msgid "Auxiliary database objects" msgstr "Objetos de bases de datos auxiliares" #. Tag: para +#: basic_mapping.xml:4386 #, no-c-format msgid "" "Auxiliary database objects allow for the CREATE and DROP of arbitrary " @@ -4282,6 +8858,7 @@ msgstr "" "bases de datos auxiliares:" #. Tag: para +#: basic_mapping.xml:4396 #, no-c-format msgid "" "The first mode is to explicitly list the CREATE and DROP commands in the " @@ -4290,7 +8867,21 @@ msgstr "" "El primer modo es para numerar explícitamente los comandos CREATE y DROP en " "el archivo de mapeo: " +#. Tag: programlisting +#: basic_mapping.xml:4399 +#, no-c-format +msgid "" +"<hibernate-mapping>\n" +" ...\n" +" <database-object>\n" +" <create>CREATE TRIGGER my_trigger ...</create>\n" +" <drop>DROP TRIGGER my_trigger</drop>\n" +" </database-object>\n" +"</hibernate-mapping>" +msgstr "" + #. Tag: para +#: basic_mapping.xml:4401 #, no-c-format msgid "" "The second mode is to supply a custom class that constructs the CREATE and " @@ -4301,7 +8892,20 @@ msgstr "" "los comandos CREATE y DROP. Esta clase personalizada tiene que implementar " "la interfaz org.hibernate.mapping.AuxiliaryDatabaseObject." +#. Tag: programlisting +#: basic_mapping.xml:4406 +#, no-c-format +msgid "" +"<hibernate-mapping>\n" +" ...\n" +" <database-object>\n" +" <definition class=\"MyTriggerDefinition\"/>\n" +" </database-object>\n" +"</hibernate-mapping>" +msgstr "" + #. Tag: para +#: basic_mapping.xml:4408 #, no-c-format msgid "" "Additionally, these database objects can be optionally scoped so that they " @@ -4311,3 +8915,394 @@ msgstr "" "manera opcional de forma que aplique sólamente cuando se utilicen ciertos " "dialectos. " +#. Tag: programlisting +#: basic_mapping.xml:4411 +#, no-c-format +msgid "" +"<hibernate-mapping>\n" +" ...\n" +" <database-object>\n" +" <definition class=\"MyTriggerDefinition\"/>\n" +" <dialect-scope name=\"org.hibernate.dialect.Oracle9iDialect\"/" +">\n" +" <dialect-scope name=\"org.hibernate.dialect.Oracle10gDialect\"/" +">\n" +" </database-object>\n" +"</hibernate-mapping>" +msgstr "" + +#~ msgid "" +#~ "Use of select-before-update will usually decrease " +#~ "performance. It is useful to prevent a database update trigger being " +#~ "called unnecessarily if you reattach a graph of detached instances to a " +#~ "Session." +#~ msgstr "" +#~ "El uso de select-before-update disminuirá el " +#~ "rendimiento. Es muy útil prevenir que se llame innecesariamente a un " +#~ "disparador de actualización de la base de datos al volver a unir un " +#~ "gráfico de instancias separadas a una Session." + +#~ msgid "Generator" +#~ msgstr "Generador" + +#~ msgid "increment" +#~ msgstr "increment" + +#~ msgid "identity" +#~ msgstr "identity" + +#~ msgid "sequence" +#~ msgstr "sequence" + +#~ msgid "seqhilo" +#~ msgstr "seqhilo" + +#~ msgid "uuid" +#~ msgstr "uuid" + +#~ msgid "" +#~ "uses a 128-bit UUID algorithm to generate identifiers of type string that " +#~ "are unique within a network (the IP address is used). The UUID is encoded " +#~ "as a string of 32 hexadecimal digits in length." +#~ msgstr "" +#~ "utiliza un algoritmo UUID de 128 bits para generar identificadores de " +#~ "tipo cadena, únicos dentro de una red (se utiliza la direccón IP). El " +#~ "UUID se codifica como una cadena hexadecimal de 32 dígitos de largo." + +#~ msgid "guid" +#~ msgstr "guid" + +#~ msgid "native" +#~ msgstr "native" + +#~ msgid "select" +#~ msgstr "select" + +#~ msgid "foreign" +#~ msgstr "foreign" + +#~ msgid "" +#~ "optimizer (optional - defaults to none): See " +#~ msgstr "" +#~ "optimizer (opcional - por defecto es none): Consulte " + +#~ msgid "composite-id" +#~ msgstr "composite-id" + +#~ msgid "" +#~ "A table with a composite key can be mapped with multiple properties of " +#~ "the class as identifier properties. The <composite-id> element accepts <key-property> property " +#~ "mappings and <key-many-to-one> mappings as child " +#~ "elements." +#~ msgstr "" +#~ "Una tabla con clave compuesta se puede mapear con múltiples propiedades " +#~ "de la clase como propiedades identificadoras. El elemento <" +#~ "composite-id> acepta los mapeos de propiedad <" +#~ "key-property> y los mapeos <key-many-to-one> como elementos hijos." + +#~ msgid "" +#~ "The persistent class must override equals()" +#~ " and hashCode() to implement composite " +#~ "identifier equality. It must also implement Serializable." +#~ msgstr "" +#~ "La clase persistente tiene que sobrescribir " +#~ "equals() y hashCode() para " +#~ "implementar la igualdad del identificador compuesto. También tiene que " +#~ "implementar Serializable." + +#~ msgid "" +#~ "Unfortunately, this approach means that a persistent object is its own " +#~ "identifier. There is no convenient \"handle\" other than the object " +#~ "itself. You must instantiate an instance of the persistent class itself " +#~ "and populate its identifier properties before you can load() the persistent state associated with a composite key. We call " +#~ "this approach an embedded composite identifier, and " +#~ "discourage it for serious applications." +#~ msgstr "" +#~ "Desafortunadamente, este enfoque significa que un objeto persistente es " +#~ "su propio identificador. No existe otra \"asa\" conveniente más que el " +#~ "objeto mismo. Debe instanciar una instancia de la clase persistente y " +#~ "poblar sus propiedades identificadoras antes de que pueda load()" +#~ " el estado persistente asociado a una clave compuesta. Este " +#~ "enfoque lo denominamos un identificador compuesto incluído y no lo recomendamos para aplicaciones serias." + +#~ msgid "" +#~ "A second approach is what we call a mapped composite " +#~ "identifier, where the identifier properties named inside the <" +#~ "composite-id> element are duplicated on both the persistent " +#~ "class and a separate identifier class." +#~ msgstr "" +#~ "Un segundo enfoque es lo que denominamos un identificador compuesto " +#~ "mapeado, en donde las propiedades del identificador " +#~ "nombradas dentro del elemento <composite-id> son " +#~ "duplicadas tanto en la clase persistente como en la clase identificadora " +#~ "separada." + +#~ msgid "" +#~ "In this example, both the composite identifier class, " +#~ "MedicareId, and the entity class itself have " +#~ "properties named medicareNumber and " +#~ "dependent. The identifier class must override " +#~ "equals() and hashCode() and " +#~ "implement Serializable. The main disadvantage of this " +#~ "approach is code duplication." +#~ msgstr "" +#~ "En este ejemplo, tanto la clase identificadora compuesta " +#~ "MedicareId como la clase de entidad misma tienen " +#~ "propiedades denominadas medicareNumber y " +#~ "dependent. La clase identificadora tiene que " +#~ "sobrescribir equals() y hashCode() " +#~ "e implementar Serializable. La desventaja principal de " +#~ "este enfoque es la duplicación de código." + +#~ msgid "" +#~ "The following attributes are used to specify a mapped composite " +#~ "identifier:" +#~ msgstr "" +#~ "Los siguientes atributos se utilizan para especificar un identificador " +#~ "compuesto mapeado:" + +#~ msgid "" +#~ "mapped (optional - defaults to false): indicates that a mapped composite identifier is used, and that " +#~ "the contained property mappings refer to both the entity class and the " +#~ "composite identifier class." +#~ msgstr "" +#~ "mapped (opcional, por defecto es false): indica que se utiliza un identificador compuesto mapeado y que " +#~ "los mapeos de propiedad contenidos se refieren tanto a la clase de " +#~ "entidad como a la clase identificadora compuesta. " + +#~ msgid "" +#~ "class (optional - but required for a mapped composite " +#~ "identifier): the class used as a composite identifier." +#~ msgstr "" +#~ "class (opcional, pero requerida por un identificador " +#~ "compuesto mapeado): La clase se utiliza como un identificador compuesto. " + +#~ msgid "" +#~ "We will describe a third, even more convenient approach, where the " +#~ "composite identifier is implemented as a component class in . The attributes described below apply only " +#~ "to this alternative approach:" +#~ msgstr "" +#~ "Vamos a decribir un tercer enfoque, aún más práctico, en donde se " +#~ "implementa el identificador compuesto como una clase componente en . Los atributos descritos a " +#~ "continuación sólamente aplican a este enfoque alternativo:" + +#~ msgid "" +#~ "name (optional - required for this approach): a " +#~ "property of component type that holds the composite identifier. Please " +#~ "see chapter 9 for more information." +#~ msgstr "" +#~ "name (opcional, se necesita para este enfoque): Una " +#~ "propiedad de tipo componente que tiene el identificador compuesto. " +#~ "Consulte el capítulo 9 para obtener mayor información. " + +#~ msgid "" +#~ "class (optional - defaults to the property type " +#~ "determined by reflection): the component class used as a composite " +#~ "identifier. Please see the next section for more information." +#~ msgstr "" +#~ "class (opcional - por defecto es el tipo de propiedad " +#~ "determinado por la reflección): la clase componente utilizada como un " +#~ "identificador compuesto. Vea la siguiente sección para obtener mayor " +#~ "información." + +#~ msgid "" +#~ "The third approach, an identifier component, is " +#~ "recommended for almost all applications." +#~ msgstr "" +#~ "Este tercer enfoque, un componente identificador es " +#~ "el que recomendamos para casi todas las aplicaciones. " + +#~ msgid "Version (optional)" +#~ msgstr "Versión (opcional)" + +#~ msgid "" +#~ "The <version> element is optional and indicates " +#~ "that the table contains versioned data. This is particularly useful if " +#~ "you plan to use long transactions. See below for " +#~ "more information:" +#~ msgstr "" +#~ "El elemento <version> es opcional e indica que " +#~ "la tabla contiene datos versionados. Esto es particularmente útil si " +#~ "planea utilizar transacciones largas. Vea a " +#~ "continuación para obtener mayor información:" + +#~ msgid "" +#~ "Version numbers can be of Hibernate type long, " +#~ "integer, short, timestamp or calendar." +#~ msgstr "" +#~ "Los números de versión pueden ser de tipo Hibernate long, integer, short, " +#~ "timestamp o calendar." + +#~ msgid "Many-to-one" +#~ msgstr "Many-to-one" + +#~ msgid "" +#~ "An ordinary association to another persistent class is declared using a " +#~ "many-to-one element. The relational model is a many-to-" +#~ "one association; a foreign key in one table is referencing the primary " +#~ "key column(s) of the target table." +#~ msgstr "" +#~ "Una asociación ordinaria a otra clase persistente se declara utilizando " +#~ "el elemento many-to-one. El modelo relacional es una " +#~ "asociación muchos-a-uno; una clave foránea en una tabla referencia la " +#~ "columna (o columnas) de la clave principal de la tabla destino." + +#~ msgid "One-to-one" +#~ msgstr "One-to-one" + +#~ msgid "There are two varieties of one-to-one associations:" +#~ msgstr "Existen dos variedades de asociaciones uno-a-uno: " + +#~ msgid "primary key associations" +#~ msgstr "asociaciones de clave primaria" + +#~ msgid "" +#~ "Alternatively, a foreign key with a unique constraint, from " +#~ "Employee to Person, can be " +#~ "expressed as:" +#~ msgstr "" +#~ "Opcionalmente, una clave foránea con una restricción de unicidad, desde " +#~ "Employee a Person, se puede " +#~ "expresar como:" + +#~ msgid "" +#~ "This association can be made bidirectional by adding the following to the " +#~ "Person mapping:" +#~ msgstr "" +#~ "Esta asociación puede hacerse bidireccional agregando lo siguiente al " +#~ "mapeo de Person:" + +#~ msgid "Component and dynamic-component" +#~ msgstr "Componente y componente dinámico" + +#~ msgid "Subclass" +#~ msgstr "Subclase" + +#~ msgid "" +#~ "A discriminator column is not required for this mapping strategy. Each " +#~ "subclass must, however, declare a table column holding the object " +#~ "identifier using the <key> element. The mapping " +#~ "at the start of the chapter would then be re-written as:" +#~ msgstr "" +#~ "No se necesita una columna discriminadora para esta estrategia de mapeo. " +#~ "Sin embargo, cada subclase debe declarar una columna de tabla que tenga " +#~ "el identificador del objeto utilizando el elemento <key>. El mapeo mencionado al comienzo del capítulo se reescribiría " +#~ "así:" + +#~ msgid "Union-subclass" +#~ msgstr "Union-subclass" + +#~ msgid "Join" +#~ msgstr "Join" + +#~ msgid "" +#~ "Using the <join> element, it is possible to map " +#~ "properties of one class to several tables that have a one-to-one " +#~ "relationship. For example:" +#~ msgstr "" +#~ "Al utilizar el elemento <join>, es posible " +#~ "mapear las propiedades de una clase a varias tablas que tengan una " +#~ "relación uno-a-uno. Por ejemplo:" + +#~ msgid "Key" +#~ msgstr "Key" + +#~ msgid "Any" +#~ msgstr "Any" + +#~ msgid "class" +#~ msgstr "class" + +#~ msgid "text" +#~ msgstr "text" + +#~ msgid "clob, blob" +#~ msgstr "clob, blob" + +#~ msgid "" +#~ "XML does not suit all users so there are some alternative ways to define " +#~ "O/R mapping metadata in Hibernate." +#~ msgstr "" +#~ "XML no es para todo el mundo, así que hay algunas formas opcionales de " +#~ "definir metadatos de mapeo O/R en Hibernate." + +#~ msgid "Using XDoclet markup" +#~ msgstr "Utilización de marcado de XDoclet" + +#~ msgid "" +#~ "Many Hibernate users prefer to embed mapping information directly in " +#~ "sourcecode using XDoclet @hibernate.tags. We do not " +#~ "cover this approach in this reference guide since it is considered part " +#~ "of XDoclet. However, we include the following example of the " +#~ "Cat class with XDoclet mappings:" +#~ msgstr "" +#~ "Muchos usuarios de Hibernate prefieren incluir la información de mapeo " +#~ "directamente en el código fuente usando las @hibernate.tags XDoclet. No abordaremos este enfoque en este manual de " +#~ "referencia ya que se considera como parte de XDoclet. Sin embargo, " +#~ "incluímos el siguiente ejemplo de la clase Cat con los " +#~ "mapeos XDoclet:" + +#~ msgid "" +#~ "See the Hibernate website for more examples of XDoclet and Hibernate." +#~ msgstr "" +#~ "Para obtener más ejemplos de XDoclet e Hibernate consulte el sitio web de " +#~ "Hibernate. " + +#~ msgid "Using JDK 5.0 Annotations" +#~ msgstr "Utlización de Anotaciones JDK 5.0" + +#~ msgid "" +#~ "JDK 5.0 introduced XDoclet-style annotations at the language level that " +#~ "are type-safe and checked at compile time. This mechanism is more " +#~ "powerful than XDoclet annotations and better supported by tools and IDEs. " +#~ "IntelliJ IDEA, for example, supports auto-completion and syntax " +#~ "highlighting of JDK 5.0 annotations. The new revision of the EJB " +#~ "specification (JSR-220) uses JDK 5.0 annotations as the primary metadata " +#~ "mechanism for entity beans. Hibernate3 implements the " +#~ "EntityManager of JSR-220 (the persistence API). " +#~ "Support for mapping metadata is available via the Hibernate " +#~ "Annotations package as a separate download. Both EJB3 (JSR-" +#~ "220) and Hibernate3 metadata is supported." +#~ msgstr "" +#~ "JDK 5.0 introdujo anotaciones del estilo XDoclet a nivel del lenguaje con " +#~ "chequeo seguro de tipos en tiempo de compilación. Este mecanismo es más " +#~ "potente que las anotaciones XDoclet y es mejor soportado por herramientas " +#~ "e IDEs. IntelliJ IDEA, por ejemplo, soporta auto-completación además de " +#~ "resalte de sintaxis de las anotaciones JDK 5.0. La nueva revisión de la " +#~ "especificación de EJB (JSR-220) utiliza anotaciones JDK 5.0 como el " +#~ "mecanismo principal de metadatos para beans de entidad. Hibernate3 " +#~ "implementa el EntityManager del JSR-220 (la API de " +#~ "persistencia). El soporte para metadatos de mapeo está disponible por " +#~ "medio del paquete Anotaciones de Hibernate, como una " +#~ "descarga separada. Tanto los metadatos de EJB3 (JSR-220) como de " +#~ "Hibernate3 se encuentran soportados." + +#~ msgid "This is an example of a POJO class annotated as an EJB entity bean:" +#~ msgstr "" +#~ "Este es un ejemplo de una clase POJO anotada como un bean de entidad EJB:" + +#~ msgid "" +#~ "Support for JDK 5.0 Annotations (and JSR-220) is currently under " +#~ "development. Please refer to the Hibernate Annotations module for more " +#~ "details." +#~ msgstr "" +#~ "El soporte para las anotaciones JDK 5.0 (y JSR-220) todavía se encuentra " +#~ "en progreso. Para obtener más información consulte al módulo de " +#~ "anotaciones de Hibernate." diff --git a/documentation/manual/src/main/docbook/es-ES/content/collection_mapping.po b/documentation/manual/src/main/docbook/es-ES/content/collection_mapping.po index db081c119e..ad17d82505 100644 --- a/documentation/manual/src/main/docbook/es-ES/content/collection_mapping.po +++ b/documentation/manual/src/main/docbook/es-ES/content/collection_mapping.po @@ -14,7 +14,7 @@ msgid "" msgstr "" "Project-Id-Version: collection_mapping\n" "Report-Msgid-Bugs-To: http://bugs.kde.org\n" -"POT-Creation-Date: 2010-02-10T07:25:34\n" +"POT-Creation-Date: 2010-07-20 21:02+0000\n" "PO-Revision-Date: 2010-03-16 10:27+1000\n" "Last-Translator: Angela Garcia \n" "Language-Team: \n" @@ -24,33 +24,52 @@ msgstr "" "X-Generator: KBabel 1.11.4\n" #. Tag: title +#: collection_mapping.xml:31 #, no-c-format msgid "Collection mapping" msgstr "Mapeos de colección " #. Tag: title +#: collection_mapping.xml:34 #, no-c-format msgid "Persistent collections" msgstr "Colecciones persistentes" #. Tag: para -#, no-c-format +#: collection_mapping.xml:36 +#, fuzzy, no-c-format msgid "" -"Hibernate requires that persistent collection-valued fields be declared as " -"an interface type. For example:" +"Naturally Hibernate also allows to persist collections. These persistent " +"collections can contain almost any other Hibernate type, including: basic " +"types, custom types, components and references to other entities. The " +"distinction between value and reference semantics is in this context very " +"important. An object in a collection might be handled with \"value\" " +"semantics (its life cycle fully depends on the collection owner), or it " +"might be a reference to another entity with its own life cycle. In the " +"latter case, only the \"link\" between the two objects is considered to be a " +"state held by the collection." msgstr "" -"Hibernate requiere que los campos valuados en colección persistente se " -"declaren como un tipo de interfaz. Por ejemplo:" +"Las colecciones pueden contener casi cualquier tipo de Hibernate, " +"incluyendo: los tipos básicos, personalizados, componentes y referencias a " +"otras entidades. Esta es una diferencia importante. Un objeto en una " +"colección puede ser manejado con una semántica de \"valor\" (su ciclo de " +"vida depende completamente del propietario de la colección) o podría ser una " +"referencia a otra entidad, con su propio ciclo de vida. En el último caso, " +"sólamente el \"enlace\" entre los dos objetos se considera como un estado " +"mantenido por la colección." #. Tag: para -#, no-c-format +#: collection_mapping.xml:46 +#, fuzzy, no-c-format msgid "" -"The actual interface might be java.util.Set, " +"As a requirement persistent collection-valued fields must be declared as an " +"interface type (see ). The actual interface might be java.util.Set, " "java.util.Collection, java.util.List, " "java.util.Map, java.util.SortedSet, " "java.util.SortedMap or anything you like (\"anything you " "like\" means you will have to write an implementation of org." -"hibernate.usertype.UserCollectionType.)" +"hibernate.usertype.UserCollectionType)." msgstr "" "La interfaz real puede ser java.util.Set, java." "util.Collection, java.util.List, java." @@ -60,15 +79,17 @@ msgstr "" "hibernate.usertype.UserCollectionType)." #. Tag: para -#, no-c-format +#: collection_mapping.xml:57 +#, fuzzy, no-c-format msgid "" -"Notice how the instance variable was initialized with an instance of " -"HashSet. This is the best way to initialize collection " +"Notice how in the " +"instance variable parts was initialized with an instance " +"of HashSet. This is the best way to initialize collection " "valued properties of newly instantiated (non-persistent) instances. When you " -"make the instance persistent, by calling persist() for " -"example, Hibernate will actually replace the HashSet with " -"an instance of Hibernate's own implementation of Set. Be " -"aware of the following errors:" +"make the instance persistent, by calling persist(), " +"Hibernate will actually replace the HashSet with an " +"instance of Hibernate's own implementation of Set. Be " +"aware of the following error:" msgstr "" "Note cómo se inicializó la variable de instancia con una instancia de " "HashSet. Esta es la mejor forma de inicializar las " @@ -78,7 +99,30 @@ msgstr "" "HashSet con una instancia de una implementación de " "Set propia de Hibernate. Observe los siguientes errores:" +#. Tag: title +#: collection_mapping.xml:68 +#, no-c-format +msgid "Hibernate uses its own collection implementations" +msgstr "" + +#. Tag: programlisting +#: collection_mapping.xml:70 +#, no-c-format +msgid "" +"Cat cat = new DomesticCat();\n" +"Cat kitten = new DomesticCat();\n" +"....\n" +"Set kittens = new HashSet();\n" +"kittens.add(kitten);\n" +"cat.setKittens(kittens);\n" +"session.persist(cat);\n" +"\n" +"kittens = cat.getKittens(); // Okay, kittens collection is a Set\n" +"(HashSet) cat.getKittens(); // Error!" +msgstr "" + #. Tag: para +#: collection_mapping.xml:73 #, no-c-format msgid "" "The persistent collections injected by Hibernate behave like " @@ -92,6 +136,7 @@ msgstr "" "dependiendo del tipo de interfaz. " #. Tag: para +#: collection_mapping.xml:78 #, no-c-format msgid "" "Collections instances have the usual behavior of value types. They are " @@ -114,53 +159,297 @@ msgstr "" "y una colección vacía." #. Tag: para -#, no-c-format +#: collection_mapping.xml:89 +#, fuzzy, no-c-format msgid "" "Use persistent collections the same way you use ordinary Java collections. " -"However, please ensure you understand the semantics of bidirectional " -"associations (these are discussed later)." +"However, ensure you understand the semantics of bidirectional associations " +"(see )." msgstr "" "Utilice las colecciones persistentes de la misma forma en que utiliza " "colecciones de Java ordinarias. Sin embargo, asegúrese de que entiende la " "semántica de las asociaciones bidireccionales (se discuten más adelante)." #. Tag: title -#, no-c-format -msgid "Collection mappings" -msgstr "Mapeos de colección" +#: collection_mapping.xml:97 +#, fuzzy, no-c-format +msgid "How to map collections" +msgstr "Colecciones ordenadas" #. Tag: para +#: collection_mapping.xml:99 #, no-c-format msgid "" -"There are quite a range of mappings that can be generated for collections " -"that cover many common relational models. We suggest you experiment with the " -"schema generation tool so that you understand how various mapping " -"declarations translate to database tables." +"Using annotations you can map Collections, " +"Lists, Maps and " +"Sets of associated entities using @OneToMany and " +"@ManyToMany. For collections of a basic or embeddable type use " +"@ElementCollection. In the simplest case a collection mapping looks like " +"this:" msgstr "" -"Hay bastantes rangos de mapeos que se pueden generar para colecciones que " -"cubren muchos modelos relacionales comúnes. Le recomendamos que experimente " -"con la herramienta de generación de esquemas para comprender cómo se " -"traducen varias declaraciones de mapeo a tablas de bases de datos." -#. Tag: para +#. Tag: title +#: collection_mapping.xml:107 +#, no-c-format +msgid "Collection mapping using @OneToMany and @JoinColumn" +msgstr "" + +#. Tag: programlisting +#: collection_mapping.xml:109 #, no-c-format msgid "" -"The Hibernate mapping element used for mapping a collection depends upon the " -"type of interface. For example, a <set> element is " -"used for mapping properties of type Set." +"@Entity\n" +"public class Product {\n" +"\n" +" private String serialNumber;\n" +" private Set<Part> parts = new HashSet<Part>();\n" +"\n" +" @Id\n" +" public String getSerialNumber() { return serialNumber; }\n" +" void setSerialNumber(String sn) { serialNumber = sn; }\n" +" \n" +" @OneToMany\n" +" @JoinColumn(name=\"PART_ID\")\n" +" public Set<Part> getParts() { return parts; }\n" +" void setParts(Set parts) { this.parts = parts; }\n" +"}\n" +"\n" +"\n" +"@Entity\n" +"public class Part {\n" +" ...\n" +"}" +msgstr "" + +#. Tag: para +#: collection_mapping.xml:112 +#, no-c-format +msgid "" +"Product describes a unidirectional relationship with Part using the join " +"column PART_ID. In this unidirectional one to many scenario you can also use " +"a join table as seen in ." +msgstr "" + +#. Tag: title +#: collection_mapping.xml:118 +#, no-c-format +msgid "Collection mapping using @OneToMany and @JoinTable" +msgstr "" + +#. Tag: programlisting +#: collection_mapping.xml:121 +#, no-c-format +msgid "" +"@Entity\n" +"public class Product {\n" +"\n" +" private String serialNumber;\n" +" private Set<Part> parts = new HashSet<Part>();\n" +"\n" +" @Id\n" +" public String getSerialNumber() { return serialNumber; }\n" +" void setSerialNumber(String sn) { serialNumber = sn; }\n" +" \n" +" @OneToMany\n" +" @JoinTable(\n" +" name=\"PRODUCT_PARTS\",\n" +" joinColumns = @JoinColumn( name=\"PRODUCT_ID\"),\n" +" inverseJoinColumns = @JoinColumn( name=\"PART_ID\")\n" +" )\n" +" public Set<Part> getParts() { return parts; }\n" +" void setParts(Set parts) { this.parts = parts; }\n" +"}\n" +"\n" +"\n" +"@Entity\n" +"public class Part {\n" +" ...\n" +"}" +msgstr "" + +#. Tag: para +#: collection_mapping.xml:124 +#, no-c-format +msgid "" +"Without describing any physical mapping (no @JoinColumn or @JoinTable), a unidirectional one to " +"many with join table is used. The table name is the concatenation of the " +"owner table name, _, and the other side table name. The foreign key name(s) " +"referencing the owner table is the concatenation of the owner table, _, and " +"the owner primary key column(s) name. The foreign key name(s) referencing " +"the other side is the concatenation of the owner property name, _, and the " +"other side primary key column(s) name. A unique constraint is added to the " +"foreign key referencing the other side table to reflect the one to many." +msgstr "" + +#. Tag: para +#: collection_mapping.xml:135 +#, fuzzy, no-c-format +msgid "" +"Lets have a look now how collections are mapped using Hibernate mapping " +"files. In this case the first step is to chose the right mapping element. It " +"depends on the type of interface. For example, a <set> element is used for mapping properties of type Set." msgstr "" "El elemento de mapeo de Hibernate usado para mapear una colección depende " "del tipo de la interfaz. Por ejemplo, un elemento <set> se utiliza para mapear propiedades de tipo Set. " -#. Tag: para +#. Tag: title +#: collection_mapping.xml:142 +#, no-c-format +msgid "Mapping a Set using <set>" +msgstr "" + +#. Tag: programlisting +#: collection_mapping.xml:144 #, no-c-format msgid "" -"Apart from <set>, there is also <" -"list>, <map>, <bag>, <array> and <primitive-" -"array> mapping elements. The <map> " -"element is representative:" +"<class name=\"Product\">\n" +" <id name=\"serialNumber\" column=\"productSerialNumber\"/>\n" +" <set name=\"parts\">\n" +" <key column=\"productSerialNumber\" not-null=\"true\"/>\n" +" <one-to-many class=\"Part\"/>\n" +" </set>\n" +"</class>" +msgstr "" + +#. Tag: para +#: collection_mapping.xml:147 +#, fuzzy, no-c-format +msgid "" +"In a one-to-many " +"association links the Product and " +"Part entities. This association requires the existence of " +"a foreign key column and possibly an index column to the Part table. This mapping loses certain semantics of normal Java " +"collections:" +msgstr "" +"Una asociación de Product a Part " +"requiere la existencia de una columna clave foránea y posiblemente una " +"columna índice a la tabla Part. Una etiqueta <" +"one-to-many> indica que ésta es una asociación uno-a-muchos." + +#. Tag: para +#: collection_mapping.xml:156 +#, no-c-format +msgid "" +"An instance of the contained entity class cannot belong to more than one " +"instance of the collection." +msgstr "" +"Una instancia de la clase entidad contenida no puede pertenecer a más de una " +"instancia de la colección. " + +#. Tag: para +#: collection_mapping.xml:161 +#, no-c-format +msgid "" +"An instance of the contained entity class cannot appear at more than one " +"value of the collection index." +msgstr "" +"Una instancia de la clase entidad contenida no puede aparecer en más de un " +"valor del índice de colección. " + +#. Tag: para +#: collection_mapping.xml:166 +#, no-c-format +msgid "" +"Looking closer at the used <one-to-many> tag we see " +"that it has the following options." +msgstr "" + +#. Tag: title +#: collection_mapping.xml:170 +#, no-c-format +msgid "options of <one-to-many> element" +msgstr "" + +#. Tag: programlisting +#: collection_mapping.xml:181 +#, no-c-format +msgid "" +"<one-to-many\n" +" class=\"ClassName\"\n" +" not-found=\"ignore|exception\"\n" +" entity-name=\"EntityName\"\n" +" node=\"element-name\"\n" +" embed-xml=\"true|false\"\n" +" />" +msgstr "" + +#. Tag: para +#: collection_mapping.xml:185 +#, no-c-format +msgid "class (required): the name of the associated class." +msgstr "class (requerido): El nombre de la clase asociada. " + +#. Tag: para +#: collection_mapping.xml:190 +#, no-c-format +msgid "" +"not-found (optional - defaults to exception): specifies how cached identifiers that reference missing rows will " +"be handled. ignore will treat a missing row as a null " +"association." +msgstr "" +"not-found (opcional - por defecto es exception): Especifica cómo serán manejados los identificadores en caché que " +"referencien filas perdidas. ignore tratará una fila " +"perdida como una asociación nula." + +#. Tag: para +#: collection_mapping.xml:198 +#, no-c-format +msgid "" +"entity-name (optional): the entity name of the associated " +"class, as an alternative to class." +msgstr "" +"entity-name (opcional): El nombre de entidad de la clase " +"asociada como una alternativa para class. " + +#. Tag: para +#: collection_mapping.xml:206 +#, no-c-format +msgid "" +"The <one-to-many> element does not need to declare " +"any columns. Nor is it necessary to specify the table " +"name anywhere." +msgstr "" +"El elemento <one-to-many> no necesita declarar " +"ninguna columna. Ni es necesario especificar el nombre de table en ningún sitio." + +#. Tag: para +#: collection_mapping.xml:211 +#, fuzzy, no-c-format +msgid "" +"If the foreign key column of a <one-to-many> " +"association is declared NOT NULL, you must declare the " +"<key> mapping not-null=\"true\" " +"or use a bidirectional association with the collection " +"mapping marked inverse=\"true\". See ." +msgstr "" +"Si la columna de la clave foránea de una asociación <one-to-" +"many> se declara NOT NULL, debe declarar el " +"mapeo de <key>not-null=\"true\" " +"o utilizar una asociación bidireccional con el mapeo " +"de colección marcado inverse=\"true\". Vea la discusión " +"sobre asociaciones bidireccionales más adelante en este capítulo para " +"obtener mayor información." + +#. Tag: para +#: collection_mapping.xml:221 +#, fuzzy, no-c-format +msgid "" +"Apart from the <set> tag as shown in , there is also <list>, <map>, <bag>, " +"<array> and <primitive-array> mapping elements. The <map> element is " +"representative:" msgstr "" "Aparte de <set>, existen además los elementos de " "mapeo <list>, <map>, " @@ -168,12 +457,49 @@ msgstr "" "<primitive-array>. El elemento <map>" " es representativo:" +#. Tag: title +#: collection_mapping.xml:229 +#, no-c-format +msgid "Elements of the <map> mapping" +msgstr "" + +#. Tag: programlisting +#: collection_mapping.xml:262 +#, no-c-format +msgid "" +"<map\n" +" name=\"propertyName\"\n" +" table=\"table_name\"\n" +" schema=\"schema_name\"\n" +" lazy=\"true|extra|false\"\n" +" inverse=\"true|false\"\n" +" cascade=\"all|none|save-update|delete|all-delete-orphan|delete-orphan\"\n" +" sort=\"unsorted|natural|comparatorClass\"\n" +" order-by=\"column_name asc|desc\"\n" +" where=\"arbitrary sql where condition\"\n" +" fetch=\"join|select|subselect\"\n" +" batch-size=\"N\"\n" +" access=\"field|property|ClassName\"\n" +" optimistic-lock=\"true|false\"\n" +" mutable=\"true|false\"\n" +" node=\"element-name|.\"\n" +" embed-xml=\"true|false\"\n" +">\n" +"\n" +" <key .... />\n" +" <map-key .... />\n" +" <element .... />\n" +"</map>" +msgstr "" + #. Tag: para +#: collection_mapping.xml:266 #, no-c-format msgid "name: the collection property name" msgstr "name: el nombre de la propiedad de colección" #. Tag: para +#: collection_mapping.xml:270 #, no-c-format msgid "" "table (optional - defaults to property name): the name of " @@ -184,6 +510,7 @@ msgstr "" "asociaciones uno-a-muchos." #. Tag: para +#: collection_mapping.xml:276 #, no-c-format msgid "" "schema (optional): the name of a table schema to override " @@ -193,6 +520,7 @@ msgstr "" "sobrescribir el esquema declarado en el elemento raíz" #. Tag: para +#: collection_mapping.xml:281 #, no-c-format msgid "" "lazy (optional - defaults to true): " @@ -208,6 +536,7 @@ msgstr "" "inicializan la colección. Esto es apropiado para colecciones grandes." #. Tag: para +#: collection_mapping.xml:290 #, no-c-format msgid "" "inverse (optional - defaults to falsecascade (optional - defaults to none): " @@ -228,6 +558,7 @@ msgstr "" "literal>): habilita operaciones en cascada para entidades hijas." #. Tag: para +#: collection_mapping.xml:302 #, no-c-format msgid "" "sort (optional): specifies a sorted collection with " @@ -237,12 +568,13 @@ msgstr "" "ordenamiento natural, o una clase comparadora dada." #. Tag: para -#, no-c-format +#: collection_mapping.xml:308 +#, fuzzy, no-c-format msgid "" -"order-by (optional, JDK1.4 only): specifies a table " -"column or columns that define the iteration order of the Map, Set or bag, together with an optional " -"asc or desc." +"order-by (optional): specifies a table column or columns " +"that define the iteration order of the Map, Set or bag, together with an optional asc or " +"desc." msgstr "" "order-by (opcional, sólamente en JDK1.4): especifica una " "columna de tabla o columnas que definen el orden de iteración del " @@ -250,6 +582,7 @@ msgstr "" "asc o desc opcional." #. Tag: para +#: collection_mapping.xml:316 #, no-c-format msgid "" "where (optional): specifies an arbitrary SQL " @@ -263,6 +596,7 @@ msgstr "" "subconjunto de los datos disponibles." #. Tag: para +#: collection_mapping.xml:324 #, no-c-format msgid "" "fetch (optional, defaults to select): " @@ -275,6 +609,7 @@ msgstr "" "secuencial." #. Tag: para +#: collection_mapping.xml:331 #, no-c-format msgid "" "batch-size (optional, defaults to 1): " @@ -285,6 +620,7 @@ msgstr "" "instancias de esta colección." #. Tag: para +#: collection_mapping.xml:337 #, no-c-format msgid "" "access (optional - defaults to propertyoptimistic-lock (optional - defaults to truemutable (optional - defaults to true): " @@ -321,19 +659,31 @@ msgstr "" "la colección nunca cambian. En algunos casos, esto permite una pequeña " "optimización de rendimiento." +#. Tag: para +#: collection_mapping.xml:360 +#, no-c-format +msgid "" +"After exploring the basic mapping of collections in the preceding paragraphs " +"we will now focus details like physical mapping considerations, indexed " +"collections and collections of value types." +msgstr "" + #. Tag: title +#: collection_mapping.xml:365 #, no-c-format msgid "Collection foreign keys" msgstr "Claves foráneas de colección" #. Tag: para -#, no-c-format +#: collection_mapping.xml:367 +#, fuzzy, no-c-format msgid "" -"Collection instances are distinguished in the database by the foreign key of " -"the entity that owns the collection. This foreign key is referred to as the " -"collection key column, or columns, of the collection " -"table. The collection key column is mapped by the <key> element." +"On the database level collection instances are distinguished by the foreign " +"key of the entity that owns the collection. This foreign key is referred to " +"as the collection key column, or columns, of the " +"collection table. The collection key column is mapped by the " +"@JoinColumn annotation respectively the <" +"key> XML element." msgstr "" "Las instancias de colección se distinguen en la base de datos por la clave " "foránea de la entidad que posee la colección. Se hace referencia a esta " @@ -342,12 +692,12 @@ msgstr "" "literal> mapea la columna clave de la colección." #. Tag: para -#, no-c-format +#: collection_mapping.xml:374 +#, fuzzy, no-c-format msgid "" "There can be a nullability constraint on the foreign key column. For most " "collections, this is implied. For unidirectional one-to-many associations, " -"the foreign key column is nullable by default, so you may need to specify " -"not-null=\"true\"." +"the foreign key column is nullable by default, so you may need to specify" msgstr "" "Puede haber una restricción de nulabilidad sobre la columna de clave " "foránea. Para la mayoría de las colecciones, esto es implícito. Para " @@ -355,99 +705,268 @@ msgstr "" "nulable por defecto, de modo que puede que necesite especificar not-" "null=\"true\"." -#. Tag: para +#. Tag: programlisting +#: collection_mapping.xml:379 #, no-c-format -msgid "The foreign key constraint can use ON DELETE CASCADE." +msgid "@JoinColumn(nullable=false)" +msgstr "" + +#. Tag: para +#: collection_mapping.xml:381 +#, no-c-format +msgid "or" +msgstr "" + +#. Tag: programlisting +#: collection_mapping.xml:383 +#, no-c-format +msgid "<key column=\"productSerialNumber\" not-null=\"true\"/>" +msgstr "" + +#. Tag: para +#: collection_mapping.xml:385 +#, fuzzy, no-c-format +msgid "" +"The foreign key constraint can use ON DELETE CASCADE. In " +"XML this can be expressed via:" msgstr "" "La restricción de clave foránea puede utilizar ON DELETE CASCADE." +#. Tag: programlisting +#: collection_mapping.xml:388 +#, no-c-format +msgid "<key column=\"productSerialNumber\" on-delete=\"cascade\"/>" +msgstr "" + #. Tag: para +#: collection_mapping.xml:390 #, no-c-format msgid "" -"See the previous chapter for a full definition of the <key> element." +"In annotations the Hibernate specific annotation @OnDelete has to be used." +msgstr "" + +#. Tag: programlisting +#: collection_mapping.xml:393 +#, no-c-format +msgid "@OnDelete(action=OnDeleteAction.CASCADE)" +msgstr "" + +#. Tag: para +#: collection_mapping.xml:395 +#, fuzzy, no-c-format +msgid "" +"See for more information about the " +"<key> element." msgstr "" "Vea el capítulo anterior para obtener una definición completa del elemento " "<key>." #. Tag: title -#, no-c-format -msgid "Collection elements" -msgstr "Elementos de collección" - -#. Tag: para -#, no-c-format -msgid "" -"Collections can contain almost any other Hibernate type, including: basic " -"types, custom types, components and references to other entities. This is an " -"important distinction. An object in a collection might be handled with " -"\"value\" semantics (its life cycle fully depends on the collection owner), " -"or it might be a reference to another entity with its own life cycle. In the " -"latter case, only the \"link\" between the two objects is considered to be a " -"state held by the collection." -msgstr "" -"Las colecciones pueden contener casi cualquier tipo de Hibernate, " -"incluyendo: los tipos básicos, personalizados, componentes y referencias a " -"otras entidades. Esta es una diferencia importante. Un objeto en una " -"colección puede ser manejado con una semántica de \"valor\" (su ciclo de " -"vida depende completamente del propietario de la colección) o podría ser una " -"referencia a otra entidad, con su propio ciclo de vida. En el último caso, " -"sólamente el \"enlace\" entre los dos objetos se considera como un estado " -"mantenido por la colección." - -#. Tag: para -#, no-c-format -msgid "" -"The contained type is referred to as the collection element type. Collection elements are mapped by <element> or <composite-element>, or in the case of " -"entity references, with <one-to-many> or " -"<many-to-many>. The first two map elements with " -"value semantics, the next two are used to map entity associations." -msgstr "" -"Se hace referencia al tipo contenido como el tipo de elemento de " -"la colección. Los elementos de colección son mapeados por " -"<element> o <composite-element>, o en el caso de referencias de entidades, con <one-to-" -"many> o <many-to-many>. Las dos " -"primeras mapean elementos con semántica de valor, los dos siguientes se " -"utilizan para mapear asociaciones de entidades." - -#. Tag: title +#: collection_mapping.xml:400 #, no-c-format msgid "Indexed collections" msgstr "Colecciones indexadas" #. Tag: para +#: collection_mapping.xml:402 #, no-c-format msgid "" -"All collection mappings, except those with set and bag semantics, need an " -"index column in the collection table. An index column " -"is a column that maps to an array index, or List index, " -"or Map key. The index of a Map may be " -"of any basic type, mapped with <map-key>. It can be " -"an entity reference mapped with <map-key-many-to-many>, or it can be a composite type mapped with <composite-" -"map-key>. The index of an array or list is always of type " -"integer and is mapped using the <list-" -"index> element. The mapped column contains sequential integers " -"that are numbered from zero by default." +"In the following paragraphs we have a closer at the indexed collections " +"List and Map how the their " +"index can be mapped in Hibernate." +msgstr "" + +#. Tag: title +#: collection_mapping.xml:407 +#, no-c-format +msgid "Lists" msgstr "" -"Todos los mapeos de colección, excepto aquellos con semántica de set o bag, " -"necesitan una columna índice en la tabla de colección. " -"Una columna índice es una columna que mapea a un índice de array o índice de " -"List o llave de Map. El índice de un " -"Map puede ser de cualquier tipo básico, mapeado con " -"<map-key>. Puede ser una referencia de entidad " -"mapeada con <map-key-many-to-many>, o puede ser un " -"tipo compuesto mapeado con <composite-map-key>. El " -"índice de un array o lista es siempre de tipo integer y " -"se mapea utilizando el elemento <list-index>. La " -"columna mapeada contiene enteros secuenciales numerados desde cero, por " -"defecto." #. Tag: para +#: collection_mapping.xml:409 +#, no-c-format +msgid "Lists can be mapped in two different ways:" +msgstr "" + +#. Tag: para +#: collection_mapping.xml:413 +#, no-c-format +msgid "as ordered lists, where the order is not materialized in the database" +msgstr "" + +#. Tag: para +#: collection_mapping.xml:418 +#, no-c-format +msgid "as indexed lists, where the order is materialized in the database" +msgstr "" + +#. Tag: para +#: collection_mapping.xml:423 +#, no-c-format +msgid "" +"To order lists in memory, add @javax.persistence.OrderBy " +"to your property. This annotation takes as parameter a list of comma " +"separated properties (of the target entity) and orders the collection " +"accordingly (eg firstname asc, age desc), if the string is " +"empty, the collection will be ordered by the primary key of the target " +"entity." +msgstr "" + +#. Tag: title +#: collection_mapping.xml:432 +#, no-c-format +msgid "Ordered lists using @OrderBy" +msgstr "" + +#. Tag: programlisting +#: collection_mapping.xml:434 +#, no-c-format +msgid "" +"@Entity\n" +"public class Customer {\n" +" @Id @GeneratedValue public Integer getId() { return id; }\n" +" public void setId(Integer id) { this.id = id; }\n" +" private Integer id;\n" +"\n" +" @OneToMany(mappedBy=\"customer\")\n" +" @OrderBy(\"number\")\n" +" public List<Order> getOrders() { return orders; }\n" +" public void setOrders(List<Order> orders) { this.orders = " +"orders; }\n" +" private List<Order> orders;\n" +"}\n" +"\n" +"@Entity\n" +"public class Order {\n" +" @Id @GeneratedValue public Integer getId() { return id; }\n" +" public void setId(Integer id) { this.id = id; }\n" +" private Integer id;\n" +"\n" +" public String getNumber() { return number; }\n" +" public void setNumber(String number) { this.number = number; }\n" +" private String number;\n" +"\n" +" @ManyToOne\n" +" public Customer getCustomer() { return customer; }\n" +" public void setCustomer(Customer customer) { this.customer = customer; }\n" +" private Customer number;\n" +"}\n" +"\n" +"-- Table schema\n" +"|-------------| |----------|\n" +"| Order | | Customer |\n" +"|-------------| |----------|\n" +"| id | | id |\n" +"| number | |----------| \n" +"| customer_id |\n" +"|-------------|" +msgstr "" + +#. Tag: para +#: collection_mapping.xml:437 +#, no-c-format +msgid "" +"To store the index value in a dedicated column, use the @javax." +"persistence.OrderColumn annotation on your property. This " +"annotations describes the column name and attributes of the column keeping " +"the index value. This column is hosted on the table containing the " +"association foreign key. If the column name is not specified, the default is " +"the name of the referencing property, followed by underscore, followed by " +"ORDER (in the following example, it would be " +"orders_ORDER)." +msgstr "" + +#. Tag: title +#: collection_mapping.xml:448 +#, no-c-format +msgid "Explicit index column using @OrderColumn" +msgstr "" + +#. Tag: programlisting +#: collection_mapping.xml:451 +#, no-c-format +msgid "" +"@Entity\n" +"public class Customer {\n" +" @Id @GeneratedValue public Integer getId() { return id; }\n" +" public void setId(Integer id) { this.id = id; }\n" +" private Integer id;\n" +"\n" +" @OneToMany(mappedBy=\"customer\")\n" +" @OrderColumn(name=\"orders_index\")\n" +" public List<Order> getOrders() { return orders; }\n" +" public void setOrders(List<Order> orders) { this.orders = " +"orders; }\n" +" private List<Order> orders;\n" +"}\n" +"\n" +"@Entity\n" +"public class Order {\n" +" @Id @GeneratedValue public Integer getId() { return id; }\n" +" public void setId(Integer id) { this.id = id; }\n" +" private Integer id;\n" +"\n" +" public String getNumber() { return number; }\n" +" public void setNumber(String number) { this.number = number; }\n" +" private String number;\n" +"\n" +" @ManyToOne\n" +" public Customer getCustomer() { return customer; }\n" +" public void setCustomer(Customer customer) { this.customer = customer; }\n" +" private Customer number;\n" +"}\n" +"\n" +"-- Table schema\n" +"|--------------| |----------|\n" +"| Order | | Customer |\n" +"|--------------| |----------|\n" +"| id | | id |\n" +"| number | |----------| \n" +"| customer_id |\n" +"| orders_order |\n" +"|--------------|" +msgstr "" + +#. Tag: para +#: collection_mapping.xml:455 +#, no-c-format +msgid "" +"We recommend you to convert the legacy @org.hibernate.annotations." +"IndexColumn usages to @OrderColumn unless " +"you are making use of the base property. The base " +"property lets you define the index value of the first element (aka as base " +"index). The usual value is 0 or 1. The " +"default is 0 like in Java." +msgstr "" + +#. Tag: para +#: collection_mapping.xml:464 +#, no-c-format +msgid "" +"Looking again at the Hibernate mapping file equivalent, the index of an " +"array or list is always of type integer and is mapped " +"using the <list-index> element. The mapped column " +"contains sequential integers that are numbered from zero by default." +msgstr "" + +#. Tag: title +#: collection_mapping.xml:471 +#, no-c-format +msgid "index-list element for indexed collections in xml mapping" +msgstr "" + +#. Tag: programlisting +#: collection_mapping.xml:481 +#, no-c-format +msgid "" +"<list-index\n" +" column=\"column_name\"\n" +" base=\"0|1|...\"/>" +msgstr "" + +#. Tag: para +#: collection_mapping.xml:485 #, no-c-format msgid "" "column_name (required): the name of the column holding " @@ -457,6 +976,7 @@ msgstr "" "tiene los valores del índice de la colección." #. Tag: para +#: collection_mapping.xml:490 #, no-c-format msgid "" "base (optional - defaults to 0): the " @@ -468,54 +988,7 @@ msgstr "" "el array." #. Tag: para -#, no-c-format -msgid "" -"column (optional): the name of the column holding the " -"collection index values." -msgstr "" -"column (opcional): el nombre de la columna que tiene los " -"valores del índice de colecciones." - -#. Tag: para -#, no-c-format -msgid "" -"formula (optional): a SQL formula used to evaluate the " -"key of the map." -msgstr "" -"formula (opcional): una fórmula SQL que se usa para " -"evaluar la clave del mapa." - -#. Tag: para -#, no-c-format -msgid "type (required): the type of the map keys." -msgstr "type (requerido): el tipo de las claves del mapa." - -#. Tag: para -#, no-c-format -msgid "" -"column (optional): the name of the foreign key column for " -"the collection index values." -msgstr "" -"column (opcional): el nombre de la columna de la clave " -"foránea para los valores del índice de la colección." - -#. Tag: para -#, no-c-format -msgid "" -"formula (optional): a SQ formula used to evaluate the " -"foreign key of the map key." -msgstr "" -"formula (opcional): una fórmula SQ utilizada para evaluar " -"la clave foránea de la clave de mapeos." - -#. Tag: para -#, no-c-format -msgid "class (required): the entity class used as the map key." -msgstr "" -"class (requerido): La clase de entidad que se usa como la " -"clave mapeada. " - -#. Tag: para +#: collection_mapping.xml:498 #, no-c-format msgid "" "If your table does not have an index column, and you still wish to use " @@ -531,33 +1004,485 @@ msgstr "" "ordenado o clasificado de manera opcional." #. Tag: title +#: collection_mapping.xml:506 #, no-c-format -msgid "Collections of values and many-to-many associations" +msgid "Maps" +msgstr "" + +#. Tag: para +#: collection_mapping.xml:508 +#, no-c-format +msgid "" +"The question with Maps is where the key value is " +"stored. There are everal options. Maps can borrow their keys from one of the " +"associated entity properties or have dedicated columns to store an explicit " +"key." +msgstr "" + +#. Tag: para +#: collection_mapping.xml:513 +#, no-c-format +msgid "" +"To use one of the target entity property as a key of the map, use " +"@MapKey(name=\"myProperty\"), where myProperty is a property name in the target entity. When using " +"@MapKey without the name attribuate, the target entity " +"primary key is used. The map key uses the same column as the property " +"pointed out. There is no additional column defined to hold the map key, " +"because the map key represent a target property. Be aware that once loaded, " +"the key is no longer kept in sync with the property. In other words, if you " +"change the property value, the key will not change automatically in your " +"Java model." +msgstr "" + +#. Tag: title +#: collection_mapping.xml:525 +#, no-c-format +msgid "" +"Use of target entity property as map key via @MapKey" +msgstr "" + +#. Tag: programlisting +#: collection_mapping.xml:528 +#, no-c-format +msgid "" +"@Entity\n" +"public class Customer {\n" +" @Id @GeneratedValue public Integer getId() { return id; }\n" +" public void setId(Integer id) { this.id = id; }\n" +" private Integer id;\n" +"\n" +" @OneToMany(mappedBy=\"customer\")\n" +" @MapKey(name=\"number\")\n" +" public Map<String,Order> getOrders() { return orders; }\n" +" public void setOrders(Map<String,Order> order) { this.orders = " +"orders; }\n" +" private Map<String,Order> orders;\n" +"}\n" +"\n" +"@Entity\n" +"public class Order {\n" +" @Id @GeneratedValue public Integer getId() { return id; }\n" +" public void setId(Integer id) { this.id = id; }\n" +" private Integer id;\n" +"\n" +" public String getNumber() { return number; }\n" +" public void setNumber(String number) { this.number = number; }\n" +" private String number;\n" +"\n" +" @ManyToOne\n" +" public Customer getCustomer() { return customer; }\n" +" public void setCustomer(Customer customer) { this.customer = customer; }\n" +" private Customer number;\n" +"}\n" +"\n" +"-- Table schema\n" +"|-------------| |----------|\n" +"| Order | | Customer |\n" +"|-------------| |----------|\n" +"| id | | id |\n" +"| number | |----------| \n" +"| customer_id |\n" +"|-------------|" +msgstr "" + +#. Tag: para +#: collection_mapping.xml:531 +#, no-c-format +msgid "" +"Alternatively the map key is mapped to a dedicated column or columns. In " +"order to customize the mapping use one of the following annotations:" +msgstr "" + +#. Tag: para +#: collection_mapping.xml:537 +#, no-c-format +msgid "" +"@MapKeyColumn if the map key is a basic type. If you " +"don't specify the column name, the name of the property followed by " +"underscore followed by KEY is used (for example " +"orders_KEY)." +msgstr "" + +#. Tag: para +#: collection_mapping.xml:544 +#, no-c-format +msgid "" +"@MapKeyEnumerated / @MapKeyTemporal if the map key type is respectively an enum or a Date." +msgstr "" + +#. Tag: para +#: collection_mapping.xml:550 +#, no-c-format +msgid "" +"@MapKeyJoinColumn/@MapKeyJoinColumns if the map key type is another entity." +msgstr "" + +#. Tag: para +#: collection_mapping.xml:555 +#, no-c-format +msgid "" +"@AttributeOverride/@AttributeOverrides when the map key is a embeddable object. Use key. as a prefix for your embeddable object property names." +msgstr "" + +#. Tag: para +#: collection_mapping.xml:562 +#, no-c-format +msgid "" +"You can also use @MapKeyClass to define the type of " +"the key if you don't use generics." +msgstr "" + +#. Tag: title +#: collection_mapping.xml:566 +#, no-c-format +msgid "Map key as basic type using @MapKeyColumn" +msgstr "" + +#. Tag: programlisting +#: collection_mapping.xml:569 +#, no-c-format +msgid "" +"@Entity\n" +"public class Customer {\n" +" @Id @GeneratedValue public Integer getId() { return id; }\n" +" public void setId(Integer id) { this.id = id; }\n" +" private Integer id;\n" +"\n" +" @OneToMany @JoinTable(name=\"Cust_Order\")\n" +" @MapKeyColumn(name=\"orders_number\")\n" +" public Map<String,Order> getOrders() { return orders; }\n" +" public void setOrders(Map<String,Order> orders) { this.orders = " +"orders; }\n" +" private Map<String,Order> orders;\n" +"}\n" +"\n" +"@Entity\n" +"public class Order {\n" +" @Id @GeneratedValue public Integer getId() { return id; }\n" +" public void setId(Integer id) { this.id = id; }\n" +" private Integer id;\n" +"\n" +" public String getNumber() { return number; }\n" +" public void setNumber(String number) { this.number = number; }\n" +" private String number;\n" +"\n" +" @ManyToOne\n" +" public Customer getCustomer() { return customer; }\n" +" public void setCustomer(Customer customer) { this.customer = customer; }\n" +" private Customer number;\n" +"}\n" +"\n" +"-- Table schema\n" +"|-------------| |----------| |---------------|\n" +"| Order | | Customer | | Cust_Order |\n" +"|-------------| |----------| |---------------|\n" +"| id | | id | | customer_id |\n" +"| number | |----------| | order_id |\n" +"| customer_id | | orders_number |\n" +"|-------------| |---------------|" +msgstr "" + +#. Tag: para +#: collection_mapping.xml:573 +#, no-c-format +msgid "" +"We recommend you to migrate from @org.hibernate.annotations." +"MapKey / @org.hibernate.annotation.MapKeyManyToMany to the new standard approach described above" +msgstr "" + +#. Tag: para +#: collection_mapping.xml:579 +#, fuzzy, no-c-format +msgid "" +"Using Hibernate mapping files there exists equivalent concepts to the " +"descibed annotations. You have to use <map-key>, " +"<map-key-many-to-many> and <composite-" +"map-key>. <map-key> is used for any " +"basic type, <map-key-many-to-many> for an entity " +"reference and <composite-map-key> for a composite " +"type." +msgstr "" +"Aparte de <set>, existen además los elementos de " +"mapeo <list>, <map>, " +"<bag>, <array> y " +"<primitive-array>. El elemento <map>" +" es representativo:" + +#. Tag: title +#: collection_mapping.xml:590 +#, no-c-format +msgid "map-key xml mapping element" +msgstr "" + +#. Tag: programlisting +#: collection_mapping.xml:601 +#, no-c-format +msgid "" +"<map-key\n" +" column=\"column_name\"\n" +" formula=\"any SQL expression\"\n" +" type=\"type_name\"\n" +" node=\"@attribute-name\"\n" +" length=\"N\"/>" +msgstr "" + +#. Tag: para +#: collection_mapping.xml:605 +#, no-c-format +msgid "" +"column (optional): the name of the column holding the " +"collection index values." +msgstr "" +"column (opcional): el nombre de la columna que tiene los " +"valores del índice de colecciones." + +#. Tag: para +#: collection_mapping.xml:610 +#, no-c-format +msgid "" +"formula (optional): a SQL formula used to evaluate the " +"key of the map." +msgstr "" +"formula (opcional): una fórmula SQL que se usa para " +"evaluar la clave del mapa." + +#. Tag: para +#: collection_mapping.xml:615 +#, no-c-format +msgid "type (required): the type of the map keys." +msgstr "type (requerido): el tipo de las claves del mapa." + +#. Tag: title +#: collection_mapping.xml:623 +#, fuzzy, no-c-format +msgid "map-key-many-to-many" +msgstr "muchos-a-muchos" + +#. Tag: programlisting +#: collection_mapping.xml:634 +#, no-c-format +msgid "" +"<map-key-many-to-many\n" +" column=\"column_name\"\n" +" formula=\"any SQL expression\"\n" +" class=\"ClassName\"\n" +"/>" +msgstr "" + +#. Tag: para +#: collection_mapping.xml:638 +#, no-c-format +msgid "" +"column (optional): the name of the foreign key column for " +"the collection index values." +msgstr "" +"column (opcional): el nombre de la columna de la clave " +"foránea para los valores del índice de la colección." + +#. Tag: para +#: collection_mapping.xml:643 +#, no-c-format +msgid "" +"formula (optional): a SQ formula used to evaluate the " +"foreign key of the map key." +msgstr "" +"formula (opcional): una fórmula SQ utilizada para evaluar " +"la clave foránea de la clave de mapeos." + +#. Tag: para +#: collection_mapping.xml:648 +#, no-c-format +msgid "" +"class (required): the entity class used as the map key." +msgstr "" +"class (requerido): La clase de entidad que se usa como la " +"clave mapeada. " + +#. Tag: title +#: collection_mapping.xml:658 +#, fuzzy, no-c-format +msgid "Collections of basic types and embeddable objects" msgstr "Colecciones de valores y asociaciones muchos-a-muchos" #. Tag: para +#: collection_mapping.xml:660 #, no-c-format msgid "" -"Any collection of values or many-to-many associations requires a dedicated " -"collection table with a foreign key column or columns, " -"collection element column or columns, and possibly an " -"index column or columns." +"In some situations you don't need to associate two entities but simply " +"create a collection of basic types or embeddable objects. Use the " +"@ElementCollection for this case." +msgstr "" + +#. Tag: title +#: collection_mapping.xml:665 +#, no-c-format +msgid "" +"Collection of basic types mapped via @ElementCollection" +msgstr "" + +#. Tag: programlisting +#: collection_mapping.xml:668 +#, no-c-format +msgid "" +"@Entity\n" +"public class User {\n" +" [...]\n" +" public String getLastname() { ...}\n" +"\n" +" @ElementCollection\n" +" @CollectionTable(name=\"Nicknames\", joinColumns=@JoinColumn(name=" +"\"user_id\"))\n" +" @Column(name=\"nickname\")\n" +" public Set<String> getNicknames() { ... } \n" +"}" msgstr "" -"Cualquier colección de valores o asociación muchos-a-muchos requiere una " -"tabla de colección dedicada con una columna o columnas " -"de clave foránea, columna de elemento de colección o " -"columnas y posiblemente una columna o columnas índices." #. Tag: para +#: collection_mapping.xml:671 #, no-c-format msgid "" -"For a collection of values use the <element> tag. " -"For example:" +"The collection table holding the collection data is set using the " +"@CollectionTable annotation. If omitted the " +"collection table name defaults to the concatenation of the name of the " +"containing entity and the name of the collection attribute, separated by an " +"underscore. In our example, it would be User_nicknames." +msgstr "" + +#. Tag: para +#: collection_mapping.xml:678 +#, no-c-format +msgid "" +"The column holding the basic type is set using the @Column annotation. If omitted, the column name defaults to the property " +"name: in our example, it would be nicknames." +msgstr "" + +#. Tag: para +#: collection_mapping.xml:683 +#, no-c-format +msgid "" +"But you are not limited to basic types, the collection type can be any " +"embeddable object. To override the columns of the embeddable object in the " +"collection table, use the @AttributeOverride " +"annotation." +msgstr "" + +#. Tag: title +#: collection_mapping.xml:689 +#, no-c-format +msgid "@ElementCollection for embeddable objects" +msgstr "" + +#. Tag: programlisting +#: collection_mapping.xml:691 +#, no-c-format +msgid "" +"@Entity\n" +"public class User {\n" +" [...]\n" +" public String getLastname() { ...}\n" +"\n" +" @ElementCollection\n" +" @CollectionTable(name=\"Addresses\", joinColumns=@JoinColumn(name=" +"\"user_id\"))\n" +" @AttributeOverrides({\n" +" @AttributeOverride(name=\"street1\", column=@Column(name=\"fld_street" +"\"))\n" +" })\n" +" public Set<Address> getAddresses() { ... } \n" +"}\n" +"\n" +"@Embeddable\n" +"public class Address {\n" +" public String getStreet1() {...}\n" +" [...]\n" +"}" +msgstr "" + +#. Tag: para +#: collection_mapping.xml:694 +#, no-c-format +msgid "Such an embeddable object cannot contains a collection itself." +msgstr "" + +#. Tag: para +#: collection_mapping.xml:698 +#, no-c-format +msgid "" +"in @AttributeOverride, you must use the " +"value. prefix to override properties of the embeddable " +"object used in the map value and the key. prefix to " +"override properties of the embeddable object used in the map key." +msgstr "" + +#. Tag: programlisting +#: collection_mapping.xml:704 +#, no-c-format +msgid "" +"@Entity\n" +"public class User {\n" +" @ElementCollection\n" +" @AttributeOverrides({\n" +" @AttributeOverride(name=\"key.street1\", column=@Column(name=" +"\"fld_street\")),\n" +" @AttributeOverride(name=\"value.stars\", column=@Column(name=\"fld_note" +"\"))\n" +" })\n" +" public Map<Address,Rating> getFavHomes() { ... }" +msgstr "" + +#. Tag: para +#: collection_mapping.xml:708 +#, no-c-format +msgid "" +"We recommend you to migrate from @org.hibernate.annotations." +"CollectionOfElements to the new @ElementCollection annotation." +msgstr "" + +#. Tag: para +#: collection_mapping.xml:714 +#, fuzzy, no-c-format +msgid "" +"Using the mapping file approach a collection of values is mapped using the " +"<element> tag. For example:" msgstr "" "Para una colección de valores utilice la etiqueta <element>. Por ejemplo:" +#. Tag: title +#: collection_mapping.xml:718 +#, no-c-format +msgid "<element> tag for collection values using mapping files" +msgstr "" + +#. Tag: programlisting +#: collection_mapping.xml:730 +#, no-c-format +msgid "" +"<element\n" +" column=\"column_name\"\n" +" formula=\"any SQL expression\"\n" +" type=\"typename\"\n" +" length=\"L\"\n" +" precision=\"P\"\n" +" scale=\"S\"\n" +" not-null=\"true|false\"\n" +" unique=\"true|false\"\n" +" node=\"element-name\"\n" +"/>" +msgstr "" + #. Tag: para +#: collection_mapping.xml:734 #, no-c-format msgid "" "column (optional): the name of the column holding the " @@ -567,6 +1492,7 @@ msgstr "" "valores de los elementos de la colección." #. Tag: para +#: collection_mapping.xml:739 #, no-c-format msgid "" "formula (optional): an SQL formula used to evaluate the " @@ -576,263 +1502,90 @@ msgstr "" "evaluar el elemento." #. Tag: para +#: collection_mapping.xml:744 #, no-c-format msgid "type (required): the type of the collection element." -msgstr "type (requerido): el tipo del elemento de colección." - -#. Tag: para -#, no-c-format -msgid "" -"A many-to-many association is specified using the " -"<many-to-many> element." msgstr "" -"Una asociación muchos-a-muchos se especifica usando el " -"elemento <many-to-many>." - -#. Tag: para -#, no-c-format -msgid "" -"column (optional): the name of the element foreign key " -"column." -msgstr "" -"column (opcional): el nombre de la columna de clave " -"foránea elemento." - -#. Tag: para -#, no-c-format -msgid "" -"formula (optional): an SQL formula used to evaluate the " -"element foreign key value." -msgstr "" -"formula (opcional): una fórmula SQL utilizada para " -"evaluar el valor de la clave foránea elemento." - -#. Tag: para -#, no-c-format -msgid "class (required): the name of the associated class." -msgstr "class (requerido): El nombre de la clase asociada. " - -#. Tag: para -#, no-c-format -msgid "" -"fetch (optional - defaults to join): " -"enables outer-join or sequential select fetching for this association. This " -"is a special case; for full eager fetching in a single SELECT of an entity and its many-to-many relationships to other entities, " -"you would enable join fetching,not only of the collection " -"itself, but also with this attribute on the <many-to-many> nested element." -msgstr "" -"fetch (opcional - por defecto es join): habilita la búsqueda de selects secuenciales o de unión externa " -"para esta asociación. Este es un caso especial; para búsqueda temprana " -"completa en un solo SELECT de una entidad y sus " -"relaciones muchos-a-muchos con otras entidades, habilitaría la búsqueda " -"join,no solo de la colección misma, si no también con " -"este atributo en el elemento anidado <many-to-many>." - -#. Tag: para -#, no-c-format -msgid "" -"unique (optional): enables the DDL generation of a unique " -"constraint for the foreign-key column. This makes the association " -"multiplicity effectively one-to-many." -msgstr "" -"unique (opcional): habilita la generación DDL de una " -"restricción única para la columna de la clave foránea. Esto hace la " -"multiplicidad de la asociación efectivamente uno-a-muchos." - -#. Tag: para -#, no-c-format -msgid "" -"not-found (optional - defaults to exception): specifies how foreign keys that reference missing rows will be " -"handled: ignore will treat a missing row as a null " -"association." -msgstr "" -"not-found (opcional - por defecto es exception): Especifica cómo serán manejadas las claves foráneas que hacen " -"referencia a filas que falten: ignore tratará una fila " -"que falte como una asociación nula." - -#. Tag: para -#, no-c-format -msgid "" -"entity-name (optional): the entity name of the associated " -"class, as an alternative to class." -msgstr "" -"entity-name (opcional): El nombre de entidad de la clase " -"asociada como una alternativa para class. " - -#. Tag: para -#, no-c-format -msgid "" -"property-ref (optional): the name of a property of the " -"associated class that is joined to this foreign key. If not specified, the " -"primary key of the associated class is used." -msgstr "" -"property-ref (opcional): el nombre de una propiedad de la " -"clase asociada que está unida a esta clave foránea. Si no se especifica " -"entonces se utiliza la clave principal de la clase asociada." - -#. Tag: para -#, no-c-format -msgid "Here are some examples." -msgstr "Aquí tiene algunos ejemplos:" - -#. Tag: para -#, no-c-format -msgid "A set of strings:" -msgstr "Un grupo de cadenas:" - -#. Tag: para -#, no-c-format -msgid "" -"A bag containing integers with an iteration order determined by the " -"order-by attribute:" -msgstr "" -"Un bag que contiene enteros con un orden de iteración determinado por el " -"atributo order-by:" - -#. Tag: para -#, no-c-format -msgid "An array of entities, in this case, a many-to-many association:" -msgstr "Una lista de entidades, en este caso, una asociación muchos-a-muchos:" - -#. Tag: para -#, no-c-format -msgid "A map from string indices to dates:" -msgstr "Un mapeo de índices de cadenas a fechas:" - -#. Tag: para -#, no-c-format -msgid "A list of components (this is discussed in the next chapter):" -msgstr "Una lista de componentes (se discuten en el siguiente capítulo):" - -#. Tag: title -#, no-c-format -msgid "One-to-many associations" -msgstr "Asociaciones uno-a-muchos" - -#. Tag: para -#, no-c-format -msgid "" -"A one-to-many association links the tables of two " -"classes via a foreign key with no intervening collection table. This mapping " -"loses certain semantics of normal Java collections:" -msgstr "" -"Una asociación uno-a-muchos enlaza las tablas de dos " -"clases por medio de una clave foránea, sin intervención de tabla de " -"colección alguna. Este mapeo pierde cierta semántica de colecciones Java " -"normales: " - -#. Tag: para -#, no-c-format -msgid "" -"An instance of the contained entity class cannot belong to more than one " -"instance of the collection." -msgstr "" -"Una instancia de la clase entidad contenida no puede pertenecer a más de una " -"instancia de la colección. " - -#. Tag: para -#, no-c-format -msgid "" -"An instance of the contained entity class cannot appear at more than one " -"value of the collection index." -msgstr "" -"Una instancia de la clase entidad contenida no puede aparecer en más de un " -"valor del índice de colección. " - -#. Tag: para -#, no-c-format -msgid "" -"An association from Product to Part " -"requires the existence of a foreign key column and possibly an index column " -"to the Part table. A <one-to-many> tag indicates that this is a one-to-many association." -msgstr "" -"Una asociación de Product a Part " -"requiere la existencia de una columna clave foránea y posiblemente una " -"columna índice a la tabla Part. Una etiqueta <" -"one-to-many> indica que ésta es una asociación uno-a-muchos." - -#. Tag: para -#, no-c-format -msgid "" -"not-found (optional - defaults to exception): specifies how cached identifiers that reference missing rows will " -"be handled. ignore will treat a missing row as a null " -"association." -msgstr "" -"not-found (opcional - por defecto es exception): Especifica cómo serán manejados los identificadores en caché que " -"referencien filas perdidas. ignore tratará una fila " -"perdida como una asociación nula." - -#. Tag: para -#, no-c-format -msgid "" -"The <one-to-many> element does not need to declare " -"any columns. Nor is it necessary to specify the table " -"name anywhere." -msgstr "" -"El elemento <one-to-many> no necesita declarar " -"ninguna columna. Ni es necesario especificar el nombre de table en ningún sitio." - -#. Tag: para -#, no-c-format -msgid "" -"If the foreign key column of a <one-to-many> " -"association is declared NOT NULL, you must declare the " -"<key> mapping not-null=\"true\" " -"or use a bidirectional association with the collection " -"mapping marked inverse=\"true\". See the discussion of " -"bidirectional associations later in this chapter for more information." -msgstr "" -"Si la columna de la clave foránea de una asociación <one-to-" -"many> se declara NOT NULL, debe declarar el " -"mapeo de <key>not-null=\"true\" " -"o utilizar una asociación bidireccional con el mapeo " -"de colección marcado inverse=\"true\". Vea la discusión " -"sobre asociaciones bidireccionales más adelante en este capítulo para " -"obtener mayor información." - -#. Tag: para -#, no-c-format -msgid "" -"The following example shows a map of Part entities by " -"name, where partName is a persistent property of " -"Part. Notice the use of a formula-based index:" -msgstr "" -"El siguiente ejemplo muestra un mapeo de entidades Part " -"por nombre, en donde partName es una propiedad " -"persistente de Part. Observe el uso de un índice basado " -"en fórmula:" +"type (requerido): el tipo del elemento de colección." #. Tag: title +#: collection_mapping.xml:754 #, no-c-format msgid "Advanced collection mappings" msgstr "Mapeos de colección avanzados" #. Tag: title +#: collection_mapping.xml:757 #, no-c-format msgid "Sorted collections" msgstr "Colecciones ordenadas" #. Tag: para +#: collection_mapping.xml:759 #, no-c-format msgid "" "Hibernate supports collections implementing java.util.SortedMap and java.util.SortedSet. You must specify a " -"comparator in the mapping file:" +"literal> and java.util.SortedSet. With annotations you " +"declare a sort comparator using @Sort. You chose between " +"the comparator types unsorted, natural or custom. If you want to use your " +"own comparator implementation, you'll also have to specify the " +"implementation class using the comparator attribute. Note " +"that you need to use either a SortedSet or a " +"SortedMap interface." +msgstr "" + +#. Tag: title +#: collection_mapping.xml:770 +#, fuzzy, no-c-format +msgid "Sorted collection with @Sort" +msgstr "Colecciones ordenadas" + +#. Tag: programlisting +#: collection_mapping.xml:772 +#, no-c-format +msgid "" +"@OneToMany(cascade=CascadeType.ALL, fetch=FetchType.EAGER)\n" +"@JoinColumn(name=\"CUST_ID\")\n" +"@Sort(type = SortType.COMPARATOR, comparator = TicketComparator.class)\n" +"public SortedSet<Ticket> getTickets() {\n" +" return tickets;\n" +"}" msgstr "" -"Hibernate soporta colecciones implementando java.util.SortedMap y java.util.SortedSet. Tiene que especificar un " -"comparador en el archivo de mapeo:" #. Tag: para +#: collection_mapping.xml:775 +#, no-c-format +msgid "" +"Using Hibernate mapping files you specify a comparator in the mapping file " +"with <sort>:" +msgstr "" + +#. Tag: title +#: collection_mapping.xml:779 +#, fuzzy, no-c-format +msgid "Sorted collection using xml mapping" +msgstr "Colecciones ordenadas" + +#. Tag: programlisting +#: collection_mapping.xml:781 +#, no-c-format +msgid "" +"<set name=\"aliases\"\n" +" table=\"person_aliases\" \n" +" sort=\"natural\">\n" +" <key column=\"person\"/>\n" +" <element column=\"name\" type=\"string\"/>\n" +"</set>\n" +"\n" +"<map name=\"holidays\" sort=\"my.custom.HolidayComparator\">\n" +" <key column=\"year_id\"/>\n" +" <map-key column=\"hol_name\" type=\"string\"/>\n" +" <element column=\"hol_date\" type=\"date\"/>\n" +"</map>" +msgstr "" + +#. Tag: para +#: collection_mapping.xml:784 #, no-c-format msgid "" "Allowed values of the sort attribute are " @@ -844,6 +1597,7 @@ msgstr "" "clase que implemente java.util.Comparator." #. Tag: para +#: collection_mapping.xml:789 #, no-c-format msgid "" "Sorted collections actually behave like java.util.TreeSet " @@ -853,14 +1607,15 @@ msgstr "" "TreeSet o java.util.TreeMap." #. Tag: para -#, no-c-format +#: collection_mapping.xml:794 +#, fuzzy, no-c-format msgid "" "If you want the database itself to order the collection elements, use the " "order-by attribute of set, " "bag or map mappings. This solution is " -"only available under JDK 1.4 or higher and is implemented using " -"LinkedHashSet or LinkedHashMap. This " -"performs the ordering in the SQL query and not in the memory." +"implemented using LinkedHashSet or " +"LinkedHashMap and performs the ordering in the SQL query " +"and not in the memory." msgstr "" "Si quiere que la misma base de datos ordene los elementos de la colección, " "utilice el atributo order-by de los mapeos set. Este realiza la ordenación en la consulta SQL y no en memoria." #. Tag: title +#: collection_mapping.xml:802 +#, no-c-format +msgid "Sorting in database using order-by" +msgstr "" + +#. Tag: programlisting +#: collection_mapping.xml:804 +#, no-c-format +msgid "" +"<set name=\"aliases\" table=\"person_aliases\" order-by=\"lower(name) asc" +"\">\n" +" <key column=\"person\"/>\n" +" <element column=\"name\" type=\"string\"/>\n" +"</set>\n" +"\n" +"<map name=\"holidays\" order-by=\"hol_date, hol_name\">\n" +" <key column=\"year_id\"/>\n" +" <map-key column=\"hol_name\" type=\"string\"/>\n" +" <element column=\"hol_date type=\"date\"/>\n" +"</map>" +msgstr "" + +#. Tag: title +#: collection_mapping.xml:808 #, no-c-format msgid "Note" msgstr "Nota" #. Tag: para +#: collection_mapping.xml:810 #, no-c-format msgid "" "The value of the order-by attribute is an SQL ordering, " @@ -884,6 +1664,7 @@ msgstr "" "una ordenación HQL." #. Tag: para +#: collection_mapping.xml:814 #, no-c-format msgid "" "Associations can even be sorted by arbitrary criteria at runtime using a " @@ -894,11 +1675,27 @@ msgstr "" "colección:" #. Tag: title +#: collection_mapping.xml:818 +#, no-c-format +msgid "Sorting via a query filter" +msgstr "" + +#. Tag: programlisting +#: collection_mapping.xml:820 +#, no-c-format +msgid "" +"sortedUsers = s.createFilter( group.getUsers(), \"order by this.name\" ).list" +"();" +msgstr "" + +#. Tag: title +#: collection_mapping.xml:825 #, no-c-format msgid "Bidirectional associations" msgstr "Asociaciones bidireccionales" #. Tag: para +#: collection_mapping.xml:827 #, no-c-format msgid "" "A bidirectional association allows navigation from both " @@ -910,31 +1707,346 @@ msgstr "" "asociación bidireccional:" #. Tag: term +#: collection_mapping.xml:831 #, no-c-format msgid "one-to-many" msgstr "uno-a-muchos" #. Tag: para +#: collection_mapping.xml:834 #, no-c-format msgid "set or bag valued at one end and single-valued at the other" msgstr "conjunto o bag valorados en un lado, monovaluados en el otro" #. Tag: term +#: collection_mapping.xml:840 #, no-c-format msgid "many-to-many" msgstr "muchos-a-muchos" #. Tag: para +#: collection_mapping.xml:843 #, no-c-format msgid "set or bag valued at both ends" msgstr "set o bag valorados en ambos extremos" #. Tag: para +#: collection_mapping.xml:848 #, no-c-format msgid "" -"You can specify a bidirectional many-to-many association by mapping two many-" -"to-many associations to the same database table and declaring one end as " -"inverse. You cannot select an indexed collection." +"Often there exists a many to one association which is the owner side of a " +"bidirectional relationship. The corresponding one to many association is in " +"this case annotated by @OneToMany(mappedBy=...)" +msgstr "" + +#. Tag: title +#: collection_mapping.xml:854 +#, no-c-format +msgid "Bidirectional one to many with many to one side as association owner" +msgstr "" + +#. Tag: programlisting +#: collection_mapping.xml:857 +#, no-c-format +msgid "" +"@Entity\n" +"public class Troop {\n" +" @OneToMany(mappedBy=\"troop\")\n" +" public Set<Soldier> getSoldiers() {\n" +" ...\n" +"}\n" +"\n" +"@Entity\n" +"public class Soldier {\n" +" @ManyToOne\n" +" @JoinColumn(name=\"troop_fk\")\n" +" public Troop getTroop() {\n" +" ...\n" +"}" +msgstr "" + +#. Tag: para +#: collection_mapping.xml:860 +#, no-c-format +msgid "" +"Troop has a bidirectional one to many relationship " +"with Soldier through the troop " +"property. You don't have to (must not) define any physical mapping in the " +"mappedBy side." +msgstr "" + +#. Tag: para +#: collection_mapping.xml:865 +#, no-c-format +msgid "" +"To map a bidirectional one to many, with the one-to-many side as the owning " +"side, you have to remove the mappedBy element and set the " +"many to one @JoinColumn as insertable and updatable to " +"false. This solution is not optimized and will produce additional UPDATE " +"statements." +msgstr "" + +#. Tag: title +#: collection_mapping.xml:872 +#, fuzzy, no-c-format +msgid "Bidirectional associtaion with one to many side as owner" +msgstr "Asociaciones bidireccionales con colecciones indexadas" + +#. Tag: programlisting +#: collection_mapping.xml:875 +#, no-c-format +msgid "" +"@Entity\n" +"public class Troop {\n" +" @OneToMany\n" +" @JoinColumn(name=\"troop_fk\") //we need to duplicate the physical " +"information\n" +" public Set<Soldier> getSoldiers() {\n" +" ...\n" +"}\n" +"\n" +"@Entity\n" +"public class Soldier {\n" +" @ManyToOne\n" +" @JoinColumn(name=\"troop_fk\", insertable=false, updatable=false)\n" +" public Troop getTroop() {\n" +" ...\n" +"}" +msgstr "" + +#. Tag: para +#: collection_mapping.xml:878 +#, fuzzy, no-c-format +msgid "" +"How does the mappping of a bidirectional mapping look like in Hibernate " +"mapping xml? There you define a bidirectional one-to-many association by " +"mapping a one-to-many association to the same table column(s) as a many-to-" +"one association and declaring the many-valued end inverse=\"true\"." +msgstr "" +"Puede definir una asociación bidireccional uno-a-muchos mapeando una " +"asociación uno-a-muchos a la misma columna (o columnas) de tabla como una " +"asociación muchos-a-uno y declarando el extremo multivaluado " +"inverse=\"true\"." + +#. Tag: title +#: collection_mapping.xml:885 +#, no-c-format +msgid "Bidirectional one to many via Hibernate mapping files" +msgstr "" + +#. Tag: programlisting +#: collection_mapping.xml:887 +#, no-c-format +msgid "" +"<class name=\"Parent\">\n" +" <id name=\"id\" column=\"parent_id\"/>\n" +" ....\n" +" <set name=\"children\" inverse=\"true\">\n" +" <key column=\"parent_id\"/>\n" +" <one-to-many class=\"Child\"/>\n" +" </set>\n" +"</class>\n" +"\n" +"<class name=\"Child\">\n" +" <id name=\"id\" column=\"child_id\"/>\n" +" ....\n" +" <many-to-one name=\"parent\" \n" +" class=\"Parent\" \n" +" column=\"parent_id\"\n" +" not-null=\"true\"/>\n" +"</class>" +msgstr "" + +#. Tag: para +#: collection_mapping.xml:890 +#, no-c-format +msgid "" +"Mapping one end of an association with inverse=\"true\" " +"does not affect the operation of cascades as these are orthogonal concepts." +msgstr "" +"Mapear un extremo de una asociación con inverse=\"true\" " +"no afecta la operación de cascadas ay que éstos son conceptos ortogonales." + +#. Tag: para +#: collection_mapping.xml:894 +#, no-c-format +msgid "" +"A many-to-many association is defined logically using the " +"@ManyToMany annotation. You also have to describe the " +"association table and the join conditions using the @JoinTable annotation. If the association is bidirectional, one side has to be " +"the owner and one side has to be the inverse end (ie. it will be ignored " +"when updating the relationship values in the association table):" +msgstr "" + +#. Tag: title +#: collection_mapping.xml:903 +#, no-c-format +msgid "Many to many association via @ManyToMany" +msgstr "" + +#. Tag: programlisting +#: collection_mapping.xml:905 +#, no-c-format +msgid "" +"@Entity\n" +"public class Employer implements Serializable {\n" +" @ManyToMany(\n" +" targetEntity=org.hibernate.test.metadata.manytomany.Employee.class,\n" +" cascade={CascadeType.PERSIST, CascadeType.MERGE}\n" +" )\n" +" @JoinTable(\n" +" name=\"EMPLOYER_EMPLOYEE\",\n" +" joinColumns=@JoinColumn(name=\"EMPER_ID\"),\n" +" inverseJoinColumns=@JoinColumn(name=\"EMPEE_ID\")\n" +" )\n" +" public Collection getEmployees() {\n" +" return employees;\n" +" }\n" +" ...\n" +"}" +msgstr "" + +#. Tag: programlisting +#: collection_mapping.xml:907 +#, no-c-format +msgid "" +"@Entity\n" +"public class Employee implements Serializable {\n" +" @ManyToMany(\n" +" cascade = {CascadeType.PERSIST, CascadeType.MERGE},\n" +" mappedBy = \"employees\",\n" +" targetEntity = Employer.class\n" +" )\n" +" public Collection getEmployers() {\n" +" return employers;\n" +" }\n" +"}" +msgstr "" + +#. Tag: para +#: collection_mapping.xml:910 +#, no-c-format +msgid "" +"In this example @JoinTable defines a name, an array of join columns, and an array of inverse join columns. " +"The latter ones are the columns of the association table which refer to the " +"Employee primary key (the \"other side\"). As seen " +"previously, the other side don't have to (must not) describe the physical " +"mapping: a simple mappedBy argument containing the owner " +"side property name bind the two." +msgstr "" + +#. Tag: para +#: collection_mapping.xml:919 +#, no-c-format +msgid "" +"As any other annotations, most values are guessed in a many to many " +"relationship. Without describing any physical mapping in a unidirectional " +"many to many the following rules applied. The table name is the " +"concatenation of the owner table name, _ and the other side " +"table name. The foreign key name(s) referencing the owner table is the " +"concatenation of the owner table name, _ and the owner " +"primary key column(s). The foreign key name(s) referencing the other side is " +"the concatenation of the owner property name, _, and the " +"other side primary key column(s). These are the same rules used for a " +"unidirectional one to many relationship." +msgstr "" + +#. Tag: title +#: collection_mapping.xml:932 +#, no-c-format +msgid "Default values for @ManyToMany (uni-directional)" +msgstr "" + +#. Tag: programlisting +#: collection_mapping.xml:935 +#, no-c-format +msgid "" +"@Entity\n" +"public class Store {\n" +" @ManyToMany(cascade = CascadeType.PERSIST)\n" +" public Set<City> getImplantedIn() {\n" +" ...\n" +" }\n" +"}\n" +"\n" +"@Entity\n" +"public class City {\n" +" ... //no bidirectional relationship\n" +"}" +msgstr "" + +#. Tag: para +#: collection_mapping.xml:938 +#, no-c-format +msgid "" +"A Store_City is used as the join table. The " +"Store_id column is a foreign key to the Store table. The implantedIn_id column is a foreign " +"key to the City table." +msgstr "" + +#. Tag: para +#: collection_mapping.xml:943 +#, no-c-format +msgid "" +"Without describing any physical mapping in a bidirectional many to many the " +"following rules applied. The table name is the concatenation of the owner " +"table name, _ and the other side table name. The foreign " +"key name(s) referencing the owner table is the concatenation of the other " +"side property name, _, and the owner primary key column(s). " +"The foreign key name(s) referencing the other side is the concatenation of " +"the owner property name, _, and the other side primary key " +"column(s). These are the same rules used for a unidirectional one to many " +"relationship." +msgstr "" + +#. Tag: title +#: collection_mapping.xml:955 +#, no-c-format +msgid "Default values for @ManyToMany (bi-directional)" +msgstr "" + +#. Tag: programlisting +#: collection_mapping.xml:958 +#, no-c-format +msgid "" +"@Entity\n" +"public class Store {\n" +" @ManyToMany(cascade = {CascadeType.PERSIST, CascadeType.MERGE})\n" +" public Set<Customer> getCustomers() {\n" +" ...\n" +" }\n" +"}\n" +"\n" +"@Entity\n" +"public class Customer {\n" +" @ManyToMany(mappedBy=\"customers\")\n" +" public Set<Store> getStores() {\n" +" ...\n" +" }\n" +"}" +msgstr "" + +#. Tag: para +#: collection_mapping.xml:961 +#, no-c-format +msgid "" +"A Store_Customer is used as the join table. The " +"stores_id column is a foreign key to the Store table. The customers_id column is a foreign key " +"to the Customer table." +msgstr "" + +#. Tag: para +#: collection_mapping.xml:966 +#, fuzzy, no-c-format +msgid "" +"Using Hibernate mapping files you can map a bidirectional many-to-many " +"association by mapping two many-to-many associations to the same database " +"table and declaring one end as inverse." msgstr "" "Puede especificar una asociación bidireccional muchos-a-muchos simplemente " "mapeando dos asociaciones muchos-a-muchos a la misma tabla de base de datos " @@ -942,17 +2054,56 @@ msgstr "" "usted escoge, pero no puede ser una colección indexada)." #. Tag: para +#: collection_mapping.xml:970 #, no-c-format +msgid "You cannot select an indexed collection." +msgstr "" + +#. Tag: para +#: collection_mapping.xml:973 +#, fuzzy, no-c-format msgid "" -"Here is an example of a bidirectional many-to-many association that " -"illustrates how each category can have many items and each item can be in " -"many categories:" +"shows a bidirectional many-to-many association that illustrates how each " +"category can have many items and each item can be in many categories:" msgstr "" "He aquí un ejemplo de una asociación bidireccional muchos-a-muchos que " "ilustra la manera en que cada categoría puede tener muchos ítems y cada ítem " "puede estar en muchas categorías:" +#. Tag: title +#: collection_mapping.xml:979 +#, no-c-format +msgid "Many to many association using Hibernate mapping files" +msgstr "" + +#. Tag: programlisting +#: collection_mapping.xml:981 +#, no-c-format +msgid "" +"<class name=\"Category\">\n" +" <id name=\"id\" column=\"CATEGORY_ID\"/>\n" +" ...\n" +" <bag name=\"items\" table=\"CATEGORY_ITEM\">\n" +" <key column=\"CATEGORY_ID\"/>\n" +" <many-to-many class=\"Item\" column=\"ITEM_ID\"/>\n" +" </bag>\n" +"</class>\n" +"\n" +"<class name=\"Item\">\n" +" <id name=\"id\" column=\"ITEM_ID\"/>\n" +" ...\n" +"\n" +" <!-- inverse end -->\n" +" <bag name=\"categories\" table=\"CATEGORY_ITEM\" inverse=\"true" +"\">\n" +" <key column=\"ITEM_ID\"/>\n" +" <many-to-many class=\"Category\" column=\"CATEGORY_ID\"/>\n" +" </bag>\n" +"</class>" +msgstr "" + #. Tag: para +#: collection_mapping.xml:984 #, no-c-format msgid "" "Changes made only to the inverse end of the association are notinverse=\"true\"." -msgstr "" -"Puede definir una asociación bidireccional uno-a-muchos mapeando una " -"asociación uno-a-muchos a la misma columna (o columnas) de tabla como una " -"asociación muchos-a-uno y declarando el extremo multivaluado " -"inverse=\"true\"." - -#. Tag: para -#, no-c-format -msgid "" -"Mapping one end of an association with inverse=\"true\" " -"does not affect the operation of cascades as these are orthogonal concepts." -msgstr "" -"Mapear un extremo de una asociación con inverse=\"true\" " -"no afecta la operación de cascadas ay que éstos son conceptos ortogonales." - #. Tag: title +#: collection_mapping.xml:1003 #, no-c-format msgid "Bidirectional associations with indexed collections" msgstr "Asociaciones bidireccionales con colecciones indexadas" #. Tag: para -#, no-c-format +#: collection_mapping.xml:1005 +#, fuzzy, no-c-format msgid "" -"A bidirectional association where one end is represented as a <" -"list> or <map>, requires special " -"consideration. If there is a property of the child class that maps to the " -"index column you can use inverse=\"true\" on the " -"collection mapping:" +"There are some additional considerations for bidirectional mappings with " +"indexed collections (where one end is represented as a <list>" +" or <map>) when using Hibernate mapping " +"files. If there is a property of the child class that maps to the index " +"column you can use inverse=\"true\" on the collection " +"mapping:" msgstr "" "Requiere especial atención una asociación bidireccional en donde un extremo " "esté representado como una <list> o <" @@ -1018,7 +2172,41 @@ msgstr "" "columna índice, puede utilizar inverse=\"true\" en el " "mapeo de la colección:" +#. Tag: title +#: collection_mapping.xml:1013 +#, fuzzy, no-c-format +msgid "Bidirectional association with indexed collection" +msgstr "Asociaciones bidireccionales con colecciones indexadas" + +#. Tag: programlisting +#: collection_mapping.xml:1015 +#, no-c-format +msgid "" +"<class name=\"Parent\">\n" +" <id name=\"id\" column=\"parent_id\"/>\n" +" ....\n" +" <map name=\"children\" inverse=\"true\">\n" +" <key column=\"parent_id\"/>\n" +" <map-key column=\"name\" \n" +" type=\"string\"/>\n" +" <one-to-many class=\"Child\"/>\n" +" </map>\n" +"</class>\n" +"\n" +"<class name=\"Child\">\n" +" <id name=\"id\" column=\"child_id\"/>\n" +" ....\n" +" <property name=\"name\" \n" +" not-null=\"true\"/>\n" +" <many-to-one name=\"parent\" \n" +" class=\"Parent\" \n" +" column=\"parent_id\"\n" +" not-null=\"true\"/>\n" +"</class>" +msgstr "" + #. Tag: para +#: collection_mapping.xml:1018 #, no-c-format msgid "" "If there is no such property on the child class, the association cannot be " @@ -1033,7 +2221,42 @@ msgstr "" "este caso, no puede mapear la colección con inverse=\"true\". En cambio, puede usar el siguiente mapeo:" +#. Tag: title +#: collection_mapping.xml:1026 +#, fuzzy, no-c-format +msgid "Bidirectional association with indexed collection, but no index column" +msgstr "Asociaciones bidireccionales con colecciones indexadas" + +#. Tag: programlisting +#: collection_mapping.xml:1029 +#, no-c-format +msgid "" +"<class name=\"Parent\">\n" +" <id name=\"id\" column=\"parent_id\"/>\n" +" ....\n" +" <map name=\"children\">\n" +" <key column=\"parent_id\"\n" +" not-null=\"true\"/>\n" +" <map-key column=\"name\" \n" +" type=\"string\"/>\n" +" <one-to-many class=\"Child\"/>\n" +" </map>\n" +"</class>\n" +"\n" +"<class name=\"Child\">\n" +" <id name=\"id\" column=\"child_id\"/>\n" +" ....\n" +" <many-to-one name=\"parent\" \n" +" class=\"Parent\" \n" +" column=\"parent_id\"\n" +" insert=\"false\"\n" +" update=\"false\"\n" +" not-null=\"true\"/>\n" +"</class>" +msgstr "" + #. Tag: para +#: collection_mapping.xml:1032 #, no-c-format msgid "" "Note that in this mapping, the collection-valued end of the association is " @@ -1043,11 +2266,13 @@ msgstr "" "responsable de las actualizaciones de la clave foránea. " #. Tag: title +#: collection_mapping.xml:1037 #, no-c-format msgid "Ternary associations" msgstr "Asociaciones ternarias" #. Tag: para +#: collection_mapping.xml:1039 #, no-c-format msgid "" "There are three possible approaches to mapping a ternary association. One " @@ -1056,40 +2281,64 @@ msgstr "" "Hay tres enfoques posibles para mapear una asociación ternaria. Una es " "utilizar un Map con una asociación como su índice: " -#. Tag: para +#. Tag: title +#: collection_mapping.xml:1044 +#, fuzzy, no-c-format +msgid "Ternary association mapping" +msgstr "Asociaciones ternarias" + +#. Tag: programlisting +#: collection_mapping.xml:1046 #, no-c-format msgid "" +"@Entity\n" +"public class Company {\n" +" @Id \n" +" int id;\n" +" ...\n" +" @OneToMany // unidirectional\n" +" @MapKeyJoinColumn(name=\"employee_id\")\n" +" Map<Employee, Contract> contracts;\n" +"}\n" +"\n" +"// or\n" +"\n" +"<map name=\"contracts\">\n" +" <key column=\"employer_id\" not-null=\"true\"/>\n" +" <map-key-many-to-many column=\"employee_id\" class=\"Employee\"/>\n" +" <one-to-many class=\"Contract\"/>\n" +"</map>" +msgstr "" + +#. Tag: para +#: collection_mapping.xml:1049 +#, fuzzy, no-c-format +msgid "" "A second approach is to remodel the association as an entity class. This is " -"the most common approach." +"the most common approach. A final alternative is to use composite elements, " +"which will be discussed later." msgstr "" "Un segundo enfoque es remodelar la asociación como una clase de entidad. " "Este es el enfoque más común." -#. Tag: para -#, no-c-format -msgid "" -"A final alternative is to use composite elements, which will be discussed " -"later." -msgstr "" -"La última opción es utilizar elementos compuestos que discutiremos más " -"adelante." - -#. Tag: title -#, no-c-format -msgid "Using an <idbag>" +#. Tag: literal +#: collection_mapping.xml:1055 +#, fuzzy, no-c-format +msgid "Using an <idbag>" msgstr "Utilización de un <idbag>" #. Tag: para -#, no-c-format +#: collection_mapping.xml:1057 +#, fuzzy, no-c-format msgid "" "The majority of the many-to-many associations and collections of values " "shown previously all map to tables with composite keys, even though it has " -"been have suggested that entities should have synthetic identifiers " -"(surrogate keys). A pure association table does not seem to benefit much " -"from a surrogate key, although a collection of composite values " -"might. It is for this reason that Hibernate provides a " -"feature that allows you to map many-to-many associations and collections of " -"values to a table with a surrogate key." +"been suggested that entities should have synthetic identifiers (surrogate " +"keys). A pure association table does not seem to benefit much from a " +"surrogate key, although a collection of composite values might. For this reason Hibernate provides a feature that allows you to " +"map many-to-many associations and collections of values to a table with a " +"surrogate key." msgstr "" "La mayoría de las asociaciones muchos-a-muchos y las colecciones de valores " "que hemos mostrado hasta ahora mapean a tablas con claves compuestas, aunque " @@ -1101,6 +2350,7 @@ msgstr "" "y colecciones de valores a una tabla con una llave sustituta." #. Tag: para +#: collection_mapping.xml:1066 #, no-c-format msgid "" "The <idbag> element lets you map a ListList (o Collection) con semántica de " "bag. Por ejemplo:" +#. Tag: programlisting +#: collection_mapping.xml:1070 +#, no-c-format +msgid "" +"<idbag name=\"lovers\" table=\"LOVERS\">\n" +" <collection-id column=\"ID\" type=\"long\">\n" +" <generator class=\"sequence\"/>\n" +" </collection-id>\n" +" <key column=\"PERSON1\"/>\n" +" <many-to-many column=\"PERSON2\" class=\"Person\" fetch=\"join\"/" +">\n" +"</idbag>" +msgstr "" + #. Tag: para +#: collection_mapping.xml:1072 #, no-c-format msgid "" "An <idbag> has a synthetic id generator, just like " @@ -1125,6 +2390,7 @@ msgstr "" "particular." #. Tag: para +#: collection_mapping.xml:1077 #, no-c-format msgid "" "The update performance of an <idbag> supersedes a " @@ -1138,6 +2404,7 @@ msgstr "" "borrarlas individualmente, al igual que si fuese una lista, mapa o conjunto." #. Tag: para +#: collection_mapping.xml:1082 #, no-c-format msgid "" "In the current implementation, the native identifier " @@ -1149,23 +2416,59 @@ msgstr "" "colecciones <idbag>." #. Tag: title +#: collection_mapping.xml:1103 #, no-c-format msgid "Collection examples" msgstr "Ejemplos de colección" #. Tag: para +#: collection_mapping.xml:1105 #, no-c-format msgid "This section covers collection examples." msgstr "Esta sección cubre los ejemplos de colección. " #. Tag: para +#: collection_mapping.xml:1107 #, no-c-format -msgid "The following class has a collection of Child instances:" +msgid "" +"The following class has a collection of Child instances:" msgstr "" "La siguiente clase tiene una colección de instancias Child:" +#. Tag: title +#: collection_mapping.xml:1111 +#, no-c-format +msgid "" +"Example classes Parent and Child" +msgstr "" + +#. Tag: programlisting +#: collection_mapping.xml:1114 +#, no-c-format +msgid "" +"public class Parent {\n" +" private long id;\n" +" private Set<Child> children;\n" +"\n" +" // getter/setter\n" +" ...\n" +"}\n" +"\n" +"\n" +"public class Child {\n" +" private long id;\n" +" private String name\n" +"\n" +" \n" +" // getter/setter\n" +" ...\n" +"}" +msgstr "" + #. Tag: para +#: collection_mapping.xml:1117 #, no-c-format msgid "" "If each child has, at most, one parent, the most natural mapping is a one-to-" @@ -1174,12 +2477,103 @@ msgstr "" "Si cada hijo tiene como mucho un padre, el mapeo más natural es una " "asociación uno-a-muchos:" +#. Tag: title +#: collection_mapping.xml:1121 +#, no-c-format +msgid "" +"One to many unidirectional Parent-Child relationship " +"using annotations" +msgstr "" + +#. Tag: programlisting +#: collection_mapping.xml:1124 +#, no-c-format +msgid "" +"public class Parent {\n" +" @Id\n" +" @GeneratedValue\n" +" private long id;\n" +"\n" +" @OneToMany\n" +" private Set<Child> children;\n" +"\n" +" // getter/setter\n" +" ...\n" +"}\n" +"\n" +"\n" +"public class Child {\n" +" @Id\n" +" @GeneratedValue\n" +" private long id;\n" +" private String name;\n" +"\n" +" \n" +" // getter/setter\n" +" ...\n" +"}" +msgstr "" + +#. Tag: title +#: collection_mapping.xml:1128 +#, no-c-format +msgid "" +"One to many unidirectional Parent-Child relationship " +"using mapping files" +msgstr "" + +#. Tag: programlisting +#: collection_mapping.xml:1131 +#, no-c-format +msgid "" +"<hibernate-mapping>\n" +"\n" +" <class name=\"Parent\">\n" +" <id name=\"id\">\n" +" <generator class=\"sequence\"/>\n" +" </id>\n" +" <set name=\"children\">\n" +" <key column=\"parent_id\"/>\n" +" <one-to-many class=\"Child\"/>\n" +" </set>\n" +" </class>\n" +"\n" +" <class name=\"Child\">\n" +" <id name=\"id\">\n" +" <generator class=\"sequence\"/>\n" +" </id>\n" +" <property name=\"name\"/>\n" +" </class>\n" +"\n" +"</hibernate-mapping>" +msgstr "" + #. Tag: para +#: collection_mapping.xml:1134 #, no-c-format msgid "This maps to the following table definitions:" msgstr "Esto mapea a las siguientes definiciones de tabla:" +#. Tag: title +#: collection_mapping.xml:1137 +#, no-c-format +msgid "" +"Table definitions for unidirectional Parent-" +"Child relationship" +msgstr "" + +#. Tag: programlisting +#: collection_mapping.xml:1141 +#, no-c-format +msgid "" +"create table parent ( id bigint not null primary key )\n" +"create table child ( id bigint not null primary key, name varchar(255), " +"parent_id bigint )\n" +"alter table child add constraint childfk0 (parent_id) references parent" +msgstr "" + #. Tag: para +#: collection_mapping.xml:1144 #, no-c-format msgid "" "If the parent is required, use a bidirectional one-to-" @@ -1188,47 +2582,519 @@ msgstr "" "Si el padre es requerido, utilice una asociación " "bidireccional uno-a-muchos:" +#. Tag: title +#: collection_mapping.xml:1148 +#, no-c-format +msgid "" +"One to many bidirectional Parent-Child relationship " +"using annotations" +msgstr "" + +#. Tag: programlisting +#: collection_mapping.xml:1151 +#, no-c-format +msgid "" +"public class Parent {\n" +" @Id\n" +" @GeneratedValue\n" +" private long id;\n" +"\n" +" @OneToMany(mappedBy=\"parent\")\n" +" private Set<Child> children;\n" +"\n" +" // getter/setter\n" +" ...\n" +"}\n" +"\n" +"\n" +"public class Child {\n" +" @Id\n" +" @GeneratedValue\n" +" private long id;\n" +"\n" +" private String name;\n" +" \n" +" @ManyToOne\n" +" private Parent parent;\n" +"\n" +" \n" +" // getter/setter\n" +" ...\n" +"}" +msgstr "" + +#. Tag: title +#: collection_mapping.xml:1155 +#, no-c-format +msgid "" +"One to many bidirectional Parent-Child relationship " +"using mapping files" +msgstr "" + +#. Tag: programlisting +#: collection_mapping.xml:1158 +#, no-c-format +msgid "" +"<hibernate-mapping>\n" +"\n" +" <class name=\"Parent\">\n" +" <id name=\"id\">\n" +" <generator class=\"sequence\"/>\n" +" </id>\n" +" <set name=\"children\" inverse=\"true\">\n" +" <key column=\"parent_id\"/>\n" +" <one-to-many class=\"Child\"/>\n" +" </set>\n" +" </class>\n" +"\n" +" <class name=\"Child\">\n" +" <id name=\"id\">\n" +" <generator class=\"sequence\"/>\n" +" </id>\n" +" <property name=\"name\"/>\n" +" <many-to-one name=\"parent\" class=\"Parent\" column=\"parent_id" +"\" not-null=\"true\"/>\n" +" </class>\n" +"\n" +"</hibernate-mapping>" +msgstr "" + #. Tag: para +#: collection_mapping.xml:1161 #, no-c-format msgid "Notice the NOT NULL constraint:" msgstr "Observe la restricción NOT NULL:" -#. Tag: para +#. Tag: title +#: collection_mapping.xml:1164 #, no-c-format msgid "" -"Alternatively, if this association must be unidirectional you can declare " -"the NOT NULL constraint on the <key> mapping:" +"Table definitions for bidirectional Parent-" +"Child relationship" +msgstr "" + +#. Tag: programlisting +#: collection_mapping.xml:1168 +#, no-c-format +msgid "" +"create table parent ( id bigint not null primary key )\n" +"create table child ( id bigint not null\n" +" primary key,\n" +" name varchar(255),\n" +" parent_id bigint not null )\n" +"alter table child add constraint childfk0 (parent_id) references parent" +msgstr "" + +#. Tag: para +#: collection_mapping.xml:1171 +#, fuzzy, no-c-format +msgid "" +"Alternatively, if this association must be unidirectional you can enforce " +"the NOT NULL constraint." msgstr "" "Opcionalmente, si esta asociación debe ser unidireccional, puede declarar la " "restricción NOT NULL en el mapeo de <key>:" -#. Tag: para +#. Tag: title +#: collection_mapping.xml:1175 #, no-c-format msgid "" +"Enforcing NOT NULL constraint in unidirectional relation using annotations" +msgstr "" + +#. Tag: programlisting +#: collection_mapping.xml:1178 +#, no-c-format +msgid "" +"public class Parent {\n" +" @Id\n" +" @GeneratedValue\n" +" private long id;\n" +"\n" +" @OneToMany(optional=false)\n" +" private Set<Child> children;\n" +"\n" +" // getter/setter\n" +" ...\n" +"}\n" +"\n" +"\n" +"public class Child {\n" +" @Id\n" +" @GeneratedValue\n" +" private long id;\n" +" private String name;\n" +"\n" +" \n" +" // getter/setter\n" +" ...\n" +"}" +msgstr "" + +#. Tag: title +#: collection_mapping.xml:1182 +#, no-c-format +msgid "" +"Enforcing NOT NULL constraint in unidirectional relation using mapping files" +msgstr "" + +#. Tag: programlisting +#: collection_mapping.xml:1185 +#, no-c-format +msgid "" +"<hibernate-mapping>\n" +"\n" +" <class name=\"Parent\">\n" +" <id name=\"id\">\n" +" <generator class=\"sequence\"/>\n" +" </id>\n" +" <set name=\"children\">\n" +" <key column=\"parent_id\" not-null=\"true\"/>\n" +" <one-to-many class=\"Child\"/>\n" +" </set>\n" +" </class>\n" +"\n" +" <class name=\"Child\">\n" +" <id name=\"id\">\n" +" <generator class=\"sequence\"/>\n" +" </id>\n" +" <property name=\"name\"/>\n" +" </class>\n" +"\n" +"</hibernate-mapping>" +msgstr "" + +#. Tag: para +#: collection_mapping.xml:1188 +#, fuzzy, no-c-format +msgid "" "On the other hand, if a child has multiple parents, a many-to-many " -"association is appropriate:" +"association is appropriate." msgstr "" "Por otro lado, si un hijo tiene múltiples padres, una asociación muchos-a-" "muchos es apropiada:" +#. Tag: title +#: collection_mapping.xml:1192 +#, no-c-format +msgid "" +"Many to many Parent-Child relationship using " +"annotations" +msgstr "" + +#. Tag: programlisting +#: collection_mapping.xml:1195 +#, no-c-format +msgid "" +"public class Parent {\n" +" @Id\n" +" @GeneratedValue\n" +" private long id;\n" +"\n" +" @ManyToMany\n" +" private Set<Child> children;\n" +"\n" +" // getter/setter\n" +" ...\n" +"}\n" +"\n" +"\n" +"public class Child {\n" +" @Id\n" +" @GeneratedValue\n" +" private long id;\n" +"\n" +" private String name;\n" +"\n" +" \n" +" // getter/setter\n" +" ...\n" +"}" +msgstr "" + +#. Tag: title +#: collection_mapping.xml:1199 +#, no-c-format +msgid "" +"Many to many Parent-Child relationship using mapping " +"files" +msgstr "" + +#. Tag: programlisting +#: collection_mapping.xml:1202 +#, no-c-format +msgid "" +"<hibernate-mapping>\n" +"\n" +" <class name=\"Parent\">\n" +" <id name=\"id\">\n" +" <generator class=\"sequence\"/>\n" +" </id>\n" +" <set name=\"children\" table=\"childset\">\n" +" <key column=\"parent_id\"/>\n" +" <many-to-many class=\"Child\" column=\"child_id\"/>\n" +" </set>\n" +" </class>\n" +"\n" +" <class name=\"Child\">\n" +" <id name=\"id\">\n" +" <generator class=\"sequence\"/>\n" +" </id>\n" +" <property name=\"name\"/>\n" +" </class>\n" +"\n" +"</hibernate-mapping>" +msgstr "" + #. Tag: para +#: collection_mapping.xml:1205 #, no-c-format msgid "Table definitions:" msgstr "Definiciones de tabla:" -#. Tag: para +#. Tag: title +#: collection_mapping.xml:1208 +#, no-c-format +msgid "Table definitions for many to many releationship" +msgstr "" + +#. Tag: programlisting +#: collection_mapping.xml:1210 #, no-c-format msgid "" +"create table parent ( id bigint not null primary key )\n" +"create table child ( id bigint not null primary key, name varchar(255) )\n" +"create table childset ( parent_id bigint not null,\n" +" child_id bigint not null,\n" +" primary key ( parent_id, child_id ) )\n" +"alter table childset add constraint childsetfk0 (parent_id) references " +"parent\n" +"alter table childset add constraint childsetfk1 (child_id) references child" +msgstr "" + +#. Tag: para +#: collection_mapping.xml:1213 +#, fuzzy, no-c-format +msgid "" "For more examples and a complete explanation of a parent/child relationship " -"mapping, see for more information." +"mapping, see for more information. " +"Even more complex association mappings are covered in the next chapter." msgstr "" "Para ver más ejemplos y encontrar una explicación completa sobre el mapeo de " "relaciones padre/hijo, consulte el ." -#. Tag: para -#, no-c-format -msgid "Even more complex association mappings are covered in the next chapter." -msgstr "En el próximo capítulo abordaremos los mapeos de asociaciones más complejas." +#~ msgid "" +#~ "Hibernate requires that persistent collection-valued fields be declared " +#~ "as an interface type. For example:" +#~ msgstr "" +#~ "Hibernate requiere que los campos valuados en colección persistente se " +#~ "declaren como un tipo de interfaz. Por ejemplo:" +#~ msgid "Collection mappings" +#~ msgstr "Mapeos de colección" + +#~ msgid "" +#~ "There are quite a range of mappings that can be generated for collections " +#~ "that cover many common relational models. We suggest you experiment with " +#~ "the schema generation tool so that you understand how various mapping " +#~ "declarations translate to database tables." +#~ msgstr "" +#~ "Hay bastantes rangos de mapeos que se pueden generar para colecciones que " +#~ "cubren muchos modelos relacionales comúnes. Le recomendamos que " +#~ "experimente con la herramienta de generación de esquemas para comprender " +#~ "cómo se traducen varias declaraciones de mapeo a tablas de bases de datos." + +#~ msgid "Collection elements" +#~ msgstr "Elementos de collección" + +#~ msgid "" +#~ "The contained type is referred to as the collection element " +#~ "type. Collection elements are mapped by <" +#~ "element> or <composite-element>, or " +#~ "in the case of entity references, with <one-to-many> or <many-to-many>. The first two map " +#~ "elements with value semantics, the next two are used to map entity " +#~ "associations." +#~ msgstr "" +#~ "Se hace referencia al tipo contenido como el tipo de elemento " +#~ "de la colección. Los elementos de colección son mapeados por " +#~ "<element> o <composite-element>, o en el caso de referencias de entidades, con <one-" +#~ "to-many> o <many-to-many>. Las dos " +#~ "primeras mapean elementos con semántica de valor, los dos siguientes se " +#~ "utilizan para mapear asociaciones de entidades." + +#~ msgid "" +#~ "All collection mappings, except those with set and bag semantics, need an " +#~ "index column in the collection table. An index " +#~ "column is a column that maps to an array index, or List index, or Map key. The index of a " +#~ "Map may be of any basic type, mapped with <" +#~ "map-key>. It can be an entity reference mapped with " +#~ "<map-key-many-to-many>, or it can be a composite " +#~ "type mapped with <composite-map-key>. The index " +#~ "of an array or list is always of type integer and is " +#~ "mapped using the <list-index> element. The " +#~ "mapped column contains sequential integers that are numbered from zero by " +#~ "default." +#~ msgstr "" +#~ "Todos los mapeos de colección, excepto aquellos con semántica de set o " +#~ "bag, necesitan una columna índice en la tabla de " +#~ "colección. Una columna índice es una columna que mapea a un índice de " +#~ "array o índice de List o llave de Map. El índice de un Map puede ser de cualquier " +#~ "tipo básico, mapeado con <map-key>. Puede ser " +#~ "una referencia de entidad mapeada con <map-key-many-to-" +#~ "many>, o puede ser un tipo compuesto mapeado con " +#~ "<composite-map-key>. El índice de un array o " +#~ "lista es siempre de tipo integer y se mapea utilizando " +#~ "el elemento <list-index>. La columna mapeada " +#~ "contiene enteros secuenciales numerados desde cero, por defecto." + +#~ msgid "" +#~ "Any collection of values or many-to-many associations requires a " +#~ "dedicated collection table with a foreign key column " +#~ "or columns, collection element column or columns, " +#~ "and possibly an index column or columns." +#~ msgstr "" +#~ "Cualquier colección de valores o asociación muchos-a-muchos requiere una " +#~ "tabla de colección dedicada con una columna o " +#~ "columnas de clave foránea, columna de elemento de colección o columnas y posiblemente una columna o columnas índices." + +#~ msgid "" +#~ "A many-to-many association is specified using the " +#~ "<many-to-many> element." +#~ msgstr "" +#~ "Una asociación muchos-a-muchos se especifica usando " +#~ "el elemento <many-to-many>." + +#~ msgid "" +#~ "column (optional): the name of the element foreign key " +#~ "column." +#~ msgstr "" +#~ "column (opcional): el nombre de la columna de clave " +#~ "foránea elemento." + +#~ msgid "" +#~ "formula (optional): an SQL formula used to evaluate " +#~ "the element foreign key value." +#~ msgstr "" +#~ "formula (opcional): una fórmula SQL utilizada para " +#~ "evaluar el valor de la clave foránea elemento." + +#~ msgid "" +#~ "fetch (optional - defaults to join): enables outer-join or sequential select fetching for this " +#~ "association. This is a special case; for full eager fetching in a single " +#~ "SELECT of an entity and its many-to-many relationships " +#~ "to other entities, you would enable join fetching,not " +#~ "only of the collection itself, but also with this attribute on the " +#~ "<many-to-many> nested element." +#~ msgstr "" +#~ "fetch (opcional - por defecto es join): habilita la búsqueda de selects secuenciales o de unión " +#~ "externa para esta asociación. Este es un caso especial; para búsqueda " +#~ "temprana completa en un solo SELECT de una entidad y " +#~ "sus relaciones muchos-a-muchos con otras entidades, habilitaría la " +#~ "búsqueda join,no solo de la colección misma, si no " +#~ "también con este atributo en el elemento anidado <many-to-" +#~ "many>." + +#~ msgid "" +#~ "unique (optional): enables the DDL generation of a " +#~ "unique constraint for the foreign-key column. This makes the association " +#~ "multiplicity effectively one-to-many." +#~ msgstr "" +#~ "unique (opcional): habilita la generación DDL de una " +#~ "restricción única para la columna de la clave foránea. Esto hace la " +#~ "multiplicidad de la asociación efectivamente uno-a-muchos." + +#~ msgid "" +#~ "not-found (optional - defaults to exception): specifies how foreign keys that reference missing rows will be " +#~ "handled: ignore will treat a missing row as a null " +#~ "association." +#~ msgstr "" +#~ "not-found (opcional - por defecto es " +#~ "exception): Especifica cómo serán manejadas las claves " +#~ "foráneas que hacen referencia a filas que falten: ignore tratará una fila que falte como una asociación nula." + +#~ msgid "" +#~ "property-ref (optional): the name of a property of the " +#~ "associated class that is joined to this foreign key. If not specified, " +#~ "the primary key of the associated class is used." +#~ msgstr "" +#~ "property-ref (opcional): el nombre de una propiedad de " +#~ "la clase asociada que está unida a esta clave foránea. Si no se " +#~ "especifica entonces se utiliza la clave principal de la clase asociada." + +#~ msgid "Here are some examples." +#~ msgstr "Aquí tiene algunos ejemplos:" + +#~ msgid "A set of strings:" +#~ msgstr "Un grupo de cadenas:" + +#~ msgid "" +#~ "A bag containing integers with an iteration order determined by the " +#~ "order-by attribute:" +#~ msgstr "" +#~ "Un bag que contiene enteros con un orden de iteración determinado por el " +#~ "atributo order-by:" + +#~ msgid "An array of entities, in this case, a many-to-many association:" +#~ msgstr "" +#~ "Una lista de entidades, en este caso, una asociación muchos-a-muchos:" + +#~ msgid "A map from string indices to dates:" +#~ msgstr "Un mapeo de índices de cadenas a fechas:" + +#~ msgid "A list of components (this is discussed in the next chapter):" +#~ msgstr "Una lista de componentes (se discuten en el siguiente capítulo):" + +#~ msgid "One-to-many associations" +#~ msgstr "Asociaciones uno-a-muchos" + +#~ msgid "" +#~ "A one-to-many association links the tables of two " +#~ "classes via a foreign key with no intervening collection table. This " +#~ "mapping loses certain semantics of normal Java collections:" +#~ msgstr "" +#~ "Una asociación uno-a-muchos enlaza las tablas de dos " +#~ "clases por medio de una clave foránea, sin intervención de tabla de " +#~ "colección alguna. Este mapeo pierde cierta semántica de colecciones Java " +#~ "normales: " + +#~ msgid "" +#~ "The following example shows a map of Part entities by " +#~ "name, where partName is a persistent property of " +#~ "Part. Notice the use of a formula-based index:" +#~ msgstr "" +#~ "El siguiente ejemplo muestra un mapeo de entidades Part por nombre, en donde partName es una " +#~ "propiedad persistente de Part. Observe el uso de un " +#~ "índice basado en fórmula:" + +#~ msgid "" +#~ "Hibernate supports collections implementing java.util.SortedMap and java.util.SortedSet. You must specify a " +#~ "comparator in the mapping file:" +#~ msgstr "" +#~ "Hibernate soporta colecciones implementando java.util.SortedMap y java.util.SortedSet. Tiene que especificar " +#~ "un comparador en el archivo de mapeo:" + +#~ msgid "" +#~ "A final alternative is to use composite elements, which will be discussed " +#~ "later." +#~ msgstr "" +#~ "La última opción es utilizar elementos compuestos que discutiremos más " +#~ "adelante." + +#~ msgid "" +#~ "Even more complex association mappings are covered in the next chapter." +#~ msgstr "" +#~ "En el próximo capítulo abordaremos los mapeos de asociaciones más " +#~ "complejas." diff --git a/documentation/manual/src/main/docbook/es-ES/content/configuration.po b/documentation/manual/src/main/docbook/es-ES/content/configuration.po index 556c718ebd..80c4c876f7 100644 --- a/documentation/manual/src/main/docbook/es-ES/content/configuration.po +++ b/documentation/manual/src/main/docbook/es-ES/content/configuration.po @@ -14,7 +14,7 @@ msgid "" msgstr "" "Project-Id-Version: configuration\n" "Report-Msgid-Bugs-To: http://bugs.kde.org\n" -"POT-Creation-Date: 2010-02-11T05:38:15\n" +"POT-Creation-Date: 2010-07-20 21:02+0000\n" "PO-Revision-Date: 2010-03-16 11:05+1000\n" "Last-Translator: Angela Garcia \n" "Language-Team: \n" @@ -24,11 +24,13 @@ msgstr "" "X-Generator: KBabel 1.11.4\n" #. Tag: title +#: configuration.xml:31 #, no-c-format msgid "Configuration" msgstr "Configuración" #. Tag: para +#: configuration.xml:33 #, no-c-format msgid "" "Hibernate is designed to operate in many different environments and, as " @@ -47,11 +49,13 @@ msgstr "" "necesidades." #. Tag: title +#: configuration.xml:41 #, no-c-format msgid "Programmatic configuration" msgstr "Configuración programática" #. Tag: para +#: configuration.xml:43 #, no-c-format msgid "" "An instance of org.hibernate.cfg.Configuration " @@ -68,6 +72,7 @@ msgstr "" "varios archivos de mapeo XML." #. Tag: para +#: configuration.xml:51 #, no-c-format msgid "" "You can obtain a org.hibernate.cfg.Configuration " @@ -80,7 +85,17 @@ msgstr "" "mapeo XML. Si los archivos de mapeo están en la ruta de clase, utilice " "addResource(). Por ejemplo:" +#. Tag: programlisting +#: configuration.xml:57 +#, no-c-format +msgid "" +"Configuration cfg = new Configuration()\n" +" .addResource(\"Item.hbm.xml\")\n" +" .addResource(\"Bid.hbm.xml\");" +msgstr "" + #. Tag: para +#: configuration.xml:59 #, no-c-format msgid "" "An alternative way is to specify the mapped class and allow Hibernate to " @@ -89,7 +104,17 @@ msgstr "" "Una manera opcional es especificar la clase mapeada y dejar que Hibernate " "encuentre el documento de mapeo por usted:" +#. Tag: programlisting +#: configuration.xml:62 +#, no-c-format +msgid "" +"Configuration cfg = new Configuration()\n" +" .addClass(org.hibernate.auction.Item.class)\n" +" .addClass(org.hibernate.auction.Bid.class);" +msgstr "" + #. Tag: para +#: configuration.xml:64 #, no-c-format msgid "" "Hibernate will then search for mapping files named /org/hibernate/" @@ -103,6 +128,7 @@ msgstr "" "nombre de archivo establecido manualmente." #. Tag: para +#: configuration.xml:69 #, no-c-format msgid "" "A org.hibernate.cfg.Configuration also allows you to " @@ -111,7 +137,22 @@ msgstr "" "Una org.hibernate.cfg.Configuration también le " "permite especificar las propiedades de configuración. Por ejemplo:" +#. Tag: programlisting +#: configuration.xml:72 +#, no-c-format +msgid "" +"Configuration cfg = new Configuration()\n" +" .addClass(org.hibernate.auction.Item.class)\n" +" .addClass(org.hibernate.auction.Bid.class)\n" +" .setProperty(\"hibernate.dialect\", \"org.hibernate.dialect." +"MySQLInnoDBDialect\")\n" +" .setProperty(\"hibernate.connection.datasource\", \"java:comp/env/jdbc/" +"test\")\n" +" .setProperty(\"hibernate.order_updates\", \"true\");" +msgstr "" + #. Tag: para +#: configuration.xml:74 #, no-c-format msgid "" "This is not the only way to pass configuration properties to Hibernate. Some " @@ -121,6 +162,7 @@ msgstr "" "Hibernate. Algunas opciones incluyen:" #. Tag: para +#: configuration.xml:79 #, no-c-format msgid "" "Pass an instance of java.util.Properties to " @@ -130,6 +172,7 @@ msgstr "" "Configuration.setProperties()." #. Tag: para +#: configuration.xml:84 #, no-c-format msgid "" "Place a file named hibernate.properties in a root " @@ -139,6 +182,7 @@ msgstr "" "directorio raíz de la ruta de clase." #. Tag: para +#: configuration.xml:89 #, no-c-format msgid "" "Set System properties using java -" @@ -148,6 +192,7 @@ msgstr "" "Dproperty=value." #. Tag: para +#: configuration.xml:94 #, no-c-format msgid "" "Include <property> elements in hibernate." @@ -157,6 +202,7 @@ msgstr "" "hibernate.cfg.xml (esto se discute más adelante)." #. Tag: para +#: configuration.xml:99 #, no-c-format msgid "" "If you want to get started quicklyhibernate.properties " @@ -166,6 +212,7 @@ msgstr "" "el enfoque más fácil." #. Tag: para +#: configuration.xml:103 #, no-c-format msgid "" "The org.hibernate.cfg.Configuration is intended as a " @@ -177,11 +224,13 @@ msgstr "" "SessionFactory." #. Tag: title +#: configuration.xml:109 #, no-c-format msgid "Obtaining a SessionFactory" msgstr "Obtención de una SessionFactory" #. Tag: para +#: configuration.xml:111 #, no-c-format msgid "" "When all mappings have been parsed by the org.hibernate.cfg." @@ -189,28 +238,38 @@ msgid "" "org.hibernate.Session instances. This factory " "is intended to be shared by all application threads:" msgstr "" -"Cuando la org.hibernate.cfg." -"Configuration ha " +"Cuando la org.hibernate.cfg.Configuration ha " "analizado sintácticamente todos los mapeos, la aplicación tiene que obtener " -"una fábrica para las instancias org.hibernate.Session. Esta fábrica está concebida para que todos los hilos de la " +"una fábrica para las instancias org.hibernate.Session. Esta fábrica está concebida para que todos los hilos de la " "aplicación la compartan:" +#. Tag: programlisting +#: configuration.xml:117 +#, no-c-format +msgid "SessionFactory sessions = cfg.buildSessionFactory();" +msgstr "" + #. Tag: para +#: configuration.xml:119 #, no-c-format msgid "" "Hibernate does allow your application to instantiate more than one " "org.hibernate.SessionFactory. This is useful " "if you are using more than one database." msgstr "" -"Hibernate permite que su aplicación instancie más de una org.hibernate.SessionFactory. Esto es útil si está utilizando " +"Hibernate permite que su aplicación instancie más de una org." +"hibernate.SessionFactory. Esto es útil si está utilizando " "más de una base de datos." #. Tag: title +#: configuration.xml:125 #, no-c-format msgid "JDBC connections" msgstr "Conexiones JDBC" #. Tag: para +#: configuration.xml:127 #, no-c-format msgid "" "It is advisable to have the org.hibernate.SessionFactoryorg.hibernate.Session es tan simple como:" +#. Tag: programlisting +#: configuration.xml:133 +#, no-c-format +msgid "Session session = sessions.openSession(); // open a new Session" +msgstr "" + #. Tag: para +#: configuration.xml:135 #, no-c-format msgid "" "Once you start a task that requires access to the database, a JDBC " @@ -233,6 +299,7 @@ msgstr "" "datos, se obtendrá una conexión JDBC del pool." #. Tag: para +#: configuration.xml:138 #, no-c-format msgid "" "Before you can do this, you first need to pass some JDBC connection " @@ -248,6 +315,7 @@ msgstr "" "importantes para la conexión JDBC." #. Tag: para +#: configuration.xml:144 #, no-c-format msgid "" "Hibernate will obtain and pool connections using java.sql." @@ -258,71 +326,89 @@ msgstr "" "propiedades:" #. Tag: title +#: configuration.xml:149 #, no-c-format msgid "Hibernate JDBC Properties" msgstr "Propiedades JDBC de Hibernate" #. Tag: entry +#: configuration.xml:158 configuration.xml:236 configuration.xml:327 +#: configuration.xml:495 configuration.xml:657 configuration.xml:753 +#: configuration.xml:826 #, no-c-format msgid "Property name" msgstr "Nombre de la propiedad" #. Tag: entry +#: configuration.xml:160 configuration.xml:238 configuration.xml:329 +#: configuration.xml:497 configuration.xml:659 configuration.xml:755 +#: configuration.xml:828 #, no-c-format msgid "Purpose" msgstr "Propósito" -#. Tag: entry -#, no-c-format -msgid "hibernate.connection.driver_class" +#. Tag: property +#: configuration.xml:166 +#, fuzzy, no-c-format +msgid "hibernate.connection.driver_class" msgstr "hibernate.connection.driver_class" -#. Tag: entry -#, no-c-format -msgid "JDBC driver class" +#. Tag: emphasis +#: configuration.xml:168 +#, fuzzy, no-c-format +msgid "JDBC driver class" msgstr "clase del controlador JDBC" -#. Tag: entry -#, no-c-format -msgid "hibernate.connection.url" +#. Tag: property +#: configuration.xml:172 +#, fuzzy, no-c-format +msgid "hibernate.connection.url" msgstr "hibernate.connection.url" -#. Tag: entry +#. Tag: emphasis +#: configuration.xml:174 #, no-c-format -msgid "JDBC URL" -msgstr "URL JDBC" +msgid "JDBC URL" +msgstr "" -#. Tag: entry -#, no-c-format -msgid "hibernate.connection.username" +#. Tag: property +#: configuration.xml:178 configuration.xml:265 +#, fuzzy, no-c-format +msgid "hibernate.connection.username" msgstr "hibernate.connection.username" -#. Tag: entry +#. Tag: emphasis +#: configuration.xml:180 #, no-c-format -msgid "database user" -msgstr "usuario de la base de datos" +msgid "database user" +msgstr "" -#. Tag: entry -#, no-c-format -msgid "hibernate.connection.password" +#. Tag: property +#: configuration.xml:184 configuration.xml:271 +#, fuzzy, no-c-format +msgid "hibernate.connection.password" msgstr "hibernate.connection.password" -#. Tag: entry -#, no-c-format -msgid "database user password" +#. Tag: emphasis +#: configuration.xml:186 +#, fuzzy, no-c-format +msgid "database user password" msgstr "contraseña del usuario de la base de datos" -#. Tag: entry -#, no-c-format -msgid "hibernate.connection.pool_size" +#. Tag: property +#: configuration.xml:190 +#, fuzzy, no-c-format +msgid "hibernate.connection.pool_size" msgstr "hibernate.connection.pool_size" -#. Tag: entry -#, no-c-format -msgid "maximum number of pooled connections" +#. Tag: emphasis +#: configuration.xml:192 +#, fuzzy, no-c-format +msgid "maximum number of pooled connections" msgstr "número máximo de conexiones en pools" #. Tag: para +#: configuration.xml:199 #, no-c-format msgid "" "Hibernate's own connection pooling algorithm is, however, quite rudimentary. " @@ -343,6 +429,7 @@ msgstr "" "Hibernate. Por ejemplo, es posible utilizar C3P0." #. Tag: para +#: configuration.xml:208 #, no-c-format msgid "" "C3P0 is an open source JDBC connection pool distributed along with Hibernate " @@ -362,6 +449,7 @@ msgstr "" "obtener más información." #. Tag: para +#: configuration.xml:216 #, no-c-format msgid "" "The following is an example hibernate.properties file " @@ -370,7 +458,23 @@ msgstr "" "Aquí hay un archivo hibernate.properties de ejemplo para " "c3p0:" +#. Tag: programlisting +#: configuration.xml:219 +#, no-c-format +msgid "" +"hibernate.connection.driver_class = org.postgresql.Driver\n" +"hibernate.connection.url = jdbc:postgresql://localhost/mydatabase\n" +"hibernate.connection.username = myuser\n" +"hibernate.connection.password = secret\n" +"hibernate.c3p0.min_size=5\n" +"hibernate.c3p0.max_size=20\n" +"hibernate.c3p0.timeout=1800\n" +"hibernate.c3p0.max_statements=50\n" +"hibernate.dialect = org.hibernate.dialect.PostgreSQLDialect" +msgstr "" + #. Tag: para +#: configuration.xml:221 #, no-c-format msgid "" "For use inside an application server, you should almost always configure " @@ -385,36 +489,43 @@ msgstr "" "siguientes propiedades:" #. Tag: title +#: configuration.xml:227 #, no-c-format msgid "Hibernate Datasource Properties" msgstr "Propiedades de la Fuente de Datos de Hibernate" -#. Tag: entry -#, no-c-format -msgid "hibernate.connection.datasource" +#. Tag: property +#: configuration.xml:244 +#, fuzzy, no-c-format +msgid "hibernate.connection.datasource" msgstr "hibernate.connection.datasource" -#. Tag: entry -#, no-c-format -msgid "datasource JNDI name" +#. Tag: emphasis +#: configuration.xml:246 +#, fuzzy, no-c-format +msgid "datasource JNDI name" msgstr "nombre JNDI de la fuente de datos" -#. Tag: entry -#, no-c-format -msgid "hibernate.jndi.url" +#. Tag: property +#: configuration.xml:250 +#, fuzzy, no-c-format +msgid "hibernate.jndi.url" msgstr "hibernate.jndi.url" #. Tag: entry +#: configuration.xml:252 #, no-c-format msgid "URL of the JNDI provider (optional)" msgstr "URL del proveedor JNDI (opcional)" -#. Tag: entry -#, no-c-format -msgid "hibernate.jndi.class" +#. Tag: property +#: configuration.xml:257 +#, fuzzy, no-c-format +msgid "hibernate.jndi.class" msgstr "hibernate.jndi.class" #. Tag: entry +#: configuration.xml:259 #, no-c-format msgid "" "class of the JNDI InitialContextFactorydatabase user (optional)" msgstr "usuario de la base de datos (opcional)" #. Tag: entry +#: configuration.xml:273 #, no-c-format msgid "database user password (optional)" -msgstr "contraseña del usuario de la base de datos (opcional)" +msgstr "" +"contraseña del usuario de la base de datos (opcional)" #. Tag: para +#: configuration.xml:280 #, no-c-format msgid "" "Here is an example hibernate.properties file for an " @@ -442,7 +557,20 @@ msgstr "" "He aquí un archivo hibernate.properties de ejemplo para " "una fuente de datos JNDI provisto por un servidor de aplicaciones:" +#. Tag: programlisting +#: configuration.xml:283 +#, no-c-format +msgid "" +"hibernate.connection.datasource = java:/comp/env/jdbc/test\n" +"hibernate.transaction.factory_class = \\\n" +" org.hibernate.transaction.JTATransactionFactory\n" +"hibernate.transaction.manager_lookup_class = \\\n" +" org.hibernate.transaction.JBossTransactionManagerLookup\n" +"hibernate.dialect = org.hibernate.dialect.PostgreSQLDialect" +msgstr "" + #. Tag: para +#: configuration.xml:285 #, no-c-format msgid "" "JDBC connections obtained from a JNDI datasource will automatically " @@ -453,6 +581,7 @@ msgstr "" "administradas por el contenedor." #. Tag: para +#: configuration.xml:289 #, no-c-format msgid "" "Arbitrary connection properties can be given by prepending " @@ -467,6 +596,7 @@ msgstr "" "property>." #. Tag: para +#: configuration.xml:294 #, no-c-format msgid "" "You can define your own plugin strategy for obtaining JDBC connections by " @@ -482,11 +612,13 @@ msgstr "" "provider_class
." #. Tag: title +#: configuration.xml:302 #, no-c-format msgid "Optional configuration properties" msgstr "Parámetros de configuración opcionales" #. Tag: para +#: configuration.xml:304 #, no-c-format msgid "" "There are a number of other properties that control the behavior of " @@ -496,6 +628,7 @@ msgstr "" "de ejecución. Todas son opcionales y tienen valores razonables por defecto. " #. Tag: para +#: configuration.xml:309 #, no-c-format msgid "" "Some of these properties are \"system-level\" only. " @@ -503,23 +636,26 @@ msgid "" "literal> or hibernate.properties. They " "cannot be set by the other techniques described above." msgstr "" -"Algunas de estas propiedades se encuentran a \"nivel del sistema sólamente\". " -"Las propiedades a nivel del sistema sólamente se pueden establecer por medio " -"de java -Dproperty=value o hibernate.properties. No se pueden establecer por medio de las " -"técnicas descritas anteriormente." +"Algunas de estas propiedades se encuentran a \"nivel del sistema " +"sólamente\". Las propiedades a nivel del sistema sólamente se " +"pueden establecer por medio de java -Dproperty=value o " +"hibernate.properties. No se pueden " +"establecer por medio de las técnicas descritas anteriormente." #. Tag: title +#: configuration.xml:318 #, no-c-format msgid "Hibernate Configuration Properties" msgstr "Propiedades de Configuración de Hibernate" -#. Tag: entry -#, no-c-format -msgid "hibernate.dialect" +#. Tag: property +#: configuration.xml:335 +#, fuzzy, no-c-format +msgid "hibernate.dialect" msgstr "hibernate.dialect" #. Tag: entry +#: configuration.xml:337 #, no-c-format msgid "" "The classname of a Hibernate org.hibernate.dialect.Dialecte.g. full.classname.of." @@ -540,6 +677,7 @@ msgstr "" "Dialect" #. Tag: para +#: configuration.xml:341 #, no-c-format msgid "" "In most cases Hibernate will actually be able to choose the correct " @@ -551,12 +689,14 @@ msgstr "" "con base en los JDBC metadata que el controlador JDBC " "retorna." -#. Tag: entry -#, no-c-format -msgid "hibernate.show_sql" +#. Tag: property +#: configuration.xml:349 +#, fuzzy, no-c-format +msgid "hibernate.show_sql" msgstr "hibernate.show_sql" #. Tag: entry +#: configuration.xml:351 #, no-c-format msgid "" "Write all SQL statements to console. This is an alternative to setting the " @@ -568,6 +708,11 @@ msgstr "" "literal> a debug." #. Tag: para +#: configuration.xml:353 configuration.xml:361 configuration.xml:426 +#: configuration.xml:435 configuration.xml:443 configuration.xml:453 +#: configuration.xml:468 configuration.xml:525 configuration.xml:545 +#: configuration.xml:555 configuration.xml:598 configuration.xml:797 +#: configuration.xml:808 configuration.xml:904 #, no-c-format msgid "" "e.g. true | " @@ -576,22 +721,26 @@ msgstr "" "e.g. true | " "false" -#. Tag: entry -#, no-c-format -msgid "hibernate.format_sql" +#. Tag: property +#: configuration.xml:359 +#, fuzzy, no-c-format +msgid "hibernate.format_sql" msgstr "hibernate.format_sql" #. Tag: entry +#: configuration.xml:361 #, no-c-format msgid "Pretty print the SQL in the log and console." msgstr "Imprime el SQL en el registro y la consola." -#. Tag: entry -#, no-c-format -msgid "hibernate.default_schema" +#. Tag: property +#: configuration.xml:367 +#, fuzzy, no-c-format +msgid "hibernate.default_schema" msgstr "hibernate.default_schema" #. Tag: entry +#: configuration.xml:369 #, no-c-format msgid "" "Qualify unqualified table names with the given schema/tablespace in " @@ -601,33 +750,44 @@ msgstr "" "dado en el SQL generado. " #. Tag: para +#: configuration.xml:370 #, no-c-format -msgid "e.g. SCHEMA_NAME" -msgstr "e.g. SCHEMA_NAME" +msgid "" +"e.g. SCHEMA_NAME" +msgstr "" +"e.g. SCHEMA_NAME" -#. Tag: entry -#, no-c-format -msgid "hibernate.default_catalog" +#. Tag: property +#: configuration.xml:376 +#, fuzzy, no-c-format +msgid "hibernate.default_catalog" msgstr "hibernate.default_catalog" #. Tag: entry +#: configuration.xml:378 #, no-c-format -msgid "Qualifies unqualified table names with the given catalog in generated SQL." +msgid "" +"Qualifies unqualified table names with the given catalog in generated SQL." msgstr "" "Califica los nombres de tabla sin calificar con el catálogo dado en el SQL " "generado." #. Tag: para +#: configuration.xml:379 #, no-c-format -msgid "e.g. CATALOG_NAME" -msgstr "e.g. CATALOG_NAME" +msgid "" +"e.g. CATALOG_NAME" +msgstr "" +"e.g. CATALOG_NAME" -#. Tag: entry -#, no-c-format -msgid "hibernate.session_factory_name" +#. Tag: property +#: configuration.xml:384 +#, fuzzy, no-c-format +msgid "hibernate.session_factory_name" msgstr "hibernate.session_factory_name" #. Tag: entry +#: configuration.xml:386 #, no-c-format msgid "" "The org.hibernate.SessionFactory will be " @@ -637,6 +797,7 @@ msgstr "" "interfacename> a este nombre en JNDI después de que se ha creado." #. Tag: para +#: configuration.xml:389 configuration.xml:776 #, no-c-format msgid "" "e.g. jndi/composite/namee.g. jndi/composite/name" -#. Tag: entry -#, no-c-format -msgid "hibernate.max_fetch_depth" +#. Tag: property +#: configuration.xml:394 +#, fuzzy, no-c-format +msgid "hibernate.max_fetch_depth" msgstr "hibernate.max_fetch_depth" #. Tag: entry +#: configuration.xml:396 #, no-c-format msgid "" "Sets a maximum \"depth\" for the outer join fetch tree for single-ended " @@ -663,6 +826,7 @@ msgstr "" "externa predeterminada." #. Tag: para +#: configuration.xml:398 #, no-c-format msgid "" "e.g. recommended values between " @@ -671,12 +835,14 @@ msgstr "" "ej. los valores recomendados entre " "0 y 3" -#. Tag: entry -#, no-c-format -msgid "hibernate.default_batch_fetch_size" +#. Tag: property +#: configuration.xml:404 +#, fuzzy, no-c-format +msgid "hibernate.default_batch_fetch_size" msgstr "hibernate.default_batch_fetch_size" #. Tag: entry +#: configuration.xml:406 #, no-c-format msgid "Sets a default size for Hibernate batch fetching of associations." msgstr "" @@ -684,6 +850,7 @@ msgstr "" "de Hibernate." #. Tag: para +#: configuration.xml:407 #, no-c-format msgid "" "e.g. recommended values 4ej. valores recomendados 4, 8, 16 " -#. Tag: entry -#, no-c-format -msgid "hibernate.default_entity_mode" +#. Tag: property +#: configuration.xml:413 +#, fuzzy, no-c-format +msgid "hibernate.default_entity_mode" msgstr "hibernate.default_entity_mode" #. Tag: entry +#: configuration.xml:415 #, no-c-format msgid "" "Sets a default mode for entity representation for all sessions opened from " @@ -707,6 +876,7 @@ msgstr "" "las sesiones abiertas desde esta SessionFactory " #. Tag: para +#: configuration.xml:416 #, no-c-format msgid "" "dynamic-map, dom4j, pojodynamic-map, dom4j, pojo" -#. Tag: entry -#, no-c-format -msgid "hibernate.order_updates" +#. Tag: property +#: configuration.xml:422 +#, fuzzy, no-c-format +msgid "hibernate.order_updates" msgstr "hibernate.order_updates" #. Tag: entry +#: configuration.xml:424 #, no-c-format msgid "" "Forces Hibernate to order SQL updates by the primary key value of the items " @@ -731,24 +903,29 @@ msgstr "" "clave principal de los items a actualizar. Esto resultará en menos bloqueos " "de transacción en sistemas altamente concurrentes." -#. Tag: entry -#, no-c-format -msgid "hibernate.generate_statistics" -msgstr "hibernate.generate_statistics" +#. Tag: property +#: configuration.xml:432 +#, fuzzy, no-c-format +msgid "hibernate.generate_statistics" +msgstr "Estadísticas de Hibernate" #. Tag: entry +#: configuration.xml:434 #, no-c-format -msgid "If enabled, Hibernate will collect statistics useful for performance tuning." +msgid "" +"If enabled, Hibernate will collect statistics useful for performance tuning." msgstr "" "De habilitarse, Hibernate colectará estadísticas útiles para la afinación de " "rendimiento. " -#. Tag: entry -#, no-c-format -msgid "hibernate.use_identifier_rollback" +#. Tag: property +#: configuration.xml:440 +#, fuzzy, no-c-format +msgid "hibernate.use_identifier_rollback" msgstr "hibernate.use_identifier_rollback" #. Tag: entry +#: configuration.xml:442 #, no-c-format msgid "" "If enabled, generated identifier properties will be reset to default values " @@ -757,12 +934,14 @@ msgstr "" "De habilitarse, cuando se borren los objetos las propiedades identificadoras " "generadas se resetearán a losvalores establecidos por defecto." -#. Tag: entry -#, no-c-format -msgid "hibernate.use_sql_comments" +#. Tag: property +#: configuration.xml:449 +#, fuzzy, no-c-format +msgid "hibernate.use_sql_comments" msgstr "hibernate.use_sql_comments" #. Tag: entry +#: configuration.xml:451 #, no-c-format msgid "" "If turned on, Hibernate will generate comments inside the SQL, for easier " @@ -771,17 +950,51 @@ msgstr "" "De activarse, Hibernate generará comentarios dentro del SQL, para una " "depuración más fácil, por defecto es false." +#. Tag: property +#: configuration.xml:458 +#, no-c-format +msgid "hibernate.id.new_generator_mappings" +msgstr "" + +#. Tag: entry +#: configuration.xml:460 +#, no-c-format +msgid "" +"Setting is relevant when using @GeneratedValue. It " +"indicates whether or not the new IdentifierGenerator " +"implementations are used for javax.persistence.GenerationType." +"AUTO, javax.persistence.GenerationType.TABLE and javax.persistence.GenerationType.SEQUENCE. Default to false to keep backward " +"compatibility." +msgstr "" + +#. Tag: para +#: configuration.xml:476 +#, no-c-format +msgid "" +"We recommend all new projects which make use of to use " +"@GeneratedValue to also set hibernate.id." +"new_generator_mappings=true as the new generators are more efficient " +"and closer to the JPA 2 specification semantic. However they are not " +"backward compatible with existing databases (if a sequence or a table is " +"used for id generation)." +msgstr "" + #. Tag: title +#: configuration.xml:485 #, no-c-format msgid "Hibernate JDBC and Connection Properties" msgstr "Propiedades de JDBC y Conexiones de Hibernate" -#. Tag: entry -#, no-c-format -msgid "hibernate.jdbc.fetch_size" +#. Tag: property +#: configuration.xml:503 +#, fuzzy, no-c-format +msgid "hibernate.jdbc.fetch_size" msgstr "hibernate.jdbc.fetch_size" #. Tag: entry +#: configuration.xml:505 #, no-c-format msgid "" "A non-zero value determines the JDBC fetch size (calls Statement." @@ -790,12 +1003,14 @@ msgstr "" "Un valor distinto de cero que determina el tamaño de recuperación de JDBC " "(llama a Statement.setFetchSize())." -#. Tag: entry -#, no-c-format -msgid "hibernate.jdbc.batch_size" +#. Tag: property +#: configuration.xml:510 +#, fuzzy, no-c-format +msgid "hibernate.jdbc.batch_size" msgstr "hibernate.jdbc.batch_size" #. Tag: entry +#: configuration.xml:512 #, no-c-format msgid "A non-zero value enables use of JDBC2 batch updates by Hibernate." msgstr "" @@ -803,6 +1018,7 @@ msgstr "" "en lote de JDBC2. " #. Tag: para +#: configuration.xml:513 #, no-c-format msgid "" "e.g. recommended values between " @@ -811,16 +1027,18 @@ msgstr "" "ej. valores recomendados entre " "5 y 30 " -#. Tag: entry -#, no-c-format -msgid "hibernate.jdbc.batch_versioned_data" +#. Tag: property +#: configuration.xml:519 +#, fuzzy, no-c-format +msgid "hibernate.jdbc.batch_versioned_data" msgstr "hibernate.jdbc.batch_versioned_data" #. Tag: entry -#, no-c-format +#: configuration.xml:521 +#, fuzzy, no-c-format msgid "" "Set this property to true if your JDBC driver returns " -"correct row counts from executeBatch(). Iit is usually " +"correct row counts from executeBatch(). It is usually " "safe to turn this option on. Hibernate will then use batched DML for " "automatically versioned data. Defaults to false." msgstr "" @@ -830,12 +1048,14 @@ msgstr "" "para versionar automáticamente los datos. Por defecto es false." -#. Tag: entry -#, no-c-format -msgid "hibernate.jdbc.factory_class" +#. Tag: property +#: configuration.xml:531 +#, fuzzy, no-c-format +msgid "hibernate.jdbc.factory_class" msgstr "hibernate.jdbc.factory_class" #. Tag: entry +#: configuration.xml:533 #, no-c-format msgid "" "Select a custom org.hibernate.jdbc.Batcher. " @@ -846,6 +1066,7 @@ msgstr "" "de configuración. " #. Tag: para +#: configuration.xml:535 #, no-c-format msgid "" "e.g. classname.of." @@ -854,12 +1075,14 @@ msgstr "" "eg. classname.of." "BatcherFactory" -#. Tag: entry -#, no-c-format -msgid "hibernate.jdbc.use_scrollable_resultset" +#. Tag: property +#: configuration.xml:541 +#, fuzzy, no-c-format +msgid "hibernate.jdbc.use_scrollable_resultset" msgstr "hibernate.jdbc.use_scrollable_resultset" #. Tag: entry +#: configuration.xml:543 #, no-c-format msgid "" "Enables use of JDBC2 scrollable resultsets by Hibernate. This property is " @@ -871,12 +1094,14 @@ msgstr "" "JDBC provistas por el usuario. En el caso contrario Hibernate utiliza los " "metadatos de conexión." -#. Tag: entry -#, no-c-format -msgid "hibernate.jdbc.use_streams_for_binary" +#. Tag: property +#: configuration.xml:551 +#, fuzzy, no-c-format +msgid "hibernate.jdbc.use_streams_for_binary" msgstr "hibernate.jdbc.use_streams_for_binary" #. Tag: entry +#: configuration.xml:553 #, no-c-format msgid "" "Use streams when writing/reading binary or " @@ -887,12 +1112,14 @@ msgstr "" "serializable a/desde JDBC. Propiedad a nivel de " "sistema" -#. Tag: entry -#, no-c-format -msgid "hibernate.jdbc.use_get_generated_keys" +#. Tag: property +#: configuration.xml:561 +#, fuzzy, no-c-format +msgid "hibernate.jdbc.use_get_generated_keys" msgstr "hibernate.jdbc.use_get_generated_keys" #. Tag: entry +#: configuration.xml:563 #, no-c-format msgid "" "Enables use of JDBC3 PreparedStatement.getGeneratedKeys() " @@ -909,16 +1136,21 @@ msgstr "" "controlador utilizando los metadatos de conexión." #. Tag: para +#: configuration.xml:569 configuration.xml:678 configuration.xml:687 +#: configuration.xml:696 configuration.xml:723 #, no-c-format msgid "e.g. true|false" -msgstr "e.g. true|false" +msgstr "" +"e.g. true|false" -#. Tag: entry -#, no-c-format -msgid "hibernate.connection.provider_class" +#. Tag: property +#: configuration.xml:574 +#, fuzzy, no-c-format +msgid "hibernate.connection.provider_class" msgstr "hibernate.connection.provider_class" #. Tag: entry +#: configuration.xml:576 #, no-c-format msgid "" "The classname of a custom org.hibernate.connection." @@ -930,6 +1162,7 @@ msgstr "" "JDBC a Hibernate. " #. Tag: para +#: configuration.xml:578 #, no-c-format msgid "" "e.g. classname.of." @@ -938,12 +1171,14 @@ msgstr "" "e.g. classname.of." "ConnectionProvider" -#. Tag: entry -#, no-c-format -msgid "hibernate.connection.isolation" +#. Tag: property +#: configuration.xml:584 +#, fuzzy, no-c-format +msgid "hibernate.connection.isolation" msgstr "hibernate.connection.isolation" #. Tag: entry +#: configuration.xml:586 #, no-c-format msgid "" "Sets the JDBC transaction isolation level. Check java.sql." @@ -958,28 +1193,34 @@ msgstr "" "adicionales y no estándares." #. Tag: para +#: configuration.xml:589 #, no-c-format msgid "e.g. 1, 2, 4, 8" -msgstr "e.g. 1, 2, 4, 8" +msgstr "" +"e.g. 1, 2, 4, 8" -#. Tag: entry -#, no-c-format -msgid "hibernate.connection.autocommit" +#. Tag: property +#: configuration.xml:595 +#, fuzzy, no-c-format +msgid "hibernate.connection.autocommit" msgstr "hibernate.connection.autocommit" #. Tag: entry +#: configuration.xml:597 #, no-c-format msgid "Enables autocommit for JDBC pooled connections (it is not recommended)." msgstr "" "Habilita un guardado automático (autocommit) para las conexiones JDBC en " "pool (no se recomienda)." -#. Tag: entry -#, no-c-format -msgid "hibernate.connection.release_mode" +#. Tag: property +#: configuration.xml:603 +#, fuzzy, no-c-format +msgid "hibernate.connection.release_mode" msgstr "hibernate.connection.release_mode" #. Tag: entry +#: configuration.xml:605 #, no-c-format msgid "" "Specifies when Hibernate should release JDBC connections. By default, a JDBC " @@ -1004,6 +1245,7 @@ msgstr "" "estrategia JDBC de transacción. " #. Tag: para +#: configuration.xml:615 #, no-c-format msgid "" "e.g. auto (default) " @@ -1015,15 +1257,15 @@ msgstr "" "after_statement" #. Tag: para -#, no-c-format +#: configuration.xml:618 +#, fuzzy, no-c-format msgid "" "This setting only affects Sessions returned from " "SessionFactory.openSession. For Sessions obtained through SessionFactory.getCurrentSession, the CurrentSessionContext implementation " "configured for use controls the connection release mode for those " -"Sessions. See " +"Sessions. See" msgstr "" "Esta configuración sólamente afecta las Sessiones " "retornadas desde SessionFactory.openSession. Para las " @@ -1034,6 +1276,7 @@ msgstr "" "literal>es. Consulte ." #. Tag: entry +#: configuration.xml:630 #, no-c-format msgid "" "hibernate.connection.<propertyName>" #. Tag: entry +#: configuration.xml:632 #, no-c-format msgid "" "Pass the JDBC property <propertyName> to " @@ -1052,11 +1296,15 @@ msgstr "" "DriverManager.getConnection()." #. Tag: entry +#: configuration.xml:638 #, no-c-format -msgid "hibernate.jndi.<propertyName>" -msgstr "hibernate.jndi.<propertyName>" +msgid "" +"hibernate.jndi.<propertyName>" +msgstr "" +"hibernate.jndi.<propertyName>" #. Tag: entry +#: configuration.xml:640 #, no-c-format msgid "" "Pass the property <propertyName> to the JNDI " @@ -1066,21 +1314,26 @@ msgstr "" "InitialContextFactory JNDI." #. Tag: title +#: configuration.xml:648 #, no-c-format msgid "Hibernate Cache Properties" msgstr "Propiedades de Caché de Hibernate" -#. Tag: entry -#, no-c-format -msgid "hibernate.cache.provider_class" +#. Tag: literal +#: configuration.xml:665 +#, fuzzy, no-c-format +msgid "hibernate.cache.provider_class" msgstr "hibernate.cache.provider_class" #. Tag: entry +#: configuration.xml:667 #, no-c-format msgid "The classname of a custom CacheProvider." -msgstr "El nombre de clase de un CacheProvider personalizado." +msgstr "" +"El nombre de clase de un CacheProvider personalizado." #. Tag: para +#: configuration.xml:668 #, no-c-format msgid "" "e.g. classname.of." @@ -1089,12 +1342,14 @@ msgstr "" "e.g. classname.of." "CacheProvider" -#. Tag: entry -#, no-c-format -msgid "hibernate.cache.use_minimal_puts" +#. Tag: literal +#: configuration.xml:673 +#, fuzzy, no-c-format +msgid "hibernate.cache.use_minimal_puts" msgstr "hibernate.cache.use_minimal_puts" #. Tag: entry +#: configuration.xml:675 #, no-c-format msgid "" "Optimizes second-level cache operation to minimize writes, at the cost of " @@ -1106,24 +1361,29 @@ msgstr "" "cachés en clúster y en Hibernate3, está habilitado por defecto para " "implementaciones de caché en clúster. " -#. Tag: entry -#, no-c-format -msgid "hibernate.cache.use_query_cache" +#. Tag: literal +#: configuration.xml:684 +#, fuzzy, no-c-format +msgid "hibernate.cache.use_query_cache" msgstr "hibernate.cache.use_query_cache" #. Tag: entry +#: configuration.xml:686 #, no-c-format -msgid "Enables the query cache. Individual queries still have to be set cachable." +msgid "" +"Enables the query cache. Individual queries still have to be set cachable." msgstr "" "Habilita el caché de consultas. Las consultas individuales todavía tienen " "que establecerse con cachés. " -#. Tag: entry -#, no-c-format -msgid "hibernate.cache.use_second_level_cache" +#. Tag: literal +#: configuration.xml:692 +#, fuzzy, no-c-format +msgid "hibernate.cache.use_second_level_cache" msgstr "hibernate.cache.use_second_level_cache" #. Tag: entry +#: configuration.xml:694 #, no-c-format msgid "" "Can be used to completely disable the second level cache, which is enabled " @@ -1134,12 +1394,14 @@ msgstr "" "que está habilitado por defecto para clases que especifican un mapeo " "<cache>. " -#. Tag: entry -#, no-c-format -msgid "hibernate.cache.query_cache_factory" +#. Tag: literal +#: configuration.xml:702 +#, fuzzy, no-c-format +msgid "hibernate.cache.query_cache_factory" msgstr "hibernate.cache.query_cache_factory" #. Tag: entry +#: configuration.xml:704 #, no-c-format msgid "" "The classname of a custom QueryCache interface, defaults " @@ -1150,6 +1412,7 @@ msgstr "" "incorporado." #. Tag: para +#: configuration.xml:706 #, no-c-format msgid "" "e.g. classname.of.QueryCachee.g. classname.of.QueryCache" -#. Tag: entry -#, no-c-format -msgid "hibernate.cache.region_prefix" +#. Tag: literal +#: configuration.xml:712 +#, fuzzy, no-c-format +msgid "hibernate.cache.region_prefix" msgstr "hibernate.cache.region_prefix" #. Tag: entry +#: configuration.xml:714 #, no-c-format msgid "A prefix to use for second-level cache region names." msgstr "" @@ -1171,16 +1436,19 @@ msgstr "" "segundo nivel." #. Tag: para +#: configuration.xml:714 #, no-c-format msgid "e.g. prefix" msgstr "e.g. prefix" -#. Tag: entry -#, no-c-format -msgid "hibernate.cache.use_structured_entries" +#. Tag: literal +#: configuration.xml:720 +#, fuzzy, no-c-format +msgid "hibernate.cache.use_structured_entries" msgstr "hibernate.cache.use_structured_entries" #. Tag: entry +#: configuration.xml:722 #, no-c-format msgid "" "Forces Hibernate to store data in the second-level cache in a more human-" @@ -1189,17 +1457,36 @@ msgstr "" "Obliga a Hibernate a almacenar los datos en el caché de segundo nivel en un " "formato más amigable para personas." +#. Tag: literal +#: configuration.xml:729 +#, no-c-format +msgid "hibernate.cache.default_cache_concurrency_strategy" +msgstr "" + +#. Tag: entry +#: configuration.xml:731 +#, no-c-format +msgid "" +"Setting used to give the name of the default org.hibernate." +"annotations.CacheConcurrencyStrategy to use when either " +"@Cacheable or @Cache is used. " +"@Cache(strategy=\"..\") is used to override this default." +msgstr "" + #. Tag: title +#: configuration.xml:744 #, no-c-format msgid "Hibernate Transaction Properties" msgstr "Propiedades de Transacción de Hibernate" -#. Tag: entry -#, no-c-format -msgid "hibernate.transaction.factory_class" +#. Tag: literal +#: configuration.xml:761 +#, fuzzy, no-c-format +msgid "hibernate.transaction.factory_class" msgstr "hibernate.transaction.factory_class" #. Tag: entry +#: configuration.xml:763 #, no-c-format msgid "" "The classname of a TransactionFactory to use with " @@ -1211,6 +1498,7 @@ msgstr "" "JDBCTransactionFactory)." #. Tag: para +#: configuration.xml:765 #, no-c-format msgid "" "e.g. classname.of." @@ -1219,12 +1507,14 @@ msgstr "" "e.g. classname.of." "TransactionFactory" -#. Tag: entry -#, no-c-format -msgid "jta.UserTransaction" +#. Tag: literal +#: configuration.xml:771 +#, fuzzy, no-c-format +msgid "jta.UserTransaction" msgstr "jta.UserTransaction" #. Tag: entry +#: configuration.xml:773 #, no-c-format msgid "" "A JNDI name used by JTATransactionFactory to obtain the " @@ -1234,12 +1524,14 @@ msgstr "" "obtener la UserTransaction de JTA del servidor de " "aplicaciones. " -#. Tag: entry -#, no-c-format -msgid "hibernate.transaction.manager_lookup_class" +#. Tag: literal +#: configuration.xml:781 +#, fuzzy, no-c-format +msgid "hibernate.transaction.manager_lookup_class" msgstr "hibernate.transaction.manager_lookup_class" #. Tag: entry +#: configuration.xml:783 #, no-c-format msgid "" "The classname of a TransactionManagerLookup. It is " @@ -1251,6 +1543,7 @@ msgstr "" "un generador alto/bajo en un entorno JTA." #. Tag: para +#: configuration.xml:786 #, no-c-format msgid "" "e.g. classname.of." @@ -1259,17 +1552,19 @@ msgstr "" "e.g. classname.of." "TransactionManagerLookup" -#. Tag: entry -#, no-c-format -msgid "hibernate.transaction.flush_before_completion" +#. Tag: literal +#: configuration.xml:792 +#, fuzzy, no-c-format +msgid "hibernate.transaction.flush_before_completion" msgstr "hibernate.transaction.flush_before_completion" #. Tag: entry -#, no-c-format +#: configuration.xml:794 +#, fuzzy, no-c-format msgid "" "If enabled, the session will be automatically flushed during the before " "completion phase of the transaction. Built-in and automatic session context " -"management is preferred, see ." msgstr "" "Si está habilitado, la sesión se vaciará automáticamente durante la fase " @@ -1277,17 +1572,19 @@ msgstr "" "del contexto de sesión automático e incorporado. Consulte ." -#. Tag: entry -#, no-c-format -msgid "hibernate.transaction.auto_close_session" +#. Tag: literal +#: configuration.xml:803 +#, fuzzy, no-c-format +msgid "hibernate.transaction.auto_close_session" msgstr "hibernate.transaction.auto_close_session" #. Tag: entry -#, no-c-format +#: configuration.xml:805 +#, fuzzy, no-c-format msgid "" "If enabled, the session will be automatically closed during the after " "completion phase of the transaction. Built-in and automatic session context " -"management is preferred, see ." msgstr "" "Si se habilita, la sesión se cerrará automáticamente durante la fase " @@ -1296,21 +1593,24 @@ msgstr "" "\"architecture-current-session\" />." #. Tag: title +#: configuration.xml:817 #, no-c-format msgid "Miscellaneous Properties" msgstr "Propiedades Misceláneas" -#. Tag: entry -#, no-c-format -msgid "hibernate.current_session_context_class" +#. Tag: literal +#: configuration.xml:834 +#, fuzzy, no-c-format +msgid "hibernate.current_session_context_class" msgstr "hibernate.current_session_context_class" #. Tag: entry -#, no-c-format +#: configuration.xml:836 +#, fuzzy, no-c-format msgid "" "Supply a custom strategy for the scoping of the \"current\" " "Session. See for more information about the built-in strategies." +"\"/> for more information about the built-in strategies." msgstr "" "Proporciona una estrategia personalizada para el alcance de la " "Session \"actual\". Consulte e.g. jta | " @@ -1328,17 +1629,20 @@ msgstr "" "thread | managed | custom." "Class" -#. Tag: entry -#, no-c-format -msgid "hibernate.query.factory_class" +#. Tag: literal +#: configuration.xml:846 +#, fuzzy, no-c-format +msgid "hibernate.query.factory_class" msgstr "hibernate.query.factory_class" #. Tag: entry +#: configuration.xml:848 #, no-c-format msgid "Chooses the HQL parser implementation." msgstr "Elige la implementación de análisis sintáctico HQL." #. Tag: para +#: configuration.xml:848 #, no-c-format msgid "" "e.g. org.hibernate.hql.ast." @@ -1349,12 +1653,14 @@ msgstr "" "ASTQueryTranslatorFactory o org.hibernate.hql.classic." "ClassicQueryTranslatorFactory" -#. Tag: entry -#, no-c-format -msgid "hibernate.query.substitutions" +#. Tag: literal +#: configuration.xml:857 +#, fuzzy, no-c-format +msgid "hibernate.query.substitutions" msgstr "hibernate.query.substitutions" #. Tag: entry +#: configuration.xml:859 #, no-c-format msgid "" "Is used to map from tokens in Hibernate queries to SQL tokens (tokens might " @@ -1364,6 +1670,7 @@ msgstr "" "(por ejemplo, los tokens pueden ser nombres de función o literales). " #. Tag: para +#: configuration.xml:861 #, no-c-format msgid "" "e.g. hqlLiteral=SQL_LITERAL, " @@ -1372,12 +1679,14 @@ msgstr "" "e.g. hqlLiteral=SQL_LITERAL, " "hqlFunction=SQLFUNC" -#. Tag: entry -#, no-c-format -msgid "hibernate.hbm2ddl.auto" +#. Tag: literal +#: configuration.xml:867 +#, fuzzy, no-c-format +msgid "hibernate.hbm2ddl.auto" msgstr "hibernate.hbm2ddl.auto" #. Tag: entry +#: configuration.xml:869 #, no-c-format msgid "" "Automatically validates or exports schema DDL to the database when the " @@ -1391,6 +1700,7 @@ msgstr "" "SessionFactory se cierre explícitamente." #. Tag: para +#: configuration.xml:873 #, no-c-format msgid "" "e.g. validate | " @@ -1401,12 +1711,49 @@ msgstr "" "update | create | create-" "drop" -#. Tag: entry +#. Tag: literal +#: configuration.xml:880 +#, fuzzy, no-c-format +msgid "hibernate.hbm2ddl.import_file" +msgstr "hibernate.hbm2ddl.auto" + +#. Tag: para +#: configuration.xml:882 #, no-c-format -msgid "hibernate.cglib.use_reflection_optimizer" +msgid "" +"Comma-separated names of the optional files containing SQL DML statements " +"executed during the SessionFactory creation. This is " +"useful for testing or demoing: by adding INSERT statements for example you " +"can populate your database with a minimal set of data when it is deployed." +msgstr "" + +#. Tag: para +#: configuration.xml:887 +#, no-c-format +msgid "" +"File order matters, the statements of a give file are executed before the " +"statements of the following files. These statements are only executed if the " +"schema is created ie if hibernate.hbm2ddl.auto is set to " +"create or create-drop." +msgstr "" + +#. Tag: para +#: configuration.xml:892 +#, fuzzy, no-c-format +msgid "" +"e.g. /humans.sql,/dogs.sql" +msgstr "" +"e.g. true|false" + +#. Tag: literal +#: configuration.xml:898 +#, fuzzy, no-c-format +msgid "hibernate.cglib.use_reflection_optimizer" msgstr "hibernate.cglib.use_reflection_optimizer" #. Tag: entry +#: configuration.xml:900 #, no-c-format msgid "" "Enables the use of CGLIB instead of runtime reflection (System-level " @@ -1421,11 +1768,13 @@ msgstr "" "xml." #. Tag: title +#: configuration.xml:913 #, no-c-format msgid "SQL Dialects" msgstr "Dialectos de SQL" #. Tag: para +#: configuration.xml:915 #, no-c-format msgid "" "Always set the hibernate.dialect property to the correct " @@ -1442,256 +1791,307 @@ msgstr "" "manualmente." #. Tag: title +#: configuration.xml:922 #, no-c-format msgid "Hibernate SQL Dialects (hibernate.dialect)" msgstr "Dialectos SQL de Hibernate(hibernate.dialect)" #. Tag: entry +#: configuration.xml:933 #, no-c-format msgid "RDBMS" msgstr "RDBMS" #. Tag: entry +#: configuration.xml:935 #, no-c-format msgid "Dialect" msgstr "Dialecto" #. Tag: entry +#: configuration.xml:941 #, no-c-format -msgid "DB2" -msgstr "DB2" +msgid "DB2" +msgstr "" -#. Tag: entry -#, no-c-format -msgid "org.hibernate.dialect.DB2Dialect" +#. Tag: literal +#: configuration.xml:943 +#, fuzzy, no-c-format +msgid "org.hibernate.dialect.DB2Dialect" msgstr "org.hibernate.dialect.DB2Dialect" #. Tag: entry +#: configuration.xml:947 #, no-c-format msgid "DB2 AS/400" msgstr "DB2 AS/400" -#. Tag: entry -#, no-c-format -msgid "org.hibernate.dialect.DB2400Dialect" +#. Tag: literal +#: configuration.xml:949 +#, fuzzy, no-c-format +msgid "org.hibernate.dialect.DB2400Dialect" msgstr "org.hibernate.dialect.DB2400Dialect" #. Tag: entry +#: configuration.xml:953 #, no-c-format msgid "DB2 OS390" msgstr "DB2 OS390" -#. Tag: entry -#, no-c-format -msgid "org.hibernate.dialect.DB2390Dialect" +#. Tag: literal +#: configuration.xml:955 +#, fuzzy, no-c-format +msgid "org.hibernate.dialect.DB2390Dialect" msgstr "org.hibernate.dialect.DB2390Dialect" #. Tag: entry +#: configuration.xml:959 #, no-c-format msgid "PostgreSQL" msgstr "PostgreSQL" -#. Tag: entry -#, no-c-format -msgid "org.hibernate.dialect.PostgreSQLDialect" +#. Tag: literal +#: configuration.xml:961 +#, fuzzy, no-c-format +msgid "org.hibernate.dialect.PostgreSQLDialect" msgstr "org.hibernate.dialect.PostgreSQLDialect" #. Tag: entry +#: configuration.xml:965 #, no-c-format msgid "MySQL" msgstr "MySQL" -#. Tag: entry -#, no-c-format -msgid "org.hibernate.dialect.MySQLDialect" +#. Tag: literal +#: configuration.xml:967 +#, fuzzy, no-c-format +msgid "org.hibernate.dialect.MySQLDialect" msgstr "org.hibernate.dialect.MySQLDialect" #. Tag: entry +#: configuration.xml:971 #, no-c-format msgid "MySQL with InnoDB" msgstr "MySQL con InnoDB" -#. Tag: entry -#, no-c-format -msgid "org.hibernate.dialect.MySQLInnoDBDialect" +#. Tag: literal +#: configuration.xml:973 +#, fuzzy, no-c-format +msgid "org.hibernate.dialect.MySQLInnoDBDialect" msgstr "org.hibernate.dialect.MySQLInnoDBDialect" #. Tag: entry +#: configuration.xml:977 #, no-c-format msgid "MySQL with MyISAM" msgstr "MySQL con MyISAM" -#. Tag: entry -#, no-c-format -msgid "org.hibernate.dialect.MySQLMyISAMDialect" +#. Tag: literal +#: configuration.xml:979 +#, fuzzy, no-c-format +msgid "org.hibernate.dialect.MySQLMyISAMDialect" msgstr "org.hibernate.dialect.MySQLMyISAMDialect" #. Tag: entry +#: configuration.xml:983 #, no-c-format msgid "Oracle (any version)" msgstr "Oracle (cualquier versión)" -#. Tag: entry -#, no-c-format -msgid "org.hibernate.dialect.OracleDialect" +#. Tag: literal +#: configuration.xml:985 +#, fuzzy, no-c-format +msgid "org.hibernate.dialect.OracleDialect" msgstr "org.hibernate.dialect.OracleDialect" #. Tag: entry +#: configuration.xml:989 #, no-c-format msgid "Oracle 9i" msgstr "Oracle 9i" -#. Tag: entry -#, no-c-format -msgid "org.hibernate.dialect.Oracle9iDialect" +#. Tag: literal +#: configuration.xml:991 +#, fuzzy, no-c-format +msgid "org.hibernate.dialect.Oracle9iDialect" msgstr "org.hibernate.dialect.Oracle9iDialect" #. Tag: entry +#: configuration.xml:995 #, no-c-format msgid "Oracle 10g" msgstr "Oracle 10g" -#. Tag: entry -#, no-c-format -msgid "org.hibernate.dialect.Oracle10gDialect" +#. Tag: literal +#: configuration.xml:997 +#, fuzzy, no-c-format +msgid "org.hibernate.dialect.Oracle10gDialect" msgstr "org.hibernate.dialect.Oracle10gDialect" #. Tag: entry +#: configuration.xml:1001 #, no-c-format msgid "Sybase" msgstr "Sybase" -#. Tag: entry -#, no-c-format -msgid "org.hibernate.dialect.SybaseDialect" +#. Tag: literal +#: configuration.xml:1003 +#, fuzzy, no-c-format +msgid "org.hibernate.dialect.SybaseDialect" msgstr "org.hibernate.dialect.SybaseDialect" #. Tag: entry +#: configuration.xml:1007 #, no-c-format msgid "Sybase Anywhere" msgstr "Sybase Anywhere" -#. Tag: entry -#, no-c-format -msgid "org.hibernate.dialect.SybaseAnywhereDialect" +#. Tag: literal +#: configuration.xml:1009 +#, fuzzy, no-c-format +msgid "org.hibernate.dialect.SybaseAnywhereDialect" msgstr "org.hibernate.dialect.SybaseAnywhereDialect" #. Tag: entry +#: configuration.xml:1013 #, no-c-format msgid "Microsoft SQL Server" msgstr "Microsoft SQL Server" -#. Tag: entry -#, no-c-format -msgid "org.hibernate.dialect.SQLServerDialect" +#. Tag: literal +#: configuration.xml:1015 +#, fuzzy, no-c-format +msgid "org.hibernate.dialect.SQLServerDialect" msgstr "org.hibernate.dialect.SQLServerDialect" #. Tag: entry +#: configuration.xml:1019 #, no-c-format msgid "SAP DB" msgstr "SAP DB" -#. Tag: entry -#, no-c-format -msgid "org.hibernate.dialect.SAPDBDialect" +#. Tag: literal +#: configuration.xml:1021 +#, fuzzy, no-c-format +msgid "org.hibernate.dialect.SAPDBDialect" msgstr "org.hibernate.dialect.SAPDBDialect" #. Tag: entry +#: configuration.xml:1025 #, no-c-format msgid "Informix" msgstr "Informix" -#. Tag: entry -#, no-c-format -msgid "org.hibernate.dialect.InformixDialect" +#. Tag: literal +#: configuration.xml:1027 +#, fuzzy, no-c-format +msgid "org.hibernate.dialect.InformixDialect" msgstr "org.hibernate.dialect.InformixDialect" #. Tag: entry +#: configuration.xml:1031 #, no-c-format msgid "HypersonicSQL" msgstr "HypersonicSQL" -#. Tag: entry -#, no-c-format -msgid "org.hibernate.dialect.HSQLDialect" +#. Tag: literal +#: configuration.xml:1033 +#, fuzzy, no-c-format +msgid "org.hibernate.dialect.HSQLDialect" msgstr "org.hibernate.dialect.HSQLDialect" #. Tag: entry +#: configuration.xml:1037 #, no-c-format msgid "Ingres" msgstr "Ingres" -#. Tag: entry -#, no-c-format -msgid "org.hibernate.dialect.IngresDialect" +#. Tag: literal +#: configuration.xml:1039 +#, fuzzy, no-c-format +msgid "org.hibernate.dialect.IngresDialect" msgstr "org.hibernate.dialect.IngresDialect" #. Tag: entry +#: configuration.xml:1043 #, no-c-format msgid "Progress" msgstr "Progress" -#. Tag: entry -#, no-c-format -msgid "org.hibernate.dialect.ProgressDialect" +#. Tag: literal +#: configuration.xml:1045 +#, fuzzy, no-c-format +msgid "org.hibernate.dialect.ProgressDialect" msgstr "org.hibernate.dialect.ProgressDialect" #. Tag: entry +#: configuration.xml:1049 #, no-c-format msgid "Mckoi SQL" msgstr "Mckoi SQL" -#. Tag: entry -#, no-c-format -msgid "org.hibernate.dialect.MckoiDialect" +#. Tag: literal +#: configuration.xml:1051 +#, fuzzy, no-c-format +msgid "org.hibernate.dialect.MckoiDialect" msgstr "org.hibernate.dialect.MckoiDialect" #. Tag: entry +#: configuration.xml:1055 #, no-c-format msgid "Interbase" msgstr "Interbase" -#. Tag: entry -#, no-c-format -msgid "org.hibernate.dialect.InterbaseDialect" +#. Tag: literal +#: configuration.xml:1057 +#, fuzzy, no-c-format +msgid "org.hibernate.dialect.InterbaseDialect" msgstr "org.hibernate.dialect.InterbaseDialect" #. Tag: entry +#: configuration.xml:1061 #, no-c-format msgid "Pointbase" msgstr "Pointbase" -#. Tag: entry -#, no-c-format -msgid "org.hibernate.dialect.PointbaseDialect" +#. Tag: literal +#: configuration.xml:1063 +#, fuzzy, no-c-format +msgid "org.hibernate.dialect.PointbaseDialect" msgstr "org.hibernate.dialect.PointbaseDialect" #. Tag: entry +#: configuration.xml:1067 #, no-c-format msgid "FrontBase" msgstr "FrontBase" -#. Tag: entry -#, no-c-format -msgid "org.hibernate.dialect.FrontbaseDialect" +#. Tag: literal +#: configuration.xml:1069 +#, fuzzy, no-c-format +msgid "org.hibernate.dialect.FrontbaseDialect" msgstr "org.hibernate.dialect.FrontbaseDialect" #. Tag: entry +#: configuration.xml:1073 #, no-c-format msgid "Firebird" msgstr "Firebird" -#. Tag: entry -#, no-c-format -msgid "org.hibernate.dialect.FirebirdDialect" +#. Tag: literal +#: configuration.xml:1075 +#, fuzzy, no-c-format +msgid "org.hibernate.dialect.FirebirdDialect" msgstr "org.hibernate.dialect.FirebirdDialect" #. Tag: title +#: configuration.xml:1083 #, no-c-format msgid "Outer Join Fetching" msgstr "Recuperación por Unión Externa - Outer Join Fetching" #. Tag: para +#: configuration.xml:1085 #, no-c-format msgid "" "If your database supports ANSI, Oracle or Sybase style outer joins, " @@ -1710,6 +2110,7 @@ msgstr "" "muchos y uno-a-uno sea recuperado en un sólo SELECT SQL." #. Tag: para +#: configuration.xml:1094 #, no-c-format msgid "" "Outer join fetching can be disabled globally by setting " @@ -1726,18 +2127,21 @@ msgstr "" "con fetch=\"join\"." #. Tag: para -#, no-c-format -msgid "See for more information." +#: configuration.xml:1100 +#, fuzzy, no-c-format +msgid "See for more information." msgstr "" "Consulte para obtener más " "información." #. Tag: title +#: configuration.xml:1105 #, no-c-format msgid "Binary Streams" msgstr "Flujos Binarios" #. Tag: para +#: configuration.xml:1107 #, no-c-format msgid "" "Oracle limits the size of byte arrays that can be passed " @@ -1753,16 +2157,18 @@ msgstr "" "Esta es una configuración a nivel de sistema sólamente." #. Tag: title +#: configuration.xml:1116 #, no-c-format msgid "Second-level and query cache" msgstr "Caché de segundo nivel y de lectura" #. Tag: para -#, no-c-format +#: configuration.xml:1118 +#, fuzzy, no-c-format msgid "" "The properties prefixed by hibernate.cache allow you to " "use a process or cluster scoped second-level cache system with Hibernate. " -"See the for more information." +"See the for more information." msgstr "" "Las propiedades prefijadas por hibernate.cache le " "permiten utilizar un sistema de caché de segundo nivel en el ámbito de un " @@ -1770,11 +2176,13 @@ msgstr "" "> para obtener más detalles." #. Tag: title +#: configuration.xml:1125 #, no-c-format msgid "Query Language Substitution" msgstr "Sustitución de Lenguaje de Consulta" #. Tag: para +#: configuration.xml:1127 #, no-c-format msgid "" "You can define new Hibernate query tokens using hibernate.query." @@ -1783,7 +2191,14 @@ msgstr "" "Puede definir nuevos tokens de consulta de Hibernate utilizando " "hibernate.query.substitutions. Por ejemplo:" +#. Tag: programlisting +#: configuration.xml:1130 +#, fuzzy, no-c-format +msgid "hibernate.query.substitutions true=1, false=0" +msgstr "hibernate.query.substitutions" + #. Tag: para +#: configuration.xml:1132 #, no-c-format msgid "" "This would cause the tokens true and falsetrue y false sean traducidos a literales enteros en el SQL generado." +#. Tag: programlisting +#: configuration.xml:1136 +#, fuzzy, no-c-format +msgid "hibernate.query.substitutions toLowercase=LOWER" +msgstr "hibernate.query.substitutions" + #. Tag: para +#: configuration.xml:1138 #, no-c-format -msgid "This would allow you to rename the SQL LOWER function." -msgstr "Esto le permitiría renombrar la función LOWER de SQL." +msgid "" +"This would allow you to rename the SQL LOWER function." +msgstr "" +"Esto le permitiría renombrar la función LOWER de SQL." #. Tag: title +#: configuration.xml:1143 #, no-c-format msgid "Hibernate statistics" msgstr "Estadísticas de Hibernate" #. Tag: para +#: configuration.xml:1145 #, no-c-format msgid "" "If you enable hibernate.generate_statistics, Hibernate " @@ -1819,11 +2245,13 @@ msgstr "" "stats para obtener más información." #. Tag: title +#: configuration.xml:1155 #, no-c-format msgid "Logging" msgstr "Registros de mensajes (Logging)" #. Tag: para +#: configuration.xml:1157 #, no-c-format msgid "" "Hibernate utilizes Simple Logging " @@ -1854,6 +2282,7 @@ msgstr "" "literal>." #. Tag: para +#: configuration.xml:1171 #, no-c-format msgid "" "It is recommended that you familiarize yourself with Hibernate's log " @@ -1869,56 +2298,67 @@ msgstr "" "registro más interesantes son las siguientes: " #. Tag: title +#: configuration.xml:1178 #, no-c-format msgid "Hibernate Log Categories" msgstr "Categorías de Registro de Hibernate" #. Tag: entry +#: configuration.xml:1187 #, no-c-format msgid "Category" msgstr "Categoría" #. Tag: entry +#: configuration.xml:1189 #, no-c-format msgid "Function" msgstr "Función" -#. Tag: entry -#, no-c-format -msgid "org.hibernate.SQL" +#. Tag: literal +#: configuration.xml:1195 +#, fuzzy, no-c-format +msgid "org.hibernate.SQL" msgstr "org.hibernate.SQL" #. Tag: entry +#: configuration.xml:1197 #, no-c-format msgid "Log all SQL DML statements as they are executed" msgstr "Registra todas las declaraciones DML de SQL a medida que se ejecutan" -#. Tag: entry -#, no-c-format -msgid "org.hibernate.type" +#. Tag: literal +#: configuration.xml:1201 +#, fuzzy, no-c-format +msgid "org.hibernate.type" msgstr "org.hibernate.type" #. Tag: entry +#: configuration.xml:1203 #, no-c-format msgid "Log all JDBC parameters" msgstr "Registra todos los parámetros JDBC" -#. Tag: entry -#, no-c-format -msgid "org.hibernate.tool.hbm2ddl" +#. Tag: literal +#: configuration.xml:1207 +#, fuzzy, no-c-format +msgid "org.hibernate.tool.hbm2ddl" msgstr "org.hibernate.tool.hbm2ddl" #. Tag: entry +#: configuration.xml:1209 #, no-c-format msgid "Log all SQL DDL statements as they are executed" msgstr "Registra todas las declaraciones DDL de SQL a medida que se ejecutan" -#. Tag: entry -#, no-c-format -msgid "org.hibernate.pretty" +#. Tag: literal +#: configuration.xml:1213 +#, fuzzy, no-c-format +msgid "org.hibernate.pretty" msgstr "org.hibernate.pretty" #. Tag: entry +#: configuration.xml:1215 #, no-c-format msgid "" "Log the state of all entities (max 20 entities) associated with the session " @@ -1927,62 +2367,74 @@ msgstr "" "Registra el estado de todas las entidades (máximo 20 entidades) asociadas " "con la sesión en tiempo de limpieza (flush)" -#. Tag: entry -#, no-c-format -msgid "org.hibernate.cache" +#. Tag: literal +#: configuration.xml:1220 +#, fuzzy, no-c-format +msgid "org.hibernate.cache" msgstr "org.hibernate.cache" #. Tag: entry +#: configuration.xml:1222 #, no-c-format msgid "Log all second-level cache activity" msgstr "Registra toda la actividad del caché de segundo nivel" -#. Tag: entry -#, no-c-format -msgid "org.hibernate.transaction" +#. Tag: literal +#: configuration.xml:1226 +#, fuzzy, no-c-format +msgid "org.hibernate.transaction" msgstr "org.hibernate.transaction" #. Tag: entry +#: configuration.xml:1228 #, no-c-format msgid "Log transaction related activity" msgstr "Registra la actividad relacionada con la transacción" -#. Tag: entry -#, no-c-format -msgid "org.hibernate.jdbc" +#. Tag: literal +#: configuration.xml:1232 +#, fuzzy, no-c-format +msgid "org.hibernate.jdbc" msgstr "org.hibernate.jdbc" #. Tag: entry +#: configuration.xml:1234 #, no-c-format msgid "Log all JDBC resource acquisition" msgstr "Registra toda adquisición de recursos JDBC" -#. Tag: entry -#, no-c-format -msgid "org.hibernate.hql.ast.AST" +#. Tag: literal +#: configuration.xml:1238 +#, fuzzy, no-c-format +msgid "org.hibernate.hql.ast.AST" msgstr "org.hibernate.hql.ast.AST" #. Tag: entry +#: configuration.xml:1240 #, no-c-format msgid "Log HQL and SQL ASTs during query parsing" msgstr "Regista los ASTs de HQL y SQL, durante análisis de consultas." -#. Tag: entry -#, no-c-format -msgid "org.hibernate.secure" +#. Tag: literal +#: configuration.xml:1244 +#, fuzzy, no-c-format +msgid "org.hibernate.secure" msgstr "org.hibernate.secure" #. Tag: entry +#: configuration.xml:1246 #, no-c-format msgid "Log all JAAS authorization requests" msgstr "Registra todas las peticiones de autorización JAAS" -#. Tag: entry +#. Tag: literal +#: configuration.xml:1250 #, no-c-format -msgid "org.hibernate" -msgstr "org.hibernate" +msgid "org.hibernate" +msgstr "" #. Tag: entry +#: configuration.xml:1252 #, no-c-format msgid "" "Log everything. This is a lot of information but it is useful for " @@ -1992,6 +2444,7 @@ msgstr "" "problemas" #. Tag: para +#: configuration.xml:1259 #, no-c-format msgid "" "When developing applications with Hibernate, you should almost always work " @@ -2005,11 +2458,13 @@ msgstr "" "literal> habilitada." #. Tag: title +#: configuration.xml:1266 #, no-c-format msgid "Implementing a NamingStrategy" msgstr "Implementación de una NamingStrategy" #. Tag: para +#: configuration.xml:1268 #, no-c-format msgid "" "The interface org.hibernate.cfg.NamingStrategy allows you " @@ -2020,6 +2475,7 @@ msgstr "" "los elementos del esquema." #. Tag: para +#: configuration.xml:1272 #, no-c-format msgid "" "You can provide rules for automatically generating database identifiers from " @@ -2038,6 +2494,7 @@ msgstr "" "bastante mínima." #. Tag: para +#: configuration.xml:1279 #, no-c-format msgid "" "You can specify a different strategy by calling Configuration." @@ -2046,7 +2503,19 @@ msgstr "" "Puede especificar una estrategia diferente llamando a Configuration." "setNamingStrategy() antes de agregar los mapeos:" +#. Tag: programlisting +#: configuration.xml:1283 +#, no-c-format +msgid "" +"SessionFactory sf = new Configuration()\n" +" .setNamingStrategy(ImprovedNamingStrategy.INSTANCE)\n" +" .addFile(\"Item.hbm.xml\")\n" +" .addFile(\"Bid.hbm.xml\")\n" +" .buildSessionFactory();" +msgstr "" + #. Tag: para +#: configuration.xml:1285 #, no-c-format msgid "" "org.hibernate.cfg.ImprovedNamingStrategy is a built-in " @@ -2057,11 +2526,13 @@ msgstr "" "aplicaciones." #. Tag: title +#: configuration.xml:1291 #, no-c-format msgid "XML configuration file" msgstr "Archivo de configuración XML" #. Tag: para +#: configuration.xml:1293 #, no-c-format msgid "" "An alternative approach to configuration is to specify a full configuration " @@ -2076,6 +2547,7 @@ msgstr "" "sobrescribir propiedades." #. Tag: para +#: configuration.xml:1299 #, no-c-format msgid "" "The XML configuration file is by default expected to be in the root of your " @@ -2084,7 +2556,53 @@ msgstr "" "El archivo de configuración XML por defecto se espera en la raíz de su " "CLASSPATH. Este es un ejemplo:" +#. Tag: programlisting +#: configuration.xml:1302 +#, no-c-format +msgid "" +"<?xml version='1.0' encoding='utf-8'?>\n" +"<!DOCTYPE hibernate-configuration PUBLIC\n" +" \"-//Hibernate/Hibernate Configuration DTD//EN\"\n" +" \"http://hibernate.sourceforge.net/hibernate-configuration-3.0.dtd" +"\">\n" +"\n" +"<hibernate-configuration>\n" +"\n" +" <!-- a SessionFactory instance listed as /jndi/name -->\n" +" <session-factory\n" +" name=\"java:hibernate/SessionFactory\">\n" +"\n" +" <!-- properties -->\n" +" <property name=\"connection.datasource\">java:/comp/env/jdbc/" +"MyDB</property>\n" +" <property name=\"dialect\">org.hibernate.dialect." +"MySQLDialect</property>\n" +" <property name=\"show_sql\">false</property>\n" +" <property name=\"transaction.factory_class\">\n" +" org.hibernate.transaction.JTATransactionFactory\n" +" </property>\n" +" <property name=\"jta.UserTransaction\">java:comp/" +"UserTransaction</property>\n" +"\n" +" <!-- mapping files -->\n" +" <mapping resource=\"org/hibernate/auction/Item.hbm.xml\"/>\n" +" <mapping resource=\"org/hibernate/auction/Bid.hbm.xml\"/>\n" +"\n" +" <!-- cache settings -->\n" +" <class-cache class=\"org.hibernate.auction.Item\" usage=\"read-" +"write\"/>\n" +" <class-cache class=\"org.hibernate.auction.Bid\" usage=\"read-only" +"\"/>\n" +" <collection-cache collection=\"org.hibernate.auction.Item.bids\" " +"usage=\"read-write\"/>\n" +"\n" +" </session-factory>\n" +"\n" +"</hibernate-configuration>" +msgstr "" + #. Tag: para +#: configuration.xml:1304 #, no-c-format msgid "" "The advantage of this approach is the externalization of the mapping file " @@ -2102,21 +2620,42 @@ msgstr "" "los beneficios de utilizar la sintaxis XML que mencionados anteriormente." #. Tag: para +#: configuration.xml:1311 #, no-c-format msgid "With the XML configuration, starting Hibernate is then as simple as:" msgstr "Con la configuración XML, iniciar Hibernate es tan simple como:" +#. Tag: programlisting +#: configuration.xml:1314 +#, no-c-format +msgid "" +"SessionFactory sf = new Configuration().configure().buildSessionFactory();" +msgstr "" + #. Tag: para +#: configuration.xml:1316 #, no-c-format msgid "You can select a different XML configuration file using:" -msgstr "Puede seleccionar un fichero de configuración XML diferente utilizando:" +msgstr "" +"Puede seleccionar un fichero de configuración XML diferente utilizando:" + +#. Tag: programlisting +#: configuration.xml:1318 +#, no-c-format +msgid "" +"SessionFactory sf = new Configuration()\n" +" .configure(\"catdb.cfg.xml\")\n" +" .buildSessionFactory();" +msgstr "" #. Tag: title +#: configuration.xml:1322 #, no-c-format msgid "J2EE Application Server integration" msgstr "Integración con Servidores de Aplicaciones J2EE" #. Tag: para +#: configuration.xml:1324 #, no-c-format msgid "Hibernate has the following integration points for J2EE infrastructure:" msgstr "" @@ -2124,6 +2663,7 @@ msgstr "" "J2EE:" #. Tag: para +#: configuration.xml:1329 #, no-c-format msgid "" "Container-managed datasources: Hibernate can use JDBC " @@ -2146,6 +2686,7 @@ msgstr "" "literal> de Hibernate para mantener portátil su código." #. Tag: para +#: configuration.xml:1343 #, no-c-format msgid "" "Automatic JNDI binding: Hibernate can bind its " @@ -2155,6 +2696,7 @@ msgstr "" "sus SessionFactory a JNDI después del inicio." #. Tag: para +#: configuration.xml:1350 #, no-c-format msgid "" "JTA Session binding: the Hibernate SessionJMX deployment: if you have a JMX capable application " @@ -2194,6 +2737,7 @@ msgstr "" "de que Hibernate inicie, etc)." #. Tag: para +#: configuration.xml:1373 #, no-c-format msgid "" "Depending on your environment, you might have to set the configuration " @@ -2206,11 +2750,13 @@ msgstr "" "conexión\"." #. Tag: title +#: configuration.xml:1379 #, no-c-format msgid "Transaction strategy configuration" msgstr "Configuración de la estrategia de transacción" #. Tag: para +#: configuration.xml:1381 #, no-c-format msgid "" "The Hibernate Session API is independent of any " @@ -2229,6 +2775,7 @@ msgstr "" "UserTransaction cuando sea necesario." #. Tag: para +#: configuration.xml:1389 #, no-c-format msgid "" "To keep your code portable between these two (and other) environments we " @@ -2246,26 +2793,31 @@ msgstr "" "literal> de Hibernate." #. Tag: para +#: configuration.xml:1397 #, no-c-format msgid "There are three standard, or built-in, choices:" msgstr "Existen tres opciones estándares o incorporadas:" -#. Tag: term -#, no-c-format -msgid "org.hibernate.transaction.JDBCTransactionFactory" +#. Tag: literal +#: configuration.xml:1401 +#, fuzzy, no-c-format +msgid "org.hibernate.transaction.JDBCTransactionFactory" msgstr "org.hibernate.transaction.JDBCTransactionFactory" #. Tag: para +#: configuration.xml:1404 #, no-c-format msgid "delegates to database (JDBC) transactions (default)" msgstr "delega a transacciones de bases de datos (JDBC) (por defecto)" -#. Tag: term -#, no-c-format -msgid "org.hibernate.transaction.JTATransactionFactory" +#. Tag: literal +#: configuration.xml:1409 +#, fuzzy, no-c-format +msgid "org.hibernate.transaction.JTATransactionFactory" msgstr "org.hibernate.transaction.JTATransactionFactory" #. Tag: para +#: configuration.xml:1412 #, no-c-format msgid "" "delegates to container-managed transactions if an existing transaction is " @@ -2277,17 +2829,20 @@ msgstr "" "de bean de sesión EJB). De otra manera, se inicia una nueva transacción y se " "utilizan las transacciones administradas por bean." -#. Tag: term -#, no-c-format -msgid "org.hibernate.transaction.CMTTransactionFactory" +#. Tag: literal +#: configuration.xml:1420 +#, fuzzy, no-c-format +msgid "org.hibernate.transaction.CMTTransactionFactory" msgstr "org.hibernate.transaction.CMTTransactionFactory" #. Tag: para +#: configuration.xml:1423 #, no-c-format msgid "delegates to container-managed JTA transactions" msgstr "delega a transacciones JTA administradas por el contenedor" #. Tag: para +#: configuration.xml:1428 #, no-c-format msgid "" "You can also define your own transaction strategies (for a CORBA transaction " @@ -2297,6 +2852,7 @@ msgstr "" "para un servicio de transacción CORBA)." #. Tag: para +#: configuration.xml:1431 #, no-c-format msgid "" "Some features in Hibernate (i.e., the second level cache, Contextual " @@ -2314,134 +2870,163 @@ msgstr "" "no estandariza un sólo mecanismo:" #. Tag: title +#: configuration.xml:1439 #, no-c-format msgid "JTA TransactionManagers" msgstr "TransactionManagers de JTA" #. Tag: entry +#: configuration.xml:1448 #, no-c-format msgid "Transaction Factory" msgstr "Transaction Factory" #. Tag: entry +#: configuration.xml:1450 #, no-c-format msgid "Application Server" msgstr "Servidor de Aplicaciones" -#. Tag: entry -#, no-c-format -msgid "org.hibernate.transaction.JBossTransactionManagerLookup" -msgstr "org.hibernate.transaction.JBossTransactionManagerLookup" +#. Tag: literal +#: configuration.xml:1456 +#, fuzzy, no-c-format +msgid "org.hibernate.transaction.JBossTransactionManagerLookup" +msgstr "" +"org.hibernate.transaction.JBossTransactionManagerLookup" #. Tag: entry +#: configuration.xml:1458 #, no-c-format msgid "JBoss" msgstr "JBoss" -#. Tag: entry -#, no-c-format -msgid "org.hibernate.transaction.WeblogicTransactionManagerLookup" -msgstr "org.hibernate.transaction.WeblogicTransactionManagerLookup" +#. Tag: literal +#: configuration.xml:1462 +#, fuzzy, no-c-format +msgid "org.hibernate.transaction.WeblogicTransactionManagerLookup" +msgstr "" +"org.hibernate.transaction.WeblogicTransactionManagerLookup" #. Tag: entry +#: configuration.xml:1464 #, no-c-format msgid "Weblogic" msgstr "Weblogic" -#. Tag: entry -#, no-c-format -msgid "" -"org.hibernate.transaction.WebSphereTransactionManagerLookup" +#. Tag: literal +#: configuration.xml:1468 +#, fuzzy, no-c-format +msgid "org.hibernate.transaction.WebSphereTransactionManagerLookup" msgstr "" "org.hibernate.transaction.WebSphereTransactionManagerLookup" #. Tag: entry +#: configuration.xml:1470 #, no-c-format msgid "WebSphere" msgstr "WebSphere" -#. Tag: entry -#, no-c-format -msgid "" -"org.hibernate.transaction.WebSphereExtendedJTATransactionLookup" +#. Tag: literal +#: configuration.xml:1474 +#, fuzzy, no-c-format +msgid "org.hibernate.transaction.WebSphereExtendedJTATransactionLookup" msgstr "" "org.hibernate.transaction.WebSphereExtendedJTATransactionLookup" #. Tag: entry +#: configuration.xml:1476 #, no-c-format msgid "WebSphere 6" msgstr "WebSphere 6" -#. Tag: entry -#, no-c-format -msgid "org.hibernate.transaction.OrionTransactionManagerLookup" -msgstr "org.hibernate.transaction.OrionTransactionManagerLookup" +#. Tag: literal +#: configuration.xml:1480 +#, fuzzy, no-c-format +msgid "org.hibernate.transaction.OrionTransactionManagerLookup" +msgstr "" +"org.hibernate.transaction.OrionTransactionManagerLookup" #. Tag: entry +#: configuration.xml:1482 #, no-c-format msgid "Orion" msgstr "Orion" -#. Tag: entry -#, no-c-format -msgid "org.hibernate.transaction.ResinTransactionManagerLookup" -msgstr "org.hibernate.transaction.ResinTransactionManagerLookup" +#. Tag: literal +#: configuration.xml:1486 +#, fuzzy, no-c-format +msgid "org.hibernate.transaction.ResinTransactionManagerLookup" +msgstr "" +"org.hibernate.transaction.ResinTransactionManagerLookup" #. Tag: entry +#: configuration.xml:1488 #, no-c-format msgid "Resin" msgstr "Resin" -#. Tag: entry -#, no-c-format -msgid "org.hibernate.transaction.JOTMTransactionManagerLookup" -msgstr "org.hibernate.transaction.JOTMTransactionManagerLookup" +#. Tag: literal +#: configuration.xml:1492 +#, fuzzy, no-c-format +msgid "org.hibernate.transaction.JOTMTransactionManagerLookup" +msgstr "" +"org.hibernate.transaction.JOTMTransactionManagerLookup" #. Tag: entry +#: configuration.xml:1494 #, no-c-format msgid "JOTM" msgstr "JOTM" -#. Tag: entry -#, no-c-format -msgid "org.hibernate.transaction.JOnASTransactionManagerLookup" -msgstr "org.hibernate.transaction.JOnASTransactionManagerLookup" +#. Tag: literal +#: configuration.xml:1498 +#, fuzzy, no-c-format +msgid "org.hibernate.transaction.JOnASTransactionManagerLookup" +msgstr "" +"org.hibernate.transaction.JOnASTransactionManagerLookup" #. Tag: entry +#: configuration.xml:1500 #, no-c-format msgid "JOnAS" msgstr "JOnAS" -#. Tag: entry -#, no-c-format -msgid "org.hibernate.transaction.JRun4TransactionManagerLookup" -msgstr "org.hibernate.transaction.JRun4TransactionManagerLookup" +#. Tag: literal +#: configuration.xml:1504 +#, fuzzy, no-c-format +msgid "org.hibernate.transaction.JRun4TransactionManagerLookup" +msgstr "" +"org.hibernate.transaction.JRun4TransactionManagerLookup" #. Tag: entry +#: configuration.xml:1506 #, no-c-format msgid "JRun4" msgstr "JRun4" -#. Tag: entry -#, no-c-format -msgid "org.hibernate.transaction.BESTransactionManagerLookup" -msgstr "org.hibernate.transaction.BESTransactionManagerLookup" +#. Tag: literal +#: configuration.xml:1510 +#, fuzzy, no-c-format +msgid "org.hibernate.transaction.BESTransactionManagerLookup" +msgstr "" +"org.hibernate.transaction.BESTransactionManagerLookup" #. Tag: entry +#: configuration.xml:1512 #, no-c-format msgid "Borland ES" msgstr "Borland ES" #. Tag: title +#: configuration.xml:1520 #, no-c-format msgid "JNDI-bound SessionFactory" msgstr "SessionFactory enlazado a JNDI" #. Tag: para +#: configuration.xml:1522 #, no-c-format msgid "" "A JNDI-bound Hibernate SessionFactory can simplify the " @@ -2456,6 +3041,7 @@ msgstr "" "utilizan el mismo registro." #. Tag: para +#: configuration.xml:1528 #, no-c-format msgid "" "If you wish to have the SessionFactory bound to a JNDI " @@ -2474,6 +3060,7 @@ msgstr "" "lectura por defecto (por ejemplo, en Tomcat)." #. Tag: para +#: configuration.xml:1536 #, no-c-format msgid "" "When binding the SessionFactory to JNDI, Hibernate will " @@ -2487,6 +3074,7 @@ msgstr "" "especifican, se utilizará el InitialContext por defecto." #. Tag: para +#: configuration.xml:1542 #, no-c-format msgid "" "Hibernate will automatically place the SessionFactory in " @@ -2504,6 +3092,7 @@ msgstr "" "mayor detalle)." #. Tag: para +#: configuration.xml:1550 #, no-c-format msgid "" "If you use a JNDI SessionFactory, an EJB or any other " @@ -2515,7 +3104,8 @@ msgstr "" "utilizando una búsqueda JNDI." #. Tag: para -#, no-c-format +#: configuration.xml:1554 +#, fuzzy, no-c-format msgid "" "It is recommended that you bind the SessionFactory to " "JNDI in a managed environment and use a static singleton " @@ -2523,7 +3113,7 @@ msgid "" "recommend to hide the actual lookup code for a SessionFactory in a helper class, such as HibernateUtil.getSessionFactory" "(). Note that such a class is also a convenient way to startup " -"Hibernate—see chapter 1." +"Hibernate—see chapter 1." msgstr "" "Le recomendamos que vincule el SessionFactory a JNDI en " "un entorno administrado y que de otra manera, use un singleton " @@ -2534,22 +3124,24 @@ msgstr "" "también es una manera práctica de iniciar Hibernate— vea el capítulo 1." #. Tag: title +#: configuration.xml:1565 #, no-c-format msgid "Current Session context management with JTA" msgstr "Administración de contexto de Sesión Actual con JTA" #. Tag: para -#, no-c-format +#: configuration.xml:1567 +#, fuzzy, no-c-format msgid "" "The easiest way to handle Sessions and transactions is " "Hibernate's automatic \"current\" Session management. For " "a discussion of contextual sessions see . Using the \"jta\" session context, if there " +"session\"/>. Using the \"jta\" session context, if there " "is no Hibernate Session associated with the current JTA " "transaction, one will be started and associated with that JTA transaction " "the first time you call sessionFactory.getCurrentSession(). The Sessions retrieved via " -"getCurrentSession() in the\"jta\" " +"getCurrentSession() in the \"jta\" " "context are set to automatically flush before the transaction completes, " "close after the transaction completes, and aggressively release JDBC " "connections after each statement. This allows the Sessioncfg.buildSessionFactory() still has to be " @@ -2604,6 +3198,7 @@ msgstr "" "desplegar Hibernate como un servicio administrado." #. Tag: para +#: configuration.xml:1598 #, no-c-format msgid "" "Hibernate is distributed with org.hibernate.jmx.HibernateServicejboss-service.xml para " "JBoss 4.0.x: " +#. Tag: programlisting +#: configuration.xml:1604 +#, no-c-format +msgid "" +"<?xml version=\"1.0\"?>\n" +"<server>\n" +"\n" +"<mbean code=\"org.hibernate.jmx.HibernateService\"\n" +" name=\"jboss.jca:service=HibernateFactory,name=HibernateFactory\">\n" +"\n" +" <!-- Required services -->\n" +" <depends>jboss.jca:service=RARDeployer</depends>\n" +" <depends>jboss.jca:service=LocalTxCM,name=HsqlDS</depends>\n" +"\n" +" <!-- Bind the Hibernate service to JNDI -->\n" +" <attribute name=\"JndiName\">java:/hibernate/SessionFactory</" +"attribute>\n" +"\n" +" <!-- Datasource settings -->\n" +" <attribute name=\"Datasource\">java:HsqlDS</attribute>\n" +" <attribute name=\"Dialect\">org.hibernate.dialect.HSQLDialect</" +"attribute>\n" +"\n" +" <!-- Transaction integration -->\n" +" <attribute name=\"TransactionStrategy\">\n" +" org.hibernate.transaction.JTATransactionFactory</attribute>\n" +" <attribute name=\"TransactionManagerLookupStrategy\">\n" +" org.hibernate.transaction.JBossTransactionManagerLookup</" +"attribute>\n" +" <attribute name=\"FlushBeforeCompletionEnabled\">true</" +"attribute>\n" +" <attribute name=\"AutoCloseSessionEnabled\">true</" +"attribute>\n" +"\n" +" <!-- Fetching options -->\n" +" <attribute name=\"MaximumFetchDepth\">5</attribute>\n" +"\n" +" <!-- Second-level caching -->\n" +" <attribute name=\"SecondLevelCacheEnabled\">true</" +"attribute>\n" +" <attribute name=\"CacheProviderClass\">org.hibernate.cache." +"EhCacheProvider</attribute>\n" +" <attribute name=\"QueryCacheEnabled\">true</attribute>\n" +"\n" +" <!-- Logging -->\n" +" <attribute name=\"ShowSqlEnabled\">true</attribute>\n" +"\n" +" <!-- Mapping files -->\n" +" <attribute name=\"MapResources\">auction/Item.hbm.xml,auction/" +"Category.hbm.xml</attribute>\n" +"\n" +"</mbean>\n" +"\n" +"</server>" +msgstr "" + #. Tag: para +#: configuration.xml:1606 #, no-c-format msgid "" "This file is deployed in a directory called META-INF and " @@ -2641,3 +3293,17 @@ msgstr "" "apagarlo). Consulte la documentación de JBoss AS para obtener más " "información sobre el servicio JMX y la implementación de EJB." +#~ msgid "JDBC URL" +#~ msgstr "URL JDBC" + +#~ msgid "database user" +#~ msgstr "usuario de la base de datos" + +#~ msgid "hibernate.generate_statistics" +#~ msgstr "hibernate.generate_statistics" + +#~ msgid "DB2" +#~ msgstr "DB2" + +#~ msgid "org.hibernate" +#~ msgstr "org.hibernate" diff --git a/documentation/manual/src/main/docbook/es-ES/content/filters.po b/documentation/manual/src/main/docbook/es-ES/content/filters.po index 50d35eeb15..4bb36c2d0c 100644 --- a/documentation/manual/src/main/docbook/es-ES/content/filters.po +++ b/documentation/manual/src/main/docbook/es-ES/content/filters.po @@ -14,7 +14,7 @@ msgid "" msgstr "" "Project-Id-Version: filters\n" "Report-Msgid-Bugs-To: http://bugs.kde.org\n" -"POT-Creation-Date: 2010-02-10T07:25:35\n" +"POT-Creation-Date: 2010-07-20 21:02+0000\n" "PO-Revision-Date: 2009-11-11 08:28+1000\n" "Last-Translator: Angela Garcia \n" "Language-Team: \n" @@ -24,11 +24,13 @@ msgstr "" "X-Generator: KBabel 1.11.4\n" #. Tag: title +#: filters.xml:31 #, no-c-format msgid "Filtering data" msgstr "Filtración de datos" #. Tag: para +#: filters.xml:33 #, no-c-format msgid "" "Hibernate3 provides an innovative new approach to handling data with " @@ -42,11 +44,13 @@ msgstr "" "deshabilitado para una sesión de Hibernate especifica." #. Tag: title +#: filters.xml:39 #, no-c-format msgid "Hibernate filters" msgstr "Filtros de Hibernate" #. Tag: para +#: filters.xml:41 #, no-c-format msgid "" "Hibernate3 has the ability to pre-define filter criteria and attach those " @@ -69,9 +73,95 @@ msgstr "" "parametrizados dentro de la aplicación." #. Tag: para +#: filters.xml:50 #, no-c-format msgid "" -"In order to use filters, they must first be defined and then attached to the " +"Using annotatons filters are defined via @org.hibernate.annotations." +"FilterDef or @org.hibernate.annotations.FilterDefs. A filter definition has a name() and an " +"array of parameters(). A parameter will allow you to adjust the behavior of " +"the filter at runtime. Each parameter is defined by a @ParamDef which has a name and a type. You can also define a " +"defaultCondition() parameter for a given " +"@FilterDef to set the default condition to use when none " +"are defined in each individual @Filter. " +"@FilterDef(s) can be defined at the class or package " +"level." +msgstr "" + +#. Tag: para +#: filters.xml:63 +#, no-c-format +msgid "" +"We now need to define the SQL filter clause applied to either the entity " +"load or the collection load. @Filter is used and placed " +"either on the entity or the collection element. The connection between " +"@FilterName and @Filter is a " +"matching name." +msgstr "" + +#. Tag: title +#: filters.xml:70 +#, no-c-format +msgid "@FilterDef and @Filter annotations" +msgstr "" + +#. Tag: programlisting +#: filters.xml:72 +#, no-c-format +msgid "" +"@Entity\n" +"@FilterDef(name=\"minLength\", parameters=@ParamDef( name=\"minLength\", " +"type=\"integer\" ) )\n" +"@Filters( {\n" +" @Filter(name=\"betweenLength\", condition=\":minLength <= length and :" +"maxLength >= length\"),\n" +" @Filter(name=\"minLength\", condition=\":minLength <= length\")\n" +"} )\n" +"public class Forest { ... }" +msgstr "" + +#. Tag: para +#: filters.xml:75 +#, no-c-format +msgid "" +"When the collection use an association table as a relational representation, " +"you might want to apply the filter condition to the association table itself " +"or to the target entity table. To apply the constraint on the target entity, " +"use the regular @Filter annotation. However, if you want " +"to target the association table, use the @FilterJoinTable " +"annotation." +msgstr "" + +#. Tag: title +#: filters.xml:84 +#, no-c-format +msgid "" +"Using @FilterJoinTable for filterting on the " +"association table" +msgstr "" + +#. Tag: programlisting +#: filters.xml:87 +#, no-c-format +msgid "" +"@OneToMany\n" +" @JoinTable\n" +" //filter on the target entity table\n" +" @Filter(name=\"betweenLength\", condition=\":minLength <= length and :" +"maxLength >= length\")\n" +" //filter on the association table\n" +" @FilterJoinTable(name=\"security\", condition=\":userlevel >= " +"requredLevel\")\n" +" public Set<Forest> getForests() { ... }" +msgstr "" + +#. Tag: para +#: filters.xml:90 +#, fuzzy, no-c-format +msgid "" +"Using Hibernate mapping files for defining filters the situtation is very " +"similar. The filters must first be defined and then attached to the " "appropriate mapping elements. To define a filter, use the <" "filter-def/> element within a <hibernate-mapping/" "> element:" @@ -81,22 +171,58 @@ msgstr "" "elemento <filter-def/> dentro de un elemento " "<hibernate-mapping/>:" -#. Tag: para +#. Tag: title +#: filters.xml:97 #, no-c-format -msgid "This filter can then be attached to a class:" -msgstr "Luego este filtro se puede adjuntar a una clase:" +msgid "Defining a filter definition via <filter-def>" +msgstr "" + +#. Tag: programlisting +#: filters.xml:100 +#, fuzzy, no-c-format +msgid "" +"<filter-def name=\"myFilter\">\n" +" <filter-param name=\"myFilterParam\" type=\"string\"/>\n" +"</filter-def>" +msgstr "" +"\n" +" \n" +"]]>" #. Tag: para -#, no-c-format -msgid "Or, to a collection:" -msgstr "O a una colección:" - -#. Tag: para -#, no-c-format -msgid "Or, to both or multiples of each at the same time." +#: filters.xml:103 +#, fuzzy, no-c-format +msgid "" +"This filter can then be attached to a class or collection (or, to both or " +"multiples of each at the same time):" msgstr "O incluso a ambos o múltiples de cada uno al mismo tiempo." +#. Tag: title +#: filters.xml:107 +#, no-c-format +msgid "" +"Attaching a filter to a class or collection using <filter>" +msgstr "" + +#. Tag: programlisting +#: filters.xml:110 +#, no-c-format +msgid "" +"<class name=\"myClass\" ...>\n" +" ...\n" +" <filter name=\"myFilter\" condition=\":myFilterParam = " +"MY_FILTERED_COLUMN\"/>\n" +"\n" +" <set ...>\n" +" <filter name=\"myFilter\" condition=\":myFilterParam = " +"MY_FILTERED_COLUMN\"/>\n" +" </set> \n" +"</class>" +msgstr "" + #. Tag: para +#: filters.xml:113 #, no-c-format msgid "" "The methods on Session are: enableFilter(String " @@ -117,7 +243,18 @@ msgstr "" "instancia de la interfaz Filter. Si se utiliza el filtro " "simple definido anteriormente, esto se vería así:" +#. Tag: programlisting +#: filters.xml:123 +#, fuzzy, no-c-format +msgid "" +"session.enableFilter(\"myFilter\").setParameter(\"myFilterParam\", \"some-" +"value\");" +msgstr "" +"" + #. Tag: para +#: filters.xml:125 #, no-c-format msgid "" "Methods on the org.hibernate.Filter interface do allow the method-chaining " @@ -127,6 +264,7 @@ msgstr "" "de métodos, lo cual es bastante común en gran parte de Hibernate." #. Tag: para +#: filters.xml:128 #, no-c-format msgid "" "The following is a full example, using temporal data with an effective " @@ -135,7 +273,79 @@ msgstr "" "Este es un ejemplo completo, utilizando datos temporales con un patrón " "efectivo de fechas de registro: " +#. Tag: programlisting +#: filters.xml:131 +#, fuzzy, no-c-format +msgid "" +"<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 "" +"\n" +" \n" +"\n" +"\n" +"\n" +"...\n" +" \n" +" \n" +" \n" +"...\n" +" \n" +" \n" +"\n" +"\n" +"\n" +"...\n" +" \n" +" \n" +" \n" +" \n" +" \n" +"]]>" + #. Tag: para +#: filters.xml:133 #, no-c-format msgid "" "In order to ensure that you are provided with currently effective records, " @@ -145,7 +355,29 @@ msgstr "" "actualmente, habilite el filtro en la sesión antes de recuperar los datos de " "los empleados:" +#. Tag: programlisting +#: filters.xml:137 +#, fuzzy, no-c-format +msgid "" +"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();" +msgstr "" +" :" +"targetSalary\")\n" +" .setLong(\"targetSalary\", new Long(1000000))\n" +" .list();\n" +"]]>" + #. Tag: para +#: filters.xml:139 #, no-c-format msgid "" "Even though a salary constraint was mentioned explicitly on the results in " @@ -159,6 +391,7 @@ msgstr "" "millón de dólares." #. Tag: para +#: filters.xml:144 #, no-c-format msgid "" "If you want to use filters with outer joining, either through HQL or load " @@ -173,6 +406,7 @@ msgstr "" "columna(s) después del operador." #. Tag: para +#: filters.xml:149 #, no-c-format msgid "" "After being defined, a filter might be attached to multiple entities and/or " @@ -187,7 +421,20 @@ msgstr "" "<filter-def/> le permite definir una condición por " "defecto, ya sea como atributo o como CDATA:" +#. Tag: programlisting +#: filters.xml:155 +#, fuzzy, no-c-format +msgid "" +"<filter-def name=\"myFilter\" condition=\"abc > xyz\">...</" +"filter-def>\n" +"<filter-def name=\"myOtherFilter\">abc=xyz</filter-def>" +msgstr "" +" xyz\">...\n" +"abc=xyz]]>" + #. Tag: para +#: filters.xml:157 #, no-c-format msgid "" "This default condition will be used whenever the filter is attached to " @@ -200,14 +447,11 @@ msgstr "" "condición especifica como parte del anexo del filtro, el cual substituye la " "condición por defecto en ese caso en particular." -#~ msgid "" -#~ "\n" -#~ " \n" -#~ "]]>" -#~ msgstr "" -#~ "\n" -#~ " \n" -#~ "]]>" +#~ msgid "This filter can then be attached to a class:" +#~ msgstr "Luego este filtro se puede adjuntar a una clase:" + +#~ msgid "Or, to a collection:" +#~ msgstr "O a una colección:" #~ msgid "" #~ "\n" @@ -232,107 +476,3 @@ msgstr "" #~ " \n" #~ "]]>" - -#~ msgid "" -#~ "" -#~ msgstr "" -#~ "" - -#~ msgid "" -#~ "\n" -#~ " \n" -#~ "\n" -#~ "\n" -#~ "\n" -#~ "...\n" -#~ " \n" -#~ " \n" -#~ " \n" -#~ "...\n" -#~ " \n" -#~ " \n" -#~ "\n" -#~ "\n" -#~ "\n" -#~ "...\n" -#~ " \n" -#~ " \n" -#~ " \n" -#~ " \n" -#~ " \n" -#~ "]]>" -#~ msgstr "" -#~ "\n" -#~ " \n" -#~ "\n" -#~ "\n" -#~ "\n" -#~ "...\n" -#~ " \n" -#~ " \n" -#~ " \n" -#~ "...\n" -#~ " \n" -#~ " \n" -#~ "\n" -#~ "\n" -#~ "\n" -#~ "...\n" -#~ " \n" -#~ " \n" -#~ " \n" -#~ " \n" -#~ " \n" -#~ "]]>" - -#~ msgid "" -#~ " :" -#~ "targetSalary\")\n" -#~ " .setLong(\"targetSalary\", new Long(1000000))\n" -#~ " .list();\n" -#~ "]]>" -#~ msgstr "" -#~ " :" -#~ "targetSalary\")\n" -#~ " .setLong(\"targetSalary\", new Long(1000000))\n" -#~ " .list();\n" -#~ "]]>" - -#~ msgid "" -#~ " xyz\">...\n" -#~ "abc=xyz]]>" -#~ msgstr "" -#~ " xyz\">...\n" -#~ "abc=xyz]]>" diff --git a/documentation/manual/src/main/docbook/es-ES/content/performance.po b/documentation/manual/src/main/docbook/es-ES/content/performance.po index ff584e394e..dc4eec4ec4 100644 --- a/documentation/manual/src/main/docbook/es-ES/content/performance.po +++ b/documentation/manual/src/main/docbook/es-ES/content/performance.po @@ -14,7 +14,7 @@ msgid "" msgstr "" "Project-Id-Version: performance\n" "Report-Msgid-Bugs-To: http://bugs.kde.org\n" -"POT-Creation-Date: 2010-02-11T05:38:15\n" +"POT-Creation-Date: 2010-07-20 21:02+0000\n" "PO-Revision-Date: 2010-03-17 10:28+1000\n" "Last-Translator: Angela Garcia \n" "Language-Team: \n" @@ -24,16 +24,19 @@ msgstr "" "X-Generator: KBabel 1.11.4\n" #. Tag: title +#: performance.xml:31 #, no-c-format msgid "Improving performance" msgstr "Mejoramiento del rendimiento" #. Tag: title +#: performance.xml:34 #, no-c-format msgid "Fetching strategies" msgstr "Estrategias de recuperación" #. Tag: para +#: performance.xml:36 #, no-c-format msgid "" "Hibernate uses a fetching strategy to retrieve " @@ -48,11 +51,13 @@ msgstr "" "particular o una petición Criteria." #. Tag: para +#: performance.xml:42 #, no-c-format msgid "Hibernate3 defines the following fetching strategies:" msgstr "Hibernate3 define las siguientes estrategias de recuperación:" #. Tag: para +#: performance.xml:46 #, no-c-format msgid "" "Join fetching: Hibernate retrieves the associated " @@ -64,6 +69,7 @@ msgstr "" "literal>, utilizando un OUTER JOIN." #. Tag: para +#: performance.xml:53 #, no-c-format msgid "" "Select fetching: a second SELECT is " @@ -78,6 +84,7 @@ msgstr "" "selección sólo será ejecutada cuando acceda a la asociación." #. Tag: para +#: performance.xml:61 #, no-c-format msgid "" "Subselect fetching: a second SELECT " @@ -94,6 +101,7 @@ msgstr "" "se ejecutará cuando acceda a la asociación." #. Tag: para +#: performance.xml:70 #, no-c-format msgid "" "Batch fetching: an optimization strategy for select " @@ -107,11 +115,13 @@ msgstr "" "una lista de claves principales o de claves foráneas." #. Tag: para +#: performance.xml:77 #, no-c-format msgid "Hibernate also distinguishes between:" msgstr "Hibernate también distingue entre:" #. Tag: para +#: performance.xml:81 #, no-c-format msgid "" "Immediate fetching: an association, collection or " @@ -121,6 +131,7 @@ msgstr "" "atributo se recupera inmediatamente cuando se carga el dueño." #. Tag: para +#: performance.xml:87 #, no-c-format msgid "" "Lazy collection fetching: a collection is fetched when " @@ -132,6 +143,7 @@ msgstr "" "es el valor predeterminado para las colecciones." #. Tag: para +#: performance.xml:93 #, no-c-format msgid "" "\"Extra-lazy\" collection fetching: individual elements " @@ -146,6 +158,7 @@ msgstr "" "grandes." #. Tag: para +#: performance.xml:101 #, no-c-format msgid "" "Proxy fetching: a single-valued association is fetched " @@ -157,6 +170,7 @@ msgstr "" "sobre el objeto asociado." #. Tag: para +#: performance.xml:107 #, no-c-format msgid "" "\"No-proxy\" fetching: a single-valued association is " @@ -175,6 +189,7 @@ msgstr "" "y se necesita muy raramente." #. Tag: para +#: performance.xml:117 #, no-c-format msgid "" "Lazy attribute fetching: an attribute or single valued " @@ -187,6 +202,7 @@ msgstr "" "estimado de construcción y se necesita muy raramente." #. Tag: para +#: performance.xml:124 #, no-c-format msgid "" "We have two orthogonal notions here: when is the " @@ -204,11 +220,13 @@ msgstr "" "separada de una clase en particular." #. Tag: title +#: performance.xml:132 #, no-c-format msgid "Working with lazy associations" msgstr "Trabajo con asociaciones perezosas" #. Tag: para +#: performance.xml:134 #, no-c-format msgid "" "By default, Hibernate3 uses lazy select fetching for collections and lazy " @@ -221,6 +239,7 @@ msgstr "" "las asociaciones en la mayoría de las aplicaciones." #. Tag: para +#: performance.xml:138 #, no-c-format msgid "" "If you set hibernate.default_batch_fetch_size, Hibernate " @@ -233,6 +252,7 @@ msgstr "" "nivel más detallado." #. Tag: para +#: performance.xml:142 #, no-c-format msgid "" "Please be aware that access to a lazy association outside of the context of " @@ -241,7 +261,25 @@ msgstr "" "Note que el acceder a una asociación perezosa fuera del contexto de una " "sesión de Hibernate abierta resultará en una excepción. Por ejemplo:" +#. Tag: programlisting +#: performance.xml:146 +#, no-c-format +msgid "" +"s = sessions.openSession();\n" +"Transaction tx = s.beginTransaction();\n" +" \n" +"User u = (User) s.createQuery(\"from User u where u.name=:userName\")\n" +" .setString(\"userName\", userName).uniqueResult();\n" +"Map permissions = u.getPermissions();\n" +"\n" +"tx.commit();\n" +"s.close();\n" +"\n" +"Integer accessLevel = (Integer) permissions.get(\"accounts\"); // Error!" +msgstr "" + #. Tag: para +#: performance.xml:148 #, no-c-format msgid "" "Since the permissions collection was not initialized when the " @@ -257,6 +295,7 @@ msgstr "" "a justo antes de que se guarde la transacción." #. Tag: para +#: performance.xml:155 #, no-c-format msgid "" "Alternatively, you can use a non-lazy collection or association, by " @@ -274,6 +313,7 @@ msgstr "" "base de datos entera en toda transacción." #. Tag: para +#: performance.xml:162 #, no-c-format msgid "" "On the other hand, you can use join fetching, which is non-lazy by nature, " @@ -290,11 +330,13 @@ msgstr "" "colecciones." #. Tag: title +#: performance.xml:170 #, no-c-format msgid "Tuning fetch strategies" msgstr "Afinación de las estrategias de recuperación" #. Tag: para +#: performance.xml:172 #, no-c-format msgid "" "Select fetching (the default) is extremely vulnerable to N+1 selects " @@ -304,7 +346,25 @@ msgstr "" "vulnerable a problemas de selección N+1, de modo que puede que queramos " "habilitar la recuperación por unión (join fetching) en el documento de mapeo:" +#. Tag: programlisting +#: performance.xml:176 +#, no-c-format +msgid "" +"<set name=\"permissions\"\n" +" fetch=\"join\">\n" +" <key column=\"userId\"/>\n" +" <one-to-many class=\"Permission\"/>\n" +"</set" +msgstr "" + +#. Tag: programlisting +#: performance.xml:178 +#, no-c-format +msgid "<many-to-one name=\"mother\" class=\"Cat\" fetch=\"join\"/>" +msgstr "" + #. Tag: para +#: performance.xml:180 #, no-c-format msgid "" "The fetch strategy defined in the mapping document " @@ -314,6 +374,7 @@ msgstr "" "mapeo afecta a:" #. Tag: para +#: performance.xml:185 #, no-c-format msgid "retrieval via get() or load()" msgstr "" @@ -321,6 +382,7 @@ msgstr "" "literal>" #. Tag: para +#: performance.xml:190 #, no-c-format msgid "retrieval that happens implicitly when an association is navigated" msgstr "" @@ -328,17 +390,20 @@ msgstr "" "asociación (recuperación perezosa)" #. Tag: para +#: performance.xml:195 #, no-c-format msgid "Criteria queries" msgstr "las consultas de Criteria" #. Tag: para +#: performance.xml:199 #, no-c-format msgid "HQL queries if subselect fetching is used" msgstr "" "las consultas HQL si se utiliza la recuperación subselect" #. Tag: para +#: performance.xml:204 #, no-c-format msgid "" "Irrespective of the fetching strategy you use, the defined non-lazy graph is " @@ -351,6 +416,7 @@ msgstr "" "una consulta HQL en particular." #. Tag: para +#: performance.xml:209 #, no-c-format msgid "" "Usually, the mapping document is not used to customize fetching. Instead, we " @@ -369,6 +435,7 @@ msgstr "" "setFetchMode(FetchMode.JOIN)." #. Tag: para +#: performance.xml:216 #, no-c-format msgid "" "If you want to change the fetching strategy used by get() " @@ -379,7 +446,18 @@ msgstr "" " o load(); utilice una consulta " "Criteria. Por ejemplo:" +#. Tag: programlisting +#: performance.xml:220 +#, no-c-format +msgid "" +"User user = (User) session.createCriteria(User.class)\n" +" .setFetchMode(\"permissions\", FetchMode.JOIN)\n" +" .add( Restrictions.idEq(userId) )\n" +" .uniqueResult();" +msgstr "" + #. Tag: para +#: performance.xml:222 #, no-c-format msgid "" "This is Hibernate's equivalent of what some ORM solutions call a \"fetch plan" @@ -389,6 +467,7 @@ msgstr "" "un \"plan de recuperación\"." #. Tag: para +#: performance.xml:225 #, no-c-format msgid "" "A completely different approach to problems with N+1 selects is to use the " @@ -398,11 +477,13 @@ msgstr "" "es usar el caché de segundo nivel." #. Tag: title +#: performance.xml:230 #, no-c-format msgid "Single-ended association proxies" msgstr "Proxies de asociaciones de un sólo extremo" #. Tag: para +#: performance.xml:232 #, no-c-format msgid "" "Lazy fetching for collections is implemented using Hibernate's own " @@ -421,6 +502,7 @@ msgstr "" "ejecución por medio de la biblioteca CGLIB)." #. Tag: para +#: performance.xml:239 #, no-c-format msgid "" "At startup, Hibernate3 generates proxies by default for all persistent " @@ -432,6 +514,7 @@ msgstr "" "asociaciones muchos-a-uno y uno-a-uno." #. Tag: para +#: performance.xml:244 #, no-c-format msgid "" "The mapping file may declare an interface to use as the proxy interface for " @@ -448,6 +531,7 @@ msgstr "" "persistentes." #. Tag: para +#: performance.xml:251 #, no-c-format msgid "" "There are potential problems to note when extending this approach to " @@ -456,7 +540,20 @@ msgstr "" "Hay problemas potenciales que se deben tener en cuenta al extender este " "enfoque a las clases polimórficas. Por ejemplo:" +#. Tag: programlisting +#: performance.xml:254 +#, no-c-format +msgid "" +"<class name=\"Cat\" proxy=\"Cat\">\n" +" ......\n" +" <subclass name=\"DomesticCat\">\n" +" .....\n" +" </subclass>\n" +"</class>" +msgstr "" + #. Tag: para +#: performance.xml:256 #, no-c-format msgid "" "Firstly, instances of Cat will never be castable to " @@ -467,12 +564,39 @@ msgstr "" "cast a DomesticCat, incluso aunque la instancia " "subyacente sea una instancia de DomesticCat:" +#. Tag: programlisting +#: performance.xml:260 +#, no-c-format +msgid "" +"Cat cat = (Cat) session.load(Cat.class, id); // instantiate a proxy (does " +"not hit the db)\n" +"if ( cat.isDomesticCat() ) { // hit the db to initialize " +"the proxy\n" +" DomesticCat dc = (DomesticCat) cat; // Error!\n" +" ....\n" +"}" +msgstr "" + #. Tag: para +#: performance.xml:262 #, no-c-format msgid "Secondly, it is possible to break proxy ==:" msgstr "Segundo, es posible romper el proxy ==:" +#. Tag: programlisting +#: performance.xml:265 +#, no-c-format +msgid "" +"Cat cat = (Cat) session.load(Cat.class, id); // instantiate a Cat " +"proxy\n" +"DomesticCat dc = \n" +" (DomesticCat) session.load(DomesticCat.class, id); // acquire new " +"DomesticCat proxy!\n" +"System.out.println(cat==dc); // false" +msgstr "" + #. Tag: para +#: performance.xml:267 #, no-c-format msgid "" "However, the situation is not quite as bad as it looks. Even though we now " @@ -483,7 +607,16 @@ msgstr "" "tenemos ahora dos referencias a objetos proxy diferentes, la instancia " "subyacente será aún el mismo objeto:" +#. Tag: programlisting +#: performance.xml:271 +#, no-c-format +msgid "" +"cat.setWeight(11.0); // hit the db to initialize the proxy\n" +"System.out.println( dc.getWeight() ); // 11.0" +msgstr "" + #. Tag: para +#: performance.xml:273 #, no-c-format msgid "" "Third, you cannot use a CGLIB proxy for a final class or " @@ -493,6 +626,7 @@ msgstr "" "literal> o una clase con algún método final." #. Tag: para +#: performance.xml:276 #, no-c-format msgid "" "Finally, if your persistent object acquires any resources upon instantiation " @@ -506,6 +640,7 @@ msgstr "" "proxy es una subclase real de la clase persistente. " #. Tag: para +#: performance.xml:281 #, no-c-format msgid "" "These problems are all due to fundamental limitations in Java's single " @@ -524,7 +659,20 @@ msgstr "" "literal> y DomesticCatImpl implementa la interfaz " "DomesticCat. Por ejemplo:" +#. Tag: programlisting +#: performance.xml:289 +#, no-c-format +msgid "" +"<class name=\"CatImpl\" proxy=\"Cat\">\n" +" ......\n" +" <subclass name=\"DomesticCatImpl\" proxy=\"DomesticCat\">\n" +" .....\n" +" </subclass>\n" +"</class>" +msgstr "" + #. Tag: para +#: performance.xml:291 #, no-c-format msgid "" "Then proxies for instances of Cat and " @@ -535,17 +683,30 @@ msgstr "" "DomesticCat pueden ser retornadas por load() o iterate()." +#. Tag: programlisting +#: performance.xml:295 +#, no-c-format +msgid "" +"Cat cat = (Cat) session.load(CatImpl.class, catid);\n" +"Iterator iter = session.createQuery(\"from CatImpl as cat where cat." +"name='fritz'\").iterate();\n" +"Cat fritz = (Cat) iter.next();" +msgstr "" + #. Tag: title +#: performance.xml:298 #, no-c-format msgid "Note" msgstr "Nota" #. Tag: para +#: performance.xml:300 #, no-c-format msgid "list() does not usually return proxies." msgstr "list() usualmente no retorna proxies." #. Tag: para +#: performance.xml:304 #, no-c-format msgid "" "Relationships are also lazily initialized. This means you must declare any " @@ -557,6 +718,7 @@ msgstr "" "CatImpl." #. Tag: para +#: performance.xml:308 #, no-c-format msgid "" "Certain operations do not require proxy initialization:" @@ -565,6 +727,7 @@ msgstr "" "proxies:" #. Tag: para +#: performance.xml:313 #, no-c-format msgid "" "equals(): if the persistent class does not override " @@ -574,6 +737,7 @@ msgstr "" "equals() " #. Tag: para +#: performance.xml:318 #, no-c-format msgid "" "hashCode(): if the persistent class does not override " @@ -583,11 +747,13 @@ msgstr "" "hashCode() " #. Tag: para +#: performance.xml:323 #, no-c-format msgid "The identifier getter method" msgstr "El método getter del identificador" #. Tag: para +#: performance.xml:327 #, no-c-format msgid "" "Hibernate will detect persistent classes that override equals() o hashCode()." #. Tag: para +#: performance.xml:330 #, no-c-format msgid "" "By choosing lazy=\"no-proxy\" instead of the default " @@ -611,11 +778,13 @@ msgstr "" "las operaciones resultarán en una inicialización de proxies inmediata." #. Tag: title +#: performance.xml:338 #, no-c-format msgid "Initializing collections and proxies" msgstr "Inicialización de colecciones y proxies" #. Tag: para +#: performance.xml:340 #, no-c-format msgid "" "A LazyInitializationException will be thrown by Hibernate " @@ -629,6 +798,7 @@ msgstr "" "colección o que tiene la referencia al proxy esté en el estado separado." #. Tag: para +#: performance.xml:346 #, no-c-format msgid "" "Sometimes a proxy or collection needs to be initialized before closing the " @@ -644,6 +814,7 @@ msgstr "" "del código y no es conveniente para el código genérico." #. Tag: para +#: performance.xml:353 #, no-c-format msgid "" "The static methods Hibernate.initialize() and " @@ -664,6 +835,7 @@ msgstr "" "colección de gatitos. " #. Tag: para +#: performance.xml:362 #, no-c-format msgid "" "Another option is to keep the Session open until all " @@ -683,6 +855,7 @@ msgstr "" "inicializa una colección. Existen dos formas básicas para abordar este tema: " #. Tag: para +#: performance.xml:372 #, no-c-format msgid "" "In a web-based application, a servlet filter can be used to close the " @@ -707,6 +880,7 @@ msgstr "" "ejemplos de este patrón \"Open Session in View\" (sesión abierta en vista). " #. Tag: para +#: performance.xml:385 #, no-c-format msgid "" "In an application with a separate business tier, the business logic must " @@ -736,6 +910,7 @@ msgstr "" "Sesión." #. Tag: para +#: performance.xml:401 #, no-c-format msgid "" "You can also attach a previously loaded object to a new SessioncreateFilter() method is also used to efficiently " @@ -781,12 +967,22 @@ msgstr "" "recuperar eficientemente subconjuntos de una colección sin necesidad de " "inicializar toda la colección:" +#. Tag: programlisting +#: performance.xml:423 +#, no-c-format +msgid "" +"s.createFilter( lazyCollection, \"\").setFirstResult(0).setMaxResults(10)." +"list();" +msgstr "" + #. Tag: title +#: performance.xml:427 #, no-c-format msgid "Using batch fetching" msgstr "Utilización de recuperación de lotes" #. Tag: para +#: performance.xml:429 #, no-c-format msgid "" "Using batch fetching, Hibernate can load several uninitialized proxies if " @@ -801,6 +997,7 @@ msgstr "" "clase y a nivel de colección." #. Tag: para +#: performance.xml:434 #, no-c-format msgid "" "Batch fetching for classes/entities is easier to understand. Consider the " @@ -826,7 +1023,14 @@ msgstr "" "especificando un batch-size en el mapeo de " "Person:" +#. Tag: programlisting +#: performance.xml:447 +#, no-c-format +msgid "<class name=\"Person\" batch-size=\"10\">...</class>" +msgstr "" + #. Tag: para +#: performance.xml:449 #, no-c-format msgid "" "Hibernate will now execute only three queries: the pattern is 10, 10, 5." @@ -834,6 +1038,7 @@ msgstr "" "Hibernate ahora ejecutará sólamente tres consultas: el patrón es 10, 10, 5." #. Tag: para +#: performance.xml:452 #, no-c-format msgid "" "You can also enable batch fetching of collections. For example, if each " @@ -853,7 +1058,19 @@ msgstr "" "cats en el mapeo de Person, Hibernate " "puede recuperar por adelantado las colecciones: " +#. Tag: programlisting +#: performance.xml:461 +#, no-c-format +msgid "" +"<class name=\"Person\">\n" +" <set name=\"cats\" batch-size=\"3\">\n" +" ...\n" +" </set>\n" +"</class>" +msgstr "" + #. Tag: para +#: performance.xml:463 #, no-c-format msgid "" "With a batch-size of 3, Hibernate will load 3, 3, 3, 1 " @@ -867,6 +1084,7 @@ msgstr "" "Session en particular." #. Tag: para +#: performance.xml:468 #, no-c-format msgid "" "Batch fetching of collections is particularly useful if you have a nested " @@ -881,11 +1099,13 @@ msgstr "" "árboles que sean de lectura en la mayoría de los casos." #. Tag: title +#: performance.xml:475 #, no-c-format msgid "Using subselect fetching" msgstr "Utilización de la recuperación por subselección" #. Tag: para +#: performance.xml:477 #, no-c-format msgid "" "If one lazy collection or single-valued proxy has to be fetched, Hibernate " @@ -898,19 +1118,21 @@ msgstr "" "lotes, sin carga fragmentaria. " #. Tag: title +#: performance.xml:486 #, no-c-format msgid "Fetch profiles" msgstr "Perfiles de recuperación" #. Tag: para -#, no-c-format +#: performance.xml:488 +#, fuzzy, no-c-format msgid "" "Another way to affect the fetching strategy for loading associated objects " "is through something called a fetch profile, which is a named configuration " "associated with the org.hibernate.SessionFactory but enabled, by name, on the org.hibernate." "Session. Once enabled on a org.hibernate." -"Session, the fetch profile wull be in affect for that " +"Session, the fetch profile will be in affect for that " "org.hibernate.Session until it is explicitly " "disabled." msgstr "" @@ -924,16 +1146,109 @@ msgstr "" "interfacename> hasta que se deshabilite explícitamente." #. Tag: para -#, no-c-format +#: performance.xml:498 +#, fuzzy, no-c-format msgid "" -"So what does that mean? Well lets explain that by way of an example. Say we " -"have the following mappings:" +"So what does that mean? Well lets explain that by way of an example which " +"show the different available approaches to configure a fetch profile:" msgstr "" "¿Entonces qué significa? Vamos a explicarlo por medio de un ejemplo. Digamos " "que tenemos los siguientes mapeos:" -#. Tag: para +#. Tag: title +#: performance.xml:503 #, no-c-format +msgid "Specifying a fetch profile using @FetchProfile" +msgstr "" + +#. Tag: programlisting +#: performance.xml:506 +#, no-c-format +msgid "" +"@Entity\n" +"@FetchProfile(name = \"customer-with-orders\", fetchOverrides = {\n" +" @FetchProfile.FetchOverride(entity = Customer.class, association = " +"\"orders\", mode = FetchMode.JOIN)\n" +"})\n" +"public class Customer {\n" +" @Id\n" +" @GeneratedValue\n" +" private long id;\n" +"\n" +" private String name;\n" +"\n" +" private long customerNumber;\n" +"\n" +" @OneToMany\n" +" private Set<Order> orders;\n" +"\n" +" // standard getter/setter\n" +" ...\n" +"}" +msgstr "" + +#. Tag: title +#: performance.xml:510 +#, no-c-format +msgid "" +"Specifying a fetch profile using <fetch-profile> " +"outside <class> node" +msgstr "" + +#. Tag: programlisting +#: performance.xml:514 +#, no-c-format +msgid "" +"<hibernate-mapping>\n" +" <class name=\"Customer\">\n" +" ...\n" +" <set name=\"orders\" inverse=\"true\">\n" +" <key column=\"cust_id\"/>\n" +" <one-to-many class=\"Order\"/>\n" +" </set>\n" +" </class>\n" +" <class name=\"Order\">\n" +" ...\n" +" </class>\n" +" <fetch-profile name=\"customer-with-orders\">\n" +" <fetch entity=\"Customer\" association=\"orders\" style=\"join\"/" +">\n" +" </fetch-profile>\n" +"</hibernate-mapping>" +msgstr "" + +#. Tag: title +#: performance.xml:518 +#, no-c-format +msgid "" +"Specifying a fetch profile using <fetch-profile> " +"inside <class> node" +msgstr "" + +#. Tag: programlisting +#: performance.xml:522 +#, no-c-format +msgid "" +"<hibernate-mapping>\n" +" <class name=\"Customer\">\n" +" ...\n" +" <set name=\"orders\" inverse=\"true\">\n" +" <key column=\"cust_id\"/>\n" +" <one-to-many class=\"Order\"/>\n" +" </set>\n" +" <fetch-profile name=\"customer-with-orders\">\n" +" <fetch association=\"orders\" style=\"join\"/>\n" +" </fetch-profile>\n" +" </class>\n" +" <class name=\"Order\">\n" +" ...\n" +" </class>\n" +"</hibernate-mapping>" +msgstr "" + +#. Tag: para +#: performance.xml:525 +#, fuzzy, no-c-format msgid "" "Now normally when you get a reference to a particular customer, that " "customer's set of orders will be lazy meaning we will not yet have loaded " @@ -941,8 +1256,8 @@ msgid "" "that you have a certain use case where it is more efficient to load the " "customer and their orders together. One way certainly is to use \"dynamic " "fetching\" strategies via an HQL or criteria queries. But another option is " -"to use a fetch profile to achieve that. Just add the following to your " -"mapping:" +"to use a fetch profile to achieve that. The following code will load both " +"the customer andtheir orders:" msgstr "" "Ahora normalmente cuando reciba una referencia a un cliente en particular, " "el grupo de pedidos será perezoso lo que significa que aún no habremos " @@ -953,21 +1268,35 @@ msgstr "" "otra opción es utilizar un perfi de recuperación para lograr esto. " "Simplemente agregue lo siguiente a su mapeo:" -#. Tag: para +#. Tag: title +#: performance.xml:536 #, no-c-format -msgid "or even:" -msgstr "o incluso:" +msgid "Activating a fetch profile for a given Session" +msgstr "" -#. Tag: para +#. Tag: programlisting +#: performance.xml:539 #, no-c-format msgid "" -"Now the following code will actually load both the customer and " -"their orders:" +"Session session = ...;\n" +"session.enableFetchProfile( \"customer-with-orders\" ); // name matches " +"from mapping\n" +"Customer customer = (Customer) session.get( Customer.class, customerId );" msgstr "" -"Ahora el siguiente código de hecho cargará el cliente y sus " -"órdenes:" #. Tag: para +#: performance.xml:543 +#, no-c-format +msgid "" +"@FetchProfile definitions are global and it does not " +"matter on which class you place them. You can place the " +"@FetchProfile annotation either onto a class or " +"package (package-info.java). In order to define multiple fetch profiles for " +"the same class or package @FetchProfiles can be used." +msgstr "" + +#. Tag: para +#: performance.xml:551 #, no-c-format msgid "" "Currently only join style fetch profiles are supported, but they plan is to " @@ -980,11 +1309,13 @@ msgstr "" "ulink> para obtener mayores detalles." #. Tag: title +#: performance.xml:558 #, no-c-format msgid "Using lazy property fetching" msgstr "Utilización de la recuperación perezosa de propiedades" #. Tag: para +#: performance.xml:560 #, no-c-format msgid "" "Hibernate3 supports the lazy fetching of individual properties. This " @@ -1005,6 +1336,7 @@ msgstr "" "cientos de columnas y el modelo de datos no puede ser mejorado." #. Tag: para +#: performance.xml:568 #, no-c-format msgid "" "To enable lazy property loading, set the lazy attribute " @@ -1013,7 +1345,24 @@ msgstr "" "Para habilitar la carga perezosa de propiedades, establezca el atributo " "lazy en sus mapeos de propiedades:" +#. Tag: programlisting +#: performance.xml:571 +#, no-c-format +msgid "" +"<class name=\"Document\">\n" +" <id name=\"id\">\n" +" <generator class=\"native\"/>\n" +" </id>\n" +" <property name=\"name\" not-null=\"true\" length=\"50\"/>\n" +" <property name=\"summary\" not-null=\"true\" length=\"200\" lazy=" +"\"true\"/>\n" +" <property name=\"text\" not-null=\"true\" length=\"2000\" lazy=\"true" +"\"/>\n" +"</class>" +msgstr "" + #. Tag: para +#: performance.xml:573 #, no-c-format msgid "" "Lazy property loading requires buildtime bytecode instrumentation. If your " @@ -1026,12 +1375,35 @@ msgstr "" "recuperación inmediata." #. Tag: para +#: performance.xml:577 #, no-c-format msgid "For bytecode instrumentation, use the following Ant task:" msgstr "" "Para la instrumentación del código byte, utilice la siguiente tarea Ant:" +#. Tag: programlisting +#: performance.xml:579 +#, no-c-format +msgid "" +"<target name=\"instrument\" depends=\"compile\">\n" +" <taskdef name=\"instrument\" classname=\"org.hibernate.tool." +"instrument.InstrumentTask\">\n" +" <classpath path=\"${jar.path}\"/>\n" +" <classpath path=\"${classes.dir}\"/>\n" +" <classpath refid=\"lib.class.path\"/>\n" +" </taskdef>\n" +"\n" +" <instrument verbose=\"true\">\n" +" <fileset dir=\"${testclasses.dir}/org/hibernate/auction/model" +"\">\n" +" <include name=\"*.class\"/>\n" +" </fileset>\n" +" </instrument>\n" +"</target>" +msgstr "" + #. Tag: para +#: performance.xml:581 #, no-c-format msgid "" "A different way of avoiding unnecessary column reads, at least for read-only " @@ -1046,6 +1418,7 @@ msgstr "" "preferida." #. Tag: para +#: performance.xml:586 #, no-c-format msgid "" "You can force the usual eager fetching of properties using fetch " @@ -1055,11 +1428,13 @@ msgstr "" "fetch all properties en HQL." #. Tag: title +#: performance.xml:592 #, no-c-format msgid "The Second Level Cache" msgstr "El Caché de Segundo Nivel" #. Tag: para +#: performance.xml:594 #, no-c-format msgid "" "A Hibernate Session is a transaction-level cache of " @@ -1080,15 +1455,17 @@ msgstr "" "expiren regularmente." #. Tag: para -#, no-c-format +#: performance.xml:602 +#, fuzzy, no-c-format msgid "" "You have the option to tell Hibernate which caching implementation to use by " "specifying the name of a class that implements org.hibernate.cache." "CacheProvider using the property hibernate.cache." "provider_class. Hibernate is bundled with a number of built-in " -"integrations with the open-source cache providers that are listed below. You " -"can also implement your own and plug it in as outlined above. Note that " -"versions prior to 3.2 use EhCache as the default cache provider." +"integrations with the open-source cache providers that are listed in . You can also implement your own and plug it in " +"as outlined above. Note that versions prior to Hibernate 3.2 use EhCache as " +"the default cache provider." msgstr "" "Tiene la opción de decirle a Hibernate cual implementación de caché utilizar " "al especificar el nombre de una clase que implemente org.hibernate." @@ -1100,155 +1477,396 @@ msgstr "" "por defecto utilizan EhCache como proveedor de caché." #. Tag: title +#: performance.xml:613 #, no-c-format msgid "Cache Providers" msgstr "Proveedores de Caché" #. Tag: entry +#: performance.xml:628 performance.xml:976 #, no-c-format msgid "Cache" msgstr "Caché" #. Tag: entry +#: performance.xml:630 #, no-c-format msgid "Provider class" msgstr "Clase del Provedor" #. Tag: entry +#: performance.xml:632 #, no-c-format msgid "Type" msgstr "Tipo" #. Tag: entry +#: performance.xml:634 #, no-c-format msgid "Cluster Safe" msgstr "Clúster Seguro" #. Tag: entry +#: performance.xml:636 #, no-c-format msgid "Query Cache Supported" msgstr "Caché de Consultas Soportado" #. Tag: entry +#: performance.xml:642 performance.xml:990 #, no-c-format msgid "Hashtable (not intended for production use)" msgstr "Hashtable (no fue pensado para la utilización en producción)" -#. Tag: entry -#, no-c-format -msgid "org.hibernate.cache.HashtableCacheProvider" +#. Tag: literal +#: performance.xml:644 +#, fuzzy, no-c-format +msgid "org.hibernate.cache.HashtableCacheProvider" msgstr "org.hibernate.cache.HashtableCacheProvider" #. Tag: entry +#: performance.xml:646 #, no-c-format msgid "memory" msgstr "memoria" #. Tag: entry +#: performance.xml:650 performance.xml:662 performance.xml:674 +#: performance.xml:992 performance.xml:994 performance.xml:996 +#: performance.xml:1004 performance.xml:1006 performance.xml:1008 +#: performance.xml:1016 performance.xml:1018 performance.xml:1020 +#: performance.xml:1028 performance.xml:1030 performance.xml:1040 +#: performance.xml:1046 performance.xml:1052 performance.xml:1058 #, no-c-format -msgid "yes" -msgstr "si" +msgid "yes" +msgstr "" #. Tag: entry +#: performance.xml:654 performance.xml:1002 #, no-c-format msgid "EHCache" msgstr "EHCache" -#. Tag: entry -#, no-c-format -msgid "org.hibernate.cache.EhCacheProvider" +#. Tag: literal +#: performance.xml:656 +#, fuzzy, no-c-format +msgid "org.hibernate.cache.EhCacheProvider" msgstr "org.hibernate.cache.EhCacheProvider" #. Tag: entry +#: performance.xml:658 performance.xml:670 #, no-c-format msgid "memory, disk" msgstr "memoria, disco" #. Tag: entry +#: performance.xml:666 performance.xml:1014 #, no-c-format msgid "OSCache" msgstr "OSCache" -#. Tag: entry -#, no-c-format -msgid "org.hibernate.cache.OSCacheProvider" +#. Tag: literal +#: performance.xml:668 +#, fuzzy, no-c-format +msgid "org.hibernate.cache.OSCacheProvider" msgstr "org.hibernate.cache.OSCacheProvider" #. Tag: entry +#: performance.xml:678 performance.xml:1026 #, no-c-format msgid "SwarmCache" msgstr "SwarmCache" -#. Tag: entry -#, no-c-format -msgid "org.hibernate.cache.SwarmCacheProvider" +#. Tag: literal +#: performance.xml:680 +#, fuzzy, no-c-format +msgid "org.hibernate.cache.SwarmCacheProvider" msgstr "org.hibernate.cache.SwarmCacheProvider" #. Tag: entry +#: performance.xml:682 #, no-c-format msgid "clustered (ip multicast)" msgstr "en clúster (ip multicast)" #. Tag: entry +#: performance.xml:684 #, no-c-format msgid "yes (clustered invalidation)" msgstr "sí (invalidación en clúster)" #. Tag: entry +#: performance.xml:690 performance.xml:1038 #, no-c-format msgid "JBoss Cache 1.x" msgstr "JBoss Cache 1.x" -#. Tag: entry -#, no-c-format -msgid "org.hibernate.cache.TreeCacheProvider" +#. Tag: literal +#: performance.xml:692 +#, fuzzy, no-c-format +msgid "org.hibernate.cache.TreeCacheProvider" msgstr "org.hibernate.cache.TreeCacheProvider" #. Tag: entry +#: performance.xml:694 performance.xml:706 #, no-c-format msgid "clustered (ip multicast), transactional" msgstr "en clúster (ip multicast), transaccional" #. Tag: entry +#: performance.xml:696 #, no-c-format msgid "yes (replication)" msgstr "sí (replicación)" #. Tag: entry +#: performance.xml:698 performance.xml:710 #, no-c-format msgid "yes (clock sync req.)" msgstr "sí (requiere sincronización de reloj)" #. Tag: entry +#: performance.xml:702 performance.xml:1050 #, no-c-format msgid "JBoss Cache 2" msgstr "JBoss Cache 2" -#. Tag: entry -#, no-c-format -msgid "org.hibernate.cache.jbc.JBossCacheRegionFactory" +#. Tag: literal +#: performance.xml:704 +#, fuzzy, no-c-format +msgid "org.hibernate.cache.jbc.JBossCacheRegionFactory" msgstr "org.hibernate.cache.jbc.JBossCacheRegionFactory" #. Tag: entry +#: performance.xml:708 #, no-c-format msgid "yes (replication or invalidation)" msgstr "sí (replicación o invalidación)" #. Tag: title +#: performance.xml:717 #, no-c-format msgid "Cache mappings" msgstr "Mapeos de caché" #. Tag: para +#: performance.xml:719 #, no-c-format msgid "" -"The <cache> element of a class or collection " -"mapping has the following form:" +"As we have done in previous chapters we are looking at the two different " +"possibiltites to configure caching. First configuration via annotations and " +"then via Hibernate mapping files." msgstr "" -"El elemento <cache> de un mapeo de clase o " -"colección tiene la siguiente forma:" #. Tag: para +#: performance.xml:723 +#, no-c-format +msgid "" +"By default, entities are not part of the second level cache and we recommend " +"you to stick to this setting. However, you can override this by setting the " +"shared-cache-mode element in your persistence." +"xml file or by using the javax.persistence.sharedCache." +"mode property in your configuration. The following values are " +"possible:" +msgstr "" + +#. Tag: para +#: performance.xml:732 +#, no-c-format +msgid "" +"ENABLE_SELECTIVE (Default and recommended value): " +"entities are not cached unless explicitly marked as cacheable." +msgstr "" + +#. Tag: para +#: performance.xml:738 +#, no-c-format +msgid "" +"DISABLE_SELECTIVE: entities are cached unless explicitly " +"marked as not cacheable." +msgstr "" + +#. Tag: para +#: performance.xml:743 +#, no-c-format +msgid "" +"ALL: all entities are always cached even if marked as non " +"cacheable." +msgstr "" + +#. Tag: para +#: performance.xml:748 +#, no-c-format +msgid "" +"NONE: no entity are cached even if marked as cacheable. " +"This option can make sense to disable second-level cache altogether." +msgstr "" + +#. Tag: para +#: performance.xml:754 +#, no-c-format +msgid "" +"The cache concurrency strategy used by default can be set globaly via the " +"hibernate.cache.default_cache_concurrency_strategy " +"configuration property. The values for this property are:" +msgstr "" + +#. Tag: literal +#: performance.xml:761 +#, fuzzy, no-c-format +msgid "read-only" +msgstr "las consultas de Criteria" + +#. Tag: literal +#: performance.xml:765 +#, fuzzy, no-c-format +msgid "read-write" +msgstr "las consultas de Criteria" + +#. Tag: literal +#: performance.xml:769 +#, fuzzy, no-c-format +msgid "nonstrict-read-write" +msgstr "nonstrict-read-write" + +#. Tag: literal +#: performance.xml:773 +#, fuzzy, no-c-format +msgid "transactional" +msgstr "las consultas de Criteria" + +#. Tag: para +#: performance.xml:778 +#, no-c-format +msgid "" +"It is recommended to define the cache concurrency strategy per entity rather " +"than using a global one. Use the @org.hibernate.annotations." +"Cache annotation for that." +msgstr "" + +#. Tag: title +#: performance.xml:785 +#, no-c-format +msgid "" +"Definition of cache concurrency strategy via @Cache" +msgstr "" + +#. Tag: programlisting +#: performance.xml:788 +#, no-c-format +msgid "" +"@Entity \n" +"@Cacheable\n" +"@Cache(usage = CacheConcurrencyStrategy.NONSTRICT_READ_WRITE)\n" +"public class Forest { ... }" +msgstr "" + +#. Tag: para +#: performance.xml:791 +#, no-c-format +msgid "" +"Hibernate also let's you cache the content of a collection or the " +"identifiers if the collection contains other entities. Use the " +"@Cache annotation on the collection property." +msgstr "" + +#. Tag: title +#: performance.xml:797 +#, fuzzy, no-c-format +msgid "Caching collections using annotations" +msgstr "Inicialización de colecciones y proxies" + +#. Tag: programlisting +#: performance.xml:799 +#, no-c-format +msgid "" +"@OneToMany(cascade=CascadeType.ALL, fetch=FetchType.EAGER)\n" +"@JoinColumn(name=\"CUST_ID\")\n" +"@Cache(usage = CacheConcurrencyStrategy.NONSTRICT_READ_WRITE)\n" +"public SortedSet<Ticket> getTickets() {\n" +" return tickets;\n" +"}" +msgstr "" + +#. Tag: para +#: performance.xml:802 +#, no-c-format +msgid "" +"shows the @org.hibernate.annotations.Cache annotations " +"with its attributes. It allows you to define the caching strategy and region " +"of a given second level cache." +msgstr "" + +#. Tag: title +#: performance.xml:808 +#, no-c-format +msgid "@Cache annotation with attributes" +msgstr "" + +#. Tag: programlisting +#: performance.xml:820 +#, no-c-format +msgid "" +"@Cache(\n" +" CacheConcurrencyStrategy usage();\n" +" String region() default \"\";\n" +" String include() default \"all\";\n" +")" +msgstr "" + +#. Tag: para +#: performance.xml:824 +#, no-c-format +msgid "" +"usage: the given cache concurrency strategy (NONE, READ_ONLY, " +"NONSTRICT_READ_WRITE, READ_WRITE, TRANSACTIONAL)" +msgstr "" + +#. Tag: para +#: performance.xml:830 +#, no-c-format +msgid "" +"region (optional): the cache region (default to the fqcn of the class or the " +"fq role name of the collection)" +msgstr "" + +#. Tag: para +#: performance.xml:835 +#, no-c-format +msgid "" +"include (optional): all to include all properties, non-" +"lazy to only include non lazy properties (default all)." +msgstr "" + +#. Tag: para +#: performance.xml:843 +#, no-c-format +msgid "" +"Let's now take a look at Hibernate mapping files. There the <" +"cache> element of a class or collection mapping is used to " +"configure the second level cache. Looking at the parallels to anotations is obvious." +msgstr "" + +#. Tag: title +#: performance.xml:850 +#, no-c-format +msgid "The Hibernate <cache> mapping element" +msgstr "" + +#. Tag: programlisting +#: performance.xml:862 +#, no-c-format +msgid "" +"<cache\n" +" usage=\"transactional|read-write|nonstrict-read-write|read-only\"\n" +" region=\"RegionName\"\n" +" include=\"all|non-lazy\"\n" +"/>" +msgstr "" + +#. Tag: para +#: performance.xml:866 #, no-c-format msgid "" "usage (required) specifies the caching strategy: " @@ -1260,6 +1878,7 @@ msgstr "" "nonstrict-read-write o read-only" #. Tag: para +#: performance.xml:874 #, no-c-format msgid "" "region (optional: defaults to the class or collection " @@ -1270,6 +1889,7 @@ msgstr "" "nivel." #. Tag: para +#: performance.xml:880 #, no-c-format msgid "" "include (optional: defaults to all) " @@ -1283,31 +1903,31 @@ msgstr "" "cuando se habilita la recuperación perezoza a nivel de atributos." #. Tag: para -#, no-c-format +#: performance.xml:890 +#, fuzzy, no-c-format msgid "" -"Alternatively, you can specify <class-cache> and " -"<collection-cache> elements in hibernate." -"cfg.xml." +"Alternatively to <cache>, you can use <" +"class-cache> and <collection-cache> " +"elements in hibernate.cfg.xml." msgstr "" "Opcionalmente, puede especificar los elementos <class-cache> y <collection-cache> en hibernate." "cfg.xml." #. Tag: para +#: performance.xml:895 #, no-c-format -msgid "" -"The usage attribute specifies a cache " -"concurrency strategy." +msgid "Let's now have a closer look at the different usage strategies" msgstr "" -"El atributo usage especifica una estrategia de " -"concurrencia al caché." #. Tag: title +#: performance.xml:900 #, no-c-format msgid "Strategy: read only" msgstr "Estrategia: sólo lectura" #. Tag: para +#: performance.xml:902 #, no-c-format msgid "" "If your application needs to read, but not modify, instances of a persistent " @@ -1321,11 +1941,13 @@ msgstr "" "segura para utilizar en un clúster." #. Tag: title +#: performance.xml:909 #, no-c-format msgid "Strategy: read/write" msgstr "Estrategia: lectura/escritura (read/write)" #. Tag: para +#: performance.xml:911 #, no-c-format msgid "" "If the application needs to update data, a read-write " @@ -1354,11 +1976,13 @@ msgstr "" "soportan bloqueos." #. Tag: title +#: performance.xml:927 #, no-c-format msgid "Strategy: nonstrict read/write" msgstr "Estrategia: lectura/escritura no estricta" #. Tag: para +#: performance.xml:929 #, no-c-format msgid "" "If the application only occasionally needs to update data (i.e. if it is " @@ -1381,11 +2005,13 @@ msgstr "" "literal>." #. Tag: title +#: performance.xml:941 #, no-c-format msgid "Strategy: transactional" msgstr "Estrategia: transaccional" #. Tag: para +#: performance.xml:943 #, no-c-format msgid "" "The transactional cache strategy provides support for " @@ -1399,11 +2025,13 @@ msgstr "" "hibernate.transaction.manager_lookup_class." #. Tag: title +#: performance.xml:950 #, no-c-format msgid "Cache-provider/concurrency-strategy compatibility" msgstr "Compatibilidad de proveedor de caché/estrategia de concurrencia" #. Tag: para +#: performance.xml:953 #, no-c-format msgid "" "None of the cache providers support all of the cache concurrency strategies." @@ -1412,6 +2040,7 @@ msgstr "" "concurrencia al caché. " #. Tag: para +#: performance.xml:957 #, no-c-format msgid "" "The following table shows which providers are compatible with which " @@ -1421,36 +2050,43 @@ msgstr "" "estrategias de concurrencia." #. Tag: title +#: performance.xml:961 #, no-c-format msgid "Cache Concurrency Strategy Support" msgstr "Soporte a Estrategia de Concurrencia a Caché" #. Tag: entry +#: performance.xml:978 #, no-c-format -msgid "read-only" -msgstr "read-only" +msgid "read-only" +msgstr "" #. Tag: entry -#, no-c-format -msgid "nonstrict-read-write" +#: performance.xml:980 +#, fuzzy, no-c-format +msgid "nonstrict-read-write" msgstr "nonstrict-read-write" #. Tag: entry +#: performance.xml:982 #, no-c-format -msgid "read-write" -msgstr "read-write" +msgid "read-write" +msgstr "" #. Tag: entry -#, no-c-format -msgid "transactional" +#: performance.xml:984 +#, fuzzy, no-c-format +msgid "transactional" msgstr "transactional" #. Tag: title +#: performance.xml:1067 #, no-c-format msgid "Managing the caches" msgstr "Gestión de cachés" #. Tag: para +#: performance.xml:1069 #, no-c-format msgid "" "Whenever you pass an object to save(), update()." #. Tag: para +#: performance.xml:1076 #, no-c-format msgid "" "When flush() is subsequently called, the state of that " @@ -1484,7 +2121,29 @@ msgstr "" "() para quitar el objeto y sus colecciones del caché de primer " "nivel. " +#. Tag: title +#: performance.xml:1084 +#, no-c-format +msgid "" +"Explcitly evicting a cached instance from the first level cache using " +"Session.evict()" +msgstr "" + +#. Tag: programlisting +#: performance.xml:1087 +#, no-c-format +msgid "" +"ScrollableResult cats = sess.createQuery(\"from Cat as cat\").scroll(); //a " +"huge result set\n" +"while ( cats.next() ) {\n" +" Cat cat = (Cat) cats.get(0);\n" +" doSomethingWithACat(cat);\n" +" sess.evict(cat);\n" +"}" +msgstr "" + #. Tag: para +#: performance.xml:1090 #, no-c-format msgid "" "The Session also provides a contains() " @@ -1495,6 +2154,7 @@ msgstr "" "sesión." #. Tag: para +#: performance.xml:1094 #, no-c-format msgid "" "To evict all objects from the session cache, call Session.clear()Session.clear(). " #. Tag: para +#: performance.xml:1097 #, no-c-format msgid "" "For the second-level cache, there are methods defined on " @@ -1514,7 +2175,28 @@ msgstr "" "SessionFactory para explusar el estado en caché de una " "instancia, clase entera, instancia de colección o rol entero de colección." +#. Tag: title +#: performance.xml:1103 +#, no-c-format +msgid "" +"Second-level cache eviction via SessionFactoty.evict() and SessionFacyory.evictCollection()" +msgstr "" + +#. Tag: programlisting +#: performance.xml:1107 +#, no-c-format +msgid "" +"sessionFactory.evict(Cat.class, catId); //evict a particular Cat\n" +"sessionFactory.evict(Cat.class); //evict all Cats\n" +"sessionFactory.evictCollection(\"Cat.kittens\", catId); //evict a particular " +"collection of kittens\n" +"sessionFactory.evictCollection(\"Cat.kittens\"); //evict all kitten " +"collections" +msgstr "" + #. Tag: para +#: performance.xml:1110 #, no-c-format msgid "" "The CacheMode controls how a particular session interacts " @@ -1524,6 +2206,7 @@ msgstr "" "sesión en particular con el caché de segundo nivel:" #. Tag: para +#: performance.xml:1115 #, no-c-format msgid "" "CacheMode.NORMAL: will read items from and write items to " @@ -1533,6 +2216,7 @@ msgstr "" "el caché del segundo nivel" #. Tag: para +#: performance.xml:1120 #, no-c-format msgid "" "CacheMode.GET: will read items from the second-level " @@ -1542,6 +2226,7 @@ msgstr "" "escribe al caché de segundo nivel excepto cuando actualiza datos" #. Tag: para +#: performance.xml:1126 #, no-c-format msgid "" "CacheMode.PUT: will write items to the second-level " @@ -1551,6 +2236,7 @@ msgstr "" "No lee del caché de segundo nivel" #. Tag: para +#: performance.xml:1131 #, no-c-format msgid "" "CacheMode.REFRESH: will write items to the second-level " @@ -1565,6 +2251,7 @@ msgstr "" "base de datos" #. Tag: para +#: performance.xml:1139 #, no-c-format msgid "" "To browse the contents of a second-level or query cache region, use the " @@ -1573,7 +2260,27 @@ msgstr "" "Para navegar por los contenidos de una región de caché de segundo nivel o de " "consultas, use la API de Statistics:" +#. Tag: title +#: performance.xml:1143 +#, fuzzy, no-c-format +msgid "" +"Browsing the second-level cache entries via the Statistics API" +msgstr "" +"Para navegar por los contenidos de una región de caché de segundo nivel o de " +"consultas, use la API de Statistics:" + +#. Tag: programlisting +#: performance.xml:1146 +#, no-c-format +msgid "" +"Map cacheEntries = sessionFactory.getStatistics()\n" +" .getSecondLevelCacheStatistics(regionName)\n" +" .getEntries();" +msgstr "" + #. Tag: para +#: performance.xml:1149 #, no-c-format msgid "" "You will need to enable statistics and, optionally, force Hibernate to keep " @@ -1584,11 +2291,27 @@ msgstr "" "para humanos: " #. Tag: title +#: performance.xml:1153 +#, no-c-format +msgid "Enabling Hibernate statistics" +msgstr "" + +#. Tag: programlisting +#: performance.xml:1155 +#, no-c-format +msgid "" +"hibernate.generate_statistics true\n" +"hibernate.cache.use_structured_entries true" +msgstr "" + +#. Tag: title +#: performance.xml:1160 #, no-c-format msgid "The Query Cache" msgstr "El Caché de Consultas" #. Tag: para +#: performance.xml:1162 #, no-c-format msgid "" "Query result sets can also be cached. This is only useful for queries that " @@ -1599,11 +2322,13 @@ msgstr "" "mismos parámetros." #. Tag: title +#: performance.xml:1166 #, no-c-format msgid "Enabling query caching" msgstr "Habilitación del caché de peticiones" #. Tag: para +#: performance.xml:1168 #, no-c-format msgid "" "Caching of query results introduces some overhead in terms of your " @@ -1625,12 +2350,20 @@ msgstr "" "el caché de los resultados de una petición por defecto. Para utilizar el " "caché de peticiones primero necesita habilitar el caché de peticiones:" +#. Tag: programlisting +#: performance.xml:1177 +#, no-c-format +msgid "hibernate.cache.use_query_cache true" +msgstr "" + #. Tag: para +#: performance.xml:1179 #, no-c-format msgid "This setting creates two new cache regions:" msgstr "Esta configuración crea dos nuevas regiones de caché:" #. Tag: para +#: performance.xml:1181 #, no-c-format msgid "" "org.hibernate.cache.StandardQueryCache, holding the " @@ -1640,6 +2373,7 @@ msgstr "" "resultados de la petición en caché" #. Tag: para +#: performance.xml:1186 #, no-c-format msgid "" "org.hibernate.cache.UpdateTimestampsCache, holding " @@ -1652,10 +2386,11 @@ msgstr "" "desde el caché de peticiones." #. Tag: para +#: performance.xml:1194 #, fuzzy, no-c-format msgid "" "If you configure your underlying cache implementation to use expiry or " -"timeouts is is very important that the cache timeout of the underlying cache " +"timeouts is very important that the cache timeout of the underlying cache " "region for the UpdateTimestampsCache be set to a higher value than the " "timeouts of any of the query caches. In fact, we recommend that the the " "UpdateTimestampsCache region not be configured for expiry at all. Note, in " @@ -1670,6 +2405,7 @@ msgstr "" "apropiado una política de expiración de caché LRU. " #. Tag: para +#: performance.xml:1203 #, no-c-format msgid "" "As mentioned above, most queries do not benefit from caching or their " @@ -1688,6 +2424,7 @@ msgstr "" "existentes en caché o que agregue sus resultados al caché cuando se ejecuta." #. Tag: para +#: performance.xml:1211 #, no-c-format msgid "" "The query cache does not cache the state of the actual entities in the " @@ -1704,11 +2441,13 @@ msgstr "" "petición (así como con el caché de colección). " #. Tag: title +#: performance.xml:1221 #, no-c-format msgid "Query cache regions" msgstr "Regiones de caché de consultas" #. Tag: para +#: performance.xml:1223 #, no-c-format msgid "" "If you require fine-grained control over query cache expiration policies, " @@ -1720,7 +2459,21 @@ msgstr "" "una consulta en particular llamando a Query.setCacheRegion()." +#. Tag: programlisting +#: performance.xml:1227 +#, no-c-format +msgid "" +"List blogs = sess.createQuery(\"from Blog blog where blog.blogger = :blogger" +"\")\n" +" .setEntity(\"blogger\", blogger)\n" +" .setMaxResults(15)\n" +" .setCacheable(true)\n" +" .setCacheRegion(\"frontpages\")\n" +" .list();" +msgstr "" + #. Tag: para +#: performance.xml:1229 #, no-c-format msgid "" "If you want to force the query cache to refresh one of its regions " @@ -1745,11 +2498,13 @@ msgstr "" "evictQueries()." #. Tag: title +#: performance.xml:1242 #, no-c-format msgid "Understanding Collection performance" msgstr "Comprensión del rendimiento de Colecciones" #. Tag: para +#: performance.xml:1244 #, no-c-format msgid "" "In the previous sections we have covered collections and their applications. " @@ -1761,31 +2516,37 @@ msgstr "" "colecciones en tiempo de ejecución. " #. Tag: title +#: performance.xml:1249 #, no-c-format msgid "Taxonomy" msgstr "Taxonomía" #. Tag: para +#: performance.xml:1251 #, no-c-format msgid "Hibernate defines three basic kinds of collections:" msgstr "Hibernate define tres tipos básicos de colecciones:" #. Tag: para +#: performance.xml:1255 #, no-c-format msgid "collections of values" msgstr "colecciones de valores" #. Tag: para +#: performance.xml:1259 #, no-c-format msgid "one-to-many associations" msgstr "Asociaciones uno-a-muchos " #. Tag: para +#: performance.xml:1263 #, no-c-format msgid "many-to-many associations" msgstr "Aociaciones muchos-a-muchos" #. Tag: para +#: performance.xml:1267 #, no-c-format msgid "" "This classification distinguishes the various table and foreign key " @@ -1803,21 +2564,25 @@ msgstr "" "Esto sugiere la siguiente clasificación:" #. Tag: para +#: performance.xml:1276 #, no-c-format msgid "indexed collections" msgstr "colecciones indexadas" #. Tag: para +#: performance.xml:1280 #, no-c-format msgid "sets" msgstr "conjuntos (sets)" #. Tag: para +#: performance.xml:1284 #, no-c-format msgid "bags" msgstr "bolsas (bags)" #. Tag: para +#: performance.xml:1288 #, no-c-format msgid "" "All indexed collections (maps, lists, and arrays) have a primary key " @@ -1834,6 +2599,7 @@ msgstr "" "Hibernate intenta actualizarla o borrarla." #. Tag: para +#: performance.xml:1295 #, no-c-format msgid "" "Sets have a primary key consisting of <key> and " @@ -1858,6 +2624,7 @@ msgstr "" "todas las columnas como not-null=\"true\"." #. Tag: para +#: performance.xml:1306 #, no-c-format msgid "" "<idbag> mappings define a surrogate key, so they " @@ -1868,6 +2635,7 @@ msgstr "" "mejor caso." #. Tag: para +#: performance.xml:1309 #, no-c-format msgid "" "Bags are the worst case since they permit duplicate element values and, as " @@ -1884,6 +2652,7 @@ msgstr "" "Esto puede ser muy ineficiente." #. Tag: para +#: performance.xml:1316 #, no-c-format msgid "" "For a one-to-many association, the \"primary key\" may not be the physical " @@ -1897,6 +2666,7 @@ msgstr "" "\"localiza\" filas individuales de la colección." #. Tag: title +#: performance.xml:1323 #, no-c-format msgid "" "Lists, maps, idbags and sets are the most efficient collections to update" @@ -1905,6 +2675,7 @@ msgstr "" "actualizar" #. Tag: para +#: performance.xml:1326 #, no-c-format msgid "" "From the discussion above, it should be clear that indexed collections and " @@ -1916,6 +2687,7 @@ msgstr "" "quitar y actualizar elementos." #. Tag: para +#: performance.xml:1330 #, no-c-format msgid "" "There is, arguably, one more advantage that indexed collections have over " @@ -1936,6 +2708,7 @@ msgstr "" "asociaciones uno a muchos." #. Tag: para +#: performance.xml:1338 #, no-c-format msgid "" "After observing that arrays cannot be lazy, you can conclude that lists, " @@ -1952,6 +2725,7 @@ msgstr "" "el modelo relacional." #. Tag: para +#: performance.xml:1344 #, no-c-format msgid "" "However, in well-designed Hibernate domain models, most collections are in " @@ -1968,11 +2742,13 @@ msgstr "" "las colecciones simplemente no se aplican." #. Tag: title +#: performance.xml:1352 #, no-c-format msgid "Bags and lists are the most efficient inverse collections" msgstr "Los Bags y las listas son las colecciones inversas más eficientes" #. Tag: para +#: performance.xml:1354 #, no-c-format msgid "" "There is a particular case, however, in which bags, and also lists, are much " @@ -1994,12 +2770,25 @@ msgstr "" "un bag o List (no como un Set). Esto " "puede hacer el siguiente código común mucho más rápido:" +#. Tag: programlisting +#: performance.xml:1365 +#, no-c-format +msgid "" +"Parent p = (Parent) sess.load(Parent.class, id);\n" +"Child c = new Child();\n" +"c.setParent(p);\n" +"p.getChildren().add(c); //no need to fetch the collection!\n" +"sess.flush();" +msgstr "" + #. Tag: title +#: performance.xml:1369 #, no-c-format msgid "One shot delete" msgstr "Borrado de un sólo tiro" #. Tag: para +#: performance.xml:1371 #, no-c-format msgid "" "Deleting collection elements one by one can sometimes be extremely " @@ -2014,6 +2803,7 @@ msgstr "" "DELETE." #. Tag: para +#: performance.xml:1377 #, no-c-format msgid "" "Suppose you added a single element to a collection of size twenty and then " @@ -2027,6 +2817,7 @@ msgstr "" "colección sea un bag. Esto ciertamente es deseable." #. Tag: para +#: performance.xml:1383 #, no-c-format msgid "" "However, suppose that we remove eighteen elements, leaving two and then add " @@ -2036,11 +2827,13 @@ msgstr "" "añadimos tres elementos nuevos. Hay dos formas posibles de proceder" #. Tag: para +#: performance.xml:1389 #, no-c-format msgid "delete eighteen rows one by one and then insert three rows" msgstr "borrar dieciocho filas una a una y luego insertar tres filas" #. Tag: para +#: performance.xml:1394 #, no-c-format msgid "" "remove the whole collection in one SQL DELETE and insert " @@ -2050,6 +2843,7 @@ msgstr "" "insertar todos los cinco elementos actuales uno por uno" #. Tag: para +#: performance.xml:1400 #, no-c-format msgid "" "Hibernate cannot know that the second option is probably quicker. It would " @@ -2061,6 +2855,7 @@ msgstr "" "comportamiento podría confundir a disparadores de la base de datos, etc." #. Tag: para +#: performance.xml:1404 #, no-c-format msgid "" "Fortunately, you can force this behavior (i.e. the second strategy) at any " @@ -2073,6 +2868,7 @@ msgstr "" "todos los elementos actuales." #. Tag: para +#: performance.xml:1409 #, no-c-format msgid "" "One-shot-delete does not apply to collections mapped inverse=\"true" @@ -2082,11 +2878,13 @@ msgstr "" "inverse=\"true\"." #. Tag: title +#: performance.xml:1415 #, no-c-format msgid "Monitoring performance" msgstr "Control del rendimiento" #. Tag: para +#: performance.xml:1417 #, no-c-format msgid "" "Optimization is not much use without monitoring and access to performance " @@ -2100,11 +2898,13 @@ msgstr "" "SessionFactory." #. Tag: title +#: performance.xml:1423 #, no-c-format msgid "Monitoring a SessionFactory" msgstr "Control de una SessionFactory" #. Tag: para +#: performance.xml:1425 #, no-c-format msgid "" "You can access SessionFactory metrics in two ways. Your " @@ -2117,6 +2917,7 @@ msgstr "" "por sí mismo." #. Tag: para +#: performance.xml:1430 #, no-c-format msgid "" "Hibernate can also use JMX to publish metrics if you enable the " @@ -2129,7 +2930,38 @@ msgstr "" "para todas sus SessionFactory o una por fábrica. Véa el " "siguiente código para ver ejemplos de configuración minimalistas:" +#. Tag: programlisting +#: performance.xml:1435 +#, no-c-format +msgid "" +"// MBean service registration for a specific SessionFactory\n" +"Hashtable tb = new Hashtable();\n" +"tb.put(\"type\", \"statistics\");\n" +"tb.put(\"sessionFactory\", \"myFinancialApp\");\n" +"ObjectName on = new ObjectName(\"hibernate\", tb); // MBean object name\n" +"\n" +"StatisticsService stats = new StatisticsService(); // MBean implementation\n" +"stats.setSessionFactory(sessionFactory); // Bind the stats to a " +"SessionFactory\n" +"server.registerMBean(stats, on); // Register the Mbean on the server" +msgstr "" + +#. Tag: programlisting +#: performance.xml:1437 +#, no-c-format +msgid "" +"// MBean service registration for all SessionFactory's\n" +"Hashtable tb = new Hashtable();\n" +"tb.put(\"type\", \"statistics\");\n" +"tb.put(\"sessionFactory\", \"all\");\n" +"ObjectName on = new ObjectName(\"hibernate\", tb); // MBean object name\n" +"\n" +"StatisticsService stats = new StatisticsService(); // MBean implementation\n" +"server.registerMBean(stats, on); // Register the MBean on the server" +msgstr "" + #. Tag: para +#: performance.xml:1439 #, no-c-format msgid "" "You can activate and deactivate the monitoring for a " @@ -2139,6 +2971,7 @@ msgstr "" "literal>" #. Tag: para +#: performance.xml:1444 #, no-c-format msgid "" "at configuration time, set hibernate.generate_statistics " @@ -2148,6 +2981,7 @@ msgstr "" "generate_statistics como false" #. Tag: para +#: performance.xml:1452 #, no-c-format msgid "" "at runtime: sf.getStatistics().setStatisticsEnabled(true) " @@ -2158,6 +2992,7 @@ msgstr "" "literal>" #. Tag: para +#: performance.xml:1458 #, no-c-format msgid "" "Statistics can be reset programmatically using the clear(). " #. Tag: title +#: performance.xml:1464 #, no-c-format msgid "Metrics" msgstr "Métricas" #. Tag: para +#: performance.xml:1466 #, no-c-format msgid "" "Hibernate provides a number of metrics, from basic information to more " @@ -2188,6 +3025,7 @@ msgstr "" "Statistics, en tres categorías:" #. Tag: para +#: performance.xml:1473 #, no-c-format msgid "" "Metrics related to the general Session usage, such as " @@ -2197,6 +3035,7 @@ msgstr "" "tales como número de sesiones abiertas, conexiones JDBC recuperadas, etc," #. Tag: para +#: performance.xml:1479 #, no-c-format msgid "" "Metrics related to the entities, collections, queries, and caches as a whole " @@ -2206,6 +3045,7 @@ msgstr "" "como un todo (también conocidas como métricas globales)." #. Tag: para +#: performance.xml:1484 #, no-c-format msgid "" "Detailed metrics related to a particular entity, collection, query or cache " @@ -2215,6 +3055,7 @@ msgstr "" "región de caché en particular." #. Tag: para +#: performance.xml:1489 #, no-c-format msgid "" "For example, you can check the cache hit, miss, and put ratio of entities, " @@ -2230,6 +3071,7 @@ msgstr "" "algunas plataformas esto podría tener incluso una exactitud de 10 segundos." #. Tag: para +#: performance.xml:1495 #, no-c-format msgid "" "Simple getters are used to access the global metrics (i.e. not tied to a " @@ -2253,7 +3095,30 @@ msgstr "" "literal> para obtener más información. El siguiente código es un ejemplo " "sencillo:" +#. Tag: programlisting +#: performance.xml:1506 +#, no-c-format +msgid "" +"Statistics stats = HibernateUtil.sessionFactory.getStatistics();\n" +"\n" +"double queryCacheHitCount = stats.getQueryCacheHitCount();\n" +"double queryCacheMissCount = stats.getQueryCacheMissCount();\n" +"double queryCacheHitRatio =\n" +" queryCacheHitCount / (queryCacheHitCount + queryCacheMissCount);\n" +"\n" +"log.info(\"Query Hit ratio:\" + queryCacheHitRatio);\n" +"\n" +"EntityStatistics entityStats =\n" +" stats.getEntityStatistics( Cat.class.getName() );\n" +"long changes =\n" +" entityStats.getInsertCount()\n" +" + entityStats.getUpdateCount()\n" +" + entityStats.getDeleteCount();\n" +"log.info(Cat.class.getName() + \" changed \" + changes + \"times\" );" +msgstr "" + #. Tag: para +#: performance.xml:1508 #, no-c-format msgid "" "You can work on all entities, collections, queries and region caches, by " @@ -2268,3 +3133,36 @@ msgstr "" "getQueries(), getEntityNames(), " "getCollectionRoleNames() y " "getSecondLevelCacheRegionNames()." + +#~ msgid "or even:" +#~ msgstr "o incluso:" + +#~ msgid "" +#~ "Now the following code will actually load both the customer and " +#~ "their orders:" +#~ msgstr "" +#~ "Ahora el siguiente código de hecho cargará el cliente y sus " +#~ "órdenes:" + +#~ msgid "yes" +#~ msgstr "si" + +#~ msgid "" +#~ "The <cache> element of a class or collection " +#~ "mapping has the following form:" +#~ msgstr "" +#~ "El elemento <cache> de un mapeo de clase o " +#~ "colección tiene la siguiente forma:" + +#~ msgid "" +#~ "The usage attribute specifies a cache " +#~ "concurrency strategy." +#~ msgstr "" +#~ "El atributo usage especifica una estrategia " +#~ "de concurrencia al caché." + +#~ msgid "read-only" +#~ msgstr "read-only" + +#~ msgid "read-write" +#~ msgstr "read-write" diff --git a/documentation/manual/src/main/docbook/es-ES/content/persistent_classes.po b/documentation/manual/src/main/docbook/es-ES/content/persistent_classes.po index 3fd0ec92c9..ce29d4ae69 100644 --- a/documentation/manual/src/main/docbook/es-ES/content/persistent_classes.po +++ b/documentation/manual/src/main/docbook/es-ES/content/persistent_classes.po @@ -14,7 +14,7 @@ msgid "" msgstr "" "Project-Id-Version: persistent_classes\n" "Report-Msgid-Bugs-To: http://bugs.kde.org\n" -"POT-Creation-Date: 2010-02-11T05:38:15\n" +"POT-Creation-Date: 2010-07-20 21:02+0000\n" "PO-Revision-Date: 2010-03-16 11:10+1000\n" "Last-Translator: Angela Garcia \n" "Language-Team: \n" @@ -24,18 +24,20 @@ msgstr "" "X-Generator: KBabel 1.11.4\n" #. Tag: title +#: persistent_classes.xml:32 #, no-c-format msgid "Persistent Classes" msgstr "Clases persistentes" #. Tag: para -#, no-c-format +#: persistent_classes.xml:34 +#, fuzzy, 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. For example, an instance can instead be transient " -"or detached." +"application). The term \"persistent\" here means that the classes are able " +"to be persisted, not that they are in the persistent state (see for discussion)." msgstr "" "Las clases presistentes son clases en una aplicación que implementan las " "entidades del problema empresarial (por ejemplo, Customer y Order en una " @@ -44,13 +46,15 @@ msgstr "" "ejemplo, una instancia puede ser transitoria o separada." #. Tag: para -#, no-c-format +#: persistent_classes.xml:41 +#, fuzzy, 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 " +"these rules are hard requirements. Indeed, Hibernate assumes very little " "about the nature of your persistent objects. You can express a domain model " -"in other ways (using trees of Map instances, for example)." +"in other ways (using trees of java.util.Map " +"instances, for example)." msgstr "" "Hibernate funciona mejor si estas clases siguen algunas reglas simples, " "también conocidas como el modelo de programación POJO (Plain Old Java " @@ -60,20 +64,103 @@ msgstr "" "ejemplo, utilizando árboles de instancias de Map)." #. Tag: title +#: persistent_classes.xml:49 #, no-c-format msgid "A simple POJO example" msgstr "Ejemplo simple de POJO" -#. Tag: para +#. Tag: title +#: persistent_classes.xml:52 +#, no-c-format +msgid "Simple POJO representing a cat" +msgstr "" + +#. Tag: programlisting +#: persistent_classes.xml:53 #, no-c-format msgid "" -"Most Java applications require a persistent class representing felines. For " -"example:" +"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 "" -"La mayoría de aplicaciones Java requieren una clase persistente que " -"represente a los felinos. Por ejemplo:" #. Tag: para +#: persistent_classes.xml:57 #, no-c-format msgid "" "The four main rules of persistent classes are explored in more detail in the " @@ -83,19 +170,21 @@ msgstr "" "reglas principales de las clases persistentes. " #. Tag: title +#: persistent_classes.xml:62 #, no-c-format msgid "Implement a no-argument constructor" msgstr "Implemente un constructor sin argumentos" #. Tag: para -#, no-c-format +#: persistent_classes.xml:64 +#, fuzzy, no-c-format msgid "" -"Cat has a no-argument constructor. All persistent classes " -"must have a default constructor (which can be non-public) so that Hibernate " -"can instantiate them using Constructor.newInstance(). It " -"is recommended that you have a default constructor with at least " -"package visibility for runtime proxy generation in " -"Hibernate." +"Cat has a no-argument constructor. All persistent " +"classes must have a default constructor (which can be non-public) so that " +"Hibernate can instantiate them using java.lang.reflect." +"Constructor.newInstance(). It is recommended that this " +"constructor be defined with at least package visibility " +"in order for runtime proxy generation to work properly." msgstr "" "Cat tiene un contructor sin argumentos. Todas las clases " "persistentes deben tener un constructor predeterminado (el cual puede ser no-" @@ -105,71 +194,42 @@ msgstr "" "emphasis> para la generación de proxies en tiempo de ejecución en Hibernate." #. Tag: title -#, no-c-format -msgid "Provide an identifier property (optional)" +#: persistent_classes.xml:74 +#, fuzzy, no-c-format +msgid "Provide an identifier property" msgstr "Proporcione una propiedad identificadora (opcional)" #. Tag: para +#: persistent_classes.xml:77 #, no-c-format msgid "" -"Cat has a property called id. 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, java.lang.String or " -"java.util.Date. If your legacy database table has " -"composite keys, you can use a user-defined class with properties of these " -"types (see the section on composite identifiers later in the chapter.)" +"Historically this was considered option. While still not (yet) enforced, " +"this should be considered a deprecated feature as it will be completely " +"required to provide a identifier property in an upcoming release." msgstr "" -"Cat tiene una propiedad llamada id. " -"Esta propiedad mapea a la columna de la llave principal de la tabla de la " -"base de datos. La propiedad podría llamarse de cualquier manera y su tipo " -"podría haber sido cualquier tipo primitivo, cualquier tipo de \"wrapper\" " -"primitivo, java.lang.String o java.util.Date. Si su tabla de base de datos heredada tiene claves compuestas, " -"puede utilizar una clase definida por el usuario con propiedades de estos " -"tipos (vea la sección sobre identificadores compuestos más adelante en este " -"capítulo)." #. 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." +"Cat has a property named id. This " +"property maps to the primary key column(s) of the underlying database table. " +"The type of the identifier property can be any \"basic\" type (see ). See for information on mapping composite (multi-column) identifiers." msgstr "" -"La propiedad identificadora es estrictamente opcional. Puede olvidarla y " -"dejar que Hibernate siga internamente la pista de los identificadores del " -"objeto. Sin embargo, no recomendamos que esto suceda." #. Tag: para +#: persistent_classes.xml:92 #, no-c-format msgid "" -"In fact, some functionality is available only to classes that declare an " -"identifier property:" +"Identifiers do not necessarily need to identify column(s) in the database " +"physically defined as a primary key. They should just identify columns that " +"can be used to uniquely identify rows in the underlying table." msgstr "" -"De hecho, algunas funcionalidades se encuentran disponibles sólamente para " -"clases que declaran una propiedad identificadora: " - -#. Tag: para -#, no-c-format -msgid "" -"Transitive reattachment for detached objects (cascade update or cascade " -"merge) - see " -msgstr "" -"Reasociación transitiva de objetos separados (actualizaciones o fusiones en " -"cascada) - consulte " - -#. Tag: para -#, no-c-format -msgid "Session.saveOrUpdate()" -msgstr "Session.saveOrUpdate()" - -#. Tag: para -#, no-c-format -msgid "Session.merge()" -msgstr "Session.merge()" #. Tag: para +#: persistent_classes.xml:99 #, no-c-format msgid "" "We recommend that you declare consistently-named identifier properties on " @@ -180,41 +240,100 @@ msgstr "" "ejemplo, no primitivo)." #. Tag: title -#, no-c-format -msgid "Prefer non-final classes (optional)" +#: persistent_classes.xml:107 +#, fuzzy, no-c-format +msgid "Prefer non-final classes (semi-optional)" msgstr "Prefiera las clases no finales (opcional)" #. Tag: para +#: persistent_classes.xml:109 #, no-c-format msgid "" -"A central feature of Hibernate, proxies, depends upon " -"the persistent class being either non-final, or the implementation of an " -"interface that declares all public methods." +"A central feature of Hibernate, proxies (lazy loading), " +"depends upon the persistent class being either non-final, or the " +"implementation of an interface that declares all public methods. You can " +"persist final classes that do not implement an interface " +"with Hibernate; you will not, however, be able to use proxies for lazy " +"association fetching which will ultimately limit your options for " +"performance tuning. To persist a final class which does " +"not implement a \"full\" interface you must disable proxy generation. See " +" and ." +msgstr "" + +#. Tag: title +#: persistent_classes.xml:121 +#, no-c-format +msgid "Disabling proxies in hbm.xml" +msgstr "" + +#. Tag: programlisting +#: persistent_classes.xml:122 +#, no-c-format +msgid "...]]>" +msgstr "" + +#. Tag: title +#: persistent_classes.xml:126 +#, no-c-format +msgid "Disabling proxies in annotations" +msgstr "" + +#. Tag: programlisting +#: persistent_classes.xml:127 +#, no-c-format +msgid "" msgstr "" -"Un aspecto central de Hibernate, los proxies, dependen " -"de que las clases persistentes sean no finales o de la implementación de una " -"interfaz que declare todos los métodos públicos." #. Tag: para +#: persistent_classes.xml:130 #, no-c-format msgid "" -"You can persist final classes that do not implement an " -"interface with Hibernate. You will not, however, be able to use proxies for " -"lazy association fetching which will ultimately limit your options for " -"performance tuning." +"If the final class does implement a proper interface, you " +"could alternatively tell Hibernate to use the interface instead when " +"generating the proxies. See and ." +msgstr "" + +#. Tag: title +#: persistent_classes.xml:139 +#, no-c-format +msgid "Proxying an interface in hbm.xml" +msgstr "" + +#. Tag: programlisting +#: persistent_classes.xml:140 +#, no-c-format +msgid "...]]>" +msgstr "" + +#. Tag: title +#: persistent_classes.xml:144 +#, no-c-format +msgid "Proxying an interface in annotations" +msgstr "" + +#. Tag: programlisting +#: persistent_classes.xml:145 +#, no-c-format +msgid "" +"" msgstr "" -"Con Hibernate puede persistir las clases finales que no " -"implementen una interfaz. Sin embargo, no podrá utilizar proxies para " -"recuperación perezosa de asociaciones, lo cual limitará sus opciones para " -"afinar el rendimiento." #. Tag: para -#, no-c-format +#: persistent_classes.xml:148 +#, fuzzy, no-c-format msgid "" -"You should also avoid declaring public final methods on " -"the non-final classes. If you want to use a class with a public " -"final method, you must explicitly disable proxying by setting " -"lazy=\"false\"." +"You should also avoid declaring public final methods as " +"this will again limit the ability to generate proxies " +"from this class. If you want to use a class with public final methods, you must explicitly disable proxying. Again, see and " +"." msgstr "" "También debe evitar el declarar métodos public final en " "las clases no-finales. Si quiere utilizar una clase con un método " @@ -222,6 +341,7 @@ msgstr "" "proxies estableciendo lazy=\"false\"." #. Tag: title +#: persistent_classes.xml:158 #, no-c-format msgid "Declare accessors and mutators for persistent fields (optional)" msgstr "" @@ -229,9 +349,10 @@ msgstr "" "(opcional)" #. Tag: para -#, no-c-format +#: persistent_classes.xml:160 +#, fuzzy, no-c-format msgid "" -"Cat declares accessor methods for all its persistent " +"Cat declares accessor methods for all its persistent " "fields. Many other ORM tools directly persist instance variables. It is " "better to provide an indirection between the relational schema and internal " "data structures of the class. By default, Hibernate persists JavaBeans style " @@ -249,22 +370,26 @@ msgstr "" "acceso directo a campos para propiedades específicas." #. Tag: para -#, no-c-format +#: persistent_classes.xml:169 +#, fuzzy, no-c-format msgid "" -"Properties need not be declared public - Hibernate can " -"persist a property with a default, protected or " -"private get / set pair." +"Properties need not be declared public. Hibernate can " +"persist a property declared with package, " +"protected or private visibility as " +"well." msgstr "" "No es necesario declarar públicas las propiedades. " "Hibernate puede persistir una propiedad con un par get / set " "protected o private." #. Tag: title +#: persistent_classes.xml:178 #, no-c-format msgid "Implementing inheritance" msgstr "Implementación de herencia" #. Tag: para +#: persistent_classes.xml:180 #, no-c-format msgid "" "A subclass must also observe the first and second rules. It inherits its " @@ -274,12 +399,34 @@ msgstr "" "Hereda su propiedad identificadora de la superclase Cat. " "Por ejemplo:" -#. Tag: title +#. Tag: programlisting +#: persistent_classes.xml:184 #, no-c-format -msgid "Implementing equals() and hashCode()" -msgstr "Implementando equals() y hashCode()" +msgid "" +"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:188 +#, no-c-format +msgid "" +"Implementing equals() and hashCode()" +msgstr "" +"Implementando equals() y hashCode()" #. Tag: para +#: persistent_classes.xml:191 #, no-c-format msgid "" "You have to override the equals() and hashCode()" @@ -289,6 +436,7 @@ msgstr "" "hashCode() si:" #. Tag: para +#: persistent_classes.xml:196 #, no-c-format msgid "" "intend to put instances of persistent classes in a Set " @@ -300,11 +448,13 @@ msgstr "" "y" #. Tag: para +#: persistent_classes.xml:202 #, no-c-format msgid "intend to use reattachment of detached instances" msgstr "piensa utilizar reasociación de instancias separadas." #. Tag: para +#: persistent_classes.xml:206 #, no-c-format msgid "" "Hibernate guarantees equivalence of persistent identity (database row) and " @@ -321,6 +471,7 @@ msgstr "" "para Sets." #. Tag: para +#: persistent_classes.xml:212 #, no-c-format msgid "" "The most obvious way is to implement equals()/" @@ -356,6 +507,7 @@ msgstr "" "de Java de identidad de objeto e igualdad." #. Tag: para +#: persistent_classes.xml:228 #, no-c-format msgid "" "It is recommended that you implement equals() and " @@ -373,37 +525,72 @@ msgstr "" "instancia en el mundo real (una clave candidata natural):" -#. Tag: para +#. Tag: programlisting +#: persistent_classes.xml:235 #, no-c-format msgid "" +"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:237 +#, fuzzy, no-c-format +msgid "" "A business key does not have to be as solid as a database primary key " -"candidate (see ). Immutable " +"candidate (see ). Immutable " "or unique properties are usually good candidates for a business key." msgstr "" "Una clave empresarial no tiene que ser tan sólida como una clave principal " -"candidata (consulte la ). Las propiedades inmutables o únicas usualmente son " -"buenas candidatas para una clave empresarial." +"candidata (consulte la ). " +"Las propiedades inmutables o únicas usualmente son buenas candidatas para " +"una clave empresarial." #. Tag: title +#: persistent_classes.xml:244 #, no-c-format msgid "Dynamic models" msgstr "Modelos dinámicos" #. Tag: title +#: persistent_classes.xml:247 #, no-c-format msgid "Note" msgstr "Nota" -#. Tag: para -#, no-c-format +#. Tag: emphasis +#: persistent_classes.xml:249 +#, fuzzy, no-c-format msgid "" -"The following features are currently considered experimental and " -"may change in the near future." +"The following features are currently considered experimental and may change " +"in the near future." msgstr "" -"Las siguientes funcionalidades se consideran como " -"experimentales actualmente y es posible que cambien pronto." +"Las siguientes funcionalidades se consideran como experimentales " +"actualmente y es posible que cambien pronto." #. Tag: para +#: persistent_classes.xml:253 #, no-c-format msgid "" "Persistent entities do not necessarily have to be represented as POJO " @@ -420,19 +607,22 @@ msgstr "" "enfoque, sólamente archivos de mapeo. " #. Tag: para -#, no-c-format +#: persistent_classes.xml:259 +#, fuzzy, no-c-format msgid "" "By default, Hibernate works in normal POJO mode. You can set a default " "entity representation mode for a particular SessionFactory using the default_entity_mode configuration " -"option (see )." +"option (see )." msgstr "" "Por defecto, Hibernate funciona en modo POJO normal. Puede establecer un " "modo de representación de entidad predeterminado para una " "SessionFactory en particular utilizando la opción de " -"configuración default_entity_mode (consulte )." +"configuración default_entity_mode (consulte )." #. Tag: para +#: persistent_classes.xml:265 #, no-c-format msgid "" "The following examples demonstrate the representation using Mapentity-name en lugar de, o además de un " "nombre de clase:" +#. Tag: programlisting +#: persistent_classes.xml:270 +#, no-c-format +msgid "" +"<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:272 #, no-c-format msgid "" "Even though associations are declared using target class names, the target " @@ -455,6 +685,7 @@ msgstr "" "lugar de un POJO." #. Tag: para +#: persistent_classes.xml:276 #, no-c-format msgid "" "After setting the default entity mode to dynamic-map for " @@ -466,7 +697,34 @@ msgstr "" "puede trabajar en tiempo de ejecución con Mapeos de " "Mapeos: " +#. Tag: programlisting +#: persistent_classes.xml:281 +#, no-c-format +msgid "" +"Session s = openSession();\n" +"Transaction tx = s.beginTransaction();\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:283 #, no-c-format msgid "" "One of the main advantages of dynamic mapping is quick turnaround time for " @@ -485,6 +743,7 @@ msgstr "" "apropiada del modelo de dominio más adelante." #. Tag: para +#: persistent_classes.xml:290 #, no-c-format msgid "" "Entity representation modes can also be set on a per SessionSession:" +#. Tag: programlisting +#: persistent_classes.xml:293 +#, no-c-format +msgid "" +"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" +msgstr "" + #. Tag: para +#: persistent_classes.xml:295 #, no-c-format msgid "" "Please note that the call to getSession() using an " @@ -515,31 +792,35 @@ msgstr "" "de la transacción y de la conexión a la unidad de trabajo primaria. " #. Tag: para -#, no-c-format +#: persistent_classes.xml:304 +#, fuzzy, no-c-format msgid "" "More information about the XML representation capabilities can be found in " -"." +"." msgstr "" "Puede encontrar más información sobre las capacidades de representación de " "XML en ." #. Tag: title +#: persistent_classes.xml:310 #, no-c-format msgid "Tuplizers" msgstr "Tuplizers" #. Tag: para -#, no-c-format +#: persistent_classes.xml:312 +#, fuzzy, no-c-format msgid "" -"org.hibernate.tuple.Tuplizer, and its sub-interfaces, are " -"responsible for managing a particular representation of a piece of data " -"given that representation's org.hibernate.EntityMode. If " -"a given piece of data is thought of as a data structure, then a tuplizer is " -"the thing that 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 corresponding tuplizer knows how create the POJO " -"through its constructor. It also knows how to access the POJO properties " -"using the defined property accessors." +"org.hibernate.tuple.Tuplizer and its sub-" +"interfaces are responsible for managing a particular representation of a " +"piece of data given that representation's org.hibernate." +"EntityMode. If a given piece of data is thought of as a data " +"structure, then a tuplizer is the thing that knows how to create such a data " +"structure, how to extract values from such a data structure and how to " +"inject values into such a data structure. For example, for the POJO entity " +"mode, the corresponding tuplizer knows how create the POJO through its " +"constructor. It also knows how to access the POJO properties using the " +"defined property accessors." msgstr "" "org.hibernate.tuple.Tuplizer y sus subinterfaces son las " "responsables de administrar una representación en particular de un dato, " @@ -552,34 +833,44 @@ msgstr "" "POJO utilizando los accesores de propiedad definidos. " #. Tag: para +#: persistent_classes.xml:322 #, no-c-format -msgid "" -"There are two high-level types of Tuplizers, represented by the org." -"hibernate.tuple.entity.EntityTuplizer and org.hibernate." -"tuple.component.ComponentTuplizer interfaces. " -"EntityTuplizers are responsible for managing the above " -"mentioned contracts in regards to entities, while " -"ComponentTuplizers do the same for components." +msgid "There are two (high-level) types of Tuplizers:" msgstr "" -"Hay dos tipos altos de niveles de Tuplizers, representados por las " -"interfaces org.hibernate.tuple.entity.EntityTuplizer y " -"org.hibernate.tuple.component.ComponentTuplizer. Los " -"EntityTuplizers son los responsables de administrar los " -"contratos mencionados anteriormente en relación con las entidades mientras " -"que los ComponentTuplizers hacen lo mismo para los " -"componentes." #. Tag: para +#: persistent_classes.xml:326 #, no-c-format msgid "" -"Users can also plug in their own tuplizers. Perhaps you require that a " -"java.util.Map implementation other than java." -"util.HashMap 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. Tuplizer definitions are attached to the entity or component " -"mapping they are meant to manage. Going back to the example of our customer " -"entity:" +"org.hibernate.tuple.entity.EntityTuplizer " +"which is responsible for managing the above mentioned contracts in regards " +"to entities" +msgstr "" + +#. Tag: para +#: persistent_classes.xml:332 +#, no-c-format +msgid "" +"org.hibernate.tuple.component.ComponentTuplizer which does the same for components" +msgstr "" + +#. Tag: para +#: persistent_classes.xml:340 +#, fuzzy, no-c-format +msgid "" +"Users can also plug in their own tuplizers. Perhaps you require that " +"java.util.Map implementation other than " +"java.util.HashMap 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. Tuplizer definitions are attached to the " +"entity or component mapping they are meant to manage. Going back to the " +"example of our Customer entity, shows how to specify a custom " +"org.hibernate.tuple.entity.EntityTuplizer " +"using annotations while shows how to do the same in hbm.xml" msgstr "" "Los usuarios también pueden enchufar sus propios tuplizers. Tal vez necesite " "que una implementación java.util.Map diferente de " @@ -592,26 +883,83 @@ msgstr "" "de cliente:" #. Tag: title +#: persistent_classes.xml:353 +#, no-c-format +msgid "Specify custom tuplizers in annotations" +msgstr "" + +#. Tag: programlisting +#: persistent_classes.xml:354 +#, no-c-format +msgid "" +"@Entity\n" +"@Tuplizer(impl = DynamicEntityTuplizer.class)\n" +"public interface Cuisine {\n" +" @Id\n" +" @GeneratedValue\n" +" public Long getId();\n" +" public void setId(Long id);\n" +"\n" +" public String getName();\n" +" public void setName(String name);\n" +"\n" +" @Tuplizer(impl = DynamicComponentTuplizer.class)\n" +" public Country getCountry();\n" +" public void setCountry(Country country);\n" +"}" +msgstr "" + +#. Tag: title +#: persistent_classes.xml:357 +#, no-c-format +msgid "Specify custom tuplizers in hbm.xml" +msgstr "" + +#. Tag: programlisting +#: persistent_classes.xml:358 +#, no-c-format +msgid "" +"<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>" +msgstr "" + +#. Tag: title +#: persistent_classes.xml:363 #, no-c-format msgid "EntityNameResolvers" msgstr "EntityNameResolvers" #. Tag: para -#, no-c-format +#: persistent_classes.xml:365 +#, fuzzy, no-c-format msgid "" -"The org.hibernate.EntityNameResolver " -"interface is a contract for resolving the entity name of a given entity " -"instance. The interface defines a single method " -"resolveEntityName which is passed the entity " -"instance and is expected to return the appropriate entity name (null is " -"allowed and would indicate that the resolver does not know how to resolve " -"the entity name of the given entity instance). Generally speaking, an " -"org.hibernate.EntityNameResolver is going to " -"be most useful in the case of dynamic models. One example might be using " -"proxied interfaces as your domain model. The hibernate test suite has an " -"example of this exact style of usage under the org.hibernate.test." -"dynamicentity.tuplizer2. Here is some of the code from that " -"package for illustration." +"org.hibernate.EntityNameResolver is a " +"contract for resolving the entity name of a given entity instance. The " +"interface defines a single method resolveEntityName " +"which is passed the entity instance and is expected to return the " +"appropriate entity name (null is allowed and would indicate that the " +"resolver does not know how to resolve the entity name of the given entity " +"instance). Generally speaking, an org.hibernate." +"EntityNameResolver is going to be most useful in the case of " +"dynamic models. One example might be using proxied interfaces as your domain " +"model. The hibernate test suite has an example of this exact style of usage " +"under the org.hibernate.test.dynamicentity.tuplizer2. " +"Here is some of the code from that package for illustration." msgstr "" "La interfaz org.hibernate.EntityNameResolver " "es un contrato para resolver el nombre de la entidad de una instancia de " @@ -627,7 +975,138 @@ msgstr "" "hibernate.test.dynamicentity.tuplizer2. Aquí está algo del código " "de ese paquete para su ilustración." +#. Tag: programlisting +#: persistent_classes.xml:377 +#, no-c-format +msgid "" +"/**\n" +" * A very trivial JDK Proxy InvocationHandler implementation where we proxy " +"an\n" +" * interface as the domain model and simply store persistent state in an " +"internal\n" +" * Map. This is an extremely trivial example meant only for illustration.\n" +" */\n" +"public final class DataProxyHandler implements InvocationHandler {\n" +" private String entityName;\n" +" private HashMap data = new HashMap();\n" +"\n" +" public DataProxyHandler(String entityName, Serializable id) {\n" +" this.entityName = entityName;\n" +" data.put( \"Id\", id );\n" +" }\n" +"\n" +" public Object invoke(Object proxy, Method method, Object[] args) " +"throws Throwable {\n" +" String methodName = method.getName();\n" +" if ( methodName.startsWith( \"set\" ) ) {\n" +" String propertyName = methodName.substring( 3 );\n" +" data.put( propertyName, args[0] );\n" +" }\n" +" else if ( methodName.startsWith( \"get\" ) ) {\n" +" String propertyName = methodName.substring( 3 );\n" +" return data.get( propertyName );\n" +" }\n" +" else if ( \"toString\".equals( methodName ) ) {\n" +" return entityName + \"#\" + data.get( \"Id\" );\n" +" }\n" +" else if ( \"hashCode\".equals( methodName ) ) {\n" +" return new Integer( this.hashCode() );\n" +" }\n" +" return null;\n" +" }\n" +"\n" +" public String getEntityName() {\n" +" return entityName;\n" +" }\n" +"\n" +" public HashMap getData() {\n" +" return data;\n" +" }\n" +"}\n" +"\n" +"public class ProxyHelper {\n" +" public static String extractEntityName(Object object) {\n" +" // Our custom java.lang.reflect.Proxy instances actually bundle\n" +" // their appropriate entity name, so we simply extract it from " +"there\n" +" // if this represents one of our proxies; otherwise, we return null\n" +" if ( Proxy.isProxyClass( object.getClass() ) ) {\n" +" InvocationHandler handler = Proxy.getInvocationHandler" +"( object );\n" +" if ( DataProxyHandler.class.isAssignableFrom( handler.getClass" +"() ) ) {\n" +" DataProxyHandler myHandler = ( DataProxyHandler ) handler;\n" +" return myHandler.getEntityName();\n" +" }\n" +" }\n" +" return null;\n" +" }\n" +"\n" +" // various other utility methods ....\n" +"\n" +"}\n" +"\n" +"/**\n" +" * The EntityNameResolver implementation.\n" +" *\n" +" * IMPL NOTE : An EntityNameResolver really defines a strategy for how " +"entity names\n" +" * should be resolved. Since this particular impl can handle resolution for " +"all of our\n" +" * entities we want to take advantage of the fact that SessionFactoryImpl " +"keeps these\n" +" * in a Set so that we only ever have one instance registered. Why? Well, " +"when it\n" +" * comes time to resolve an entity name, Hibernate must iterate over all the " +"registered\n" +" * resolvers. So keeping that number down helps that process be as speedy " +"as possible.\n" +" * Hence the equals and hashCode implementations as is\n" +" */\n" +"public class MyEntityNameResolver implements EntityNameResolver {\n" +" public static final MyEntityNameResolver INSTANCE = new " +"MyEntityNameResolver();\n" +"\n" +" public String resolveEntityName(Object entity) {\n" +" return ProxyHelper.extractEntityName( entity );\n" +" }\n" +"\n" +" public boolean equals(Object obj) {\n" +" return getClass().equals( obj.getClass() );\n" +" }\n" +"\n" +" public int hashCode() {\n" +" return getClass().hashCode();\n" +" }\n" +"}\n" +"\n" +"public class MyEntityTuplizer extends PojoEntityTuplizer {\n" +" public MyEntityTuplizer(EntityMetamodel entityMetamodel, " +"PersistentClass mappedEntity) {\n" +" super( entityMetamodel, mappedEntity );\n" +" }\n" +"\n" +" public EntityNameResolver[] getEntityNameResolvers() {\n" +" return new EntityNameResolver[] { MyEntityNameResolver." +"INSTANCE };\n" +" }\n" +"\n" +" public String determineConcreteSubclassEntityName(Object entityInstance, " +"SessionFactoryImplementor factory) {\n" +" String entityName = ProxyHelper.extractEntityName" +"( entityInstance );\n" +" if ( entityName == null ) {\n" +" entityName = super.determineConcreteSubclassEntityName" +"( entityInstance, factory );\n" +" }\n" +" return entityName;\n" +" }\n" +"\n" +" ..." +msgstr "" + #. Tag: para +#: persistent_classes.xml:379 #, no-c-format msgid "" "In order to register an org.hibernate.EntityNameResolver los usuarios deben:" #. Tag: para -#, no-c-format +#: persistent_classes.xml:383 +#, fuzzy, no-c-format msgid "" -"Implement a custom Tuplizer, implementing the getEntityNameResolvers " -"method." +"Implement a custom tuplizer (see ), implementing the getEntityNameResolvers " +"method" msgstr "" "Implementar un Tuplizer personalizado, implementando el método getEntityNameResolvers." +"link> personalizado, implementando el método " +"getEntityNameResolvers." #. Tag: para +#: persistent_classes.xml:389 #, no-c-format msgid "" "Register it with the org.hibernate.impl.SessionFactoryImpl) usando el método " "registerEntityNameResolver." +#~ msgid "" +#~ "Most Java applications require a persistent class representing felines. " +#~ "For example:" +#~ msgstr "" +#~ "La mayoría de aplicaciones Java requieren una clase persistente que " +#~ "represente a los felinos. Por ejemplo:" + +#~ msgid "" +#~ "Cat has a property called id. 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, java.lang." +#~ "String or java.util.Date. If your legacy " +#~ "database table has composite keys, you can use a user-defined class with " +#~ "properties of these types (see the section on composite identifiers later " +#~ "in the chapter.)" +#~ msgstr "" +#~ "Cat tiene una propiedad llamada id. " +#~ "Esta propiedad mapea a la columna de la llave principal de la tabla de la " +#~ "base de datos. La propiedad podría llamarse de cualquier manera y su tipo " +#~ "podría haber sido cualquier tipo primitivo, cualquier tipo de \"wrapper\" " +#~ "primitivo, java.lang.String o java.util.Date. Si su tabla de base de datos heredada tiene claves compuestas, " +#~ "puede utilizar una clase definida por el usuario con propiedades de estos " +#~ "tipos (vea la sección sobre identificadores compuestos más adelante en " +#~ "este capítulo)." + +#~ 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 "" +#~ "La propiedad identificadora es estrictamente opcional. Puede olvidarla y " +#~ "dejar que Hibernate siga internamente la pista de los identificadores del " +#~ "objeto. Sin embargo, no recomendamos que esto suceda." + +#~ msgid "" +#~ "In fact, some functionality is available only to classes that declare an " +#~ "identifier property:" +#~ msgstr "" +#~ "De hecho, algunas funcionalidades se encuentran disponibles sólamente " +#~ "para clases que declaran una propiedad identificadora: " + +#~ msgid "" +#~ "Transitive reattachment for detached objects (cascade update or cascade " +#~ "merge) - see " +#~ msgstr "" +#~ "Reasociación transitiva de objetos separados (actualizaciones o fusiones " +#~ "en cascada) - consulte " + +#~ msgid "Session.saveOrUpdate()" +#~ msgstr "Session.saveOrUpdate()" + +#~ msgid "Session.merge()" +#~ msgstr "Session.merge()" + +#~ msgid "" +#~ "A central feature of Hibernate, proxies, depends " +#~ "upon the persistent class being either non-final, or the implementation " +#~ "of an interface that declares all public methods." +#~ msgstr "" +#~ "Un aspecto central de Hibernate, los proxies, " +#~ "dependen de que las clases persistentes sean no finales o de la " +#~ "implementación de una interfaz que declare todos los métodos públicos." + +#~ msgid "" +#~ "You can persist final classes that do not implement an " +#~ "interface with Hibernate. You will not, however, be able to use proxies " +#~ "for lazy association fetching which will ultimately limit your options " +#~ "for performance tuning." +#~ msgstr "" +#~ "Con Hibernate puede persistir las clases finales que " +#~ "no implementen una interfaz. Sin embargo, no podrá utilizar proxies para " +#~ "recuperación perezosa de asociaciones, lo cual limitará sus opciones para " +#~ "afinar el rendimiento." + +#~ msgid "" +#~ "There are two high-level types of Tuplizers, represented by the " +#~ "org.hibernate.tuple.entity.EntityTuplizer and " +#~ "org.hibernate.tuple.component.ComponentTuplizer " +#~ "interfaces. EntityTuplizers are responsible for " +#~ "managing the above mentioned contracts in regards to entities, while " +#~ "ComponentTuplizers do the same for components." +#~ msgstr "" +#~ "Hay dos tipos altos de niveles de Tuplizers, representados por las " +#~ "interfaces org.hibernate.tuple.entity.EntityTuplizer y " +#~ "org.hibernate.tuple.component.ComponentTuplizer. Los " +#~ "EntityTuplizers son los responsables de administrar " +#~ "los contratos mencionados anteriormente en relación con las entidades " +#~ "mientras que los ComponentTuplizers hacen lo mismo " +#~ "para los componentes." diff --git a/documentation/manual/src/main/docbook/es-ES/content/preface.po b/documentation/manual/src/main/docbook/es-ES/content/preface.po index 11d640fced..38a8ce29dc 100644 --- a/documentation/manual/src/main/docbook/es-ES/content/preface.po +++ b/documentation/manual/src/main/docbook/es-ES/content/preface.po @@ -15,7 +15,7 @@ msgid "" msgstr "" "Project-Id-Version: preface\n" "Report-Msgid-Bugs-To: http://bugs.kde.org\n" -"POT-Creation-Date: 2010-02-11T05:38:15\n" +"POT-Creation-Date: 2010-07-20 21:02+0000\n" "PO-Revision-Date: 2010-03-15 15:31+1000\n" "Last-Translator: Angela Garcia \n" "Language-Team: \n" @@ -25,29 +25,58 @@ msgstr "" "X-Generator: KBabel 1.11.4\n" #. Tag: title +#: preface.xml:33 #, no-c-format msgid "Preface" msgstr "Prefacio" #. Tag: para -#, no-c-format +#: preface.xml:35 +#, fuzzy, 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." +"Working with both Object-Oriented software and Relational Databases can be " +"cumbersome and time consuming. Development costs are significantly higher " +"due to a paradigm mismatch between how data is represented in objects versus " +"relational databases. Hibernate is an Object/Relational Mapping solution for " +"Java environments. The term Object/Relational Mapping refers to the " +"technique of mapping a data representation from an object model to a " +"relational data model with a SQL-based schema; see http://en.wikipedia.org/wiki/" +"Object-relational_mapping for a discussion." msgstr "" "El trabajar con software orientado a objetos y con una base de datos " "relacional puede llegar a ser engorroso y puede llegar a tomar bastante " "tiempo en los entornos empresariales de hoy en día. Hibernate es una " -"herramienta de mapeo objeto/relacional para entornos Java. El término de mapeo " -"objeto/relacional (ORM) se refiere a la técnica de mapear una representación " -"de datos desde un modelo de objeto a un modelo de datos relacionales con un " -"esquema basado en SQL." +"herramienta de mapeo objeto/relacional para entornos Java. El término de " +"mapeo objeto/relacional (ORM) se refiere a la técnica de mapear una " +"representación de datos desde un modelo de objeto a un modelo de datos " +"relacionales con un esquema basado en SQL." #. Tag: para +#: preface.xml:46 +#, no-c-format +msgid "" +"While having a strong background in SQL is not required to use Hibernate, " +"having a basic understanding of the concepts can greatly help you understand " +"Hibernate more fully and quickly. Probably the single best background is an " +"understanding of data modeling principles. You might want to consider these " +"resources as a good starting point:" +msgstr "" + +#. Tag: ulink +#: preface.xml:54 +#, no-c-format +msgid "http://www.agiledata.org/essays/dataModeling101.html" +msgstr "" + +#. Tag: ulink +#: preface.xml:59 +#, no-c-format +msgid "http://en.wikipedia.org/wiki/Data_modeling" +msgstr "" + +#. Tag: para +#: preface.xml:66 #, no-c-format msgid "" "Hibernate not only takes care of the mapping from Java classes to database " @@ -62,16 +91,28 @@ msgstr "" "se tomaría con el manejo de datos de forma manual en SQL y JDBC." #. Tag: para +#: preface.xml:72 #, no-c-format msgid "" -"Hibernate's 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." +"Hibernate’s design goal is to relieve the developer from 95% of common data " +"persistence-related programming tasks by eliminating the need for manual, " +"hand-crafted data processing using SQL and JDBC. However, unlike many other " +"persistence solutions, Hibernate does not hide the power of SQL from you and " +"guarantees that your investment in relational technology and knowledge is as " +"valid as always." +msgstr "" + +#. Tag: para +#: preface.xml:79 +#, fuzzy, no-c-format +msgid "" +"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 "" "La meta de Hibernate es aliviar el trabajo del desarrollador en 95% de la " "persistencia de datos comunes relacionados con tareas de programación. Es " @@ -85,6 +126,7 @@ msgstr "" "una representación tabular a un grafo de objetos." #. Tag: para +#: preface.xml:88 #, no-c-format msgid "" "If you are new to Hibernate and Object/Relational Mapping or even Java, " @@ -94,26 +136,30 @@ msgstr "" "inclusive en Java por favor siga los siguientes pasos:" #. Tag: para -#, no-c-format +#: preface.xml:95 +#, fuzzy, no-c-format msgid "" -"Read for a tutorial with step-by-step " +"Read for a tutorial with step-by-step " "instructions. The source code for the tutorial is included in the " "distribution in the doc/reference/tutorial/ directory." msgstr "" "Consulte el , el cual es un tutorial con " "instrucciones paso por paso. El código fuente para el tutorial se encuentra " -"incluído en la distribución en el directorio doc/reference/tutorial/. " +"incluído en la distribución en el directorio doc/reference/tutorial/" +". " #. Tag: para -#, no-c-format +#: preface.xml:103 +#, fuzzy, no-c-format msgid "" -"Read to understand the environments where " +"Read to understand the environments where " "Hibernate can be used." msgstr "" "Consulte el para comprender los entornos " "en donde se puede utilizar Hibernate." #. Tag: para +#: preface.xml:109 #, no-c-format msgid "" "View the eg/ directory in the Hibernate distribution. It " @@ -132,21 +178,25 @@ msgstr "" "Windows, escriba build eg." #. Tag: para -#, no-c-format +#: preface.xml:120 +#, fuzzy, no-c-format msgid "" "Use this reference documentation as your primary source of information. " "Consider reading if you need " "more help with application design, or if you prefer a step-by-step tutorial. " -"Also visit and download " -"the example application from ." +"Also visit and " +"download the example application from ." msgstr "" "Utilice esta documentación de referencia como su fuente principal de " -"información. Considere el leer si necesita más ayuda con el " -"diseño de la aplicación o si prefiere un tutorial paso por paso. También " -"visite y descargue la aplicación " -"de ejemplo de ." +"información. Considere el leer si necesita más ayuda con el diseño de la aplicación o si " +"prefiere un tutorial paso por paso. También visite y descargue la aplicación de ejemplo de " +"." #. Tag: para +#: preface.xml:130 #, no-c-format msgid "FAQs are answered on the Hibernate website." msgstr "" @@ -154,6 +204,7 @@ msgstr "" "frecuentes." #. Tag: para +#: preface.xml:135 #, no-c-format msgid "" "Links to third party demos, examples, and tutorials are maintained on the " @@ -163,6 +214,7 @@ msgstr "" "terceros, ejemplos y tutoriales." #. Tag: para +#: preface.xml:141 #, no-c-format msgid "" "The Community Area on the Hibernate website is a good resource for design " @@ -174,33 +226,93 @@ msgstr "" "JBoss AS, Struts, EJB, etc)." #. Tag: para +#: preface.xml:149 #, no-c-format msgid "" -"If you have questions, use the user forum linked on the Hibernate website. " -"We also provide a JIRA issue tracking 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." +"There are a number of ways to become involved in the Hibernate community, " +"including" msgstr "" -"Si tiene alguna pregunta, diríjase al sitio web de Hibernate en donde " -"encontrará un enlace al foro de usuarios. También proporcionamos un sistema " -"de localización para reportes de errores JIRA y solicitud de funciones. Si " -"está interesado en el desarrollo de Hibernate, únase a la lista de correo de " -"los desarrolladores. Si le interesa traducir esta documentación a su propio " -"idioma, contáctenos en la lista de correo de los desarrolladores." #. Tag: para +#: preface.xml:153 #, 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." +"Trying stuff out and reporting bugs. See http://hibernate.org/issuetracker.html details." msgstr "" -"JBoss Inc. proporciona soporte para desarrollo comercial, soporte para " -"producción y entrenamiento (vea http://www.hibernate.org/SupportTraining/). " -"Hibernate es un proyecto de Código Abierto Profesional y es un componente " -"crítico de la suite de productos de JBoss Enterprise Middleware System " -"(JEMS)." +#. Tag: para +#: preface.xml:160 +#, no-c-format +msgid "" +"Trying your hand at fixing some bugs or implementing enhancements. Again, " +"see http://hibernate." +"org/issuetracker.html details." +msgstr "" + +#. Tag: para +#: preface.xml:167 +#, no-c-format +msgid "" +"http://hibernate.org/" +"community.html list a few ways to engage in the community." +msgstr "" + +#. Tag: para +#: preface.xml:172 +#, no-c-format +msgid "" +"There are forums for users to ask questions and receive help from the " +"community." +msgstr "" + +#. Tag: para +#: preface.xml:177 +#, no-c-format +msgid "" +"There are also IRC channels for both user and developer discussions." +msgstr "" + +#. Tag: para +#: preface.xml:186 +#, no-c-format +msgid "" +"Helping improve or translate this documentation. Contact us on the developer " +"mailing list if you have interest." +msgstr "" + +#. Tag: para +#: preface.xml:192 +#, no-c-format +msgid "Evangelizing Hibernate within your organization." +msgstr "" + +#~ msgid "" +#~ "If you have questions, use the user forum linked on the Hibernate " +#~ "website. We also provide a JIRA issue tracking 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 "" +#~ "Si tiene alguna pregunta, diríjase al sitio web de Hibernate en donde " +#~ "encontrará un enlace al foro de usuarios. También proporcionamos un " +#~ "sistema de localización para reportes de errores JIRA y solicitud de " +#~ "funciones. Si está interesado en el desarrollo de Hibernate, únase a la " +#~ "lista de correo de los desarrolladores. Si le interesa traducir esta " +#~ "documentación a su propio idioma, contáctenos en la lista de correo de " +#~ "los desarrolladores." + +#~ 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 "" +#~ "JBoss Inc. proporciona soporte para desarrollo comercial, soporte para " +#~ "producción y entrenamiento (vea http://www.hibernate.org/" +#~ "SupportTraining/). Hibernate es un proyecto de Código Abierto Profesional " +#~ "y es un componente crítico de la suite de productos de JBoss Enterprise " +#~ "Middleware System (JEMS)." diff --git a/documentation/manual/src/main/docbook/es-ES/content/query_sql.po b/documentation/manual/src/main/docbook/es-ES/content/query_sql.po index 607318546c..6bc53dffee 100644 --- a/documentation/manual/src/main/docbook/es-ES/content/query_sql.po +++ b/documentation/manual/src/main/docbook/es-ES/content/query_sql.po @@ -14,7 +14,7 @@ msgid "" msgstr "" "Project-Id-Version: query_sql\n" "Report-Msgid-Bugs-To: http://bugs.kde.org\n" -"POT-Creation-Date: 2010-03-12T00:03:47\n" +"POT-Creation-Date: 2010-07-20 21:02+0000\n" "PO-Revision-Date: 2010-03-17 12:28+1000\n" "Last-Translator: Angela Garcia \n" "Language-Team: \n" @@ -24,11 +24,13 @@ msgstr "" "X-Generator: KBabel 1.11.4\n" #. Tag: title +#: query_sql.xml:31 #, no-c-format msgid "Native SQL" msgstr "SQL Nativo" #. Tag: para +#: query_sql.xml:33 #, no-c-format msgid "" "You can also express queries in the native SQL dialect of your database. " @@ -44,6 +46,7 @@ msgstr "" "migración limpia desde una aplicación basada en SQL/JDBC a Hibernate." #. Tag: para +#: query_sql.xml:39 #, no-c-format msgid "" "Hibernate3 allows you to specify handwritten SQL, including stored " @@ -54,11 +57,13 @@ msgstr "" "y load." #. Tag: title +#: query_sql.xml:43 #, no-c-format msgid "Using a SQLQuery" msgstr "Uso de una SQLQuery" #. Tag: para +#: query_sql.xml:45 #, no-c-format msgid "" "Execution of native SQL queries is controlled via the SQLQueryResultSetMetadata, or " @@ -106,22 +123,36 @@ msgstr "" "ResultSetMetadata o simplemente para ser más explícito en " "lo que se devuelve se puede utilizar addScalar():" +#. Tag: programlisting +#: query_sql.xml:67 +#, no-c-format +msgid "" +"sess.createSQLQuery(\"SELECT * FROM CATS\")\n" +" .addScalar(\"ID\", Hibernate.LONG)\n" +" .addScalar(\"NAME\", Hibernate.STRING)\n" +" .addScalar(\"BIRTHDATE\", Hibernate.DATE)" +msgstr "" + #. Tag: para +#: query_sql.xml:69 query_sql.xml:116 query_sql.xml:197 query_sql.xml:349 #, no-c-format msgid "This query specified:" msgstr "Se especifica esta consulta:" #. Tag: para +#: query_sql.xml:73 query_sql.xml:120 query_sql.xml:353 #, no-c-format msgid "the SQL query string" msgstr "la cadena de consulta SQL" #. Tag: para +#: query_sql.xml:77 #, no-c-format msgid "the columns and types to return" msgstr "las columnas y tipos que se devuelven" #. Tag: para +#: query_sql.xml:81 #, no-c-format msgid "" "This will return Object arrays, but now it will not use " @@ -139,6 +170,7 @@ msgstr "" "* y pueda devolver más de las tres columnas enumeradas." #. Tag: para +#: query_sql.xml:89 #, no-c-format msgid "" "It is possible to leave out the type information for all or some of the " @@ -147,7 +179,18 @@ msgstr "" "Es posible dejar afuera la información de tipo para todos o algunos de los " "escalares." +#. Tag: programlisting +#: query_sql.xml:92 +#, no-c-format +msgid "" +"sess.createSQLQuery(\"SELECT * FROM CATS\")\n" +" .addScalar(\"ID\", Hibernate.LONG)\n" +" .addScalar(\"NAME\")\n" +" .addScalar(\"BIRTHDATE\")" +msgstr "" + #. Tag: para +#: query_sql.xml:94 #, no-c-format msgid "" "This is essentially the same query as before, but now " @@ -160,6 +203,7 @@ msgstr "" "explícitamente." #. Tag: para +#: query_sql.xml:99 #, no-c-format msgid "" "How the java.sql.Types returned from ResultSetMetaData is mapped to " @@ -174,11 +218,13 @@ msgstr "" "literal> en el dialecto." #. Tag: title +#: query_sql.xml:107 #, no-c-format msgid "Entity queries" msgstr "Consultas de entidades" #. Tag: para +#: query_sql.xml:109 #, no-c-format msgid "" "The above queries were all about returning scalar values, basically " @@ -191,12 +237,23 @@ msgstr "" "siguiente muestra como obtener los objetos entidades desde una consulta sql " "nativa por medio de addEntity()." +#. Tag: programlisting +#: query_sql.xml:114 +#, no-c-format +msgid "" +"sess.createSQLQuery(\"SELECT * FROM CATS\").addEntity(Cat.class);\n" +"sess.createSQLQuery(\"SELECT ID, NAME, BIRTHDATE FROM CATS\").addEntity(Cat." +"class);" +msgstr "" + #. Tag: para +#: query_sql.xml:124 #, no-c-format msgid "the entity returned by the query" msgstr "la entidad devuelta por la consulta" #. Tag: para +#: query_sql.xml:128 #, no-c-format msgid "" "Assuming that Cat is mapped as a class with the columns ID, NAME and " @@ -208,6 +265,7 @@ msgstr "" "en donde cada elemento es una entidad Cat." #. Tag: para +#: query_sql.xml:132 #, no-c-format msgid "" "If the entity is mapped with a many-to-one to another " @@ -225,17 +283,28 @@ msgstr "" "explícitos así como lo muestra el siguiente ejemplo para una many-" "to-one a un Dog:" +#. Tag: programlisting +#: query_sql.xml:140 +#, no-c-format +msgid "" +"sess.createSQLQuery(\"SELECT ID, NAME, BIRTHDATE, DOG_ID FROM CATS\")." +"addEntity(Cat.class);" +msgstr "" + #. Tag: para +#: query_sql.xml:142 #, no-c-format msgid "This will allow cat.getDog() to function properly." msgstr "Esto permitirá que cat.getDog() funcione apropiadamente." #. Tag: title +#: query_sql.xml:146 #, no-c-format msgid "Handling associations and collections" msgstr "Manejo de asociaciones y colecciones" #. Tag: para +#: query_sql.xml:148 #, no-c-format msgid "" "It is possible to eagerly join in the Dog to avoid the " @@ -248,7 +317,18 @@ msgstr "" "medio del método addJoin(), el cual le permite unirse en " "una asociación o colección." +#. Tag: programlisting +#: query_sql.xml:153 +#, no-c-format +msgid "" +"sess.createSQLQuery(\"SELECT c.ID, NAME, BIRTHDATE, DOG_ID, D_ID, D_NAME " +"FROM CATS c, DOGS d WHERE c.DOG_ID = d.D_ID\")\n" +" .addEntity(\"cat\", Cat.class)\n" +" .addJoin(\"cat.dog\");" +msgstr "" + #. Tag: para +#: query_sql.xml:155 #, no-c-format msgid "" "In this example, the returned Cat's will have their " @@ -266,7 +346,18 @@ msgstr "" "Cat tuviese en lugar un Dog uno-a-" "muchos." +#. Tag: programlisting +#: query_sql.xml:163 +#, no-c-format +msgid "" +"sess.createSQLQuery(\"SELECT ID, NAME, BIRTHDATE, D_ID, D_NAME, CAT_ID FROM " +"CATS c, DOGS d WHERE c.ID = d.CAT_ID\")\n" +" .addEntity(\"cat\", Cat.class)\n" +" .addJoin(\"cat.dogs\");" +msgstr "" + #. Tag: para +#: query_sql.xml:165 #, no-c-format msgid "" "At this stage you are reaching the limits of what is possible with native " @@ -281,11 +372,13 @@ msgstr "" "suficientes los nombres de las columnas/alias predeterminados." #. Tag: title +#: query_sql.xml:173 #, no-c-format msgid "Returning multiple entities" msgstr "Devolución de entidades múltiples" #. Tag: para +#: query_sql.xml:175 #, no-c-format msgid "" "Until now, the result set column names are assumed to be the same as the " @@ -300,6 +393,7 @@ msgstr "" "aparecer en más de una tabla." #. Tag: para +#: query_sql.xml:180 #, no-c-format msgid "" "Column alias injection is needed in the following query (which most likely " @@ -308,7 +402,18 @@ msgstr "" "Se necesita una inyección de alias en las columnas en la siguiente consulta " "(que con mucha probabilidad fallará):" +#. Tag: programlisting +#: query_sql.xml:183 +#, no-c-format +msgid "" +"sess.createSQLQuery(\"SELECT c.*, m.* FROM CATS c, CATS m WHERE c.MOTHER_ID " +"= c.ID\")\n" +" .addEntity(\"cat\", Cat.class)\n" +" .addEntity(\"mother\", Cat.class)" +msgstr "" + #. Tag: para +#: query_sql.xml:185 #, no-c-format msgid "" "The query was intended to return two Cat instances per row: a cat and its " @@ -327,11 +432,24 @@ msgstr "" "los mapeos (\"IDENTIFICACION\" y \"NOMBRE\")." #. Tag: para +#: query_sql.xml:192 #, no-c-format msgid "The following form is not vulnerable to column name duplication:" -msgstr "La siguiente forma no es vulnerable a la duplicación de nombres de columnas:" +msgstr "" +"La siguiente forma no es vulnerable a la duplicación de nombres de columnas:" + +#. Tag: programlisting +#: query_sql.xml:195 +#, no-c-format +msgid "" +"sess.createSQLQuery(\"SELECT {cat.*}, {mother.*} FROM CATS c, CATS m WHERE " +"c.MOTHER_ID = c.ID\")\n" +" .addEntity(\"cat\", Cat.class)\n" +" .addEntity(\"mother\", Cat.class)" +msgstr "" #. Tag: para +#: query_sql.xml:201 #, no-c-format msgid "" "the SQL query string, with placeholders for Hibernate to inject column " @@ -341,11 +459,13 @@ msgstr "" "inserte alias de columnas" #. Tag: para +#: query_sql.xml:206 #, no-c-format msgid "the entities returned by the query" msgstr "las entidades devueltas por la consulta" #. Tag: para +#: query_sql.xml:210 #, no-c-format msgid "" "The {cat.*} and {mother.*} notation used above is a shorthand for \"all " @@ -365,12 +485,28 @@ msgstr "" "tabla diferente (cat_log) a la declarada en los meta datos de mapeo. " "Inclusive puede utilizar los alias de propiedad en la cláusula where." +#. Tag: programlisting +#: query_sql.xml:219 +#, no-c-format +msgid "" +"String sql = \"SELECT ID as {c.id}, NAME as {c.name}, \" +\n" +" \"BIRTHDATE as {c.birthDate}, MOTHER_ID as {c.mother}, {mother.*} " +"\" +\n" +" \"FROM CAT_LOG c, CAT_LOG m WHERE {c.mother} = c.ID\";\n" +"\n" +"List loggedCats = sess.createSQLQuery(sql)\n" +" .addEntity(\"cat\", Cat.class)\n" +" .addEntity(\"mother\", Cat.class).list()" +msgstr "" + #. Tag: title +#: query_sql.xml:222 #, no-c-format msgid "Alias and property references" msgstr "Referencias de propiedad y alias" #. Tag: para +#: query_sql.xml:224 #, no-c-format msgid "" "In most cases the above alias injection is needed. For queries relating to " @@ -385,6 +521,7 @@ msgstr "" "apropiados." #. Tag: para +#: query_sql.xml:229 #, no-c-format msgid "" "The following table shows the different ways you can use the alias " @@ -398,180 +535,213 @@ msgstr "" "se utilice." #. Tag: title +#: query_sql.xml:235 #, no-c-format msgid "Alias injection names" msgstr "Nombres con inyección alias" #. Tag: entry +#: query_sql.xml:246 #, no-c-format msgid "Description" msgstr "Descripción" #. Tag: entry +#: query_sql.xml:248 #, no-c-format msgid "Syntax" msgstr "Sintaxis" #. Tag: entry +#: query_sql.xml:250 #, no-c-format msgid "Example" msgstr "Ejemplo" #. Tag: entry +#: query_sql.xml:256 #, no-c-format msgid "A simple property" msgstr "Una propiedad simple" -#. Tag: entry -#, no-c-format -msgid "{[aliasname].[propertyname]" +#. Tag: literal +#: query_sql.xml:258 +#, fuzzy, no-c-format +msgid "{[aliasname].[propertyname]" msgstr "{[aliasname].[propertyname]" -#. Tag: entry -#, no-c-format -msgid "A_NAME as {item.name}" +#. Tag: literal +#: query_sql.xml:260 +#, fuzzy, no-c-format +msgid "A_NAME as {item.name}" msgstr "A_NAME as {item.name}" #. Tag: entry +#: query_sql.xml:264 #, no-c-format msgid "A composite property" msgstr "Una propiedad compuesta" -#. Tag: entry -#, no-c-format -msgid "{[aliasname].[componentname].[propertyname]}" +#. Tag: literal +#: query_sql.xml:266 +#, fuzzy, no-c-format +msgid "{[aliasname].[componentname].[propertyname]}" msgstr "{[aliasname].[componentname].[propertyname]}" -#. Tag: entry -#, no-c-format -msgid "" -"CURRENCY as {item.amount.currency}, VALUE as {item.amount.value}" +#. Tag: literal +#: query_sql.xml:268 +#, fuzzy, no-c-format +msgid "CURRENCY as {item.amount.currency}, VALUE as {item.amount.value}" msgstr "" "CURRENCY as {item.amount.currency}, VALUE as {item.amount.value}" #. Tag: entry +#: query_sql.xml:273 #, no-c-format msgid "Discriminator of an entity" msgstr "Discriminador de una entidad" -#. Tag: entry -#, no-c-format -msgid "{[aliasname].class}" +#. Tag: literal +#: query_sql.xml:275 +#, fuzzy, no-c-format +msgid "{[aliasname].class}" msgstr "{[aliasname].class}" -#. Tag: entry -#, no-c-format -msgid "DISC as {item.class}" +#. Tag: literal +#: query_sql.xml:277 +#, fuzzy, no-c-format +msgid "DISC as {item.class}" msgstr "DISC as {item.class}" #. Tag: entry +#: query_sql.xml:281 #, no-c-format msgid "All properties of an entity" msgstr "Todas las propiedades de una entidad" -#. Tag: entry -#, no-c-format -msgid "{[aliasname].*}" +#. Tag: literal +#: query_sql.xml:283 query_sql.xml:331 +#, fuzzy, no-c-format +msgid "{[aliasname].*}" msgstr "{[aliasname].*}" -#. Tag: entry +#. Tag: literal +#: query_sql.xml:285 #, no-c-format -msgid "{item.*}" -msgstr "{item.*}" +msgid "{item.*}" +msgstr "" #. Tag: entry +#: query_sql.xml:289 #, no-c-format msgid "A collection key" msgstr "Una clave de colección" -#. Tag: entry -#, no-c-format -msgid "{[aliasname].key}" +#. Tag: literal +#: query_sql.xml:291 +#, fuzzy, no-c-format +msgid "{[aliasname].key}" msgstr "{[aliasname].key}" -#. Tag: entry -#, no-c-format -msgid "ORGID as {coll.key}" +#. Tag: literal +#: query_sql.xml:293 +#, fuzzy, no-c-format +msgid "ORGID as {coll.key}" msgstr "ORGID as {coll.key}" #. Tag: entry +#: query_sql.xml:297 #, no-c-format msgid "The id of an collection" msgstr "La identificación -id- de una colección" -#. Tag: entry -#, no-c-format -msgid "{[aliasname].id}" +#. Tag: literal +#: query_sql.xml:299 +#, fuzzy, no-c-format +msgid "{[aliasname].id}" msgstr "{[aliasname].id}" -#. Tag: entry -#, no-c-format -msgid "EMPID as {coll.id}" +#. Tag: literal +#: query_sql.xml:301 +#, fuzzy, no-c-format +msgid "EMPID as {coll.id}" msgstr "EMPID as {coll.id}" #. Tag: entry +#: query_sql.xml:305 #, no-c-format msgid "The element of an collection" msgstr "El elemento de una colección" -#. Tag: entry -#, no-c-format -msgid "{[aliasname].element}" +#. Tag: literal +#: query_sql.xml:307 +#, fuzzy, no-c-format +msgid "{[aliasname].element}" msgstr "{[aliasname].element}" -#. Tag: entry -#, no-c-format -msgid "XID as {coll.element}" +#. Tag: literal +#: query_sql.xml:309 +#, fuzzy, no-c-format +msgid "XID as {coll.element}" msgstr "XID as {coll.element}" #. Tag: entry +#: query_sql.xml:313 #, no-c-format msgid "property of the element in the collection" msgstr "propiedad del elemento en la colección " -#. Tag: entry -#, no-c-format -msgid "{[aliasname].element.[propertyname]}" +#. Tag: literal +#: query_sql.xml:315 +#, fuzzy, no-c-format +msgid "{[aliasname].element.[propertyname]}" msgstr "{[aliasname].element.[propertyname]}" -#. Tag: entry -#, no-c-format -msgid "NAME as {coll.element.name}" +#. Tag: literal +#: query_sql.xml:317 +#, fuzzy, no-c-format +msgid "NAME as {coll.element.name}" msgstr "NAME as {coll.element.name}" #. Tag: entry +#: query_sql.xml:321 #, no-c-format msgid "All properties of the element in the collection" msgstr "Todas las propiedades del elemeto en la colección" -#. Tag: entry -#, no-c-format -msgid "{[aliasname].element.*}" +#. Tag: literal +#: query_sql.xml:323 +#, fuzzy, no-c-format +msgid "{[aliasname].element.*}" msgstr "{[aliasname].element.*}" -#. Tag: entry -#, no-c-format -msgid "{coll.element.*}" +#. Tag: literal +#: query_sql.xml:325 +#, fuzzy, no-c-format +msgid "{coll.element.*}" msgstr "{coll.element.*}" #. Tag: entry +#: query_sql.xml:329 #, no-c-format msgid "All properties of the collection" msgstr "Todas las propiedades de la colección " -#. Tag: entry +#. Tag: literal +#: query_sql.xml:333 #, no-c-format -msgid "{coll.*}" -msgstr "{coll.*}" +msgid "{coll.*}" +msgstr "" #. Tag: title +#: query_sql.xml:342 #, no-c-format msgid "Returning non-managed entities" msgstr "Devolución de entidades no-administradas" #. Tag: para +#: query_sql.xml:344 #, no-c-format msgid "" "It is possible to apply a ResultTransformer to native SQL queries, allowing " @@ -580,12 +750,22 @@ msgstr "" "Es posible aplicar un ResultTransformer para consultas SQL nativas, " "permitiéndole retornar entidades no-administradas." +#. Tag: programlisting +#: query_sql.xml:347 +#, no-c-format +msgid "" +"sess.createSQLQuery(\"SELECT NAME, BIRTHDATE FROM CATS\")\n" +" .setResultTransformer(Transformers.aliasToBean(CatDTO.class))" +msgstr "" + #. Tag: para +#: query_sql.xml:357 #, no-c-format msgid "a result transformer" msgstr "un transformador de resultado" #. Tag: para +#: query_sql.xml:361 #, no-c-format msgid "" "The above query will return a list of CatDTO which has " @@ -597,11 +777,13 @@ msgstr "" "NACIMIENTO en su propiedades o campos correspondientes." #. Tag: title +#: query_sql.xml:367 #, no-c-format msgid "Handling inheritance" msgstr "Manejo de herencias" #. Tag: para +#: query_sql.xml:369 #, no-c-format msgid "" "Native SQL queries which query for entities that are mapped as part of an " @@ -613,35 +795,90 @@ msgstr "" "para la clase base y todas sus subclases." #. Tag: title +#: query_sql.xml:375 #, no-c-format msgid "Parameters" msgstr "Parámetros" #. Tag: para +#: query_sql.xml:377 #, no-c-format msgid "Native SQL queries support positional as well as named parameters:" msgstr "" "Las consultas SQL nativas soportan parámetros nombrados así como " "posicionales:" +#. Tag: programlisting +#: query_sql.xml:380 +#, no-c-format +msgid "" +"Query query = sess.createSQLQuery(\"SELECT * FROM CATS WHERE NAME like ?\")." +"addEntity(Cat.class);\n" +"List pusList = query.setString(0, \"Pus%\").list();\n" +" \n" +"query = sess.createSQLQuery(\"SELECT * FROM CATS WHERE NAME like :name\")." +"addEntity(Cat.class);\n" +"List pusList = query.setString(\"name\", \"Pus%\").list();" +msgstr "" + #. Tag: title +#: query_sql.xml:385 #, no-c-format msgid "Named SQL queries" msgstr "Consultas SQL nombradas" #. Tag: para -#, no-c-format +#: query_sql.xml:387 +#, fuzzy, no-c-format msgid "" -"Named SQL queries can be defined in the mapping document and called in " -"exactly the same way as a named HQL query. In this case, you do " -"not need to call addEntity()." +"Named SQL queries can also be defined in the mapping document and called in " +"exactly the same way as a named HQL query (see ). In this case, you do not " +"need to call addEntity()." msgstr "" "Las consultas SQL nombradas se pueden definir en el documento de mapeo y se " "pueden llamar de la misma manera que una consulta HQL nombrada. En este " "caso, no necesitamos llamar a addEntity()." +#. Tag: title +#: query_sql.xml:394 +#, no-c-format +msgid "Named sql query using the <sql-query> maping element" +msgstr "" + +#. Tag: programlisting +#: query_sql.xml:397 +#, no-c-format +msgid "" +"<sql-query name=\"persons\">\n" +" <return alias=\"person\" class=\"eg.Person\"/>\n" +" SELECT person.NAME AS {person.name},\n" +" person.AGE AS {person.age},\n" +" person.SEX AS {person.sex}\n" +" FROM PERSON person\n" +" WHERE person.NAME LIKE :namePattern\n" +"</sql-query>" +msgstr "" + +#. Tag: title +#: query_sql.xml:401 +#, no-c-format +msgid "Execution of a named query" +msgstr "" + +#. Tag: programlisting +#: query_sql.xml:403 +#, no-c-format +msgid "" +"List people = sess.getNamedQuery(\"persons\")\n" +" .setString(\"namePattern\", namePattern)\n" +" .setMaxResults(50)\n" +" .list();" +msgstr "" + #. Tag: para +#: query_sql.xml:406 #, no-c-format msgid "" "The <return-join> element is use to join " @@ -652,7 +889,36 @@ msgstr "" "asociaciones y el elemento <load-collection> se usa " "para definir consultas, las cuales dan inicio a colecciones." +#. Tag: title +#: query_sql.xml:411 +#, no-c-format +msgid "Named sql query with association" +msgstr "" + +#. Tag: programlisting +#: query_sql.xml:413 +#, no-c-format +msgid "" +"<sql-query name=\"personsWith\">\n" +" <return alias=\"person\" class=\"eg.Person\"/>\n" +" <return-join alias=\"address\" property=\"person.mailingAddress\"/" +">\n" +" SELECT person.NAME AS {person.name},\n" +" person.AGE AS {person.age},\n" +" person.SEX AS {person.sex},\n" +" address.STREET AS {address.street},\n" +" address.CITY AS {address.city},\n" +" address.STATE AS {address.state},\n" +" address.ZIP AS {address.zip}\n" +" FROM PERSON person\n" +" JOIN ADDRESS address\n" +" ON person.ID = address.PERSON_ID AND address.TYPE='MAILING'\n" +" WHERE person.NAME LIKE :namePattern\n" +"</sql-query>" +msgstr "" + #. Tag: para +#: query_sql.xml:416 #, no-c-format msgid "" "A named SQL query may return a scalar value. You must declare the column " @@ -663,7 +929,27 @@ msgstr "" "declarar el alias de la columna y el tipo de Hibernate utilizando el " "elemento <return-scalar>:" +#. Tag: title +#: query_sql.xml:421 +#, no-c-format +msgid "Named query returning a scalar" +msgstr "" + +#. Tag: programlisting +#: query_sql.xml:423 +#, no-c-format +msgid "" +"<sql-query name=\"mySqlQuery\">\n" +" <return-scalar column=\"name\" type=\"string\"/>\n" +" <return-scalar column=\"age\" type=\"long\"/>\n" +" SELECT p.NAME AS name, \n" +" p.AGE AS age,\n" +" FROM PERSON p WHERE p.NAME LIKE 'Hiber%'\n" +"</sql-query>" +msgstr "" + #. Tag: para +#: query_sql.xml:426 #, no-c-format msgid "" "You can externalize the resultset mapping information in a <" @@ -676,7 +962,39 @@ msgstr "" "reutilizarlos a través de consultas nombradas o por medio de la API " "setResultSetMapping()." +#. Tag: title +#: query_sql.xml:432 +#, no-c-format +msgid "<resultset> mapping used to externalize mapping information" +msgstr "" + +#. Tag: programlisting +#: query_sql.xml:435 +#, no-c-format +msgid "" +"<resultset name=\"personAddress\">\n" +" <return alias=\"person\" class=\"eg.Person\"/>\n" +" <return-join alias=\"address\" property=\"person.mailingAddress\"/" +">\n" +"</resultset>\n" +"\n" +"<sql-query name=\"personsWith\" resultset-ref=\"personAddress\">\n" +" SELECT person.NAME AS {person.name},\n" +" person.AGE AS {person.age},\n" +" person.SEX AS {person.sex},\n" +" address.STREET AS {address.street},\n" +" address.CITY AS {address.city},\n" +" address.STATE AS {address.state},\n" +" address.ZIP AS {address.zip}\n" +" FROM PERSON person\n" +" JOIN ADDRESS address\n" +" ON person.ID = address.PERSON_ID AND address.TYPE='MAILING'\n" +" WHERE person.NAME LIKE :namePattern\n" +"</sql-query>" +msgstr "" + #. Tag: para +#: query_sql.xml:438 #, no-c-format msgid "" "You can, alternatively, use the resultset mapping information in your hbm " @@ -686,6 +1004,332 @@ msgstr "" "en sus archivos hbm directamente en código java." #. Tag: title +#: query_sql.xml:442 +#, no-c-format +msgid "Programmatically specifying the result mapping information" +msgstr "" + +#. Tag: programlisting +#: query_sql.xml:445 +#, no-c-format +msgid "" +"List cats = sess.createSQLQuery(\n" +" \"select {cat.*}, {kitten.*} from cats cat, cats kitten where kitten." +"mother = cat.id\"\n" +" )\n" +" .setResultSetMapping(\"catAndKitten\")\n" +" .list();" +msgstr "" + +#. Tag: para +#: query_sql.xml:448 +#, no-c-format +msgid "" +"So far we have only looked at externalizing SQL queries using Hibernate " +"mapping files. The same concept is also available with anntations and is " +"called named native queries. You can use @NamedNativeQuery (@NamedNativeQueries) in conjunction with " +"@SqlResultSetMapping (@SqlResultSetMappings). Like @NamedQuery, " +"@NamedNativeQuery and @SqlResultSetMapping can be defined at class level, but their scope is global to the " +"application. Lets look at a view examples." +msgstr "" + +#. Tag: para +#: query_sql.xml:460 +#, no-c-format +msgid "" +"shows how a resultSetMapping parameter is defined in " +"@NamedNativeQuery. It represents the name of a defined " +"@SqlResultSetMapping. The resultset mapping declares the " +"entities retrieved by this native query. Each field of the entity is bound " +"to an SQL alias (or column name). All fields of the entity including the " +"ones of subclasses and the foreign key columns of related entities have to " +"be present in the SQL query. Field definitions are optional provided that " +"they map to the same column name as the one declared on the class property. " +"In the example 2 entities, Night and Area, are returned and each property is declared and associated to a " +"column name, actually the column name retrieved by the query." +msgstr "" + +#. Tag: para +#: query_sql.xml:475 +#, no-c-format +msgid "" +"In the result set " +"mapping is implicit. We only describe the entity class of the result set " +"mapping. The property / column mappings is done using the entity mapping " +"values. In this case the model property is bound to the model_txt column." +msgstr "" + +#. Tag: para +#: query_sql.xml:481 +#, no-c-format +msgid "" +"Finally, if the association to a related entity involve a composite primary " +"key, a @FieldResult element should be used for each " +"foreign key column. The @FieldResult name is composed of " +"the property name for the relationship, followed by a dot (\".\"), followed " +"by the name or the field or property of the primary key. This can be seen in " +"." +msgstr "" + +#. Tag: title +#: query_sql.xml:490 +#, no-c-format +msgid "" +"Named SQL query using @NamedNativeQuery together with " +"@SqlResultSetMapping" +msgstr "" + +#. Tag: programlisting +#: query_sql.xml:493 +#, no-c-format +msgid "" +"@NamedNativeQuery(name=\"night&area\", query=\"select night.id nid, " +"night.night_duration, \"\n" +" + \" night.night_date, area.id aid, night.area_id, area.name \"\n" +" + \"from Night night, Area area where night.area_id = area.id\", \n" +" resultSetMapping=\"joinMapping\")\n" +"@SqlResultSetMapping(name=\"joinMapping\", entities={\n" +" @EntityResult(entityClass=Night.class, fields = {\n" +" @FieldResult(name=\"id\", column=\"nid\"),\n" +" @FieldResult(name=\"duration\", column=\"night_duration\"),\n" +" @FieldResult(name=\"date\", column=\"night_date\"),\n" +" @FieldResult(name=\"area\", column=\"area_id\"),\n" +" discriminatorColumn=\"disc\"\n" +" }),\n" +" @EntityResult(entityClass=org.hibernate.test.annotations.query.Area." +"class, fields = {\n" +" @FieldResult(name=\"id\", column=\"aid\"),\n" +" @FieldResult(name=\"name\", column=\"name\")\n" +" })\n" +" }\n" +")" +msgstr "" + +#. Tag: title +#: query_sql.xml:497 +#, no-c-format +msgid "Implicit result set mapping" +msgstr "" + +#. Tag: programlisting +#: query_sql.xml:499 +#, no-c-format +msgid "" +"@Entity\n" +"@SqlResultSetMapping(name=\"implicit\",\n" +" entities=@EntityResult(entityClass=SpaceShip.class))\n" +"@NamedNativeQuery(name=\"implicitSample\", \n" +" query=\"select * from SpaceShip\", \n" +" resultSetMapping=\"implicit\")\n" +"public class SpaceShip {\n" +" private String name;\n" +" private String model;\n" +" private double speed;\n" +"\n" +" @Id\n" +" public String getName() {\n" +" return name;\n" +" }\n" +"\n" +" public void setName(String name) {\n" +" this.name = name;\n" +" }\n" +"\n" +" @Column(name=\"model_txt\")\n" +" public String getModel() {\n" +" return model;\n" +" }\n" +"\n" +" public void setModel(String model) {\n" +" this.model = model;\n" +" }\n" +"\n" +" public double getSpeed() {\n" +" return speed;\n" +" }\n" +"\n" +" public void setSpeed(double speed) {\n" +" this.speed = speed;\n" +" }\n" +"}" +msgstr "" + +#. Tag: title +#: query_sql.xml:503 +#, no-c-format +msgid "Using dot notation in @FieldResult for specifying associations" +msgstr "" + +#. Tag: programlisting +#: query_sql.xml:506 +#, no-c-format +msgid "" +"@Entity\n" +"@SqlResultSetMapping(name=\"compositekey\",\n" +" entities=@EntityResult(entityClass=SpaceShip.class,\n" +" fields = {\n" +" @FieldResult(name=\"name\", column = \"name\"),\n" +" @FieldResult(name=\"model\", column = \"model\"),\n" +" @FieldResult(name=\"speed\", column = \"speed\"),\n" +" @FieldResult(name=\"captain.firstname\", column = " +"\"firstn\"),\n" +" @FieldResult(name=\"captain.lastname\", column = \"lastn" +"\"),\n" +" @FieldResult(name=\"dimensions.length\", column = " +"\"length\"),\n" +" @FieldResult(name=\"dimensions.width\", column = \"width" +"\")\n" +" }),\n" +" columns = { @ColumnResult(name = \"surface\"),\n" +" @ColumnResult(name = \"volume\") } )\n" +"\n" +"@NamedNativeQuery(name=\"compositekey\",\n" +" query=\"select name, model, speed, lname as lastn, fname as firstn, " +"length, width, length * width as surface from SpaceShip\", \n" +" resultSetMapping=\"compositekey\")\n" +"} )\n" +"public class SpaceShip {\n" +" private String name;\n" +" private String model;\n" +" private double speed;\n" +" private Captain captain;\n" +" private Dimensions dimensions;\n" +"\n" +" @Id\n" +" public String getName() {\n" +" return name;\n" +" }\n" +"\n" +" public void setName(String name) {\n" +" this.name = name;\n" +" }\n" +"\n" +" @ManyToOne(fetch= FetchType.LAZY)\n" +" @JoinColumns( {\n" +" @JoinColumn(name=\"fname\", referencedColumnName = \"firstname" +"\"),\n" +" @JoinColumn(name=\"lname\", referencedColumnName = \"lastname" +"\")\n" +" } )\n" +" public Captain getCaptain() {\n" +" return captain;\n" +" }\n" +"\n" +" public void setCaptain(Captain captain) {\n" +" this.captain = captain;\n" +" }\n" +"\n" +" public String getModel() {\n" +" return model;\n" +" }\n" +"\n" +" public void setModel(String model) {\n" +" this.model = model;\n" +" }\n" +"\n" +" public double getSpeed() {\n" +" return speed;\n" +" }\n" +"\n" +" public void setSpeed(double speed) {\n" +" this.speed = speed;\n" +" }\n" +"\n" +" public Dimensions getDimensions() {\n" +" return dimensions;\n" +" }\n" +"\n" +" public void setDimensions(Dimensions dimensions) {\n" +" this.dimensions = dimensions;\n" +" }\n" +"}\n" +"\n" +"@Entity\n" +"@IdClass(Identity.class)\n" +"public class Captain implements Serializable {\n" +" private String firstname;\n" +" private String lastname;\n" +"\n" +" @Id\n" +" public String getFirstname() {\n" +" return firstname;\n" +" }\n" +"\n" +" public void setFirstname(String firstname) {\n" +" this.firstname = firstname;\n" +" }\n" +"\n" +" @Id\n" +" public String getLastname() {\n" +" return lastname;\n" +" }\n" +"\n" +" public void setLastname(String lastname) {\n" +" this.lastname = lastname;\n" +" }\n" +"}" +msgstr "" + +#. Tag: para +#: query_sql.xml:510 +#, no-c-format +msgid "" +"If you retrieve a single entity using the default mapping, you can specify " +"the resultClass attribute instead of " +"resultSetMapping:" +msgstr "" + +#. Tag: programlisting +#: query_sql.xml:514 +#, no-c-format +msgid "" +"@NamedNativeQuery(name=\"implicitSample\", query=\"select * from SpaceShip" +"\", resultClass=SpaceShip.class)\n" +"public class SpaceShip {" +msgstr "" + +#. Tag: para +#: query_sql.xml:517 +#, no-c-format +msgid "" +"In some of your native queries, you'll have to return scalar values, for " +"example when building report queries. You can map them in the " +"@SqlResultsetMapping through @ColumnResult. You actually can even mix, entities and scalar returns in the same " +"native query (this is probably not that common though)." +msgstr "" + +#. Tag: title +#: query_sql.xml:525 +#, no-c-format +msgid "Scalar values via @ColumnResult" +msgstr "" + +#. Tag: programlisting +#: query_sql.xml:527 +#, no-c-format +msgid "" +"@SqlResultSetMapping(name=\"scalar\", columns=@ColumnResult(name=\"dimension" +"\"))\n" +"@NamedNativeQuery(name=\"scalar\", query=\"select length*width as dimension " +"from SpaceShip\", resultSetMapping=\"scalar\")" +msgstr "" + +#. Tag: para +#: query_sql.xml:530 +#, no-c-format +msgid "" +"An other query hint specific to native queries has been introduced: " +"org.hibernate.callable which can be true or false " +"depending on whether the query is a stored procedure or not." +msgstr "" + +#. Tag: title +#: query_sql.xml:535 #, no-c-format msgid "Using return-property to explicitly specify column/alias names" msgstr "" @@ -693,6 +1337,7 @@ msgstr "" "nombres de columnas/alias" #. Tag: para +#: query_sql.xml:538 #, no-c-format msgid "" "You can explicitly tell Hibernate what column aliases to use with " @@ -704,7 +1349,25 @@ msgstr "" "utilizar la sintaxis {} para dejar que Hibernate inyecte " "sus propios alias. Por ejemplo:" +#. Tag: programlisting +#: query_sql.xml:543 +#, no-c-format +msgid "" +"<sql-query name=\"mySqlQuery\">\n" +" <return alias=\"person\" class=\"eg.Person\">\n" +" <return-property name=\"name\" column=\"myName\"/>\n" +" <return-property name=\"age\" column=\"myAge\"/>\n" +" <return-property name=\"sex\" column=\"mySex\"/>\n" +" </return>\n" +" SELECT person.NAME AS myName,\n" +" person.AGE AS myAge,\n" +" person.SEX AS mySex,\n" +" FROM PERSON person WHERE person.NAME LIKE :name\n" +"</sql-query>" +msgstr "" + #. Tag: para +#: query_sql.xml:545 #, no-c-format msgid "" "<return-property> also works with multiple columns. " @@ -716,7 +1379,29 @@ msgstr "" "literal>, la cual no puede permitir control muy detallado de propiedades " "multi-columnas." +#. Tag: programlisting +#: query_sql.xml:550 +#, no-c-format +msgid "" +"<sql-query name=\"organizationCurrentEmployments\">\n" +" <return alias=\"emp\" class=\"Employment\">\n" +" <return-property name=\"salary\">\n" +" <return-column name=\"VALUE\"/>\n" +" <return-column name=\"CURRENCY\"/>\n" +" </return-property>\n" +" <return-property name=\"endDate\" column=\"myEndDate\"/>\n" +" </return>\n" +" SELECT EMPLOYEE AS {emp.employee}, EMPLOYER AS {emp.employer},\n" +" STARTDATE AS {emp.startDate}, ENDDATE AS {emp.endDate},\n" +" REGIONCODE as {emp.regionCode}, EID AS {emp.id}, VALUE, CURRENCY\n" +" FROM EMPLOYMENT\n" +" WHERE EMPLOYER = :id AND ENDDATE IS NULL\n" +" ORDER BY STARTDATE ASC\n" +"</sql-query>" +msgstr "" + #. Tag: para +#: query_sql.xml:552 #, no-c-format msgid "" "In this example <return-property> was used in " @@ -729,6 +1414,7 @@ msgstr "" "las propiedades." #. Tag: para +#: query_sql.xml:557 #, no-c-format msgid "" "If your mapping has a discriminator you must use <return-" @@ -739,11 +1425,13 @@ msgstr "" "discriminadora." #. Tag: title +#: query_sql.xml:563 #, no-c-format msgid "Using stored procedures for querying" msgstr "Utilización de procedimientos para consultas" #. Tag: para +#: query_sql.xml:565 #, no-c-format msgid "" "Hibernate3 provides support for queries via stored procedures and functions. " @@ -759,14 +1447,55 @@ msgstr "" "Hibernate. A continuación hay un ejemplo de tal función almacenada en Oracle " "9 y posteriores:" +#. Tag: programlisting +#: query_sql.xml:571 +#, no-c-format +msgid "" +"CREATE OR REPLACE FUNCTION selectAllEmployments\n" +" RETURN SYS_REFCURSOR\n" +"AS\n" +" st_cursor SYS_REFCURSOR;\n" +"BEGIN\n" +" OPEN st_cursor FOR\n" +" SELECT EMPLOYEE, EMPLOYER,\n" +" STARTDATE, ENDDATE,\n" +" REGIONCODE, EID, VALUE, CURRENCY\n" +" FROM EMPLOYMENT;\n" +" RETURN st_cursor;\n" +" END;" +msgstr "" + #. Tag: para +#: query_sql.xml:573 #, no-c-format msgid "To use this query in Hibernate you need to map it via a named query." msgstr "" "Para utilizar esta consulta en Hibernate u.d necesita mapearla por medio de " "una consulta nombrada." +#. Tag: programlisting +#: query_sql.xml:576 +#, no-c-format +msgid "" +"<sql-query name=\"selectAllEmployees_SP\" callable=\"true\">\n" +" <return alias=\"emp\" class=\"Employment\">\n" +" <return-property name=\"employee\" column=\"EMPLOYEE\"/>\n" +" <return-property name=\"employer\" column=\"EMPLOYER\"/>\n" +" <return-property name=\"startDate\" column=\"STARTDATE\"/>\n" +" <return-property name=\"endDate\" column=\"ENDDATE\"/>\n" +" <return-property name=\"regionCode\" column=\"REGIONCODE\"/>\n" +" <return-property name=\"id\" column=\"EID\"/>\n" +" <return-property name=\"salary\">\n" +" <return-column name=\"VALUE\"/>\n" +" <return-column name=\"CURRENCY\"/>\n" +" </return-property>\n" +" </return>\n" +" { ? = call selectAllEmployments() }\n" +"</sql-query>" +msgstr "" + #. Tag: para +#: query_sql.xml:578 #, no-c-format msgid "" "Stored procedures currently only return scalars and entities. <" @@ -778,11 +1507,13 @@ msgstr "" "<load-collection> ." #. Tag: title +#: query_sql.xml:583 #, no-c-format msgid "Rules/limitations for using stored procedures" msgstr "Reglas/limitaciones para utilizar procedimientos almacenados" #. Tag: para +#: query_sql.xml:585 #, no-c-format msgid "" "You cannot use stored procedures with Hibernate unless you follow some " @@ -801,6 +1532,7 @@ msgstr "" "procedimientos almacenados." #. Tag: para +#: query_sql.xml:593 #, no-c-format msgid "" "Stored procedure queries cannot be paged with setFirstResult()/" @@ -810,6 +1542,7 @@ msgstr "" "setFirstResult()/setMaxResults()." #. Tag: para +#: query_sql.xml:596 #, no-c-format msgid "" "The recommended call form is standard SQL92: { ? = call functionName" @@ -822,11 +1555,13 @@ msgstr "" "llamadas nativas." #. Tag: para +#: query_sql.xml:601 #, no-c-format msgid "For Oracle the following rules apply:" msgstr "Para Oracle aplican las siguientes reglas:" #. Tag: para +#: query_sql.xml:605 #, no-c-format msgid "" "A function must return a result set. The first parameter of a procedure must " @@ -843,11 +1578,13 @@ msgstr "" "información." #. Tag: para +#: query_sql.xml:614 #, no-c-format msgid "For Sybase or MS SQL server the following rules apply:" msgstr "Para Sybase o el servidor MS SQL aplican las siguientes reglas:" #. Tag: para +#: query_sql.xml:618 #, no-c-format msgid "" "The procedure must return a result set. Note that since these servers can " @@ -862,6 +1599,7 @@ msgstr "" "será descartado." #. Tag: para +#: query_sql.xml:626 #, no-c-format msgid "" "If you can enable SET NOCOUNT ON in your procedure it " @@ -871,75 +1609,179 @@ msgstr "" "probablemente será más eficiente, pero no es un requerimiento." #. Tag: title +#: query_sql.xml:636 #, no-c-format msgid "Custom SQL for create, update and delete" msgstr "Personalice SQL para crear, actualizar y borrar" #. Tag: para -#, no-c-format +#: query_sql.xml:638 +#, fuzzy, no-c-format msgid "" "Hibernate3 can use custom SQL for create, update, and delete operations. The " "SQL can be overridden at the statement level or inidividual column level. " "This section describes statement overrides. For columns, see ." +"\"mapping-column-read-and-write\"/>. shows how to define custom SQL operatons using annotations." msgstr "" -"Hibernate3 puede utilizar SQL personalizado para crear, actualizar y borrar operaciones. El SQL se puede sobreescribir a nivel de declaración o a nivel de columna individual. " -"Esta sección describe la sobreescritua de declaraciones. Para las columnas consulte ." +"Hibernate3 puede utilizar SQL personalizado para crear, actualizar y borrar " +"operaciones. El SQL se puede sobreescribir a nivel de declaración o a nivel " +"de columna individual. Esta sección describe la sobreescritua de " +"declaraciones. Para las columnas consulte ." -#. Tag: para +#. Tag: title +#: query_sql.xml:646 +#, no-c-format +msgid "Custom CRUD via annotations" +msgstr "" + +#. Tag: programlisting +#: query_sql.xml:648 #, no-c-format msgid "" -"The class and collection persisters in Hibernate already contain a set of " -"configuration time generated strings (insertsql, deletesql, updatesql etc.). " -"The mapping tags <sql-insert>, <sql-" -"delete>, and <sql-update> override " -"these strings:" +"@Entity\n" +"@Table(name=\"CHAOS\")\n" +"@SQLInsert( sql=\"INSERT INTO CHAOS(size, name, nickname, id) VALUES(?,upper" +"(?),?,?)\")\n" +"@SQLUpdate( sql=\"UPDATE CHAOS SET size = ?, name = upper(?), nickname = ? " +"WHERE id = ?\")\n" +"@SQLDelete( sql=\"DELETE CHAOS WHERE id = ?\")\n" +"@SQLDeleteAll( sql=\"DELETE CHAOS\")\n" +"@Loader(namedQuery = \"chaos\")\n" +"@NamedNativeQuery(name=\"chaos\", query=\"select id, size, name, lower" +"( nickname ) as nickname from CHAOS where id= ?\", resultClass = Chaos." +"class)\n" +"public class Chaos {\n" +" @Id\n" +" private Long id;\n" +" private Long size;\n" +" private String name;\n" +" private String nickname;" msgstr "" -"Los persistentes de clase y de colección en " -"Hibernate ya contienen un grupo de cadenas generadas en tiempo de " -"configuración (insertsql, deletesql, updatesql, etc.). Las etiquetas de mapeo " -"<sql-insert>, <sql-delete> y <sql-update> sobrescriben estas cadenas:" #. Tag: para +#: query_sql.xml:651 #, no-c-format msgid "" -"The SQL is directly executed in your database, so you can use any dialect " -"you like. This will reduce the portability of your mapping if you use " -"database specific SQL." +"@SQLInsert, @SQLUpdate, " +"@SQLDelete, @SQLDeleteAll respectively " +"override the INSERT, UPDATE, DELETE, and DELETE all statement. The same can " +"be achieved using Hibernate mapping files and the <sql-insert>" +", <sql-update> and <sql-" +"delete> nodes. This can be seen in ." +msgstr "" + +#. Tag: title +#: query_sql.xml:661 +#, no-c-format +msgid "Custom CRUD XML" +msgstr "" + +#. Tag: programlisting +#: query_sql.xml:663 +#, no-c-format +msgid "" +"<class name=\"Person\">\n" +" <id name=\"id\">\n" +" <generator class=\"increment\"/>\n" +" </id>\n" +" <property name=\"name\" not-null=\"true\"/>\n" +" <sql-insert>INSERT INTO PERSON (NAME, ID) VALUES ( UPPER(?), ? )" +"</sql-insert>\n" +" <sql-update>UPDATE PERSON SET NAME=UPPER(?) WHERE ID=?</sql-" +"update>\n" +" <sql-delete>DELETE FROM PERSON WHERE ID=?</sql-delete>\n" +"</class>" msgstr "" -"El SQL se ejecuta directamente en su base de datos asi que usted es libre de " -"utilizar cualquier dialecto que desee. Esto reducirá la portabilidad de su " -"mapeo si utiliza una base de datos especifica de SQL." #. Tag: para +#: query_sql.xml:666 #, no-c-format msgid "" -"Stored procedures are supported if the callable attribute " -"is set:" +"If you expect to call a store procedure, be sure to set the " +"callable attribute to true. In " +"annotations as well as in xml." msgstr "" -"Los procedimientos almacenados se encuentran soportados si el atributo " -"callable está configurado:" #. Tag: para +#: query_sql.xml:670 #, no-c-format msgid "" -"The order of the positional parameters is vital, as they must be in the same " -"sequence as Hibernate expects them." +"To check that the execution happens correctly, Hibernate allows you to " +"define one of those three strategies:" msgstr "" -"El orden de los parámetros posicionales es vital ya que se deben encontrar " -"en la misma secuencia en que Hibernate los espera." #. Tag: para +#: query_sql.xml:675 #, no-c-format msgid "" -"You can view the expected order by enabling debug logging for the " -"org.hibernate.persister.entity level. With this level " -"enabled, Hibernate will print out the static SQL that is used to create, " -"update, delete etc. entities. To view the expected sequence, do not include " -"your custom SQL in the mapping files, as this will override the Hibernate " -"generated static SQL." +"none: no check is performed: the store procedure is expected to fail upon " +"issues" +msgstr "" + +#. Tag: para +#: query_sql.xml:680 +#, no-c-format +msgid "count: use of rowcount to check that the update is successful" +msgstr "" + +#. Tag: para +#: query_sql.xml:685 +#, no-c-format +msgid "" +"param: like COUNT but using an output parameter rather that the standard " +"mechanism" +msgstr "" + +#. Tag: para +#: query_sql.xml:690 +#, no-c-format +msgid "" +"To define the result check style, use the check parameter " +"which is again available in annoations as well as in xml." +msgstr "" + +#. Tag: para +#: query_sql.xml:693 +#, no-c-format +msgid "" +"You can use the exact same set of annotations respectively xml nodes to " +"override the collection related statements -see ." +msgstr "" + +#. Tag: title +#: query_sql.xml:698 +#, no-c-format +msgid "Overriding SQL statements for collections using annotations" +msgstr "" + +#. Tag: programlisting +#: query_sql.xml:701 +#, no-c-format +msgid "" +"@OneToMany\n" +"@JoinColumn(name=\"chaos_fk\")\n" +"@SQLInsert( sql=\"UPDATE CASIMIR_PARTICULE SET chaos_fk = ? where id = ?\")\n" +"@SQLDelete( sql=\"UPDATE CASIMIR_PARTICULE SET chaos_fk = null where id = ?" +"\")\n" +"private Set<CasimirParticle> particles = new HashSet<" +"CasimirParticle>();" +msgstr "" + +#. Tag: para +#: query_sql.xml:705 +#, fuzzy, no-c-format +msgid "" +"The parameter order is important and is defined by the order Hibernate " +"handles properties. You can see the expected order by enabling debug logging " +"for the org.hibernate.persister.entity level. With this " +"level enabled Hibernate will print out the static SQL that is used to " +"create, update, delete etc. entities. (To see the expected sequence, " +"remember to not include your custom SQL through annotations or mapping files " +"as that will override the Hibernate generated static sql)" msgstr "" "Puede ver el orden esperado habilitando el registro de depuración para el " "nivel org.hibernate.persister.entity. Con este nivel " @@ -949,12 +1791,67 @@ msgstr "" "sobrescribirá el sql estático generado por Hibernate)." #. Tag: para +#: query_sql.xml:715 #, no-c-format msgid "" -"The stored procedures are in most cases required to return the number of " -"rows inserted, updated and deleted, as Hibernate has some runtime checks for " -"the success of the statement. Hibernate always registers the first statement " -"parameter as a numeric output parameter for the CUD operations:" +"Overriding SQL statements for secondary tables is also possible using " +"@org.hibernate.annotations.Table and either (or all) " +"attributes sqlInsert, sqlUpdate, " +"sqlDelete:" +msgstr "" + +#. Tag: title +#: query_sql.xml:721 +#, no-c-format +msgid "Overriding SQL statements for secondary tables" +msgstr "" + +#. Tag: programlisting +#: query_sql.xml:723 +#, no-c-format +msgid "" +"@Entity\n" +"@SecondaryTables({\n" +" @SecondaryTable(name = \"`Cat nbr1`\"),\n" +" @SecondaryTable(name = \"Cat2\"})\n" +"@org.hibernate.annotations.Tables( {\n" +" @Table(appliesTo = \"Cat\", comment = \"My cat table\" ),\n" +" @Table(appliesTo = \"Cat2\", foreignKey = @ForeignKey(name=\"FK_CAT2_CAT" +"\"), fetch = FetchMode.SELECT,\n" +" sqlInsert=@SQLInsert(sql=\"insert into Cat2(storyPart2, id) values" +"(upper(?), ?)\") )\n" +"} )\n" +"public class Cat implements Serializable {" +msgstr "" + +#. Tag: para +#: query_sql.xml:726 +#, no-c-format +msgid "" +"The previous example also shows that you can give a comment to a given table " +"(primary or secondary): This comment will be used for DDL generation." +msgstr "" + +#. Tag: para +#: query_sql.xml:731 +#, fuzzy, no-c-format +msgid "" +"The SQL is directly executed in your database, so you can use any dialect " +"you like. This will, however, reduce the portability of your mapping if you " +"use database specific SQL." +msgstr "" +"El SQL se ejecuta directamente en su base de datos asi que usted es libre de " +"utilizar cualquier dialecto que desee. Esto reducirá la portabilidad de su " +"mapeo si utiliza una base de datos especifica de SQL." + +#. Tag: para +#: query_sql.xml:736 +#, fuzzy, no-c-format +msgid "" +"Last but not least, stored procedures are in most cases required to return " +"the number of rows inserted, updated and deleted. Hibernate always registers " +"the first statement parameter as a numeric output parameter for the CUD " +"operations:" msgstr "" "En la mayoría de los casos se requiere que los procedimientos almacenados " "retornen el número de filas insertadas, actualizadas y borradas ya que " @@ -963,23 +1860,67 @@ msgstr "" "declaración como un parámetro de la salida numérica para las operaciones CUD:" #. Tag: title +#: query_sql.xml:742 +#, no-c-format +msgid "Stored procedures and their return value" +msgstr "" + +#. Tag: programlisting +#: query_sql.xml:744 +#, no-c-format +msgid "" +"CREATE OR REPLACE FUNCTION updatePerson (uid IN NUMBER, uname IN VARCHAR2)\n" +" RETURN NUMBER IS\n" +"BEGIN\n" +"\n" +" update PERSON\n" +" set\n" +" NAME = uname,\n" +" where\n" +" ID = uid;\n" +"\n" +" return SQL%ROWCOUNT;\n" +"\n" +"END updatePerson;" +msgstr "" + +#. Tag: title +#: query_sql.xml:749 #, no-c-format msgid "Custom SQL for loading" msgstr "Personalice SQL para cargar" #. Tag: para -#, no-c-format +#: query_sql.xml:751 +#, fuzzy, no-c-format msgid "" "You can also declare your own SQL (or HQL) queries for entity loading. As " "with inserts, updates, and deletes, this can be done at the individual " -"column level as described in or at the statement level. Here is an example of a statement level " +"column level as described in or at the statement level. Here is an example of a statement level " "override:" msgstr "" -"También puede declarar su propias peticiones SQL (o HQL) para cargar entidades. Así como con las inserciones, actualizaciones y los borrados, esto se puede realizar a nivel de columna individual tal como se describe en o a nivel de declaración. Este es un ejemplo de una sobreescritura a nivel de declaración: " +"También puede declarar su propias peticiones SQL (o HQL) para cargar " +"entidades. Así como con las inserciones, actualizaciones y los borrados, " +"esto se puede realizar a nivel de columna individual tal como se describe en " +" o a nivel de declaración. " +"Este es un ejemplo de una sobreescritura a nivel de declaración: " + +#. Tag: programlisting +#: query_sql.xml:757 +#, no-c-format +msgid "" +"<sql-query name=\"person\">\n" +" <return alias=\"pers\" class=\"Person\" lock-mode=\"upgrade\"/>\n" +" SELECT NAME AS {pers.name}, ID AS {pers.id}\n" +" FROM PERSON\n" +" WHERE ID=?\n" +" FOR UPDATE\n" +"</sql-query>" +msgstr "" #. Tag: para +#: query_sql.xml:759 #, no-c-format msgid "" "This is just a named query declaration, as discussed earlier. You can " @@ -988,17 +1929,57 @@ msgstr "" "Esta es tan sólo una declaración de consulta nombrada, como se discutió " "anteriormente. Puede referenciar esta consulta nombrada en un mapeo de clase:" +#. Tag: programlisting +#: query_sql.xml:762 +#, no-c-format +msgid "" +"<class name=\"Person\">\n" +" <id name=\"id\">\n" +" <generator class=\"increment\"/>\n" +" </id>\n" +" <property name=\"name\" not-null=\"true\"/>\n" +" <loader query-ref=\"person\"/>\n" +"</class>" +msgstr "" + #. Tag: para +#: query_sql.xml:764 #, no-c-format msgid "This even works with stored procedures." msgstr "Esto funciona inclusive con procedimientos almacenados." #. Tag: para +#: query_sql.xml:766 #, no-c-format msgid "You can even define a query for collection loading:" msgstr "Puede incluso definir una consulta para la carga de colección:" +#. Tag: programlisting +#: query_sql.xml:768 +#, no-c-format +msgid "" +"<set name=\"employments\" inverse=\"true\">\n" +" <key/>\n" +" <one-to-many class=\"Employment\"/>\n" +" <loader query-ref=\"employments\"/>\n" +"</set>" +msgstr "" + +#. Tag: programlisting +#: query_sql.xml:770 +#, no-c-format +msgid "" +"<sql-query name=\"employments\">\n" +" <load-collection alias=\"emp\" role=\"Person.employments\"/>\n" +" SELECT {emp.*}\n" +" FROM EMPLOYMENT emp\n" +" WHERE EMPLOYER = :id\n" +" ORDER BY STARTDATE ASC, EMPLOYEE ASC\n" +"</sql-query>" +msgstr "" + #. Tag: para +#: query_sql.xml:772 #, no-c-format msgid "" "You can also define an entity loader that loads a collection by join " @@ -1007,3 +1988,59 @@ msgstr "" "También puede definir un cargador de entidad que cargue una colección con " "una unión temprana:" +#. Tag: programlisting +#: query_sql.xml:775 +#, no-c-format +msgid "" +"<sql-query name=\"person\">\n" +" <return alias=\"pers\" class=\"Person\"/>\n" +" <return-join alias=\"emp\" property=\"pers.employments\"/>\n" +" SELECT NAME AS {pers.*}, {emp.*}\n" +" FROM PERSON pers\n" +" LEFT OUTER JOIN EMPLOYMENT emp\n" +" ON pers.ID = emp.PERSON_ID\n" +" WHERE ID=?\n" +"</sql-query>" +msgstr "" + +#. Tag: para +#: query_sql.xml:777 +#, no-c-format +msgid "" +"The annotation equivalent <loader> is the @Loader " +"annotation as seen in ." +msgstr "" + +#~ msgid "{item.*}" +#~ msgstr "{item.*}" + +#~ msgid "{coll.*}" +#~ msgstr "{coll.*}" + +#~ msgid "" +#~ "The class and collection persisters in Hibernate already contain a set of " +#~ "configuration time generated strings (insertsql, deletesql, updatesql " +#~ "etc.). The mapping tags <sql-insert>, " +#~ "<sql-delete>, and <sql-update> override these strings:" +#~ msgstr "" +#~ "Los persistentes de clase y de colección en Hibernate ya contienen un " +#~ "grupo de cadenas generadas en tiempo de configuración (insertsql, " +#~ "deletesql, updatesql, etc.). Las etiquetas de mapeo <sql-" +#~ "insert>, <sql-delete> y " +#~ "<sql-update> sobrescriben estas cadenas:" + +#~ msgid "" +#~ "Stored procedures are supported if the callable " +#~ "attribute is set:" +#~ msgstr "" +#~ "Los procedimientos almacenados se encuentran soportados si el atributo " +#~ "callable está configurado:" + +#~ msgid "" +#~ "The order of the positional parameters is vital, as they must be in the " +#~ "same sequence as Hibernate expects them." +#~ msgstr "" +#~ "El orden de los parámetros posicionales es vital ya que se deben " +#~ "encontrar en la misma secuencia en que Hibernate los espera." diff --git a/documentation/manual/src/main/docbook/es-ES/content/session_api.po b/documentation/manual/src/main/docbook/es-ES/content/session_api.po index 2dc0490780..77bb2f6ca5 100644 --- a/documentation/manual/src/main/docbook/es-ES/content/session_api.po +++ b/documentation/manual/src/main/docbook/es-ES/content/session_api.po @@ -14,7 +14,7 @@ msgid "" msgstr "" "Project-Id-Version: session_api\n" "Report-Msgid-Bugs-To: http://bugs.kde.org\n" -"POT-Creation-Date: 2010-03-12T00:03:48\n" +"POT-Creation-Date: 2010-07-20 21:02+0000\n" "PO-Revision-Date: 2010-03-15 14:40+1000\n" "Last-Translator: Angela Garcia \n" "Language-Team: \n" @@ -24,11 +24,13 @@ msgstr "" "X-Generator: KBabel 1.11.4\n" #. Tag: title +#: session_api.xml:31 #, no-c-format msgid "Working with objects" msgstr "Trabajo con objetos" #. Tag: para +#: session_api.xml:33 #, no-c-format msgid "" "Hibernate is a full object/relational mapping solution that not only shields " @@ -47,6 +49,7 @@ msgstr "" "aplicaciones Java." #. Tag: para +#: session_api.xml:40 #, no-c-format msgid "" "In other words, Hibernate application developers should always think about " @@ -62,16 +65,19 @@ msgstr "" "afinar el rendimiento del sistema." #. Tag: title +#: session_api.xml:47 #, no-c-format msgid "Hibernate object states" msgstr "Estados de objeto de Hibernate" #. Tag: para +#: session_api.xml:49 #, no-c-format msgid "Hibernate defines and supports the following object states:" msgstr "Hibernate define y soporta los siguientes estados de objeto:" #. Tag: para +#: session_api.xml:53 #, no-c-format msgid "" "Transient - an object is transient if it has just been " @@ -95,6 +101,7 @@ msgstr "" "necesitan ejecutarse para esta transición)." #. Tag: para +#: session_api.xml:65 #, no-c-format msgid "" "Persistent - a persistent instance has a representation " @@ -117,6 +124,7 @@ msgstr "" "poner como transitorio." #. Tag: para +#: session_api.xml:77 #, no-c-format msgid "" "Detached - a detached instance is an object that has " @@ -141,6 +149,7 @@ msgstr "" "unidad de trabajo desde el punto de vista del usuario." #. Tag: para +#: session_api.xml:90 #, no-c-format msgid "" "We will now discuss the states and state transitions (and the Hibernate " @@ -150,21 +159,37 @@ msgstr "" "Hibernate que disparan una transición) en más detalle. " #. Tag: title +#: session_api.xml:95 #, no-c-format msgid "Making objects persistent" msgstr "Haciendo los objetos persistentes" #. Tag: para +#: session_api.xml:97 #, no-c-format msgid "" "Newly instantiated instances of a persistent class are considered " "transient by Hibernate. We can make a transient " "instance persistent by associating it with a session:" msgstr "" -"Las instancias recién instanciadas de una clase persistente, Hibernate las considera como transitorias. Podemos hacer una instancia " -"transitoria persistente asociándola con una sesión:" +"Las instancias recién instanciadas de una clase persistente, Hibernate las " +"considera como transitorias. Podemos hacer una " +"instancia transitoria persistente asociándola con una " +"sesión:" + +#. Tag: programlisting +#: session_api.xml:102 +#, no-c-format +msgid "" +"DomesticCat fritz = new DomesticCat();\n" +"fritz.setColor(Color.GINGER);\n" +"fritz.setSex('M');\n" +"fritz.setName(\"Fritz\");\n" +"Long generatedId = (Long) sess.save(fritz);" +msgstr "" #. Tag: para +#: session_api.xml:104 #, no-c-format msgid "" "If Cat has a generated identifier, the identifier is " @@ -186,6 +211,7 @@ msgstr "" "el borrador de EJB3. " #. Tag: para +#: session_api.xml:115 #, no-c-format msgid "" "persist() makes a transient instance persistent. However, " @@ -205,6 +231,7 @@ msgstr "" "un contexto extendido sesión/persistencia." #. Tag: para +#: session_api.xml:126 #, no-c-format msgid "" "save() does guarantee to return an identifier. If an " @@ -221,6 +248,7 @@ msgstr "" "extendido sesión/persistencia." #. Tag: para +#: session_api.xml:135 #, no-c-format msgid "" "Alternatively, you can assign the identifier using an overloaded version of " @@ -229,7 +257,21 @@ msgstr "" "Opcionalmente, puede asignar el identificador utilizando una versión " "sobrecargada de save()." +#. Tag: programlisting +#: session_api.xml:138 +#, no-c-format +msgid "" +"DomesticCat pk = new DomesticCat();\n" +"pk.setColor(Color.TABBY);\n" +"pk.setSex('F');\n" +"pk.setName(\"PK\");\n" +"pk.setKittens( new HashSet() );\n" +"pk.addKitten(fritz);\n" +"sess.save( pk, new Long(1234) );" +msgstr "" + #. Tag: para +#: session_api.xml:140 #, no-c-format msgid "" "If the object you make persistent has associated objects (e.g. the " @@ -250,6 +292,7 @@ msgstr "" "equivocado. " #. Tag: para +#: session_api.xml:148 #, no-c-format msgid "" "Usually you do not bother with this detail, as you will normally use " @@ -266,11 +309,13 @@ msgstr "" "discute la persistencia transitiva." #. Tag: title +#: session_api.xml:157 #, no-c-format msgid "Loading an object" msgstr "Cargando un objeto" #. Tag: para +#: session_api.xml:159 #, no-c-format msgid "" "The load() methods of Session provide " @@ -284,12 +329,39 @@ msgstr "" "estado dentro de una instancia recién instanciada de esa clase, en un estado " "persistente." +#. Tag: programlisting +#: session_api.xml:165 +#, no-c-format +msgid "Cat fritz = (Cat) sess.load(Cat.class, generatedId);" +msgstr "" + +#. Tag: programlisting +#: session_api.xml:167 +#, no-c-format +msgid "" +"// you need to wrap primitive identifiers\n" +"long id = 1234;\n" +"DomesticCat pk = (DomesticCat) sess.load( DomesticCat.class, new Long(id) );" +msgstr "" + #. Tag: para +#: session_api.xml:169 #, no-c-format msgid "Alternatively, you can load state into a given instance:" msgstr "Alternativamente, puede cargar estado dentro de una instancia dada:" +#. Tag: programlisting +#: session_api.xml:171 +#, no-c-format +msgid "" +"Cat cat = new DomesticCat();\n" +"// load pk's state into cat\n" +"sess.load( cat, new Long(pkId) );\n" +"Set kittens = cat.getKittens();" +msgstr "" + #. Tag: para +#: session_api.xml:173 #, no-c-format msgid "" "Be aware that load() will throw an unrecoverable " @@ -311,6 +383,7 @@ msgstr "" "size para el mapeo de la clase." #. Tag: para +#: session_api.xml:182 #, no-c-format msgid "" "If you are not certain that a matching row exists, you should use the " @@ -321,7 +394,20 @@ msgstr "" "el método get(), que llama a la base de datos " "inmediatamente y devuelve nulo si no existe una fila correspondiente. " +#. Tag: programlisting +#: session_api.xml:186 +#, no-c-format +msgid "" +"Cat cat = (Cat) sess.get(Cat.class, id);\n" +"if (cat==null) {\n" +" cat = new Cat();\n" +" sess.save(cat, id);\n" +"}\n" +"return cat;" +msgstr "" + #. Tag: para +#: session_api.xml:188 #, no-c-format msgid "" "You can even load an object using an SQL SELECT ... FOR UPDATE de SQL, usando un LockMode. Consulte la " "documentación de la API para obtener más información." +#. Tag: programlisting +#: session_api.xml:192 +#, no-c-format +msgid "Cat cat = (Cat) sess.get(Cat.class, id, LockMode.UPGRADE);" +msgstr "" + #. Tag: para +#: session_api.xml:194 #, no-c-format msgid "" "Any associated instances or contained collections will notSELECTs will it use? This depends on the " "fetching strategy. This is explained in ." +"\"performance-fetching\"/>." msgstr "" "¿Cuánto carga Hibernate de la base de datos y cuántos SELECTs de SQL utilizará? Esto depende de la estrategia de " -"recuperación. Esto se explica en la ." +"recuperación. Esto se explica en la ." #. Tag: title +#: session_api.xml:213 #, no-c-format msgid "Querying" msgstr "Consultas" #. Tag: para +#: session_api.xml:215 #, no-c-format msgid "" "If you do not know the identifiers of the objects you are looking for, you " @@ -394,11 +500,13 @@ msgstr "" "conversión del conjunto de resultados a objetos." #. Tag: title +#: session_api.xml:224 #, no-c-format msgid "Executing queries" msgstr "Ejecución de consultas" #. Tag: para +#: session_api.xml:226 #, no-c-format msgid "" "HQL and native SQL queries are represented with an instance of org." @@ -413,7 +521,38 @@ msgstr "" "consulta real. Siempre obtiene una Query utilizando la " "Session actual:" +#. Tag: programlisting +#: session_api.xml:232 +#, no-c-format +msgid "" +"List cats = session.createQuery(\n" +" \"from Cat as cat where cat.birthdate < ?\")\n" +" .setDate(0, date)\n" +" .list();\n" +"\n" +"List mothers = session.createQuery(\n" +" \"select mother from Cat as cat join cat.mother as mother where cat.name " +"= ?\")\n" +" .setString(0, name)\n" +" .list();\n" +"\n" +"List kittens = session.createQuery(\n" +" \"from Cat as cat where cat.mother = ?\")\n" +" .setEntity(0, pk)\n" +" .list();\n" +"\n" +"Cat mother = (Cat) session.createQuery(\n" +" \"select cat.mother from Cat as cat where cat = ?\")\n" +" .setEntity(0, izi)\n" +" .uniqueResult();]]\n" +"\n" +"Query mothersWithKittens = (Cat) session.createQuery(\n" +" \"select mother from Cat as mother left join fetch mother.kittens\");\n" +"Set uniqueMothers = new HashSet(mothersWithKittens.list());" +msgstr "" + #. Tag: para +#: session_api.xml:234 #, no-c-format msgid "" "A query is usually executed by invoking list(). The " @@ -436,11 +575,13 @@ msgstr "" "Set." #. Tag: title +#: session_api.xml:244 #, no-c-format msgid "Iterating results" msgstr "Iteración de resultados" #. Tag: para +#: session_api.xml:246 #, no-c-format msgid "" "Occasionally, you might be able to achieve better performance by executing " @@ -463,12 +604,33 @@ msgstr "" "que sólamente retorna identificadores y n selecciones " "adicionales para inicializar las instancias reales." +#. Tag: programlisting +#: session_api.xml:257 +#, no-c-format +msgid "" +"// fetch ids\n" +"Iterator iter = sess.createQuery(\"from eg.Qux q order by q.likeliness\")." +"iterate();\n" +"while ( iter.hasNext() ) {\n" +" Qux qux = (Qux) iter.next(); // fetch the object\n" +" // something we couldnt express in the query\n" +" if ( qux.calculateComplicatedAlgorithm() ) {\n" +" // delete the current instance\n" +" iter.remove();\n" +" // dont need to process the rest\n" +" break;\n" +" }\n" +"}" +msgstr "" + #. Tag: title +#: session_api.xml:261 #, no-c-format msgid "Queries that return tuples" msgstr "Consultas que devuelven tuplas" #. Tag: para +#: session_api.xml:263 #, no-c-format msgid "" "Hibernate queries sometimes return tuples of objects. Each tuple is returned " @@ -477,12 +639,32 @@ msgstr "" "Las consultas de Hibernate a veces retornan tuplas de objetos. Cada tupla se " "retorna como un array:" +#. Tag: programlisting +#: session_api.xml:266 +#, no-c-format +msgid "" +"Iterator kittensAndMothers = sess.createQuery(\n" +" \"select kitten, mother from Cat kitten join kitten.mother mother" +"\")\n" +" .list()\n" +" .iterator();\n" +"\n" +"while ( kittensAndMothers.hasNext() ) {\n" +" Object[] tuple = (Object[]) kittensAndMothers.next();\n" +" Cat kitten = (Cat) tuple[0];\n" +" Cat mother = (Cat) tuple[1];\n" +" ....\n" +"}" +msgstr "" + #. Tag: title +#: session_api.xml:270 #, no-c-format msgid "Scalar results" msgstr "Resultados escalares" #. Tag: para +#: session_api.xml:272 #, no-c-format msgid "" "Queries can specify a property of a class in the select " @@ -494,12 +676,34 @@ msgstr "" "SQL. Las propiedades o agregaciones son considerados resultados \"escalares" "\" y no entidades en estado persistente." +#. Tag: programlisting +#: session_api.xml:277 +#, no-c-format +msgid "" +"Iterator results = sess.createQuery(\n" +" \"select cat.color, min(cat.birthdate), count(cat) from Cat cat \" " +"+\n" +" \"group by cat.color\")\n" +" .list()\n" +" .iterator();\n" +"\n" +"while ( results.hasNext() ) {\n" +" Object[] row = (Object[]) results.next();\n" +" Color type = (Color) row[0];\n" +" Date oldest = (Date) row[1];\n" +" Integer count = (Integer) row[2];\n" +" .....\n" +"}" +msgstr "" + #. Tag: title +#: session_api.xml:281 #, no-c-format msgid "Bind parameters" msgstr "Ligado de parámetros" #. Tag: para +#: session_api.xml:283 #, no-c-format msgid "" "Methods on Query are provided for binding values to named " @@ -516,28 +720,69 @@ msgstr "" "parámetros con nombre son las siguientes:" #. Tag: para +#: session_api.xml:292 #, no-c-format -msgid "named parameters are insensitive to the order they occur in the query string" +msgid "" +"named parameters are insensitive to the order they occur in the query string" msgstr "" "los parámetros con nombre son insensibles al orden en que aparecen en la " "cadena de consulta" #. Tag: para +#: session_api.xml:297 #, no-c-format msgid "they can occur multiple times in the same query" msgstr "pueden aparecer múltiples veces en la misma petición" #. Tag: para +#: session_api.xml:301 #, no-c-format msgid "they are self-documenting" msgstr "son auto-documentados" +#. Tag: programlisting +#: session_api.xml:305 +#, no-c-format +msgid "" +"//named parameter (preferred)\n" +"Query q = sess.createQuery(\"from DomesticCat cat where cat.name = :name" +"\");\n" +"q.setString(\"name\", \"Fritz\");\n" +"Iterator cats = q.iterate();" +msgstr "" + +#. Tag: programlisting +#: session_api.xml:307 +#, no-c-format +msgid "" +"//positional parameter\n" +"Query q = sess.createQuery(\"from DomesticCat cat where cat.name = ?\");\n" +"q.setString(0, \"Izi\");\n" +"Iterator cats = q.iterate();" +msgstr "" + +#. Tag: programlisting +#: session_api.xml:309 +#, no-c-format +msgid "" +"//named parameter list\n" +"List names = new ArrayList();\n" +"names.add(\"Izi\");\n" +"names.add(\"Fritz\");\n" +"Query q = sess.createQuery(\"from DomesticCat cat where cat.name in (:" +"namesList)\");\n" +"q.setParameterList(\"namesList\", names);\n" +"List cats = q.list();" +msgstr "" + #. Tag: title +#: session_api.xml:313 #, no-c-format msgid "Pagination" msgstr "Paginación" #. Tag: para +#: session_api.xml:315 #, no-c-format msgid "" "If you need to specify bounds upon your result set, that is, the maximum " @@ -549,7 +794,18 @@ msgstr "" "recuperar, puede utilizar los métodos de la interfaz Query:" +#. Tag: programlisting +#: session_api.xml:320 +#, no-c-format +msgid "" +"Query q = sess.createQuery(\"from DomesticCat cat\");\n" +"q.setFirstResult(20);\n" +"q.setMaxResults(10);\n" +"List cats = q.list();" +msgstr "" + #. Tag: para +#: session_api.xml:322 #, no-c-format msgid "" "Hibernate knows how to translate this limit query into the native SQL of " @@ -559,11 +815,13 @@ msgstr "" "DBMS." #. Tag: title +#: session_api.xml:327 #, no-c-format msgid "Scrollable iteration" msgstr "Iteración deslizable" #. Tag: para +#: session_api.xml:329 #, no-c-format msgid "" "If your JDBC driver supports scrollable ResultSets, the " @@ -576,7 +834,37 @@ msgstr "" "ScrollableResults que permite una navegación flexible de " "los resultados de consulta. " +#. Tag: programlisting +#: session_api.xml:334 +#, no-c-format +msgid "" +"Query q = sess.createQuery(\"select cat.name, cat from DomesticCat cat \" +\n" +" \"order by cat.name\");\n" +"ScrollableResults cats = q.scroll();\n" +"if ( cats.first() ) {\n" +"\n" +" // find the first name on each page of an alphabetical list of cats by " +"name\n" +" firstNamesOfPages = new ArrayList();\n" +" do {\n" +" String name = cats.getString(0);\n" +" firstNamesOfPages.add(name);\n" +" }\n" +" while ( cats.scroll(PAGE_SIZE) );\n" +"\n" +" // Now get the first page of cats\n" +" pageOfCats = new ArrayList();\n" +" cats.beforeFirst();\n" +" int i=0;\n" +" while( ( PAGE_SIZE > i++ ) && cats.next() ) pageOfCats.add" +"( cats.get(1) );\n" +"\n" +"}\n" +"cats.close()" +msgstr "" + #. Tag: para +#: session_api.xml:336 #, no-c-format msgid "" "Note that an open database connection and cursor is required for this " @@ -589,27 +877,106 @@ msgstr "" "paginación fuera de línea." #. Tag: title +#: session_api.xml:343 #, no-c-format msgid "Externalizing named queries" msgstr "Externalización de consultas con nombre" #. Tag: para +#: session_api.xml:345 #, no-c-format msgid "" -"You can also define named queries in the mapping document. Remember to use a " -"CDATA section if your query contains characters that " -"could be interpreted as markup." +"Queries can also be configured as so called named queries using annotations " +"or Hibernate mapping documents. @NamedQuery and " +"@NamedQueries can be defined at the class level as seen " +"in . However their " +"definitions are global to the session factory/entity manager factory scope. " +"A named query is defined by its name and the actual query string." +msgstr "" + +#. Tag: title +#: session_api.xml:355 +#, no-c-format +msgid "Defining a named query using @NamedQuery" +msgstr "" + +#. Tag: programlisting +#: session_api.xml:358 +#, no-c-format +msgid "" +"@Entity\n" +"@NamedQuery(name=\"night.moreRecentThan\", query=\"select n from Night n " +"where n.date >= :date\")\n" +"public class Night {\n" +" ...\n" +"}\n" +"\n" +"public class MyDao {\n" +" doStuff() {\n" +" Query q = s.getNamedQuery(\"night.moreRecentThan\");\n" +" q.setDate( \"date\", aMonthAgo );\n" +" List results = q.list();\n" +" ...\n" +" }\n" +" ...\n" +"}" +msgstr "" + +#. Tag: para +#: session_api.xml:361 +#, fuzzy, no-c-format +msgid "" +"Using a mapping document can be configured using the <query> node. Remember to use a CDATA section if your " +"query contains characters that could be interpreted as markup." msgstr "" "También puede definir consultas con nombre en el documento de mapeo. " "Recuerde utilizar una sección CDATA si su consulta " "contiene caracteres que puedan ser interpretados como etiquetado." -#. Tag: para +#. Tag: title +#: session_api.xml:367 #, no-c-format -msgid "Parameter binding and executing is done programatically:" -msgstr "El ligado de parámetros y de ejecución se realiza programáticamente:" +msgid "Defining a named query using <query>" +msgstr "" + +#. Tag: programlisting +#: session_api.xml:370 +#, no-c-format +msgid "" +"<query name=\"ByNameAndMaximumWeight\"><![CDATA[\n" +" from eg.DomesticCat as cat\n" +" where cat.name = ?\n" +" and cat.weight > ?\n" +"] ]></query>" +msgstr "" #. Tag: para +#: session_api.xml:373 +#, fuzzy, no-c-format +msgid "" +"Parameter binding and executing is done programatically as seen in ." +msgstr "El ligado de parámetros y de ejecución se realiza programáticamente:" + +#. Tag: title +#: session_api.xml:377 +#, no-c-format +msgid "Parameter binding of a named query" +msgstr "" + +#. Tag: programlisting +#: session_api.xml:379 +#, no-c-format +msgid "" +"Query q = sess.getNamedQuery(\"ByNameAndMaximumWeight\");\n" +"q.setString(0, name);\n" +"q.setInt(1, minWeight);\n" +"List cats = q.list();" +msgstr "" + +#. Tag: para +#: session_api.xml:382 #, no-c-format msgid "" "The actual program code is independent of the query language that is used. " @@ -621,6 +988,7 @@ msgstr "" "migrar consultas existentes a Hibernate colocándolas en archivos de mapeo." #. Tag: para +#: session_api.xml:387 #, no-c-format msgid "" "Also note that a query declaration inside a <hibernate-" @@ -637,11 +1005,13 @@ msgstr "" "eg.Cat.ByNameAndMaximumWeight." #. Tag: title +#: session_api.xml:397 #, no-c-format msgid "Filtering collections" msgstr "Filtración de colecciones" #. Tag: para +#: session_api.xml:399 #, no-c-format msgid "" "A collection filter is a special type of query that can " @@ -653,7 +1023,20 @@ msgstr "" "consulta puede referirse a this, lo que quiere decir el " "elemento de la colección actual." +#. Tag: programlisting +#: session_api.xml:404 +#, no-c-format +msgid "" +"Collection blackKittens = session.createFilter(\n" +" pk.getKittens(), \n" +" \"where this.color = ?\")\n" +" .setParameter( Color.BLACK, Hibernate.custom(ColorUserType.class) )\n" +" .list()\n" +");" +msgstr "" + #. Tag: para +#: session_api.xml:406 #, no-c-format msgid "" "The returned collection is considered a bag that is a copy of the given " @@ -666,6 +1049,7 @@ msgstr "" "esperado." #. Tag: para +#: session_api.xml:411 #, no-c-format msgid "" "Observe that filters do not require a from clause, " @@ -676,7 +1060,18 @@ msgstr "" "aunque pueden tener una si se necesita. Los filtros no están limitados a " "devolver los elementos de colección por sí mismos." +#. Tag: programlisting +#: session_api.xml:415 +#, no-c-format +msgid "" +"Collection blackKittenMates = session.createFilter(\n" +" pk.getKittens(), \n" +" \"select this.mate where this.color = eg.Color.BLACK.intValue\")\n" +" .list();" +msgstr "" + #. Tag: para +#: session_api.xml:417 #, no-c-format msgid "" "Even an empty filter query is useful, e.g. to load a subset of elements in a " @@ -685,12 +1080,24 @@ msgstr "" "Incluso una consulta de filtro vacío es útil, por ejemplo, para cargar un " "subconjunto de elementos en una colección enorme: " +#. Tag: programlisting +#: session_api.xml:420 +#, no-c-format +msgid "" +"Collection tenKittens = session.createFilter(\n" +" mother.getKittens(), \"\")\n" +" .setFirstResult(0).setMaxResults(10)\n" +" .list();" +msgstr "" + #. Tag: title +#: session_api.xml:424 #, no-c-format msgid "Criteria queries" msgstr "Consultas de criterios" #. Tag: para +#: session_api.xml:426 #, no-c-format msgid "" "HQL is extremely powerful, but some developers prefer to build queries " @@ -703,23 +1110,35 @@ msgstr "" "vez de construir cadenas de consulta. Hibernate brinda una API intuitiva de " "consulta Criteria para estos casos: " -#. Tag: para +#. Tag: programlisting +#: session_api.xml:431 #, no-c-format msgid "" +"Criteria crit = session.createCriteria(Cat.class);\n" +"crit.add( Restrictions.eq( \"color\", eg.Color.BLACK ) );\n" +"crit.setMaxResults(10);\n" +"List cats = crit.list();" +msgstr "" + +#. Tag: para +#: session_api.xml:433 +#, fuzzy, no-c-format +msgid "" "The Criteria and the associated Example API are discussed in more detail in ." +"literal> API are discussed in more detail in ." msgstr "" "Las APIs de Criteria y el Example " -"asociado se discuten en más detalle en el ." +"asociado se discuten en más detalle en el ." #. Tag: title +#: session_api.xml:439 #, no-c-format msgid "Queries in native SQL" msgstr "Consultas en SQL nativo" #. Tag: para +#: session_api.xml:441 #, no-c-format msgid "" "You can express a query in SQL, using createSQLQuery() " @@ -735,23 +1154,50 @@ msgstr "" "directamente. Si elige usar la API de Hibernate, tiene que encerrar los " "alias de SQL entre llaves:" -#. Tag: para +#. Tag: programlisting +#: session_api.xml:448 #, no-c-format msgid "" +"List cats = session.createSQLQuery(\"SELECT {cat.*} FROM CAT {cat} WHERE " +"ROWNUM<10\")\n" +" .addEntity(\"cat\", Cat.class)\n" +".list();" +msgstr "" + +#. Tag: programlisting +#: session_api.xml:450 +#, no-c-format +msgid "" +"List cats = session.createSQLQuery(\n" +" \"SELECT {cat}.ID AS {cat.id}, {cat}.SEX AS {cat.sex}, \" +\n" +" \"{cat}.MATE AS {cat.mate}, {cat}.SUBCLASS AS {cat.class}, ... \" " +"+\n" +" \"FROM CAT {cat} WHERE ROWNUM<10\")\n" +" .addEntity(\"cat\", Cat.class)\n" +".list()" +msgstr "" + +#. Tag: para +#: session_api.xml:452 +#, fuzzy, no-c-format +msgid "" "SQL queries can contain named and positional parameters, just like Hibernate " "queries. More information about native SQL queries in Hibernate can be found " -"in ." +"in ." msgstr "" "Las consultas SQL pueden contener parámetros con nombre y posicionados, al " "igual que las consultas de Hibernate. Puede encontrar más información sobre " -"las consultas en SQL nativo en Hibernate en el . " +"las consultas en SQL nativo en Hibernate en el . " #. Tag: title +#: session_api.xml:459 #, no-c-format msgid "Modifying persistent objects" msgstr "Modificación de objetos persistentes" #. Tag: para +#: session_api.xml:461 #, no-c-format msgid "" "Transactional persistent instances (i.e. objects " @@ -776,7 +1222,17 @@ msgstr "" "load() y luego manipularlo directamente, mientras la " "Session está abierta:" +#. Tag: programlisting +#: session_api.xml:473 +#, no-c-format +msgid "" +"DomesticCat cat = (DomesticCat) sess.load( Cat.class, new Long(69) );\n" +"cat.setName(\"PK\");\n" +"sess.flush(); // changes to cat are automatically detected and persisted" +msgstr "" + #. Tag: para +#: session_api.xml:475 #, no-c-format msgid "" "Sometimes this programming model is inefficient, as it requires in the same " @@ -791,7 +1247,8 @@ msgstr "" "instancias separadas." #. Tag: para -#, no-c-format +#: session_api.xml:481 +#, fuzzy, no-c-format msgid "" "Hibernate does not offer its own API for direct execution of " "UPDATE or DELETE statements. Hibernate " @@ -802,7 +1259,7 @@ msgid "" "the notion of mass operations conflicts with object/relational mapping for " "online transaction processing-oriented applications. Future versions of " "Hibernate can, however, provide special mass operation functions. See for some possible batch operation tricks." +"linkend=\"batch\"/> for some possible batch operation tricks." msgstr "" "Hibernate no ofrece su propia API para ejecución directa de declaraciones " "UPDATE o DELETE. Hibernate es un " @@ -818,11 +1275,13 @@ msgstr "" "trucos posibles para la operación en lote. " #. Tag: title +#: session_api.xml:497 #, no-c-format msgid "Modifying detached objects" msgstr "Modificación de objetos separados" #. Tag: para +#: session_api.xml:499 #, no-c-format msgid "" "Many applications need to retrieve an object in one transaction, send it to " @@ -838,6 +1297,7 @@ msgstr "" "versionados para asegurar el aislamiento de la unidad de trabajo \"larga\"." #. Tag: para +#: session_api.xml:505 #, no-c-format msgid "" "Hibernate supports this model by providing for reattachment of detached " @@ -848,7 +1308,25 @@ msgstr "" "utilizando los métodos Session.update() o " "Session.merge():" +#. Tag: programlisting +#: session_api.xml:509 +#, no-c-format +msgid "" +"// in the first session\n" +"Cat cat = (Cat) firstSession.load(Cat.class, catId);\n" +"Cat potentialMate = new Cat();\n" +"firstSession.save(potentialMate);\n" +"\n" +"// in a higher layer of the application\n" +"cat.setMate(potentialMate);\n" +"\n" +"// later, in a new session\n" +"secondSession.update(cat); // update cat\n" +"secondSession.update(mate); // update mate" +msgstr "" + #. Tag: para +#: session_api.xml:511 #, no-c-format msgid "" "If the Cat with identifier catId had " @@ -860,6 +1338,7 @@ msgstr "" "aplicación intentó volver a unirlo, se habría lanzado una excepción." #. Tag: para +#: session_api.xml:516 #, no-c-format msgid "" "Use update() if you are certain that the session does not " @@ -879,22 +1358,24 @@ msgstr "" "instancias separadas es la primera operación que se ejecuta." #. Tag: para -#, no-c-format +#: session_api.xml:524 +#, fuzzy, no-c-format msgid "" "The application should individually update() detached " "instances that are reachable from the given detached instance " "only if it wants their state to be updated. This can be " "automated using transitive persistence. See for more information." +"linkend=\"objectstate-transitive\"/> for more information." msgstr "" "La aplicación debe actualizar update() individualmente " "las instancias separadas alcanzables desde la instancia separada dada " "sólo si quiere que su estado se actualice. Esto puede " -"ser automatizado utilizando la persistencia transitiva. Consulte la para " -"obtener mayor información." +"ser automatizado utilizando la persistencia transitiva. " +"Consulte la para obtener mayor " +"información." #. Tag: para +#: session_api.xml:530 #, no-c-format msgid "" "The lock() method also allows an application to " @@ -905,7 +1386,20 @@ msgstr "" "reasociar un objeto con una sesión nueva. Sin embargo, la instancia separada " "no puede haber sido modificada." +#. Tag: programlisting +#: session_api.xml:534 +#, no-c-format +msgid "" +"//just reassociate:\n" +"sess.lock(fritz, LockMode.NONE);\n" +"//do a version check, then reassociate:\n" +"sess.lock(izi, LockMode.READ);\n" +"//do a version check, using SELECT ... FOR UPDATE, then reassociate:\n" +"sess.lock(pk, LockMode.UPGRADE);" +msgstr "" + #. Tag: para +#: session_api.xml:536 #, no-c-format msgid "" "Note that lock() can be used with various " @@ -919,20 +1413,23 @@ msgstr "" "re-unión no es el único caso de uso para lock()." #. Tag: para -#, no-c-format +#: session_api.xml:541 +#, fuzzy, no-c-format msgid "" "Other models for long units of work are discussed in ." +"\"transactions-optimistic\"/>." msgstr "" "Se discuten otros modelos para unidades largas de trabajo en ." #. Tag: title +#: session_api.xml:546 #, no-c-format msgid "Automatic state detection" msgstr "Detección automática de estado" #. Tag: para +#: session_api.xml:548 #, no-c-format msgid "" "Hibernate users have requested a general purpose method that either saves a " @@ -946,7 +1443,26 @@ msgstr "" "actual. El método saveOrUpdate() implementa esta " "funcionalidad." +#. Tag: programlisting +#: session_api.xml:554 +#, no-c-format +msgid "" +"// in the first session\n" +"Cat cat = (Cat) firstSession.load(Cat.class, catID);\n" +"\n" +"// in a higher tier of the application\n" +"Cat mate = new Cat();\n" +"cat.setMate(mate);\n" +"\n" +"// later, in a new session\n" +"secondSession.saveOrUpdate(cat); // update existing state (cat has a non-" +"null id)\n" +"secondSession.saveOrUpdate(mate); // save the new instance (mate has a null " +"id)" +msgstr "" + #. Tag: para +#: session_api.xml:556 #, no-c-format msgid "" "The usage and semantics of saveOrUpdate() seems to be " @@ -964,6 +1480,7 @@ msgstr "" "ninguno de estos métodos." #. Tag: para +#: session_api.xml:563 #, no-c-format msgid "" "Usually update() or saveOrUpdate() are " @@ -973,26 +1490,31 @@ msgstr "" "se utilizan en el siguiente escenario:" #. Tag: para +#: session_api.xml:569 #, no-c-format msgid "the application loads an object in the first session" msgstr "la aplicación carga un objeto en la primera sesión" #. Tag: para +#: session_api.xml:573 #, no-c-format msgid "the object is passed up to the UI tier" msgstr "el objeto se pasa a la capa de UI" #. Tag: para +#: session_api.xml:577 #, no-c-format msgid "some modifications are made to the object" msgstr "se realizan algunas modificaciones al objeto" #. Tag: para +#: session_api.xml:581 #, no-c-format msgid "the object is passed back down to the business logic tier" msgstr "el objeto se pasa abajo de regreso a la capa lógica de negocios" #. Tag: para +#: session_api.xml:585 #, no-c-format msgid "" "the application persists these modifications by calling update()update() en una segunda sesión" #. Tag: para +#: session_api.xml:590 #, no-c-format msgid "saveOrUpdate() does the following:" msgstr "saveOrUpdate() hace lo siguiente:" #. Tag: para +#: session_api.xml:594 #, no-c-format msgid "if the object is already persistent in this session, do nothing" msgstr "si el objeto ya es persistente en esta sesión, no haga nada" #. Tag: para +#: session_api.xml:599 #, no-c-format msgid "" "if another object associated with the session has the same identifier, throw " @@ -1021,6 +1546,7 @@ msgstr "" "una excepción" #. Tag: para +#: session_api.xml:604 #, no-c-format msgid "if the object has no identifier property, save() it" msgstr "" @@ -1028,6 +1554,7 @@ msgstr "" "save()" #. Tag: para +#: session_api.xml:609 #, no-c-format msgid "" "if the object's identifier has the value assigned to a newly instantiated " @@ -1037,6 +1564,7 @@ msgstr "" "instanciado, guárdelo llamando a save()" #. Tag: para +#: session_api.xml:614 #, no-c-format msgid "" "if the object is versioned by a <version> or " @@ -1050,16 +1578,20 @@ msgstr "" "a save()" #. Tag: para +#: session_api.xml:622 #, no-c-format msgid "otherwise update() the object" -msgstr "de otra manera actualice el objeto llamando a update()" +msgstr "" +"de otra manera actualice el objeto llamando a update()" #. Tag: para +#: session_api.xml:626 #, no-c-format msgid "and merge() is very different:" msgstr "y merge() es muy diferente:" #. Tag: para +#: session_api.xml:630 #, no-c-format msgid "" "if there is a persistent instance with the same identifier currently " @@ -1071,6 +1603,7 @@ msgstr "" "persistente" #. Tag: para +#: session_api.xml:636 #, no-c-format msgid "" "if there is no persistent instance currently associated with the session, " @@ -1081,11 +1614,13 @@ msgstr "" "persistente" #. Tag: para +#: session_api.xml:642 #, no-c-format msgid "the persistent instance is returned" msgstr "la instancia persistente es devuelta" #. Tag: para +#: session_api.xml:646 #, no-c-format msgid "" "the given instance does not become associated with the session, it remains " @@ -1093,11 +1628,13 @@ msgid "" msgstr "la instancia dada no se asocia a la sesión, permanece separada" #. Tag: title +#: session_api.xml:653 #, no-c-format msgid "Deleting persistent objects" msgstr "Borrado de objetos persistentes" #. Tag: para +#: session_api.xml:655 #, no-c-format msgid "" "Session.delete() will remove an object's state from the " @@ -1110,7 +1647,14 @@ msgstr "" "a un objeto borrado. Lo mejor es pensar en delete() al " "hacer transitoria una instancia persistente." +#. Tag: programlisting +#: session_api.xml:660 +#, no-c-format +msgid "sess.delete(cat);" +msgstr "" + #. Tag: para +#: session_api.xml:662 #, no-c-format msgid "" "You can delete objects in any order, without risk of foreign key constraint " @@ -1125,11 +1669,13 @@ msgstr "" "borrar los hijos." #. Tag: title +#: session_api.xml:670 #, no-c-format msgid "Replicating object between two different datastores" msgstr "Replicación de objetos entre dos almacenamientos de datos diferentes" #. Tag: para +#: session_api.xml:672 #, no-c-format msgid "" "It is sometimes useful to be able to take a graph of persistent instances " @@ -1140,7 +1686,27 @@ msgstr "" "hacerlas persistentes en un almacenamiento de datos diferente, sin regenerar " "los valores identificadores." +#. Tag: programlisting +#: session_api.xml:676 +#, no-c-format +msgid "" +"//retrieve a cat from one database\n" +"Session session1 = factory1.openSession();\n" +"Transaction tx1 = session1.beginTransaction();\n" +"Cat cat = session1.get(Cat.class, catId);\n" +"tx1.commit();\n" +"session1.close();\n" +"\n" +"//reconcile with a second database\n" +"Session session2 = factory2.openSession();\n" +"Transaction tx2 = session2.beginTransaction();\n" +"session2.replicate(cat, ReplicationMode.LATEST_VERSION);\n" +"tx2.commit();\n" +"session2.close();" +msgstr "" + #. Tag: para +#: session_api.xml:678 #, no-c-format msgid "" "The ReplicationMode determines how replicate() tratará los conflictos con filas existentes en la base de datos:" #. Tag: para +#: session_api.xml:684 #, no-c-format msgid "" "ReplicationMode.IGNORE: ignores the object when there is " @@ -1159,6 +1726,7 @@ msgstr "" "una fila de la base de datos con el mismo identificador" #. Tag: para +#: session_api.xml:689 #, no-c-format msgid "" "ReplicationMode.OVERWRITE: overwrites any existing " @@ -1168,6 +1736,7 @@ msgstr "" "la base de datos existente con el mismo identificador" #. Tag: para +#: session_api.xml:694 #, no-c-format msgid "" "ReplicationMode.EXCEPTION: throws an exception if there " @@ -1177,6 +1746,7 @@ msgstr "" "una fila de la base de datos con el mismo identificador" #. Tag: para +#: session_api.xml:700 #, no-c-format msgid "" "ReplicationMode.LATEST_VERSION: overwrites the row if its " @@ -1188,6 +1758,7 @@ msgstr "" "contrario ignora el objeto" #. Tag: para +#: session_api.xml:706 #, no-c-format msgid "" "Usecases for this feature include reconciling data entered into different " @@ -1201,11 +1772,13 @@ msgstr "" "producto, deshacer cambios realizados durante transacciones no-ACID y más." #. Tag: title +#: session_api.xml:713 #, no-c-format msgid "Flushing the Session" msgstr "Limpieza (flushing) de la sesión" #. Tag: para +#: session_api.xml:715 #, no-c-format msgid "" "Sometimes the Session will execute the SQL statements " @@ -1219,26 +1792,31 @@ msgstr "" ", ocurre por defecto en los siguientes puntos:" #. Tag: para +#: session_api.xml:723 #, no-c-format msgid "before some query executions" msgstr "antes de algunas ejecuciones de consulta" #. Tag: para +#: session_api.xml:727 #, no-c-format msgid "from org.hibernate.Transaction.commit()" msgstr "desde org.hibernate.Transaction.commit()" #. Tag: para +#: session_api.xml:732 #, no-c-format msgid "from Session.flush()" msgstr "desde Session.flush()" #. Tag: para +#: session_api.xml:736 #, no-c-format msgid "The SQL statements are issued in the following order:" msgstr "Las declaraciones SQL se emiten en el siguiente orden:" #. Tag: para +#: session_api.xml:740 #, no-c-format msgid "" "all entity insertions in the same order the corresponding objects were saved " @@ -1249,26 +1827,32 @@ msgstr "" "literal>" #. Tag: para +#: session_api.xml:745 #, no-c-format msgid "all entity updates" msgstr "todas las actualizaciones de entidades" #. Tag: para +#: session_api.xml:749 #, no-c-format msgid "all collection deletions" msgstr "todas los borrados de colecciones" #. Tag: para +#: session_api.xml:753 #, no-c-format msgid "all collection element deletions, updates and insertions" -msgstr "todos los borrados, actualizaciones e inserciones de elementos de colección" +msgstr "" +"todos los borrados, actualizaciones e inserciones de elementos de colección" #. Tag: para +#: session_api.xml:757 #, no-c-format msgid "all collection insertions" msgstr "todas las inserciones de colecciones" #. Tag: para +#: session_api.xml:761 #, no-c-format msgid "" "all entity deletions in the same order the corresponding objects were " @@ -1278,6 +1862,7 @@ msgstr "" "correspondientes fueron borrados usando Session.delete() " #. Tag: para +#: session_api.xml:766 #, no-c-format msgid "" "An exception is that objects using native ID generation " @@ -1287,6 +1872,7 @@ msgstr "" "native se insertan cuando se guardan." #. Tag: para +#: session_api.xml:769 #, no-c-format msgid "" "Except when you explicitly flush(), there are absolutely " @@ -1303,7 +1889,8 @@ msgstr "" "desactualizados o incorrectos." #. Tag: para -#, no-c-format +#: session_api.xml:776 +#, fuzzy, no-c-format msgid "" "It is possible to change the default behavior so that flush occurs less " "frequently. The FlushMode class defines three different " @@ -1312,7 +1899,7 @@ msgid "" "never flush unless flush() is called explicitly. The last " "mode is useful for long running units of work, where a Session is kept open and disconnected for a long time (see )." +"\"transactions-optimistic-longsession\"/>)." msgstr "" "Es posible cambiar el comportamiento predeterminado de modo que el vaciado " "ocurra con menos frecuencia. La clase FlushMode define " @@ -1321,16 +1908,37 @@ msgstr "" "automático utilizando la rutina explicada, o nunca vaciar a menos de que se " "llame a flush() explícitamente. El último modo es útil " "para unidades de trabajo largas, donde se mantiene abierta una " -"Session y es desconectada por largo tiempo (consulte la )." +"Session y es desconectada por largo tiempo (consulte la " +")." + +#. Tag: programlisting +#: session_api.xml:786 +#, no-c-format +msgid "" +"sess = sf.openSession();\n" +"Transaction tx = sess.beginTransaction();\n" +"sess.setFlushMode(FlushMode.COMMIT); // allow queries to return stale state\n" +"\n" +"Cat izi = (Cat) sess.load(Cat.class, id);\n" +"izi.setName(iznizi);\n" +"\n" +"// might return stale data\n" +"sess.find(\"from Cat as cat left outer join cat.kittens kitten\");\n" +"\n" +"// change to izi is not flushed!\n" +"...\n" +"tx.commit(); // flush occurs\n" +"sess.close();" +msgstr "" #. Tag: para -#, no-c-format +#: session_api.xml:788 +#, fuzzy, no-c-format msgid "" "During flush, an exception might occur (e.g. if a DML operation violates a " "constraint). Since handling exceptions involves some understanding of " "Hibernate's transactional behavior, we discuss it in ." +"\"transactions\"/>." msgstr "" "Durante el vaciado se puede presentar una excepción (por ejemplo, si una " "operación DML viola una restricción). Ya que el manejo de excepciones " @@ -1338,11 +1946,13 @@ msgstr "" "lo discutimos en . " #. Tag: title +#: session_api.xml:795 #, no-c-format msgid "Transitive persistence" msgstr "Persistencia transitiva" #. Tag: para +#: session_api.xml:797 #, no-c-format msgid "" "It is quite cumbersome to save, delete, or reattach individual objects, " @@ -1354,6 +1964,7 @@ msgstr "" "una relación padre/hijo. Considere el siguiente ejemplo:" #. Tag: para +#: session_api.xml:802 #, no-c-format msgid "" "If the children in a parent/child relationship would be value typed (e.g. a " @@ -1376,6 +1987,7 @@ msgstr "" "referencias compartidas entonces borrará el hijo de la base de datos." #. Tag: para +#: session_api.xml:812 #, no-c-format msgid "" "Now consider the same scenario with parent and child objects being entities, " @@ -1395,6 +2007,7 @@ msgstr "" "no implementa por defecto la persistencia por alcance." #. Tag: para +#: session_api.xml:820 #, no-c-format msgid "" "For each basic operation of the Hibernate session - including " @@ -1414,12 +2027,26 @@ msgstr "" "largo de una asociación, debe indicar eso en el documento de mapeo. Por " "ejemplo:" +#. Tag: programlisting +#: session_api.xml:828 +#, no-c-format +msgid "<one-to-one name=\"person\" cascade=\"persist\"/>" +msgstr "" + #. Tag: para +#: session_api.xml:830 #, no-c-format msgid "Cascade styles my be combined:" msgstr "Los estilos de cascada pueden combinarse:" +#. Tag: programlisting +#: session_api.xml:832 +#, no-c-format +msgid "<one-to-one name=\"person\" cascade=\"persist,delete,lock\"/>" +msgstr "" + #. Tag: para +#: session_api.xml:834 #, no-c-format msgid "" "You can even use cascade=\"all\" to specify that " @@ -1433,30 +2060,133 @@ msgstr "" "predeterminada especifica que ninguna operación se tratará en cascada. " #. Tag: para +#: session_api.xml:839 +#, no-c-format +msgid "" +"In case you are using annotatons you probably have noticed the " +"cascade attribute taking an array of " +"CascadeType as a value. The cascade concept in JPA is " +"very is similar to the transitive persistence and cascading of operations as " +"described above, but with slightly different semantics and cascading types:" +msgstr "" + +#. Tag: para +#: session_api.xml:848 +#, no-c-format +msgid "" +"CascadeType.PERSIST: cascades the persist (create) " +"operation to associated entities persist() is called or if the entity is " +"managed" +msgstr "" + +#. Tag: para +#: session_api.xml:854 +#, no-c-format +msgid "" +"CascadeType.MERGE: cascades the merge operation to " +"associated entities if merge() is called or if the entity is managed" +msgstr "" + +#. Tag: para +#: session_api.xml:860 +#, no-c-format +msgid "" +"CascadeType.REMOVE: cascades the remove operation to " +"associated entities if delete() is called" +msgstr "" + +#. Tag: para +#: session_api.xml:865 +#, no-c-format +msgid "" +"CascadeType.REFRESH: cascades the refresh operation to " +"associated entities if refresh() is called" +msgstr "" + +#. Tag: para +#: session_api.xml:870 +#, no-c-format +msgid "" +"CascadeType.DETACH: cascades the detach operation to " +"associated entities if detach() is called" +msgstr "" + +#. Tag: para +#: session_api.xml:875 +#, fuzzy, no-c-format +msgid "CascadeType.ALL: all of the above" +msgstr "saveOrUpdate() hace lo siguiente:" + +#. Tag: para +#: session_api.xml:880 +#, no-c-format +msgid "" +"CascadeType.ALL also covers Hibernate specific operations like save-update, " +"lock etc..." +msgstr "" + +#. Tag: para +#: session_api.xml:884 #, no-c-format msgid "" "A special cascade style, delete-orphan, applies only to " "one-to-many associations, and indicates that the delete() " "operation should be applied to any child object that is removed from the " -"association." +"association. Using annotations there is no CascadeType.DELETE-" +"ORPHAN equivalent. Instead you can use the attribute " +"orphanRemoval as seen in . If an entity is removed from a " +"@OneToMany collection or an associated entity is " +"dereferenced from a @OneToOne association, this " +"associated entity can be marked for deletion if orphanRemoval is set to true." +msgstr "" + +#. Tag: title +#: session_api.xml:897 +#, no-c-format +msgid "@OneToMany with orphanRemoval" +msgstr "" + +#. Tag: programlisting +#: session_api.xml:900 +#, no-c-format +msgid "" +"@Entity \n" +"public class Customer {\n" +" private Set<Order> orders;\n" +"\n" +" @OneToMany(cascade=CascadeType.ALL, orphanRemoval=true) \n" +" public Set<Order> getOrders() { return orders; }\n" +"\n" +" public void setOrders(Set<Order> orders) { this.orders = orders; }\n" +"\n" +" [...]\n" +"}\n" +"\n" +"@Entity \n" +"public class Order { ... }\n" +"\n" +"Customer customer = em.find(Customer.class, 1l);\n" +"Order order = em.find(Order.class, 1l);\n" +"customer.getOrders().remove(order); //order will be deleted by cascade" msgstr "" -"Un estilo de cascada especial, delete-orphan, se aplica " -"sólamente a asociaciones uno-a-muchos, e indica que la operación " -"delete() debe aplicarse a cualquier objeto hijo que se " -"elimine de la asociación." #. Tag: para +#: session_api.xml:903 #, no-c-format msgid "Recommendations:" msgstr "Recomendaciones:" #. Tag: para -#, no-c-format +#: session_api.xml:907 +#, fuzzy, no-c-format msgid "" -"It does not usually make sense to enable cascade on a <many-to-" -"one> or <many-to-many> association. " -"Cascade is often useful for <one-to-one> and " -"<one-to-many> associations." +"It does not usually make sense to enable cascade on a many-to-one or many-to-" +"many association. In fact the @ManyToOne and " +"@ManyToMany don't even offer a orphanRemoval attribute. Cascading is often useful for one-to-one and one-to-many " +"associations." msgstr "" "Usualmente no tiene sentido habilitar el tratamiento en cascada en una " "asociación <many-to-one> o <many-to-" @@ -1465,17 +2195,20 @@ msgstr "" "many>." #. Tag: para -#, no-c-format +#: session_api.xml:915 +#, fuzzy, no-c-format msgid "" "If the child object's lifespan is bounded by the lifespan of the parent " "object, make it a life cycle object by specifying " -"cascade=\"all,delete-orphan\"." +"cascade=\"all,delete-orphan\"(@OneToMany" +"(cascade=CascadeType.ALL, orphanRemoval=true))." msgstr "" "Si el periodo de vida de los objetos hijos está ligado al periodo de vida " "del objeto padre, hágalo un objeto de ciclo de vida " "especificando cascade=\"all,delete-orphan\". " #. Tag: para +#: session_api.xml:923 #, no-c-format msgid "" "Otherwise, you might not need cascade at all. But if you think that you will " @@ -1490,6 +2223,7 @@ msgstr "" "update\"." #. Tag: para +#: session_api.xml:931 #, no-c-format msgid "" "Mapping an association (either a single valued association, or a collection) " @@ -1504,15 +2238,16 @@ msgstr "" "hijo o hijos." #. Tag: para -#, no-c-format +#: session_api.xml:937 +#, fuzzy, no-c-format msgid "" "Furthermore, a mere reference to a child from a persistent parent will " "result in save/update of the child. This metaphor is incomplete, however. A " "child which becomes unreferenced by its parent is not " -"automatically deleted, except in the case of a <one-to-many> association mapped with cascade=\"delete-orphan\". The precise semantics of cascading operations for a parent/child " -"relationship are as follows:" +"automatically deleted, except in the case of a one-to-many association " +"mapped with cascade=\"delete-orphan\". The precise " +"semantics of cascading operations for a parent/child relationship are as " +"follows:" msgstr "" "Además, una mera referencia a un hijo desde un padre persistente hará que se " "guarde/actualice el hijo. Sin embargo, esta metáfora se encuentra " @@ -1523,6 +2258,7 @@ msgstr "" "una relación padre/hijo es la siguiente:" #. Tag: para +#: session_api.xml:948 #, no-c-format msgid "" "If a parent is passed to persist(), all children are " @@ -1532,6 +2268,7 @@ msgstr "" "persist()" #. Tag: para +#: session_api.xml:953 #, no-c-format msgid "" "If a parent is passed to merge(), all children are passed " @@ -1541,6 +2278,7 @@ msgstr "" "merge()" #. Tag: para +#: session_api.xml:958 #, no-c-format msgid "" "If a parent is passed to save(), update()saveOrUpdate()" #. Tag: para +#: session_api.xml:964 #, no-c-format msgid "" "If a transient or detached child becomes referenced by a persistent parent, " @@ -1561,13 +2300,16 @@ msgstr "" "persistente, le es pasado a saveOrUpdate()" #. Tag: para +#: session_api.xml:970 #, no-c-format msgid "" "If a parent is deleted, all children are passed to delete()" -msgstr "Si se borra un padre, se pasan todos los hijos a delete()" +msgstr "" +"Si se borra un padre, se pasan todos los hijos a delete()" #. Tag: para +#: session_api.xml:975 #, no-c-format msgid "" "If a child is dereferenced by a persistent parent, nothing special " @@ -1581,6 +2323,7 @@ msgstr "" "literal>, en cuyo caso se borra el hijo \"huérfano\"." #. Tag: para +#: session_api.xml:983 #, no-c-format msgid "" "Finally, note that cascading of operations can be applied to an object graph " @@ -1600,11 +2343,13 @@ msgstr "" "Session." #. Tag: title +#: session_api.xml:993 #, no-c-format msgid "Using metadata" msgstr "Utilización de metadatos" #. Tag: para +#: session_api.xml:995 #, no-c-format msgid "" "Hibernate requires a rich meta-level model of all entity and value types. " @@ -1623,6 +2368,7 @@ msgstr "" "las entidades asociadas)." #. Tag: para +#: session_api.xml:1002 #, no-c-format msgid "" "Hibernate exposes metadata via the ClassMetadata and " @@ -1635,3 +2381,34 @@ msgstr "" "la jerarquía Type. Las instancias de las interfaces de " "metadatos se pueden obtener de la SessionFactory." +#. Tag: programlisting +#: session_api.xml:1007 +#, no-c-format +msgid "" +"Cat fritz = ......;\n" +"ClassMetadata catMeta = sessionfactory.getClassMetadata(Cat.class);\n" +"\n" +"Object[] propertyValues = catMeta.getPropertyValues(fritz);\n" +"String[] propertyNames = catMeta.getPropertyNames();\n" +"Type[] propertyTypes = catMeta.getPropertyTypes();\n" +"\n" +"// get a Map of all properties which are not collections or associations\n" +"Map namedValues = new HashMap();\n" +"for ( int i=0; i<propertyNames.length; i++ ) {\n" +" if ( !propertyTypes[i].isEntityType() && !propertyTypes[i]." +"isCollectionType() ) {\n" +" namedValues.put( propertyNames[i], propertyValues[i] );\n" +" }\n" +"}" +msgstr "" + +#~ msgid "" +#~ "A special cascade style, delete-orphan, applies only " +#~ "to one-to-many associations, and indicates that the delete() operation should be applied to any child object that is removed " +#~ "from the association." +#~ msgstr "" +#~ "Un estilo de cascada especial, delete-orphan, se " +#~ "aplica sólamente a asociaciones uno-a-muchos, e indica que la operación " +#~ "delete() debe aplicarse a cualquier objeto hijo que se " +#~ "elimine de la asociación." diff --git a/documentation/manual/src/main/docbook/es-ES/content/tutorial.po b/documentation/manual/src/main/docbook/es-ES/content/tutorial.po index 665c4d1fbd..10cd77b62f 100644 --- a/documentation/manual/src/main/docbook/es-ES/content/tutorial.po +++ b/documentation/manual/src/main/docbook/es-ES/content/tutorial.po @@ -14,7 +14,7 @@ msgid "" msgstr "" "Project-Id-Version: tutorial\n" "Report-Msgid-Bugs-To: http://bugs.kde.org\n" -"POT-Creation-Date: 2010-02-11T05:38:16\n" +"POT-Creation-Date: 2010-07-20 21:02+0000\n" "PO-Revision-Date: 2010-03-15 13:03+1000\n" "Last-Translator: Angela Garcia \n" "Language-Team: \n" @@ -24,11 +24,13 @@ msgstr "" "X-Generator: KBabel 1.11.4\n" #. Tag: title +#: tutorial.xml:34 #, no-c-format msgid "Tutorial" msgstr "Tutorial" #. Tag: para +#: tutorial.xml:36 #, no-c-format msgid "" "Intended for new users, this chapter provides an step-by-step introduction " @@ -44,6 +46,7 @@ msgstr "" "tutorials/web de la fuente del proyecto. " #. Tag: para +#: tutorial.xml:45 #, no-c-format msgid "" "This tutorial expects the user have knowledge of both Java and SQL. If you " @@ -56,6 +59,7 @@ msgstr "" "sobre Hibernate." #. Tag: para +#: tutorial.xml:54 #, no-c-format msgid "" "The distribution contains another example application under the " @@ -65,11 +69,13 @@ msgstr "" "fuente del proyecto tutorial/eg." #. Tag: title +#: tutorial.xml:62 #, no-c-format msgid "Part 1 - The first Hibernate Application" msgstr "Parte 1 - La primera aplicación Hibernate" #. Tag: para +#: tutorial.xml:64 #, no-c-format msgid "" "For this example, we will set up a small database application that can store " @@ -80,6 +86,7 @@ msgstr "" "los anfitriones de estos eventos." #. Tag: para +#: tutorial.xml:70 #, no-c-format msgid "" "Although you can use whatever database you feel comfortable using, we will " @@ -93,11 +100,13 @@ msgstr "" "cualquier servidor de base de datos en particular." #. Tag: title +#: tutorial.xml:79 #, no-c-format msgid "Setup" msgstr "Configuración" #. Tag: para +#: tutorial.xml:81 #, no-c-format msgid "" "The first thing we need to do is to set up the development environment. We " @@ -120,6 +129,7 @@ msgstr "" "webapp
." #. Tag: para +#: tutorial.xml:91 #, no-c-format msgid "" "We will be using Maven in this tutorial, taking advantage of its transitive " @@ -131,11 +141,65 @@ msgstr "" "muchos IDEs para configurar automáticamente un proyecto para nosotros con " "base en el descriptor maven." -#. Tag: para +#. Tag: programlisting +#: tutorial.xml:97 #, no-c-format msgid "" +"\n" +"\n" +" 4.0.0\n" +"\n" +" org.hibernate.tutorials\n" +" hibernate-tutorial\n" +" 1.0.0-SNAPSHOT\n" +" First Hibernate Tutorial\n" +"\n" +" \n" +" \n" +" ${artifactId}\n" +" \n" +"\n" +" \n" +" \n" +" org.hibernate\n" +" hibernate-core\n" +" \n" +"\n" +" \n" +" \n" +" javax.servlet\n" +" servlet-api\n" +" \n" +"\n" +" \n" +" \n" +" org.slf4j\n" +" slf4j-simple\n" +" \n" +"\n" +" \n" +" \n" +" javassist\n" +" javassist\n" +" \n" +" \n" +"\n" +"]]>" +msgstr "" + +#. Tag: para +#: tutorial.xml:100 +#, fuzzy, no-c-format +msgid "" "It is not a requirement to use Maven. If you wish to use something else to " -"build this tutoial (such as Ant), the layout will remain the same. The only " +"build this tutorial (such as Ant), the layout will remain the same. The only " "change is that you will need to manually account for all the needed " "dependencies. If you use something like Ivy providing transitive dependency management you would " @@ -148,34 +212,38 @@ msgid "" "javassist
directory; additionally you will need both the servlet-" "api jar and one of the slf4j logging backends." msgstr "" -"No es un requerimiento el uso de Maven. Si desea utilizar alguna otra cosa para " -"construir este tutorial (tal como Ant), el diseño sigue siendo el mismo. El " -"único cambio es que necesitará dar cuenta manualmente por todas las " -"dependencias que se necesitan. Si usa algo como Ivy para brindar administración de dependencias transitivas " -"todavía utilizaría las dependencias que mencionamos anteriormente. De otra " -"manera, necesitará encontrar todas las dependencias, explícitas y " -"transitivas y agregarlas a la ruta de clase del proyecto. Si trabaja desde " -"el paquete de distribución Hibernate, esto significaría que " -"hibernate3.jar, todos los artefactos en el directorio " -"lib/required y todos los archivos del directorio " -"lib/bytecode/cglib o lib/bytecode/javassist; además necesitará el servlet-api jar y uno de los backends de " -"registro slf4j." +"No es un requerimiento el uso de Maven. Si desea utilizar alguna otra cosa " +"para construir este tutorial (tal como Ant), el diseño sigue siendo el " +"mismo. El único cambio es que necesitará dar cuenta manualmente por todas " +"las dependencias que se necesitan. Si usa algo como Ivy para brindar administración de dependencias " +"transitivas todavía utilizaría las dependencias que mencionamos " +"anteriormente. De otra manera, necesitará encontrar todas las dependencias, explícitas y transitivas y agregarlas a la ruta " +"de clase del proyecto. Si trabaja desde el paquete de distribución " +"Hibernate, esto significaría que hibernate3.jar, todos " +"los artefactos en el directorio lib/required y todos " +"los archivos del directorio lib/bytecode/cglib o " +"lib/bytecode/javassist; además necesitará el servlet-" +"api jar y uno de los backends de registro slf4j." #. Tag: para +#: tutorial.xml:117 #, no-c-format -msgid "Save this file as pom.xml in the project root directory." +msgid "" +"Save this file as pom.xml in the project root directory." msgstr "" "Guarde este archivo como pom.xml en el directorio raíz " "del proyecto." #. Tag: title +#: tutorial.xml:124 #, no-c-format msgid "The first class" msgstr "La primera clase" #. Tag: para +#: tutorial.xml:126 #, no-c-format msgid "" "Next, we create a class that represents the event we want to store in the " @@ -184,7 +252,50 @@ msgstr "" "Luego creamos una clase que representa el evento que queremos almacenar en " "la base de datos, es una clase JavaBean simple con algunas propiedades:" +#. Tag: programlisting +#: tutorial.xml:131 +#, no-c-format +msgid "" +"" +msgstr "" + #. Tag: para +#: tutorial.xml:133 #, no-c-format msgid "" "This class uses standard JavaBean naming conventions for property getter and " @@ -200,6 +311,7 @@ msgstr "" "benefician la robustez de la refactorización. " #. Tag: para +#: tutorial.xml:141 #, no-c-format msgid "" "The id property holds a unique identifier value for a " @@ -229,6 +341,7 @@ msgstr "" "Puede escoger y hacer que se ajuste a su diseño de su aplicación." #. Tag: para +#: tutorial.xml:156 #, no-c-format msgid "" "The no-argument constructor is a requirement for all persistent classes; " @@ -245,6 +358,7 @@ msgstr "" "código byte." #. Tag: para +#: tutorial.xml:164 #, no-c-format msgid "" "Save this file to the src/main/java/org/hibernate/tutorial/domain." #. Tag: title +#: tutorial.xml:171 #, no-c-format msgid "The mapping file" msgstr "El archivo de mapeo" #. Tag: para +#: tutorial.xml:173 #, no-c-format msgid "" "Hibernate needs to know how to load and store objects of the persistent " @@ -272,11 +388,27 @@ msgstr "" "la base de datos, y que columnas debe utilizar en esta tabla." #. Tag: para +#: tutorial.xml:181 #, no-c-format msgid "The basic structure of a mapping file looks like this:" msgstr "La estructura básica de un archivo de mapeo se ve así:" +#. Tag: programlisting +#: tutorial.xml:185 +#, no-c-format +msgid "" +"\n" +"\n" +"\n" +"\n" +"[...]\n" +"]]>" +msgstr "" + #. Tag: para +#: tutorial.xml:187 #, no-c-format msgid "" "Hibernate DTD is sophisticated. You can use it for auto-completion of XML " @@ -299,6 +431,7 @@ msgstr "" "la distribución)." #. Tag: para +#: tutorial.xml:200 #, no-c-format msgid "" "We will omit the DTD declaration in future examples to shorten the code. It " @@ -308,6 +441,7 @@ msgstr "" "corto el código. Esto no es opcional." #. Tag: para +#: tutorial.xml:206 #, no-c-format msgid "" "Between the two hibernate-mapping tags, include a " @@ -321,7 +455,21 @@ msgstr "" "entidades de primera clase) necesitan de dicho mapeo en una tabla en la base " "de datos SQL:" +#. Tag: programlisting +#: tutorial.xml:213 +#, no-c-format +msgid "" +"\n" +"\n" +" \n" +"\n" +" \n" +"\n" +"]]>" +msgstr "" + #. Tag: para +#: tutorial.xml:215 #, no-c-format msgid "" "So far we have told Hibernate how to persist and load object of class " @@ -339,7 +487,23 @@ msgstr "" "identificador, configuramos la estrategia de generación del identificador de " "Hibernate para una columna clave primaria sustituta:" +#. Tag: programlisting +#: tutorial.xml:225 +#, no-c-format +msgid "" +"\n" +"\n" +" \n" +" \n" +" \n" +" \n" +" \n" +"\n" +"]]>" +msgstr "" + #. Tag: para +#: tutorial.xml:227 #, no-c-format msgid "" "The id element is the declaration of the identifier " @@ -357,6 +521,7 @@ msgstr "" "tabla EVENTS tiene el valor de la llave principal." #. Tag: para +#: tutorial.xml:237 #, no-c-format msgid "" "The nested generator element specifies the identifier " @@ -378,17 +543,18 @@ msgstr "" "estrategia." #. Tag: para -#, no-c-format +#: tutorial.xml:249 +#, fuzzy, no-c-format msgid "" "native is no longer consider the best strategy in terms " -"of portability. for further discussion, see " +"of portability. for further discussion, see" msgstr "" "native ya no se considera como la mejor estrategia en " -"términos de portabilidad. Para obtener mayor información consulte . " +"términos de portabilidad. Para obtener mayor información consulte . " #. Tag: para +#: tutorial.xml:255 #, no-c-format msgid "" "Lastly, we need to tell Hibernate about the remaining entity class " @@ -398,7 +564,26 @@ msgstr "" "de entidad que quedan. Por defecto, ninguna propiedad de la clase se " "considera persistente:" +#. Tag: programlisting +#: tutorial.xml:261 +#, no-c-format +msgid "" +"\n" +"\n" +" \n" +" \n" +" \n" +" \n" +" \n" +" \n" +" \n" +"\n" +"]]>" +msgstr "" + #. Tag: para +#: tutorial.xml:263 #, no-c-format msgid "" "Similar to the id element, the name " @@ -414,6 +599,7 @@ msgstr "" "()
, getTitle() y setTitle()." #. Tag: para +#: tutorial.xml:274 #, no-c-format msgid "" "Why does the date property mapping include the " @@ -432,6 +618,7 @@ msgstr "" "mejor que la mapeamos a un nombre diferente." #. Tag: para +#: tutorial.xml:284 #, no-c-format msgid "" "The title mapping also lacks a type " @@ -466,6 +653,7 @@ msgstr "" "mantenemos la información completa sobre la hora y fecha." #. Tag: para +#: tutorial.xml:300 #, no-c-format msgid "" "Hibernate makes this mapping type determination using reflection when the " @@ -479,6 +667,7 @@ msgstr "" "definir explícitamente el tipo a usar." #. Tag: para +#: tutorial.xml:307 #, no-c-format msgid "" "Save this mapping file as src/main/resources/org/hibernate/" @@ -488,11 +677,13 @@ msgstr "" "tutorial/domain/Event.hbm.xml." #. Tag: title +#: tutorial.xml:315 #, no-c-format msgid "Hibernate configuration" msgstr "Configuración de Hibernate" #. Tag: para +#: tutorial.xml:317 #, no-c-format msgid "" "At this point, you should have the persistent class and its mapping file in " @@ -504,11 +695,13 @@ msgstr "" "ejecute en \"modo de servidor\"" #. Tag: para +#: tutorial.xml:324 #, no-c-format msgid "We do this do that the data remains between runs." msgstr "Hacemos esto o lo otro y los datos permanecen entre ejecuciones." #. Tag: para +#: tutorial.xml:329 #, no-c-format msgid "" "We will utilize the Maven exec plugin to launch the HSQLDB server by " @@ -528,6 +721,7 @@ msgstr "" "en el directorio target/data e inicie HSQLDB de nuevo." #. Tag: para +#: tutorial.xml:340 #, no-c-format msgid "" "Hibernate will be connecting to the database on behalf of your application, " @@ -549,15 +743,18 @@ msgstr "" "conexiones incluido de Hibernate para este tutorial." #. Tag: para +#: tutorial.xml:351 #, no-c-format msgid "" "The built-in Hibernate connection pool is in no way intended for production " "use. It lacks several features found on any decent connection pool." msgstr "" "El pool de conexiones de Hibernate no está diseñado para utilizarse en " -"producción. Le faltan varias funcionalidades que se encuentran en cualquier pool de conexiones decente. " +"producción. Le faltan varias funcionalidades que se encuentran en cualquier " +"pool de conexiones decente. " #. Tag: para +#: tutorial.xml:357 #, no-c-format msgid "" "For Hibernate's configuration, we can use a simple hibernate." @@ -571,12 +768,63 @@ msgstr "" "configuración completamente programática. La mayoría de los usuarios " "prefieren el archivo de configuración XML:" +#. Tag: programlisting +#: tutorial.xml:363 +#, no-c-format +msgid "" +"\n" +"\n" +"\n" +"\n" +"\n" +" \n" +"\n" +" \n" +" org.hsqldb.jdbcDriver\n" +" jdbc:hsqldb:hsql://localhost\n" +" sa\n" +" \n" +"\n" +" \n" +" 1\n" +"\n" +" \n" +" org.hibernate.dialect.HSQLDialect\n" +"\n" +" \n" +" thread\n" +"\n" +" \n" +" org.hibernate.cache." +"NoCacheProvider\n" +"\n" +" \n" +" true\n" +"\n" +" \n" +" update\n" +"\n" +" \n" +"\n" +" \n" +"\n" +"]]>" +msgstr "" + #. Tag: para +#: tutorial.xml:366 #, no-c-format msgid "Notice that this configuration file specifies a different DTD" msgstr "Observe que este archivo de configuración especifica un DTD diferente" #. Tag: para +#: tutorial.xml:369 #, no-c-format msgid "" "You configure Hibernate's SessionFactory. SessionFactory " @@ -591,6 +839,7 @@ msgstr "" "archivos de configuración." #. Tag: para +#: tutorial.xml:376 #, no-c-format msgid "" "The first four property elements contain the necessary " @@ -603,15 +852,18 @@ msgstr "" "particular que Hibernate genera." #. Tag: para -#, no-c-format +#: tutorial.xml:383 +#, fuzzy, no-c-format msgid "" "In most cases, Hibernate is able to properly determine which dialect to use. " -"See for more information." +"See for more information." msgstr "" "Hibernate tiene la habilidad de determinar correctamente qué dialecto " -"utilizar en la mayoría de los casos. Consulte para obtener mayor información." +"utilizar en la mayoría de los casos. Consulte para obtener mayor información." #. Tag: para +#: tutorial.xml:389 #, no-c-format msgid "" "Hibernate's automatic session management for persistence contexts is " @@ -632,6 +884,7 @@ msgstr "" "clases persistentes." #. Tag: para +#: tutorial.xml:398 #, no-c-format msgid "" "Save this file as hibernate.cfg.xml into the " @@ -641,11 +894,13 @@ msgstr "" "directorio src/main/resources." #. Tag: title +#: tutorial.xml:406 #, no-c-format msgid "Building with Maven" msgstr "Construcción con Maven" #. Tag: para +#: tutorial.xml:408 #, no-c-format msgid "" "We will now build the tutorial with Maven. You will need to have Maven " @@ -663,12 +918,43 @@ msgstr "" "meta compile para asegurarnos de que podemos compilar " "todo hasta el momento:" +#. Tag: programlisting +#: tutorial.xml:418 +#, no-c-format +msgid "" +"" +msgstr "" + #. Tag: title +#: tutorial.xml:423 #, no-c-format msgid "Startup and helpers" msgstr "Inicio y ayudantes" #. Tag: para +#: tutorial.xml:425 #, no-c-format msgid "" "It is time to load and store some Event objects, but " @@ -695,6 +981,7 @@ msgstr "" "instancia una sóla vez." #. Tag: para +#: tutorial.xml:439 #, no-c-format msgid "" "We will create a HibernateUtil helper class that takes " @@ -705,7 +992,42 @@ msgstr "" "encargue del inicio y haga más práctico el acceso a org." "hibernate.SessionFactory. " +#. Tag: programlisting +#: tutorial.xml:445 +#, no-c-format +msgid "" +"" +msgstr "" + #. Tag: para +#: tutorial.xml:447 #, no-c-format msgid "" "Save this code as src/main/java/org/hibernate/tutorial/util/" @@ -715,6 +1037,7 @@ msgstr "" "HibernateUtil.java" #. Tag: para +#: tutorial.xml:452 #, no-c-format msgid "" "This class not only produces the global org.hibernate." @@ -732,6 +1055,7 @@ msgstr "" "lugar." #. Tag: para +#: tutorial.xml:461 #, no-c-format msgid "" "If you give the org.hibernate.SessionFactory " @@ -749,6 +1073,7 @@ msgstr "" "JNDI. Más adelante discutiremos estas opciones avanzadas." #. Tag: para +#: tutorial.xml:470 #, no-c-format msgid "" "You now need to configure a logging system. Hibernate uses commons logging " @@ -771,6 +1096,7 @@ msgstr "" "inicio de Hibernate en la salida estándar." #. Tag: para +#: tutorial.xml:480 #, no-c-format msgid "" "The tutorial infrastructure is complete and you are now ready to do some " @@ -780,14 +1106,16 @@ msgstr "" "poco de trabajo real con Hibernate." #. Tag: title +#: tutorial.xml:488 #, no-c-format msgid "Loading and storing objects" msgstr "Carga y almacenamiento de objetos" #. Tag: para -#, no-c-format +#: tutorial.xml:490 +#, fuzzy, no-c-format msgid "" -"We are now ready to start doing some real worjk with Hibernate. Let's start " +"We are now ready to start doing some real work with Hibernate. Let's start " "by writing an EventManager class with a main() method:" msgstr "" @@ -795,7 +1123,49 @@ msgstr "" "Empecemos por escribir una clase EventManager con un " "método main():" +#. Tag: programlisting +#: tutorial.xml:496 +#, no-c-format +msgid "" +"" +msgstr "" + #. Tag: para +#: tutorial.xml:498 #, no-c-format msgid "" "In createAndStoreEvent() we created a new Eventorg.hibernate.Session is designed to represent a " -"single unit of work (a single atmoic piece of work to be performed). For now " +"single unit of work (a single atomic piece of work to be performed). For now " "we will keep things simple and assume a one-to-one granularity between a " "Hibernate org.hibernate.Session and a database " "transaction. To shield our code from the actual underlying transaction " @@ -831,6 +1202,7 @@ msgstr "" "transaccional basada en JDBC pero también puede ejecutarse con JTA. " #. Tag: para +#: tutorial.xml:518 #, no-c-format msgid "" "What does sessionFactory.getCurrentSession() do? First, " @@ -852,6 +1224,7 @@ msgstr "" "encuentra vinculada al hilo de Java actual que ejecuta nuestra aplicación." #. Tag: para +#: tutorial.xml:532 #, no-c-format msgid "" "Hibernate offers three methods of current session tracking. The \"thread\" " @@ -865,6 +1238,7 @@ msgstr "" "detalles el rastreo de sesión actual." #. Tag: para +#: tutorial.xml:541 #, no-c-format msgid "" "A org.hibernate.Session begins when the first call to " @@ -887,6 +1261,7 @@ msgstr "" "unidad de trabajo. " #. Tag: para +#: tutorial.xml:554 #, no-c-format msgid "" "Related to the unit of work scope, should the Hibernate org." @@ -916,9 +1291,10 @@ msgstr "" "muestra una aplicación web real, lo cual le ayudará a ilustrar esto." #. Tag: para -#, no-c-format +#: tutorial.xml:571 +#, fuzzy, no-c-format msgid "" -"See for more information about transaction " +"See for more information about transaction " "handling and demarcation. The previous example also skipped any error " "handling and rollback." msgstr "" @@ -927,6 +1303,7 @@ msgstr "" "también nos saltamos el manejo de errores y cómo deshacerlos. " #. Tag: para +#: tutorial.xml:577 #, no-c-format msgid "" "To run this, we will make use of the Maven exec plugin to call our class " @@ -939,11 +1316,14 @@ msgstr "" "args=\"store\"" #. Tag: para +#: tutorial.xml:584 #, no-c-format msgid "You may need to perform mvn compile first." -msgstr "Es posible que primero necesite realizar mvn compile." +msgstr "" +"Es posible que primero necesite realizar mvn compile." #. Tag: para +#: tutorial.xml:589 #, no-c-format msgid "" "You should see Hibernate starting up and, depending on your configuration, " @@ -952,29 +1332,75 @@ msgstr "" "Debe ver que Hibernate inicia y dependiendo de su configuración, también " "verá bastantes salidas de registro. Al final, verá la siguiente línea:" +#. Tag: programlisting +#: tutorial.xml:594 +#, no-c-format +msgid "" +"" +msgstr "" + #. Tag: para +#: tutorial.xml:596 #, no-c-format msgid "This is the INSERT executed by Hibernate." msgstr "Este es el INSERT que Hibernate ejecuta." #. Tag: para +#: tutorial.xml:600 #, no-c-format msgid "To list stored events an option is added to the main method:" -msgstr "Para listar los eventos almacenados se agrega una opción al método principal:" +msgstr "" +"Para listar los eventos almacenados se agrega una opción al método principal:" + +#. Tag: programlisting +#: tutorial.xml:604 +#, no-c-format +msgid "" +"" +msgstr "" #. Tag: para +#: tutorial.xml:606 #, no-c-format msgid "A new listEvents() method is also added:" msgstr "También agregamos un método listEvents():" -#. Tag: para +#. Tag: programlisting +#: tutorial.xml:610 #, no-c-format msgid "" +"" +msgstr "" + +#. Tag: para +#: tutorial.xml:612 +#, fuzzy, no-c-format +msgid "" "Here, we are using a Hibernate Query Language (HQL) query to load all " "existing Event objects from the database. Hibernate will " "generate the appropriate SQL, send it to the database and populate " "Event objects with the data. You can create more complex " -"queries with HQL. See for more information." +"queries with HQL. See for more information." msgstr "" "Aquí utilizamos una consulta HQL (Hibernate Query Language) para cargar " "todos los objetos Event desde la base de datos. Hibernate " @@ -984,6 +1410,7 @@ msgstr "" "información." #. Tag: para +#: tutorial.xml:620 #, no-c-format msgid "" "Now we can call our new functionality, again using the Maven exec plugin: " @@ -995,11 +1422,13 @@ msgstr "" "tutorial.EventManager\" -Dexec.args=\"list\"" #. Tag: title +#: tutorial.xml:630 #, no-c-format msgid "Part 2 - Mapping associations" msgstr "Part 2 - Mapeo de asociaciones" #. Tag: para +#: tutorial.xml:632 #, no-c-format msgid "" "So far we have mapped a single persistent entity class to a table in " @@ -1013,16 +1442,39 @@ msgstr "" "lista de eventos en las que participan." #. Tag: title +#: tutorial.xml:640 #, no-c-format msgid "Mapping the Person class" msgstr "Mapeo de la clase Person" #. Tag: para +#: tutorial.xml:642 #, no-c-format msgid "The first cut of the Person class looks like this:" msgstr "El primer corte de la clase Person se ve así:" +#. Tag: programlisting +#: tutorial.xml:646 +#, no-c-format +msgid "" +"" +msgstr "" + #. Tag: para +#: tutorial.xml:648 #, no-c-format msgid "" "Save this to a file named src/main/java/org/hibernate/tutorial/" @@ -1032,6 +1484,7 @@ msgstr "" "tutorial/domain/Person.java" #. Tag: para +#: tutorial.xml:653 #, no-c-format msgid "" "Next, create the new mapping file as src/main/resources/org/" @@ -1040,12 +1493,40 @@ msgstr "" "Luego, cree el nuevo archivo de mapeo como src/main/resources/org/" "hibernate/tutorial/domain/Person.hbm.xml" +#. Tag: programlisting +#: tutorial.xml:658 +#, no-c-format +msgid "" +"\n" +"\n" +" \n" +" \n" +" \n" +" \n" +" \n" +" \n" +" \n" +" \n" +"\n" +"]]>" +msgstr "" + #. Tag: para +#: tutorial.xml:660 #, no-c-format msgid "Finally, add the new mapping to Hibernate's configuration:" msgstr "Finalmente, añada el nuevo mapeo a la configuración de Hibernate:" +#. Tag: programlisting +#: tutorial.xml:664 +#, no-c-format +msgid "" +"\n" +"]]>" +msgstr "" + #. Tag: para +#: tutorial.xml:666 #, no-c-format msgid "" "Create an association between these two entities. Persons can participate in " @@ -1058,11 +1539,13 @@ msgstr "" "multiplicidad y comportamiento de la colección." #. Tag: title +#: tutorial.xml:676 #, no-c-format msgid "A unidirectional Set-based association" msgstr "Una asociación unidireccional basada en Set" #. Tag: para +#: tutorial.xml:678 #, no-c-format msgid "" "By adding a collection of events to the Person class, you " @@ -1082,7 +1565,26 @@ msgstr "" "contendrá elementos duplicados y el orden no es relevante para nuestros " "ejemplos." +#. Tag: programlisting +#: tutorial.xml:689 +#, no-c-format +msgid "" +"" +msgstr "" + #. Tag: para +#: tutorial.xml:691 #, no-c-format msgid "" "Before mapping this association, let's consider the other side. We could " @@ -1106,7 +1608,28 @@ msgstr "" "asociación muchos-a-muchos. Por lo tanto, utilizamos un " "mapeo muchos-a-muchos de Hibernate:" +#. Tag: programlisting +#: tutorial.xml:704 +#, no-c-format +msgid "" +"\n" +" \n" +" \n" +" \n" +" \n" +" \n" +" \n" +"\n" +" \n" +" \n" +" \n" +" \n" +"\n" +"]]>" +msgstr "" + #. Tag: para +#: tutorial.xml:706 #, no-c-format msgid "" "Hibernate supports a broad range of collection mappings, a set | *EVENT_ID | | |\n" +" | EVENT_DATE | | *PERSON_ID | <--> | *PERSON_ID |\n" +" | TITLE | |__________________| | AGE |\n" +" |_____________| | FIRSTNAME |\n" +" | LASTNAME |\n" +" |_____________|\n" +" ]]>" +msgstr "" + #. Tag: title +#: tutorial.xml:731 #, no-c-format msgid "Working the association" msgstr "Trabajo de la asociación" #. Tag: para +#: tutorial.xml:733 #, no-c-format msgid "" "Now we will bring some people and events together in a new method in " @@ -1152,7 +1697,25 @@ msgstr "" "Vamos a reunir a algunas personas y eventos en un nuevo método en " "EventManager:" +#. Tag: programlisting +#: tutorial.xml:737 +#, no-c-format +msgid "" +"" +msgstr "" + #. Tag: para +#: tutorial.xml:739 #, no-c-format msgid "" "After loading a Person and an Event, " @@ -1186,6 +1749,7 @@ msgstr "" "transacción de la base de datos." #. Tag: para +#: tutorial.xml:758 #, no-c-format msgid "" "You can load person and event in different units of work. Or you can modify " @@ -1201,7 +1765,43 @@ msgstr "" "emphasis> ). Inclusive, puede modificar una colección cuando se encuentre " "separada:" +#. Tag: programlisting +#: tutorial.xml:767 +#, no-c-format +msgid "" +"" +msgstr "" + #. Tag: para +#: tutorial.xml:769 #, no-c-format msgid "" "The call to update makes a detached object persistent " @@ -1217,6 +1817,7 @@ msgstr "" "o eliminaciones) que le hizo a una colección de ese objeto entidad." #. Tag: para +#: tutorial.xml:778 #, no-c-format msgid "" "This is not much use in our example, but it is an important concept you can " @@ -1234,7 +1835,22 @@ msgstr "" "(pueda que necesite modificar algunos de los métodos anteriores para " "retornar ese identificador):" +#. Tag: programlisting +#: tutorial.xml:786 +#, no-c-format +msgid "" +"" +msgstr "" + #. Tag: para +#: tutorial.xml:788 #, no-c-format msgid "" "This is an example of an association between two equally important classes : " @@ -1266,6 +1882,7 @@ msgstr "" "como tipos de valor. " #. Tag: para +#: tutorial.xml:806 #, no-c-format msgid "" "You can also design a collection of value types. This is conceptually " @@ -1277,11 +1894,13 @@ msgstr "" "pero se ve casi igual en Java." #. Tag: title +#: tutorial.xml:815 #, no-c-format msgid "Collection of values" msgstr "Colección de valores" #. Tag: para +#: tutorial.xml:817 #, no-c-format msgid "" "Let's add a collection of email addresses to the Person " @@ -1293,12 +1912,39 @@ msgstr "" "java.util.Set de las instnaicas " "java.lang.String:" +#. Tag: programlisting +#: tutorial.xml:823 +#, no-c-format +msgid "" +"" +msgstr "" + #. Tag: para +#: tutorial.xml:825 #, no-c-format msgid "The mapping of this Set is as follows:" msgstr "El mapeo de este Set es así:" +#. Tag: programlisting +#: tutorial.xml:829 +#, no-c-format +msgid "" +"\n" +" \n" +" \n" +" ]]>" +msgstr "" + #. Tag: para +#: tutorial.xml:831 #, no-c-format msgid "" "The difference compared with the earlier mapping is the use of the " @@ -1326,11 +1972,39 @@ msgstr "" "realmente se almacenarán los valores de la dirección de correo electrónico." #. Tag: para +#: tutorial.xml:847 #, no-c-format msgid "Here is the updated schema:" msgstr "Este es el esquema actualizado:" +#. Tag: programlisting +#: tutorial.xml:851 +#, no-c-format +msgid "" +" | *EVENT_ID | | | |" +"___________________|\n" +" | EVENT_DATE | | *PERSON_ID | <--> | *PERSON_ID | <--> | " +"*PERSON_ID |\n" +" | TITLE | |__________________| | AGE | | " +"*EMAIL_ADDR |\n" +" |_____________| | FIRSTNAME | |" +"___________________|\n" +" | LASTNAME |\n" +" |_____________|\n" +" ]]>" +msgstr "" + #. Tag: para +#: tutorial.xml:853 #, no-c-format msgid "" "You can see that the primary key of the collection table is in fact a " @@ -1344,6 +2018,7 @@ msgstr "" "cual es exactamente la semántica que necesitamos para un conjunto en Java." #. Tag: para +#: tutorial.xml:859 #, no-c-format msgid "" "You can now try to add elements to this collection, just like we did before " @@ -1352,7 +2027,27 @@ msgstr "" "Ahora, puede tratar de agregar elementos a esta colección, al igual que lo " "hicimos antes vinculando personas y eventos. Es el mismo código en Java." +#. Tag: programlisting +#: tutorial.xml:864 +#, no-c-format +msgid "" +"" +msgstr "" + #. Tag: para +#: tutorial.xml:866 #, no-c-format msgid "" "This time we did not use a fetch query to initialize " @@ -1364,11 +2059,13 @@ msgstr "" "intente de optimizar esto con una recuperación temprana." #. Tag: title +#: tutorial.xml:875 #, no-c-format msgid "Bi-directional associations" msgstr "Asociaciones bidireccionales" #. Tag: para +#: tutorial.xml:877 #, no-c-format msgid "" "Next you will map a bi-directional association. You will make the " @@ -1382,6 +2079,7 @@ msgstr "" "multiplicidad muchos-a-muchos." #. Tag: para +#: tutorial.xml:885 #, no-c-format msgid "" "A relational database is more flexible than a network programming language, " @@ -1393,6 +2091,7 @@ msgstr "" "ver y recuperar de cualquier forma posible." #. Tag: para +#: tutorial.xml:893 #, no-c-format msgid "" "First, add a collection of participants to the Event " @@ -1401,12 +2100,42 @@ msgstr "" "Primero, agregue una colección de participantes a la clase Event:" -#. Tag: para +#. Tag: programlisting +#: tutorial.xml:898 #, no-c-format -msgid "Now map this side of the association in Event.hbm.xml." -msgstr "Ahora mapee este lado de la asociación en Event.hbm.xml." +msgid "" +"" +msgstr "" #. Tag: para +#: tutorial.xml:900 +#, no-c-format +msgid "" +"Now map this side of the association in Event.hbm.xml." +msgstr "" +"Ahora mapee este lado de la asociación en Event.hbm.xml." + +#. Tag: programlisting +#: tutorial.xml:904 +#, no-c-format +msgid "" +"\n" +" \n" +" \n" +" ]]>" +msgstr "" + +#. Tag: para +#: tutorial.xml:906 #, no-c-format msgid "" "These are normal set mappings in both mapping documents. " @@ -1424,6 +2153,7 @@ msgstr "" "Event." #. Tag: para +#: tutorial.xml:914 #, no-c-format msgid "" "What this means is that Hibernate should take the other side, the " @@ -1437,11 +2167,13 @@ msgstr "" "como se crea el enlace bidireccional entre nuestras dos entidades." #. Tag: title +#: tutorial.xml:923 #, no-c-format msgid "Working bi-directional links" msgstr "Trabajo con enlaces bidireccionales" #. Tag: para +#: tutorial.xml:925 #, no-c-format msgid "" "First, keep in mind that Hibernate does not affect normal Java semantics. " @@ -1465,6 +2197,7 @@ msgstr "" "absolutamente necesario con enlaces bidireccionales." #. Tag: para +#: tutorial.xml:935 #, no-c-format msgid "" "Many developers program defensively and create link management methods to " @@ -1474,7 +2207,31 @@ msgstr "" "administración de enlaces para establecer correctamente ambos lados, (por " "ejemplo, en Person):" +#. Tag: programlisting +#: tutorial.xml:940 +#, no-c-format +msgid "" +"" +msgstr "" + #. Tag: para +#: tutorial.xml:942 #, no-c-format msgid "" "The get and set methods for the collection are now protected. This allows " @@ -1488,6 +2245,7 @@ msgstr "" "directamente. Repita los pasos para la colección del otro lado." #. Tag: para +#: tutorial.xml:949 #, no-c-format msgid "" "What about the inverse mapping attribute? For you, and " @@ -1518,11 +2276,13 @@ msgstr "" "una asociación muchos-a-muchos, puede escoger cualquier lado." #. Tag: title +#: tutorial.xml:965 #, no-c-format msgid "Part 3 - The EventManager web application" msgstr "Part 3 - La aplicación web EventManager" #. Tag: para +#: tutorial.xml:967 #, no-c-format msgid "" "A Hibernate web application uses Session and " @@ -1539,11 +2299,13 @@ msgstr "" "para ingresar eventos nuevos." #. Tag: title +#: tutorial.xml:975 #, no-c-format msgid "Writing the basic servlet" msgstr "Escritura de un servlet básico" #. Tag: para +#: tutorial.xml:977 #, no-c-format msgid "" "First we need create our basic processing servlet. Since our servlet only " @@ -1554,7 +2316,52 @@ msgstr "" "nuestro servlet solo maneja pedidos GET HTTP sólamente, " "solo implementaremos el método doGet():" +#. Tag: programlisting +#: tutorial.xml:983 +#, no-c-format +msgid "" +"" +msgstr "" + #. Tag: para +#: tutorial.xml:985 #, no-c-format msgid "" "Save this servlet as src/main/java/org/hibernate/tutorial/web/" @@ -1564,6 +2371,7 @@ msgstr "" "EventManagerServlet.java" #. Tag: para +#: tutorial.xml:990 #, no-c-format msgid "" "The pattern applied here is called session-per-request. " @@ -1583,6 +2391,7 @@ msgstr "" "aplicaciones." #. Tag: para +#: tutorial.xml:999 #, no-c-format msgid "" "Do not use a new Hibernate Session " @@ -1597,6 +2406,7 @@ msgstr "" "automáticamente al hilo de Java actual." #. Tag: para +#: tutorial.xml:1006 #, no-c-format msgid "" "Next, the possible actions of the request are processed and the response " @@ -1606,6 +2416,7 @@ msgstr "" "respuesta HTML. Llegaremos a esa parte muy pronto. " #. Tag: para +#: tutorial.xml:1011 #, no-c-format msgid "" "Finally, the unit of work ends when processing and rendering are complete. " @@ -1628,11 +2439,13 @@ msgstr "" "representar su vista en JSP, no en un servlet." #. Tag: title +#: tutorial.xml:1025 #, no-c-format msgid "Processing and rendering" msgstr "Procesamiento y entrega" #. Tag: para +#: tutorial.xml:1027 #, no-c-format msgid "" "Now you can implement the processing of the request and the rendering of the " @@ -1641,7 +2454,44 @@ msgstr "" "Ahora puede implementar el procesamiento del pedido y la representación de " "la página." +#. Tag: programlisting +#: tutorial.xml:1031 +#, no-c-format +msgid "" +"Event Manager" +"\");\n" +"\n" +" // Handle actions\n" +" if ( \"store\".equals(request.getParameter(\"action\")) ) {\n" +"\n" +" String eventTitle = request.getParameter(\"eventTitle\");\n" +" String eventDate = request.getParameter(\"eventDate\");\n" +"\n" +" if ( \"\".equals(eventTitle) || \"\".equals(eventDate) ) {\n" +" out.println(\"Please enter event title and date.\");\n" +" }\n" +" else {\n" +" createAndStoreEvent(eventTitle, dateFormatter.parse" +"(eventDate));\n" +" out.println(\"Added event.\");\n" +" }\n" +" }\n" +"\n" +" // Print page\n" +" printEventForm(out);\n" +" listEvents(out, dateFormatter);\n" +"\n" +" // Write HTML footer\n" +" out.println(\"\");\n" +" out.flush();\n" +" out.close();]]>" +msgstr "" + #. Tag: para +#: tutorial.xml:1033 #, no-c-format msgid "" "This coding style, with a mix of Java and HTML, would not scale in a more " @@ -1659,7 +2509,25 @@ msgstr "" "todos los eventos en la base de datos. El primer método es trivial y su " "salida se realiza únicamente en HTML:" +#. Tag: programlisting +#: tutorial.xml:1042 +#, no-c-format +msgid "" +"Add new event:\");\n" +" out.println(\"
\");\n" +" out.println(\"Title:
" +"\");\n" +" out.println(\"Date (e.g. 24.12.2009):
\");\n" +" out.println(\"" +"\");\n" +" out.println(\"
\");\n" +" }]]>" +msgstr "" + #. Tag: para +#: tutorial.xml:1044 #, no-c-format msgid "" "The listEvents() method uses the Hibernate " @@ -1669,7 +2537,38 @@ msgstr "" "Session vinculado al hilo actual para ejecutar una " "petición:" +#. Tag: programlisting +#: tutorial.xml:1050 +#, no-c-format +msgid "" +" 0) {\n" +" out.println(\"

Events in database:

\");\n" +" out.println(\"\");\n" +" out.println(\"\");\n" +" out.println(\"\");\n" +" out.println(\"\");\n" +" out.println(\"\");\n" +" Iterator it = result.iterator();\n" +" while (it.hasNext()) {\n" +" Event event = (Event) it.next();\n" +" out.println(\"\");\n" +" out.println(\"\");\n" +" out.println(\"\");\n" +" out.println(\"\");\n" +" }\n" +" out.println(\"
Event titleEvent date
\" + event.getTitle() + \"\" + dateFormatter.format(event.getDate()) " +"+ \"
\");\n" +" }\n" +" }]]>" +msgstr "" + #. Tag: para +#: tutorial.xml:1052 #, no-c-format msgid "" "Finally, the store action is dispatched to the " @@ -1680,7 +2579,23 @@ msgstr "" "createAndStoreEvent(), el cual también utiliza la " "Session del hilo actual:" +#. Tag: programlisting +#: tutorial.xml:1058 +#, no-c-format +msgid "" +"" +msgstr "" + #. Tag: para +#: tutorial.xml:1060 #, no-c-format msgid "" "The servlet is now complete. A request to the servlet will be processed in a " @@ -1703,11 +2618,13 @@ msgstr "" "Refiérase al Wiki de Hibernate para ver más ejemplos." #. Tag: title +#: tutorial.xml:1074 #, no-c-format msgid "Deploying and testing" msgstr "Despliegue y prueba" #. Tag: para +#: tutorial.xml:1076 #, no-c-format msgid "" "To deploy this application for testing we must create a Web ARchive (WAR). " @@ -1718,7 +2635,32 @@ msgstr "" "(WAR). Primero debemos definir el descriptor WAR como src/main/" "webapp/WEB-INF/web.xml" +#. Tag: programlisting +#: tutorial.xml:1082 +#, no-c-format +msgid "" +"\n" +"\n" +"\n" +" \n" +" Event Manager\n" +" org.hibernate.tutorial.web.EventManagerServlet\n" +" \n" +"\n" +" \n" +" Event Manager\n" +" /eventmanager\n" +" \n" +"]]>" +msgstr "" + #. Tag: para +#: tutorial.xml:1084 #, no-c-format msgid "" "To build and deploy call mvn package in your project " @@ -1730,17 +2672,19 @@ msgstr "" "literal> en su directorio webapp Tomcat. " #. Tag: para -#, no-c-format +#: tutorial.xml:1091 +#, fuzzy, no-c-format msgid "" "If you do not have Tomcat installed, download it from and follow the installation instructions. Our " +"tomcat.apache.org/\"> and follow the installation instructions. Our " "application requires no changes to the standard Tomcat configuration." msgstr "" -"Si no tiene Tomcat instalado, descárguelo de y siga las instrucciones de instalación. Nuestra aplicación " +"Si no tiene Tomcat instalado, descárguelo de y siga las instrucciones de instalación. Nuestra aplicación " "no requiere cambios a la configuración estándar de Tomcat." #. Tag: para +#: tutorial.xml:1099 #, no-c-format msgid "" "Once deployed and Tomcat is running, access the application at " @@ -1758,11 +2702,13 @@ msgstr "" "la salida detallada si ocurre alguna excepción." #. Tag: title +#: tutorial.xml:1112 #, no-c-format msgid "Summary" msgstr "Resumen" #. Tag: para +#: tutorial.xml:1114 #, no-c-format msgid "" "This tutorial covered the basics of writing a simple standalone Hibernate " @@ -1773,4 +2719,3 @@ msgstr "" "aplicación de Hibernate autónoma y una pequeña aplicación web. Encontrará " "más tutoriales en el website de Hibernate ." - diff --git a/documentation/manual/src/main/docbook/fr-FR/author_group.po b/documentation/manual/src/main/docbook/fr-FR/author_group.po index 1d1d3388a2..a44318eb86 100644 --- a/documentation/manual/src/main/docbook/fr-FR/author_group.po +++ b/documentation/manual/src/main/docbook/fr-FR/author_group.po @@ -5,7 +5,7 @@ msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: http://bugs.kde.org\n" -"POT-Creation-Date: 2010-02-04T04:51:21\n" +"POT-Creation-Date: 2010-07-20 21:02+0000\n" "PO-Revision-Date: 2009-07-14 19:55+0000\n" "Last-Translator: Automatically generated\n" "Language-Team: none\n" @@ -13,137 +13,215 @@ msgstr "" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" -#. Tag: firstname +#. Tag: author +#: author_group.xml:28 #, no-c-format -msgid "Gavin" +msgid "Gavin King" msgstr "" -#. Tag: firstname +#. Tag: author +#: author_group.xml:32 #, no-c-format -msgid "Christian" +msgid "Christian Bauer" msgstr "" -#. Tag: firstname +#. Tag: author +#: author_group.xml:36 #, no-c-format -msgid "Max" +msgid "" +"Max Rydahl Andersen" msgstr "" -#. Tag: firstname +#. Tag: author +#: author_group.xml:41 #, no-c-format -msgid "Emmanuel" +msgid "" +"Emmanuel Bernard" msgstr "" -#. Tag: firstname +#. Tag: author +#: author_group.xml:45 #, no-c-format -msgid "Steve" +msgid "Steve Ebersole" msgstr "" -#. Tag: firstname +#. Tag: author +#: author_group.xml:49 #, no-c-format -msgid "James" +msgid "Hardy Ferentschik" msgstr "" -#. Tag: firstname +#. Tag: othercredit +#: author_group.xml:54 #, no-c-format -msgid "Cheyenne" +msgid "James Cobb" msgstr "" -#. Tag: firstname +#. Tag: shortaffil +#: author_group.xml:58 author_group.xml:65 #, no-c-format -msgid "Vincent" +msgid "Graphic Design" msgstr "" -#. Tag: firstname +#. Tag: othercredit +#: author_group.xml:61 #, no-c-format -msgid "Sebastien" +msgid "Cheyenne Weaver" msgstr "" -#. Tag: firstname +#. Tag: othercredit +#: author_group.xml:74 #, no-c-format -msgid "Michael" +msgid "" +" " +"kreimer@bbs.frc.utn.edu.ar" msgstr "" -#. Tag: firstname +#. Tag: othercredit +#: author_group.xml:84 #, no-c-format -msgid "Baptiste" +msgid "Vincent Ricard" msgstr "" -#. Tag: firstname +#. Tag: othercredit +#: author_group.xml:88 #, no-c-format -msgid "Anthony" +msgid "Sebastien Cesbron" msgstr "" -#. Tag: firstname +#. Tag: othercredit +#: author_group.xml:92 #, no-c-format -msgid "Alvaro" +msgid "Michael Courcy" msgstr "" -#. Tag: firstname +#. Tag: othercredit +#: author_group.xml:96 #, no-c-format -msgid "Anderson" +msgid "Vincent Giguère" msgstr "" -#. Tag: firstname +#. Tag: othercredit +#: author_group.xml:100 #, no-c-format -msgid "Daniel Vieira" +msgid "Baptiste Mathus" msgstr "" -#. Tag: firstname +#. Tag: othercredit +#: author_group.xml:104 #, no-c-format -msgid "Francisco" +msgid "" +"Emmanuel Bernard" msgstr "" -#. Tag: firstname +#. Tag: othercredit +#: author_group.xml:108 #, no-c-format -msgid "Gamarra" +msgid "Anthony Patricio" msgstr "" -#. Tag: firstname +#. Tag: othercredit +#: author_group.xml:118 #, no-c-format -msgid "Luiz Carlos" +msgid "" +"Alvaro Netto " +"alvaronetto@cetip.com.br" msgstr "" -#. Tag: firstname +#. Tag: othercredit +#: author_group.xml:123 #, no-c-format -msgid "Marcel" +msgid "" +"Anderson Braulio " +"andersonbraulio@gmail.com" msgstr "" -#. Tag: firstname +#. Tag: othercredit +#: author_group.xml:128 #, no-c-format -msgid "Paulo" +msgid "" +"Daniel Vieira Costa " +"danielvc@gmail.com" msgstr "" -#. Tag: firstname +#. Tag: othercredit +#: author_group.xml:133 #, no-c-format -msgid "Pablo L." +msgid "" +"Francisco gamarra francisco." +"gamarra@gmail.com" msgstr "" -#. Tag: firstname +#. Tag: othercredit +#: author_group.xml:138 #, no-c-format -msgid "Renato" +msgid "" +"Gamarra mauricio.gamarra@gmail.com" msgstr "" -#. Tag: firstname +#. Tag: othercredit +#: author_group.xml:142 #, no-c-format -msgid "Rogério" +msgid "" +"Luiz Carlos Rodrigues " +"luizcarlos_rodrigues@yahoo.com.br" msgstr "" -#. Tag: firstname +#. Tag: othercredit +#: author_group.xml:147 #, no-c-format -msgid "Wanderson" +msgid "" +"Marcel Castelo marcel." +"castelo@gmail.com" msgstr "" -#. Tag: firstname +#. Tag: othercredit +#: author_group.xml:152 #, no-c-format -msgid "Cao" +msgid "" +"Paulo César paulocol@gmail." +"com" msgstr "" -#. Tag: orgname +#. Tag: othercredit +#: author_group.xml:157 #, no-c-format -msgid "RedSaga" +msgid "" +"Pablo L. de Miranda " +"pablolmiranda@gmail.com" msgstr "" -#. Tag: contrib +#. Tag: othercredit +#: author_group.xml:162 #, no-c-format -msgid "Translation Lead" +msgid "" +"Renato Deggau rdeggau@gmail." +"com" +msgstr "" + +#. Tag: othercredit +#: author_group.xml:167 +#, no-c-format +msgid "" +"Rogério Araújo " +"rgildoaraujo@yahoo.com.br" +msgstr "" + +#. Tag: othercredit +#: author_group.xml:172 +#, no-c-format +msgid "" +"Wanderson Siqueira " +"wandersonxs@gmail.com" +msgstr "" + +#. Tag: othercredit +#: author_group.xml:183 +#, no-c-format +msgid "" +"Cao Xiaogang " +"RedSaga Translation Lead caoxg@yahoo.com" msgstr "" diff --git a/documentation/manual/src/main/docbook/fr-FR/content/basic_mapping.po b/documentation/manual/src/main/docbook/fr-FR/content/basic_mapping.po index cc3096771d..f1fe23856f 100644 --- a/documentation/manual/src/main/docbook/fr-FR/content/basic_mapping.po +++ b/documentation/manual/src/main/docbook/fr-FR/content/basic_mapping.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: basic_mapping\n" "Report-Msgid-Bugs-To: http://bugs.kde.org\n" -"POT-Creation-Date: 2010-02-11T05:38:15\n" +"POT-Creation-Date: 2010-07-20 21:02+0000\n" "PO-Revision-Date: 2010-01-04 17:01+1000\n" "Last-Translator: Corina Roe \n" "Language-Team: French \n" @@ -17,22 +17,143 @@ msgstr "" "X-Generator: KBabel 1.11.4\n" #. Tag: title +#: basic_mapping.xml:31 #, no-c-format msgid "Basic O/R Mapping" msgstr "Mappage O/R de base" #. Tag: title +#: basic_mapping.xml:34 #, no-c-format msgid "Mapping declaration" msgstr "Déclaration de mappage" #. Tag: para +#: basic_mapping.xml:36 +#, no-c-format +msgid "Object/relational mappings can be defined in three approaches:" +msgstr "" + +#. Tag: para +#: basic_mapping.xml:41 +#, no-c-format +msgid "using Java 5 annotations (via the Java Persistence 2 annotations)" +msgstr "" + +#. Tag: para +#: basic_mapping.xml:46 +#, no-c-format +msgid "using JPA 2 XML deployment descriptors (described in chapter XXX)" +msgstr "" + +#. Tag: para +#: basic_mapping.xml:51 +#, no-c-format +msgid "using the Hibernate legacy XML files approach known as hbm.xml" +msgstr "" + +#. Tag: para +#: basic_mapping.xml:56 #, no-c-format msgid "" -"Object/relational mappings are usually defined in an XML document. The " -"mapping document is designed to be readable and hand-editable. The mapping " -"language is Java-centric, meaning that mappings are constructed around " -"persistent class declarations and not table declarations." +"Annotations are split in two categories, the logical mapping annotations " +"(describing the object model, the association between two entities etc.) and " +"the physical mapping annotations (describing the physical schema, tables, " +"columns, indexes, etc). We will mix annotations from both categories in the " +"following code examples." +msgstr "" + +#. Tag: para +#: basic_mapping.xml:62 +#, no-c-format +msgid "" +"JPA annotations are in the javax.persistence.* package. " +"Hibernate specific extensions are in org.hibernate.annotations.*. You favorite IDE can auto-complete annotations and their " +"attributes for you (even without a specific \"JPA\" plugin, since JPA " +"annotations are plain Java 5 annotations)." +msgstr "" + +#. Tag: para +#: basic_mapping.xml:69 +#, fuzzy, no-c-format +msgid "Here is an example of mapping" +msgstr "Commençons avec un exemple de mappage : " + +#. Tag: programlisting +#: basic_mapping.xml:71 +#, no-c-format +msgid "" +"package eg;\n" +"\n" +"@Entity \n" +"@Table(name=\"cats\") @Inheritance(strategy=SINGLE_TABLE)\n" +"@DiscriminatorValue(\"C\") @DiscriminatorColumn(name=\"subclass\", " +"discriminatorType=CHAR)\n" +"public class Cat {\n" +" \n" +" @Id @GeneratedValue\n" +" public Integer getId() { return id; }\n" +" public void setId(Integer id) { this.id = id; }\n" +" private Integer id;\n" +"\n" +" public BigDecimal getWeight() { return weight; }\n" +" public void setWeight(BigDecimal weight) { this.weight = weight; }\n" +" private BigDecimal weight;\n" +"\n" +" @Temporal(DATE) @NotNull @Column(updatable=false)\n" +" public Date getBirthdate() { return birthdate; }\n" +" public void setBirthdate(Date birthdate) { this.birthdate = birthdate; }\n" +" private Date birthdate;\n" +"\n" +" @org.hibernate.annotations.Type(type=\"eg.types.ColorUserType\")\n" +" @NotNull @Column(updatable=false)\n" +" public ColorType getColor() { return color; }\n" +" public void setColor(ColorType color) { this.color = color; }\n" +" private ColorType color;\n" +"\n" +" @NotNull @Column(updatable=false)\n" +" public String getSex() { return sex; }\n" +" public void setSex(String sex) { this.sex = sex; }\n" +" private String sex;\n" +"\n" +" @NotNull @Column(updatable=false)\n" +" public Integer getLitterId() { return litterId; }\n" +" public void setLitterId(Integer litterId) { this.litterId = litterId; }\n" +" private Integer litterId;\n" +"\n" +" @ManyToOne @JoinColumn(name=\"mother_id\", updatable=false)\n" +" public Cat getMother() { return mother; }\n" +" public void setMother(Cat mother) { this.mother = mother; }\n" +" private Cat mother;\n" +"\n" +" @OneToMany(mappedBy=\"mother\") @OrderBy(\"litterId\")\n" +" public Set<Cat> getKittens() { return kittens; }\n" +" public void setKittens(Set<Cat> kittens) { this.kittens = " +"kittens; }\n" +" private Set<Cat> kittens = new HashSet<Cat>();\n" +"}\n" +"\n" +"@Entity @DiscriminatorValue(\"D\")\n" +"public class DomesticCat extends Cat {\n" +"\n" +" public String getName() { return name; }\n" +" public void setName(String name) { this.name = name }\n" +" private String name;\n" +"}\n" +"\n" +"@Entity\n" +"public class Dog { ... }" +msgstr "" + +#. Tag: para +#: basic_mapping.xml:73 +#, fuzzy, no-c-format +msgid "" +"The legacy hbm.xml approach uses an XML schema designed to be readable and " +"hand-editable. The mapping language is Java-centric, meaning that mappings " +"are constructed around persistent class declarations and not table " +"declarations." msgstr "" "Les mappages objet/relationnel sont généralement définis dans un document " "XML. Le document de mappage est conçu pour être lisible et éditable à la " @@ -41,6 +162,7 @@ msgstr "" "non à partir de déclarations de tables. " #. Tag: para +#: basic_mapping.xml:78 #, no-c-format msgid "" "Please note that even though many Hibernate users choose to write the XML by " @@ -52,18 +174,92 @@ msgstr "" "générer ce document, notamment XDoclet, Middlegen et AndroMDA. " #. Tag: para +#: basic_mapping.xml:82 #, no-c-format msgid "Here is an example mapping:" msgstr "Commençons avec un exemple de mappage : " -#. Tag: para +#. Tag: programlisting +#: basic_mapping.xml:84 #, no-c-format msgid "" -"We will now discuss the content of the mapping document. We will only " -"describe, however, the document elements and attributes that are used by " -"Hibernate at runtime. The mapping document also contains some extra optional " -"attributes and elements that affect the database schemas exported by the " -"schema export tool (for example, the not-null attribute)." +"<?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 name=\"Cat\"\n" +" table=\"cats\"\n" +" discriminator-value=\"C\">\n" +"\n" +" <id name=\"id\">\n" +" <generator class=\"native\"/>\n" +" </id>\n" +"\n" +" <discriminator column=\"subclass\"\n" +" type=\"character\"/>\n" +"\n" +" <property name=\"weight\"/>\n" +"\n" +" <property name=\"birthdate\"\n" +" type=\"date\"\n" +" not-null=\"true\"\n" +" update=\"false\"/>\n" +"\n" +" <property name=\"color\"\n" +" type=\"eg.types.ColorUserType\"\n" +" not-null=\"true\"\n" +" update=\"false\"/>\n" +"\n" +" <property name=\"sex\"\n" +" not-null=\"true\"\n" +" update=\"false\"/>\n" +"\n" +" <property name=\"litterId\"\n" +" column=\"litterId\"\n" +" update=\"false\"/>\n" +"\n" +" <many-to-one name=\"mother\"\n" +" column=\"mother_id\"\n" +" update=\"false\"/>\n" +"\n" +" <set name=\"kittens\"\n" +" inverse=\"true\"\n" +" order-by=\"litter_id\">\n" +" <key column=\"mother_id\"/>\n" +" <one-to-many class=\"Cat\"/>\n" +" </set>\n" +"\n" +" <subclass name=\"DomesticCat\"\n" +" discriminator-value=\"D\">\n" +"\n" +" <property name=\"name\"\n" +" type=\"string\"/>\n" +"\n" +" </subclass>\n" +"\n" +" </class>\n" +"\n" +" <class name=\"Dog\">\n" +" <!-- mapping for Dog could go here -->\n" +" </class>\n" +"\n" +"</hibernate-mapping>" +msgstr "" + +#. Tag: para +#: basic_mapping.xml:86 +#, fuzzy, no-c-format +msgid "" +"We will now discuss the concepts of the mapping documents (both annotations " +"and XML). We will only describe, however, the document elements and " +"attributes that are used by Hibernate at runtime. The mapping document also " +"contains some extra optional attributes and elements that affect the " +"database schemas exported by the schema export tool (for example, the " +" not-null attribute)." msgstr "" "Étudions le contenu du document de mappage. Nous ne décrirons que les " "éléments et attributs du document utilisés par Hibernate à l'exécution. Le " @@ -72,339 +268,140 @@ msgstr "" "de schéma. (Par exemple l'attribut not-null)." #. Tag: title -#, no-c-format -msgid "Doctype" -msgstr "Doctype" - -#. Tag: para -#, no-c-format -msgid "" -"All XML mappings should declare the doctype shown. The actual DTD can be " -"found at the URL above, in the directory hibernate-x.x.x/src/org/" -"hibernate , or in hibernate3.jar. Hibernate " -"will always look for the DTD in its classpath first. If you experience " -"lookups of the DTD using an Internet connection, check the DTD declaration " -"against the contents of your classpath." -msgstr "" -"Tous les mappages XML devraient utiliser le doctype indiqué. En effet vous " -"trouverez le fichier DTD à l'URL ci-dessus, dans le répertoire " -"hibernate-x.x.x/src/org/hibernate ou dans " -"hibernate3.jar. Hibernate va toujours chercher la DTD " -"dans son classpath en premier lieu. Si vous constatez des recherches de la " -"DTD sur Internet, vérifiez votre déclaration de DTD par rapport au contenu " -"de votre classpath. " - -#. Tag: title -#, no-c-format -msgid "EntityResolver" +#: basic_mapping.xml:94 +#, fuzzy, no-c-format +msgid "Entity" msgstr "EntityResolver" #. Tag: para +#: basic_mapping.xml:96 #, no-c-format msgid "" -"Hibernate will first attempt to resolve DTDs in its classpath. It does this " -"is by registering a custom org.xml.sax.EntityResolver " -"implementation with the SAXReader it uses to read in the xml files. This " -"custom EntityResolver recognizes two different systemId " -"namespaces:" +"An entity is a regular Java object (aka POJO) which will be persisted by " +"Hibernate." msgstr "" -"Comme mentionné précédemment, Hibernate tentera en premier lieu de résoudre " -"les DTD dans leur classpath. Il réussit à le faire en enregistrant une " -"implémentation personnalisée de org.xml.sax.EntityResolver avec le SAXReader qu'il utilise pour lire les fichiers xml. Cet " -"EntityResolver personnalisé reconnaît deux espaces de " -"nommage systemId différents :" #. Tag: para +#: basic_mapping.xml:99 #, no-c-format msgid "" -"a hibernate namespace is recognized whenever the resolver " -"encounters a systemId starting with http://hibernate.sourceforge." -"net/. The resolver attempts to resolve these entities via the " -"classloader which loaded the Hibernate classes." +"To mark an object as an entity in annotations, use the @Entity annotation." msgstr "" -"un espace de nommage hibernate est reconnu dès que le " -"résolveur rencontre un systemId commençant par http://hibernate." -"sourceforge.net/. Le résolveur tente alors de résoudre ces entités " -"via le chargeur de classe qui a chargé les classes Hibernate." -#. Tag: para +#. Tag: programlisting +#: basic_mapping.xml:102 #, no-c-format msgid "" -"a user namespace is recognized whenever the resolver " -"encounters a systemId using a classpath:// URL protocol. " -"The resolver will attempt to resolve these entities via (1) the current " -"thread context classloader and (2) the classloader which loaded the " -"Hibernate classes." +"@Entity\n" +"public class Flight implements Serializable {\n" +" Long id;\n" +"\n" +" @Id\n" +" public Long getId() { return id; }\n" +"\n" +" public void setId(Long id) { this.id = id; }\n" +"}" msgstr "" -"un espace de nommage utilisateur est reconnu dès que le " -"résolveur rencontre un systemId qui utilise un protocole URL " -"classpath://. Le résolveur tentera alors de résoudre ces " -"entités via (1) le chargeur de classe du contexte du thread courant et (2) " -"le chargeur de classe qui a chargé les classes Hibernate." #. Tag: para +#: basic_mapping.xml:104 #, no-c-format -msgid "The following is an example of utilizing user namespacing:" -msgstr "Un exemple d'utilisation de l'espace de nommage utilisateur: " +msgid "" +"That's pretty much it, the rest is optional. There are however any options " +"to tweak your entity mapping, let's explore them." +msgstr "" #. Tag: para +#: basic_mapping.xml:107 +#, no-c-format +msgid "" +"@Table lets you define the table the entity will be " +"persisted into. If undefined, the table name is the unqualified class name " +"of the entity. You can also optionally define the catalog, the schema as " +"well as unique constraints on the table." +msgstr "" + +#. Tag: programlisting +#: basic_mapping.xml:112 +#, no-c-format +msgid "" +"@Entity\n" +"@Table(name=\"TBL_FLIGHT\", \n" +" schema=\"AIR_COMMAND\", \n" +" uniqueConstraints=\n" +" @UniqueConstraint(\n" +" name=\"flight_number\", \n" +" columnNames={\"comp_prefix\", \"flight_number\"} ) )\n" +"public class Flight implements Serializable {\n" +" @Column(name=\"comp_prefix\")\n" +" public String getCompagnyPrefix() { return companyPrefix; }\n" +"\n" +" @Column(name=\"flight_number\")\n" +" public String getNumber() { return number; }\n" +"}" +msgstr "" + +#. Tag: para +#: basic_mapping.xml:114 +#, no-c-format +msgid "" +"The constraint name is optional (generated if left undefined). The column " +"names composing the constraint correspond to the column names as defined " +"before the Hibernate NamingStrategy is applied." +msgstr "" + +#. Tag: para +#: basic_mapping.xml:119 +#, no-c-format +msgid "" +"@Entity.name lets you define the shortcut name of the " +"entity you can used in JP-QL and HQL queries. It defaults to the unqualified " +"class name of the class." +msgstr "" + +#. Tag: para +#: basic_mapping.xml:123 +#, no-c-format +msgid "" +"Hibernate goes beyond the JPA specification and provide additional " +"configurations. Some of them are hosted on @org.hibernate." +"annotations.Entity:" +msgstr "" + +#. Tag: para +#: basic_mapping.xml:129 #, fuzzy, no-c-format msgid "" -"Where types.xml is a resource in the your." -"domain package and contains a custom typedef." +"dynamicInsert / dynamicUpdate " +"(defaults to false): specifies that INSERT / " +"UPDATE SQL should be generated at runtime and contain " +"only the columns whose values are not null. The dynamic-update and dynamic-insert settings are not inherited by " +"subclasses. Although these settings can increase performance in some cases, " +"they can actually decrease performance in others." msgstr "" -"Là où types.xml est une ressource dans votre paquetage " -"your.domain et contient un personnalisé. " - -#. Tag: title -#, no-c-format -msgid "Hibernate-mapping" -msgstr "Hibernate-mappage" +"Notez que les paramètres dynamic-update et " +"dynamic-insert ne sont pas hérités par les sous-classes " +"et peuvent donc être spécifiés pour les éléments <subclass> ou <joined-subclass>. Ces paramètres " +"peuvent améliorer les performances dans certains cas, mais peuvent aussi les " +"amoindrir. À utiliser en connaissance de causes. " #. Tag: para -#, no-c-format +#: basic_mapping.xml:140 +#, fuzzy, no-c-format msgid "" -"This element has several optional attributes. The schema " -"and catalog attributes specify that tables referred to in " -"this mapping belong to the named schema and/or catalog. If they are " -"specified, tablenames will be qualified by the given schema and catalog " -"names. If they are missing, tablenames will be unqualified. The " -"default-cascade attribute specifies what cascade style " -"should be assumed for properties and collections that do not specify a " -"cascade attribute. By default, the auto-import attribute allows you to use unqualified class names in the query " -"language." -msgstr "" -"Cet élément a plusieurs attributs optionnels. Les attributs schema et catalog indiquent que les tables mentionnées " -"dans ce mappage appartiennent au schéma nommé et/ou au catalogue. S'ils sont " -"spécifiés, les noms de tables seront qualifiés par les noms de schéma et de " -"catalogue. L'attribut default-cascade indique quel type " -"de cascade sera utilisé par défaut pour les propriétés et collections qui ne " -"précisent pas l'attribut cascade. L'attribut " -"auto-import nous permet d'utiliser par défaut des noms de " -"classes non qualifiés dans le langage de requête, par défaut. " - -#. Tag: para -#, no-c-format -msgid "schema (optional): the name of a database schema." -msgstr "" -"schema (optionnel) : le nom d'un schéma de base de " -"données. " - -#. Tag: para -#, no-c-format -msgid "catalog (optional): the name of a database catalog." -msgstr "" -"catalog (optionnel) : le nom d'un catalogue de base de " -"données. " - -#. Tag: para -#, no-c-format -msgid "" -"default-cascade (optional - defaults to none): a default cascade style." -msgstr "" -"default-cascade (optionnel - par défaut vaut : " -"none) : un type de cascade par défaut. " - -#. Tag: para -#, no-c-format -msgid "" -"default-access (optional - defaults to property): the strategy Hibernate should use for accessing all properties. " -"It can be a custom implementation of PropertyAccessor." -msgstr "" -"default-access (optionnel - par défaut vaut : " -"property) : Comment hibernate accèdera aux propriétés. On " -"peut aussi redéfinir sa propre implémentation de PropertyAccessor. " - -#. Tag: para -#, no-c-format -msgid "" -"default-lazy (optional - defaults to true): the default value for unspecified lazy " -"attributes of class and collection mappings." -msgstr "" -"default-lazy (optionnel - par défaut vaut : " -"true) : Valeur par défaut pour des attributs " -"lazy non spécifiés des mappages de classe et de " -"collection. " - -#. Tag: para -#, no-c-format -msgid "" -"auto-import (optional - defaults to true): specifies whether we can use unqualified class names of classes " -"in this mapping in the query language." -msgstr "" -"auto-import (optionnel - par défaut vaut : true) : spécifie si l'on peut utiliser des noms de classes non qualifiés " -"(de classes de ce mappage) dans le langage de requête. " - -#. Tag: para -#, no-c-format -msgid "" -"package (optional): specifies a package prefix to use for " -"unqualified class names in the mapping document." -msgstr "" -"package (optionnel) : préfixe de paquetage par défaut " -"pour les noms de classe non qualifiés du document de mappage. " - -#. Tag: para -#, no-c-format -msgid "" -"If you have two persistent classes with the same unqualified name, you " -"should set auto-import=\"false\". An exception will " -"result if you attempt to assign two classes to the same \"imported\" name." -msgstr "" -"Si deux classes persistantes possèdent le même nom de classe (non qualifié), " -"vous devez configurer auto-import=\"false\". Hibernate " -"lancera une exception si vous essayez d'assigner le même nom \"importé\" à " -"deux classes." - -#. Tag: para -#, no-c-format -msgid "" -"The hibernate-mapping element allows you to nest several " -"persistent <class> mappings, as shown above. It is, " -"however, good practice (and expected by some tools) to map only a single " -"persistent class, or a single class hierarchy, in one mapping file and name " -"it after the persistent superclass. For example, Cat.hbm.xml, Dog.hbm.xml, or if using inheritance, " -"Animal.hbm.xml." -msgstr "" -"Notez que l'élément hibernate-mappage vous permet " -"d'imbriquer plusieurs mappages de <class> " -"persistantes, comme dans l'exemple ci-dessus. Cependant il est recommandé " -"(et c'est parfois une exigence de certains outils) de mapper une seule " -"classe persistante (ou une seule hiérarchie de classes) par fichier de " -"mappage et de nommer ce fichier d'après le nom de la superclasse " -"persistante, par exemple Cat.hbm.xml, Dog.hbm." -"xml, ou en cas d'héritage, Animal.hbm.xml. " - -#. Tag: title -#, no-c-format -msgid "Class" -msgstr "Classe" - -#. Tag: para -#, no-c-format -msgid "" -"You can declare a persistent class using the class " -"element. For example:" -msgstr "" -"Déclarez une classe persistante avec l'élément class. " -"Part exemple :" - -#. Tag: para -#, no-c-format -msgid "" -"name (optional): the fully qualified Java class name of " -"the persistent class or interface. If this attribute is missing, it is " -"assumed that the mapping is for a non-POJO entity." -msgstr "" -"name (optionnel) : le nom Java complet de la classe (ou " -"interface) persistante. Si cet attribut est absent, nous supposons que ce " -"mappage ne se rapporte pas à une entité POJO. " - -#. Tag: para -#, no-c-format -msgid "" -"table (optional - defaults to the unqualified class " -"name): the name of its database table." -msgstr "" -"table (optionnel - par défaut le nom non-qualifié de la " -"classe) : le nom de sa table en base de données." - -#. Tag: para -#, no-c-format -msgid "" -"discriminator-value (optional - defaults to the class " -"name): a value that distinguishes individual subclasses that is used for " -"polymorphic behavior. Acceptable values include null and " -"not null." -msgstr "" -"discriminator-value (optionnel - par défaut le nom de la " -"classe) : une valeur permettant de distinguer les différentes sous-classes " -"utilisées dans le comportement polymorphique. Les valeurs null et not null sont autorisées. " - -#. Tag: para -#, no-c-format -msgid "" -"mutable (optional - defaults to true): " -"specifies that instances of the class are (not) mutable." -msgstr "" -"mutable (optionnel, vaut true par " -"défaut) : spécifie que des instances de la classe sont (ou non) immuables. " - -#. Tag: para -#, no-c-format -msgid "" -"schema (optional): overrides the schema name specified by " -"the root <hibernate-mapping> element." -msgstr "" -"schema (optionnel) : surcharge le nom de schéma spécifié " -"par l'élément racine <hibernate-mappage>. " - -#. Tag: para -#, no-c-format -msgid "" -"catalog (optional): overrides the catalog name specified " -"by the root <hibernate-mapping> element." -msgstr "" -"catalog (optionnel) : surcharge le nom du catalogue " -"spécifié par l'élément racine <hibernate-mappage>. " - -#. Tag: para -#, no-c-format -msgid "" -"proxy (optional): specifies an interface to use for lazy " -"initializing proxies. You can specify the name of the class itself." -msgstr "" -"proxy (optionnel) : spécifie une interface à utiliser " -"pour l'initialisation différée (lazy loading) des proxies. Vous pouvez " -"indiquer le nom de la classe elle-même. " - -#. Tag: para -#, no-c-format -msgid "" -"dynamic-update (optional - defaults to false): specifies that UPDATE SQL should be generated " -"at runtime and can contain only those columns whose values have changed." -msgstr "" -"dynamic-update (optionnel, par défaut à false) : spécifie que les SQL UPDATE doivent être " -"générés à l'exécution et contenir uniquement les colonnes dont les valeurs " -"ont été modifiées. " - -#. Tag: para -#, no-c-format -msgid "" -"dynamic-insert (optional - defaults to false): specifies that INSERT SQL should be generated " -"at runtime and contain only the columns whose values are not null." -msgstr "" -"dynamic-insert (optionnel, par défaut à false) : spécifie que les SQL INSERT doivent être " -"générés à l'exécution et ne contenir que les colonnes dont les valeurs sont " -"non nulles. " - -#. Tag: para -#, no-c-format -msgid "" -"select-before-update (optional - defaults to " -"false): specifies that Hibernate should never perform an SQL UPDATE unless it is certain that " -"an object is actually modified. Only when a transient object has been " -"associated with a new session using update(), will " -"Hibernate perform an extra SQL SELECT to determine if an " -"UPDATE is actually required." +"selectBeforeUpdate (defaults to false): specifies that " +"Hibernate should never perform an SQL UPDATE unless it is certain that an object is actually modified. Only when " +"a transient object has been associated with a new session using " +"update(), will Hibernate perform an extra SQL " +"SELECT to determine if an UPDATE is " +"actually required. Use of select-before-update will " +"usually decrease performance. It is useful to prevent a database update " +"trigger being called unnecessarily if you reattach a graph of detached " +"instances to a Session." msgstr "" "select-before-update (optionnel, par défaut à " "false): spécifie que Hibernate ne doit jamais est véritablement nécessaire. " #. Tag: para -#, no-c-format +#: basic_mapping.xml:154 +#, fuzzy, no-c-format msgid "" -"polymorphism (optional - defaults to implicit): determines whether implicit or explicit query polymorphism is " -"used." -msgstr "" -"polymorphism (optionnel, vaut implicit " -"par défaut) : détermine si, pour cette classe, une requête polymorphique " -"implicite ou explicite est utilisée. " - -#. Tag: para -#, no-c-format -msgid "" -"where (optional): specifies an arbitrary SQL " -"WHERE condition to be used when retrieving objects of " -"this class." -msgstr "" -"where (optionnel) spécifie une clause SQL WHERE à utiliser lorsque l'on récupère des objets de cette classe. " - -#. Tag: para -#, no-c-format -msgid "" -"persister (optional): specifies a custom " -"ClassPersister." -msgstr "" -"persister (optionnel) : spécifie un " -"ClassPersister particulier. " - -#. Tag: para -#, no-c-format -msgid "" -"batch-size (optional - defaults to 1): " -"specifies a \"batch size\" for fetching instances of this class by " -"identifier." -msgstr "" -"batch-size (optionnel, par défaut = 1) : spécifie une \"taille de lot\" pour remplir les instances de " -"cette classe par identifiant en une seule requête." - -#. Tag: para -#, no-c-format -msgid "" -"optimistic-lock (optional - defaults to version): determines the optimistic locking strategy." -msgstr "" -"optimistic-lock (optionnel, par défaut = " -"version) : détermine la stratégie de verrouillage " -"optimiste. " - -#. Tag: para -#, no-c-format -msgid "" -"lazy (optional): lazy fetching can be disabled by setting " -"lazy=\"false\"." -msgstr "" -"lazy (optionnel) : l'extraction différée (lazy fetching) " -"peut être totalement désactivée en configurant lazy=\"false\"." - -#. Tag: para -#, no-c-format -msgid "" -"entity-name (optional - defaults to the class name): " -"Hibernate3 allows a class to be mapped multiple times, potentially to " -"different tables. It also allows entity mappings that are represented by " -"Maps or XML at the Java level. In these cases, you should provide an " -"explicit arbitrary name for the entity. See and for more information." -msgstr "" -"entity-name (optionnel - le nom de classe par défaut) : " -"Hibernate3 permet à une classe d'être mappée plusieurs fois (potentiellement " -"à plusieurs tables), et permet aux mappages d'entité d'être représentés par " -"des Maps ou du XML au niveau Java. Dans ces cas, vous devez indiquer un nom " -"explicite arbitraire pour les entités. Consultez et pour plus " -"d'informations. " - -#. Tag: para -#, no-c-format -msgid "" -"check (optional): an SQL expression used to generate a " -"multi-row check constraint for automatic schema " -"generation." -msgstr "" -"check (optionnel) : expression SQL utilisée pour générer " -"une contrainte de vérification check multi-lignes pour " -"la génération automatique de schéma. " - -#. Tag: para -#, no-c-format -msgid "" -"rowid (optional): Hibernate can use ROWIDs on databases. " -"On Oracle, for example, Hibernate can use the rowid extra " -"column for fast updates once this option has been set to rowid. A ROWID is an implementation detail and represents the physical " -"location of a stored tuple." -msgstr "" -"rowid (optionnel) : Hibernate peut utiliser des ROWID sur " -"les bases de données qui utilisent ce mécanisme. Par exemple avec Oracle, " -"Hibernate peut utiliser la colonne additionnelle rowid " -"pour des mise à jour rapides si cette option vaut rowid. " -"Un ROWID est un détail d'implémentation et représente la localisation " -"physique d'un uplet enregistré. " - -#. Tag: para -#, no-c-format -msgid "" -"subselect (optional): maps an immutable and read-only " -"entity to a database subselect. This is useful if you want to have a view " -"instead of a base table. See below for more information." -msgstr "" -"subselect (optionnel) : permet de mapper une entité " -"immuable en lecture-seule sur un sous-select de base de données. Utile pour " -"avoir une vue au lieu d'une table de base, mais à éviter. Voir plus bas pour " -"plus d'informations. " - -#. Tag: para -#, no-c-format -msgid "" -"abstract (optional): is used to mark abstract " -"superclasses in <union-subclass> hierarchies." -msgstr "" -"abstract (optionnel) : utilisé pour marquer des " -"superclasses abstraites dans des hiérarchies de <union-" -"subclass>. " - -#. Tag: para -#, no-c-format -msgid "" -"It is acceptable for the named persistent class to be an interface. You can " -"declare implementing classes of that interface using the <" -"subclass> element. You can persist any static inner class. Specify the class name using the standard form i.e. " -"e.g.Foo$Bar." -msgstr "" -"Il est tout à fait possible d'utiliser une interface comme nom de classe " -"persistante. Vous devez alors déclarer les classes implémentant cette " -"interface en utilisant l'élément <subclass>. Vous " -"pouvez faire persister toute classe interne static. " -"Vous devez alors spécifier le nom de la classe par la notation habituelle " -"des classes internes, c'est à dire eg.Foo$Bar." - -#. Tag: para -#, no-c-format -msgid "" -"Immutable classes, mutable=\"false\", cannot be updated " -"or deleted by the application. This allows Hibernate to make some minor " -"performance optimizations." -msgstr "" -"Les classes immuables, mutable=\"false\", ne peuvent pas " -"être modifiées ou supprimées par l'application. Cela permet à Hibernate de " -"faire quelques optimisations mineures sur les performances. " - -#. Tag: para -#, no-c-format -msgid "" -"The optional proxy attribute enables lazy initialization " -"of persistent instances of the class. Hibernate will initially return CGLIB " -"proxies that implement the named interface. The persistent object will load " -"when a method of the proxy is invoked. See \"Initializing collections and " -"proxies\" below." -msgstr "" -"L'attribut optionnel proxy permet les initialisations " -"différées des instances persistantes de la classe. Hibernate retournera " -"initialement des proxies CGLIB qui implémentent l'interface nommée. Le " -"véritable objet persistant ne sera chargé que lorsqu'une méthode du proxy " -"sera appelée. Voir plus bas le paragraphe abordant les Proxies et leur " -"initialisation différée (lazy initialization). " - -#. Tag: para -#, no-c-format -msgid "" -"Implicit polymorphism means that instances of the class " -"will be returned by a query that names any superclass or implemented " +"polymorphisms (defaults to IMPLICIT): " +"determines whether implicit or explicit query polymorphisms is used. " +"Implicit polymorphisms means that instances of the " +"class will be returned by a query that names any superclass or implemented " "interface or class, and that instances of any subclass of the class will be " "returned by a query that names the class itself. Explicit polymorphism means that class instances will be returned only by " +"emphasis> polymorphisms means that class instances will be returned only by " "queries that explicitly name that class. Queries that name the class will " -"return only instances of subclasses mapped inside this <class>" -" declaration as a <subclass> or " -"<joined-subclass>. For most purposes, the default " -"polymorphism=\"implicit\" is appropriate. Explicit " -"polymorphism is useful when two different classes are mapped to the same " +"return only instances of subclasses mapped. For most purposes, the default " +"polymorphisms=IMPLICIT is appropriate. Explicit " +"polymorphisms is useful when two different classes are mapped to the same " "table This allows a \"lightweight\" class that contains a subset of the " "table columns." msgstr "" @@ -620,9 +447,11 @@ msgstr "" "voir la partie design pattern du site communautaire). " #. Tag: para -#, no-c-format +#: basic_mapping.xml:171 +#, fuzzy, no-c-format msgid "" -"The persister attribute lets you customize the " +"persister: specifies a custom ClassPersister. The persister attribute lets you customize the " "persistence strategy used for the class. You can, for example, specify your " "own subclass of org.hibernate.persister.EntityPersister, " "or you can even provide a completely new implementation of the interface " @@ -643,54 +472,31 @@ msgstr "" "Hashtable). " #. Tag: para -#, no-c-format +#: basic_mapping.xml:185 +#, fuzzy, no-c-format msgid "" -"The dynamic-update and dynamic-insert " -"settings are not inherited by subclasses, so they can also be specified on " -"the <subclass> or <joined-subclass> elements. Although these settings can increase performance in some " -"cases, they can actually decrease performance in others." -msgstr "" -"Notez que les paramètres dynamic-update et " -"dynamic-insert ne sont pas hérités par les sous-classes " -"et peuvent donc être spécifiés pour les éléments <subclass> ou <joined-subclass>. Ces paramètres " -"peuvent améliorer les performances dans certains cas, mais peuvent aussi les " -"amoindrir. À utiliser en connaissance de causes. " - -#. Tag: para -#, no-c-format -msgid "" -"Use of select-before-update will usually decrease " -"performance. It is useful to prevent a database update trigger being called " -"unnecessarily if you reattach a graph of detached instances to a " -"Session." -msgstr "" -"L'utilisation de select-before-update va généralement " -"faire baisser les performances. Ce paramètre est pratique pour éviter " -"l'appel inutile par un déclenchement de mise à jour de base de donnée, quand " -"on ré-attache un graphe d'instances à une Session." - -#. Tag: para -#, no-c-format -msgid "" -"If you enable dynamic-update, you will have a choice of " -"optimistic locking strategies:" +"optimisticLock (defaults to VERSION): " +"determines the optimistic locking strategy. If you enable " +"dynamicUpdate, you will have a choice of optimistic " +"locking strategies:" msgstr "" "Si vous utilisez le dynamic-update, les différentes " "stratégies de verrouillage optimiste sont les suivantes :" #. Tag: para +#: basic_mapping.xml:192 #, no-c-format msgid "version: check the version/timestamp columns" msgstr "version vérifie les colonnes version/timestamp " #. Tag: para +#: basic_mapping.xml:197 #, no-c-format msgid "all: check all columns" msgstr "all vérifie toutes les colonnes " #. Tag: para +#: basic_mapping.xml:201 #, no-c-format msgid "" "dirty: check the changed columns, allowing some " @@ -700,11 +506,13 @@ msgstr "" "mise à jour concurrentes " #. Tag: para +#: basic_mapping.xml:206 #, no-c-format msgid "none: do not use optimistic locking" msgstr "none n'utilisez pas le verrouillage optimiste " #. Tag: para +#: basic_mapping.xml:211 #, no-c-format msgid "" "It is strongly recommended that you use version/" @@ -719,14 +527,88 @@ msgstr "" "dire lorsqu'on utilise Session.merge()). " #. Tag: para +#: basic_mapping.xml:220 #, no-c-format msgid "" +"Be sure to import @javax.persistence.Entity to mark a " +"class as an entity. It's a common mistake to import @org." +"hibernate.annotations.Entity by accident." +msgstr "" + +#. Tag: para +#: basic_mapping.xml:227 +#, fuzzy, no-c-format +msgid "" +"Some entities are not mutable. They cannot be updated or deleted by the " +"application. This allows Hibernate to make some minor performance " +"optimizations.. Use the @Immutable annotation." +msgstr "" +"Les classes immuables, mutable=\"false\", ne peuvent pas " +"être modifiées ou supprimées par l'application. Cela permet à Hibernate de " +"faire quelques optimisations mineures sur les performances. " + +#. Tag: para +#: basic_mapping.xml:232 +#, fuzzy, no-c-format +msgid "" +"You can also alter how Hibernate deals with lazy initialization for this " +"class. On @Proxy, use lazy=false " +"to disable lazy fetching (not recommended). You can also specify an " +"interface to use for lazy initializing proxies (defaults to the class " +"itself): use proxyClass on @Proxy. " +"Hibernate will initially return proxies (Javassist or CGLIB) that implement " +"the named interface. The persistent object will load when a method of the " +"proxy is invoked. See \"Initializing collections and proxies\" below." +msgstr "" +"L'attribut optionnel proxy permet les initialisations " +"différées des instances persistantes de la classe. Hibernate retournera " +"initialement des proxies CGLIB qui implémentent l'interface nommée. Le " +"véritable objet persistant ne sera chargé que lorsqu'une méthode du proxy " +"sera appelée. Voir plus bas le paragraphe abordant les Proxies et leur " +"initialisation différée (lazy initialization). " + +#. Tag: para +#: basic_mapping.xml:243 +#, no-c-format +msgid "" +"@BatchSize specifies a \"batch size\" for fetching " +"instances of this class by identifier. Not yet loaded instances are loaded " +"batch-size at a time (default 1)." +msgstr "" + +#. Tag: para +#: basic_mapping.xml:247 +#, fuzzy, no-c-format +msgid "" +"You can specific an arbitrary SQL WHERE condition to be used when retrieving " +"objects of this class. Use @Where for that." +msgstr "" +"where (optionnel) spécifie une clause SQL WHERE à utiliser lorsque l'on récupère des objets de cette classe. " + +#. Tag: para +#: basic_mapping.xml:251 +#, fuzzy, no-c-format +msgid "" +"In the same vein, @Check lets you define an SQL " +"expression used to generate a multi-row check " +"constraint for automatic schema generation." +msgstr "" +"check (optionnel) : expression SQL utilisée pour générer " +"une contrainte de vérification check multi-lignes pour " +"la génération automatique de schéma. " + +#. Tag: para +#: basic_mapping.xml:255 +#, fuzzy, no-c-format +msgid "" "There is no difference between a view and a base table for a Hibernate " "mapping. This is transparent at the database level, although some DBMS do " "not support views properly, especially with updates. Sometimes you want to " "use a view, but you cannot create one in the database (i.e. with a legacy " "schema). In this case, you can map an immutable and read-only entity to a " -"given SQL subselect expression:" +"given SQL subselect expression using @org.hibernate.annotations." +"Subselect:" msgstr "" "Il n'y a pas de différence entre table et vue pour le mappage Hibernate, " "comme on peut s'y attendre, cela est transparent au niveau base de données " @@ -736,7 +618,25 @@ msgstr "" "à-dire avec un schéma ancien). Dans ces cas, vous pouvez mapper une entité " "immuable en lecture seule sur une expression sous-select SQL donnée :" +#. Tag: programlisting +#: basic_mapping.xml:263 +#, no-c-format +msgid "" +"@Entity\n" +"@Subselect(\"select item.name, max(bid.amount), count(*) \"\n" +" + \"from item \"\n" +" + \"join bid on bid.item_id = item.id \"\n" +" + \"group by item.name\")\n" +"@Synchronize( {\"item\", \"bid\"} ) //tables impacted\n" +"public class Summary {\n" +" @Id\n" +" public String getId() { return id; }\n" +" ...\n" +"}" +msgstr "" + #. Tag: para +#: basic_mapping.xml:265 #, no-c-format msgid "" "Declare the tables to synchronize this entity with, ensuring that auto-flush " @@ -750,19 +650,372 @@ msgstr "" "subselect> est disponible comme attribut ou comme élément de " "mappage imbriqué. " -#. Tag: title +#. Tag: para +#: basic_mapping.xml:270 +#, fuzzy, no-c-format +msgid "" +"We will now explore the same options using the hbm.xml structure. You can " +"declare a persistent class using the class element. For " +"example:" +msgstr "" +"Déclarez une classe persistante avec l'élément class. " +"Part exemple :" + +#. Tag: programlisting +#: basic_mapping.xml:319 #, no-c-format -msgid "id" -msgstr "id" +msgid "" +"<class\n" +" name=\"ClassName\"\n" +" table=\"tableName\"\n" +" discriminator-value=\"discriminator_value\"\n" +" mutable=\"true|false\"\n" +" schema=\"owner\"\n" +" catalog=\"catalog\"\n" +" proxy=\"ProxyInterface\"\n" +" dynamic-update=\"true|false\"\n" +" dynamic-insert=\"true|false\"\n" +" select-before-update=\"true|false\"\n" +" polymorphism=\"implicit|explicit\"\n" +" where=\"arbitrary sql where condition\"\n" +" persister=\"PersisterClass\"\n" +" batch-size=\"N\"\n" +" optimistic-lock=\"none|version|dirty|all\"\n" +" lazy=\"true|false\"\n" +" entity-name=\"EntityName\"\n" +" check=\"arbitrary sql check condition\"\n" +" rowid=\"rowid\"\n" +" subselect=\"SQL expression\"\n" +" abstract=\"true|false\"\n" +" node=\"element-name\"\n" +"/>" +msgstr "" #. Tag: para +#: basic_mapping.xml:323 #, no-c-format msgid "" +"name (optional): the fully qualified Java class name of " +"the persistent class or interface. If this attribute is missing, it is " +"assumed that the mapping is for a non-POJO entity." +msgstr "" +"name (optionnel) : le nom Java complet de la classe (ou " +"interface) persistante. Si cet attribut est absent, nous supposons que ce " +"mappage ne se rapporte pas à une entité POJO. " + +#. Tag: para +#: basic_mapping.xml:330 +#, no-c-format +msgid "" +"table (optional - defaults to the unqualified class " +"name): the name of its database table." +msgstr "" +"table (optionnel - par défaut le nom non-qualifié de la " +"classe) : le nom de sa table en base de données." + +#. Tag: para +#: basic_mapping.xml:335 +#, no-c-format +msgid "" +"discriminator-value (optional - defaults to the class " +"name): a value that distinguishes individual subclasses that is used for " +"polymorphic behavior. Acceptable values include null and " +"not null." +msgstr "" +"discriminator-value (optionnel - par défaut le nom de la " +"classe) : une valeur permettant de distinguer les différentes sous-classes " +"utilisées dans le comportement polymorphique. Les valeurs null et not null sont autorisées. " + +#. Tag: para +#: basic_mapping.xml:343 +#, no-c-format +msgid "" +"mutable (optional - defaults to true): " +"specifies that instances of the class are (not) mutable." +msgstr "" +"mutable (optionnel, vaut true par " +"défaut) : spécifie que des instances de la classe sont (ou non) immuables. " + +#. Tag: para +#: basic_mapping.xml:349 basic_mapping.xml:2912 +#, no-c-format +msgid "" +"schema (optional): overrides the schema name specified by " +"the root <hibernate-mapping> element." +msgstr "" +"schema (optionnel) : surcharge le nom de schéma spécifié " +"par l'élément racine <hibernate-mappage>. " + +#. Tag: para +#: basic_mapping.xml:355 basic_mapping.xml:2918 +#, no-c-format +msgid "" +"catalog (optional): overrides the catalog name specified " +"by the root <hibernate-mapping> element." +msgstr "" +"catalog (optionnel) : surcharge le nom du catalogue " +"spécifié par l'élément racine <hibernate-mappage>. " + +#. Tag: para +#: basic_mapping.xml:361 +#, no-c-format +msgid "" +"proxy (optional): specifies an interface to use for lazy " +"initializing proxies. You can specify the name of the class itself." +msgstr "" +"proxy (optionnel) : spécifie une interface à utiliser " +"pour l'initialisation différée (lazy loading) des proxies. Vous pouvez " +"indiquer le nom de la classe elle-même. " + +#. Tag: para +#: basic_mapping.xml:367 +#, no-c-format +msgid "" +"dynamic-update (optional - defaults to false): specifies that UPDATE SQL should be generated " +"at runtime and can contain only those columns whose values have changed." +msgstr "" +"dynamic-update (optionnel, par défaut à false) : spécifie que les SQL UPDATE doivent être " +"générés à l'exécution et contenir uniquement les colonnes dont les valeurs " +"ont été modifiées. " + +#. Tag: para +#: basic_mapping.xml:374 +#, no-c-format +msgid "" +"dynamic-insert (optional - defaults to false): specifies that INSERT SQL should be generated " +"at runtime and contain only the columns whose values are not null." +msgstr "" +"dynamic-insert (optionnel, par défaut à false) : spécifie que les SQL INSERT doivent être " +"générés à l'exécution et ne contenir que les colonnes dont les valeurs sont " +"non nulles. " + +#. Tag: para +#: basic_mapping.xml:381 +#, no-c-format +msgid "" +"select-before-update (optional - defaults to " +"false): specifies that Hibernate should never perform an SQL UPDATE unless it is certain that " +"an object is actually modified. Only when a transient object has been " +"associated with a new session using update(), will " +"Hibernate perform an extra SQL SELECT to determine if an " +"UPDATE is actually required." +msgstr "" +"select-before-update (optionnel, par défaut à " +"false): spécifie que Hibernate ne doit jamais exécuter un SQL UPDATE sans être certain qu'un " +"objet a été réellement modifié. Dans certains cas, (en réalité, seulement " +"quand un objet transient a été associé à une nouvelle session par " +"update()), cela signifie que Hibernate exécutera un SQL " +"SELECT pour déterminer si un SQL UPDATE est véritablement nécessaire. " + +#. Tag: para +#: basic_mapping.xml:393 +#, fuzzy, no-c-format +msgid "" +"polymorphisms (optional - defaults to implicit): determines whether implicit or explicit query polymorphisms is " +"used." +msgstr "" +"polymorphism (optionnel, vaut implicit " +"par défaut) : détermine si, pour cette classe, une requête polymorphique " +"implicite ou explicite est utilisée. " + +#. Tag: para +#: basic_mapping.xml:399 +#, no-c-format +msgid "" +"where (optional): specifies an arbitrary SQL " +"WHERE condition to be used when retrieving objects of " +"this class." +msgstr "" +"where (optionnel) spécifie une clause SQL WHERE à utiliser lorsque l'on récupère des objets de cette classe. " + +#. Tag: para +#: basic_mapping.xml:405 +#, no-c-format +msgid "" +"persister (optional): specifies a custom " +"ClassPersister." +msgstr "" +"persister (optionnel) : spécifie un " +"ClassPersister particulier. " + +#. Tag: para +#: basic_mapping.xml:410 +#, no-c-format +msgid "" +"batch-size (optional - defaults to 1): " +"specifies a \"batch size\" for fetching instances of this class by " +"identifier." +msgstr "" +"batch-size (optionnel, par défaut = 1) : spécifie une \"taille de lot\" pour remplir les instances de " +"cette classe par identifiant en une seule requête." + +#. Tag: para +#: basic_mapping.xml:416 +#, no-c-format +msgid "" +"optimistic-lock (optional - defaults to version): determines the optimistic locking strategy." +msgstr "" +"optimistic-lock (optionnel, par défaut = " +"version) : détermine la stratégie de verrouillage " +"optimiste. " + +#. Tag: para +#: basic_mapping.xml:422 +#, no-c-format +msgid "" +"lazy (optional): lazy fetching can be disabled by setting " +"lazy=\"false\"." +msgstr "" +"lazy (optionnel) : l'extraction différée (lazy fetching) " +"peut être totalement désactivée en configurant lazy=\"false\"." + +#. Tag: para +#: basic_mapping.xml:427 +#, fuzzy, no-c-format +msgid "" +"entity-name (optional - defaults to the class name): " +"Hibernate3 allows a class to be mapped multiple times, potentially to " +"different tables. It also allows entity mappings that are represented by " +"Maps or XML at the Java level. In these cases, you should provide an " +"explicit arbitrary name for the entity. See and for more information." +msgstr "" +"entity-name (optionnel - le nom de classe par défaut) : " +"Hibernate3 permet à une classe d'être mappée plusieurs fois (potentiellement " +"à plusieurs tables), et permet aux mappages d'entité d'être représentés par " +"des Maps ou du XML au niveau Java. Dans ces cas, vous devez indiquer un nom " +"explicite arbitraire pour les entités. Consultez et pour plus " +"d'informations. " + +#. Tag: para +#: basic_mapping.xml:437 +#, no-c-format +msgid "" +"check (optional): an SQL expression used to generate a " +"multi-row check constraint for automatic schema " +"generation." +msgstr "" +"check (optionnel) : expression SQL utilisée pour générer " +"une contrainte de vérification check multi-lignes pour " +"la génération automatique de schéma. " + +#. Tag: para +#: basic_mapping.xml:443 +#, no-c-format +msgid "" +"rowid (optional): Hibernate can use ROWIDs on databases. " +"On Oracle, for example, Hibernate can use the rowid extra " +"column for fast updates once this option has been set to rowid. A ROWID is an implementation detail and represents the physical " +"location of a stored tuple." +msgstr "" +"rowid (optionnel) : Hibernate peut utiliser des ROWID sur " +"les bases de données qui utilisent ce mécanisme. Par exemple avec Oracle, " +"Hibernate peut utiliser la colonne additionnelle rowid " +"pour des mise à jour rapides si cette option vaut rowid. " +"Un ROWID est un détail d'implémentation et représente la localisation " +"physique d'un uplet enregistré. " + +#. Tag: para +#: basic_mapping.xml:452 +#, no-c-format +msgid "" +"subselect (optional): maps an immutable and read-only " +"entity to a database subselect. This is useful if you want to have a view " +"instead of a base table. See below for more information." +msgstr "" +"subselect (optionnel) : permet de mapper une entité " +"immuable en lecture-seule sur un sous-select de base de données. Utile pour " +"avoir une vue au lieu d'une table de base, mais à éviter. Voir plus bas pour " +"plus d'informations. " + +#. Tag: para +#: basic_mapping.xml:459 +#, no-c-format +msgid "" +"abstract (optional): is used to mark abstract " +"superclasses in <union-subclass> hierarchies." +msgstr "" +"abstract (optionnel) : utilisé pour marquer des " +"superclasses abstraites dans des hiérarchies de <union-" +"subclass>. " + +#. Tag: para +#: basic_mapping.xml:466 +#, no-c-format +msgid "" +"It is acceptable for the named persistent class to be an interface. You can " +"declare implementing classes of that interface using the <" +"subclass> element. You can persist any static inner class. Specify the class name using the standard form i.e. " +"e.g.Foo$Bar." +msgstr "" +"Il est tout à fait possible d'utiliser une interface comme nom de classe " +"persistante. Vous devez alors déclarer les classes implémentant cette " +"interface en utilisant l'élément <subclass>. Vous " +"pouvez faire persister toute classe interne static. " +"Vous devez alors spécifier le nom de la classe par la notation habituelle " +"des classes internes, c'est à dire eg.Foo$Bar." + +#. Tag: para +#: basic_mapping.xml:472 +#, no-c-format +msgid "Here is how to do a virtual view (subselect) in XML:" +msgstr "" + +#. Tag: programlisting +#: basic_mapping.xml:474 +#, no-c-format +msgid "" +"<class name=\"Summary\">\n" +" <subselect>\n" +" select item.name, max(bid.amount), count(*)\n" +" from item\n" +" join bid on bid.item_id = item.id\n" +" group by item.name\n" +" </subselect>\n" +" <synchronize table=\"item\"/>\n" +" <synchronize table=\"bid\"/>\n" +" <id name=\"name\"/>\n" +" ...\n" +"</class>" +msgstr "" + +#. Tag: para +#: basic_mapping.xml:476 +#, no-c-format +msgid "" +"The <subselect> is available both as an attribute " +"and a nested mapping element." +msgstr "" + +#. Tag: title +#: basic_mapping.xml:481 +#, fuzzy, no-c-format +msgid "Identifiers" +msgstr "Identifiants assignés" + +#. Tag: para +#: basic_mapping.xml:483 +#, fuzzy, no-c-format +msgid "" "Mapped classes must declare the primary key column of " "the database table. Most classes will also have a JavaBeans-style property " -"holding the unique identifier of an instance. The <id> element defines the mapping from that property to the primary key " -"column." +"holding the unique identifier of an instance." msgstr "" "Les classes mappées doivent déclarer la clé primaire de " "la table en base de données. La plupart des classes auront aussi une " @@ -771,6 +1024,50 @@ msgstr "" "cette propriété et la colonne de la clé primaire." #. Tag: para +#: basic_mapping.xml:488 +#, no-c-format +msgid "Mark the identifier property with @Id." +msgstr "" + +#. Tag: programlisting +#: basic_mapping.xml:491 +#, no-c-format +msgid "" +"@Entity\n" +"public class Person {\n" +" @Id Integer getId() { ... }\n" +" ...\n" +"}" +msgstr "" + +#. Tag: para +#: basic_mapping.xml:493 +#, fuzzy, no-c-format +msgid "" +"In hbm.xml, use the <id> element which defines the " +"mapping from that property to the primary key column." +msgstr "" +"Remarquez l'utilisation des balises <column> pour " +"mapper une propriété sur des colonnes multiples." + +#. Tag: programlisting +#: basic_mapping.xml:509 +#, no-c-format +msgid "" +"<id\n" +" name=\"propertyName\"\n" +" type=\"typename\"\n" +" column=\"column_name\"\n" +" unsaved-value=\"null|any|none|undefined|id_value\"\n" +" access=\"field|property|ClassName\">\n" +" node=\"element-name|@attribute-name|element/@attribute|.\"\n" +"\n" +" <generator class=\"generatorClass\"/>\n" +"</id>" +msgstr "" + +#. Tag: para +#: basic_mapping.xml:513 #, no-c-format msgid "" "name (optional): the name of the identifier property." @@ -778,6 +1075,7 @@ msgstr "" "name (optionnel) : nom de la propriété de l'identifiant." #. Tag: para +#: basic_mapping.xml:518 basic_mapping.xml:2141 #, no-c-format msgid "" "type (optional): a name that indicates the Hibernate type." @@ -785,6 +1083,7 @@ msgstr "" "type (optionnel) : nom indiquant le type Hibernate. " #. Tag: para +#: basic_mapping.xml:523 #, no-c-format msgid "" "column (optional - defaults to the property name): the " @@ -794,6 +1093,7 @@ msgstr "" "défaut) : nom de la colonne de la clé primaire." #. Tag: para +#: basic_mapping.xml:528 #, no-c-format msgid "" "unsaved-value (optional - defaults to a \"sensible\" " @@ -808,6 +1108,7 @@ msgstr "" "une session précédente. " #. Tag: para +#: basic_mapping.xml:536 #, no-c-format msgid "" "access (optional - defaults to propertyname attribute is missing, it is assumed that the " @@ -828,38 +1130,1044 @@ msgstr "" "classe ne possède pas de propriété d'identifiant." #. Tag: para -#, no-c-format +#: basic_mapping.xml:546 +#, fuzzy, no-c-format msgid "" "The unsaved-value attribute is almost never needed in " -"Hibernate3." +"Hibernate3 and indeed has no corresponding element in annotations." msgstr "" "L'attribut unsaved-value n'est presque jamais nécessaire " "dans Hibernate3." #. Tag: para -#, no-c-format +#: basic_mapping.xml:550 +#, fuzzy, no-c-format msgid "" -"There is an alternative <composite-id> declaration " -"that allows access to legacy data with composite keys. Its use is strongly " -"discouraged for anything else." +"You can also declare the identifier as a composite identifier. This allows " +"access to legacy data with composite keys. Its use is strongly discouraged " +"for anything else." msgstr "" "La déclaration alternative <composite-id> permet " "l'accès aux données d'anciens systèmes qui utilisent des clés composées. Son " "utilisation est fortement déconseillée pour d'autres cas." #. Tag: title -#, no-c-format -msgid "Generator" -msgstr "Generator" +#: basic_mapping.xml:555 +#, fuzzy, no-c-format +msgid "Composite identifier" +msgstr "Identifiants assignés" #. Tag: para +#: basic_mapping.xml:557 +#, no-c-format +msgid "You can define a composite primary key through several syntaxes:" +msgstr "" + +#. Tag: para +#: basic_mapping.xml:562 #, no-c-format msgid "" -"The optional <generator> child element names a Java " -"class used to generate unique identifiers for instances of the persistent " -"class. If any parameters are required to configure or initialize the " -"generator instance, they are passed using the <param> element." +"use a component type to represent the identifier and map it as a property in " +"the entity: you then annotated the property as @EmbeddedId. The component type has to be Serializable." +msgstr "" + +#. Tag: para +#: basic_mapping.xml:569 +#, no-c-format +msgid "" +"map multiple properties as @Id properties: the " +"identifier type is then the entity class itself and needs to be " +"Serializable. This approach is unfortunately not " +"standard and only supported by Hibernate." +msgstr "" + +#. Tag: para +#: basic_mapping.xml:577 +#, no-c-format +msgid "" +"map multiple properties as @Id properties and declare " +"an external class to be the identifier type. This class, which needs to be " +"Serializable, is declared on the entity via the " +"@IdClass annotation. The identifier type must contain " +"the same properties as the identifier properties of the entity: each " +"property name must be the same, its type must be the same as well if the " +"entity property is of a basic type, its type must be the type of the primary " +"key of the associated entity if the entity property is an association " +"(either a @OneToOne or a @ManyToOne)." +msgstr "" + +#. Tag: para +#: basic_mapping.xml:592 +#, no-c-format +msgid "" +"As you can see the last case is far from obvious. It has been inherited from " +"the dark ages of EJB 2 for backward compatibilities and we recommend you not " +"to use it (for simplicity sake)." +msgstr "" + +#. Tag: para +#: basic_mapping.xml:596 +#, no-c-format +msgid "Let's explore all three cases using examples." +msgstr "" + +#. Tag: title +#: basic_mapping.xml:599 +#, no-c-format +msgid "id as a property using a component type" +msgstr "" + +#. Tag: para +#: basic_mapping.xml:601 +#, no-c-format +msgid "Here is a simple example of @EmbeddedId." +msgstr "" + +#. Tag: programlisting +#: basic_mapping.xml:604 +#, no-c-format +msgid "" +"@Entity\n" +"class User {\n" +" @EmbeddedId\n" +" @AttributeOverride(name=\"firstName\", column=@Column(name=\"fld_firstname" +"\")\n" +" UserId id;\n" +"\n" +" Integer age;\n" +"}\n" +"\n" +"@Embeddable\n" +"class UserId implements Serializable {\n" +" String firstName;\n" +" String lastName;\n" +"}" +msgstr "" + +#. Tag: para +#: basic_mapping.xml:606 +#, no-c-format +msgid "" +"You can notice that the UserId class is serializable. " +"To override the column mapping, use @AttributeOverride." +msgstr "" + +#. Tag: para +#: basic_mapping.xml:610 +#, no-c-format +msgid "" +"An embedded id can itself contains the primary key of an associated entity." +msgstr "" + +#. Tag: programlisting +#: basic_mapping.xml:613 +#, no-c-format +msgid "" +"@Entity\n" +"class Customer {\n" +" @EmbeddedId CustomerId id;\n" +" boolean preferredCustomer;\n" +"\n" +" @MapsId(\"userId\")\n" +" @JoinColumns({\n" +" @JoinColumn(name=\"userfirstname_fk\", referencedColumnName=\"firstName" +"\"),\n" +" @JoinColumn(name=\"userlastname_fk\", referencedColumnName=\"lastName" +"\")\n" +" })\n" +" @OneToOne User user;\n" +"}\n" +"\n" +"@Embeddable\n" +"class CustomerId implements Serializable {\n" +" UserId userId;\n" +" String customerNumber;\n" +"\n" +" //implements equals and hashCode\n" +"}\n" +"\n" +"@Entity \n" +"class User {\n" +" @EmbeddedId UserId id;\n" +" Integer age;\n" +"}\n" +"\n" +"@Embeddable\n" +"class UserId implements Serializable {\n" +" String firstName;\n" +" String lastName;\n" +"\n" +" //implements equals and hashCode\n" +"}" +msgstr "" + +#. Tag: para +#: basic_mapping.xml:615 +#, no-c-format +msgid "" +"In the embedded id object, the association is represented as the identifier " +"of the associated entity. But you can link its value to a regular " +"association in the entity via the @MapsId annotation. " +"The @MapsId value correspond to the property name of " +"the embedded id object containing the associated entity's identifier. In the " +"database, it means that the Customer.user and the " +"CustomerId.userId properties share the same underlying " +"column (user_fk in this case)." +msgstr "" + +#. Tag: para +#: basic_mapping.xml:627 +#, no-c-format +msgid "" +"The component type used as identifier must implement equals() and hashCode()." +msgstr "" + +#. Tag: para +#: basic_mapping.xml:632 +#, no-c-format +msgid "" +"In practice, your code only sets the Customer.user " +"property and the user id value is copied by Hibernate into the " +"CustomerId.userId property." +msgstr "" + +#. Tag: para +#: basic_mapping.xml:638 +#, no-c-format +msgid "" +"The id value can be copied as late as flush time, don't rely on it until " +"after flush time." +msgstr "" + +#. Tag: para +#: basic_mapping.xml:642 +#, no-c-format +msgid "" +"While not supported in JPA, Hibernate lets you place your association " +"directly in the embedded id component (instead of having to use the " +"@MapsId annotation)." +msgstr "" + +#. Tag: programlisting +#: basic_mapping.xml:646 +#, no-c-format +msgid "" +"@Entity\n" +"class Customer {\n" +" @EmbeddedId CustomerId id;\n" +" boolean preferredCustomer;\n" +"}\n" +"\n" +"@Embeddable\n" +"class CustomerId implements Serializable {\n" +" @OneToOne\n" +" @JoinColumns({\n" +" @JoinColumn(name=\"userfirstname_fk\", referencedColumnName=\"firstName" +"\"),\n" +" @JoinColumn(name=\"userlastname_fk\", referencedColumnName=\"lastName" +"\")\n" +" }) \n" +" User user;\n" +" String customerNumber;\n" +"\n" +" //implements equals and hashCode\n" +"}\n" +"\n" +"@Entity \n" +"class User {\n" +" @EmbeddedId UserId id;\n" +" Integer age;\n" +"}\n" +"\n" +"@Embeddable\n" +"class UserId implements Serializable {\n" +" String firstName;\n" +" String lastName;\n" +"\n" +"\n" +" //implements equals and hashCode\n" +"}" +msgstr "" + +#. Tag: para +#: basic_mapping.xml:648 +#, no-c-format +msgid "Let's now rewrite these examples using the hbm.xml syntax." +msgstr "" + +#. Tag: programlisting +#: basic_mapping.xml:651 +#, no-c-format +msgid "" +"<composite-id\n" +" name=\"propertyName\"\n" +" class=\"ClassName\"\n" +" mapped=\"true|false\"\n" +" access=\"field|property|ClassName\"\n" +" node=\"element-name|.\">\n" +"\n" +" <key-property name=\"propertyName\" type=\"typename\" column=" +"\"column_name\"/>\n" +" <key-many-to-one name=\"propertyName\" class=\"ClassName\" column=" +"\"column_name\"/>\n" +" ......\n" +"</composite-id>" +msgstr "" + +#. Tag: para +#: basic_mapping.xml:653 +#, no-c-format +msgid "First a simple example:" +msgstr "" + +#. Tag: programlisting +#: basic_mapping.xml:655 +#, no-c-format +msgid "" +"<class name=\"User\">\n" +" <composite-id name=\"id\" class=\"UserId\">\n" +" <key-property name=\"firstName\" column=\"fld_firstname\"/>\n" +" <key-property name=\"lastName\"/>\n" +" </composite-id>\n" +"</class>" +msgstr "" + +#. Tag: para +#: basic_mapping.xml:657 +#, no-c-format +msgid "Then an example showing how an association can be mapped." +msgstr "" + +#. Tag: programlisting +#: basic_mapping.xml:660 +#, no-c-format +msgid "" +"<class name=\"Customer\">\n" +" <composite-id name=\"id\" class=\"CustomerId\">\n" +" <key-property name=\"firstName\" column=\"userfirstname_fk\"/>\n" +" <key-property name=\"lastName\" column=\"userfirstname_fk\"/>\n" +" <key-property name=\"customerNumber\"/>\n" +" </composite-id>\n" +"\n" +" <property name=\"preferredCustomer\"/>\n" +"\n" +" <many-to-one name=\"user\">\n" +" <column name=\"userfirstname_fk\" updatable=\"false\" insertable=" +"\"false\"/>\n" +" <column name=\"userlastname_fk\" updatable=\"false\" insertable=" +"\"false\"/>\n" +" </many-to-one>\n" +"</class>\n" +"\n" +"<class name=\"User\">\n" +" <composite-id name=\"id\" class=\"UserId\">\n" +" <key-property name=\"firstName\"/>\n" +" <key-property name=\"lastName\"/>\n" +" </composite-id>\n" +"\n" +" <property name=\"age\"/>\n" +"</class>" +msgstr "" + +#. Tag: para +#: basic_mapping.xml:662 +#, no-c-format +msgid "Notice a few things in the previous example:" +msgstr "" + +#. Tag: para +#: basic_mapping.xml:666 +#, no-c-format +msgid "" +"the order of the properties (and column) matters. It must be the same " +"between the association and the primary key of the associated entity" +msgstr "" + +#. Tag: para +#: basic_mapping.xml:672 +#, no-c-format +msgid "" +"the many to one uses the same columns as the primary key and thus must be " +"marked as read only (insertable and updatable to false)." +msgstr "" + +#. Tag: para +#: basic_mapping.xml:679 +#, no-c-format +msgid "" +"unlike with @MapsId, the id value of the associated " +"entity is not transparently copied, check the foreign id " +"generator for more information." +msgstr "" + +#. Tag: para +#: basic_mapping.xml:686 +#, no-c-format +msgid "" +"The last example shows how to map association directly in the embedded id " +"component." +msgstr "" + +#. Tag: programlisting +#: basic_mapping.xml:689 +#, no-c-format +msgid "" +"<class name=\"Customer\">\n" +" <composite-id name=\"id\" class=\"CustomerId\">\n" +" <key-many-to-one name=\"user\">\n" +" <column name=\"userfirstname_fk\"/>\n" +" <column name=\"userlastname_fk\"/>\n" +" </key-many-to-one>\n" +" <key-property name=\"customerNumber\"/>\n" +" </composite-id>\n" +"\n" +" <property name=\"preferredCustomer\"/>\n" +"</class>\n" +"\n" +"<class name=\"User\">\n" +" <composite-id name=\"id\" class=\"UserId\">\n" +" <key-property name=\"firstName\"/>\n" +" <key-property name=\"lastName\"/>\n" +" </composite-id>\n" +"\n" +" <property name=\"age\"/>\n" +"</class>" +msgstr "" + +#. Tag: para +#: basic_mapping.xml:691 +#, no-c-format +msgid "" +"This is the recommended approach to map composite identifier. The following " +"options should not be considered unless some constraint are present." +msgstr "" + +#. Tag: title +#: basic_mapping.xml:697 +#, no-c-format +msgid "Multiple id properties without identifier type" +msgstr "" + +#. Tag: para +#: basic_mapping.xml:699 +#, no-c-format +msgid "" +"Another, arguably more natural, approach is to place @Id on multiple properties of your entity. This approach is only " +"supported by Hibernate (not JPA compliant) but does not require an extra " +"embeddable component." +msgstr "" + +#. Tag: programlisting +#: basic_mapping.xml:704 +#, no-c-format +msgid "" +"@Entity\n" +"class Customer implements Serializable {\n" +" @Id @OneToOne\n" +" @JoinColumns({\n" +" @JoinColumn(name=\"userfirstname_fk\", referencedColumnName=\"firstName" +"\"),\n" +" @JoinColumn(name=\"userlastname_fk\", referencedColumnName=\"lastName" +"\")\n" +" })\n" +" User user;\n" +" \n" +" @Id String customerNumber;\n" +"\n" +" boolean preferredCustomer;\n" +"\n" +" //implements equals and hashCode\n" +"}\n" +"\n" +"@Entity \n" +"class User {\n" +" @EmbeddedId UserId id;\n" +" Integer age;\n" +"}\n" +"\n" +"@Embeddable\n" +"class UserId implements Serializable {\n" +" String firstName;\n" +" String lastName;\n" +"\n" +" //implements equals and hashCode\n" +"}" +msgstr "" + +#. Tag: para +#: basic_mapping.xml:706 +#, no-c-format +msgid "" +"In this case Customer is its own identifier " +"representation: it must implement Serializable and " +"must implement equals() and hashCode()." +msgstr "" + +#. Tag: para +#: basic_mapping.xml:712 +#, no-c-format +msgid "In hbm.xml, the same mapping is:" +msgstr "" + +#. Tag: programlisting +#: basic_mapping.xml:714 +#, no-c-format +msgid "" +"<class name=\"Customer\">\n" +" <composite-id>\n" +" <key-many-to-one name=\"user\">\n" +" <column name=\"userfirstname_fk\"/>\n" +" <column name=\"userlastname_fk\"/>\n" +" </key-many-to-one>\n" +" <key-property name=\"customerNumber\"/>\n" +" </composite-id>\n" +"\n" +" <property name=\"preferredCustomer\"/>\n" +"</class>\n" +"\n" +"<class name=\"User\">\n" +" <composite-id name=\"id\" class=\"UserId\">\n" +" <key-property name=\"firstName\"/>\n" +" <key-property name=\"lastName\"/>\n" +" </composite-id>\n" +"\n" +" <property name=\"age\"/>\n" +"</class>" +msgstr "" + +#. Tag: title +#: basic_mapping.xml:718 +#, no-c-format +msgid "Multiple id properties with with a dedicated identifier type" +msgstr "" + +#. Tag: para +#: basic_mapping.xml:721 +#, no-c-format +msgid "" +"@IdClass on an entity points to the class (component) " +"representing the identifier of the class. The properties marked " +"@Id on the entity must have their corresponding " +"property on the @IdClass. The return type of search " +"twin property must be either identical for basic properties or must " +"correspond to the identifier class of the associated entity for an " +"association." +msgstr "" + +#. Tag: para +#: basic_mapping.xml:730 +#, no-c-format +msgid "" +"This approach is inherited from the EJB 2 days and we recommend against its " +"use. But, after all it's your application and Hibernate supports it." +msgstr "" + +#. Tag: programlisting +#: basic_mapping.xml:735 +#, no-c-format +msgid "" +"@Entity\n" +"@IdClass(CustomerId.class)\n" +"class Customer implements Serializable {\n" +" @Id @OneToOne\n" +" @JoinColumns({\n" +" @JoinColumn(name=\"userfirstname_fk\", referencedColumnName=\"firstName" +"\"),\n" +" @JoinColumn(name=\"userlastname_fk\", referencedColumnName=\"lastName" +"\")\n" +" }) \n" +" User user;\n" +" \n" +" @Id String customerNumber;\n" +"\n" +" boolean preferredCustomer;\n" +"}\n" +"\n" +"class CustomerId implements Serializable {\n" +" UserId user;\n" +" String customerNumber;\n" +"\n" +" //implements equals and hashCode\n" +"}\n" +"\n" +"@Entity \n" +"class User {\n" +" @EmbeddedId UserId id;\n" +" Integer age;\n" +"\n" +" //implements equals and hashCode\n" +"}\n" +"\n" +"@Embeddable\n" +"class UserId implements Serializable {\n" +" String firstName;\n" +" String lastName;\n" +"\n" +" //implements equals and hashCode\n" +"}" +msgstr "" + +#. Tag: para +#: basic_mapping.xml:737 +#, no-c-format +msgid "" +"Customer and CustomerId do " +"have the same properties customerNumber as well as " +"user. CustomerId must be " +"Serializable and implement equals() and hashCode()." +msgstr "" + +#. Tag: para +#: basic_mapping.xml:745 +#, no-c-format +msgid "" +"While not JPA standard, Hibernate let's you declare the vanilla associated " +"property in the @IdClass." +msgstr "" + +#. Tag: programlisting +#: basic_mapping.xml:749 +#, no-c-format +msgid "" +"@Entity\n" +"@IdClass(CustomerId.class)\n" +"class Customer implements Serializable {\n" +" @Id @OneToOne\n" +" @JoinColumns({\n" +" @JoinColumn(name=\"userfirstname_fk\", referencedColumnName=\"firstName" +"\"),\n" +" @JoinColumn(name=\"userlastname_fk\", referencedColumnName=\"lastName" +"\")\n" +" }) \n" +" User user;\n" +" \n" +" @Id String customerNumber;\n" +"\n" +" boolean preferredCustomer;\n" +"}\n" +"\n" +"class CustomerId implements Serializable {\n" +" @OneToOne User user;\n" +" String customerNumber;\n" +"\n" +" //implements equals and hashCode\n" +"}\n" +"\n" +"@Entity \n" +"class User {\n" +" @EmbeddedId UserId id;\n" +" Integer age;\n" +"\n" +" //implements equals and hashCode\n" +"}\n" +"\n" +"@Embeddable\n" +"class UserId implements Serializable {\n" +" String firstName;\n" +" String lastName;\n" +"}" +msgstr "" + +#. Tag: para +#: basic_mapping.xml:751 +#, no-c-format +msgid "" +"This feature is of limited interest though as you are likely to have chosen " +"the @IdClass approach to stay JPA compliant or you " +"have a quite twisted mind." +msgstr "" + +#. Tag: para +#: basic_mapping.xml:755 +#, no-c-format +msgid "Here are the equivalent on hbm.xml files:" +msgstr "" + +#. Tag: programlisting +#: basic_mapping.xml:757 +#, no-c-format +msgid "" +"<class name=\"Customer\">\n" +" <composite-id class=\"CustomerId\" mapped=\"true\">\n" +" <key-many-to-one name=\"user\">\n" +" <column name=\"userfirstname_fk\"/>\n" +" <column name=\"userlastname_fk\"/>\n" +" </key-many-to-one>\n" +" <key-property name=\"customerNumber\"/>\n" +" </composite-id>\n" +"\n" +" <property name=\"preferredCustomer\"/>\n" +"</class>\n" +"\n" +"<class name=\"User\">\n" +" <composite-id name=\"id\" class=\"UserId\">\n" +" <key-property name=\"firstName\"/>\n" +" <key-property name=\"lastName\"/>\n" +" </composite-id>\n" +"\n" +" <property name=\"age\"/>\n" +"</class>" +msgstr "" + +#. Tag: title +#: basic_mapping.xml:762 +#, fuzzy, no-c-format +msgid "Identifier generator" +msgstr "La méthode getter de l'identifiant " + +#. Tag: para +#: basic_mapping.xml:764 +#, no-c-format +msgid "" +"Hibernate can generate and populate identifier values for you automatically. " +"This is the recommended approach over \"business\" or \"natural\" id " +"(especially composite ids)." +msgstr "" + +#. Tag: para +#: basic_mapping.xml:768 +#, no-c-format +msgid "" +"Hibernate offers various generation strategies, let's explore the most " +"common ones first that happens to be standardized by JPA:" +msgstr "" + +#. Tag: para +#: basic_mapping.xml:774 +#, fuzzy, no-c-format +msgid "" +"IDENTITY: supports identity columns in DB2, MySQL, MS SQL Server, Sybase and " +"HypersonicSQL. The returned identifier is of type long, " +"short or int." +msgstr "" +"prend en charge les colonnes d'identité dans DB2, MySQL, MS SQL Server, " +"Sybase et HypersonicSQL. L'identifiant renvoyé est de type long, short ou int." + +#. Tag: para +#: basic_mapping.xml:781 +#, fuzzy, no-c-format +msgid "" +"SEQUENCE (called seqhilo in Hibernate): uses a hi/lo " +"algorithm to efficiently generate identifiers of type long, short or int, given a named " +"database sequence." +msgstr "" +"utilise un algorithme hi/lo pour générer efficacement des identifiants de " +"type long, short ou int, en prenant une séquence en base nommée." + +#. Tag: para +#: basic_mapping.xml:788 +#, fuzzy, no-c-format +msgid "" +"TABLE (called MultipleHiLoPerTableGenerator in " +"Hibernate) : uses a hi/lo algorithm to efficiently generate identifiers of " +"type long, short or int, given a table and column as a source of hi values. The hi/lo " +"algorithm generates identifiers that are unique only for a particular " +"database." +msgstr "" +"utilise un algorithme hi/lo pour générer de façon efficace des identifiants " +"de type long, short ou int, en prenant comme source de valeurs \"hi\" une table et une colonne " +"(par défaut hibernate_unique_key et next_hi respectivement). L'algorithme hi/lo génère des identifiants uniques " +"pour une base de données particulière seulement." + +#. Tag: para +#: basic_mapping.xml:798 +#, fuzzy, no-c-format +msgid "" +"AUTO: selects IDENTITY, SEQUENCE or " +"TABLE depending upon the capabilities of the underlying " +"database." +msgstr "" +"choisit identity, sequence ou " +"hilo selon les possibilités offertes par la base de " +"données sous-jacente. " + +#. Tag: para +#: basic_mapping.xml:805 +#, no-c-format +msgid "" +"We recommend all new projects to use the new enhanced identifier generators. " +"They are deactivated by default for entities using annotations but can be " +"activated using hibernate.id.new_generator_mappings=true. These " +"new generators are more efficient and closer to the JPA 2 specification " +"semantic." +msgstr "" + +#. Tag: para +#: basic_mapping.xml:812 +#, no-c-format +msgid "" +"However they are not backward compatible with existing Hibernate based " +"application (if a sequence or a table is used for id generation). See " +"XXXXXXX for more information on how " +"to activate them." +msgstr "" + +#. Tag: para +#: basic_mapping.xml:818 +#, no-c-format +msgid "" +"To mark an id property as generated, use the @GeneratedValue annotation. You can specify the strategy used (default to " +"AUTO) by setting strategy." +msgstr "" + +#. Tag: programlisting +#: basic_mapping.xml:823 +#, no-c-format +msgid "" +"@Entity\n" +"public class Customer {\n" +" @Id @GeneratedValue\n" +" Integer getId() { ... };\n" +"}\n" +"\n" +"@Entity \n" +"public class Invoice {\n" +" @Id @GeneratedValue(strategy=GenerationType.IDENTITY)\n" +" Integer getId() { ... };\n" +"}" +msgstr "" + +#. Tag: para +#: basic_mapping.xml:825 +#, no-c-format +msgid "" +"SEQUENCE and TABLE require additional " +"configurations that you can set using @SequenceGenerator and @TableGenerator:" +msgstr "" + +#. Tag: para +#: basic_mapping.xml:832 +#, fuzzy, no-c-format +msgid "name: name of the generator" +msgstr "name : le nom de la propriété. " + +#. Tag: para +#: basic_mapping.xml:836 +#, fuzzy, no-c-format +msgid "" +"table / sequenceName: name of the " +"table or the sequence (defaulting respectively to " +"hibernate_sequences and hibernate_sequence)" +msgstr "" +"sequence_name (en option, par défaut = " +"hibernate_sequence): le nom de la séquence ou table à " +"utiliser." + +#. Tag: para +#: basic_mapping.xml:843 +#, fuzzy, no-c-format +msgid "catalog / schema:" +msgstr "serializable" + +#. Tag: para +#: basic_mapping.xml:848 +#, fuzzy, no-c-format +msgid "" +"initialValue: the value from which the id is to start " +"generating" +msgstr "table : le nom de la table jointe. " + +#. Tag: para +#: basic_mapping.xml:853 +#, no-c-format +msgid "" +"allocationSize: the amount to increment by when " +"allocating id numbers from the generator" +msgstr "" + +#. Tag: para +#: basic_mapping.xml:858 +#, no-c-format +msgid "" +"In addition, the TABLE strategy also let you " +"customize:" +msgstr "" + +#. Tag: para +#: basic_mapping.xml:863 +#, fuzzy, no-c-format +msgid "" +"pkColumnName: the column name containing the entity " +"identifier" +msgstr "name : le nom de la propriété. " + +#. Tag: para +#: basic_mapping.xml:868 +#, fuzzy, no-c-format +msgid "" +"valueColumnName: the column name containing the " +"identifier value" +msgstr "" +"name (optionnel) : nom de la propriété de l'identifiant." + +#. Tag: para +#: basic_mapping.xml:873 +#, fuzzy, no-c-format +msgid "pkColumnValue: the entity identifier" +msgstr "id-type : le type identifiant." + +#. Tag: para +#: basic_mapping.xml:878 +#, no-c-format +msgid "" +"uniqueConstraints: any potential column constraint on the " +"table containing the ids" +msgstr "" + +#. Tag: para +#: basic_mapping.xml:883 +#, no-c-format +msgid "" +"To link a table or sequence generator definition with an actual generated " +"property, use the same name in both the definition name " +"and the generator value generator as shown below." +msgstr "" + +#. Tag: programlisting +#: basic_mapping.xml:888 +#, no-c-format +msgid "" +"@Id \n" +"@GeneratedValue(\n" +" strategy=GenerationType.SEQUENCE, \n" +" generator=\"SEQ_GEN\")\n" +"@javax.persistence.SequenceGenerator(\n" +" name=\"SEQ_GEN\",\n" +" sequenceName=\"my_sequence\",\n" +" allocationSize=20\n" +")\n" +"public Integer getId() { ... }" +msgstr "" + +#. Tag: para +#: basic_mapping.xml:890 +#, no-c-format +msgid "" +"The scope of a generator definition can be the application or the class. " +"Class-defined generators are not visible outside the class and can override " +"application level generators. Application level generators are defined in " +"JPA's XML deployment descriptors (see XXXXXX ):" +msgstr "" + +#. Tag: programlisting +#: basic_mapping.xml:896 +#, no-c-format +msgid "" +"<table-generator name=\"EMP_GEN\"\n" +" table=\"GENERATOR_TABLE\"\n" +" pk-column-name=\"key\"\n" +" value-column-name=\"hi\"\n" +" pk-column-value=\"EMP\"\n" +" allocation-size=\"20\"/>\n" +"\n" +"//and the annotation equivalent\n" +"\n" +"@javax.persistence.TableGenerator(\n" +" name=\"EMP_GEN\",\n" +" table=\"GENERATOR_TABLE\",\n" +" pkColumnName = \"key\",\n" +" valueColumnName = \"hi\"\n" +" pkColumnValue=\"EMP\",\n" +" allocationSize=20\n" +")\n" +"\n" +"<sequence-generator name=\"SEQ_GEN\" \n" +" sequence-name=\"my_sequence\"\n" +" allocation-size=\"20\"/>\n" +"\n" +"//and the annotation equivalent\n" +"\n" +"@javax.persistence.SequenceGenerator(\n" +" name=\"SEQ_GEN\",\n" +" sequenceName=\"my_sequence\",\n" +" allocationSize=20\n" +")" +msgstr "" + +#. Tag: para +#: basic_mapping.xml:898 +#, no-c-format +msgid "" +"If a JPA XML descriptor (like META-INF/orm.xml) is used " +"to define the generators, EMP_GEN and SEQ_GEN are application level generators." +msgstr "" + +#. Tag: para +#: basic_mapping.xml:904 +#, no-c-format +msgid "" +"Package level definition is not supported by the JPA specification. However, " +"you can use the @GenericGenerator at the package level " +"(see )." +msgstr "" + +#. Tag: para +#: basic_mapping.xml:910 +#, no-c-format +msgid "" +"These are the four standard JPA generators. Hibernate goes beyond that and " +"provide additional generators or additional options as we will see below. " +"You can also write your own custom identifier generator by implementing " +"org.hibernate.id.IdentifierGenerator." +msgstr "" + +#. Tag: para +#: basic_mapping.xml:916 +#, no-c-format +msgid "" +"To define a custom generator, use the @GenericGenerator annotation (and its plural counter part " +"@GenericGenerators) that describes the class of the " +"identifier generator or its short cut name (as described below) and a list " +"of key/value parameters. When using @GenericGenerator " +"and assigning it via @GeneratedValue.generator, the " +"@GeneratedValue.strategy is ignored: leave it blank." +msgstr "" + +#. Tag: programlisting +#: basic_mapping.xml:926 +#, no-c-format +msgid "" +"@Id @GeneratedValue(generator=\"system-uuid\")\n" +"@GenericGenerator(name=\"system-uuid\", strategy = \"uuid\")\n" +"public String getId() {\n" +"\n" +"@Id @GeneratedValue(generator=\"trigger-generated\")\n" +"@GenericGenerator(\n" +" name=\"trigger-generated\", \n" +" strategy = \"select\",\n" +" parameters = @Parameter(name=\"key\", value = \"socialSecurityNumber\")\n" +")\n" +"public String getId() {" +msgstr "" + +#. Tag: para +#: basic_mapping.xml:928 +#, fuzzy, no-c-format +msgid "" +"The hbm.xml approach uses the optional <generator> " +"child element inside <id>. If any parameters are " +"required to configure or initialize the generator instance, they are passed " +"using the <param> element." msgstr "" "L'élément enfant <generator> nomme une classe Java " "utilisée pour générer les identifiants uniques pour les instances des " @@ -867,7 +2175,27 @@ msgstr "" "initialiser l'instance du générateur, ils sont passés en utilisant l'élément " "<param>." +#. Tag: programlisting +#: basic_mapping.xml:934 +#, no-c-format +msgid "" +"<id name=\"id\" type=\"long\" column=\"cat_id\">\n" +" <generator class=\"org.hibernate.id.TableHiLoGenerator\">\n" +" <param name=\"table\">uid_table</param>\n" +" <param name=\"column\">next_hi_value_column</" +"param>\n" +" </generator>\n" +"</id>" +msgstr "" + +#. Tag: title +#: basic_mapping.xml:937 +#, no-c-format +msgid "Various additional generators" +msgstr "" + #. Tag: para +#: basic_mapping.xml:939 #, no-c-format msgid "" "All generators implement the interface org.hibernate.id." @@ -882,12 +2210,14 @@ msgstr "" "Cependant, Hibernate propose une série d'implémentations intégrées. Il " "existe des noms raccourcis pour les générateurs intégrés :" -#. Tag: term +#. Tag: literal +#: basic_mapping.xml:946 #, no-c-format -msgid "increment" -msgstr "increment" +msgid "increment" +msgstr "" #. Tag: para +#: basic_mapping.xml:949 #, no-c-format msgid "" "generates identifiers of type long, shortNe pas utiliser " "en environnement clusterisé." -#. Tag: term +#. Tag: literal +#: basic_mapping.xml:958 #, no-c-format -msgid "identity" -msgstr "identity" +msgid "identity" +msgstr "" #. Tag: para +#: basic_mapping.xml:961 #, no-c-format msgid "" "supports identity columns in DB2, MySQL, MS SQL Server, Sybase and " @@ -916,12 +2248,14 @@ msgstr "" "Sybase et HypersonicSQL. L'identifiant renvoyé est de type long, short ou int." -#. Tag: term +#. Tag: literal +#: basic_mapping.xml:969 #, no-c-format -msgid "sequence" -msgstr "sequence" +msgid "sequence" +msgstr "" #. Tag: para +#: basic_mapping.xml:972 #, no-c-format msgid "" "uses a sequence in DB2, PostgreSQL, Oracle, SAP DB, McKoi or a generator in " @@ -932,12 +2266,14 @@ msgstr "" "générateur dans Interbase. L'identifiant renvoyé est de type long, short ou int" -#. Tag: term +#. Tag: literal +#: basic_mapping.xml:980 #, no-c-format -msgid "hilo" -msgstr "hilo" +msgid "hilo" +msgstr "" #. Tag: para +#: basic_mapping.xml:984 #, no-c-format msgid "" "uses a hi/lo algorithm to efficiently generate identifiers of type " @@ -954,12 +2290,14 @@ msgstr "" "literal> respectivement). L'algorithme hi/lo génère des identifiants uniques " "pour une base de données particulière seulement." -#. Tag: term +#. Tag: literal +#: basic_mapping.xml:996 #, no-c-format -msgid "seqhilo" -msgstr "seqhilo" +msgid "seqhilo" +msgstr "" #. Tag: para +#: basic_mapping.xml:999 #, no-c-format msgid "" "uses a hi/lo algorithm to efficiently generate identifiers of type " @@ -970,39 +2308,122 @@ msgstr "" "type long, short ou int, en prenant une séquence en base nommée." -#. Tag: term -#, no-c-format -msgid "uuid" -msgstr "uuid" +#. Tag: literal +#: basic_mapping.xml:1007 +#, fuzzy, no-c-format +msgid "uuid" +msgstr "id" #. Tag: para +#: basic_mapping.xml:1010 #, no-c-format msgid "" -"uses a 128-bit UUID algorithm to generate identifiers of type string that " -"are unique within a network (the IP address is used). The UUID is encoded as " -"a string of 32 hexadecimal digits in length." +"Generates a 128-bit UUID based on a custom algorithm. The value generated is " +"represented as a string of 32 hexidecimal digits. Users can also configure " +"it to use a separator (config parameter \"separator\") which separates the " +"hexidecimal digits into 8{sep}8{sep}4{sep}8{sep}4. Note specifically that " +"this is different than the IETF RFC 4122 representation of 8-4-4-4-12. If " +"you need RFC 4122 compliant UUIDs, consider using \"uuid2\" generator " +"discussed below." msgstr "" -"utilise un algorithme de type UUID 128 bits pour générer des identifiants de " -"type string, unique au sein d'un réseau (l'adresse IP est utilisée). Le UUID " -"est encodé en une chaîne de nombre héxadécimaux de longueur 32. " -#. Tag: term +#. Tag: literal +#: basic_mapping.xml:1023 #, no-c-format -msgid "guid" -msgstr "guid" +msgid "uuid2" +msgstr "" #. Tag: para +#: basic_mapping.xml:1026 +#, no-c-format +msgid "" +"Generates a IETF RFC 4122 compliant (variant 2) 128-bit UUID. The exact " +"\"version\" (the RFC term) generated depends on the pluggable \"generation " +"strategy\" used (see below). Capable of generating values as java." +"util.UUID, java.lang.String or as a byte " +"array of length 16 (byte[16]). The \"generation strategy" +"\" is defined by the interface org.hibernate.id." +"UUIDGenerationStrategy. The generator defines 2 " +"configuration parameters for defining which generation strategy to use:" +msgstr "" + +#. Tag: literal +#: basic_mapping.xml:1038 +#, no-c-format +msgid "uuid_gen_strategy_class" +msgstr "" + +#. Tag: para +#: basic_mapping.xml:1041 +#, no-c-format +msgid "Names the UUIDGenerationStrategy class to use" +msgstr "" + +#. Tag: literal +#: basic_mapping.xml:1047 +#, no-c-format +msgid "uuid_gen_strategy" +msgstr "" + +#. Tag: para +#: basic_mapping.xml:1050 +#, no-c-format +msgid "Names the UUIDGenerationStrategy instance to use" +msgstr "" + +#. Tag: para +#: basic_mapping.xml:1056 +#, no-c-format +msgid "Out of the box, comes with the following strategies:" +msgstr "" + +#. Tag: para +#: basic_mapping.xml:1059 +#, no-c-format +msgid "" +"org.hibernate.id.uuid.StandardRandomStrategy (the " +"default) - generates \"version 3\" (aka, \"random\") UUID values via the " +"randomUUID method of java.util.UUID" +msgstr "" + +#. Tag: para +#: basic_mapping.xml:1067 +#, no-c-format +msgid "" +"org.hibernate.id.uuid.CustomVersionOneStrategy - " +"generates \"version 1\" UUID values, using IP address since mac address not " +"available. If you need mac address to be used, consider leveraging one of " +"the existing third party UUID generators which sniff out mac address and " +"integrating it via the org.hibernate.id." +"UUIDGenerationStrategy contract. Two such libraries known at " +"time of this writing include http://johannburkard.de/software/uuid/ and http://commons.apache.org/" +"sandbox/id/uuid.html" +msgstr "" + +#. Tag: literal +#: basic_mapping.xml:1085 +#, fuzzy, no-c-format +msgid "guid" +msgstr "id" + +#. Tag: para +#: basic_mapping.xml:1088 #, no-c-format msgid "uses a database-generated GUID string on MS SQL Server and MySQL." msgstr "" "utilise une chaîne GUID générée par la base pour MS SQL Server et MySQL." -#. Tag: term +#. Tag: literal +#: basic_mapping.xml:1094 #, no-c-format -msgid "native" -msgstr "native" +msgid "native" +msgstr "" #. Tag: para +#: basic_mapping.xml:1097 #, no-c-format msgid "" "selects identity, sequence or " @@ -1013,12 +2434,14 @@ msgstr "" "hilo selon les possibilités offertes par la base de " "données sous-jacente. " -#. Tag: term +#. Tag: literal +#: basic_mapping.xml:1105 #, no-c-format -msgid "assigned" -msgstr "assigned" +msgid "assigned" +msgstr "" #. Tag: para +#: basic_mapping.xml:1108 #, no-c-format msgid "" "lets the application assign an identifier to the object before save" @@ -1029,12 +2452,14 @@ msgstr "" "méthode save() soit appelée. Il s'agit de la stratégie " "par défaut si aucun <generator> n'est spécifié. " -#. Tag: term +#. Tag: literal +#: basic_mapping.xml:1117 #, no-c-format -msgid "select" -msgstr "select" +msgid "select" +msgstr "" #. Tag: para +#: basic_mapping.xml:1120 #, no-c-format msgid "" "retrieves a primary key, assigned by a database trigger, by selecting the " @@ -1044,12 +2469,14 @@ msgstr "" "données en sélectionnant la ligne par une clé unique quelconque et en " "extrayant la valeur de la clé primaire." -#. Tag: term +#. Tag: literal +#: basic_mapping.xml:1127 #, no-c-format -msgid "foreign" -msgstr "foreign" +msgid "foreign" +msgstr "" #. Tag: para +#: basic_mapping.xml:1130 #, no-c-format msgid "" "uses the identifier of another associated object. It is usually used in " @@ -1060,12 +2487,14 @@ msgstr "" "conjonction avec une association <one-to-one> sur " "la clé primaire. " -#. Tag: term -#, no-c-format -msgid "sequence-identity" +#. Tag: literal +#: basic_mapping.xml:1138 +#, fuzzy, no-c-format +msgid "sequence-identity" msgstr "sequence-identity" #. Tag: para +#: basic_mapping.xml:1141 #, no-c-format msgid "" "a specialized sequence generation strategy that utilizes a database sequence " @@ -1084,11 +2513,13 @@ msgstr "" "à cause d'un bogue dans les pilotes d'Oracle. " #. Tag: title +#: basic_mapping.xml:1155 #, no-c-format msgid "Hi/lo algorithm" msgstr "Algorithme Hi/lo" #. Tag: para +#: basic_mapping.xml:1157 #, no-c-format msgid "" "The hilo and seqhilo generators " @@ -1103,7 +2534,33 @@ msgstr "" "héberger la prochaine valeur \"hi\" disponible. La seconde utilise une " "séquence de type Oracle (quand la base sous-jacente le propose). " +#. Tag: programlisting +#: basic_mapping.xml:1163 +#, no-c-format +msgid "" +"<id name=\"id\" type=\"long\" column=\"cat_id\">\n" +" <generator class=\"hilo\">\n" +" <param name=\"table\">hi_value</param>\n" +" <param name=\"column\">next_value</param>\n" +" <param name=\"max_lo\">100</param>\n" +" </generator>\n" +"</id>" +msgstr "" + +#. Tag: programlisting +#: basic_mapping.xml:1165 +#, no-c-format +msgid "" +"<id name=\"id\" type=\"long\" column=\"cat_id\">\n" +" <generator class=\"seqhilo\">\n" +" <param name=\"sequence\">hi_value</param>\n" +" <param name=\"max_lo\">100</param>\n" +" </generator>\n" +"</id>" +msgstr "" + #. Tag: para +#: basic_mapping.xml:1167 #, no-c-format msgid "" "Unfortunately, you cannot use hilo when supplying your " @@ -1119,11 +2576,13 @@ msgstr "" "hibernate.transaction.manager_lookup_class. " #. Tag: title +#: basic_mapping.xml:1175 #, no-c-format msgid "UUID algorithm" msgstr "Algorithme UUID " #. Tag: para +#: basic_mapping.xml:1177 #, no-c-format msgid "" "The UUID contains: IP address, startup time of the JVM that is accurate to a " @@ -1138,11 +2597,13 @@ msgstr "" "sans utiliser JNI. " #. Tag: title +#: basic_mapping.xml:1185 #, no-c-format msgid "Identity columns and sequences" msgstr "Colonnes identifiantes et séquences" #. Tag: para +#: basic_mapping.xml:1187 #, no-c-format msgid "" "For databases that support identity columns (DB2, MySQL, Sybase, MS SQL), " @@ -1158,7 +2619,30 @@ msgstr "" "génération de clé par sequence. Ces deux méthodes " "nécessitent deux requêtes SQL pour insérer un nouvel objet. Par exemple :" +#. Tag: programlisting +#: basic_mapping.xml:1195 +#, no-c-format +msgid "" +"<id name=\"id\" type=\"long\" column=\"person_id\">\n" +" <generator class=\"sequence\">\n" +" <param name=\"sequence\">person_id_sequence</" +"param>\n" +" </generator>\n" +"</id>" +msgstr "" + +#. Tag: programlisting +#: basic_mapping.xml:1197 +#, no-c-format +msgid "" +"<id name=\"id\" type=\"long\" column=\"person_id\" unsaved-value=\"0" +"\">\n" +" <generator class=\"identity\"/>\n" +"</id>" +msgstr "" + #. Tag: para +#: basic_mapping.xml:1199 #, no-c-format msgid "" "For cross-platform development, the native strategy will, " @@ -1172,20 +2656,22 @@ msgstr "" "possibilités offertes par la base sous-jacente. " #. Tag: title +#: basic_mapping.xml:1207 #, no-c-format msgid "Assigned identifiers" msgstr "Identifiants assignés" #. Tag: para -#, no-c-format +#: basic_mapping.xml:1209 +#, fuzzy, no-c-format msgid "" "If you want the application to assign identifiers, as opposed to having " "Hibernate generate them, you can use the assigned " "generator. This special generator uses the identifier value already assigned " "to the object's identifier property. The generator is used when the primary " "key is a natural key instead of a surrogate key. This is the default " -"behavior if you do not specify a <generator> " -"element." +"behavior if you do not specify @GeneratedValue nor " +"<generator> elements." msgstr "" "Si vous souhaitez que l'application assigne des identifiants (par opposition " "à la génération par Hibernate), vous pouvez utiliser le générateur " @@ -1196,6 +2682,7 @@ msgstr "" "pas d'élément <generator>." #. Tag: para +#: basic_mapping.xml:1218 #, no-c-format msgid "" "The assigned generator makes Hibernate use " @@ -1211,11 +2698,13 @@ msgstr "" "de définir Interceptor.isUnsaved(). " #. Tag: title +#: basic_mapping.xml:1226 #, no-c-format msgid "Primary keys assigned by triggers" msgstr "Clés primaires assignées par les triggers" #. Tag: para +#: basic_mapping.xml:1228 #, no-c-format msgid "" "Hibernate does not generate DDL with triggers. It is for legacy schemas only." @@ -1223,7 +2712,20 @@ msgstr "" "Pour les schémas de base hérités d'anciens systèmes uniquement (Hibernate ne " "génère pas de DDL avec des triggers) " +#. Tag: programlisting +#: basic_mapping.xml:1231 +#, no-c-format +msgid "" +"<id name=\"id\" type=\"long\" column=\"person_id\">\n" +" <generator class=\"select\">\n" +" <param name=\"key\">socialSecurityNumber</" +"param>\n" +" </generator>\n" +"</id>" +msgstr "" + #. Tag: para +#: basic_mapping.xml:1233 #, no-c-format msgid "" "In the above example, there is a unique valued property named " @@ -1237,11 +2739,91 @@ msgstr "" "person_id dont la valeur est générée par un trigger." #. Tag: title +#: basic_mapping.xml:1241 +#, no-c-format +msgid "Identity copy (foreign generator)" +msgstr "" + +#. Tag: para +#: basic_mapping.xml:1243 +#, no-c-format +msgid "" +"Finally, you can ask Hibernate to copy the identifier from another " +"associated entity. In the Hibernate jargon, it is known as a foreign " +"generator but the JPA mapping reads better and is encouraged." +msgstr "" + +#. Tag: programlisting +#: basic_mapping.xml:1248 +#, no-c-format +msgid "" +"@Entity\n" +"class MedicalHistory implements Serializable {\n" +" @Id @OneToOne\n" +" @JoinColumn(name = \"person_id\")\n" +" Person patient;\n" +"}\n" +"\n" +"@Entity\n" +"public class Person implements Serializable {\n" +" @Id @GeneratedValue Integer id;\n" +"}" +msgstr "" + +#. Tag: para +#: basic_mapping.xml:1250 +#, fuzzy, no-c-format +msgid "Or alternatively" +msgstr "Métadonnées alternatives" + +#. Tag: programlisting +#: basic_mapping.xml:1252 +#, no-c-format +msgid "" +"@Entity\n" +"class MedicalHistory implements Serializable {\n" +" @Id Integer id;\n" +"\n" +" @MapsId @OneToOne\n" +" @JoinColumn(name = \"patient_id\")\n" +" Person patient;\n" +"}\n" +"\n" +"@Entity\n" +"class Person {\n" +" @Id @GeneratedValue Integer id;\n" +"}" +msgstr "" + +#. Tag: para +#: basic_mapping.xml:1254 +#, no-c-format +msgid "In hbm.xml use the following approach:" +msgstr "" + +#. Tag: programlisting +#: basic_mapping.xml:1256 +#, no-c-format +msgid "" +"<class name=\"MedicalHistory\">\n" +" <id name=\"id\">\n" +" <generator class=\"foreign\">\n" +" <param name=\"property\">patient</param>\n" +" </generator>\n" +" </id>\n" +" <one-to-one name=\"patient\" class=\"Person\" constrained=\"true\"/" +">\n" +"</class>" +msgstr "" + +#. Tag: title +#: basic_mapping.xml:1261 #, no-c-format msgid "Enhanced identifier generators" msgstr "La méthode getter de l'identifiant " #. Tag: para +#: basic_mapping.xml:1263 #, no-c-format msgid "" "Starting with release 3.2.3, there are 2 new generators which represent a re-" @@ -1262,6 +2844,7 @@ msgstr "" "actuelles, et peuvent être référencés par FQN." #. Tag: para +#: basic_mapping.xml:1272 #, no-c-format msgid "" "The first of these new generators is org.hibernate.id.enhanced." @@ -1299,6 +2882,7 @@ msgstr "" "générateur a un certain nombre de paramètres de configuration :" #. Tag: para +#: basic_mapping.xml:1291 #, no-c-format msgid "" "sequence_name (optional, defaults to " @@ -1310,6 +2894,7 @@ msgstr "" "utiliser." #. Tag: para +#: basic_mapping.xml:1297 #, no-c-format msgid "" "initial_value (optional, defaults to 1increment_size (optional - defaults to 1force_table_use (optional - defaults to falsevalue_column (optional - defaults to next_valoptimizer (optional - defaults to none): See " +"literal>): See" msgstr "" -"optimizer (en option - valeur par défaut = none): Voir " +"cascade (optionnel - par défaut à none) : le style de cascade. " #. Tag: para +#: basic_mapping.xml:1332 #, no-c-format msgid "" "The second of these new generators is org.hibernate.id.enhanced." @@ -1395,6 +2983,7 @@ msgstr "" "configuration :" #. Tag: para +#: basic_mapping.xml:1345 #, no-c-format msgid "" "table_name (optional - defaults to " @@ -1404,6 +2993,7 @@ msgstr "" "hibernate_sequences): le nom de la table à utiliser." #. Tag: para +#: basic_mapping.xml:1351 #, no-c-format msgid "" "value_column_name (optional - defaults to " @@ -1415,6 +3005,7 @@ msgstr "" "utilisée pour la valeur." #. Tag: para +#: basic_mapping.xml:1357 #, no-c-format msgid "" "segment_column_name (optional - defaults to " @@ -1428,6 +3019,7 @@ msgstr "" "identifie la valeur d'incrément à utiliser." #. Tag: para +#: basic_mapping.xml:1365 #, no-c-format msgid "" "segment_value (optional - defaults to defaultsegment_value_length (optional - defaults to " @@ -1451,6 +3044,7 @@ msgstr "" "de la colonne pour créer cette colonne de clé de segment." #. Tag: para +#: basic_mapping.xml:1378 #, no-c-format msgid "" "initial_value (optional - defaults to 1 : La valeur initiale à récupérer à partir de la table." #. Tag: para +#: basic_mapping.xml:1384 #, no-c-format msgid "" "increment_size (optional - defaults to 1optimizer (optional - defaults to ): " -"See " +"optimizer (optional - defaults to ??): " +"See ." msgstr "" "optimizer (en option - valeur par défaut = ): Voir " #. Tag: title +#: basic_mapping.xml:1397 #, no-c-format msgid "Identifier generator optimization" msgstr "Optimisation du générateur d'identifiants" #. Tag: para -#, no-c-format +#: basic_mapping.xml:1399 +#, fuzzy, no-c-format msgid "" "For identifier generators that store values in the database, it is " "inefficient for them to hit the database on each and every call to generate " "a new identifier value. Instead, you can group a bunch of them in memory and " "only hit the database when you have exhausted your in-memory value group. " "This is the role of the pluggable optimizers. Currently only the two " -"enhanced generators ( " +"enhanced generators ( " "support this operation." msgstr "" "Pour les générateurs d'identifiants qui stockent des valeurs dans la base de " @@ -1505,6 +3103,7 @@ msgstr "" "prennent en charge cette opération." #. Tag: para +#: basic_mapping.xml:1410 #, no-c-format msgid "" "none (generally this is the default if no optimizer was " @@ -1516,6 +3115,7 @@ msgstr "" "n'interrogera pas la base de données à chaque demande." #. Tag: para +#: basic_mapping.xml:1417 #, no-c-format msgid "" "hilo: applies a hi/lo algorithm around the database " @@ -1533,6 +3133,7 @@ msgstr "" "valeur en mémoire pour définir un groupe de \"hi value\"." #. Tag: para +#: basic_mapping.xml:1427 #, no-c-format msgid "" "pooled: as with the case of hilo, this " @@ -1551,391 +3152,91 @@ msgstr "" "référence aux valeurs provenant de la base de données." #. Tag: title -#, no-c-format -msgid "composite-id" -msgstr "composite-id" - -#. Tag: para -#, no-c-format -msgid "" -"A table with a composite key can be mapped with multiple properties of the " -"class as identifier properties. The <composite-id> " -"element accepts <key-property> property mappings " -"and <key-many-to-one> mappings as child elements." -msgstr "" -"Pour une table avec clé composée, vous pouvez mapper plusieurs attributs de " -"la classe comme propriétés identifiantes. L'élément <composite-" -"id> accepte les mappages de propriétés <key-" -"property> et les mappages <key-many-to-one> comme éléments enfants. " - -#. Tag: para -#, no-c-format -msgid "" -"The persistent class must override equals() and hashCode() to implement composite identifier " -"equality. It must also implement Serializable." -msgstr "" -"Vos classes persistantes doivent surcharger les " -"méthodes equals() et hashCode() pour " -"implémenter l'égalité d'identifiant composite. Elles doivent aussi " -"implémenter l'interface Serializable." - -#. Tag: para -#, no-c-format -msgid "" -"Unfortunately, this approach means that a persistent object is its own " -"identifier. There is no convenient \"handle\" other than the object itself. " -"You must instantiate an instance of the persistent class itself and populate " -"its identifier properties before you can load() the " -"persistent state associated with a composite key. We call this approach an " -"embedded composite identifier, and discourage it for " -"serious applications." -msgstr "" -"Malheureusement, cette approche signifie qu'un objet persistant est son " -"propre identifiant. Il n'y a pas d'autre moyen pratique de \"manipuler\" " -"l'objet que par l'objet lui-même. Vous devez instancier une instance de la " -"classe persistante elle-même et peupler ses attributs identifiants avant de " -"pouvoir appeler la méthode load() pour charger son état " -"persistant associé à une clé composée. Nous appelons cette approche " -"\"identifiant composé embarqué\" et ne la recommandons " -"pas pour des applications complexes." - -#. Tag: para -#, no-c-format -msgid "" -"A second approach is what we call a mapped composite " -"identifier, where the identifier properties named inside the <" -"composite-id> element are duplicated on both the persistent " -"class and a separate identifier class." -msgstr "" -"Une seconde approche, appelée identifiant composé mappé, consiste à dupliquer les propriétés identifiantes nommées dans " -"l'élément <composite-id>) à la fois dans la classe " -"persistante et dans une classe identifiante particulière." - -#. Tag: para -#, no-c-format -msgid "" -"In this example, both the composite identifier class, MedicareId, and the entity class itself have properties named " -"medicareNumber and dependent. The " -"identifier class must override equals() and " -"hashCode() and implement Serializable. " -"The main disadvantage of this approach is code duplication." -msgstr "" -"Dans cet exemple, la classe d'identifiant composée,MedicareId et la classe mappée elle-même, possèdent les propriétés " -"medicareNumber et dependent. La classe " -"identifiante doit redéfinir equals() et hashCode" -"() et implémenter Serializable. Le désavantage " -"de cette approche est la duplication du code. " - -#. Tag: para -#, no-c-format -msgid "" -"The following attributes are used to specify a mapped composite identifier:" -msgstr "" -"Les attributs suivants servent à configurer un identifiant composé mappé :" - -#. Tag: para -#, no-c-format -msgid "" -"mapped (optional - defaults to false): " -"indicates that a mapped composite identifier is used, and that the contained " -"property mappings refer to both the entity class and the composite " -"identifier class." -msgstr "" -"mapped (optionnel, défaut à false) : " -"indique qu'un identifiant composé mappé est utilisé, et que les mappages de " -"propriétés contenues font référence aux deux classes, la classe mappée et la " -"classe identifiante composée. " - -#. Tag: para -#, no-c-format -msgid "" -"class (optional - but required for a mapped composite " -"identifier): the class used as a composite identifier." -msgstr "" -"class (optionnel, mais requis pour un identifiant composé " -"mappé) : la classe utilisée comme identifiant composé. " - -#. Tag: para -#, no-c-format -msgid "" -"We will describe a third, even more convenient approach, where the composite " -"identifier is implemented as a component class in . The attributes described below apply only to this " -"alternative approach:" -msgstr "" -"Nous décrirons une troisième approche beaucoup plus efficace pour laquelle " -"l'identifiant composé est implémenté comme une classe composant dans . Les attributs décrits ci dessous, ne " -"s'appliquent que pour cette dernière approche :" - -#. Tag: para -#, no-c-format -msgid "" -"name (optional - required for this approach): a property " -"of component type that holds the composite identifier. Please see chapter 9 " -"for more information." -msgstr "" -"name (optionnel, requis pour cette approche) : une " -"propriété de type composant qui contient l'identifiant composé (voir " -"chapitre 9). " - -#. Tag: para -#, no-c-format -msgid "" -"access (optional - defaults to property): the strategy Hibernate uses for accessing the property value." -msgstr "" -"access (optionnel - par défaut property) : la stratégie que doit utiliser Hibernate pour accéder aux " -"valeurs des propriétés. " - -#. Tag: para -#, no-c-format -msgid "" -"class (optional - defaults to the property type " -"determined by reflection): the component class used as a composite " -"identifier. Please see the next section for more information." -msgstr "" -"class (optionnel - par défaut le type de la propriété " -"déterminé par réflexion) : la classe composant utilisée comme identifiant " -"(voir prochaine section). " - -#. Tag: para -#, no-c-format -msgid "" -"The third approach, an identifier component, is " -"recommended for almost all applications." -msgstr "" -"La troisième approche, un composant d'identifiant, est " -"celle que nous recommandons pour toutes vos applications." - -#. Tag: title -#, no-c-format -msgid "Discriminator" -msgstr "Discriminator" - -#. Tag: para -#, no-c-format -msgid "" -"The <discriminator> element is required for " -"polymorphic persistence using the table-per-class-hierarchy mapping " -"strategy. It declares a discriminator column of the table. The discriminator " -"column contains marker values that tell the persistence layer what subclass " -"to instantiate for a particular row. A restricted set of types can be used: " -"string, character, integer, byte, short, " -"boolean, yes_no, true_false." -msgstr "" -"L'élément <discriminator> est nécessaire pour la " -"persistance polymorphique qui utilise la stratégie de mappage de table par " -"hiérarchie de classe et déclare une colonne discriminante de la table. La " -"colonne discriminante contient des valeurs marqueur qui permettent à la " -"couche de persistance de savoir quelle sous-classe instancier pour une ligne " -"particulière de table en base. Un nombre restreint de types peuvent être " -"utilisés : string, character, " -"integer, byte, short, boolean, yes_no, " -"true_false." - -#. Tag: para -#, no-c-format -msgid "" -"column (optional - defaults to class): " -"the name of the discriminator column." -msgstr "" -"column (optionnel - par défaut à class), le nom de la colonne discriminante. " - -#. Tag: para -#, no-c-format -msgid "" -"type (optional - defaults to string): " -"a name that indicates the Hibernate type" -msgstr "" -"type (optionnel - par défaut à string) " -"un nom indiquant le type Hibernate. " - -#. Tag: para -#, no-c-format -msgid "" -"force (optional - defaults to false): " -"\"forces\" Hibernate to specify the allowed discriminator values, even when " -"retrieving all instances of the root class." -msgstr "" -"force (optionnel - par défaut à false) " -"\"oblige\" Hibernate à spécifier une valeur discriminante autorisée même " -"quand on récupère toutes les instances de la classe de base. " - -#. Tag: para -#, no-c-format -msgid "" -"insert (optional - defaults to true): " -"set this to false if your discriminator column is also " -"part of a mapped composite identifier. It tells Hibernate not to include the " -"column in SQL INSERTs." -msgstr "" -"insert (optionnel - par défaut à true) " -"à passer à false si la colonne discriminante fait aussi " -"partie d'un identifiant composé mappé (Indique à Hibernate de ne pas inclure " -"la colonne dans les SQL INSERT s). " - -#. Tag: para -#, no-c-format -msgid "" -"formula (optional): an arbitrary SQL expression that is " -"executed when a type has to be evaluated. It allows content-based " -"discrimination." -msgstr "" -"formula (optionnel) une expression SQL arbitraire qui est " -"exécutée quand un type doit être évalué. Permet la discrimination basée sur " -"le contenu. " - -#. Tag: para -#, no-c-format -msgid "" -"Actual values of the discriminator column are specified by the " -"discriminator-value attribute of the <" -"class> and <subclass> elements." -msgstr "" -"Les véritables valeurs de la colonne discriminante sont spécifiées par " -"l'attribut discriminator-value des éléments <" -"class> et <subclass>. " - -#. Tag: para -#, no-c-format -msgid "" -"The force attribute is only useful if the table contains " -"rows with \"extra\" discriminator values that are not mapped to a persistent " -"class. This will not usually be the case." -msgstr "" -"L'attribut force n'est utile que si la table contient des " -"lignes avec des valeurs \"extra\" discriminantes qui ne sont pas mappées à " -"une classe persistante. Ce ne sera généralement pas le cas. " - -#. Tag: para -#, no-c-format -msgid "" -"The formula attribute allows you to declare an arbitrary " -"SQL expression that will be used to evaluate the type of a row. For example:" -msgstr "" -"En utilisant l'attribut formula vous pouvez déclarer une " -"expression SQL arbitraire qui sera utilisée pour évaluer le type d'une " -"ligne : " - -#. Tag: title -#, no-c-format -msgid "Version (optional)" -msgstr "Version (optionnel)" - -#. Tag: para -#, no-c-format -msgid "" -"The <version> element is optional and indicates " -"that the table contains versioned data. This is particularly useful if you " -"plan to use long transactions. See below for more " -"information:" -msgstr "" -"L'élément <version> est optionnel et indique que la " -"table contient des données versionnées. C'est particulièrement utile si vous " -"avez l'intention d'utiliser des transactions longues " -"(voir plus-bas)." - -#. Tag: para -#, no-c-format -msgid "" -"column (optional - defaults to the property name): the " -"name of the column holding the version number." -msgstr "" -"column (optionnel - par défaut égal au nom de la " -"propriété) : le nom de la colonne contenant le numéro de version. " - -#. Tag: para -#, no-c-format -msgid "" -"name: the name of a property of the persistent class." -msgstr "" -"name : le nom d'un attribut de la classe persistante. " - -#. Tag: para -#, no-c-format -msgid "" -"type (optional - defaults to integer): " -"the type of the version number." -msgstr "" -"type (optionnel - par défaut à integer) : le type du numéro de version. " - -#. Tag: para -#, no-c-format -msgid "" -"access (optional - defaults to property): the strategy Hibernate uses to access the property value." -msgstr "" -"access (optionnel - par défaut property) : la stratégie que doit utiliser Hibernate pour accéder aux " -"valeurs des propriétés. " - -#. Tag: para -#, no-c-format -msgid "" -"unsaved-value (optional - defaults to undefined): a version property value that indicates that an instance is newly " -"instantiated (unsaved), distinguishing it from detached instances that were " -"saved or loaded in a previous session. Undefined " -"specifies that the identifier property value should be used." -msgstr "" -"unsaved-value (optionnel - par défaut à " -"undefined) : une valeur de la propriété d'identifiant qui " -"indique que l'instance est nouvellement instanciée (non sauvegardée), et qui " -"la distingue des instances détachées qui ont été sauvegardées ou chargées " -"dans une session précédente. Undefined indique que la " -"valeur de la propritété identifiant devrait être utilisée." - -#. Tag: para +#: basic_mapping.xml:1441 #, fuzzy, no-c-format -msgid "" -"generated (optional - defaults to never): specifies that this version property value is generated by the " -"database. See the discussion of generated properties for more information." -msgstr "" -"generated (optionnel - défaut à never) : spécifie que cette valeur de la propriété version est en réalité " -"générée par la base de données. Consultez la discussion pour obtenir des informations supplémentaires." +msgid "Partial identifier generation" +msgstr "La méthode getter de l'identifiant " #. Tag: para +#: basic_mapping.xml:1443 #, no-c-format msgid "" -"insert (optional - defaults to true): " -"specifies whether the version column should be included in SQL insert " -"statements. It can be set to false if the database column " -"is defined with a default value of 0." +"Hibernate supports the automatic generation of some of the identifier " +"properties. Simply use the @GeneratedValue annotation " +"on one or several id properties." msgstr "" -"insert (optionnel - par défaut à true) : indique si la colonne de version doit être incluse dans les " -"ordres SQL insert. Peut être configuré à false si et " -"seulement si la colonne de la base de données est définie avec une valeur " -"par défaut égale à 0. " #. Tag: para +#: basic_mapping.xml:1449 #, no-c-format msgid "" -"Version numbers can be of Hibernate type long, " -"integer, short, timestamp or calendar." +"The Hibernate team has always felt such a construct as fundamentally wrong. " +"Try hard to fix your data model before using this feature." +msgstr "" + +#. Tag: programlisting +#: basic_mapping.xml:1454 +#, no-c-format +msgid "" +"@Entity\n" +"public class CustomerInventory implements Serializable {\n" +" @Id\n" +" @TableGenerator(name = \"inventory\",\n" +" table = \"U_SEQUENCES\",\n" +" pkColumnName = \"S_ID\",\n" +" valueColumnName = \"S_NEXTNUM\",\n" +" pkColumnValue = \"inventory\",\n" +" allocationSize = 1000)\n" +" @GeneratedValue(strategy = GenerationType.TABLE, generator = \"inventory" +"\")\n" +" Integer id;\n" +"\n" +"\n" +" @Id @ManyToOne(cascade = CascadeType.MERGE)\n" +" Customer customer;\n" +"}\n" +"\n" +"@Entity\n" +"public class Customer implements Serializable {\n" +" @Id\n" +" private int id;\n" +"}" msgstr "" -"Les numéros de version doivent avoir les types Hibernate long, integer, short, " -"timestamp ou calendar. " #. Tag: para +#: basic_mapping.xml:1456 +#, no-c-format +msgid "" +"You can also generate properties inside an @EmbeddedId class." +msgstr "" + +#. Tag: title +#: basic_mapping.xml:1462 +#, no-c-format +msgid "Optimistic locking properties (optional)" +msgstr "" + +#. Tag: para +#: basic_mapping.xml:1464 +#, no-c-format +msgid "" +"When using long transactions or conversations that span several database " +"transactions, it is useful to store versioning data to ensure that if the " +"same entity is updated by two conversations, the last to commit changes will " +"be informed and not override the other conversation's work. It guarantees " +"some isolation while still allowing for good scalability and works " +"particularly well in read-often write-sometimes situations." +msgstr "" + +#. Tag: para +#: basic_mapping.xml:1472 +#, no-c-format +msgid "You can use two approaches: a dedicated version number or a timestamp." +msgstr "" + +#. Tag: para +#: basic_mapping.xml:1475 #, no-c-format msgid "" "A version or timestamp property should never be null for a detached " @@ -1956,17 +3257,191 @@ msgstr "" "des clés composées ." #. Tag: title +#: basic_mapping.xml:1485 #, no-c-format -msgid "Timestamp (optional)" +msgid "Version number" +msgstr "" + +#. Tag: para +#: basic_mapping.xml:1487 +#, no-c-format +msgid "" +"You can add optimistic locking capability to an entity using the " +"@Version annotation:" +msgstr "" + +#. Tag: programlisting +#: basic_mapping.xml:1490 +#, no-c-format +msgid "" +"@Entity\n" +"public class Flight implements Serializable {\n" +"...\n" +" @Version\n" +" @Column(name=\"OPTLOCK\")\n" +" public Integer getVersion() { ... }\n" +"}" +msgstr "" + +#. Tag: para +#: basic_mapping.xml:1492 +#, no-c-format +msgid "" +"The version property will be mapped to the OPTLOCK " +"column, and the entity manager will use it to detect conflicting updates " +"(preventing lost updates you might otherwise see with the last-commit-wins " +"strategy)." +msgstr "" + +#. Tag: para +#: basic_mapping.xml:1497 +#, no-c-format +msgid "" +"The version column may be a numeric. Hibernate supports any kind of type " +"provided that you define and implement the appropriate " +"UserVersionType." +msgstr "" + +#. Tag: para +#: basic_mapping.xml:1501 +#, no-c-format +msgid "" +"The application must not alter the version number set up by Hibernate in any " +"way. To artificially increase the version number, check in Hibernate Entity " +"Manager's reference documentation LockModeType." +"OPTIMISTIC_FORCE_INCREMENT or LockModeType." +"PESSIMISTIC_FORCE_INCREMENT." +msgstr "" + +#. Tag: para +#: basic_mapping.xml:1507 +#, no-c-format +msgid "" +"If the version number is generated by the database (via a trigger for " +"example), make sure to use @org.hibernate.annotations.Generated" +"(GenerationTime.ALWAYS)." +msgstr "" + +#. Tag: para +#: basic_mapping.xml:1511 +#, no-c-format +msgid "To declare a version property in hbm.xml, use:" +msgstr "" + +#. Tag: programlisting +#: basic_mapping.xml:1530 +#, no-c-format +msgid "" +"<version\n" +" column=\"version_column\"\n" +" name=\"propertyName\"\n" +" type=\"typename\"\n" +" access=\"field|property|ClassName\"\n" +" unsaved-value=\"null|negative|undefined\"\n" +" generated=\"never|always\"\n" +" insert=\"true|false\"\n" +" node=\"element-name|@attribute-name|element/@attribute|.\"\n" +"/>" +msgstr "" + +#. Tag: para +#: basic_mapping.xml:1534 +#, no-c-format +msgid "" +"column (optional - defaults to the property name): the " +"name of the column holding the version number." +msgstr "" +"column (optionnel - par défaut égal au nom de la " +"propriété) : le nom de la colonne contenant le numéro de version. " + +#. Tag: para +#: basic_mapping.xml:1540 +#, no-c-format +msgid "" +"name: the name of a property of the persistent class." +msgstr "" +"name : le nom d'un attribut de la classe persistante. " + +#. Tag: para +#: basic_mapping.xml:1545 +#, no-c-format +msgid "" +"type (optional - defaults to integer): " +"the type of the version number." +msgstr "" +"type (optionnel - par défaut à integer) : le type du numéro de version. " + +#. Tag: para +#: basic_mapping.xml:1551 +#, no-c-format +msgid "" +"access (optional - defaults to property): the strategy Hibernate uses to access the property value." +msgstr "" +"access (optionnel - par défaut property) : la stratégie que doit utiliser Hibernate pour accéder aux " +"valeurs des propriétés. " + +#. Tag: para +#: basic_mapping.xml:1557 +#, no-c-format +msgid "" +"unsaved-value (optional - defaults to undefined): a version property value that indicates that an instance is newly " +"instantiated (unsaved), distinguishing it from detached instances that were " +"saved or loaded in a previous session. Undefined " +"specifies that the identifier property value should be used." +msgstr "" +"unsaved-value (optionnel - par défaut à " +"undefined) : une valeur de la propriété d'identifiant qui " +"indique que l'instance est nouvellement instanciée (non sauvegardée), et qui " +"la distingue des instances détachées qui ont été sauvegardées ou chargées " +"dans une session précédente. Undefined indique que la " +"valeur de la propritété identifiant devrait être utilisée." + +#. Tag: para +#: basic_mapping.xml:1567 +#, fuzzy, no-c-format +msgid "" +"generated (optional - defaults to never): specifies that this version property value is generated by the " +"database. See the discussion of generated properties for more information." +msgstr "" +"generated (optionnel - défaut à never) : spécifie que cette valeur de la propriété version est en réalité " +"générée par la base de données. Consultez la discussion pour obtenir des informations supplémentaires." + +#. Tag: para +#: basic_mapping.xml:1575 +#, no-c-format +msgid "" +"insert (optional - defaults to true): " +"specifies whether the version column should be included in SQL insert " +"statements. It can be set to false if the database column " +"is defined with a default value of 0." +msgstr "" +"insert (optionnel - par défaut à true) : indique si la colonne de version doit être incluse dans les " +"ordres SQL insert. Peut être configuré à false si et " +"seulement si la colonne de la base de données est définie avec une valeur " +"par défaut égale à 0. " + +#. Tag: title +#: basic_mapping.xml:1586 +#, fuzzy, no-c-format +msgid "Timestamp" msgstr "Timestamp (optionnel) " #. Tag: para -#, no-c-format +#: basic_mapping.xml:1588 +#, fuzzy, no-c-format msgid "" -"The optional <timestamp> element indicates that the " -"table contains timestamped data. This provides an alternative to versioning. " -"Timestamps are a less safe implementation of optimistic locking. However, " -"sometimes the application might use the timestamps in other ways." +"Alternatively, you can use a timestamp. Timestamps are a less safe " +"implementation of optimistic locking. However, sometimes the application " +"might use the timestamps in other ways." msgstr "" "L'élément optionnel <timestamp> indique que la " "table contient des données horodatées (timestamped). Cela sert d'alternative " @@ -1975,6 +3450,59 @@ msgstr "" "Cependant, l'application peut parfois utiliser l'horodatage à d'autres fins. " #. Tag: para +#: basic_mapping.xml:1592 +#, no-c-format +msgid "" +"Simply mark a property of type Date or " +"Calendar as @Version." +msgstr "" + +#. Tag: programlisting +#: basic_mapping.xml:1596 +#, no-c-format +msgid "" +"@Entity\n" +"public class Flight implements Serializable {\n" +"...\n" +" @Version\n" +" public Date getLastUpdate() { ... }\n" +"}" +msgstr "" + +#. Tag: para +#: basic_mapping.xml:1598 +#, no-c-format +msgid "" +"Like version numbers, the timestamp can be generated by the database instead " +"of Hibernate. To do that, use @org.hibernate.annotations.Generated" +"(GenerationTime.ALWAYS)." +msgstr "" + +#. Tag: para +#: basic_mapping.xml:1602 +#, fuzzy, no-c-format +msgid "In hbm.xml, use the <timestamp> element:" +msgstr "" +"Par exemple, si nous avons le mappage de <properties> suivant : " + +#. Tag: programlisting +#: basic_mapping.xml:1620 +#, no-c-format +msgid "" +"<timestamp\n" +" column=\"timestamp_column\"\n" +" name=\"propertyName\"\n" +" access=\"field|property|ClassName\"\n" +" unsaved-value=\"null|undefined\"\n" +" source=\"vm|db\"\n" +" generated=\"never|always\"\n" +" node=\"element-name|@attribute-name|element/@attribute|.\"\n" +"/>" +msgstr "" + +#. Tag: para +#: basic_mapping.xml:1624 #, no-c-format msgid "" "column (optional - defaults to the property name): the " @@ -1984,6 +3512,7 @@ msgstr "" "propriété) : le nom d'une colonne contenant le timestamp. " #. Tag: para +#: basic_mapping.xml:1630 #, no-c-format msgid "" "name: the name of a JavaBeans style property of Java type " @@ -1995,6 +3524,19 @@ msgstr "" "persistante. " #. Tag: para +#: basic_mapping.xml:1636 basic_mapping.xml:2163 basic_mapping.xml:2380 +#: basic_mapping.xml:3226 basic_mapping.xml:3420 basic_mapping.xml:3593 +#, no-c-format +msgid "" +"access (optional - defaults to property): the strategy Hibernate uses for accessing the property value." +msgstr "" +"access (optionnel - par défaut property) : la stratégie que doit utiliser Hibernate pour accéder aux " +"valeurs des propriétés. " + +#. Tag: para +#: basic_mapping.xml:1642 #, no-c-format msgid "" "unsaved-value (optional - defaults to nullsource (optional - defaults to vm): " @@ -2033,6 +3576,7 @@ msgstr "" "exemple)." #. Tag: para +#: basic_mapping.xml:1665 #, fuzzy, no-c-format msgid "" "generated (optional - defaults to never pour obtenir des informations supplémentaires. " #. Tag: title +#: basic_mapping.xml:1675 #, no-c-format msgid "Note" msgstr "Note" #. Tag: para +#: basic_mapping.xml:1677 #, no-c-format msgid "" "<Timestamp> is equivalent to <version " @@ -2064,11 +3610,798 @@ msgstr "" "" #. Tag: title +#: basic_mapping.xml:1686 #, no-c-format msgid "Property" msgstr "Property" #. Tag: para +#: basic_mapping.xml:1688 +#, no-c-format +msgid "" +"You need to decide which property needs to be made persistent in a given " +"entity. This differs slightly between the annotation driven metadata and the " +"hbm.xml files." +msgstr "" + +#. Tag: title +#: basic_mapping.xml:1693 +#, no-c-format +msgid "Property mapping with annotations" +msgstr "" + +#. Tag: para +#: basic_mapping.xml:1695 +#, no-c-format +msgid "" +"In the annotations world, every non static non transient property (field or " +"method depending on the access type) of an entity is considered persistent, " +"unless you annotate it as @Transient. Not having an " +"annotation for your property is equivalent to the appropriate " +"@Basic annotation." +msgstr "" + +#. Tag: para +#: basic_mapping.xml:1702 +#, no-c-format +msgid "" +"The @Basic annotation allows you to declare the fetching " +"strategy for a property. If set to LAZY, specifies that " +"this property should be fetched lazily when the instance variable is first " +"accessed. It requires build-time bytecode instrumentation, if your classes " +"are not instrumented, property level lazy loading is silently ignored. The " +"default is EAGER. You can also mark a property as not " +"optional thanks to the @Basic.optional attribute. " +"This will ensure that the underlying column are not nullable (if possible). " +"Note that a better approach is to use the @NotNull " +"annotation of the Bean Validation specification." +msgstr "" + +#. Tag: para +#: basic_mapping.xml:1715 +#, no-c-format +msgid "Let's look at a few examples:" +msgstr "" + +#. Tag: programlisting +#: basic_mapping.xml:1717 +#, no-c-format +msgid "" +"public transient int counter; //transient property\n" +"\n" +"private String firstname; //persistent property\n" +"\n" +"@Transient\n" +"String getLengthInMeter() { ... } //transient property\n" +"\n" +"String getName() {... } // persistent property\n" +"\n" +"@Basic\n" +"int getLength() { ... } // persistent property\n" +"\n" +"@Basic(fetch = FetchType.LAZY)\n" +"String getDetailedComment() { ... } // persistent property\n" +"\n" +"@Temporal(TemporalType.TIME)\n" +"java.util.Date getDepartureTime() { ... } // persistent property \n" +"\n" +"@Enumerated(EnumType.STRING)\n" +"Starred getNote() { ... } //enum persisted as String in database" +msgstr "" + +#. Tag: para +#: basic_mapping.xml:1719 +#, no-c-format +msgid "" +"counter, a transient field, and lengthInMeter, a method annotated as @Transient, and will be " +"ignored by the Hibernate. name, length, and firstname properties are mapped persistent " +"and eagerly fetched (the default for simple properties). The " +"detailedComment property value will be lazily fetched " +"from the database once a lazy property of the entity is accessed for the " +"first time. Usually you don't need to lazy simple properties (not to be " +"confused with lazy association fetching). The recommended alternative is to " +"use the projection capability of JP-QL (Java Persistence Query Language) or " +"Criteria queries." +msgstr "" + +#. Tag: para +#: basic_mapping.xml:1732 +#, no-c-format +msgid "" +"JPA support property mapping of all basic types supported by Hibernate (all " +"basic Java types , their respective wrappers and serializable classes). " +"Hibernate Annotations supports out of the box enum type mapping either into " +"a ordinal column (saving the enum ordinal) or a string based column (saving " +"the enum string representation): the persistence representation, defaulted " +"to ordinal, can be overridden through the @Enumerated " +"annotation as shown in the note property example." +msgstr "" + +#. Tag: para +#: basic_mapping.xml:1742 +#, no-c-format +msgid "" +"In plain Java APIs, the temporal precision of time is not defined. When " +"dealing with temporal data you might want to describe the expected precision " +"in database. Temporal data can have DATE, TIME, or TIMESTAMP precision (ie the actual date, " +"only the time, or both). Use the @Temporal annotation to " +"fine tune that." +msgstr "" + +#. Tag: para +#: basic_mapping.xml:1750 +#, no-c-format +msgid "" +"@Lob indicates that the property should be persisted in a " +"Blob or a Clob depending on the property type: java.sql.Clob, Character[], char[] and java.lang.String will be persisted in " +"a Clob. java.sql.Blob, Byte[], " +"byte[] and Serializable type " +"will be persisted in a Blob." +msgstr "" + +#. Tag: programlisting +#: basic_mapping.xml:1759 +#, no-c-format +msgid "" +"@Lob\n" +"public String getFullText() {\n" +" return fullText;\n" +"}\n" +"\n" +"@Lob\n" +"public byte[] getFullCode() {\n" +" return fullCode;\n" +"}" +msgstr "" + +#. Tag: para +#: basic_mapping.xml:1761 +#, no-c-format +msgid "" +"If the property type implements java.io.Serializable " +"and is not a basic type, and if the property is not annotated with " +"@Lob, then the Hibernate serializable " +"type is used." +msgstr "" + +#. Tag: title +#: basic_mapping.xml:1768 +#, no-c-format +msgid "Type" +msgstr "" + +#. Tag: para +#: basic_mapping.xml:1770 +#, no-c-format +msgid "" +"You can also manually specify a type using the @org.hibernate." +"annotations.Type and some parameters if needed. @Type." +"type could be:" +msgstr "" + +#. Tag: para +#: basic_mapping.xml:1777 basic_mapping.xml:2209 +#, no-c-format +msgid "" +"The name of a Hibernate basic type: integer, string, character, " +"date, timestamp, float, binary, serializable, object, blob etc." +msgstr "" +"Le nom d'un type basique Hibernate (par ex : integer, string, " +"character, date, timestamp, float, binary, serializable, object, blob etc.). " + +#. Tag: para +#: basic_mapping.xml:1783 basic_mapping.xml:2215 +#, no-c-format +msgid "" +"The name of a Java class with a default basic type: int, float, " +"char, java.lang.String, java.util.Date, java.lang.Integer, java.sql.Clob etc." +msgstr "" +"le nom d'une classe Java avec un type basique par défaut (par ex : " +"int, float, char, java.lang.String, java.util.Date, java.lang." +"Integer, java.sql.Clob etc.). " + +#. Tag: para +#: basic_mapping.xml:1789 basic_mapping.xml:2221 +#, no-c-format +msgid "The name of a serializable Java class." +msgstr "Le nom d'une classe Java sérialisable." + +#. Tag: para +#: basic_mapping.xml:1793 basic_mapping.xml:2225 +#, no-c-format +msgid "" +"The class name of a custom type: com.illflow.type.MyCustomType etc." +msgstr "" +"Le nom d'une classe avec un type personnalisé (par ex : com.illflow." +"type.MyCustomType)." + +#. Tag: para +#: basic_mapping.xml:1798 +#, fuzzy, no-c-format +msgid "" +"If you do not specify a type, Hibernate will use reflection upon the named " +"property and guess the correct Hibernate type. Hibernate will attempt to " +"interpret the name of the return class of the property getter using, in " +"order, rules 2, 3, and 4." +msgstr "" +"Si vous n'indiquez pas un type, Hibernate utilisera la réflexion sur le nom " +"de la propriété pour tenter de trouver le type Hibernate correct. Hibernate " +"essayera d'interprêter le nom de la classe retournée par le getter de la " +"propriété en utilisant les règles 2, 3, 4 dans cet ordre. Dans certains cas " +"vous aurez encore besoin de l'attribut type. (Par " +"exemple, pour distinguer Hibernate.DATE et " +"Hibernate.TIMESTAMP, ou pour préciser un type " +"personnalisé)." + +#. Tag: para +#: basic_mapping.xml:1803 +#, no-c-format +msgid "" +"@org.hibernate.annotations.TypeDef and @org." +"hibernate.annotations.TypeDefs allows you to declare type " +"definitions. These annotations can be placed at the class or package level. " +"Note that these definitions are global for the session factory (even when " +"defined at the class level). If the type is used on a single entity, you can " +"place the definition on the entity itself. Otherwise, it is recommended to " +"place the definition at the package level. In the example below, when " +"Hibernate encounters a property of class PhoneNumer, it " +"delegates the persistence strategy to the custom mapping type " +"PhoneNumberType. However, properties belonging to other " +"classes, too, can delegate their persistence strategy to " +"PhoneNumberType, by explicitly using the @Type annotation." +msgstr "" + +#. Tag: para +#: basic_mapping.xml:1819 +#, no-c-format +msgid "" +"Package level annotations are placed in a file named package-info." +"java in the appropriate package. Place your annotations before " +"the package declaration." +msgstr "" + +#. Tag: programlisting +#: basic_mapping.xml:1824 +#, no-c-format +msgid "" +"@TypeDef(\n" +" name = \"phoneNumber\",\n" +" defaultForType = PhoneNumber.class,\n" +" typeClass = PhoneNumberType.class\n" +")\n" +"\n" +"@Entity\n" +"public class ContactDetails {\n" +" [...]\n" +" private PhoneNumber localPhoneNumber;\n" +" @Type(type=\"phoneNumber\")\n" +" private OverseasPhoneNumber overseasPhoneNumber;\n" +" [...]\n" +"}" +msgstr "" + +#. Tag: para +#: basic_mapping.xml:1826 +#, no-c-format +msgid "" +"The following example shows the usage of the parameters " +"attribute to customize the TypeDef." +msgstr "" + +#. Tag: programlisting +#: basic_mapping.xml:1830 +#, no-c-format +msgid "" +"//in org/hibernate/test/annotations/entity/package-info.java\n" +"@TypeDefs(\n" +" {\n" +" @TypeDef(\n" +" name=\"caster\",\n" +" typeClass = CasterStringType.class,\n" +" parameters = {\n" +" @Parameter(name=\"cast\", value=\"lower\")\n" +" }\n" +" )\n" +" }\n" +")\n" +"package org.hibernate.test.annotations.entity;\n" +"\n" +"//in org/hibernate/test/annotations/entity/Forest.java\n" +"public class Forest {\n" +" @Type(type=\"caster\")\n" +" public String getSmallText() {\n" +" ...\n" +"}" +msgstr "" + +#. Tag: para +#: basic_mapping.xml:1832 +#, no-c-format +msgid "" +"When using composite user type, you will have to express column definitions. " +"The @Columns has been introduced for that purpose." +msgstr "" + +#. Tag: programlisting +#: basic_mapping.xml:1836 +#, no-c-format +msgid "" +"@Type(type=\"org.hibernate.test.annotations.entity.MonetaryAmountUserType" +"\")\n" +"@Columns(columns = {\n" +" @Column(name=\"r_amount\"),\n" +" @Column(name=\"r_currency\")\n" +"})\n" +"public MonetaryAmount getAmount() {\n" +" return amount;\n" +"}\n" +"\n" +"\n" +"public class MonetaryAmount implements Serializable {\n" +" private BigDecimal amount;\n" +" private Currency currency;\n" +" ...\n" +"}" +msgstr "" + +#. Tag: title +#: basic_mapping.xml:1840 +#, no-c-format +msgid "Access type" +msgstr "" + +#. Tag: para +#: basic_mapping.xml:1842 +#, no-c-format +msgid "" +"By default the access type of a class hierarchy is defined by the position " +"of the @Id or @EmbeddedId " +"annotations. If these annotations are on a field, then only fields are " +"considered for persistence and the state is accessed via the field. If there " +"annotations are on a getter, then only the getters are considered for " +"persistence and the state is accessed via the getter/setter. That works well " +"in practice and is the recommended approach." +msgstr "" + +#. Tag: para +#: basic_mapping.xml:1850 +#, no-c-format +msgid "" +"The placement of annotations within a class hierarchy has to be consistent " +"(either field or on property) to be able to determine the default access " +"type. It is recommended to stick to one single annotation placement strategy " +"throughout your whole application." +msgstr "" + +#. Tag: para +#: basic_mapping.xml:1857 +#, no-c-format +msgid "However in some situations, you need to:" +msgstr "" + +#. Tag: para +#: basic_mapping.xml:1861 +#, no-c-format +msgid "force the access type of the entity hierarchy" +msgstr "" + +#. Tag: para +#: basic_mapping.xml:1865 +#, no-c-format +msgid "override the access type of a specific entity in the class hierarchy" +msgstr "" + +#. Tag: para +#: basic_mapping.xml:1870 +#, no-c-format +msgid "override the access type of an embeddable type" +msgstr "" + +#. Tag: para +#: basic_mapping.xml:1874 +#, no-c-format +msgid "" +"The best use case is an embeddable class used by several entities that might " +"not use the same access type. In this case it is better to force the access " +"type at the embeddable class level." +msgstr "" + +#. Tag: para +#: basic_mapping.xml:1879 +#, no-c-format +msgid "" +"To force the access type on a given class, use the @Access annotation as showed below:" +msgstr "" + +#. Tag: programlisting +#: basic_mapping.xml:1882 +#, no-c-format +msgid "" +"@Entity\n" +"public class Order {\n" +" @Id private Long id;\n" +" public Long getId() { return id; }\n" +" public void setId(Long id) { this.id = id; }\n" +"\n" +" @Embedded private Address address;\n" +" public Address getAddress() { return address; }\n" +" public void setAddress() { this.address = address; }\n" +"}\n" +"\n" +"@Entity\n" +"public class User {\n" +" private Long id;\n" +" @Id public Long getId() { return id; }\n" +" public void setId(Long id) { this.id = id; }\n" +"\n" +" private Address address;\n" +" @Embedded public Address getAddress() { return address; }\n" +" public void setAddress() { this.address = address; }\n" +"}\n" +"\n" +"@Embeddable\n" +"@Access(AcessType.PROPERTY)\n" +"public class Address {\n" +" private String street1;\n" +" public String getStreet1() { return street1; }\n" +" public void setStreet1() { this.street1 = street1; }\n" +"\n" +" private hashCode; //not persistent\n" +"}" +msgstr "" + +#. Tag: para +#: basic_mapping.xml:1884 +#, no-c-format +msgid "" +"You can also override the access type of a single property while keeping the " +"other properties standard." +msgstr "" + +#. Tag: programlisting +#: basic_mapping.xml:1887 +#, no-c-format +msgid "" +"@Entity\n" +"public class Order {\n" +" @Id private Long id;\n" +" public Long getId() { return id; }\n" +" public void setId(Long id) { this.id = id; }\n" +" @Transient private String userId;\n" +" @Transient private String orderId;\n" +"\n" +" @Access(AccessType.PROPERTY)\n" +" public String getOrderNumber() { return userId + \":\" + orderId; }\n" +" public void setOrderNumber() { this.userId = ...; this.orderId = ...; }\n" +"}" +msgstr "" + +#. Tag: para +#: basic_mapping.xml:1889 +#, no-c-format +msgid "" +"In this example, the default access type is FIELD " +"except for the orderNumber property. Note that the " +"corresponding field, if any must be marked as @Transient or transient." +msgstr "" + +#. Tag: title +#: basic_mapping.xml:1896 +#, no-c-format +msgid "@org.hibernate.annotations.AccessType" +msgstr "" + +#. Tag: para +#: basic_mapping.xml:1898 +#, no-c-format +msgid "" +"The annotation @org.hibernate.annotations.AccessType " +"should be considered deprecated for FIELD and PROPERTY access. It is still " +"useful however if you need to use a custom access type." +msgstr "" + +#. Tag: title +#: basic_mapping.xml:1907 +#, no-c-format +msgid "Optimistic lock" +msgstr "" + +#. Tag: para +#: basic_mapping.xml:1909 +#, no-c-format +msgid "" +"It is sometimes useful to avoid increasing the version number even if a " +"given property is dirty (particularly collections). You can do that by " +"annotating the property (or collection) with @OptimisticLock" +"(excluded=true)." +msgstr "" + +#. Tag: para +#: basic_mapping.xml:1914 +#, no-c-format +msgid "" +"More formally, specifies that updates to this property do not require " +"acquisition of the optimistic lock." +msgstr "" + +#. Tag: title +#: basic_mapping.xml:1919 +#, no-c-format +msgid "Declaring column attributes" +msgstr "" + +#. Tag: para +#: basic_mapping.xml:1921 +#, no-c-format +msgid "" +"The column(s) used for a property mapping can be defined using the " +"@Column annotation. Use it to override default values " +"(see the JPA specification for more information on the defaults). You can " +"use this annotation at the property level for properties that are:" +msgstr "" + +#. Tag: para +#: basic_mapping.xml:1929 +#, no-c-format +msgid "not annotated at all" +msgstr "" + +#. Tag: para +#: basic_mapping.xml:1933 +#, fuzzy, no-c-format +msgid "annotated with @Basic" +msgstr "assigned" + +#. Tag: para +#: basic_mapping.xml:1937 +#, fuzzy, no-c-format +msgid "annotated with @Version" +msgstr "string" + +#. Tag: para +#: basic_mapping.xml:1941 +#, fuzzy, no-c-format +msgid "annotated with @Lob" +msgstr "hilo" + +#. Tag: para +#: basic_mapping.xml:1945 +#, fuzzy, no-c-format +msgid "annotated with @Temporal" +msgstr "serializable" + +#. Tag: programlisting +#: basic_mapping.xml:1949 +#, no-c-format +msgid "" +"@Entity\n" +"public class Flight implements Serializable {\n" +"...\n" +"@Column(updatable = false, name = \"flight_name\", nullable = false, " +"length=50)\n" +"public String getName() { ... }" +msgstr "" + +#. Tag: para +#: basic_mapping.xml:1951 +#, no-c-format +msgid "" +"The name property is mapped to the flight_name column, which is not nullable, has a length of 50 and is not " +"updatable (making the property immutable)." +msgstr "" + +#. Tag: para +#: basic_mapping.xml:1956 +#, no-c-format +msgid "" +"This annotation can be applied to regular properties as well as " +"@Id or @Version properties." +msgstr "" + +#. Tag: programlisting +#: basic_mapping.xml:1983 +#, no-c-format +msgid "" +"@Column(\n" +" name=\"columnName\";\n" +" boolean unique() default false;\n" +" boolean nullable() default true;\n" +" boolean insertable() default true;\n" +" boolean updatable() default true;\n" +" String columnDefinition() default \"\";\n" +" String table() default \"\";\n" +" int length() default 255;\n" +" int precision() default 0; // decimal precision\n" +" int scale() default 0; // decimal scale" +msgstr "" + +#. Tag: para +#: basic_mapping.xml:1987 +#, fuzzy, no-c-format +msgid "" +"name (optional): the column name (default to the property " +"name)" +msgstr "" +"name (optionnel) : nom de la propriété de l'identifiant." + +#. Tag: para +#: basic_mapping.xml:1992 +#, fuzzy, no-c-format +msgid "" +"unique (optional): set a unique constraint on this column " +"or not (default false)" +msgstr "" +"unique (optionnel) : génère le DDL d'une contrainte " +"d'unicité pour les colonnes. Permet aussi d'en faire la cible d'une " +"property-ref." + +#. Tag: para +#: basic_mapping.xml:1997 +#, fuzzy, no-c-format +msgid "" +"nullable (optional): set the column as nullable (default " +"true)." +msgstr "" +"name (optionnel) : nom de la propriété de l'identifiant." + +#. Tag: para +#: basic_mapping.xml:2002 +#, fuzzy, no-c-format +msgid "" +"insertable (optional): whether or not the column will be " +"part of the insert statement (default true)" +msgstr "" +"name (optionnel) : nom de la propriété de l'identifiant." + +#. Tag: para +#: basic_mapping.xml:2008 +#, fuzzy, no-c-format +msgid "" +"updatable (optional): whether or not the column will be " +"part of the update statement (default true)" +msgstr "" +"catalog (optionnel) : le nom d'un catalogue de base de " +"données. " + +#. Tag: para +#: basic_mapping.xml:2014 +#, no-c-format +msgid "" +"columnDefinition (optional): override the sql DDL " +"fragment for this particular column (non portable)" +msgstr "" + +#. Tag: para +#: basic_mapping.xml:2020 +#, fuzzy, no-c-format +msgid "" +"table (optional): define the targeted table (default " +"primary table)" +msgstr "" +"catalog (optionnel) : le nom d'un catalogue de base de " +"données. " + +#. Tag: para +#: basic_mapping.xml:2025 +#, no-c-format +msgid "" +"length (optional): column length " +"(default 255)" +msgstr "" + +#. Tag: para +#: basic_mapping.xml:2030 +#, no-c-format +msgid "" +"precision (optional): column decimal " +"precision (default 0)" +msgstr "" + +#. Tag: para +#: basic_mapping.xml:2035 +#, no-c-format +msgid "" +"scale (optional): column decimal scale " +"if useful (default 0)" +msgstr "" + +#. Tag: title +#: basic_mapping.xml:2043 +#, no-c-format +msgid "Formula" +msgstr "" + +#. Tag: para +#: basic_mapping.xml:2045 +#, no-c-format +msgid "" +"Sometimes, you want the Database to do some computation for you rather than " +"in the JVM, you might also create some kind of virtual column. You can use a " +"SQL fragment (aka formula) instead of mapping a property into a column. This " +"kind of property is read only (its value is calculated by your formula " +"fragment)." +msgstr "" + +#. Tag: programlisting +#: basic_mapping.xml:2051 +#, no-c-format +msgid "" +"@Formula(\"obj_length * obj_height * obj_width\")\n" +"public long getObjectVolume()" +msgstr "" + +#. Tag: para +#: basic_mapping.xml:2053 +#, no-c-format +msgid "" +"The SQL fragment can be as complex as you want and even include subselects." +msgstr "" + +#. Tag: title +#: basic_mapping.xml:2058 +#, no-c-format +msgid "Non-annotated property defaults" +msgstr "" + +#. Tag: para +#: basic_mapping.xml:2060 +#, no-c-format +msgid "If a property is not annotated, the following rules apply:" +msgstr "" + +#. Tag: para +#: basic_mapping.xml:2063 +#, no-c-format +msgid "If the property is of a single type, it is mapped as @Basic" +msgstr "" + +#. Tag: para +#: basic_mapping.xml:2068 +#, no-c-format +msgid "" +"Otherwise, if the type of the property is annotated as @Embeddable, it is " +"mapped as @Embedded" +msgstr "" + +#. Tag: para +#: basic_mapping.xml:2073 +#, no-c-format +msgid "" +"Otherwise, if the type of the property is Serializable, it is mapped as @Basic in a column " +"holding the object in its serialized version" +msgstr "" + +#. Tag: para +#: basic_mapping.xml:2080 +#, no-c-format +msgid "" +"Otherwise, if the type of the property is java.sql.Clob or java.sql.Blob, it is mapped as " +"@Lob with the appropriate LobType" +msgstr "" + +#. Tag: title +#: basic_mapping.xml:2091 +#, no-c-format +msgid "Property mapping with hbm.xml" +msgstr "" + +#. Tag: para +#: basic_mapping.xml:2093 #, no-c-format msgid "" "The <property> element declares a persistent " @@ -2077,7 +4410,34 @@ msgstr "" "L'élément <property> déclare une propriété " "persistante de la classe au sens JavaBean." +#. Tag: programlisting +#: basic_mapping.xml:2125 +#, no-c-format +msgid "" +"<property\n" +" name=\"propertyName\"\n" +" column=\"column_name\"\n" +" type=\"typename\"\n" +" update=\"true|false\"\n" +" insert=\"true|false\"\n" +" formula=\"arbitrary SQL expression\"\n" +" access=\"field|property|ClassName\"\n" +" lazy=\"true|false\"\n" +" unique=\"true|false\"\n" +" not-null=\"true|false\"\n" +" optimistic-lock=\"true|false\"\n" +" generated=\"never|insert|always\"\n" +" node=\"element-name|@attribute-name|element/@attribute|.\"\n" +" index=\"index_name\"\n" +" unique_key=\"unique_key_id\"\n" +" length=\"L\"\n" +" precision=\"P\"\n" +" scale=\"S\"\n" +"/>" +msgstr "" + #. Tag: para +#: basic_mapping.xml:2129 #, no-c-format msgid "" "name: the name of the property, with an initial lowercase " @@ -2087,6 +4447,7 @@ msgstr "" "minuscule. " #. Tag: para +#: basic_mapping.xml:2134 #, no-c-format msgid "" "column (optional - defaults to the property name): the " @@ -2098,6 +4459,7 @@ msgstr "" "élément(s) <column> imbriqués. " #. Tag: para +#: basic_mapping.xml:2146 #, no-c-format msgid "" "update, insert (optional - defaults to trueformula (optional): an SQL expression that defines the " @@ -2127,6 +4490,7 @@ msgstr "" "calculées ne possèdent pas leur propre mappage." #. Tag: para +#: basic_mapping.xml:2169 #, no-c-format msgid "" "lazy (optional - defaults to false): " @@ -2140,6 +4504,7 @@ msgstr "" "construction). " #. Tag: para +#: basic_mapping.xml:2176 #, no-c-format msgid "" "unique (optional): enables the DDL generation of a unique " @@ -2151,6 +4516,7 @@ msgstr "" "property-ref." #. Tag: para +#: basic_mapping.xml:2183 #, no-c-format msgid "" "not-null (optional): enables the DDL generation of a " @@ -2160,6 +4526,7 @@ msgstr "" "nullité pour les colonnes." #. Tag: para +#: basic_mapping.xml:2188 basic_mapping.xml:3246 #, no-c-format msgid "" "optimistic-lock (optional - defaults to truegenerated (optional - defaults to never pour plus d'informations. " #. Tag: para +#: basic_mapping.xml:2205 #, no-c-format msgid "typename could be:" msgstr "typename peut être :" #. Tag: para -#, no-c-format -msgid "" -"The name of a Hibernate basic type: integer, string, character, " -"date, timestamp, float, binary, serializable, object, blob etc." -msgstr "" -"Le nom d'un type basique Hibernate (par ex : integer, string, " -"character, date, timestamp, float, binary, serializable, object, blob etc.). " - -#. Tag: para -#, no-c-format -msgid "" -"The name of a Java class with a default basic type: int, float, " -"char, java.lang.String, java.util.Date, java.lang.Integer, java.sql.Clob etc." -msgstr "" -"le nom d'une classe Java avec un type basique par défaut (par ex : " -"int, float, char, java.lang.String, java.util.Date, java.lang." -"Integer, java.sql.Clob etc.). " - -#. Tag: para -#, no-c-format -msgid "The name of a serializable Java class." -msgstr "Le nom d'une classe Java sérialisable." - -#. Tag: para -#, no-c-format -msgid "" -"The class name of a custom type: com.illflow.type.MyCustomType etc." -msgstr "" -"Le nom d'une classe avec un type personnalisé (par ex : com.illflow." -"type.MyCustomType)." - -#. Tag: para +#: basic_mapping.xml:2230 #, no-c-format msgid "" "If you do not specify a type, Hibernate will use reflection upon the named " @@ -2247,6 +4582,7 @@ msgstr "" "personnalisé)." #. Tag: para +#: basic_mapping.xml:2239 #, no-c-format msgid "" "The access attribute allows you to control how Hibernate " @@ -2267,6 +4603,7 @@ msgstr "" "build-timey.PropertyAccessor. " #. Tag: para +#: basic_mapping.xml:2248 #, no-c-format msgid "" "A powerful feature is derived properties. These properties are by definition " @@ -2280,7 +4617,20 @@ msgstr "" "expression SQL, qui se traduit par une sous-requête SELECT dans la requête SQL qui charge une instance : " +#. Tag: programlisting +#: basic_mapping.xml:2254 +#, no-c-format +msgid "" +"<property name=\"totalPrice\"\n" +" formula=\"( SELECT SUM (li.quantity*p.price) FROM LineItem li, Product " +"p\n" +" WHERE li.productId = p.productId\n" +" AND li.customerId = customerId\n" +" AND li.orderNumber = orderNumber )\"/>" +msgstr "" + #. Tag: para +#: basic_mapping.xml:2256 #, no-c-format msgid "" "You can reference the entity table by not declaring an alias on a particular " @@ -2295,480 +4645,18 @@ msgstr "" "l'attribut si vous le souhaitez. " #. Tag: title +#: basic_mapping.xml:2265 #, no-c-format -msgid "Many-to-one" -msgstr "Plusieurs-à-un" - -#. Tag: para -#, no-c-format -msgid "" -"An ordinary association to another persistent class is declared using a " -"many-to-one element. The relational model is a many-to-" -"one association; a foreign key in one table is referencing the primary key " -"column(s) of the target table." +msgid "Embedded objects (aka components)" msgstr "" -"Une association ordinaire vers une autre classe persistante est déclarée en " -"utilisant un élément many-to-one. Le modèle relationnel " -"est une association de type plusieurs-à-un : une clé étrangère dans une " -"table référence la ou les clé(s) primaire(s) dans la table cible. " #. Tag: para -#, no-c-format -msgid "name: the name of the property." -msgstr "name : le nom de la propriété. " - -#. Tag: para -#, no-c-format +#: basic_mapping.xml:2267 +#, fuzzy, no-c-format msgid "" -"column (optional): the name of the foreign key column. " -"This can also be specified by nested <column> " -"element(s)." -msgstr "" -"column (optionnel) : le nom de la colonne de la clé " -"étrangère. Cela peut être aussi spécifié par un ou des sous-élément(s) " -"<column>. " - -#. Tag: para -#, no-c-format -msgid "" -"class (optional - defaults to the property type " -"determined by reflection): the name of the associated class." -msgstr "" -"class (optionnel - par défaut, le type de la propriété " -"déterminé par réflexion) : le nom de la classe associée. " - -#. Tag: para -#, no-c-format -msgid "" -"cascade (optional): specifies which operations should be " -"cascaded from the parent object to the associated object." -msgstr "" -"cascade (optionnel) : indique quelles opérations doivent " -"être cascadées de l'objet parent vers l'objet associé. " - -#. Tag: para -#, no-c-format -msgid "" -"fetch (optional - defaults to select): " -"chooses between outer-join fetching or sequential select fetching." -msgstr "" -"fetch (optionnel - par défaut à select) : choisit entre le chargement de type jointure externe (outer-" -"join) ou le chargement par select successifs." - -#. Tag: para -#, no-c-format -msgid "" -"update, insert (optional - defaults to true): specifies that the mapped columns should be included in SQL " -"UPDATE and/or INSERT statements. " -"Setting both to false allows a pure \"derived\" " -"association whose value is initialized from another property that maps to " -"the same column(s), or by a trigger or other application." -msgstr "" -"update, insert (optionnel - par défaut à true) : indique que les colonnes mappées devraient être incluses dans " -"des SQL UPDATE et/ou des déclarations INSERT. Mettre les deux à false, permet une association " -"pure dérivée dont la valeur est initialisée à partir d'une autre propriété " -"qui mappe à une ou plusieurs mêmes colonnes, ou par un trigger ou une autre " -"application. " - -#. Tag: para -#, no-c-format -msgid "" -"property-ref (optional): the name of a property of the " -"associated class that is joined to this foreign key. If not specified, the " -"primary key of the associated class is used." -msgstr "" -"property-ref (optionnel) : le nom d'une propriété de la " -"classe associée qui est jointe à cette clé étrangère. Si non-spécifiée, la " -"clé primaire de la classe associée est utilisée. " - -#. Tag: para -#, no-c-format -msgid "" -"unique (optional): enables the DDL generation of a unique " -"constraint for the foreign-key column. By allowing this to be the target of " -"a property-ref, you can make the association multiplicity " -"one-to-one." -msgstr "" -"unique (optionnel) : génère le DDL d'une contrainte " -"unique pour la clé étrangère. Permet aussi d'en faire la cible d'une " -"property-ref. Cela permet de créer une véritable " -"association un-à-un. " - -#. Tag: para -#, no-c-format -msgid "" -"not-null (optional): enables the DDL generation of a " -"nullability constraint for the foreign key columns." -msgstr "" -"not-null (optionnel) : active le DDL d'une contrainte de " -"nullité pour les colonnes de clés étrangères." - -#. Tag: para -#, no-c-format -msgid "" -"lazy (optional - defaults to proxy): " -"by default, single point associations are proxied. lazy=\"no-proxy" -"\" specifies that the property should be fetched lazily when the " -"instance variable is first accessed. This requires build-time bytecode " -"instrumentation. lazy=\"false\" specifies that the " -"association will always be eagerly fetched." -msgstr "" -"lazy (optionnel - par défaut à proxy) : par défaut, les associations de point uniques utilisent des " -"proxies. lazy=\"no-proxy\" indique que cette propriété " -"doit être chargée en différé au premier accès à la variable d'instance " -"(nécessite une instrumentation du bytecode lors de la phase de " -"construction). lazy=\"false\" indique que l'association " -"sera toujours chargée." - -#. Tag: para -#, no-c-format -msgid "" -"not-found (optional - defaults to exception): specifies how foreign keys that reference missing rows will be " -"handled. ignore will treat a missing row as a null " -"association." -msgstr "" -"not-found (optionnel - par défaut = exception) : spécifie comment les clés étrangères qui référencent des lignes " -"manquantes seront gérées : ignore traitera une ligne " -"manquante comme une association nulle. " - -#. Tag: para -#, no-c-format -msgid "" -"entity-name (optional): the entity name of the associated " -"class." -msgstr "" -"entity-name (optionnel) : le nom de l'entité de la classe " -"associée. " - -#. Tag: para -#, no-c-format -msgid "" -"formula (optional): an SQL expression that defines the " -"value for a computed foreign key." -msgstr "" -"formula (optionnel) : une expression SQL qui définit la " -"valeur pour une clé étrangère calculée. " - -#. Tag: para -#, no-c-format -msgid "" -"Setting a value of the cascade attribute to any " -"meaningful value other than none will propagate certain " -"operations to the associated object. The meaningful values are divided into " -"three categories. First, basic operations, which include: persist, " -"merge, delete, save-update, evict, replicate, lock and refresh; " -"second, special values: delete-orphan; and third," -"all comma-separated combinations of operation names: " -"cascade=\"persist,merge,evict\" or cascade=\"all," -"delete-orphan\". See " -"for a full explanation. Note that single valued, many-to-one and one-to-one, " -"associations do not support orphan delete." -msgstr "" -"Donner une valeur significative à l'attribut cascade " -"autre que none propagera certaines opérations à l'objet " -"associé. Les valeurs significatives sont les noms des opérations et sont " -"divisées en trois catégories. Tout d'abord, les valeurs Hibernate basiques, " -"persist, merge, delete, save-update, evict, replicate, lock, " -"refresh, puis les valeurs spéciales delete-orphan et all et enfin, des combinaisons de noms " -"d'opérations séparées par des virgules, comme par exemple cascade=" -"\"persist,merge,evict\" ou cascade=\"all,delete-orphan\". Consultez la pour une " -"explication complète. Notez que des associations valuées uniques " -"(associations plusieurs-à-un et un-à-un) ne supportent pas orphan delete. " - -#. Tag: para -#, no-c-format -msgid "" -"Here is an example of a typical many-to-one declaration:" -msgstr "" -"Une déclaration many-to-one typique est aussi simple " -"que : " - -#. Tag: para -#, no-c-format -msgid "" -"The property-ref attribute should only be used for " -"mapping legacy data where a foreign key refers to a unique key of the " -"associated table other than the primary key. This is a complicated and " -"confusing relational model. For example, if the Product " -"class had a unique serial number that is not the primary key. The " -"unique attribute controls Hibernate's DDL generation with " -"the SchemaExport tool." -msgstr "" -"L'attribut property-ref devrait être utilisé pour mapper " -"seulement des données provenant d'un ancien système où les clés étrangères " -"font référence à une clé unique de la table associée et qui n'est pas la clé " -"primaire. C'est un cas de mauvaise conception relationnelle. Par exemple, " -"supposez que la classe Product ait un numéro de série " -"unique qui n'est pas la clé primaire. L'attribut unique " -"contrôle la génération DDL par Hibernate avec l'outil SchemaExport." - -#. Tag: para -#, no-c-format -msgid "Then the mapping for OrderItem might use:" -msgstr "Ainsi le mappage pour OrderItem peut utiliser :" - -#. Tag: para -#, no-c-format -msgid "This is not encouraged, however." -msgstr "Bien que ce ne soit certainement pas encouragé." - -#. Tag: para -#, no-c-format -msgid "" -"If the referenced unique key comprises multiple properties of the associated " -"entity, you should map the referenced properties inside a named <" -"properties> element." -msgstr "" -"Si la clé unique référencée comprend des propriétés multiples de l'entité " -"associée, vous devez mapper ces propriétés à l'intérieur d'un élément nommé " -"<properties>. " - -#. Tag: para -#, no-c-format -msgid "" -"If the referenced unique key is the property of a component, you can specify " -"a property path:" -msgstr "" -"Si la clé unique référencée est la propriété d'un composant, vous pouvez " -"spécifier le chemin de propriété :" - -#. Tag: title -#, no-c-format -msgid "One-to-one" -msgstr "Un-à-un" - -#. Tag: para -#, no-c-format -msgid "" -"A one-to-one association to another persistent class is declared using a " -"one-to-one element." -msgstr "" -"Une association un-à-un vers une autre classe persistante est déclarée avec " -"l'élément one-to-one." - -#. Tag: para -#, no-c-format -msgid "" -"constrained (optional): specifies that a foreign key " -"constraint on the primary key of the mapped table and references the table " -"of the associated class. This option affects the order in which save" -"() and delete() are cascaded, and determines " -"whether the association can be proxied. It is also used by the schema export " -"tool." -msgstr "" -"constrained (optionnel) : indique qu'une contrainte de " -"clé étrangère sur la clé primaire de la table mappée référence la table de " -"la classe associée. Cette option affecte l'ordre dans lequel chaque " -"save() et chaque delete() est cascadé " -"et détermine si l'association peut utiliser un proxy (aussi utilisé par " -"l'outil SchemaExport). " - -#. Tag: para -#, no-c-format -msgid "" -"property-ref (optional): the name of a property of the " -"associated class that is joined to the primary key of this class. If not " -"specified, the primary key of the associated class is used." -msgstr "" -"property-ref (optionnel) : le nom de la propriété de la " -"classe associée qui est jointe à la clé primaire de cette classe. Si ce " -"n'est pas spécifié, la clé primaire de la classe associée est utilisée. " - -#. Tag: para -#, no-c-format -msgid "" -"formula (optional): almost all one-to-one associations " -"map to the primary key of the owning entity. If this is not the case, you " -"can specify another column, columns or expression to join on using an SQL " -"formula. See org.hibernate.test.onetooneformula for an " -"example." -msgstr "" -"formula (optionnel) : presque toutes les associations un-" -"à-un pointent sur la clé primaire de l'entité propriétaire. Dans les rares " -"cas différents, vous devez donner une ou plusieurs autres colonnes ou " -"expression à joindre par une formule SQL . Voir org.hibernate.test." -"onetooneformula pour un exemple." - -#. Tag: para -#, no-c-format -msgid "" -"lazy (optional - defaults to proxy): " -"by default, single point associations are proxied. lazy=\"no-proxy" -"\" specifies that the property should be fetched lazily when the " -"instance variable is first accessed. It requires build-time bytecode " -"instrumentation. lazy=\"false\" specifies that the " -"association will always be eagerly fetched. Note that if " -"constrained=\"false\", proxying is impossible and " -"Hibernate will eagerly fetch the association." -msgstr "" -"lazy (optionnel - par défaut proxy) : " -"par défaut, les associations simples sont soumises à proxy. lazy=" -"\"no-proxy\" spécifie que la propriété doit être chargée en " -"différé au premier accès à l'instance. (nécessite l'instrumentation du " -"bytecode à la construction). lazy=\"false\" indique que " -"l'association sera toujours chargée agressivement. . Notez que si " -"constrained=\"false\", l'utilisation de proxy est " -"impossible et Hibernate chargera automatiquement l'association ." - -#. Tag: para -#, no-c-format -msgid "There are two varieties of one-to-one associations:" -msgstr "Il existe deux types d'associations un-à-un : " - -#. Tag: para -#, no-c-format -msgid "primary key associations" -msgstr "association par clé primaire " - -#. Tag: para -#, no-c-format -msgid "unique foreign key associations" -msgstr "association par clé étrangère unique" - -#. Tag: para -#, no-c-format -msgid "" -"Primary key associations do not need an extra table column. If two rows are " -"related by the association, then the two table rows share the same primary " -"key value. To relate two objects by a primary key association, ensure that " -"they are assigned the same identifier value." -msgstr "" -"Les associations par clé primaire ne nécessitent pas une colonne " -"supplémentaire en table ; si deux lignes sont liées par l'association alors " -"les deux lignes de la table partagent la même valeur de clé primaire. Donc " -"si vous voulez que deux objets soient liés par une association par clé " -"primaire, vous devez faire en sorte qu'on leur assigne la même valeur " -"d'identifiant. " - -#. Tag: para -#, no-c-format -msgid "" -"For a primary key association, add the following mappings to " -"Employee and Person respectively:" -msgstr "" -"Pour une association par clé primaire, ajoutez les mappages suivants à " -"Employee et Person, respectivement :" - -#. Tag: para -#, no-c-format -msgid "" -"Ensure that the primary keys of the related rows in the PERSON and EMPLOYEE " -"tables are equal. You use a special Hibernate identifier generation strategy " -"called foreign:" -msgstr "" -"Maintenant, vous devez faire en sorte que les clés primaires des lignes " -"liées dans les tables PERSON et EMPLOYEE sont égales. On utilise une " -"stratégie Hibernate spéciale de génération d'identifiants appelée " -"foreign : " - -#. Tag: para -#, no-c-format -msgid "" -"A newly saved instance of Person is assigned the same " -"primary key value as the Employee instance referred with " -"the employee property of that Person." -msgstr "" -"Une instance fraîchement enregistrée de Person se voit " -"alors assignée la même valeur de clé primaire que l'instance de " -"Employee référencée par la propriété employee de cette Person. " - -#. Tag: para -#, no-c-format -msgid "" -"Alternatively, a foreign key with a unique constraint, from " -"Employee to Person, can be expressed " -"as:" -msgstr "" -"Alternativement, une clé étrangère avec contrainte d'unicité de " -"Employee vers Person peut être " -"indiquée ainsi : " - -#. Tag: para -#, no-c-format -msgid "" -"This association can be made bidirectional by adding the following to the " -"Person mapping:" -msgstr "" -"Et cette association peut être rendue bidirectionnelle en ajoutant ceci au " -"mappage de Person : " - -#. Tag: title -#, no-c-format -msgid "Natural-id" -msgstr "Natural-id" - -#. Tag: para -#, no-c-format -msgid "" -"Although we recommend the use of surrogate keys as primary keys, you should " -"try to identify natural keys for all entities. A natural key is a property " -"or combination of properties that is unique and non-null. It is also " -"immutable. Map the properties of the natural key inside the <" -"natural-id> element. Hibernate will generate the necessary " -"unique key and nullability constraints and, as a result, your mapping will " -"be more self-documenting." -msgstr "" -"Bien que nous recommandions l'utilisation de clés primaires générées, vous " -"devriez toujours essayer d'identifier des clés métier (naturelles) pour " -"toutes vos entités. Une clé naturelle est une propriété ou une combinaison " -"de propriétés unique et non nulle. Si elle est aussi immuable, c'est encore " -"mieux. Mappez les propriétés de la clé naturelle dans l'élément <" -"natural-id>. Hibernate générera la clé unique nécessaire et les " -"contraintes de non-nullité, et votre mappage s'auto-documentera. " - -#. Tag: para -#, no-c-format -msgid "" -"It is recommended that you implement equals() and " -"hashCode() to compare the natural key properties of the " -"entity." -msgstr "" -"Nous vous recommandons fortement d'implémenter equals() " -"et hashCode() pour comparer les propriétés clés " -"naturelles de l'entité." - -#. Tag: para -#, no-c-format -msgid "" -"This mapping is not intended for use with entities that have natural primary " -"keys." -msgstr "" -"Ce mappage n'est pas destiné à être utilisé avec des entités qui ont des " -"clés naturelles. " - -#. Tag: para -#, no-c-format -msgid "" -"mutable (optional - defaults to false): by default, natural identifier properties are assumed to be " -"immutable (constant)." -msgstr "" -"mutable (optionnel, par défaut à false) : par défaut, les identifiants naturels sont supposés être " -"immuables (constants). " - -#. Tag: title -#, no-c-format -msgid "Component and dynamic-component" -msgstr "Component, dynamic-component" - -#. Tag: para -#, no-c-format -msgid "" -"The <component> element maps properties of a child " -"object to columns of the table of a parent class. Components can, in turn, " -"declare their own properties, components or collections. See the \"Component" -"\" examples below:" +"Embeddable objects (or components) are objects whose properties are mapped " +"to the same table as the owning entity's table. Components can, in turn, " +"declare their own properties, components or collections" msgstr "" "L'élément <component> mappe les propriétés d'un " "objet enfant aux colonnes d'une classe parente. Les composants peuvent en " @@ -2776,6 +4664,193 @@ msgstr "" "\"Components\" plus bas :" #. Tag: para +#: basic_mapping.xml:2272 +#, no-c-format +msgid "" +"It is possible to declare an embedded component inside an entity and even " +"override its column mapping. Component classes have to be annotated at the " +"class level with the @Embeddable annotation. It is " +"possible to override the column mapping of an embedded object for a " +"particular entity using the @Embedded and " +"@AttributeOverride annotation in the associated property:" +msgstr "" + +#. Tag: programlisting +#: basic_mapping.xml:2280 +#, no-c-format +msgid "" +"@Entity\n" +"public class Person implements Serializable {\n" +"\n" +" // Persistent component using defaults\n" +" Address homeAddress;\n" +"\n" +" @Embedded\n" +" @AttributeOverrides( {\n" +" @AttributeOverride(name=\"iso2\", column = @Column(name=" +"\"bornIso2\") ),\n" +" @AttributeOverride(name=\"name\", column = @Column(name=" +"\"bornCountryName\") )\n" +" } )\n" +" Country bornIn;\n" +" ...\n" +"}" +msgstr "" + +#. Tag: programlisting +#: basic_mapping.xml:2282 +#, no-c-format +msgid "" +"@Embeddable\n" +"public class Address implements Serializable {\n" +" String city;\n" +" Country nationality; //no overriding here\n" +"}" +msgstr "" + +#. Tag: programlisting +#: basic_mapping.xml:2284 +#, no-c-format +msgid "" +"@Embeddable\n" +"public class Country implements Serializable {\n" +" private String iso2;\n" +" @Column(name=\"countryName\") private String name;\n" +"\n" +" public String getIso2() { return iso2; }\n" +" public void setIso2(String iso2) { this.iso2 = iso2; }\n" +"\n" +" \n" +" public String getName() { return name; }\n" +" public void setName(String name) { this.name = name; }\n" +" ...\n" +"}" +msgstr "" + +#. Tag: para +#: basic_mapping.xml:2286 +#, no-c-format +msgid "" +"An embeddable object inherits the access type of its owning entity (note " +"that you can override that using the @Access annotation)." +msgstr "" + +#. Tag: para +#: basic_mapping.xml:2290 +#, no-c-format +msgid "" +"The Person entity has two component properties, " +"homeAddress and bornIn. " +"homeAddress property has not been annotated, but " +"Hibernate will guess that it is a persistent component by looking for the " +"@Embeddable annotation in the Address class. We also " +"override the mapping of a column name (to bornCountryName) with the @Embedded and " +"@AttributeOverride annotations for each mapped attribute " +"of Country. As you can see, Country is " +"also a nested component of Address, again using auto-" +"detection by Hibernate and JPA defaults. Overriding columns of embedded " +"objects of embedded objects is through dotted expressions." +msgstr "" + +#. Tag: programlisting +#: basic_mapping.xml:2305 +#, no-c-format +msgid "" +"@Embedded\n" +" @AttributeOverrides( {\n" +" @AttributeOverride(name=\"city\", column = @Column(name=" +"\"fld_city\") ),\n" +" @AttributeOverride(name=\"nationality.iso2\", column = @Column" +"(name=\"nat_Iso2\") ),\n" +" @AttributeOverride(name=\"nationality.name\", column = @Column" +"(name=\"nat_CountryName\") )\n" +" //nationality columns in homeAddress are overridden\n" +" } )\n" +" Address homeAddress;" +msgstr "" + +#. Tag: para +#: basic_mapping.xml:2307 +#, no-c-format +msgid "" +"Hibernate Annotations supports something that is not explicitly supported by " +"the JPA specification. You can annotate a embedded object with the " +"@MappedSuperclass annotation to make the superclass " +"properties persistent (see @MappedSuperclass for more " +"informations)." +msgstr "" + +#. Tag: para +#: basic_mapping.xml:2313 +#, no-c-format +msgid "" +"You can also use association annotations in an embeddable object (ie " +"@OneToOne, @ManyToOne, " +"@OneToMany or @ManyToMany). To " +"override the association columns you can use @AssociationOverride." +msgstr "" + +#. Tag: para +#: basic_mapping.xml:2319 +#, no-c-format +msgid "" +"If you want to have the same embeddable object type twice in the same " +"entity, the column name defaulting will not work as several embedded objects " +"would share the same set of columns. In plain JPA, you need to override at " +"least one set of columns. Hibernate, however, allows you to enhance the " +"default naming mechanism through the NamingStrategy " +"interface. You can write a strategy that prevent name clashing in such a " +"situation. DefaultComponentSafeNamingStrategy is an " +"example of this." +msgstr "" + +#. Tag: para +#: basic_mapping.xml:2329 +#, no-c-format +msgid "" +"If a property of the embedded object points back to the owning entity, " +"annotate it with the @Parent annotation. Hibernate " +"will make sure this property is properly loaded with the entity reference." +msgstr "" + +#. Tag: para +#: basic_mapping.xml:2334 +#, no-c-format +msgid "In XML, use the <component> element." +msgstr "" + +#. Tag: programlisting +#: basic_mapping.xml:2356 +#, no-c-format +msgid "" +"<component\n" +" name=\"propertyName\"\n" +" class=\"className\"\n" +" insert=\"true|false\"\n" +" update=\"true|false\"\n" +" access=\"field|property|ClassName\"\n" +" lazy=\"true|false\"\n" +" optimistic-lock=\"true|false\"\n" +" unique=\"true|false\"\n" +" node=\"element-name|.\"\n" +">\n" +"\n" +" <property ...../>\n" +" <many-to-one .... />\n" +" ........\n" +"</component>" +msgstr "" + +#. Tag: para +#: basic_mapping.xml:2360 basic_mapping.xml:3181 basic_mapping.xml:3381 +#, no-c-format +msgid "name: the name of the property." +msgstr "name : le nom de la propriété. " + +#. Tag: para +#: basic_mapping.xml:2364 #, no-c-format msgid "" "class (optional - defaults to the property type " @@ -2785,6 +4860,7 @@ msgstr "" "déterminé par réflexion) : le nom de la classe (enfant) du composant. " #. Tag: para +#: basic_mapping.xml:2370 basic_mapping.xml:3641 #, no-c-format msgid "" "insert: do the mapped columns appear in SQL " @@ -2794,6 +4870,7 @@ msgstr "" "SQL INSERT s ? " #. Tag: para +#: basic_mapping.xml:2375 basic_mapping.xml:3646 #, no-c-format msgid "" "update: do the mapped columns appear in SQL " @@ -2803,6 +4880,7 @@ msgstr "" "SQL UPDATE s ? " #. Tag: para +#: basic_mapping.xml:2386 #, no-c-format msgid "" "lazy (optional - defaults to false): " @@ -2815,6 +4893,7 @@ msgstr "" "lors de la phase de construction). " #. Tag: para +#: basic_mapping.xml:2393 #, no-c-format msgid "" "optimistic-lock (optional - defaults to trueunique (optional - defaults to false): " @@ -2840,6 +4920,7 @@ msgstr "" "colonnes mappées de ce composant. " #. Tag: para +#: basic_mapping.xml:2408 #, no-c-format msgid "" "The child <property> tags map properties of the " @@ -2849,6 +4930,7 @@ msgstr "" "propriétés de la classe enfant sur les colonnes de la table. " #. Tag: para +#: basic_mapping.xml:2411 #, no-c-format msgid "" "The <component> element allows a <" @@ -2860,12 +4942,13 @@ msgstr "" "classe composant comme une référence arrière vers l'entité contenante. " #. Tag: para -#, no-c-format +#: basic_mapping.xml:2415 +#, fuzzy, no-c-format msgid "" "The <dynamic-component> element allows a " "Map to be mapped as a component, where the property names " -"refer to keys of the map. See for " -"more information." +"refer to keys of the map. See for " +"more information. This feature is not supported in annotations." msgstr "" "L'élément <dynamic-component> permet à une " "Map d'être mappée en tant que composant, quand les noms " @@ -2873,101 +4956,136 @@ msgstr "" "\"components-dynamic\" />. " #. Tag: title +#: basic_mapping.xml:2423 #, no-c-format -msgid "Properties" -msgstr "Propriétés" +msgid "Inheritance strategy" +msgstr "" #. Tag: para +#: basic_mapping.xml:2425 #, no-c-format msgid "" -"The <properties> element allows the definition of a " -"named, logical grouping of the properties of a class. The most important use " -"of the construct is that it allows a combination of properties to be the " -"target of a property-ref. It is also a convenient way to " -"define a multi-column unique constraint. For example:" +"Java is a language supporting polymorphism: a class can inherit from " +"another. Several strategies are possible to persist a class hierarchy:" msgstr "" -"L'élément <properties> permet la définition d'un " -"groupement logique nommé des propriétés d'une classe. L'utilisation la plus " -"importante de cette construction est la possibilité pour une combinaison de " -"propriétés d'être la cible d'un property-ref. C'est aussi " -"un moyen pratique de définir une contrainte d'unicité multi-colonnes. Par " -"exemple :" #. Tag: para +#: basic_mapping.xml:2431 #, no-c-format msgid "" -"name: the logical name of the grouping. It is " -"not an actual property name." +"Single table per class hierarchy strategy: a single table hosts all the " +"instances of a class hierarchy" msgstr "" -"name : le nom logique d'un regroupement et non le véritable nom d'une propriété. " #. Tag: para +#: basic_mapping.xml:2436 #, no-c-format msgid "" -"optimistic-lock (optional - defaults to true): specifies that updates to these properties either do or do not " -"require acquisition of the optimistic lock. It determines if a version " -"increment should occur when these properties are dirty." +"Joined subclass strategy: one table per class and subclass is present and " +"each table persist the properties specific to a given subclass. The state of " +"the entity is then stored in its corresponding class table and all its " +"superclasses" msgstr "" -"optimistic-lock (optionnel - par défaut à true) : indique si les mise à jour sur ce composant nécessitent ou non " -"l'acquisition d'un verrou optimiste. En d'autres termes, cela détermine si " -"une incrémentation de version doit avoir lieu quand la propriété est marquée " -"obsolète (dirty). " #. Tag: para +#: basic_mapping.xml:2443 #, no-c-format msgid "" -"For example, if we have the following <properties> " -"mapping:" +"Table per class strategy: one table per concrete class and subclass is " +"present and each table persist the properties of the class and its " +"superclasses. The state of the entity is then stored entirely in the " +"dedicated table for its class." msgstr "" -"Par exemple, si nous avons le mappage de <properties> suivant : " - -#. Tag: para -#, no-c-format -msgid "" -"You might have some legacy data association that refers to this unique key " -"of the Person table, instead of to the primary key:" -msgstr "" -"Alors nous pourrions avoir une association sur des données d'un ancien " -"système qui font référence à cette clé unique de la table Person au lieu de la clé primaire : " - -#. Tag: para -#, no-c-format -msgid "" -"The use of this outside the context of mapping legacy data is not " -"recommended." -msgstr "" -"Nous ne recommandons pas une telle utilisation, en dehors du contexte de " -"mappage de données héritées d'anciens systèmes. " #. Tag: title +#: basic_mapping.xml:2451 #, no-c-format -msgid "Subclass" -msgstr "Subclass" +msgid "Single table per class hierarchy strategy" +msgstr "" #. Tag: para +#: basic_mapping.xml:2453 #, no-c-format msgid "" -"Polymorphic persistence requires the declaration of each subclass of the " -"root persistent class. For the table-per-class-hierarchy mapping strategy, " -"the <subclass> declaration is used. For example:" +"With this approach the properties of all the subclasses in a given mapped " +"class hierarchy are stored in a single table." +msgstr "" + +#. Tag: para +#: basic_mapping.xml:2456 +#, fuzzy, no-c-format +msgid "" +"Each subclass declares its own persistent properties and subclasses. Version " +"and id properties are assumed to be inherited from the root class. Each " +"subclass in a hierarchy must define a unique discriminator value. If this is " +"not specified, the fully qualified Java class name is used." +msgstr "" +"Chaque sous-classe devrait déclarer ses propres propriétés persistantes et " +"sous-classes. Les propriétés <version> et " +"<id> sont implicitement hérités de la classe " +"racine. Chaque sous-classe dans une hiérarchie doit définir une unique " +"discriminator-value. Si non spécifiée, le nom complet de " +"la classe Java est utilisé. " + +#. Tag: programlisting +#: basic_mapping.xml:2462 basic_mapping.xml:2540 +#, no-c-format +msgid "" +"@Entity\n" +"@Inheritance(strategy=InheritanceType.SINGLE_TABLE)\n" +"@DiscriminatorColumn(\n" +" name=\"planetype\",\n" +" discriminatorType=DiscriminatorType.STRING\n" +")\n" +"@DiscriminatorValue(\"Plane\")\n" +"public class Plane { ... }\n" +"\n" +"@Entity\n" +"@DiscriminatorValue(\"A320\")\n" +"public class A320 extends Plane { ... }" +msgstr "" + +#. Tag: para +#: basic_mapping.xml:2464 +#, fuzzy, no-c-format +msgid "" +"In hbm.xml, for the table-per-class-hierarchy mapping strategy, the " +"<subclass> declaration is used. For example:" msgstr "" "Pour finir, la persistance polymorphique nécessite la déclaration de chaque " "sous-classe de la classe racine persistante. Pour la stratégie de mappage de " "type table-per-class-hierarchy, on utilise la déclaration <" "subclass>. " +#. Tag: programlisting +#: basic_mapping.xml:2479 +#, no-c-format +msgid "" +"<subclass\n" +" name=\"ClassName\"\n" +" discriminator-value=\"discriminator_value\"\n" +" proxy=\"ProxyInterface\"\n" +" lazy=\"true|false\"\n" +" dynamic-update=\"true|false\"\n" +" dynamic-insert=\"true|false\"\n" +" entity-name=\"EntityName\"\n" +" node=\"element-name\"\n" +" extends=\"SuperclassName\">\n" +"\n" +" <property .... />\n" +" .....\n" +"</subclass>" +msgstr "" + #. Tag: para +#: basic_mapping.xml:2483 basic_mapping.xml:2656 basic_mapping.xml:2720 #, no-c-format msgid "" "name: the fully qualified class name of the subclass." msgstr "name : le nom de classe complet de la sous-classe. " #. Tag: para +#: basic_mapping.xml:2488 #, no-c-format msgid "" "discriminator-value (optional - defaults to the class " @@ -2977,6 +5095,7 @@ msgstr "" "classe) : une valeur qui distingue les différentes sous-classes. " #. Tag: para +#: basic_mapping.xml:2494 #, no-c-format msgid "" "proxy (optional): specifies a class or interface used for " @@ -2986,6 +5105,7 @@ msgstr "" "utiliser pour l'initialisation différée des proxies. " #. Tag: para +#: basic_mapping.xml:2499 #, no-c-format msgid "" "lazy (optional - defaults to true): " @@ -2996,54 +5116,291 @@ msgstr "" "l'extraction différée." #. Tag: para -#, no-c-format +#: basic_mapping.xml:2507 basic_mapping.xml:2685 basic_mapping.xml:2746 +#, fuzzy, no-c-format msgid "" -"Each subclass declares its own persistent properties and subclasses. " -"<version> and <id> " -"properties are assumed to be inherited from the root class. Each subclass in " -"a hierarchy must define a unique discriminator-value. If " -"this is not specified, the fully qualified Java class name is used." -msgstr "" -"Chaque sous-classe devrait déclarer ses propres propriétés persistantes et " -"sous-classes. Les propriétés <version> et " -"<id> sont implicitement hérités de la classe " -"racine. Chaque sous-classe dans une hiérarchie doit définir une unique " -"discriminator-value. Si non spécifiée, le nom complet de " -"la classe Java est utilisé. " - -#. Tag: para -#, no-c-format -msgid "" -"For information about inheritance mappings see ." +"For information about inheritance mappings see ." msgstr "" "Pour plus d'informations sur les mappages d'héritage, consultez le . " #. Tag: title +#: basic_mapping.xml:2511 #, no-c-format -msgid "Joined-subclass" +msgid "Discriminator" +msgstr "Discriminator" + +#. Tag: para +#: basic_mapping.xml:2513 +#, fuzzy, no-c-format +msgid "" +"Discriminators are required for polymorphic persistence using the table-per-" +"class-hierarchy mapping strategy. It declares a discriminator column of the " +"table. The discriminator column contains marker values that tell the " +"persistence layer what subclass to instantiate for a particular row. A " +"restricted set of types can be used: string, " +"character, integer, byte, short, boolean, " +"yes_no, true_false." +msgstr "" +"L'élément <discriminator> est nécessaire pour la " +"persistance polymorphique qui utilise la stratégie de mappage de table par " +"hiérarchie de classe et déclare une colonne discriminante de la table. La " +"colonne discriminante contient des valeurs marqueur qui permettent à la " +"couche de persistance de savoir quelle sous-classe instancier pour une ligne " +"particulière de table en base. Un nombre restreint de types peuvent être " +"utilisés : string, character, " +"integer, byte, short, boolean, yes_no, " +"true_false." + +#. Tag: para +#: basic_mapping.xml:2523 +#, no-c-format +msgid "" +"Use the @DiscriminatorColumn to define the " +"discriminator column as well as the discriminator type. Alternatively, you " +"can also use @DiscriminatorFormula to express in SQL " +"what would be in a virtual discriminator column. This is particularly handy " +"when the discriminator value can be extracted from one or more columns of " +"the table. Both @DiscriminatorColumn and " +"@DiscriminatorFormula are to be set on the root " +"entity (once per persisted hierarchy)." +msgstr "" + +#. Tag: para +#: basic_mapping.xml:2534 +#, no-c-format +msgid "" +"Finally, use @DiscriminatorValue on each class of the " +"hierarchy to specify the value stored in the discriminator column for a " +"given entity. If you do not set @DiscriminatorValue " +"on a class, the fully qualified class name is used." +msgstr "" + +#. Tag: para +#: basic_mapping.xml:2542 +#, no-c-format +msgid "" +"In hbm.xml, the <discriminator> element is used to " +"define the discriminator column or formula:" +msgstr "" + +#. Tag: programlisting +#: basic_mapping.xml:2559 +#, no-c-format +msgid "" +"<discriminator\n" +" column=\"discriminator_column\"\n" +" type=\"discriminator_type\"\n" +" force=\"true|false\"\n" +" insert=\"true|false\"\n" +" formula=\"arbitrary sql expression\"\n" +"/>" +msgstr "" + +#. Tag: para +#: basic_mapping.xml:2563 +#, no-c-format +msgid "" +"column (optional - defaults to class): " +"the name of the discriminator column." +msgstr "" +"column (optionnel - par défaut à class), le nom de la colonne discriminante. " + +#. Tag: para +#: basic_mapping.xml:2569 +#, no-c-format +msgid "" +"type (optional - defaults to string): " +"a name that indicates the Hibernate type" +msgstr "" +"type (optionnel - par défaut à string) " +"un nom indiquant le type Hibernate. " + +#. Tag: para +#: basic_mapping.xml:2575 +#, no-c-format +msgid "" +"force (optional - defaults to false): " +"\"forces\" Hibernate to specify the allowed discriminator values, even when " +"retrieving all instances of the root class." +msgstr "" +"force (optionnel - par défaut à false) " +"\"oblige\" Hibernate à spécifier une valeur discriminante autorisée même " +"quand on récupère toutes les instances de la classe de base. " + +#. Tag: para +#: basic_mapping.xml:2582 +#, no-c-format +msgid "" +"insert (optional - defaults to true): " +"set this to false if your discriminator column is also " +"part of a mapped composite identifier. It tells Hibernate not to include the " +"column in SQL INSERTs." +msgstr "" +"insert (optionnel - par défaut à true) " +"à passer à false si la colonne discriminante fait aussi " +"partie d'un identifiant composé mappé (Indique à Hibernate de ne pas inclure " +"la colonne dans les SQL INSERT s). " + +#. Tag: para +#: basic_mapping.xml:2590 +#, no-c-format +msgid "" +"formula (optional): an arbitrary SQL expression that is " +"executed when a type has to be evaluated. It allows content-based " +"discrimination." +msgstr "" +"formula (optionnel) une expression SQL arbitraire qui est " +"exécutée quand un type doit être évalué. Permet la discrimination basée sur " +"le contenu. " + +#. Tag: para +#: basic_mapping.xml:2597 +#, no-c-format +msgid "" +"Actual values of the discriminator column are specified by the " +"discriminator-value attribute of the <" +"class> and <subclass> elements." +msgstr "" +"Les véritables valeurs de la colonne discriminante sont spécifiées par " +"l'attribut discriminator-value des éléments <" +"class> et <subclass>. " + +#. Tag: para +#: basic_mapping.xml:2602 +#, no-c-format +msgid "" +"The force attribute is only useful if the table contains " +"rows with \"extra\" discriminator values that are not mapped to a persistent " +"class. This will not usually be the case." +msgstr "" +"L'attribut force n'est utile que si la table contient des " +"lignes avec des valeurs \"extra\" discriminantes qui ne sont pas mappées à " +"une classe persistante. Ce ne sera généralement pas le cas. " + +#. Tag: para +#: basic_mapping.xml:2607 +#, no-c-format +msgid "" +"The formula attribute allows you to declare an arbitrary " +"SQL expression that will be used to evaluate the type of a row. For example:" +msgstr "" +"En utilisant l'attribut formula vous pouvez déclarer une " +"expression SQL arbitraire qui sera utilisée pour évaluer le type d'une " +"ligne : " + +#. Tag: programlisting +#: basic_mapping.xml:2611 +#, no-c-format +msgid "" +"<discriminator\n" +" formula=\"case when CLASS_TYPE in ('a', 'b', 'c') then 0 else 1 end\"\n" +" type=\"integer\"/>" +msgstr "" + +#. Tag: title +#: basic_mapping.xml:2616 +#, fuzzy, no-c-format +msgid "Joined subclass strategy" msgstr "Joined-subclass" #. Tag: para -#, no-c-format +#: basic_mapping.xml:2618 +#, fuzzy, no-c-format msgid "" "Each subclass can also be mapped to its own table. This is called the table-" "per-subclass mapping strategy. An inherited state is retrieved by joining " -"with the table of the superclass. To do this you use the <joined-" -"subclass> element. For example:" +"with the table of the superclass. A discriminator column is not required for " +"this mapping strategy. Each subclass must, however, declare a table column " +"holding the object identifier. The primary key of this table is also a " +"foreign key to the superclass table and described by the " +"@PrimaryKeyJoinColumns or the <key> element." msgstr "" "Il est également possible de mapper chaque sous-classe vers sa propre table " "(stratégie de mappage de type table-per-subclass). L'état hérité est " "récupéré en joignant la table de la super-classe. L'élément <" "joined-subclass> est utilisé. Par exemple :" +#. Tag: programlisting +#: basic_mapping.xml:2628 +#, no-c-format +msgid "" +"@Entity @Table(name=\"CATS\")\n" +"@Inheritance(strategy=InheritanceType.JOINED)\n" +"public class Cat implements Serializable { \n" +" @Id @GeneratedValue(generator=\"cat-uuid\") \n" +" @GenericGenerator(name=\"cat-uuid\", strategy=\"uuid\")\n" +" String getId() { return id; }\n" +"\n" +" ...\n" +"}\n" +"\n" +"@Entity @Table(name=\"DOMESTIC_CATS\")\n" +"@PrimaryKeyJoinColumn(name=\"CAT\")\n" +"public class DomesticCat extends Cat { \n" +" public String getName() { return name; }\n" +"}" +msgstr "" + #. Tag: para +#: basic_mapping.xml:2631 +#, no-c-format +msgid "" +"The table name still defaults to the non qualified class name. Also if " +"@PrimaryKeyJoinColumn is not set, the primary key / " +"foreign key columns are assumed to have the same names as the primary key " +"columns of the primary table of the superclass." +msgstr "" + +#. Tag: para +#: basic_mapping.xml:2638 +#, fuzzy, no-c-format +msgid "" +"In hbm.xml, use the <joined-subclass> element. For " +"example:" +msgstr "" +"Déclarez une classe persistante avec l'élément class. " +"Part exemple :" + +#. Tag: programlisting +#: basic_mapping.xml:2652 +#, no-c-format +msgid "" +"<joined-subclass\n" +" name=\"ClassName\"\n" +" table=\"tablename\"\n" +" proxy=\"ProxyInterface\"\n" +" lazy=\"true|false\"\n" +" dynamic-update=\"true|false\"\n" +" dynamic-insert=\"true|false\"\n" +" schema=\"schema\"\n" +" catalog=\"catalog\"\n" +" extends=\"SuperclassName\"\n" +" persister=\"ClassName\"\n" +" subselect=\"SQL expression\"\n" +" entity-name=\"EntityName\"\n" +" node=\"element-name\">\n" +"\n" +" <key .... >\n" +"\n" +" <property .... />\n" +" .....\n" +"</joined-subclass>" +msgstr "" + +#. Tag: para +#: basic_mapping.xml:2661 basic_mapping.xml:2725 #, no-c-format msgid "table: the name of the subclass table." msgstr "table: le nom de la table de la sous-classe. " #. Tag: para +#: basic_mapping.xml:2666 basic_mapping.xml:2730 #, no-c-format msgid "" "proxy (optional): specifies a class or interface to use " @@ -3053,6 +5410,7 @@ msgstr "" "utiliser pour l'initialisation différée des proxies. " #. Tag: para +#: basic_mapping.xml:2671 basic_mapping.xml:2735 #, no-c-format msgid "" "lazy (optional, defaults to true): " @@ -3063,35 +5421,70 @@ msgstr "" "l'extraction différée. " #. Tag: para +#: basic_mapping.xml:2679 #, no-c-format msgid "" -"A discriminator column is not required for this mapping strategy. Each " -"subclass must, however, declare a table column holding the object identifier " -"using the <key> element. The mapping at the start " -"of the chapter would then be re-written as:" +"Use the <key> element to declare the primary key / " +"foreign key column. The mapping at the start of the chapter would then be re-" +"written as:" +msgstr "" + +#. Tag: programlisting +#: basic_mapping.xml:2683 +#, no-c-format +msgid "" +"<?xml version=\"1.0\"?>\n" +"<!DOCTYPE hibernate-mapping PUBLIC\n" +" \"-//Hibernate/Hibernate Mapping DTD//EN\"\n" +" \"http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd\">\n" +"\n" +"<hibernate-mapping package=\"eg\">\n" +"\n" +" <class name=\"Cat\" table=\"CATS\">\n" +" <id name=\"id\" column=\"uid\" type=\"long\">\n" +" <generator class=\"hilo\"/>\n" +" </id>\n" +" <property name=\"birthdate\" type=\"date\"/>\n" +" <property name=\"color\" not-null=\"true\"/>\n" +" <property name=\"sex\" not-null=\"true\"/>\n" +" <property name=\"weight\"/>\n" +" <many-to-one name=\"mate\"/>\n" +" <set name=\"kittens\">\n" +" <key column=\"MOTHER\"/>\n" +" <one-to-many class=\"Cat\"/>\n" +" </set>\n" +" <joined-subclass name=\"DomesticCat\" table=" +"\"DOMESTIC_CATS\">\n" +" <key column=\"CAT\"/>\n" +" <property name=\"name\" type=\"string\"/>\n" +" </joined-subclass>\n" +" </class>\n" +"\n" +" <class name=\"eg.Dog\">\n" +" <!-- mapping for Dog could go here -->\n" +" </class>\n" +"\n" +"</hibernate-mapping>" msgstr "" -"Aucune colonne discriminante n'est nécessaire pour cette stratégie de " -"mappage. Cependant, chaque sous-classe doit déclarer une colonne de table " -"contenant l'objet identifiant qui utilise l'élément <key>. Le mappage au début de ce chapitre serait ré-écrit ainsi : " #. Tag: title +#: basic_mapping.xml:2690 #, no-c-format -msgid "Union-subclass" -msgstr "Union-subclass" +msgid "Table per class strategy" +msgstr "" #. Tag: para -#, no-c-format +#: basic_mapping.xml:2692 +#, fuzzy, no-c-format msgid "" "A third option is to map only the concrete classes of an inheritance " "hierarchy to tables. This is called the table-per-concrete-class strategy. " "Each table defines all persistent states of the class, including the " "inherited state. In Hibernate, it is not necessary to explicitly map such " -"inheritance hierarchies. You can map each class with a separate <" -"class> declaration. However, if you wish use polymorphic " -"associations (e.g. an association to the superclass of your hierarchy), you " -"need to use the <union-subclass> mapping. For " -"example:" +"inheritance hierarchies. You can map each class as a separate entity root. " +"However, if you wish use polymorphic associations (e.g. an association to " +"the superclass of your hierarchy), you need to use the union subclass " +"mapping." msgstr "" "Une troisième option est de mapper uniquement les classes concrètes d'une " "hiérarchie d'héritage vers des tables, (stratégie de type table-per-concrete-" @@ -3104,7 +5497,48 @@ msgstr "" "hiérarchie), vous devez utiliser le mappage <union-subclass>. Par exemple :" +#. Tag: programlisting +#: basic_mapping.xml:2701 +#, no-c-format +msgid "" +"@Entity\n" +"@Inheritance(strategy = InheritanceType.TABLE_PER_CLASS)\n" +"public class Flight implements Serializable { ... }" +msgstr "" + #. Tag: para +#: basic_mapping.xml:2703 +#, no-c-format +msgid "Or in hbm.xml:" +msgstr "" + +#. Tag: programlisting +#: basic_mapping.xml:2716 +#, no-c-format +msgid "" +"<union-subclass\n" +" name=\"ClassName\"\n" +" table=\"tablename\"\n" +" proxy=\"ProxyInterface\"\n" +" lazy=\"true|false\"\n" +" dynamic-update=\"true|false\"\n" +" dynamic-insert=\"true|false\"\n" +" schema=\"schema\"\n" +" catalog=\"catalog\"\n" +" extends=\"SuperclassName\"\n" +" abstract=\"true|false\"\n" +" persister=\"ClassName\"\n" +" subselect=\"SQL expression\"\n" +" entity-name=\"EntityName\"\n" +" node=\"element-name\">\n" +"\n" +" <property .... />\n" +" .....\n" +"</union-subclass>" +msgstr "" + +#. Tag: para +#: basic_mapping.xml:2743 #, no-c-format msgid "" "No discriminator column or key column is required for this mapping strategy." @@ -3113,27 +5547,390 @@ msgstr "" "stratégie de mappage." #. Tag: title +#: basic_mapping.xml:2751 #, no-c-format -msgid "Join" -msgstr "Join" +msgid "Inherit properties from superclasses" +msgstr "" #. Tag: para +#: basic_mapping.xml:2753 #, no-c-format msgid "" -"Using the <join> element, it is possible to map " -"properties of one class to several tables that have a one-to-one " -"relationship. For example:" +"This is sometimes useful to share common properties through a technical or a " +"business superclass without including it as a regular mapped entity (ie no " +"specific table for this entity). For that purpose you can map them as " +"@MappedSuperclass." +msgstr "" + +#. Tag: programlisting +#: basic_mapping.xml:2758 +#, no-c-format +msgid "" +"@MappedSuperclass\n" +"public class BaseEntity {\n" +" @Basic\n" +" @Temporal(TemporalType.TIMESTAMP)\n" +" public Date getLastUpdate() { ... }\n" +" public String getLastUpdater() { ... }\n" +" ...\n" +"}\n" +"\n" +"@Entity class Order extends BaseEntity {\n" +" @Id public Integer getId() { ... }\n" +" ...\n" +"}" msgstr "" -"En utilisant l'élément <join>, il est possible de " -"mapper des propriétés d'une classe sur plusieurs tables quand il existe une " -"relation un-à-un entre les tables. Par exemple :" #. Tag: para +#: basic_mapping.xml:2760 +#, no-c-format +msgid "" +"In database, this hierarchy will be represented as an Order table having the id, lastUpdate and lastUpdater columns. The embedded superclass " +"property mappings are copied into their entity subclasses. Remember that the " +"embeddable superclass is not the root of the hierarchy though." +msgstr "" + +#. Tag: para +#: basic_mapping.xml:2768 +#, no-c-format +msgid "" +"Properties from superclasses not mapped as @MappedSuperclass are ignored." +msgstr "" + +#. Tag: para +#: basic_mapping.xml:2773 +#, no-c-format +msgid "" +"The default access type (field or methods) is used, unless you use the " +"@Access annotation." +msgstr "" + +#. Tag: para +#: basic_mapping.xml:2778 +#, no-c-format +msgid "" +"The same notion can be applied to @Embeddable objects to " +"persist properties from their superclasses. You also need to use " +"@MappedSuperclass to do that (this should not be " +"considered as a standard EJB3 feature though)" +msgstr "" + +#. Tag: para +#: basic_mapping.xml:2786 +#, no-c-format +msgid "" +"It is allowed to mark a class as @MappedSuperclass in the " +"middle of the mapped inheritance hierarchy." +msgstr "" + +#. Tag: para +#: basic_mapping.xml:2792 +#, no-c-format +msgid "" +"Any class in the hierarchy non annotated with @MappedSuperclass nor @Entity will be ignored." +msgstr "" + +#. Tag: para +#: basic_mapping.xml:2797 +#, no-c-format +msgid "" +"You can override columns defined in entity superclasses at the root entity " +"level using the @AttributeOverride annotation." +msgstr "" + +#. Tag: programlisting +#: basic_mapping.xml:2801 +#, no-c-format +msgid "" +"@MappedSuperclass\n" +"public class FlyingObject implements Serializable {\n" +"\n" +" public int getAltitude() {\n" +" return altitude;\n" +" }\n" +"\n" +" @Transient\n" +" public int getMetricAltitude() {\n" +" return metricAltitude;\n" +" }\n" +"\n" +" @ManyToOne\n" +" public PropulsionType getPropulsion() {\n" +" return metricAltitude;\n" +" }\n" +" ...\n" +"}\n" +"\n" +"@Entity\n" +"@AttributeOverride( name=\"altitude\", column = @Column(name=\"fld_altitude" +"\") )\n" +"@AssociationOverride( \n" +" name=\"propulsion\", \n" +" joinColumns = @JoinColumn(name=\"fld_propulsion_fk\") \n" +")\n" +"public class Plane extends FlyingObject {\n" +" ...\n" +"}" +msgstr "" + +#. Tag: para +#: basic_mapping.xml:2803 +#, no-c-format +msgid "" +"The altitude property will be persisted in an " +"fld_altitude column of table Plane and " +"the propulsion association will be materialized in a " +"fld_propulsion_fk foreign key column." +msgstr "" + +#. Tag: para +#: basic_mapping.xml:2809 +#, no-c-format +msgid "" +"You can define @AttributeOverride(s) and " +"@AssociationOverride(s) on @Entity " +"classes, @MappedSuperclass classes and properties " +"pointing to an @Embeddable object." +msgstr "" + +#. Tag: para +#: basic_mapping.xml:2815 +#, no-c-format +msgid "" +"In hbm.xml, simply map the properties of the superclass in the <" +"class> element of the entity that needs to inherit them." +msgstr "" + +#. Tag: title +#: basic_mapping.xml:2821 +#, no-c-format +msgid "Mapping one entity to several tables" +msgstr "" + +#. Tag: para +#: basic_mapping.xml:2823 +#, no-c-format +msgid "" +"While not recommended for a fresh schema, some legacy databases force your " +"to map a single entity on several tables." +msgstr "" + +#. Tag: para +#: basic_mapping.xml:2826 +#, no-c-format +msgid "" +"Using the @SecondaryTable or @SecondaryTables class level annotations. To express that a column is in a " +"particular table, use the table parameter of " +"@Column or @JoinColumn." +msgstr "" + +#. Tag: programlisting +#: basic_mapping.xml:2832 +#, no-c-format +msgid "" +"@Entity\n" +"@Table(name=\"MainCat\")\n" +"@SecondaryTables({\n" +" @SecondaryTable(name=\"Cat1\", pkJoinColumns={\n" +" @PrimaryKeyJoinColumn(name=\"cat_id\", referencedColumnName=\"id\")\n" +" ),\n" +" @SecondaryTable(name=\"Cat2\", uniqueConstraints={@UniqueConstraint" +"(columnNames={\"storyPart2\"})})\n" +"})\n" +"public class Cat implements Serializable {\n" +"\n" +" private Integer id;\n" +" private String name;\n" +" private String storyPart1;\n" +" private String storyPart2;\n" +"\n" +" @Id @GeneratedValue\n" +" public Integer getId() {\n" +" return id;\n" +" }\n" +"\n" +" public String getName() {\n" +" return name;\n" +" }\n" +" \n" +" @Column(table=\"Cat1\")\n" +" public String getStoryPart1() {\n" +" return storyPart1;\n" +" }\n" +"\n" +" @Column(table=\"Cat2\")\n" +" public String getStoryPart2() {\n" +" return storyPart2;\n" +" }\n" +"}" +msgstr "" + +#. Tag: para +#: basic_mapping.xml:2834 +#, no-c-format +msgid "" +"In this example, name will be in MainCat. storyPart1 will be in Cat1 " +"and storyPart2 will be in Cat2. " +"Cat1 will be joined to MainCat using " +"the cat_id as a foreign key, and Cat2 " +"using id (ie the same column name, the MainCat id column has). Plus a unique constraint on storyPart2 has been set." +msgstr "" + +#. Tag: para +#: basic_mapping.xml:2844 +#, no-c-format +msgid "" +"There is also additional tuning accessible via the @org.hibernate." +"annotations.Table annotation:" +msgstr "" + +#. Tag: para +#: basic_mapping.xml:2850 +#, fuzzy, no-c-format +msgid "" +"fetch: If set to JOIN, the default, Hibernate will use an " +"inner join to retrieve a secondary table defined by a class or its " +"superclasses and an outer join for a secondary table defined by a subclass. " +"If set to SELECT then Hibernate will use a sequential " +"select for a secondary table defined on a subclass, which will be issued " +"only if a row turns out to represent an instance of the subclass. Inner " +"joins will still be used to retrieve a secondary defined by the class and " +"its superclasses." +msgstr "" +"fetch (optionnel - par défaut à join) : si positionné à join, Hibernate utilisera une " +"jointure interne pour charger une jointure définie par " +"une classe ou ses super-classes et une jointure externe pour une " +"<jointure> définie par une sous-classe. Si " +"positionné à select, Hibernate utilisera un select " +"séquentiel pour une <jointure> définie sur une sous-" +"classe, qui ne sera délivrée que si une ligne représente une instance de la " +"sous-classe. Les jointures internes seront quand même utilisées pour charger " +"une <jointure> définie par une classe et ses super-" +"classes. " + +#. Tag: para +#: basic_mapping.xml:2862 +#, fuzzy, no-c-format +msgid "" +"inverse: If true, Hibernate will not try to insert or " +"update the properties defined by this join. Default to false." +msgstr "" +"inverse (optionnel - par défaut à false) : si positionné à true, Hibernate n'essaiera pas d'insérer ou de " +"mettre à jour les propriétés définies par cette jointure. " + +#. Tag: para +#: basic_mapping.xml:2868 +#, fuzzy, no-c-format +msgid "" +"optional: If enabled (the default), Hibernate will insert " +"a row only if the properties defined by this join are non-null and will " +"always use an outer join to retrieve the properties." +msgstr "" +"optionnel (optionnel - par défaut à false) : si positionné à true, Hibernate insèrera une ligne seulement si " +"les propriétés définies par cette jointure sont non-nulles et utilisera " +"toujours une jointure externe pour extraire les propriétés. " + +#. Tag: para +#: basic_mapping.xml:2875 +#, no-c-format +msgid "" +"foreignKey: defines the Foreign Key name of a secondary " +"table pointing back to the primary table." +msgstr "" + +#. Tag: para +#: basic_mapping.xml:2880 +#, no-c-format +msgid "" +"Make sure to use the secondary table name in the appliesto property" +msgstr "" + +#. Tag: programlisting +#: basic_mapping.xml:2883 +#, no-c-format +msgid "" +"@Entity\n" +"@Table(name=\"MainCat\")\n" +"@SecondaryTable(name=\"Cat1\")\n" +"@org.hibernate.annotations.Table(\n" +" appliesTo=\"Cat1\",\n" +" fetch=FetchMode.SELECT,\n" +" optional=true)\n" +"public class Cat implements Serializable {\n" +"\n" +" private Integer id;\n" +" private String name;\n" +" private String storyPart1;\n" +" private String storyPart2;\n" +"\n" +" @Id @GeneratedValue\n" +" public Integer getId() {\n" +" return id;\n" +" }\n" +"\n" +" public String getName() {\n" +" return name;\n" +" }\n" +" \n" +" @Column(table=\"Cat1\")\n" +" public String getStoryPart1() {\n" +" return storyPart1;\n" +" }\n" +"\n" +" @Column(table=\"Cat2\")\n" +" public String getStoryPart2() {\n" +" return storyPart2;\n" +" }\n" +"}" +msgstr "" + +#. Tag: para +#: basic_mapping.xml:2885 +#, fuzzy, no-c-format +msgid "In hbm.xml, use the <join> element." +msgstr "" +"Par exemple, si nous avons le mappage de <properties> suivant : " + +#. Tag: programlisting +#: basic_mapping.xml:2903 +#, no-c-format +msgid "" +"<join\n" +" table=\"tablename\"\n" +" schema=\"owner\"\n" +" catalog=\"catalog\"\n" +" fetch=\"join|select\"\n" +" inverse=\"true|false\"\n" +" optional=\"true|false\">\n" +"\n" +" <key ... />\n" +"\n" +" <property ... />\n" +" ...\n" +"</join>" +msgstr "" + +#. Tag: para +#: basic_mapping.xml:2907 #, no-c-format msgid "table: the name of the joined table." msgstr "table : le nom de la table jointe. " #. Tag: para +#: basic_mapping.xml:2924 #, no-c-format msgid "" "fetch (optional - defaults to join): " @@ -3159,6 +5956,7 @@ msgstr "" "classes. " #. Tag: para +#: basic_mapping.xml:2939 #, no-c-format msgid "" "inverse (optional - defaults to falseoptional (optional - defaults to false<key> element has featured a few times within " +"To link one entity to an other, you need to map the association property as " +"a to one association. In the relational model, you can either use a foreign " +"key or an association table, or (a bit less common) share the same primary " +"key value between the two entities." +msgstr "" + +#. Tag: para +#: basic_mapping.xml:2974 +#, no-c-format +msgid "" +"To mark an association, use either @ManyToOne or " +"@OnetoOne." +msgstr "" + +#. Tag: para +#: basic_mapping.xml:2978 +#, no-c-format +msgid "" +"@ManyToOne and @OneToOne have a " +"parameter named targetEntity which describes the target " +"entity name. You usually don't need this parameter since the default value " +"(the type of the property that stores the association) is good in almost all " +"cases. However this is useful when you want to use interfaces as the return " +"type instead of the regular entity." +msgstr "" + +#. Tag: para +#: basic_mapping.xml:2985 +#, no-c-format +msgid "" +"Setting a value of the cascade attribute to any " +"meaningful value other than nothing will propagate certain operations to the " +"associated object. The meaningful values are divided into three categories." +msgstr "" + +#. Tag: para +#: basic_mapping.xml:2992 +#, no-c-format +msgid "" +"basic operations, which include: persist, merge, delete, save-" +"update, evict, replicate, lock and refresh;" +msgstr "" + +#. Tag: para +#: basic_mapping.xml:2998 +#, fuzzy, no-c-format +msgid "" +"special values: delete-orphan or all ;" +msgstr "" +"Remarquez comment les associations sont désormais spécifiées en utilisant " +"entity-name au lieu de class. " + +#. Tag: para +#: basic_mapping.xml:3003 +#, no-c-format +msgid "" +"comma-separated combinations of operation names: cascade=\"persist," +"merge,evict\" or cascade=\"all,delete-orphan\". " +"See for a full explanation. Note " +"that single valued many-to-one associations do not support orphan delete." +msgstr "" + +#. Tag: para +#: basic_mapping.xml:3012 +#, no-c-format +msgid "" +"By default, single point associations are eagerly fetched in JPA 2. You can " +"mark it as lazily fetched by using @ManyToOne(fetch=FetchType." +"LAZY) in which case Hibernate will proxy the association and " +"load it when the state of the associated entity is reached. You can force " +"Hibernate not to use a proxy by using @LazyToOne(NO_PROXY). In this case, the property is fetched lazily when the instance " +"variable is first accessed. This requires build-time bytecode " +"instrumentation. lazy=\"false\" specifies that the association will always " +"be eagerly fetched." +msgstr "" + +#. Tag: para +#: basic_mapping.xml:3022 +#, no-c-format +msgid "" +"With the default JPA options, single-ended associations are loaded with a " +"subsequent select if set to LAZY, or a SQL JOIN is used " +"for EAGER associations. You can however adjust the " +"fetching strategy, ie how data is fetched by using @Fetch. FetchMode can be SELECT (a " +"select is triggered when the association needs to be loaded) or " +"JOIN (use a SQL JOIN to load the association while " +"loading the owner entity). JOIN overrides any lazy " +"attribute (an association loaded through a JOIN strategy " +"cannot be lazy)." +msgstr "" + +#. Tag: title +#: basic_mapping.xml:3034 +#, fuzzy, no-c-format +msgid "Using a foreign key or an association table" +msgstr "association par clé étrangère unique" + +#. Tag: para +#: basic_mapping.xml:3036 +#, fuzzy, no-c-format +msgid "An ordinary association to another persistent class is declared using a" +msgstr "" +"Une association un-à-un vers une autre classe persistante est déclarée avec " +"l'élément one-to-one." + +#. Tag: para +#: basic_mapping.xml:3041 +#, no-c-format +msgid "" +"@ManyToOne if several entities can point to the the " +"target entity" +msgstr "" + +#. Tag: para +#: basic_mapping.xml:3046 +#, no-c-format +msgid "" +"@OneToOne if only a single entity can point to the " +"the target entity" +msgstr "" + +#. Tag: para +#: basic_mapping.xml:3051 +#, no-c-format +msgid "" +"and a foreign key in one table is referencing the primary key column(s) of " +"the target table." +msgstr "" + +#. Tag: programlisting +#: basic_mapping.xml:3054 +#, no-c-format +msgid "" +"@Entity\n" +"public class Flight implements Serializable {\n" +" @ManyToOne( cascade = {CascadeType.PERSIST, CascadeType.MERGE} )\n" +" @JoinColumn(name=\"COMP_ID\")\n" +" public Company getCompany() {\n" +" return company;\n" +" }\n" +" ...\n" +"}" +msgstr "" + +#. Tag: para +#: basic_mapping.xml:3056 +#, no-c-format +msgid "" +"The @JoinColumn attribute is optional, the default value" +"(s) is the concatenation of the name of the relationship in the owner side, " +"_ (underscore), and the name of the primary key column in " +"the owned side. In this example company_id because the " +"property name is company and the column id of Company is " +"id." +msgstr "" + +#. Tag: programlisting +#: basic_mapping.xml:3064 +#, no-c-format +msgid "" +"@Entity\n" +"public class Flight implements Serializable {\n" +" @ManyToOne( cascade = {CascadeType.PERSIST, CascadeType.MERGE}, " +"targetEntity=CompanyImpl.class )\n" +" @JoinColumn(name=\"COMP_ID\")\n" +" public Company getCompany() {\n" +" return company;\n" +" }\n" +" ...\n" +"}\n" +"\n" +"public interface Company {\n" +" ...\n" +"}" +msgstr "" + +#. Tag: para +#: basic_mapping.xml:3066 +#, no-c-format +msgid "" +"You can also map a to one association through an association table. This " +"association table described by the @JoinTable annotation " +"will contains a foreign key referencing back the entity table (through " +"@JoinTable.joinColumns) and a a foreign key referencing " +"the target entity table (through @JoinTable.inverseJoinColumns)." +msgstr "" + +#. Tag: programlisting +#: basic_mapping.xml:3074 +#, no-c-format +msgid "" +"@Entity\n" +"public class Flight implements Serializable {\n" +" @ManyToOne( cascade = {CascadeType.PERSIST, CascadeType.MERGE} )\n" +" @JoinTable(name=\"Flight_Company\",\n" +" joinColumns = @JoinColumn(name=\"FLIGHT_ID\"),\n" +" inverseJoinColumns = @JoinColumn(name=\"COMP_ID\")\n" +" )\n" +" public Company getCompany() {\n" +" return company;\n" +" }\n" +" ...\n" +"}" +msgstr "" + +#. Tag: para +#: basic_mapping.xml:3077 +#, no-c-format +msgid "" +"You can use a SQL fragment to simulate a physical join column using the " +"@JoinColumnOrFormula / " +"@JoinColumnOrformulas annotations (just like you can " +"use a SQL fragment to simulate a property column via the " +"@Formula annotation)." +msgstr "" + +#. Tag: programlisting +#: basic_mapping.xml:3083 +#, no-c-format +msgid "" +"@Entity\n" +"public class Ticket implements Serializable {\n" +" @ManyToOne\n" +" @JoinColumnOrFormula(formula=\"(firstname + ' ' + lastname)\")\n" +" public Person getOwner() {\n" +" return person;\n" +" }\n" +" ...\n" +"}" +msgstr "" + +#. Tag: para +#: basic_mapping.xml:3086 +#, no-c-format +msgid "" +"You can mark an association as mandatory by using the " +"optional=false attribute. We recommend to use Bean " +"Validation's @NotNull annotation as a better " +"alternative however. As a consequence, the foreign key column(s) will be " +"marked as not nullable (if possible)." +msgstr "" + +#. Tag: para +#: basic_mapping.xml:3092 +#, no-c-format +msgid "" +"When Hibernate cannot resolve the association because the expected " +"associated element is not in database (wrong id on the association column), " +"an exception is raised. This might be inconvenient for legacy and badly " +"maintained schemas. You can ask Hibernate to ignore such elements instead of " +"raising an exception using the @NotFound annotation." +msgstr "" + +#. Tag: title +#: basic_mapping.xml:3100 +#, no-c-format +msgid "@NotFound annotation" +msgstr "" + +#. Tag: programlisting +#: basic_mapping.xml:3102 +#, no-c-format +msgid "" +"@Entity\n" +"public class Child {\n" +" ...\n" +" @ManyToOne\n" +" @NotFound(action=NotFoundAction.IGNORE)\n" +" public Parent getParent() { ... }\n" +" ...\n" +"}" +msgstr "" + +#. Tag: para +#: basic_mapping.xml:3105 +#, no-c-format +msgid "" +"Sometimes you want to delegate to your database the deletion of cascade when " +"a given entity is deleted. In this case Hibernate generates a cascade delete " +"constraint at the database level." +msgstr "" + +#. Tag: title +#: basic_mapping.xml:3110 +#, no-c-format +msgid "@OnDelete annotation" +msgstr "" + +#. Tag: programlisting +#: basic_mapping.xml:3112 +#, no-c-format +msgid "" +"@Entity\n" +"public class Child {\n" +" ...\n" +" @ManyToOne\n" +" @OnDelete(action=OnDeleteAction.CASCADE)\n" +" public Parent getParent() { ... }\n" +" ...\n" +"}" +msgstr "" + +#. Tag: para +#: basic_mapping.xml:3115 +#, no-c-format +msgid "" +"Foreign key constraints, while generated by Hibernate, have a fairly " +"unreadable name. You can override the constraint name using " +"@ForeignKey." +msgstr "" + +#. Tag: title +#: basic_mapping.xml:3120 +#, fuzzy, no-c-format +msgid "@ForeignKey annotation" +msgstr "association par clé étrangère unique" + +#. Tag: programlisting +#: basic_mapping.xml:3122 +#, no-c-format +msgid "" +"@Entity\n" +"public class Child {\n" +" ...\n" +" @ManyToOne\n" +" @ForeignKey(name=\"FK_PARENT\")\n" +" public Parent getParent() { ... }\n" +" ...\n" +"}\n" +"\n" +"alter table Child add constraint FK_PARENT foreign key (parent_id) " +"references Parent" +msgstr "" + +#. Tag: para +#: basic_mapping.xml:3125 +#, no-c-format +msgid "" +"Sometimes, you want to link one entity to an other not by the target entity " +"primary key but by a different unique key. You can achieve that by " +"referencing the unique key column(s) in @JoinColumn." +"referenceColumnName." +msgstr "" + +#. Tag: programlisting +#: basic_mapping.xml:3130 basic_mapping.xml:3682 +#, no-c-format +msgid "" +"@Entity\n" +"class Person {\n" +" @Id Integer personNumber;\n" +" String firstName;\n" +" @Column(name=\"I\")\n" +" String initial;\n" +" String lastName;\n" +"}\n" +"\n" +"@Entity\n" +"class Home {\n" +" @ManyToOne\n" +" @JoinColumns({\n" +" @JoinColumn(name=\"first_name\", referencedColumnName=\"firstName\"),\n" +" @JoinColumn(name=\"init\", referencedColumnName=\"I\"),\n" +" @JoinColumn(name=\"last_name\", referencedColumnName=\"lastName\"),\n" +" })\n" +" Person owner\n" +"}" +msgstr "" + +#. Tag: para +#: basic_mapping.xml:3132 +#, no-c-format +msgid "" +"This is not encouraged however and should be reserved to legacy mappings." +msgstr "" + +#. Tag: para +#: basic_mapping.xml:3135 +#, no-c-format +msgid "" +"In hbm.xml, mapping an association is similar. The main difference is that a " +"@OneToOne is mapped as <many-to-one " +"unique=\"true\"/>, let's dive into the subject." +msgstr "" + +#. Tag: programlisting +#: basic_mapping.xml:3177 +#, no-c-format +msgid "" +"<many-to-one\n" +" name=\"propertyName\"\n" +" column=\"column_name\"\n" +" class=\"ClassName\"\n" +" cascade=\"cascade_style\"\n" +" fetch=\"join|select\"\n" +" update=\"true|false\"\n" +" insert=\"true|false\"\n" +" property-ref=\"propertyNameFromAssociatedClass\"\n" +" access=\"field|property|ClassName\"\n" +" unique=\"true|false\"\n" +" not-null=\"true|false\"\n" +" optimistic-lock=\"true|false\"\n" +" lazy=\"proxy|no-proxy|false\"\n" +" not-found=\"ignore|exception\"\n" +" entity-name=\"EntityName\"\n" +" formula=\"arbitrary SQL expression\"\n" +" node=\"element-name|@attribute-name|element/@attribute|.\"\n" +" embed-xml=\"true|false\"\n" +" index=\"index_name\"\n" +" unique_key=\"unique_key_id\"\n" +" foreign-key=\"foreign_key_name\"\n" +"/>" +msgstr "" + +#. Tag: para +#: basic_mapping.xml:3185 basic_mapping.xml:3868 +#, no-c-format +msgid "" +"column (optional): the name of the foreign key column. " +"This can also be specified by nested <column> " +"element(s)." +msgstr "" +"column (optionnel) : le nom de la colonne de la clé " +"étrangère. Cela peut être aussi spécifié par un ou des sous-élément(s) " +"<column>. " + +#. Tag: para +#: basic_mapping.xml:3191 basic_mapping.xml:3385 +#, no-c-format +msgid "" +"class (optional - defaults to the property type " +"determined by reflection): the name of the associated class." +msgstr "" +"class (optionnel - par défaut, le type de la propriété " +"déterminé par réflexion) : le nom de la classe associée. " + +#. Tag: para +#: basic_mapping.xml:3197 basic_mapping.xml:3391 +#, no-c-format +msgid "" +"cascade (optional): specifies which operations should be " +"cascaded from the parent object to the associated object." +msgstr "" +"cascade (optionnel) : indique quelles opérations doivent " +"être cascadées de l'objet parent vers l'objet associé. " + +#. Tag: para +#: basic_mapping.xml:3203 basic_mapping.xml:3407 +#, no-c-format +msgid "" +"fetch (optional - defaults to select): " +"chooses between outer-join fetching or sequential select fetching." +msgstr "" +"fetch (optionnel - par défaut à select) : choisit entre le chargement de type jointure externe (outer-" +"join) ou le chargement par select successifs." + +#. Tag: para +#: basic_mapping.xml:3209 +#, no-c-format +msgid "" +"update, insert (optional - defaults to true): specifies that the mapped columns should be included in SQL " +"UPDATE and/or INSERT statements. " +"Setting both to false allows a pure \"derived\" " +"association whose value is initialized from another property that maps to " +"the same column(s), or by a trigger or other application." +msgstr "" +"update, insert (optionnel - par défaut à true) : indique que les colonnes mappées devraient être incluses dans " +"des SQL UPDATE et/ou des déclarations INSERT. Mettre les deux à false, permet une association " +"pure dérivée dont la valeur est initialisée à partir d'une autre propriété " +"qui mappe à une ou plusieurs mêmes colonnes, ou par un trigger ou une autre " +"application. " + +#. Tag: para +#: basic_mapping.xml:3219 +#, no-c-format +msgid "" +"property-ref (optional): the name of a property of the " +"associated class that is joined to this foreign key. If not specified, the " +"primary key of the associated class is used." +msgstr "" +"property-ref (optionnel) : le nom d'une propriété de la " +"classe associée qui est jointe à cette clé étrangère. Si non-spécifiée, la " +"clé primaire de la classe associée est utilisée. " + +#. Tag: para +#: basic_mapping.xml:3232 +#, no-c-format +msgid "" +"unique (optional): enables the DDL generation of a unique " +"constraint for the foreign-key column. By allowing this to be the target of " +"a property-ref, you can make the association multiplicity " +"one-to-one." +msgstr "" +"unique (optionnel) : génère le DDL d'une contrainte " +"unique pour la clé étrangère. Permet aussi d'en faire la cible d'une " +"property-ref. Cela permet de créer une véritable " +"association un-à-un. " + +#. Tag: para +#: basic_mapping.xml:3240 +#, no-c-format +msgid "" +"not-null (optional): enables the DDL generation of a " +"nullability constraint for the foreign key columns." +msgstr "" +"not-null (optionnel) : active le DDL d'une contrainte de " +"nullité pour les colonnes de clés étrangères." + +#. Tag: para +#: basic_mapping.xml:3254 +#, no-c-format +msgid "" +"lazy (optional - defaults to proxy): " +"by default, single point associations are proxied. lazy=\"no-proxy" +"\" specifies that the property should be fetched lazily when the " +"instance variable is first accessed. This requires build-time bytecode " +"instrumentation. lazy=\"false\" specifies that the " +"association will always be eagerly fetched." +msgstr "" +"lazy (optionnel - par défaut à proxy) : par défaut, les associations de point uniques utilisent des " +"proxies. lazy=\"no-proxy\" indique que cette propriété " +"doit être chargée en différé au premier accès à la variable d'instance " +"(nécessite une instrumentation du bytecode lors de la phase de " +"construction). lazy=\"false\" indique que l'association " +"sera toujours chargée." + +#. Tag: para +#: basic_mapping.xml:3264 +#, no-c-format +msgid "" +"not-found (optional - defaults to exception): specifies how foreign keys that reference missing rows will be " +"handled. ignore will treat a missing row as a null " +"association." +msgstr "" +"not-found (optionnel - par défaut = exception) : spécifie comment les clés étrangères qui référencent des lignes " +"manquantes seront gérées : ignore traitera une ligne " +"manquante comme une association nulle. " + +#. Tag: para +#: basic_mapping.xml:3272 basic_mapping.xml:3448 +#, no-c-format +msgid "" +"entity-name (optional): the entity name of the associated " +"class." +msgstr "" +"entity-name (optionnel) : le nom de l'entité de la classe " +"associée. " + +#. Tag: para +#: basic_mapping.xml:3277 +#, no-c-format +msgid "" +"formula (optional): an SQL expression that defines the " +"value for a computed foreign key." +msgstr "" +"formula (optionnel) : une expression SQL qui définit la " +"valeur pour une clé étrangère calculée. " + +#. Tag: para +#: basic_mapping.xml:3284 +#, fuzzy, no-c-format +msgid "" +"Setting a value of the cascade attribute to any " +"meaningful value other than none will propagate certain " +"operations to the associated object. The meaningful values are divided into " +"three categories. First, basic operations, which include: persist, " +"merge, delete, save-update, evict, replicate, lock and refresh; " +"second, special values: delete-orphan; and third," +"all comma-separated combinations of operation names: " +"cascade=\"persist,merge,evict\" or cascade=\"all," +"delete-orphan\". See " +"for a full explanation. Note that single valued, many-to-one and one-to-one, " +"associations do not support orphan delete." +msgstr "" +"Donner une valeur significative à l'attribut cascade " +"autre que none propagera certaines opérations à l'objet " +"associé. Les valeurs significatives sont les noms des opérations et sont " +"divisées en trois catégories. Tout d'abord, les valeurs Hibernate basiques, " +"persist, merge, delete, save-update, evict, replicate, lock, " +"refresh, puis les valeurs spéciales delete-orphan et all et enfin, des combinaisons de noms " +"d'opérations séparées par des virgules, comme par exemple cascade=" +"\"persist,merge,evict\" ou cascade=\"all,delete-orphan\". Consultez la pour une " +"explication complète. Notez que des associations valuées uniques " +"(associations plusieurs-à-un et un-à-un) ne supportent pas orphan delete. " + +#. Tag: para +#: basic_mapping.xml:3298 +#, no-c-format +msgid "" +"Here is an example of a typical many-to-one declaration:" +msgstr "" +"Une déclaration many-to-one typique est aussi simple " +"que : " + +#. Tag: programlisting +#: basic_mapping.xml:3301 +#, no-c-format +msgid "" +"<many-to-one name=\"product\" class=\"Product\" column=\"PRODUCT_ID\"/>" +msgstr "" + +#. Tag: para +#: basic_mapping.xml:3303 +#, no-c-format +msgid "" +"The property-ref attribute should only be used for " +"mapping legacy data where a foreign key refers to a unique key of the " +"associated table other than the primary key. This is a complicated and " +"confusing relational model. For example, if the Product " +"class had a unique serial number that is not the primary key. The " +"unique attribute controls Hibernate's DDL generation with " +"the SchemaExport tool." +msgstr "" +"L'attribut property-ref devrait être utilisé pour mapper " +"seulement des données provenant d'un ancien système où les clés étrangères " +"font référence à une clé unique de la table associée et qui n'est pas la clé " +"primaire. C'est un cas de mauvaise conception relationnelle. Par exemple, " +"supposez que la classe Product ait un numéro de série " +"unique qui n'est pas la clé primaire. L'attribut unique " +"contrôle la génération DDL par Hibernate avec l'outil SchemaExport." + +#. Tag: programlisting +#: basic_mapping.xml:3311 +#, no-c-format +msgid "" +"<property name=\"serialNumber\" unique=\"true\" type=\"string\" column=" +"\"SERIAL_NUMBER\"/>" +msgstr "" + +#. Tag: para +#: basic_mapping.xml:3313 +#, no-c-format +msgid "Then the mapping for OrderItem might use:" +msgstr "Ainsi le mappage pour OrderItem peut utiliser :" + +#. Tag: programlisting +#: basic_mapping.xml:3316 +#, no-c-format +msgid "" +"<many-to-one name=\"product\" property-ref=\"serialNumber\" column=" +"\"PRODUCT_SERIAL_NUMBER\"/>" +msgstr "" + +#. Tag: para +#: basic_mapping.xml:3318 +#, no-c-format +msgid "This is not encouraged, however." +msgstr "Bien que ce ne soit certainement pas encouragé." + +#. Tag: para +#: basic_mapping.xml:3320 +#, no-c-format +msgid "" +"If the referenced unique key comprises multiple properties of the associated " +"entity, you should map the referenced properties inside a named <" +"properties> element." +msgstr "" +"Si la clé unique référencée comprend des propriétés multiples de l'entité " +"associée, vous devez mapper ces propriétés à l'intérieur d'un élément nommé " +"<properties>. " + +#. Tag: para +#: basic_mapping.xml:3324 +#, no-c-format +msgid "" +"If the referenced unique key is the property of a component, you can specify " +"a property path:" +msgstr "" +"Si la clé unique référencée est la propriété d'un composant, vous pouvez " +"spécifier le chemin de propriété :" + +#. Tag: programlisting +#: basic_mapping.xml:3327 +#, no-c-format +msgid "" +"<many-to-one name=\"owner\" property-ref=\"identity.ssn\" column=" +"\"OWNER_SSN\"/>" +msgstr "" + +#. Tag: title +#: basic_mapping.xml:3331 +#, no-c-format +msgid "Sharing the primary key with the associated entity" +msgstr "" + +#. Tag: para +#: basic_mapping.xml:3333 +#, no-c-format +msgid "" +"The second approach is to ensure an entity and its associated entity share " +"the same primary key. In this case the primary key column is also a foreign " +"key and there is no extra column. These associations are always one to one." +msgstr "" + +#. Tag: title +#: basic_mapping.xml:3339 +#, fuzzy, no-c-format +msgid "One to One association" +msgstr "association par clé étrangère unique" + +#. Tag: programlisting +#: basic_mapping.xml:3341 +#, no-c-format +msgid "" +"@Entity\n" +"public class Body {\n" +" @Id\n" +" public Long getId() { return id; }\n" +"\n" +" @OneToOne(cascade = CascadeType.ALL)\n" +" @MapsId\n" +" public Heart getHeart() {\n" +" return heart;\n" +" }\n" +" ...\n" +"} \n" +"\n" +"@Entity\n" +"public class Heart {\n" +" @Id\n" +" public Long getId() { ...}\n" +"}" +msgstr "" + +#. Tag: para +#: basic_mapping.xml:3345 +#, no-c-format +msgid "" +"Many people got confused by these primary key based one to one associations. " +"They can only be lazily loaded if Hibernate knows that the other side of the " +"association is always present. To indicate to Hibernate that it is the case, " +"use @OneToOne(optional=false)." +msgstr "" + +#. Tag: para +#: basic_mapping.xml:3352 +#, no-c-format +msgid "In hbm.xml, use the following mapping." +msgstr "" + +#. Tag: programlisting +#: basic_mapping.xml:3377 +#, no-c-format +msgid "" +"<one-to-one\n" +" name=\"propertyName\"\n" +" class=\"ClassName\"\n" +" cascade=\"cascade_style\"\n" +" constrained=\"true|false\"\n" +" fetch=\"join|select\"\n" +" property-ref=\"propertyNameFromAssociatedClass\"\n" +" access=\"field|property|ClassName\"\n" +" formula=\"any SQL expression\"\n" +" lazy=\"proxy|no-proxy|false\"\n" +" entity-name=\"EntityName\"\n" +" node=\"element-name|@attribute-name|element/@attribute|.\"\n" +" embed-xml=\"true|false\"\n" +" foreign-key=\"foreign_key_name\"\n" +"/>" +msgstr "" + +#. Tag: para +#: basic_mapping.xml:3397 +#, no-c-format +msgid "" +"constrained (optional): specifies that a foreign key " +"constraint on the primary key of the mapped table and references the table " +"of the associated class. This option affects the order in which save" +"() and delete() are cascaded, and determines " +"whether the association can be proxied. It is also used by the schema export " +"tool." +msgstr "" +"constrained (optionnel) : indique qu'une contrainte de " +"clé étrangère sur la clé primaire de la table mappée référence la table de " +"la classe associée. Cette option affecte l'ordre dans lequel chaque " +"save() et chaque delete() est cascadé " +"et détermine si l'association peut utiliser un proxy (aussi utilisé par " +"l'outil SchemaExport). " + +#. Tag: para +#: basic_mapping.xml:3413 +#, no-c-format +msgid "" +"property-ref (optional): the name of a property of the " +"associated class that is joined to the primary key of this class. If not " +"specified, the primary key of the associated class is used." +msgstr "" +"property-ref (optionnel) : le nom de la propriété de la " +"classe associée qui est jointe à la clé primaire de cette classe. Si ce " +"n'est pas spécifié, la clé primaire de la classe associée est utilisée. " + +#. Tag: para +#: basic_mapping.xml:3426 +#, no-c-format +msgid "" +"formula (optional): almost all one-to-one associations " +"map to the primary key of the owning entity. If this is not the case, you " +"can specify another column, columns or expression to join on using an SQL " +"formula. See org.hibernate.test.onetooneformula for an " +"example." +msgstr "" +"formula (optionnel) : presque toutes les associations un-" +"à-un pointent sur la clé primaire de l'entité propriétaire. Dans les rares " +"cas différents, vous devez donner une ou plusieurs autres colonnes ou " +"expression à joindre par une formule SQL . Voir org.hibernate.test." +"onetooneformula pour un exemple." + +#. Tag: para +#: basic_mapping.xml:3435 +#, no-c-format +msgid "" +"lazy (optional - defaults to proxy): " +"by default, single point associations are proxied. lazy=\"no-proxy" +"\" specifies that the property should be fetched lazily when the " +"instance variable is first accessed. It requires build-time bytecode " +"instrumentation. lazy=\"false\" specifies that the " +"association will always be eagerly fetched. Note that if " +"constrained=\"false\", proxying is impossible and " +"Hibernate will eagerly fetch the association." +msgstr "" +"lazy (optionnel - par défaut proxy) : " +"par défaut, les associations simples sont soumises à proxy. lazy=" +"\"no-proxy\" spécifie que la propriété doit être chargée en " +"différé au premier accès à l'instance. (nécessite l'instrumentation du " +"bytecode à la construction). lazy=\"false\" indique que " +"l'association sera toujours chargée agressivement. . Notez que si " +"constrained=\"false\", l'utilisation de proxy est " +"impossible et Hibernate chargera automatiquement l'association ." + +#. Tag: para +#: basic_mapping.xml:3454 +#, no-c-format +msgid "" +"Primary key associations do not need an extra table column. If two rows are " +"related by the association, then the two table rows share the same primary " +"key value. To relate two objects by a primary key association, ensure that " +"they are assigned the same identifier value." +msgstr "" +"Les associations par clé primaire ne nécessitent pas une colonne " +"supplémentaire en table ; si deux lignes sont liées par l'association alors " +"les deux lignes de la table partagent la même valeur de clé primaire. Donc " +"si vous voulez que deux objets soient liés par une association par clé " +"primaire, vous devez faire en sorte qu'on leur assigne la même valeur " +"d'identifiant. " + +#. Tag: para +#: basic_mapping.xml:3460 +#, no-c-format +msgid "" +"For a primary key association, add the following mappings to " +"Employee and Person respectively:" +msgstr "" +"Pour une association par clé primaire, ajoutez les mappages suivants à " +"Employee et Person, respectivement :" + +#. Tag: programlisting +#: basic_mapping.xml:3464 +#, no-c-format +msgid "<one-to-one name=\"person\" class=\"Person\"/>" +msgstr "" + +#. Tag: programlisting +#: basic_mapping.xml:3466 +#, no-c-format +msgid "" +"<one-to-one name=\"employee\" class=\"Employee\" constrained=\"true\"/>" +msgstr "" + +#. Tag: para +#: basic_mapping.xml:3468 +#, no-c-format +msgid "" +"Ensure that the primary keys of the related rows in the PERSON and EMPLOYEE " +"tables are equal. You use a special Hibernate identifier generation strategy " +"called foreign:" +msgstr "" +"Maintenant, vous devez faire en sorte que les clés primaires des lignes " +"liées dans les tables PERSON et EMPLOYEE sont égales. On utilise une " +"stratégie Hibernate spéciale de génération d'identifiants appelée " +"foreign : " + +#. Tag: programlisting +#: basic_mapping.xml:3472 +#, no-c-format +msgid "" +"<class name=\"person\" table=\"PERSON\">\n" +" <id name=\"id\" column=\"PERSON_ID\">\n" +" <generator class=\"foreign\">\n" +" <param name=\"property\">employee</param>\n" +" </generator>\n" +" </id>\n" +" ...\n" +" <one-to-one name=\"employee\"\n" +" class=\"Employee\"\n" +" constrained=\"true\"/>\n" +"</class>" +msgstr "" + +#. Tag: para +#: basic_mapping.xml:3474 +#, no-c-format +msgid "" +"A newly saved instance of Person is assigned the same " +"primary key value as the Employee instance referred with " +"the employee property of that Person." +msgstr "" +"Une instance fraîchement enregistrée de Person se voit " +"alors assignée la même valeur de clé primaire que l'instance de " +"Employee référencée par la propriété employee de cette Person. " + +#. Tag: title +#: basic_mapping.xml:3482 +#, no-c-format +msgid "Natural-id" +msgstr "Natural-id" + +#. Tag: para +#: basic_mapping.xml:3484 +#, fuzzy, no-c-format +msgid "" +"Although we recommend the use of surrogate keys as primary keys, you should " +"try to identify natural keys for all entities. A natural key is a property " +"or combination of properties that is unique and non-null. It is also " +"immutable. Map the properties of the natural key as @NaturalId or map them inside the <natural-id> " +"element. Hibernate will generate the necessary unique key and nullability " +"constraints and, as a result, your mapping will be more self-documenting." +msgstr "" +"Bien que nous recommandions l'utilisation de clés primaires générées, vous " +"devriez toujours essayer d'identifier des clés métier (naturelles) pour " +"toutes vos entités. Une clé naturelle est une propriété ou une combinaison " +"de propriétés unique et non nulle. Si elle est aussi immuable, c'est encore " +"mieux. Mappez les propriétés de la clé naturelle dans l'élément <" +"natural-id>. Hibernate générera la clé unique nécessaire et les " +"contraintes de non-nullité, et votre mappage s'auto-documentera. " + +#. Tag: programlisting +#: basic_mapping.xml:3493 +#, no-c-format +msgid "" +"@Entity\n" +"public class Citizen {\n" +" @Id\n" +" @GeneratedValue\n" +" private Integer id;\n" +" private String firstname;\n" +" private String lastname;\n" +" \n" +" @NaturalId\n" +" @ManyToOne\n" +" private State state;\n" +"\n" +" @NaturalId\n" +" private String ssn;\n" +" ...\n" +"}\n" +"\n" +"\n" +"\n" +"//and later on query\n" +"List results = s.createCriteria( Citizen.class )\n" +" .add( Restrictions.naturalId().set( \"ssn\", \"1234\" ).set" +"( \"state\", ste ) )\n" +" .list();" +msgstr "" + +#. Tag: para +#: basic_mapping.xml:3495 +#, no-c-format +msgid "Or in XML," +msgstr "" + +#. Tag: programlisting +#: basic_mapping.xml:3497 +#, no-c-format +msgid "" +"<natural-id mutable=\"true|false\"/>\n" +" <property ... />\n" +" <many-to-one ... />\n" +" ......\n" +"</natural-id>" +msgstr "" + +#. Tag: para +#: basic_mapping.xml:3499 +#, no-c-format +msgid "" +"It is recommended that you implement equals() and " +"hashCode() to compare the natural key properties of the " +"entity." +msgstr "" +"Nous vous recommandons fortement d'implémenter equals() " +"et hashCode() pour comparer les propriétés clés " +"naturelles de l'entité." + +#. Tag: para +#: basic_mapping.xml:3503 +#, no-c-format +msgid "" +"This mapping is not intended for use with entities that have natural primary " +"keys." +msgstr "" +"Ce mappage n'est pas destiné à être utilisé avec des entités qui ont des " +"clés naturelles. " + +#. Tag: para +#: basic_mapping.xml:3508 +#, no-c-format +msgid "" +"mutable (optional - defaults to false): by default, natural identifier properties are assumed to be " +"immutable (constant)." +msgstr "" +"mutable (optionnel, par défaut à false) : par défaut, les identifiants naturels sont supposés être " +"immuables (constants). " + +#. Tag: title +#: basic_mapping.xml:3516 +#, fuzzy, no-c-format +msgid "Any" +msgstr "binary" + +#. Tag: para +#: basic_mapping.xml:3518 +#, fuzzy, no-c-format +msgid "" +"There is one more type of property mapping. The @Any " +"mapping defines a polymorphic association to classes from multiple tables. " +"This type of mapping requires more than one column. The first column " +"contains the type of the associated entity. The remaining columns contain " +"the identifier. It is impossible to specify a foreign key constraint for " +"this kind of association. This is not the usual way of mapping polymorphic " +"associations and you should use this only in special cases. For example, for " +"audit logs, user session data, etc." +msgstr "" +"Il existe encore un type de mappage de propriété. L'élément de mappage " +"<any> définit une association polymorphique vers " +"des classes de tables multiples. Ce type de mappage requiert toujours plus " +"d'une colonne. La première colonne contient le type de l'entité associée. " +"Les colonnes restantes contiennent l'identifiant. Il est impossible de " +"spécifier une contrainte de clé étrangère pour ce type d'association, donc " +"ce n'est certainement pas considéré comme le moyen habituel de mapper des " +"associations (polymorphiques). Ne doit être utilisé que dans des cas " +"particuliers (par exemple des logs d'audit, des données de session " +"utilisateur, etc...). " + +#. Tag: para +#: basic_mapping.xml:3528 +#, fuzzy, no-c-format +msgid "" +"The @Any annotation describes the column holding the " +"metadata information. To link the value of the metadata information and an " +"actual entity type, The @AnyDef and " +"@AnyDefs annotations are used. The metaType attribute allows the application to specify a custom type that maps " +"database column values to persistent classes that have identifier properties " +"of the type specified by idType. You must specify the " +"mapping from values of the metaType to class names." +msgstr "" +"L'attribut meta-type permet à l'application de spécifier " +"un type personnalisé qui mappe des valeurs de colonnes de base de données " +"sur des classes persistantes qui ont un attribut identifiant du type " +"spécifié par id-type. Vous devez spécifier le mappage à " +"partir de valeurs du méta-type sur les noms des classes. " + +#. Tag: programlisting +#: basic_mapping.xml:3538 +#, no-c-format +msgid "" +"@Any( metaColumn = @Column( name = \"property_type\" ), fetch=FetchType." +"EAGER )\n" +"@AnyMetaDef( \n" +" idType = \"integer\", \n" +" metaType = \"string\", \n" +" metaValues = {\n" +" @MetaValue( value = \"S\", targetEntity = StringProperty.class ),\n" +" @MetaValue( value = \"I\", targetEntity = IntegerProperty.class )\n" +" } )\n" +"@JoinColumn( name = \"property_id\" )\n" +"public Property getMainProperty() {\n" +" return mainProperty;\n" +"}" +msgstr "" + +#. Tag: para +#: basic_mapping.xml:3540 +#, no-c-format +msgid "" +"Note that @AnyDef can be mutualized and reused. It is " +"recommended to place it as a package metadata in this case." +msgstr "" + +#. Tag: programlisting +#: basic_mapping.xml:3544 +#, no-c-format +msgid "" +"//on a package\n" +"@AnyMetaDef( name=\"property\" \n" +" idType = \"integer\", \n" +" metaType = \"string\", \n" +" metaValues = {\n" +" @MetaValue( value = \"S\", targetEntity = StringProperty.class ),\n" +" @MetaValue( value = \"I\", targetEntity = IntegerProperty.class )\n" +" } )\n" +"package org.hibernate.test.annotations.any;\n" +"\n" +"\n" +"//in a class\n" +" @Any( metaDef=\"property\", metaColumn = @Column( name = \"property_type" +"\" ), fetch=FetchType.EAGER )\n" +" @JoinColumn( name = \"property_id\" )\n" +" public Property getMainProperty() {\n" +" return mainProperty;\n" +" }" +msgstr "" + +#. Tag: para +#: basic_mapping.xml:3546 +#, no-c-format +msgid "The hbm.xml equivalent is:" +msgstr "" + +#. Tag: programlisting +#: basic_mapping.xml:3548 +#, no-c-format +msgid "" +"<any name=\"being\" id-type=\"long\" meta-type=\"string\">\n" +" <meta-value value=\"TBL_ANIMAL\" class=\"Animal\"/>\n" +" <meta-value value=\"TBL_HUMAN\" class=\"Human\"/>\n" +" <meta-value value=\"TBL_ALIEN\" class=\"Alien\"/>\n" +" <column name=\"table_name\"/>\n" +" <column name=\"id\"/>\n" +"</any>" +msgstr "" + +#. Tag: para +#: basic_mapping.xml:3551 +#, no-c-format +msgid "You cannot mutualize the metadata in hbm.xml as you can in annotations." +msgstr "" + +#. Tag: programlisting +#: basic_mapping.xml:3570 +#, no-c-format +msgid "" +"<any\n" +" name=\"propertyName\"\n" +" id-type=\"idtypename\"\n" +" meta-type=\"metatypename\"\n" +" cascade=\"cascade_style\"\n" +" access=\"field|property|ClassName\"\n" +" optimistic-lock=\"true|false\"\n" +">\n" +" <meta-value ... />\n" +" <meta-value ... />\n" +" .....\n" +" <column .... />\n" +" <column .... />\n" +" .....\n" +"</any>" +msgstr "" + +#. Tag: para +#: basic_mapping.xml:3574 +#, no-c-format +msgid "name: the property name." +msgstr "name : le nom de la propriété. " + +#. Tag: para +#: basic_mapping.xml:3578 +#, no-c-format +msgid "id-type: the identifier type." +msgstr "id-type : le type identifiant." + +#. Tag: para +#: basic_mapping.xml:3582 +#, no-c-format +msgid "" +"meta-type (optional - defaults to string): any type that is allowed for a discriminator mapping." +msgstr "" +"meta-type (optionnel - par défaut à string) : tout type permis pour un mappage par discriminateur." + +#. Tag: para +#: basic_mapping.xml:3588 +#, no-c-format +msgid "" +"cascade (optional- defaults to none): " +"the cascade style." +msgstr "" +"cascade (optionnel - par défaut à none) : le style de cascade. " + +#. Tag: para +#: basic_mapping.xml:3599 +#, no-c-format +msgid "" +"optimistic-lock (optional - defaults to true): specifies that updates to this property either do or do not " +"require acquisition of the optimistic lock. It defines whether a version " +"increment should occur if this property is dirty." +msgstr "" +"optimistic-lock (optionnel - par défaut à true) : indique si les mise à jour sur cette propriété nécessitent ou " +"non l'acquisition d'un verrou optimiste. En d'autres termes, définit si un " +"incrément de version doit avoir lieu quand cette propriété est marquée " +"dirty. " + +#. Tag: title +#: basic_mapping.xml:3610 +#, no-c-format +msgid "Properties" +msgstr "Propriétés" + +#. Tag: para +#: basic_mapping.xml:3612 +#, no-c-format +msgid "" +"The <properties> element allows the definition of a " +"named, logical grouping of the properties of a class. The most important use " +"of the construct is that it allows a combination of properties to be the " +"target of a property-ref. It is also a convenient way to " +"define a multi-column unique constraint. For example:" +msgstr "" +"L'élément <properties> permet la définition d'un " +"groupement logique nommé des propriétés d'une classe. L'utilisation la plus " +"importante de cette construction est la possibilité pour une combinaison de " +"propriétés d'être la cible d'un property-ref. C'est aussi " +"un moyen pratique de définir une contrainte d'unicité multi-colonnes. Par " +"exemple :" + +#. Tag: programlisting +#: basic_mapping.xml:3632 +#, no-c-format +msgid "" +"<properties\n" +" name=\"logicalName\"\n" +" insert=\"true|false\"\n" +" update=\"true|false\"\n" +" optimistic-lock=\"true|false\"\n" +" unique=\"true|false\"\n" +">\n" +"\n" +" <property ...../>\n" +" <many-to-one .... />\n" +" ........\n" +"</properties>" +msgstr "" + +#. Tag: para +#: basic_mapping.xml:3636 +#, no-c-format +msgid "" +"name: the logical name of the grouping. It is " +"not an actual property name." +msgstr "" +"name : le nom logique d'un regroupement et non le véritable nom d'une propriété. " + +#. Tag: para +#: basic_mapping.xml:3651 +#, no-c-format +msgid "" +"optimistic-lock (optional - defaults to true): specifies that updates to these properties either do or do not " +"require acquisition of the optimistic lock. It determines if a version " +"increment should occur when these properties are dirty." +msgstr "" +"optimistic-lock (optionnel - par défaut à true) : indique si les mise à jour sur ce composant nécessitent ou non " +"l'acquisition d'un verrou optimiste. En d'autres termes, cela détermine si " +"une incrémentation de version doit avoir lieu quand la propriété est marquée " +"obsolète (dirty). " + +#. Tag: para +#: basic_mapping.xml:3666 +#, no-c-format +msgid "" +"For example, if we have the following <properties> " +"mapping:" +msgstr "" +"Par exemple, si nous avons le mappage de <properties> suivant : " + +#. Tag: programlisting +#: basic_mapping.xml:3669 +#, no-c-format +msgid "" +"<class name=\"Person\">\n" +" <id name=\"personNumber\"/>\n" +"\n" +" ...\n" +" <properties name=\"name\"\n" +" unique=\"true\" update=\"false\">\n" +" <property name=\"firstName\"/>\n" +" <property name=\"initial\"/>\n" +" <property name=\"lastName\"/>\n" +" </properties>\n" +"</class>" +msgstr "" + +#. Tag: para +#: basic_mapping.xml:3671 +#, no-c-format +msgid "" +"You might have some legacy data association that refers to this unique key " +"of the Person table, instead of to the primary key:" +msgstr "" +"Alors nous pourrions avoir une association sur des données d'un ancien " +"système qui font référence à cette clé unique de la table Person au lieu de la clé primaire : " + +#. Tag: programlisting +#: basic_mapping.xml:3675 +#, no-c-format +msgid "" +"<many-to-one name=\"owner\"\n" +" class=\"Person\" property-ref=\"name\">\n" +" <column name=\"firstName\"/>\n" +" <column name=\"initial\"/>\n" +" <column name=\"lastName\"/>\n" +"</many-to-one>" +msgstr "" + +#. Tag: para +#: basic_mapping.xml:3678 +#, no-c-format +msgid "" +"When using annotations as a mapping strategy, such construct is not " +"necessary as the binding between a column and its related column on the " +"associated table is done directly" +msgstr "" + +#. Tag: para +#: basic_mapping.xml:3685 +#, no-c-format +msgid "" +"The use of this outside the context of mapping legacy data is not " +"recommended." +msgstr "" +"Nous ne recommandons pas une telle utilisation, en dehors du contexte de " +"mappage de données héritées d'anciens systèmes. " + +#. Tag: title +#: basic_mapping.xml:3690 +#, no-c-format +msgid "Some hbm.xml specificities" +msgstr "" + +#. Tag: para +#: basic_mapping.xml:3692 +#, no-c-format +msgid "" +"The hbm.xml structure has some specificities naturally not present when " +"using annotations, let's describe them briefly." +msgstr "" + +#. Tag: title +#: basic_mapping.xml:3696 +#, no-c-format +msgid "Doctype" +msgstr "Doctype" + +#. Tag: para +#: basic_mapping.xml:3698 +#, no-c-format +msgid "" +"All XML mappings should declare the doctype shown. The actual DTD can be " +"found at the URL above, in the directory hibernate-x.x.x/src/org/" +"hibernate , or in hibernate3.jar. Hibernate " +"will always look for the DTD in its classpath first. If you experience " +"lookups of the DTD using an Internet connection, check the DTD declaration " +"against the contents of your classpath." +msgstr "" +"Tous les mappages XML devraient utiliser le doctype indiqué. En effet vous " +"trouverez le fichier DTD à l'URL ci-dessus, dans le répertoire " +"hibernate-x.x.x/src/org/hibernate ou dans " +"hibernate3.jar. Hibernate va toujours chercher la DTD " +"dans son classpath en premier lieu. Si vous constatez des recherches de la " +"DTD sur Internet, vérifiez votre déclaration de DTD par rapport au contenu " +"de votre classpath. " + +#. Tag: title +#: basic_mapping.xml:3707 +#, no-c-format +msgid "EntityResolver" +msgstr "EntityResolver" + +#. Tag: para +#: basic_mapping.xml:3709 +#, no-c-format +msgid "" +"Hibernate will first attempt to resolve DTDs in its classpath. It does this " +"is by registering a custom org.xml.sax.EntityResolver " +"implementation with the SAXReader it uses to read in the xml files. This " +"custom EntityResolver recognizes two different systemId " +"namespaces:" +msgstr "" +"Comme mentionné précédemment, Hibernate tentera en premier lieu de résoudre " +"les DTD dans leur classpath. Il réussit à le faire en enregistrant une " +"implémentation personnalisée de org.xml.sax.EntityResolver avec le SAXReader qu'il utilise pour lire les fichiers xml. Cet " +"EntityResolver personnalisé reconnaît deux espaces de " +"nommage systemId différents :" + +#. Tag: para +#: basic_mapping.xml:3718 +#, no-c-format +msgid "" +"a hibernate namespace is recognized whenever the resolver " +"encounters a systemId starting with http://hibernate.sourceforge." +"net/. The resolver attempts to resolve these entities via the " +"classloader which loaded the Hibernate classes." +msgstr "" +"un espace de nommage hibernate est reconnu dès que le " +"résolveur rencontre un systemId commençant par http://hibernate." +"sourceforge.net/. Le résolveur tente alors de résoudre ces entités " +"via le chargeur de classe qui a chargé les classes Hibernate." + +#. Tag: para +#: basic_mapping.xml:3726 +#, no-c-format +msgid "" +"a user namespace is recognized whenever the resolver " +"encounters a systemId using a classpath:// URL protocol. " +"The resolver will attempt to resolve these entities via (1) the current " +"thread context classloader and (2) the classloader which loaded the " +"Hibernate classes." +msgstr "" +"un espace de nommage utilisateur est reconnu dès que le " +"résolveur rencontre un systemId qui utilise un protocole URL " +"classpath://. Le résolveur tentera alors de résoudre ces " +"entités via (1) le chargeur de classe du contexte du thread courant et (2) " +"le chargeur de classe qui a chargé les classes Hibernate." + +#. Tag: para +#: basic_mapping.xml:3735 +#, no-c-format +msgid "The following is an example of utilizing user namespacing:" +msgstr "Un exemple d'utilisation de l'espace de nommage utilisateur: " + +#. Tag: programlisting +#: basic_mapping.xml:3738 +#, no-c-format +msgid "" +"" +msgstr "" + +#. Tag: para +#: basic_mapping.xml:3740 +#, fuzzy, no-c-format +msgid "" +"Where types.xml is a resource in the your." +"domain package and contains a custom typedef." +msgstr "" +"Là où types.xml est une ressource dans votre paquetage " +"your.domain et contient un personnalisé. " + +#. Tag: title +#: basic_mapping.xml:3747 +#, no-c-format +msgid "Hibernate-mapping" +msgstr "Hibernate-mappage" + +#. Tag: para +#: basic_mapping.xml:3749 +#, no-c-format +msgid "" +"This element has several optional attributes. The schema " +"and catalog attributes specify that tables referred to in " +"this mapping belong to the named schema and/or catalog. If they are " +"specified, tablenames will be qualified by the given schema and catalog " +"names. If they are missing, tablenames will be unqualified. The " +"default-cascade attribute specifies what cascade style " +"should be assumed for properties and collections that do not specify a " +"cascade attribute. By default, the auto-import attribute allows you to use unqualified class names in the query " +"language." +msgstr "" +"Cet élément a plusieurs attributs optionnels. Les attributs schema et catalog indiquent que les tables mentionnées " +"dans ce mappage appartiennent au schéma nommé et/ou au catalogue. S'ils sont " +"spécifiés, les noms de tables seront qualifiés par les noms de schéma et de " +"catalogue. L'attribut default-cascade indique quel type " +"de cascade sera utilisé par défaut pour les propriétés et collections qui ne " +"précisent pas l'attribut cascade. L'attribut " +"auto-import nous permet d'utiliser par défaut des noms de " +"classes non qualifiés dans le langage de requête, par défaut. " + +#. Tag: programlisting +#: basic_mapping.xml:3778 +#, no-c-format +msgid "" +"<hibernate-mapping\n" +" schema=\"schemaName\"\n" +" catalog=\"catalogName\"\n" +" default-cascade=\"cascade_style\"\n" +" default-access=\"field|property|ClassName\"\n" +" default-lazy=\"true|false\"\n" +" auto-import=\"true|false\"\n" +" package=\"package.name\"\n" +" />" +msgstr "" + +#. Tag: para +#: basic_mapping.xml:3782 +#, no-c-format +msgid "schema (optional): the name of a database schema." +msgstr "" +"schema (optionnel) : le nom d'un schéma de base de " +"données. " + +#. Tag: para +#: basic_mapping.xml:3787 +#, no-c-format +msgid "catalog (optional): the name of a database catalog." +msgstr "" +"catalog (optionnel) : le nom d'un catalogue de base de " +"données. " + +#. Tag: para +#: basic_mapping.xml:3792 +#, no-c-format +msgid "" +"default-cascade (optional - defaults to none): a default cascade style." +msgstr "" +"default-cascade (optionnel - par défaut vaut : " +"none) : un type de cascade par défaut. " + +#. Tag: para +#: basic_mapping.xml:3797 +#, no-c-format +msgid "" +"default-access (optional - defaults to property): the strategy Hibernate should use for accessing all properties. " +"It can be a custom implementation of PropertyAccessor." +msgstr "" +"default-access (optionnel - par défaut vaut : " +"property) : Comment hibernate accèdera aux propriétés. On " +"peut aussi redéfinir sa propre implémentation de PropertyAccessor. " + +#. Tag: para +#: basic_mapping.xml:3804 +#, no-c-format +msgid "" +"default-lazy (optional - defaults to true): the default value for unspecified lazy " +"attributes of class and collection mappings." +msgstr "" +"default-lazy (optionnel - par défaut vaut : " +"true) : Valeur par défaut pour des attributs " +"lazy non spécifiés des mappages de classe et de " +"collection. " + +#. Tag: para +#: basic_mapping.xml:3811 +#, no-c-format +msgid "" +"auto-import (optional - defaults to true): specifies whether we can use unqualified class names of classes " +"in this mapping in the query language." +msgstr "" +"auto-import (optionnel - par défaut vaut : true) : spécifie si l'on peut utiliser des noms de classes non qualifiés " +"(de classes de ce mappage) dans le langage de requête. " + +#. Tag: para +#: basic_mapping.xml:3818 +#, no-c-format +msgid "" +"package (optional): specifies a package prefix to use for " +"unqualified class names in the mapping document." +msgstr "" +"package (optionnel) : préfixe de paquetage par défaut " +"pour les noms de classe non qualifiés du document de mappage. " + +#. Tag: para +#: basic_mapping.xml:3825 +#, no-c-format +msgid "" +"If you have two persistent classes with the same unqualified name, you " +"should set auto-import=\"false\". An exception will " +"result if you attempt to assign two classes to the same \"imported\" name." +msgstr "" +"Si deux classes persistantes possèdent le même nom de classe (non qualifié), " +"vous devez configurer auto-import=\"false\". Hibernate " +"lancera une exception si vous essayez d'assigner le même nom \"importé\" à " +"deux classes." + +#. Tag: para +#: basic_mapping.xml:3830 +#, no-c-format +msgid "" +"The hibernate-mapping element allows you to nest several " +"persistent <class> mappings, as shown above. It is, " +"however, good practice (and expected by some tools) to map only a single " +"persistent class, or a single class hierarchy, in one mapping file and name " +"it after the persistent superclass. For example, Cat.hbm.xml, Dog.hbm.xml, or if using inheritance, " +"Animal.hbm.xml." +msgstr "" +"Notez que l'élément hibernate-mappage vous permet " +"d'imbriquer plusieurs mappages de <class> " +"persistantes, comme dans l'exemple ci-dessus. Cependant il est recommandé " +"(et c'est parfois une exigence de certains outils) de mapper une seule " +"classe persistante (ou une seule hiérarchie de classes) par fichier de " +"mappage et de nommer ce fichier d'après le nom de la superclasse " +"persistante, par exemple Cat.hbm.xml, Dog.hbm." +"xml, ou en cas d'héritage, Animal.hbm.xml. " + +#. Tag: title +#: basic_mapping.xml:3841 +#, no-c-format +msgid "Key" +msgstr "" + +#. Tag: para +#: basic_mapping.xml:3843 +#, fuzzy, no-c-format +msgid "" +"The <key> element is featured a few times within " "this guide. It appears anywhere the parent mapping element defines a join to " "a new table that references the primary key of the original table. It also " "defines the foreign key in the joined table:" @@ -3224,7 +7685,22 @@ msgstr "" "définit une jointure sur une nouvelle table, et définit la clé étrangère " "dans la table jointe, qui référence la clé primaire de la table d'origine :" +#. Tag: programlisting +#: basic_mapping.xml:3864 +#, no-c-format +msgid "" +"<key\n" +" column=\"columnname\"\n" +" on-delete=\"noaction|cascade\"\n" +" property-ref=\"propertyName\"\n" +" not-null=\"true|false\"\n" +" update=\"true|false\"\n" +" unique=\"true|false\"\n" +"/>" +msgstr "" + #. Tag: para +#: basic_mapping.xml:3874 #, no-c-format msgid "" "on-delete (optional - defaults to noactionproperty-ref (optional): specifies that the foreign key " @@ -3247,6 +7724,7 @@ msgstr "" "d'origine (Pour les données d'anciens systèmes). " #. Tag: para +#: basic_mapping.xml:3886 #, no-c-format msgid "" "not-null (optional): specifies that the foreign key " @@ -3258,6 +7736,7 @@ msgstr "" "fait partie de la clé primaire). " #. Tag: para +#: basic_mapping.xml:3892 #, no-c-format msgid "" "update (optional): specifies that the foreign key should " @@ -3269,6 +7748,7 @@ msgstr "" "primaire). " #. Tag: para +#: basic_mapping.xml:3898 #, no-c-format msgid "" "unique (optional): specifies that the foreign key should " @@ -3280,6 +7760,7 @@ msgstr "" "la clé primaire). " #. Tag: para +#: basic_mapping.xml:3905 #, no-c-format msgid "" "For systems where delete performance is important, we recommend that all " @@ -3298,6 +7779,7 @@ msgstr "" "versionnées. " #. Tag: para +#: basic_mapping.xml:3913 #, no-c-format msgid "" "The not-null and update attributes are " @@ -3313,52 +7795,13 @@ msgstr "" "<key not-null=\"true\">. " #. Tag: title -#, no-c-format -msgid "Column and formula elements" -msgstr "Éléments column et formula " - -#. Tag: para -#, no-c-format -msgid "" -"Mapping elements which accept a column attribute will " -"alternatively accept a <column> subelement. " -"Likewise, <formula> is an alternative to the " -"formula attribute. For example:" -msgstr "" -"Tout élément de mappage qui accepte un attribut column " -"acceptera alternativement un sous-élément <column>. " -"Pareillement <formula> est une alternative à " -"l'attribut formula. Par exemple :" - -#. Tag: para -#, no-c-format -msgid "" -"Most of the attributes on column provide a means of " -"tailoring the DDL during automatic schema generation. The read and write attributes allow you to specify custom " -"SQL that Hibernate will use to access the column's value. For more on this, " -"see the discussion of column " -"read and write expressions." -msgstr "" - -#. Tag: para -#, fuzzy, no-c-format -msgid "" -"The column and formula elements can " -"even be combined within the same property or association mapping to express, " -"for example, exotic join conditions." -msgstr "" -"Les attributs column et formula " -"peuvent même être combinés au sein d'une même propriété ou mappage " -"d'association pour exprimer, par exemple, des conditions de jointure " -"exotiques. " - -#. Tag: title +#: basic_mapping.xml:3922 #, no-c-format msgid "Import" msgstr "Import" #. Tag: para +#: basic_mapping.xml:3924 #, no-c-format msgid "" "If your application has two persistent classes with the same name, and you " @@ -3374,13 +7817,31 @@ msgstr "" "literal>.Vous pouvez même importer des classes et interfaces qui ne sont pas " "mappées explicitement :" +#. Tag: programlisting +#: basic_mapping.xml:3930 +#, no-c-format +msgid "<import class=\"java.lang.Object\" rename=\"Universe\"/>" +msgstr "" + +#. Tag: programlisting +#: basic_mapping.xml:3939 +#, no-c-format +msgid "" +"<import\n" +" class=\"ClassName\"\n" +" rename=\"ShortName\"\n" +"/>" +msgstr "" + #. Tag: para +#: basic_mapping.xml:3943 #, no-c-format msgid "" "class: the fully qualified class name of any Java class." msgstr "class : nom complet de toute classe Java. " #. Tag: para +#: basic_mapping.xml:3948 #, no-c-format msgid "" "rename (optional - defaults to the unqualified class " @@ -3389,102 +7850,108 @@ msgstr "" "rename (optionnel - par défaut vaut le nom de la classe " "non qualifié): nom pouvant être utilisé dans le langage de requête. " -#. Tag: title -#, no-c-format -msgid "Any" -msgstr "Any" - #. Tag: para +#: basic_mapping.xml:3956 #, no-c-format -msgid "" -"There is one more type of property mapping. The <any> mapping element defines a polymorphic association to classes from " -"multiple tables. This type of mapping requires more than one column. The " -"first column contains the type of the associated entity. The remaining " -"columns contain the identifier. It is impossible to specify a foreign key " -"constraint for this kind of association. This is not the usual way of " -"mapping polymorphic associations and you should use this only in special " -"cases. For example, for audit logs, user session data, etc." +msgid "This feature is unique to hbm.xml and is not supported in annotations." msgstr "" -"Il existe encore un type de mappage de propriété. L'élément de mappage " -"<any> définit une association polymorphique vers " -"des classes de tables multiples. Ce type de mappage requiert toujours plus " -"d'une colonne. La première colonne contient le type de l'entité associée. " -"Les colonnes restantes contiennent l'identifiant. Il est impossible de " -"spécifier une contrainte de clé étrangère pour ce type d'association, donc " -"ce n'est certainement pas considéré comme le moyen habituel de mapper des " -"associations (polymorphiques). Ne doit être utilisé que dans des cas " -"particuliers (par exemple des logs d'audit, des données de session " -"utilisateur, etc...). " - -#. Tag: para -#, no-c-format -msgid "" -"The meta-type attribute allows the application to specify " -"a custom type that maps database column values to persistent classes that " -"have identifier properties of the type specified by id-type. You must specify the mapping from values of the meta-type to class " -"names." -msgstr "" -"L'attribut meta-type permet à l'application de spécifier " -"un type personnalisé qui mappe des valeurs de colonnes de base de données " -"sur des classes persistantes qui ont un attribut identifiant du type " -"spécifié par id-type. Vous devez spécifier le mappage à " -"partir de valeurs du méta-type sur les noms des classes. " - -#. Tag: para -#, no-c-format -msgid "name: the property name." -msgstr "name : le nom de la propriété. " - -#. Tag: para -#, no-c-format -msgid "id-type: the identifier type." -msgstr "id-type : le type identifiant." - -#. Tag: para -#, no-c-format -msgid "" -"meta-type (optional - defaults to string): any type that is allowed for a discriminator mapping." -msgstr "" -"meta-type (optionnel - par défaut à string) : tout type permis pour un mappage par discriminateur." - -#. Tag: para -#, no-c-format -msgid "" -"cascade (optional- defaults to none): " -"the cascade style." -msgstr "" -"cascade (optionnel - par défaut à none) : le style de cascade. " - -#. Tag: para -#, no-c-format -msgid "" -"optimistic-lock (optional - defaults to true): specifies that updates to this property either do or do not " -"require acquisition of the optimistic lock. It defines whether a version " -"increment should occur if this property is dirty." -msgstr "" -"optimistic-lock (optionnel - par défaut à true) : indique si les mise à jour sur cette propriété nécessitent ou " -"non l'acquisition d'un verrou optimiste. En d'autres termes, définit si un " -"incrément de version doit avoir lieu quand cette propriété est marquée " -"dirty. " #. Tag: title +#: basic_mapping.xml:3962 +#, no-c-format +msgid "Column and formula elements" +msgstr "Éléments column et formula " + +#. Tag: para +#: basic_mapping.xml:3964 +#, no-c-format +msgid "" +"Mapping elements which accept a column attribute will " +"alternatively accept a <column> subelement. " +"Likewise, <formula> is an alternative to the " +"formula attribute. For example:" +msgstr "" +"Tout élément de mappage qui accepte un attribut column " +"acceptera alternativement un sous-élément <column>. " +"Pareillement <formula> est une alternative à " +"l'attribut formula. Par exemple :" + +#. Tag: programlisting +#: basic_mapping.xml:3970 +#, no-c-format +msgid "" +"<column\n" +" name=\"column_name\"\n" +" length=\"N\"\n" +" precision=\"N\"\n" +" scale=\"N\"\n" +" not-null=\"true|false\"\n" +" unique=\"true|false\"\n" +" unique-key=\"multicolumn_unique_key_name\"\n" +" index=\"index_name\"\n" +" sql-type=\"sql_type_name\"\n" +" check=\"SQL expression\"\n" +" default=\"SQL expression\"\n" +" read=\"SQL expression\"\n" +" write=\"SQL expression\"/>" +msgstr "" + +#. Tag: programlisting +#: basic_mapping.xml:3972 +#, no-c-format +msgid "<formula>SQL expression</formula>" +msgstr "" + +#. Tag: para +#: basic_mapping.xml:3974 +#, no-c-format +msgid "" +"Most of the attributes on column provide a means of " +"tailoring the DDL during automatic schema generation. The read and write attributes allow you to specify custom " +"SQL that Hibernate will use to access the column's value. For more on this, " +"see the discussion of column " +"read and write expressions." +msgstr "" + +#. Tag: para +#: basic_mapping.xml:3982 +#, fuzzy, no-c-format +msgid "" +"The column and formula elements can " +"even be combined within the same property or association mapping to express, " +"for example, exotic join conditions." +msgstr "" +"Les attributs column et formula " +"peuvent même être combinés au sein d'une même propriété ou mappage " +"d'association pour exprimer, par exemple, des conditions de jointure " +"exotiques. " + +#. Tag: programlisting +#: basic_mapping.xml:3986 +#, no-c-format +msgid "" +"<many-to-one name=\"homeAddress\" class=\"Address\"\n" +" insert=\"false\" update=\"false\">\n" +" <column name=\"person_id\" not-null=\"true\" length=\"10\"/>\n" +" <formula>'MAILING'</formula>\n" +"</many-to-one>" +msgstr "" + +#. Tag: title +#: basic_mapping.xml:3992 #, no-c-format msgid "Hibernate types" msgstr "Types Hibernate " #. Tag: title +#: basic_mapping.xml:3995 #, no-c-format msgid "Entities and values" msgstr "Entités et valeurs" #. Tag: para +#: basic_mapping.xml:3997 #, no-c-format msgid "" "In relation to the persistence service, Java language-level objects are " @@ -3494,6 +7961,7 @@ msgstr "" "niveau langage Java :" #. Tag: para +#: basic_mapping.xml:4000 #, no-c-format msgid "" "An entity exists independently of any other objects " @@ -3518,6 +7986,7 @@ msgstr "" "partagées. Elles peuvent aussi être versionnées." #. Tag: para +#: basic_mapping.xml:4010 #, no-c-format msgid "" "An entity's persistent state consists of references to other entities and " @@ -3542,6 +8011,7 @@ msgstr "" "partagées par deux entités ou collections. " #. Tag: para +#: basic_mapping.xml:4020 #, no-c-format msgid "" "Until now, we have been using the term \"persistent class\" to refer to " @@ -3572,12 +8042,14 @@ msgstr "" "l'agrégation se traduit en général par une valeur type. " #. Tag: para +#: basic_mapping.xml:4033 #, no-c-format msgid "We will revisit both concepts throughout this reference guide." msgstr "" "Nous nous pencherons sur ces deux concepts tout au long de la documentation. " #. Tag: para +#: basic_mapping.xml:4036 #, no-c-format msgid "" "The challenge is to map the Java type system, and the developers' definition " @@ -3605,6 +8077,7 @@ msgstr "" "nous le verrons plus tard. " #. Tag: para +#: basic_mapping.xml:4049 #, no-c-format msgid "" "With the exception of collections, all built-in Hibernate types support null " @@ -3614,11 +8087,13 @@ msgstr "" "sémantiques null. " #. Tag: title +#: basic_mapping.xml:4054 #, no-c-format msgid "Basic value types" msgstr "Types valeurs de base " #. Tag: para +#: basic_mapping.xml:4056 #, no-c-format msgid "" "The built-in basic mapping types can be roughly " @@ -3627,16 +8102,18 @@ msgstr "" "Les types de mappage de base peuvent être classés de la " "façon suivante :" -#. Tag: term -#, no-c-format +#. Tag: literal +#: basic_mapping.xml:4059 +#, fuzzy, no-c-format msgid "" -"integer, long, short, float, double, character, byte, boolean, " -"yes_no, true_false" +"integer, long, short, float, double, character, byte, boolean, yes_no, " +"true_false" msgstr "" "integer, long, short, float, double, character, byte, boolean, " "yes_no, true_false" #. Tag: para +#: basic_mapping.xml:4063 #, no-c-format msgid "" "Type mappings from Java primitives or wrapper classes to appropriate (vendor-" @@ -3650,12 +8127,14 @@ msgstr "" "des alternatives pour les types Java boolean ou " "java.lang.Boolean." -#. Tag: term +#. Tag: literal +#: basic_mapping.xml:4073 #, no-c-format -msgid "string" -msgstr "string" +msgid "string" +msgstr "" #. Tag: para +#: basic_mapping.xml:4076 #, no-c-format msgid "" "A type mapping from java.lang.String to VARCHARjava.lang.String vers " "VARCHAR (ou le VARCHAR2 Oracle)." -#. Tag: term -#, no-c-format -msgid "date, time, timestamp" +#. Tag: literal +#: basic_mapping.xml:4083 +#, fuzzy, no-c-format +msgid "date, time, timestamp" msgstr "date, time, timestamp" #. Tag: para +#: basic_mapping.xml:4086 #, no-c-format msgid "" "Type mappings from java.util.Date and its subclasses to " @@ -3680,12 +8161,14 @@ msgstr "" "vers les types SQL DATE, TIME et " "TIMESTAMP (ou équivalent)." -#. Tag: term -#, no-c-format -msgid "calendar, calendar_date" +#. Tag: literal +#: basic_mapping.xml:4094 +#, fuzzy, no-c-format +msgid "calendar, calendar_date" msgstr "calendar, calendar_date" #. Tag: para +#: basic_mapping.xml:4097 #, no-c-format msgid "" "Type mappings from java.util.Calendar to SQL types " @@ -3694,12 +8177,14 @@ msgstr "" "mappages de type pour java.util.Calendar vers les types " "SQL TIMESTAMP et DATE (ou équivalent)." -#. Tag: term -#, no-c-format -msgid "big_decimal, big_integer" +#. Tag: literal +#: basic_mapping.xml:4104 +#, fuzzy, no-c-format +msgid "big_decimal, big_integer" msgstr "big_decimal, big_integer" #. Tag: para +#: basic_mapping.xml:4107 #, no-c-format msgid "" "Type mappings from java.math.BigDecimal and java." @@ -3710,12 +8195,14 @@ msgstr "" "math.BigInteger vers NUMERIC (ou le " "NUMBER Oracle)." -#. Tag: term -#, no-c-format -msgid "locale, timezone, currency" +#. Tag: literal +#: basic_mapping.xml:4115 +#, fuzzy, no-c-format +msgid "locale, timezone, currency" msgstr "locale, timezone, currency" #. Tag: para +#: basic_mapping.xml:4118 #, no-c-format msgid "" "Type mappings from java.util.Locale, java.util." @@ -3732,12 +8219,14 @@ msgstr "" "mappées sur leurs codes ISO. Les instances de TimeZone " "sont mappées sur leur ID." -#. Tag: term -#, no-c-format -msgid "class" -msgstr "class" +#. Tag: literal +#: basic_mapping.xml:4131 +#, fuzzy, no-c-format +msgid "class" +msgstr "Classe" #. Tag: para +#: basic_mapping.xml:4134 #, no-c-format msgid "" "A type mapping from java.lang.Class to VARCHARVARCHAR (ou le VARCHAR2 Oracle). Un " "objet Class est mappé sur son nom Java complet." -#. Tag: term +#. Tag: literal +#: basic_mapping.xml:4142 #, no-c-format -msgid "binary" -msgstr "binary" +msgid "binary" +msgstr "" #. Tag: para +#: basic_mapping.xml:4145 #, no-c-format msgid "Maps byte arrays to an appropriate SQL binary type." msgstr "Mappe les tableaux de bytes vers le type binaire SQL approprié." -#. Tag: term +#. Tag: literal +#: basic_mapping.xml:4150 #, no-c-format -msgid "text" -msgstr "text" +msgid "text" +msgstr "" #. Tag: para +#: basic_mapping.xml:4153 #, no-c-format msgid "" "Maps long Java strings to a SQL CLOB or TEXTCLOB ou TEXT." -#. Tag: term +#. Tag: literal +#: basic_mapping.xml:4159 #, no-c-format -msgid "serializable" -msgstr "serializable" +msgid "serializable" +msgstr "" #. Tag: para +#: basic_mapping.xml:4162 #, no-c-format msgid "" "Maps serializable Java types to an appropriate SQL binary type. You can also " @@ -3789,12 +8284,14 @@ msgstr "" "le nom d'une classe Java sérialisable ou une interface qui ne soit pas par " "défaut un type de base. " -#. Tag: term +#. Tag: literal +#: basic_mapping.xml:4171 #, no-c-format -msgid "clob, blob" -msgstr "clob, blob" +msgid "clob, blob" +msgstr "" #. Tag: para +#: basic_mapping.xml:4174 #, no-c-format msgid "" "Type mappings for the JDBC classes java.sql.Clob and " @@ -3808,16 +8305,18 @@ msgstr "" "réutilisable en dehors d'une transaction (de plus l'implémentation par les " "pilotes comporte des lacunes)." -#. Tag: term -#, no-c-format +#. Tag: literal +#: basic_mapping.xml:4184 +#, fuzzy, no-c-format msgid "" -"imm_date, imm_time, imm_timestamp, imm_calendar, imm_calendar_date, " -"imm_serializable, imm_binary" +"imm_date, imm_time, imm_timestamp, imm_calendar, imm_calendar_date, " +"imm_serializable, imm_binary" msgstr "" "imm_date, imm_time, imm_timestamp, imm_calendar, imm_calendar_date, " "imm_serializable, imm_binary" #. Tag: para +#: basic_mapping.xml:4188 #, no-c-format msgid "" "Type mappings for what are considered mutable Java types. This is where " @@ -3838,6 +8337,7 @@ msgstr "" "assigner un nouvel (non identique) objet à la propriété. " #. Tag: para +#: basic_mapping.xml:4200 #, no-c-format msgid "" "Unique identifiers of entities and collections can be of any basic type " @@ -3851,6 +8351,7 @@ msgstr "" "composites sont aussi permis, voir plus bas). " #. Tag: para +#: basic_mapping.xml:4205 #, no-c-format msgid "" "The basic value types have corresponding Type constants " @@ -3864,11 +8365,13 @@ msgstr "" "string. " #. Tag: title +#: basic_mapping.xml:4212 #, no-c-format msgid "Custom value types" msgstr "Types de valeur personnalisés" #. Tag: para +#: basic_mapping.xml:4214 #, no-c-format msgid "" "It is relatively easy for developers to create their own value types. For " @@ -3893,6 +8396,7 @@ msgstr "" "literal>, SURNAME. " #. Tag: para +#: basic_mapping.xml:4225 #, no-c-format msgid "" "To implement a custom type, implement either org.hibernate." @@ -3907,7 +8411,19 @@ msgstr "" "classes complets du type. Consultez org.hibernate.test." "DoubleStringType pour étudier les possibilités. " +#. Tag: programlisting +#: basic_mapping.xml:4232 +#, no-c-format +msgid "" +"<property name=\"twoStrings\" type=\"org.hibernate.test.DoubleStringType" +"\">\n" +" <column name=\"first_string\"/>\n" +" <column name=\"second_string\"/>\n" +"</property>" +msgstr "" + #. Tag: para +#: basic_mapping.xml:4234 #, no-c-format msgid "" "Notice the use of <column> tags to map a property " @@ -3917,6 +8433,7 @@ msgstr "" "mapper une propriété sur des colonnes multiples." #. Tag: para +#: basic_mapping.xml:4237 #, no-c-format msgid "" "The CompositeUserType, EnhancedUserTypeUserType in the " @@ -3945,7 +8463,19 @@ msgstr "" "propre, vous pouvez utiliser l'élément <type> dans " "vos fichiers de mappage. " +#. Tag: programlisting +#: basic_mapping.xml:4250 +#, no-c-format +msgid "" +"<property name=\"priority\">\n" +" <type name=\"com.mycompany.usertypes.DefaultValueIntegerType\">\n" +" <param name=\"default\">0</param>\n" +" </type>\n" +"</property>" +msgstr "" + #. Tag: para +#: basic_mapping.xml:4252 #, no-c-format msgid "" "The UserType can now retrieve the value for the parameter " @@ -3957,6 +8487,7 @@ msgstr "" "Properties qui lui est passé. " #. Tag: para +#: basic_mapping.xml:4256 #, no-c-format msgid "" "If you regularly use a certain UserType, it is useful to " @@ -3971,7 +8502,24 @@ msgstr "" "d'assigner un nom à votre type propre et peuvent aussi contenir une liste de " "valeurs de paramètres par défaut si ce type est paramétré. " +#. Tag: programlisting +#: basic_mapping.xml:4262 +#, no-c-format +msgid "" +"<typedef class=\"com.mycompany.usertypes.DefaultValueIntegerType\" name=" +"\"default_zero\">\n" +" <param name=\"default\">0</param>\n" +"</typedef>" +msgstr "" + +#. Tag: programlisting +#: basic_mapping.xml:4264 +#, no-c-format +msgid "<property name=\"priority\" type=\"default_zero\"/>" +msgstr "" + #. Tag: para +#: basic_mapping.xml:4266 #, no-c-format msgid "" "It is also possible to override the parameters supplied in a typedef on a " @@ -3982,6 +8530,7 @@ msgstr "" "propriété. " #. Tag: para +#: basic_mapping.xml:4270 #, no-c-format msgid "" "Even though Hibernate's rich range of built-in types and support for " @@ -4005,11 +8554,13 @@ msgstr "" "changements futurs dans votre façon de représenter des valeurs monétaires. " #. Tag: title +#: basic_mapping.xml:4283 #, no-c-format msgid "Mapping a class more than once" msgstr "Mapper une classe plus d'une fois" #. Tag: para +#: basic_mapping.xml:4285 #, no-c-format msgid "" "It is possible to provide more than one mapping for a particular persistent " @@ -4027,7 +8578,31 @@ msgstr "" "écrivez des requêtes ou quand vous mappez des associations vers les entités " "nommées. " +#. Tag: programlisting +#: basic_mapping.xml:4293 +#, no-c-format +msgid "" +"<class name=\"Contract\" table=\"Contracts\"\n" +" entity-name=\"CurrentContract\">\n" +" ...\n" +" <set name=\"history\" inverse=\"true\"\n" +" order-by=\"effectiveEndDate desc\">\n" +" <key column=\"currentContractId\"/>\n" +" <one-to-many entity-name=\"HistoricalContract\"/>\n" +" </set>\n" +"</class>\n" +"\n" +"<class name=\"Contract\" table=\"ContractHistory\"\n" +" entity-name=\"HistoricalContract\">\n" +" ...\n" +" <many-to-one name=\"currentContract\"\n" +" column=\"currentContractId\"\n" +" entity-name=\"CurrentContract\"/>\n" +"</class>" +msgstr "" + #. Tag: para +#: basic_mapping.xml:4295 #, no-c-format msgid "" "Associations are now specified using entity-name instead " @@ -4036,12 +8611,20 @@ msgstr "" "Remarquez comment les associations sont désormais spécifiées en utilisant " "entity-name au lieu de class. " +#. Tag: para +#: basic_mapping.xml:4299 basic_mapping.xml:4379 basic_mapping.xml:4414 +#, no-c-format +msgid "This feature is not supported in Annotations" +msgstr "" + #. Tag: title +#: basic_mapping.xml:4304 #, no-c-format msgid "SQL quoted identifiers" msgstr "SQL quoted identifiers" #. Tag: para +#: basic_mapping.xml:4306 #, no-c-format msgid "" "You can force Hibernate to quote an identifier in the generated SQL by " @@ -4056,101 +8639,32 @@ msgstr "" "pour le SQL Dialect (habituellement des doubles quotes, " "mais des parenthèses pour SQL Server et des backticks pour MySQL). " -#. Tag: title -#, no-c-format -msgid "Metadata alternatives" -msgstr "Métadonnées alternatives" - -#. Tag: para +#. Tag: programlisting +#: basic_mapping.xml:4312 #, no-c-format msgid "" -"XML does not suit all users so there are some alternative ways to define O/R " -"mapping metadata in Hibernate." +"@Entity @Table(name=\"`Line Item`\")\n" +"class LineItem {\n" +" @id @Column(name=\"`Item Id`\") Integer id;\n" +" @Column(name=\"`Item #`\") int itemNumber\n" +"}\n" +"\n" +"<class name=\"LineItem\" table=\"`Line Item`\">\n" +" <id name=\"id\" column=\"`Item Id`\"/><generator class=" +"\"assigned\"/></id>\n" +" <property name=\"itemNumber\" column=\"`Item #`\"/>\n" +" ...\n" +"</class>" msgstr "" -"XML ne convient pas à tout le monde, il y a donc des moyens alternatifs pour " -"définir des métadonnées de mappage O/R dans Hibernate. " - -#. Tag: title -#, no-c-format -msgid "Using XDoclet markup" -msgstr "Utilisation de XDoclet " - -#. Tag: para -#, no-c-format -msgid "" -"Many Hibernate users prefer to embed mapping information directly in " -"sourcecode using XDoclet @hibernate.tags. We do not cover " -"this approach in this reference guide since it is considered part of " -"XDoclet. However, we include the following example of the Cat class with XDoclet mappings:" -msgstr "" -"De nombreux utilisateurs de Hibernate préfèrent embarquer les informations " -"de mappages directement au sein du code source en utilisant lesbalises " -"XDoclet @hibernate.tags. Nous ne couvrons pas cette " -"approche dans ce document puisque cela est considéré comme faisant partie de " -"XDoclet. Cependant, nous présentons l'exemple suivant de la classe " -"Cat avec des mappages XDoclet :" - -#. Tag: para -#, no-c-format -msgid "See the Hibernate website for more examples of XDoclet and Hibernate." -msgstr "" -"Voyez le site web de Hibernate pour plus d'exemples sur XDoclet et " -"Hibernate. " - -#. Tag: title -#, no-c-format -msgid "Using JDK 5.0 Annotations" -msgstr "Utilisation des annotations JDK 5.0" - -#. Tag: para -#, no-c-format -msgid "" -"JDK 5.0 introduced XDoclet-style annotations at the language level that are " -"type-safe and checked at compile time. This mechanism is more powerful than " -"XDoclet annotations and better supported by tools and IDEs. IntelliJ IDEA, " -"for example, supports auto-completion and syntax highlighting of JDK 5.0 " -"annotations. The new revision of the EJB specification (JSR-220) uses JDK " -"5.0 annotations as the primary metadata mechanism for entity beans. " -"Hibernate3 implements the EntityManager of JSR-220 (the " -"persistence API). Support for mapping metadata is available via the " -"Hibernate Annotations package as a separate download. " -"Both EJB3 (JSR-220) and Hibernate3 metadata is supported." -msgstr "" -"Le JDK 5.0 introduit des annotations proches de celles de XDoclet au niveau " -"java, qui sont type-safe et vérifiées à la compilation. Ce mécanisme est " -"plus puissant que XDoclet et mieux supporté par les outils et les IDE. " -"IntelliJ IDEA, par exemple, supporte l'auto-complétion et le surlignement " -"syntaxique des annotations JDK 5.0. La nouvelle révision des spécifications " -"des EJB (JSR-220) utilise les annotations JDK 5.0 comme mécanisme primaire " -"pour les metadonnées des beans entités. Hibernate3 implémente " -"l'EntityManager de la JSR-220 (API de persistance), le " -"support du mappage de métadonnées est disponible via le paquetage " -"Hibernate Annotations, en tant que module séparé à " -"télécharger. EJB3 (JSR-220) et les métadonnées Hibernate3 sont supportés. " - -#. Tag: para -#, no-c-format -msgid "This is an example of a POJO class annotated as an EJB entity bean:" -msgstr "Ceci est un exemple d'une classe POJO annotée comme un EJB entité :" - -#. Tag: para -#, no-c-format -msgid "" -"Support for JDK 5.0 Annotations (and JSR-220) is currently under " -"development. Please refer to the Hibernate Annotations module for more " -"details." -msgstr "" -"Notez que le support des annotations JDK 5.0 (et de la JSR-220) est encore " -"en cours et n'est pas terminé. Référez vous au module Hibernate Annotation " -"pour plus d'informations. " #. Tag: title +#: basic_mapping.xml:4316 #, no-c-format msgid "Generated properties" msgstr "Propriétés générées " #. Tag: para +#: basic_mapping.xml:4318 #, no-c-format msgid "" "Generated properties are properties that have their values generated by the " @@ -4172,6 +8686,7 @@ msgstr "" "les valeurs générées. " #. Tag: para +#: basic_mapping.xml:4327 #, fuzzy, no-c-format msgid "" "Properties marked as generated must additionally be non-insertable and non-" @@ -4187,6 +8702,7 @@ msgstr "" "property\" /> peuvent être marqués comme générés. " #. Tag: para +#: basic_mapping.xml:4334 #, no-c-format msgid "" "never (the default): the given property value is not " @@ -4196,6 +8712,7 @@ msgstr "" "propriété n'est pas générée dans la base de données. " #. Tag: para +#: basic_mapping.xml:4337 #, fuzzy, no-c-format msgid "" "insert: the given property value is generated on insert, " @@ -4214,6 +8731,7 @@ msgstr "" "générées, cette option n'est pas disponible." #. Tag: para +#: basic_mapping.xml:4344 #, no-c-format msgid "" "always: the property value is generated both on insert " @@ -4222,24 +8740,43 @@ msgstr "" "always - indique que la valeur de la propriété est " "générée à l'insertion comme aux mise à jour. " +#. Tag: para +#: basic_mapping.xml:4347 +#, no-c-format +msgid "To mark a property as generated, use @Generated." +msgstr "" + #. Tag: title +#: basic_mapping.xml:4352 #, no-c-format msgid "Column read and write expressions" msgstr "" #. Tag: para +#: basic_mapping.xml:4354 #, no-c-format msgid "" "Hibernate allows you to customize the SQL it uses to read and write the " "values of columns mapped to simple properties. For example, if your database provides a set of " "data encryption functions, you can invoke them for individual columns like " -"this: <property name=\"creditCardNumber" -"\"> <column name=\"credit_card_num\" read=\"decrypt(credit_card_num)\" " -"write=\"encrypt(?)\"/> </property>" +"this:" +msgstr "" + +#. Tag: programlisting +#: basic_mapping.xml:4359 +#, no-c-format +msgid "" +"<property name=\"creditCardNumber\">\n" +" <column \n" +" name=\"credit_card_num\"\n" +" read=\"decrypt(credit_card_num)\"\n" +" write=\"encrypt(?)\"/>\n" +"</property>" msgstr "" #. Tag: para +#: basic_mapping.xml:4361 #, no-c-format msgid "" "Hibernate applies the custom expressions automatically whenever the property " @@ -4248,6 +8785,7 @@ msgid "" msgstr "" #. Tag: para +#: basic_mapping.xml:4366 #, no-c-format msgid "" "The property is backed by one or more columns that are exported as part of " @@ -4255,11 +8793,13 @@ msgid "" msgstr "" #. Tag: para +#: basic_mapping.xml:4371 #, no-c-format msgid "The property is read-write, not read-only." msgstr "" #. Tag: para +#: basic_mapping.xml:4375 #, no-c-format msgid "" "The write expression, if specified, must contain exactly " @@ -4267,11 +8807,13 @@ msgid "" msgstr "" #. Tag: title +#: basic_mapping.xml:4384 #, no-c-format msgid "Auxiliary database objects" msgstr "Objets auxiliaires de la base de données " #. Tag: para +#: basic_mapping.xml:4386 #, no-c-format msgid "" "Auxiliary database objects allow for the CREATE and DROP of arbitrary " @@ -4294,6 +8836,7 @@ msgstr "" "objets auxiliaires de base de données :" #. Tag: para +#: basic_mapping.xml:4396 #, no-c-format msgid "" "The first mode is to explicitly list the CREATE and DROP commands in the " @@ -4302,7 +8845,21 @@ msgstr "" "Le premier mode est de lister explicitement les commandes CREATE et DROP " "dans le fichier de mappage : " +#. Tag: programlisting +#: basic_mapping.xml:4399 +#, no-c-format +msgid "" +"<hibernate-mapping>\n" +" ...\n" +" <database-object>\n" +" <create>CREATE TRIGGER my_trigger ...</create>\n" +" <drop>DROP TRIGGER my_trigger</drop>\n" +" </database-object>\n" +"</hibernate-mapping>" +msgstr "" + #. Tag: para +#: basic_mapping.xml:4401 #, no-c-format msgid "" "The second mode is to supply a custom class that constructs the CREATE and " @@ -4314,7 +8871,20 @@ msgstr "" "implémenter l'interface org.hibernate.mappage." "AuxiliaryDatabaseObject. " +#. Tag: programlisting +#: basic_mapping.xml:4406 +#, no-c-format +msgid "" +"<hibernate-mapping>\n" +" ...\n" +" <database-object>\n" +" <definition class=\"MyTriggerDefinition\"/>\n" +" </database-object>\n" +"</hibernate-mapping>" +msgstr "" + #. Tag: para +#: basic_mapping.xml:4408 #, no-c-format msgid "" "Additionally, these database objects can be optionally scoped so that they " @@ -4322,3 +8892,392 @@ msgid "" msgstr "" "De plus, ces objets de base de données peuvent être optionnellement traités " "selon l'utilisation de dialectes particuliers. " + +#. Tag: programlisting +#: basic_mapping.xml:4411 +#, no-c-format +msgid "" +"<hibernate-mapping>\n" +" ...\n" +" <database-object>\n" +" <definition class=\"MyTriggerDefinition\"/>\n" +" <dialect-scope name=\"org.hibernate.dialect.Oracle9iDialect\"/" +">\n" +" <dialect-scope name=\"org.hibernate.dialect.Oracle10gDialect\"/" +">\n" +" </database-object>\n" +"</hibernate-mapping>" +msgstr "" + +#~ msgid "" +#~ "Use of select-before-update will usually decrease " +#~ "performance. It is useful to prevent a database update trigger being " +#~ "called unnecessarily if you reattach a graph of detached instances to a " +#~ "Session." +#~ msgstr "" +#~ "L'utilisation de select-before-update va généralement " +#~ "faire baisser les performances. Ce paramètre est pratique pour éviter " +#~ "l'appel inutile par un déclenchement de mise à jour de base de donnée, " +#~ "quand on ré-attache un graphe d'instances à une Session." + +#~ msgid "Generator" +#~ msgstr "Generator" + +#~ msgid "increment" +#~ msgstr "increment" + +#~ msgid "identity" +#~ msgstr "identity" + +#~ msgid "sequence" +#~ msgstr "sequence" + +#~ msgid "seqhilo" +#~ msgstr "seqhilo" + +#~ msgid "uuid" +#~ msgstr "uuid" + +#~ msgid "" +#~ "uses a 128-bit UUID algorithm to generate identifiers of type string that " +#~ "are unique within a network (the IP address is used). The UUID is encoded " +#~ "as a string of 32 hexadecimal digits in length." +#~ msgstr "" +#~ "utilise un algorithme de type UUID 128 bits pour générer des identifiants " +#~ "de type string, unique au sein d'un réseau (l'adresse IP est utilisée). " +#~ "Le UUID est encodé en une chaîne de nombre héxadécimaux de longueur 32. " + +#~ msgid "guid" +#~ msgstr "guid" + +#~ msgid "native" +#~ msgstr "native" + +#~ msgid "select" +#~ msgstr "select" + +#~ msgid "foreign" +#~ msgstr "foreign" + +#~ msgid "" +#~ "optimizer (optional - defaults to none): See " +#~ msgstr "" +#~ "optimizer (en option - valeur par défaut = " +#~ "none): Voir " + +#~ msgid "composite-id" +#~ msgstr "composite-id" + +#~ msgid "" +#~ "A table with a composite key can be mapped with multiple properties of " +#~ "the class as identifier properties. The <composite-id> element accepts <key-property> property " +#~ "mappings and <key-many-to-one> mappings as child " +#~ "elements." +#~ msgstr "" +#~ "Pour une table avec clé composée, vous pouvez mapper plusieurs attributs " +#~ "de la classe comme propriétés identifiantes. L'élément <" +#~ "composite-id> accepte les mappages de propriétés " +#~ "<key-property> et les mappages <key-" +#~ "many-to-one> comme éléments enfants. " + +#~ msgid "" +#~ "The persistent class must override equals()" +#~ " and hashCode() to implement composite " +#~ "identifier equality. It must also implement Serializable." +#~ msgstr "" +#~ "Vos classes persistantes doivent surcharger les " +#~ "méthodes equals() et hashCode() " +#~ "pour implémenter l'égalité d'identifiant composite. Elles doivent aussi " +#~ "implémenter l'interface Serializable." + +#~ msgid "" +#~ "Unfortunately, this approach means that a persistent object is its own " +#~ "identifier. There is no convenient \"handle\" other than the object " +#~ "itself. You must instantiate an instance of the persistent class itself " +#~ "and populate its identifier properties before you can load() the persistent state associated with a composite key. We call " +#~ "this approach an embedded composite identifier, and " +#~ "discourage it for serious applications." +#~ msgstr "" +#~ "Malheureusement, cette approche signifie qu'un objet persistant est son " +#~ "propre identifiant. Il n'y a pas d'autre moyen pratique de \"manipuler\" " +#~ "l'objet que par l'objet lui-même. Vous devez instancier une instance de " +#~ "la classe persistante elle-même et peupler ses attributs identifiants " +#~ "avant de pouvoir appeler la méthode load() pour " +#~ "charger son état persistant associé à une clé composée. Nous appelons " +#~ "cette approche \"identifiant composé embarqué\" et " +#~ "ne la recommandons pas pour des applications complexes." + +#~ msgid "" +#~ "A second approach is what we call a mapped composite " +#~ "identifier, where the identifier properties named inside the <" +#~ "composite-id> element are duplicated on both the persistent " +#~ "class and a separate identifier class." +#~ msgstr "" +#~ "Une seconde approche, appelée identifiant composé mappé, consiste à dupliquer les propriétés identifiantes nommées dans " +#~ "l'élément <composite-id>) à la fois dans la " +#~ "classe persistante et dans une classe identifiante particulière." + +#~ msgid "" +#~ "In this example, both the composite identifier class, " +#~ "MedicareId, and the entity class itself have " +#~ "properties named medicareNumber and " +#~ "dependent. The identifier class must override " +#~ "equals() and hashCode() and " +#~ "implement Serializable. The main disadvantage of this " +#~ "approach is code duplication." +#~ msgstr "" +#~ "Dans cet exemple, la classe d'identifiant composée,MedicareId et la classe mappée elle-même, possèdent les propriétés " +#~ "medicareNumber et dependent. La " +#~ "classe identifiante doit redéfinir equals() et " +#~ "hashCode() et implémenter Serializable. Le désavantage de cette approche est la duplication du code. " + +#~ msgid "" +#~ "The following attributes are used to specify a mapped composite " +#~ "identifier:" +#~ msgstr "" +#~ "Les attributs suivants servent à configurer un identifiant composé mappé :" + +#~ msgid "" +#~ "mapped (optional - defaults to false): indicates that a mapped composite identifier is used, and that " +#~ "the contained property mappings refer to both the entity class and the " +#~ "composite identifier class." +#~ msgstr "" +#~ "mapped (optionnel, défaut à false) : indique qu'un identifiant composé mappé est utilisé, et que " +#~ "les mappages de propriétés contenues font référence aux deux classes, la " +#~ "classe mappée et la classe identifiante composée. " + +#~ msgid "" +#~ "class (optional - but required for a mapped composite " +#~ "identifier): the class used as a composite identifier." +#~ msgstr "" +#~ "class (optionnel, mais requis pour un identifiant " +#~ "composé mappé) : la classe utilisée comme identifiant composé. " + +#~ msgid "" +#~ "We will describe a third, even more convenient approach, where the " +#~ "composite identifier is implemented as a component class in . The attributes described below apply only " +#~ "to this alternative approach:" +#~ msgstr "" +#~ "Nous décrirons une troisième approche beaucoup plus efficace pour " +#~ "laquelle l'identifiant composé est implémenté comme une classe composant " +#~ "dans . Les attributs décrits " +#~ "ci dessous, ne s'appliquent que pour cette dernière approche :" + +#~ msgid "" +#~ "name (optional - required for this approach): a " +#~ "property of component type that holds the composite identifier. Please " +#~ "see chapter 9 for more information." +#~ msgstr "" +#~ "name (optionnel, requis pour cette approche) : une " +#~ "propriété de type composant qui contient l'identifiant composé (voir " +#~ "chapitre 9). " + +#~ msgid "" +#~ "class (optional - defaults to the property type " +#~ "determined by reflection): the component class used as a composite " +#~ "identifier. Please see the next section for more information." +#~ msgstr "" +#~ "class (optionnel - par défaut le type de la propriété " +#~ "déterminé par réflexion) : la classe composant utilisée comme identifiant " +#~ "(voir prochaine section). " + +#~ msgid "" +#~ "The third approach, an identifier component, is " +#~ "recommended for almost all applications." +#~ msgstr "" +#~ "La troisième approche, un composant d'identifiant, " +#~ "est celle que nous recommandons pour toutes vos applications." + +#~ msgid "Version (optional)" +#~ msgstr "Version (optionnel)" + +#~ msgid "" +#~ "The <version> element is optional and indicates " +#~ "that the table contains versioned data. This is particularly useful if " +#~ "you plan to use long transactions. See below for " +#~ "more information:" +#~ msgstr "" +#~ "L'élément <version> est optionnel et indique que " +#~ "la table contient des données versionnées. C'est particulièrement utile " +#~ "si vous avez l'intention d'utiliser des transactions longues (voir plus-bas)." + +#~ msgid "" +#~ "Version numbers can be of Hibernate type long, " +#~ "integer, short, timestamp or calendar." +#~ msgstr "" +#~ "Les numéros de version doivent avoir les types Hibernate long, integer, short, " +#~ "timestamp ou calendar. " + +#~ msgid "Many-to-one" +#~ msgstr "Plusieurs-à-un" + +#~ msgid "" +#~ "An ordinary association to another persistent class is declared using a " +#~ "many-to-one element. The relational model is a many-to-" +#~ "one association; a foreign key in one table is referencing the primary " +#~ "key column(s) of the target table." +#~ msgstr "" +#~ "Une association ordinaire vers une autre classe persistante est déclarée " +#~ "en utilisant un élément many-to-one. Le modèle " +#~ "relationnel est une association de type plusieurs-à-un : une clé " +#~ "étrangère dans une table référence la ou les clé(s) primaire(s) dans la " +#~ "table cible. " + +#~ msgid "One-to-one" +#~ msgstr "Un-à-un" + +#~ msgid "There are two varieties of one-to-one associations:" +#~ msgstr "Il existe deux types d'associations un-à-un : " + +#~ msgid "primary key associations" +#~ msgstr "association par clé primaire " + +#~ msgid "" +#~ "Alternatively, a foreign key with a unique constraint, from " +#~ "Employee to Person, can be " +#~ "expressed as:" +#~ msgstr "" +#~ "Alternativement, une clé étrangère avec contrainte d'unicité de " +#~ "Employee vers Person peut être " +#~ "indiquée ainsi : " + +#~ msgid "" +#~ "This association can be made bidirectional by adding the following to the " +#~ "Person mapping:" +#~ msgstr "" +#~ "Et cette association peut être rendue bidirectionnelle en ajoutant ceci " +#~ "au mappage de Person : " + +#~ msgid "Component and dynamic-component" +#~ msgstr "Component, dynamic-component" + +#~ msgid "Subclass" +#~ msgstr "Subclass" + +#~ msgid "" +#~ "A discriminator column is not required for this mapping strategy. Each " +#~ "subclass must, however, declare a table column holding the object " +#~ "identifier using the <key> element. The mapping " +#~ "at the start of the chapter would then be re-written as:" +#~ msgstr "" +#~ "Aucune colonne discriminante n'est nécessaire pour cette stratégie de " +#~ "mappage. Cependant, chaque sous-classe doit déclarer une colonne de table " +#~ "contenant l'objet identifiant qui utilise l'élément <key>. Le mappage au début de ce chapitre serait ré-écrit ainsi : " + +#~ msgid "Union-subclass" +#~ msgstr "Union-subclass" + +#~ msgid "Join" +#~ msgstr "Join" + +#~ msgid "" +#~ "Using the <join> element, it is possible to map " +#~ "properties of one class to several tables that have a one-to-one " +#~ "relationship. For example:" +#~ msgstr "" +#~ "En utilisant l'élément <join>, il est possible " +#~ "de mapper des propriétés d'une classe sur plusieurs tables quand il " +#~ "existe une relation un-à-un entre les tables. Par exemple :" + +#~ msgid "Key" +#~ msgstr "Key" + +#~ msgid "Any" +#~ msgstr "Any" + +#~ msgid "class" +#~ msgstr "class" + +#~ msgid "text" +#~ msgstr "text" + +#~ msgid "clob, blob" +#~ msgstr "clob, blob" + +#~ msgid "" +#~ "XML does not suit all users so there are some alternative ways to define " +#~ "O/R mapping metadata in Hibernate." +#~ msgstr "" +#~ "XML ne convient pas à tout le monde, il y a donc des moyens alternatifs " +#~ "pour définir des métadonnées de mappage O/R dans Hibernate. " + +#~ msgid "Using XDoclet markup" +#~ msgstr "Utilisation de XDoclet " + +#~ msgid "" +#~ "Many Hibernate users prefer to embed mapping information directly in " +#~ "sourcecode using XDoclet @hibernate.tags. We do not " +#~ "cover this approach in this reference guide since it is considered part " +#~ "of XDoclet. However, we include the following example of the " +#~ "Cat class with XDoclet mappings:" +#~ msgstr "" +#~ "De nombreux utilisateurs de Hibernate préfèrent embarquer les " +#~ "informations de mappages directement au sein du code source en utilisant " +#~ "lesbalises XDoclet @hibernate.tags. Nous ne couvrons " +#~ "pas cette approche dans ce document puisque cela est considéré comme " +#~ "faisant partie de XDoclet. Cependant, nous présentons l'exemple suivant " +#~ "de la classe Cat avec des mappages XDoclet :" + +#~ msgid "" +#~ "See the Hibernate website for more examples of XDoclet and Hibernate." +#~ msgstr "" +#~ "Voyez le site web de Hibernate pour plus d'exemples sur XDoclet et " +#~ "Hibernate. " + +#~ msgid "Using JDK 5.0 Annotations" +#~ msgstr "Utilisation des annotations JDK 5.0" + +#~ msgid "" +#~ "JDK 5.0 introduced XDoclet-style annotations at the language level that " +#~ "are type-safe and checked at compile time. This mechanism is more " +#~ "powerful than XDoclet annotations and better supported by tools and IDEs. " +#~ "IntelliJ IDEA, for example, supports auto-completion and syntax " +#~ "highlighting of JDK 5.0 annotations. The new revision of the EJB " +#~ "specification (JSR-220) uses JDK 5.0 annotations as the primary metadata " +#~ "mechanism for entity beans. Hibernate3 implements the " +#~ "EntityManager of JSR-220 (the persistence API). " +#~ "Support for mapping metadata is available via the Hibernate " +#~ "Annotations package as a separate download. Both EJB3 (JSR-" +#~ "220) and Hibernate3 metadata is supported." +#~ msgstr "" +#~ "Le JDK 5.0 introduit des annotations proches de celles de XDoclet au " +#~ "niveau java, qui sont type-safe et vérifiées à la compilation. Ce " +#~ "mécanisme est plus puissant que XDoclet et mieux supporté par les outils " +#~ "et les IDE. IntelliJ IDEA, par exemple, supporte l'auto-complétion et le " +#~ "surlignement syntaxique des annotations JDK 5.0. La nouvelle révision des " +#~ "spécifications des EJB (JSR-220) utilise les annotations JDK 5.0 comme " +#~ "mécanisme primaire pour les metadonnées des beans entités. Hibernate3 " +#~ "implémente l'EntityManager de la JSR-220 (API de " +#~ "persistance), le support du mappage de métadonnées est disponible via le " +#~ "paquetage Hibernate Annotations, en tant que module " +#~ "séparé à télécharger. EJB3 (JSR-220) et les métadonnées Hibernate3 sont " +#~ "supportés. " + +#~ msgid "This is an example of a POJO class annotated as an EJB entity bean:" +#~ msgstr "Ceci est un exemple d'une classe POJO annotée comme un EJB entité :" + +#~ msgid "" +#~ "Support for JDK 5.0 Annotations (and JSR-220) is currently under " +#~ "development. Please refer to the Hibernate Annotations module for more " +#~ "details." +#~ msgstr "" +#~ "Notez que le support des annotations JDK 5.0 (et de la JSR-220) est " +#~ "encore en cours et n'est pas terminé. Référez vous au module Hibernate " +#~ "Annotation pour plus d'informations. " diff --git a/documentation/manual/src/main/docbook/fr-FR/content/collection_mapping.po b/documentation/manual/src/main/docbook/fr-FR/content/collection_mapping.po index 3bfebae269..c27c8d3065 100644 --- a/documentation/manual/src/main/docbook/fr-FR/content/collection_mapping.po +++ b/documentation/manual/src/main/docbook/fr-FR/content/collection_mapping.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: collection_mapping\n" "Report-Msgid-Bugs-To: http://bugs.kde.org\n" -"POT-Creation-Date: 2010-02-10T07:25:34\n" +"POT-Creation-Date: 2010-07-20 21:02+0000\n" "PO-Revision-Date: 2010-01-05 08:54+1000\n" "Last-Translator: Corina Roe \n" "Language-Team: French \n" @@ -17,33 +17,53 @@ msgstr "" "X-Generator: KBabel 1.11.4\n" #. Tag: title +#: collection_mapping.xml:31 #, no-c-format msgid "Collection mapping" msgstr "Mapper une collection " #. Tag: title +#: collection_mapping.xml:34 #, no-c-format msgid "Persistent collections" msgstr "Collections persistantes" #. Tag: para -#, no-c-format +#: collection_mapping.xml:36 +#, fuzzy, no-c-format msgid "" -"Hibernate requires that persistent collection-valued fields be declared as " -"an interface type. For example:" +"Naturally Hibernate also allows to persist collections. These persistent " +"collections can contain almost any other Hibernate type, including: basic " +"types, custom types, components and references to other entities. The " +"distinction between value and reference semantics is in this context very " +"important. An object in a collection might be handled with \"value\" " +"semantics (its life cycle fully depends on the collection owner), or it " +"might be a reference to another entity with its own life cycle. In the " +"latter case, only the \"link\" between the two objects is considered to be a " +"state held by the collection." msgstr "" -"Hibernate requiert que les champs contenant des collections persistantes " -"soient déclarés comme des types d'interface, par exemple : " +"Les collections peuvent contenir la plupart des autres types Hibernate, y " +"compris tous les types basiques, les types utilisateur, les composants, et " +"bien sûr, les références vers d'autres entités. C'est une distinction " +"importante. Un objet dans une collection pourrait être géré avec une " +"sémantique de \"valeur\" (sa durée de vie dépend complètement du " +"propriétaire de la collection) ou il pourrait avoir une référence vers une " +"autre entité, avec sa propre durée de vie. Dans le dernier cas, seul le " +"\"lien\" entre les deux objets est considéré être l'état retenu par la " +"collection. " #. Tag: para -#, no-c-format +#: collection_mapping.xml:46 +#, fuzzy, no-c-format msgid "" -"The actual interface might be java.util.Set, " +"As a requirement persistent collection-valued fields must be declared as an " +"interface type (see ). The actual interface might be java.util.Set, " "java.util.Collection, java.util.List, " "java.util.Map, java.util.SortedSet, " "java.util.SortedMap or anything you like (\"anything you " "like\" means you will have to write an implementation of org." -"hibernate.usertype.UserCollectionType.)" +"hibernate.usertype.UserCollectionType)." msgstr "" "L'interface réelle peut être java.util.Set, java." "util.Collection, java.util.List, java." @@ -53,15 +73,17 @@ msgstr "" "hibernate.usertype.UserCollectionType.)" #. Tag: para -#, no-c-format +#: collection_mapping.xml:57 +#, fuzzy, no-c-format msgid "" -"Notice how the instance variable was initialized with an instance of " -"HashSet. This is the best way to initialize collection " +"Notice how in the " +"instance variable parts was initialized with an instance " +"of HashSet. This is the best way to initialize collection " "valued properties of newly instantiated (non-persistent) instances. When you " -"make the instance persistent, by calling persist() for " -"example, Hibernate will actually replace the HashSet with " -"an instance of Hibernate's own implementation of Set. Be " -"aware of the following errors:" +"make the instance persistent, by calling persist(), " +"Hibernate will actually replace the HashSet with an " +"instance of Hibernate's own implementation of Set. Be " +"aware of the following error:" msgstr "" "Notez comment nous avons initialisé la variable d'instance avec une instance " "de HashSet. C'est le meilleur moyen pour initialiser les " @@ -71,7 +93,30 @@ msgstr "" "literal> par une instance d'une implémentation propre à Hibernate de " "Set. Prenez garde aux erreurs suivantes : " +#. Tag: title +#: collection_mapping.xml:68 +#, no-c-format +msgid "Hibernate uses its own collection implementations" +msgstr "" + +#. Tag: programlisting +#: collection_mapping.xml:70 +#, no-c-format +msgid "" +"Cat cat = new DomesticCat();\n" +"Cat kitten = new DomesticCat();\n" +"....\n" +"Set kittens = new HashSet();\n" +"kittens.add(kitten);\n" +"cat.setKittens(kittens);\n" +"session.persist(cat);\n" +"\n" +"kittens = cat.getKittens(); // Okay, kittens collection is a Set\n" +"(HashSet) cat.getKittens(); // Error!" +msgstr "" + #. Tag: para +#: collection_mapping.xml:73 #, no-c-format msgid "" "The persistent collections injected by Hibernate behave like " @@ -85,6 +130,7 @@ msgstr "" "ArrayList, selon le type de l'interface. " #. Tag: para +#: collection_mapping.xml:78 #, no-c-format msgid "" "Collections instances have the usual behavior of value types. They are " @@ -108,11 +154,12 @@ msgstr "" "et une collection vide. " #. Tag: para -#, no-c-format +#: collection_mapping.xml:89 +#, fuzzy, no-c-format msgid "" "Use persistent collections the same way you use ordinary Java collections. " -"However, please ensure you understand the semantics of bidirectional " -"associations (these are discussed later)." +"However, ensure you understand the semantics of bidirectional associations " +"(see )." msgstr "" "Ne vous en souciez pas trop. Utilisez les collections persistantes de la " "même manière que vous utilisez des collections Java ordinaires. Assurez-vous " @@ -120,44 +167,286 @@ msgstr "" "loin). " #. Tag: title -#, no-c-format -msgid "Collection mappings" -msgstr "Mapper une collection" +#: collection_mapping.xml:97 +#, fuzzy, no-c-format +msgid "How to map collections" +msgstr "Collections triées" #. Tag: para +#: collection_mapping.xml:99 #, no-c-format msgid "" -"There are quite a range of mappings that can be generated for collections " -"that cover many common relational models. We suggest you experiment with the " -"schema generation tool so that you understand how various mapping " -"declarations translate to database tables." +"Using annotations you can map Collections, " +"Lists, Maps and " +"Sets of associated entities using @OneToMany and " +"@ManyToMany. For collections of a basic or embeddable type use " +"@ElementCollection. In the simplest case a collection mapping looks like " +"this:" msgstr "" -"Il y a une grande variété de mappages qui peuvent être générés pour les " -"collections, couvrant beaucoup de nombreux modèles relationnels communs. " -"Nous vous suggérons d'expérimenter avec l'outil de génération de schéma pour " -"cerner comment les différentes déclarations de mappage se traduisent vers " -"des tables de bases de données. " -#. Tag: para +#. Tag: title +#: collection_mapping.xml:107 +#, no-c-format +msgid "Collection mapping using @OneToMany and @JoinColumn" +msgstr "" + +#. Tag: programlisting +#: collection_mapping.xml:109 #, no-c-format msgid "" -"The Hibernate mapping element used for mapping a collection depends upon the " -"type of interface. For example, a <set> element is " -"used for mapping properties of type Set." +"@Entity\n" +"public class Product {\n" +"\n" +" private String serialNumber;\n" +" private Set<Part> parts = new HashSet<Part>();\n" +"\n" +" @Id\n" +" public String getSerialNumber() { return serialNumber; }\n" +" void setSerialNumber(String sn) { serialNumber = sn; }\n" +" \n" +" @OneToMany\n" +" @JoinColumn(name=\"PART_ID\")\n" +" public Set<Part> getParts() { return parts; }\n" +" void setParts(Set parts) { this.parts = parts; }\n" +"}\n" +"\n" +"\n" +"@Entity\n" +"public class Part {\n" +" ...\n" +"}" +msgstr "" + +#. Tag: para +#: collection_mapping.xml:112 +#, no-c-format +msgid "" +"Product describes a unidirectional relationship with Part using the join " +"column PART_ID. In this unidirectional one to many scenario you can also use " +"a join table as seen in ." +msgstr "" + +#. Tag: title +#: collection_mapping.xml:118 +#, no-c-format +msgid "Collection mapping using @OneToMany and @JoinTable" +msgstr "" + +#. Tag: programlisting +#: collection_mapping.xml:121 +#, no-c-format +msgid "" +"@Entity\n" +"public class Product {\n" +"\n" +" private String serialNumber;\n" +" private Set<Part> parts = new HashSet<Part>();\n" +"\n" +" @Id\n" +" public String getSerialNumber() { return serialNumber; }\n" +" void setSerialNumber(String sn) { serialNumber = sn; }\n" +" \n" +" @OneToMany\n" +" @JoinTable(\n" +" name=\"PRODUCT_PARTS\",\n" +" joinColumns = @JoinColumn( name=\"PRODUCT_ID\"),\n" +" inverseJoinColumns = @JoinColumn( name=\"PART_ID\")\n" +" )\n" +" public Set<Part> getParts() { return parts; }\n" +" void setParts(Set parts) { this.parts = parts; }\n" +"}\n" +"\n" +"\n" +"@Entity\n" +"public class Part {\n" +" ...\n" +"}" +msgstr "" + +#. Tag: para +#: collection_mapping.xml:124 +#, no-c-format +msgid "" +"Without describing any physical mapping (no @JoinColumn or @JoinTable), a unidirectional one to " +"many with join table is used. The table name is the concatenation of the " +"owner table name, _, and the other side table name. The foreign key name(s) " +"referencing the owner table is the concatenation of the owner table, _, and " +"the owner primary key column(s) name. The foreign key name(s) referencing " +"the other side is the concatenation of the owner property name, _, and the " +"other side primary key column(s) name. A unique constraint is added to the " +"foreign key referencing the other side table to reflect the one to many." +msgstr "" + +#. Tag: para +#: collection_mapping.xml:135 +#, fuzzy, no-c-format +msgid "" +"Lets have a look now how collections are mapped using Hibernate mapping " +"files. In this case the first step is to chose the right mapping element. It " +"depends on the type of interface. For example, a <set> element is used for mapping properties of type Set." msgstr "" "L'élément de mappage d'Hibernate utilisé pour mapper une collection dépend " "du type de l'interface. Par exemple, un élément <set> est utilisé pour mapper des propriétés de type Set. " -#. Tag: para +#. Tag: title +#: collection_mapping.xml:142 +#, no-c-format +msgid "Mapping a Set using <set>" +msgstr "" + +#. Tag: programlisting +#: collection_mapping.xml:144 #, no-c-format msgid "" -"Apart from <set>, there is also <" -"list>, <map>, <bag>, <array> and <primitive-" -"array> mapping elements. The <map> " -"element is representative:" +"<class name=\"Product\">\n" +" <id name=\"serialNumber\" column=\"productSerialNumber\"/>\n" +" <set name=\"parts\">\n" +" <key column=\"productSerialNumber\" not-null=\"true\"/>\n" +" <one-to-many class=\"Part\"/>\n" +" </set>\n" +"</class>" +msgstr "" + +#. Tag: para +#: collection_mapping.xml:147 +#, fuzzy, no-c-format +msgid "" +"In a one-to-many " +"association links the Product and " +"Part entities. This association requires the existence of " +"a foreign key column and possibly an index column to the Part table. This mapping loses certain semantics of normal Java " +"collections:" +msgstr "" +"Une association de Product vers Part " +"requiert l'existence d'une clé étrangère et éventuellement une colonne " +"d'index pour la table Part. Une balise <one-" +"to-many> indique que c'est une association un-à-plusieurs. " + +#. Tag: para +#: collection_mapping.xml:156 +#, no-c-format +msgid "" +"An instance of the contained entity class cannot belong to more than one " +"instance of the collection." +msgstr "" +"Une instance de la classe de l'entité contenue ne peut pas appartenir à plus " +"d'une instance de la collection." + +#. Tag: para +#: collection_mapping.xml:161 +#, no-c-format +msgid "" +"An instance of the contained entity class cannot appear at more than one " +"value of the collection index." +msgstr "" +"Une instance de la classe de l'entité contenue peut ne pas apparaître à plus " +"plus d'une valeur d'index de la collection." + +#. Tag: para +#: collection_mapping.xml:166 +#, no-c-format +msgid "" +"Looking closer at the used <one-to-many> tag we see " +"that it has the following options." +msgstr "" + +#. Tag: title +#: collection_mapping.xml:170 +#, no-c-format +msgid "options of <one-to-many> element" +msgstr "" + +#. Tag: programlisting +#: collection_mapping.xml:181 +#, no-c-format +msgid "" +"<one-to-many\n" +" class=\"ClassName\"\n" +" not-found=\"ignore|exception\"\n" +" entity-name=\"EntityName\"\n" +" node=\"element-name\"\n" +" embed-xml=\"true|false\"\n" +" />" +msgstr "" + +#. Tag: para +#: collection_mapping.xml:185 +#, no-c-format +msgid "class (required): the name of the associated class." +msgstr "class (requis) : le nom de la classe associée." + +#. Tag: para +#: collection_mapping.xml:190 +#, no-c-format +msgid "" +"not-found (optional - defaults to exception): specifies how cached identifiers that reference missing rows will " +"be handled. ignore will treat a missing row as a null " +"association." +msgstr "" +"not-found (optionnel - par défaut exception) : spécifie comment les identifiants cachés qui référencent des " +"lignes manquantes seront gérés : ignore traitera une " +"ligne manquante comme une association nulle." + +#. Tag: para +#: collection_mapping.xml:198 +#, no-c-format +msgid "" +"entity-name (optional): the entity name of the associated " +"class, as an alternative to class." +msgstr "" +"entity-name (optionnel) : le nom de l'entité de la classe " +"associée, comme une alternative à class. " + +#. Tag: para +#: collection_mapping.xml:206 +#, no-c-format +msgid "" +"The <one-to-many> element does not need to declare " +"any columns. Nor is it necessary to specify the table " +"name anywhere." +msgstr "" +"Notez que l'élément <one-to-many> n'a pas besoin de " +"déclarer de colonnes. Il n'est pas non plus nécessaire de spécifier le nom " +"de la table à aucun endroit." + +#. Tag: para +#: collection_mapping.xml:211 +#, fuzzy, no-c-format +msgid "" +"If the foreign key column of a <one-to-many> " +"association is declared NOT NULL, you must declare the " +"<key> mapping not-null=\"true\" " +"or use a bidirectional association with the collection " +"mapping marked inverse=\"true\". See ." +msgstr "" +"Note très importante : si la colonne de la clé d'une " +"association <one-to-many> est déclarée NOT " +"NULL, vous devez déclarer le mappage de <key> avec not-null=\"true\" ou utiliser " +"une association bidirectionnelle avec le mappage de la " +"collection marqué inverse=\"true\". Voir la discussion " +"sur les associations bidirectionnelles plus tard dans ce chapitre. " + +#. Tag: para +#: collection_mapping.xml:221 +#, fuzzy, no-c-format +msgid "" +"Apart from the <set> tag as shown in , there is also <list>, <map>, <bag>, " +"<array> and <primitive-array> mapping elements. The <map> element is " +"representative:" msgstr "" "À part <set>, il y aussi les éléments de mappage " "<list>, <map>, " @@ -165,13 +454,50 @@ msgstr "" "<primitive-array>. L'élément <map> est représentatif : " +#. Tag: title +#: collection_mapping.xml:229 +#, no-c-format +msgid "Elements of the <map> mapping" +msgstr "" + +#. Tag: programlisting +#: collection_mapping.xml:262 +#, no-c-format +msgid "" +"<map\n" +" name=\"propertyName\"\n" +" table=\"table_name\"\n" +" schema=\"schema_name\"\n" +" lazy=\"true|extra|false\"\n" +" inverse=\"true|false\"\n" +" cascade=\"all|none|save-update|delete|all-delete-orphan|delete-orphan\"\n" +" sort=\"unsorted|natural|comparatorClass\"\n" +" order-by=\"column_name asc|desc\"\n" +" where=\"arbitrary sql where condition\"\n" +" fetch=\"join|select|subselect\"\n" +" batch-size=\"N\"\n" +" access=\"field|property|ClassName\"\n" +" optimistic-lock=\"true|false\"\n" +" mutable=\"true|false\"\n" +" node=\"element-name|.\"\n" +" embed-xml=\"true|false\"\n" +">\n" +"\n" +" <key .... />\n" +" <map-key .... />\n" +" <element .... />\n" +"</map>" +msgstr "" + #. Tag: para +#: collection_mapping.xml:266 #, no-c-format msgid "name: the collection property name" msgstr "" "name : le nom de la propriété contenant la collection " #. Tag: para +#: collection_mapping.xml:270 #, no-c-format msgid "" "table (optional - defaults to property name): the name of " @@ -182,6 +508,7 @@ msgstr "" "plusieurs) " #. Tag: para +#: collection_mapping.xml:276 #, no-c-format msgid "" "schema (optional): the name of a table schema to override " @@ -191,6 +518,7 @@ msgstr "" "schéma déclaré dans l'élément racine " #. Tag: para +#: collection_mapping.xml:281 #, no-c-format msgid "" "lazy (optional - defaults to true): " @@ -206,6 +534,7 @@ msgstr "" "collection (approprié pour de très grosses collections)." #. Tag: para +#: collection_mapping.xml:290 #, no-c-format msgid "" "inverse (optional - defaults to falsecascade (optional - defaults to none): " @@ -226,6 +556,7 @@ msgstr "" "literal>) : active les opérations de cascade vers les entités filles." #. Tag: para +#: collection_mapping.xml:302 #, no-c-format msgid "" "sort (optional): specifies a sorted collection with " @@ -236,12 +567,13 @@ msgstr "" "donnée." #. Tag: para -#, no-c-format +#: collection_mapping.xml:308 +#, fuzzy, no-c-format msgid "" -"order-by (optional, JDK1.4 only): specifies a table " -"column or columns that define the iteration order of the Map, Set or bag, together with an optional " -"asc or desc." +"order-by (optional): specifies a table column or columns " +"that define the iteration order of the Map, Set or bag, together with an optional asc or " +"desc." msgstr "" "order-by (optionnel, seulement à partir du JDK1.4) : " "spécifie une colonne de table (ou des colonnes) qui définit l'ordre " @@ -249,6 +581,7 @@ msgstr "" "en option asc ou desc." #. Tag: para +#: collection_mapping.xml:316 #, no-c-format msgid "" "where (optional): specifies an arbitrary SQL " @@ -262,6 +595,7 @@ msgstr "" "données disponibles)." #. Tag: para +#: collection_mapping.xml:324 #, no-c-format msgid "" "fetch (optional, defaults to select): " @@ -274,6 +608,7 @@ msgstr "" "séquentiels." #. Tag: para +#: collection_mapping.xml:331 #, no-c-format msgid "" "batch-size (optional, defaults to 1): " @@ -284,6 +619,7 @@ msgstr "" "instances de cette collection." #. Tag: para +#: collection_mapping.xml:337 #, no-c-format msgid "" "access (optional - defaults to propertyoptimistic-lock (optional - defaults to truemutable (optional - defaults to true): " @@ -321,19 +659,31 @@ msgstr "" "de la collection ne changent jamais (une optimisation mineure dans certains " "cas)." +#. Tag: para +#: collection_mapping.xml:360 +#, no-c-format +msgid "" +"After exploring the basic mapping of collections in the preceding paragraphs " +"we will now focus details like physical mapping considerations, indexed " +"collections and collections of value types." +msgstr "" + #. Tag: title +#: collection_mapping.xml:365 #, no-c-format msgid "Collection foreign keys" msgstr "Les clés étrangères d'une collection" #. Tag: para -#, no-c-format +#: collection_mapping.xml:367 +#, fuzzy, no-c-format msgid "" -"Collection instances are distinguished in the database by the foreign key of " -"the entity that owns the collection. This foreign key is referred to as the " -"collection key column, or columns, of the collection " -"table. The collection key column is mapped by the <key> element." +"On the database level collection instances are distinguished by the foreign " +"key of the entity that owns the collection. This foreign key is referred to " +"as the collection key column, or columns, of the " +"collection table. The collection key column is mapped by the " +"@JoinColumn annotation respectively the <" +"key> XML element." msgstr "" "Les instances d'une collection sont distinguées dans la base de données par " "la clé étrangère de l'entité qui possède la collection. Cette clé étrangère " @@ -342,113 +692,280 @@ msgstr "" "collection est mappée par l'élément <key>." #. Tag: para -#, no-c-format +#: collection_mapping.xml:374 +#, fuzzy, no-c-format msgid "" "There can be a nullability constraint on the foreign key column. For most " "collections, this is implied. For unidirectional one-to-many associations, " -"the foreign key column is nullable by default, so you may need to specify " -"not-null=\"true\"." +"the foreign key column is nullable by default, so you may need to specify" msgstr "" "Il peut y avoir une contrainte de nullité sur la colonne de la clé " "étrangère. Pour les associations unidirectionnelles un-à-plusieurs, la " "colonne de la clé étrangère peut être nulle par défaut, donc vous pourriez " "avoir besoin de spécifier not-null=\"true\". " -#. Tag: para +#. Tag: programlisting +#: collection_mapping.xml:379 #, no-c-format +msgid "@JoinColumn(nullable=false)" +msgstr "" + +#. Tag: para +#: collection_mapping.xml:381 +#, no-c-format +msgid "or" +msgstr "" + +#. Tag: programlisting +#: collection_mapping.xml:383 +#, no-c-format +msgid "<key column=\"productSerialNumber\" not-null=\"true\"/>" +msgstr "" + +#. Tag: para +#: collection_mapping.xml:385 +#, fuzzy, no-c-format msgid "" -"The foreign key constraint can use ON DELETE CASCADE." +"The foreign key constraint can use ON DELETE CASCADE. In " +"XML this can be expressed via:" msgstr "" "La contraite de la clé étrangère peut utiliser ON DELETE CASCADE. " +#. Tag: programlisting +#: collection_mapping.xml:388 +#, no-c-format +msgid "<key column=\"productSerialNumber\" on-delete=\"cascade\"/>" +msgstr "" + #. Tag: para +#: collection_mapping.xml:390 #, no-c-format msgid "" -"See the previous chapter for a full definition of the <key> element." +"In annotations the Hibernate specific annotation @OnDelete has to be used." +msgstr "" + +#. Tag: programlisting +#: collection_mapping.xml:393 +#, no-c-format +msgid "@OnDelete(action=OnDeleteAction.CASCADE)" +msgstr "" + +#. Tag: para +#: collection_mapping.xml:395 +#, fuzzy, no-c-format +msgid "" +"See for more information about the " +"<key> element." msgstr "" "Voir le chapitre précédent pour une définition complète de l'élément " "<key>." #. Tag: title -#, no-c-format -msgid "Collection elements" -msgstr "Les éléments d'une collection" - -#. Tag: para -#, no-c-format -msgid "" -"Collections can contain almost any other Hibernate type, including: basic " -"types, custom types, components and references to other entities. This is an " -"important distinction. An object in a collection might be handled with " -"\"value\" semantics (its life cycle fully depends on the collection owner), " -"or it might be a reference to another entity with its own life cycle. In the " -"latter case, only the \"link\" between the two objects is considered to be a " -"state held by the collection." -msgstr "" -"Les collections peuvent contenir la plupart des autres types Hibernate, y " -"compris tous les types basiques, les types utilisateur, les composants, et " -"bien sûr, les références vers d'autres entités. C'est une distinction " -"importante. Un objet dans une collection pourrait être géré avec une " -"sémantique de \"valeur\" (sa durée de vie dépend complètement du " -"propriétaire de la collection) ou il pourrait avoir une référence vers une " -"autre entité, avec sa propre durée de vie. Dans le dernier cas, seul le " -"\"lien\" entre les deux objets est considéré être l'état retenu par la " -"collection. " - -#. Tag: para -#, no-c-format -msgid "" -"The contained type is referred to as the collection element type. Collection elements are mapped by <element> or <composite-element>, or in the case of " -"entity references, with <one-to-many> or " -"<many-to-many>. The first two map elements with " -"value semantics, the next two are used to map entity associations." -msgstr "" -"Le type contenu est référencé comme le type de l'élément de la " -"collection. Les éléments de la collections sont mappés par " -"<element> ou <composite-element>, ou dans le cas des références d'entité, avec <one-to-" -"many> ou <many-to-many>. Les deux " -"premiers mappent des éléments avec une sémantique de valeur, les deux " -"suivants sont utilisés pour mapper des associations d'entité." - -#. Tag: title +#: collection_mapping.xml:400 #, no-c-format msgid "Indexed collections" msgstr "Collections indexées" #. Tag: para +#: collection_mapping.xml:402 #, no-c-format msgid "" -"All collection mappings, except those with set and bag semantics, need an " -"index column in the collection table. An index column " -"is a column that maps to an array index, or List index, " -"or Map key. The index of a Map may be " -"of any basic type, mapped with <map-key>. It can be " -"an entity reference mapped with <map-key-many-to-many>, or it can be a composite type mapped with <composite-" -"map-key>. The index of an array or list is always of type " -"integer and is mapped using the <list-" -"index> element. The mapped column contains sequential integers " -"that are numbered from zero by default." +"In the following paragraphs we have a closer at the indexed collections " +"List and Map how the their " +"index can be mapped in Hibernate." +msgstr "" + +#. Tag: title +#: collection_mapping.xml:407 +#, no-c-format +msgid "Lists" msgstr "" -"Tous les mappages de collection, exceptés ceux avec les sémantiques " -"d'ensemble (set) et de sac (bag), ont besoin d'une colonne " -"d'index dans la table de la collection - une colonne qui mappe un " -"index de tableau, ou un index de List, ou une clé de " -"Map. L'index d'une Map peut être " -"n'importe quel type basique, mappé avec <map-key>, " -"ou peut être une référence d'entité mappée avec <map-key-many-to-" -"many>, ou peut être un type composé, mappé avec <" -"composite-map-key>. L'index d'un tableau ou d'une liste est " -"toujours de type integer et est mappé en utilisant " -"l'élément <list-index>. Les colonnes mappées " -"contiennent des entiers séquentiels (numérotés à partir de zéro par défaut). " #. Tag: para +#: collection_mapping.xml:409 +#, no-c-format +msgid "Lists can be mapped in two different ways:" +msgstr "" + +#. Tag: para +#: collection_mapping.xml:413 +#, no-c-format +msgid "as ordered lists, where the order is not materialized in the database" +msgstr "" + +#. Tag: para +#: collection_mapping.xml:418 +#, no-c-format +msgid "as indexed lists, where the order is materialized in the database" +msgstr "" + +#. Tag: para +#: collection_mapping.xml:423 +#, no-c-format +msgid "" +"To order lists in memory, add @javax.persistence.OrderBy " +"to your property. This annotation takes as parameter a list of comma " +"separated properties (of the target entity) and orders the collection " +"accordingly (eg firstname asc, age desc), if the string is " +"empty, the collection will be ordered by the primary key of the target " +"entity." +msgstr "" + +#. Tag: title +#: collection_mapping.xml:432 +#, no-c-format +msgid "Ordered lists using @OrderBy" +msgstr "" + +#. Tag: programlisting +#: collection_mapping.xml:434 +#, no-c-format +msgid "" +"@Entity\n" +"public class Customer {\n" +" @Id @GeneratedValue public Integer getId() { return id; }\n" +" public void setId(Integer id) { this.id = id; }\n" +" private Integer id;\n" +"\n" +" @OneToMany(mappedBy=\"customer\")\n" +" @OrderBy(\"number\")\n" +" public List<Order> getOrders() { return orders; }\n" +" public void setOrders(List<Order> orders) { this.orders = " +"orders; }\n" +" private List<Order> orders;\n" +"}\n" +"\n" +"@Entity\n" +"public class Order {\n" +" @Id @GeneratedValue public Integer getId() { return id; }\n" +" public void setId(Integer id) { this.id = id; }\n" +" private Integer id;\n" +"\n" +" public String getNumber() { return number; }\n" +" public void setNumber(String number) { this.number = number; }\n" +" private String number;\n" +"\n" +" @ManyToOne\n" +" public Customer getCustomer() { return customer; }\n" +" public void setCustomer(Customer customer) { this.customer = customer; }\n" +" private Customer number;\n" +"}\n" +"\n" +"-- Table schema\n" +"|-------------| |----------|\n" +"| Order | | Customer |\n" +"|-------------| |----------|\n" +"| id | | id |\n" +"| number | |----------| \n" +"| customer_id |\n" +"|-------------|" +msgstr "" + +#. Tag: para +#: collection_mapping.xml:437 +#, no-c-format +msgid "" +"To store the index value in a dedicated column, use the @javax." +"persistence.OrderColumn annotation on your property. This " +"annotations describes the column name and attributes of the column keeping " +"the index value. This column is hosted on the table containing the " +"association foreign key. If the column name is not specified, the default is " +"the name of the referencing property, followed by underscore, followed by " +"ORDER (in the following example, it would be " +"orders_ORDER)." +msgstr "" + +#. Tag: title +#: collection_mapping.xml:448 +#, no-c-format +msgid "Explicit index column using @OrderColumn" +msgstr "" + +#. Tag: programlisting +#: collection_mapping.xml:451 +#, no-c-format +msgid "" +"@Entity\n" +"public class Customer {\n" +" @Id @GeneratedValue public Integer getId() { return id; }\n" +" public void setId(Integer id) { this.id = id; }\n" +" private Integer id;\n" +"\n" +" @OneToMany(mappedBy=\"customer\")\n" +" @OrderColumn(name=\"orders_index\")\n" +" public List<Order> getOrders() { return orders; }\n" +" public void setOrders(List<Order> orders) { this.orders = " +"orders; }\n" +" private List<Order> orders;\n" +"}\n" +"\n" +"@Entity\n" +"public class Order {\n" +" @Id @GeneratedValue public Integer getId() { return id; }\n" +" public void setId(Integer id) { this.id = id; }\n" +" private Integer id;\n" +"\n" +" public String getNumber() { return number; }\n" +" public void setNumber(String number) { this.number = number; }\n" +" private String number;\n" +"\n" +" @ManyToOne\n" +" public Customer getCustomer() { return customer; }\n" +" public void setCustomer(Customer customer) { this.customer = customer; }\n" +" private Customer number;\n" +"}\n" +"\n" +"-- Table schema\n" +"|--------------| |----------|\n" +"| Order | | Customer |\n" +"|--------------| |----------|\n" +"| id | | id |\n" +"| number | |----------| \n" +"| customer_id |\n" +"| orders_order |\n" +"|--------------|" +msgstr "" + +#. Tag: para +#: collection_mapping.xml:455 +#, no-c-format +msgid "" +"We recommend you to convert the legacy @org.hibernate.annotations." +"IndexColumn usages to @OrderColumn unless " +"you are making use of the base property. The base " +"property lets you define the index value of the first element (aka as base " +"index). The usual value is 0 or 1. The " +"default is 0 like in Java." +msgstr "" + +#. Tag: para +#: collection_mapping.xml:464 +#, no-c-format +msgid "" +"Looking again at the Hibernate mapping file equivalent, the index of an " +"array or list is always of type integer and is mapped " +"using the <list-index> element. The mapped column " +"contains sequential integers that are numbered from zero by default." +msgstr "" + +#. Tag: title +#: collection_mapping.xml:471 +#, no-c-format +msgid "index-list element for indexed collections in xml mapping" +msgstr "" + +#. Tag: programlisting +#: collection_mapping.xml:481 +#, no-c-format +msgid "" +"<list-index\n" +" column=\"column_name\"\n" +" base=\"0|1|...\"/>" +msgstr "" + +#. Tag: para +#: collection_mapping.xml:485 #, no-c-format msgid "" "column_name (required): the name of the column holding " @@ -458,6 +975,7 @@ msgstr "" "contient les valeurs 'index' de la collection." #. Tag: para +#: collection_mapping.xml:490 #, no-c-format msgid "" "base (optional - defaults to 0): the " @@ -469,55 +987,7 @@ msgstr "" "ou de la table." #. Tag: para -#, no-c-format -msgid "" -"column (optional): the name of the column holding the " -"collection index values." -msgstr "" -"colonne (optionnel) : le nom de la colonne qui contient " -"les valeurs 'index' de la collection." - -#. Tag: para -#, no-c-format -msgid "" -"formula (optional): a SQL formula used to evaluate the " -"key of the map." -msgstr "" -"formula (optionnel): formule SQL utilisée pour évaluer la " -"clé de la mappe." - -#. Tag: para -#, no-c-format -msgid "type (required): the type of the map keys." -msgstr "type (requis) : le type de clés de mappe." - -#. Tag: para -#, no-c-format -msgid "" -"column (optional): the name of the foreign key column for " -"the collection index values." -msgstr "" -"colonne (optionnel) : le nom de la colonne de clés " -"étrangères pour la collection de valeurs 'index'." - -#. Tag: para -#, no-c-format -msgid "" -"formula (optional): a SQ formula used to evaluate the " -"foreign key of the map key." -msgstr "" -"formula (optionnel): formule SQ utilisée pour évaluer la " -"clé étrangère d'une clé de mappe." - -#. Tag: para -#, no-c-format -msgid "" -"class (required): the entity class used as the map key." -msgstr "" -"class (requis) : le nom de la classe utilisée en tant que " -"clé de mappe." - -#. Tag: para +#: collection_mapping.xml:498 #, no-c-format msgid "" "If your table does not have an index column, and you still wish to use " @@ -533,33 +1003,485 @@ msgstr "" "données, mais il peut être optionnellement trié ou ordonné. " #. Tag: title +#: collection_mapping.xml:506 #, no-c-format -msgid "Collections of values and many-to-many associations" +msgid "Maps" +msgstr "" + +#. Tag: para +#: collection_mapping.xml:508 +#, no-c-format +msgid "" +"The question with Maps is where the key value is " +"stored. There are everal options. Maps can borrow their keys from one of the " +"associated entity properties or have dedicated columns to store an explicit " +"key." +msgstr "" + +#. Tag: para +#: collection_mapping.xml:513 +#, no-c-format +msgid "" +"To use one of the target entity property as a key of the map, use " +"@MapKey(name=\"myProperty\"), where myProperty is a property name in the target entity. When using " +"@MapKey without the name attribuate, the target entity " +"primary key is used. The map key uses the same column as the property " +"pointed out. There is no additional column defined to hold the map key, " +"because the map key represent a target property. Be aware that once loaded, " +"the key is no longer kept in sync with the property. In other words, if you " +"change the property value, the key will not change automatically in your " +"Java model." +msgstr "" + +#. Tag: title +#: collection_mapping.xml:525 +#, no-c-format +msgid "" +"Use of target entity property as map key via @MapKey" +msgstr "" + +#. Tag: programlisting +#: collection_mapping.xml:528 +#, no-c-format +msgid "" +"@Entity\n" +"public class Customer {\n" +" @Id @GeneratedValue public Integer getId() { return id; }\n" +" public void setId(Integer id) { this.id = id; }\n" +" private Integer id;\n" +"\n" +" @OneToMany(mappedBy=\"customer\")\n" +" @MapKey(name=\"number\")\n" +" public Map<String,Order> getOrders() { return orders; }\n" +" public void setOrders(Map<String,Order> order) { this.orders = " +"orders; }\n" +" private Map<String,Order> orders;\n" +"}\n" +"\n" +"@Entity\n" +"public class Order {\n" +" @Id @GeneratedValue public Integer getId() { return id; }\n" +" public void setId(Integer id) { this.id = id; }\n" +" private Integer id;\n" +"\n" +" public String getNumber() { return number; }\n" +" public void setNumber(String number) { this.number = number; }\n" +" private String number;\n" +"\n" +" @ManyToOne\n" +" public Customer getCustomer() { return customer; }\n" +" public void setCustomer(Customer customer) { this.customer = customer; }\n" +" private Customer number;\n" +"}\n" +"\n" +"-- Table schema\n" +"|-------------| |----------|\n" +"| Order | | Customer |\n" +"|-------------| |----------|\n" +"| id | | id |\n" +"| number | |----------| \n" +"| customer_id |\n" +"|-------------|" +msgstr "" + +#. Tag: para +#: collection_mapping.xml:531 +#, no-c-format +msgid "" +"Alternatively the map key is mapped to a dedicated column or columns. In " +"order to customize the mapping use one of the following annotations:" +msgstr "" + +#. Tag: para +#: collection_mapping.xml:537 +#, no-c-format +msgid "" +"@MapKeyColumn if the map key is a basic type. If you " +"don't specify the column name, the name of the property followed by " +"underscore followed by KEY is used (for example " +"orders_KEY)." +msgstr "" + +#. Tag: para +#: collection_mapping.xml:544 +#, no-c-format +msgid "" +"@MapKeyEnumerated / @MapKeyTemporal if the map key type is respectively an enum or a Date." +msgstr "" + +#. Tag: para +#: collection_mapping.xml:550 +#, no-c-format +msgid "" +"@MapKeyJoinColumn/@MapKeyJoinColumns if the map key type is another entity." +msgstr "" + +#. Tag: para +#: collection_mapping.xml:555 +#, no-c-format +msgid "" +"@AttributeOverride/@AttributeOverrides when the map key is a embeddable object. Use key. as a prefix for your embeddable object property names." +msgstr "" + +#. Tag: para +#: collection_mapping.xml:562 +#, no-c-format +msgid "" +"You can also use @MapKeyClass to define the type of " +"the key if you don't use generics." +msgstr "" + +#. Tag: title +#: collection_mapping.xml:566 +#, no-c-format +msgid "Map key as basic type using @MapKeyColumn" +msgstr "" + +#. Tag: programlisting +#: collection_mapping.xml:569 +#, no-c-format +msgid "" +"@Entity\n" +"public class Customer {\n" +" @Id @GeneratedValue public Integer getId() { return id; }\n" +" public void setId(Integer id) { this.id = id; }\n" +" private Integer id;\n" +"\n" +" @OneToMany @JoinTable(name=\"Cust_Order\")\n" +" @MapKeyColumn(name=\"orders_number\")\n" +" public Map<String,Order> getOrders() { return orders; }\n" +" public void setOrders(Map<String,Order> orders) { this.orders = " +"orders; }\n" +" private Map<String,Order> orders;\n" +"}\n" +"\n" +"@Entity\n" +"public class Order {\n" +" @Id @GeneratedValue public Integer getId() { return id; }\n" +" public void setId(Integer id) { this.id = id; }\n" +" private Integer id;\n" +"\n" +" public String getNumber() { return number; }\n" +" public void setNumber(String number) { this.number = number; }\n" +" private String number;\n" +"\n" +" @ManyToOne\n" +" public Customer getCustomer() { return customer; }\n" +" public void setCustomer(Customer customer) { this.customer = customer; }\n" +" private Customer number;\n" +"}\n" +"\n" +"-- Table schema\n" +"|-------------| |----------| |---------------|\n" +"| Order | | Customer | | Cust_Order |\n" +"|-------------| |----------| |---------------|\n" +"| id | | id | | customer_id |\n" +"| number | |----------| | order_id |\n" +"| customer_id | | orders_number |\n" +"|-------------| |---------------|" +msgstr "" + +#. Tag: para +#: collection_mapping.xml:573 +#, no-c-format +msgid "" +"We recommend you to migrate from @org.hibernate.annotations." +"MapKey / @org.hibernate.annotation.MapKeyManyToMany to the new standard approach described above" +msgstr "" + +#. Tag: para +#: collection_mapping.xml:579 +#, fuzzy, no-c-format +msgid "" +"Using Hibernate mapping files there exists equivalent concepts to the " +"descibed annotations. You have to use <map-key>, " +"<map-key-many-to-many> and <composite-" +"map-key>. <map-key> is used for any " +"basic type, <map-key-many-to-many> for an entity " +"reference and <composite-map-key> for a composite " +"type." +msgstr "" +"À part <set>, il y aussi les éléments de mappage " +"<list>, <map>, " +"<bag>, <array> et " +"<primitive-array>. L'élément <map> est représentatif : " + +#. Tag: title +#: collection_mapping.xml:590 +#, no-c-format +msgid "map-key xml mapping element" +msgstr "" + +#. Tag: programlisting +#: collection_mapping.xml:601 +#, no-c-format +msgid "" +"<map-key\n" +" column=\"column_name\"\n" +" formula=\"any SQL expression\"\n" +" type=\"type_name\"\n" +" node=\"@attribute-name\"\n" +" length=\"N\"/>" +msgstr "" + +#. Tag: para +#: collection_mapping.xml:605 +#, no-c-format +msgid "" +"column (optional): the name of the column holding the " +"collection index values." +msgstr "" +"colonne (optionnel) : le nom de la colonne qui contient " +"les valeurs 'index' de la collection." + +#. Tag: para +#: collection_mapping.xml:610 +#, no-c-format +msgid "" +"formula (optional): a SQL formula used to evaluate the " +"key of the map." +msgstr "" +"formula (optionnel): formule SQL utilisée pour évaluer la " +"clé de la mappe." + +#. Tag: para +#: collection_mapping.xml:615 +#, no-c-format +msgid "type (required): the type of the map keys." +msgstr "type (requis) : le type de clés de mappe." + +#. Tag: title +#: collection_mapping.xml:623 +#, fuzzy, no-c-format +msgid "map-key-many-to-many" +msgstr "plusieurs-à-plusieurs " + +#. Tag: programlisting +#: collection_mapping.xml:634 +#, no-c-format +msgid "" +"<map-key-many-to-many\n" +" column=\"column_name\"\n" +" formula=\"any SQL expression\"\n" +" class=\"ClassName\"\n" +"/>" +msgstr "" + +#. Tag: para +#: collection_mapping.xml:638 +#, no-c-format +msgid "" +"column (optional): the name of the foreign key column for " +"the collection index values." +msgstr "" +"colonne (optionnel) : le nom de la colonne de clés " +"étrangères pour la collection de valeurs 'index'." + +#. Tag: para +#: collection_mapping.xml:643 +#, no-c-format +msgid "" +"formula (optional): a SQ formula used to evaluate the " +"foreign key of the map key." +msgstr "" +"formula (optionnel): formule SQ utilisée pour évaluer la " +"clé étrangère d'une clé de mappe." + +#. Tag: para +#: collection_mapping.xml:648 +#, no-c-format +msgid "" +"class (required): the entity class used as the map key." +msgstr "" +"class (requis) : le nom de la classe utilisée en tant que " +"clé de mappe." + +#. Tag: title +#: collection_mapping.xml:658 +#, fuzzy, no-c-format +msgid "Collections of basic types and embeddable objects" msgstr "Collections de valeurs et associations plusieurs-à-plusieurs" #. Tag: para +#: collection_mapping.xml:660 #, no-c-format msgid "" -"Any collection of values or many-to-many associations requires a dedicated " -"collection table with a foreign key column or columns, " -"collection element column or columns, and possibly an " -"index column or columns." +"In some situations you don't need to associate two entities but simply " +"create a collection of basic types or embeddable objects. Use the " +"@ElementCollection for this case." +msgstr "" + +#. Tag: title +#: collection_mapping.xml:665 +#, no-c-format +msgid "" +"Collection of basic types mapped via @ElementCollection" +msgstr "" + +#. Tag: programlisting +#: collection_mapping.xml:668 +#, no-c-format +msgid "" +"@Entity\n" +"public class User {\n" +" [...]\n" +" public String getLastname() { ...}\n" +"\n" +" @ElementCollection\n" +" @CollectionTable(name=\"Nicknames\", joinColumns=@JoinColumn(name=" +"\"user_id\"))\n" +" @Column(name=\"nickname\")\n" +" public Set<String> getNicknames() { ... } \n" +"}" msgstr "" -"Toute collection de valeurs ou association plusieurs-à-plusieurs requiert " -"une table de collection avec une(des) colonne(s) de clé " -"étrangère, une(des) colonne(s) d'élément de la collection ou des colonnes et éventuellement une(des) colonne(s) d'index. " #. Tag: para +#: collection_mapping.xml:671 #, no-c-format msgid "" -"For a collection of values use the <element> tag. " -"For example:" +"The collection table holding the collection data is set using the " +"@CollectionTable annotation. If omitted the " +"collection table name defaults to the concatenation of the name of the " +"containing entity and the name of the collection attribute, separated by an " +"underscore. In our example, it would be User_nicknames." +msgstr "" + +#. Tag: para +#: collection_mapping.xml:678 +#, no-c-format +msgid "" +"The column holding the basic type is set using the @Column annotation. If omitted, the column name defaults to the property " +"name: in our example, it would be nicknames." +msgstr "" + +#. Tag: para +#: collection_mapping.xml:683 +#, no-c-format +msgid "" +"But you are not limited to basic types, the collection type can be any " +"embeddable object. To override the columns of the embeddable object in the " +"collection table, use the @AttributeOverride " +"annotation." +msgstr "" + +#. Tag: title +#: collection_mapping.xml:689 +#, no-c-format +msgid "@ElementCollection for embeddable objects" +msgstr "" + +#. Tag: programlisting +#: collection_mapping.xml:691 +#, no-c-format +msgid "" +"@Entity\n" +"public class User {\n" +" [...]\n" +" public String getLastname() { ...}\n" +"\n" +" @ElementCollection\n" +" @CollectionTable(name=\"Addresses\", joinColumns=@JoinColumn(name=" +"\"user_id\"))\n" +" @AttributeOverrides({\n" +" @AttributeOverride(name=\"street1\", column=@Column(name=\"fld_street" +"\"))\n" +" })\n" +" public Set<Address> getAddresses() { ... } \n" +"}\n" +"\n" +"@Embeddable\n" +"public class Address {\n" +" public String getStreet1() {...}\n" +" [...]\n" +"}" +msgstr "" + +#. Tag: para +#: collection_mapping.xml:694 +#, no-c-format +msgid "Such an embeddable object cannot contains a collection itself." +msgstr "" + +#. Tag: para +#: collection_mapping.xml:698 +#, no-c-format +msgid "" +"in @AttributeOverride, you must use the " +"value. prefix to override properties of the embeddable " +"object used in the map value and the key. prefix to " +"override properties of the embeddable object used in the map key." +msgstr "" + +#. Tag: programlisting +#: collection_mapping.xml:704 +#, no-c-format +msgid "" +"@Entity\n" +"public class User {\n" +" @ElementCollection\n" +" @AttributeOverrides({\n" +" @AttributeOverride(name=\"key.street1\", column=@Column(name=" +"\"fld_street\")),\n" +" @AttributeOverride(name=\"value.stars\", column=@Column(name=\"fld_note" +"\"))\n" +" })\n" +" public Map<Address,Rating> getFavHomes() { ... }" +msgstr "" + +#. Tag: para +#: collection_mapping.xml:708 +#, no-c-format +msgid "" +"We recommend you to migrate from @org.hibernate.annotations." +"CollectionOfElements to the new @ElementCollection annotation." +msgstr "" + +#. Tag: para +#: collection_mapping.xml:714 +#, fuzzy, no-c-format +msgid "" +"Using the mapping file approach a collection of values is mapped using the " +"<element> tag. For example:" msgstr "" "Pour une collection de valeurs, nous utilisons la balise <" "element>. Par exemple :" +#. Tag: title +#: collection_mapping.xml:718 +#, no-c-format +msgid "<element> tag for collection values using mapping files" +msgstr "" + +#. Tag: programlisting +#: collection_mapping.xml:730 +#, no-c-format +msgid "" +"<element\n" +" column=\"column_name\"\n" +" formula=\"any SQL expression\"\n" +" type=\"typename\"\n" +" length=\"L\"\n" +" precision=\"P\"\n" +" scale=\"S\"\n" +" not-null=\"true|false\"\n" +" unique=\"true|false\"\n" +" node=\"element-name\"\n" +"/>" +msgstr "" + #. Tag: para +#: collection_mapping.xml:734 #, no-c-format msgid "" "column (optional): the name of the column holding the " @@ -569,6 +1491,7 @@ msgstr "" "les valeurs des éléments de collection." #. Tag: para +#: collection_mapping.xml:739 #, no-c-format msgid "" "formula (optional): an SQL formula used to evaluate the " @@ -578,264 +1501,89 @@ msgstr "" "l'élément." #. Tag: para +#: collection_mapping.xml:744 #, no-c-format msgid "type (required): the type of the collection element." msgstr "type (requis) : le type d'élément de collection." -#. Tag: para -#, no-c-format -msgid "" -"A many-to-many association is specified using the " -"<many-to-many> element." -msgstr "" -"Une association many-to-many est spécifiée en utilisant " -"l'élément <many-to-many>." - -#. Tag: para -#, no-c-format -msgid "" -"column (optional): the name of the element foreign key " -"column." -msgstr "" -"colonne (optionnel) : le nom de la colonne de clés " -"étrangères des éléments." - -#. Tag: para -#, no-c-format -msgid "" -"formula (optional): an SQL formula used to evaluate the " -"element foreign key value." -msgstr "" -"formula (optionnel): formule SQL utilisée pour évaluer la " -"valeur des clés étrangères des éléments." - -#. Tag: para -#, no-c-format -msgid "class (required): the name of the associated class." -msgstr "class (requis) : le nom de la classe associée." - -#. Tag: para -#, no-c-format -msgid "" -"fetch (optional - defaults to join): " -"enables outer-join or sequential select fetching for this association. This " -"is a special case; for full eager fetching in a single SELECT of an entity and its many-to-many relationships to other entities, " -"you would enable join fetching,not only of the collection " -"itself, but also with this attribute on the <many-to-many> nested element." -msgstr "" -"fetch (optionnel - par défaut join): " -"permet la récupération par jointures externes ou bien par selects " -"séquentiels pour cette association. Il s'agit d'un cas particulier de " -"récupération. Pour que la récupération soit toujours rapportée en un seul " -"SELECT d'entité ou à partir de ses relations many-to-many " -"à d'autres entités, vous devrez activer la récupération join, non seulement pour la collection elle-même, mais aussi avec cet " -"attribut qui se trouve sur l'élément <many-to-many>." - -#. Tag: para -#, no-c-format -msgid "" -"unique (optional): enables the DDL generation of a unique " -"constraint for the foreign-key column. This makes the association " -"multiplicity effectively one-to-many." -msgstr "" -"unique (optionnel): permet la génération DDL d'une seule " -"contrainte pour la colonne de la clé étrangère. Cela transforme la " -"muticiplicité de l'association en one-to-many." - -#. Tag: para -#, no-c-format -msgid "" -"not-found (optional - defaults to exception): specifies how foreign keys that reference missing rows will be " -"handled: ignore will treat a missing row as a null " -"association." -msgstr "" -"not-found (optionnel - par défaut exception) : spécifie comment les clés étrangères cachées qui référencent des " -"lignes manquantes seront gérées : ignore traitera une " -"ligne manquante comme une association nulle." - -#. Tag: para -#, no-c-format -msgid "" -"entity-name (optional): the entity name of the associated " -"class, as an alternative to class." -msgstr "" -"entity-name (optionnel) : le nom de l'entité de la classe " -"associée, comme une alternative à class. " - -#. Tag: para -#, no-c-format -msgid "" -"property-ref (optional): the name of a property of the " -"associated class that is joined to this foreign key. If not specified, the " -"primary key of the associated class is used." -msgstr "" -"property-ref (optionnel): nom d'une propriété de la " -"classe associée associée à une clé étrangère. Si elle n'est pas précisée, la " -"clé primaire de la classe associée sera alors utilisée." - -#. Tag: para -#, no-c-format -msgid "Here are some examples." -msgstr "Voici quelques exemples :" - -#. Tag: para -#, no-c-format -msgid "A set of strings:" -msgstr "Un ensemble de chaînes de caractères :" - -#. Tag: para -#, no-c-format -msgid "" -"A bag containing integers with an iteration order determined by the " -"order-by attribute:" -msgstr "" -"Un sac contenant des entiers (avec un ordre d'itération déterminé par " -"l'attribut order-by) : " - -#. Tag: para -#, no-c-format -msgid "An array of entities, in this case, a many-to-many association:" -msgstr "" -"Un tableau d'entités - dans ce cas, une association plusieurs-à-plusieurs : " - -#. Tag: para -#, no-c-format -msgid "A map from string indices to dates:" -msgstr "Une map de chaînes de caractères vers des dates :" - -#. Tag: para -#, no-c-format -msgid "A list of components (this is discussed in the next chapter):" -msgstr "Une liste de composants (traité dans le prochain chapitre) : " - -#. Tag: title -#, no-c-format -msgid "One-to-many associations" -msgstr "Associations un-à-plusieurs" - -#. Tag: para -#, no-c-format -msgid "" -"A one-to-many association links the tables of two " -"classes via a foreign key with no intervening collection table. This mapping " -"loses certain semantics of normal Java collections:" -msgstr "" -"Une association un-à-plusieurs lie les tables de deux " -"classes par une clé étrangère, sans l'intervention d'une table de " -"collection. Ce mappage perd certaines sémantiques des collections Java " -"normales : " - -#. Tag: para -#, no-c-format -msgid "" -"An instance of the contained entity class cannot belong to more than one " -"instance of the collection." -msgstr "" -"Une instance de la classe de l'entité contenue ne peut pas appartenir à plus " -"d'une instance de la collection." - -#. Tag: para -#, no-c-format -msgid "" -"An instance of the contained entity class cannot appear at more than one " -"value of the collection index." -msgstr "" -"Une instance de la classe de l'entité contenue peut ne pas apparaître à plus " -"plus d'une valeur d'index de la collection." - -#. Tag: para -#, no-c-format -msgid "" -"An association from Product to Part " -"requires the existence of a foreign key column and possibly an index column " -"to the Part table. A <one-to-many> tag indicates that this is a one-to-many association." -msgstr "" -"Une association de Product vers Part " -"requiert l'existence d'une clé étrangère et éventuellement une colonne " -"d'index pour la table Part. Une balise <one-" -"to-many> indique que c'est une association un-à-plusieurs. " - -#. Tag: para -#, no-c-format -msgid "" -"not-found (optional - defaults to exception): specifies how cached identifiers that reference missing rows will " -"be handled. ignore will treat a missing row as a null " -"association." -msgstr "" -"not-found (optionnel - par défaut exception) : spécifie comment les identifiants cachés qui référencent des " -"lignes manquantes seront gérés : ignore traitera une " -"ligne manquante comme une association nulle." - -#. Tag: para -#, no-c-format -msgid "" -"The <one-to-many> element does not need to declare " -"any columns. Nor is it necessary to specify the table " -"name anywhere." -msgstr "" -"Notez que l'élément <one-to-many> n'a pas besoin de " -"déclarer de colonnes. Il n'est pas non plus nécessaire de spécifier le nom " -"de la table à aucun endroit." - -#. Tag: para -#, no-c-format -msgid "" -"If the foreign key column of a <one-to-many> " -"association is declared NOT NULL, you must declare the " -"<key> mapping not-null=\"true\" " -"or use a bidirectional association with the collection " -"mapping marked inverse=\"true\". See the discussion of " -"bidirectional associations later in this chapter for more information." -msgstr "" -"Note très importante : si la colonne de la clé d'une " -"association <one-to-many> est déclarée NOT " -"NULL, vous devez déclarer le mappage de <key> avec not-null=\"true\" ou utiliser " -"une association bidirectionnelle avec le mappage de la " -"collection marqué inverse=\"true\". Voir la discussion " -"sur les associations bidirectionnelles plus tard dans ce chapitre. " - -#. Tag: para -#, no-c-format -msgid "" -"The following example shows a map of Part entities by " -"name, where partName is a persistent property of " -"Part. Notice the use of a formula-based index:" -msgstr "" -"Cet exemple montre une map d'entités Part par nom (où " -"partName est une propriété persistante de Part). Notez l'utilisation d'un index basé sur une formule :" - #. Tag: title +#: collection_mapping.xml:754 #, no-c-format msgid "Advanced collection mappings" msgstr "Mappages de collection avancés" #. Tag: title +#: collection_mapping.xml:757 #, no-c-format msgid "Sorted collections" msgstr "Collections triées" #. Tag: para +#: collection_mapping.xml:759 #, no-c-format msgid "" "Hibernate supports collections implementing java.util.SortedMap and java.util.SortedSet. You must specify a " -"comparator in the mapping file:" +"literal> and java.util.SortedSet. With annotations you " +"declare a sort comparator using @Sort. You chose between " +"the comparator types unsorted, natural or custom. If you want to use your " +"own comparator implementation, you'll also have to specify the " +"implementation class using the comparator attribute. Note " +"that you need to use either a SortedSet or a " +"SortedMap interface." +msgstr "" + +#. Tag: title +#: collection_mapping.xml:770 +#, fuzzy, no-c-format +msgid "Sorted collection with @Sort" +msgstr "Collections triées" + +#. Tag: programlisting +#: collection_mapping.xml:772 +#, no-c-format +msgid "" +"@OneToMany(cascade=CascadeType.ALL, fetch=FetchType.EAGER)\n" +"@JoinColumn(name=\"CUST_ID\")\n" +"@Sort(type = SortType.COMPARATOR, comparator = TicketComparator.class)\n" +"public SortedSet<Ticket> getTickets() {\n" +" return tickets;\n" +"}" msgstr "" -"Hibernate supporte des collections implémentant java.util." -"SortedMap et java.util.SortedSet. Vous devez " -"spécifier un comparateur dans le fichier de mappage :" #. Tag: para +#: collection_mapping.xml:775 +#, no-c-format +msgid "" +"Using Hibernate mapping files you specify a comparator in the mapping file " +"with <sort>:" +msgstr "" + +#. Tag: title +#: collection_mapping.xml:779 +#, fuzzy, no-c-format +msgid "Sorted collection using xml mapping" +msgstr "Collections triées" + +#. Tag: programlisting +#: collection_mapping.xml:781 +#, no-c-format +msgid "" +"<set name=\"aliases\"\n" +" table=\"person_aliases\" \n" +" sort=\"natural\">\n" +" <key column=\"person\"/>\n" +" <element column=\"name\" type=\"string\"/>\n" +"</set>\n" +"\n" +"<map name=\"holidays\" sort=\"my.custom.HolidayComparator\">\n" +" <key column=\"year_id\"/>\n" +" <map-key column=\"hol_name\" type=\"string\"/>\n" +" <element column=\"hol_date\" type=\"date\"/>\n" +"</map>" +msgstr "" + +#. Tag: para +#: collection_mapping.xml:784 #, no-c-format msgid "" "Allowed values of the sort attribute are " @@ -847,6 +1595,7 @@ msgstr "" "classe implémentant java.util.Comparator." #. Tag: para +#: collection_mapping.xml:789 #, no-c-format msgid "" "Sorted collections actually behave like java.util.TreeSet " @@ -856,14 +1605,15 @@ msgstr "" "TreeSet ou java.util.TreeMap." #. Tag: para -#, no-c-format +#: collection_mapping.xml:794 +#, fuzzy, no-c-format msgid "" "If you want the database itself to order the collection elements, use the " "order-by attribute of set, " "bag or map mappings. This solution is " -"only available under JDK 1.4 or higher and is implemented using " -"LinkedHashSet or LinkedHashMap. This " -"performs the ordering in the SQL query and not in the memory." +"implemented using LinkedHashSet or " +"LinkedHashMap and performs the ordering in the SQL query " +"and not in the memory." msgstr "" "Si vous voulez que la base de données elle-même ordonne les éléments de la " "collection, utilisez l'attribut order-by des mappages " @@ -874,11 +1624,36 @@ msgstr "" "pas en mémoire. " #. Tag: title +#: collection_mapping.xml:802 +#, no-c-format +msgid "Sorting in database using order-by" +msgstr "" + +#. Tag: programlisting +#: collection_mapping.xml:804 +#, no-c-format +msgid "" +"<set name=\"aliases\" table=\"person_aliases\" order-by=\"lower(name) asc" +"\">\n" +" <key column=\"person\"/>\n" +" <element column=\"name\" type=\"string\"/>\n" +"</set>\n" +"\n" +"<map name=\"holidays\" order-by=\"hol_date, hol_name\">\n" +" <key column=\"year_id\"/>\n" +" <map-key column=\"hol_name\" type=\"string\"/>\n" +" <element column=\"hol_date type=\"date\"/>\n" +"</map>" +msgstr "" + +#. Tag: title +#: collection_mapping.xml:808 #, no-c-format msgid "Note" msgstr "Note" #. Tag: para +#: collection_mapping.xml:810 #, no-c-format msgid "" "The value of the order-by attribute is an SQL ordering, " @@ -888,6 +1663,7 @@ msgstr "" "SQL, et non pas un ordre HQL." #. Tag: para +#: collection_mapping.xml:814 #, no-c-format msgid "" "Associations can even be sorted by arbitrary criteria at runtime using a " @@ -897,11 +1673,27 @@ msgstr "" "l'exécution en utilisant un filter() de collection :" #. Tag: title +#: collection_mapping.xml:818 +#, no-c-format +msgid "Sorting via a query filter" +msgstr "" + +#. Tag: programlisting +#: collection_mapping.xml:820 +#, no-c-format +msgid "" +"sortedUsers = s.createFilter( group.getUsers(), \"order by this.name\" ).list" +"();" +msgstr "" + +#. Tag: title +#: collection_mapping.xml:825 #, no-c-format msgid "Bidirectional associations" msgstr "Associations bidirectionnelles" #. Tag: para +#: collection_mapping.xml:827 #, no-c-format msgid "" "A bidirectional association allows navigation from both " @@ -913,31 +1705,347 @@ msgstr "" "bidirectionnelles sont supportées : " #. Tag: term +#: collection_mapping.xml:831 #, no-c-format msgid "one-to-many" msgstr "un-à-plusieurs (one-to-many)" #. Tag: para +#: collection_mapping.xml:834 #, no-c-format msgid "set or bag valued at one end and single-valued at the other" msgstr "ensemble ou sac à une extrémité, une seule valeur à l'autre " #. Tag: term +#: collection_mapping.xml:840 #, no-c-format msgid "many-to-many" msgstr "plusieurs-à-plusieurs " #. Tag: para +#: collection_mapping.xml:843 #, no-c-format msgid "set or bag valued at both ends" msgstr "ensemble ou sac aux deux extrémités" #. Tag: para +#: collection_mapping.xml:848 #, no-c-format msgid "" -"You can specify a bidirectional many-to-many association by mapping two many-" -"to-many associations to the same database table and declaring one end as " -"inverse. You cannot select an indexed collection." +"Often there exists a many to one association which is the owner side of a " +"bidirectional relationship. The corresponding one to many association is in " +"this case annotated by @OneToMany(mappedBy=...)" +msgstr "" + +#. Tag: title +#: collection_mapping.xml:854 +#, no-c-format +msgid "Bidirectional one to many with many to one side as association owner" +msgstr "" + +#. Tag: programlisting +#: collection_mapping.xml:857 +#, no-c-format +msgid "" +"@Entity\n" +"public class Troop {\n" +" @OneToMany(mappedBy=\"troop\")\n" +" public Set<Soldier> getSoldiers() {\n" +" ...\n" +"}\n" +"\n" +"@Entity\n" +"public class Soldier {\n" +" @ManyToOne\n" +" @JoinColumn(name=\"troop_fk\")\n" +" public Troop getTroop() {\n" +" ...\n" +"}" +msgstr "" + +#. Tag: para +#: collection_mapping.xml:860 +#, no-c-format +msgid "" +"Troop has a bidirectional one to many relationship " +"with Soldier through the troop " +"property. You don't have to (must not) define any physical mapping in the " +"mappedBy side." +msgstr "" + +#. Tag: para +#: collection_mapping.xml:865 +#, no-c-format +msgid "" +"To map a bidirectional one to many, with the one-to-many side as the owning " +"side, you have to remove the mappedBy element and set the " +"many to one @JoinColumn as insertable and updatable to " +"false. This solution is not optimized and will produce additional UPDATE " +"statements." +msgstr "" + +#. Tag: title +#: collection_mapping.xml:872 +#, fuzzy, no-c-format +msgid "Bidirectional associtaion with one to many side as owner" +msgstr "Associations bidirectionnelles avec des collections indexées" + +#. Tag: programlisting +#: collection_mapping.xml:875 +#, no-c-format +msgid "" +"@Entity\n" +"public class Troop {\n" +" @OneToMany\n" +" @JoinColumn(name=\"troop_fk\") //we need to duplicate the physical " +"information\n" +" public Set<Soldier> getSoldiers() {\n" +" ...\n" +"}\n" +"\n" +"@Entity\n" +"public class Soldier {\n" +" @ManyToOne\n" +" @JoinColumn(name=\"troop_fk\", insertable=false, updatable=false)\n" +" public Troop getTroop() {\n" +" ...\n" +"}" +msgstr "" + +#. Tag: para +#: collection_mapping.xml:878 +#, fuzzy, no-c-format +msgid "" +"How does the mappping of a bidirectional mapping look like in Hibernate " +"mapping xml? There you define a bidirectional one-to-many association by " +"mapping a one-to-many association to the same table column(s) as a many-to-" +"one association and declaring the many-valued end inverse=\"true\"." +msgstr "" +"Vous pouvez définir une association bidirectionnelle un-à-plusieurs en " +"mappant une association un-à-plusieurs vers la(es) même(s) colonne(s) de " +"table qu'une association plusieurs-à-un et en déclarant l'extrémité pluri-" +"valuée inverse=\"true\". " + +#. Tag: title +#: collection_mapping.xml:885 +#, no-c-format +msgid "Bidirectional one to many via Hibernate mapping files" +msgstr "" + +#. Tag: programlisting +#: collection_mapping.xml:887 +#, no-c-format +msgid "" +"<class name=\"Parent\">\n" +" <id name=\"id\" column=\"parent_id\"/>\n" +" ....\n" +" <set name=\"children\" inverse=\"true\">\n" +" <key column=\"parent_id\"/>\n" +" <one-to-many class=\"Child\"/>\n" +" </set>\n" +"</class>\n" +"\n" +"<class name=\"Child\">\n" +" <id name=\"id\" column=\"child_id\"/>\n" +" ....\n" +" <many-to-one name=\"parent\" \n" +" class=\"Parent\" \n" +" column=\"parent_id\"\n" +" not-null=\"true\"/>\n" +"</class>" +msgstr "" + +#. Tag: para +#: collection_mapping.xml:890 +#, no-c-format +msgid "" +"Mapping one end of an association with inverse=\"true\" " +"does not affect the operation of cascades as these are orthogonal concepts." +msgstr "" +"Mapper une extrémité d'une association avec inverse=\"true\" n'affecte pas l'opération de cascades, ce sont des concepts " +"orthogonaux." + +#. Tag: para +#: collection_mapping.xml:894 +#, no-c-format +msgid "" +"A many-to-many association is defined logically using the " +"@ManyToMany annotation. You also have to describe the " +"association table and the join conditions using the @JoinTable annotation. If the association is bidirectional, one side has to be " +"the owner and one side has to be the inverse end (ie. it will be ignored " +"when updating the relationship values in the association table):" +msgstr "" + +#. Tag: title +#: collection_mapping.xml:903 +#, no-c-format +msgid "Many to many association via @ManyToMany" +msgstr "" + +#. Tag: programlisting +#: collection_mapping.xml:905 +#, no-c-format +msgid "" +"@Entity\n" +"public class Employer implements Serializable {\n" +" @ManyToMany(\n" +" targetEntity=org.hibernate.test.metadata.manytomany.Employee.class,\n" +" cascade={CascadeType.PERSIST, CascadeType.MERGE}\n" +" )\n" +" @JoinTable(\n" +" name=\"EMPLOYER_EMPLOYEE\",\n" +" joinColumns=@JoinColumn(name=\"EMPER_ID\"),\n" +" inverseJoinColumns=@JoinColumn(name=\"EMPEE_ID\")\n" +" )\n" +" public Collection getEmployees() {\n" +" return employees;\n" +" }\n" +" ...\n" +"}" +msgstr "" + +#. Tag: programlisting +#: collection_mapping.xml:907 +#, no-c-format +msgid "" +"@Entity\n" +"public class Employee implements Serializable {\n" +" @ManyToMany(\n" +" cascade = {CascadeType.PERSIST, CascadeType.MERGE},\n" +" mappedBy = \"employees\",\n" +" targetEntity = Employer.class\n" +" )\n" +" public Collection getEmployers() {\n" +" return employers;\n" +" }\n" +"}" +msgstr "" + +#. Tag: para +#: collection_mapping.xml:910 +#, no-c-format +msgid "" +"In this example @JoinTable defines a name, an array of join columns, and an array of inverse join columns. " +"The latter ones are the columns of the association table which refer to the " +"Employee primary key (the \"other side\"). As seen " +"previously, the other side don't have to (must not) describe the physical " +"mapping: a simple mappedBy argument containing the owner " +"side property name bind the two." +msgstr "" + +#. Tag: para +#: collection_mapping.xml:919 +#, no-c-format +msgid "" +"As any other annotations, most values are guessed in a many to many " +"relationship. Without describing any physical mapping in a unidirectional " +"many to many the following rules applied. The table name is the " +"concatenation of the owner table name, _ and the other side " +"table name. The foreign key name(s) referencing the owner table is the " +"concatenation of the owner table name, _ and the owner " +"primary key column(s). The foreign key name(s) referencing the other side is " +"the concatenation of the owner property name, _, and the " +"other side primary key column(s). These are the same rules used for a " +"unidirectional one to many relationship." +msgstr "" + +#. Tag: title +#: collection_mapping.xml:932 +#, no-c-format +msgid "Default values for @ManyToMany (uni-directional)" +msgstr "" + +#. Tag: programlisting +#: collection_mapping.xml:935 +#, no-c-format +msgid "" +"@Entity\n" +"public class Store {\n" +" @ManyToMany(cascade = CascadeType.PERSIST)\n" +" public Set<City> getImplantedIn() {\n" +" ...\n" +" }\n" +"}\n" +"\n" +"@Entity\n" +"public class City {\n" +" ... //no bidirectional relationship\n" +"}" +msgstr "" + +#. Tag: para +#: collection_mapping.xml:938 +#, no-c-format +msgid "" +"A Store_City is used as the join table. The " +"Store_id column is a foreign key to the Store table. The implantedIn_id column is a foreign " +"key to the City table." +msgstr "" + +#. Tag: para +#: collection_mapping.xml:943 +#, no-c-format +msgid "" +"Without describing any physical mapping in a bidirectional many to many the " +"following rules applied. The table name is the concatenation of the owner " +"table name, _ and the other side table name. The foreign " +"key name(s) referencing the owner table is the concatenation of the other " +"side property name, _, and the owner primary key column(s). " +"The foreign key name(s) referencing the other side is the concatenation of " +"the owner property name, _, and the other side primary key " +"column(s). These are the same rules used for a unidirectional one to many " +"relationship." +msgstr "" + +#. Tag: title +#: collection_mapping.xml:955 +#, no-c-format +msgid "Default values for @ManyToMany (bi-directional)" +msgstr "" + +#. Tag: programlisting +#: collection_mapping.xml:958 +#, no-c-format +msgid "" +"@Entity\n" +"public class Store {\n" +" @ManyToMany(cascade = {CascadeType.PERSIST, CascadeType.MERGE})\n" +" public Set<Customer> getCustomers() {\n" +" ...\n" +" }\n" +"}\n" +"\n" +"@Entity\n" +"public class Customer {\n" +" @ManyToMany(mappedBy=\"customers\")\n" +" public Set<Store> getStores() {\n" +" ...\n" +" }\n" +"}" +msgstr "" + +#. Tag: para +#: collection_mapping.xml:961 +#, no-c-format +msgid "" +"A Store_Customer is used as the join table. The " +"stores_id column is a foreign key to the Store table. The customers_id column is a foreign key " +"to the Customer table." +msgstr "" + +#. Tag: para +#: collection_mapping.xml:966 +#, fuzzy, no-c-format +msgid "" +"Using Hibernate mapping files you can map a bidirectional many-to-many " +"association by mapping two many-to-many associations to the same database " +"table and declaring one end as inverse." msgstr "" "Vous pouvez spécifier une association bidirectionnelle plusieurs-à-plusieurs " "simplement en mappant deux associations plusieurs-à-plusieurs vers la même " @@ -946,17 +2054,56 @@ msgstr "" "indexée). " #. Tag: para +#: collection_mapping.xml:970 #, no-c-format +msgid "You cannot select an indexed collection." +msgstr "" + +#. Tag: para +#: collection_mapping.xml:973 +#, fuzzy, no-c-format msgid "" -"Here is an example of a bidirectional many-to-many association that " -"illustrates how each category can have many items and each item can be in " -"many categories:" +"shows a bidirectional many-to-many association that illustrates how each " +"category can have many items and each item can be in many categories:" msgstr "" "Voici un exemple d'association bidirectionnelle plusieurs-à-plusieurs ; " "chaque catégorie peut avoir plusieurs objets et chaque objet peut être dans " "plusieurs catégories : " +#. Tag: title +#: collection_mapping.xml:979 +#, no-c-format +msgid "Many to many association using Hibernate mapping files" +msgstr "" + +#. Tag: programlisting +#: collection_mapping.xml:981 +#, no-c-format +msgid "" +"<class name=\"Category\">\n" +" <id name=\"id\" column=\"CATEGORY_ID\"/>\n" +" ...\n" +" <bag name=\"items\" table=\"CATEGORY_ITEM\">\n" +" <key column=\"CATEGORY_ID\"/>\n" +" <many-to-many class=\"Item\" column=\"ITEM_ID\"/>\n" +" </bag>\n" +"</class>\n" +"\n" +"<class name=\"Item\">\n" +" <id name=\"id\" column=\"ITEM_ID\"/>\n" +" ...\n" +"\n" +" <!-- inverse end -->\n" +" <bag name=\"categories\" table=\"CATEGORY_ITEM\" inverse=\"true" +"\">\n" +" <key column=\"ITEM_ID\"/>\n" +" <many-to-many class=\"Category\" column=\"CATEGORY_ID\"/>\n" +" </bag>\n" +"</class>" +msgstr "" + #. Tag: para +#: collection_mapping.xml:984 #, no-c-format msgid "" "Changes made only to the inverse end of the association are notinverse=\"true\"." -msgstr "" -"Vous pouvez définir une association bidirectionnelle un-à-plusieurs en " -"mappant une association un-à-plusieurs vers la(es) même(s) colonne(s) de " -"table qu'une association plusieurs-à-un et en déclarant l'extrémité pluri-" -"valuée inverse=\"true\". " - -#. Tag: para -#, no-c-format -msgid "" -"Mapping one end of an association with inverse=\"true\" " -"does not affect the operation of cascades as these are orthogonal concepts." -msgstr "" -"Mapper une extrémité d'une association avec inverse=\"true\" n'affecte pas l'opération de cascades, ce sont des concepts " -"orthogonaux." - #. Tag: title +#: collection_mapping.xml:1003 #, no-c-format msgid "Bidirectional associations with indexed collections" msgstr "Associations bidirectionnelles avec des collections indexées" #. Tag: para -#, no-c-format +#: collection_mapping.xml:1005 +#, fuzzy, no-c-format msgid "" -"A bidirectional association where one end is represented as a <" -"list> or <map>, requires special " -"consideration. If there is a property of the child class that maps to the " -"index column you can use inverse=\"true\" on the " -"collection mapping:" +"There are some additional considerations for bidirectional mappings with " +"indexed collections (where one end is represented as a <list>" +" or <map>) when using Hibernate mapping " +"files. If there is a property of the child class that maps to the index " +"column you can use inverse=\"true\" on the collection " +"mapping:" msgstr "" "Une association bidirectionnelle où une extrémité est représentée comme une " "<list> ou une <map> " @@ -1024,7 +2173,41 @@ msgstr "" "continuer à utiliser inverse=\"true\" sur le mappage de " "la collection : " +#. Tag: title +#: collection_mapping.xml:1013 +#, fuzzy, no-c-format +msgid "Bidirectional association with indexed collection" +msgstr "Associations bidirectionnelles avec des collections indexées" + +#. Tag: programlisting +#: collection_mapping.xml:1015 +#, no-c-format +msgid "" +"<class name=\"Parent\">\n" +" <id name=\"id\" column=\"parent_id\"/>\n" +" ....\n" +" <map name=\"children\" inverse=\"true\">\n" +" <key column=\"parent_id\"/>\n" +" <map-key column=\"name\" \n" +" type=\"string\"/>\n" +" <one-to-many class=\"Child\"/>\n" +" </map>\n" +"</class>\n" +"\n" +"<class name=\"Child\">\n" +" <id name=\"id\" column=\"child_id\"/>\n" +" ....\n" +" <property name=\"name\" \n" +" not-null=\"true\"/>\n" +" <many-to-one name=\"parent\" \n" +" class=\"Parent\" \n" +" column=\"parent_id\"\n" +" not-null=\"true\"/>\n" +"</class>" +msgstr "" + #. Tag: para +#: collection_mapping.xml:1018 #, no-c-format msgid "" "If there is no such property on the child class, the association cannot be " @@ -1040,7 +2223,42 @@ msgstr "" "mapper la collection inverse=\"true\". Par contre, nous " "utiliserons le mappage suivant : " +#. Tag: title +#: collection_mapping.xml:1026 +#, fuzzy, no-c-format +msgid "Bidirectional association with indexed collection, but no index column" +msgstr "Associations bidirectionnelles avec des collections indexées" + +#. Tag: programlisting +#: collection_mapping.xml:1029 +#, no-c-format +msgid "" +"<class name=\"Parent\">\n" +" <id name=\"id\" column=\"parent_id\"/>\n" +" ....\n" +" <map name=\"children\">\n" +" <key column=\"parent_id\"\n" +" not-null=\"true\"/>\n" +" <map-key column=\"name\" \n" +" type=\"string\"/>\n" +" <one-to-many class=\"Child\"/>\n" +" </map>\n" +"</class>\n" +"\n" +"<class name=\"Child\">\n" +" <id name=\"id\" column=\"child_id\"/>\n" +" ....\n" +" <many-to-one name=\"parent\" \n" +" class=\"Parent\" \n" +" column=\"parent_id\"\n" +" insert=\"false\"\n" +" update=\"false\"\n" +" not-null=\"true\"/>\n" +"</class>" +msgstr "" + #. Tag: para +#: collection_mapping.xml:1032 #, fuzzy, no-c-format msgid "" "Note that in this mapping, the collection-valued end of the association is " @@ -1051,11 +2269,13 @@ msgstr "" "Does this really result in some unnecessary update statements? -->" #. Tag: title +#: collection_mapping.xml:1037 #, no-c-format msgid "Ternary associations" msgstr "Associations ternaires" #. Tag: para +#: collection_mapping.xml:1039 #, no-c-format msgid "" "There are three possible approaches to mapping a ternary association. One " @@ -1065,40 +2285,64 @@ msgstr "" "est d'utiliser une Map avec une association comme son " "index : " -#. Tag: para +#. Tag: title +#: collection_mapping.xml:1044 +#, fuzzy, no-c-format +msgid "Ternary association mapping" +msgstr "Associations ternaires" + +#. Tag: programlisting +#: collection_mapping.xml:1046 #, no-c-format msgid "" +"@Entity\n" +"public class Company {\n" +" @Id \n" +" int id;\n" +" ...\n" +" @OneToMany // unidirectional\n" +" @MapKeyJoinColumn(name=\"employee_id\")\n" +" Map<Employee, Contract> contracts;\n" +"}\n" +"\n" +"// or\n" +"\n" +"<map name=\"contracts\">\n" +" <key column=\"employer_id\" not-null=\"true\"/>\n" +" <map-key-many-to-many column=\"employee_id\" class=\"Employee\"/>\n" +" <one-to-many class=\"Contract\"/>\n" +"</map>" +msgstr "" + +#. Tag: para +#: collection_mapping.xml:1049 +#, fuzzy, no-c-format +msgid "" "A second approach is to remodel the association as an entity class. This is " -"the most common approach." +"the most common approach. A final alternative is to use composite elements, " +"which will be discussed later." msgstr "" "Une seconde approche est simplement de remodeler l'association comme une " "classe d'entité. C'est l'approche la plus commune. " -#. Tag: para -#, no-c-format -msgid "" -"A final alternative is to use composite elements, which will be discussed " -"later." -msgstr "" -"Une alternative finale est d'utiliser des éléments composites, dont nous " -"discuterons plus tard. " - -#. Tag: title +#. Tag: literal +#: collection_mapping.xml:1055 #, fuzzy, no-c-format -msgid "Using an <idbag>" +msgid "Using an <idbag>" msgstr "Using an <idbag>" #. Tag: para -#, no-c-format +#: collection_mapping.xml:1057 +#, fuzzy, no-c-format msgid "" "The majority of the many-to-many associations and collections of values " "shown previously all map to tables with composite keys, even though it has " -"been have suggested that entities should have synthetic identifiers " -"(surrogate keys). A pure association table does not seem to benefit much " -"from a surrogate key, although a collection of composite values " -"might. It is for this reason that Hibernate provides a " -"feature that allows you to map many-to-many associations and collections of " -"values to a table with a surrogate key." +"been suggested that entities should have synthetic identifiers (surrogate " +"keys). A pure association table does not seem to benefit much from a " +"surrogate key, although a collection of composite values might. For this reason Hibernate provides a feature that allows you to " +"map many-to-many associations and collections of values to a table with a " +"surrogate key." msgstr "" "Si vous êtes bien d'accord avec nous sur le fait que les clés composées sont " "une mauvaise chose et que les entités devraient avoir des identifiants " @@ -1113,6 +2357,7 @@ msgstr "" "clé subrogée. " #. Tag: para +#: collection_mapping.xml:1066 #, no-c-format msgid "" "The <idbag> element lets you map a ListList (ou une Collection) avec une " "sémantique de sac. Par exemple :" +#. Tag: programlisting +#: collection_mapping.xml:1070 +#, no-c-format +msgid "" +"<idbag name=\"lovers\" table=\"LOVERS\">\n" +" <collection-id column=\"ID\" type=\"long\">\n" +" <generator class=\"sequence\"/>\n" +" </collection-id>\n" +" <key column=\"PERSON1\"/>\n" +" <many-to-many column=\"PERSON2\" class=\"Person\" fetch=\"join\"/" +">\n" +"</idbag>" +msgstr "" + #. Tag: para +#: collection_mapping.xml:1072 #, no-c-format msgid "" "An <idbag> has a synthetic id generator, just like " @@ -1137,6 +2397,7 @@ msgstr "" "subrogée d'une ligne particulière. " #. Tag: para +#: collection_mapping.xml:1077 #, no-c-format msgid "" "The update performance of an <idbag> supersedes a " @@ -1151,6 +2412,7 @@ msgstr "" "liste, une map ou un ensemble. " #. Tag: para +#: collection_mapping.xml:1082 #, no-c-format msgid "" "In the current implementation, the native identifier " @@ -1162,16 +2424,19 @@ msgstr "" "identifiants de collection <idbag>. " #. Tag: title +#: collection_mapping.xml:1103 #, no-c-format msgid "Collection examples" msgstr "Exemples de collections" #. Tag: para +#: collection_mapping.xml:1105 #, no-c-format msgid "This section covers collection examples." msgstr "Exemples de collections " #. Tag: para +#: collection_mapping.xml:1107 #, no-c-format msgid "" "The following class has a collection of Child instances:" @@ -1179,7 +2444,39 @@ msgstr "" "La classe suivante possède une collection d'instances Child(filles) :" +#. Tag: title +#: collection_mapping.xml:1111 +#, no-c-format +msgid "" +"Example classes Parent and Child" +msgstr "" + +#. Tag: programlisting +#: collection_mapping.xml:1114 +#, no-c-format +msgid "" +"public class Parent {\n" +" private long id;\n" +" private Set<Child> children;\n" +"\n" +" // getter/setter\n" +" ...\n" +"}\n" +"\n" +"\n" +"public class Child {\n" +" private long id;\n" +" private String name\n" +"\n" +" \n" +" // getter/setter\n" +" ...\n" +"}" +msgstr "" + #. Tag: para +#: collection_mapping.xml:1117 #, no-c-format msgid "" "If each child has, at most, one parent, the most natural mapping is a one-to-" @@ -1188,12 +2485,103 @@ msgstr "" "Si chaque instance fille a au plus un parent, le mappage le plus naturel est " "une association un-à-plusieurs :" +#. Tag: title +#: collection_mapping.xml:1121 +#, no-c-format +msgid "" +"One to many unidirectional Parent-Child relationship " +"using annotations" +msgstr "" + +#. Tag: programlisting +#: collection_mapping.xml:1124 +#, no-c-format +msgid "" +"public class Parent {\n" +" @Id\n" +" @GeneratedValue\n" +" private long id;\n" +"\n" +" @OneToMany\n" +" private Set<Child> children;\n" +"\n" +" // getter/setter\n" +" ...\n" +"}\n" +"\n" +"\n" +"public class Child {\n" +" @Id\n" +" @GeneratedValue\n" +" private long id;\n" +" private String name;\n" +"\n" +" \n" +" // getter/setter\n" +" ...\n" +"}" +msgstr "" + +#. Tag: title +#: collection_mapping.xml:1128 +#, no-c-format +msgid "" +"One to many unidirectional Parent-Child relationship " +"using mapping files" +msgstr "" + +#. Tag: programlisting +#: collection_mapping.xml:1131 +#, no-c-format +msgid "" +"<hibernate-mapping>\n" +"\n" +" <class name=\"Parent\">\n" +" <id name=\"id\">\n" +" <generator class=\"sequence\"/>\n" +" </id>\n" +" <set name=\"children\">\n" +" <key column=\"parent_id\"/>\n" +" <one-to-many class=\"Child\"/>\n" +" </set>\n" +" </class>\n" +"\n" +" <class name=\"Child\">\n" +" <id name=\"id\">\n" +" <generator class=\"sequence\"/>\n" +" </id>\n" +" <property name=\"name\"/>\n" +" </class>\n" +"\n" +"</hibernate-mapping>" +msgstr "" + #. Tag: para +#: collection_mapping.xml:1134 #, no-c-format msgid "This maps to the following table definitions:" msgstr "Ceci mappe les définitions de tables suivantes :" +#. Tag: title +#: collection_mapping.xml:1137 +#, no-c-format +msgid "" +"Table definitions for unidirectional Parent-" +"Child relationship" +msgstr "" + +#. Tag: programlisting +#: collection_mapping.xml:1141 +#, no-c-format +msgid "" +"create table parent ( id bigint not null primary key )\n" +"create table child ( id bigint not null primary key, name varchar(255), " +"parent_id bigint )\n" +"alter table child add constraint childfk0 (parent_id) references parent" +msgstr "" + #. Tag: para +#: collection_mapping.xml:1144 #, no-c-format msgid "" "If the parent is required, use a bidirectional one-to-" @@ -1202,48 +2590,523 @@ msgstr "" "Si le parent est requis, utilisez une association " "bidirectionnelle un-à-plusieurs : " +#. Tag: title +#: collection_mapping.xml:1148 +#, no-c-format +msgid "" +"One to many bidirectional Parent-Child relationship " +"using annotations" +msgstr "" + +#. Tag: programlisting +#: collection_mapping.xml:1151 +#, no-c-format +msgid "" +"public class Parent {\n" +" @Id\n" +" @GeneratedValue\n" +" private long id;\n" +"\n" +" @OneToMany(mappedBy=\"parent\")\n" +" private Set<Child> children;\n" +"\n" +" // getter/setter\n" +" ...\n" +"}\n" +"\n" +"\n" +"public class Child {\n" +" @Id\n" +" @GeneratedValue\n" +" private long id;\n" +"\n" +" private String name;\n" +" \n" +" @ManyToOne\n" +" private Parent parent;\n" +"\n" +" \n" +" // getter/setter\n" +" ...\n" +"}" +msgstr "" + +#. Tag: title +#: collection_mapping.xml:1155 +#, no-c-format +msgid "" +"One to many bidirectional Parent-Child relationship " +"using mapping files" +msgstr "" + +#. Tag: programlisting +#: collection_mapping.xml:1158 +#, no-c-format +msgid "" +"<hibernate-mapping>\n" +"\n" +" <class name=\"Parent\">\n" +" <id name=\"id\">\n" +" <generator class=\"sequence\"/>\n" +" </id>\n" +" <set name=\"children\" inverse=\"true\">\n" +" <key column=\"parent_id\"/>\n" +" <one-to-many class=\"Child\"/>\n" +" </set>\n" +" </class>\n" +"\n" +" <class name=\"Child\">\n" +" <id name=\"id\">\n" +" <generator class=\"sequence\"/>\n" +" </id>\n" +" <property name=\"name\"/>\n" +" <many-to-one name=\"parent\" class=\"Parent\" column=\"parent_id" +"\" not-null=\"true\"/>\n" +" </class>\n" +"\n" +"</hibernate-mapping>" +msgstr "" + #. Tag: para +#: collection_mapping.xml:1161 #, no-c-format msgid "Notice the NOT NULL constraint:" msgstr "Notez la contrainte NOT NULL : " -#. Tag: para +#. Tag: title +#: collection_mapping.xml:1164 #, no-c-format msgid "" -"Alternatively, if this association must be unidirectional you can declare " -"the NOT NULL constraint on the <key> mapping:" +"Table definitions for bidirectional Parent-" +"Child relationship" +msgstr "" + +#. Tag: programlisting +#: collection_mapping.xml:1168 +#, no-c-format +msgid "" +"create table parent ( id bigint not null primary key )\n" +"create table child ( id bigint not null\n" +" primary key,\n" +" name varchar(255),\n" +" parent_id bigint not null )\n" +"alter table child add constraint childfk0 (parent_id) references parent" +msgstr "" + +#. Tag: para +#: collection_mapping.xml:1171 +#, fuzzy, no-c-format +msgid "" +"Alternatively, if this association must be unidirectional you can enforce " +"the NOT NULL constraint." msgstr "" "Alternativement, si vous insistez absolument pour que cette association soit " "unidirectionnelle, vous pouvez déclarer la contrainte NOT NULL sur le mappage <key> : " -#. Tag: para +#. Tag: title +#: collection_mapping.xml:1175 #, no-c-format msgid "" +"Enforcing NOT NULL constraint in unidirectional relation using annotations" +msgstr "" + +#. Tag: programlisting +#: collection_mapping.xml:1178 +#, no-c-format +msgid "" +"public class Parent {\n" +" @Id\n" +" @GeneratedValue\n" +" private long id;\n" +"\n" +" @OneToMany(optional=false)\n" +" private Set<Child> children;\n" +"\n" +" // getter/setter\n" +" ...\n" +"}\n" +"\n" +"\n" +"public class Child {\n" +" @Id\n" +" @GeneratedValue\n" +" private long id;\n" +" private String name;\n" +"\n" +" \n" +" // getter/setter\n" +" ...\n" +"}" +msgstr "" + +#. Tag: title +#: collection_mapping.xml:1182 +#, no-c-format +msgid "" +"Enforcing NOT NULL constraint in unidirectional relation using mapping files" +msgstr "" + +#. Tag: programlisting +#: collection_mapping.xml:1185 +#, no-c-format +msgid "" +"<hibernate-mapping>\n" +"\n" +" <class name=\"Parent\">\n" +" <id name=\"id\">\n" +" <generator class=\"sequence\"/>\n" +" </id>\n" +" <set name=\"children\">\n" +" <key column=\"parent_id\" not-null=\"true\"/>\n" +" <one-to-many class=\"Child\"/>\n" +" </set>\n" +" </class>\n" +"\n" +" <class name=\"Child\">\n" +" <id name=\"id\">\n" +" <generator class=\"sequence\"/>\n" +" </id>\n" +" <property name=\"name\"/>\n" +" </class>\n" +"\n" +"</hibernate-mapping>" +msgstr "" + +#. Tag: para +#: collection_mapping.xml:1188 +#, fuzzy, no-c-format +msgid "" "On the other hand, if a child has multiple parents, a many-to-many " -"association is appropriate:" +"association is appropriate." msgstr "" "D'autre part, si un enfant peut avoir plusieurs parents, une association " "plusieurs-à-plusieurs est plus appropriée : " +#. Tag: title +#: collection_mapping.xml:1192 +#, no-c-format +msgid "" +"Many to many Parent-Child relationship using " +"annotations" +msgstr "" + +#. Tag: programlisting +#: collection_mapping.xml:1195 +#, no-c-format +msgid "" +"public class Parent {\n" +" @Id\n" +" @GeneratedValue\n" +" private long id;\n" +"\n" +" @ManyToMany\n" +" private Set<Child> children;\n" +"\n" +" // getter/setter\n" +" ...\n" +"}\n" +"\n" +"\n" +"public class Child {\n" +" @Id\n" +" @GeneratedValue\n" +" private long id;\n" +"\n" +" private String name;\n" +"\n" +" \n" +" // getter/setter\n" +" ...\n" +"}" +msgstr "" + +#. Tag: title +#: collection_mapping.xml:1199 +#, no-c-format +msgid "" +"Many to many Parent-Child relationship using mapping " +"files" +msgstr "" + +#. Tag: programlisting +#: collection_mapping.xml:1202 +#, no-c-format +msgid "" +"<hibernate-mapping>\n" +"\n" +" <class name=\"Parent\">\n" +" <id name=\"id\">\n" +" <generator class=\"sequence\"/>\n" +" </id>\n" +" <set name=\"children\" table=\"childset\">\n" +" <key column=\"parent_id\"/>\n" +" <many-to-many class=\"Child\" column=\"child_id\"/>\n" +" </set>\n" +" </class>\n" +"\n" +" <class name=\"Child\">\n" +" <id name=\"id\">\n" +" <generator class=\"sequence\"/>\n" +" </id>\n" +" <property name=\"name\"/>\n" +" </class>\n" +"\n" +"</hibernate-mapping>" +msgstr "" + #. Tag: para +#: collection_mapping.xml:1205 #, no-c-format msgid "Table definitions:" msgstr "Définitions des tables :" +#. Tag: title +#: collection_mapping.xml:1208 +#, no-c-format +msgid "Table definitions for many to many releationship" +msgstr "" + +#. Tag: programlisting +#: collection_mapping.xml:1210 +#, no-c-format +msgid "" +"create table parent ( id bigint not null primary key )\n" +"create table child ( id bigint not null primary key, name varchar(255) )\n" +"create table childset ( parent_id bigint not null,\n" +" child_id bigint not null,\n" +" primary key ( parent_id, child_id ) )\n" +"alter table childset add constraint childsetfk0 (parent_id) references " +"parent\n" +"alter table childset add constraint childsetfk1 (child_id) references child" +msgstr "" + #. Tag: para +#: collection_mapping.xml:1213 #, fuzzy, no-c-format msgid "" "For more examples and a complete explanation of a parent/child relationship " -"mapping, see for more information." +"mapping, see for more information. " +"Even more complex association mappings are covered in the next chapter." msgstr "" "Pour plus d'exemples et une revue complète du mappage de la relation parent/" "enfant, consultez le . " -#. Tag: para -#, no-c-format -msgid "Even more complex association mappings are covered in the next chapter." -msgstr "" -"Des mappages d'association plus exotiques sont possibles, nous cataloguerons " -"toutes les possibilités dans le prochain chapitre. " +#~ msgid "" +#~ "Hibernate requires that persistent collection-valued fields be declared " +#~ "as an interface type. For example:" +#~ msgstr "" +#~ "Hibernate requiert que les champs contenant des collections persistantes " +#~ "soient déclarés comme des types d'interface, par exemple : " + +#~ msgid "Collection mappings" +#~ msgstr "Mapper une collection" + +#~ msgid "" +#~ "There are quite a range of mappings that can be generated for collections " +#~ "that cover many common relational models. We suggest you experiment with " +#~ "the schema generation tool so that you understand how various mapping " +#~ "declarations translate to database tables." +#~ msgstr "" +#~ "Il y a une grande variété de mappages qui peuvent être générés pour les " +#~ "collections, couvrant beaucoup de nombreux modèles relationnels communs. " +#~ "Nous vous suggérons d'expérimenter avec l'outil de génération de schéma " +#~ "pour cerner comment les différentes déclarations de mappage se traduisent " +#~ "vers des tables de bases de données. " + +#~ msgid "Collection elements" +#~ msgstr "Les éléments d'une collection" + +#~ msgid "" +#~ "The contained type is referred to as the collection element " +#~ "type. Collection elements are mapped by <" +#~ "element> or <composite-element>, or " +#~ "in the case of entity references, with <one-to-many> or <many-to-many>. The first two map " +#~ "elements with value semantics, the next two are used to map entity " +#~ "associations." +#~ msgstr "" +#~ "Le type contenu est référencé comme le type de l'élément de la " +#~ "collection. Les éléments de la collections sont mappés par " +#~ "<element> ou <composite-element>, ou dans le cas des références d'entité, avec <one-" +#~ "to-many> ou <many-to-many>. Les " +#~ "deux premiers mappent des éléments avec une sémantique de valeur, les " +#~ "deux suivants sont utilisés pour mapper des associations d'entité." + +#~ msgid "" +#~ "All collection mappings, except those with set and bag semantics, need an " +#~ "index column in the collection table. An index " +#~ "column is a column that maps to an array index, or List index, or Map key. The index of a " +#~ "Map may be of any basic type, mapped with <" +#~ "map-key>. It can be an entity reference mapped with " +#~ "<map-key-many-to-many>, or it can be a composite " +#~ "type mapped with <composite-map-key>. The index " +#~ "of an array or list is always of type integer and is " +#~ "mapped using the <list-index> element. The " +#~ "mapped column contains sequential integers that are numbered from zero by " +#~ "default." +#~ msgstr "" +#~ "Tous les mappages de collection, exceptés ceux avec les sémantiques " +#~ "d'ensemble (set) et de sac (bag), ont besoin d'une colonne " +#~ "d'index dans la table de la collection - une colonne qui mappe " +#~ "un index de tableau, ou un index de List, ou une clé " +#~ "de Map. L'index d'une Map peut être " +#~ "n'importe quel type basique, mappé avec <map-key>, ou peut être une référence d'entité mappée avec <" +#~ "map-key-many-to-many>, ou peut être un type composé, mappé " +#~ "avec <composite-map-key>. L'index d'un tableau " +#~ "ou d'une liste est toujours de type integer et est " +#~ "mappé en utilisant l'élément <list-index>. Les " +#~ "colonnes mappées contiennent des entiers séquentiels (numérotés à partir " +#~ "de zéro par défaut). " + +#~ msgid "" +#~ "Any collection of values or many-to-many associations requires a " +#~ "dedicated collection table with a foreign key column " +#~ "or columns, collection element column or columns, " +#~ "and possibly an index column or columns." +#~ msgstr "" +#~ "Toute collection de valeurs ou association plusieurs-à-plusieurs requiert " +#~ "une table de collection avec une(des) colonne(s) de " +#~ "clé étrangère, une(des) colonne(s) d'élément de la collection ou des colonnes et éventuellement une(des) colonne(s) d'index. " + +#~ msgid "" +#~ "A many-to-many association is specified using the " +#~ "<many-to-many> element." +#~ msgstr "" +#~ "Une association many-to-many est spécifiée en " +#~ "utilisant l'élément <many-to-many>." + +#~ msgid "" +#~ "column (optional): the name of the element foreign key " +#~ "column." +#~ msgstr "" +#~ "colonne (optionnel) : le nom de la colonne de clés " +#~ "étrangères des éléments." + +#~ msgid "" +#~ "formula (optional): an SQL formula used to evaluate " +#~ "the element foreign key value." +#~ msgstr "" +#~ "formula (optionnel): formule SQL utilisée pour évaluer " +#~ "la valeur des clés étrangères des éléments." + +#~ msgid "" +#~ "fetch (optional - defaults to join): enables outer-join or sequential select fetching for this " +#~ "association. This is a special case; for full eager fetching in a single " +#~ "SELECT of an entity and its many-to-many relationships " +#~ "to other entities, you would enable join fetching,not " +#~ "only of the collection itself, but also with this attribute on the " +#~ "<many-to-many> nested element." +#~ msgstr "" +#~ "fetch (optionnel - par défaut join): permet la récupération par jointures externes ou bien par " +#~ "selects séquentiels pour cette association. Il s'agit d'un cas " +#~ "particulier de récupération. Pour que la récupération soit toujours " +#~ "rapportée en un seul SELECT d'entité ou à partir de " +#~ "ses relations many-to-many à d'autres entités, vous devrez activer la " +#~ "récupération join, non seulement pour la collection " +#~ "elle-même, mais aussi avec cet attribut qui se trouve sur l'élément " +#~ "<many-to-many>." + +#~ msgid "" +#~ "unique (optional): enables the DDL generation of a " +#~ "unique constraint for the foreign-key column. This makes the association " +#~ "multiplicity effectively one-to-many." +#~ msgstr "" +#~ "unique (optionnel): permet la génération DDL d'une " +#~ "seule contrainte pour la colonne de la clé étrangère. Cela transforme la " +#~ "muticiplicité de l'association en one-to-many." + +#~ msgid "" +#~ "not-found (optional - defaults to exception): specifies how foreign keys that reference missing rows will be " +#~ "handled: ignore will treat a missing row as a null " +#~ "association." +#~ msgstr "" +#~ "not-found (optionnel - par défaut exception) : spécifie comment les clés étrangères cachées qui référencent " +#~ "des lignes manquantes seront gérées : ignore traitera " +#~ "une ligne manquante comme une association nulle." + +#~ msgid "" +#~ "property-ref (optional): the name of a property of the " +#~ "associated class that is joined to this foreign key. If not specified, " +#~ "the primary key of the associated class is used." +#~ msgstr "" +#~ "property-ref (optionnel): nom d'une propriété de la " +#~ "classe associée associée à une clé étrangère. Si elle n'est pas précisée, " +#~ "la clé primaire de la classe associée sera alors utilisée." + +#~ msgid "Here are some examples." +#~ msgstr "Voici quelques exemples :" + +#~ msgid "A set of strings:" +#~ msgstr "Un ensemble de chaînes de caractères :" + +#~ msgid "" +#~ "A bag containing integers with an iteration order determined by the " +#~ "order-by attribute:" +#~ msgstr "" +#~ "Un sac contenant des entiers (avec un ordre d'itération déterminé par " +#~ "l'attribut order-by) : " + +#~ msgid "An array of entities, in this case, a many-to-many association:" +#~ msgstr "" +#~ "Un tableau d'entités - dans ce cas, une association plusieurs-à-" +#~ "plusieurs : " + +#~ msgid "A map from string indices to dates:" +#~ msgstr "Une map de chaînes de caractères vers des dates :" + +#~ msgid "A list of components (this is discussed in the next chapter):" +#~ msgstr "Une liste de composants (traité dans le prochain chapitre) : " + +#~ msgid "One-to-many associations" +#~ msgstr "Associations un-à-plusieurs" + +#~ msgid "" +#~ "A one-to-many association links the tables of two " +#~ "classes via a foreign key with no intervening collection table. This " +#~ "mapping loses certain semantics of normal Java collections:" +#~ msgstr "" +#~ "Une association un-à-plusieurs lie les tables de " +#~ "deux classes par une clé étrangère, sans l'intervention d'une table de " +#~ "collection. Ce mappage perd certaines sémantiques des collections Java " +#~ "normales : " + +#~ msgid "" +#~ "The following example shows a map of Part entities by " +#~ "name, where partName is a persistent property of " +#~ "Part. Notice the use of a formula-based index:" +#~ msgstr "" +#~ "Cet exemple montre une map d'entités Part par nom (où " +#~ "partName est une propriété persistante de " +#~ "Part). Notez l'utilisation d'un index basé sur une " +#~ "formule :" + +#~ msgid "" +#~ "Hibernate supports collections implementing java.util.SortedMap and java.util.SortedSet. You must specify a " +#~ "comparator in the mapping file:" +#~ msgstr "" +#~ "Hibernate supporte des collections implémentant java.util." +#~ "SortedMap et java.util.SortedSet. Vous devez " +#~ "spécifier un comparateur dans le fichier de mappage :" + +#~ msgid "" +#~ "A final alternative is to use composite elements, which will be discussed " +#~ "later." +#~ msgstr "" +#~ "Une alternative finale est d'utiliser des éléments composites, dont nous " +#~ "discuterons plus tard. " + +#~ msgid "" +#~ "Even more complex association mappings are covered in the next chapter." +#~ msgstr "" +#~ "Des mappages d'association plus exotiques sont possibles, nous " +#~ "cataloguerons toutes les possibilités dans le prochain chapitre. " diff --git a/documentation/manual/src/main/docbook/fr-FR/content/configuration.po b/documentation/manual/src/main/docbook/fr-FR/content/configuration.po index 9ae7b0592a..f931124eb2 100644 --- a/documentation/manual/src/main/docbook/fr-FR/content/configuration.po +++ b/documentation/manual/src/main/docbook/fr-FR/content/configuration.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: configuration\n" "Report-Msgid-Bugs-To: http://bugs.kde.org\n" -"POT-Creation-Date: 2010-02-11T05:38:15\n" +"POT-Creation-Date: 2010-07-20 21:02+0000\n" "PO-Revision-Date: 2010-01-05 09:05+1000\n" "Last-Translator: Corina Roe \n" "Language-Team: French \n" @@ -17,11 +17,13 @@ msgstr "" "X-Generator: KBabel 1.11.4\n" #. Tag: title +#: configuration.xml:31 #, no-c-format msgid "Configuration" msgstr "Configuration" #. Tag: para +#: configuration.xml:33 #, no-c-format msgid "" "Hibernate is designed to operate in many different environments and, as " @@ -40,11 +42,13 @@ msgstr "" "besoins." #. Tag: title +#: configuration.xml:41 #, no-c-format msgid "Programmatic configuration" msgstr "Configuration par programmation" #. Tag: para +#: configuration.xml:43 #, no-c-format msgid "" "An instance of org.hibernate.cfg.Configuration " @@ -60,6 +64,7 @@ msgstr "" "mappages sont constitués d'un ensemble de fichiers de mappage XML. " #. Tag: para +#: configuration.xml:51 #, no-c-format msgid "" "You can obtain a org.hibernate.cfg.Configuration " @@ -72,7 +77,17 @@ msgstr "" "mappage. Si les fichiers de mappage sont dans le classpath, vous pouvez " "utiliser la méthode addResource() : " +#. Tag: programlisting +#: configuration.xml:57 +#, no-c-format +msgid "" +"Configuration cfg = new Configuration()\n" +" .addResource(\"Item.hbm.xml\")\n" +" .addResource(\"Bid.hbm.xml\");" +msgstr "" + #. Tag: para +#: configuration.xml:59 #, no-c-format msgid "" "An alternative way is to specify the mapped class and allow Hibernate to " @@ -81,7 +96,17 @@ msgstr "" "Une solution alternative consiste à spécifier la classe mappée et à donner à " "Hibernate la possibilité de trouver les documents de mappage pour vous :" +#. Tag: programlisting +#: configuration.xml:62 +#, no-c-format +msgid "" +"Configuration cfg = new Configuration()\n" +" .addClass(org.hibernate.auction.Item.class)\n" +" .addClass(org.hibernate.auction.Bid.class);" +msgstr "" + #. Tag: para +#: configuration.xml:64 #, no-c-format msgid "" "Hibernate will then search for mapping files named /org/hibernate/" @@ -95,6 +120,7 @@ msgstr "" "en dur. " #. Tag: para +#: configuration.xml:69 #, no-c-format msgid "" "A org.hibernate.cfg.Configuration also allows you to " @@ -103,7 +129,22 @@ msgstr "" "Une Configuration vous permet également de préciser des " "propriétés de configuration. Par exemple :" +#. Tag: programlisting +#: configuration.xml:72 +#, no-c-format +msgid "" +"Configuration cfg = new Configuration()\n" +" .addClass(org.hibernate.auction.Item.class)\n" +" .addClass(org.hibernate.auction.Bid.class)\n" +" .setProperty(\"hibernate.dialect\", \"org.hibernate.dialect." +"MySQLInnoDBDialect\")\n" +" .setProperty(\"hibernate.connection.datasource\", \"java:comp/env/jdbc/" +"test\")\n" +" .setProperty(\"hibernate.order_updates\", \"true\");" +msgstr "" + #. Tag: para +#: configuration.xml:74 #, no-c-format msgid "" "This is not the only way to pass configuration properties to Hibernate. Some " @@ -113,6 +154,7 @@ msgstr "" "Hibernate. Les différentes options sont : " #. Tag: para +#: configuration.xml:79 #, no-c-format msgid "" "Pass an instance of java.util.Properties to " @@ -122,6 +164,7 @@ msgstr "" "Configuration.setProperties(). " #. Tag: para +#: configuration.xml:84 #, no-c-format msgid "" "Place a file named hibernate.properties in a root " @@ -131,6 +174,7 @@ msgstr "" "chemin de classe." #. Tag: para +#: configuration.xml:89 #, no-c-format msgid "" "Set System properties using java -" @@ -140,6 +184,7 @@ msgstr "" "java -Dproperty=value." #. Tag: para +#: configuration.xml:94 #, no-c-format msgid "" "Include <property> elements in hibernate." @@ -149,6 +194,7 @@ msgstr "" "hibernate.cfg.xml (voir plus loin). " #. Tag: para +#: configuration.xml:99 #, no-c-format msgid "" "If you want to get started quicklyhibernate.properties " @@ -158,6 +204,7 @@ msgstr "" "filename> est l'approche la plus facile." #. Tag: para +#: configuration.xml:103 #, no-c-format msgid "" "The org.hibernate.cfg.Configuration is intended as a " @@ -169,11 +216,13 @@ msgstr "" "literal> aura été créée." #. Tag: title +#: configuration.xml:109 #, no-c-format msgid "Obtaining a SessionFactory" msgstr "Obtenir une SessionFactory" #. Tag: para +#: configuration.xml:111 #, fuzzy, no-c-format msgid "" "When all mappings have been parsed by the org.hibernate.cfg." @@ -186,7 +235,14 @@ msgstr "" "Session. Cette fabrique sera partagée entre tous les " "threads de l'application : " +#. Tag: programlisting +#: configuration.xml:117 +#, no-c-format +msgid "SessionFactory sessions = cfg.buildSessionFactory();" +msgstr "" + #. Tag: para +#: configuration.xml:119 #, fuzzy, no-c-format msgid "" "Hibernate does allow your application to instantiate more than one " @@ -198,11 +254,13 @@ msgstr "" "plus d'une base de données. " #. Tag: title +#: configuration.xml:125 #, no-c-format msgid "JDBC connections" msgstr "Connexions JDBC " #. Tag: para +#: configuration.xml:127 #, no-c-format msgid "" "It is advisable to have the org.hibernate.SessionFactoryorg.hibernate." "Session est aussi simple que :" +#. Tag: programlisting +#: configuration.xml:133 +#, no-c-format +msgid "Session session = sessions.openSession(); // open a new Session" +msgstr "" + #. Tag: para +#: configuration.xml:135 #, no-c-format msgid "" "Once you start a task that requires access to the database, a JDBC " @@ -225,6 +290,7 @@ msgstr "" "données, une connexion JDBC sera récupérée dans le pool." #. Tag: para +#: configuration.xml:138 #, no-c-format msgid "" "Before you can do this, you first need to pass some JDBC connection " @@ -240,6 +306,7 @@ msgstr "" "plus importants. " #. Tag: para +#: configuration.xml:144 #, no-c-format msgid "" "Hibernate will obtain and pool connections using java.sql." @@ -250,71 +317,89 @@ msgstr "" "de la manière suivante : " #. Tag: title +#: configuration.xml:149 #, no-c-format msgid "Hibernate JDBC Properties" msgstr "Propriétés JDBC de Hibernate" #. Tag: entry +#: configuration.xml:158 configuration.xml:236 configuration.xml:327 +#: configuration.xml:495 configuration.xml:657 configuration.xml:753 +#: configuration.xml:826 #, no-c-format msgid "Property name" msgstr "Nom de la propriété" #. Tag: entry +#: configuration.xml:160 configuration.xml:238 configuration.xml:329 +#: configuration.xml:497 configuration.xml:659 configuration.xml:755 +#: configuration.xml:828 #, no-c-format msgid "Purpose" msgstr "Fonction" -#. Tag: entry -#, no-c-format -msgid "hibernate.connection.driver_class" +#. Tag: property +#: configuration.xml:166 +#, fuzzy, no-c-format +msgid "hibernate.connection.driver_class" msgstr "hibernate.connection.driver_class" -#. Tag: entry -#, no-c-format -msgid "JDBC driver class" +#. Tag: emphasis +#: configuration.xml:168 +#, fuzzy, no-c-format +msgid "JDBC driver class" msgstr "Classe de pilote JDBC" -#. Tag: entry -#, no-c-format -msgid "hibernate.connection.url" +#. Tag: property +#: configuration.xml:172 +#, fuzzy, no-c-format +msgid "hibernate.connection.url" msgstr "hibernate.connection.url" -#. Tag: entry +#. Tag: emphasis +#: configuration.xml:174 #, no-c-format -msgid "JDBC URL" -msgstr "JDBC URL" +msgid "JDBC URL" +msgstr "" -#. Tag: entry -#, no-c-format -msgid "hibernate.connection.username" +#. Tag: property +#: configuration.xml:178 configuration.xml:265 +#, fuzzy, no-c-format +msgid "hibernate.connection.username" msgstr "hibernate.connection.username" -#. Tag: entry +#. Tag: emphasis +#: configuration.xml:180 #, no-c-format -msgid "database user" -msgstr "utilisateur de la base de données" +msgid "database user" +msgstr "" -#. Tag: entry -#, no-c-format -msgid "hibernate.connection.password" +#. Tag: property +#: configuration.xml:184 configuration.xml:271 +#, fuzzy, no-c-format +msgid "hibernate.connection.password" msgstr "hibernate.connection.password" -#. Tag: entry -#, no-c-format -msgid "database user password" +#. Tag: emphasis +#: configuration.xml:186 +#, fuzzy, no-c-format +msgid "database user password" msgstr "mot de passe de l'utilisateur de base de données" -#. Tag: entry -#, no-c-format -msgid "hibernate.connection.pool_size" +#. Tag: property +#: configuration.xml:190 +#, fuzzy, no-c-format +msgid "hibernate.connection.pool_size" msgstr "hibernate.connection.pool_size" -#. Tag: entry -#, no-c-format -msgid "maximum number of pooled connections" +#. Tag: emphasis +#: configuration.xml:192 +#, fuzzy, no-c-format +msgid "maximum number of pooled connections" msgstr "nombre maximum de connexions dans le pool" #. Tag: para +#: configuration.xml:199 #, no-c-format msgid "" "Hibernate's own connection pooling algorithm is, however, quite rudimentary. " @@ -336,6 +421,7 @@ msgstr "" "C3P0. " #. Tag: para +#: configuration.xml:208 #, no-c-format msgid "" "C3P0 is an open source JDBC connection pool distributed along with Hibernate " @@ -355,6 +441,7 @@ msgstr "" "web Hibernate pour plus d'informations. " #. Tag: para +#: configuration.xml:216 #, no-c-format msgid "" "The following is an example hibernate.properties file " @@ -363,7 +450,23 @@ msgstr "" "Voici un exemple de fichier hibernate.properties pour " "C3P0: " +#. Tag: programlisting +#: configuration.xml:219 +#, no-c-format +msgid "" +"hibernate.connection.driver_class = org.postgresql.Driver\n" +"hibernate.connection.url = jdbc:postgresql://localhost/mydatabase\n" +"hibernate.connection.username = myuser\n" +"hibernate.connection.password = secret\n" +"hibernate.c3p0.min_size=5\n" +"hibernate.c3p0.max_size=20\n" +"hibernate.c3p0.timeout=1800\n" +"hibernate.c3p0.max_statements=50\n" +"hibernate.dialect = org.hibernate.dialect.PostgreSQLDialect" +msgstr "" + #. Tag: para +#: configuration.xml:221 #, no-c-format msgid "" "For use inside an application server, you should almost always configure " @@ -378,36 +481,43 @@ msgstr "" "moins une des propriétés suivantes : " #. Tag: title +#: configuration.xml:227 #, no-c-format msgid "Hibernate Datasource Properties" msgstr "Propriétés d'une Datasource Hibernate" -#. Tag: entry -#, no-c-format -msgid "hibernate.connection.datasource" +#. Tag: property +#: configuration.xml:244 +#, fuzzy, no-c-format +msgid "hibernate.connection.datasource" msgstr "hibernate.connection.datasource" -#. Tag: entry -#, no-c-format -msgid "datasource JNDI name" +#. Tag: emphasis +#: configuration.xml:246 +#, fuzzy, no-c-format +msgid "datasource JNDI name" msgstr "nom JNDI de la source de données" -#. Tag: entry -#, no-c-format -msgid "hibernate.jndi.url" +#. Tag: property +#: configuration.xml:250 +#, fuzzy, no-c-format +msgid "hibernate.jndi.url" msgstr "hibernate.jndi.url" #. Tag: entry +#: configuration.xml:252 #, no-c-format msgid "URL of the JNDI provider (optional)" msgstr "URL du fournisseur JNDI (optionnel)" -#. Tag: entry -#, no-c-format -msgid "hibernate.jndi.class" +#. Tag: property +#: configuration.xml:257 +#, fuzzy, no-c-format +msgid "hibernate.jndi.class" msgstr "hibernate.jndi.class" #. Tag: entry +#: configuration.xml:259 #, no-c-format msgid "" "class of the JNDI InitialContextFactorydatabase user (optional)" msgstr "utilisateur de base de données (optionnel)" #. Tag: entry +#: configuration.xml:273 #, no-c-format msgid "database user password (optional)" msgstr "" @@ -429,6 +541,7 @@ msgstr "" "(optionnel)" #. Tag: para +#: configuration.xml:280 #, no-c-format msgid "" "Here is an example hibernate.properties file for an " @@ -437,7 +550,20 @@ msgstr "" "Voici un exemple de fichier hibernate.properties pour " "l'utilisation d'une datasource JNDI fournie par un serveur d'applications : " +#. Tag: programlisting +#: configuration.xml:283 +#, no-c-format +msgid "" +"hibernate.connection.datasource = java:/comp/env/jdbc/test\n" +"hibernate.transaction.factory_class = \\\n" +" org.hibernate.transaction.JTATransactionFactory\n" +"hibernate.transaction.manager_lookup_class = \\\n" +" org.hibernate.transaction.JBossTransactionManagerLookup\n" +"hibernate.dialect = org.hibernate.dialect.PostgreSQLDialect" +msgstr "" + #. Tag: para +#: configuration.xml:285 #, no-c-format msgid "" "JDBC connections obtained from a JNDI datasource will automatically " @@ -448,6 +574,7 @@ msgstr "" "d'applications." #. Tag: para +#: configuration.xml:289 #, no-c-format msgid "" "Arbitrary connection properties can be given by prepending " @@ -461,6 +588,7 @@ msgstr "" "hibernate.connection.charSet. " #. Tag: para +#: configuration.xml:294 #, no-c-format msgid "" "You can define your own plugin strategy for obtaining JDBC connections by " @@ -476,11 +604,13 @@ msgstr "" "literal>." #. Tag: title +#: configuration.xml:302 #, no-c-format msgid "Optional configuration properties" msgstr "Propriétés de configuration optionnelles" #. Tag: para +#: configuration.xml:304 #, no-c-format msgid "" "There are a number of other properties that control the behavior of " @@ -491,6 +621,7 @@ msgstr "" "comme valeurs par défaut des valeurs raisonnables." #. Tag: para +#: configuration.xml:309 #, fuzzy, no-c-format msgid "" "Some of these properties are \"system-level\" only. " @@ -506,16 +637,19 @@ msgstr "" "dessus. " #. Tag: title +#: configuration.xml:318 #, no-c-format msgid "Hibernate Configuration Properties" msgstr "Propriétés de configuration Hibernate" -#. Tag: entry -#, no-c-format -msgid "hibernate.dialect" +#. Tag: property +#: configuration.xml:335 +#, fuzzy, no-c-format +msgid "hibernate.dialect" msgstr "hibernate.dialect" #. Tag: entry +#: configuration.xml:337 #, no-c-format msgid "" "The classname of a Hibernate org.hibernate.dialect.Dialecte.g. full.classname.of." @@ -536,6 +671,7 @@ msgstr "" "Dialect " #. Tag: para +#: configuration.xml:341 #, no-c-format msgid "" "In most cases Hibernate will actually be able to choose the correct " @@ -547,12 +683,14 @@ msgstr "" "convient sur la base des métadonnées JDBC retournées par " "le driver JDBC." -#. Tag: entry -#, no-c-format -msgid "hibernate.show_sql" +#. Tag: property +#: configuration.xml:349 +#, fuzzy, no-c-format +msgid "hibernate.show_sql" msgstr "hibernate.show_sql" #. Tag: entry +#: configuration.xml:351 #, no-c-format msgid "" "Write all SQL statements to console. This is an alternative to setting the " @@ -564,6 +702,11 @@ msgstr "" "debug. " #. Tag: para +#: configuration.xml:353 configuration.xml:361 configuration.xml:426 +#: configuration.xml:435 configuration.xml:443 configuration.xml:453 +#: configuration.xml:468 configuration.xml:525 configuration.xml:545 +#: configuration.xml:555 configuration.xml:598 configuration.xml:797 +#: configuration.xml:808 configuration.xml:904 #, no-c-format msgid "" "e.g. true | " @@ -572,22 +715,26 @@ msgstr "" " par ex.true | " "false " -#. Tag: entry -#, no-c-format -msgid "hibernate.format_sql" +#. Tag: property +#: configuration.xml:359 +#, fuzzy, no-c-format +msgid "hibernate.format_sql" msgstr "hibernate.format_sql" #. Tag: entry +#: configuration.xml:361 #, no-c-format msgid "Pretty print the SQL in the log and console." msgstr "Effectue un pretty print du SQL dans la console et dans le log. " -#. Tag: entry -#, no-c-format -msgid "hibernate.default_schema" +#. Tag: property +#: configuration.xml:367 +#, fuzzy, no-c-format +msgid "hibernate.default_schema" msgstr "hibernate.default_schema" #. Tag: entry +#: configuration.xml:369 #, no-c-format msgid "" "Qualify unqualified table names with the given schema/tablespace in " @@ -597,18 +744,21 @@ msgstr "" "SQL généré." #. Tag: para +#: configuration.xml:370 #, no-c-format msgid "" "e.g. SCHEMA_NAME" msgstr "" "e.g. SCHEMA_NAME" -#. Tag: entry -#, no-c-format -msgid "hibernate.default_catalog" +#. Tag: property +#: configuration.xml:376 +#, fuzzy, no-c-format +msgid "hibernate.default_catalog" msgstr "hibernate.default_catalog" #. Tag: entry +#: configuration.xml:378 #, no-c-format msgid "" "Qualifies unqualified table names with the given catalog in generated SQL." @@ -617,18 +767,21 @@ msgstr "" "généré. " #. Tag: para +#: configuration.xml:379 #, no-c-format msgid "" "e.g. CATALOG_NAME" msgstr "" "e.g. CATALOG_NAME" -#. Tag: entry -#, no-c-format -msgid "hibernate.session_factory_name" +#. Tag: property +#: configuration.xml:384 +#, fuzzy, no-c-format +msgid "hibernate.session_factory_name" msgstr "hibernate.session_factory_name" #. Tag: entry +#: configuration.xml:386 #, no-c-format msgid "" "The org.hibernate.SessionFactory will be " @@ -638,6 +791,7 @@ msgstr "" "automatiquement liée à ce nom dans JNDI après sa création. " #. Tag: para +#: configuration.xml:389 configuration.xml:776 #, no-c-format msgid "" "e.g. jndi/composite/namepar ex.jndi/composite/name" -#. Tag: entry -#, no-c-format -msgid "hibernate.max_fetch_depth" +#. Tag: property +#: configuration.xml:394 +#, fuzzy, no-c-format +msgid "hibernate.max_fetch_depth" msgstr "hibernate.max_fetch_depth" #. Tag: entry +#: configuration.xml:396 #, no-c-format msgid "" "Sets a maximum \"depth\" for the outer join fetch tree for single-ended " @@ -664,6 +820,7 @@ msgstr "" "externe." #. Tag: para +#: configuration.xml:398 #, no-c-format msgid "" "e.g. recommended values between " @@ -672,12 +829,14 @@ msgstr "" "par ex. valeurs recommandées entre " "0 et 3 " -#. Tag: entry -#, no-c-format -msgid "hibernate.default_batch_fetch_size" +#. Tag: property +#: configuration.xml:404 +#, fuzzy, no-c-format +msgid "hibernate.default_batch_fetch_size" msgstr "hibernate.default_batch_fetch_size" #. Tag: entry +#: configuration.xml:406 #, no-c-format msgid "Sets a default size for Hibernate batch fetching of associations." msgstr "" @@ -685,6 +844,7 @@ msgstr "" "Hibernate " #. Tag: para +#: configuration.xml:407 #, no-c-format msgid "" "e.g. recommended values 4ex. valeurs recommandées : 4, 8, 16 " -#. Tag: entry -#, no-c-format -msgid "hibernate.default_entity_mode" +#. Tag: property +#: configuration.xml:413 +#, fuzzy, no-c-format +msgid "hibernate.default_entity_mode" msgstr "hibernate.default_entity_mode" #. Tag: entry +#: configuration.xml:415 #, fuzzy, no-c-format msgid "" "Sets a default mode for entity representation for all sessions opened from " @@ -708,6 +870,7 @@ msgstr "" "sessions ouvertes depuis cette SessionFactory " #. Tag: para +#: configuration.xml:416 #, no-c-format msgid "" "dynamic-map, dom4j, pojodynamic-map, dom4j, pojo" -#. Tag: entry -#, no-c-format -msgid "hibernate.order_updates" +#. Tag: property +#: configuration.xml:422 +#, fuzzy, no-c-format +msgid "hibernate.order_updates" msgstr "hibernate.order_updates" #. Tag: entry +#: configuration.xml:424 #, no-c-format msgid "" "Forces Hibernate to order SQL updates by the primary key value of the items " @@ -732,12 +897,14 @@ msgstr "" "primaire des éléments mis à jour. Cela permet de limiter les deadlocks de " "transaction dans les systèmes hautement concurrents." -#. Tag: entry -#, no-c-format -msgid "hibernate.generate_statistics" -msgstr "hibernate.generate_statistics" +#. Tag: property +#: configuration.xml:432 +#, fuzzy, no-c-format +msgid "hibernate.generate_statistics" +msgstr "Statistiques Hibernate" #. Tag: entry +#: configuration.xml:434 #, no-c-format msgid "" "If enabled, Hibernate will collect statistics useful for performance tuning." @@ -745,12 +912,14 @@ msgstr "" "Si activé, Hibernate va collecter des statistiques utiles pour le réglage " "des performances. " -#. Tag: entry -#, no-c-format -msgid "hibernate.use_identifier_rollback" +#. Tag: property +#: configuration.xml:440 +#, fuzzy, no-c-format +msgid "hibernate.use_identifier_rollback" msgstr "hibernate.use_identifer_rollback" #. Tag: entry +#: configuration.xml:442 #, no-c-format msgid "" "If enabled, generated identifier properties will be reset to default values " @@ -759,12 +928,14 @@ msgstr "" "Si activé, les propriétés correspondant à l'identifiant des objets sont " "remises aux valeurs par défaut lorsque les objets sont supprimés. " -#. Tag: entry -#, no-c-format -msgid "hibernate.use_sql_comments" +#. Tag: property +#: configuration.xml:449 +#, fuzzy, no-c-format +msgid "hibernate.use_sql_comments" msgstr "hibernate.use_sql_comments" #. Tag: entry +#: configuration.xml:451 #, no-c-format msgid "" "If turned on, Hibernate will generate comments inside the SQL, for easier " @@ -773,17 +944,51 @@ msgstr "" "Si activé, Hibernate génère des commentaires à l'intérieur des requêtes SQL " "pour faciliter le débogage, par défaut à false." +#. Tag: property +#: configuration.xml:458 +#, no-c-format +msgid "hibernate.id.new_generator_mappings" +msgstr "" + +#. Tag: entry +#: configuration.xml:460 +#, no-c-format +msgid "" +"Setting is relevant when using @GeneratedValue. It " +"indicates whether or not the new IdentifierGenerator " +"implementations are used for javax.persistence.GenerationType." +"AUTO, javax.persistence.GenerationType.TABLE and javax.persistence.GenerationType.SEQUENCE. Default to false to keep backward " +"compatibility." +msgstr "" + +#. Tag: para +#: configuration.xml:476 +#, no-c-format +msgid "" +"We recommend all new projects which make use of to use " +"@GeneratedValue to also set hibernate.id." +"new_generator_mappings=true as the new generators are more efficient " +"and closer to the JPA 2 specification semantic. However they are not " +"backward compatible with existing databases (if a sequence or a table is " +"used for id generation)." +msgstr "" + #. Tag: title +#: configuration.xml:485 #, no-c-format msgid "Hibernate JDBC and Connection Properties" msgstr "Propriétés Hibernate liées à JDBC et aux connexions" -#. Tag: entry -#, no-c-format -msgid "hibernate.jdbc.fetch_size" +#. Tag: property +#: configuration.xml:503 +#, fuzzy, no-c-format +msgid "hibernate.jdbc.fetch_size" msgstr "hibernate.jdbc.fetch_size" #. Tag: entry +#: configuration.xml:505 #, no-c-format msgid "" "A non-zero value determines the JDBC fetch size (calls Statement." @@ -792,12 +997,14 @@ msgstr "" "Une valeur non nulle détermine la taille des chargements JDBC (appelle " "Statement.setFetchSize())." -#. Tag: entry -#, no-c-format -msgid "hibernate.jdbc.batch_size" +#. Tag: property +#: configuration.xml:510 +#, fuzzy, no-c-format +msgid "hibernate.jdbc.batch_size" msgstr "hibernate.jdbc.batch_size" #. Tag: entry +#: configuration.xml:512 #, no-c-format msgid "A non-zero value enables use of JDBC2 batch updates by Hibernate." msgstr "" @@ -805,6 +1012,7 @@ msgstr "" "lot de JDBC2. " #. Tag: para +#: configuration.xml:513 #, no-c-format msgid "" "e.g. recommended values between " @@ -813,16 +1021,18 @@ msgstr "" "ex. les valeurs recommandées entre " "5 et 30" -#. Tag: entry -#, no-c-format -msgid "hibernate.jdbc.batch_versioned_data" +#. Tag: property +#: configuration.xml:519 +#, fuzzy, no-c-format +msgid "hibernate.jdbc.batch_versioned_data" msgstr "hibernate.jdbc.batch_versioned_data" #. Tag: entry -#, no-c-format +#: configuration.xml:521 +#, fuzzy, no-c-format msgid "" "Set this property to true if your JDBC driver returns " -"correct row counts from executeBatch(). Iit is usually " +"correct row counts from executeBatch(). It is usually " "safe to turn this option on. Hibernate will then use batched DML for " "automatically versioned data. Defaults to false." msgstr "" @@ -832,12 +1042,14 @@ msgstr "" "utilisera alors le \"batched DML\" pour les données automatiquement " "versionnées. Par défaut à false. " -#. Tag: entry -#, no-c-format -msgid "hibernate.jdbc.factory_class" +#. Tag: property +#: configuration.xml:531 +#, fuzzy, no-c-format +msgid "hibernate.jdbc.factory_class" msgstr "hibernate.jdbc.factory_class" #. Tag: entry +#: configuration.xml:533 #, no-c-format msgid "" "Select a custom org.hibernate.jdbc.Batcher. " @@ -848,6 +1060,7 @@ msgstr "" "propriété de configuration." #. Tag: para +#: configuration.xml:535 #, no-c-format msgid "" "e.g. classname.of." @@ -856,12 +1069,14 @@ msgstr "" "par.ex. classname.of." "BatcherFactory" -#. Tag: entry -#, no-c-format -msgid "hibernate.jdbc.use_scrollable_resultset" +#. Tag: property +#: configuration.xml:541 +#, fuzzy, no-c-format +msgid "hibernate.jdbc.use_scrollable_resultset" msgstr "hibernate.jdbc.use_scrollable_resultset" #. Tag: entry +#: configuration.xml:543 #, no-c-format msgid "" "Enables use of JDBC2 scrollable resultsets by Hibernate. This property is " @@ -873,12 +1088,14 @@ msgstr "" "connexions JDBC fournies par l'utilisateur. Autrement, Hibernate utilise les " "métadonnées de la connexion." -#. Tag: entry -#, no-c-format -msgid "hibernate.jdbc.use_streams_for_binary" +#. Tag: property +#: configuration.xml:551 +#, fuzzy, no-c-format +msgid "hibernate.jdbc.use_streams_for_binary" msgstr "hibernate.jdbc.use_streams_for_binary" #. Tag: entry +#: configuration.xml:553 #, no-c-format msgid "" "Use streams when writing/reading binary or " @@ -889,12 +1106,14 @@ msgstr "" "ou des types serializablevers/à partir de JDBC. " "*system-level property*" -#. Tag: entry -#, no-c-format -msgid "hibernate.jdbc.use_get_generated_keys" +#. Tag: property +#: configuration.xml:561 +#, fuzzy, no-c-format +msgid "hibernate.jdbc.use_get_generated_keys" msgstr "hibernate.jdbc.use_get_generated_keys" #. Tag: entry +#: configuration.xml:563 #, no-c-format msgid "" "Enables use of JDBC3 PreparedStatement.getGeneratedKeys() " @@ -911,17 +1130,21 @@ msgstr "" "metadonnées de connexion." #. Tag: para +#: configuration.xml:569 configuration.xml:678 configuration.xml:687 +#: configuration.xml:696 configuration.xml:723 #, no-c-format msgid "e.g. true|false" msgstr "" "par ex. true|false" -#. Tag: entry -#, no-c-format -msgid "hibernate.connection.provider_class" +#. Tag: property +#: configuration.xml:574 +#, fuzzy, no-c-format +msgid "hibernate.connection.provider_class" msgstr "hibernate.connection.provider_class" #. Tag: entry +#: configuration.xml:576 #, no-c-format msgid "" "The classname of a custom org.hibernate.connection." @@ -933,6 +1156,7 @@ msgstr "" "JDBC à Hibernate." #. Tag: para +#: configuration.xml:578 #, no-c-format msgid "" "e.g. classname.of." @@ -941,12 +1165,14 @@ msgstr "" "par ex.classname.of." "ConnectionProvider " -#. Tag: entry -#, no-c-format -msgid "hibernate.connection.isolation" +#. Tag: property +#: configuration.xml:584 +#, fuzzy, no-c-format +msgid "hibernate.connection.isolation" msgstr "hibernate.connection.isolation" #. Tag: entry +#: configuration.xml:586 #, no-c-format msgid "" "Sets the JDBC transaction isolation level. Check java.sql." @@ -961,29 +1187,34 @@ msgstr "" "supplémentaires." #. Tag: para +#: configuration.xml:589 #, no-c-format msgid "e.g. 1, 2, 4, 8" msgstr "" "par ex.1, 2, 4, 8 " -#. Tag: entry -#, no-c-format -msgid "hibernate.connection.autocommit" +#. Tag: property +#: configuration.xml:595 +#, fuzzy, no-c-format +msgid "hibernate.connection.autocommit" msgstr " hibernate.connection.autocommit" #. Tag: entry +#: configuration.xml:597 #, no-c-format msgid "Enables autocommit for JDBC pooled connections (it is not recommended)." msgstr "" "Active le mode de commit automatique (autocommit) pour les connexions JDBC " "du pool (non recommandé). " -#. Tag: entry -#, no-c-format -msgid "hibernate.connection.release_mode" +#. Tag: property +#: configuration.xml:603 +#, fuzzy, no-c-format +msgid "hibernate.connection.release_mode" msgstr "hibernate.connection.release_mode" #. Tag: entry +#: configuration.xml:605 #, no-c-format msgid "" "Specifies when Hibernate should release JDBC connections. By default, a JDBC " @@ -1009,6 +1240,7 @@ msgstr "" "transactions JDBC. " #. Tag: para +#: configuration.xml:615 #, no-c-format msgid "" "e.g. auto (default) " @@ -1020,15 +1252,15 @@ msgstr "" "after_statement" #. Tag: para -#, no-c-format +#: configuration.xml:618 +#, fuzzy, no-c-format msgid "" "This setting only affects Sessions returned from " "SessionFactory.openSession. For Sessions obtained through SessionFactory.getCurrentSession, the CurrentSessionContext implementation " "configured for use controls the connection release mode for those " -"Sessions. See " +"Sessions. See" msgstr "" "Remarquez que ce paramètre influence uniquement les Session s retournées depuis SessionFactory.openSession. " @@ -1039,6 +1271,7 @@ msgstr "" "literal> s. Consultez " #. Tag: entry +#: configuration.xml:630 #, no-c-format msgid "" "hibernate.connection.<propertyName>" #. Tag: entry +#: configuration.xml:632 #, no-c-format msgid "" "Pass the JDBC property <propertyName> to " @@ -1057,6 +1291,7 @@ msgstr "" "DriverManager.getConnection(). " #. Tag: entry +#: configuration.xml:638 #, no-c-format msgid "" "hibernate.jndi.<propertyName>" @@ -1064,6 +1299,7 @@ msgstr "" "hibernate.jndi.<propertyName>" #. Tag: entry +#: configuration.xml:640 #, no-c-format msgid "" "Pass the property <propertyName> to the JNDI " @@ -1073,21 +1309,25 @@ msgstr "" "InitialContextFactory." #. Tag: title +#: configuration.xml:648 #, no-c-format msgid "Hibernate Cache Properties" msgstr "Propriétés du Cache Hibernate" -#. Tag: entry -#, no-c-format -msgid "hibernate.cache.provider_class" +#. Tag: literal +#: configuration.xml:665 +#, fuzzy, no-c-format +msgid "hibernate.cache.provider_class" msgstr "hibernate.cache.provider_class" #. Tag: entry +#: configuration.xml:667 #, no-c-format msgid "The classname of a custom CacheProvider." msgstr "Le nom de classe d'un CacheProvider personnalisé." #. Tag: para +#: configuration.xml:668 #, no-c-format msgid "" "e.g. classname.of." @@ -1096,12 +1336,14 @@ msgstr "" "par ex.classname.of." "CacheProvider " -#. Tag: entry -#, no-c-format -msgid "hibernate.cache.use_minimal_puts" +#. Tag: literal +#: configuration.xml:673 +#, fuzzy, no-c-format +msgid "hibernate.cache.use_minimal_puts" msgstr "hibernate.cache.use_minimal_puts" #. Tag: entry +#: configuration.xml:675 #, no-c-format msgid "" "Optimizes second-level cache operation to minimize writes, at the cost of " @@ -1113,12 +1355,14 @@ msgstr "" "et est activé par défaut dans hibernate3 pour les implémentations de cache " "en cluster. " -#. Tag: entry -#, no-c-format -msgid "hibernate.cache.use_query_cache" +#. Tag: literal +#: configuration.xml:684 +#, fuzzy, no-c-format +msgid "hibernate.cache.use_query_cache" msgstr "hibernate.cache.use_query_cache" #. Tag: entry +#: configuration.xml:686 #, no-c-format msgid "" "Enables the query cache. Individual queries still have to be set cachable." @@ -1126,12 +1370,14 @@ msgstr "" "Activer le cache de requête, les requêtes individuelles doivent tout de même " "être déclarées comme pouvant être mises en cache." -#. Tag: entry -#, no-c-format -msgid "hibernate.cache.use_second_level_cache" +#. Tag: literal +#: configuration.xml:692 +#, fuzzy, no-c-format +msgid "hibernate.cache.use_second_level_cache" msgstr "hibernate.cache.use_second_level_cache" #. Tag: entry +#: configuration.xml:694 #, no-c-format msgid "" "Can be used to completely disable the second level cache, which is enabled " @@ -1142,12 +1388,14 @@ msgstr "" "est activé par défaut pour les classes qui spécifient un élément " "<cache> dans leur mappage. " -#. Tag: entry -#, no-c-format -msgid "hibernate.cache.query_cache_factory" +#. Tag: literal +#: configuration.xml:702 +#, fuzzy, no-c-format +msgid "hibernate.cache.query_cache_factory" msgstr "hibernate.cache.query_cache_factory" #. Tag: entry +#: configuration.xml:704 #, no-c-format msgid "" "The classname of a custom QueryCache interface, defaults " @@ -1158,6 +1406,7 @@ msgstr "" "literal> imbriqué." #. Tag: para +#: configuration.xml:706 #, no-c-format msgid "" "e.g. classname.of.QueryCachepar ex.classname.of." "QueryCache " -#. Tag: entry -#, no-c-format -msgid "hibernate.cache.region_prefix" +#. Tag: literal +#: configuration.xml:712 +#, fuzzy, no-c-format +msgid "hibernate.cache.region_prefix" msgstr "hibernate.cache.region_prefix" #. Tag: entry +#: configuration.xml:714 #, no-c-format msgid "A prefix to use for second-level cache region names." msgstr "" "Un préfixe à utiliser pour les noms de régions du cache de second niveau. " #. Tag: para +#: configuration.xml:714 #, no-c-format msgid "e.g. prefix" msgstr "par ex. prefix" -#. Tag: entry -#, no-c-format -msgid "hibernate.cache.use_structured_entries" +#. Tag: literal +#: configuration.xml:720 +#, fuzzy, no-c-format +msgid "hibernate.cache.use_structured_entries" msgstr "hibernate.cache.use_structured_entries" #. Tag: entry +#: configuration.xml:722 #, no-c-format msgid "" "Forces Hibernate to store data in the second-level cache in a more human-" @@ -1196,17 +1450,36 @@ msgstr "" "Force Hibernate à stocker les données dans le cache de second niveau en un " "format plus adapté à la visualisation. " +#. Tag: literal +#: configuration.xml:729 +#, no-c-format +msgid "hibernate.cache.default_cache_concurrency_strategy" +msgstr "" + +#. Tag: entry +#: configuration.xml:731 +#, no-c-format +msgid "" +"Setting used to give the name of the default org.hibernate." +"annotations.CacheConcurrencyStrategy to use when either " +"@Cacheable or @Cache is used. " +"@Cache(strategy=\"..\") is used to override this default." +msgstr "" + #. Tag: title +#: configuration.xml:744 #, no-c-format msgid "Hibernate Transaction Properties" msgstr "Propriétés des transactions Hibernate" -#. Tag: entry -#, no-c-format -msgid "hibernate.transaction.factory_class" +#. Tag: literal +#: configuration.xml:761 +#, fuzzy, no-c-format +msgid "hibernate.transaction.factory_class" msgstr "hibernate.transaction.factory_class" #. Tag: entry +#: configuration.xml:763 #, no-c-format msgid "" "The classname of a TransactionFactory to use with " @@ -1218,6 +1491,7 @@ msgstr "" "par défaut est JDBCTransactionFactory). " #. Tag: para +#: configuration.xml:765 #, no-c-format msgid "" "e.g. classname.of." @@ -1226,12 +1500,14 @@ msgstr "" "par ex.classname.of." "TransactionFactory " -#. Tag: entry -#, no-c-format -msgid "jta.UserTransaction" +#. Tag: literal +#: configuration.xml:771 +#, fuzzy, no-c-format +msgid "jta.UserTransaction" msgstr "jta.UserTransaction" #. Tag: entry +#: configuration.xml:773 #, no-c-format msgid "" "A JNDI name used by JTATransactionFactory to obtain the " @@ -1240,12 +1516,14 @@ msgstr "" "Le nom JNDI utilisé par la JTATransactionFactory pour " "obtenir la UserTransaction JTA du serveur d'applications." -#. Tag: entry +#. Tag: literal +#: configuration.xml:781 #, fuzzy, no-c-format -msgid "hibernate.transaction.manager_lookup_class" +msgid "hibernate.transaction.manager_lookup_class" msgstr "hibernate.transaction. manager_lookup_class" #. Tag: entry +#: configuration.xml:783 #, no-c-format msgid "" "The classname of a TransactionManagerLookup. It is " @@ -1257,6 +1535,7 @@ msgstr "" "générateur hilo dans un environnement JTA." #. Tag: para +#: configuration.xml:786 #, no-c-format msgid "" "e.g. classname.of." @@ -1265,17 +1544,19 @@ msgstr "" "par ex.classname.of." "TransactionManagerLookup " -#. Tag: entry +#. Tag: literal +#: configuration.xml:792 #, fuzzy, no-c-format -msgid "hibernate.transaction.flush_before_completion" +msgid "hibernate.transaction.flush_before_completion" msgstr "hibernate.transaction. flush_before_completion" #. Tag: entry -#, no-c-format +#: configuration.xml:794 +#, fuzzy, no-c-format msgid "" "If enabled, the session will be automatically flushed during the before " "completion phase of the transaction. Built-in and automatic session context " -"management is preferred, see ." msgstr "" "Si activé, la session sera automatiquement vidée durant la phase qui précède " @@ -1283,17 +1564,19 @@ msgstr "" "session fourni par Hibernate est préférable, consultez ." -#. Tag: entry +#. Tag: literal +#: configuration.xml:803 #, fuzzy, no-c-format -msgid "hibernate.transaction.auto_close_session" +msgid "hibernate.transaction.auto_close_session" msgstr "hibernate.transaction. auto_close_session" #. Tag: entry -#, no-c-format +#: configuration.xml:805 +#, fuzzy, no-c-format msgid "" "If enabled, the session will be automatically closed during the after " "completion phase of the transaction. Built-in and automatic session context " -"management is preferred, see ." msgstr "" "Si activé, la session sera automatiquement fermée pendant la phase qui suit " @@ -1302,27 +1585,31 @@ msgstr "" "\"architecture-current-session\" />." #. Tag: title +#: configuration.xml:817 #, no-c-format msgid "Miscellaneous Properties" msgstr "Propriétés diverses" -#. Tag: entry +#. Tag: literal +#: configuration.xml:834 #, fuzzy, no-c-format -msgid "hibernate.current_session_context_class" +msgid "hibernate.current_session_context_class" msgstr "hibernate. current_session_context_class" #. Tag: entry -#, no-c-format +#: configuration.xml:836 +#, fuzzy, no-c-format msgid "" "Supply a custom strategy for the scoping of the \"current\" " "Session. See for more information about the built-in strategies." +"\"/> for more information about the built-in strategies." msgstr "" "Fournit une stratégie particulière pour la portée de la Session courante. Consultez pour plus d'informations sur les stratégies incorporées. " #. Tag: para +#: configuration.xml:839 #, no-c-format msgid "" "e.g. jta | " @@ -1333,17 +1620,20 @@ msgstr "" "thread | managed | custom." "Class" -#. Tag: entry -#, no-c-format -msgid "hibernate.query.factory_class" +#. Tag: literal +#: configuration.xml:846 +#, fuzzy, no-c-format +msgid "hibernate.query.factory_class" msgstr "hibernate.query.factory_class" #. Tag: entry +#: configuration.xml:848 #, no-c-format msgid "Chooses the HQL parser implementation." msgstr "Choisit l'implémentation du parseur de requête HQL. " #. Tag: para +#: configuration.xml:848 #, no-c-format msgid "" "e.g. org.hibernate.hql.ast." @@ -1354,12 +1644,14 @@ msgstr "" "ASTQueryTranslatorFactory ou org.hibernate.hql.classic." "ClassicQueryTranslatorFactory " -#. Tag: entry -#, no-c-format -msgid "hibernate.query.substitutions" +#. Tag: literal +#: configuration.xml:857 +#, fuzzy, no-c-format +msgid "hibernate.query.substitutions" msgstr "hibernate.query.substitutions" #. Tag: entry +#: configuration.xml:859 #, no-c-format msgid "" "Is used to map from tokens in Hibernate queries to SQL tokens (tokens might " @@ -1369,6 +1661,7 @@ msgstr "" "peuvent être des fonctions ou des noms textuels par exemple)." #. Tag: para +#: configuration.xml:861 #, no-c-format msgid "" "e.g. hqlLiteral=SQL_LITERAL, " @@ -1377,12 +1670,14 @@ msgstr "" "par ex.hqlLiteral=SQL_LITERAL, " "hqlFunction=SQLFUNC " -#. Tag: entry -#, no-c-format -msgid "hibernate.hbm2ddl.auto" +#. Tag: literal +#: configuration.xml:867 +#, fuzzy, no-c-format +msgid "hibernate.hbm2ddl.auto" msgstr "hibernate.hbm2ddl.auto" #. Tag: entry +#: configuration.xml:869 #, no-c-format msgid "" "Automatically validates or exports schema DDL to the database when the " @@ -1397,6 +1692,7 @@ msgstr "" "explicitement." #. Tag: para +#: configuration.xml:873 #, no-c-format msgid "" "e.g. validate | " @@ -1407,12 +1703,49 @@ msgstr "" "update | create | create-" "drop " -#. Tag: entry +#. Tag: literal +#: configuration.xml:880 #, fuzzy, no-c-format -msgid "hibernate.cglib.use_reflection_optimizer" +msgid "hibernate.hbm2ddl.import_file" +msgstr "hibernate.hbm2ddl.auto" + +#. Tag: para +#: configuration.xml:882 +#, no-c-format +msgid "" +"Comma-separated names of the optional files containing SQL DML statements " +"executed during the SessionFactory creation. This is " +"useful for testing or demoing: by adding INSERT statements for example you " +"can populate your database with a minimal set of data when it is deployed." +msgstr "" + +#. Tag: para +#: configuration.xml:887 +#, no-c-format +msgid "" +"File order matters, the statements of a give file are executed before the " +"statements of the following files. These statements are only executed if the " +"schema is created ie if hibernate.hbm2ddl.auto is set to " +"create or create-drop." +msgstr "" + +#. Tag: para +#: configuration.xml:892 +#, fuzzy, no-c-format +msgid "" +"e.g. /humans.sql,/dogs.sql" +msgstr "" +"par ex. true|false" + +#. Tag: literal +#: configuration.xml:898 +#, fuzzy, no-c-format +msgid "hibernate.cglib.use_reflection_optimizer" msgstr "hibernate.cglib. use_reflection_optimizer" #. Tag: entry +#: configuration.xml:900 #, no-c-format msgid "" "Enables the use of CGLIB instead of runtime reflection (System-level " @@ -1427,11 +1760,13 @@ msgstr "" "cette propriété dans la hibernate.cfg.xml. " #. Tag: title +#: configuration.xml:913 #, no-c-format msgid "SQL Dialects" msgstr "Dialectes SQL" #. Tag: para +#: configuration.xml:915 #, no-c-format msgid "" "Always set the hibernate.dialect property to the correct " @@ -1447,256 +1782,307 @@ msgstr "" "propriétés listées ci-dessus, vous évitant ainsi de l'effectuer à la main. " #. Tag: title +#: configuration.xml:922 #, no-c-format msgid "Hibernate SQL Dialects (hibernate.dialect)" msgstr "Dialectes SQL de Hibernate (hibernate.dialect)" #. Tag: entry +#: configuration.xml:933 #, no-c-format msgid "RDBMS" msgstr "RDBMS" #. Tag: entry +#: configuration.xml:935 #, no-c-format msgid "Dialect" msgstr "Dialecte" #. Tag: entry +#: configuration.xml:941 #, no-c-format -msgid "DB2" -msgstr "DB2" +msgid "DB2" +msgstr "" -#. Tag: entry -#, no-c-format -msgid "org.hibernate.dialect.DB2Dialect" +#. Tag: literal +#: configuration.xml:943 +#, fuzzy, no-c-format +msgid "org.hibernate.dialect.DB2Dialect" msgstr "org.hibernate.dialect.DB2Dialect" #. Tag: entry +#: configuration.xml:947 #, no-c-format msgid "DB2 AS/400" msgstr "DB2 AS/400" -#. Tag: entry -#, no-c-format -msgid "org.hibernate.dialect.DB2400Dialect" +#. Tag: literal +#: configuration.xml:949 +#, fuzzy, no-c-format +msgid "org.hibernate.dialect.DB2400Dialect" msgstr "org.hibernate.dialect.DB2400Dialect" #. Tag: entry +#: configuration.xml:953 #, no-c-format msgid "DB2 OS390" msgstr "DB2 OS390" -#. Tag: entry -#, no-c-format -msgid "org.hibernate.dialect.DB2390Dialect" +#. Tag: literal +#: configuration.xml:955 +#, fuzzy, no-c-format +msgid "org.hibernate.dialect.DB2390Dialect" msgstr "org.hibernate.dialect.DB2390Dialect" #. Tag: entry +#: configuration.xml:959 #, no-c-format msgid "PostgreSQL" msgstr "PostgreSQL" -#. Tag: entry -#, no-c-format -msgid "org.hibernate.dialect.PostgreSQLDialect" +#. Tag: literal +#: configuration.xml:961 +#, fuzzy, no-c-format +msgid "org.hibernate.dialect.PostgreSQLDialect" msgstr "org.hibernate.dialect.PostgreSQLDialect" #. Tag: entry +#: configuration.xml:965 #, no-c-format msgid "MySQL" msgstr "MySQL" -#. Tag: entry -#, no-c-format -msgid "org.hibernate.dialect.MySQLDialect" +#. Tag: literal +#: configuration.xml:967 +#, fuzzy, no-c-format +msgid "org.hibernate.dialect.MySQLDialect" msgstr "org.hibernate.dialect.MySQLDialect" #. Tag: entry +#: configuration.xml:971 #, no-c-format msgid "MySQL with InnoDB" msgstr "MySQL with InnoDB" -#. Tag: entry -#, no-c-format -msgid "org.hibernate.dialect.MySQLInnoDBDialect" +#. Tag: literal +#: configuration.xml:973 +#, fuzzy, no-c-format +msgid "org.hibernate.dialect.MySQLInnoDBDialect" msgstr "org.hibernate.dialect.MySQLInnoDBDialect" #. Tag: entry +#: configuration.xml:977 #, no-c-format msgid "MySQL with MyISAM" msgstr "MySQL with MyISAM" -#. Tag: entry -#, no-c-format -msgid "org.hibernate.dialect.MySQLMyISAMDialect" +#. Tag: literal +#: configuration.xml:979 +#, fuzzy, no-c-format +msgid "org.hibernate.dialect.MySQLMyISAMDialect" msgstr "org.hibernate.dialect.MySQLMyISAMDialect" #. Tag: entry +#: configuration.xml:983 #, no-c-format msgid "Oracle (any version)" msgstr "Oracle (toutes versions)" -#. Tag: entry -#, no-c-format -msgid "org.hibernate.dialect.OracleDialect" +#. Tag: literal +#: configuration.xml:985 +#, fuzzy, no-c-format +msgid "org.hibernate.dialect.OracleDialect" msgstr "org.hibernate.dialect.OracleDialect" #. Tag: entry +#: configuration.xml:989 #, no-c-format msgid "Oracle 9i" msgstr "Oracle 9i" -#. Tag: entry -#, no-c-format -msgid "org.hibernate.dialect.Oracle9iDialect" +#. Tag: literal +#: configuration.xml:991 +#, fuzzy, no-c-format +msgid "org.hibernate.dialect.Oracle9iDialect" msgstr "org.hibernate.dialect.Oracle9iDialect" #. Tag: entry +#: configuration.xml:995 #, no-c-format msgid "Oracle 10g" msgstr "Oracle 10g" -#. Tag: entry -#, no-c-format -msgid "org.hibernate.dialect.Oracle10gDialect" +#. Tag: literal +#: configuration.xml:997 +#, fuzzy, no-c-format +msgid "org.hibernate.dialect.Oracle10gDialect" msgstr "org.hibernate.dialect.Oracle10gDialect" #. Tag: entry +#: configuration.xml:1001 #, no-c-format msgid "Sybase" msgstr "Sybase" -#. Tag: entry -#, no-c-format -msgid "org.hibernate.dialect.SybaseDialect" +#. Tag: literal +#: configuration.xml:1003 +#, fuzzy, no-c-format +msgid "org.hibernate.dialect.SybaseDialect" msgstr "org.hibernate.dialect.SybaseDialect" #. Tag: entry +#: configuration.xml:1007 #, no-c-format msgid "Sybase Anywhere" msgstr "Sybase Anywhere" -#. Tag: entry -#, no-c-format -msgid "org.hibernate.dialect.SybaseAnywhereDialect" +#. Tag: literal +#: configuration.xml:1009 +#, fuzzy, no-c-format +msgid "org.hibernate.dialect.SybaseAnywhereDialect" msgstr "org.hibernate.dialect.SybaseAnywhereDialect" #. Tag: entry +#: configuration.xml:1013 #, no-c-format msgid "Microsoft SQL Server" msgstr "Microsoft SQL Server" -#. Tag: entry -#, no-c-format -msgid "org.hibernate.dialect.SQLServerDialect" +#. Tag: literal +#: configuration.xml:1015 +#, fuzzy, no-c-format +msgid "org.hibernate.dialect.SQLServerDialect" msgstr "org.hibernate.dialect.SQLServerDialect" #. Tag: entry +#: configuration.xml:1019 #, no-c-format msgid "SAP DB" msgstr "SAP DB" -#. Tag: entry -#, no-c-format -msgid "org.hibernate.dialect.SAPDBDialect" +#. Tag: literal +#: configuration.xml:1021 +#, fuzzy, no-c-format +msgid "org.hibernate.dialect.SAPDBDialect" msgstr "org.hibernate.dialect.SAPDBDialect" #. Tag: entry +#: configuration.xml:1025 #, no-c-format msgid "Informix" msgstr "Informix" -#. Tag: entry -#, no-c-format -msgid "org.hibernate.dialect.InformixDialect" +#. Tag: literal +#: configuration.xml:1027 +#, fuzzy, no-c-format +msgid "org.hibernate.dialect.InformixDialect" msgstr "org.hibernate.dialect.InformixDialect" #. Tag: entry +#: configuration.xml:1031 #, no-c-format msgid "HypersonicSQL" msgstr "HypersonicSQL" -#. Tag: entry -#, no-c-format -msgid "org.hibernate.dialect.HSQLDialect" +#. Tag: literal +#: configuration.xml:1033 +#, fuzzy, no-c-format +msgid "org.hibernate.dialect.HSQLDialect" msgstr "org.hibernate.dialect.HSQLDialect" #. Tag: entry +#: configuration.xml:1037 #, no-c-format msgid "Ingres" msgstr "Ingres" -#. Tag: entry -#, no-c-format -msgid "org.hibernate.dialect.IngresDialect" +#. Tag: literal +#: configuration.xml:1039 +#, fuzzy, no-c-format +msgid "org.hibernate.dialect.IngresDialect" msgstr "org.hibernate.dialect.IngresDialect" #. Tag: entry +#: configuration.xml:1043 #, no-c-format msgid "Progress" msgstr "Progress" -#. Tag: entry -#, no-c-format -msgid "org.hibernate.dialect.ProgressDialect" +#. Tag: literal +#: configuration.xml:1045 +#, fuzzy, no-c-format +msgid "org.hibernate.dialect.ProgressDialect" msgstr "org.hibernate.dialect.ProgressDialect" #. Tag: entry +#: configuration.xml:1049 #, no-c-format msgid "Mckoi SQL" msgstr "Mckoi SQL" -#. Tag: entry -#, no-c-format -msgid "org.hibernate.dialect.MckoiDialect" +#. Tag: literal +#: configuration.xml:1051 +#, fuzzy, no-c-format +msgid "org.hibernate.dialect.MckoiDialect" msgstr "org.hibernate.dialect.MckoiDialect" #. Tag: entry +#: configuration.xml:1055 #, no-c-format msgid "Interbase" msgstr "Interbase" -#. Tag: entry -#, no-c-format -msgid "org.hibernate.dialect.InterbaseDialect" +#. Tag: literal +#: configuration.xml:1057 +#, fuzzy, no-c-format +msgid "org.hibernate.dialect.InterbaseDialect" msgstr "org.hibernate.dialect.InterbaseDialect" #. Tag: entry +#: configuration.xml:1061 #, no-c-format msgid "Pointbase" msgstr "Pointbase" -#. Tag: entry -#, no-c-format -msgid "org.hibernate.dialect.PointbaseDialect" +#. Tag: literal +#: configuration.xml:1063 +#, fuzzy, no-c-format +msgid "org.hibernate.dialect.PointbaseDialect" msgstr "org.hibernate.dialect.PointbaseDialect" #. Tag: entry +#: configuration.xml:1067 #, no-c-format msgid "FrontBase" msgstr "FrontBase" -#. Tag: entry -#, no-c-format -msgid "org.hibernate.dialect.FrontbaseDialect" +#. Tag: literal +#: configuration.xml:1069 +#, fuzzy, no-c-format +msgid "org.hibernate.dialect.FrontbaseDialect" msgstr "org.hibernate.dialect.FrontbaseDialect" #. Tag: entry +#: configuration.xml:1073 #, no-c-format msgid "Firebird" msgstr "Firebird" -#. Tag: entry -#, no-c-format -msgid "org.hibernate.dialect.FirebirdDialect" +#. Tag: literal +#: configuration.xml:1075 +#, fuzzy, no-c-format +msgid "org.hibernate.dialect.FirebirdDialect" msgstr "org.hibernate.dialect.FirebirdDialect" #. Tag: title +#: configuration.xml:1083 #, no-c-format msgid "Outer Join Fetching" msgstr "Chargement par jointure externe" #. Tag: para +#: configuration.xml:1085 #, no-c-format msgid "" "If your database supports ANSI, Oracle or Sybase style outer joins, " @@ -1716,6 +2102,7 @@ msgstr "" "un d'être chargé en un seul SQLSELECT." #. Tag: para +#: configuration.xml:1094 #, no-c-format msgid "" "Outer join fetching can be disabled globally by setting " @@ -1732,18 +2119,21 @@ msgstr "" "fetch=\"join\". " #. Tag: para -#, no-c-format -msgid "See for more information." +#: configuration.xml:1100 +#, fuzzy, no-c-format +msgid "See for more information." msgstr "" "Reportez vous à pour plus " "d'informations." #. Tag: title +#: configuration.xml:1105 #, no-c-format msgid "Binary Streams" msgstr "Flux binaires" #. Tag: para +#: configuration.xml:1107 #, no-c-format msgid "" "Oracle limits the size of byte arrays that can be passed " @@ -1760,27 +2150,31 @@ msgstr "" "une fonctionalité de niveau système uniquement." #. Tag: title +#: configuration.xml:1116 #, no-c-format msgid "Second-level and query cache" msgstr "Cache de second niveau et cache de requêtes" #. Tag: para -#, no-c-format +#: configuration.xml:1118 +#, fuzzy, no-c-format msgid "" "The properties prefixed by hibernate.cache allow you to " "use a process or cluster scoped second-level cache system with Hibernate. " -"See the for more information." +"See the for more information." msgstr "" "Les propriétés préfixées par hibernate.cache vous " "permettent d'utiliser un système de cache de second niveau avec Hibernate. " "Référez vous à pour plus de détails." #. Tag: title +#: configuration.xml:1125 #, no-c-format msgid "Query Language Substitution" msgstr "Substitution dans le langage de requêtes" #. Tag: para +#: configuration.xml:1127 #, no-c-format msgid "" "You can define new Hibernate query tokens using hibernate.query." @@ -1789,7 +2183,14 @@ msgstr "" "Vous pouvez définir de nouveaux jetons dans les requêtes Hibernate en " "utilisant hibernate.query.substitutions. Par exemple :" +#. Tag: programlisting +#: configuration.xml:1130 +#, fuzzy, no-c-format +msgid "hibernate.query.substitutions true=1, false=0" +msgstr "hibernate.query.substitutions" + #. Tag: para +#: configuration.xml:1132 #, no-c-format msgid "" "This would cause the tokens true and falsetrue et false seraient transformés par des entiers dans le SQL généré." +#. Tag: programlisting +#: configuration.xml:1136 +#, fuzzy, no-c-format +msgid "hibernate.query.substitutions toLowercase=LOWER" +msgstr "hibernate.query.substitutions" + #. Tag: para +#: configuration.xml:1138 #, no-c-format msgid "" "This would allow you to rename the SQL LOWER function." msgstr "Cela permettrait de renommer la fonction SQL LOWER." #. Tag: title +#: configuration.xml:1143 #, no-c-format msgid "Hibernate statistics" msgstr "Statistiques Hibernate" #. Tag: para +#: configuration.xml:1145 #, no-c-format msgid "" "If you enable hibernate.generate_statistics, Hibernate " @@ -1826,11 +2236,13 @@ msgstr "" "hibernate.stats pour plus d'informations. " #. Tag: title +#: configuration.xml:1155 #, no-c-format msgid "Logging" msgstr "Journalisation" #. Tag: para +#: configuration.xml:1157 #, no-c-format msgid "" "Hibernate utilizes Simple Logging " @@ -1861,6 +2273,7 @@ msgstr "" "dans le répertoire src/." #. Tag: para +#: configuration.xml:1171 #, no-c-format msgid "" "It is recommended that you familiarize yourself with Hibernate's log " @@ -1876,60 +2289,71 @@ msgstr "" "suivantes : " #. Tag: title +#: configuration.xml:1178 #, no-c-format msgid "Hibernate Log Categories" msgstr "Catégories de logs de Hibernate" #. Tag: entry +#: configuration.xml:1187 #, no-c-format msgid "Category" msgstr "Catégorie" #. Tag: entry +#: configuration.xml:1189 #, no-c-format msgid "Function" msgstr "Fonction" -#. Tag: entry -#, no-c-format -msgid "org.hibernate.SQL" +#. Tag: literal +#: configuration.xml:1195 +#, fuzzy, no-c-format +msgid "org.hibernate.SQL" msgstr "org.hibernate.SQL" #. Tag: entry +#: configuration.xml:1197 #, no-c-format msgid "Log all SQL DML statements as they are executed" msgstr "" "Journalise toutes les requêtes SQL de type DML (gestion des données) qui " "sont exécutées" -#. Tag: entry -#, no-c-format -msgid "org.hibernate.type" +#. Tag: literal +#: configuration.xml:1201 +#, fuzzy, no-c-format +msgid "org.hibernate.type" msgstr "org.hibernate.type" #. Tag: entry +#: configuration.xml:1203 #, no-c-format msgid "Log all JDBC parameters" msgstr "Journalise tous les paramètres JDBC" -#. Tag: entry +#. Tag: literal +#: configuration.xml:1207 #, fuzzy, no-c-format -msgid "org.hibernate.tool.hbm2ddl" +msgid "org.hibernate.tool.hbm2ddl" msgstr "org.hibernate.tool. hbm2ddl" #. Tag: entry +#: configuration.xml:1209 #, no-c-format msgid "Log all SQL DDL statements as they are executed" msgstr "" "Journalise toutes les requêtes SQL de type DDL (gestion de la structure de " "la base) qui sont exécutées" -#. Tag: entry -#, no-c-format -msgid "org.hibernate.pretty" +#. Tag: literal +#: configuration.xml:1213 +#, fuzzy, no-c-format +msgid "org.hibernate.pretty" msgstr "org.hibernate.pretty" #. Tag: entry +#: configuration.xml:1215 #, no-c-format msgid "" "Log the state of all entities (max 20 entities) associated with the session " @@ -1938,64 +2362,76 @@ msgstr "" "Journalise l'état de toutes les entités (20 entités maximum) associées avec " "la session Hibernate au moment du flush" -#. Tag: entry -#, no-c-format -msgid "org.hibernate.cache" +#. Tag: literal +#: configuration.xml:1220 +#, fuzzy, no-c-format +msgid "org.hibernate.cache" msgstr "org.hibernate.cache" #. Tag: entry +#: configuration.xml:1222 #, no-c-format msgid "Log all second-level cache activity" msgstr "Journalise toute activité du cache de second niveau" -#. Tag: entry +#. Tag: literal +#: configuration.xml:1226 #, fuzzy, no-c-format -msgid "org.hibernate.transaction" +msgid "org.hibernate.transaction" msgstr "org.hibernate. transaction" #. Tag: entry +#: configuration.xml:1228 #, no-c-format msgid "Log transaction related activity" msgstr "Journalise toute activité relative aux transactions" -#. Tag: entry -#, no-c-format -msgid "org.hibernate.jdbc" +#. Tag: literal +#: configuration.xml:1232 +#, fuzzy, no-c-format +msgid "org.hibernate.jdbc" msgstr "org.hibernate.jdbc" #. Tag: entry +#: configuration.xml:1234 #, no-c-format msgid "Log all JDBC resource acquisition" msgstr "Journalise toute acquisition de ressource JDBC " -#. Tag: entry +#. Tag: literal +#: configuration.xml:1238 #, fuzzy, no-c-format -msgid "org.hibernate.hql.ast.AST" +msgid "org.hibernate.hql.ast.AST" msgstr "org.hibernate.hql. ast.AST" #. Tag: entry +#: configuration.xml:1240 #, no-c-format msgid "Log HQL and SQL ASTs during query parsing" msgstr "" "Journalise l'arbre syntaxique des requêtes HQL et SQL durant l'analyse " "syntaxique des requêtes" -#. Tag: entry -#, no-c-format -msgid "org.hibernate.secure" +#. Tag: literal +#: configuration.xml:1244 +#, fuzzy, no-c-format +msgid "org.hibernate.secure" msgstr "org.hibernate.secure" #. Tag: entry +#: configuration.xml:1246 #, no-c-format msgid "Log all JAAS authorization requests" msgstr "Journalise toutes les demandes d'autorisation JAAS" -#. Tag: entry +#. Tag: literal +#: configuration.xml:1250 #, no-c-format -msgid "org.hibernate" -msgstr "org.hibernate" +msgid "org.hibernate" +msgstr "" #. Tag: entry +#: configuration.xml:1252 #, no-c-format msgid "" "Log everything. This is a lot of information but it is useful for " @@ -2005,6 +2441,7 @@ msgstr "" "problèmes)." #. Tag: para +#: configuration.xml:1259 #, no-c-format msgid "" "When developing applications with Hibernate, you should almost always work " @@ -2018,12 +2455,14 @@ msgstr "" "propriété hibernate.show_sql activée." #. Tag: title +#: configuration.xml:1266 #, no-c-format msgid "Implementing a NamingStrategy" msgstr "" "Sélectionne une NamingStrategy (stratégie de nommage)" #. Tag: para +#: configuration.xml:1268 #, no-c-format msgid "" "The interface org.hibernate.cfg.NamingStrategy allows you " @@ -2034,6 +2473,7 @@ msgstr "" "de données." #. Tag: para +#: configuration.xml:1272 #, no-c-format msgid "" "You can provide rules for automatically generating database identifiers from " @@ -2052,6 +2492,7 @@ msgstr "" "utilisée par Hibernate est assez minimale." #. Tag: para +#: configuration.xml:1279 #, no-c-format msgid "" "You can specify a different strategy by calling Configuration." @@ -2061,7 +2502,19 @@ msgstr "" "Configuration.setNamingStrategy() avant d'ajouter des " "mappages : " +#. Tag: programlisting +#: configuration.xml:1283 +#, no-c-format +msgid "" +"SessionFactory sf = new Configuration()\n" +" .setNamingStrategy(ImprovedNamingStrategy.INSTANCE)\n" +" .addFile(\"Item.hbm.xml\")\n" +" .addFile(\"Bid.hbm.xml\")\n" +" .buildSessionFactory();" +msgstr "" + #. Tag: para +#: configuration.xml:1285 #, no-c-format msgid "" "org.hibernate.cfg.ImprovedNamingStrategy is a built-in " @@ -2072,11 +2525,13 @@ msgstr "" "applications." #. Tag: title +#: configuration.xml:1291 #, no-c-format msgid "XML configuration file" msgstr "Fichier de configuration XML" #. Tag: para +#: configuration.xml:1293 #, no-c-format msgid "" "An alternative approach to configuration is to specify a full configuration " @@ -2091,6 +2546,7 @@ msgstr "" "présents." #. Tag: para +#: configuration.xml:1299 #, no-c-format msgid "" "The XML configuration file is by default expected to be in the root of your " @@ -2099,7 +2555,53 @@ msgstr "" "Le fichier de configuration XML doit par défaut se placer à la racine du " "CLASSPATH. En voici un exemple : " +#. Tag: programlisting +#: configuration.xml:1302 +#, no-c-format +msgid "" +"<?xml version='1.0' encoding='utf-8'?>\n" +"<!DOCTYPE hibernate-configuration PUBLIC\n" +" \"-//Hibernate/Hibernate Configuration DTD//EN\"\n" +" \"http://hibernate.sourceforge.net/hibernate-configuration-3.0.dtd" +"\">\n" +"\n" +"<hibernate-configuration>\n" +"\n" +" <!-- a SessionFactory instance listed as /jndi/name -->\n" +" <session-factory\n" +" name=\"java:hibernate/SessionFactory\">\n" +"\n" +" <!-- properties -->\n" +" <property name=\"connection.datasource\">java:/comp/env/jdbc/" +"MyDB</property>\n" +" <property name=\"dialect\">org.hibernate.dialect." +"MySQLDialect</property>\n" +" <property name=\"show_sql\">false</property>\n" +" <property name=\"transaction.factory_class\">\n" +" org.hibernate.transaction.JTATransactionFactory\n" +" </property>\n" +" <property name=\"jta.UserTransaction\">java:comp/" +"UserTransaction</property>\n" +"\n" +" <!-- mapping files -->\n" +" <mapping resource=\"org/hibernate/auction/Item.hbm.xml\"/>\n" +" <mapping resource=\"org/hibernate/auction/Bid.hbm.xml\"/>\n" +"\n" +" <!-- cache settings -->\n" +" <class-cache class=\"org.hibernate.auction.Item\" usage=\"read-" +"write\"/>\n" +" <class-cache class=\"org.hibernate.auction.Bid\" usage=\"read-only" +"\"/>\n" +" <collection-cache collection=\"org.hibernate.auction.Item.bids\" " +"usage=\"read-write\"/>\n" +"\n" +" </session-factory>\n" +"\n" +"</hibernate-configuration>" +msgstr "" + #. Tag: para +#: configuration.xml:1304 #, no-c-format msgid "" "The advantage of this approach is the externalization of the mapping file " @@ -2119,24 +2621,44 @@ msgstr "" "dessus. " #. Tag: para +#: configuration.xml:1311 #, no-c-format msgid "With the XML configuration, starting Hibernate is then as simple as:" msgstr "" "Avec la configuration XML, démarrer Hibernate devient donc aussi simple que " "ceci : " +#. Tag: programlisting +#: configuration.xml:1314 +#, no-c-format +msgid "" +"SessionFactory sf = new Configuration().configure().buildSessionFactory();" +msgstr "" + #. Tag: para +#: configuration.xml:1316 #, no-c-format msgid "You can select a different XML configuration file using:" msgstr "" "Vous pouvez choisir un fichier de configuration XML différent en utilisant : " +#. Tag: programlisting +#: configuration.xml:1318 +#, no-c-format +msgid "" +"SessionFactory sf = new Configuration()\n" +" .configure(\"catdb.cfg.xml\")\n" +" .buildSessionFactory();" +msgstr "" + #. Tag: title +#: configuration.xml:1322 #, no-c-format msgid "J2EE Application Server integration" msgstr "Intégration à un serveur d'applications J2EE" #. Tag: para +#: configuration.xml:1324 #, no-c-format msgid "Hibernate has the following integration points for J2EE infrastructure:" msgstr "" @@ -2144,6 +2666,7 @@ msgstr "" "J2EE :" #. Tag: para +#: configuration.xml:1329 #, no-c-format msgid "" "Container-managed datasources: Hibernate can use JDBC " @@ -2167,6 +2690,7 @@ msgstr "" "portabilité de votre code entre plusieurs serveurs d'application. " #. Tag: para +#: configuration.xml:1343 #, no-c-format msgid "" "Automatic JNDI binding: Hibernate can bind its " @@ -2176,6 +2700,7 @@ msgstr "" "sa SessionFactory à JNDI après le démarrage." #. Tag: para +#: configuration.xml:1350 #, no-c-format msgid "" "JTA Session binding: the Hibernate SessionJMX deployment: if you have a JMX capable application " @@ -2216,6 +2742,7 @@ msgstr "" "disponible avant le démarrage de Hibernate, etc). " #. Tag: para +#: configuration.xml:1373 #, no-c-format msgid "" "Depending on your environment, you might have to set the configuration " @@ -2228,11 +2755,13 @@ msgstr "" "containment\"." #. Tag: title +#: configuration.xml:1379 #, no-c-format msgid "Transaction strategy configuration" msgstr "Configuration de la stratégie transactionnelle" #. Tag: para +#: configuration.xml:1381 #, no-c-format msgid "" "The Hibernate Session API is independent of any " @@ -2252,6 +2781,7 @@ msgstr "" "cela est nécessaire. " #. Tag: para +#: configuration.xml:1389 #, no-c-format msgid "" "To keep your code portable between these two (and other) environments we " @@ -2270,27 +2800,32 @@ msgstr "" "factory_class." #. Tag: para +#: configuration.xml:1397 #, no-c-format msgid "There are three standard, or built-in, choices:" msgstr "Il existe trois choix standards (intégrés) : " -#. Tag: term -#, no-c-format -msgid "org.hibernate.transaction.JDBCTransactionFactory" +#. Tag: literal +#: configuration.xml:1401 +#, fuzzy, no-c-format +msgid "org.hibernate.transaction.JDBCTransactionFactory" msgstr "org.hibernate.transaction.JDBCTransactionFactory" #. Tag: para +#: configuration.xml:1404 #, no-c-format msgid "delegates to database (JDBC) transactions (default)" msgstr "" "délègue aux transactions de la base de données (JDBC) (valeur par défaut)." -#. Tag: term -#, no-c-format -msgid "org.hibernate.transaction.JTATransactionFactory" +#. Tag: literal +#: configuration.xml:1409 +#, fuzzy, no-c-format +msgid "org.hibernate.transaction.JTATransactionFactory" msgstr "org.hibernate.transaction.JTATransactionFactory" #. Tag: para +#: configuration.xml:1412 #, no-c-format msgid "" "delegates to container-managed transactions if an existing transaction is " @@ -2301,17 +2836,20 @@ msgstr "" "méthode d'un EJB session), sinon une nouvelle transaction est entamée et une " "transaction gérée par le bean est utilisée. " -#. Tag: term -#, no-c-format -msgid "org.hibernate.transaction.CMTTransactionFactory" +#. Tag: literal +#: configuration.xml:1420 +#, fuzzy, no-c-format +msgid "org.hibernate.transaction.CMTTransactionFactory" msgstr "org.hibernate.transaction.CMTTransactionFactory" #. Tag: para +#: configuration.xml:1423 #, no-c-format msgid "delegates to container-managed JTA transactions" msgstr "délègue aux transactions JTA gérées par le conteneur" #. Tag: para +#: configuration.xml:1428 #, no-c-format msgid "" "You can also define your own transaction strategies (for a CORBA transaction " @@ -2321,6 +2859,7 @@ msgstr "" "un service de transaction CORBA par exemple). " #. Tag: para +#: configuration.xml:1431 #, no-c-format msgid "" "Some features in Hibernate (i.e., the second level cache, Contextual " @@ -2338,151 +2877,164 @@ msgstr "" "car J2EE ne fournit pas un seul mécanisme standard. " #. Tag: title +#: configuration.xml:1439 #, no-c-format msgid "JTA TransactionManagers" msgstr "TransactionManagers JTA" #. Tag: entry +#: configuration.xml:1448 #, no-c-format msgid "Transaction Factory" msgstr "Fabrique de transaction" #. Tag: entry +#: configuration.xml:1450 #, no-c-format msgid "Application Server" msgstr "Serveur d'applications" -#. Tag: entry +#. Tag: literal +#: configuration.xml:1456 #, fuzzy, no-c-format -msgid "" -"org.hibernate.transaction.JBossTransactionManagerLookup" +msgid "org.hibernate.transaction.JBossTransactionManagerLookup" msgstr "" "org.hibernate.transaction. JBossTransactionManagerLookup" #. Tag: entry +#: configuration.xml:1458 #, no-c-format msgid "JBoss" msgstr "JBoss" -#. Tag: entry +#. Tag: literal +#: configuration.xml:1462 #, fuzzy, no-c-format -msgid "" -"org.hibernate.transaction.WeblogicTransactionManagerLookup" +msgid "org.hibernate.transaction.WeblogicTransactionManagerLookup" msgstr "" "org.hibernate.transaction. WeblogicTransactionManagerLookup" #. Tag: entry +#: configuration.xml:1464 #, no-c-format msgid "Weblogic" msgstr "Weblogic" -#. Tag: entry +#. Tag: literal +#: configuration.xml:1468 #, fuzzy, no-c-format -msgid "" -"org.hibernate.transaction.WebSphereTransactionManagerLookup" +msgid "org.hibernate.transaction.WebSphereTransactionManagerLookup" msgstr "" "org.hibernate.transaction. WebSphereTransactionManagerLookup" #. Tag: entry +#: configuration.xml:1470 #, no-c-format msgid "WebSphere" msgstr "WebSphere" -#. Tag: entry +#. Tag: literal +#: configuration.xml:1474 #, fuzzy, no-c-format -msgid "" -"org.hibernate.transaction.WebSphereExtendedJTATransactionLookup" +msgid "org.hibernate.transaction.WebSphereExtendedJTATransactionLookup" msgstr "" "org.hibernate.transaction. WebSphereExtendedJTATransactionLookup" #. Tag: entry +#: configuration.xml:1476 #, no-c-format msgid "WebSphere 6" msgstr "WebSphere 6" -#. Tag: entry +#. Tag: literal +#: configuration.xml:1480 #, fuzzy, no-c-format -msgid "" -"org.hibernate.transaction.OrionTransactionManagerLookup" +msgid "org.hibernate.transaction.OrionTransactionManagerLookup" msgstr "" "org.hibernate.transaction. OrionTransactionManagerLookup" #. Tag: entry +#: configuration.xml:1482 #, no-c-format msgid "Orion" msgstr "Orion" -#. Tag: entry +#. Tag: literal +#: configuration.xml:1486 #, fuzzy, no-c-format -msgid "" -"org.hibernate.transaction.ResinTransactionManagerLookup" +msgid "org.hibernate.transaction.ResinTransactionManagerLookup" msgstr "" "org.hibernate.transaction. ResinTransactionManagerLookup" #. Tag: entry +#: configuration.xml:1488 #, no-c-format msgid "Resin" msgstr "Resin" -#. Tag: entry +#. Tag: literal +#: configuration.xml:1492 #, fuzzy, no-c-format -msgid "" -"org.hibernate.transaction.JOTMTransactionManagerLookup" +msgid "org.hibernate.transaction.JOTMTransactionManagerLookup" msgstr "" "org.hibernate.transaction. JOTMTransactionManagerLookup" #. Tag: entry +#: configuration.xml:1494 #, no-c-format msgid "JOTM" msgstr "JOTM" -#. Tag: entry +#. Tag: literal +#: configuration.xml:1498 #, fuzzy, no-c-format -msgid "" -"org.hibernate.transaction.JOnASTransactionManagerLookup" +msgid "org.hibernate.transaction.JOnASTransactionManagerLookup" msgstr "" "org.hibernate.transaction. JOnASTransactionManagerLookup" #. Tag: entry +#: configuration.xml:1500 #, no-c-format msgid "JOnAS" msgstr "JOnAS" -#. Tag: entry +#. Tag: literal +#: configuration.xml:1504 #, fuzzy, no-c-format -msgid "" -"org.hibernate.transaction.JRun4TransactionManagerLookup" +msgid "org.hibernate.transaction.JRun4TransactionManagerLookup" msgstr "" "org.hibernate.transaction. JRun4TransactionManagerLookup" #. Tag: entry +#: configuration.xml:1506 #, no-c-format msgid "JRun4" msgstr "JRun4" -#. Tag: entry +#. Tag: literal +#: configuration.xml:1510 #, fuzzy, no-c-format -msgid "" -"org.hibernate.transaction.BESTransactionManagerLookup" +msgid "org.hibernate.transaction.BESTransactionManagerLookup" msgstr "" "org.hibernate.transaction. BESTransactionManagerLookup" #. Tag: entry +#: configuration.xml:1512 #, no-c-format msgid "Borland ES" msgstr "Borland ES" #. Tag: title +#: configuration.xml:1520 #, no-c-format msgid "JNDI-bound SessionFactory" msgstr "SessionFactory associée au JNDI" #. Tag: para +#: configuration.xml:1522 #, no-c-format msgid "" "A JNDI-bound Hibernate SessionFactory can simplify the " @@ -2497,6 +3049,7 @@ msgstr "" "même registre ! " #. Tag: para +#: configuration.xml:1528 #, no-c-format msgid "" "If you wish to have the SessionFactory bound to a JNDI " @@ -2515,6 +3068,7 @@ msgstr "" "comme c'est le cas pour Tomcat). " #. Tag: para +#: configuration.xml:1536 #, no-c-format msgid "" "When binding the SessionFactory to JNDI, Hibernate will " @@ -2529,6 +3083,7 @@ msgstr "" "literal> par défaut sera utilisé. " #. Tag: para +#: configuration.xml:1542 #, no-c-format msgid "" "Hibernate will automatically place the SessionFactory in " @@ -2546,6 +3101,7 @@ msgstr "" "plus tard dans ce document. " #. Tag: para +#: configuration.xml:1550 #, no-c-format msgid "" "If you use a JNDI SessionFactory, an EJB or any other " @@ -2557,7 +3113,8 @@ msgstr "" "utilisant une recherche JNDI. " #. Tag: para -#, no-c-format +#: configuration.xml:1554 +#, fuzzy, no-c-format msgid "" "It is recommended that you bind the SessionFactory to " "JNDI in a managed environment and use a static singleton " @@ -2565,7 +3122,7 @@ msgid "" "recommend to hide the actual lookup code for a SessionFactory in a helper class, such as HibernateUtil.getSessionFactory" "(). Note that such a class is also a convenient way to startup " -"Hibernate—see chapter 1." +"Hibernate—see chapter 1." msgstr "" "Nous recommandons de lier la SessionFactory à JNDI dans " "les environnements gérés et d'utilisier un singleton staticSessions and transactions is " "Hibernate's automatic \"current\" Session management. For " "a discussion of contextual sessions see . Using the \"jta\" session context, if there " +"session\"/>. Using the \"jta\" session context, if there " "is no Hibernate Session associated with the current JTA " "transaction, one will be started and associated with that JTA transaction " "the first time you call sessionFactory.getCurrentSession(). The Sessions retrieved via " -"getCurrentSession() in the\"jta\" " +"getCurrentSession() in the \"jta\" " "context are set to automatically flush before the transaction completes, " "close after the transaction completes, and aggressively release JDBC " "connections after each statement. This allows the Sessioncfg.buildSessionFactory() still has to be " @@ -2646,6 +3207,7 @@ msgstr "" "que service géré. " #. Tag: para +#: configuration.xml:1598 #, no-c-format msgid "" "Hibernate is distributed with org.hibernate.jmx.HibernateServicejboss-service.xml " "d'exemple pour JBoss 4.0.x :" +#. Tag: programlisting +#: configuration.xml:1604 +#, no-c-format +msgid "" +"<?xml version=\"1.0\"?>\n" +"<server>\n" +"\n" +"<mbean code=\"org.hibernate.jmx.HibernateService\"\n" +" name=\"jboss.jca:service=HibernateFactory,name=HibernateFactory\">\n" +"\n" +" <!-- Required services -->\n" +" <depends>jboss.jca:service=RARDeployer</depends>\n" +" <depends>jboss.jca:service=LocalTxCM,name=HsqlDS</depends>\n" +"\n" +" <!-- Bind the Hibernate service to JNDI -->\n" +" <attribute name=\"JndiName\">java:/hibernate/SessionFactory</" +"attribute>\n" +"\n" +" <!-- Datasource settings -->\n" +" <attribute name=\"Datasource\">java:HsqlDS</attribute>\n" +" <attribute name=\"Dialect\">org.hibernate.dialect.HSQLDialect</" +"attribute>\n" +"\n" +" <!-- Transaction integration -->\n" +" <attribute name=\"TransactionStrategy\">\n" +" org.hibernate.transaction.JTATransactionFactory</attribute>\n" +" <attribute name=\"TransactionManagerLookupStrategy\">\n" +" org.hibernate.transaction.JBossTransactionManagerLookup</" +"attribute>\n" +" <attribute name=\"FlushBeforeCompletionEnabled\">true</" +"attribute>\n" +" <attribute name=\"AutoCloseSessionEnabled\">true</" +"attribute>\n" +"\n" +" <!-- Fetching options -->\n" +" <attribute name=\"MaximumFetchDepth\">5</attribute>\n" +"\n" +" <!-- Second-level caching -->\n" +" <attribute name=\"SecondLevelCacheEnabled\">true</" +"attribute>\n" +" <attribute name=\"CacheProviderClass\">org.hibernate.cache." +"EhCacheProvider</attribute>\n" +" <attribute name=\"QueryCacheEnabled\">true</attribute>\n" +"\n" +" <!-- Logging -->\n" +" <attribute name=\"ShowSqlEnabled\">true</attribute>\n" +"\n" +" <!-- Mapping files -->\n" +" <attribute name=\"MapResources\">auction/Item.hbm.xml,auction/" +"Category.hbm.xml</attribute>\n" +"\n" +"</mbean>\n" +"\n" +"</server>" +msgstr "" + #. Tag: para +#: configuration.xml:1606 #, no-c-format msgid "" "This file is deployed in a directory called META-INF and " @@ -2681,3 +3300,18 @@ msgstr "" "fichier JAR dans le jar principal du service pour avoir une seule unité " "déployable à chaud. Vous pouvez consulter la documentation de JBoss AS pour " "plus d'informations sur les services JMX et le déploiement des EJB. " + +#~ msgid "JDBC URL" +#~ msgstr "JDBC URL" + +#~ msgid "database user" +#~ msgstr "utilisateur de la base de données" + +#~ msgid "hibernate.generate_statistics" +#~ msgstr "hibernate.generate_statistics" + +#~ msgid "DB2" +#~ msgstr "DB2" + +#~ msgid "org.hibernate" +#~ msgstr "org.hibernate" diff --git a/documentation/manual/src/main/docbook/fr-FR/content/filters.po b/documentation/manual/src/main/docbook/fr-FR/content/filters.po index 425c5a8b36..22a2f41130 100644 --- a/documentation/manual/src/main/docbook/fr-FR/content/filters.po +++ b/documentation/manual/src/main/docbook/fr-FR/content/filters.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: filters\n" "Report-Msgid-Bugs-To: http://bugs.kde.org\n" -"POT-Creation-Date: 2010-02-10T07:25:35\n" +"POT-Creation-Date: 2010-07-20 21:02+0000\n" "PO-Revision-Date: 2009-11-11 09:26+1000\n" "Last-Translator: Corina Roe \n" "Language-Team: French \n" @@ -17,11 +17,13 @@ msgstr "" "X-Generator: KBabel 1.11.4\n" #. Tag: title +#: filters.xml:31 #, no-c-format msgid "Filtering data" msgstr "Filtrer les données" #. Tag: para +#: filters.xml:33 #, no-c-format msgid "" "Hibernate3 provides an innovative new approach to handling data with " @@ -35,11 +37,13 @@ msgstr "" "désactivé pour une session Hibernate particulière. " #. Tag: title +#: filters.xml:39 #, no-c-format msgid "Hibernate filters" msgstr "Filtres Hibernate" #. Tag: para +#: filters.xml:41 #, no-c-format msgid "" "Hibernate3 has the ability to pre-define filter criteria and attach those " @@ -62,9 +66,95 @@ msgstr "" "données, mais paramétrées dans l'application. " #. Tag: para +#: filters.xml:50 #, no-c-format msgid "" -"In order to use filters, they must first be defined and then attached to the " +"Using annotatons filters are defined via @org.hibernate.annotations." +"FilterDef or @org.hibernate.annotations.FilterDefs. A filter definition has a name() and an " +"array of parameters(). A parameter will allow you to adjust the behavior of " +"the filter at runtime. Each parameter is defined by a @ParamDef which has a name and a type. You can also define a " +"defaultCondition() parameter for a given " +"@FilterDef to set the default condition to use when none " +"are defined in each individual @Filter. " +"@FilterDef(s) can be defined at the class or package " +"level." +msgstr "" + +#. Tag: para +#: filters.xml:63 +#, no-c-format +msgid "" +"We now need to define the SQL filter clause applied to either the entity " +"load or the collection load. @Filter is used and placed " +"either on the entity or the collection element. The connection between " +"@FilterName and @Filter is a " +"matching name." +msgstr "" + +#. Tag: title +#: filters.xml:70 +#, no-c-format +msgid "@FilterDef and @Filter annotations" +msgstr "" + +#. Tag: programlisting +#: filters.xml:72 +#, no-c-format +msgid "" +"@Entity\n" +"@FilterDef(name=\"minLength\", parameters=@ParamDef( name=\"minLength\", " +"type=\"integer\" ) )\n" +"@Filters( {\n" +" @Filter(name=\"betweenLength\", condition=\":minLength <= length and :" +"maxLength >= length\"),\n" +" @Filter(name=\"minLength\", condition=\":minLength <= length\")\n" +"} )\n" +"public class Forest { ... }" +msgstr "" + +#. Tag: para +#: filters.xml:75 +#, no-c-format +msgid "" +"When the collection use an association table as a relational representation, " +"you might want to apply the filter condition to the association table itself " +"or to the target entity table. To apply the constraint on the target entity, " +"use the regular @Filter annotation. However, if you want " +"to target the association table, use the @FilterJoinTable " +"annotation." +msgstr "" + +#. Tag: title +#: filters.xml:84 +#, no-c-format +msgid "" +"Using @FilterJoinTable for filterting on the " +"association table" +msgstr "" + +#. Tag: programlisting +#: filters.xml:87 +#, no-c-format +msgid "" +"@OneToMany\n" +" @JoinTable\n" +" //filter on the target entity table\n" +" @Filter(name=\"betweenLength\", condition=\":minLength <= length and :" +"maxLength >= length\")\n" +" //filter on the association table\n" +" @FilterJoinTable(name=\"security\", condition=\":userlevel >= " +"requredLevel\")\n" +" public Set<Forest> getForests() { ... }" +msgstr "" + +#. Tag: para +#: filters.xml:90 +#, fuzzy, no-c-format +msgid "" +"Using Hibernate mapping files for defining filters the situtation is very " +"similar. The filters must first be defined and then attached to the " "appropriate mapping elements. To define a filter, use the <" "filter-def/> element within a <hibernate-mapping/" "> element:" @@ -74,22 +164,58 @@ msgstr "" "l'élément <filter-def/> dans un élément " "<hibernate-mapping/> :" -#. Tag: para +#. Tag: title +#: filters.xml:97 #, no-c-format -msgid "This filter can then be attached to a class:" -msgstr "Puis, ce filtre peut être attaché à une classe : " +msgid "Defining a filter definition via <filter-def>" +msgstr "" + +#. Tag: programlisting +#: filters.xml:100 +#, fuzzy, no-c-format +msgid "" +"<filter-def name=\"myFilter\">\n" +" <filter-param name=\"myFilterParam\" type=\"string\"/>\n" +"</filter-def>" +msgstr "" +"\n" +" \n" +"]]>" #. Tag: para -#, no-c-format -msgid "Or, to a collection:" -msgstr "Ou bien, à une collection :" - -#. Tag: para -#, no-c-format -msgid "Or, to both or multiples of each at the same time." +#: filters.xml:103 +#, fuzzy, no-c-format +msgid "" +"This filter can then be attached to a class or collection (or, to both or " +"multiples of each at the same time):" msgstr "Ou même encore, aux deux (ou à plusieurs de chaque) en même temps." +#. Tag: title +#: filters.xml:107 +#, no-c-format +msgid "" +"Attaching a filter to a class or collection using <filter>" +msgstr "" + +#. Tag: programlisting +#: filters.xml:110 +#, no-c-format +msgid "" +"<class name=\"myClass\" ...>\n" +" ...\n" +" <filter name=\"myFilter\" condition=\":myFilterParam = " +"MY_FILTERED_COLUMN\"/>\n" +"\n" +" <set ...>\n" +" <filter name=\"myFilter\" condition=\":myFilterParam = " +"MY_FILTERED_COLUMN\"/>\n" +" </set> \n" +"</class>" +msgstr "" + #. Tag: para +#: filters.xml:113 #, no-c-format msgid "" "The methods on Session are: enableFilter(String " @@ -110,7 +236,18 @@ msgstr "" "instance de l'interface Filter. Utiliser le simple filtre " "défini ci-dessus ressemblerait à : " +#. Tag: programlisting +#: filters.xml:123 +#, fuzzy, no-c-format +msgid "" +"session.enableFilter(\"myFilter\").setParameter(\"myFilterParam\", \"some-" +"value\");" +msgstr "" +"" + #. Tag: para +#: filters.xml:125 #, no-c-format msgid "" "Methods on the org.hibernate.Filter interface do allow the method-chaining " @@ -120,6 +257,7 @@ msgstr "" "chaînage de beaucoup de méthodes communes à Hibernate. " #. Tag: para +#: filters.xml:128 #, no-c-format msgid "" "The following is a full example, using temporal data with an effective " @@ -128,7 +266,79 @@ msgstr "" "Un exemple complet, utilisant des données temporelles avec une structure de " "date d'enregistrement effectif : " +#. Tag: programlisting +#: filters.xml:131 +#, fuzzy, no-c-format +msgid "" +"<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 "" +"\n" +" \n" +"\n" +"\n" +"\n" +"...\n" +" \n" +" \n" +" \n" +"...\n" +" \n" +" \n" +"\n" +"\n" +"\n" +"...\n" +" \n" +" \n" +" \n" +" \n" +" \n" +"]]>" + #. Tag: para +#: filters.xml:133 #, no-c-format msgid "" "In order to ensure that you are provided with currently effective records, " @@ -138,7 +348,29 @@ msgstr "" "enregistrements actuellement effectifs, activez simplement le filtre sur la " "session avant de récupérer des données des employés : " +#. Tag: programlisting +#: filters.xml:137 +#, fuzzy, no-c-format +msgid "" +"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();" +msgstr "" +" :" +"targetSalary\")\n" +" .setLong(\"targetSalary\", new Long(1000000))\n" +" .list();\n" +"]]>" + #. Tag: para +#: filters.xml:139 #, no-c-format msgid "" "Even though a salary constraint was mentioned explicitly on the results in " @@ -152,6 +384,7 @@ msgstr "" "salaire supérieur à un million de dollars. " #. Tag: para +#: filters.xml:144 #, no-c-format msgid "" "If you want to use filters with outer joining, either through HQL or load " @@ -166,6 +399,7 @@ msgstr "" "d'abord, suivi du(des) nom(s) de colonne après l'opérateur. " #. Tag: para +#: filters.xml:149 #, no-c-format msgid "" "After being defined, a filter might be attached to multiple entities and/or " @@ -180,7 +414,20 @@ msgstr "" "<filter-def/> permet de définir une condition par " "défaut, soit en tant qu'attribut, soit comme CDATA. " +#. Tag: programlisting +#: filters.xml:155 +#, fuzzy, no-c-format +msgid "" +"<filter-def name=\"myFilter\" condition=\"abc > xyz\">...</" +"filter-def>\n" +"<filter-def name=\"myOtherFilter\">abc=xyz</filter-def>" +msgstr "" +" xyz\">...\n" +"abc=xyz]]>" + #. Tag: para +#: filters.xml:157 #, no-c-format msgid "" "This default condition will be used whenever the filter is attached to " @@ -194,14 +441,11 @@ msgstr "" "faisant partie de la pièce attachée du filtre qui surcharge la condition par " "défaut dans ce cas particulier. " -#~ msgid "" -#~ "\n" -#~ " \n" -#~ "]]>" -#~ msgstr "" -#~ "\n" -#~ " \n" -#~ "]]>" +#~ msgid "This filter can then be attached to a class:" +#~ msgstr "Puis, ce filtre peut être attaché à une classe : " + +#~ msgid "Or, to a collection:" +#~ msgstr "Ou bien, à une collection :" #~ msgid "" #~ "\n" @@ -226,107 +470,3 @@ msgstr "" #~ " \n" #~ "]]>" - -#~ msgid "" -#~ "" -#~ msgstr "" -#~ "" - -#~ msgid "" -#~ "\n" -#~ " \n" -#~ "\n" -#~ "\n" -#~ "\n" -#~ "...\n" -#~ " \n" -#~ " \n" -#~ " \n" -#~ "...\n" -#~ " \n" -#~ " \n" -#~ "\n" -#~ "\n" -#~ "\n" -#~ "...\n" -#~ " \n" -#~ " \n" -#~ " \n" -#~ " \n" -#~ " \n" -#~ "]]>" -#~ msgstr "" -#~ "\n" -#~ " \n" -#~ "\n" -#~ "\n" -#~ "\n" -#~ "...\n" -#~ " \n" -#~ " \n" -#~ " \n" -#~ "...\n" -#~ " \n" -#~ " \n" -#~ "\n" -#~ "\n" -#~ "\n" -#~ "...\n" -#~ " \n" -#~ " \n" -#~ " \n" -#~ " \n" -#~ " \n" -#~ "]]>" - -#~ msgid "" -#~ " :" -#~ "targetSalary\")\n" -#~ " .setLong(\"targetSalary\", new Long(1000000))\n" -#~ " .list();\n" -#~ "]]>" -#~ msgstr "" -#~ " :" -#~ "targetSalary\")\n" -#~ " .setLong(\"targetSalary\", new Long(1000000))\n" -#~ " .list();\n" -#~ "]]>" - -#~ msgid "" -#~ " xyz\">...\n" -#~ "abc=xyz]]>" -#~ msgstr "" -#~ " xyz\">...\n" -#~ "abc=xyz]]>" diff --git a/documentation/manual/src/main/docbook/fr-FR/content/performance.po b/documentation/manual/src/main/docbook/fr-FR/content/performance.po index 9f0e83beaf..0e2b787a6d 100644 --- a/documentation/manual/src/main/docbook/fr-FR/content/performance.po +++ b/documentation/manual/src/main/docbook/fr-FR/content/performance.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: performance\n" "Report-Msgid-Bugs-To: http://bugs.kde.org\n" -"POT-Creation-Date: 2010-02-11T05:38:15\n" +"POT-Creation-Date: 2010-07-20 21:02+0000\n" "PO-Revision-Date: 2010-01-05 09:38+1000\n" "Last-Translator: Corina Roe \n" "Language-Team: French \n" @@ -17,16 +17,19 @@ msgstr "" "X-Generator: KBabel 1.11.4\n" #. Tag: title +#: performance.xml:31 #, no-c-format msgid "Improving performance" msgstr "Améliorer les performances" #. Tag: title +#: performance.xml:34 #, no-c-format msgid "Fetching strategies" msgstr "Stratégies de chargement" #. Tag: para +#: performance.xml:36 #, no-c-format msgid "" "Hibernate uses a fetching strategy to retrieve " @@ -42,11 +45,13 @@ msgstr "" "Criteria particulière." #. Tag: para +#: performance.xml:42 #, no-c-format msgid "Hibernate3 defines the following fetching strategies:" msgstr "Hibernate3 définit les stratégies de chargement suivantes :" #. Tag: para +#: performance.xml:46 #, no-c-format msgid "" "Join fetching: Hibernate retrieves the associated " @@ -58,6 +63,7 @@ msgstr "" "utilisant un OUTER JOIN. " #. Tag: para +#: performance.xml:53 #, no-c-format msgid "" "Select fetching: a second SELECT is " @@ -72,6 +78,7 @@ msgstr "" "sera exécuté que lorsque vous accéderez réellement à l'association." #. Tag: para +#: performance.xml:61 #, no-c-format msgid "" "Subselect fetching: a second SELECT " @@ -88,6 +95,7 @@ msgstr "" "accéderez réellement à l'association. " #. Tag: para +#: performance.xml:70 #, no-c-format msgid "" "Batch fetching: an optimization strategy for select " @@ -101,11 +109,13 @@ msgstr "" "spécifiant une liste de clés primaires ou de clés étrangères. " #. Tag: para +#: performance.xml:77 #, no-c-format msgid "Hibernate also distinguishes between:" msgstr "Hibernate fait également la distinction entre :" #. Tag: para +#: performance.xml:81 #, no-c-format msgid "" "Immediate fetching: an association, collection or " @@ -116,6 +126,7 @@ msgstr "" "cet élément est chargé. " #. Tag: para +#: performance.xml:87 #, no-c-format msgid "" "Lazy collection fetching: a collection is fetched when " @@ -127,6 +138,7 @@ msgstr "" "(il s'agit du mode de chargement par défaut pour les collections). " #. Tag: para +#: performance.xml:93 #, no-c-format msgid "" "\"Extra-lazy\" collection fetching: individual elements " @@ -141,6 +153,7 @@ msgstr "" "collections). " #. Tag: para +#: performance.xml:101 #, no-c-format msgid "" "Proxy fetching: a single-valued association is fetched " @@ -152,6 +165,7 @@ msgstr "" "est appelée sur l'objet associé." #. Tag: para +#: performance.xml:107 #, no-c-format msgid "" "\"No-proxy\" fetching: a single-valued association is " @@ -170,6 +184,7 @@ msgstr "" "compilation et est rarement nécessaire. " #. Tag: para +#: performance.xml:117 #, no-c-format msgid "" "Lazy attribute fetching: an attribute or single valued " @@ -182,6 +197,7 @@ msgstr "" "est rarement nécessaire. " #. Tag: para +#: performance.xml:124 #, no-c-format msgid "" "We have two orthogonal notions here: when is the " @@ -200,11 +216,13 @@ msgstr "" "classe particulière. " #. Tag: title +#: performance.xml:132 #, no-c-format msgid "Working with lazy associations" msgstr "Travailler avec des associations chargées en différé" #. Tag: para +#: performance.xml:134 #, no-c-format msgid "" "By default, Hibernate3 uses lazy select fetching for collections and lazy " @@ -217,6 +235,7 @@ msgstr "" "associations dans la plupart des applications. " #. Tag: para +#: performance.xml:138 #, no-c-format msgid "" "If you set hibernate.default_batch_fetch_size, Hibernate " @@ -229,6 +248,7 @@ msgstr "" "de granularité plus fin). " #. Tag: para +#: performance.xml:142 #, no-c-format msgid "" "Please be aware that access to a lazy association outside of the context of " @@ -237,7 +257,25 @@ msgstr "" "L'accès à une association définie comme \"différé\", hors du contexte d'une " "session Hibernate ouverte, entraîne une exception. Par exemple : " +#. Tag: programlisting +#: performance.xml:146 +#, no-c-format +msgid "" +"s = sessions.openSession();\n" +"Transaction tx = s.beginTransaction();\n" +" \n" +"User u = (User) s.createQuery(\"from User u where u.name=:userName\")\n" +" .setString(\"userName\", userName).uniqueResult();\n" +"Map permissions = u.getPermissions();\n" +"\n" +"tx.commit();\n" +"s.close();\n" +"\n" +"Integer accessLevel = (Integer) permissions.get(\"accounts\"); // Error!" +msgstr "" + #. Tag: para +#: performance.xml:148 #, no-c-format msgid "" "Since the permissions collection was not initialized when the " @@ -254,6 +292,7 @@ msgstr "" "transaction. " #. Tag: para +#: performance.xml:155 #, no-c-format msgid "" "Alternatively, you can use a non-lazy collection or association, by " @@ -272,6 +311,7 @@ msgstr "" "chaque transaction." #. Tag: para +#: performance.xml:162 #, no-c-format msgid "" "On the other hand, you can use join fetching, which is non-lazy by nature, " @@ -288,11 +328,13 @@ msgstr "" "objet simple ou vers une collection. " #. Tag: title +#: performance.xml:170 #, no-c-format msgid "Tuning fetch strategies" msgstr "Personnalisation des stratégies de chargement" #. Tag: para +#: performance.xml:172 #, no-c-format msgid "" "Select fetching (the default) is extremely vulnerable to N+1 selects " @@ -302,7 +344,25 @@ msgstr "" "du N+1 selects, ainsi vous souhaiterez peut-être activer le chargement par " "jointure dans les fichiers de mappage :" +#. Tag: programlisting +#: performance.xml:176 +#, no-c-format +msgid "" +"<set name=\"permissions\"\n" +" fetch=\"join\">\n" +" <key column=\"userId\"/>\n" +" <one-to-many class=\"Permission\"/>\n" +"</set" +msgstr "" + +#. Tag: programlisting +#: performance.xml:178 +#, no-c-format +msgid "<many-to-one name=\"mother\" class=\"Cat\" fetch=\"join\"/>" +msgstr "" + #. Tag: para +#: performance.xml:180 #, no-c-format msgid "" "The fetch strategy defined in the mapping document " @@ -312,23 +372,27 @@ msgstr "" "dans les fichiers de mappage affecte :" #. Tag: para +#: performance.xml:185 #, no-c-format msgid "retrieval via get() or load()" msgstr "" "La récupération via get() ou load()" #. Tag: para +#: performance.xml:190 #, no-c-format msgid "retrieval that happens implicitly when an association is navigated" msgstr "" "La récupération implicite lorsque l'on navigue à travers une association" #. Tag: para +#: performance.xml:195 #, no-c-format msgid "Criteria queries" msgstr "Les requêtes par Criteria" #. Tag: para +#: performance.xml:199 #, no-c-format msgid "HQL queries if subselect fetching is used" msgstr "" @@ -336,6 +400,7 @@ msgstr "" "literal>" #. Tag: para +#: performance.xml:204 #, no-c-format msgid "" "Irrespective of the fetching strategy you use, the defined non-lazy graph is " @@ -347,6 +412,7 @@ msgstr "" "l'exécution de plusieurs selects successifs pour une seule requête HQL. " #. Tag: para +#: performance.xml:209 #, no-c-format msgid "" "Usually, the mapping document is not used to customize fetching. Instead, we " @@ -365,6 +431,7 @@ msgstr "" "utiliserez la méthode setFetchMode(FetchMode.JOIN)." #. Tag: para +#: performance.xml:216 #, no-c-format msgid "" "If you want to change the fetching strategy used by get() " @@ -376,7 +443,18 @@ msgstr "" "pouvez juste utiliser une requête de type Criteria comme " "par exemple : " +#. Tag: programlisting +#: performance.xml:220 +#, no-c-format +msgid "" +"User user = (User) session.createCriteria(User.class)\n" +" .setFetchMode(\"permissions\", FetchMode.JOIN)\n" +" .add( Restrictions.idEq(userId) )\n" +" .uniqueResult();" +msgstr "" + #. Tag: para +#: performance.xml:222 #, no-c-format msgid "" "This is Hibernate's equivalent of what some ORM solutions call a \"fetch plan" @@ -386,6 +464,7 @@ msgstr "" "mappage appellent un \"fetch plan\" ou \"plan de chargement\"." #. Tag: para +#: performance.xml:225 #, no-c-format msgid "" "A completely different approach to problems with N+1 selects is to use the " @@ -395,11 +474,13 @@ msgstr "" "selects est d'utiliser le cache de second niveau. " #. Tag: title +#: performance.xml:230 #, no-c-format msgid "Single-ended association proxies" msgstr "Proxies pour des associations vers un seul objet " #. Tag: para +#: performance.xml:232 #, no-c-format msgid "" "Lazy fetching for collections is implemented using Hibernate's own " @@ -418,6 +499,7 @@ msgstr "" "du bytecode (à l'aide de l'excellente librairie CGLIB)." #. Tag: para +#: performance.xml:239 #, no-c-format msgid "" "At startup, Hibernate3 generates proxies by default for all persistent " @@ -429,6 +511,7 @@ msgstr "" "associations many-to-one et one-to-one." #. Tag: para +#: performance.xml:244 #, no-c-format msgid "" "The mapping file may declare an interface to use as the proxy interface for " @@ -446,6 +529,7 @@ msgstr "" "persistantes !." #. Tag: para +#: performance.xml:251 #, no-c-format msgid "" "There are potential problems to note when extending this approach to " @@ -454,7 +538,20 @@ msgstr "" "Il y a quelques précautions à prendre lorsque l'on étend cette approche à " "des classes polymorphiques, par exemple : " +#. Tag: programlisting +#: performance.xml:254 +#, no-c-format +msgid "" +"<class name=\"Cat\" proxy=\"Cat\">\n" +" ......\n" +" <subclass name=\"DomesticCat\">\n" +" .....\n" +" </subclass>\n" +"</class>" +msgstr "" + #. Tag: para +#: performance.xml:256 #, no-c-format msgid "" "Firstly, instances of Cat will never be castable to " @@ -465,14 +562,41 @@ msgstr "" "être \"castées\" en DomesticCat, même si l'instance sous-" "jacente est une instance de DomesticCat :" +#. Tag: programlisting +#: performance.xml:260 +#, no-c-format +msgid "" +"Cat cat = (Cat) session.load(Cat.class, id); // instantiate a proxy (does " +"not hit the db)\n" +"if ( cat.isDomesticCat() ) { // hit the db to initialize " +"the proxy\n" +" DomesticCat dc = (DomesticCat) cat; // Error!\n" +" ....\n" +"}" +msgstr "" + #. Tag: para +#: performance.xml:262 #, no-c-format msgid "Secondly, it is possible to break proxy ==:" msgstr "" "Deuxièmement, il est possible de casser la notion de == " "des proxies. " +#. Tag: programlisting +#: performance.xml:265 +#, no-c-format +msgid "" +"Cat cat = (Cat) session.load(Cat.class, id); // instantiate a Cat " +"proxy\n" +"DomesticCat dc = \n" +" (DomesticCat) session.load(DomesticCat.class, id); // acquire new " +"DomesticCat proxy!\n" +"System.out.println(cat==dc); // false" +msgstr "" + #. Tag: para +#: performance.xml:267 #, no-c-format msgid "" "However, the situation is not quite as bad as it looks. Even though we now " @@ -483,7 +607,16 @@ msgstr "" "deux références à deux objets proxies différents, l'instance sous-jacente " "sera quand même le même objet :" +#. Tag: programlisting +#: performance.xml:271 +#, no-c-format +msgid "" +"cat.setWeight(11.0); // hit the db to initialize the proxy\n" +"System.out.println( dc.getWeight() ); // 11.0" +msgstr "" + #. Tag: para +#: performance.xml:273 #, no-c-format msgid "" "Third, you cannot use a CGLIB proxy for a final class or " @@ -494,6 +627,7 @@ msgstr "" "final. " #. Tag: para +#: performance.xml:276 #, no-c-format msgid "" "Finally, if your persistent object acquires any resources upon instantiation " @@ -507,6 +641,7 @@ msgstr "" "classe proxy est en réalité une sous-classe de la classe persistante. " #. Tag: para +#: performance.xml:281 #, no-c-format msgid "" "These problems are all due to fundamental limitations in Java's single " @@ -525,7 +660,20 @@ msgstr "" "Cat et DomesticCatImpl implémente " "l'interface DomesticCat. Par exemple :" +#. Tag: programlisting +#: performance.xml:289 +#, no-c-format +msgid "" +"<class name=\"CatImpl\" proxy=\"Cat\">\n" +" ......\n" +" <subclass name=\"DomesticCatImpl\" proxy=\"DomesticCat\">\n" +" .....\n" +" </subclass>\n" +"</class>" +msgstr "" + #. Tag: para +#: performance.xml:291 #, no-c-format msgid "" "Then proxies for instances of Cat and " @@ -536,17 +684,30 @@ msgstr "" "DomesticCat peuvent être retournées par load() ou par iterate()." +#. Tag: programlisting +#: performance.xml:295 +#, no-c-format +msgid "" +"Cat cat = (Cat) session.load(CatImpl.class, catid);\n" +"Iterator iter = session.createQuery(\"from CatImpl as cat where cat." +"name='fritz'\").iterate();\n" +"Cat fritz = (Cat) iter.next();" +msgstr "" + #. Tag: title +#: performance.xml:298 #, no-c-format msgid "Note" msgstr "Remarque" #. Tag: para +#: performance.xml:300 #, no-c-format msgid "list() does not usually return proxies." msgstr "list() ne retourne pas les proxies normalement." #. Tag: para +#: performance.xml:304 #, no-c-format msgid "" "Relationships are also lazily initialized. This means you must declare any " @@ -558,6 +719,7 @@ msgstr "" "et non CatImpl." #. Tag: para +#: performance.xml:308 #, no-c-format msgid "" "Certain operations do not require proxy initialization:" @@ -566,6 +728,7 @@ msgstr "" "l'initialisation du proxy :" #. Tag: para +#: performance.xml:313 #, no-c-format msgid "" "equals(): if the persistent class does not override " @@ -575,6 +738,7 @@ msgstr "" "equals() " #. Tag: para +#: performance.xml:318 #, no-c-format msgid "" "hashCode(): if the persistent class does not override " @@ -584,11 +748,13 @@ msgstr "" "hashCode() " #. Tag: para +#: performance.xml:323 #, no-c-format msgid "The identifier getter method" msgstr "La méthode getter de l'identifiant " #. Tag: para +#: performance.xml:327 #, no-c-format msgid "" "Hibernate will detect persistent classes that override equals()hashCode()." #. Tag: para +#: performance.xml:330 #, no-c-format msgid "" "By choosing lazy=\"no-proxy\" instead of the default " @@ -612,11 +779,13 @@ msgstr "" "en une initialisation du proxy. " #. Tag: title +#: performance.xml:338 #, no-c-format msgid "Initializing collections and proxies" msgstr "Initialisation des collections et des proxies" #. Tag: para +#: performance.xml:340 #, no-c-format msgid "" "A LazyInitializationException will be thrown by Hibernate " @@ -631,6 +800,7 @@ msgstr "" "vers le proxy, est dans l'état \"détaché\". " #. Tag: para +#: performance.xml:346 #, no-c-format msgid "" "Sometimes a proxy or collection needs to be initialized before closing the " @@ -647,6 +817,7 @@ msgstr "" "code et n'est pas approprié pour le code générique. " #. Tag: para +#: performance.xml:353 #, no-c-format msgid "" "The static methods Hibernate.initialize() and " @@ -666,6 +837,7 @@ msgstr "" "literal> a le même effet sur la collection kittens. " #. Tag: para +#: performance.xml:362 #, no-c-format msgid "" "Another option is to keep the Session open until all " @@ -686,6 +858,7 @@ msgstr "" "initialisée. Il y a deux moyens de maîtriser ce problème : " #. Tag: para +#: performance.xml:372 #, no-c-format msgid "" "In a web-based application, a servlet filter can be used to close the " @@ -709,6 +882,7 @@ msgstr "" "Hibernate pour des exemples sur le modèle \"Open Session in View\". " #. Tag: para +#: performance.xml:385 #, no-c-format msgid "" "In an application with a separate business tier, the business logic must " @@ -739,6 +913,7 @@ msgstr "" "Session Facade. " #. Tag: para +#: performance.xml:401 #, no-c-format msgid "" "You can also attach a previously loaded object to a new SessioncreateFilter() method is also used to efficiently " @@ -785,12 +971,22 @@ msgstr "" "récupérer efficacement des sous-ensembles d'une collection sans avoir besoin " "de l'initialiser dans son ensemble :" +#. Tag: programlisting +#: performance.xml:423 +#, no-c-format +msgid "" +"s.createFilter( lazyCollection, \"\").setFirstResult(0).setMaxResults(10)." +"list();" +msgstr "" + #. Tag: title +#: performance.xml:427 #, no-c-format msgid "Using batch fetching" msgstr "Utiliser le chargement par lot" #. Tag: para +#: performance.xml:429 #, no-c-format msgid "" "Using batch fetching, Hibernate can load several uninitialized proxies if " @@ -807,6 +1003,7 @@ msgstr "" "collection." #. Tag: para +#: performance.xml:434 #, no-c-format msgid "" "Batch fetching for classes/entities is easier to understand. Consider the " @@ -833,7 +1030,14 @@ msgstr "" "size (taille du lot) dans le mappage de Person : " +#. Tag: programlisting +#: performance.xml:447 +#, no-c-format +msgid "<class name=\"Person\" batch-size=\"10\">...</class>" +msgstr "" + #. Tag: para +#: performance.xml:449 #, no-c-format msgid "" "Hibernate will now execute only three queries: the pattern is 10, 10, 5." @@ -842,6 +1046,7 @@ msgstr "" "10, 10, et 5 entités. " #. Tag: para +#: performance.xml:452 #, no-c-format msgid "" "You can also enable batch fetching of collections. For example, if each " @@ -861,7 +1066,19 @@ msgstr "" "collection cats dans le mappage de Person, Hibernate pourra précharger les collections :" +#. Tag: programlisting +#: performance.xml:461 +#, no-c-format +msgid "" +"<class name=\"Person\">\n" +" <set name=\"cats\" batch-size=\"3\">\n" +" ...\n" +" </set>\n" +"</class>" +msgstr "" + #. Tag: para +#: performance.xml:463 #, no-c-format msgid "" "With a batch-size of 3, Hibernate will load 3, 3, 3, 1 " @@ -876,6 +1093,7 @@ msgstr "" "literal> particulière. " #. Tag: para +#: performance.xml:468 #, no-c-format msgid "" "Batch fetching of collections is particularly useful if you have a nested " @@ -890,11 +1108,13 @@ msgstr "" "option pour des arbres principalement en lecture.) " #. Tag: title +#: performance.xml:475 #, no-c-format msgid "Using subselect fetching" msgstr "Utilisation du chargement par sous select" #. Tag: para +#: performance.xml:477 #, no-c-format msgid "" "If one lazy collection or single-valued proxy has to be fetched, Hibernate " @@ -907,11 +1127,13 @@ msgstr "" "sans la possibilité de fragmenter le chargement." #. Tag: title +#: performance.xml:486 #, fuzzy, no-c-format msgid "Fetch profiles" msgstr "Stratégies de chargement" #. Tag: para +#: performance.xml:488 #, no-c-format msgid "" "Another way to affect the fetching strategy for loading associated objects " @@ -919,19 +1141,112 @@ msgid "" "associated with the org.hibernate.SessionFactory but enabled, by name, on the org.hibernate." "Session. Once enabled on a org.hibernate." -"Session, the fetch profile wull be in affect for that " +"Session, the fetch profile will be in affect for that " "org.hibernate.Session until it is explicitly " "disabled." msgstr "" #. Tag: para +#: performance.xml:498 #, no-c-format msgid "" -"So what does that mean? Well lets explain that by way of an example. Say we " -"have the following mappings:" +"So what does that mean? Well lets explain that by way of an example which " +"show the different available approaches to configure a fetch profile:" +msgstr "" + +#. Tag: title +#: performance.xml:503 +#, no-c-format +msgid "Specifying a fetch profile using @FetchProfile" +msgstr "" + +#. Tag: programlisting +#: performance.xml:506 +#, no-c-format +msgid "" +"@Entity\n" +"@FetchProfile(name = \"customer-with-orders\", fetchOverrides = {\n" +" @FetchProfile.FetchOverride(entity = Customer.class, association = " +"\"orders\", mode = FetchMode.JOIN)\n" +"})\n" +"public class Customer {\n" +" @Id\n" +" @GeneratedValue\n" +" private long id;\n" +"\n" +" private String name;\n" +"\n" +" private long customerNumber;\n" +"\n" +" @OneToMany\n" +" private Set<Order> orders;\n" +"\n" +" // standard getter/setter\n" +" ...\n" +"}" +msgstr "" + +#. Tag: title +#: performance.xml:510 +#, no-c-format +msgid "" +"Specifying a fetch profile using <fetch-profile> " +"outside <class> node" +msgstr "" + +#. Tag: programlisting +#: performance.xml:514 +#, no-c-format +msgid "" +"<hibernate-mapping>\n" +" <class name=\"Customer\">\n" +" ...\n" +" <set name=\"orders\" inverse=\"true\">\n" +" <key column=\"cust_id\"/>\n" +" <one-to-many class=\"Order\"/>\n" +" </set>\n" +" </class>\n" +" <class name=\"Order\">\n" +" ...\n" +" </class>\n" +" <fetch-profile name=\"customer-with-orders\">\n" +" <fetch entity=\"Customer\" association=\"orders\" style=\"join\"/" +">\n" +" </fetch-profile>\n" +"</hibernate-mapping>" +msgstr "" + +#. Tag: title +#: performance.xml:518 +#, no-c-format +msgid "" +"Specifying a fetch profile using <fetch-profile> " +"inside <class> node" +msgstr "" + +#. Tag: programlisting +#: performance.xml:522 +#, no-c-format +msgid "" +"<hibernate-mapping>\n" +" <class name=\"Customer\">\n" +" ...\n" +" <set name=\"orders\" inverse=\"true\">\n" +" <key column=\"cust_id\"/>\n" +" <one-to-many class=\"Order\"/>\n" +" </set>\n" +" <fetch-profile name=\"customer-with-orders\">\n" +" <fetch association=\"orders\" style=\"join\"/>\n" +" </fetch-profile>\n" +" </class>\n" +" <class name=\"Order\">\n" +" ...\n" +" </class>\n" +"</hibernate-mapping>" msgstr "" #. Tag: para +#: performance.xml:525 #, no-c-format msgid "" "Now normally when you get a reference to a particular customer, that " @@ -940,23 +1255,39 @@ msgid "" "that you have a certain use case where it is more efficient to load the " "customer and their orders together. One way certainly is to use \"dynamic " "fetching\" strategies via an HQL or criteria queries. But another option is " -"to use a fetch profile to achieve that. Just add the following to your " -"mapping:" +"to use a fetch profile to achieve that. The following code will load both " +"the customer andtheir orders:" msgstr "" -#. Tag: para +#. Tag: title +#: performance.xml:536 #, no-c-format -msgid "or even:" +msgid "Activating a fetch profile for a given Session" msgstr "" -#. Tag: para +#. Tag: programlisting +#: performance.xml:539 #, no-c-format msgid "" -"Now the following code will actually load both the customer and " -"their orders:" +"Session session = ...;\n" +"session.enableFetchProfile( \"customer-with-orders\" ); // name matches " +"from mapping\n" +"Customer customer = (Customer) session.get( Customer.class, customerId );" msgstr "" #. Tag: para +#: performance.xml:543 +#, no-c-format +msgid "" +"@FetchProfile definitions are global and it does not " +"matter on which class you place them. You can place the " +"@FetchProfile annotation either onto a class or " +"package (package-info.java). In order to define multiple fetch profiles for " +"the same class or package @FetchProfiles can be used." +msgstr "" + +#. Tag: para +#: performance.xml:551 #, no-c-format msgid "" "Currently only join style fetch profiles are supported, but they plan is to " @@ -965,11 +1296,13 @@ msgid "" msgstr "" #. Tag: title +#: performance.xml:558 #, no-c-format msgid "Using lazy property fetching" msgstr "Utiliser le chargement en différé des propriétés" #. Tag: para +#: performance.xml:560 #, no-c-format msgid "" "Hibernate3 supports the lazy fetching of individual properties. This " @@ -991,6 +1324,7 @@ msgstr "" "modèle de données ne peut pas être amélioré." #. Tag: para +#: performance.xml:568 #, no-c-format msgid "" "To enable lazy property loading, set the lazy attribute " @@ -1000,7 +1334,24 @@ msgstr "" "l'attribut lazy sur une propriété particulière du " "mappage :" +#. Tag: programlisting +#: performance.xml:571 +#, no-c-format +msgid "" +"<class name=\"Document\">\n" +" <id name=\"id\">\n" +" <generator class=\"native\"/>\n" +" </id>\n" +" <property name=\"name\" not-null=\"true\" length=\"50\"/>\n" +" <property name=\"summary\" not-null=\"true\" length=\"200\" lazy=" +"\"true\"/>\n" +" <property name=\"text\" not-null=\"true\" length=\"2000\" lazy=\"true" +"\"/>\n" +"</class>" +msgstr "" + #. Tag: para +#: performance.xml:573 #, no-c-format msgid "" "Lazy property loading requires buildtime bytecode instrumentation. If your " @@ -1013,13 +1364,36 @@ msgstr "" "et retombera dans le mode de chargement immédiat. " #. Tag: para +#: performance.xml:577 #, no-c-format msgid "For bytecode instrumentation, use the following Ant task:" msgstr "" "Pour l'instrumentation du bytecode vous pouvez utiliser la tâche Ant " "suivante :" +#. Tag: programlisting +#: performance.xml:579 +#, no-c-format +msgid "" +"<target name=\"instrument\" depends=\"compile\">\n" +" <taskdef name=\"instrument\" classname=\"org.hibernate.tool." +"instrument.InstrumentTask\">\n" +" <classpath path=\"${jar.path}\"/>\n" +" <classpath path=\"${classes.dir}\"/>\n" +" <classpath refid=\"lib.class.path\"/>\n" +" </taskdef>\n" +"\n" +" <instrument verbose=\"true\">\n" +" <fileset dir=\"${testclasses.dir}/org/hibernate/auction/model" +"\">\n" +" <include name=\"*.class\"/>\n" +" </fileset>\n" +" </instrument>\n" +"</target>" +msgstr "" + #. Tag: para +#: performance.xml:581 #, no-c-format msgid "" "A different way of avoiding unnecessary column reads, at least for read-only " @@ -1034,6 +1408,7 @@ msgstr "" "solution préférable. " #. Tag: para +#: performance.xml:586 #, no-c-format msgid "" "You can force the usual eager fetching of properties using fetch " @@ -1043,11 +1418,13 @@ msgstr "" "utilisant fetch all properties dans les requêtes HQL. " #. Tag: title +#: performance.xml:592 #, no-c-format msgid "The Second Level Cache" msgstr "Le cache de second niveau" #. Tag: para +#: performance.xml:594 #, no-c-format msgid "" "A Hibernate Session is a transaction-level cache of " @@ -1068,15 +1445,17 @@ msgstr "" "configurés pour régulièrement expirer les données en cache). " #. Tag: para -#, no-c-format +#: performance.xml:602 +#, fuzzy, no-c-format msgid "" "You have the option to tell Hibernate which caching implementation to use by " "specifying the name of a class that implements org.hibernate.cache." "CacheProvider using the property hibernate.cache." "provider_class. Hibernate is bundled with a number of built-in " -"integrations with the open-source cache providers that are listed below. You " -"can also implement your own and plug it in as outlined above. Note that " -"versions prior to 3.2 use EhCache as the default cache provider." +"integrations with the open-source cache providers that are listed in . You can also implement your own and plug it in " +"as outlined above. Note that versions prior to Hibernate 3.2 use EhCache as " +"the default cache provider." msgstr "" "Vous pouvez choisir une autre implémentation en spécifiant le nom de la " "classe qui implémente org.hibernate.cache.CacheProvider " @@ -1088,155 +1467,396 @@ msgstr "" "EhCache comme le fournisseur de cache par défaut, ce qui n'est plus le cas. " #. Tag: title +#: performance.xml:613 #, no-c-format msgid "Cache Providers" msgstr "Fournisseurs de cache" #. Tag: entry +#: performance.xml:628 performance.xml:976 #, no-c-format msgid "Cache" msgstr "Cache" #. Tag: entry +#: performance.xml:630 #, no-c-format msgid "Provider class" msgstr "Classe pourvoyeuse" #. Tag: entry +#: performance.xml:632 #, no-c-format msgid "Type" msgstr "Type" #. Tag: entry +#: performance.xml:634 #, no-c-format msgid "Cluster Safe" msgstr "Cluster sécurisé" #. Tag: entry +#: performance.xml:636 #, no-c-format msgid "Query Cache Supported" msgstr "Cache de requêtes supporté" #. Tag: entry +#: performance.xml:642 performance.xml:990 #, no-c-format msgid "Hashtable (not intended for production use)" msgstr "Table de hachage (ne pas utiliser en production)" -#. Tag: entry +#. Tag: literal +#: performance.xml:644 #, fuzzy, no-c-format -msgid "org.hibernate.cache.HashtableCacheProvider" +msgid "org.hibernate.cache.HashtableCacheProvider" msgstr "org.hibernate.cache.HashtableCacheProvider" #. Tag: entry +#: performance.xml:646 #, no-c-format msgid "memory" msgstr "mémoire" #. Tag: entry +#: performance.xml:650 performance.xml:662 performance.xml:674 +#: performance.xml:992 performance.xml:994 performance.xml:996 +#: performance.xml:1004 performance.xml:1006 performance.xml:1008 +#: performance.xml:1016 performance.xml:1018 performance.xml:1020 +#: performance.xml:1028 performance.xml:1030 performance.xml:1040 +#: performance.xml:1046 performance.xml:1052 performance.xml:1058 #, no-c-format -msgid "yes" -msgstr "oui" +msgid "yes" +msgstr "" #. Tag: entry +#: performance.xml:654 performance.xml:1002 #, no-c-format msgid "EHCache" msgstr "EHCache" -#. Tag: entry +#. Tag: literal +#: performance.xml:656 #, fuzzy, no-c-format -msgid "org.hibernate.cache.EhCacheProvider" +msgid "org.hibernate.cache.EhCacheProvider" msgstr "org.hibernate.cache.EhCacheProvider" #. Tag: entry +#: performance.xml:658 performance.xml:670 #, no-c-format msgid "memory, disk" msgstr "mémoire, disque" #. Tag: entry +#: performance.xml:666 performance.xml:1014 #, no-c-format msgid "OSCache" msgstr "OSCache" -#. Tag: entry +#. Tag: literal +#: performance.xml:668 #, fuzzy, no-c-format -msgid "org.hibernate.cache.OSCacheProvider" +msgid "org.hibernate.cache.OSCacheProvider" msgstr "org.hibernate.cache.OSCacheProvider" #. Tag: entry +#: performance.xml:678 performance.xml:1026 #, no-c-format msgid "SwarmCache" msgstr "SwarmCache" -#. Tag: entry +#. Tag: literal +#: performance.xml:680 #, fuzzy, no-c-format -msgid "org.hibernate.cache.SwarmCacheProvider" +msgid "org.hibernate.cache.SwarmCacheProvider" msgstr "org.hibernate.cache.SwarmCacheProvider" #. Tag: entry +#: performance.xml:682 #, no-c-format msgid "clustered (ip multicast)" msgstr "en cluster (multicast ip)" #. Tag: entry +#: performance.xml:684 #, no-c-format msgid "yes (clustered invalidation)" msgstr "oui (invalidation de cluster)" #. Tag: entry +#: performance.xml:690 performance.xml:1038 #, no-c-format msgid "JBoss Cache 1.x" msgstr "JBoss Cache 1.x" -#. Tag: entry +#. Tag: literal +#: performance.xml:692 #, fuzzy, no-c-format -msgid "org.hibernate.cache.TreeCacheProvider" +msgid "org.hibernate.cache.TreeCacheProvider" msgstr " org.hibernate.cache.TreeCacheProvider" #. Tag: entry +#: performance.xml:694 performance.xml:706 #, no-c-format msgid "clustered (ip multicast), transactional" msgstr "en cluster (multicast ip), transactionnel" #. Tag: entry +#: performance.xml:696 #, no-c-format msgid "yes (replication)" msgstr "oui (réplication)" #. Tag: entry +#: performance.xml:698 performance.xml:710 #, no-c-format msgid "yes (clock sync req.)" msgstr "oui (horloge sync. nécessaire)" #. Tag: entry +#: performance.xml:702 performance.xml:1050 #, no-c-format msgid "JBoss Cache 2" msgstr "JBoss Cache 2" -#. Tag: entry +#. Tag: literal +#: performance.xml:704 #, fuzzy, no-c-format -msgid "org.hibernate.cache.jbc.JBossCacheRegionFactory" +msgid "org.hibernate.cache.jbc.JBossCacheRegionFactory" msgstr "org.hibernate.cache.jbc2.JBossCacheRegionFactory" #. Tag: entry +#: performance.xml:708 #, no-c-format msgid "yes (replication or invalidation)" msgstr "oui (replication ou invalidation)" #. Tag: title +#: performance.xml:717 #, no-c-format msgid "Cache mappings" msgstr "Mappages de Cache" #. Tag: para +#: performance.xml:719 #, no-c-format msgid "" -"The <cache> element of a class or collection " -"mapping has the following form:" +"As we have done in previous chapters we are looking at the two different " +"possibiltites to configure caching. First configuration via annotations and " +"then via Hibernate mapping files." msgstr "" -"L'élément <cache> d'une classe ou d'une collection " -"a la forme suivante :" #. Tag: para +#: performance.xml:723 +#, no-c-format +msgid "" +"By default, entities are not part of the second level cache and we recommend " +"you to stick to this setting. However, you can override this by setting the " +"shared-cache-mode element in your persistence." +"xml file or by using the javax.persistence.sharedCache." +"mode property in your configuration. The following values are " +"possible:" +msgstr "" + +#. Tag: para +#: performance.xml:732 +#, no-c-format +msgid "" +"ENABLE_SELECTIVE (Default and recommended value): " +"entities are not cached unless explicitly marked as cacheable." +msgstr "" + +#. Tag: para +#: performance.xml:738 +#, no-c-format +msgid "" +"DISABLE_SELECTIVE: entities are cached unless explicitly " +"marked as not cacheable." +msgstr "" + +#. Tag: para +#: performance.xml:743 +#, no-c-format +msgid "" +"ALL: all entities are always cached even if marked as non " +"cacheable." +msgstr "" + +#. Tag: para +#: performance.xml:748 +#, no-c-format +msgid "" +"NONE: no entity are cached even if marked as cacheable. " +"This option can make sense to disable second-level cache altogether." +msgstr "" + +#. Tag: para +#: performance.xml:754 +#, no-c-format +msgid "" +"The cache concurrency strategy used by default can be set globaly via the " +"hibernate.cache.default_cache_concurrency_strategy " +"configuration property. The values for this property are:" +msgstr "" + +#. Tag: literal +#: performance.xml:761 +#, fuzzy, no-c-format +msgid "read-only" +msgstr "Les requêtes par Criteria" + +#. Tag: literal +#: performance.xml:765 +#, fuzzy, no-c-format +msgid "read-write" +msgstr "Les requêtes par Criteria" + +#. Tag: literal +#: performance.xml:769 +#, fuzzy, no-c-format +msgid "nonstrict-read-write" +msgstr "nonstrict-read-write (lecture-écriture non stricte)" + +#. Tag: literal +#: performance.xml:773 +#, fuzzy, no-c-format +msgid "transactional" +msgstr "Les requêtes par Criteria" + +#. Tag: para +#: performance.xml:778 +#, no-c-format +msgid "" +"It is recommended to define the cache concurrency strategy per entity rather " +"than using a global one. Use the @org.hibernate.annotations." +"Cache annotation for that." +msgstr "" + +#. Tag: title +#: performance.xml:785 +#, no-c-format +msgid "" +"Definition of cache concurrency strategy via @Cache" +msgstr "" + +#. Tag: programlisting +#: performance.xml:788 +#, no-c-format +msgid "" +"@Entity \n" +"@Cacheable\n" +"@Cache(usage = CacheConcurrencyStrategy.NONSTRICT_READ_WRITE)\n" +"public class Forest { ... }" +msgstr "" + +#. Tag: para +#: performance.xml:791 +#, no-c-format +msgid "" +"Hibernate also let's you cache the content of a collection or the " +"identifiers if the collection contains other entities. Use the " +"@Cache annotation on the collection property." +msgstr "" + +#. Tag: title +#: performance.xml:797 +#, fuzzy, no-c-format +msgid "Caching collections using annotations" +msgstr "Initialisation des collections et des proxies" + +#. Tag: programlisting +#: performance.xml:799 +#, no-c-format +msgid "" +"@OneToMany(cascade=CascadeType.ALL, fetch=FetchType.EAGER)\n" +"@JoinColumn(name=\"CUST_ID\")\n" +"@Cache(usage = CacheConcurrencyStrategy.NONSTRICT_READ_WRITE)\n" +"public SortedSet<Ticket> getTickets() {\n" +" return tickets;\n" +"}" +msgstr "" + +#. Tag: para +#: performance.xml:802 +#, no-c-format +msgid "" +"shows the @org.hibernate.annotations.Cache annotations " +"with its attributes. It allows you to define the caching strategy and region " +"of a given second level cache." +msgstr "" + +#. Tag: title +#: performance.xml:808 +#, no-c-format +msgid "@Cache annotation with attributes" +msgstr "" + +#. Tag: programlisting +#: performance.xml:820 +#, no-c-format +msgid "" +"@Cache(\n" +" CacheConcurrencyStrategy usage();\n" +" String region() default \"\";\n" +" String include() default \"all\";\n" +")" +msgstr "" + +#. Tag: para +#: performance.xml:824 +#, no-c-format +msgid "" +"usage: the given cache concurrency strategy (NONE, READ_ONLY, " +"NONSTRICT_READ_WRITE, READ_WRITE, TRANSACTIONAL)" +msgstr "" + +#. Tag: para +#: performance.xml:830 +#, no-c-format +msgid "" +"region (optional): the cache region (default to the fqcn of the class or the " +"fq role name of the collection)" +msgstr "" + +#. Tag: para +#: performance.xml:835 +#, no-c-format +msgid "" +"include (optional): all to include all properties, non-" +"lazy to only include non lazy properties (default all)." +msgstr "" + +#. Tag: para +#: performance.xml:843 +#, no-c-format +msgid "" +"Let's now take a look at Hibernate mapping files. There the <" +"cache> element of a class or collection mapping is used to " +"configure the second level cache. Looking at the parallels to anotations is obvious." +msgstr "" + +#. Tag: title +#: performance.xml:850 +#, no-c-format +msgid "The Hibernate <cache> mapping element" +msgstr "" + +#. Tag: programlisting +#: performance.xml:862 +#, no-c-format +msgid "" +"<cache\n" +" usage=\"transactional|read-write|nonstrict-read-write|read-only\"\n" +" region=\"RegionName\"\n" +" include=\"all|non-lazy\"\n" +"/>" +msgstr "" + +#. Tag: para +#: performance.xml:866 #, no-c-format msgid "" "usage (required) specifies the caching strategy: " @@ -1249,6 +1869,7 @@ msgstr "" "literal>" #. Tag: para +#: performance.xml:874 #, no-c-format msgid "" "region (optional: defaults to the class or collection " @@ -1259,6 +1880,7 @@ msgstr "" "cache de second niveau" #. Tag: para +#: performance.xml:880 #, no-c-format msgid "" "include (optional: defaults to all) " @@ -1272,31 +1894,31 @@ msgstr "" "cache lorsque le chargement en différé des attributs est activé." #. Tag: para -#, no-c-format +#: performance.xml:890 +#, fuzzy, no-c-format msgid "" -"Alternatively, you can specify <class-cache> and " -"<collection-cache> elements in hibernate." -"cfg.xml." +"Alternatively to <cache>, you can use <" +"class-cache> and <collection-cache> " +"elements in hibernate.cfg.xml." msgstr "" "Alternativement (voir préférentiellement), vous pouvez spécifier les " "éléments <class-cache> et <collection-" "cache> dans hibernate.cfg.xml. " #. Tag: para +#: performance.xml:895 #, no-c-format -msgid "" -"The usage attribute specifies a cache " -"concurrency strategy." +msgid "Let's now have a closer look at the different usage strategies" msgstr "" -"L'attribut usage spécifie une stratégie de " -"concurrence d'accès au cache." #. Tag: title +#: performance.xml:900 #, no-c-format msgid "Strategy: read only" msgstr "Stratégie : lecture seule" #. Tag: para +#: performance.xml:902 #, no-c-format msgid "" "If your application needs to read, but not modify, instances of a persistent " @@ -1310,11 +1932,13 @@ msgstr "" "parfaitement sûre dans un cluster. " #. Tag: title +#: performance.xml:909 #, no-c-format msgid "Strategy: read/write" msgstr "Stratégie : lecture/écriture" #. Tag: para +#: performance.xml:911 #, no-c-format msgid "" "If the application needs to update data, a read-write " @@ -1344,11 +1968,13 @@ msgstr "" "fournis. " #. Tag: title +#: performance.xml:927 #, no-c-format msgid "Strategy: nonstrict read/write" msgstr "Stratégie : lecture/écriture non stricte" #. Tag: para +#: performance.xml:929 #, no-c-format msgid "" "If the application only occasionally needs to update data (i.e. if it is " @@ -1371,11 +1997,13 @@ msgstr "" "close() ou Session.disconnect()." #. Tag: title +#: performance.xml:941 #, no-c-format msgid "Strategy: transactional" msgstr "Stratégie : transactionelle" #. Tag: para +#: performance.xml:943 #, no-c-format msgid "" "The transactional cache strategy provides support for " @@ -1389,11 +2017,13 @@ msgstr "" "spécifier hibernate.transaction.manager_lookup_class. " #. Tag: title +#: performance.xml:950 #, no-c-format msgid "Cache-provider/concurrency-strategy compatibility" msgstr "Support de stratégie de concurrence du fournisseur-cache" #. Tag: para +#: performance.xml:953 #, no-c-format msgid "" "None of the cache providers support all of the cache concurrency strategies." @@ -1403,6 +2033,7 @@ msgstr "" "de concurrence. " #. Tag: para +#: performance.xml:957 #, no-c-format msgid "" "The following table shows which providers are compatible with which " @@ -1413,36 +2044,43 @@ msgstr "" "de concurrence. " #. Tag: title +#: performance.xml:961 #, no-c-format msgid "Cache Concurrency Strategy Support" msgstr "Support de stratégie de concurrence du cache" #. Tag: entry +#: performance.xml:978 #, no-c-format -msgid "read-only" -msgstr "read-only (lecture seule)" +msgid "read-only" +msgstr "" #. Tag: entry -#, no-c-format -msgid "nonstrict-read-write" +#: performance.xml:980 +#, fuzzy, no-c-format +msgid "nonstrict-read-write" msgstr "nonstrict-read-write (lecture-écriture non stricte)" #. Tag: entry +#: performance.xml:982 #, no-c-format -msgid "read-write" -msgstr "read-write (lecture-écriture)" +msgid "read-write" +msgstr "" #. Tag: entry -#, no-c-format -msgid "transactional" +#: performance.xml:984 +#, fuzzy, no-c-format +msgid "transactional" msgstr "transactional (transactionnel)" #. Tag: title +#: performance.xml:1067 #, no-c-format msgid "Managing the caches" msgstr "Gérer les caches" #. Tag: para +#: performance.xml:1069 #, no-c-format msgid "" "Whenever you pass an object to save(), update()Session. " #. Tag: para +#: performance.xml:1076 #, no-c-format msgid "" "When flush() is subsequently called, the state of that " @@ -1477,7 +2116,29 @@ msgstr "" "l'objet et ses collections dépendantes du cache de premier niveau de la " "session. " +#. Tag: title +#: performance.xml:1084 +#, no-c-format +msgid "" +"Explcitly evicting a cached instance from the first level cache using " +"Session.evict()" +msgstr "" + +#. Tag: programlisting +#: performance.xml:1087 +#, no-c-format +msgid "" +"ScrollableResult cats = sess.createQuery(\"from Cat as cat\").scroll(); //a " +"huge result set\n" +"while ( cats.next() ) {\n" +" Cat cat = (Cat) cats.get(0);\n" +" doSomethingWithACat(cat);\n" +" sess.evict(cat);\n" +"}" +msgstr "" + #. Tag: para +#: performance.xml:1090 #, no-c-format msgid "" "The Session also provides a contains() " @@ -1488,6 +2149,7 @@ msgstr "" "session. " #. Tag: para +#: performance.xml:1094 #, no-c-format msgid "" "To evict all objects from the session cache, call Session.clear() " #. Tag: para +#: performance.xml:1097 #, no-c-format msgid "" "For the second-level cache, there are methods defined on " @@ -1508,7 +2171,28 @@ msgstr "" "la classe entière, d'une instance de collection ou du rôle entier d'une " "collection." +#. Tag: title +#: performance.xml:1103 +#, no-c-format +msgid "" +"Second-level cache eviction via SessionFactoty.evict() and SessionFacyory.evictCollection()" +msgstr "" + +#. Tag: programlisting +#: performance.xml:1107 +#, no-c-format +msgid "" +"sessionFactory.evict(Cat.class, catId); //evict a particular Cat\n" +"sessionFactory.evict(Cat.class); //evict all Cats\n" +"sessionFactory.evictCollection(\"Cat.kittens\", catId); //evict a particular " +"collection of kittens\n" +"sessionFactory.evictCollection(\"Cat.kittens\"); //evict all kitten " +"collections" +msgstr "" + #. Tag: para +#: performance.xml:1110 #, no-c-format msgid "" "The CacheMode controls how a particular session interacts " @@ -1518,6 +2202,7 @@ msgstr "" "particulière interagit avec le cache de second niveau :" #. Tag: para +#: performance.xml:1115 #, no-c-format msgid "" "CacheMode.NORMAL: will read items from and write items to " @@ -1527,6 +2212,7 @@ msgstr "" "cache de second niveau " #. Tag: para +#: performance.xml:1120 #, no-c-format msgid "" "CacheMode.GET: will read items from the second-level " @@ -1536,6 +2222,7 @@ msgstr "" "niveau mais ne les écrit pas sauf dans le cas d'une mise à jour des données " #. Tag: para +#: performance.xml:1126 #, no-c-format msgid "" "CacheMode.PUT: will write items to the second-level " @@ -1545,6 +2232,7 @@ msgstr "" "second niveau mais ne les lit pas dans le cache de second niveau " #. Tag: para +#: performance.xml:1131 #, no-c-format msgid "" "CacheMode.REFRESH: will write items to the second-level " @@ -1559,6 +2247,7 @@ msgstr "" "base de données. " #. Tag: para +#: performance.xml:1139 #, no-c-format msgid "" "To browse the contents of a second-level or query cache region, use the " @@ -1568,7 +2257,28 @@ msgstr "" "dédiée aux requêtes, vous pouvez utiliser l'API Statistics :" +#. Tag: title +#: performance.xml:1143 +#, fuzzy, no-c-format +msgid "" +"Browsing the second-level cache entries via the Statistics API" +msgstr "" +"Pour parcourir le contenu du cache de second niveau ou la région du cache " +"dédiée aux requêtes, vous pouvez utiliser l'API Statistics :" + +#. Tag: programlisting +#: performance.xml:1146 +#, no-c-format +msgid "" +"Map cacheEntries = sessionFactory.getStatistics()\n" +" .getSecondLevelCacheStatistics(regionName)\n" +" .getEntries();" +msgstr "" + #. Tag: para +#: performance.xml:1149 #, no-c-format msgid "" "You will need to enable statistics and, optionally, force Hibernate to keep " @@ -1579,11 +2289,27 @@ msgstr "" "compréhensible pour l'utilisateur : " #. Tag: title +#: performance.xml:1153 +#, no-c-format +msgid "Enabling Hibernate statistics" +msgstr "" + +#. Tag: programlisting +#: performance.xml:1155 +#, no-c-format +msgid "" +"hibernate.generate_statistics true\n" +"hibernate.cache.use_structured_entries true" +msgstr "" + +#. Tag: title +#: performance.xml:1160 #, no-c-format msgid "The Query Cache" msgstr "Le cache de requêtes" #. Tag: para +#: performance.xml:1162 #, fuzzy, no-c-format msgid "" "Query result sets can also be cached. This is only useful for queries that " @@ -1594,11 +2320,13 @@ msgstr "" "Pour utiliser le cache de requêtes, vous devez d'abord l'activer : " #. Tag: title +#: performance.xml:1166 #, no-c-format msgid "Enabling query caching" msgstr "" #. Tag: para +#: performance.xml:1168 #, no-c-format msgid "" "Caching of query results introduces some overhead in terms of your " @@ -1611,12 +2339,20 @@ msgid "" "need to enable the query cache:" msgstr "" +#. Tag: programlisting +#: performance.xml:1177 +#, no-c-format +msgid "hibernate.cache.use_query_cache true" +msgstr "" + #. Tag: para +#: performance.xml:1179 #, no-c-format msgid "This setting creates two new cache regions:" msgstr "" #. Tag: para +#: performance.xml:1181 #, no-c-format msgid "" "org.hibernate.cache.StandardQueryCache, holding the " @@ -1624,6 +2360,7 @@ msgid "" msgstr "" #. Tag: para +#: performance.xml:1186 #, no-c-format msgid "" "org.hibernate.cache.UpdateTimestampsCache, holding " @@ -1632,10 +2369,11 @@ msgid "" msgstr "" #. Tag: para +#: performance.xml:1194 #, no-c-format msgid "" "If you configure your underlying cache implementation to use expiry or " -"timeouts is is very important that the cache timeout of the underlying cache " +"timeouts is very important that the cache timeout of the underlying cache " "region for the UpdateTimestampsCache be set to a higher value than the " "timeouts of any of the query caches. In fact, we recommend that the the " "UpdateTimestampsCache region not be configured for expiry at all. Note, in " @@ -1643,6 +2381,7 @@ msgid "" msgstr "" #. Tag: para +#: performance.xml:1203 #, fuzzy, no-c-format msgid "" "As mentioned above, most queries do not benefit from caching or their " @@ -1659,6 +2398,7 @@ msgstr "" "requête est exécutée. " #. Tag: para +#: performance.xml:1211 #, no-c-format msgid "" "The query cache does not cache the state of the actual entities in the " @@ -1669,11 +2409,13 @@ msgid "" msgstr "" #. Tag: title +#: performance.xml:1221 #, fuzzy, no-c-format msgid "Query cache regions" msgstr "Cache de requêtes supporté" #. Tag: para +#: performance.xml:1223 #, no-c-format msgid "" "If you require fine-grained control over query cache expiration policies, " @@ -1684,7 +2426,21 @@ msgstr "" "vous pouvez spécifier une région de cache nommée pour une requête " "particulière en appelant Query.setCacheRegion(). " +#. Tag: programlisting +#: performance.xml:1227 +#, no-c-format +msgid "" +"List blogs = sess.createQuery(\"from Blog blog where blog.blogger = :blogger" +"\")\n" +" .setEntity(\"blogger\", blogger)\n" +" .setMaxResults(15)\n" +" .setCacheable(true)\n" +" .setCacheRegion(\"frontpages\")\n" +" .list();" +msgstr "" + #. Tag: para +#: performance.xml:1229 #, fuzzy, no-c-format msgid "" "If you want to force the query cache to refresh one of its regions " @@ -1707,11 +2463,13 @@ msgstr "" "méthode SessionFactory.evictQueries()." #. Tag: title +#: performance.xml:1242 #, no-c-format msgid "Understanding Collection performance" msgstr "Comprendre les performances des collections" #. Tag: para +#: performance.xml:1244 #, no-c-format msgid "" "In the previous sections we have covered collections and their applications. " @@ -1723,31 +2481,37 @@ msgstr "" "en rapport aux collections en cours d'exécution." #. Tag: title +#: performance.xml:1249 #, no-c-format msgid "Taxonomy" msgstr "Taxinomie" #. Tag: para +#: performance.xml:1251 #, no-c-format msgid "Hibernate defines three basic kinds of collections:" msgstr "Hibernate définit trois types de collections de base :" #. Tag: para +#: performance.xml:1255 #, no-c-format msgid "collections of values" msgstr "les collections de valeurs" #. Tag: para +#: performance.xml:1259 #, no-c-format msgid "one-to-many associations" msgstr "Association un-à-plusieurs " #. Tag: para +#: performance.xml:1263 #, no-c-format msgid "many-to-many associations" msgstr "les associations plusieurs-à-plusieurs " #. Tag: para +#: performance.xml:1267 #, no-c-format msgid "" "This classification distinguishes the various table and foreign key " @@ -1765,21 +2529,25 @@ msgstr "" "les lignes des collections. Cela nous amène aux classifications suivantes :" #. Tag: para +#: performance.xml:1276 #, no-c-format msgid "indexed collections" msgstr "collections indexées" #. Tag: para +#: performance.xml:1280 #, no-c-format msgid "sets" msgstr "ensembles (sets)" #. Tag: para +#: performance.xml:1284 #, no-c-format msgid "bags" msgstr "sacs (bags)" #. Tag: para +#: performance.xml:1288 #, no-c-format msgid "" "All indexed collections (maps, lists, and arrays) have a primary key " @@ -1797,6 +2565,7 @@ msgstr "" "supprimer. " #. Tag: para +#: performance.xml:1295 #, no-c-format msgid "" "Sets have a primary key consisting of <key> and " @@ -1823,6 +2592,7 @@ msgstr "" "literal>). " #. Tag: para +#: performance.xml:1306 #, no-c-format msgid "" "<idbag> mappings define a surrogate key, so they " @@ -1833,6 +2603,7 @@ msgstr "" "jour. En fait il s'agit du meilleur cas de mise à jour d'une collection." #. Tag: para +#: performance.xml:1309 #, no-c-format msgid "" "Bags are the worst case since they permit duplicate element values and, as " @@ -1849,6 +2620,7 @@ msgstr "" "collection chaque fois qu'elle change. Ce qui peut être très inefficace. " #. Tag: para +#: performance.xml:1316 #, no-c-format msgid "" "For a one-to-many association, the \"primary key\" may not be the physical " @@ -1862,6 +2634,7 @@ msgstr "" "localise les lignes individuelles de la collection). " #. Tag: title +#: performance.xml:1323 #, no-c-format msgid "" "Lists, maps, idbags and sets are the most efficient collections to update" @@ -1870,6 +2643,7 @@ msgstr "" "plus efficaces pour la mise à jour " #. Tag: para +#: performance.xml:1326 #, no-c-format msgid "" "From the discussion above, it should be clear that indexed collections and " @@ -1882,6 +2656,7 @@ msgstr "" "d'éléments. " #. Tag: para +#: performance.xml:1330 #, no-c-format msgid "" "There is, arguably, one more advantage that indexed collections have over " @@ -1901,6 +2676,7 @@ msgstr "" "Une fois de plus, ce cas ne s'applique pas aux associations un-à-plusieurs. " #. Tag: para +#: performance.xml:1338 #, no-c-format msgid "" "After observing that arrays cannot be lazy, you can conclude that lists, " @@ -1917,6 +2693,7 @@ msgstr "" "sémantique des ensembles est la plus naturelle dans le modèle relationnel. " #. Tag: para +#: performance.xml:1344 #, no-c-format msgid "" "However, in well-designed Hibernate domain models, most collections are in " @@ -1933,12 +2710,14 @@ msgstr "" "tout simplement pas dans ces cas-là. " #. Tag: title +#: performance.xml:1352 #, no-c-format msgid "Bags and lists are the most efficient inverse collections" msgstr "" "Les sacs et les listes sont les plus efficaces pour les collections inverses" #. Tag: para +#: performance.xml:1354 #, no-c-format msgid "" "There is a particular case, however, in which bags, and also lists, are much " @@ -1961,12 +2740,25 @@ msgstr "" "literal> (contrairement au Set). Cela peut rendre le code " "suivant beaucoup plus rapide :" +#. Tag: programlisting +#: performance.xml:1365 +#, no-c-format +msgid "" +"Parent p = (Parent) sess.load(Parent.class, id);\n" +"Child c = new Child();\n" +"c.setParent(p);\n" +"p.getChildren().add(c); //no need to fetch the collection!\n" +"sess.flush();" +msgstr "" + #. Tag: title +#: performance.xml:1369 #, no-c-format msgid "One shot delete" msgstr "Suppression en un coup" #. Tag: para +#: performance.xml:1371 #, no-c-format msgid "" "Deleting collection elements one by one can sometimes be extremely " @@ -1982,6 +2774,7 @@ msgstr "" "fait ! " #. Tag: para +#: performance.xml:1377 #, no-c-format msgid "" "Suppose you added a single element to a collection of size twenty and then " @@ -1995,6 +2788,7 @@ msgstr "" "la collection ne soit un sac). Cela est préférable. " #. Tag: para +#: performance.xml:1383 #, no-c-format msgid "" "However, suppose that we remove eighteen elements, leaving two and then add " @@ -2005,11 +2799,13 @@ msgstr "" "moyens de procéder." #. Tag: para +#: performance.xml:1389 #, no-c-format msgid "delete eighteen rows one by one and then insert three rows" msgstr "effacer dix-huit lignes une à une puis en insérer trois" #. Tag: para +#: performance.xml:1394 #, no-c-format msgid "" "remove the whole collection in one SQL DELETE and insert " @@ -2019,6 +2815,7 @@ msgstr "" "puis insérer les cinq éléments restant (un à un) " #. Tag: para +#: performance.xml:1400 #, no-c-format msgid "" "Hibernate cannot know that the second option is probably quicker. It would " @@ -2031,6 +2828,7 @@ msgstr "" "de bases de données plutôt aléatoire, etc...). " #. Tag: para +#: performance.xml:1404 #, no-c-format msgid "" "Fortunately, you can force this behavior (i.e. the second strategy) at any " @@ -2043,6 +2841,7 @@ msgstr "" "avec tous les éléments restants. " #. Tag: para +#: performance.xml:1409 #, no-c-format msgid "" "One-shot-delete does not apply to collections mapped inverse=\"true" @@ -2052,11 +2851,13 @@ msgstr "" "qui sont mappées avec inverse=\"true\". " #. Tag: title +#: performance.xml:1415 #, no-c-format msgid "Monitoring performance" msgstr "Moniteur de performance" #. Tag: para +#: performance.xml:1417 #, no-c-format msgid "" "Optimization is not much use without monitoring and access to performance " @@ -2070,11 +2871,13 @@ msgstr "" "SessionFactory." #. Tag: title +#: performance.xml:1423 #, no-c-format msgid "Monitoring a SessionFactory" msgstr "Suivi d'une SessionFactory" #. Tag: para +#: performance.xml:1425 #, no-c-format msgid "" "You can access SessionFactory metrics in two ways. Your " @@ -2087,6 +2890,7 @@ msgstr "" "literal> vous-même." #. Tag: para +#: performance.xml:1430 #, no-c-format msgid "" "Hibernate can also use JMX to publish metrics if you enable the " @@ -2099,7 +2903,38 @@ msgstr "" "un seul MBean pour toutes vos SessionFactory ou un par " "fabrique. Voici un code qui montre un exemple de configuration minimaliste : " +#. Tag: programlisting +#: performance.xml:1435 +#, no-c-format +msgid "" +"// MBean service registration for a specific SessionFactory\n" +"Hashtable tb = new Hashtable();\n" +"tb.put(\"type\", \"statistics\");\n" +"tb.put(\"sessionFactory\", \"myFinancialApp\");\n" +"ObjectName on = new ObjectName(\"hibernate\", tb); // MBean object name\n" +"\n" +"StatisticsService stats = new StatisticsService(); // MBean implementation\n" +"stats.setSessionFactory(sessionFactory); // Bind the stats to a " +"SessionFactory\n" +"server.registerMBean(stats, on); // Register the Mbean on the server" +msgstr "" + +#. Tag: programlisting +#: performance.xml:1437 +#, no-c-format +msgid "" +"// MBean service registration for all SessionFactory's\n" +"Hashtable tb = new Hashtable();\n" +"tb.put(\"type\", \"statistics\");\n" +"tb.put(\"sessionFactory\", \"all\");\n" +"ObjectName on = new ObjectName(\"hibernate\", tb); // MBean object name\n" +"\n" +"StatisticsService stats = new StatisticsService(); // MBean implementation\n" +"server.registerMBean(stats, on); // Register the MBean on the server" +msgstr "" + #. Tag: para +#: performance.xml:1439 #, no-c-format msgid "" "You can activate and deactivate the monitoring for a " @@ -2109,6 +2944,7 @@ msgstr "" "literal> :" #. Tag: para +#: performance.xml:1444 #, no-c-format msgid "" "at configuration time, set hibernate.generate_statistics " @@ -2118,6 +2954,7 @@ msgstr "" "generate_statistics à false" #. Tag: para +#: performance.xml:1452 #, no-c-format msgid "" "at runtime: sf.getStatistics().setStatisticsEnabled(true) " @@ -2127,6 +2964,7 @@ msgstr "" "literal> ou hibernateStatsBean.setStatisticsEnabled(true)" #. Tag: para +#: performance.xml:1458 #, no-c-format msgid "" "Statistics can be reset programmatically using the clear()." #. Tag: title +#: performance.xml:1464 #, no-c-format msgid "Metrics" msgstr "Métriques" #. Tag: para +#: performance.xml:1466 #, no-c-format msgid "" "Hibernate provides a number of metrics, from basic information to more " @@ -2157,6 +2997,7 @@ msgstr "" "de l'interface Statistics dans trois catégories : " #. Tag: para +#: performance.xml:1473 #, no-c-format msgid "" "Metrics related to the general Session usage, such as " @@ -2167,6 +3008,7 @@ msgstr "" "récupérées, etc..." #. Tag: para +#: performance.xml:1479 #, no-c-format msgid "" "Metrics related to the entities, collections, queries, and caches as a whole " @@ -2176,6 +3018,7 @@ msgstr "" "leur ensemble (métriques globales aka)." #. Tag: para +#: performance.xml:1484 #, no-c-format msgid "" "Detailed metrics related to a particular entity, collection, query or cache " @@ -2185,6 +3028,7 @@ msgstr "" "ou une région de cache particulière." #. Tag: para +#: performance.xml:1489 #, no-c-format msgid "" "For example, you can check the cache hit, miss, and put ratio of entities, " @@ -2201,6 +3045,7 @@ msgstr "" "n'offre qu'une précision de l'ordre de 10 secondes. " #. Tag: para +#: performance.xml:1495 #, no-c-format msgid "" "Simple getters are used to access the global metrics (i.e. not tied to a " @@ -2224,7 +3069,30 @@ msgstr "" "literal> pour plus d'informations. Le code ci-dessous montre un exemple " "simple : " +#. Tag: programlisting +#: performance.xml:1506 +#, no-c-format +msgid "" +"Statistics stats = HibernateUtil.sessionFactory.getStatistics();\n" +"\n" +"double queryCacheHitCount = stats.getQueryCacheHitCount();\n" +"double queryCacheMissCount = stats.getQueryCacheMissCount();\n" +"double queryCacheHitRatio =\n" +" queryCacheHitCount / (queryCacheHitCount + queryCacheMissCount);\n" +"\n" +"log.info(\"Query Hit ratio:\" + queryCacheHitRatio);\n" +"\n" +"EntityStatistics entityStats =\n" +" stats.getEntityStatistics( Cat.class.getName() );\n" +"long changes =\n" +" entityStats.getInsertCount()\n" +" + entityStats.getUpdateCount()\n" +" + entityStats.getDeleteCount();\n" +"log.info(Cat.class.getName() + \" changed \" + changes + \"times\" );" +msgstr "" + #. Tag: para +#: performance.xml:1508 #, no-c-format msgid "" "You can work on all entities, collections, queries and region caches, by " @@ -2240,6 +3108,29 @@ msgstr "" "getCollectionRoleNames(), et " "getSecondLevelCacheRegionNames(). " +#~ msgid "yes" +#~ msgstr "oui" + +#~ msgid "" +#~ "The <cache> element of a class or collection " +#~ "mapping has the following form:" +#~ msgstr "" +#~ "L'élément <cache> d'une classe ou d'une " +#~ "collection a la forme suivante :" + +#~ msgid "" +#~ "The usage attribute specifies a cache " +#~ "concurrency strategy." +#~ msgstr "" +#~ "L'attribut usage spécifie une stratégie de " +#~ "concurrence d'accès au cache." + +#~ msgid "read-only" +#~ msgstr "read-only (lecture seule)" + +#~ msgid "read-write" +#~ msgstr "read-write (lecture-écriture)" + #~ msgid "" #~ "This setting creates two new cache regions: one holding cached query " #~ "result sets (org.hibernate.cache.StandardQueryCache), " diff --git a/documentation/manual/src/main/docbook/fr-FR/content/persistent_classes.po b/documentation/manual/src/main/docbook/fr-FR/content/persistent_classes.po index 65a9ac8412..afc549abf3 100644 --- a/documentation/manual/src/main/docbook/fr-FR/content/persistent_classes.po +++ b/documentation/manual/src/main/docbook/fr-FR/content/persistent_classes.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: persistent_classes\n" "Report-Msgid-Bugs-To: http://bugs.kde.org\n" -"POT-Creation-Date: 2010-02-11T05:38:15\n" +"POT-Creation-Date: 2010-07-20 21:02+0000\n" "PO-Revision-Date: 2010-01-05 09:39+1000\n" "Last-Translator: Corina Roe \n" "Language-Team: French \n" @@ -17,18 +17,20 @@ msgstr "" "X-Generator: KBabel 1.11.4\n" #. Tag: title +#: persistent_classes.xml:32 #, no-c-format msgid "Persistent Classes" msgstr "Classes persistantes" #. Tag: para -#, no-c-format +#: persistent_classes.xml:34 +#, fuzzy, 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. For example, an instance can instead be transient " -"or detached." +"application). The term \"persistent\" here means that the classes are able " +"to be persisted, not that they are in the persistent state (see for discussion)." msgstr "" "Les classes persistantes sont les classes d'une application qui implémentent " "les entités d'un problème métier (par ex. Client et Commande dans une " @@ -37,13 +39,15 @@ msgstr "" "instance peut être éphémère (transient) ou détachée." #. Tag: para -#, no-c-format +#: persistent_classes.xml:41 +#, fuzzy, 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 " +"these rules are hard requirements. Indeed, Hibernate assumes very little " "about the nature of your persistent objects. You can express a domain model " -"in other ways (using trees of Map instances, for example)." +"in other ways (using trees of java.util.Map " +"instances, for example)." msgstr "" "Hibernate fonctionne de manière optimale lorsque ces classes suivent " "quelques règles simples, aussi connues comme le modèle de programmation " @@ -54,20 +58,103 @@ msgstr "" "Map, par exemple." #. Tag: title +#: persistent_classes.xml:49 #, no-c-format msgid "A simple POJO example" msgstr "Un exemple simple de POJO" -#. Tag: para +#. Tag: title +#: persistent_classes.xml:52 +#, no-c-format +msgid "Simple POJO representing a cat" +msgstr "" + +#. Tag: programlisting +#: persistent_classes.xml:53 #, no-c-format msgid "" -"Most Java applications require a persistent class representing felines. For " -"example:" +"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 "" -"Toute bonne application Java nécessite une classe persistante représentant " -"les félins. Par exemple :" #. Tag: para +#: persistent_classes.xml:57 #, no-c-format msgid "" "The four main rules of persistent classes are explored in more detail in the " @@ -77,19 +164,21 @@ msgstr "" "les sections qui suivent :" #. Tag: title +#: persistent_classes.xml:62 #, no-c-format msgid "Implement a no-argument constructor" msgstr "Implémenter un constructeur sans argument" #. Tag: para -#, no-c-format +#: persistent_classes.xml:64 +#, fuzzy, no-c-format msgid "" -"Cat has a no-argument constructor. All persistent classes " -"must have a default constructor (which can be non-public) so that Hibernate " -"can instantiate them using Constructor.newInstance(). It " -"is recommended that you have a default constructor with at least " -"package visibility for runtime proxy generation in " -"Hibernate." +"Cat has a no-argument constructor. All persistent " +"classes must have a default constructor (which can be non-public) so that " +"Hibernate can instantiate them using java.lang.reflect." +"Constructor.newInstance(). It is recommended that this " +"constructor be defined with at least package visibility " +"in order for runtime proxy generation to work properly." msgstr "" "Cat a un constructeur sans argument. Toutes les classes " "persistantes doivent avoir un constructeur par défaut (lequel peut ne pas " @@ -100,73 +189,42 @@ msgstr "" "dans Hibernate. " #. Tag: title -#, no-c-format -msgid "Provide an identifier property (optional)" +#: persistent_classes.xml:74 +#, fuzzy, no-c-format +msgid "Provide an identifier property" msgstr "Fournir une propriété d'identifiant (optionnel)" #. Tag: para +#: persistent_classes.xml:77 #, no-c-format msgid "" -"Cat has a property called id. 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, java.lang.String or " -"java.util.Date. If your legacy database table has " -"composite keys, you can use a user-defined class with properties of these " -"types (see the section on composite identifiers later in the chapter.)" +"Historically this was considered option. While still not (yet) enforced, " +"this should be considered a deprecated feature as it will be completely " +"required to provide a identifier property in an upcoming release." msgstr "" -"Cat possède une propriété appelée id. " -"Cette propriété mappe la valeur de la colonne de clé primaire de la table " -"d'une base de données. La propriété aurait pu s'appeler autrement, et son " -"type aurait pu être n'importe quel type primitif, n'importe quel " -"\"encapsuleur\" de type primitif, java.lang.String ou " -"java.util.Date. (Si votre base de données héritée possède " -"des clés composites, elles peuvent être mappées en utilisant une classe " -"définie par l'utilisateur et possédant les propriétés associées aux types de " -"la clé composite - voir la section concernant les identifiants composites " -"ultérieurement). " #. 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." +"Cat has a property named id. This " +"property maps to the primary key column(s) of the underlying database table. " +"The type of the identifier property can be any \"basic\" type (see ). See for information on mapping composite (multi-column) identifiers." msgstr "" -"La propriété d'identifiant est strictement optionnelle. Vous pouvez " -"l'oublier et laisser Hibernate s'occuper des identifiants de l'objet en " -"interne. Toutefois, ce n'est pas recommandé. " #. Tag: para +#: persistent_classes.xml:92 #, no-c-format msgid "" -"In fact, some functionality is available only to classes that declare an " -"identifier property:" +"Identifiers do not necessarily need to identify column(s) in the database " +"physically defined as a primary key. They should just identify columns that " +"can be used to uniquely identify rows in the underlying table." msgstr "" -"En fait, quelques fonctionnalités ne sont disponibles que pour les classes " -"déclarant un identifiant de propriété : " - -#. Tag: para -#, fuzzy, no-c-format -msgid "" -"Transitive reattachment for detached objects (cascade update or cascade " -"merge) - see " -msgstr "" -"Pour les rattachements transitifs pour les objets détachés (mise à jour en " -"cascade ou fusion en cascade) - consultez " - -#. Tag: para -#, fuzzy, no-c-format -msgid "Session.saveOrUpdate()" -msgstr "Session.saveOrUpdate()" - -#. Tag: para -#, fuzzy, no-c-format -msgid "Session.merge()" -msgstr "Session.merge()" #. Tag: para +#: persistent_classes.xml:99 #, no-c-format msgid "" "We recommend that you declare consistently-named identifier properties on " @@ -177,41 +235,100 @@ msgstr "" "(c'est-à-dire non primitif). " #. Tag: title -#, no-c-format -msgid "Prefer non-final classes (optional)" +#: persistent_classes.xml:107 +#, fuzzy, no-c-format +msgid "Prefer non-final classes (semi-optional)" msgstr "Favoriser les classes non finales (optionnel)" #. Tag: para +#: persistent_classes.xml:109 #, no-c-format msgid "" -"A central feature of Hibernate, proxies, depends upon " -"the persistent class being either non-final, or the implementation of an " -"interface that declares all public methods." +"A central feature of Hibernate, proxies (lazy loading), " +"depends upon the persistent class being either non-final, or the " +"implementation of an interface that declares all public methods. You can " +"persist final classes that do not implement an interface " +"with Hibernate; you will not, however, be able to use proxies for lazy " +"association fetching which will ultimately limit your options for " +"performance tuning. To persist a final class which does " +"not implement a \"full\" interface you must disable proxy generation. See " +" and ." +msgstr "" + +#. Tag: title +#: persistent_classes.xml:121 +#, no-c-format +msgid "Disabling proxies in hbm.xml" +msgstr "" + +#. Tag: programlisting +#: persistent_classes.xml:122 +#, no-c-format +msgid "...]]>" +msgstr "" + +#. Tag: title +#: persistent_classes.xml:126 +#, no-c-format +msgid "Disabling proxies in annotations" +msgstr "" + +#. Tag: programlisting +#: persistent_classes.xml:127 +#, no-c-format +msgid "" msgstr "" -"Une fonctionnalité clé de Hibernate, les proxies, " -"nécessitent que la classe persistante soit non finale ou qu'elle soit " -"l'implémentation d'une interface qui déclare toutes les méthodes publiques." #. Tag: para +#: persistent_classes.xml:130 #, no-c-format msgid "" -"You can persist final classes that do not implement an " -"interface with Hibernate. You will not, however, be able to use proxies for " -"lazy association fetching which will ultimately limit your options for " -"performance tuning." +"If the final class does implement a proper interface, you " +"could alternatively tell Hibernate to use the interface instead when " +"generating the proxies. See and ." +msgstr "" + +#. Tag: title +#: persistent_classes.xml:139 +#, no-c-format +msgid "Proxying an interface in hbm.xml" +msgstr "" + +#. Tag: programlisting +#: persistent_classes.xml:140 +#, no-c-format +msgid "...]]>" +msgstr "" + +#. Tag: title +#: persistent_classes.xml:144 +#, no-c-format +msgid "Proxying an interface in annotations" +msgstr "" + +#. Tag: programlisting +#: persistent_classes.xml:145 +#, no-c-format +msgid "" +"" msgstr "" -"Vous pouvez persister, grâce à Hibernate, les classes final qui n'implémentent pas d'interface, mais vous ne pourrez pas " -"utiliser les proxies pour les chargements d'associations paresseux - ce qui " -"limitera vos possibilités d'ajustement des performances. " #. Tag: para -#, no-c-format +#: persistent_classes.xml:148 +#, fuzzy, no-c-format msgid "" -"You should also avoid declaring public final methods on " -"the non-final classes. If you want to use a class with a public " -"final method, you must explicitly disable proxying by setting " -"lazy=\"false\"." +"You should also avoid declaring public final methods as " +"this will again limit the ability to generate proxies " +"from this class. If you want to use a class with public final methods, you must explicitly disable proxying. Again, see and " +"." msgstr "" "Vous devriez aussi éviter de déclarer des méthodes public final sur des classes non-finales. Si vous voulez utiliser une classe " @@ -219,15 +336,17 @@ msgstr "" "désactiver les proxies en paramétrant lazy=\"false\". " #. Tag: title +#: persistent_classes.xml:158 #, no-c-format msgid "Declare accessors and mutators for persistent fields (optional)" msgstr "" "Déclarer les accesseurs et mutateurs des attributs persistants (optionnel)" #. Tag: para -#, no-c-format +#: persistent_classes.xml:160 +#, fuzzy, no-c-format msgid "" -"Cat declares accessor methods for all its persistent " +"Cat declares accessor methods for all its persistent " "fields. Many other ORM tools directly persist instance variables. It is " "better to provide an indirection between the relational schema and internal " "data structures of the class. By default, Hibernate persists JavaBeans style " @@ -246,22 +365,26 @@ msgstr "" "champs pour des propriétés particulières, si besoin est. " #. Tag: para -#, no-c-format +#: persistent_classes.xml:169 +#, fuzzy, no-c-format msgid "" -"Properties need not be declared public - Hibernate can " -"persist a property with a default, protected or " -"private get / set pair." +"Properties need not be declared public. Hibernate can " +"persist a property declared with package, " +"protected or private visibility as " +"well." msgstr "" "Les propriétés n'ont pas à être déclarées publiques - " "Hibernate peut persister une propriété avec une paire de getter/setter par " "défault, protected ou private. " #. Tag: title +#: persistent_classes.xml:178 #, no-c-format msgid "Implementing inheritance" msgstr "Implémenter l'héritage" #. Tag: para +#: persistent_classes.xml:180 #, no-c-format msgid "" "A subclass must also observe the first and second rules. It inherits its " @@ -271,7 +394,26 @@ msgstr "" "hérite sa propriété d'identifiant de la classe mère Cat. " "Par exemple :" +#. Tag: programlisting +#: persistent_classes.xml:184 +#, no-c-format +msgid "" +"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:188 #, no-c-format msgid "" "Implementing equals() and hashCode()" @@ -279,6 +421,7 @@ msgstr "" "Implémenter equals() et hashCode() " #. Tag: para +#: persistent_classes.xml:191 #, no-c-format msgid "" "You have to override the equals() and hashCode()" @@ -288,6 +431,7 @@ msgstr "" "hashCode() si vous :" #. Tag: para +#: persistent_classes.xml:196 #, no-c-format msgid "" "intend to put instances of persistent classes in a Set " @@ -299,11 +443,13 @@ msgstr "" "associations pluri-valuées); et" #. Tag: para +#: persistent_classes.xml:202 #, no-c-format msgid "intend to use reattachment of detached instances" msgstr "avez l'intention d'utiliser le rattachement d'instances détachées" #. Tag: para +#: persistent_classes.xml:206 #, no-c-format msgid "" "Hibernate guarantees equivalence of persistent identity (database row) and " @@ -320,6 +466,7 @@ msgstr "" "correcte pour les Set s. " #. Tag: para +#: persistent_classes.xml:212 #, no-c-format msgid "" "The most obvious way is to implement equals()/" @@ -356,6 +503,7 @@ msgstr "" "l'égalité d'un objet. " #. Tag: para +#: persistent_classes.xml:228 #, no-c-format msgid "" "It is recommended that you implement equals() and " @@ -372,11 +520,41 @@ msgstr "" "une clé métier, une clé qui identifierait notre instance dans le monde réel " "(une clé candidate naturelle) : " +#. Tag: programlisting +#: persistent_classes.xml:235 +#, no-c-format +msgid "" +"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:237 #, fuzzy, no-c-format msgid "" "A business key does not have to be as solid as a database primary key " -"candidate (see ). Immutable " +"candidate (see ). Immutable " "or unique properties are usually good candidates for a business key." msgstr "" "Notez qu'une clé métier ne doit pas être solide comme une clé primaire de " @@ -385,26 +563,30 @@ msgstr "" "pour une clé métier. " #. Tag: title +#: persistent_classes.xml:244 #, no-c-format msgid "Dynamic models" msgstr "Modèles dynamiques" #. Tag: title +#: persistent_classes.xml:247 #, no-c-format msgid "Note" msgstr "Remarque" -#. Tag: para +#. Tag: emphasis +#: persistent_classes.xml:249 #, fuzzy, no-c-format msgid "" -"The following features are currently considered experimental and " -"may change in the near future." +"The following features are currently considered experimental and may change " +"in the near future." msgstr "" "Notez que les fonctionnalités suivantes sont actuellement " "considérées comme expérimentales et pourront changer dans un futur proche." #. Tag: para +#: persistent_classes.xml:253 #, no-c-format msgid "" "Persistent entities do not necessarily have to be represented as POJO " @@ -421,12 +603,13 @@ msgstr "" "de classes persistantes, seulement des fichiers de mappage. " #. Tag: para +#: persistent_classes.xml:259 #, fuzzy, no-c-format msgid "" "By default, Hibernate works in normal POJO mode. You can set a default " "entity representation mode for a particular SessionFactory using the default_entity_mode configuration " -"option (see )." +"option (see )." msgstr "" "Par défaut, Hibernate fonctionne en mode POJO normal. Vous pouvez paramétrer " "un mode de représentation d'entité par défaut pour une " @@ -435,6 +618,7 @@ msgstr "" "\"configuration-optional-properties\" />)." #. Tag: para +#: persistent_classes.xml:265 #, no-c-format msgid "" "The following examples demonstrate the representation using Mapentity-name doit être déclaré au lieu (ou en plus) d'un " "nom de classe :" +#. Tag: programlisting +#: persistent_classes.xml:270 +#, no-c-format +msgid "" +"<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:272 #, no-c-format msgid "" "Even though associations are declared using target class names, the target " @@ -457,6 +681,7 @@ msgstr "" "dynamique au lieu d'un POJO. " #. Tag: para +#: persistent_classes.xml:276 #, no-c-format msgid "" "After setting the default entity mode to dynamic-map for " @@ -468,7 +693,34 @@ msgstr "" "l'exécution fonctionner avec des Map s de Map s : " +#. Tag: programlisting +#: persistent_classes.xml:281 +#, no-c-format +msgid "" +"Session s = openSession();\n" +"Transaction tx = s.beginTransaction();\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:283 #, no-c-format msgid "" "One of the main advantages of dynamic mapping is quick turnaround time for " @@ -487,6 +739,7 @@ msgstr "" "domaine plus tard. " #. Tag: para +#: persistent_classes.xml:290 #, no-c-format msgid "" "Entity representation modes can also be set on a per SessionSession :" +#. Tag: programlisting +#: persistent_classes.xml:293 +#, no-c-format +msgid "" +"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" +msgstr "" + #. Tag: para +#: persistent_classes.xml:295 #, no-c-format msgid "" "Please note that the call to getSession() using an " @@ -517,31 +788,35 @@ msgstr "" "transaction et de la connexion à l'unité de travail primaire. " #. Tag: para +#: persistent_classes.xml:304 #, fuzzy, no-c-format msgid "" "More information about the XML representation capabilities can be found in " -"." +"." msgstr "" "Pour plus d'informations à propos de la représentation XML, veuillez " "consulter ." #. Tag: title +#: persistent_classes.xml:310 #, no-c-format msgid "Tuplizers" msgstr "Tuplizers" #. Tag: para -#, no-c-format +#: persistent_classes.xml:312 +#, fuzzy, no-c-format msgid "" -"org.hibernate.tuple.Tuplizer, and its sub-interfaces, are " -"responsible for managing a particular representation of a piece of data " -"given that representation's org.hibernate.EntityMode. If " -"a given piece of data is thought of as a data structure, then a tuplizer is " -"the thing that 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 corresponding tuplizer knows how create the POJO " -"through its constructor. It also knows how to access the POJO properties " -"using the defined property accessors." +"org.hibernate.tuple.Tuplizer and its sub-" +"interfaces are responsible for managing a particular representation of a " +"piece of data given that representation's org.hibernate." +"EntityMode. If a given piece of data is thought of as a data " +"structure, then a tuplizer is the thing that knows how to create such a data " +"structure, how to extract values from such a data structure and how to " +"inject values into such a data structure. For example, for the POJO entity " +"mode, the corresponding tuplizer knows how create the POJO through its " +"constructor. It also knows how to access the POJO properties using the " +"defined property accessors." msgstr "" "org.hibernate.tuple.Tuplizer, et ses sous-interfaces, " "sont responsables de la gestion d'une représentation particulière d'un " @@ -555,33 +830,44 @@ msgstr "" "les accesseurs de la propriété définie. " #. Tag: para +#: persistent_classes.xml:322 #, no-c-format -msgid "" -"There are two high-level types of Tuplizers, represented by the org." -"hibernate.tuple.entity.EntityTuplizer and org.hibernate." -"tuple.component.ComponentTuplizer interfaces. " -"EntityTuplizers are responsible for managing the above " -"mentioned contracts in regards to entities, while " -"ComponentTuplizers do the same for components." +msgid "There are two (high-level) types of Tuplizers:" msgstr "" -"Il y a deux types de Tuplizers de haut niveau, représentés par les " -"interfaces org.hibernate.tuple.EntityTuplizer et " -"org.hibernate.tuple.ComponentTuplizer. Les " -"EntityTuplizer s sont responsables de la gestion des " -"contrats mentionnés ci-dessus pour les entités, alors que les " -"ComponentTuplizer s s'occupent des composants." #. Tag: para +#: persistent_classes.xml:326 #, no-c-format msgid "" -"Users can also plug in their own tuplizers. Perhaps you require that a " -"java.util.Map implementation other than java." -"util.HashMap 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. Tuplizer definitions are attached to the entity or component " -"mapping they are meant to manage. Going back to the example of our customer " -"entity:" +"org.hibernate.tuple.entity.EntityTuplizer " +"which is responsible for managing the above mentioned contracts in regards " +"to entities" +msgstr "" + +#. Tag: para +#: persistent_classes.xml:332 +#, no-c-format +msgid "" +"org.hibernate.tuple.component.ComponentTuplizer which does the same for components" +msgstr "" + +#. Tag: para +#: persistent_classes.xml:340 +#, fuzzy, no-c-format +msgid "" +"Users can also plug in their own tuplizers. Perhaps you require that " +"java.util.Map implementation other than " +"java.util.HashMap 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. Tuplizer definitions are attached to the " +"entity or component mapping they are meant to manage. Going back to the " +"example of our Customer entity, shows how to specify a custom " +"org.hibernate.tuple.entity.EntityTuplizer " +"using annotations while shows how to do the same in hbm.xml" msgstr "" "Les utilisateurs peuvent aussi brancher leurs propres tuplizers. Il vous " "faudra peut-être utiliser une implémentation de java.util.Maphbm.xml" +msgstr "" + +#. Tag: programlisting +#: persistent_classes.xml:358 +#, no-c-format +msgid "" +"<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>" +msgstr "" + +#. Tag: title +#: persistent_classes.xml:363 #, no-c-format msgid "EntityNameResolvers" msgstr "EntityNameResolvers" #. Tag: para -#, no-c-format +#: persistent_classes.xml:365 +#, fuzzy, no-c-format msgid "" -"The org.hibernate.EntityNameResolver " -"interface is a contract for resolving the entity name of a given entity " -"instance. The interface defines a single method " -"resolveEntityName which is passed the entity " -"instance and is expected to return the appropriate entity name (null is " -"allowed and would indicate that the resolver does not know how to resolve " -"the entity name of the given entity instance). Generally speaking, an " -"org.hibernate.EntityNameResolver is going to " -"be most useful in the case of dynamic models. One example might be using " -"proxied interfaces as your domain model. The hibernate test suite has an " -"example of this exact style of usage under the org.hibernate.test." -"dynamicentity.tuplizer2. Here is some of the code from that " -"package for illustration." +"org.hibernate.EntityNameResolver is a " +"contract for resolving the entity name of a given entity instance. The " +"interface defines a single method resolveEntityName " +"which is passed the entity instance and is expected to return the " +"appropriate entity name (null is allowed and would indicate that the " +"resolver does not know how to resolve the entity name of the given entity " +"instance). Generally speaking, an org.hibernate." +"EntityNameResolver is going to be most useful in the case of " +"dynamic models. One example might be using proxied interfaces as your domain " +"model. The hibernate test suite has an example of this exact style of usage " +"under the org.hibernate.test.dynamicentity.tuplizer2. " +"Here is some of the code from that package for illustration." msgstr "" "L'interface org.hibernate.EntityNameResolver " "représente un contrat pour résoudre le nom de l'entité d'une instance " @@ -629,7 +972,138 @@ msgstr "" "hibernate.test.dynamicentity.tuplizer2. Vous trouverez ci dessous " "une illustration du code de ce package." +#. Tag: programlisting +#: persistent_classes.xml:377 +#, no-c-format +msgid "" +"/**\n" +" * A very trivial JDK Proxy InvocationHandler implementation where we proxy " +"an\n" +" * interface as the domain model and simply store persistent state in an " +"internal\n" +" * Map. This is an extremely trivial example meant only for illustration.\n" +" */\n" +"public final class DataProxyHandler implements InvocationHandler {\n" +" private String entityName;\n" +" private HashMap data = new HashMap();\n" +"\n" +" public DataProxyHandler(String entityName, Serializable id) {\n" +" this.entityName = entityName;\n" +" data.put( \"Id\", id );\n" +" }\n" +"\n" +" public Object invoke(Object proxy, Method method, Object[] args) " +"throws Throwable {\n" +" String methodName = method.getName();\n" +" if ( methodName.startsWith( \"set\" ) ) {\n" +" String propertyName = methodName.substring( 3 );\n" +" data.put( propertyName, args[0] );\n" +" }\n" +" else if ( methodName.startsWith( \"get\" ) ) {\n" +" String propertyName = methodName.substring( 3 );\n" +" return data.get( propertyName );\n" +" }\n" +" else if ( \"toString\".equals( methodName ) ) {\n" +" return entityName + \"#\" + data.get( \"Id\" );\n" +" }\n" +" else if ( \"hashCode\".equals( methodName ) ) {\n" +" return new Integer( this.hashCode() );\n" +" }\n" +" return null;\n" +" }\n" +"\n" +" public String getEntityName() {\n" +" return entityName;\n" +" }\n" +"\n" +" public HashMap getData() {\n" +" return data;\n" +" }\n" +"}\n" +"\n" +"public class ProxyHelper {\n" +" public static String extractEntityName(Object object) {\n" +" // Our custom java.lang.reflect.Proxy instances actually bundle\n" +" // their appropriate entity name, so we simply extract it from " +"there\n" +" // if this represents one of our proxies; otherwise, we return null\n" +" if ( Proxy.isProxyClass( object.getClass() ) ) {\n" +" InvocationHandler handler = Proxy.getInvocationHandler" +"( object );\n" +" if ( DataProxyHandler.class.isAssignableFrom( handler.getClass" +"() ) ) {\n" +" DataProxyHandler myHandler = ( DataProxyHandler ) handler;\n" +" return myHandler.getEntityName();\n" +" }\n" +" }\n" +" return null;\n" +" }\n" +"\n" +" // various other utility methods ....\n" +"\n" +"}\n" +"\n" +"/**\n" +" * The EntityNameResolver implementation.\n" +" *\n" +" * IMPL NOTE : An EntityNameResolver really defines a strategy for how " +"entity names\n" +" * should be resolved. Since this particular impl can handle resolution for " +"all of our\n" +" * entities we want to take advantage of the fact that SessionFactoryImpl " +"keeps these\n" +" * in a Set so that we only ever have one instance registered. Why? Well, " +"when it\n" +" * comes time to resolve an entity name, Hibernate must iterate over all the " +"registered\n" +" * resolvers. So keeping that number down helps that process be as speedy " +"as possible.\n" +" * Hence the equals and hashCode implementations as is\n" +" */\n" +"public class MyEntityNameResolver implements EntityNameResolver {\n" +" public static final MyEntityNameResolver INSTANCE = new " +"MyEntityNameResolver();\n" +"\n" +" public String resolveEntityName(Object entity) {\n" +" return ProxyHelper.extractEntityName( entity );\n" +" }\n" +"\n" +" public boolean equals(Object obj) {\n" +" return getClass().equals( obj.getClass() );\n" +" }\n" +"\n" +" public int hashCode() {\n" +" return getClass().hashCode();\n" +" }\n" +"}\n" +"\n" +"public class MyEntityTuplizer extends PojoEntityTuplizer {\n" +" public MyEntityTuplizer(EntityMetamodel entityMetamodel, " +"PersistentClass mappedEntity) {\n" +" super( entityMetamodel, mappedEntity );\n" +" }\n" +"\n" +" public EntityNameResolver[] getEntityNameResolvers() {\n" +" return new EntityNameResolver[] { MyEntityNameResolver." +"INSTANCE };\n" +" }\n" +"\n" +" public String determineConcreteSubclassEntityName(Object entityInstance, " +"SessionFactoryImplementor factory) {\n" +" String entityName = ProxyHelper.extractEntityName" +"( entityInstance );\n" +" if ( entityName == null ) {\n" +" entityName = super.determineConcreteSubclassEntityName" +"( entityInstance, factory );\n" +" }\n" +" return entityName;\n" +" }\n" +"\n" +" ..." +msgstr "" + #. Tag: para +#: persistent_classes.xml:379 #, no-c-format msgid "" "In order to register an org.hibernate.EntityNameResolver, les utilisateurs doivent soit :" #. Tag: para +#: persistent_classes.xml:383 #, fuzzy, no-c-format msgid "" -"Implement a custom Tuplizer, implementing the getEntityNameResolvers " -"method." +"Implement a custom tuplizer (see ), implementing the getEntityNameResolvers " +"method" msgstr "" "Implémenter un " "personnalisé, en implémentant la méthode getEntityNameResolvers." #. Tag: para +#: persistent_classes.xml:389 #, no-c-format msgid "" "Register it with the org.hibernate.impl.SessionFactoryImpl (qui est la classe d'implémentation de org." "hibernate.SessionFactory) à l'aide de la méthode " "registerEntityNameResolver." + +#~ msgid "" +#~ "Most Java applications require a persistent class representing felines. " +#~ "For example:" +#~ msgstr "" +#~ "Toute bonne application Java nécessite une classe persistante " +#~ "représentant les félins. Par exemple :" + +#~ msgid "" +#~ "Cat has a property called id. 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, java.lang." +#~ "String or java.util.Date. If your legacy " +#~ "database table has composite keys, you can use a user-defined class with " +#~ "properties of these types (see the section on composite identifiers later " +#~ "in the chapter.)" +#~ msgstr "" +#~ "Cat possède une propriété appelée id. Cette propriété mappe la valeur de la colonne de clé primaire " +#~ "de la table d'une base de données. La propriété aurait pu s'appeler " +#~ "autrement, et son type aurait pu être n'importe quel type primitif, " +#~ "n'importe quel \"encapsuleur\" de type primitif, java.lang." +#~ "String ou java.util.Date. (Si votre base de " +#~ "données héritée possède des clés composites, elles peuvent être mappées " +#~ "en utilisant une classe définie par l'utilisateur et possédant les " +#~ "propriétés associées aux types de la clé composite - voir la section " +#~ "concernant les identifiants composites ultérieurement). " + +#~ 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 "" +#~ "La propriété d'identifiant est strictement optionnelle. Vous pouvez " +#~ "l'oublier et laisser Hibernate s'occuper des identifiants de l'objet en " +#~ "interne. Toutefois, ce n'est pas recommandé. " + +#~ msgid "" +#~ "In fact, some functionality is available only to classes that declare an " +#~ "identifier property:" +#~ msgstr "" +#~ "En fait, quelques fonctionnalités ne sont disponibles que pour les " +#~ "classes déclarant un identifiant de propriété : " + +#, fuzzy +#~ msgid "" +#~ "Transitive reattachment for detached objects (cascade update or cascade " +#~ "merge) - see " +#~ msgstr "" +#~ "Pour les rattachements transitifs pour les objets détachés (mise à jour " +#~ "en cascade ou fusion en cascade) - consultez " + +#, fuzzy +#~ msgid "Session.saveOrUpdate()" +#~ msgstr "Session.saveOrUpdate()" + +#, fuzzy +#~ msgid "Session.merge()" +#~ msgstr "Session.merge()" + +#~ msgid "" +#~ "A central feature of Hibernate, proxies, depends " +#~ "upon the persistent class being either non-final, or the implementation " +#~ "of an interface that declares all public methods." +#~ msgstr "" +#~ "Une fonctionnalité clé de Hibernate, les proxies, " +#~ "nécessitent que la classe persistante soit non finale ou qu'elle soit " +#~ "l'implémentation d'une interface qui déclare toutes les méthodes " +#~ "publiques." + +#~ msgid "" +#~ "You can persist final classes that do not implement an " +#~ "interface with Hibernate. You will not, however, be able to use proxies " +#~ "for lazy association fetching which will ultimately limit your options " +#~ "for performance tuning." +#~ msgstr "" +#~ "Vous pouvez persister, grâce à Hibernate, les classes final qui n'implémentent pas d'interface, mais vous ne pourrez pas " +#~ "utiliser les proxies pour les chargements d'associations paresseux - ce " +#~ "qui limitera vos possibilités d'ajustement des performances. " + +#~ msgid "" +#~ "There are two high-level types of Tuplizers, represented by the " +#~ "org.hibernate.tuple.entity.EntityTuplizer and " +#~ "org.hibernate.tuple.component.ComponentTuplizer " +#~ "interfaces. EntityTuplizers are responsible for " +#~ "managing the above mentioned contracts in regards to entities, while " +#~ "ComponentTuplizers do the same for components." +#~ msgstr "" +#~ "Il y a deux types de Tuplizers de haut niveau, représentés par les " +#~ "interfaces org.hibernate.tuple.EntityTuplizer et " +#~ "org.hibernate.tuple.ComponentTuplizer. Les " +#~ "EntityTuplizer s sont responsables de la gestion des " +#~ "contrats mentionnés ci-dessus pour les entités, alors que les " +#~ "ComponentTuplizer s s'occupent des composants." diff --git a/documentation/manual/src/main/docbook/fr-FR/content/preface.po b/documentation/manual/src/main/docbook/fr-FR/content/preface.po index 042aabb8ce..bef64c1944 100644 --- a/documentation/manual/src/main/docbook/fr-FR/content/preface.po +++ b/documentation/manual/src/main/docbook/fr-FR/content/preface.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: Preface\n" "Report-Msgid-Bugs-To: http://bugs.kde.org\n" -"POT-Creation-Date: 2010-02-11T05:38:15\n" +"POT-Creation-Date: 2010-07-20 21:02+0000\n" "PO-Revision-Date: 2010-01-05 09:43+1000\n" "Last-Translator: Corina Roe \n" "Language-Team: French \n" @@ -17,19 +17,24 @@ msgstr "" "X-Generator: KBabel 1.11.4\n" #. Tag: title +#: preface.xml:33 #, no-c-format msgid "Preface" msgstr "Préface" #. Tag: para +#: preface.xml:35 #, fuzzy, 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." +"Working with both Object-Oriented software and Relational Databases can be " +"cumbersome and time consuming. Development costs are significantly higher " +"due to a paradigm mismatch between how data is represented in objects versus " +"relational databases. Hibernate is an Object/Relational Mapping solution for " +"Java environments. The term Object/Relational Mapping refers to the " +"technique of mapping a data representation from an object model to a " +"relational data model with a SQL-based schema; see http://en.wikipedia.org/wiki/" +"Object-relational_mapping for a discussion." msgstr "" "Travailler avec des logiciels orientés-objet et une base de données " "relationnelle peut sembler parfois lourd et coûteux en temps dans les " @@ -40,6 +45,30 @@ msgstr "" "d'objet vers un modèle de données relationnelles dans un schéma basé-SQL." #. Tag: para +#: preface.xml:46 +#, no-c-format +msgid "" +"While having a strong background in SQL is not required to use Hibernate, " +"having a basic understanding of the concepts can greatly help you understand " +"Hibernate more fully and quickly. Probably the single best background is an " +"understanding of data modeling principles. You might want to consider these " +"resources as a good starting point:" +msgstr "" + +#. Tag: ulink +#: preface.xml:54 +#, no-c-format +msgid "http://www.agiledata.org/essays/dataModeling101.html" +msgstr "" + +#. Tag: ulink +#: preface.xml:59 +#, no-c-format +msgid "http://en.wikipedia.org/wiki/Data_modeling" +msgstr "" + +#. Tag: para +#: preface.xml:66 #, no-c-format msgid "" "Hibernate not only takes care of the mapping from Java classes to database " @@ -54,16 +83,28 @@ msgstr "" "passé à traiter des données manuellement dans SQL ou JDBC." #. Tag: para +#: preface.xml:72 #, no-c-format msgid "" -"Hibernate's 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." +"Hibernate’s design goal is to relieve the developer from 95% of common data " +"persistence-related programming tasks by eliminating the need for manual, " +"hand-crafted data processing using SQL and JDBC. However, unlike many other " +"persistence solutions, Hibernate does not hide the power of SQL from you and " +"guarantees that your investment in relational technology and knowledge is as " +"valid as always." +msgstr "" + +#. Tag: para +#: preface.xml:79 +#, fuzzy, no-c-format +msgid "" +"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 "" "Le but d'Hibernate est de libérer le développeur de 95 pour cent des tâches " "de programmation liées à la persistance de données communes. Hibernate n'est " @@ -77,6 +118,7 @@ msgstr "" "d'un tableau de représentation vers un graphe d'objets. " #. Tag: para +#: preface.xml:88 #, no-c-format msgid "" "If you are new to Hibernate and Object/Relational Mapping or even Java, " @@ -86,9 +128,10 @@ msgstr "" "Relationnel ou même Java, veuillez suivre les étapes suivantes :" #. Tag: para +#: preface.xml:95 #, fuzzy, no-c-format msgid "" -"Read for a tutorial with step-by-step " +"Read for a tutorial with step-by-step " "instructions. The source code for the tutorial is included in the " "distribution in the doc/reference/tutorial/ directory." msgstr "" @@ -97,15 +140,17 @@ msgstr "" "distribution du répertoire doc/reference/tutorial/. " #. Tag: para +#: preface.xml:103 #, fuzzy, no-c-format msgid "" -"Read to understand the environments where " +"Read to understand the environments where " "Hibernate can be used." msgstr "" "Veuillez lire pour comprendre dans quels " "environnements Hibernate peuvent-être utilisés." #. Tag: para +#: preface.xml:109 #, no-c-format msgid "" "View the eg/ directory in the Hibernate distribution. It " @@ -124,13 +169,15 @@ msgstr "" "et sous Windows, tapez build eg." #. Tag: para +#: preface.xml:120 #, fuzzy, no-c-format msgid "" "Use this reference documentation as your primary source of information. " "Consider reading if you need " "more help with application design, or if you prefer a step-by-step tutorial. " -"Also visit and download " -"the example application from ." +"Also visit and " +"download the example application from ." msgstr "" "Utiliser cette documentation de référence en tant que source primaire " "d'information. Vous pourrez lire Hibernate in Action " @@ -140,11 +187,13 @@ msgstr "" "et décharger l'exemple d'application pour Hibernate en action." #. Tag: para +#: preface.xml:130 #, no-c-format msgid "FAQs are answered on the Hibernate website." msgstr "Les questions FAQ sont traitées sur le site Hibernate." #. Tag: para +#: preface.xml:135 #, fuzzy, no-c-format msgid "" "Links to third party demos, examples, and tutorials are maintained on the " @@ -154,6 +203,7 @@ msgstr "" "à partir du site Hibernate." #. Tag: para +#: preface.xml:141 #, no-c-format msgid "" "The Community Area on the Hibernate website is a good resource for design " @@ -165,31 +215,91 @@ msgstr "" "diverses d'intégration (Tomcat, JBoss AS, Struts, EJB, etc.)." #. Tag: para +#: preface.xml:149 #, no-c-format msgid "" -"If you have questions, use the user forum linked on the Hibernate website. " -"We also provide a JIRA issue tracking 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." +"There are a number of ways to become involved in the Hibernate community, " +"including" msgstr "" -"Si vous avez des questions, participez au forum utilisateur sur le site " -"Hibernate. Nous proposons également des systèmes de traçage JIRA pour les " -"rapports de bogues et les demandes sur les fonctionalités. Si vous êtes " -"intéressé à participer au développement d'Hibernate, veuillez rejoindre la " -"liste de distribution électronique des développeurs. " #. Tag: para +#: preface.xml:153 #, 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." +"Trying stuff out and reporting bugs. See http://hibernate.org/issuetracker.html details." msgstr "" -"Le support pour le développement commercial, le support production, et la " -"formation Hibernate sont disponibles à travers JBoss Inc. (voir http://www." -"hibernate.org/SupportTraining/). Hibernate est un projet professionnel en " -"source ouverte et un composant critique de la suite de produits JBoss " -"Enterprise Middleware System (JEMS). " + +#. Tag: para +#: preface.xml:160 +#, no-c-format +msgid "" +"Trying your hand at fixing some bugs or implementing enhancements. Again, " +"see http://hibernate." +"org/issuetracker.html details." +msgstr "" + +#. Tag: para +#: preface.xml:167 +#, no-c-format +msgid "" +"http://hibernate.org/" +"community.html list a few ways to engage in the community." +msgstr "" + +#. Tag: para +#: preface.xml:172 +#, no-c-format +msgid "" +"There are forums for users to ask questions and receive help from the " +"community." +msgstr "" + +#. Tag: para +#: preface.xml:177 +#, no-c-format +msgid "" +"There are also IRC channels for both user and developer discussions." +msgstr "" + +#. Tag: para +#: preface.xml:186 +#, no-c-format +msgid "" +"Helping improve or translate this documentation. Contact us on the developer " +"mailing list if you have interest." +msgstr "" + +#. Tag: para +#: preface.xml:192 +#, no-c-format +msgid "Evangelizing Hibernate within your organization." +msgstr "" + +#~ msgid "" +#~ "If you have questions, use the user forum linked on the Hibernate " +#~ "website. We also provide a JIRA issue tracking 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 "" +#~ "Si vous avez des questions, participez au forum utilisateur sur le site " +#~ "Hibernate. Nous proposons également des systèmes de traçage JIRA pour les " +#~ "rapports de bogues et les demandes sur les fonctionalités. Si vous êtes " +#~ "intéressé à participer au développement d'Hibernate, veuillez rejoindre " +#~ "la liste de distribution électronique des développeurs. " + +#~ 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 "" +#~ "Le support pour le développement commercial, le support production, et la " +#~ "formation Hibernate sont disponibles à travers JBoss Inc. (voir http://" +#~ "www.hibernate.org/SupportTraining/). Hibernate est un projet " +#~ "professionnel en source ouverte et un composant critique de la suite de " +#~ "produits JBoss Enterprise Middleware System (JEMS). " diff --git a/documentation/manual/src/main/docbook/fr-FR/content/query_sql.po b/documentation/manual/src/main/docbook/fr-FR/content/query_sql.po index 91b23e270b..fe49644135 100644 --- a/documentation/manual/src/main/docbook/fr-FR/content/query_sql.po +++ b/documentation/manual/src/main/docbook/fr-FR/content/query_sql.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: query_sql\n" "Report-Msgid-Bugs-To: http://bugs.kde.org\n" -"POT-Creation-Date: 2010-03-12T00:03:47\n" +"POT-Creation-Date: 2010-07-20 21:02+0000\n" "PO-Revision-Date: 2010-01-05 09:47+1000\n" "Last-Translator: Corina Roe \n" "Language-Team: French \n" @@ -17,11 +17,13 @@ msgstr "" "X-Generator: KBabel 1.11.4\n" #. Tag: title +#: query_sql.xml:31 #, no-c-format msgid "Native SQL" msgstr "SQL natif" #. Tag: para +#: query_sql.xml:33 #, no-c-format msgid "" "You can also express queries in the native SQL dialect of your database. " @@ -38,6 +40,7 @@ msgstr "" "directement sur SQL/JDBC vers Hibernate. " #. Tag: para +#: query_sql.xml:39 #, no-c-format msgid "" "Hibernate3 allows you to specify handwritten SQL, including stored " @@ -48,11 +51,13 @@ msgstr "" "suppression et chargement. " #. Tag: title +#: query_sql.xml:43 #, no-c-format msgid "Using a SQLQuery" msgstr "Utiliser une requête SQLQuery" #. Tag: para +#: query_sql.xml:45 #, no-c-format msgid "" "Execution of native SQL queries is controlled via the SQLQueryResultSetMetadata, or " @@ -100,22 +117,36 @@ msgstr "" "simplement pour être plus explicite dans ce qui est retourné, vous pouvez " "utiliser addScalar(). " +#. Tag: programlisting +#: query_sql.xml:67 +#, no-c-format +msgid "" +"sess.createSQLQuery(\"SELECT * FROM CATS\")\n" +" .addScalar(\"ID\", Hibernate.LONG)\n" +" .addScalar(\"NAME\", Hibernate.STRING)\n" +" .addScalar(\"BIRTHDATE\", Hibernate.DATE)" +msgstr "" + #. Tag: para +#: query_sql.xml:69 query_sql.xml:116 query_sql.xml:197 query_sql.xml:349 #, no-c-format msgid "This query specified:" msgstr "Cette requête spécifie :" #. Tag: para +#: query_sql.xml:73 query_sql.xml:120 query_sql.xml:353 #, no-c-format msgid "the SQL query string" msgstr "la chaîne de requêtes SQL" #. Tag: para +#: query_sql.xml:77 #, no-c-format msgid "the columns and types to return" msgstr "les colonnes et les types retournés" #. Tag: para +#: query_sql.xml:81 #, no-c-format msgid "" "This will return Object arrays, but now it will not use " @@ -134,6 +165,7 @@ msgstr "" "colonnes listées." #. Tag: para +#: query_sql.xml:89 #, no-c-format msgid "" "It is possible to leave out the type information for all or some of the " @@ -142,7 +174,18 @@ msgstr "" "Il est possible de ne pas définir l'information sur le type pour toutes ou " "une partie des scalaires." +#. Tag: programlisting +#: query_sql.xml:92 +#, no-c-format +msgid "" +"sess.createSQLQuery(\"SELECT * FROM CATS\")\n" +" .addScalar(\"ID\", Hibernate.LONG)\n" +" .addScalar(\"NAME\")\n" +" .addScalar(\"BIRTHDATE\")" +msgstr "" + #. Tag: para +#: query_sql.xml:94 #, no-c-format msgid "" "This is essentially the same query as before, but now " @@ -154,6 +197,7 @@ msgstr "" "NAME et BIRTHDATE alors que le type de ID est explicitement spécifié. " #. Tag: para +#: query_sql.xml:99 #, no-c-format msgid "" "How the java.sql.Types returned from ResultSetMetaData is mapped to " @@ -167,11 +211,13 @@ msgstr "" "registerHibernateType dans le Dialect. " #. Tag: title +#: query_sql.xml:107 #, no-c-format msgid "Entity queries" msgstr "Requêtes d'entités" #. Tag: para +#: query_sql.xml:109 #, no-c-format msgid "" "The above queries were all about returning scalar values, basically " @@ -184,12 +230,23 @@ msgstr "" "montre comment récupérer des entités depuis une requête native SQL, grâce à " "addEntity()." +#. Tag: programlisting +#: query_sql.xml:114 +#, no-c-format +msgid "" +"sess.createSQLQuery(\"SELECT * FROM CATS\").addEntity(Cat.class);\n" +"sess.createSQLQuery(\"SELECT ID, NAME, BIRTHDATE FROM CATS\").addEntity(Cat." +"class);" +msgstr "" + #. Tag: para +#: query_sql.xml:124 #, no-c-format msgid "the entity returned by the query" msgstr "L'entité retournée par la requête" #. Tag: para +#: query_sql.xml:128 #, no-c-format msgid "" "Assuming that Cat is mapped as a class with the columns ID, NAME and " @@ -201,6 +258,7 @@ msgstr "" "une entité Cat." #. Tag: para +#: query_sql.xml:132 #, no-c-format msgid "" "If the entity is mapped with a many-to-one to another " @@ -218,17 +276,28 @@ msgstr "" "comme dans l'exemple suivant avec le many-to-one vers " "Dog:" +#. Tag: programlisting +#: query_sql.xml:140 +#, no-c-format +msgid "" +"sess.createSQLQuery(\"SELECT ID, NAME, BIRTHDATE, DOG_ID FROM CATS\")." +"addEntity(Cat.class);" +msgstr "" + #. Tag: para +#: query_sql.xml:142 #, no-c-format msgid "This will allow cat.getDog() to function properly." msgstr "Ceci permet à cat.getDog() de fonctionner normalement." #. Tag: title +#: query_sql.xml:146 #, no-c-format msgid "Handling associations and collections" msgstr "Gérer les associations et collections" #. Tag: para +#: query_sql.xml:148 #, no-c-format msgid "" "It is possible to eagerly join in the Dog to avoid the " @@ -241,7 +310,18 @@ msgstr "" "base de données. Ceci est effectué via la méthode addJoin(), qui vous permet de joindre une association ou collection." +#. Tag: programlisting +#: query_sql.xml:153 +#, no-c-format +msgid "" +"sess.createSQLQuery(\"SELECT c.ID, NAME, BIRTHDATE, DOG_ID, D_ID, D_NAME " +"FROM CATS c, DOGS d WHERE c.DOG_ID = d.D_ID\")\n" +" .addEntity(\"cat\", Cat.class)\n" +" .addJoin(\"cat.dog\");" +msgstr "" + #. Tag: para +#: query_sql.xml:155 #, no-c-format msgid "" "In this example, the returned Cat's will have their " @@ -259,7 +339,18 @@ msgstr "" "collections, par ex. si le Cat a un un-à-plusieurs vers " "Dog. " +#. Tag: programlisting +#: query_sql.xml:163 +#, no-c-format +msgid "" +"sess.createSQLQuery(\"SELECT ID, NAME, BIRTHDATE, D_ID, D_NAME, CAT_ID FROM " +"CATS c, DOGS d WHERE c.ID = d.CAT_ID\")\n" +" .addEntity(\"cat\", Cat.class)\n" +" .addJoin(\"cat.dogs\");" +msgstr "" + #. Tag: para +#: query_sql.xml:165 #, no-c-format msgid "" "At this stage you are reaching the limits of what is possible with native " @@ -274,11 +365,13 @@ msgstr "" "plus suffisants." #. Tag: title +#: query_sql.xml:173 #, no-c-format msgid "Returning multiple entities" msgstr "Retour d'entités multiples" #. Tag: para +#: query_sql.xml:175 #, no-c-format msgid "" "Until now, the result set column names are assumed to be the same as the " @@ -293,6 +386,7 @@ msgstr "" "peuvent apparaître dans plus d'une table. " #. Tag: para +#: query_sql.xml:180 #, no-c-format msgid "" "Column alias injection is needed in the following query (which most likely " @@ -301,7 +395,18 @@ msgstr "" "L'injection d'alias de colonne est requise pour la requête suivante (qui " "risque de ne pas fonctionner) :" +#. Tag: programlisting +#: query_sql.xml:183 +#, no-c-format +msgid "" +"sess.createSQLQuery(\"SELECT c.*, m.* FROM CATS c, CATS m WHERE c.MOTHER_ID " +"= c.ID\")\n" +" .addEntity(\"cat\", Cat.class)\n" +" .addEntity(\"mother\", Cat.class)" +msgstr "" + #. Tag: para +#: query_sql.xml:185 #, no-c-format msgid "" "The query was intended to return two Cat instances per row: a cat and its " @@ -319,13 +424,25 @@ msgstr "" "et \"NAME\"). " #. Tag: para +#: query_sql.xml:192 #, no-c-format msgid "The following form is not vulnerable to column name duplication:" msgstr "" "La forme suivante n'est pas vulnérable à la duplication des noms de " "colonnes :" +#. Tag: programlisting +#: query_sql.xml:195 +#, no-c-format +msgid "" +"sess.createSQLQuery(\"SELECT {cat.*}, {mother.*} FROM CATS c, CATS m WHERE " +"c.MOTHER_ID = c.ID\")\n" +" .addEntity(\"cat\", Cat.class)\n" +" .addEntity(\"mother\", Cat.class)" +msgstr "" + #. Tag: para +#: query_sql.xml:201 #, no-c-format msgid "" "the SQL query string, with placeholders for Hibernate to inject column " @@ -335,11 +452,13 @@ msgstr "" "colonnes" #. Tag: para +#: query_sql.xml:206 #, no-c-format msgid "the entities returned by the query" msgstr "les entités retournées par la requête" #. Tag: para +#: query_sql.xml:210 #, no-c-format msgid "" "The {cat.*} and {mother.*} notation used above is a shorthand for \"all " @@ -360,12 +479,28 @@ msgstr "" "que nous pouvons aussi utiliser les alias de propriété dans la clause where " "si désiré. " +#. Tag: programlisting +#: query_sql.xml:219 +#, no-c-format +msgid "" +"String sql = \"SELECT ID as {c.id}, NAME as {c.name}, \" +\n" +" \"BIRTHDATE as {c.birthDate}, MOTHER_ID as {c.mother}, {mother.*} " +"\" +\n" +" \"FROM CAT_LOG c, CAT_LOG m WHERE {c.mother} = c.ID\";\n" +"\n" +"List loggedCats = sess.createSQLQuery(sql)\n" +" .addEntity(\"cat\", Cat.class)\n" +" .addEntity(\"mother\", Cat.class).list()" +msgstr "" + #. Tag: title +#: query_sql.xml:222 #, no-c-format msgid "Alias and property references" msgstr "Références d'alias et de propriété" #. Tag: para +#: query_sql.xml:224 #, no-c-format msgid "" "In most cases the above alias injection is needed. For queries relating to " @@ -380,6 +515,7 @@ msgstr "" "l'injection des alias appropriés. " #. Tag: para +#: query_sql.xml:229 #, no-c-format msgid "" "The following table shows the different ways you can use the alias " @@ -393,180 +529,213 @@ msgstr "" "lorsqu'ils seront utilisés. " #. Tag: title +#: query_sql.xml:235 #, no-c-format msgid "Alias injection names" msgstr "Nom d'injection d'alias" #. Tag: entry +#: query_sql.xml:246 #, no-c-format msgid "Description" msgstr "Description" #. Tag: entry +#: query_sql.xml:248 #, no-c-format msgid "Syntax" msgstr "Syntaxe" #. Tag: entry +#: query_sql.xml:250 #, no-c-format msgid "Example" msgstr "Exemple" #. Tag: entry +#: query_sql.xml:256 #, no-c-format msgid "A simple property" msgstr "Une propriété simple" -#. Tag: entry +#. Tag: literal +#: query_sql.xml:258 #, fuzzy, no-c-format -msgid "{[aliasname].[propertyname]" +msgid "{[aliasname].[propertyname]" msgstr "{[aliasname].[propertyname]" -#. Tag: entry +#. Tag: literal +#: query_sql.xml:260 #, fuzzy, no-c-format -msgid "A_NAME as {item.name}" -msgstr "{item.*}" +msgid "A_NAME as {item.name}" +msgstr "A_NAME as {item.name}" #. Tag: entry +#: query_sql.xml:264 #, no-c-format msgid "A composite property" msgstr "Une propriété composite" -#. Tag: entry +#. Tag: literal +#: query_sql.xml:266 #, fuzzy, no-c-format -msgid "{[aliasname].[componentname].[propertyname]}" +msgid "{[aliasname].[componentname].[propertyname]}" msgstr "{[aliasname].[componentname].[propertyname]}" -#. Tag: entry +#. Tag: literal +#: query_sql.xml:268 #, fuzzy, no-c-format -msgid "" -"CURRENCY as {item.amount.currency}, VALUE as {item.amount.value}" +msgid "CURRENCY as {item.amount.currency}, VALUE as {item.amount.value}" msgstr "" "CURRENCY as {item.amount.currency}, VALUE as {item.amount.value}" #. Tag: entry +#: query_sql.xml:273 #, no-c-format msgid "Discriminator of an entity" msgstr "Discriminateur d'une entité" -#. Tag: entry +#. Tag: literal +#: query_sql.xml:275 #, fuzzy, no-c-format -msgid "{[aliasname].class}" -msgstr "{item.*}" - -#. Tag: entry -#, fuzzy, no-c-format -msgid "DISC as {item.class}" -msgstr "{item.*}" +msgid "{[aliasname].class}" +msgstr "{[aliasname].class}" + +#. Tag: literal +#: query_sql.xml:277 +#, fuzzy, no-c-format +msgid "DISC as {item.class}" +msgstr "DISC as {item.class}" #. Tag: entry +#: query_sql.xml:281 #, no-c-format msgid "All properties of an entity" msgstr "Toutes les propriétés d'une entité" -#. Tag: entry +#. Tag: literal +#: query_sql.xml:283 query_sql.xml:331 #, fuzzy, no-c-format -msgid "{[aliasname].*}" -msgstr "{item.*}" +msgid "{[aliasname].*}" +msgstr "{[aliasname].*}" -#. Tag: entry +#. Tag: literal +#: query_sql.xml:285 #, no-c-format -msgid "{item.*}" -msgstr "{item.*}" +msgid "{item.*}" +msgstr "" #. Tag: entry +#: query_sql.xml:289 #, no-c-format msgid "A collection key" msgstr "La clé d'une collection" -#. Tag: entry +#. Tag: literal +#: query_sql.xml:291 #, fuzzy, no-c-format -msgid "{[aliasname].key}" -msgstr "{item.*}" - -#. Tag: entry -#, fuzzy, no-c-format -msgid "ORGID as {coll.key}" -msgstr "{coll.*}" +msgid "{[aliasname].key}" +msgstr "{[aliasname].key}" + +#. Tag: literal +#: query_sql.xml:293 +#, fuzzy, no-c-format +msgid "ORGID as {coll.key}" +msgstr "ORGID as {coll.key}" #. Tag: entry +#: query_sql.xml:297 #, no-c-format msgid "The id of an collection" msgstr "L'id d'une collection" -#. Tag: entry +#. Tag: literal +#: query_sql.xml:299 #, fuzzy, no-c-format -msgid "{[aliasname].id}" -msgstr "{item.*}" - -#. Tag: entry -#, fuzzy, no-c-format -msgid "EMPID as {coll.id}" -msgstr "{coll.*}" +msgid "{[aliasname].id}" +msgstr "{[aliasname].id}" + +#. Tag: literal +#: query_sql.xml:301 +#, fuzzy, no-c-format +msgid "EMPID as {coll.id}" +msgstr "EMPID as {coll.id}" #. Tag: entry +#: query_sql.xml:305 #, no-c-format msgid "The element of an collection" msgstr "L'élément d'une collection" -#. Tag: entry +#. Tag: literal +#: query_sql.xml:307 #, fuzzy, no-c-format -msgid "{[aliasname].element}" -msgstr "{item.*}" - -#. Tag: entry -#, fuzzy, no-c-format -msgid "XID as {coll.element}" -msgstr "{coll.*}" +msgid "{[aliasname].element}" +msgstr "{[aliasname].element}" + +#. Tag: literal +#: query_sql.xml:309 +#, fuzzy, no-c-format +msgid "XID as {coll.element}" +msgstr "XID as {coll.element}" #. Tag: entry +#: query_sql.xml:313 #, no-c-format msgid "property of the element in the collection" msgstr "Propriété de l'élément dans une collection " -#. Tag: entry +#. Tag: literal +#: query_sql.xml:315 #, fuzzy, no-c-format -msgid "{[aliasname].element.[propertyname]}" +msgid "{[aliasname].element.[propertyname]}" msgstr "{[aliasname].element.[propertyname]}" -#. Tag: entry +#. Tag: literal +#: query_sql.xml:317 #, fuzzy, no-c-format -msgid "NAME as {coll.element.name}" -msgstr "NAME as {coll.element.name}" +msgid "NAME as {coll.element.name}" +msgstr "XID as {coll.element}" #. Tag: entry +#: query_sql.xml:321 #, no-c-format msgid "All properties of the element in the collection" msgstr "Toutes les propriétés d'un élément dans la collection" -#. Tag: entry +#. Tag: literal +#: query_sql.xml:323 #, fuzzy, no-c-format -msgid "{[aliasname].element.*}" -msgstr "{item.*}" - -#. Tag: entry -#, fuzzy, no-c-format -msgid "{coll.element.*}" -msgstr "{coll.*}" +msgid "{[aliasname].element.*}" +msgstr "{[aliasname].element.*}" + +#. Tag: literal +#: query_sql.xml:325 +#, fuzzy, no-c-format +msgid "{coll.element.*}" +msgstr "{coll.element.*}" #. Tag: entry +#: query_sql.xml:329 #, fuzzy, no-c-format msgid "All properties of the collection" msgstr "Toutes les propriétés d'une collection" -#. Tag: entry -#, no-c-format -msgid "{coll.*}" -msgstr "{coll.*}" +#. Tag: literal +#: query_sql.xml:333 +#, fuzzy, no-c-format +msgid "{coll.*}" +msgstr "{coll.element.*}" #. Tag: title +#: query_sql.xml:342 #, no-c-format msgid "Returning non-managed entities" msgstr "Retour d'entités non gérées" #. Tag: para +#: query_sql.xml:344 #, no-c-format msgid "" "It is possible to apply a ResultTransformer to native SQL queries, allowing " @@ -575,12 +744,22 @@ msgstr "" "Il est possible d'appliquer un ResultTransformer à une requête native SQL. " "Ce qui permet, par exemple, de retourner des entités non gérées. " +#. Tag: programlisting +#: query_sql.xml:347 +#, no-c-format +msgid "" +"sess.createSQLQuery(\"SELECT NAME, BIRTHDATE FROM CATS\")\n" +" .setResultTransformer(Transformers.aliasToBean(CatDTO.class))" +msgstr "" + #. Tag: para +#: query_sql.xml:357 #, no-c-format msgid "a result transformer" msgstr "un transformateur de résultat" #. Tag: para +#: query_sql.xml:361 #, no-c-format msgid "" "The above query will return a list of CatDTO which has " @@ -592,11 +771,13 @@ msgstr "" "été injectées dans leurs propriétés ou champs correspondants." #. Tag: title +#: query_sql.xml:367 #, no-c-format msgid "Handling inheritance" msgstr "Gérer l'héritage" #. Tag: para +#: query_sql.xml:369 #, no-c-format msgid "" "Native SQL queries which query for entities that are mapped as part of an " @@ -608,35 +789,90 @@ msgstr "" "base et de toutes ses sous classes. " #. Tag: title +#: query_sql.xml:375 #, no-c-format msgid "Parameters" msgstr "Paramètres" #. Tag: para +#: query_sql.xml:377 #, no-c-format msgid "Native SQL queries support positional as well as named parameters:" msgstr "" "Les requêtes natives SQL supportent aussi bien les paramètres de position " "que les paramètres nommés : " +#. Tag: programlisting +#: query_sql.xml:380 +#, no-c-format +msgid "" +"Query query = sess.createSQLQuery(\"SELECT * FROM CATS WHERE NAME like ?\")." +"addEntity(Cat.class);\n" +"List pusList = query.setString(0, \"Pus%\").list();\n" +" \n" +"query = sess.createSQLQuery(\"SELECT * FROM CATS WHERE NAME like :name\")." +"addEntity(Cat.class);\n" +"List pusList = query.setString(\"name\", \"Pus%\").list();" +msgstr "" + #. Tag: title +#: query_sql.xml:385 #, no-c-format msgid "Named SQL queries" msgstr "Requêtes SQL nommées" #. Tag: para -#, no-c-format +#: query_sql.xml:387 +#, fuzzy, no-c-format msgid "" -"Named SQL queries can be defined in the mapping document and called in " -"exactly the same way as a named HQL query. In this case, you do " -"not need to call addEntity()." +"Named SQL queries can also be defined in the mapping document and called in " +"exactly the same way as a named HQL query (see ). In this case, you do not " +"need to call addEntity()." msgstr "" "Les requêtes SQL nommées peuvent être définies dans le document de mapping " "et appelées exactement de la même manière qu'une requête HQL nommée. Dans ce " "cas, nous n'avons pas besoin d'appeler " "addEntity(). " +#. Tag: title +#: query_sql.xml:394 +#, no-c-format +msgid "Named sql query using the <sql-query> maping element" +msgstr "" + +#. Tag: programlisting +#: query_sql.xml:397 +#, no-c-format +msgid "" +"<sql-query name=\"persons\">\n" +" <return alias=\"person\" class=\"eg.Person\"/>\n" +" SELECT person.NAME AS {person.name},\n" +" person.AGE AS {person.age},\n" +" person.SEX AS {person.sex}\n" +" FROM PERSON person\n" +" WHERE person.NAME LIKE :namePattern\n" +"</sql-query>" +msgstr "" + +#. Tag: title +#: query_sql.xml:401 +#, no-c-format +msgid "Execution of a named query" +msgstr "" + +#. Tag: programlisting +#: query_sql.xml:403 +#, no-c-format +msgid "" +"List people = sess.getNamedQuery(\"persons\")\n" +" .setString(\"namePattern\", namePattern)\n" +" .setMaxResults(50)\n" +" .list();" +msgstr "" + #. Tag: para +#: query_sql.xml:406 #, no-c-format msgid "" "The <return-join> element is use to join " @@ -647,7 +883,36 @@ msgstr "" "collection> sont respectivement utilisés pour lier des " "associations et définir des requêtes qui initialisent des collections," +#. Tag: title +#: query_sql.xml:411 +#, no-c-format +msgid "Named sql query with association" +msgstr "" + +#. Tag: programlisting +#: query_sql.xml:413 +#, no-c-format +msgid "" +"<sql-query name=\"personsWith\">\n" +" <return alias=\"person\" class=\"eg.Person\"/>\n" +" <return-join alias=\"address\" property=\"person.mailingAddress\"/" +">\n" +" SELECT person.NAME AS {person.name},\n" +" person.AGE AS {person.age},\n" +" person.SEX AS {person.sex},\n" +" address.STREET AS {address.street},\n" +" address.CITY AS {address.city},\n" +" address.STATE AS {address.state},\n" +" address.ZIP AS {address.zip}\n" +" FROM PERSON person\n" +" JOIN ADDRESS address\n" +" ON person.ID = address.PERSON_ID AND address.TYPE='MAILING'\n" +" WHERE person.NAME LIKE :namePattern\n" +"</sql-query>" +msgstr "" + #. Tag: para +#: query_sql.xml:416 #, no-c-format msgid "" "A named SQL query may return a scalar value. You must declare the column " @@ -658,7 +923,27 @@ msgstr "" "spécifier l'alias de colonne et le type Hibernate utilisant l'élément " "<return-scalar> :" +#. Tag: title +#: query_sql.xml:421 +#, no-c-format +msgid "Named query returning a scalar" +msgstr "" + +#. Tag: programlisting +#: query_sql.xml:423 +#, no-c-format +msgid "" +"<sql-query name=\"mySqlQuery\">\n" +" <return-scalar column=\"name\" type=\"string\"/>\n" +" <return-scalar column=\"age\" type=\"long\"/>\n" +" SELECT p.NAME AS name, \n" +" p.AGE AS age,\n" +" FROM PERSON p WHERE p.NAME LIKE 'Hiber%'\n" +"</sql-query>" +msgstr "" + #. Tag: para +#: query_sql.xml:426 #, no-c-format msgid "" "You can externalize the resultset mapping information in a <" @@ -671,7 +956,39 @@ msgstr "" "différentes requêtes nommées, soit à travers l'API " "setResultSetMapping(). " +#. Tag: title +#: query_sql.xml:432 +#, no-c-format +msgid "<resultset> mapping used to externalize mapping information" +msgstr "" + +#. Tag: programlisting +#: query_sql.xml:435 +#, no-c-format +msgid "" +"<resultset name=\"personAddress\">\n" +" <return alias=\"person\" class=\"eg.Person\"/>\n" +" <return-join alias=\"address\" property=\"person.mailingAddress\"/" +">\n" +"</resultset>\n" +"\n" +"<sql-query name=\"personsWith\" resultset-ref=\"personAddress\">\n" +" SELECT person.NAME AS {person.name},\n" +" person.AGE AS {person.age},\n" +" person.SEX AS {person.sex},\n" +" address.STREET AS {address.street},\n" +" address.CITY AS {address.city},\n" +" address.STATE AS {address.state},\n" +" address.ZIP AS {address.zip}\n" +" FROM PERSON person\n" +" JOIN ADDRESS address\n" +" ON person.ID = address.PERSON_ID AND address.TYPE='MAILING'\n" +" WHERE person.NAME LIKE :namePattern\n" +"</sql-query>" +msgstr "" + #. Tag: para +#: query_sql.xml:438 #, no-c-format msgid "" "You can, alternatively, use the resultset mapping information in your hbm " @@ -681,6 +998,332 @@ msgstr "" "résultats dans vos fichiers hbm directement dans le code java. " #. Tag: title +#: query_sql.xml:442 +#, no-c-format +msgid "Programmatically specifying the result mapping information" +msgstr "" + +#. Tag: programlisting +#: query_sql.xml:445 +#, no-c-format +msgid "" +"List cats = sess.createSQLQuery(\n" +" \"select {cat.*}, {kitten.*} from cats cat, cats kitten where kitten." +"mother = cat.id\"\n" +" )\n" +" .setResultSetMapping(\"catAndKitten\")\n" +" .list();" +msgstr "" + +#. Tag: para +#: query_sql.xml:448 +#, no-c-format +msgid "" +"So far we have only looked at externalizing SQL queries using Hibernate " +"mapping files. The same concept is also available with anntations and is " +"called named native queries. You can use @NamedNativeQuery (@NamedNativeQueries) in conjunction with " +"@SqlResultSetMapping (@SqlResultSetMappings). Like @NamedQuery, " +"@NamedNativeQuery and @SqlResultSetMapping can be defined at class level, but their scope is global to the " +"application. Lets look at a view examples." +msgstr "" + +#. Tag: para +#: query_sql.xml:460 +#, no-c-format +msgid "" +"shows how a resultSetMapping parameter is defined in " +"@NamedNativeQuery. It represents the name of a defined " +"@SqlResultSetMapping. The resultset mapping declares the " +"entities retrieved by this native query. Each field of the entity is bound " +"to an SQL alias (or column name). All fields of the entity including the " +"ones of subclasses and the foreign key columns of related entities have to " +"be present in the SQL query. Field definitions are optional provided that " +"they map to the same column name as the one declared on the class property. " +"In the example 2 entities, Night and Area, are returned and each property is declared and associated to a " +"column name, actually the column name retrieved by the query." +msgstr "" + +#. Tag: para +#: query_sql.xml:475 +#, no-c-format +msgid "" +"In the result set " +"mapping is implicit. We only describe the entity class of the result set " +"mapping. The property / column mappings is done using the entity mapping " +"values. In this case the model property is bound to the model_txt column." +msgstr "" + +#. Tag: para +#: query_sql.xml:481 +#, no-c-format +msgid "" +"Finally, if the association to a related entity involve a composite primary " +"key, a @FieldResult element should be used for each " +"foreign key column. The @FieldResult name is composed of " +"the property name for the relationship, followed by a dot (\".\"), followed " +"by the name or the field or property of the primary key. This can be seen in " +"." +msgstr "" + +#. Tag: title +#: query_sql.xml:490 +#, no-c-format +msgid "" +"Named SQL query using @NamedNativeQuery together with " +"@SqlResultSetMapping" +msgstr "" + +#. Tag: programlisting +#: query_sql.xml:493 +#, no-c-format +msgid "" +"@NamedNativeQuery(name=\"night&area\", query=\"select night.id nid, " +"night.night_duration, \"\n" +" + \" night.night_date, area.id aid, night.area_id, area.name \"\n" +" + \"from Night night, Area area where night.area_id = area.id\", \n" +" resultSetMapping=\"joinMapping\")\n" +"@SqlResultSetMapping(name=\"joinMapping\", entities={\n" +" @EntityResult(entityClass=Night.class, fields = {\n" +" @FieldResult(name=\"id\", column=\"nid\"),\n" +" @FieldResult(name=\"duration\", column=\"night_duration\"),\n" +" @FieldResult(name=\"date\", column=\"night_date\"),\n" +" @FieldResult(name=\"area\", column=\"area_id\"),\n" +" discriminatorColumn=\"disc\"\n" +" }),\n" +" @EntityResult(entityClass=org.hibernate.test.annotations.query.Area." +"class, fields = {\n" +" @FieldResult(name=\"id\", column=\"aid\"),\n" +" @FieldResult(name=\"name\", column=\"name\")\n" +" })\n" +" }\n" +")" +msgstr "" + +#. Tag: title +#: query_sql.xml:497 +#, no-c-format +msgid "Implicit result set mapping" +msgstr "" + +#. Tag: programlisting +#: query_sql.xml:499 +#, no-c-format +msgid "" +"@Entity\n" +"@SqlResultSetMapping(name=\"implicit\",\n" +" entities=@EntityResult(entityClass=SpaceShip.class))\n" +"@NamedNativeQuery(name=\"implicitSample\", \n" +" query=\"select * from SpaceShip\", \n" +" resultSetMapping=\"implicit\")\n" +"public class SpaceShip {\n" +" private String name;\n" +" private String model;\n" +" private double speed;\n" +"\n" +" @Id\n" +" public String getName() {\n" +" return name;\n" +" }\n" +"\n" +" public void setName(String name) {\n" +" this.name = name;\n" +" }\n" +"\n" +" @Column(name=\"model_txt\")\n" +" public String getModel() {\n" +" return model;\n" +" }\n" +"\n" +" public void setModel(String model) {\n" +" this.model = model;\n" +" }\n" +"\n" +" public double getSpeed() {\n" +" return speed;\n" +" }\n" +"\n" +" public void setSpeed(double speed) {\n" +" this.speed = speed;\n" +" }\n" +"}" +msgstr "" + +#. Tag: title +#: query_sql.xml:503 +#, no-c-format +msgid "Using dot notation in @FieldResult for specifying associations" +msgstr "" + +#. Tag: programlisting +#: query_sql.xml:506 +#, no-c-format +msgid "" +"@Entity\n" +"@SqlResultSetMapping(name=\"compositekey\",\n" +" entities=@EntityResult(entityClass=SpaceShip.class,\n" +" fields = {\n" +" @FieldResult(name=\"name\", column = \"name\"),\n" +" @FieldResult(name=\"model\", column = \"model\"),\n" +" @FieldResult(name=\"speed\", column = \"speed\"),\n" +" @FieldResult(name=\"captain.firstname\", column = " +"\"firstn\"),\n" +" @FieldResult(name=\"captain.lastname\", column = \"lastn" +"\"),\n" +" @FieldResult(name=\"dimensions.length\", column = " +"\"length\"),\n" +" @FieldResult(name=\"dimensions.width\", column = \"width" +"\")\n" +" }),\n" +" columns = { @ColumnResult(name = \"surface\"),\n" +" @ColumnResult(name = \"volume\") } )\n" +"\n" +"@NamedNativeQuery(name=\"compositekey\",\n" +" query=\"select name, model, speed, lname as lastn, fname as firstn, " +"length, width, length * width as surface from SpaceShip\", \n" +" resultSetMapping=\"compositekey\")\n" +"} )\n" +"public class SpaceShip {\n" +" private String name;\n" +" private String model;\n" +" private double speed;\n" +" private Captain captain;\n" +" private Dimensions dimensions;\n" +"\n" +" @Id\n" +" public String getName() {\n" +" return name;\n" +" }\n" +"\n" +" public void setName(String name) {\n" +" this.name = name;\n" +" }\n" +"\n" +" @ManyToOne(fetch= FetchType.LAZY)\n" +" @JoinColumns( {\n" +" @JoinColumn(name=\"fname\", referencedColumnName = \"firstname" +"\"),\n" +" @JoinColumn(name=\"lname\", referencedColumnName = \"lastname" +"\")\n" +" } )\n" +" public Captain getCaptain() {\n" +" return captain;\n" +" }\n" +"\n" +" public void setCaptain(Captain captain) {\n" +" this.captain = captain;\n" +" }\n" +"\n" +" public String getModel() {\n" +" return model;\n" +" }\n" +"\n" +" public void setModel(String model) {\n" +" this.model = model;\n" +" }\n" +"\n" +" public double getSpeed() {\n" +" return speed;\n" +" }\n" +"\n" +" public void setSpeed(double speed) {\n" +" this.speed = speed;\n" +" }\n" +"\n" +" public Dimensions getDimensions() {\n" +" return dimensions;\n" +" }\n" +"\n" +" public void setDimensions(Dimensions dimensions) {\n" +" this.dimensions = dimensions;\n" +" }\n" +"}\n" +"\n" +"@Entity\n" +"@IdClass(Identity.class)\n" +"public class Captain implements Serializable {\n" +" private String firstname;\n" +" private String lastname;\n" +"\n" +" @Id\n" +" public String getFirstname() {\n" +" return firstname;\n" +" }\n" +"\n" +" public void setFirstname(String firstname) {\n" +" this.firstname = firstname;\n" +" }\n" +"\n" +" @Id\n" +" public String getLastname() {\n" +" return lastname;\n" +" }\n" +"\n" +" public void setLastname(String lastname) {\n" +" this.lastname = lastname;\n" +" }\n" +"}" +msgstr "" + +#. Tag: para +#: query_sql.xml:510 +#, no-c-format +msgid "" +"If you retrieve a single entity using the default mapping, you can specify " +"the resultClass attribute instead of " +"resultSetMapping:" +msgstr "" + +#. Tag: programlisting +#: query_sql.xml:514 +#, no-c-format +msgid "" +"@NamedNativeQuery(name=\"implicitSample\", query=\"select * from SpaceShip" +"\", resultClass=SpaceShip.class)\n" +"public class SpaceShip {" +msgstr "" + +#. Tag: para +#: query_sql.xml:517 +#, no-c-format +msgid "" +"In some of your native queries, you'll have to return scalar values, for " +"example when building report queries. You can map them in the " +"@SqlResultsetMapping through @ColumnResult. You actually can even mix, entities and scalar returns in the same " +"native query (this is probably not that common though)." +msgstr "" + +#. Tag: title +#: query_sql.xml:525 +#, no-c-format +msgid "Scalar values via @ColumnResult" +msgstr "" + +#. Tag: programlisting +#: query_sql.xml:527 +#, no-c-format +msgid "" +"@SqlResultSetMapping(name=\"scalar\", columns=@ColumnResult(name=\"dimension" +"\"))\n" +"@NamedNativeQuery(name=\"scalar\", query=\"select length*width as dimension " +"from SpaceShip\", resultSetMapping=\"scalar\")" +msgstr "" + +#. Tag: para +#: query_sql.xml:530 +#, no-c-format +msgid "" +"An other query hint specific to native queries has been introduced: " +"org.hibernate.callable which can be true or false " +"depending on whether the query is a stored procedure or not." +msgstr "" + +#. Tag: title +#: query_sql.xml:535 #, no-c-format msgid "Using return-property to explicitly specify column/alias names" msgstr "" @@ -688,6 +1331,7 @@ msgstr "" "colonnes/alias" #. Tag: para +#: query_sql.xml:538 #, no-c-format msgid "" "You can explicitly tell Hibernate what column aliases to use with " @@ -699,7 +1343,25 @@ msgstr "" "syntaxe {} pour laisser Hibernate injecter ses propres " "alias. Par exemple :" +#. Tag: programlisting +#: query_sql.xml:543 +#, no-c-format +msgid "" +"<sql-query name=\"mySqlQuery\">\n" +" <return alias=\"person\" class=\"eg.Person\">\n" +" <return-property name=\"name\" column=\"myName\"/>\n" +" <return-property name=\"age\" column=\"myAge\"/>\n" +" <return-property name=\"sex\" column=\"mySex\"/>\n" +" </return>\n" +" SELECT person.NAME AS myName,\n" +" person.AGE AS myAge,\n" +" person.SEX AS mySex,\n" +" FROM PERSON person WHERE person.NAME LIKE :name\n" +"</sql-query>" +msgstr "" + #. Tag: para +#: query_sql.xml:545 #, no-c-format msgid "" "<return-property> also works with multiple columns. " @@ -711,7 +1373,29 @@ msgstr "" "literal> qui ne permet pas une fine granularité des propriétés multi-" "colonnes. " +#. Tag: programlisting +#: query_sql.xml:550 +#, no-c-format +msgid "" +"<sql-query name=\"organizationCurrentEmployments\">\n" +" <return alias=\"emp\" class=\"Employment\">\n" +" <return-property name=\"salary\">\n" +" <return-column name=\"VALUE\"/>\n" +" <return-column name=\"CURRENCY\"/>\n" +" </return-property>\n" +" <return-property name=\"endDate\" column=\"myEndDate\"/>\n" +" </return>\n" +" SELECT EMPLOYEE AS {emp.employee}, EMPLOYER AS {emp.employer},\n" +" STARTDATE AS {emp.startDate}, ENDDATE AS {emp.endDate},\n" +" REGIONCODE as {emp.regionCode}, EID AS {emp.id}, VALUE, CURRENCY\n" +" FROM EMPLOYMENT\n" +" WHERE EMPLOYER = :id AND ENDDATE IS NULL\n" +" ORDER BY STARTDATE ASC\n" +"</sql-query>" +msgstr "" + #. Tag: para +#: query_sql.xml:552 #, no-c-format msgid "" "In this example <return-property> was used in " @@ -724,6 +1408,7 @@ msgstr "" "veulent référencer les colonnes et les propriétés. " #. Tag: para +#: query_sql.xml:557 #, no-c-format msgid "" "If your mapping has a discriminator you must use <return-" @@ -733,11 +1418,13 @@ msgstr "" "discriminator> pour spécifier la colonne discriminante." #. Tag: title +#: query_sql.xml:563 #, no-c-format msgid "Using stored procedures for querying" msgstr "Utilisation de procédures stockées pour les requêtes" #. Tag: para +#: query_sql.xml:565 #, no-c-format msgid "" "Hibernate3 provides support for queries via stored procedures and functions. " @@ -753,14 +1440,55 @@ msgstr "" "fonctionner avec Hibernate. Voici un exemple d'une telle procédure stockée " "en Oracle 9 et version supérieure : " +#. Tag: programlisting +#: query_sql.xml:571 +#, no-c-format +msgid "" +"CREATE OR REPLACE FUNCTION selectAllEmployments\n" +" RETURN SYS_REFCURSOR\n" +"AS\n" +" st_cursor SYS_REFCURSOR;\n" +"BEGIN\n" +" OPEN st_cursor FOR\n" +" SELECT EMPLOYEE, EMPLOYER,\n" +" STARTDATE, ENDDATE,\n" +" REGIONCODE, EID, VALUE, CURRENCY\n" +" FROM EMPLOYMENT;\n" +" RETURN st_cursor;\n" +" END;" +msgstr "" + #. Tag: para +#: query_sql.xml:573 #, no-c-format msgid "To use this query in Hibernate you need to map it via a named query." msgstr "" "Pour utiliser cette requête dans Hibernate vous avez besoin de la mapper via " "une requête nommée." +#. Tag: programlisting +#: query_sql.xml:576 +#, no-c-format +msgid "" +"<sql-query name=\"selectAllEmployees_SP\" callable=\"true\">\n" +" <return alias=\"emp\" class=\"Employment\">\n" +" <return-property name=\"employee\" column=\"EMPLOYEE\"/>\n" +" <return-property name=\"employer\" column=\"EMPLOYER\"/>\n" +" <return-property name=\"startDate\" column=\"STARTDATE\"/>\n" +" <return-property name=\"endDate\" column=\"ENDDATE\"/>\n" +" <return-property name=\"regionCode\" column=\"REGIONCODE\"/>\n" +" <return-property name=\"id\" column=\"EID\"/>\n" +" <return-property name=\"salary\">\n" +" <return-column name=\"VALUE\"/>\n" +" <return-column name=\"CURRENCY\"/>\n" +" </return-property>\n" +" </return>\n" +" { ? = call selectAllEmployments() }\n" +"</sql-query>" +msgstr "" + #. Tag: para +#: query_sql.xml:578 #, no-c-format msgid "" "Stored procedures currently only return scalars and entities. <" @@ -772,11 +1500,13 @@ msgstr "" "<load-collection> ne sont pas supportés. " #. Tag: title +#: query_sql.xml:583 #, no-c-format msgid "Rules/limitations for using stored procedures" msgstr "Règles/limitations lors de l'utilisation des procédures stockées" #. Tag: para +#: query_sql.xml:585 #, no-c-format msgid "" "You cannot use stored procedures with Hibernate unless you follow some " @@ -795,6 +1525,7 @@ msgstr "" "pour les procédures stockées. " #. Tag: para +#: query_sql.xml:593 #, no-c-format msgid "" "Stored procedure queries cannot be paged with setFirstResult()/" @@ -804,6 +1535,7 @@ msgstr "" "setFirstResult()/setMaxResults(). " #. Tag: para +#: query_sql.xml:596 #, no-c-format msgid "" "The recommended call form is standard SQL92: { ? = call functionName" @@ -816,11 +1548,13 @@ msgstr "" "pas supportée." #. Tag: para +#: query_sql.xml:601 #, no-c-format msgid "For Oracle the following rules apply:" msgstr "Pour Oracle les règles suivantes sont applicables :" #. Tag: para +#: query_sql.xml:605 #, no-c-format msgid "" "A function must return a result set. The first parameter of a procedure must " @@ -836,11 +1570,13 @@ msgstr "" "type REF CURSOR, consultez la documentation Oracle. " #. Tag: para +#: query_sql.xml:614 #, no-c-format msgid "For Sybase or MS SQL server the following rules apply:" msgstr "Pour Sybase ou MS SQL server les règles suivantes sont applicables :" #. Tag: para +#: query_sql.xml:618 #, no-c-format msgid "" "The procedure must return a result set. Note that since these servers can " @@ -855,6 +1591,7 @@ msgstr "" "reste sera ignoré. " #. Tag: para +#: query_sql.xml:626 #, no-c-format msgid "" "If you can enable SET NOCOUNT ON in your procedure it " @@ -865,75 +1602,174 @@ msgstr "" "obligation." #. Tag: title +#: query_sql.xml:636 #, no-c-format msgid "Custom SQL for create, update and delete" msgstr "SQL personnalisé pour créer, mettre à jour et effacer" #. Tag: para +#: query_sql.xml:638 #, no-c-format msgid "" "Hibernate3 can use custom SQL for create, update, and delete operations. The " "SQL can be overridden at the statement level or inidividual column level. " "This section describes statement overrides. For columns, see ." +"\"mapping-column-read-and-write\"/>. shows how to define custom SQL operatons using annotations." +msgstr "" + +#. Tag: title +#: query_sql.xml:646 +#, no-c-format +msgid "Custom CRUD via annotations" +msgstr "" + +#. Tag: programlisting +#: query_sql.xml:648 +#, no-c-format +msgid "" +"@Entity\n" +"@Table(name=\"CHAOS\")\n" +"@SQLInsert( sql=\"INSERT INTO CHAOS(size, name, nickname, id) VALUES(?,upper" +"(?),?,?)\")\n" +"@SQLUpdate( sql=\"UPDATE CHAOS SET size = ?, name = upper(?), nickname = ? " +"WHERE id = ?\")\n" +"@SQLDelete( sql=\"DELETE CHAOS WHERE id = ?\")\n" +"@SQLDeleteAll( sql=\"DELETE CHAOS\")\n" +"@Loader(namedQuery = \"chaos\")\n" +"@NamedNativeQuery(name=\"chaos\", query=\"select id, size, name, lower" +"( nickname ) as nickname from CHAOS where id= ?\", resultClass = Chaos." +"class)\n" +"public class Chaos {\n" +" @Id\n" +" private Long id;\n" +" private Long size;\n" +" private String name;\n" +" private String nickname;" msgstr "" #. Tag: para +#: query_sql.xml:651 +#, no-c-format +msgid "" +"@SQLInsert, @SQLUpdate, " +"@SQLDelete, @SQLDeleteAll respectively " +"override the INSERT, UPDATE, DELETE, and DELETE all statement. The same can " +"be achieved using Hibernate mapping files and the <sql-insert>" +", <sql-update> and <sql-" +"delete> nodes. This can be seen in ." +msgstr "" + +#. Tag: title +#: query_sql.xml:661 +#, no-c-format +msgid "Custom CRUD XML" +msgstr "" + +#. Tag: programlisting +#: query_sql.xml:663 +#, no-c-format +msgid "" +"<class name=\"Person\">\n" +" <id name=\"id\">\n" +" <generator class=\"increment\"/>\n" +" </id>\n" +" <property name=\"name\" not-null=\"true\"/>\n" +" <sql-insert>INSERT INTO PERSON (NAME, ID) VALUES ( UPPER(?), ? )" +"</sql-insert>\n" +" <sql-update>UPDATE PERSON SET NAME=UPPER(?) WHERE ID=?</sql-" +"update>\n" +" <sql-delete>DELETE FROM PERSON WHERE ID=?</sql-delete>\n" +"</class>" +msgstr "" + +#. Tag: para +#: query_sql.xml:666 +#, no-c-format +msgid "" +"If you expect to call a store procedure, be sure to set the " +"callable attribute to true. In " +"annotations as well as in xml." +msgstr "" + +#. Tag: para +#: query_sql.xml:670 +#, no-c-format +msgid "" +"To check that the execution happens correctly, Hibernate allows you to " +"define one of those three strategies:" +msgstr "" + +#. Tag: para +#: query_sql.xml:675 +#, no-c-format +msgid "" +"none: no check is performed: the store procedure is expected to fail upon " +"issues" +msgstr "" + +#. Tag: para +#: query_sql.xml:680 +#, no-c-format +msgid "count: use of rowcount to check that the update is successful" +msgstr "" + +#. Tag: para +#: query_sql.xml:685 +#, no-c-format +msgid "" +"param: like COUNT but using an output parameter rather that the standard " +"mechanism" +msgstr "" + +#. Tag: para +#: query_sql.xml:690 +#, no-c-format +msgid "" +"To define the result check style, use the check parameter " +"which is again available in annoations as well as in xml." +msgstr "" + +#. Tag: para +#: query_sql.xml:693 +#, no-c-format +msgid "" +"You can use the exact same set of annotations respectively xml nodes to " +"override the collection related statements -see ." +msgstr "" + +#. Tag: title +#: query_sql.xml:698 +#, no-c-format +msgid "Overriding SQL statements for collections using annotations" +msgstr "" + +#. Tag: programlisting +#: query_sql.xml:701 +#, no-c-format +msgid "" +"@OneToMany\n" +"@JoinColumn(name=\"chaos_fk\")\n" +"@SQLInsert( sql=\"UPDATE CASIMIR_PARTICULE SET chaos_fk = ? where id = ?\")\n" +"@SQLDelete( sql=\"UPDATE CASIMIR_PARTICULE SET chaos_fk = null where id = ?" +"\")\n" +"private Set<CasimirParticle> particles = new HashSet<" +"CasimirParticle>();" +msgstr "" + +#. Tag: para +#: query_sql.xml:705 #, fuzzy, no-c-format msgid "" -"The class and collection persisters in Hibernate already contain a set of " -"configuration time generated strings (insertsql, deletesql, updatesql etc.). " -"The mapping tags <sql-insert>, <sql-" -"delete>, and <sql-update> override " -"these strings:" -msgstr "" -"Hibernate3 peut utiliser des expressions SQL personnalisées pour des " -"opérations de création, de mise à jour, et de suppression. Les objets " -"persistants les classes et les collections dans Hibernate contiennent déjà " -"un ensemble de chaînes de caractères générées lors de la configuration " -"(insertsql, deletesql, updatesql, etc). Les balises de mappage <" -"sql-insert>, <sql-delete>, et " -"<sql-update> surchargent ces chaînes de caractères :" - -#. Tag: para -#, no-c-format -msgid "" -"The SQL is directly executed in your database, so you can use any dialect " -"you like. This will reduce the portability of your mapping if you use " -"database specific SQL." -msgstr "" -"Le SQL est directement exécuté dans votre base de données, donc vous êtes " -"libre d'utiliser le dialecte que vous souhaitez. Cela réduira bien sûr la " -"portabilité de votre mappage si vous utilisez du SQL spécifique à votre base " -"de données. " - -#. Tag: para -#, no-c-format -msgid "" -"Stored procedures are supported if the callable attribute " -"is set:" -msgstr "" -"Les procédures stockées sont supportées si l'attribut callable est paramétré :" - -#. Tag: para -#, no-c-format -msgid "" -"The order of the positional parameters is vital, as they must be in the same " -"sequence as Hibernate expects them." -msgstr "" -"L'ordre des paramètres de position est essentiel, car ils doivent être dans " -"la séquence attendue par Hibernate. " - -#. Tag: para -#, no-c-format -msgid "" -"You can view the expected order by enabling debug logging for the " -"org.hibernate.persister.entity level. With this level " -"enabled, Hibernate will print out the static SQL that is used to create, " -"update, delete etc. entities. To view the expected sequence, do not include " -"your custom SQL in the mapping files, as this will override the Hibernate " -"generated static SQL." +"The parameter order is important and is defined by the order Hibernate " +"handles properties. You can see the expected order by enabling debug logging " +"for the org.hibernate.persister.entity level. With this " +"level enabled Hibernate will print out the static SQL that is used to " +"create, update, delete etc. entities. (To see the expected sequence, " +"remember to not include your custom SQL through annotations or mapping files " +"as that will override the Hibernate generated static sql)" msgstr "" "Vous pouvez voir l'ordre attendu en activant la journalisation de débogage " "pour le niveau org.hibernate.persister.entity. Avec ce " @@ -944,12 +1780,68 @@ msgstr "" "Hibernate." #. Tag: para +#: query_sql.xml:715 #, no-c-format msgid "" -"The stored procedures are in most cases required to return the number of " -"rows inserted, updated and deleted, as Hibernate has some runtime checks for " -"the success of the statement. Hibernate always registers the first statement " -"parameter as a numeric output parameter for the CUD operations:" +"Overriding SQL statements for secondary tables is also possible using " +"@org.hibernate.annotations.Table and either (or all) " +"attributes sqlInsert, sqlUpdate, " +"sqlDelete:" +msgstr "" + +#. Tag: title +#: query_sql.xml:721 +#, no-c-format +msgid "Overriding SQL statements for secondary tables" +msgstr "" + +#. Tag: programlisting +#: query_sql.xml:723 +#, no-c-format +msgid "" +"@Entity\n" +"@SecondaryTables({\n" +" @SecondaryTable(name = \"`Cat nbr1`\"),\n" +" @SecondaryTable(name = \"Cat2\"})\n" +"@org.hibernate.annotations.Tables( {\n" +" @Table(appliesTo = \"Cat\", comment = \"My cat table\" ),\n" +" @Table(appliesTo = \"Cat2\", foreignKey = @ForeignKey(name=\"FK_CAT2_CAT" +"\"), fetch = FetchMode.SELECT,\n" +" sqlInsert=@SQLInsert(sql=\"insert into Cat2(storyPart2, id) values" +"(upper(?), ?)\") )\n" +"} )\n" +"public class Cat implements Serializable {" +msgstr "" + +#. Tag: para +#: query_sql.xml:726 +#, no-c-format +msgid "" +"The previous example also shows that you can give a comment to a given table " +"(primary or secondary): This comment will be used for DDL generation." +msgstr "" + +#. Tag: para +#: query_sql.xml:731 +#, fuzzy, no-c-format +msgid "" +"The SQL is directly executed in your database, so you can use any dialect " +"you like. This will, however, reduce the portability of your mapping if you " +"use database specific SQL." +msgstr "" +"Le SQL est directement exécuté dans votre base de données, donc vous êtes " +"libre d'utiliser le dialecte que vous souhaitez. Cela réduira bien sûr la " +"portabilité de votre mappage si vous utilisez du SQL spécifique à votre base " +"de données. " + +#. Tag: para +#: query_sql.xml:736 +#, fuzzy, no-c-format +msgid "" +"Last but not least, stored procedures are in most cases required to return " +"the number of rows inserted, updated and deleted. Hibernate always registers " +"the first statement parameter as a numeric output parameter for the CUD " +"operations:" msgstr "" "Les procédures stockées sont dans la plupart des cas (lire : il vaut mieux " "le faire) requises pour retourner le nombre de lignes insérées/mises à jour/" @@ -959,21 +1851,62 @@ msgstr "" "CUD : " #. Tag: title +#: query_sql.xml:742 +#, no-c-format +msgid "Stored procedures and their return value" +msgstr "" + +#. Tag: programlisting +#: query_sql.xml:744 +#, no-c-format +msgid "" +"CREATE OR REPLACE FUNCTION updatePerson (uid IN NUMBER, uname IN VARCHAR2)\n" +" RETURN NUMBER IS\n" +"BEGIN\n" +"\n" +" update PERSON\n" +" set\n" +" NAME = uname,\n" +" where\n" +" ID = uid;\n" +"\n" +" return SQL%ROWCOUNT;\n" +"\n" +"END updatePerson;" +msgstr "" + +#. Tag: title +#: query_sql.xml:749 #, no-c-format msgid "Custom SQL for loading" msgstr "SQL personnalisé pour le chargement" #. Tag: para +#: query_sql.xml:751 #, no-c-format msgid "" "You can also declare your own SQL (or HQL) queries for entity loading. As " "with inserts, updates, and deletes, this can be done at the individual " -"column level as described in or at the statement level. Here is an example of a statement level " +"column level as described in or at the statement level. Here is an example of a statement level " "override:" msgstr "" +#. Tag: programlisting +#: query_sql.xml:757 +#, no-c-format +msgid "" +"<sql-query name=\"person\">\n" +" <return alias=\"pers\" class=\"Person\" lock-mode=\"upgrade\"/>\n" +" SELECT NAME AS {pers.name}, ID AS {pers.id}\n" +" FROM PERSON\n" +" WHERE ID=?\n" +" FOR UPDATE\n" +"</sql-query>" +msgstr "" + #. Tag: para +#: query_sql.xml:759 #, no-c-format msgid "" "This is just a named query declaration, as discussed earlier. You can " @@ -982,18 +1915,58 @@ msgstr "" "Ceci est juste une déclaration de requête nommée, comme vu précédemment. " "Vous pouvez référencer cette requête nommée dans un mappage de classe : " +#. Tag: programlisting +#: query_sql.xml:762 +#, no-c-format +msgid "" +"<class name=\"Person\">\n" +" <id name=\"id\">\n" +" <generator class=\"increment\"/>\n" +" </id>\n" +" <property name=\"name\" not-null=\"true\"/>\n" +" <loader query-ref=\"person\"/>\n" +"</class>" +msgstr "" + #. Tag: para +#: query_sql.xml:764 #, no-c-format msgid "This even works with stored procedures." msgstr "Ceci fonctionne même avec des procédures stockées." #. Tag: para +#: query_sql.xml:766 #, no-c-format msgid "You can even define a query for collection loading:" msgstr "" "Vous pouvez même définir une requête pour le chargement d'une collection : " +#. Tag: programlisting +#: query_sql.xml:768 +#, no-c-format +msgid "" +"<set name=\"employments\" inverse=\"true\">\n" +" <key/>\n" +" <one-to-many class=\"Employment\"/>\n" +" <loader query-ref=\"employments\"/>\n" +"</set>" +msgstr "" + +#. Tag: programlisting +#: query_sql.xml:770 +#, no-c-format +msgid "" +"<sql-query name=\"employments\">\n" +" <load-collection alias=\"emp\" role=\"Person.employments\"/>\n" +" SELECT {emp.*}\n" +" FROM EMPLOYMENT emp\n" +" WHERE EMPLOYER = :id\n" +" ORDER BY STARTDATE ASC, EMPLOYEE ASC\n" +"</sql-query>" +msgstr "" + #. Tag: para +#: query_sql.xml:772 #, no-c-format msgid "" "You can also define an entity loader that loads a collection by join " @@ -1002,56 +1975,121 @@ msgstr "" "Vous pourriez même définir un chargeur d'entité qui charge une collection " "par jointure : " +#. Tag: programlisting +#: query_sql.xml:775 +#, no-c-format +msgid "" +"<sql-query name=\"person\">\n" +" <return alias=\"pers\" class=\"Person\"/>\n" +" <return-join alias=\"emp\" property=\"pers.employments\"/>\n" +" SELECT NAME AS {pers.*}, {emp.*}\n" +" FROM PERSON pers\n" +" LEFT OUTER JOIN EMPLOYMENT emp\n" +" ON pers.ID = emp.PERSON_ID\n" +" WHERE ID=?\n" +"</sql-query>" +msgstr "" + +#. Tag: para +#: query_sql.xml:777 +#, no-c-format +msgid "" +"The annotation equivalent <loader> is the @Loader " +"annotation as seen in ." +msgstr "" + +#, fuzzy +#~ msgid "A_NAME as {item.name}" +#~ msgstr "{item.*}" + +#, fuzzy +#~ msgid "{[aliasname].class}" +#~ msgstr "{item.*}" + +#, fuzzy +#~ msgid "DISC as {item.class}" +#~ msgstr "{item.*}" + +#, fuzzy +#~ msgid "{[aliasname].*}" +#~ msgstr "{item.*}" + +#~ msgid "{item.*}" +#~ msgstr "{item.*}" + +#, fuzzy +#~ msgid "{[aliasname].key}" +#~ msgstr "{item.*}" + +#, fuzzy +#~ msgid "ORGID as {coll.key}" +#~ msgstr "{coll.*}" + +#, fuzzy +#~ msgid "{[aliasname].id}" +#~ msgstr "{item.*}" + +#, fuzzy +#~ msgid "EMPID as {coll.id}" +#~ msgstr "{coll.*}" + +#, fuzzy +#~ msgid "{[aliasname].element}" +#~ msgstr "{item.*}" + +#, fuzzy +#~ msgid "XID as {coll.element}" +#~ msgstr "{coll.*}" + +#, fuzzy +#~ msgid "NAME as {coll.element.name}" +#~ msgstr "NAME as {coll.element.name}" + +#, fuzzy +#~ msgid "{[aliasname].element.*}" +#~ msgstr "{item.*}" + +#, fuzzy +#~ msgid "{coll.element.*}" +#~ msgstr "{coll.*}" + +#~ msgid "{coll.*}" +#~ msgstr "{coll.*}" + +#, fuzzy +#~ msgid "" +#~ "The class and collection persisters in Hibernate already contain a set of " +#~ "configuration time generated strings (insertsql, deletesql, updatesql " +#~ "etc.). The mapping tags <sql-insert>, " +#~ "<sql-delete>, and <sql-update> override these strings:" +#~ msgstr "" +#~ "Hibernate3 peut utiliser des expressions SQL personnalisées pour des " +#~ "opérations de création, de mise à jour, et de suppression. Les objets " +#~ "persistants les classes et les collections dans Hibernate contiennent " +#~ "déjà un ensemble de chaînes de caractères générées lors de la " +#~ "configuration (insertsql, deletesql, updatesql, etc). Les balises de " +#~ "mappage <sql-insert>, <sql-delete>" +#~ ", et <sql-update> surchargent ces " +#~ "chaînes de caractères :" + +#~ msgid "" +#~ "Stored procedures are supported if the callable " +#~ "attribute is set:" +#~ msgstr "" +#~ "Les procédures stockées sont supportées si l'attribut callable est paramétré :" + +#~ msgid "" +#~ "The order of the positional parameters is vital, as they must be in the " +#~ "same sequence as Hibernate expects them." +#~ msgstr "" +#~ "L'ordre des paramètres de position est essentiel, car ils doivent être " +#~ "dans la séquence attendue par Hibernate. " + #~ msgid "" #~ "You can also declare your own SQL (or HQL) queries for entity loading:" #~ msgstr "" #~ "Vous pouvez aussi déclarer vos propres requêtes SQL (ou HQL) pour le " #~ "chargement d'entité : " - -#, fuzzy -#~ msgid "A_NAME as {item.name}" -#~ msgstr "A_NAME as {item.name}" - -#, fuzzy -#~ msgid "{[aliasname].class}" -#~ msgstr "{[aliasname].class}" - -#, fuzzy -#~ msgid "DISC as {item.class}" -#~ msgstr "DISC as {item.class}" - -#, fuzzy -#~ msgid "{[aliasname].*}" -#~ msgstr "{[aliasname].*}" - -#, fuzzy -#~ msgid "{[aliasname].key}" -#~ msgstr "{[aliasname].key}" - -#, fuzzy -#~ msgid "ORGID as {coll.key}" -#~ msgstr "ORGID as {coll.key}" - -#, fuzzy -#~ msgid "{[aliasname].id}" -#~ msgstr "{[aliasname].id}" - -#, fuzzy -#~ msgid "EMPID as {coll.id}" -#~ msgstr "EMPID as {coll.id}" - -#, fuzzy -#~ msgid "{[aliasname].element}" -#~ msgstr "{[aliasname].element}" - -#, fuzzy -#~ msgid "XID as {coll.element}" -#~ msgstr "XID as {coll.element}" - -#, fuzzy -#~ msgid "{[aliasname].element.*}" -#~ msgstr "{[aliasname].element.*}" - -#, fuzzy -#~ msgid "{coll.element.*}" -#~ msgstr "{coll.element.*}" diff --git a/documentation/manual/src/main/docbook/fr-FR/content/session_api.po b/documentation/manual/src/main/docbook/fr-FR/content/session_api.po index d7d84193b9..c40ca087a6 100644 --- a/documentation/manual/src/main/docbook/fr-FR/content/session_api.po +++ b/documentation/manual/src/main/docbook/fr-FR/content/session_api.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: session_api\n" "Report-Msgid-Bugs-To: http://bugs.kde.org\n" -"POT-Creation-Date: 2010-03-12T00:03:48\n" +"POT-Creation-Date: 2010-07-20 21:02+0000\n" "PO-Revision-Date: 2010-01-05 09:57+1000\n" "Last-Translator: Corina Roe \n" "Language-Team: French \n" @@ -17,11 +17,13 @@ msgstr "" "X-Generator: KBabel 1.11.4\n" #. Tag: title +#: session_api.xml:31 #, no-c-format msgid "Working with objects" msgstr "Travailler avec des objets" #. Tag: para +#: session_api.xml:33 #, no-c-format msgid "" "Hibernate is a full object/relational mapping solution that not only shields " @@ -40,6 +42,7 @@ msgstr "" "persistance dans les applications Java." #. Tag: para +#: session_api.xml:40 #, no-c-format msgid "" "In other words, Hibernate application developers should always think about " @@ -55,16 +58,19 @@ msgstr "" "lors du réglage de la performance de leur système." #. Tag: title +#: session_api.xml:47 #, no-c-format msgid "Hibernate object states" msgstr "États des objets Hibernate" #. Tag: para +#: session_api.xml:49 #, no-c-format msgid "Hibernate defines and supports the following object states:" msgstr "Hibernate définit et prend en charge les états d'objets suivants :" #. Tag: para +#: session_api.xml:53 #, no-c-format msgid "" "Transient - an object is transient if it has just been " @@ -87,6 +93,7 @@ msgstr "" "exécutées pour cette transistion)." #. Tag: para +#: session_api.xml:65 #, no-c-format msgid "" "Persistent - a persistent instance has a representation " @@ -109,6 +116,7 @@ msgstr "" "rendu éphémère. " #. Tag: para +#: session_api.xml:77 #, no-c-format msgid "" "Detached - a detached instance is an object that has " @@ -133,6 +141,7 @@ msgstr "" "unité de travail du point de vue de l'utilisateur. " #. Tag: para +#: session_api.xml:90 #, no-c-format msgid "" "We will now discuss the states and state transitions (and the Hibernate " @@ -142,11 +151,13 @@ msgstr "" "d'état (et des méthodes Hibernate qui déclenchent une transition)." #. Tag: title +#: session_api.xml:95 #, no-c-format msgid "Making objects persistent" msgstr "Rendre des objets persistants" #. Tag: para +#: session_api.xml:97 #, fuzzy, no-c-format msgid "" "Newly instantiated instances of a persistent class are considered " @@ -158,7 +169,19 @@ msgstr "" "rendre une instance éphémère persistante en l'associant " "à une session :" +#. Tag: programlisting +#: session_api.xml:102 +#, no-c-format +msgid "" +"DomesticCat fritz = new DomesticCat();\n" +"fritz.setColor(Color.GINGER);\n" +"fritz.setSex('M');\n" +"fritz.setName(\"Fritz\");\n" +"Long generatedId = (Long) sess.save(fritz);" +msgstr "" + #. Tag: para +#: session_api.xml:104 #, no-c-format msgid "" "If Cat has a generated identifier, the identifier is " @@ -180,6 +203,7 @@ msgstr "" "première ébauche d'EJB3. " #. Tag: para +#: session_api.xml:115 #, no-c-format msgid "" "persist() makes a transient instance persistent. However, " @@ -199,6 +223,7 @@ msgstr "" "conversations dans un contexte de session/persistance étendu." #. Tag: para +#: session_api.xml:126 #, no-c-format msgid "" "save() does guarantee to return an identifier. If an " @@ -215,6 +240,7 @@ msgstr "" "contexte de session/persistance étendu." #. Tag: para +#: session_api.xml:135 #, no-c-format msgid "" "Alternatively, you can assign the identifier using an overloaded version of " @@ -223,7 +249,21 @@ msgstr "" "Alternativement, vous pouvez assigner l'identifiant en utilisant une version " "surchargée de save(). " +#. Tag: programlisting +#: session_api.xml:138 +#, no-c-format +msgid "" +"DomesticCat pk = new DomesticCat();\n" +"pk.setColor(Color.TABBY);\n" +"pk.setSex('F');\n" +"pk.setName(\"PK\");\n" +"pk.setKittens( new HashSet() );\n" +"pk.addKitten(fritz);\n" +"sess.save( pk, new Long(1234) );" +msgstr "" + #. Tag: para +#: session_api.xml:140 #, no-c-format msgid "" "If the object you make persistent has associated objects (e.g. the " @@ -244,6 +284,7 @@ msgstr "" "mauvais ordre. " #. Tag: para +#: session_api.xml:148 #, no-c-format msgid "" "Usually you do not bother with this detail, as you will normally use " @@ -260,11 +301,13 @@ msgstr "" "transitive est traitée plus loin dans ce chapitre. " #. Tag: title +#: session_api.xml:157 #, no-c-format msgid "Loading an object" msgstr "Chargement d'un objet" #. Tag: para +#: session_api.xml:159 #, no-c-format msgid "" "The load() methods of Session provide " @@ -278,13 +321,40 @@ msgstr "" "chargera l'état dans une instance nouvellement instanciée de cette classe, " "dans un état persistant. " +#. Tag: programlisting +#: session_api.xml:165 +#, no-c-format +msgid "Cat fritz = (Cat) sess.load(Cat.class, generatedId);" +msgstr "" + +#. Tag: programlisting +#: session_api.xml:167 +#, no-c-format +msgid "" +"// you need to wrap primitive identifiers\n" +"long id = 1234;\n" +"DomesticCat pk = (DomesticCat) sess.load( DomesticCat.class, new Long(id) );" +msgstr "" + #. Tag: para +#: session_api.xml:169 #, no-c-format msgid "Alternatively, you can load state into a given instance:" msgstr "" "Alternativement, vous pouvez charger un état dans une instance donnée :" +#. Tag: programlisting +#: session_api.xml:171 +#, no-c-format +msgid "" +"Cat cat = new DomesticCat();\n" +"// load pk's state into cat\n" +"sess.load( cat, new Long(pkId) );\n" +"Set kittens = cat.getKittens();" +msgstr "" + #. Tag: para +#: session_api.xml:173 #, no-c-format msgid "" "Be aware that load() will throw an unrecoverable " @@ -307,6 +377,7 @@ msgstr "" "pour le mapping de la classe. " #. Tag: para +#: session_api.xml:182 #, no-c-format msgid "" "If you are not certain that a matching row exists, you should use the " @@ -318,7 +389,20 @@ msgstr "" "données immédiatement et retourne null s'il n'y a pas de ligne " "correspondante. " +#. Tag: programlisting +#: session_api.xml:186 +#, no-c-format +msgid "" +"Cat cat = (Cat) sess.get(Cat.class, id);\n" +"if (cat==null) {\n" +" cat = new Cat();\n" +" sess.save(cat, id);\n" +"}\n" +"return cat;" +msgstr "" + #. Tag: para +#: session_api.xml:188 #, no-c-format msgid "" "You can even load an object using an SQL SELECT ... FOR UPDATE, en utilisant un LockMode. Voir la " "documentation de l'API pour plus d'informations. " +#. Tag: programlisting +#: session_api.xml:192 +#, no-c-format +msgid "Cat cat = (Cat) sess.get(Cat.class, id, LockMode.UPGRADE);" +msgstr "" + #. Tag: para +#: session_api.xml:194 #, no-c-format msgid "" "Any associated instances or contained collections will notall en tant que style de cascade pour l'association." #. Tag: para +#: session_api.xml:199 #, no-c-format msgid "" "It is possible to re-load an object and all its collections at any time, " @@ -354,13 +446,23 @@ msgstr "" "lorsque des \"triggers\" de base de données sont utilisés pour initialiser " "certaines propriétés de l'objet." +#. Tag: programlisting +#: session_api.xml:204 +#, no-c-format +msgid "" +"sess.save(cat);\n" +"sess.flush(); //force the SQL INSERT\n" +"sess.refresh(cat); //re-read the state (after the trigger executes)" +msgstr "" + #. Tag: para +#: session_api.xml:206 #, fuzzy, no-c-format msgid "" "How much does Hibernate load from the database and how many SQL " "SELECTs will it use? This depends on the " "fetching strategy. This is explained in ." +"\"performance-fetching\"/>." msgstr "" "Combien de données Hibernate charge-t-il de la base de données et combien de " "SELECTs utilisera-t-il ? Cela dépend de la " @@ -368,11 +470,13 @@ msgstr "" "." #. Tag: title +#: session_api.xml:213 #, no-c-format msgid "Querying" msgstr "Requêtage" #. Tag: para +#: session_api.xml:215 #, no-c-format msgid "" "If you do not know the identifiers of the objects you are looking for, you " @@ -392,11 +496,13 @@ msgstr "" "objets. " #. Tag: title +#: session_api.xml:224 #, no-c-format msgid "Executing queries" msgstr "Exécution de requêtes" #. Tag: para +#: session_api.xml:226 #, no-c-format msgid "" "HQL and native SQL queries are represented with an instance of org." @@ -411,7 +517,38 @@ msgstr "" "l'exécution de la requête réelle. Vous obtenez toujours une Query en utilisant la Session courante : " +#. Tag: programlisting +#: session_api.xml:232 +#, no-c-format +msgid "" +"List cats = session.createQuery(\n" +" \"from Cat as cat where cat.birthdate < ?\")\n" +" .setDate(0, date)\n" +" .list();\n" +"\n" +"List mothers = session.createQuery(\n" +" \"select mother from Cat as cat join cat.mother as mother where cat.name " +"= ?\")\n" +" .setString(0, name)\n" +" .list();\n" +"\n" +"List kittens = session.createQuery(\n" +" \"from Cat as cat where cat.mother = ?\")\n" +" .setEntity(0, pk)\n" +" .list();\n" +"\n" +"Cat mother = (Cat) session.createQuery(\n" +" \"select cat.mother from Cat as cat where cat = ?\")\n" +" .setEntity(0, izi)\n" +" .uniqueResult();]]\n" +"\n" +"Query mothersWithKittens = (Cat) session.createQuery(\n" +" \"select mother from Cat as mother left join fetch mother.kittens\");\n" +"Set uniqueMothers = new HashSet(mothersWithKittens.list());" +msgstr "" + #. Tag: para +#: session_api.xml:234 #, no-c-format msgid "" "A query is usually executed by invoking list(). The " @@ -434,11 +571,13 @@ msgstr "" "Set. " #. Tag: title +#: session_api.xml:244 #, no-c-format msgid "Iterating results" msgstr "Itération de résultats" #. Tag: para +#: session_api.xml:246 #, no-c-format msgid "" "Occasionally, you might be able to achieve better performance by executing " @@ -462,12 +601,33 @@ msgstr "" "retourne seulement les identifiants, et n selects " "supplémentaires pour initialiser les instances réelles. " +#. Tag: programlisting +#: session_api.xml:257 +#, no-c-format +msgid "" +"// fetch ids\n" +"Iterator iter = sess.createQuery(\"from eg.Qux q order by q.likeliness\")." +"iterate();\n" +"while ( iter.hasNext() ) {\n" +" Qux qux = (Qux) iter.next(); // fetch the object\n" +" // something we couldnt express in the query\n" +" if ( qux.calculateComplicatedAlgorithm() ) {\n" +" // delete the current instance\n" +" iter.remove();\n" +" // dont need to process the rest\n" +" break;\n" +" }\n" +"}" +msgstr "" + #. Tag: title +#: session_api.xml:261 #, no-c-format msgid "Queries that return tuples" msgstr "Requêtes qui retournent des tuples" #. Tag: para +#: session_api.xml:263 #, no-c-format msgid "" "Hibernate queries sometimes return tuples of objects. Each tuple is returned " @@ -476,12 +636,32 @@ msgstr "" "Les requêtes d'Hibernate retournent parfois des tuples d'objets, auquel cas " "chaque tuple est retourné comme un tableau : " +#. Tag: programlisting +#: session_api.xml:266 +#, no-c-format +msgid "" +"Iterator kittensAndMothers = sess.createQuery(\n" +" \"select kitten, mother from Cat kitten join kitten.mother mother" +"\")\n" +" .list()\n" +" .iterator();\n" +"\n" +"while ( kittensAndMothers.hasNext() ) {\n" +" Object[] tuple = (Object[]) kittensAndMothers.next();\n" +" Cat kitten = (Cat) tuple[0];\n" +" Cat mother = (Cat) tuple[1];\n" +" ....\n" +"}" +msgstr "" + #. Tag: title +#: session_api.xml:270 #, no-c-format msgid "Scalar results" msgstr "Résultats scalaires" #. Tag: para +#: session_api.xml:272 #, no-c-format msgid "" "Queries can specify a property of a class in the select " @@ -493,12 +673,34 @@ msgstr "" "d'aggrégat SQL. Les propriétés ou les aggrégats sont considérés comme des " "résultats \"scalaires\" (et non des entités dans un état persistant). " +#. Tag: programlisting +#: session_api.xml:277 +#, no-c-format +msgid "" +"Iterator results = sess.createQuery(\n" +" \"select cat.color, min(cat.birthdate), count(cat) from Cat cat \" " +"+\n" +" \"group by cat.color\")\n" +" .list()\n" +" .iterator();\n" +"\n" +"while ( results.hasNext() ) {\n" +" Object[] row = (Object[]) results.next();\n" +" Color type = (Color) row[0];\n" +" Date oldest = (Date) row[1];\n" +" Integer count = (Integer) row[2];\n" +" .....\n" +"}" +msgstr "" + #. Tag: title +#: session_api.xml:281 #, no-c-format msgid "Bind parameters" msgstr "Lier des paramètres" #. Tag: para +#: session_api.xml:283 #, no-c-format msgid "" "Methods on Query are provided for binding values to named " @@ -515,6 +717,7 @@ msgstr "" "caractères de la requête. Les avantages des paramètres nommés sont : " #. Tag: para +#: session_api.xml:292 #, no-c-format msgid "" "named parameters are insensitive to the order they occur in the query string" @@ -523,21 +726,60 @@ msgstr "" "apparaissent dans la chaîne de la requête" #. Tag: para +#: session_api.xml:297 #, no-c-format msgid "they can occur multiple times in the same query" msgstr "ils peuvent apparaître plusieurs fois dans la même requête " #. Tag: para +#: session_api.xml:301 #, no-c-format msgid "they are self-documenting" msgstr "ils sont auto-documentés" +#. Tag: programlisting +#: session_api.xml:305 +#, no-c-format +msgid "" +"//named parameter (preferred)\n" +"Query q = sess.createQuery(\"from DomesticCat cat where cat.name = :name" +"\");\n" +"q.setString(\"name\", \"Fritz\");\n" +"Iterator cats = q.iterate();" +msgstr "" + +#. Tag: programlisting +#: session_api.xml:307 +#, no-c-format +msgid "" +"//positional parameter\n" +"Query q = sess.createQuery(\"from DomesticCat cat where cat.name = ?\");\n" +"q.setString(0, \"Izi\");\n" +"Iterator cats = q.iterate();" +msgstr "" + +#. Tag: programlisting +#: session_api.xml:309 +#, no-c-format +msgid "" +"//named parameter list\n" +"List names = new ArrayList();\n" +"names.add(\"Izi\");\n" +"names.add(\"Fritz\");\n" +"Query q = sess.createQuery(\"from DomesticCat cat where cat.name in (:" +"namesList)\");\n" +"q.setParameterList(\"namesList\", names);\n" +"List cats = q.list();" +msgstr "" + #. Tag: title +#: session_api.xml:313 #, no-c-format msgid "Pagination" msgstr "Pagination" #. Tag: para +#: session_api.xml:315 #, no-c-format msgid "" "If you need to specify bounds upon your result set, that is, the maximum " @@ -549,7 +791,18 @@ msgstr "" "récupérer) vous utiliserez des méthodes de l'interface Query : " +#. Tag: programlisting +#: session_api.xml:320 +#, no-c-format +msgid "" +"Query q = sess.createQuery(\"from DomesticCat cat\");\n" +"q.setFirstResult(20);\n" +"q.setMaxResults(10);\n" +"List cats = q.list();" +msgstr "" + #. Tag: para +#: session_api.xml:322 #, no-c-format msgid "" "Hibernate knows how to translate this limit query into the native SQL of " @@ -559,11 +812,13 @@ msgstr "" "votre SGBD." #. Tag: title +#: session_api.xml:327 #, no-c-format msgid "Scrollable iteration" msgstr "Itération \"scrollable\"" #. Tag: para +#: session_api.xml:329 #, no-c-format msgid "" "If your JDBC driver supports scrollable ResultSets, the " @@ -576,7 +831,37 @@ msgstr "" "pour obtenir un objet ScrollableResults, qui permettra " "une navigation flexible dans les résultats de la requête. " +#. Tag: programlisting +#: session_api.xml:334 +#, no-c-format +msgid "" +"Query q = sess.createQuery(\"select cat.name, cat from DomesticCat cat \" +\n" +" \"order by cat.name\");\n" +"ScrollableResults cats = q.scroll();\n" +"if ( cats.first() ) {\n" +"\n" +" // find the first name on each page of an alphabetical list of cats by " +"name\n" +" firstNamesOfPages = new ArrayList();\n" +" do {\n" +" String name = cats.getString(0);\n" +" firstNamesOfPages.add(name);\n" +" }\n" +" while ( cats.scroll(PAGE_SIZE) );\n" +"\n" +" // Now get the first page of cats\n" +" pageOfCats = new ArrayList();\n" +" cats.beforeFirst();\n" +" int i=0;\n" +" while( ( PAGE_SIZE > i++ ) && cats.next() ) pageOfCats.add" +"( cats.get(1) );\n" +"\n" +"}\n" +"cats.close()" +msgstr "" + #. Tag: para +#: session_api.xml:336 #, no-c-format msgid "" "Note that an open database connection and cursor is required for this " @@ -589,29 +874,108 @@ msgstr "" "de pagination hors ligne. " #. Tag: title +#: session_api.xml:343 #, no-c-format msgid "Externalizing named queries" msgstr "Externaliser des requêtes nommées" #. Tag: para +#: session_api.xml:345 #, no-c-format msgid "" -"You can also define named queries in the mapping document. Remember to use a " -"CDATA section if your query contains characters that " -"could be interpreted as markup." +"Queries can also be configured as so called named queries using annotations " +"or Hibernate mapping documents. @NamedQuery and " +"@NamedQueries can be defined at the class level as seen " +"in . However their " +"definitions are global to the session factory/entity manager factory scope. " +"A named query is defined by its name and the actual query string." +msgstr "" + +#. Tag: title +#: session_api.xml:355 +#, no-c-format +msgid "Defining a named query using @NamedQuery" +msgstr "" + +#. Tag: programlisting +#: session_api.xml:358 +#, no-c-format +msgid "" +"@Entity\n" +"@NamedQuery(name=\"night.moreRecentThan\", query=\"select n from Night n " +"where n.date >= :date\")\n" +"public class Night {\n" +" ...\n" +"}\n" +"\n" +"public class MyDao {\n" +" doStuff() {\n" +" Query q = s.getNamedQuery(\"night.moreRecentThan\");\n" +" q.setDate( \"date\", aMonthAgo );\n" +" List results = q.list();\n" +" ...\n" +" }\n" +" ...\n" +"}" +msgstr "" + +#. Tag: para +#: session_api.xml:361 +#, fuzzy, no-c-format +msgid "" +"Using a mapping document can be configured using the <query> node. Remember to use a CDATA section if your " +"query contains characters that could be interpreted as markup." msgstr "" "Vous pouvez aussi définir des requêtes nommées dans le document de mapping. " "Souvenez-vous d'utiliser une section CDATA si votre " "requête contient des caractères qui pourraient être interprétés comme des " "éléments XML." -#. Tag: para +#. Tag: title +#: session_api.xml:367 #, no-c-format -msgid "Parameter binding and executing is done programatically:" +msgid "Defining a named query using <query>" +msgstr "" + +#. Tag: programlisting +#: session_api.xml:370 +#, no-c-format +msgid "" +"<query name=\"ByNameAndMaximumWeight\"><![CDATA[\n" +" from eg.DomesticCat as cat\n" +" where cat.name = ?\n" +" and cat.weight > ?\n" +"] ]></query>" +msgstr "" + +#. Tag: para +#: session_api.xml:373 +#, fuzzy, no-c-format +msgid "" +"Parameter binding and executing is done programatically as seen in ." msgstr "" "La liaison de paramètres et l'exécution sont effectués par programmation :" +#. Tag: title +#: session_api.xml:377 +#, no-c-format +msgid "Parameter binding of a named query" +msgstr "" + +#. Tag: programlisting +#: session_api.xml:379 +#, no-c-format +msgid "" +"Query q = sess.getNamedQuery(\"ByNameAndMaximumWeight\");\n" +"q.setString(0, name);\n" +"q.setInt(1, minWeight);\n" +"List cats = q.list();" +msgstr "" + #. Tag: para +#: session_api.xml:382 #, no-c-format msgid "" "The actual program code is independent of the query language that is used. " @@ -624,6 +988,7 @@ msgstr "" "dans les fichiers de mapping. " #. Tag: para +#: session_api.xml:387 #, no-c-format msgid "" "Also note that a query declaration inside a <hibernate-" @@ -640,11 +1005,13 @@ msgstr "" "Cat.ByNameAndMaximumWeight. " #. Tag: title +#: session_api.xml:397 #, no-c-format msgid "Filtering collections" msgstr "Filtrer des collections" #. Tag: para +#: session_api.xml:399 #, no-c-format msgid "" "A collection filter is a special type of query that can " @@ -656,7 +1023,20 @@ msgstr "" "chaîne de requêtes peut se référer à this, correspondant " "à l'élément de la collection courant. " +#. Tag: programlisting +#: session_api.xml:404 +#, no-c-format +msgid "" +"Collection blackKittens = session.createFilter(\n" +" pk.getKittens(), \n" +" \"where this.color = ?\")\n" +" .setParameter( Color.BLACK, Hibernate.custom(ColorUserType.class) )\n" +" .list()\n" +");" +msgstr "" + #. Tag: para +#: session_api.xml:406 #, no-c-format msgid "" "The returned collection is considered a bag that is a copy of the given " @@ -669,6 +1049,7 @@ msgstr "" "comportement attendu." #. Tag: para +#: session_api.xml:411 #, no-c-format msgid "" "Observe that filters do not require a from clause, " @@ -679,7 +1060,18 @@ msgstr "" "literal> (bien qu'ils puissent en avoir une si besoin est). Les filtres ne " "sont pas limités à retourner des éléments de la collection eux-mêmes. " +#. Tag: programlisting +#: session_api.xml:415 +#, no-c-format +msgid "" +"Collection blackKittenMates = session.createFilter(\n" +" pk.getKittens(), \n" +" \"select this.mate where this.color = eg.Color.BLACK.intValue\")\n" +" .list();" +msgstr "" + #. Tag: para +#: session_api.xml:417 #, no-c-format msgid "" "Even an empty filter query is useful, e.g. to load a subset of elements in a " @@ -688,12 +1080,24 @@ msgstr "" "Même une requête de filtre vide est utile, par exemple pour charger un sous-" "ensemble d'éléments dans une énorme collection : " +#. Tag: programlisting +#: session_api.xml:420 +#, no-c-format +msgid "" +"Collection tenKittens = session.createFilter(\n" +" mother.getKittens(), \"\")\n" +" .setFirstResult(0).setMaxResults(10)\n" +" .list();" +msgstr "" + #. Tag: title +#: session_api.xml:424 #, no-c-format msgid "Criteria queries" msgstr "Requêtes par critères" #. Tag: para +#: session_api.xml:426 #, no-c-format msgid "" "HQL is extremely powerful, but some developers prefer to build queries " @@ -706,22 +1110,35 @@ msgstr "" "plutôt que de construire des chaînes de requêtes. Hibernate fournit une API " "intuitive de requête Criteria pour ces cas :" +#. Tag: programlisting +#: session_api.xml:431 +#, no-c-format +msgid "" +"Criteria crit = session.createCriteria(Cat.class);\n" +"crit.add( Restrictions.eq( \"color\", eg.Color.BLACK ) );\n" +"crit.setMaxResults(10);\n" +"List cats = crit.list();" +msgstr "" + #. Tag: para +#: session_api.xml:433 #, fuzzy, no-c-format msgid "" "The Criteria and the associated Example API are discussed in more detail in ." +"literal> API are discussed in more detail in ." msgstr "" "L'API Criteria et l'APIExample associé " "sont traités plus en détail dans ." #. Tag: title +#: session_api.xml:439 #, no-c-format msgid "Queries in native SQL" msgstr "Requêtes en SQL natif" #. Tag: para +#: session_api.xml:441 #, no-c-format msgid "" "You can express a query in SQL, using createSQLQuery() " @@ -737,23 +1154,49 @@ msgstr "" "literal> JDBC. Si vous choisissez d'utiliser l'API Hibernate, vous devez " "mettre les alias SQL entre accolades : " +#. Tag: programlisting +#: session_api.xml:448 +#, no-c-format +msgid "" +"List cats = session.createSQLQuery(\"SELECT {cat.*} FROM CAT {cat} WHERE " +"ROWNUM<10\")\n" +" .addEntity(\"cat\", Cat.class)\n" +".list();" +msgstr "" + +#. Tag: programlisting +#: session_api.xml:450 +#, no-c-format +msgid "" +"List cats = session.createSQLQuery(\n" +" \"SELECT {cat}.ID AS {cat.id}, {cat}.SEX AS {cat.sex}, \" +\n" +" \"{cat}.MATE AS {cat.mate}, {cat}.SUBCLASS AS {cat.class}, ... \" " +"+\n" +" \"FROM CAT {cat} WHERE ROWNUM<10\")\n" +" .addEntity(\"cat\", Cat.class)\n" +".list()" +msgstr "" + #. Tag: para +#: session_api.xml:452 #, fuzzy, no-c-format msgid "" "SQL queries can contain named and positional parameters, just like Hibernate " "queries. More information about native SQL queries in Hibernate can be found " -"in ." +"in ." msgstr "" "Les requêtes SQL peuvent contenir des paramètres nommés et positionnels, " "comme les requêtes Hibernate. Vous trouverez plus d'informations à propos " "des requêtes SQL natives dans Hibernate dans ." #. Tag: title +#: session_api.xml:459 #, no-c-format msgid "Modifying persistent objects" msgstr "Modifier des objets persistants" #. Tag: para +#: session_api.xml:461 #, no-c-format msgid "" "Transactional persistent instances (i.e. objects " @@ -778,7 +1221,17 @@ msgstr "" "de le manipuler directement, tant que la Session est " "ouverte : " +#. Tag: programlisting +#: session_api.xml:473 +#, no-c-format +msgid "" +"DomesticCat cat = (DomesticCat) sess.load( Cat.class, new Long(69) );\n" +"cat.setName(\"PK\");\n" +"sess.flush(); // changes to cat are automatically detected and persisted" +msgstr "" + #. Tag: para +#: session_api.xml:475 #, no-c-format msgid "" "Sometimes this programming model is inefficient, as it requires in the same " @@ -793,6 +1246,7 @@ msgstr "" "instances détachées. " #. Tag: para +#: session_api.xml:481 #, fuzzy, no-c-format msgid "" "Hibernate does not offer its own API for direct execution of " @@ -804,7 +1258,7 @@ msgid "" "the notion of mass operations conflicts with object/relational mapping for " "online transaction processing-oriented applications. Future versions of " "Hibernate can, however, provide special mass operation functions. See for some possible batch operation tricks." +"linkend=\"batch\"/> for some possible batch operation tricks." msgstr "" "Notez que Hibernate n'offre par sa propre API pour l'exécution directe " "d'expressions UPDATE ou DELETE. " @@ -820,11 +1274,13 @@ msgstr "" "possibles d'opérations groupées. " #. Tag: title +#: session_api.xml:497 #, no-c-format msgid "Modifying detached objects" msgstr "Modifier des objets détachés" #. Tag: para +#: session_api.xml:499 #, no-c-format msgid "" "Many applications need to retrieve an object in one transaction, send it to " @@ -841,6 +1297,7 @@ msgstr "" "versionnées pour assurer l'isolation des \"longues\" unités de travail." #. Tag: para +#: session_api.xml:505 #, no-c-format msgid "" "Hibernate supports this model by providing for reattachment of detached " @@ -851,7 +1308,25 @@ msgstr "" "détachées en utilisant des méthodes Session.update() ou " "Session.merge() :" +#. Tag: programlisting +#: session_api.xml:509 +#, no-c-format +msgid "" +"// in the first session\n" +"Cat cat = (Cat) firstSession.load(Cat.class, catId);\n" +"Cat potentialMate = new Cat();\n" +"firstSession.save(potentialMate);\n" +"\n" +"// in a higher layer of the application\n" +"cat.setMate(potentialMate);\n" +"\n" +"// later, in a new session\n" +"secondSession.update(cat); // update cat\n" +"secondSession.update(mate); // update mate" +msgstr "" + #. Tag: para +#: session_api.xml:511 #, no-c-format msgid "" "If the Cat with identifier catId had " @@ -863,6 +1338,7 @@ msgstr "" "l'application a essayé de le rattacher, une exception aurait été levée." #. Tag: para +#: session_api.xml:516 #, no-c-format msgid "" "Use update() if you are certain that the session does not " @@ -883,13 +1359,14 @@ msgstr "" "exécutée. " #. Tag: para +#: session_api.xml:524 #, fuzzy, no-c-format msgid "" "The application should individually update() detached " "instances that are reachable from the given detached instance " "only if it wants their state to be updated. This can be " "automated using transitive persistence. See for more information." +"linkend=\"objectstate-transitive\"/> for more information." msgstr "" "L'application devrait individuellement update() (NdT : " "mettre à jour) les instances détachées accessibles depuis l'instance " @@ -899,6 +1376,7 @@ msgstr "" "\"objectstate-transitive\" /> pour plus d'informations." #. Tag: para +#: session_api.xml:530 #, no-c-format msgid "" "The lock() method also allows an application to " @@ -909,7 +1387,20 @@ msgstr "" "associer un objet avec une nouvelle session. Cependant, l'instance détachée " "doit être non modifiée." +#. Tag: programlisting +#: session_api.xml:534 +#, no-c-format +msgid "" +"//just reassociate:\n" +"sess.lock(fritz, LockMode.NONE);\n" +"//do a version check, then reassociate:\n" +"sess.lock(izi, LockMode.READ);\n" +"//do a version check, using SELECT ... FOR UPDATE, then reassociate:\n" +"sess.lock(pk, LockMode.UPGRADE);" +msgstr "" + #. Tag: para +#: session_api.xml:536 #, no-c-format msgid "" "Note that lock() can be used with various " @@ -923,20 +1414,23 @@ msgstr "" "n'est pas le seul cas d'utilisation pour lock(). " #. Tag: para +#: session_api.xml:541 #, fuzzy, no-c-format msgid "" "Other models for long units of work are discussed in ." +"\"transactions-optimistic\"/>." msgstr "" "D'autres modèles pour de longues unités de travail sont traités dans ." #. Tag: title +#: session_api.xml:546 #, no-c-format msgid "Automatic state detection" msgstr "Détection automatique d'un état" #. Tag: para +#: session_api.xml:548 #, no-c-format msgid "" "Hibernate users have requested a general purpose method that either saves a " @@ -950,7 +1444,26 @@ msgstr "" "associées à l'identifiant courant. La méthode saveOrUpdate() implémente cette fonctionnalité." +#. Tag: programlisting +#: session_api.xml:554 +#, no-c-format +msgid "" +"// in the first session\n" +"Cat cat = (Cat) firstSession.load(Cat.class, catID);\n" +"\n" +"// in a higher tier of the application\n" +"Cat mate = new Cat();\n" +"cat.setMate(mate);\n" +"\n" +"// later, in a new session\n" +"secondSession.saveOrUpdate(cat); // update existing state (cat has a non-" +"null id)\n" +"secondSession.saveOrUpdate(mate); // save the new instance (mate has a null " +"id)" +msgstr "" + #. Tag: para +#: session_api.xml:556 #, no-c-format msgid "" "The usage and semantics of saveOrUpdate() seems to be " @@ -968,6 +1481,7 @@ msgstr "" "applications n'utiliseront jamais ces méthodes." #. Tag: para +#: session_api.xml:563 #, no-c-format msgid "" "Usually update() or saveOrUpdate() are " @@ -977,26 +1491,31 @@ msgstr "" "literal> sont utilisées dans le scénario suivant :" #. Tag: para +#: session_api.xml:569 #, no-c-format msgid "the application loads an object in the first session" msgstr "l'application charge un objet dans la première session" #. Tag: para +#: session_api.xml:573 #, no-c-format msgid "the object is passed up to the UI tier" msgstr "l'objet est passé à la couche utilisateur" #. Tag: para +#: session_api.xml:577 #, no-c-format msgid "some modifications are made to the object" msgstr "certaines modifications sont effectuées sur l'objet" #. Tag: para +#: session_api.xml:581 #, no-c-format msgid "the object is passed back down to the business logic tier" msgstr "l'objet est retourné à la couche logique métier" #. Tag: para +#: session_api.xml:585 #, no-c-format msgid "" "the application persists these modifications by calling update() dans une seconde session" #. Tag: para +#: session_api.xml:590 #, no-c-format msgid "saveOrUpdate() does the following:" msgstr "saveOrUpdate() s'utilise dans le cas suivant :" #. Tag: para +#: session_api.xml:594 #, no-c-format msgid "if the object is already persistent in this session, do nothing" msgstr "si l'objet est déjà persistant dans cette session, ne rien faire" #. Tag: para +#: session_api.xml:599 #, no-c-format msgid "" "if another object associated with the session has the same identifier, throw " @@ -1025,6 +1547,7 @@ msgstr "" "exception" #. Tag: para +#: session_api.xml:604 #, no-c-format msgid "if the object has no identifier property, save() it" msgstr "" @@ -1032,6 +1555,7 @@ msgstr "" "literal>" #. Tag: para +#: session_api.xml:609 #, no-c-format msgid "" "if the object's identifier has the value assigned to a newly instantiated " @@ -1041,6 +1565,7 @@ msgstr "" "instancié, appeler save()" #. Tag: para +#: session_api.xml:614 #, no-c-format msgid "" "if the object is versioned by a <version> or " @@ -1054,16 +1579,19 @@ msgstr "" "instancié, appeler save() " #. Tag: para +#: session_api.xml:622 #, no-c-format msgid "otherwise update() the object" msgstr "sinon mettre à jour l'objet avec update()" #. Tag: para +#: session_api.xml:626 #, no-c-format msgid "and merge() is very different:" msgstr "et merge() est très différent :" #. Tag: para +#: session_api.xml:630 #, no-c-format msgid "" "if there is a persistent instance with the same identifier currently " @@ -1075,6 +1603,7 @@ msgstr "" "persistante" #. Tag: para +#: session_api.xml:636 #, no-c-format msgid "" "if there is no persistent instance currently associated with the session, " @@ -1085,11 +1614,13 @@ msgstr "" "persistante" #. Tag: para +#: session_api.xml:642 #, no-c-format msgid "the persistent instance is returned" msgstr "l'instance persistante est retournée" #. Tag: para +#: session_api.xml:646 #, no-c-format msgid "" "the given instance does not become associated with the session, it remains " @@ -1098,11 +1629,13 @@ msgstr "" "l'instance donnée ne devient pas associée à la session, elle reste détachée" #. Tag: title +#: session_api.xml:653 #, no-c-format msgid "Deleting persistent objects" msgstr "Suppression d'objets persistants" #. Tag: para +#: session_api.xml:655 #, no-c-format msgid "" "Session.delete() will remove an object's state from the " @@ -1115,7 +1648,14 @@ msgstr "" "référence vers un objet effacé. Il est préférable de penser à delete" "() comme rendant une instance persistante éphémère. " +#. Tag: programlisting +#: session_api.xml:660 +#, no-c-format +msgid "sess.delete(cat);" +msgstr "" + #. Tag: para +#: session_api.xml:662 #, no-c-format msgid "" "You can delete objects in any order, without risk of foreign key constraint " @@ -1130,11 +1670,13 @@ msgstr "" "parent, mais oubliez d'effacer les enfants. " #. Tag: title +#: session_api.xml:670 #, no-c-format msgid "Replicating object between two different datastores" msgstr "Réplication d'objets entre deux entrepôts de données" #. Tag: para +#: session_api.xml:672 #, no-c-format msgid "" "It is sometimes useful to be able to take a graph of persistent instances " @@ -1145,7 +1687,27 @@ msgstr "" "persistantes et de les rendre persistantes dans un entrepôt différent, sans " "regénérer les valeurs des identifiants. " +#. Tag: programlisting +#: session_api.xml:676 +#, no-c-format +msgid "" +"//retrieve a cat from one database\n" +"Session session1 = factory1.openSession();\n" +"Transaction tx1 = session1.beginTransaction();\n" +"Cat cat = session1.get(Cat.class, catId);\n" +"tx1.commit();\n" +"session1.close();\n" +"\n" +"//reconcile with a second database\n" +"Session session2 = factory2.openSession();\n" +"Transaction tx2 = session2.beginTransaction();\n" +"session2.replicate(cat, ReplicationMode.LATEST_VERSION);\n" +"tx2.commit();\n" +"session2.close();" +msgstr "" + #. Tag: para +#: session_api.xml:678 #, no-c-format msgid "" "The ReplicationMode determines how replicate()ReplicationMode.IGNORE: ignores the object when there is " @@ -1165,6 +1728,7 @@ msgstr "" "ligne existante dans la base de données avec le même identifiant " #. Tag: para +#: session_api.xml:689 #, no-c-format msgid "" "ReplicationMode.OVERWRITE: overwrites any existing " @@ -1174,6 +1738,7 @@ msgstr "" "existante dans la base de données avec le même identifiant " #. Tag: para +#: session_api.xml:694 #, no-c-format msgid "" "ReplicationMode.EXCEPTION: throws an exception if there " @@ -1183,6 +1748,7 @@ msgstr "" "une ligne dans la base de données avec le même identifiant " #. Tag: para +#: session_api.xml:700 #, no-c-format msgid "" "ReplicationMode.LATEST_VERSION: overwrites the row if its " @@ -1194,6 +1760,7 @@ msgstr "" "ignore l'objet " #. Tag: para +#: session_api.xml:706 #, no-c-format msgid "" "Usecases for this feature include reconciling data entered into different " @@ -1208,11 +1775,13 @@ msgstr "" "ACID, et plus." #. Tag: title +#: session_api.xml:713 #, no-c-format msgid "Flushing the Session" msgstr "Flush de la session" #. Tag: para +#: session_api.xml:715 #, no-c-format msgid "" "Sometimes the Session will execute the SQL statements " @@ -1226,27 +1795,32 @@ msgstr "" "survient par défaut aux points suivants : " #. Tag: para +#: session_api.xml:723 #, no-c-format msgid "before some query executions" msgstr "avant certaines exécutions de requête" #. Tag: para +#: session_api.xml:727 #, no-c-format msgid "from org.hibernate.Transaction.commit()" msgstr "" "lors d'un appel à org.hibernate.Transaction.commit()" #. Tag: para +#: session_api.xml:732 #, no-c-format msgid "from Session.flush()" msgstr "lors d'un appel à Session.flush()" #. Tag: para +#: session_api.xml:736 #, no-c-format msgid "The SQL statements are issued in the following order:" msgstr "Les expressions SQL sont effectuées dans l'ordre suivant : " #. Tag: para +#: session_api.xml:740 #, no-c-format msgid "" "all entity insertions in the same order the corresponding objects were saved " @@ -1256,26 +1830,31 @@ msgstr "" "correspondants sauvegardés par l'appel à Session.save() " #. Tag: para +#: session_api.xml:745 #, no-c-format msgid "all entity updates" msgstr "mise à jour des entités" #. Tag: para +#: session_api.xml:749 #, no-c-format msgid "all collection deletions" msgstr "suppression des collections" #. Tag: para +#: session_api.xml:753 #, no-c-format msgid "all collection element deletions, updates and insertions" msgstr "suppression, mise à jour et insertion des éléments des collections" #. Tag: para +#: session_api.xml:757 #, no-c-format msgid "all collection insertions" msgstr "insertion des collections" #. Tag: para +#: session_api.xml:761 #, no-c-format msgid "" "all entity deletions in the same order the corresponding objects were " @@ -1286,6 +1865,7 @@ msgstr "" " " #. Tag: para +#: session_api.xml:766 #, no-c-format msgid "" "An exception is that objects using native ID generation " @@ -1295,6 +1875,7 @@ msgstr "" "literal> d'identifiants sont insérés lorsqu'ils sont sauvegardés." #. Tag: para +#: session_api.xml:769 #, no-c-format msgid "" "Except when you explicitly flush(), there are absolutely " @@ -1311,6 +1892,7 @@ msgstr "" "jamais de données périmées, ni des données fausses. " #. Tag: para +#: session_api.xml:776 #, fuzzy, no-c-format msgid "" "It is possible to change the default behavior so that flush occurs less " @@ -1320,7 +1902,7 @@ msgid "" "never flush unless flush() is called explicitly. The last " "mode is useful for long running units of work, where a Session is kept open and disconnected for a long time (see )." +"\"transactions-optimistic-longsession\"/>)." msgstr "" "Il est possible de changer le comportement par défaut, donc que le flush se " "produise moins fréquemment. La classe FlushMode définit " @@ -1332,13 +1914,34 @@ msgstr "" "Session est gardée ouverte et déconnectée pour un long " "moment (voir )." +#. Tag: programlisting +#: session_api.xml:786 +#, no-c-format +msgid "" +"sess = sf.openSession();\n" +"Transaction tx = sess.beginTransaction();\n" +"sess.setFlushMode(FlushMode.COMMIT); // allow queries to return stale state\n" +"\n" +"Cat izi = (Cat) sess.load(Cat.class, id);\n" +"izi.setName(iznizi);\n" +"\n" +"// might return stale data\n" +"sess.find(\"from Cat as cat left outer join cat.kittens kitten\");\n" +"\n" +"// change to izi is not flushed!\n" +"...\n" +"tx.commit(); // flush occurs\n" +"sess.close();" +msgstr "" + #. Tag: para +#: session_api.xml:788 #, fuzzy, no-c-format msgid "" "During flush, an exception might occur (e.g. if a DML operation violates a " "constraint). Since handling exceptions involves some understanding of " "Hibernate's transactional behavior, we discuss it in ." +"\"transactions\"/>." msgstr "" "Durant le flush, une exception peut se produire (par exemple, si une " "opération de la DML viole une contrainte). Les exceptions de gestion " @@ -1346,11 +1949,13 @@ msgstr "" "Hibernate, le sujet sera donc abordé dans ." #. Tag: title +#: session_api.xml:795 #, no-c-format msgid "Transitive persistence" msgstr "Persistance transitive" #. Tag: para +#: session_api.xml:797 #, no-c-format msgid "" "It is quite cumbersome to save, delete, or reattach individual objects, " @@ -1362,6 +1967,7 @@ msgstr "" "est une relation parent/enfant. Considérez l'exemple suivant :" #. Tag: para +#: session_api.xml:802 #, no-c-format msgid "" "If the children in a parent/child relationship would be value typed (e.g. a " @@ -1385,6 +1991,7 @@ msgstr "" "de données. " #. Tag: para +#: session_api.xml:812 #, no-c-format msgid "" "Now consider the same scenario with parent and child objects being entities, " @@ -1405,6 +2012,7 @@ msgstr "" "accessibilité par défaut. " #. Tag: para +#: session_api.xml:820 #, no-c-format msgid "" "For each basic operation of the Hibernate session - including " @@ -1423,12 +2031,26 @@ msgstr "" "voulez qu'une opération soit cascadée le long d'une association, vous devez " "l'indiquer dans le document de mappage. Par exemple :" +#. Tag: programlisting +#: session_api.xml:828 +#, no-c-format +msgid "<one-to-one name=\"person\" cascade=\"persist\"/>" +msgstr "" + #. Tag: para +#: session_api.xml:830 #, no-c-format msgid "Cascade styles my be combined:" msgstr "Les styles de cascade peuvent être combinés :" +#. Tag: programlisting +#: session_api.xml:832 +#, no-c-format +msgid "<one-to-one name=\"person\" cascade=\"persist,delete,lock\"/>" +msgstr "" + #. Tag: para +#: session_api.xml:834 #, no-c-format msgid "" "You can even use cascade=\"all\" to specify that " @@ -1442,30 +2064,133 @@ msgstr "" "literal> spécifie qu'aucune opération ne sera cascadée. " #. Tag: para +#: session_api.xml:839 +#, no-c-format +msgid "" +"In case you are using annotatons you probably have noticed the " +"cascade attribute taking an array of " +"CascadeType as a value. The cascade concept in JPA is " +"very is similar to the transitive persistence and cascading of operations as " +"described above, but with slightly different semantics and cascading types:" +msgstr "" + +#. Tag: para +#: session_api.xml:848 +#, no-c-format +msgid "" +"CascadeType.PERSIST: cascades the persist (create) " +"operation to associated entities persist() is called or if the entity is " +"managed" +msgstr "" + +#. Tag: para +#: session_api.xml:854 +#, no-c-format +msgid "" +"CascadeType.MERGE: cascades the merge operation to " +"associated entities if merge() is called or if the entity is managed" +msgstr "" + +#. Tag: para +#: session_api.xml:860 +#, no-c-format +msgid "" +"CascadeType.REMOVE: cascades the remove operation to " +"associated entities if delete() is called" +msgstr "" + +#. Tag: para +#: session_api.xml:865 +#, no-c-format +msgid "" +"CascadeType.REFRESH: cascades the refresh operation to " +"associated entities if refresh() is called" +msgstr "" + +#. Tag: para +#: session_api.xml:870 +#, no-c-format +msgid "" +"CascadeType.DETACH: cascades the detach operation to " +"associated entities if detach() is called" +msgstr "" + +#. Tag: para +#: session_api.xml:875 +#, fuzzy, no-c-format +msgid "CascadeType.ALL: all of the above" +msgstr "saveOrUpdate() s'utilise dans le cas suivant :" + +#. Tag: para +#: session_api.xml:880 +#, no-c-format +msgid "" +"CascadeType.ALL also covers Hibernate specific operations like save-update, " +"lock etc..." +msgstr "" + +#. Tag: para +#: session_api.xml:884 #, no-c-format msgid "" "A special cascade style, delete-orphan, applies only to " "one-to-many associations, and indicates that the delete() " "operation should be applied to any child object that is removed from the " -"association." +"association. Using annotations there is no CascadeType.DELETE-" +"ORPHAN equivalent. Instead you can use the attribute " +"orphanRemoval as seen in . If an entity is removed from a " +"@OneToMany collection or an associated entity is " +"dereferenced from a @OneToOne association, this " +"associated entity can be marked for deletion if orphanRemoval is set to true." +msgstr "" + +#. Tag: title +#: session_api.xml:897 +#, no-c-format +msgid "@OneToMany with orphanRemoval" +msgstr "" + +#. Tag: programlisting +#: session_api.xml:900 +#, no-c-format +msgid "" +"@Entity \n" +"public class Customer {\n" +" private Set<Order> orders;\n" +"\n" +" @OneToMany(cascade=CascadeType.ALL, orphanRemoval=true) \n" +" public Set<Order> getOrders() { return orders; }\n" +"\n" +" public void setOrders(Set<Order> orders) { this.orders = orders; }\n" +"\n" +" [...]\n" +"}\n" +"\n" +"@Entity \n" +"public class Order { ... }\n" +"\n" +"Customer customer = em.find(Customer.class, 1l);\n" +"Order order = em.find(Order.class, 1l);\n" +"customer.getOrders().remove(order); //order will be deleted by cascade" msgstr "" -"Un style de cascade spécial, delete-orphan, s'applique " -"seulement aux associations un-à-plusieurs, et indique que l'opération " -"delete() devrait être appliquée à tout enfant supprimé de " -"l'association." #. Tag: para +#: session_api.xml:903 #, no-c-format msgid "Recommendations:" msgstr "Recommandations :" #. Tag: para -#, no-c-format +#: session_api.xml:907 +#, fuzzy, no-c-format msgid "" -"It does not usually make sense to enable cascade on a <many-to-" -"one> or <many-to-many> association. " -"Cascade is often useful for <one-to-one> and " -"<one-to-many> associations." +"It does not usually make sense to enable cascade on a many-to-one or many-to-" +"many association. In fact the @ManyToOne and " +"@ManyToMany don't even offer a orphanRemoval attribute. Cascading is often useful for one-to-one and one-to-many " +"associations." msgstr "" "Cela n'a généralement aucun sens d'activer la cascade sur une association " "<many-to-one> ou <many-to-many>. " #. Tag: para -#, no-c-format +#: session_api.xml:915 +#, fuzzy, no-c-format msgid "" "If the child object's lifespan is bounded by the lifespan of the parent " "object, make it a life cycle object by specifying " -"cascade=\"all,delete-orphan\"." +"cascade=\"all,delete-orphan\"(@OneToMany" +"(cascade=CascadeType.ALL, orphanRemoval=true))." msgstr "" "Si la durée de vie de l'objet enfant est liée à la durée de vie de l'objet " "parent, faites-en un objet du cycle de vie en " "spécifiant cascade=\"all,delete-orphan\". " #. Tag: para +#: session_api.xml:923 #, no-c-format msgid "" "Otherwise, you might not need cascade at all. But if you think that you will " @@ -1499,6 +2227,7 @@ msgstr "" "literal>. " #. Tag: para +#: session_api.xml:931 #, no-c-format msgid "" "Mapping an association (either a single valued association, or a collection) " @@ -1513,15 +2242,16 @@ msgstr "" "jour/suppression de l'enfant ou des enfants." #. Tag: para -#, no-c-format +#: session_api.xml:937 +#, fuzzy, no-c-format msgid "" "Furthermore, a mere reference to a child from a persistent parent will " "result in save/update of the child. This metaphor is incomplete, however. A " "child which becomes unreferenced by its parent is not " -"automatically deleted, except in the case of a <one-to-many> association mapped with cascade=\"delete-orphan\". The precise semantics of cascading operations for a parent/child " -"relationship are as follows:" +"automatically deleted, except in the case of a one-to-many association " +"mapped with cascade=\"delete-orphan\". The precise " +"semantics of cascading operations for a parent/child relationship are as " +"follows:" msgstr "" "Par ailleurs, une simple référence à un enfant d'un parent persistant aura " "pour conséquence la sauvegarde/mise à jour de l'enfant. Cette métaphore est " @@ -1532,6 +2262,7 @@ msgstr "" "opérations de cascade pour une relation parent/enfant est la suivante : " #. Tag: para +#: session_api.xml:948 #, no-c-format msgid "" "If a parent is passed to persist(), all children are " @@ -1541,6 +2272,7 @@ msgstr "" "passés à persist()" #. Tag: para +#: session_api.xml:953 #, no-c-format msgid "" "If a parent is passed to merge(), all children are passed " @@ -1550,6 +2282,7 @@ msgstr "" "passés à merge()" #. Tag: para +#: session_api.xml:958 #, no-c-format msgid "" "If a parent is passed to save(), update()saveOrUpdate()" #. Tag: para +#: session_api.xml:964 #, no-c-format msgid "" "If a transient or detached child becomes referenced by a persistent parent, " @@ -1570,6 +2304,7 @@ msgstr "" "il est passé à saveOrUpdate()" #. Tag: para +#: session_api.xml:970 #, no-c-format msgid "" "If a parent is deleted, all children are passed to delete()" #. Tag: para +#: session_api.xml:975 #, no-c-format msgid "" "If a child is dereferenced by a persistent parent, nothing special " @@ -1592,6 +2328,7 @@ msgstr "" "literal> soit paramétré, auquel cas l'enfant \"orphelin\" est supprimé." #. Tag: para +#: session_api.xml:983 #, no-c-format msgid "" "Finally, note that cascading of operations can be applied to an object graph " @@ -1610,11 +2347,13 @@ msgstr "" "associées accessibles lors du flush de la Session. " #. Tag: title +#: session_api.xml:993 #, no-c-format msgid "Using metadata" msgstr "Utilisation des méta-données" #. Tag: para +#: session_api.xml:995 #, no-c-format msgid "" "Hibernate requires a rich meta-level model of all entity and value types. " @@ -1633,6 +2372,7 @@ msgstr "" "les types de valeurs immutables et, éventuellement, les entités associées). " #. Tag: para +#: session_api.xml:1002 #, no-c-format msgid "" "Hibernate exposes metadata via the ClassMetadata and " @@ -1644,3 +2384,35 @@ msgstr "" "literal> et CollectionMetadata et la hiérarchie " "Type. Les instances des interfaces de méta-données " "peuvent être obtenues à partir de la SessionFactory. " + +#. Tag: programlisting +#: session_api.xml:1007 +#, no-c-format +msgid "" +"Cat fritz = ......;\n" +"ClassMetadata catMeta = sessionfactory.getClassMetadata(Cat.class);\n" +"\n" +"Object[] propertyValues = catMeta.getPropertyValues(fritz);\n" +"String[] propertyNames = catMeta.getPropertyNames();\n" +"Type[] propertyTypes = catMeta.getPropertyTypes();\n" +"\n" +"// get a Map of all properties which are not collections or associations\n" +"Map namedValues = new HashMap();\n" +"for ( int i=0; i<propertyNames.length; i++ ) {\n" +" if ( !propertyTypes[i].isEntityType() && !propertyTypes[i]." +"isCollectionType() ) {\n" +" namedValues.put( propertyNames[i], propertyValues[i] );\n" +" }\n" +"}" +msgstr "" + +#~ msgid "" +#~ "A special cascade style, delete-orphan, applies only " +#~ "to one-to-many associations, and indicates that the delete() operation should be applied to any child object that is removed " +#~ "from the association." +#~ msgstr "" +#~ "Un style de cascade spécial, delete-orphan, s'applique " +#~ "seulement aux associations un-à-plusieurs, et indique que l'opération " +#~ "delete() devrait être appliquée à tout enfant supprimé " +#~ "de l'association." diff --git a/documentation/manual/src/main/docbook/fr-FR/content/tutorial.po b/documentation/manual/src/main/docbook/fr-FR/content/tutorial.po index 319f46a132..66eaf53296 100644 --- a/documentation/manual/src/main/docbook/fr-FR/content/tutorial.po +++ b/documentation/manual/src/main/docbook/fr-FR/content/tutorial.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: tutorial\n" "Report-Msgid-Bugs-To: http://bugs.kde.org\n" -"POT-Creation-Date: 2010-02-11T05:38:16\n" +"POT-Creation-Date: 2010-07-20 21:02+0000\n" "PO-Revision-Date: 2010-01-05 10:08+1000\n" "Last-Translator: Corina Roe \n" "Language-Team: French \n" @@ -17,11 +17,13 @@ msgstr "" "X-Generator: KBabel 1.11.4\n" #. Tag: title +#: tutorial.xml:34 #, no-c-format msgid "Tutorial" msgstr "Tutoriel" #. Tag: para +#: tutorial.xml:36 #, no-c-format msgid "" "Intended for new users, this chapter provides an step-by-step introduction " @@ -38,6 +40,7 @@ msgstr "" "répertoire source du projet. " #. Tag: para +#: tutorial.xml:45 #, no-c-format msgid "" "This tutorial expects the user have knowledge of both Java and SQL. If you " @@ -50,6 +53,7 @@ msgstr "" "d'aborder Hibernate." #. Tag: para +#: tutorial.xml:54 #, no-c-format msgid "" "The distribution contains another example application under the " @@ -59,11 +63,13 @@ msgstr "" "le répertoire source du projet tutorial/eg." #. Tag: title +#: tutorial.xml:62 #, no-c-format msgid "Part 1 - The first Hibernate Application" msgstr "Section 1 - Première application Hibernate" #. Tag: para +#: tutorial.xml:64 #, no-c-format msgid "" "For this example, we will set up a small database application that can store " @@ -74,6 +80,7 @@ msgstr "" "informations à propos des hôtes de ces événements." #. Tag: para +#: tutorial.xml:70 #, no-c-format msgid "" "Although you can use whatever database you feel comfortable using, we will " @@ -87,11 +94,13 @@ msgstr "" "configuration de n'importe quel serveur de base de données particulière." #. Tag: title +#: tutorial.xml:79 #, no-c-format msgid "Setup" msgstr "Configuration" #. Tag: para +#: tutorial.xml:81 #, no-c-format msgid "" "The first thing we need to do is to set up the development environment. We " @@ -114,6 +123,7 @@ msgstr "" "filename> et src/main/webapp." #. Tag: para +#: tutorial.xml:91 #, no-c-format msgid "" "We will be using Maven in this tutorial, taking advantage of its transitive " @@ -124,11 +134,65 @@ msgstr "" "de gestion de dépendances transitives, ainsi que de la capacité des nombreux " "IDE à installer automatiquement un projet sur la base du descripteur Maven." +#. Tag: programlisting +#: tutorial.xml:97 +#, no-c-format +msgid "" +"\n" +"\n" +" 4.0.0\n" +"\n" +" org.hibernate.tutorials\n" +" hibernate-tutorial\n" +" 1.0.0-SNAPSHOT\n" +" First Hibernate Tutorial\n" +"\n" +" \n" +" \n" +" ${artifactId}\n" +" \n" +"\n" +" \n" +" \n" +" org.hibernate\n" +" hibernate-core\n" +" \n" +"\n" +" \n" +" \n" +" javax.servlet\n" +" servlet-api\n" +" \n" +"\n" +" \n" +" \n" +" org.slf4j\n" +" slf4j-simple\n" +" \n" +"\n" +" \n" +" \n" +" javassist\n" +" javassist\n" +" \n" +" \n" +"\n" +"]]>" +msgstr "" + #. Tag: para +#: tutorial.xml:100 #, fuzzy, no-c-format msgid "" "It is not a requirement to use Maven. If you wish to use something else to " -"build this tutoial (such as Ant), the layout will remain the same. The only " +"build this tutorial (such as Ant), the layout will remain the same. The only " "change is that you will need to manually account for all the needed " "dependencies. If you use something like Ivy providing transitive dependency management you would " @@ -158,6 +222,7 @@ msgstr "" "gestionnaires de journalisation slf4j." #. Tag: para +#: tutorial.xml:117 #, no-c-format msgid "" "Save this file as pom.xml in the project root directory." @@ -166,11 +231,13 @@ msgstr "" "répertoire root du projet." #. Tag: title +#: tutorial.xml:124 #, no-c-format msgid "The first class" msgstr "La première classe" #. Tag: para +#: tutorial.xml:126 #, no-c-format msgid "" "Next, we create a class that represents the event we want to store in the " @@ -180,7 +247,50 @@ msgstr "" "stocker dans notre base de données. Il s'agit d'une simple classe JavaBean " "avec quelques propriétés :" +#. Tag: programlisting +#: tutorial.xml:131 +#, no-c-format +msgid "" +"" +msgstr "" + #. Tag: para +#: tutorial.xml:133 #, no-c-format msgid "" "This class uses standard JavaBean naming conventions for property getter and " @@ -196,6 +306,7 @@ msgstr "" "le bénéfice des méthodes d'accès est la robustesse pour la refonte de code. " #. Tag: para +#: tutorial.xml:141 #, no-c-format msgid "" "The id property holds a unique identifier value for a " @@ -226,6 +337,7 @@ msgstr "" "l'ajuster à la conception de votre application. " #. Tag: para +#: tutorial.xml:156 #, no-c-format msgid "" "The no-argument constructor is a requirement for all persistent classes; " @@ -241,6 +353,7 @@ msgstr "" "récupération efficace des données sans instrumentation du bytecode. " #. Tag: para +#: tutorial.xml:164 #, no-c-format msgid "" "Save this file to the src/main/java/org/hibernate/tutorial/domain." #. Tag: title +#: tutorial.xml:171 #, no-c-format msgid "The mapping file" msgstr "Le fichier de mappage" #. Tag: para +#: tutorial.xml:173 #, no-c-format msgid "" "Hibernate needs to know how to load and store objects of the persistent " @@ -268,12 +383,28 @@ msgstr "" "base de données, et les colonnes de cette table à utiliser." #. Tag: para +#: tutorial.xml:181 #, no-c-format msgid "The basic structure of a mapping file looks like this:" msgstr "" "La structure basique de ce fichier de mappage ressemble à ce qui suit :" +#. Tag: programlisting +#: tutorial.xml:185 +#, no-c-format +msgid "" +"\n" +"\n" +"\n" +"\n" +"[...]\n" +"]]>" +msgstr "" + #. Tag: para +#: tutorial.xml:187 #, no-c-format msgid "" "Hibernate DTD is sophisticated. You can use it for auto-completion of XML " @@ -297,6 +428,7 @@ msgstr "" "la distribution Hibernate)." #. Tag: para +#: tutorial.xml:200 #, no-c-format msgid "" "We will omit the DTD declaration in future examples to shorten the code. It " @@ -306,6 +438,7 @@ msgstr "" "raccourcir le code. Évidemment il n'est pas optionnel. " #. Tag: para +#: tutorial.xml:206 #, no-c-format msgid "" "Between the two hibernate-mapping tags, include a " @@ -319,7 +452,21 @@ msgstr "" "ne sont pas des entités mère) ont besoin d'un mappage vers une table de la " "base de données SQL :" +#. Tag: programlisting +#: tutorial.xml:213 +#, no-c-format +msgid "" +"\n" +"\n" +" \n" +"\n" +" \n" +"\n" +"]]>" +msgstr "" + #. Tag: para +#: tutorial.xml:215 #, no-c-format msgid "" "So far we have told Hibernate how to persist and load object of class " @@ -338,7 +485,23 @@ msgstr "" "de génération d'identifiant Hibernate pour la colonne de la clé primaire " "subrogée : " +#. Tag: programlisting +#: tutorial.xml:225 +#, no-c-format +msgid "" +"\n" +"\n" +" \n" +" \n" +" \n" +" \n" +" \n" +"\n" +"]]>" +msgstr "" + #. Tag: para +#: tutorial.xml:227 #, no-c-format msgid "" "The id element is the declaration of the identifier " @@ -356,6 +519,7 @@ msgstr "" "table EVENTS contient la valeur de clé primaire." #. Tag: para +#: tutorial.xml:237 #, no-c-format msgid "" "The nested generator element specifies the identifier " @@ -376,17 +540,18 @@ msgstr "" "points d'extension d'Hibernate et vous pouvez plug-in votre propre stratégie." #. Tag: para +#: tutorial.xml:249 #, fuzzy, no-c-format msgid "" "native is no longer consider the best strategy in terms " -"of portability. for further discussion, see " +"of portability. for further discussion, see" msgstr "" "native n'est plus considéré comme la meilleure stratégie " "en terme de portabilité. Pour obtenir davantage d'explications, voir " #. Tag: para +#: tutorial.xml:255 #, no-c-format msgid "" "Lastly, we need to tell Hibernate about the remaining entity class " @@ -396,7 +561,26 @@ msgstr "" "classe dans le fichier de mappage. Par défaut, aucune propriété de la classe " "n'est considérée comme persistante : " +#. Tag: programlisting +#: tutorial.xml:261 +#, no-c-format +msgid "" +"\n" +"\n" +" \n" +" \n" +" \n" +" \n" +" \n" +" \n" +" \n" +"\n" +"]]>" +msgstr "" + #. Tag: para +#: tutorial.xml:263 #, no-c-format msgid "" "Similar to the id element, the name " @@ -412,6 +596,7 @@ msgstr "" "getTitle()/setTitle(). " #. Tag: para +#: tutorial.xml:274 #, no-c-format msgid "" "Why does the date property mapping include the " @@ -430,6 +615,7 @@ msgstr "" "différent pour le mappage. " #. Tag: para +#: tutorial.xml:284 #, no-c-format msgid "" "The title mapping also lacks a type " @@ -466,6 +652,7 @@ msgstr "" "un convertisseur timestamp. " #. Tag: para +#: tutorial.xml:300 #, no-c-format msgid "" "Hibernate makes this mapping type determination using reflection when the " @@ -479,6 +666,7 @@ msgstr "" "importante, vous devriez considérer définir explicitement quel type utiliser." #. Tag: para +#: tutorial.xml:307 #, no-c-format msgid "" "Save this mapping file as src/main/resources/org/hibernate/" @@ -488,11 +676,13 @@ msgstr "" "hibernate/tutorial/domain/Event.hbm.xml." #. Tag: title +#: tutorial.xml:315 #, no-c-format msgid "Hibernate configuration" msgstr "Configuration d'Hibernate" #. Tag: para +#: tutorial.xml:317 #, no-c-format msgid "" "At this point, you should have the persistent class and its mapping file in " @@ -505,11 +695,13 @@ msgstr "" "\"server mode\"" #. Tag: para +#: tutorial.xml:324 #, fuzzy, no-c-format msgid "We do this do that the data remains between runs." msgstr "xxx" #. Tag: para +#: tutorial.xml:329 #, no-c-format msgid "" "We will utilize the Maven exec plugin to launch the HSQLDB server by " @@ -530,6 +722,7 @@ msgstr "" "target/data et redémarrez HSQL DB." #. Tag: para +#: tutorial.xml:340 #, no-c-format msgid "" "Hibernate will be connecting to the database on behalf of your application, " @@ -551,6 +744,7 @@ msgstr "" "utiliserons le pool de connexions intégré Hibernate pour ce tutoriel." #. Tag: para +#: tutorial.xml:351 #, fuzzy, no-c-format msgid "" "The built-in Hibernate connection pool is in no way intended for production " @@ -560,6 +754,7 @@ msgstr "" "environnements de production." #. Tag: para +#: tutorial.xml:357 #, no-c-format msgid "" "For Hibernate's configuration, we can use a simple hibernate." @@ -573,7 +768,57 @@ msgstr "" "complète par programmation. La plupart des utilisateurs préfèrent le fichier " "de configuration XML : " +#. Tag: programlisting +#: tutorial.xml:363 +#, no-c-format +msgid "" +"\n" +"\n" +"\n" +"\n" +"\n" +" \n" +"\n" +" \n" +" org.hsqldb.jdbcDriver\n" +" jdbc:hsqldb:hsql://localhost\n" +" sa\n" +" \n" +"\n" +" \n" +" 1\n" +"\n" +" \n" +" org.hibernate.dialect.HSQLDialect\n" +"\n" +" \n" +" thread\n" +"\n" +" \n" +" org.hibernate.cache." +"NoCacheProvider\n" +"\n" +" \n" +" true\n" +"\n" +" \n" +" update\n" +"\n" +" \n" +"\n" +" \n" +"\n" +"]]>" +msgstr "" + #. Tag: para +#: tutorial.xml:366 #, no-c-format msgid "Notice that this configuration file specifies a different DTD" msgstr "" @@ -581,6 +826,7 @@ msgstr "" "différente." #. Tag: para +#: tutorial.xml:369 #, no-c-format msgid "" "You configure Hibernate's SessionFactory. SessionFactory " @@ -595,6 +841,7 @@ msgstr "" "de configuration différents (pour un démarrage plus facile)." #. Tag: para +#: tutorial.xml:376 #, no-c-format msgid "" "The first four property elements contain the necessary " @@ -607,16 +854,18 @@ msgstr "" "Hibernate va générer. " #. Tag: para +#: tutorial.xml:383 #, fuzzy, no-c-format msgid "" "In most cases, Hibernate is able to properly determine which dialect to use. " -"See for more information." +"See for more information." msgstr "" "Hibernate est capable de déterminer correctement quel dialecte utiliser dans " "la plupart des cas. Voir " "pour obtenir davantage d'informations. " #. Tag: para +#: tutorial.xml:389 #, no-c-format msgid "" "Hibernate's automatic session management for persistence contexts is " @@ -637,6 +886,7 @@ msgstr "" "classes persistantes." #. Tag: para +#: tutorial.xml:398 #, no-c-format msgid "" "Save this file as hibernate.cfg.xml into the " @@ -646,11 +896,13 @@ msgstr "" "dans le répertoire src/main/resources." #. Tag: title +#: tutorial.xml:406 #, no-c-format msgid "Building with Maven" msgstr "Construction avec Maven" #. Tag: para +#: tutorial.xml:408 #, no-c-format msgid "" "We will now build the tutorial with Maven. You will need to have Maven " @@ -668,12 +920,43 @@ msgstr "" "d'abord, exécutons compile pour s'assurer que nous " "pouvons tout compiler jusqu'à maintenant :" +#. Tag: programlisting +#: tutorial.xml:418 +#, no-c-format +msgid "" +"" +msgstr "" + #. Tag: title +#: tutorial.xml:423 #, no-c-format msgid "Startup and helpers" msgstr "Démarrage et aides" #. Tag: para +#: tutorial.xml:425 #, no-c-format msgid "" "It is time to load and store some Event objects, but " @@ -698,6 +981,7 @@ msgstr "" "interfacename> est un objet global \"thread-safe\", instancié une seule fois." #. Tag: para +#: tutorial.xml:439 #, no-c-format msgid "" "We will create a HibernateUtil helper class that takes " @@ -708,7 +992,42 @@ msgstr "" "s'occupe du démarrage et rend la gestion des org.hibernate." "SessionFactory plus facile. " +#. Tag: programlisting +#: tutorial.xml:445 +#, no-c-format +msgid "" +"" +msgstr "" + #. Tag: para +#: tutorial.xml:447 #, no-c-format msgid "" "Save this code as src/main/java/org/hibernate/tutorial/util/" @@ -718,6 +1037,7 @@ msgstr "" "tutorial/util/HibernateUtil.java" #. Tag: para +#: tutorial.xml:452 #, no-c-format msgid "" "This class not only produces the global org.hibernate." @@ -736,6 +1056,7 @@ msgstr "" "SessionFactory depuis JNDI dans un serveur d'applications." #. Tag: para +#: tutorial.xml:461 #, no-c-format msgid "" "If you give the org.hibernate.SessionFactory " @@ -753,6 +1074,7 @@ msgstr "" "expliquées plus loin." #. Tag: para +#: tutorial.xml:470 #, no-c-format msgid "" "You now need to configure a logging system. Hibernate uses commons logging " @@ -775,6 +1097,7 @@ msgstr "" "démarrage de Hibernate est affiché sur la sortie standard." #. Tag: para +#: tutorial.xml:480 #, no-c-format msgid "" "The tutorial infrastructure is complete and you are now ready to do some " @@ -784,14 +1107,16 @@ msgstr "" "effectuer un travail réel avec Hibernate. " #. Tag: title +#: tutorial.xml:488 #, no-c-format msgid "Loading and storing objects" msgstr "Charger et stocker des objets" #. Tag: para -#, no-c-format +#: tutorial.xml:490 +#, fuzzy, no-c-format msgid "" -"We are now ready to start doing some real worjk with Hibernate. Let's start " +"We are now ready to start doing some real work with Hibernate. Let's start " "by writing an EventManager class with a main() method:" msgstr "" @@ -799,7 +1124,49 @@ msgstr "" "Nous écrivons une classe EventManager avec une méthode " "main() : " +#. Tag: programlisting +#: tutorial.xml:496 +#, no-c-format +msgid "" +"" +msgstr "" + #. Tag: para +#: tutorial.xml:498 #, no-c-format msgid "" "In createAndStoreEvent() we created a new Eventorg.hibernate.Session
is designed to represent a " -"single unit of work (a single atmoic piece of work to be performed). For now " +"single unit of work (a single atomic piece of work to be performed). For now " "we will keep things simple and assume a one-to-one granularity between a " "Hibernate org.hibernate.Session and a database " "transaction. To shield our code from the actual underlying transaction " @@ -834,6 +1202,7 @@ msgstr "" "utiliser JTA." #. Tag: para +#: tutorial.xml:518 #, no-c-format msgid "" "What does sessionFactory.getCurrentSession() do? First, " @@ -856,6 +1225,7 @@ msgstr "" "courante est liée au thread Java courant qui exécute notre application." #. Tag: para +#: tutorial.xml:532 #, no-c-format msgid "" "Hibernate offers three methods of current session tracking. The \"thread\" " @@ -869,6 +1239,7 @@ msgstr "" "suivi de session courant est abordé plus en détail par la suite." #. Tag: para +#: tutorial.xml:541 #, no-c-format msgid "" "A org.hibernate.Session begins when the first call to " @@ -890,6 +1261,7 @@ msgstr "" "travail. " #. Tag: para +#: tutorial.xml:554 #, no-c-format msgid "" "Related to the unit of work scope, should the Hibernate org." @@ -918,9 +1290,10 @@ msgstr "" "application (web) est affichée plus loin dans ce tutoriel. " #. Tag: para +#: tutorial.xml:571 #, fuzzy, no-c-format msgid "" -"See for more information about transaction " +"See for more information about transaction " "handling and demarcation. The previous example also skipped any error " "handling and rollback." msgstr "" @@ -929,6 +1302,7 @@ msgstr "" "erreurs et rollback dans l'exemple précédent." #. Tag: para +#: tutorial.xml:577 #, no-c-format msgid "" "To run this, we will make use of the Maven exec plugin to call our class " @@ -941,6 +1315,7 @@ msgstr "" "\" -Dexec.args=\"store\"" #. Tag: para +#: tutorial.xml:584 #, no-c-format msgid "You may need to perform mvn compile first." msgstr "" @@ -948,6 +1323,7 @@ msgstr "" "commencer." #. Tag: para +#: tutorial.xml:589 #, no-c-format msgid "" "You should see Hibernate starting up and, depending on your configuration, " @@ -957,32 +1333,77 @@ msgstr "" "beaucoup de traces sur la sortie. À la fin, vous trouverez la ligne " "suivante :" +#. Tag: programlisting +#: tutorial.xml:594 +#, no-c-format +msgid "" +"" +msgstr "" + #. Tag: para +#: tutorial.xml:596 #, no-c-format msgid "This is the INSERT executed by Hibernate." msgstr "C'est l' INSERT exécutée par Hibernate." #. Tag: para +#: tutorial.xml:600 #, no-c-format msgid "To list stored events an option is added to the main method:" msgstr "" "Maintenant nous aimerions aussi lister les événements stockés, donc nous " "ajoutons une option à la méthode principale : " +#. Tag: programlisting +#: tutorial.xml:604 +#, no-c-format +msgid "" +"" +msgstr "" + #. Tag: para +#: tutorial.xml:606 #, no-c-format msgid "A new listEvents() method is also added:" msgstr "" "Nous ajoutons aussi une nouvelle méthode listEvents() : " +#. Tag: programlisting +#: tutorial.xml:610 +#, no-c-format +msgid "" +"" +msgstr "" + #. Tag: para +#: tutorial.xml:612 #, fuzzy, no-c-format msgid "" "Here, we are using a Hibernate Query Language (HQL) query to load all " "existing Event objects from the database. Hibernate will " "generate the appropriate SQL, send it to the database and populate " "Event objects with the data. You can create more complex " -"queries with HQL. See for more information." +"queries with HQL. See for more information." msgstr "" "Ici nous utilisons une requête HQL (Hibernate Query Language) pour charger " "tous les objets Event existants de la base de données. " @@ -992,6 +1413,7 @@ msgstr "" "\"queryhql\" /> pour obtenir davantage d'informations." #. Tag: para +#: tutorial.xml:620 #, no-c-format msgid "" "Now we can call our new functionality, again using the Maven exec plugin: " @@ -1003,11 +1425,13 @@ msgstr "" "\"org.hibernate.tutorial.EventManager\" -Dexec.args=\"list\"" #. Tag: title +#: tutorial.xml:630 #, no-c-format msgid "Part 2 - Mapping associations" msgstr "Section 2 - Mapper des associations" #. Tag: para +#: tutorial.xml:632 #, no-c-format msgid "" "So far we have mapped a single persistent entity class to a table in " @@ -1021,17 +1445,40 @@ msgstr "" "stockerons une liste d'événements auxquels ils participent." #. Tag: title +#: tutorial.xml:640 #, no-c-format msgid "Mapping the Person class" msgstr "Mapper la classe Person" #. Tag: para +#: tutorial.xml:642 #, no-c-format msgid "The first cut of the Person class looks like this:" msgstr "" "La première version de la classe Person est simple : " +#. Tag: programlisting +#: tutorial.xml:646 +#, no-c-format +msgid "" +"" +msgstr "" + #. Tag: para +#: tutorial.xml:648 #, no-c-format msgid "" "Save this to a file named src/main/java/org/hibernate/tutorial/" @@ -1041,6 +1488,7 @@ msgstr "" "tutorial/domain/Person.java" #. Tag: para +#: tutorial.xml:653 #, no-c-format msgid "" "Next, create the new mapping file as src/main/resources/org/" @@ -1049,13 +1497,41 @@ msgstr "" "Puis, créez le nouveau fichier de mappage src/main/resources/org/" "hibernate/tutorial/domain/Person.hbm.xml" +#. Tag: programlisting +#: tutorial.xml:658 +#, no-c-format +msgid "" +"\n" +"\n" +" \n" +" \n" +" \n" +" \n" +" \n" +" \n" +" \n" +" \n" +"\n" +"]]>" +msgstr "" + #. Tag: para +#: tutorial.xml:660 #, no-c-format msgid "Finally, add the new mapping to Hibernate's configuration:" msgstr "" "Finalement, ajoutez le nouveau mappage à la configuration d'Hibernate :" +#. Tag: programlisting +#: tutorial.xml:664 +#, no-c-format +msgid "" +"\n" +"]]>" +msgstr "" + #. Tag: para +#: tutorial.xml:666 #, no-c-format msgid "" "Create an association between these two entities. Persons can participate in " @@ -1068,11 +1544,13 @@ msgstr "" "traiter sont : direction, cardinalité et comportement de la collection. " #. Tag: title +#: tutorial.xml:676 #, no-c-format msgid "A unidirectional Set-based association" msgstr "Une association unidirectionnelle basée sur Set" #. Tag: para +#: tutorial.xml:678 #, no-c-format msgid "" "By adding a collection of events to the Person class, you " @@ -1091,7 +1569,26 @@ msgstr "" "contiendra pas d'éléments dupliqués et l'ordre ne nous importe pas pour ces " "exemples :" +#. Tag: programlisting +#: tutorial.xml:689 +#, no-c-format +msgid "" +"" +msgstr "" + #. Tag: para +#: tutorial.xml:691 #, no-c-format msgid "" "Before mapping this association, let's consider the other side. We could " @@ -1115,7 +1612,28 @@ msgstr "" "côtés, est appelée plusieurs-à-plusieurs. Par " "conséquent nous utilisons un mappage Hibernate plusieurs-à-plusieurs :" +#. Tag: programlisting +#: tutorial.xml:704 +#, no-c-format +msgid "" +"\n" +" \n" +" \n" +" \n" +" \n" +" \n" +" \n" +"\n" +" \n" +" \n" +" \n" +" \n" +"\n" +"]]>" +msgstr "" + #. Tag: para +#: tutorial.xml:706 #, no-c-format msgid "" "Hibernate supports a broad range of collection mappings, a set | *EVENT_ID | | |\n" +" | EVENT_DATE | | *PERSON_ID | <--> | *PERSON_ID |\n" +" | TITLE | |__________________| | AGE |\n" +" |_____________| | FIRSTNAME |\n" +" | LASTNAME |\n" +" |_____________|\n" +" ]]>" +msgstr "" + #. Tag: title +#: tutorial.xml:731 #, no-c-format msgid "Working the association" msgstr "Travailler avec l'association" #. Tag: para +#: tutorial.xml:733 #, no-c-format msgid "" "Now we will bring some people and events together in a new method in " @@ -1161,7 +1701,25 @@ msgstr "" "Réunissons quelques personnes et quelques événements dans une nouvelle " "méthode dans EventManager : " +#. Tag: programlisting +#: tutorial.xml:737 +#, no-c-format +msgid "" +"" +msgstr "" + #. Tag: para +#: tutorial.xml:739 #, no-c-format msgid "" "After loading a Person and an Event, " @@ -1197,6 +1755,7 @@ msgstr "" "de données." #. Tag: para +#: tutorial.xml:758 #, no-c-format msgid "" "You can load person and event in different units of work. Or you can modify " @@ -1212,7 +1771,43 @@ msgstr "" "emphasis>). Vous pouvez même modifier une collection lorsqu'elle est " "détachée :" +#. Tag: programlisting +#: tutorial.xml:767 +#, no-c-format +msgid "" +"" +msgstr "" + #. Tag: para +#: tutorial.xml:769 #, no-c-format msgid "" "The call to update makes a detached object persistent " @@ -1228,6 +1823,7 @@ msgstr "" "modification effectuées sur une collection de cet objet entité." #. Tag: para +#: tutorial.xml:778 #, no-c-format msgid "" "This is not much use in our example, but it is an important concept you can " @@ -1246,7 +1842,22 @@ msgstr "" "devrez peut-être modifier certaines méthodes précédentes pour retourner ces " "identifiants) :" +#. Tag: programlisting +#: tutorial.xml:786 +#, no-c-format +msgid "" +"" +msgstr "" + #. Tag: para +#: tutorial.xml:788 #, no-c-format msgid "" "This is an example of an association between two equally important classes : " @@ -1278,6 +1889,7 @@ msgstr "" "ou MonetaryAmount, par exemple. " #. Tag: para +#: tutorial.xml:806 #, no-c-format msgid "" "You can also design a collection of value types. This is conceptually " @@ -1289,11 +1901,13 @@ msgstr "" "entités, mais très ressemblant dans Java. " #. Tag: title +#: tutorial.xml:815 #, no-c-format msgid "Collection of values" msgstr "Collection de valeurs" #. Tag: para +#: tutorial.xml:817 #, no-c-format msgid "" "Let's add a collection of email addresses to the Person " @@ -1304,12 +1918,39 @@ msgstr "" "qui sera représenté en tant que java.util.Set " "d'instance java.lang.String :" +#. Tag: programlisting +#: tutorial.xml:823 +#, no-c-format +msgid "" +"" +msgstr "" + #. Tag: para +#: tutorial.xml:825 #, no-c-format msgid "The mapping of this Set is as follows:" msgstr "Le mappage de ce Set : " +#. Tag: programlisting +#: tutorial.xml:829 +#, no-c-format +msgid "" +"\n" +" \n" +" \n" +" ]]>" +msgstr "" + #. Tag: para +#: tutorial.xml:831 #, no-c-format msgid "" "The difference compared with the earlier mapping is the use of the " @@ -1337,11 +1978,39 @@ msgstr "" "valeurs de String seront réellement stockées. " #. Tag: para +#: tutorial.xml:847 #, no-c-format msgid "Here is the updated schema:" msgstr "Considérons le schéma mis à jour : " +#. Tag: programlisting +#: tutorial.xml:851 +#, no-c-format +msgid "" +" | *EVENT_ID | | | |" +"___________________|\n" +" | EVENT_DATE | | *PERSON_ID | <--> | *PERSON_ID | <--> | " +"*PERSON_ID |\n" +" | TITLE | |__________________| | AGE | | " +"*EMAIL_ADDR |\n" +" |_____________| | FIRSTNAME | |" +"___________________|\n" +" | LASTNAME |\n" +" |_____________|\n" +" ]]>" +msgstr "" + #. Tag: para +#: tutorial.xml:853 #, no-c-format msgid "" "You can see that the primary key of the collection table is in fact a " @@ -1356,6 +2025,7 @@ msgstr "" "Java. " #. Tag: para +#: tutorial.xml:859 #, no-c-format msgid "" "You can now try to add elements to this collection, just like we did before " @@ -1365,7 +2035,27 @@ msgstr "" "juste comme nous l'avons fait auparavant en liant des personnes et des " "événements. C'est le même code dans Java. " +#. Tag: programlisting +#: tutorial.xml:864 +#, no-c-format +msgid "" +"" +msgstr "" + #. Tag: para +#: tutorial.xml:866 #, no-c-format msgid "" "This time we did not use a fetch query to initialize " @@ -1377,11 +2067,13 @@ msgstr "" "SQL et tentez d'optimiser ce cas avec un chargement agressif." #. Tag: title +#: tutorial.xml:875 #, no-c-format msgid "Bi-directional associations" msgstr "Associations bidirectionnelles" #. Tag: para +#: tutorial.xml:877 #, no-c-format msgid "" "Next you will map a bi-directional association. You will make the " @@ -1395,6 +2087,7 @@ msgstr "" "pas, nous avons toujours une pluralité plusieurs-à-plusieurs. " #. Tag: para +#: tutorial.xml:885 #, no-c-format msgid "" "A relational database is more flexible than a network programming language, " @@ -1406,6 +2099,7 @@ msgstr "" "les données peuvent être vues et récupérées de toutes les manières possibles." #. Tag: para +#: tutorial.xml:893 #, no-c-format msgid "" "First, add a collection of participants to the Event " @@ -1414,7 +2108,23 @@ msgstr "" "D'abord, ajoutez une collection de participants à la classe Event : " +#. Tag: programlisting +#: tutorial.xml:898 +#, no-c-format +msgid "" +"" +msgstr "" + #. Tag: para +#: tutorial.xml:900 #, no-c-format msgid "" "Now map this side of the association in Event.hbm.xml." @@ -1422,7 +2132,19 @@ msgstr "" "Maintenant mappez ce côté de l'association aussi, dans Event.hbm." "xml. " +#. Tag: programlisting +#: tutorial.xml:904 +#, no-c-format +msgid "" +"\n" +" \n" +" \n" +" ]]>" +msgstr "" + #. Tag: para +#: tutorial.xml:906 #, no-c-format msgid "" "These are normal set mappings in both mapping documents. " @@ -1440,6 +2162,7 @@ msgstr "" "mappage de la collection des Events. " #. Tag: para +#: tutorial.xml:914 #, no-c-format msgid "" "What this means is that Hibernate should take the other side, the " @@ -1454,11 +2177,13 @@ msgstr "" "est créé. " #. Tag: title +#: tutorial.xml:923 #, no-c-format msgid "Working bi-directional links" msgstr "Travailler avec des liens bidirectionnels" #. Tag: para +#: tutorial.xml:925 #, no-c-format msgid "" "First, keep in mind that Hibernate does not affect normal Java semantics. " @@ -1483,6 +2208,7 @@ msgstr "" "ne devriez jamais oublier de le faire. " #. Tag: para +#: tutorial.xml:935 #, no-c-format msgid "" "Many developers program defensively and create link management methods to " @@ -1492,7 +2218,31 @@ msgstr "" "méthodes de gestion de lien pour affecter correctement les deux côtés, par " "exemple dans Person :" +#. Tag: programlisting +#: tutorial.xml:940 +#, no-c-format +msgid "" +"" +msgstr "" + #. Tag: para +#: tutorial.xml:942 #, no-c-format msgid "" "The get and set methods for the collection are now protected. This allows " @@ -1507,6 +2257,7 @@ msgstr "" "faire de même avec la collection de l'autre côté. " #. Tag: para +#: tutorial.xml:949 #, no-c-format msgid "" "What about the inverse mapping attribute? For you, and " @@ -1539,11 +2290,13 @@ msgstr "" "plusieurs, vous pouvez choisir n'importe quel côté, il n'y pas de différence." #. Tag: title +#: tutorial.xml:965 #, no-c-format msgid "Part 3 - The EventManager web application" msgstr "Section 3 - L'application web EventManager" #. Tag: para +#: tutorial.xml:967 #, no-c-format msgid "" "A Hibernate web application uses Session and " @@ -1560,11 +2313,13 @@ msgstr "" "pour saisir de nouveaux évènements. " #. Tag: title +#: tutorial.xml:975 #, no-c-format msgid "Writing the basic servlet" msgstr "Écrire la servlet de base" #. Tag: para +#: tutorial.xml:977 #, no-c-format msgid "" "First we need create our basic processing servlet. Since our servlet only " @@ -1575,7 +2330,52 @@ msgstr "" "que les requêtes HTTP GET, la méthode à implémenter est " "donc doGet() :" +#. Tag: programlisting +#: tutorial.xml:983 +#, no-c-format +msgid "" +"" +msgstr "" + #. Tag: para +#: tutorial.xml:985 #, no-c-format msgid "" "Save this servlet as src/main/java/org/hibernate/tutorial/web/" @@ -1585,6 +2385,7 @@ msgstr "" "web/EventManagerServlet.java" #. Tag: para +#: tutorial.xml:990 #, no-c-format msgid "" "The pattern applied here is called session-per-request. " @@ -1604,6 +2405,7 @@ msgstr "" "mode auto-commit dans les applications). " #. Tag: para +#: tutorial.xml:999 #, no-c-format msgid "" "Do not use a new Hibernate Session " @@ -1618,6 +2420,7 @@ msgstr "" "automatiquement attachée au thread Java courant." #. Tag: para +#: tutorial.xml:1006 #, no-c-format msgid "" "Next, the possible actions of the request are processed and the response " @@ -1627,6 +2430,7 @@ msgstr "" "HTML est rendue. Nous y reviendrons ultérieurement. " #. Tag: para +#: tutorial.xml:1011 #, no-c-format msgid "" "Finally, the unit of work ends when processing and rendering are complete. " @@ -1649,18 +2453,57 @@ msgstr "" "servlets pour le rendu de vos vues. " #. Tag: title +#: tutorial.xml:1025 #, no-c-format msgid "Processing and rendering" msgstr "Traiter et interpréter" #. Tag: para +#: tutorial.xml:1027 #, no-c-format msgid "" "Now you can implement the processing of the request and the rendering of the " "page." msgstr "Implémentons l'exécution de la requête et le rendu de la page. " +#. Tag: programlisting +#: tutorial.xml:1031 +#, no-c-format +msgid "" +"Event Manager" +"\");\n" +"\n" +" // Handle actions\n" +" if ( \"store\".equals(request.getParameter(\"action\")) ) {\n" +"\n" +" String eventTitle = request.getParameter(\"eventTitle\");\n" +" String eventDate = request.getParameter(\"eventDate\");\n" +"\n" +" if ( \"\".equals(eventTitle) || \"\".equals(eventDate) ) {\n" +" out.println(\"Please enter event title and date.\");\n" +" }\n" +" else {\n" +" createAndStoreEvent(eventTitle, dateFormatter.parse" +"(eventDate));\n" +" out.println(\"Added event.\");\n" +" }\n" +" }\n" +"\n" +" // Print page\n" +" printEventForm(out);\n" +" listEvents(out, dateFormatter);\n" +"\n" +" // Write HTML footer\n" +" out.println(\"\");\n" +" out.flush();\n" +" out.close();]]>" +msgstr "" + #. Tag: para +#: tutorial.xml:1033 #, no-c-format msgid "" "This coding style, with a mix of Java and HTML, would not scale in a more " @@ -1678,7 +2521,25 @@ msgstr "" "évènements de la base de données. La première méthode est triviale et ne " "fait que sortir de l'HTML :" +#. Tag: programlisting +#: tutorial.xml:1042 +#, no-c-format +msgid "" +"Add new event:\");\n" +" out.println(\"
\");\n" +" out.println(\"Title:
" +"\");\n" +" out.println(\"Date (e.g. 24.12.2009):
\");\n" +" out.println(\"" +"\");\n" +" out.println(\"
\");\n" +" }]]>" +msgstr "" + #. Tag: para +#: tutorial.xml:1044 #, no-c-format msgid "" "The listEvents() method uses the Hibernate " @@ -1687,7 +2548,38 @@ msgstr "" "La méthode listEvents() utilise la Session Hibernate liée au thread courant pour exécuter la requête :" +#. Tag: programlisting +#: tutorial.xml:1050 +#, no-c-format +msgid "" +" 0) {\n" +" out.println(\"

Events in database:

\");\n" +" out.println(\"\");\n" +" out.println(\"\");\n" +" out.println(\"\");\n" +" out.println(\"\");\n" +" out.println(\"\");\n" +" Iterator it = result.iterator();\n" +" while (it.hasNext()) {\n" +" Event event = (Event) it.next();\n" +" out.println(\"\");\n" +" out.println(\"\");\n" +" out.println(\"\");\n" +" out.println(\"\");\n" +" }\n" +" out.println(\"
Event titleEvent date
\" + event.getTitle() + \"\" + dateFormatter.format(event.getDate()) " +"+ \"
\");\n" +" }\n" +" }]]>" +msgstr "" + #. Tag: para +#: tutorial.xml:1052 #, no-c-format msgid "" "Finally, the store action is dispatched to the " @@ -1698,7 +2590,23 @@ msgstr "" "createAndStoreEvent(), qui utilise aussi la " "Session du thread courant:" +#. Tag: programlisting +#: tutorial.xml:1058 +#, no-c-format +msgid "" +"" +msgstr "" + #. Tag: para +#: tutorial.xml:1060 #, no-c-format msgid "" "The servlet is now complete. A request to the servlet will be processed in a " @@ -1720,11 +2628,13 @@ msgstr "" "dans une couche DAO. Consultez le wiki Hibernate pour plus d'exemples. " #. Tag: title +#: tutorial.xml:1074 #, no-c-format msgid "Deploying and testing" msgstr "Déployer et tester" #. Tag: para +#: tutorial.xml:1076 #, no-c-format msgid "" "To deploy this application for testing we must create a Web ARchive (WAR). " @@ -1735,7 +2645,32 @@ msgstr "" "créer un WAR (Web ARchive). Tout d'abord, nous devons définir le descripteur " "WAR en tant que src/main/webapp/WEB-INF/web.xml" +#. Tag: programlisting +#: tutorial.xml:1082 +#, no-c-format +msgid "" +"\n" +"\n" +"\n" +" \n" +" Event Manager\n" +" org.hibernate.tutorial.web.EventManagerServlet\n" +" \n" +"\n" +" \n" +" Event Manager\n" +" /eventmanager\n" +" \n" +"]]>" +msgstr "" + #. Tag: para +#: tutorial.xml:1084 #, no-c-format msgid "" "To build and deploy call mvn package in your project " @@ -1747,10 +2682,11 @@ msgstr "" "le répertoire webapp de Tomcat. " #. Tag: para +#: tutorial.xml:1091 #, fuzzy, no-c-format msgid "" "If you do not have Tomcat installed, download it from and follow the installation instructions. Our " +"tomcat.apache.org/\"> and follow the installation instructions. Our " "application requires no changes to the standard Tomcat configuration." msgstr "" "Si vous n'avez pas installé Tomcat, téléchargez-le de Gavin King" msgstr "" -#. Tag: firstname +#. Tag: author +#: author_group.xml:32 #, no-c-format -msgid "Christian" +msgid "Christian Bauer" msgstr "" -#. Tag: firstname +#. Tag: author +#: author_group.xml:36 #, no-c-format -msgid "Max" +msgid "" +"Max Rydahl Andersen" msgstr "" -#. Tag: firstname +#. Tag: author +#: author_group.xml:41 #, no-c-format -msgid "Emmanuel" +msgid "" +"Emmanuel Bernard" msgstr "" -#. Tag: firstname +#. Tag: author +#: author_group.xml:45 #, no-c-format -msgid "Steve" +msgid "Steve Ebersole" msgstr "" -#. Tag: firstname +#. Tag: author +#: author_group.xml:49 #, no-c-format -msgid "James" +msgid "Hardy Ferentschik" msgstr "" -#. Tag: firstname +#. Tag: othercredit +#: author_group.xml:54 #, no-c-format -msgid "Cheyenne" +msgid "James Cobb" msgstr "" -#. Tag: firstname +#. Tag: shortaffil +#: author_group.xml:58 author_group.xml:65 #, no-c-format -msgid "Vincent" +msgid "Graphic Design" msgstr "" -#. Tag: firstname +#. Tag: othercredit +#: author_group.xml:61 #, no-c-format -msgid "Sebastien" +msgid "Cheyenne Weaver" msgstr "" -#. Tag: firstname +#. Tag: othercredit +#: author_group.xml:74 #, no-c-format -msgid "Michael" +msgid "" +" " +"kreimer@bbs.frc.utn.edu.ar" msgstr "" -#. Tag: firstname +#. Tag: othercredit +#: author_group.xml:84 #, no-c-format -msgid "Baptiste" +msgid "Vincent Ricard" msgstr "" -#. Tag: firstname +#. Tag: othercredit +#: author_group.xml:88 #, no-c-format -msgid "Anthony" +msgid "Sebastien Cesbron" msgstr "" -#. Tag: firstname +#. Tag: othercredit +#: author_group.xml:92 #, no-c-format -msgid "Alvaro" +msgid "Michael Courcy" msgstr "" -#. Tag: firstname +#. Tag: othercredit +#: author_group.xml:96 #, no-c-format -msgid "Anderson" +msgid "Vincent Giguère" msgstr "" -#. Tag: firstname +#. Tag: othercredit +#: author_group.xml:100 #, no-c-format -msgid "Daniel Vieira" +msgid "Baptiste Mathus" msgstr "" -#. Tag: firstname +#. Tag: othercredit +#: author_group.xml:104 #, no-c-format -msgid "Francisco" +msgid "" +"Emmanuel Bernard" msgstr "" -#. Tag: firstname +#. Tag: othercredit +#: author_group.xml:108 #, no-c-format -msgid "Gamarra" +msgid "Anthony Patricio" msgstr "" -#. Tag: firstname +#. Tag: othercredit +#: author_group.xml:118 #, no-c-format -msgid "Luiz Carlos" +msgid "" +"Alvaro Netto " +"alvaronetto@cetip.com.br" msgstr "" -#. Tag: firstname +#. Tag: othercredit +#: author_group.xml:123 #, no-c-format -msgid "Marcel" +msgid "" +"Anderson Braulio " +"andersonbraulio@gmail.com" msgstr "" -#. Tag: firstname +#. Tag: othercredit +#: author_group.xml:128 #, no-c-format -msgid "Paulo" +msgid "" +"Daniel Vieira Costa " +"danielvc@gmail.com" msgstr "" -#. Tag: firstname +#. Tag: othercredit +#: author_group.xml:133 #, no-c-format -msgid "Pablo L." +msgid "" +"Francisco gamarra francisco." +"gamarra@gmail.com" msgstr "" -#. Tag: firstname +#. Tag: othercredit +#: author_group.xml:138 #, no-c-format -msgid "Renato" +msgid "" +"Gamarra mauricio.gamarra@gmail.com" msgstr "" -#. Tag: firstname +#. Tag: othercredit +#: author_group.xml:142 #, no-c-format -msgid "Rogério" +msgid "" +"Luiz Carlos Rodrigues " +"luizcarlos_rodrigues@yahoo.com.br" msgstr "" -#. Tag: firstname +#. Tag: othercredit +#: author_group.xml:147 #, no-c-format -msgid "Wanderson" +msgid "" +"Marcel Castelo marcel." +"castelo@gmail.com" msgstr "" -#. Tag: firstname +#. Tag: othercredit +#: author_group.xml:152 #, no-c-format -msgid "Cao" +msgid "" +"Paulo César paulocol@gmail." +"com" msgstr "" -#. Tag: orgname +#. Tag: othercredit +#: author_group.xml:157 #, no-c-format -msgid "RedSaga" +msgid "" +"Pablo L. de Miranda " +"pablolmiranda@gmail.com" msgstr "" -#. Tag: contrib +#. Tag: othercredit +#: author_group.xml:162 #, no-c-format -msgid "Translation Lead" +msgid "" +"Renato Deggau rdeggau@gmail." +"com" +msgstr "" + +#. Tag: othercredit +#: author_group.xml:167 +#, no-c-format +msgid "" +"Rogério Araújo " +"rgildoaraujo@yahoo.com.br" +msgstr "" + +#. Tag: othercredit +#: author_group.xml:172 +#, no-c-format +msgid "" +"Wanderson Siqueira " +"wandersonxs@gmail.com" +msgstr "" + +#. Tag: othercredit +#: author_group.xml:183 +#, no-c-format +msgid "" +"Cao Xiaogang " +"RedSaga Translation Lead caoxg@yahoo.com" msgstr "" diff --git a/documentation/manual/src/main/docbook/ja-JP/content/basic_mapping.po b/documentation/manual/src/main/docbook/ja-JP/content/basic_mapping.po index 32c817f054..4bd7c4fe7c 100644 --- a/documentation/manual/src/main/docbook/ja-JP/content/basic_mapping.po +++ b/documentation/manual/src/main/docbook/ja-JP/content/basic_mapping.po @@ -4,7 +4,7 @@ msgid "" msgstr "" "Project-Id-Version: Collection_Mapping\n" "Report-Msgid-Bugs-To: http://bugs.kde.org\n" -"POT-Creation-Date: 2010-02-11T05:38:15\n" +"POT-Creation-Date: 2010-07-20 21:02+0000\n" "PO-Revision-Date: 2010-01-06 10:49+1000\n" "Last-Translator: Xi HUANG \n" "Language-Team: \n" @@ -14,22 +14,143 @@ msgstr "" "X-Generator: KBabel 1.11.4\n" #. Tag: title +#: basic_mapping.xml:31 #, no-c-format msgid "Basic O/R Mapping" msgstr "基本的な O/R マッピング" #. Tag: title +#: basic_mapping.xml:34 #, no-c-format msgid "Mapping declaration" msgstr "マッピング定義" #. Tag: para +#: basic_mapping.xml:36 +#, no-c-format +msgid "Object/relational mappings can be defined in three approaches:" +msgstr "" + +#. Tag: para +#: basic_mapping.xml:41 +#, no-c-format +msgid "using Java 5 annotations (via the Java Persistence 2 annotations)" +msgstr "" + +#. Tag: para +#: basic_mapping.xml:46 +#, no-c-format +msgid "using JPA 2 XML deployment descriptors (described in chapter XXX)" +msgstr "" + +#. Tag: para +#: basic_mapping.xml:51 +#, no-c-format +msgid "using the Hibernate legacy XML files approach known as hbm.xml" +msgstr "" + +#. Tag: para +#: basic_mapping.xml:56 #, no-c-format msgid "" -"Object/relational mappings are usually defined in an XML document. The " -"mapping document is designed to be readable and hand-editable. The mapping " -"language is Java-centric, meaning that mappings are constructed around " -"persistent class declarations and not table declarations." +"Annotations are split in two categories, the logical mapping annotations " +"(describing the object model, the association between two entities etc.) and " +"the physical mapping annotations (describing the physical schema, tables, " +"columns, indexes, etc). We will mix annotations from both categories in the " +"following code examples." +msgstr "" + +#. Tag: para +#: basic_mapping.xml:62 +#, no-c-format +msgid "" +"JPA annotations are in the javax.persistence.* package. " +"Hibernate specific extensions are in org.hibernate.annotations.*. You favorite IDE can auto-complete annotations and their " +"attributes for you (even without a specific \"JPA\" plugin, since JPA " +"annotations are plain Java 5 annotations)." +msgstr "" + +#. Tag: para +#: basic_mapping.xml:69 +#, fuzzy, no-c-format +msgid "Here is an example of mapping" +msgstr "サンプルのマッピングから始めましょう:" + +#. Tag: programlisting +#: basic_mapping.xml:71 +#, no-c-format +msgid "" +"package eg;\n" +"\n" +"@Entity \n" +"@Table(name=\"cats\") @Inheritance(strategy=SINGLE_TABLE)\n" +"@DiscriminatorValue(\"C\") @DiscriminatorColumn(name=\"subclass\", " +"discriminatorType=CHAR)\n" +"public class Cat {\n" +" \n" +" @Id @GeneratedValue\n" +" public Integer getId() { return id; }\n" +" public void setId(Integer id) { this.id = id; }\n" +" private Integer id;\n" +"\n" +" public BigDecimal getWeight() { return weight; }\n" +" public void setWeight(BigDecimal weight) { this.weight = weight; }\n" +" private BigDecimal weight;\n" +"\n" +" @Temporal(DATE) @NotNull @Column(updatable=false)\n" +" public Date getBirthdate() { return birthdate; }\n" +" public void setBirthdate(Date birthdate) { this.birthdate = birthdate; }\n" +" private Date birthdate;\n" +"\n" +" @org.hibernate.annotations.Type(type=\"eg.types.ColorUserType\")\n" +" @NotNull @Column(updatable=false)\n" +" public ColorType getColor() { return color; }\n" +" public void setColor(ColorType color) { this.color = color; }\n" +" private ColorType color;\n" +"\n" +" @NotNull @Column(updatable=false)\n" +" public String getSex() { return sex; }\n" +" public void setSex(String sex) { this.sex = sex; }\n" +" private String sex;\n" +"\n" +" @NotNull @Column(updatable=false)\n" +" public Integer getLitterId() { return litterId; }\n" +" public void setLitterId(Integer litterId) { this.litterId = litterId; }\n" +" private Integer litterId;\n" +"\n" +" @ManyToOne @JoinColumn(name=\"mother_id\", updatable=false)\n" +" public Cat getMother() { return mother; }\n" +" public void setMother(Cat mother) { this.mother = mother; }\n" +" private Cat mother;\n" +"\n" +" @OneToMany(mappedBy=\"mother\") @OrderBy(\"litterId\")\n" +" public Set<Cat> getKittens() { return kittens; }\n" +" public void setKittens(Set<Cat> kittens) { this.kittens = " +"kittens; }\n" +" private Set<Cat> kittens = new HashSet<Cat>();\n" +"}\n" +"\n" +"@Entity @DiscriminatorValue(\"D\")\n" +"public class DomesticCat extends Cat {\n" +"\n" +" public String getName() { return name; }\n" +" public void setName(String name) { this.name = name }\n" +" private String name;\n" +"}\n" +"\n" +"@Entity\n" +"public class Dog { ... }" +msgstr "" + +#. Tag: para +#: basic_mapping.xml:73 +#, fuzzy, no-c-format +msgid "" +"The legacy hbm.xml approach uses an XML schema designed to be readable and " +"hand-editable. The mapping language is Java-centric, meaning that mappings " +"are constructed around persistent class declarations and not table " +"declarations." msgstr "" "オブジェクト/リレーショナルマッピングは通常 XML ドキュメントで定義します。" "マッピングドキュメントは、読みやすく手作業で編集しやすいようにデザインされて" @@ -37,6 +158,7 @@ msgstr "" "義に基づいて構築されています。" #. Tag: para +#: basic_mapping.xml:78 #, no-c-format msgid "" "Please note that even though many Hibernate users choose to write the XML by " @@ -48,18 +170,157 @@ msgstr "" "ルがいくつか存在することを覚えておいてください。" #. Tag: para +#: basic_mapping.xml:82 #, no-c-format msgid "Here is an example mapping:" msgstr "サンプルのマッピングから始めましょう:" -#. Tag: para -#, no-c-format +#. Tag: programlisting +#: basic_mapping.xml:84 +#, fuzzy, no-c-format msgid "" -"We will now discuss the content of the mapping document. We will only " -"describe, however, the document elements and attributes that are used by " -"Hibernate at runtime. The mapping document also contains some extra optional " -"attributes and elements that affect the database schemas exported by the " -"schema export tool (for example, the not-null attribute)." +"<?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 name=\"Cat\"\n" +" table=\"cats\"\n" +" discriminator-value=\"C\">\n" +"\n" +" <id name=\"id\">\n" +" <generator class=\"native\"/>\n" +" </id>\n" +"\n" +" <discriminator column=\"subclass\"\n" +" type=\"character\"/>\n" +"\n" +" <property name=\"weight\"/>\n" +"\n" +" <property name=\"birthdate\"\n" +" type=\"date\"\n" +" not-null=\"true\"\n" +" update=\"false\"/>\n" +"\n" +" <property name=\"color\"\n" +" type=\"eg.types.ColorUserType\"\n" +" not-null=\"true\"\n" +" update=\"false\"/>\n" +"\n" +" <property name=\"sex\"\n" +" not-null=\"true\"\n" +" update=\"false\"/>\n" +"\n" +" <property name=\"litterId\"\n" +" column=\"litterId\"\n" +" update=\"false\"/>\n" +"\n" +" <many-to-one name=\"mother\"\n" +" column=\"mother_id\"\n" +" update=\"false\"/>\n" +"\n" +" <set name=\"kittens\"\n" +" inverse=\"true\"\n" +" order-by=\"litter_id\">\n" +" <key column=\"mother_id\"/>\n" +" <one-to-many class=\"Cat\"/>\n" +" </set>\n" +"\n" +" <subclass name=\"DomesticCat\"\n" +" discriminator-value=\"D\">\n" +"\n" +" <property name=\"name\"\n" +" type=\"string\"/>\n" +"\n" +" </subclass>\n" +"\n" +" </class>\n" +"\n" +" <class name=\"Dog\">\n" +" <!-- mapping for Dog could go here -->\n" +" </class>\n" +"\n" +"</hibernate-mapping>" +msgstr "" +"<?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 name=\"Cat\" \n" +" table=\"cats\"\n" +" discriminator-value=\"C\">\n" +" \n" +" <id name=\"id\">\n" +" <generator class=\"native\"/>\n" +" </id>\n" +"\n" +" <discriminator column=\"subclass\" \n" +" type=\"character\"/>\n" +"\n" +" <property name=\"weight\"/>\n" +"\n" +" <property name=\"birthdate\"\n" +" type=\"date\" \n" +" not-null=\"true\" \n" +" update=\"false\"/>\n" +"\n" +" <property name=\"color\"\n" +" type=\"eg.types.ColorUserType\"\n" +" not-null=\"true\"\n" +" update=\"false\"/>\n" +"\n" +" <property name=\"sex\"\n" +" not-null=\"true\" \n" +" update=\"false\"/>\n" +"\n" +" <property name=\"litterId\"\n" +" column=\"litterId\"\n" +" update=\"false\"/>\n" +"\n" +" <many-to-one name=\"mother\"\n" +" column=\"mother_id\"\n" +" update=\"false\"/>\n" +"\n" +" <set name=\"kittens\"\n" +" inverse=\"true\"\n" +" order-by=\"litter_id\">\n" +" <key column=\"mother_id\"/>\n" +" <one-to-many class=\"Cat\"/>\n" +" </set>\n" +"\n" +" <subclass name=\"DomesticCat\"\n" +" discriminator-value=\"D\">\n" +"\n" +" <property name=\"name\" \n" +" type=\"string\"/>\n" +"\n" +" </subclass>\n" +"\n" +" </class>\n" +"\n" +" <class name=\"Dog\">\n" +" <!-- mapping for Dog could go here -->\n" +" </class>\n" +"\n" +"</hibernate-mapping>" + +#. Tag: para +#: basic_mapping.xml:86 +#, fuzzy, no-c-format +msgid "" +"We will now discuss the concepts of the mapping documents (both annotations " +"and XML). We will only describe, however, the document elements and " +"attributes that are used by Hibernate at runtime. The mapping document also " +"contains some extra optional attributes and elements that affect the " +"database schemas exported by the schema export tool (for example, the " +" not-null attribute)." msgstr "" "マッピングドキュメントの内容を説明します。ただし、ここでは Hibernate が実行時" "に使うドキュメント要素と属性についてのみ説明します。マッピングドキュメント" @@ -68,226 +329,458 @@ msgstr "" "キーマに影響を与えるものです。" #. Tag: title -#, no-c-format -msgid "Doctype" -msgstr "Doctype" +#: basic_mapping.xml:94 +#, fuzzy, no-c-format +msgid "Entity" +msgstr "identity" #. Tag: para +#: basic_mapping.xml:96 #, no-c-format msgid "" -"All XML mappings should declare the doctype shown. The actual DTD can be " -"found at the URL above, in the directory hibernate-x.x.x/src/org/" -"hibernate , or in hibernate3.jar. Hibernate " -"will always look for the DTD in its classpath first. If you experience " -"lookups of the DTD using an Internet connection, check the DTD declaration " -"against the contents of your classpath." +"An entity is a regular Java object (aka POJO) which will be persisted by " +"Hibernate." msgstr "" -"XML マッピングでは、お見せしたようなドキュメント型を必ず定義すべきです。実際" -"の DTD は、上記の URL の hibernate-x.x.x/src/org/hibernate ディレクトリ、または hibernate.jar 内にありま" -"す。 Hibernate は常に、そのクラスパス内で DTD を探し始めます。インターネット" -"にある DTD ファイルを探そうとしたなら、クラスパスの内容を見て、 DTD 宣言を確" -"認してください。" - -#. Tag: title -#, no-c-format -msgid "EntityResolver" -msgstr "エンティティリゾルバ" #. Tag: para +#: basic_mapping.xml:99 #, no-c-format msgid "" -"Hibernate will first attempt to resolve DTDs in its classpath. It does this " -"is by registering a custom org.xml.sax.EntityResolver " -"implementation with the SAXReader it uses to read in the xml files. This " -"custom EntityResolver recognizes two different systemId " -"namespaces:" +"To mark an object as an entity in annotations, use the @Entity annotation." msgstr "" -"前述したように、 Hibernate はまずクラスパス内で DTD を解決しようとします。 " -"org.xml.sax.EntityResolver のカスタム実装を XML ファイルを" -"読み込むための SAXReader に登録することによって、 DTD を解決します。このカス" -"タムの EntityResolver は2つの異なるシステム ID 名前空間を" -"認識します。" -#. Tag: para +#. Tag: programlisting +#: basic_mapping.xml:102 #, no-c-format msgid "" -"a hibernate namespace is recognized whenever the resolver " -"encounters a systemId starting with http://hibernate.sourceforge." -"net/. The resolver attempts to resolve these entities via the " -"classloader which loaded the Hibernate classes." +"@Entity\n" +"public class Flight implements Serializable {\n" +" Long id;\n" +"\n" +" @Id\n" +" public Long getId() { return id; }\n" +"\n" +" public void setId(Long id) { this.id = id; }\n" +"}" msgstr "" -"hibernate namespace は、リゾルバが http://" -"hibernate.sourceforge.net/ で始まるシステム ID に到達したときに認識" -"されます。そしてリゾルバは、 Hibernate のクラスをロードしたクラスローダを用い" -"て、これらのエンティティを解決しようとします。" #. Tag: para +#: basic_mapping.xml:104 #, no-c-format msgid "" -"a user namespace is recognized whenever the resolver " -"encounters a systemId using a classpath:// URL protocol. " -"The resolver will attempt to resolve these entities via (1) the current " -"thread context classloader and (2) the classloader which loaded the " -"Hibernate classes." +"That's pretty much it, the rest is optional. There are however any options " +"to tweak your entity mapping, let's explore them." msgstr "" -"user namespace は、リゾルバが URL プロトコルの " -"classpath:// を使ったシステム ID に到達したときに、認識さ" -"れます。そしてリゾルバは、 (1) カレントスレッドのコンテキストクラスローダー、" -"または (2) Hibernate のクラスをロードしたクラスローダを使って、これらのエン" -"ティティを解決しようとします。" #. Tag: para +#: basic_mapping.xml:107 #, no-c-format -msgid "The following is an example of utilizing user namespacing:" -msgstr "下記は、ユーザー名前空間を使った例です:" +msgid "" +"@Table lets you define the table the entity will be " +"persisted into. If undefined, the table name is the unqualified class name " +"of the entity. You can also optionally define the catalog, the schema as " +"well as unique constraints on the table." +msgstr "" + +#. Tag: programlisting +#: basic_mapping.xml:112 +#, no-c-format +msgid "" +"@Entity\n" +"@Table(name=\"TBL_FLIGHT\", \n" +" schema=\"AIR_COMMAND\", \n" +" uniqueConstraints=\n" +" @UniqueConstraint(\n" +" name=\"flight_number\", \n" +" columnNames={\"comp_prefix\", \"flight_number\"} ) )\n" +"public class Flight implements Serializable {\n" +" @Column(name=\"comp_prefix\")\n" +" public String getCompagnyPrefix() { return companyPrefix; }\n" +"\n" +" @Column(name=\"flight_number\")\n" +" public String getNumber() { return number; }\n" +"}" +msgstr "" #. Tag: para +#: basic_mapping.xml:114 +#, no-c-format +msgid "" +"The constraint name is optional (generated if left undefined). The column " +"names composing the constraint correspond to the column names as defined " +"before the Hibernate NamingStrategy is applied." +msgstr "" + +#. Tag: para +#: basic_mapping.xml:119 +#, no-c-format +msgid "" +"@Entity.name lets you define the shortcut name of the " +"entity you can used in JP-QL and HQL queries. It defaults to the unqualified " +"class name of the class." +msgstr "" + +#. Tag: para +#: basic_mapping.xml:123 +#, no-c-format +msgid "" +"Hibernate goes beyond the JPA specification and provide additional " +"configurations. Some of them are hosted on @org.hibernate." +"annotations.Entity:" +msgstr "" + +#. Tag: para +#: basic_mapping.xml:129 #, fuzzy, no-c-format msgid "" -"Where types.xml is a resource in the your." -"domain package and contains a custom typedef." +"dynamicInsert / dynamicUpdate " +"(defaults to false): specifies that INSERT / " +"UPDATE SQL should be generated at runtime and contain " +"only the columns whose values are not null. The dynamic-update and dynamic-insert settings are not inherited by " +"subclasses. Although these settings can increase performance in some cases, " +"they can actually decrease performance in others." msgstr "" -"ここで types.xmlyour.domain パッ" -"ケージ内のリソースであり、カスタム型定義 を含みます。" +"dynamic-updatedynamic-insert の設定" +"はサブクラスに継承されません。そのため <subclass> " +"や <joined-subclass> 要素を指定することも出来ます。" +"これらの設定はパフォーマンスを向上させる事もありますが、落とすこともあります" +"ので、慎重に使用してください。" -#. Tag: title +#. Tag: para +#: basic_mapping.xml:140 #, fuzzy, no-c-format -msgid "Hibernate-mapping" -msgstr "hibernate-mapping" +msgid "" +"selectBeforeUpdate (defaults to false): specifies that " +"Hibernate should never perform an SQL UPDATE unless it is certain that an object is actually modified. Only when " +"a transient object has been associated with a new session using " +"update(), will Hibernate perform an extra SQL " +"SELECT to determine if an UPDATE is " +"actually required. Use of select-before-update will " +"usually decrease performance. It is useful to prevent a database update " +"trigger being called unnecessarily if you reattach a graph of detached " +"instances to a Session." +msgstr "" +"select-before-update (オプション、デフォルトは " +"false): オブジェクトが変更されたのが確実でないならば、 " +"Hibernate が SQL の UPDATE決して実行しない ことを指定します。ある特定の場合(実際的には、一時オブジェクトが " +"update() を使い、新しいセッションと関連付けられた時だ" +"け)、 UPDATE が実際に必要かどうかを決定するために、 " +"Hibernate が余分な SQL の SELECT 文を実行することを意味し" +"ます。" #. Tag: para +#: basic_mapping.xml:154 +#, fuzzy, no-c-format +msgid "" +"polymorphisms (defaults to IMPLICIT): " +"determines whether implicit or explicit query polymorphisms is used. " +"Implicit polymorphisms means that instances of the " +"class will be returned by a query that names any superclass or implemented " +"interface or class, and that instances of any subclass of the class will be " +"returned by a query that names the class itself. Explicit polymorphisms means that class instances will be returned only by " +"queries that explicitly name that class. Queries that name the class will " +"return only instances of subclasses mapped. For most purposes, the default " +"polymorphisms=IMPLICIT is appropriate. Explicit " +"polymorphisms is useful when two different classes are mapped to the same " +"table This allows a \"lightweight\" class that contains a subset of the " +"table columns." +msgstr "" +" 暗黙的 ポリモーフィズムとは、次の二つを意味しています。" +"一つはクラスのインスタンスが、スーパークラスや実装したインターフェース、また" +"そのクラスを指定するクエリによって返されることで、もう一つはそのクラスのサブ" +"クラスのインスタンスが、そのクラス自身を指定したクエリによって返されることで" +"す。また、 明示的 ポリモーフィズムとは、次の二つを意味し" +"ています。一つはクラスのインスタンスが、そのクラスを明示的に指定したクエリに" +"よってのみ返されることで、もう一つはクラスを指定したクエリが、 <" +"class> 要素の中で <subclass> や " +"<joined-subclass> とマッピングされているサブクラスの" +"インスタンスだけを返すことです。ほとんどの用途ではデフォルトの " +"polymorphism=\"implicit\" が適切です。明示的なポリモーフィ" +"ズムは、2つの違ったクラスが同じテーブルにマッピングされているときに有用です " +"(これによってテーブルカラムのサブセットを含む、「軽量な」クラスが可能になり" +"ます)。" + +#. Tag: para +#: basic_mapping.xml:171 +#, fuzzy, no-c-format +msgid "" +"persister: specifies a custom ClassPersister. The persister attribute lets you customize the " +"persistence strategy used for the class. You can, for example, specify your " +"own subclass of org.hibernate.persister.EntityPersister, " +"or you can even provide a completely new implementation of the interface " +"org.hibernate.persister.ClassPersister that implements, " +"for example, persistence via stored procedure calls, serialization to flat " +"files or LDAP. See org.hibernate.test.CustomPersister for " +"a simple example of \"persistence\" to a Hashtable." +msgstr "" +"persister 属性を指定することで、クラスの永続化戦略をカスタ" +"マイズできます。例えば org.hibernate.persister.EntityPersister 自身のサブクラスを指定したり、また例えばストアドプロシージャコール、" +"フラットファイルへシリアライズ、 LDAP などを通した永続性を実装する " +"org.hibernate.persister.ClassPersister インターフェースの" +"完全に新しい実装を提供できます。簡単な例として org.hibernate.test." +"CustomPersister を参照してください(これは Hashtable の「永続化」です)。" + +#. Tag: para +#: basic_mapping.xml:185 +#, fuzzy, no-c-format +msgid "" +"optimisticLock (defaults to VERSION): " +"determines the optimistic locking strategy. If you enable " +"dynamicUpdate, you will have a choice of optimistic " +"locking strategies:" +msgstr "" +"dynamic-update を有効にすれば、楽観ロック戦略を選ぶことに" +"なります:" + +#. Tag: para +#: basic_mapping.xml:192 +#, no-c-format +msgid "version: check the version/timestamp columns" +msgstr "" +"version バージョン/タイムスタンプカラムをチェックします。" + +#. Tag: para +#: basic_mapping.xml:197 +#, no-c-format +msgid "all: check all columns" +msgstr "all すべてのカラムをチェックします。" + +#. Tag: para +#: basic_mapping.xml:201 #, no-c-format msgid "" -"This element has several optional attributes. The schema " -"and catalog attributes specify that tables referred to in " -"this mapping belong to the named schema and/or catalog. If they are " -"specified, tablenames will be qualified by the given schema and catalog " -"names. If they are missing, tablenames will be unqualified. The " -"default-cascade attribute specifies what cascade style " -"should be assumed for properties and collections that do not specify a " -"cascade attribute. By default, the auto-import attribute allows you to use unqualified class names in the query " -"language." +"dirty: check the changed columns, allowing some " +"concurrent updates" msgstr "" -"この要素にはいくつかオプション属性があります。 schema 属性" -"と catalog 属性は、このマッピングが参照するテーブルが、こ" -"の属性によって指定されたスキーマと(または)カタログに属することを指定します。" -"この属性が指定されると、テーブル名は与えられたスキーマ名とカタログ名で修飾さ" -"れます。これらの属性が指定されていなければ、テーブル名は修飾されません。 " -"default-cascade 属性は、 cascade 属性を" -"指定していないプロパティやコレクションに、どのカスケードスタイルを割り当てる" -"かを指定します。 auto-import 属性は、クエリ言語内で修飾さ" -"れていないクラス名を、デフォルトで使えるようにします。" +"dirty 変更したカラムをチェックし、同時更新できるようにしま" +"す。" #. Tag: para +#: basic_mapping.xml:206 #, no-c-format -msgid "schema (optional): the name of a database schema." -msgstr "schema(オプション):データベーススキーマの名前。" - -#. Tag: para -#, no-c-format -msgid "catalog (optional): the name of a database catalog." -msgstr "" -"catalog (オプション):データベースカタログの名前。" +msgid "none: do not use optimistic locking" +msgstr "none 楽観ロックを使用しません。" #. Tag: para +#: basic_mapping.xml:211 #, no-c-format msgid "" -"default-cascade (optional - defaults to none): a default cascade style." +"It is strongly recommended that you use version/" +"timestamp columns for optimistic locking with Hibernate. This strategy " +"optimizes performance and correctly handles modifications made to detached " +"instances (i.e. when Session.merge() is used)." msgstr "" -"default-cascade (オプション - デフォルトは " -"none): デフォルトのカスケードスタイル。" +"Hibernate で楽観的ロック戦略を使うなら、バージョン/タイムスタンプカラムを使う" +"ことを 非常に 強くお勧めします。楽観的ロックはパフォーマ" +"ンスの観点からも最適であり、さらに分離インスタンスへの修正 (つまり " +"Session.marge() が使われるとき) を正確に扱うことのできる" +"唯一の戦略でもあります。" #. Tag: para +#: basic_mapping.xml:220 #, no-c-format msgid "" -"default-access (optional - defaults to property): the strategy Hibernate should use for accessing all properties. " -"It can be a custom implementation of PropertyAccessor." +"Be sure to import @javax.persistence.Entity to mark a " +"class as an entity. It's a common mistake to import @org." +"hibernate.annotations.Entity by accident." msgstr "" -"default-access (オプション - デフォルトは " -"property ): Hibernate がプロパティにアクセスする際に取る" -"べき戦略。 PropertyAccessor を実装することでカスタマイズ可" -"能。" #. Tag: para -#, no-c-format +#: basic_mapping.xml:227 +#, fuzzy, no-c-format msgid "" -"default-lazy (optional - defaults to true): the default value for unspecified lazy " -"attributes of class and collection mappings." +"Some entities are not mutable. They cannot be updated or deleted by the " +"application. This allows Hibernate to make some minor performance " +"optimizations.. Use the @Immutable annotation." msgstr "" -"default-lazy (オプション - デフォルトは true ): lazy 属性が指定されていないクラスやコレクショ" -"ンマッピングに対するデフォルト値。" +"mutable=\"false\" 指定をした不変クラスは、アプリケーション" +"による更新や削除が出来ないことがあります。これにより、 Hibernate がパフォーマ" +"ンスを少し改善します。" #. Tag: para -#, no-c-format +#: basic_mapping.xml:232 +#, fuzzy, no-c-format msgid "" -"auto-import (optional - defaults to true): specifies whether we can use unqualified class names of classes " -"in this mapping in the query language." +"You can also alter how Hibernate deals with lazy initialization for this " +"class. On @Proxy, use lazy=false " +"to disable lazy fetching (not recommended). You can also specify an " +"interface to use for lazy initializing proxies (defaults to the class " +"itself): use proxyClass on @Proxy. " +"Hibernate will initially return proxies (Javassist or CGLIB) that implement " +"the named interface. The persistent object will load when a method of the " +"proxy is invoked. See \"Initializing collections and proxies\" below." msgstr "" -"auto-import (オプション - デフォルトは true):クエリ言語内で、(このマッピング内のクラスの)修飾されていないク" -"ラス名を使えるかどうかを指定します。" +"オプションの proxy 属性により、クラスの永続インスタンスの" +"遅延初期化が可能になります。 Hibernate は最初に、指定したインターフェースを実" +"装した CGLIB プロキシを返します。実際の永続オブジェクトはプロキシのメソッドを" +"呼び出すときにロードします。以下の「遅延初期化のためのプロキシ」を参照してく" +"ださい。" #. Tag: para +#: basic_mapping.xml:243 #, no-c-format msgid "" -"package (optional): specifies a package prefix to use for " -"unqualified class names in the mapping document." +"@BatchSize specifies a \"batch size\" for fetching " +"instances of this class by identifier. Not yet loaded instances are loaded " +"batch-size at a time (default 1)." msgstr "" -"package (オプション): マッピングドキュメント内で修飾されて" -"いないクラス名に対して割り当てる、パッケージの接頭辞 (prefix) を指定します。" #. Tag: para -#, no-c-format +#: basic_mapping.xml:247 +#, fuzzy, no-c-format msgid "" -"If you have two persistent classes with the same unqualified name, you " -"should set auto-import=\"false\". An exception will " -"result if you attempt to assign two classes to the same \"imported\" name." +"You can specific an arbitrary SQL WHERE condition to be used when retrieving " +"objects of this class. Use @Where for that." msgstr "" -"(修飾されていない)同じ名前の永続クラスが2つあるなら、 auto-import=" -"\"false\" を設定すべきです。2つのクラスに\"インポートされた\"同じ名" -"前を割り当てようとすると、 Hibernate は例外を送出します。" +"where (オプション): このクラスのオブジェクトを検索する" +"ときに使用する、任意の SQL の WHERE 条件を指定します。" #. Tag: para -#, no-c-format +#: basic_mapping.xml:251 +#, fuzzy, no-c-format msgid "" -"The hibernate-mapping element allows you to nest several " -"persistent <class> mappings, as shown above. It is, " -"however, good practice (and expected by some tools) to map only a single " -"persistent class, or a single class hierarchy, in one mapping file and name " -"it after the persistent superclass. For example, Cat.hbm.xml, Dog.hbm.xml, or if using inheritance, " -"Animal.hbm.xml." +"In the same vein, @Check lets you define an SQL " +"expression used to generate a multi-row check " +"constraint for automatic schema generation." msgstr "" -"hibernate-mapping 要素は、最初の例で示したようにいくつかの" -"永続 <class> マッピングをネストできます。しかし、1" -"つのマッピングファイルではただひとつの永続クラス(またはひとつのクラス階層)に" -"マッピングするようにし、さらに永続スーパークラスの後で指定するべきでしょう(い" -"くつかのツールはこのようなマッピングファイルを想定しています)。例えば次のよう" -"になります。: Cat.hbm.xml , Dog.hbm.xml , または継承を使うなら Animal.hbm.xml 。" - -#. Tag: title -#, no-c-format -msgid "Class" -msgstr "Class" +"check (オプション):自動的にスキーマを生成するために、複" +"数行の check 制約を生成する SQL 式。" #. Tag: para +#: basic_mapping.xml:255 +#, fuzzy, no-c-format +msgid "" +"There is no difference between a view and a base table for a Hibernate " +"mapping. This is transparent at the database level, although some DBMS do " +"not support views properly, especially with updates. Sometimes you want to " +"use a view, but you cannot create one in the database (i.e. with a legacy " +"schema). In this case, you can map an immutable and read-only entity to a " +"given SQL subselect expression using @org.hibernate.annotations." +"Subselect:" +msgstr "" +"Hibernate のマッピングにとってビューと普通のテーブルの間に違いはなく、データ" +"ベースレベルでは透過的です(ただしビューを完全にはサポートしていない DBMS も" +"あります。特に、更新のあるビューに対してはそうです)。ビューを使いたくても、" +"データベースで作成できないことがあります(例えば、レガシースキーマの場合)。" +"この場合には、不変かつ読み取り専用のエンティティに与えられた SQL の副問合せ文" +"をマップできます:" + +#. Tag: programlisting +#: basic_mapping.xml:263 +#, fuzzy, no-c-format +msgid "" +"@Entity\n" +"@Subselect(\"select item.name, max(bid.amount), count(*) \"\n" +" + \"from item \"\n" +" + \"join bid on bid.item_id = item.id \"\n" +" + \"group by item.name\")\n" +"@Synchronize( {\"item\", \"bid\"} ) //tables impacted\n" +"public class Summary {\n" +" @Id\n" +" public String getId() { return id; }\n" +" ...\n" +"}" +msgstr "" +"<class name=\"Summary\">\n" +" <subselect>\n" +" select item.name, max(bid.amount), count(*)\n" +" from item\n" +" join bid on bid.item_id = item.id\n" +" group by item.name\n" +" </subselect>\n" +" <synchronize table=\"item\"/>\n" +" <synchronize table=\"bid\"/>\n" +" <id name=\"name\"/>\n" +" ...\n" +"</class>" + +#. Tag: para +#: basic_mapping.xml:265 #, no-c-format msgid "" -"You can declare a persistent class using the class " -"element. For example:" +"Declare the tables to synchronize this entity with, ensuring that auto-flush " +"happens correctly and that queries against the derived entity do not return " +"stale data. The <subselect> is available both as an " +"attribute and a nested mapping element." +msgstr "" +"テーブルをこのエンティティと同期するように定義してください。オートフラッシュ" +"が確実に起こるように、また導出エンティティに対するクエリが古いデータを返さな" +"いようにするためです。 <subselect> は属性とネストし" +"たマッピング属性のどちらでも利用できます。" + +#. Tag: para +#: basic_mapping.xml:270 +#, fuzzy, no-c-format +msgid "" +"We will now explore the same options using the hbm.xml structure. You can " +"declare a persistent class using the class element. For " +"example:" msgstr "class 要素を使って、永続クラスを宣言できます:" +#. Tag: programlisting +#: basic_mapping.xml:319 +#, fuzzy, no-c-format +msgid "" +"<class\n" +" name=\"ClassName\"\n" +" table=\"tableName\"\n" +" discriminator-value=\"discriminator_value\"\n" +" mutable=\"true|false\"\n" +" schema=\"owner\"\n" +" catalog=\"catalog\"\n" +" proxy=\"ProxyInterface\"\n" +" dynamic-update=\"true|false\"\n" +" dynamic-insert=\"true|false\"\n" +" select-before-update=\"true|false\"\n" +" polymorphism=\"implicit|explicit\"\n" +" where=\"arbitrary sql where condition\"\n" +" persister=\"PersisterClass\"\n" +" batch-size=\"N\"\n" +" optimistic-lock=\"none|version|dirty|all\"\n" +" lazy=\"true|false\"\n" +" entity-name=\"EntityName\"\n" +" check=\"arbitrary sql check condition\"\n" +" rowid=\"rowid\"\n" +" subselect=\"SQL expression\"\n" +" abstract=\"true|false\"\n" +" node=\"element-name\"\n" +"/>" +msgstr "" +"<class\n" +" name=\"ClassName\"\n" +" table=\"tableName\"\n" +" discriminator-value=\"discriminator_value\"\n" +" mutable=\"true|false\"\n" +" schema=\"owner\"\n" +" catalog=\"catalog\"\n" +" proxy=\"ProxyInterface\"\n" +" dynamic-update=\"true|false\"\n" +" dynamic-insert=\"true|false\"\n" +" select-before-update=\"true|false\"\n" +" polymorphism=\"implicit|explicit\"\n" +" where=\"arbitrary sql where condition\"\n" +" persister=\"PersisterClass\"\n" +" batch-size=\"N\"\n" +" optimistic-lock=\"none|version|dirty|all\"\n" +" lazy=\"true|false\"\n" +" entity-name=\"EntityName\"\n" +" check=\"arbitrary sql check condition\"\n" +" rowid=\"rowid\"\n" +" subselect=\"SQL expression\"\n" +" abstract=\"true|false\"\n" +" node=\"element-name\"\n" +"/>" + #. Tag: para +#: basic_mapping.xml:323 #, no-c-format msgid "" "name (optional): the fully qualified Java class name of " @@ -299,6 +792,7 @@ msgstr "" "ティティに対するマッピングとして扱われます。" #. Tag: para +#: basic_mapping.xml:330 #, no-c-format msgid "" "table (optional - defaults to the unqualified class " @@ -308,6 +802,7 @@ msgstr "" "名):データベーステーブルの名前。" #. Tag: para +#: basic_mapping.xml:335 #, no-c-format msgid "" "discriminator-value (optional - defaults to the class " @@ -320,6 +815,7 @@ msgstr "" "nullnot null のいずれかを取ります。" #. Tag: para +#: basic_mapping.xml:343 #, no-c-format msgid "" "mutable (optional - defaults to true): " @@ -330,6 +826,7 @@ msgstr "" "定します。" #. Tag: para +#: basic_mapping.xml:349 basic_mapping.xml:2912 #, no-c-format msgid "" "schema (optional): overrides the schema name specified by " @@ -339,6 +836,7 @@ msgstr "" "mapping> 要素で指定したスキーマ名をオーバーライドします。" #. Tag: para +#: basic_mapping.xml:355 basic_mapping.xml:2918 #, no-c-format msgid "" "catalog (optional): overrides the catalog name specified " @@ -348,6 +846,7 @@ msgstr "" "mapping> 要素で指定したカタログ名をオーバーライドします。" #. Tag: para +#: basic_mapping.xml:361 #, no-c-format msgid "" "proxy (optional): specifies an interface to use for lazy " @@ -357,6 +856,7 @@ msgstr "" "フェースを指定します。永続化するクラス名そのものを指定することも可能です。" #. Tag: para +#: basic_mapping.xml:367 #, no-c-format msgid "" "dynamic-update (optional - defaults to falseUPDATE 文を、実行時に生成することを指定します。" #. Tag: para +#: basic_mapping.xml:374 #, no-c-format msgid "" "dynamic-insert (optional - defaults to false 文を、実行時に生成することを指定します。" #. Tag: para +#: basic_mapping.xml:381 #, no-c-format msgid "" "select-before-update (optional - defaults to " @@ -399,10 +901,11 @@ msgstr "" "ます。" #. Tag: para -#, no-c-format +#: basic_mapping.xml:393 +#, fuzzy, no-c-format msgid "" -"polymorphism (optional - defaults to implicit): determines whether implicit or explicit query polymorphism is " +"polymorphisms (optional - defaults to implicit): determines whether implicit or explicit query polymorphisms is " "used." msgstr "" "polymorphism (オプション、デフォルトでは " @@ -410,6 +913,7 @@ msgstr "" "クエリポリモーフィズムを使うか決定します。" #. Tag: para +#: basic_mapping.xml:399 #, no-c-format msgid "" "where (optional): specifies an arbitrary SQL " @@ -420,6 +924,7 @@ msgstr "" "ときに使用する、任意の SQL の WHERE 条件を指定します。" #. Tag: para +#: basic_mapping.xml:405 #, no-c-format msgid "" "persister (optional): specifies a custom " @@ -429,6 +934,7 @@ msgstr "" "ClassPersister を指定します。" #. Tag: para +#: basic_mapping.xml:410 #, no-c-format msgid "" "batch-size (optional - defaults to 1): " @@ -440,6 +946,7 @@ msgstr "" "ズ」を指定します。" #. Tag: para +#: basic_mapping.xml:416 #, no-c-format msgid "" "optimistic-lock (optional - defaults to versionversion ): 楽観ロック戦略を決定します。" #. Tag: para +#: basic_mapping.xml:422 #, no-c-format msgid "" "lazy (optional): lazy fetching can be disabled by setting " @@ -458,14 +966,15 @@ msgstr "" "設定することで、遅延フェッチができなくなります。" #. Tag: para -#, no-c-format +#: basic_mapping.xml:427 +#, fuzzy, no-c-format msgid "" "entity-name (optional - defaults to the class name): " "Hibernate3 allows a class to be mapped multiple times, potentially to " "different tables. It also allows entity mappings that are represented by " "Maps or XML at the Java level. In these cases, you should provide an " "explicit arbitrary name for the entity. See and for more information." +"classes-dynamicmodels\"/> and for more information." msgstr "" "entity-name (オプション、デフォルトはクラス名): " "Hibernate3 ではクラスが複数回マッピングでき(場合によっては違うテーブルに対し" @@ -475,6 +984,7 @@ msgstr "" " を参照してください。" #. Tag: para +#: basic_mapping.xml:437 #, no-c-format msgid "" "check (optional): an SQL expression used to generate a " @@ -485,6 +995,7 @@ msgstr "" "数行の check 制約を生成する SQL 式。" #. Tag: para +#: basic_mapping.xml:443 #, no-c-format msgid "" "rowid (optional): Hibernate can use ROWIDs on databases. " @@ -501,6 +1012,7 @@ msgstr "" "的な位置を表しています。" #. Tag: para +#: basic_mapping.xml:452 #, fuzzy, no-c-format msgid "" "subselect (optional): maps an immutable and read-only " @@ -513,6 +1025,7 @@ msgstr "" "せん。より詳しい情報は下記を参照してください。" #. Tag: para +#: basic_mapping.xml:459 #, no-c-format msgid "" "abstract (optional): is used to mark abstract " @@ -522,6 +1035,7 @@ msgstr "" " 階層内の抽象スーパークラスにマークするために使います。" #. Tag: para +#: basic_mapping.xml:466 #, no-c-format msgid "" "It is acceptable for the named persistent class to be an interface. You can " @@ -537,203 +1051,62 @@ msgstr "" "literal> を使ってクラス名を指定してください。" #. Tag: para +#: basic_mapping.xml:472 +#, no-c-format +msgid "Here is how to do a virtual view (subselect) in XML:" +msgstr "" + +#. Tag: programlisting +#: basic_mapping.xml:474 +#, fuzzy, no-c-format +msgid "" +"<class name=\"Summary\">\n" +" <subselect>\n" +" select item.name, max(bid.amount), count(*)\n" +" from item\n" +" join bid on bid.item_id = item.id\n" +" group by item.name\n" +" </subselect>\n" +" <synchronize table=\"item\"/>\n" +" <synchronize table=\"bid\"/>\n" +" <id name=\"name\"/>\n" +" ...\n" +"</class>" +msgstr "" +"<class name=\"Summary\">\n" +" <subselect>\n" +" select item.name, max(bid.amount), count(*)\n" +" from item\n" +" join bid on bid.item_id = item.id\n" +" group by item.name\n" +" </subselect>\n" +" <synchronize table=\"item\"/>\n" +" <synchronize table=\"bid\"/>\n" +" <id name=\"name\"/>\n" +" ...\n" +"</class>" + +#. Tag: para +#: basic_mapping.xml:476 #, no-c-format msgid "" -"Immutable classes, mutable=\"false\", cannot be updated " -"or deleted by the application. This allows Hibernate to make some minor " -"performance optimizations." +"The <subselect> is available both as an attribute " +"and a nested mapping element." msgstr "" -"mutable=\"false\" 指定をした不変クラスは、アプリケーション" -"による更新や削除が出来ないことがあります。これにより、 Hibernate がパフォーマ" -"ンスを少し改善します。" - -#. Tag: para -#, no-c-format -msgid "" -"The optional proxy attribute enables lazy initialization " -"of persistent instances of the class. Hibernate will initially return CGLIB " -"proxies that implement the named interface. The persistent object will load " -"when a method of the proxy is invoked. See \"Initializing collections and " -"proxies\" below." -msgstr "" -"オプションの proxy 属性により、クラスの永続インスタンスの" -"遅延初期化が可能になります。 Hibernate は最初に、指定したインターフェースを実" -"装した CGLIB プロキシを返します。実際の永続オブジェクトはプロキシのメソッドを" -"呼び出すときにロードします。以下の「遅延初期化のためのプロキシ」を参照してく" -"ださい。" - -#. Tag: para -#, no-c-format -msgid "" -"Implicit polymorphism means that instances of the class " -"will be returned by a query that names any superclass or implemented " -"interface or class, and that instances of any subclass of the class will be " -"returned by a query that names the class itself. Explicit polymorphism means that class instances will be returned only by " -"queries that explicitly name that class. Queries that name the class will " -"return only instances of subclasses mapped inside this <class>" -" declaration as a <subclass> or " -"<joined-subclass>. For most purposes, the default " -"polymorphism=\"implicit\" is appropriate. Explicit " -"polymorphism is useful when two different classes are mapped to the same " -"table This allows a \"lightweight\" class that contains a subset of the " -"table columns." -msgstr "" -" 暗黙的 ポリモーフィズムとは、次の二つを意味しています。" -"一つはクラスのインスタンスが、スーパークラスや実装したインターフェース、また" -"そのクラスを指定するクエリによって返されることで、もう一つはそのクラスのサブ" -"クラスのインスタンスが、そのクラス自身を指定したクエリによって返されることで" -"す。また、 明示的 ポリモーフィズムとは、次の二つを意味し" -"ています。一つはクラスのインスタンスが、そのクラスを明示的に指定したクエリに" -"よってのみ返されることで、もう一つはクラスを指定したクエリが、 <" -"class> 要素の中で <subclass> や " -"<joined-subclass> とマッピングされているサブクラスの" -"インスタンスだけを返すことです。ほとんどの用途ではデフォルトの " -"polymorphism=\"implicit\" が適切です。明示的なポリモーフィ" -"ズムは、2つの違ったクラスが同じテーブルにマッピングされているときに有用です " -"(これによってテーブルカラムのサブセットを含む、「軽量な」クラスが可能になり" -"ます)。" - -#. Tag: para -#, no-c-format -msgid "" -"The persister attribute lets you customize the " -"persistence strategy used for the class. You can, for example, specify your " -"own subclass of org.hibernate.persister.EntityPersister, " -"or you can even provide a completely new implementation of the interface " -"org.hibernate.persister.ClassPersister that implements, " -"for example, persistence via stored procedure calls, serialization to flat " -"files or LDAP. See org.hibernate.test.CustomPersister for " -"a simple example of \"persistence\" to a Hashtable." -msgstr "" -"persister 属性を指定することで、クラスの永続化戦略をカスタ" -"マイズできます。例えば org.hibernate.persister.EntityPersister 自身のサブクラスを指定したり、また例えばストアドプロシージャコール、" -"フラットファイルへシリアライズ、 LDAP などを通した永続性を実装する " -"org.hibernate.persister.ClassPersister インターフェースの" -"完全に新しい実装を提供できます。簡単な例として org.hibernate.test." -"CustomPersister を参照してください(これは Hashtable の「永続化」です)。" - -#. Tag: para -#, no-c-format -msgid "" -"The dynamic-update and dynamic-insert " -"settings are not inherited by subclasses, so they can also be specified on " -"the <subclass> or <joined-subclass> elements. Although these settings can increase performance in some " -"cases, they can actually decrease performance in others." -msgstr "" -"dynamic-updatedynamic-insert の設定" -"はサブクラスに継承されません。そのため <subclass> " -"や <joined-subclass> 要素を指定することも出来ます。" -"これらの設定はパフォーマンスを向上させる事もありますが、落とすこともあります" -"ので、慎重に使用してください。" - -#. Tag: para -#, no-c-format -msgid "" -"Use of select-before-update will usually decrease " -"performance. It is useful to prevent a database update trigger being called " -"unnecessarily if you reattach a graph of detached instances to a " -"Session." -msgstr "" -"select-before-update の使用は通常パフォーマンスを落としま" -"す。もし Session へ分離インスタンスのグラフを再追加するな" -"ら、データベース更新のトリガを不必要に呼び出すのを避けるという点で、非常に有" -"用です。" - -#. Tag: para -#, no-c-format -msgid "" -"If you enable dynamic-update, you will have a choice of " -"optimistic locking strategies:" -msgstr "" -"dynamic-update を有効にすれば、楽観ロック戦略を選ぶことに" -"なります:" - -#. Tag: para -#, no-c-format -msgid "version: check the version/timestamp columns" -msgstr "" -"version バージョン/タイムスタンプカラムをチェックします。" - -#. Tag: para -#, no-c-format -msgid "all: check all columns" -msgstr "all すべてのカラムをチェックします。" - -#. Tag: para -#, no-c-format -msgid "" -"dirty: check the changed columns, allowing some " -"concurrent updates" -msgstr "" -"dirty 変更したカラムをチェックし、同時更新できるようにしま" -"す。" - -#. Tag: para -#, no-c-format -msgid "none: do not use optimistic locking" -msgstr "none 楽観ロックを使用しません。" - -#. Tag: para -#, no-c-format -msgid "" -"It is strongly recommended that you use version/" -"timestamp columns for optimistic locking with Hibernate. This strategy " -"optimizes performance and correctly handles modifications made to detached " -"instances (i.e. when Session.merge() is used)." -msgstr "" -"Hibernate で楽観的ロック戦略を使うなら、バージョン/タイムスタンプカラムを使う" -"ことを 非常に 強くお勧めします。楽観的ロックはパフォーマ" -"ンスの観点からも最適であり、さらに分離インスタンスへの修正 (つまり " -"Session.marge() が使われるとき) を正確に扱うことのできる" -"唯一の戦略でもあります。" - -#. Tag: para -#, no-c-format -msgid "" -"There is no difference between a view and a base table for a Hibernate " -"mapping. This is transparent at the database level, although some DBMS do " -"not support views properly, especially with updates. Sometimes you want to " -"use a view, but you cannot create one in the database (i.e. with a legacy " -"schema). In this case, you can map an immutable and read-only entity to a " -"given SQL subselect expression:" -msgstr "" -"Hibernate のマッピングにとってビューと普通のテーブルの間に違いはなく、データ" -"ベースレベルでは透過的です(ただしビューを完全にはサポートしていない DBMS も" -"あります。特に、更新のあるビューに対してはそうです)。ビューを使いたくても、" -"データベースで作成できないことがあります(例えば、レガシースキーマの場合)。" -"この場合には、不変かつ読み取り専用のエンティティに与えられた SQL の副問合せ文" -"をマップできます:" - -#. Tag: para -#, no-c-format -msgid "" -"Declare the tables to synchronize this entity with, ensuring that auto-flush " -"happens correctly and that queries against the derived entity do not return " -"stale data. The <subselect> is available both as an " -"attribute and a nested mapping element." -msgstr "" -"テーブルをこのエンティティと同期するように定義してください。オートフラッシュ" -"が確実に起こるように、また導出エンティティに対するクエリが古いデータを返さな" -"いようにするためです。 <subselect> は属性とネストし" -"たマッピング属性のどちらでも利用できます。" #. Tag: title +#: basic_mapping.xml:481 #, fuzzy, no-c-format -msgid "id" -msgstr "uuid" +msgid "Identifiers" +msgstr "識別子の割り当て" #. Tag: para -#, no-c-format +#: basic_mapping.xml:483 +#, fuzzy, no-c-format msgid "" "Mapped classes must declare the primary key column of " "the database table. Most classes will also have a JavaBeans-style property " -"holding the unique identifier of an instance. The <id> element defines the mapping from that property to the primary key " -"column." +"holding the unique identifier of an instance." msgstr "" "マップされたクラスはデータベーステーブルの主キーカラムを定義 しなけ" "ればなりません 。ほとんどのクラスにはインスタンスのユニークな識別" @@ -742,18 +1115,74 @@ msgstr "" "ます。" #. Tag: para +#: basic_mapping.xml:488 +#, no-c-format +msgid "Mark the identifier property with @Id." +msgstr "" + +#. Tag: programlisting +#: basic_mapping.xml:491 +#, no-c-format +msgid "" +"@Entity\n" +"public class Person {\n" +" @Id Integer getId() { ... }\n" +" ...\n" +"}" +msgstr "" + +#. Tag: para +#: basic_mapping.xml:493 +#, fuzzy, no-c-format +msgid "" +"In hbm.xml, use the <id> element which defines the " +"mapping from that property to the primary key column." +msgstr "" +"<column> タグで、プロパティを複数のカラムへマッピン" +"グできることに注目してください。" + +#. Tag: programlisting +#: basic_mapping.xml:509 +#, fuzzy, no-c-format +msgid "" +"<id\n" +" name=\"propertyName\"\n" +" type=\"typename\"\n" +" column=\"column_name\"\n" +" unsaved-value=\"null|any|none|undefined|id_value\"\n" +" access=\"field|property|ClassName\">\n" +" node=\"element-name|@attribute-name|element/@attribute|.\"\n" +"\n" +" <generator class=\"generatorClass\"/>\n" +"</id>" +msgstr "" +"<id\n" +" name=\"propertyName\"\n" +" type=\"typename\"\n" +" column=\"column_name\"\n" +" unsaved-value=\"null|any|none|undefined|id_value\"\n" +" access=\"field|property|ClassName\">\n" +" node=\"element-name|@attribute-name|element/@attribute|.\"\n" +"\n" +" <generator class=\"generatorClass\"/>\n" +"</id>" + +#. Tag: para +#: basic_mapping.xml:513 #, no-c-format msgid "" "name (optional): the name of the identifier property." msgstr "name(オプション):識別子プロパティの名前。" #. Tag: para +#: basic_mapping.xml:518 basic_mapping.xml:2141 #, no-c-format msgid "" "type (optional): a name that indicates the Hibernate type." msgstr "type(オプション): Hibernate の型を示す名前。" #. Tag: para +#: basic_mapping.xml:523 #, no-c-format msgid "" "column (optional - defaults to the property name): the " @@ -763,6 +1192,7 @@ msgstr "" "ラムの名前。" #. Tag: para +#: basic_mapping.xml:528 #, no-c-format msgid "" "unsaved-value (optional - defaults to a \"sensible\" " @@ -776,6 +1206,7 @@ msgstr "" "離インスタンスと区別するために使います。" #. Tag: para +#: basic_mapping.xml:536 #, no-c-format msgid "" "access (optional - defaults to property ): Hibernate がプロパティの値にアクセスするために使用すべき戦略。" #. Tag: para +#: basic_mapping.xml:543 #, no-c-format msgid "" "If the name attribute is missing, it is assumed that the " @@ -795,45 +1227,1088 @@ msgstr "" "とみなされます。" #. Tag: para -#, no-c-format +#: basic_mapping.xml:546 +#, fuzzy, no-c-format msgid "" "The unsaved-value attribute is almost never needed in " -"Hibernate3." +"Hibernate3 and indeed has no corresponding element in annotations." msgstr "" "unsaved-value 属性は Hibernate3 ではほとんどの場合、必要で" "はありません。" #. Tag: para -#, no-c-format +#: basic_mapping.xml:550 +#, fuzzy, no-c-format msgid "" -"There is an alternative <composite-id> declaration " -"that allows access to legacy data with composite keys. Its use is strongly " -"discouraged for anything else." +"You can also declare the identifier as a composite identifier. This allows " +"access to legacy data with composite keys. Its use is strongly discouraged " +"for anything else." msgstr "" "複合キーを持つレガシーデータにアクセスできるように、 <composite-" "id> という代替のマッピング定義があります。しかし他の用途への使用" "は全くおすすめできません。" #. Tag: title -#, no-c-format -msgid "Generator" -msgstr "ジェネレータ" +#: basic_mapping.xml:555 +#, fuzzy, no-c-format +msgid "Composite identifier" +msgstr "識別子の割り当て" #. Tag: para +#: basic_mapping.xml:557 +#, no-c-format +msgid "You can define a composite primary key through several syntaxes:" +msgstr "" + +#. Tag: para +#: basic_mapping.xml:562 #, no-c-format msgid "" -"The optional <generator> child element names a Java " -"class used to generate unique identifiers for instances of the persistent " -"class. If any parameters are required to configure or initialize the " -"generator instance, they are passed using the <param> element." +"use a component type to represent the identifier and map it as a property in " +"the entity: you then annotated the property as @EmbeddedId. The component type has to be Serializable." +msgstr "" + +#. Tag: para +#: basic_mapping.xml:569 +#, no-c-format +msgid "" +"map multiple properties as @Id properties: the " +"identifier type is then the entity class itself and needs to be " +"Serializable. This approach is unfortunately not " +"standard and only supported by Hibernate." +msgstr "" + +#. Tag: para +#: basic_mapping.xml:577 +#, no-c-format +msgid "" +"map multiple properties as @Id properties and declare " +"an external class to be the identifier type. This class, which needs to be " +"Serializable, is declared on the entity via the " +"@IdClass annotation. The identifier type must contain " +"the same properties as the identifier properties of the entity: each " +"property name must be the same, its type must be the same as well if the " +"entity property is of a basic type, its type must be the type of the primary " +"key of the associated entity if the entity property is an association " +"(either a @OneToOne or a @ManyToOne)." +msgstr "" + +#. Tag: para +#: basic_mapping.xml:592 +#, no-c-format +msgid "" +"As you can see the last case is far from obvious. It has been inherited from " +"the dark ages of EJB 2 for backward compatibilities and we recommend you not " +"to use it (for simplicity sake)." +msgstr "" + +#. Tag: para +#: basic_mapping.xml:596 +#, no-c-format +msgid "Let's explore all three cases using examples." +msgstr "" + +#. Tag: title +#: basic_mapping.xml:599 +#, no-c-format +msgid "id as a property using a component type" +msgstr "" + +#. Tag: para +#: basic_mapping.xml:601 +#, no-c-format +msgid "Here is a simple example of @EmbeddedId." +msgstr "" + +#. Tag: programlisting +#: basic_mapping.xml:604 +#, no-c-format +msgid "" +"@Entity\n" +"class User {\n" +" @EmbeddedId\n" +" @AttributeOverride(name=\"firstName\", column=@Column(name=\"fld_firstname" +"\")\n" +" UserId id;\n" +"\n" +" Integer age;\n" +"}\n" +"\n" +"@Embeddable\n" +"class UserId implements Serializable {\n" +" String firstName;\n" +" String lastName;\n" +"}" +msgstr "" + +#. Tag: para +#: basic_mapping.xml:606 +#, no-c-format +msgid "" +"You can notice that the UserId class is serializable. " +"To override the column mapping, use @AttributeOverride." +msgstr "" + +#. Tag: para +#: basic_mapping.xml:610 +#, no-c-format +msgid "" +"An embedded id can itself contains the primary key of an associated entity." +msgstr "" + +#. Tag: programlisting +#: basic_mapping.xml:613 +#, no-c-format +msgid "" +"@Entity\n" +"class Customer {\n" +" @EmbeddedId CustomerId id;\n" +" boolean preferredCustomer;\n" +"\n" +" @MapsId(\"userId\")\n" +" @JoinColumns({\n" +" @JoinColumn(name=\"userfirstname_fk\", referencedColumnName=\"firstName" +"\"),\n" +" @JoinColumn(name=\"userlastname_fk\", referencedColumnName=\"lastName" +"\")\n" +" })\n" +" @OneToOne User user;\n" +"}\n" +"\n" +"@Embeddable\n" +"class CustomerId implements Serializable {\n" +" UserId userId;\n" +" String customerNumber;\n" +"\n" +" //implements equals and hashCode\n" +"}\n" +"\n" +"@Entity \n" +"class User {\n" +" @EmbeddedId UserId id;\n" +" Integer age;\n" +"}\n" +"\n" +"@Embeddable\n" +"class UserId implements Serializable {\n" +" String firstName;\n" +" String lastName;\n" +"\n" +" //implements equals and hashCode\n" +"}" +msgstr "" + +#. Tag: para +#: basic_mapping.xml:615 +#, no-c-format +msgid "" +"In the embedded id object, the association is represented as the identifier " +"of the associated entity. But you can link its value to a regular " +"association in the entity via the @MapsId annotation. " +"The @MapsId value correspond to the property name of " +"the embedded id object containing the associated entity's identifier. In the " +"database, it means that the Customer.user and the " +"CustomerId.userId properties share the same underlying " +"column (user_fk in this case)." +msgstr "" + +#. Tag: para +#: basic_mapping.xml:627 +#, no-c-format +msgid "" +"The component type used as identifier must implement equals() and hashCode()." +msgstr "" + +#. Tag: para +#: basic_mapping.xml:632 +#, no-c-format +msgid "" +"In practice, your code only sets the Customer.user " +"property and the user id value is copied by Hibernate into the " +"CustomerId.userId property." +msgstr "" + +#. Tag: para +#: basic_mapping.xml:638 +#, no-c-format +msgid "" +"The id value can be copied as late as flush time, don't rely on it until " +"after flush time." +msgstr "" + +#. Tag: para +#: basic_mapping.xml:642 +#, no-c-format +msgid "" +"While not supported in JPA, Hibernate lets you place your association " +"directly in the embedded id component (instead of having to use the " +"@MapsId annotation)." +msgstr "" + +#. Tag: programlisting +#: basic_mapping.xml:646 +#, no-c-format +msgid "" +"@Entity\n" +"class Customer {\n" +" @EmbeddedId CustomerId id;\n" +" boolean preferredCustomer;\n" +"}\n" +"\n" +"@Embeddable\n" +"class CustomerId implements Serializable {\n" +" @OneToOne\n" +" @JoinColumns({\n" +" @JoinColumn(name=\"userfirstname_fk\", referencedColumnName=\"firstName" +"\"),\n" +" @JoinColumn(name=\"userlastname_fk\", referencedColumnName=\"lastName" +"\")\n" +" }) \n" +" User user;\n" +" String customerNumber;\n" +"\n" +" //implements equals and hashCode\n" +"}\n" +"\n" +"@Entity \n" +"class User {\n" +" @EmbeddedId UserId id;\n" +" Integer age;\n" +"}\n" +"\n" +"@Embeddable\n" +"class UserId implements Serializable {\n" +" String firstName;\n" +" String lastName;\n" +"\n" +"\n" +" //implements equals and hashCode\n" +"}" +msgstr "" + +#. Tag: para +#: basic_mapping.xml:648 +#, no-c-format +msgid "Let's now rewrite these examples using the hbm.xml syntax." +msgstr "" + +#. Tag: programlisting +#: basic_mapping.xml:651 +#, fuzzy, no-c-format +msgid "" +"<composite-id\n" +" name=\"propertyName\"\n" +" class=\"ClassName\"\n" +" mapped=\"true|false\"\n" +" access=\"field|property|ClassName\"\n" +" node=\"element-name|.\">\n" +"\n" +" <key-property name=\"propertyName\" type=\"typename\" column=" +"\"column_name\"/>\n" +" <key-many-to-one name=\"propertyName\" class=\"ClassName\" column=" +"\"column_name\"/>\n" +" ......\n" +"</composite-id>" +msgstr "" +"<composite-id\n" +" name=\"propertyName\"\n" +" class=\"ClassName\"\n" +" mapped=\"true|false\"\n" +" access=\"field|property|ClassName\">\n" +" node=\"element-name|.\"\n" +"\n" +" <key-property name=\"propertyName\" type=\"typename\" column=" +"\"column_name\"/>\n" +" <key-many-to-one name=\"propertyName class=\"ClassName\" column=" +"\"column_name\"/>\n" +" ......\n" +"</composite-id>" + +#. Tag: para +#: basic_mapping.xml:653 +#, no-c-format +msgid "First a simple example:" +msgstr "" + +#. Tag: programlisting +#: basic_mapping.xml:655 +#, no-c-format +msgid "" +"<class name=\"User\">\n" +" <composite-id name=\"id\" class=\"UserId\">\n" +" <key-property name=\"firstName\" column=\"fld_firstname\"/>\n" +" <key-property name=\"lastName\"/>\n" +" </composite-id>\n" +"</class>" +msgstr "" + +#. Tag: para +#: basic_mapping.xml:657 +#, no-c-format +msgid "Then an example showing how an association can be mapped." +msgstr "" + +#. Tag: programlisting +#: basic_mapping.xml:660 +#, no-c-format +msgid "" +"<class name=\"Customer\">\n" +" <composite-id name=\"id\" class=\"CustomerId\">\n" +" <key-property name=\"firstName\" column=\"userfirstname_fk\"/>\n" +" <key-property name=\"lastName\" column=\"userfirstname_fk\"/>\n" +" <key-property name=\"customerNumber\"/>\n" +" </composite-id>\n" +"\n" +" <property name=\"preferredCustomer\"/>\n" +"\n" +" <many-to-one name=\"user\">\n" +" <column name=\"userfirstname_fk\" updatable=\"false\" insertable=" +"\"false\"/>\n" +" <column name=\"userlastname_fk\" updatable=\"false\" insertable=" +"\"false\"/>\n" +" </many-to-one>\n" +"</class>\n" +"\n" +"<class name=\"User\">\n" +" <composite-id name=\"id\" class=\"UserId\">\n" +" <key-property name=\"firstName\"/>\n" +" <key-property name=\"lastName\"/>\n" +" </composite-id>\n" +"\n" +" <property name=\"age\"/>\n" +"</class>" +msgstr "" + +#. Tag: para +#: basic_mapping.xml:662 +#, no-c-format +msgid "Notice a few things in the previous example:" +msgstr "" + +#. Tag: para +#: basic_mapping.xml:666 +#, no-c-format +msgid "" +"the order of the properties (and column) matters. It must be the same " +"between the association and the primary key of the associated entity" +msgstr "" + +#. Tag: para +#: basic_mapping.xml:672 +#, no-c-format +msgid "" +"the many to one uses the same columns as the primary key and thus must be " +"marked as read only (insertable and updatable to false)." +msgstr "" + +#. Tag: para +#: basic_mapping.xml:679 +#, no-c-format +msgid "" +"unlike with @MapsId, the id value of the associated " +"entity is not transparently copied, check the foreign id " +"generator for more information." +msgstr "" + +#. Tag: para +#: basic_mapping.xml:686 +#, no-c-format +msgid "" +"The last example shows how to map association directly in the embedded id " +"component." +msgstr "" + +#. Tag: programlisting +#: basic_mapping.xml:689 +#, no-c-format +msgid "" +"<class name=\"Customer\">\n" +" <composite-id name=\"id\" class=\"CustomerId\">\n" +" <key-many-to-one name=\"user\">\n" +" <column name=\"userfirstname_fk\"/>\n" +" <column name=\"userlastname_fk\"/>\n" +" </key-many-to-one>\n" +" <key-property name=\"customerNumber\"/>\n" +" </composite-id>\n" +"\n" +" <property name=\"preferredCustomer\"/>\n" +"</class>\n" +"\n" +"<class name=\"User\">\n" +" <composite-id name=\"id\" class=\"UserId\">\n" +" <key-property name=\"firstName\"/>\n" +" <key-property name=\"lastName\"/>\n" +" </composite-id>\n" +"\n" +" <property name=\"age\"/>\n" +"</class>" +msgstr "" + +#. Tag: para +#: basic_mapping.xml:691 +#, no-c-format +msgid "" +"This is the recommended approach to map composite identifier. The following " +"options should not be considered unless some constraint are present." +msgstr "" + +#. Tag: title +#: basic_mapping.xml:697 +#, no-c-format +msgid "Multiple id properties without identifier type" +msgstr "" + +#. Tag: para +#: basic_mapping.xml:699 +#, no-c-format +msgid "" +"Another, arguably more natural, approach is to place @Id on multiple properties of your entity. This approach is only " +"supported by Hibernate (not JPA compliant) but does not require an extra " +"embeddable component." +msgstr "" + +#. Tag: programlisting +#: basic_mapping.xml:704 +#, no-c-format +msgid "" +"@Entity\n" +"class Customer implements Serializable {\n" +" @Id @OneToOne\n" +" @JoinColumns({\n" +" @JoinColumn(name=\"userfirstname_fk\", referencedColumnName=\"firstName" +"\"),\n" +" @JoinColumn(name=\"userlastname_fk\", referencedColumnName=\"lastName" +"\")\n" +" })\n" +" User user;\n" +" \n" +" @Id String customerNumber;\n" +"\n" +" boolean preferredCustomer;\n" +"\n" +" //implements equals and hashCode\n" +"}\n" +"\n" +"@Entity \n" +"class User {\n" +" @EmbeddedId UserId id;\n" +" Integer age;\n" +"}\n" +"\n" +"@Embeddable\n" +"class UserId implements Serializable {\n" +" String firstName;\n" +" String lastName;\n" +"\n" +" //implements equals and hashCode\n" +"}" +msgstr "" + +#. Tag: para +#: basic_mapping.xml:706 +#, no-c-format +msgid "" +"In this case Customer is its own identifier " +"representation: it must implement Serializable and " +"must implement equals() and hashCode()." +msgstr "" + +#. Tag: para +#: basic_mapping.xml:712 +#, no-c-format +msgid "In hbm.xml, the same mapping is:" +msgstr "" + +#. Tag: programlisting +#: basic_mapping.xml:714 +#, no-c-format +msgid "" +"<class name=\"Customer\">\n" +" <composite-id>\n" +" <key-many-to-one name=\"user\">\n" +" <column name=\"userfirstname_fk\"/>\n" +" <column name=\"userlastname_fk\"/>\n" +" </key-many-to-one>\n" +" <key-property name=\"customerNumber\"/>\n" +" </composite-id>\n" +"\n" +" <property name=\"preferredCustomer\"/>\n" +"</class>\n" +"\n" +"<class name=\"User\">\n" +" <composite-id name=\"id\" class=\"UserId\">\n" +" <key-property name=\"firstName\"/>\n" +" <key-property name=\"lastName\"/>\n" +" </composite-id>\n" +"\n" +" <property name=\"age\"/>\n" +"</class>" +msgstr "" + +#. Tag: title +#: basic_mapping.xml:718 +#, no-c-format +msgid "Multiple id properties with with a dedicated identifier type" +msgstr "" + +#. Tag: para +#: basic_mapping.xml:721 +#, no-c-format +msgid "" +"@IdClass on an entity points to the class (component) " +"representing the identifier of the class. The properties marked " +"@Id on the entity must have their corresponding " +"property on the @IdClass. The return type of search " +"twin property must be either identical for basic properties or must " +"correspond to the identifier class of the associated entity for an " +"association." +msgstr "" + +#. Tag: para +#: basic_mapping.xml:730 +#, no-c-format +msgid "" +"This approach is inherited from the EJB 2 days and we recommend against its " +"use. But, after all it's your application and Hibernate supports it." +msgstr "" + +#. Tag: programlisting +#: basic_mapping.xml:735 +#, no-c-format +msgid "" +"@Entity\n" +"@IdClass(CustomerId.class)\n" +"class Customer implements Serializable {\n" +" @Id @OneToOne\n" +" @JoinColumns({\n" +" @JoinColumn(name=\"userfirstname_fk\", referencedColumnName=\"firstName" +"\"),\n" +" @JoinColumn(name=\"userlastname_fk\", referencedColumnName=\"lastName" +"\")\n" +" }) \n" +" User user;\n" +" \n" +" @Id String customerNumber;\n" +"\n" +" boolean preferredCustomer;\n" +"}\n" +"\n" +"class CustomerId implements Serializable {\n" +" UserId user;\n" +" String customerNumber;\n" +"\n" +" //implements equals and hashCode\n" +"}\n" +"\n" +"@Entity \n" +"class User {\n" +" @EmbeddedId UserId id;\n" +" Integer age;\n" +"\n" +" //implements equals and hashCode\n" +"}\n" +"\n" +"@Embeddable\n" +"class UserId implements Serializable {\n" +" String firstName;\n" +" String lastName;\n" +"\n" +" //implements equals and hashCode\n" +"}" +msgstr "" + +#. Tag: para +#: basic_mapping.xml:737 +#, no-c-format +msgid "" +"Customer and CustomerId do " +"have the same properties customerNumber as well as " +"user. CustomerId must be " +"Serializable and implement equals() and hashCode()." +msgstr "" + +#. Tag: para +#: basic_mapping.xml:745 +#, no-c-format +msgid "" +"While not JPA standard, Hibernate let's you declare the vanilla associated " +"property in the @IdClass." +msgstr "" + +#. Tag: programlisting +#: basic_mapping.xml:749 +#, no-c-format +msgid "" +"@Entity\n" +"@IdClass(CustomerId.class)\n" +"class Customer implements Serializable {\n" +" @Id @OneToOne\n" +" @JoinColumns({\n" +" @JoinColumn(name=\"userfirstname_fk\", referencedColumnName=\"firstName" +"\"),\n" +" @JoinColumn(name=\"userlastname_fk\", referencedColumnName=\"lastName" +"\")\n" +" }) \n" +" User user;\n" +" \n" +" @Id String customerNumber;\n" +"\n" +" boolean preferredCustomer;\n" +"}\n" +"\n" +"class CustomerId implements Serializable {\n" +" @OneToOne User user;\n" +" String customerNumber;\n" +"\n" +" //implements equals and hashCode\n" +"}\n" +"\n" +"@Entity \n" +"class User {\n" +" @EmbeddedId UserId id;\n" +" Integer age;\n" +"\n" +" //implements equals and hashCode\n" +"}\n" +"\n" +"@Embeddable\n" +"class UserId implements Serializable {\n" +" String firstName;\n" +" String lastName;\n" +"}" +msgstr "" + +#. Tag: para +#: basic_mapping.xml:751 +#, no-c-format +msgid "" +"This feature is of limited interest though as you are likely to have chosen " +"the @IdClass approach to stay JPA compliant or you " +"have a quite twisted mind." +msgstr "" + +#. Tag: para +#: basic_mapping.xml:755 +#, no-c-format +msgid "Here are the equivalent on hbm.xml files:" +msgstr "" + +#. Tag: programlisting +#: basic_mapping.xml:757 +#, no-c-format +msgid "" +"<class name=\"Customer\">\n" +" <composite-id class=\"CustomerId\" mapped=\"true\">\n" +" <key-many-to-one name=\"user\">\n" +" <column name=\"userfirstname_fk\"/>\n" +" <column name=\"userlastname_fk\"/>\n" +" </key-many-to-one>\n" +" <key-property name=\"customerNumber\"/>\n" +" </composite-id>\n" +"\n" +" <property name=\"preferredCustomer\"/>\n" +"</class>\n" +"\n" +"<class name=\"User\">\n" +" <composite-id name=\"id\" class=\"UserId\">\n" +" <key-property name=\"firstName\"/>\n" +" <key-property name=\"lastName\"/>\n" +" </composite-id>\n" +"\n" +" <property name=\"age\"/>\n" +"</class>" +msgstr "" + +#. Tag: title +#: basic_mapping.xml:762 +#, fuzzy, no-c-format +msgid "Identifier generator" +msgstr "識別子の getter メソッド" + +#. Tag: para +#: basic_mapping.xml:764 +#, no-c-format +msgid "" +"Hibernate can generate and populate identifier values for you automatically. " +"This is the recommended approach over \"business\" or \"natural\" id " +"(especially composite ids)." +msgstr "" + +#. Tag: para +#: basic_mapping.xml:768 +#, no-c-format +msgid "" +"Hibernate offers various generation strategies, let's explore the most " +"common ones first that happens to be standardized by JPA:" +msgstr "" + +#. Tag: para +#: basic_mapping.xml:774 +#, fuzzy, no-c-format +msgid "" +"IDENTITY: supports identity columns in DB2, MySQL, MS SQL Server, Sybase and " +"HypersonicSQL. The returned identifier is of type long, " +"short or int." +msgstr "" +"DB2, MySQL, MS SQL Server, Sybase, HypersonicSQL の識別子カラムをサポートしま" +"す。返される識別子の型は long , short , int のいずれかです。" + +#. Tag: para +#: basic_mapping.xml:781 +#, fuzzy, no-c-format +msgid "" +"SEQUENCE (called seqhilo in Hibernate): uses a hi/lo " +"algorithm to efficiently generate identifiers of type long, short or int, given a named " +"database sequence." +msgstr "" +"long , short , int " +"型の識別子を効率的に生成する hi/lo アルゴリズムを使います。指定されたデータ" +"ベースシーケンスを与えます。" + +#. Tag: para +#: basic_mapping.xml:788 +#, fuzzy, no-c-format +msgid "" +"TABLE (called MultipleHiLoPerTableGenerator in " +"Hibernate) : uses a hi/lo algorithm to efficiently generate identifiers of " +"type long, short or int, given a table and column as a source of hi values. The hi/lo " +"algorithm generates identifiers that are unique only for a particular " +"database." +msgstr "" +"long , short , int " +"型の識別子を効率的に生成する hi/lo アルゴリズムを使います。 hi 値のソースとし" +"て、テーブルとカラムを与えます(デフォルトではそれぞれ " +"hibernate_unique_keynext_hi )。 hi/" +"lo アルゴリズムは特定のデータベースに対してのみユニークな識別子を生成します。" + +#. Tag: para +#: basic_mapping.xml:798 +#, fuzzy, no-c-format +msgid "" +"AUTO: selects IDENTITY, SEQUENCE or " +"TABLE depending upon the capabilities of the underlying " +"database." +msgstr "" +"使用するデータベースの性能により identity 、 " +"sequencehilo のいずれかが選ばれま" +"す。" + +#. Tag: para +#: basic_mapping.xml:805 +#, no-c-format +msgid "" +"We recommend all new projects to use the new enhanced identifier generators. " +"They are deactivated by default for entities using annotations but can be " +"activated using hibernate.id.new_generator_mappings=true. These " +"new generators are more efficient and closer to the JPA 2 specification " +"semantic." +msgstr "" + +#. Tag: para +#: basic_mapping.xml:812 +#, no-c-format +msgid "" +"However they are not backward compatible with existing Hibernate based " +"application (if a sequence or a table is used for id generation). See " +"XXXXXXX for more information on how " +"to activate them." +msgstr "" + +#. Tag: para +#: basic_mapping.xml:818 +#, no-c-format +msgid "" +"To mark an id property as generated, use the @GeneratedValue annotation. You can specify the strategy used (default to " +"AUTO) by setting strategy." +msgstr "" + +#. Tag: programlisting +#: basic_mapping.xml:823 +#, no-c-format +msgid "" +"@Entity\n" +"public class Customer {\n" +" @Id @GeneratedValue\n" +" Integer getId() { ... };\n" +"}\n" +"\n" +"@Entity \n" +"public class Invoice {\n" +" @Id @GeneratedValue(strategy=GenerationType.IDENTITY)\n" +" Integer getId() { ... };\n" +"}" +msgstr "" + +#. Tag: para +#: basic_mapping.xml:825 +#, no-c-format +msgid "" +"SEQUENCE and TABLE require additional " +"configurations that you can set using @SequenceGenerator and @TableGenerator:" +msgstr "" + +#. Tag: para +#: basic_mapping.xml:832 +#, fuzzy, no-c-format +msgid "name: name of the generator" +msgstr "name:プロパティ名。" + +#. Tag: para +#: basic_mapping.xml:836 +#, fuzzy, no-c-format +msgid "" +"table / sequenceName: name of the " +"table or the sequence (defaulting respectively to " +"hibernate_sequences and hibernate_sequence)" +msgstr "" +"column(オプション - デフォルトは class ): 識別カラムの名前。" + +#. Tag: para +#: basic_mapping.xml:843 +#, fuzzy, no-c-format +msgid "catalog / schema:" +msgstr "sequence-identity" + +#. Tag: para +#: basic_mapping.xml:848 +#, fuzzy, no-c-format +msgid "" +"initialValue: the value from which the id is to start " +"generating" +msgstr "table :結合したテーブルの名前" + +#. Tag: para +#: basic_mapping.xml:853 +#, no-c-format +msgid "" +"allocationSize: the amount to increment by when " +"allocating id numbers from the generator" +msgstr "" + +#. Tag: para +#: basic_mapping.xml:858 +#, no-c-format +msgid "" +"In addition, the TABLE strategy also let you " +"customize:" +msgstr "" + +#. Tag: para +#: basic_mapping.xml:863 +#, fuzzy, no-c-format +msgid "" +"pkColumnName: the column name containing the entity " +"identifier" +msgstr "name:プロパティ名。" + +#. Tag: para +#: basic_mapping.xml:868 +#, fuzzy, no-c-format +msgid "" +"valueColumnName: the column name containing the " +"identifier value" +msgstr "name(オプション):識別子プロパティの名前。" + +#. Tag: para +#: basic_mapping.xml:873 +#, fuzzy, no-c-format +msgid "pkColumnValue: the entity identifier" +msgstr "id-type: 識別子の型。" + +#. Tag: para +#: basic_mapping.xml:878 +#, no-c-format +msgid "" +"uniqueConstraints: any potential column constraint on the " +"table containing the ids" +msgstr "" + +#. Tag: para +#: basic_mapping.xml:883 +#, no-c-format +msgid "" +"To link a table or sequence generator definition with an actual generated " +"property, use the same name in both the definition name " +"and the generator value generator as shown below." +msgstr "" + +#. Tag: programlisting +#: basic_mapping.xml:888 +#, no-c-format +msgid "" +"@Id \n" +"@GeneratedValue(\n" +" strategy=GenerationType.SEQUENCE, \n" +" generator=\"SEQ_GEN\")\n" +"@javax.persistence.SequenceGenerator(\n" +" name=\"SEQ_GEN\",\n" +" sequenceName=\"my_sequence\",\n" +" allocationSize=20\n" +")\n" +"public Integer getId() { ... }" +msgstr "" + +#. Tag: para +#: basic_mapping.xml:890 +#, no-c-format +msgid "" +"The scope of a generator definition can be the application or the class. " +"Class-defined generators are not visible outside the class and can override " +"application level generators. Application level generators are defined in " +"JPA's XML deployment descriptors (see XXXXXX ):" +msgstr "" + +#. Tag: programlisting +#: basic_mapping.xml:896 +#, no-c-format +msgid "" +"<table-generator name=\"EMP_GEN\"\n" +" table=\"GENERATOR_TABLE\"\n" +" pk-column-name=\"key\"\n" +" value-column-name=\"hi\"\n" +" pk-column-value=\"EMP\"\n" +" allocation-size=\"20\"/>\n" +"\n" +"//and the annotation equivalent\n" +"\n" +"@javax.persistence.TableGenerator(\n" +" name=\"EMP_GEN\",\n" +" table=\"GENERATOR_TABLE\",\n" +" pkColumnName = \"key\",\n" +" valueColumnName = \"hi\"\n" +" pkColumnValue=\"EMP\",\n" +" allocationSize=20\n" +")\n" +"\n" +"<sequence-generator name=\"SEQ_GEN\" \n" +" sequence-name=\"my_sequence\"\n" +" allocation-size=\"20\"/>\n" +"\n" +"//and the annotation equivalent\n" +"\n" +"@javax.persistence.SequenceGenerator(\n" +" name=\"SEQ_GEN\",\n" +" sequenceName=\"my_sequence\",\n" +" allocationSize=20\n" +")" +msgstr "" + +#. Tag: para +#: basic_mapping.xml:898 +#, no-c-format +msgid "" +"If a JPA XML descriptor (like META-INF/orm.xml) is used " +"to define the generators, EMP_GEN and SEQ_GEN are application level generators." +msgstr "" + +#. Tag: para +#: basic_mapping.xml:904 +#, no-c-format +msgid "" +"Package level definition is not supported by the JPA specification. However, " +"you can use the @GenericGenerator at the package level " +"(see )." +msgstr "" + +#. Tag: para +#: basic_mapping.xml:910 +#, no-c-format +msgid "" +"These are the four standard JPA generators. Hibernate goes beyond that and " +"provide additional generators or additional options as we will see below. " +"You can also write your own custom identifier generator by implementing " +"org.hibernate.id.IdentifierGenerator." +msgstr "" + +#. Tag: para +#: basic_mapping.xml:916 +#, no-c-format +msgid "" +"To define a custom generator, use the @GenericGenerator annotation (and its plural counter part " +"@GenericGenerators) that describes the class of the " +"identifier generator or its short cut name (as described below) and a list " +"of key/value parameters. When using @GenericGenerator " +"and assigning it via @GeneratedValue.generator, the " +"@GeneratedValue.strategy is ignored: leave it blank." +msgstr "" + +#. Tag: programlisting +#: basic_mapping.xml:926 +#, no-c-format +msgid "" +"@Id @GeneratedValue(generator=\"system-uuid\")\n" +"@GenericGenerator(name=\"system-uuid\", strategy = \"uuid\")\n" +"public String getId() {\n" +"\n" +"@Id @GeneratedValue(generator=\"trigger-generated\")\n" +"@GenericGenerator(\n" +" name=\"trigger-generated\", \n" +" strategy = \"select\",\n" +" parameters = @Parameter(name=\"key\", value = \"socialSecurityNumber\")\n" +")\n" +"public String getId() {" +msgstr "" + +#. Tag: para +#: basic_mapping.xml:928 +#, fuzzy, no-c-format +msgid "" +"The hbm.xml approach uses the optional <generator> " +"child element inside <id>. If any parameters are " +"required to configure or initialize the generator instance, they are passed " +"using the <param> element." msgstr "" "オプションの <generator> 子要素は、永続クラスのイン" "スタンスのユニークな識別子を生成するために使う、 Java クラスを指定します。" "ジェネレータインスタンスの設定、もしくは初期化にパラメータが必要であれば、 " "<param> 要素を使って渡すことができます。" +#. Tag: programlisting +#: basic_mapping.xml:934 +#, fuzzy, no-c-format +msgid "" +"<id name=\"id\" type=\"long\" column=\"cat_id\">\n" +" <generator class=\"org.hibernate.id.TableHiLoGenerator\">\n" +" <param name=\"table\">uid_table</param>\n" +" <param name=\"column\">next_hi_value_column</" +"param>\n" +" </generator>\n" +"</id>" +msgstr "" +"<id name=\"id\" type=\"long\" column=\"cat_id\">\n" +" <generator class=\"org.hibernate.id.TableHiLoGenerator\">\n" +" <param name=\"table\">uid_table</param>\n" +" <param name=\"column\">next_hi_value_column</" +"param>\n" +" </generator>\n" +"</id>" + +#. Tag: title +#: basic_mapping.xml:937 +#, no-c-format +msgid "Various additional generators" +msgstr "" + #. Tag: para +#: basic_mapping.xml:939 #, no-c-format msgid "" "All generators implement the interface org.hibernate.id." @@ -848,12 +2323,14 @@ msgstr "" "Hibernate は組み込みの実装をいくつも用意しています。組み込みのジェネレータに" "は以下のショートカット名があります:" -#. Tag: term -#, fuzzy, no-c-format -msgid "increment" -msgstr "sequence-identity" +#. Tag: literal +#: basic_mapping.xml:946 +#, no-c-format +msgid "increment" +msgstr "increment" #. Tag: para +#: basic_mapping.xml:949 #, no-c-format msgid "" "generates identifiers of type long, shortクラスタ内では使わないでください 。" -#. Tag: term -#, fuzzy, no-c-format -msgid "identity" -msgstr "sequence-identity" +#. Tag: literal +#: basic_mapping.xml:958 +#, no-c-format +msgid "identity" +msgstr "identity" #. Tag: para +#: basic_mapping.xml:961 #, no-c-format msgid "" "supports identity columns in DB2, MySQL, MS SQL Server, Sybase and " @@ -882,12 +2361,14 @@ msgstr "" "す。返される識別子の型は long , short , int のいずれかです。" -#. Tag: term -#, fuzzy, no-c-format -msgid "sequence" -msgstr "sequence-identity" +#. Tag: literal +#: basic_mapping.xml:969 +#, no-c-format +msgid "sequence" +msgstr "sequence" #. Tag: para +#: basic_mapping.xml:972 #, no-c-format msgid "" "uses a sequence in DB2, PostgreSQL, Oracle, SAP DB, McKoi or a generator in " @@ -898,12 +2379,14 @@ msgstr "" "レータを使用します。返される識別子の型は long , " "short , int のいずれかです。" -#. Tag: term -#, fuzzy, no-c-format -msgid "hilo" -msgstr "sequence-identity" +#. Tag: literal +#: basic_mapping.xml:980 +#, no-c-format +msgid "hilo" +msgstr "hilo" #. Tag: para +#: basic_mapping.xml:984 #, no-c-format msgid "" "uses a hi/lo algorithm to efficiently generate identifiers of type " @@ -919,12 +2402,14 @@ msgstr "" "hibernate_unique_keynext_hi )。 hi/" "lo アルゴリズムは特定のデータベースに対してのみユニークな識別子を生成します。" -#. Tag: term -#, fuzzy, no-c-format -msgid "seqhilo" -msgstr "sequence-identity" +#. Tag: literal +#: basic_mapping.xml:996 +#, no-c-format +msgid "seqhilo" +msgstr "seqhilo" #. Tag: para +#: basic_mapping.xml:999 #, no-c-format msgid "" "uses a hi/lo algorithm to efficiently generate identifiers of type " @@ -935,39 +2420,122 @@ msgstr "" "型の識別子を効率的に生成する hi/lo アルゴリズムを使います。指定されたデータ" "ベースシーケンスを与えます。" -#. Tag: term +#. Tag: literal +#: basic_mapping.xml:1007 #, fuzzy, no-c-format -msgid "uuid" -msgstr "sequence-identity" +msgid "uuid" +msgstr "guid" #. Tag: para +#: basic_mapping.xml:1010 #, no-c-format msgid "" -"uses a 128-bit UUID algorithm to generate identifiers of type string that " -"are unique within a network (the IP address is used). The UUID is encoded as " -"a string of 32 hexadecimal digits in length." +"Generates a 128-bit UUID based on a custom algorithm. The value generated is " +"represented as a string of 32 hexidecimal digits. Users can also configure " +"it to use a separator (config parameter \"separator\") which separates the " +"hexidecimal digits into 8{sep}8{sep}4{sep}8{sep}4. Note specifically that " +"this is different than the IETF RFC 4122 representation of 8-4-4-4-12. If " +"you need RFC 4122 compliant UUIDs, consider using \"uuid2\" generator " +"discussed below." msgstr "" -"( IP アドレスが使用される)ネットワーク内でユニークな文字列型の識別子を生成す" -"るために、 128 ビットの UUID アルゴリズムを使用します。 UUID は長さ 32 の 16 " -"進数字の文字列としてエンコードされます。" -#. Tag: term +#. Tag: literal +#: basic_mapping.xml:1023 #, fuzzy, no-c-format -msgid "guid" -msgstr "sequence-identity" +msgid "uuid2" +msgstr "guid" #. Tag: para +#: basic_mapping.xml:1026 +#, no-c-format +msgid "" +"Generates a IETF RFC 4122 compliant (variant 2) 128-bit UUID. The exact " +"\"version\" (the RFC term) generated depends on the pluggable \"generation " +"strategy\" used (see below). Capable of generating values as java." +"util.UUID, java.lang.String or as a byte " +"array of length 16 (byte[16]). The \"generation strategy" +"\" is defined by the interface org.hibernate.id." +"UUIDGenerationStrategy. The generator defines 2 " +"configuration parameters for defining which generation strategy to use:" +msgstr "" + +#. Tag: literal +#: basic_mapping.xml:1038 +#, no-c-format +msgid "uuid_gen_strategy_class" +msgstr "" + +#. Tag: para +#: basic_mapping.xml:1041 +#, no-c-format +msgid "Names the UUIDGenerationStrategy class to use" +msgstr "" + +#. Tag: literal +#: basic_mapping.xml:1047 +#, no-c-format +msgid "uuid_gen_strategy" +msgstr "" + +#. Tag: para +#: basic_mapping.xml:1050 +#, no-c-format +msgid "Names the UUIDGenerationStrategy instance to use" +msgstr "" + +#. Tag: para +#: basic_mapping.xml:1056 +#, no-c-format +msgid "Out of the box, comes with the following strategies:" +msgstr "" + +#. Tag: para +#: basic_mapping.xml:1059 +#, no-c-format +msgid "" +"org.hibernate.id.uuid.StandardRandomStrategy (the " +"default) - generates \"version 3\" (aka, \"random\") UUID values via the " +"randomUUID method of java.util.UUID" +msgstr "" + +#. Tag: para +#: basic_mapping.xml:1067 +#, no-c-format +msgid "" +"org.hibernate.id.uuid.CustomVersionOneStrategy - " +"generates \"version 1\" UUID values, using IP address since mac address not " +"available. If you need mac address to be used, consider leveraging one of " +"the existing third party UUID generators which sniff out mac address and " +"integrating it via the org.hibernate.id." +"UUIDGenerationStrategy contract. Two such libraries known at " +"time of this writing include http://johannburkard.de/software/uuid/ and http://commons.apache.org/" +"sandbox/id/uuid.html" +msgstr "" + +#. Tag: literal +#: basic_mapping.xml:1085 +#, no-c-format +msgid "guid" +msgstr "guid" + +#. Tag: para +#: basic_mapping.xml:1088 #, no-c-format msgid "uses a database-generated GUID string on MS SQL Server and MySQL." msgstr "" "MS SQL サーバーと MySQL でデータベースが生成する GUID 文字列を使用します。" -#. Tag: term -#, fuzzy, no-c-format -msgid "native" -msgstr "sequence-identity" +#. Tag: literal +#: basic_mapping.xml:1094 +#, no-c-format +msgid "native" +msgstr "native" #. Tag: para +#: basic_mapping.xml:1097 #, no-c-format msgid "" "selects identity, sequence or " @@ -978,12 +2546,14 @@ msgstr "" "sequencehilo のいずれかが選ばれま" "す。" -#. Tag: term -#, fuzzy, no-c-format -msgid "assigned" -msgstr "sequence-identity" +#. Tag: literal +#: basic_mapping.xml:1105 +#, no-c-format +msgid "assigned" +msgstr "assigned" #. Tag: para +#: basic_mapping.xml:1108 #, no-c-format msgid "" "lets the application assign an identifier to the object before save" @@ -994,12 +2564,14 @@ msgstr "" "別子を代入できるようにします。 <generator> 要素が指" "定されていなければ、これがデフォルトの戦略になります。" -#. Tag: term -#, fuzzy, no-c-format -msgid "select" -msgstr "sequence-identity" +#. Tag: literal +#: basic_mapping.xml:1117 +#, no-c-format +msgid "select" +msgstr "select" #. Tag: para +#: basic_mapping.xml:1120 #, no-c-format msgid "" "retrieves a primary key, assigned by a database trigger, by selecting the " @@ -1008,12 +2580,14 @@ msgstr "" "あるユニークキーによる行の選択と主キーの値の復元により、データベーストリガが" "割り当てた主キーを取得します。" -#. Tag: term -#, fuzzy, no-c-format -msgid "foreign" -msgstr "sequence-identity" +#. Tag: literal +#: basic_mapping.xml:1127 +#, no-c-format +msgid "foreign" +msgstr "foreign" #. Tag: para +#: basic_mapping.xml:1130 #, no-c-format msgid "" "uses the identifier of another associated object. It is usually used in " @@ -1023,12 +2597,14 @@ msgstr "" "他の関連オブジェクトの識別子を使います。普通は、 <one-to-one>" " 主キー関連と組み合わせて使います。" -#. Tag: term -#, no-c-format -msgid "sequence-identity" +#. Tag: literal +#: basic_mapping.xml:1138 +#, fuzzy, no-c-format +msgid "sequence-identity" msgstr "sequence-identity" #. Tag: para +#: basic_mapping.xml:1141 #, no-c-format msgid "" "a specialized sequence generation strategy that utilizes a database sequence " @@ -1046,11 +2622,13 @@ msgstr "" "さい。" #. Tag: title +#: basic_mapping.xml:1155 #, no-c-format msgid "Hi/lo algorithm" msgstr "Hi/lo アルゴリズム" #. Tag: para +#: basic_mapping.xml:1157 #, no-c-format msgid "" "The hilo and seqhilo generators " @@ -1065,7 +2643,46 @@ msgstr "" "テーブルを必要とします。2番目の実装は、 Oracle スタイルのシーケンスを使います" "(サポートされている場合)。" +#. Tag: programlisting +#: basic_mapping.xml:1163 +#, fuzzy, no-c-format +msgid "" +"<id name=\"id\" type=\"long\" column=\"cat_id\">\n" +" <generator class=\"hilo\">\n" +" <param name=\"table\">hi_value</param>\n" +" <param name=\"column\">next_value</param>\n" +" <param name=\"max_lo\">100</param>\n" +" </generator>\n" +"</id>" +msgstr "" +"<id name=\"id\" type=\"long\" column=\"cat_id\">\n" +" <generator class=\"hilo\">\n" +" <param name=\"table\">hi_value</param>\n" +" <param name=\"column\">next_value</param>\n" +" <param name=\"max_lo\">100</param>\n" +" </generator>\n" +"</id>" + +#. Tag: programlisting +#: basic_mapping.xml:1165 +#, fuzzy, no-c-format +msgid "" +"<id name=\"id\" type=\"long\" column=\"cat_id\">\n" +" <generator class=\"seqhilo\">\n" +" <param name=\"sequence\">hi_value</param>\n" +" <param name=\"max_lo\">100</param>\n" +" </generator>\n" +"</id>" +msgstr "" +"<id name=\"id\" type=\"long\" column=\"cat_id\">\n" +" <generator class=\"seqhilo\">\n" +" <param name=\"sequence\">hi_value</param>\n" +" <param name=\"max_lo\">100</param>\n" +" </generator>\n" +"</id>" + #. Tag: para +#: basic_mapping.xml:1167 #, no-c-format msgid "" "Unfortunately, you cannot use hilo when supplying your " @@ -1081,11 +2698,13 @@ msgstr "" "切に設定しなければなりません。" #. Tag: title +#: basic_mapping.xml:1175 #, no-c-format msgid "UUID algorithm" msgstr "UUID アルゴリズム" #. Tag: para +#: basic_mapping.xml:1177 #, no-c-format msgid "" "The UUID contains: IP address, startup time of the JVM that is accurate to a " @@ -1099,11 +2718,13 @@ msgstr "" "JNI が使えないときの最良の方法です。" #. Tag: title +#: basic_mapping.xml:1185 #, no-c-format msgid "Identity columns and sequences" msgstr "識別子カラムとシーケンス" #. Tag: para +#: basic_mapping.xml:1187 #, no-c-format msgid "" "For databases that support identity columns (DB2, MySQL, Sybase, MS SQL), " @@ -1118,7 +2739,40 @@ msgstr "" "sequence スタイルのキー生成が使えます。どちらの戦略も、新" "しいオブジェクトを挿入するために、 SQL クエリを2つ必要とします。" +#. Tag: programlisting +#: basic_mapping.xml:1195 +#, fuzzy, no-c-format +msgid "" +"<id name=\"id\" type=\"long\" column=\"person_id\">\n" +" <generator class=\"sequence\">\n" +" <param name=\"sequence\">person_id_sequence</" +"param>\n" +" </generator>\n" +"</id>" +msgstr "" +"<id name=\"id\" type=\"long\" column=\"person_id\">\n" +" <generator class=\"sequence\">\n" +" <param name=\"sequence\">person_id_sequence</" +"param>\n" +" </generator>\n" +"</id>" + +#. Tag: programlisting +#: basic_mapping.xml:1197 +#, fuzzy, no-c-format +msgid "" +"<id name=\"id\" type=\"long\" column=\"person_id\" unsaved-value=\"0" +"\">\n" +" <generator class=\"identity\"/>\n" +"</id>" +msgstr "" +"<id name=\"id\" type=\"long\" column=\"person_id\" unsaved-value=\"0" +"\">\n" +" <generator class=\"identity\"/>\n" +"</id>" + #. Tag: para +#: basic_mapping.xml:1199 #, no-c-format msgid "" "For cross-platform development, the native strategy will, " @@ -1132,20 +2786,22 @@ msgstr "" "に依存します。" #. Tag: title +#: basic_mapping.xml:1207 #, no-c-format msgid "Assigned identifiers" msgstr "識別子の割り当て" #. Tag: para -#, no-c-format +#: basic_mapping.xml:1209 +#, fuzzy, no-c-format msgid "" "If you want the application to assign identifiers, as opposed to having " "Hibernate generate them, you can use the assigned " "generator. This special generator uses the identifier value already assigned " "to the object's identifier property. The generator is used when the primary " "key is a natural key instead of a surrogate key. This is the default " -"behavior if you do not specify a <generator> " -"element." +"behavior if you do not specify @GeneratedValue nor " +"<generator> elements." msgstr "" "アプリケーションに識別子を割り当てさせたいのであれば( Hibernate が生成するも" "のではなく)、 assigned ジェネレータを使うことができます。" @@ -1155,6 +2811,7 @@ msgstr "" "合のデフォルトの動作になります。" #. Tag: para +#: basic_mapping.xml:1218 #, no-c-format msgid "" "The assigned generator makes Hibernate use " @@ -1171,11 +2828,13 @@ msgstr "" "データベースを調べます。" #. Tag: title +#: basic_mapping.xml:1226 #, no-c-format msgid "Primary keys assigned by triggers" msgstr "トリガにより割り当てられた主キー" #. Tag: para +#: basic_mapping.xml:1228 #, no-c-format msgid "" "Hibernate does not generate DDL with triggers. It is for legacy schemas only." @@ -1183,7 +2842,26 @@ msgstr "" "レガシースキーマのためにのみ指定します( Hibernate はトリガを使って DDL を生成" "しません)。" +#. Tag: programlisting +#: basic_mapping.xml:1231 +#, fuzzy, no-c-format +msgid "" +"<id name=\"id\" type=\"long\" column=\"person_id\">\n" +" <generator class=\"select\">\n" +" <param name=\"key\">socialSecurityNumber</" +"param>\n" +" </generator>\n" +"</id>" +msgstr "" +"<id name=\"id\" type=\"long\" column=\"person_id\">\n" +" <generator class=\"select\">\n" +" <param name=\"key\">socialSecurityNumber</" +"param>\n" +" </generator>\n" +"</id>" + #. Tag: para +#: basic_mapping.xml:1233 #, no-c-format msgid "" "In the above example, there is a unique valued property named " @@ -1197,11 +2875,102 @@ msgstr "" "キーがあります。" #. Tag: title +#: basic_mapping.xml:1241 +#, no-c-format +msgid "Identity copy (foreign generator)" +msgstr "" + +#. Tag: para +#: basic_mapping.xml:1243 +#, no-c-format +msgid "" +"Finally, you can ask Hibernate to copy the identifier from another " +"associated entity. In the Hibernate jargon, it is known as a foreign " +"generator but the JPA mapping reads better and is encouraged." +msgstr "" + +#. Tag: programlisting +#: basic_mapping.xml:1248 +#, no-c-format +msgid "" +"@Entity\n" +"class MedicalHistory implements Serializable {\n" +" @Id @OneToOne\n" +" @JoinColumn(name = \"person_id\")\n" +" Person patient;\n" +"}\n" +"\n" +"@Entity\n" +"public class Person implements Serializable {\n" +" @Id @GeneratedValue Integer id;\n" +"}" +msgstr "" + +#. Tag: para +#: basic_mapping.xml:1250 +#, fuzzy, no-c-format +msgid "Or alternatively" +msgstr "メタデータの代替手段" + +#. Tag: programlisting +#: basic_mapping.xml:1252 +#, no-c-format +msgid "" +"@Entity\n" +"class MedicalHistory implements Serializable {\n" +" @Id Integer id;\n" +"\n" +" @MapsId @OneToOne\n" +" @JoinColumn(name = \"patient_id\")\n" +" Person patient;\n" +"}\n" +"\n" +"@Entity\n" +"class Person {\n" +" @Id @GeneratedValue Integer id;\n" +"}" +msgstr "" + +#. Tag: para +#: basic_mapping.xml:1254 +#, no-c-format +msgid "In hbm.xml use the following approach:" +msgstr "" + +#. Tag: programlisting +#: basic_mapping.xml:1256 +#, fuzzy, no-c-format +msgid "" +"<class name=\"MedicalHistory\">\n" +" <id name=\"id\">\n" +" <generator class=\"foreign\">\n" +" <param name=\"property\">patient</param>\n" +" </generator>\n" +" </id>\n" +" <one-to-one name=\"patient\" class=\"Person\" constrained=\"true\"/" +">\n" +"</class>" +msgstr "" +"<class name=\"person\" table=\"PERSON\">\n" +" <id name=\"id\" column=\"PERSON_ID\">\n" +" <generator class=\"foreign\">\n" +" <param name=\"property\">employee</param>\n" +" </generator>\n" +" </id>\n" +" ...\n" +" <one-to-one name=\"employee\"\n" +" class=\"Employee\"\n" +" constrained=\"true\"/>\n" +"</class>" + +#. Tag: title +#: basic_mapping.xml:1261 #, fuzzy, no-c-format msgid "Enhanced identifier generators" msgstr "識別子の getter メソッド" #. Tag: para +#: basic_mapping.xml:1263 #, no-c-format msgid "" "Starting with release 3.2.3, there are 2 new generators which represent a re-" @@ -1214,6 +2983,7 @@ msgid "" msgstr "" #. Tag: para +#: basic_mapping.xml:1272 #, no-c-format msgid "" "The first of these new generators is org.hibernate.id.enhanced." @@ -1235,6 +3005,7 @@ msgid "" msgstr "" #. Tag: para +#: basic_mapping.xml:1291 #, fuzzy, no-c-format msgid "" "sequence_name (optional, defaults to " @@ -1245,6 +3016,7 @@ msgstr "" "literal> ): 識別カラムの名前。" #. Tag: para +#: basic_mapping.xml:1297 #, no-c-format msgid "" "initial_value (optional, defaults to 1increment_size (optional - defaults to 1force_table_use (optional - defaults to falsevalue_column (optional - defaults to next_val ): 識別カラムの名前。" #. Tag: para +#: basic_mapping.xml:1326 #, fuzzy, no-c-format msgid "" "optimizer (optional - defaults to none): See " +"literal>): See" msgstr "" -"type (オプション - デフォルトは integer ):バージョン番号の型。" +"cascade(オプション - デフォルトは none ): カスケードのスタイル。" #. Tag: para +#: basic_mapping.xml:1332 #, no-c-format msgid "" "The second of these new generators is org.hibernate.id.enhanced." @@ -1309,6 +3085,7 @@ msgid "" msgstr "" #. Tag: para +#: basic_mapping.xml:1345 #, fuzzy, no-c-format msgid "" "table_name (optional - defaults to " @@ -1318,6 +3095,7 @@ msgstr "" "literal> ):バージョン番号の型。" #. Tag: para +#: basic_mapping.xml:1351 #, fuzzy, no-c-format msgid "" "value_column_name (optional - defaults to " @@ -1328,6 +3106,7 @@ msgstr "" "literal> ): 識別カラムの名前。" #. Tag: para +#: basic_mapping.xml:1357 #, no-c-format msgid "" "segment_column_name (optional - defaults to " @@ -1337,6 +3116,7 @@ msgid "" msgstr "" #. Tag: para +#: basic_mapping.xml:1365 #, fuzzy, no-c-format msgid "" "segment_value (optional - defaults to default ): Hibernate がプロパティの値にアクセスするために使用すべき戦略。" #. Tag: para +#: basic_mapping.xml:1372 #, fuzzy, no-c-format msgid "" "segment_value_length (optional - defaults to " @@ -1357,6 +3138,7 @@ msgstr "" "literal> ): 識別カラムの名前。" #. Tag: para +#: basic_mapping.xml:1378 #, fuzzy, no-c-format msgid "" "initial_value (optional - defaults to 1 ):バージョン番号の型。" #. Tag: para +#: basic_mapping.xml:1384 #, fuzzy, no-c-format msgid "" "increment_size (optional - defaults to 1 ):バージョン番号の型。" #. Tag: para +#: basic_mapping.xml:1390 #, fuzzy, no-c-format msgid "" -"optimizer (optional - defaults to ): " -"See " +"optimizer (optional - defaults to ??): " +"See ." msgstr "" "type (オプション - デフォルトは integer ):バージョン番号の型。" #. Tag: title +#: basic_mapping.xml:1397 #, fuzzy, no-c-format msgid "Identifier generator optimization" msgstr "識別子の getter メソッド" #. Tag: para +#: basic_mapping.xml:1399 #, no-c-format msgid "" "For identifier generators that store values in the database, it is " @@ -1396,11 +3182,12 @@ msgid "" "a new identifier value. Instead, you can group a bunch of them in memory and " "only hit the database when you have exhausted your in-memory value group. " "This is the role of the pluggable optimizers. Currently only the two " -"enhanced generators ( " +"enhanced generators ( " "support this operation." msgstr "" #. Tag: para +#: basic_mapping.xml:1410 #, no-c-format msgid "" "none (generally this is the default if no optimizer was " @@ -1409,6 +3196,7 @@ msgid "" msgstr "" #. Tag: para +#: basic_mapping.xml:1417 #, no-c-format msgid "" "hilo: applies a hi/lo algorithm around the database " @@ -1420,6 +3208,7 @@ msgid "" msgstr "" #. Tag: para +#: basic_mapping.xml:1427 #, no-c-format msgid "" "pooled: as with the case of hilo, this " @@ -1431,375 +3220,91 @@ msgid "" msgstr "" #. Tag: title -#, no-c-format -msgid "composite-id" -msgstr "composite-id" +#: basic_mapping.xml:1441 +#, fuzzy, no-c-format +msgid "Partial identifier generation" +msgstr "識別子の getter メソッド" #. Tag: para +#: basic_mapping.xml:1443 #, no-c-format msgid "" -"A table with a composite key can be mapped with multiple properties of the " -"class as identifier properties. The <composite-id> " -"element accepts <key-property> property mappings " -"and <key-many-to-one> mappings as child elements." +"Hibernate supports the automatic generation of some of the identifier " +"properties. Simply use the @GeneratedValue annotation " +"on one or several id properties." msgstr "" -"複合キーのあるテーブルに対し、識別子プロパティとしてクラスの複数のプロパティ" -"をマッピングすることができます。 <composite-id> 要素" -"は、子要素として <key-property> プロパティマッピング" -"と <key-many-to-one> マッピングを受け入れます。" #. Tag: para +#: basic_mapping.xml:1449 #, no-c-format msgid "" -"The persistent class must override equals() and hashCode() to implement composite identifier " -"equality. It must also implement Serializable." +"The Hibernate team has always felt such a construct as fundamentally wrong. " +"Try hard to fix your data model before using this feature." msgstr "" -"複合識別子の等価性を実装するためには、永続クラスが equals()hashCode() をオーバーライド しなけれ" -"ばなりません 。 また Serializable も実装しなけ" -"ればいけません。" -#. Tag: para +#. Tag: programlisting +#: basic_mapping.xml:1454 #, no-c-format msgid "" -"Unfortunately, this approach means that a persistent object is its own " -"identifier. There is no convenient \"handle\" other than the object itself. " -"You must instantiate an instance of the persistent class itself and populate " -"its identifier properties before you can load() the " -"persistent state associated with a composite key. We call this approach an " -"embedded composite identifier, and discourage it for " -"serious applications." +"@Entity\n" +"public class CustomerInventory implements Serializable {\n" +" @Id\n" +" @TableGenerator(name = \"inventory\",\n" +" table = \"U_SEQUENCES\",\n" +" pkColumnName = \"S_ID\",\n" +" valueColumnName = \"S_NEXTNUM\",\n" +" pkColumnValue = \"inventory\",\n" +" allocationSize = 1000)\n" +" @GeneratedValue(strategy = GenerationType.TABLE, generator = \"inventory" +"\")\n" +" Integer id;\n" +"\n" +"\n" +" @Id @ManyToOne(cascade = CascadeType.MERGE)\n" +" Customer customer;\n" +"}\n" +"\n" +"@Entity\n" +"public class Customer implements Serializable {\n" +" @Id\n" +" private int id;\n" +"}" msgstr "" -"残念ながら複合識別子のためのこの方法は、永続オブジェクトが自身の識別子である" -"ことを意味しています。オブジェクト自身を識別子とする以外に便利な「扱い方」は" -"ありません。複合キーに関連した永続状態を load() 出来るよう" -"になる前に、永続クラス自身をインスタンス化し、識別子プロパティを設定しなけれ" -"ばなりません。 組み込みの 複合識別子と呼ばれるこのアプ" -"ローチは、本格的なアプリケーションには向いていません。" #. Tag: para +#: basic_mapping.xml:1456 #, no-c-format msgid "" -"A second approach is what we call a mapped composite " -"identifier, where the identifier properties named inside the <" -"composite-id> element are duplicated on both the persistent " -"class and a separate identifier class." +"You can also generate properties inside an @EmbeddedId class." msgstr "" -"2つ目の方法は マップされた 複合識別子と呼ばれるもので、 " -"<composite-id>エレメント内で指定した識別プロパティが" -"永続クラスと分離した識別子クラスの両方に重複して存在します。" - -#. Tag: para -#, no-c-format -msgid "" -"In this example, both the composite identifier class, MedicareId, and the entity class itself have properties named " -"medicareNumber and dependent. The " -"identifier class must override equals() and " -"hashCode() and implement Serializable. " -"The main disadvantage of this approach is code duplication." -msgstr "" -"この例では、複合識別子クラス( MedicareId )とエンティティ" -"クラス自身の両方が、 medicareNumber と " -"dependent という名前のプロパティを持ちます。識別子クラス" -"は、 equals()hashCode() をオーバラ" -"イドし、 Serializable を実装しなくてはなりません。この方法" -"には、明らかにコードが重複するという不都合があります。" - -#. Tag: para -#, no-c-format -msgid "" -"The following attributes are used to specify a mapped composite identifier:" -msgstr "次の属性はマッピングした複合識別子を指定するために使用します:" - -#. Tag: para -#, no-c-format -msgid "" -"mapped (optional - defaults to false): " -"indicates that a mapped composite identifier is used, and that the contained " -"property mappings refer to both the entity class and the composite " -"identifier class." -msgstr "" -"mapped (オプション、デフォルトは false ): マッピングした複合識別子が使用されることと、包含されたプロパティ" -"のマッピングが、エンティティクラスと複合識別子クラスの両方を参照することを示" -"します。" - -#. Tag: para -#, no-c-format -msgid "" -"class (optional - but required for a mapped composite " -"identifier): the class used as a composite identifier." -msgstr "" -"class (オプション、ただしマッピングした複合識別子には必" -"須): 複合識別子として使用するクラス。" - -#. Tag: para -#, no-c-format -msgid "" -"We will describe a third, even more convenient approach, where the composite " -"identifier is implemented as a component class in . The attributes described below apply only to this " -"alternative approach:" -msgstr "" -"3つ目のさらに便利な方法は、複合識別子を のコンポーネントクラスとして実装することです。下で記述してい" -"る属性は、この代替方法にのみ適用されます:" - -#. Tag: para -#, no-c-format -msgid "" -"name (optional - required for this approach): a property " -"of component type that holds the composite identifier. Please see chapter 9 " -"for more information." -msgstr "" -"name (オプション、このアプローチでは必須): 複合識別子を保" -"持するコンポーネントタイプのプロパティ(9章を参照してください)。" - -#. Tag: para -#, no-c-format -msgid "" -"access (optional - defaults to property): the strategy Hibernate uses for accessing the property value." -msgstr "" -"access (オプション - デフォルトは property ): Hibernate がプロパティの値にアクセスするために使用すべき戦略。" - -#. Tag: para -#, no-c-format -msgid "" -"class (optional - defaults to the property type " -"determined by reflection): the component class used as a composite " -"identifier. Please see the next section for more information." -msgstr "" -"class (オプション - デフォルトはリフレクションにより決定" -"されるプロパティの型): 複合識別子として使われるコンポーネントのクラス(次の" -"節を見てください)。" - -#. Tag: para -#, no-c-format -msgid "" -"The third approach, an identifier component, is " -"recommended for almost all applications." -msgstr "" -"この3つ目の方法は 識別子コンポーネント と呼び、ほとんど" -"すべてのアプリケーションに対して推奨する方法です。" #. Tag: title +#: basic_mapping.xml:1462 #, no-c-format -msgid "Discriminator" -msgstr "discriminator" - -#. Tag: para -#, no-c-format -msgid "" -"The <discriminator> element is required for " -"polymorphic persistence using the table-per-class-hierarchy mapping " -"strategy. It declares a discriminator column of the table. The discriminator " -"column contains marker values that tell the persistence layer what subclass " -"to instantiate for a particular row. A restricted set of types can be used: " -"string, character, integer, byte, short, " -"boolean, yes_no, true_false." +msgid "Optimistic locking properties (optional)" msgstr "" -"<discriminator> 要素は、 table-per-class-hierarchy " -"マッピング戦略を使うポリモーフィックな永続化に必要であり、テーブルの識別カラ" -"ムを定義します。識別カラムは、ある行に対して永続層がどのサブクラスをインスタ" -"ンス化するかを伝えるマーカー値を含んでいます。以下のような型に制限されます: " -"string , character , integer, byte , short , " -"boolean , yes_no , " -"true_false." #. Tag: para +#: basic_mapping.xml:1464 #, no-c-format msgid "" -"column (optional - defaults to class): " -"the name of the discriminator column." +"When using long transactions or conversations that span several database " +"transactions, it is useful to store versioning data to ensure that if the " +"same entity is updated by two conversations, the last to commit changes will " +"be informed and not override the other conversation's work. It guarantees " +"some isolation while still allowing for good scalability and works " +"particularly well in read-often write-sometimes situations." msgstr "" -"column(オプション - デフォルトは class ): 識別カラムの名前。" #. Tag: para +#: basic_mapping.xml:1472 #, no-c-format -msgid "" -"type (optional - defaults to string): " -"a name that indicates the Hibernate type" +msgid "You can use two approaches: a dedicated version number or a timestamp." msgstr "" -"type (オプション - デフォルトは string ): Hibernate の型を示す名前。" - -#. Tag: para -#, no-c-format -msgid "" -"force (optional - defaults to false): " -"\"forces\" Hibernate to specify the allowed discriminator values, even when " -"retrieving all instances of the root class." -msgstr "" -"force (オプション - デフォルトは false ): ルートクラスのすべてのインスタンスを検索する場合であっても、 " -"Hibernate が使用できる識別カラムの指定を「強制」します。" - -#. Tag: para -#, no-c-format -msgid "" -"insert (optional - defaults to true): " -"set this to false if your discriminator column is also " -"part of a mapped composite identifier. It tells Hibernate not to include the " -"column in SQL INSERTs." -msgstr "" -"insert (オプション - デフォルトは true ): もし識別カラムがマッピングする複合識別子の一部ならば、 " -"false と設定してください。 (Hibernate に SQL の " -"INSERT 内のカラムを含ませないよう伝えます。)" - -#. Tag: para -#, no-c-format -msgid "" -"formula (optional): an arbitrary SQL expression that is " -"executed when a type has to be evaluated. It allows content-based " -"discrimination." -msgstr "" -"formula (オプション) 型が評価されるときに実行される任意の " -"SQL 式。コンテンツベースの識別を可能にします。" - -#. Tag: para -#, no-c-format -msgid "" -"Actual values of the discriminator column are specified by the " -"discriminator-value attribute of the <" -"class> and <subclass> elements." -msgstr "" -"識別カラムの実際の値は、 <class><" -"subclass> 要素の discriminator-value 属性で指" -"定されます。" - -#. Tag: para -#, no-c-format -msgid "" -"The force attribute is only useful if the table contains " -"rows with \"extra\" discriminator values that are not mapped to a persistent " -"class. This will not usually be the case." -msgstr "" -"永続クラスへマッピングされない「余分な」識別値を持つ行がテーブルにあれば、(そ" -"のときに限り) force 属性は有効です。ただし、普通はそうい" -"うことはありません。" - -#. Tag: para -#, no-c-format -msgid "" -"The formula attribute allows you to declare an arbitrary " -"SQL expression that will be used to evaluate the type of a row. For example:" -msgstr "" -"formula 属性を使うと、行の型を評価するために任意の SQL 式" -"を宣言できます:" - -#. Tag: title -#, no-c-format -msgid "Version (optional)" -msgstr "version(オプション)" - -#. Tag: para -#, no-c-format -msgid "" -"The <version> element is optional and indicates " -"that the table contains versioned data. This is particularly useful if you " -"plan to use long transactions. See below for more " -"information:" -msgstr "" -"<version> 要素はオプションであり、テーブルがバージョ" -"ンデータを含むことを示します。これは ロングトランザクション を使うつもりなら、特に役立ちます(以下を参照してください)。" - -#. Tag: para -#, no-c-format -msgid "" -"column (optional - defaults to the property name): the " -"name of the column holding the version number." -msgstr "" -"column (オプション - デフォルトはプロパティ名): バージョ" -"ン番号を保持するカラムの名前。" - -#. Tag: para -#, no-c-format -msgid "" -"name: the name of a property of the persistent class." -msgstr "name :永続クラスのプロパティの名前。" - -#. Tag: para -#, no-c-format -msgid "" -"type (optional - defaults to integer): " -"the type of the version number." -msgstr "" -"type (オプション - デフォルトは integer ):バージョン番号の型。" - -#. Tag: para -#, no-c-format -msgid "" -"access (optional - defaults to property): the strategy Hibernate uses to access the property value." -msgstr "" -"access (オプション - デフォルトは property ): Hibernate がプロパティの値にアクセスするために使用すべき戦略。" - -#. Tag: para -#, fuzzy, no-c-format -msgid "" -"unsaved-value (optional - defaults to undefined): a version property value that indicates that an instance is newly " -"instantiated (unsaved), distinguishing it from detached instances that were " -"saved or loaded in a previous session. Undefined " -"specifies that the identifier property value should be used." -msgstr "" -"unsaved-value (オプション - デフォルトは " -"undefined ): インスタンスが新しくインスタンス化されたこ" -"とを示す (セーブされていないことを示す) バージョンプロパティの値。以前の " -"Session でセーブまたはロードされた分離インスタンスと区別するために使います。 " -"( undefined は識別子プロパティの値が使われることを指定し" -"ます。)" - -#. Tag: para -#, fuzzy, no-c-format -msgid "" -"generated (optional - defaults to never): specifies that this version property value is generated by the " -"database. See the discussion of generated properties for more information." -msgstr "" -"generated (オプション - デフォルトは never ): このバージョンのプロパティの値が、データベースによって生成された" -"ことを指定します。 生成プロパティの議論" -"を参照してください。" - -#. Tag: para -#, no-c-format -msgid "" -"insert (optional - defaults to true): " -"specifies whether the version column should be included in SQL insert " -"statements. It can be set to false if the database column " -"is defined with a default value of 0." -msgstr "" -"insert (オプション - デフォルトは true ): SQLの insert 文にバージョンカラムを含めるべきかどうかを指定しま" -"す。もしデータベースカラムのデフォルト値が 0 と定義される" -"ときには、 false に設定すると良いでしょう。" - -#. Tag: para -#, no-c-format -msgid "" -"Version numbers can be of Hibernate type long, " -"integer, short, timestamp or calendar." -msgstr "" -"バージョン番号は Hibernate の longintegershorttimestamp 、 " -"calendar 型のいずれかです。" #. Tag: para +#: basic_mapping.xml:1475 #, fuzzy, no-c-format msgid "" "A version or timestamp property should never be null for a detached " @@ -1819,17 +3324,198 @@ msgstr "" "に識別子の割り当てや複合キーを使用しているときには特に有用です。" #. Tag: title +#: basic_mapping.xml:1485 #, no-c-format -msgid "Timestamp (optional)" +msgid "Version number" +msgstr "" + +#. Tag: para +#: basic_mapping.xml:1487 +#, no-c-format +msgid "" +"You can add optimistic locking capability to an entity using the " +"@Version annotation:" +msgstr "" + +#. Tag: programlisting +#: basic_mapping.xml:1490 +#, no-c-format +msgid "" +"@Entity\n" +"public class Flight implements Serializable {\n" +"...\n" +" @Version\n" +" @Column(name=\"OPTLOCK\")\n" +" public Integer getVersion() { ... }\n" +"}" +msgstr "" + +#. Tag: para +#: basic_mapping.xml:1492 +#, no-c-format +msgid "" +"The version property will be mapped to the OPTLOCK " +"column, and the entity manager will use it to detect conflicting updates " +"(preventing lost updates you might otherwise see with the last-commit-wins " +"strategy)." +msgstr "" + +#. Tag: para +#: basic_mapping.xml:1497 +#, no-c-format +msgid "" +"The version column may be a numeric. Hibernate supports any kind of type " +"provided that you define and implement the appropriate " +"UserVersionType." +msgstr "" + +#. Tag: para +#: basic_mapping.xml:1501 +#, no-c-format +msgid "" +"The application must not alter the version number set up by Hibernate in any " +"way. To artificially increase the version number, check in Hibernate Entity " +"Manager's reference documentation LockModeType." +"OPTIMISTIC_FORCE_INCREMENT or LockModeType." +"PESSIMISTIC_FORCE_INCREMENT." +msgstr "" + +#. Tag: para +#: basic_mapping.xml:1507 +#, no-c-format +msgid "" +"If the version number is generated by the database (via a trigger for " +"example), make sure to use @org.hibernate.annotations.Generated" +"(GenerationTime.ALWAYS)." +msgstr "" + +#. Tag: para +#: basic_mapping.xml:1511 +#, no-c-format +msgid "To declare a version property in hbm.xml, use:" +msgstr "" + +#. Tag: programlisting +#: basic_mapping.xml:1530 +#, fuzzy, no-c-format +msgid "" +"<version\n" +" column=\"version_column\"\n" +" name=\"propertyName\"\n" +" type=\"typename\"\n" +" access=\"field|property|ClassName\"\n" +" unsaved-value=\"null|negative|undefined\"\n" +" generated=\"never|always\"\n" +" insert=\"true|false\"\n" +" node=\"element-name|@attribute-name|element/@attribute|.\"\n" +"/>" +msgstr "" +"<version\n" +" column=\"version_column\"\n" +" name=\"propertyName\"\n" +" type=\"typename\"\n" +" access=\"field|property|ClassName\"\n" +" unsaved-value=\"null|negative|undefined\"\n" +" generated=\"never|always\"\n" +" insert=\"true|false\"\n" +" node=\"element-name|@attribute-name|element/@attribute|.\"\n" +"/>" + +#. Tag: para +#: basic_mapping.xml:1534 +#, no-c-format +msgid "" +"column (optional - defaults to the property name): the " +"name of the column holding the version number." +msgstr "" +"column (オプション - デフォルトはプロパティ名): バージョ" +"ン番号を保持するカラムの名前。" + +#. Tag: para +#: basic_mapping.xml:1540 +#, no-c-format +msgid "" +"name: the name of a property of the persistent class." +msgstr "name :永続クラスのプロパティの名前。" + +#. Tag: para +#: basic_mapping.xml:1545 +#, no-c-format +msgid "" +"type (optional - defaults to integer): " +"the type of the version number." +msgstr "" +"type (オプション - デフォルトは integer ):バージョン番号の型。" + +#. Tag: para +#: basic_mapping.xml:1551 +#, no-c-format +msgid "" +"access (optional - defaults to property): the strategy Hibernate uses to access the property value." +msgstr "" +"access (オプション - デフォルトは property ): Hibernate がプロパティの値にアクセスするために使用すべき戦略。" + +#. Tag: para +#: basic_mapping.xml:1557 +#, fuzzy, no-c-format +msgid "" +"unsaved-value (optional - defaults to undefined): a version property value that indicates that an instance is newly " +"instantiated (unsaved), distinguishing it from detached instances that were " +"saved or loaded in a previous session. Undefined " +"specifies that the identifier property value should be used." +msgstr "" +"unsaved-value (オプション - デフォルトは " +"undefined ): インスタンスが新しくインスタンス化されたこ" +"とを示す (セーブされていないことを示す) バージョンプロパティの値。以前の " +"Session でセーブまたはロードされた分離インスタンスと区別するために使います。 " +"( undefined は識別子プロパティの値が使われることを指定し" +"ます。)" + +#. Tag: para +#: basic_mapping.xml:1567 +#, fuzzy, no-c-format +msgid "" +"generated (optional - defaults to never): specifies that this version property value is generated by the " +"database. See the discussion of generated properties for more information." +msgstr "" +"generated (オプション - デフォルトは never ): このバージョンのプロパティの値が、データベースによって生成された" +"ことを指定します。 生成プロパティの議論" +"を参照してください。" + +#. Tag: para +#: basic_mapping.xml:1575 +#, no-c-format +msgid "" +"insert (optional - defaults to true): " +"specifies whether the version column should be included in SQL insert " +"statements. It can be set to false if the database column " +"is defined with a default value of 0." +msgstr "" +"insert (オプション - デフォルトは true ): SQLの insert 文にバージョンカラムを含めるべきかどうかを指定しま" +"す。もしデータベースカラムのデフォルト値が 0 と定義される" +"ときには、 false に設定すると良いでしょう。" + +#. Tag: title +#: basic_mapping.xml:1586 +#, fuzzy, no-c-format +msgid "Timestamp" msgstr "timestamp(オプション)" #. Tag: para -#, no-c-format +#: basic_mapping.xml:1588 +#, fuzzy, no-c-format msgid "" -"The optional <timestamp> element indicates that the " -"table contains timestamped data. This provides an alternative to versioning. " -"Timestamps are a less safe implementation of optimistic locking. However, " -"sometimes the application might use the timestamps in other ways." +"Alternatively, you can use a timestamp. Timestamps are a less safe " +"implementation of optimistic locking. However, sometimes the application " +"might use the timestamps in other ways." msgstr "" "オプションの <timestamp> 要素は、テーブルがタイムス" "タンプデータを含むことを示します。これはバージョン付けの代わりの方法として用" @@ -1838,6 +3524,68 @@ msgstr "" "しれません。" #. Tag: para +#: basic_mapping.xml:1592 +#, no-c-format +msgid "" +"Simply mark a property of type Date or " +"Calendar as @Version." +msgstr "" + +#. Tag: programlisting +#: basic_mapping.xml:1596 +#, no-c-format +msgid "" +"@Entity\n" +"public class Flight implements Serializable {\n" +"...\n" +" @Version\n" +" public Date getLastUpdate() { ... }\n" +"}" +msgstr "" + +#. Tag: para +#: basic_mapping.xml:1598 +#, no-c-format +msgid "" +"Like version numbers, the timestamp can be generated by the database instead " +"of Hibernate. To do that, use @org.hibernate.annotations.Generated" +"(GenerationTime.ALWAYS)." +msgstr "" + +#. Tag: para +#: basic_mapping.xml:1602 +#, fuzzy, no-c-format +msgid "In hbm.xml, use the <timestamp> element:" +msgstr "" +"例えば、もし以下のような <properties> マッピングが" +"あった場合:" + +#. Tag: programlisting +#: basic_mapping.xml:1620 +#, fuzzy, no-c-format +msgid "" +"<timestamp\n" +" column=\"timestamp_column\"\n" +" name=\"propertyName\"\n" +" access=\"field|property|ClassName\"\n" +" unsaved-value=\"null|undefined\"\n" +" source=\"vm|db\"\n" +" generated=\"never|always\"\n" +" node=\"element-name|@attribute-name|element/@attribute|.\"\n" +"/>" +msgstr "" +"<timestamp\n" +" column=\"timestamp_column\"\n" +" name=\"propertyName\"\n" +" access=\"field|property|ClassName\"\n" +" unsaved-value=\"null|undefined\"\n" +" source=\"vm|db\"\n" +" generated=\"never|always\"\n" +" node=\"element-name|@attribute-name|element/@attribute|.\"\n" +"/>" + +#. Tag: para +#: basic_mapping.xml:1624 #, no-c-format msgid "" "column (optional - defaults to the property name): the " @@ -1847,6 +3595,7 @@ msgstr "" "タンプを保持するカラムの名前。" #. Tag: para +#: basic_mapping.xml:1630 #, no-c-format msgid "" "name: the name of a JavaBeans style property of Java type " @@ -1858,6 +3607,18 @@ msgstr "" "前。" #. Tag: para +#: basic_mapping.xml:1636 basic_mapping.xml:2163 basic_mapping.xml:2380 +#: basic_mapping.xml:3226 basic_mapping.xml:3420 basic_mapping.xml:3593 +#, no-c-format +msgid "" +"access (optional - defaults to property): the strategy Hibernate uses for accessing the property value." +msgstr "" +"access (オプション - デフォルトは property ): Hibernate がプロパティの値にアクセスするために使用すべき戦略。" + +#. Tag: para +#: basic_mapping.xml:1642 #, no-c-format msgid "" "unsaved-value (optional - defaults to null と指定すると、識別子プロパティの値が使われます。)" #. Tag: para +#: basic_mapping.xml:1652 #, no-c-format msgid "" "source (optional - defaults to vm): " @@ -1895,6 +3657,7 @@ msgstr "" "もあります (例えば Oracle 8 )。" #. Tag: para +#: basic_mapping.xml:1665 #, fuzzy, no-c-format msgid "" "generated (optional - defaults to never<Timestamp> is equivalent to <version " @@ -1926,11 +3691,790 @@ msgstr "" " と等価であることに注意してください。" #. Tag: title +#: basic_mapping.xml:1686 #, no-c-format msgid "Property" msgstr "property" #. Tag: para +#: basic_mapping.xml:1688 +#, no-c-format +msgid "" +"You need to decide which property needs to be made persistent in a given " +"entity. This differs slightly between the annotation driven metadata and the " +"hbm.xml files." +msgstr "" + +#. Tag: title +#: basic_mapping.xml:1693 +#, no-c-format +msgid "Property mapping with annotations" +msgstr "" + +#. Tag: para +#: basic_mapping.xml:1695 +#, no-c-format +msgid "" +"In the annotations world, every non static non transient property (field or " +"method depending on the access type) of an entity is considered persistent, " +"unless you annotate it as @Transient. Not having an " +"annotation for your property is equivalent to the appropriate " +"@Basic annotation." +msgstr "" + +#. Tag: para +#: basic_mapping.xml:1702 +#, no-c-format +msgid "" +"The @Basic annotation allows you to declare the fetching " +"strategy for a property. If set to LAZY, specifies that " +"this property should be fetched lazily when the instance variable is first " +"accessed. It requires build-time bytecode instrumentation, if your classes " +"are not instrumented, property level lazy loading is silently ignored. The " +"default is EAGER. You can also mark a property as not " +"optional thanks to the @Basic.optional attribute. " +"This will ensure that the underlying column are not nullable (if possible). " +"Note that a better approach is to use the @NotNull " +"annotation of the Bean Validation specification." +msgstr "" + +#. Tag: para +#: basic_mapping.xml:1715 +#, no-c-format +msgid "Let's look at a few examples:" +msgstr "" + +#. Tag: programlisting +#: basic_mapping.xml:1717 +#, no-c-format +msgid "" +"public transient int counter; //transient property\n" +"\n" +"private String firstname; //persistent property\n" +"\n" +"@Transient\n" +"String getLengthInMeter() { ... } //transient property\n" +"\n" +"String getName() {... } // persistent property\n" +"\n" +"@Basic\n" +"int getLength() { ... } // persistent property\n" +"\n" +"@Basic(fetch = FetchType.LAZY)\n" +"String getDetailedComment() { ... } // persistent property\n" +"\n" +"@Temporal(TemporalType.TIME)\n" +"java.util.Date getDepartureTime() { ... } // persistent property \n" +"\n" +"@Enumerated(EnumType.STRING)\n" +"Starred getNote() { ... } //enum persisted as String in database" +msgstr "" + +#. Tag: para +#: basic_mapping.xml:1719 +#, no-c-format +msgid "" +"counter, a transient field, and lengthInMeter, a method annotated as @Transient, and will be " +"ignored by the Hibernate. name, length, and firstname properties are mapped persistent " +"and eagerly fetched (the default for simple properties). The " +"detailedComment property value will be lazily fetched " +"from the database once a lazy property of the entity is accessed for the " +"first time. Usually you don't need to lazy simple properties (not to be " +"confused with lazy association fetching). The recommended alternative is to " +"use the projection capability of JP-QL (Java Persistence Query Language) or " +"Criteria queries." +msgstr "" + +#. Tag: para +#: basic_mapping.xml:1732 +#, no-c-format +msgid "" +"JPA support property mapping of all basic types supported by Hibernate (all " +"basic Java types , their respective wrappers and serializable classes). " +"Hibernate Annotations supports out of the box enum type mapping either into " +"a ordinal column (saving the enum ordinal) or a string based column (saving " +"the enum string representation): the persistence representation, defaulted " +"to ordinal, can be overridden through the @Enumerated " +"annotation as shown in the note property example." +msgstr "" + +#. Tag: para +#: basic_mapping.xml:1742 +#, no-c-format +msgid "" +"In plain Java APIs, the temporal precision of time is not defined. When " +"dealing with temporal data you might want to describe the expected precision " +"in database. Temporal data can have DATE, TIME, or TIMESTAMP precision (ie the actual date, " +"only the time, or both). Use the @Temporal annotation to " +"fine tune that." +msgstr "" + +#. Tag: para +#: basic_mapping.xml:1750 +#, no-c-format +msgid "" +"@Lob indicates that the property should be persisted in a " +"Blob or a Clob depending on the property type: java.sql.Clob, Character[], char[] and java.lang.String will be persisted in " +"a Clob. java.sql.Blob, Byte[], " +"byte[] and Serializable type " +"will be persisted in a Blob." +msgstr "" + +#. Tag: programlisting +#: basic_mapping.xml:1759 +#, no-c-format +msgid "" +"@Lob\n" +"public String getFullText() {\n" +" return fullText;\n" +"}\n" +"\n" +"@Lob\n" +"public byte[] getFullCode() {\n" +" return fullCode;\n" +"}" +msgstr "" + +#. Tag: para +#: basic_mapping.xml:1761 +#, no-c-format +msgid "" +"If the property type implements java.io.Serializable " +"and is not a basic type, and if the property is not annotated with " +"@Lob, then the Hibernate serializable " +"type is used." +msgstr "" + +#. Tag: title +#: basic_mapping.xml:1768 +#, no-c-format +msgid "Type" +msgstr "" + +#. Tag: para +#: basic_mapping.xml:1770 +#, no-c-format +msgid "" +"You can also manually specify a type using the @org.hibernate." +"annotations.Type and some parameters if needed. @Type." +"type could be:" +msgstr "" + +#. Tag: para +#: basic_mapping.xml:1777 basic_mapping.xml:2209 +#, no-c-format +msgid "" +"The name of a Hibernate basic type: integer, string, character, " +"date, timestamp, float, binary, serializable, object, blob etc." +msgstr "" +"Hibernate の基本型の名前(例 integer, string, character, date, " +"timestamp, float, binary, serializable, object, blob )。" + +#. Tag: para +#: basic_mapping.xml:1783 basic_mapping.xml:2215 +#, no-c-format +msgid "" +"The name of a Java class with a default basic type: int, float, " +"char, java.lang.String, java.util.Date, java.lang.Integer, java.sql.Clob etc." +msgstr "" +"デフォルトの基本型の Java クラス名 (例 int, float, char, java.lang." +"String, java.util.Date, java.lang.Integer, java.sql.Clob )。" + +#. Tag: para +#: basic_mapping.xml:1789 basic_mapping.xml:2221 +#, no-c-format +msgid "The name of a serializable Java class." +msgstr "シリアライズ可能な Java クラスの名前。" + +#. Tag: para +#: basic_mapping.xml:1793 basic_mapping.xml:2225 +#, no-c-format +msgid "" +"The class name of a custom type: com.illflow.type.MyCustomType etc." +msgstr "" +"カスタム型のクラス名(例 com.illflow.type.MyCustomType )。" + +#. Tag: para +#: basic_mapping.xml:1798 +#, fuzzy, no-c-format +msgid "" +"If you do not specify a type, Hibernate will use reflection upon the named " +"property and guess the correct Hibernate type. Hibernate will attempt to " +"interpret the name of the return class of the property getter using, in " +"order, rules 2, 3, and 4." +msgstr "" +"型を指定しなければ、 Hibernate は正しい Hibernate の型を推測するために、指定" +"されたプロパティに対してリフレクションを使います。 Hibernate はルール2, 3, 4" +"をその順序に使い、 getter プロパティの返り値のクラスの名前を解釈しようとしま" +"す。しかしこれで常に十分であるとは限りません。場合によっては、 " +"type 属性が必要な場合があります。 (例えば " +"Hibernate.DATEHibernate.TIMESTAMP " +"を区別するため、またはカスタム型を指定するためなどです。)" + +#. Tag: para +#: basic_mapping.xml:1803 +#, no-c-format +msgid "" +"@org.hibernate.annotations.TypeDef and @org." +"hibernate.annotations.TypeDefs allows you to declare type " +"definitions. These annotations can be placed at the class or package level. " +"Note that these definitions are global for the session factory (even when " +"defined at the class level). If the type is used on a single entity, you can " +"place the definition on the entity itself. Otherwise, it is recommended to " +"place the definition at the package level. In the example below, when " +"Hibernate encounters a property of class PhoneNumer, it " +"delegates the persistence strategy to the custom mapping type " +"PhoneNumberType. However, properties belonging to other " +"classes, too, can delegate their persistence strategy to " +"PhoneNumberType, by explicitly using the @Type annotation." +msgstr "" + +#. Tag: para +#: basic_mapping.xml:1819 +#, no-c-format +msgid "" +"Package level annotations are placed in a file named package-info." +"java in the appropriate package. Place your annotations before " +"the package declaration." +msgstr "" + +#. Tag: programlisting +#: basic_mapping.xml:1824 +#, no-c-format +msgid "" +"@TypeDef(\n" +" name = \"phoneNumber\",\n" +" defaultForType = PhoneNumber.class,\n" +" typeClass = PhoneNumberType.class\n" +")\n" +"\n" +"@Entity\n" +"public class ContactDetails {\n" +" [...]\n" +" private PhoneNumber localPhoneNumber;\n" +" @Type(type=\"phoneNumber\")\n" +" private OverseasPhoneNumber overseasPhoneNumber;\n" +" [...]\n" +"}" +msgstr "" + +#. Tag: para +#: basic_mapping.xml:1826 +#, no-c-format +msgid "" +"The following example shows the usage of the parameters " +"attribute to customize the TypeDef." +msgstr "" + +#. Tag: programlisting +#: basic_mapping.xml:1830 +#, no-c-format +msgid "" +"//in org/hibernate/test/annotations/entity/package-info.java\n" +"@TypeDefs(\n" +" {\n" +" @TypeDef(\n" +" name=\"caster\",\n" +" typeClass = CasterStringType.class,\n" +" parameters = {\n" +" @Parameter(name=\"cast\", value=\"lower\")\n" +" }\n" +" )\n" +" }\n" +")\n" +"package org.hibernate.test.annotations.entity;\n" +"\n" +"//in org/hibernate/test/annotations/entity/Forest.java\n" +"public class Forest {\n" +" @Type(type=\"caster\")\n" +" public String getSmallText() {\n" +" ...\n" +"}" +msgstr "" + +#. Tag: para +#: basic_mapping.xml:1832 +#, no-c-format +msgid "" +"When using composite user type, you will have to express column definitions. " +"The @Columns has been introduced for that purpose." +msgstr "" + +#. Tag: programlisting +#: basic_mapping.xml:1836 +#, no-c-format +msgid "" +"@Type(type=\"org.hibernate.test.annotations.entity.MonetaryAmountUserType" +"\")\n" +"@Columns(columns = {\n" +" @Column(name=\"r_amount\"),\n" +" @Column(name=\"r_currency\")\n" +"})\n" +"public MonetaryAmount getAmount() {\n" +" return amount;\n" +"}\n" +"\n" +"\n" +"public class MonetaryAmount implements Serializable {\n" +" private BigDecimal amount;\n" +" private Currency currency;\n" +" ...\n" +"}" +msgstr "" + +#. Tag: title +#: basic_mapping.xml:1840 +#, no-c-format +msgid "Access type" +msgstr "" + +#. Tag: para +#: basic_mapping.xml:1842 +#, no-c-format +msgid "" +"By default the access type of a class hierarchy is defined by the position " +"of the @Id or @EmbeddedId " +"annotations. If these annotations are on a field, then only fields are " +"considered for persistence and the state is accessed via the field. If there " +"annotations are on a getter, then only the getters are considered for " +"persistence and the state is accessed via the getter/setter. That works well " +"in practice and is the recommended approach." +msgstr "" + +#. Tag: para +#: basic_mapping.xml:1850 +#, no-c-format +msgid "" +"The placement of annotations within a class hierarchy has to be consistent " +"(either field or on property) to be able to determine the default access " +"type. It is recommended to stick to one single annotation placement strategy " +"throughout your whole application." +msgstr "" + +#. Tag: para +#: basic_mapping.xml:1857 +#, no-c-format +msgid "However in some situations, you need to:" +msgstr "" + +#. Tag: para +#: basic_mapping.xml:1861 +#, no-c-format +msgid "force the access type of the entity hierarchy" +msgstr "" + +#. Tag: para +#: basic_mapping.xml:1865 +#, no-c-format +msgid "override the access type of a specific entity in the class hierarchy" +msgstr "" + +#. Tag: para +#: basic_mapping.xml:1870 +#, no-c-format +msgid "override the access type of an embeddable type" +msgstr "" + +#. Tag: para +#: basic_mapping.xml:1874 +#, no-c-format +msgid "" +"The best use case is an embeddable class used by several entities that might " +"not use the same access type. In this case it is better to force the access " +"type at the embeddable class level." +msgstr "" + +#. Tag: para +#: basic_mapping.xml:1879 +#, no-c-format +msgid "" +"To force the access type on a given class, use the @Access annotation as showed below:" +msgstr "" + +#. Tag: programlisting +#: basic_mapping.xml:1882 +#, no-c-format +msgid "" +"@Entity\n" +"public class Order {\n" +" @Id private Long id;\n" +" public Long getId() { return id; }\n" +" public void setId(Long id) { this.id = id; }\n" +"\n" +" @Embedded private Address address;\n" +" public Address getAddress() { return address; }\n" +" public void setAddress() { this.address = address; }\n" +"}\n" +"\n" +"@Entity\n" +"public class User {\n" +" private Long id;\n" +" @Id public Long getId() { return id; }\n" +" public void setId(Long id) { this.id = id; }\n" +"\n" +" private Address address;\n" +" @Embedded public Address getAddress() { return address; }\n" +" public void setAddress() { this.address = address; }\n" +"}\n" +"\n" +"@Embeddable\n" +"@Access(AcessType.PROPERTY)\n" +"public class Address {\n" +" private String street1;\n" +" public String getStreet1() { return street1; }\n" +" public void setStreet1() { this.street1 = street1; }\n" +"\n" +" private hashCode; //not persistent\n" +"}" +msgstr "" + +#. Tag: para +#: basic_mapping.xml:1884 +#, no-c-format +msgid "" +"You can also override the access type of a single property while keeping the " +"other properties standard." +msgstr "" + +#. Tag: programlisting +#: basic_mapping.xml:1887 +#, no-c-format +msgid "" +"@Entity\n" +"public class Order {\n" +" @Id private Long id;\n" +" public Long getId() { return id; }\n" +" public void setId(Long id) { this.id = id; }\n" +" @Transient private String userId;\n" +" @Transient private String orderId;\n" +"\n" +" @Access(AccessType.PROPERTY)\n" +" public String getOrderNumber() { return userId + \":\" + orderId; }\n" +" public void setOrderNumber() { this.userId = ...; this.orderId = ...; }\n" +"}" +msgstr "" + +#. Tag: para +#: basic_mapping.xml:1889 +#, no-c-format +msgid "" +"In this example, the default access type is FIELD " +"except for the orderNumber property. Note that the " +"corresponding field, if any must be marked as @Transient or transient." +msgstr "" + +#. Tag: title +#: basic_mapping.xml:1896 +#, no-c-format +msgid "@org.hibernate.annotations.AccessType" +msgstr "" + +#. Tag: para +#: basic_mapping.xml:1898 +#, no-c-format +msgid "" +"The annotation @org.hibernate.annotations.AccessType " +"should be considered deprecated for FIELD and PROPERTY access. It is still " +"useful however if you need to use a custom access type." +msgstr "" + +#. Tag: title +#: basic_mapping.xml:1907 +#, no-c-format +msgid "Optimistic lock" +msgstr "" + +#. Tag: para +#: basic_mapping.xml:1909 +#, no-c-format +msgid "" +"It is sometimes useful to avoid increasing the version number even if a " +"given property is dirty (particularly collections). You can do that by " +"annotating the property (or collection) with @OptimisticLock" +"(excluded=true)." +msgstr "" + +#. Tag: para +#: basic_mapping.xml:1914 +#, no-c-format +msgid "" +"More formally, specifies that updates to this property do not require " +"acquisition of the optimistic lock." +msgstr "" + +#. Tag: title +#: basic_mapping.xml:1919 +#, no-c-format +msgid "Declaring column attributes" +msgstr "" + +#. Tag: para +#: basic_mapping.xml:1921 +#, no-c-format +msgid "" +"The column(s) used for a property mapping can be defined using the " +"@Column annotation. Use it to override default values " +"(see the JPA specification for more information on the defaults). You can " +"use this annotation at the property level for properties that are:" +msgstr "" + +#. Tag: para +#: basic_mapping.xml:1929 +#, no-c-format +msgid "not annotated at all" +msgstr "" + +#. Tag: para +#: basic_mapping.xml:1933 +#, fuzzy, no-c-format +msgid "annotated with @Basic" +msgstr "sequence-identity" + +#. Tag: para +#: basic_mapping.xml:1937 +#, fuzzy, no-c-format +msgid "annotated with @Version" +msgstr "sequence-identity" + +#. Tag: para +#: basic_mapping.xml:1941 +#, fuzzy, no-c-format +msgid "annotated with @Lob" +msgstr "sequence-identity" + +#. Tag: para +#: basic_mapping.xml:1945 +#, fuzzy, no-c-format +msgid "annotated with @Temporal" +msgstr "sequence-identity" + +#. Tag: programlisting +#: basic_mapping.xml:1949 +#, no-c-format +msgid "" +"@Entity\n" +"public class Flight implements Serializable {\n" +"...\n" +"@Column(updatable = false, name = \"flight_name\", nullable = false, " +"length=50)\n" +"public String getName() { ... }" +msgstr "" + +#. Tag: para +#: basic_mapping.xml:1951 +#, no-c-format +msgid "" +"The name property is mapped to the flight_name column, which is not nullable, has a length of 50 and is not " +"updatable (making the property immutable)." +msgstr "" + +#. Tag: para +#: basic_mapping.xml:1956 +#, no-c-format +msgid "" +"This annotation can be applied to regular properties as well as " +"@Id or @Version properties." +msgstr "" + +#. Tag: programlisting +#: basic_mapping.xml:1983 +#, no-c-format +msgid "" +"@Column(\n" +" name=\"columnName\";\n" +" boolean unique() default false;\n" +" boolean nullable() default true;\n" +" boolean insertable() default true;\n" +" boolean updatable() default true;\n" +" String columnDefinition() default \"\";\n" +" String table() default \"\";\n" +" int length() default 255;\n" +" int precision() default 0; // decimal precision\n" +" int scale() default 0; // decimal scale" +msgstr "" + +#. Tag: para +#: basic_mapping.xml:1987 +#, fuzzy, no-c-format +msgid "" +"name (optional): the column name (default to the property " +"name)" +msgstr "name(オプション):識別子プロパティの名前。" + +#. Tag: para +#: basic_mapping.xml:1992 +#, fuzzy, no-c-format +msgid "" +"unique (optional): set a unique constraint on this column " +"or not (default false)" +msgstr "" +"unique (オプション):カラムにユニーク制約をつける DDL の生" +"成を可能にします。また、 property-ref のターゲットとするこ" +"ともできます。" + +#. Tag: para +#: basic_mapping.xml:1997 +#, fuzzy, no-c-format +msgid "" +"nullable (optional): set the column as nullable (default " +"true)." +msgstr "name(オプション):識別子プロパティの名前。" + +#. Tag: para +#: basic_mapping.xml:2002 +#, fuzzy, no-c-format +msgid "" +"insertable (optional): whether or not the column will be " +"part of the insert statement (default true)" +msgstr "name(オプション):識別子プロパティの名前。" + +#. Tag: para +#: basic_mapping.xml:2008 +#, fuzzy, no-c-format +msgid "" +"updatable (optional): whether or not the column will be " +"part of the update statement (default true)" +msgstr "" +"catalog (オプション):データベースカタログの名前。" + +#. Tag: para +#: basic_mapping.xml:2014 +#, no-c-format +msgid "" +"columnDefinition (optional): override the sql DDL " +"fragment for this particular column (non portable)" +msgstr "" + +#. Tag: para +#: basic_mapping.xml:2020 +#, fuzzy, no-c-format +msgid "" +"table (optional): define the targeted table (default " +"primary table)" +msgstr "" +"catalog (オプション):データベースカタログの名前。" + +#. Tag: para +#: basic_mapping.xml:2025 +#, no-c-format +msgid "" +"length (optional): column length " +"(default 255)" +msgstr "" + +#. Tag: para +#: basic_mapping.xml:2030 +#, no-c-format +msgid "" +"precision (optional): column decimal " +"precision (default 0)" +msgstr "" + +#. Tag: para +#: basic_mapping.xml:2035 +#, no-c-format +msgid "" +"scale (optional): column decimal scale " +"if useful (default 0)" +msgstr "" + +#. Tag: title +#: basic_mapping.xml:2043 +#, no-c-format +msgid "Formula" +msgstr "" + +#. Tag: para +#: basic_mapping.xml:2045 +#, no-c-format +msgid "" +"Sometimes, you want the Database to do some computation for you rather than " +"in the JVM, you might also create some kind of virtual column. You can use a " +"SQL fragment (aka formula) instead of mapping a property into a column. This " +"kind of property is read only (its value is calculated by your formula " +"fragment)." +msgstr "" + +#. Tag: programlisting +#: basic_mapping.xml:2051 +#, no-c-format +msgid "" +"@Formula(\"obj_length * obj_height * obj_width\")\n" +"public long getObjectVolume()" +msgstr "" + +#. Tag: para +#: basic_mapping.xml:2053 +#, no-c-format +msgid "" +"The SQL fragment can be as complex as you want and even include subselects." +msgstr "" + +#. Tag: title +#: basic_mapping.xml:2058 +#, no-c-format +msgid "Non-annotated property defaults" +msgstr "" + +#. Tag: para +#: basic_mapping.xml:2060 +#, no-c-format +msgid "If a property is not annotated, the following rules apply:" +msgstr "" + +#. Tag: para +#: basic_mapping.xml:2063 +#, no-c-format +msgid "If the property is of a single type, it is mapped as @Basic" +msgstr "" + +#. Tag: para +#: basic_mapping.xml:2068 +#, no-c-format +msgid "" +"Otherwise, if the type of the property is annotated as @Embeddable, it is " +"mapped as @Embedded" +msgstr "" + +#. Tag: para +#: basic_mapping.xml:2073 +#, no-c-format +msgid "" +"Otherwise, if the type of the property is Serializable, it is mapped as @Basic in a column " +"holding the object in its serialized version" +msgstr "" + +#. Tag: para +#: basic_mapping.xml:2080 +#, no-c-format +msgid "" +"Otherwise, if the type of the property is java.sql.Clob or java.sql.Blob, it is mapped as " +"@Lob with the appropriate LobType" +msgstr "" + +#. Tag: title +#: basic_mapping.xml:2091 +#, no-c-format +msgid "Property mapping with hbm.xml" +msgstr "" + +#. Tag: para +#: basic_mapping.xml:2093 #, no-c-format msgid "" "The <property> element declares a persistent " @@ -1939,7 +4483,54 @@ msgstr "" "<property> 要素は、クラスの永続的な JavaBean スタイ" "ルのプロパティを定義します。" +#. Tag: programlisting +#: basic_mapping.xml:2125 +#, fuzzy, no-c-format +msgid "" +"<property\n" +" name=\"propertyName\"\n" +" column=\"column_name\"\n" +" type=\"typename\"\n" +" update=\"true|false\"\n" +" insert=\"true|false\"\n" +" formula=\"arbitrary SQL expression\"\n" +" access=\"field|property|ClassName\"\n" +" lazy=\"true|false\"\n" +" unique=\"true|false\"\n" +" not-null=\"true|false\"\n" +" optimistic-lock=\"true|false\"\n" +" generated=\"never|insert|always\"\n" +" node=\"element-name|@attribute-name|element/@attribute|.\"\n" +" index=\"index_name\"\n" +" unique_key=\"unique_key_id\"\n" +" length=\"L\"\n" +" precision=\"P\"\n" +" scale=\"S\"\n" +"/>" +msgstr "" +"<property\n" +" name=\"propertyName\"\n" +" column=\"column_name\"\n" +" type=\"typename\"\n" +" update=\"true|false\"\n" +" insert=\"true|false\"\n" +" formula=\"arbitrary SQL expression\"\n" +" access=\"field|property|ClassName\"\n" +" lazy=\"true|false\"\n" +" unique=\"true|false\"\n" +" not-null=\"true|false\"\n" +" optimistic-lock=\"true|false\"\n" +" generated=\"never|insert|always\"\n" +" node=\"element-name|@attribute-name|element/@attribute|.\"\n" +" index=\"index_name\"\n" +" unique_key=\"unique_key_id\"\n" +" length=\"L\"\n" +" precision=\"P\"\n" +" scale=\"S\"\n" +"/>" + #. Tag: para +#: basic_mapping.xml:2129 #, no-c-format msgid "" "name: the name of the property, with an initial lowercase " @@ -1947,6 +4538,7 @@ msgid "" msgstr "name: 小文字で始まるプロパティ名。" #. Tag: para +#: basic_mapping.xml:2134 #, no-c-format msgid "" "column (optional - defaults to the property name): the " @@ -1958,6 +4550,7 @@ msgstr "" "column> 要素でも指定できます。" #. Tag: para +#: basic_mapping.xml:2146 #, no-c-format msgid "" "update, insert (optional - defaults to trueformula (optional): an SQL expression that defines the " @@ -1986,6 +4580,7 @@ msgstr "" "ングがありません。" #. Tag: para +#: basic_mapping.xml:2169 #, no-c-format msgid "" "lazy (optional - defaults to false): " @@ -1997,6 +4592,7 @@ msgstr "" "取得するよう指定します。 (バイトコード実装を作成する時間が必要になります)。" #. Tag: para +#: basic_mapping.xml:2176 #, no-c-format msgid "" "unique (optional): enables the DDL generation of a unique " @@ -2008,6 +4604,7 @@ msgstr "" "ともできます。" #. Tag: para +#: basic_mapping.xml:2183 #, fuzzy, no-c-format msgid "" "not-null (optional): enables the DDL generation of a " @@ -2017,6 +4614,7 @@ msgstr "" "成を可能にします。" #. Tag: para +#: basic_mapping.xml:2188 basic_mapping.xml:3246 #, no-c-format msgid "" "optimistic-lock (optional - defaults to truegenerated (optional - defaults to never 生成プロパティを参照してください。" #. Tag: para +#: basic_mapping.xml:2205 #, no-c-format msgid "typename could be:" msgstr "typename には以下の値が可能です:" #. Tag: para -#, no-c-format -msgid "" -"The name of a Hibernate basic type: integer, string, character, " -"date, timestamp, float, binary, serializable, object, blob etc." -msgstr "" -"Hibernate の基本型の名前(例 integer, string, character, date, " -"timestamp, float, binary, serializable, object, blob )。" - -#. Tag: para -#, no-c-format -msgid "" -"The name of a Java class with a default basic type: int, float, " -"char, java.lang.String, java.util.Date, java.lang.Integer, java.sql.Clob etc." -msgstr "" -"デフォルトの基本型の Java クラス名 (例 int, float, char, java.lang." -"String, java.util.Date, java.lang.Integer, java.sql.Clob )。" - -#. Tag: para -#, no-c-format -msgid "The name of a serializable Java class." -msgstr "シリアライズ可能な Java クラスの名前。" - -#. Tag: para -#, no-c-format -msgid "" -"The class name of a custom type: com.illflow.type.MyCustomType etc." -msgstr "" -"カスタム型のクラス名(例 com.illflow.type.MyCustomType )。" - -#. Tag: para +#: basic_mapping.xml:2230 #, no-c-format msgid "" "If you do not specify a type, Hibernate will use reflection upon the named " @@ -2099,6 +4667,7 @@ msgstr "" "を区別するため、またはカスタム型を指定するためなどです。)" #. Tag: para +#: basic_mapping.xml:2239 #, no-c-format msgid "" "The access attribute allows you to control how Hibernate " @@ -2118,6 +4687,7 @@ msgstr "" "クセスに独自の戦略を指定することができます。" #. Tag: para +#: basic_mapping.xml:2248 #, no-c-format msgid "" "A powerful feature is derived properties. These properties are by definition " @@ -2130,7 +4700,26 @@ msgstr "" "のプロパティはインスタンスをロードする SQL クエリの SELECT 句のサブクエリに変換されます:" +#. Tag: programlisting +#: basic_mapping.xml:2254 +#, fuzzy, no-c-format +msgid "" +"<property name=\"totalPrice\"\n" +" formula=\"( SELECT SUM (li.quantity*p.price) FROM LineItem li, Product " +"p\n" +" WHERE li.productId = p.productId\n" +" AND li.customerId = customerId\n" +" AND li.orderNumber = orderNumber )\"/>" +msgstr "" +"<property name=\"totalPrice\"\n" +" formula=\"( SELECT SUM (li.quantity*p.price) FROM LineItem li, Product " +"p\n" +" WHERE li.productId = p.productId\n" +" AND li.customerId = customerId\n" +" AND li.orderNumber = orderNumber )\"/>" + #. Tag: para +#: basic_mapping.xml:2256 #, no-c-format msgid "" "You can reference the entity table by not declaring an alias on a particular " @@ -2144,466 +4733,18 @@ msgstr "" "literal> マッピング要素を使えることにも注意してください。" #. Tag: title +#: basic_mapping.xml:2265 #, no-c-format -msgid "Many-to-one" -msgstr "many-to-one" - -#. Tag: para -#, no-c-format -msgid "" -"An ordinary association to another persistent class is declared using a " -"many-to-one element. The relational model is a many-to-" -"one association; a foreign key in one table is referencing the primary key " -"column(s) of the target table." +msgid "Embedded objects (aka components)" msgstr "" -"他の永続クラスへの通常の関連は many-to-one 要素を使って定" -"義します。リレーショナルモデルは多対一関連です。つまりあるテーブルの外部キー" -"は、ターゲットとなるテーブルの主キーカラムを参照しています。" #. Tag: para -#, no-c-format -msgid "name: the name of the property." -msgstr "name:プロパティ名。" - -#. Tag: para -#, no-c-format -msgid "" -"column (optional): the name of the foreign key column. " -"This can also be specified by nested <column> " -"element(s)." -msgstr "" -"column (オプション):外部キーカラムの名前。ネストした " -"<column> カラムによっても指定されます。" - -#. Tag: para -#, no-c-format -msgid "" -"class (optional - defaults to the property type " -"determined by reflection): the name of the associated class." -msgstr "" -"class(オプション - デフォルトはリフレクションにより決定さ" -"れるプロパティの型): 関連クラスの名前。" - -#. Tag: para -#, no-c-format -msgid "" -"cascade (optional): specifies which operations should be " -"cascaded from the parent object to the associated object." -msgstr "" -"cascade(オプション): 親オブジェクトから関連オブジェクト" -"へ、どの操作をカスケードするかを指定します。" - -#. Tag: para -#, no-c-format -msgid "" -"fetch (optional - defaults to select): " -"chooses between outer-join fetching or sequential select fetching." -msgstr "" -"fetch(オプション - デフォルトは select ): 外部結合フェッチと順次選択フェッチ(sequential select fetch)の" -"どちらかを選択します。" - -#. Tag: para -#, no-c-format -msgid "" -"update, insert (optional - defaults to true): specifies that the mapped columns should be included in SQL " -"UPDATE and/or INSERT statements. " -"Setting both to false allows a pure \"derived\" " -"association whose value is initialized from another property that maps to " -"the same column(s), or by a trigger or other application." -msgstr "" -"update, insert(オプション - デフォルトは true ): マッピングされたカラムが SQL の UPDATE また" -"は INSERT 文に含まれることを指定します。両方とも " -"false に設定すると、その値が同じカラムにマッピングされた他" -"のプロパティやトリガや他のアプリケーションによって初期化された純粋な「導出」" -"プロパティが可能になります。" - -#. Tag: para -#, no-c-format -msgid "" -"property-ref (optional): the name of a property of the " -"associated class that is joined to this foreign key. If not specified, the " -"primary key of the associated class is used." -msgstr "" -"property-ref: (オプション) この外部キーに加わる、関連クラ" -"スのプロパティの名前。指定されていない場合は、関連クラスの主キーが使用されま" -"す。" - -#. Tag: para -#, no-c-format -msgid "" -"unique (optional): enables the DDL generation of a unique " -"constraint for the foreign-key column. By allowing this to be the target of " -"a property-ref, you can make the association multiplicity " -"one-to-one." -msgstr "" -"unique(オプション): 外部キーカラムに対してユニーク制約" -"をつけた DDL の生成を可能にします。また、 property-ref の" -"ターゲットにすることもできます。これにより関連の多重度を効果的に一対一にしま" -"す。" - -#. Tag: para -#, no-c-format -msgid "" -"not-null (optional): enables the DDL generation of a " -"nullability constraint for the foreign key columns." -msgstr "" -"not-null (オプション): 外部キーカラムに対して、 null 値を" -"許可する DDL の生成を可能にします。" - -#. Tag: para -#, no-c-format -msgid "" -"lazy (optional - defaults to proxy): " -"by default, single point associations are proxied. lazy=\"no-proxy" -"\" specifies that the property should be fetched lazily when the " -"instance variable is first accessed. This requires build-time bytecode " -"instrumentation. lazy=\"false\" specifies that the " -"association will always be eagerly fetched." -msgstr "" -"lazy (オプション - デフォルトは proxy ): デフォルトでは、多重度1の関連がプロキシとなります。 " -"lazy=\"no-proxy\" は、インスタンス変数に最初にアクセスした" -"ときに、プロパティを遅延フェッチするよう指定します (ビルド時にバイトコード実" -"装が必要になります)。 lazy=\"false\" は関連を常に即時に" -"フェッチするよう指定します。" - -#. Tag: para -#, no-c-format -msgid "" -"not-found (optional - defaults to exception): specifies how foreign keys that reference missing rows will be " -"handled. ignore will treat a missing row as a null " -"association." -msgstr "" -"not-found (オプション - デフォルトは exception): 参照先の行がない外部キーをどのように扱うかを指定します: " -"ignore を指定すると、行がないことを関連がないものとして扱" -"います。" - -#. Tag: para -#, no-c-format -msgid "" -"entity-name (optional): the entity name of the associated " -"class." -msgstr "" -"entity-name (オプション):関連したクラスのエンティティ名。" - -#. Tag: para -#, no-c-format -msgid "" -"formula (optional): an SQL expression that defines the " -"value for a computed foreign key." -msgstr "" -"formula (オプション): 計算された 外" -"部キーに対して値を定義する SQL 式" - -#. Tag: para -#, no-c-format -msgid "" -"Setting a value of the cascade attribute to any " -"meaningful value other than none will propagate certain " -"operations to the associated object. The meaningful values are divided into " -"three categories. First, basic operations, which include: persist, " -"merge, delete, save-update, evict, replicate, lock and refresh; " -"second, special values: delete-orphan; and third," -"all comma-separated combinations of operation names: " -"cascade=\"persist,merge,evict\" or cascade=\"all," -"delete-orphan\". See " -"for a full explanation. Note that single valued, many-to-one and one-to-one, " -"associations do not support orphan delete." -msgstr "" -"cascade 属性に none 以外の意味のある値" -"を設定すると、関連オブジェクトへある操作が伝播することになります。意味のある" -"値とは Hibernate の基本操作の名前のことで、 delete-orphan " -"と all 、操作名をカンマで区切った組み合わせ (例えば " -"cascade=\"persist,merge,evict\"cascade=\"all," -"delete-orphan\")、またそれだけでなく persist, merge, " -"delete, save-update, evict, replicate, lock, refresh のことを指しま" -"す。詳しい説明は を参照してくださ" -"い。値が一つの関連 (many-to-one と one-to-one関連) は、単独での削除 (orphan " -"delete) をサポートしていないことに注意してください。" - -#. Tag: para -#, no-c-format -msgid "" -"Here is an example of a typical many-to-one declaration:" -msgstr "" -"典型的な many-to-one 宣言は次のようにシンプルです。:" - -#. Tag: para -#, no-c-format -msgid "" -"The property-ref attribute should only be used for " -"mapping legacy data where a foreign key refers to a unique key of the " -"associated table other than the primary key. This is a complicated and " -"confusing relational model. For example, if the Product " -"class had a unique serial number that is not the primary key. The " -"unique attribute controls Hibernate's DDL generation with " -"the SchemaExport tool." -msgstr "" -"property-ref 属性は、外部キーが関連付けられたテーブルの、" -"主キーでないユニークキーを参照しているレガシーデータをマップするためにだけ使" -"うべきです。これは醜いリレーショナルモデルです。例えば Product クラスが、主キーでないユニークなシリアルナンバーを持っていると仮定し" -"てみてください。( unique 属性は SchemaExport ツールを使っ" -"た Hibernate の DDL 生成を制御します。)" - -#. Tag: para -#, no-c-format -msgid "Then the mapping for OrderItem might use:" -msgstr "" -"以下のように OrderItem に対してマッピングを使えます:" - -#. Tag: para -#, no-c-format -msgid "This is not encouraged, however." -msgstr "しかし、これは決して推奨できません。" - -#. Tag: para -#, no-c-format -msgid "" -"If the referenced unique key comprises multiple properties of the associated " -"entity, you should map the referenced properties inside a named <" -"properties> element." -msgstr "" -"参照したユニークキーが、関連するエンティティの多数のプロパティから構成される" -"場合、指定した <properties> 要素内で、参照するプロパ" -"ティをマッピングするべきです。" - -#. Tag: para -#, no-c-format -msgid "" -"If the referenced unique key is the property of a component, you can specify " -"a property path:" -msgstr "" -"もし参照したユニークキーがコンポーネントのプロパティである場合は、プロパティ" -"のパスを指定できます:" - -#. Tag: title -#, no-c-format -msgid "One-to-one" -msgstr "one-to-one" - -#. Tag: para -#, no-c-format -msgid "" -"A one-to-one association to another persistent class is declared using a " -"one-to-one element." -msgstr "" -"他の永続クラスへの一対一関連は、one-to-one 要素で定義しま" -"す。" - -#. Tag: para -#, no-c-format -msgid "" -"constrained (optional): specifies that a foreign key " -"constraint on the primary key of the mapped table and references the table " -"of the associated class. This option affects the order in which save" -"() and delete() are cascaded, and determines " -"whether the association can be proxied. It is also used by the schema export " -"tool." -msgstr "" -"constrained(オプション): マッピングされたテーブルの主" -"キーに対する外部キー制約が、関連クラスのテーブルを参照することを指定します。" -"このオプションは save()delete() が" -"カスケードされる順序に影響し、そして関連がプロキシされるかどうかにも影響しま" -"す (そしてスキーマエクスポートツールにも使われます)。" - -#. Tag: para -#, no-c-format -msgid "" -"property-ref (optional): the name of a property of the " -"associated class that is joined to the primary key of this class. If not " -"specified, the primary key of the associated class is used." -msgstr "" -"property-ref(オプション): このクラスの主キーに結合され" -"た関連クラスのプロパティ名。指定されなければ、関連クラスの主キーが使われま" -"す。" - -#. Tag: para -#, no-c-format -msgid "" -"formula (optional): almost all one-to-one associations " -"map to the primary key of the owning entity. If this is not the case, you " -"can specify another column, columns or expression to join on using an SQL " -"formula. See org.hibernate.test.onetooneformula for an " -"example." -msgstr "" -"formula (オプション): ほとんどすべての一対一関連はオーナー" -"のエンティティの主キーへとマッピングされます。これ以外の稀な場合は、他のカラ" -"ムや、複数のカラム、 SQL 構文を使った結合するための式を指定できます。(例は " -"org.hibernate.test.onetooneformula を参照してください。)" - -#. Tag: para -#, no-c-format -msgid "" -"lazy (optional - defaults to proxy): " -"by default, single point associations are proxied. lazy=\"no-proxy" -"\" specifies that the property should be fetched lazily when the " -"instance variable is first accessed. It requires build-time bytecode " -"instrumentation. lazy=\"false\" specifies that the " -"association will always be eagerly fetched. Note that if " -"constrained=\"false\", proxying is impossible and " -"Hibernate will eagerly fetch the association." -msgstr "" -"lazy (オプション - デフォルトは proxy ): デフォルトでは、多重度1の関連がプロキシとなります。 " -"lazy=\"no-proxy\" は、インスタンス変数に最初にアクセスした" -"ときに、プロパティを遅延フェッチするよう指定します (ビルド時にバイトコード実" -"装が必要になります)。 lazy=\"false\" は関連を常に即時に" -"フェッチするよう指定します。 もし constrained=\"false\" ならば、プロキシは使用不可能となり、関連を即時にフェッチすることに注" -"意してください。" - -#. Tag: para -#, no-c-format -msgid "There are two varieties of one-to-one associations:" -msgstr "一対一関連には2種類あります:" - -#. Tag: para -#, no-c-format -msgid "primary key associations" -msgstr "主キー関連" - -#. Tag: para -#, no-c-format -msgid "unique foreign key associations" -msgstr "ユニーク外部キー関連" - -#. Tag: para -#, no-c-format -msgid "" -"Primary key associations do not need an extra table column. If two rows are " -"related by the association, then the two table rows share the same primary " -"key value. To relate two objects by a primary key association, ensure that " -"they are assigned the same identifier value." -msgstr "" -"主キー関連には、特別なテーブルカラムは必要ありません。もし2つの行が関連により" -"関係していれば、2つのテーブルは同じ主キーの値を共有します。そのため2つのオブ" -"ジェクトを主キー関連によって関連付けたいのであれば、確実に同じ識別子の値を代" -"入しなければなりません。" - -#. Tag: para -#, no-c-format -msgid "" -"For a primary key association, add the following mappings to " -"Employee and Person respectively:" -msgstr "" -"主キー関連を行うためには、以下のマッピングを Employee と " -"Person のそれぞれに追加してください。" - -#. Tag: para -#, no-c-format -msgid "" -"Ensure that the primary keys of the related rows in the PERSON and EMPLOYEE " -"tables are equal. You use a special Hibernate identifier generation strategy " -"called foreign:" -msgstr "" -"ここで、 PERSON と EMPLOYEE テーブルの関係する行の主キーが同じであることを確" -"実にしなければいけません。ここでは、 foreign という特殊な " -"Hibernate 識別子生成戦略を使います:" - -#. Tag: para -#, no-c-format -msgid "" -"A newly saved instance of Person is assigned the same " -"primary key value as the Employee instance referred with " -"the employee property of that Person." -msgstr "" -"Employee インスタンスが、 Person の " -"employee プロパティで参照されるように、新しくセーブされた " -"Person のインスタンスには同じ主キーの値が代入されます。新" -"しくセーブする Person インスタンスは、その " -"Personemployee プロパティが参照す" -"る Employee インスタンスとして同じ主キーが割り当てられま" -"す。" - -#. Tag: para -#, no-c-format -msgid "" -"Alternatively, a foreign key with a unique constraint, from " -"Employee to Person, can be expressed " -"as:" -msgstr "" -"もう1つの方法として、 Employee から Person へのユニーク制約を使った外部キー関連は以下のように表現されます:" - -#. Tag: para -#, no-c-format -msgid "" -"This association can be made bidirectional by adding the following to the " -"Person mapping:" -msgstr "" -"そしてこの関連は、以下の記述を Person のマッピングに追加す" -"ることで双方向にすることができます:" - -#. Tag: title -#, no-c-format -msgid "Natural-id" -msgstr "natural-id" - -#. Tag: para -#, no-c-format -msgid "" -"Although we recommend the use of surrogate keys as primary keys, you should " -"try to identify natural keys for all entities. A natural key is a property " -"or combination of properties that is unique and non-null. It is also " -"immutable. Map the properties of the natural key inside the <" -"natural-id> element. Hibernate will generate the necessary " -"unique key and nullability constraints and, as a result, your mapping will " -"be more self-documenting." -msgstr "" -"主キーとして代理キーの使用を推奨しますが、すべてのエンティティに対して自然" -"キーを識別するようにすべきです。自然キーはユニークかつ非 null な一つのプロパ" -"ティ、またはプロパティの連結です。不変であればさらに良いです。 <" -"natural-id> 要素内で自然キーのプロパティをマッピングします。 " -"Hibernate は必然的にユニークかつ null 値を許可する制約を生成し、こうしてマッ" -"ピングはより自己記述的になります。" - -#. Tag: para -#, no-c-format -msgid "" -"It is recommended that you implement equals() and " -"hashCode() to compare the natural key properties of the " -"entity." -msgstr "" -"エンティティの自然キープロパティの比較には、 equals() と " -"hashCode() の実装を強くお勧めします。" - -#. Tag: para -#, no-c-format -msgid "" -"This mapping is not intended for use with entities that have natural primary " -"keys." -msgstr "" -"このマッピングは自然主キーを使ったエンティティでの使用を意図していません。" - -#. Tag: para -#, no-c-format -msgid "" -"mutable (optional - defaults to false): by default, natural identifier properties are assumed to be " -"immutable (constant)." -msgstr "" -"mutable (オプション、 デフォルトは false ): デフォルトでは、自然識別子プロパティは不変(定数)と想定されていま" -"す。" - -#. Tag: title +#: basic_mapping.xml:2267 #, fuzzy, no-c-format -msgid "Component and dynamic-component" -msgstr "component, dynamic-component" - -#. Tag: para -#, no-c-format msgid "" -"The <component> element maps properties of a child " -"object to columns of the table of a parent class. Components can, in turn, " -"declare their own properties, components or collections. See the \"Component" -"\" examples below:" +"Embeddable objects (or components) are objects whose properties are mapped " +"to the same table as the owning entity's table. Components can, in turn, " +"declare their own properties, components or collections" msgstr "" "<component> 要素は、子オブジェクトのプロパティを親ク" "ラスのテーブルのカラムへマッピングします。コンポーネントは自分のプロパティ、" @@ -2611,6 +4752,209 @@ msgstr "" "てください。" #. Tag: para +#: basic_mapping.xml:2272 +#, no-c-format +msgid "" +"It is possible to declare an embedded component inside an entity and even " +"override its column mapping. Component classes have to be annotated at the " +"class level with the @Embeddable annotation. It is " +"possible to override the column mapping of an embedded object for a " +"particular entity using the @Embedded and " +"@AttributeOverride annotation in the associated property:" +msgstr "" + +#. Tag: programlisting +#: basic_mapping.xml:2280 +#, no-c-format +msgid "" +"@Entity\n" +"public class Person implements Serializable {\n" +"\n" +" // Persistent component using defaults\n" +" Address homeAddress;\n" +"\n" +" @Embedded\n" +" @AttributeOverrides( {\n" +" @AttributeOverride(name=\"iso2\", column = @Column(name=" +"\"bornIso2\") ),\n" +" @AttributeOverride(name=\"name\", column = @Column(name=" +"\"bornCountryName\") )\n" +" } )\n" +" Country bornIn;\n" +" ...\n" +"}" +msgstr "" + +#. Tag: programlisting +#: basic_mapping.xml:2282 +#, no-c-format +msgid "" +"@Embeddable\n" +"public class Address implements Serializable {\n" +" String city;\n" +" Country nationality; //no overriding here\n" +"}" +msgstr "" + +#. Tag: programlisting +#: basic_mapping.xml:2284 +#, no-c-format +msgid "" +"@Embeddable\n" +"public class Country implements Serializable {\n" +" private String iso2;\n" +" @Column(name=\"countryName\") private String name;\n" +"\n" +" public String getIso2() { return iso2; }\n" +" public void setIso2(String iso2) { this.iso2 = iso2; }\n" +"\n" +" \n" +" public String getName() { return name; }\n" +" public void setName(String name) { this.name = name; }\n" +" ...\n" +"}" +msgstr "" + +#. Tag: para +#: basic_mapping.xml:2286 +#, no-c-format +msgid "" +"An embeddable object inherits the access type of its owning entity (note " +"that you can override that using the @Access annotation)." +msgstr "" + +#. Tag: para +#: basic_mapping.xml:2290 +#, no-c-format +msgid "" +"The Person entity has two component properties, " +"homeAddress and bornIn. " +"homeAddress property has not been annotated, but " +"Hibernate will guess that it is a persistent component by looking for the " +"@Embeddable annotation in the Address class. We also " +"override the mapping of a column name (to bornCountryName) with the @Embedded and " +"@AttributeOverride annotations for each mapped attribute " +"of Country. As you can see, Country is " +"also a nested component of Address, again using auto-" +"detection by Hibernate and JPA defaults. Overriding columns of embedded " +"objects of embedded objects is through dotted expressions." +msgstr "" + +#. Tag: programlisting +#: basic_mapping.xml:2305 +#, no-c-format +msgid "" +"@Embedded\n" +" @AttributeOverrides( {\n" +" @AttributeOverride(name=\"city\", column = @Column(name=" +"\"fld_city\") ),\n" +" @AttributeOverride(name=\"nationality.iso2\", column = @Column" +"(name=\"nat_Iso2\") ),\n" +" @AttributeOverride(name=\"nationality.name\", column = @Column" +"(name=\"nat_CountryName\") )\n" +" //nationality columns in homeAddress are overridden\n" +" } )\n" +" Address homeAddress;" +msgstr "" + +#. Tag: para +#: basic_mapping.xml:2307 +#, no-c-format +msgid "" +"Hibernate Annotations supports something that is not explicitly supported by " +"the JPA specification. You can annotate a embedded object with the " +"@MappedSuperclass annotation to make the superclass " +"properties persistent (see @MappedSuperclass for more " +"informations)." +msgstr "" + +#. Tag: para +#: basic_mapping.xml:2313 +#, no-c-format +msgid "" +"You can also use association annotations in an embeddable object (ie " +"@OneToOne, @ManyToOne, " +"@OneToMany or @ManyToMany). To " +"override the association columns you can use @AssociationOverride." +msgstr "" + +#. Tag: para +#: basic_mapping.xml:2319 +#, no-c-format +msgid "" +"If you want to have the same embeddable object type twice in the same " +"entity, the column name defaulting will not work as several embedded objects " +"would share the same set of columns. In plain JPA, you need to override at " +"least one set of columns. Hibernate, however, allows you to enhance the " +"default naming mechanism through the NamingStrategy " +"interface. You can write a strategy that prevent name clashing in such a " +"situation. DefaultComponentSafeNamingStrategy is an " +"example of this." +msgstr "" + +#. Tag: para +#: basic_mapping.xml:2329 +#, no-c-format +msgid "" +"If a property of the embedded object points back to the owning entity, " +"annotate it with the @Parent annotation. Hibernate " +"will make sure this property is properly loaded with the entity reference." +msgstr "" + +#. Tag: para +#: basic_mapping.xml:2334 +#, no-c-format +msgid "In XML, use the <component> element." +msgstr "" + +#. Tag: programlisting +#: basic_mapping.xml:2356 +#, fuzzy, no-c-format +msgid "" +"<component\n" +" name=\"propertyName\"\n" +" class=\"className\"\n" +" insert=\"true|false\"\n" +" update=\"true|false\"\n" +" access=\"field|property|ClassName\"\n" +" lazy=\"true|false\"\n" +" optimistic-lock=\"true|false\"\n" +" unique=\"true|false\"\n" +" node=\"element-name|.\"\n" +">\n" +"\n" +" <property ...../>\n" +" <many-to-one .... />\n" +" ........\n" +"</component>" +msgstr "" +"<component \n" +" name=\"propertyName\" \n" +" class=\"className\"\n" +" insert=\"true|false\"\n" +" update=\"true|false\"\n" +" access=\"field|property|ClassName\"\n" +" lazy=\"true|false\"\n" +" optimistic-lock=\"true|false\"\n" +" unique=\"true|false\"\n" +" node=\"element-name|.\"\n" +">\n" +" \n" +" <property ...../>\n" +" <many-to-one .... />\n" +" ........\n" +"</component>" + +#. Tag: para +#: basic_mapping.xml:2360 basic_mapping.xml:3181 basic_mapping.xml:3381 +#, no-c-format +msgid "name: the name of the property." +msgstr "name:プロパティ名。" + +#. Tag: para +#: basic_mapping.xml:2364 #, no-c-format msgid "" "class (optional - defaults to the property type " @@ -2620,6 +4964,7 @@ msgstr "" "されるプロパティの型): コンポーネント(子)クラスの名前。" #. Tag: para +#: basic_mapping.xml:2370 basic_mapping.xml:3641 #, no-c-format msgid "" "insert: do the mapped columns appear in SQL " @@ -2629,6 +4974,7 @@ msgstr "" "literal> に現れるようにするかどうかを指定します。" #. Tag: para +#: basic_mapping.xml:2375 basic_mapping.xml:3646 #, no-c-format msgid "" "update: do the mapped columns appear in SQL " @@ -2638,6 +4984,7 @@ msgstr "" "literal> に現れるようにするかどうかを指定します。" #. Tag: para +#: basic_mapping.xml:2386 #, no-c-format msgid "" "lazy (optional - defaults to false): " @@ -2650,6 +4997,7 @@ msgstr "" "ます)" #. Tag: para +#: basic_mapping.xml:2393 #, no-c-format msgid "" "optimistic-lock (optional - defaults to trueunique (optional - defaults to false): " @@ -2674,6 +5023,7 @@ msgstr "" "在するかを指定します。" #. Tag: para +#: basic_mapping.xml:2408 #, no-c-format msgid "" "The child <property> tags map properties of the " @@ -2683,6 +5033,7 @@ msgstr "" "ブルカラムにマッピングします。" #. Tag: para +#: basic_mapping.xml:2411 #, no-c-format msgid "" "The <component> element allows a <" @@ -2694,12 +5045,13 @@ msgstr "" "literal> サブ要素を許可します。" #. Tag: para -#, no-c-format +#: basic_mapping.xml:2415 +#, fuzzy, no-c-format msgid "" "The <dynamic-component> element allows a " "Map to be mapped as a component, where the property names " -"refer to keys of the map. See for " -"more information." +"refer to keys of the map. See for " +"more information. This feature is not supported in annotations." msgstr "" "<dynamic-component> 要素は、 Map " "がコンポーネントとしてマッピングされることを可能にします。プロパティ名は map " @@ -2707,97 +5059,148 @@ msgstr "" "い。" #. Tag: title +#: basic_mapping.xml:2423 #, no-c-format -msgid "Properties" -msgstr "プロパティ" +msgid "Inheritance strategy" +msgstr "" #. Tag: para +#: basic_mapping.xml:2425 #, no-c-format msgid "" -"The <properties> element allows the definition of a " -"named, logical grouping of the properties of a class. The most important use " -"of the construct is that it allows a combination of properties to be the " -"target of a property-ref. It is also a convenient way to " -"define a multi-column unique constraint. For example:" +"Java is a language supporting polymorphism: a class can inherit from " +"another. Several strategies are possible to persist a class hierarchy:" msgstr "" -"<properties> 要素はクラスのプロパティの指定された、" -"論理的なグルーピングを可能にします。この構造の最も重要な使用方法は、 " -"property-ref のターゲットになるプロパティの結合を許可する" -"ことです。それはまた、複数カラムのユニーク制約を定義する簡単な方法でもありま" -"す。" #. Tag: para +#: basic_mapping.xml:2431 #, no-c-format msgid "" -"name: the logical name of the grouping. It is " -"not an actual property name." +"Single table per class hierarchy strategy: a single table hosts all the " +"instances of a class hierarchy" msgstr "" -"name : グルーピングの論理名。実際のプロパティ名では " -"ありません 。" #. Tag: para +#: basic_mapping.xml:2436 #, no-c-format msgid "" -"optimistic-lock (optional - defaults to true): specifies that updates to these properties either do or do not " -"require acquisition of the optimistic lock. It determines if a version " -"increment should occur when these properties are dirty." +"Joined subclass strategy: one table per class and subclass is present and " +"each table persist the properties specific to a given subclass. The state of " +"the entity is then stored in its corresponding class table and all its " +"superclasses" msgstr "" -"optimistic-lock (オプション - デフォルトは true ): これらのプロパティの更新に楽観的ロックの取得を要求するかどうかを" -"指定します。言い換えれば、このプロパティがダーティであるときにバージョンを増" -"やすべきかを決定します。" #. Tag: para +#: basic_mapping.xml:2443 #, no-c-format msgid "" -"For example, if we have the following <properties> " -"mapping:" +"Table per class strategy: one table per concrete class and subclass is " +"present and each table persist the properties of the class and its " +"superclasses. The state of the entity is then stored entirely in the " +"dedicated table for its class." msgstr "" -"例えば、もし以下のような <properties> マッピングが" -"あった場合:" - -#. Tag: para -#, no-c-format -msgid "" -"You might have some legacy data association that refers to this unique key " -"of the Person table, instead of to the primary key:" -msgstr "" -"主キーの代わりに Person テーブルのユニークキーへの参照を持" -"つ、レガシーデータの関連を持つかもしれません。:" - -#. Tag: para -#, no-c-format -msgid "" -"The use of this outside the context of mapping legacy data is not " -"recommended." -msgstr "" -"しかし、このようなレガシーデータマッピングのコンテキスト外への使用は推奨しま" -"せん。" #. Tag: title +#: basic_mapping.xml:2451 #, no-c-format -msgid "Subclass" -msgstr "subclass" +msgid "Single table per class hierarchy strategy" +msgstr "" #. Tag: para +#: basic_mapping.xml:2453 #, no-c-format msgid "" -"Polymorphic persistence requires the declaration of each subclass of the " -"root persistent class. For the table-per-class-hierarchy mapping strategy, " -"the <subclass> declaration is used. For example:" +"With this approach the properties of all the subclasses in a given mapped " +"class hierarchy are stored in a single table." +msgstr "" + +#. Tag: para +#: basic_mapping.xml:2456 +#, fuzzy, no-c-format +msgid "" +"Each subclass declares its own persistent properties and subclasses. Version " +"and id properties are assumed to be inherited from the root class. Each " +"subclass in a hierarchy must define a unique discriminator value. If this is " +"not specified, the fully qualified Java class name is used." +msgstr "" +"各サブクラスでは、永続プロパティとサブクラスを定義します。 <" +"version><id> プロパティは、ルートク" +"ラスから継承されると仮定されます。階層構造におけるサブクラスは、ユニークな " +"discriminator-value を定義しなければなりません。 none が指" +"定されると、完全修飾された Java クラス名が使われます。" + +#. Tag: programlisting +#: basic_mapping.xml:2462 basic_mapping.xml:2540 +#, no-c-format +msgid "" +"@Entity\n" +"@Inheritance(strategy=InheritanceType.SINGLE_TABLE)\n" +"@DiscriminatorColumn(\n" +" name=\"planetype\",\n" +" discriminatorType=DiscriminatorType.STRING\n" +")\n" +"@DiscriminatorValue(\"Plane\")\n" +"public class Plane { ... }\n" +"\n" +"@Entity\n" +"@DiscriminatorValue(\"A320\")\n" +"public class A320 extends Plane { ... }" +msgstr "" + +#. Tag: para +#: basic_mapping.xml:2464 +#, fuzzy, no-c-format +msgid "" +"In hbm.xml, for the table-per-class-hierarchy mapping strategy, the " +"<subclass> declaration is used. For example:" msgstr "" "最後にポリモーフィックな永続化には、ルートの永続クラスの各サブクラスの定義が" "必要です。 table-per-class-hierarchy マッピング戦略では、 <" "subclass> 定義が使われます。" +#. Tag: programlisting +#: basic_mapping.xml:2479 +#, fuzzy, no-c-format +msgid "" +"<subclass\n" +" name=\"ClassName\"\n" +" discriminator-value=\"discriminator_value\"\n" +" proxy=\"ProxyInterface\"\n" +" lazy=\"true|false\"\n" +" dynamic-update=\"true|false\"\n" +" dynamic-insert=\"true|false\"\n" +" entity-name=\"EntityName\"\n" +" node=\"element-name\"\n" +" extends=\"SuperclassName\">\n" +"\n" +" <property .... />\n" +" .....\n" +"</subclass>" +msgstr "" +"<subclass\n" +" name=\"ClassName\"\n" +" discriminator-value=\"discriminator_value\"\n" +" proxy=\"ProxyInterface\"\n" +" lazy=\"true|false\"\n" +" dynamic-update=\"true|false\"\n" +" dynamic-insert=\"true|false\"\n" +" entity-name=\"EntityName\"\n" +" node=\"element-name\"\n" +" extends=\"SuperclassName\">\n" +"\n" +" <property .... />\n" +" .....\n" +"</subclass>" + #. Tag: para +#: basic_mapping.xml:2483 basic_mapping.xml:2656 basic_mapping.xml:2720 #, no-c-format msgid "" "name: the fully qualified class name of the subclass." msgstr "name:サブクラスの完全修飾されたクラス名。" #. Tag: para +#: basic_mapping.xml:2488 #, no-c-format msgid "" "discriminator-value (optional - defaults to the class " @@ -2807,6 +5210,7 @@ msgstr "" "名): 個々のサブクラスを区別するための値。" #. Tag: para +#: basic_mapping.xml:2494 #, no-c-format msgid "" "proxy (optional): specifies a class or interface used for " @@ -2816,6 +5220,7 @@ msgstr "" "ンターフェースを指定します。" #. Tag: para +#: basic_mapping.xml:2499 #, no-c-format msgid "" "lazy (optional - defaults to true): " @@ -2825,53 +5230,315 @@ msgstr "" "lazy=\"false\" とすると、遅延フェッチが使用できません。" #. Tag: para -#, no-c-format +#: basic_mapping.xml:2507 basic_mapping.xml:2685 basic_mapping.xml:2746 +#, fuzzy, no-c-format msgid "" -"Each subclass declares its own persistent properties and subclasses. " -"<version> and <id> " -"properties are assumed to be inherited from the root class. Each subclass in " -"a hierarchy must define a unique discriminator-value. If " -"this is not specified, the fully qualified Java class name is used." -msgstr "" -"各サブクラスでは、永続プロパティとサブクラスを定義します。 <" -"version><id> プロパティは、ルートク" -"ラスから継承されると仮定されます。階層構造におけるサブクラスは、ユニークな " -"discriminator-value を定義しなければなりません。 none が指" -"定されると、完全修飾された Java クラス名が使われます。" - -#. Tag: para -#, no-c-format -msgid "" -"For information about inheritance mappings see ." +"For information about inheritance mappings see ." msgstr "" "継承のマッピングに関する情報は を参照してくだ" "さい。" #. Tag: title +#: basic_mapping.xml:2511 #, no-c-format -msgid "Joined-subclass" +msgid "Discriminator" +msgstr "discriminator" + +#. Tag: para +#: basic_mapping.xml:2513 +#, fuzzy, no-c-format +msgid "" +"Discriminators are required for polymorphic persistence using the table-per-" +"class-hierarchy mapping strategy. It declares a discriminator column of the " +"table. The discriminator column contains marker values that tell the " +"persistence layer what subclass to instantiate for a particular row. A " +"restricted set of types can be used: string, " +"character, integer, byte, short, boolean, " +"yes_no, true_false." +msgstr "" +"<discriminator> 要素は、 table-per-class-hierarchy " +"マッピング戦略を使うポリモーフィックな永続化に必要であり、テーブルの識別カラ" +"ムを定義します。識別カラムは、ある行に対して永続層がどのサブクラスをインスタ" +"ンス化するかを伝えるマーカー値を含んでいます。以下のような型に制限されます: " +"string , character , integer, byte , short , " +"boolean , yes_no , " +"true_false." + +#. Tag: para +#: basic_mapping.xml:2523 +#, no-c-format +msgid "" +"Use the @DiscriminatorColumn to define the " +"discriminator column as well as the discriminator type. Alternatively, you " +"can also use @DiscriminatorFormula to express in SQL " +"what would be in a virtual discriminator column. This is particularly handy " +"when the discriminator value can be extracted from one or more columns of " +"the table. Both @DiscriminatorColumn and " +"@DiscriminatorFormula are to be set on the root " +"entity (once per persisted hierarchy)." +msgstr "" + +#. Tag: para +#: basic_mapping.xml:2534 +#, no-c-format +msgid "" +"Finally, use @DiscriminatorValue on each class of the " +"hierarchy to specify the value stored in the discriminator column for a " +"given entity. If you do not set @DiscriminatorValue " +"on a class, the fully qualified class name is used." +msgstr "" + +#. Tag: para +#: basic_mapping.xml:2542 +#, no-c-format +msgid "" +"In hbm.xml, the <discriminator> element is used to " +"define the discriminator column or formula:" +msgstr "" + +#. Tag: programlisting +#: basic_mapping.xml:2559 +#, fuzzy, no-c-format +msgid "" +"<discriminator\n" +" column=\"discriminator_column\"\n" +" type=\"discriminator_type\"\n" +" force=\"true|false\"\n" +" insert=\"true|false\"\n" +" formula=\"arbitrary sql expression\"\n" +"/>" +msgstr "" +"<discriminator\n" +" column=\"discriminator_column\"\n" +" type=\"discriminator_type\"\n" +" force=\"true|false\"\n" +" insert=\"true|false\"\n" +" formula=\"arbitrary sql expression\"\n" +"/>" + +#. Tag: para +#: basic_mapping.xml:2563 +#, no-c-format +msgid "" +"column (optional - defaults to class): " +"the name of the discriminator column." +msgstr "" +"column(オプション - デフォルトは class ): 識別カラムの名前。" + +#. Tag: para +#: basic_mapping.xml:2569 +#, no-c-format +msgid "" +"type (optional - defaults to string): " +"a name that indicates the Hibernate type" +msgstr "" +"type (オプション - デフォルトは string ): Hibernate の型を示す名前。" + +#. Tag: para +#: basic_mapping.xml:2575 +#, no-c-format +msgid "" +"force (optional - defaults to false): " +"\"forces\" Hibernate to specify the allowed discriminator values, even when " +"retrieving all instances of the root class." +msgstr "" +"force (オプション - デフォルトは false ): ルートクラスのすべてのインスタンスを検索する場合であっても、 " +"Hibernate が使用できる識別カラムの指定を「強制」します。" + +#. Tag: para +#: basic_mapping.xml:2582 +#, no-c-format +msgid "" +"insert (optional - defaults to true): " +"set this to false if your discriminator column is also " +"part of a mapped composite identifier. It tells Hibernate not to include the " +"column in SQL INSERTs." +msgstr "" +"insert (オプション - デフォルトは true ): もし識別カラムがマッピングする複合識別子の一部ならば、 " +"false と設定してください。 (Hibernate に SQL の " +"INSERT 内のカラムを含ませないよう伝えます。)" + +#. Tag: para +#: basic_mapping.xml:2590 +#, no-c-format +msgid "" +"formula (optional): an arbitrary SQL expression that is " +"executed when a type has to be evaluated. It allows content-based " +"discrimination." +msgstr "" +"formula (オプション) 型が評価されるときに実行される任意の " +"SQL 式。コンテンツベースの識別を可能にします。" + +#. Tag: para +#: basic_mapping.xml:2597 +#, no-c-format +msgid "" +"Actual values of the discriminator column are specified by the " +"discriminator-value attribute of the <" +"class> and <subclass> elements." +msgstr "" +"識別カラムの実際の値は、 <class><" +"subclass> 要素の discriminator-value 属性で指" +"定されます。" + +#. Tag: para +#: basic_mapping.xml:2602 +#, no-c-format +msgid "" +"The force attribute is only useful if the table contains " +"rows with \"extra\" discriminator values that are not mapped to a persistent " +"class. This will not usually be the case." +msgstr "" +"永続クラスへマッピングされない「余分な」識別値を持つ行がテーブルにあれば、(そ" +"のときに限り) force 属性は有効です。ただし、普通はそうい" +"うことはありません。" + +#. Tag: para +#: basic_mapping.xml:2607 +#, no-c-format +msgid "" +"The formula attribute allows you to declare an arbitrary " +"SQL expression that will be used to evaluate the type of a row. For example:" +msgstr "" +"formula 属性を使うと、行の型を評価するために任意の SQL 式" +"を宣言できます:" + +#. Tag: programlisting +#: basic_mapping.xml:2611 +#, fuzzy, no-c-format +msgid "" +"<discriminator\n" +" formula=\"case when CLASS_TYPE in ('a', 'b', 'c') then 0 else 1 end\"\n" +" type=\"integer\"/>" +msgstr "" +"<discriminator\n" +" formula=\"case when CLASS_TYPE in ('a', 'b', 'c') then 0 else 1 end\"\n" +" type=\"integer\"/>" + +#. Tag: title +#: basic_mapping.xml:2616 +#, fuzzy, no-c-format +msgid "Joined subclass strategy" msgstr "joined-subclass" #. Tag: para -#, no-c-format +#: basic_mapping.xml:2618 +#, fuzzy, no-c-format msgid "" "Each subclass can also be mapped to its own table. This is called the table-" "per-subclass mapping strategy. An inherited state is retrieved by joining " -"with the table of the superclass. To do this you use the <joined-" -"subclass> element. For example:" +"with the table of the superclass. A discriminator column is not required for " +"this mapping strategy. Each subclass must, however, declare a table column " +"holding the object identifier. The primary key of this table is also a " +"foreign key to the superclass table and described by the " +"@PrimaryKeyJoinColumns or the <key> element." msgstr "" "もう1つの方法として、各サブクラスを自身のテーブルへマッピングすることができま" "す (table-per-subclass mapping strategy)。継承した状態はスーパークラスのテー" "ブルを使った結合で検索します。 <joined-subclass> 要" "素を使用します。" +#. Tag: programlisting +#: basic_mapping.xml:2628 +#, no-c-format +msgid "" +"@Entity @Table(name=\"CATS\")\n" +"@Inheritance(strategy=InheritanceType.JOINED)\n" +"public class Cat implements Serializable { \n" +" @Id @GeneratedValue(generator=\"cat-uuid\") \n" +" @GenericGenerator(name=\"cat-uuid\", strategy=\"uuid\")\n" +" String getId() { return id; }\n" +"\n" +" ...\n" +"}\n" +"\n" +"@Entity @Table(name=\"DOMESTIC_CATS\")\n" +"@PrimaryKeyJoinColumn(name=\"CAT\")\n" +"public class DomesticCat extends Cat { \n" +" public String getName() { return name; }\n" +"}" +msgstr "" + #. Tag: para +#: basic_mapping.xml:2631 +#, no-c-format +msgid "" +"The table name still defaults to the non qualified class name. Also if " +"@PrimaryKeyJoinColumn is not set, the primary key / " +"foreign key columns are assumed to have the same names as the primary key " +"columns of the primary table of the superclass." +msgstr "" + +#. Tag: para +#: basic_mapping.xml:2638 +#, fuzzy, no-c-format +msgid "" +"In hbm.xml, use the <joined-subclass> element. For " +"example:" +msgstr "class 要素を使って、永続クラスを宣言できます:" + +#. Tag: programlisting +#: basic_mapping.xml:2652 +#, fuzzy, no-c-format +msgid "" +"<joined-subclass\n" +" name=\"ClassName\"\n" +" table=\"tablename\"\n" +" proxy=\"ProxyInterface\"\n" +" lazy=\"true|false\"\n" +" dynamic-update=\"true|false\"\n" +" dynamic-insert=\"true|false\"\n" +" schema=\"schema\"\n" +" catalog=\"catalog\"\n" +" extends=\"SuperclassName\"\n" +" persister=\"ClassName\"\n" +" subselect=\"SQL expression\"\n" +" entity-name=\"EntityName\"\n" +" node=\"element-name\">\n" +"\n" +" <key .... >\n" +"\n" +" <property .... />\n" +" .....\n" +"</joined-subclass>" +msgstr "" +"<joined-subclass\n" +" name=\"ClassName\"\n" +" table=\"tablename\"\n" +" proxy=\"ProxyInterface\"\n" +" lazy=\"true|false\"\n" +" dynamic-update=\"true|false\"\n" +" dynamic-insert=\"true|false\"\n" +" schema=\"schema\"\n" +" catalog=\"catalog\"\n" +" extends=\"SuperclassName\"\n" +" persister=\"ClassName\"\n" +" subselect=\"SQL expression\"\n" +" entity-name=\"EntityName\"\n" +" node=\"element-name\">\n" +"\n" +" <key .... >\n" +"\n" +" <property .... />\n" +" .....\n" +"</joined-subclass>" + +#. Tag: para +#: basic_mapping.xml:2661 basic_mapping.xml:2725 #, no-c-format msgid "table: the name of the subclass table." msgstr "table :サブクラステーブルの名前。" #. Tag: para +#: basic_mapping.xml:2666 basic_mapping.xml:2730 #, no-c-format msgid "" "proxy (optional): specifies a class or interface to use " @@ -2881,6 +5548,7 @@ msgstr "" "ンターフェースを指定します。" #. Tag: para +#: basic_mapping.xml:2671 basic_mapping.xml:2735 #, no-c-format msgid "" "lazy (optional, defaults to true): " @@ -2890,35 +5558,102 @@ msgstr "" "lazy=\"false\" とすると、遅延フェッチが使用できません。" #. Tag: para +#: basic_mapping.xml:2679 #, no-c-format msgid "" -"A discriminator column is not required for this mapping strategy. Each " -"subclass must, however, declare a table column holding the object identifier " -"using the <key> element. The mapping at the start " -"of the chapter would then be re-written as:" +"Use the <key> element to declare the primary key / " +"foreign key column. The mapping at the start of the chapter would then be re-" +"written as:" msgstr "" -"このマッピング戦略には、識別カラムは必要ありません。しかし各サブクラスは " -"<key> 要素を使い、オブジェクト識別子を保持するテーブ" -"ルカラムを定義しなければなりません。この章の初めのマッピングは以下のように書" -"き直せます:" + +#. Tag: programlisting +#: basic_mapping.xml:2683 +#, fuzzy, no-c-format +msgid "" +"<?xml version=\"1.0\"?>\n" +"<!DOCTYPE hibernate-mapping PUBLIC\n" +" \"-//Hibernate/Hibernate Mapping DTD//EN\"\n" +" \"http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd\">\n" +"\n" +"<hibernate-mapping package=\"eg\">\n" +"\n" +" <class name=\"Cat\" table=\"CATS\">\n" +" <id name=\"id\" column=\"uid\" type=\"long\">\n" +" <generator class=\"hilo\"/>\n" +" </id>\n" +" <property name=\"birthdate\" type=\"date\"/>\n" +" <property name=\"color\" not-null=\"true\"/>\n" +" <property name=\"sex\" not-null=\"true\"/>\n" +" <property name=\"weight\"/>\n" +" <many-to-one name=\"mate\"/>\n" +" <set name=\"kittens\">\n" +" <key column=\"MOTHER\"/>\n" +" <one-to-many class=\"Cat\"/>\n" +" </set>\n" +" <joined-subclass name=\"DomesticCat\" table=" +"\"DOMESTIC_CATS\">\n" +" <key column=\"CAT\"/>\n" +" <property name=\"name\" type=\"string\"/>\n" +" </joined-subclass>\n" +" </class>\n" +"\n" +" <class name=\"eg.Dog\">\n" +" <!-- mapping for Dog could go here -->\n" +" </class>\n" +"\n" +"</hibernate-mapping>" +msgstr "" +"<?xml version=\"1.0\"?>\n" +"<!DOCTYPE hibernate-mapping PUBLIC\n" +" \"-//Hibernate/Hibernate Mapping DTD//EN\"\n" +" \"http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd\">\n" +"\n" +"<hibernate-mapping package=\"eg\">\n" +"\n" +" <class name=\"Cat\" table=\"CATS\">\n" +" <id name=\"id\" column=\"uid\" type=\"long\">\n" +" <generator class=\"hilo\"/>\n" +" </id>\n" +" <property name=\"birthdate\" type=\"date\"/>\n" +" <property name=\"color\" not-null=\"true\"/>\n" +" <property name=\"sex\" not-null=\"true\"/>\n" +" <property name=\"weight\"/>\n" +" <many-to-one name=\"mate\"/>\n" +" <set name=\"kittens\">\n" +" <key column=\"MOTHER\"/>\n" +" <one-to-many class=\"Cat\"/>\n" +" </set>\n" +" <joined-subclass name=\"DomesticCat\" table=" +"\"DOMESTIC_CATS\">\n" +" <key column=\"CAT\"/>\n" +" <property name=\"name\" type=\"string\"/>\n" +" </joined-subclass>\n" +" </class>\n" +"\n" +" <class name=\"eg.Dog\">\n" +" <!-- mapping for Dog could go here -->\n" +" </class>\n" +"\n" +"</hibernate-mapping>" #. Tag: title +#: basic_mapping.xml:2690 #, no-c-format -msgid "Union-subclass" -msgstr "union-subclass" +msgid "Table per class strategy" +msgstr "" #. Tag: para -#, no-c-format +#: basic_mapping.xml:2692 +#, fuzzy, no-c-format msgid "" "A third option is to map only the concrete classes of an inheritance " "hierarchy to tables. This is called the table-per-concrete-class strategy. " "Each table defines all persistent states of the class, including the " "inherited state. In Hibernate, it is not necessary to explicitly map such " -"inheritance hierarchies. You can map each class with a separate <" -"class> declaration. However, if you wish use polymorphic " -"associations (e.g. an association to the superclass of your hierarchy), you " -"need to use the <union-subclass> mapping. For " -"example:" +"inheritance hierarchies. You can map each class as a separate entity root. " +"However, if you wish use polymorphic associations (e.g. an association to " +"the superclass of your hierarchy), you need to use the union subclass " +"mapping." msgstr "" "3つ目の選択肢は、継承階層の具象クラスのみをテーブルにマッピングすることです " "(the table-per-concrete-class 戦略)。それぞれのテーブルは継承の状態を含めすべ" @@ -2928,34 +5663,469 @@ msgstr "" "連 (例えば階層のスーパークラスへの関連) を使いたいなら、 <union-" "subclass> マッピングを使う必要があります。" +#. Tag: programlisting +#: basic_mapping.xml:2701 +#, no-c-format +msgid "" +"@Entity\n" +"@Inheritance(strategy = InheritanceType.TABLE_PER_CLASS)\n" +"public class Flight implements Serializable { ... }" +msgstr "" + #. Tag: para +#: basic_mapping.xml:2703 +#, no-c-format +msgid "Or in hbm.xml:" +msgstr "" + +#. Tag: programlisting +#: basic_mapping.xml:2716 +#, fuzzy, no-c-format +msgid "" +"<union-subclass\n" +" name=\"ClassName\"\n" +" table=\"tablename\"\n" +" proxy=\"ProxyInterface\"\n" +" lazy=\"true|false\"\n" +" dynamic-update=\"true|false\"\n" +" dynamic-insert=\"true|false\"\n" +" schema=\"schema\"\n" +" catalog=\"catalog\"\n" +" extends=\"SuperclassName\"\n" +" abstract=\"true|false\"\n" +" persister=\"ClassName\"\n" +" subselect=\"SQL expression\"\n" +" entity-name=\"EntityName\"\n" +" node=\"element-name\">\n" +"\n" +" <property .... />\n" +" .....\n" +"</union-subclass>" +msgstr "" +"<union-subclass\n" +" name=\"ClassName\"\n" +" table=\"tablename\"\n" +" proxy=\"ProxyInterface\"\n" +" lazy=\"true|false\"\n" +" dynamic-update=\"true|false\"\n" +" dynamic-insert=\"true|false\"\n" +" schema=\"schema\"\n" +" catalog=\"catalog\"\n" +" extends=\"SuperclassName\"\n" +" abstract=\"true|false\"\n" +" persister=\"ClassName\"\n" +" subselect=\"SQL expression\"\n" +" entity-name=\"EntityName\"\n" +" node=\"element-name\">\n" +"\n" +" <property .... />\n" +" .....\n" +"</union-subclass>" + +#. Tag: para +#: basic_mapping.xml:2743 #, no-c-format msgid "" "No discriminator column or key column is required for this mapping strategy." msgstr "このマッピング戦略では識別カラムやキーカラムは必要ありません。" #. Tag: title +#: basic_mapping.xml:2751 #, no-c-format -msgid "Join" -msgstr "join" +msgid "Inherit properties from superclasses" +msgstr "" #. Tag: para +#: basic_mapping.xml:2753 #, no-c-format msgid "" -"Using the <join> element, it is possible to map " -"properties of one class to several tables that have a one-to-one " -"relationship. For example:" +"This is sometimes useful to share common properties through a technical or a " +"business superclass without including it as a regular mapped entity (ie no " +"specific table for this entity). For that purpose you can map them as " +"@MappedSuperclass." +msgstr "" + +#. Tag: programlisting +#: basic_mapping.xml:2758 +#, no-c-format +msgid "" +"@MappedSuperclass\n" +"public class BaseEntity {\n" +" @Basic\n" +" @Temporal(TemporalType.TIMESTAMP)\n" +" public Date getLastUpdate() { ... }\n" +" public String getLastUpdater() { ... }\n" +" ...\n" +"}\n" +"\n" +"@Entity class Order extends BaseEntity {\n" +" @Id public Integer getId() { ... }\n" +" ...\n" +"}" msgstr "" -"テーブル間に一対一の関係があるとき、 <join> 要素を使" -"うことで、1つのクラスのプロパティをいくつものテーブルにマッピングすることが" -"できます。" #. Tag: para +#: basic_mapping.xml:2760 +#, no-c-format +msgid "" +"In database, this hierarchy will be represented as an Order table having the id, lastUpdate and lastUpdater columns. The embedded superclass " +"property mappings are copied into their entity subclasses. Remember that the " +"embeddable superclass is not the root of the hierarchy though." +msgstr "" + +#. Tag: para +#: basic_mapping.xml:2768 +#, no-c-format +msgid "" +"Properties from superclasses not mapped as @MappedSuperclass are ignored." +msgstr "" + +#. Tag: para +#: basic_mapping.xml:2773 +#, no-c-format +msgid "" +"The default access type (field or methods) is used, unless you use the " +"@Access annotation." +msgstr "" + +#. Tag: para +#: basic_mapping.xml:2778 +#, no-c-format +msgid "" +"The same notion can be applied to @Embeddable objects to " +"persist properties from their superclasses. You also need to use " +"@MappedSuperclass to do that (this should not be " +"considered as a standard EJB3 feature though)" +msgstr "" + +#. Tag: para +#: basic_mapping.xml:2786 +#, no-c-format +msgid "" +"It is allowed to mark a class as @MappedSuperclass in the " +"middle of the mapped inheritance hierarchy." +msgstr "" + +#. Tag: para +#: basic_mapping.xml:2792 +#, no-c-format +msgid "" +"Any class in the hierarchy non annotated with @MappedSuperclass nor @Entity will be ignored." +msgstr "" + +#. Tag: para +#: basic_mapping.xml:2797 +#, no-c-format +msgid "" +"You can override columns defined in entity superclasses at the root entity " +"level using the @AttributeOverride annotation." +msgstr "" + +#. Tag: programlisting +#: basic_mapping.xml:2801 +#, no-c-format +msgid "" +"@MappedSuperclass\n" +"public class FlyingObject implements Serializable {\n" +"\n" +" public int getAltitude() {\n" +" return altitude;\n" +" }\n" +"\n" +" @Transient\n" +" public int getMetricAltitude() {\n" +" return metricAltitude;\n" +" }\n" +"\n" +" @ManyToOne\n" +" public PropulsionType getPropulsion() {\n" +" return metricAltitude;\n" +" }\n" +" ...\n" +"}\n" +"\n" +"@Entity\n" +"@AttributeOverride( name=\"altitude\", column = @Column(name=\"fld_altitude" +"\") )\n" +"@AssociationOverride( \n" +" name=\"propulsion\", \n" +" joinColumns = @JoinColumn(name=\"fld_propulsion_fk\") \n" +")\n" +"public class Plane extends FlyingObject {\n" +" ...\n" +"}" +msgstr "" + +#. Tag: para +#: basic_mapping.xml:2803 +#, no-c-format +msgid "" +"The altitude property will be persisted in an " +"fld_altitude column of table Plane and " +"the propulsion association will be materialized in a " +"fld_propulsion_fk foreign key column." +msgstr "" + +#. Tag: para +#: basic_mapping.xml:2809 +#, no-c-format +msgid "" +"You can define @AttributeOverride(s) and " +"@AssociationOverride(s) on @Entity " +"classes, @MappedSuperclass classes and properties " +"pointing to an @Embeddable object." +msgstr "" + +#. Tag: para +#: basic_mapping.xml:2815 +#, no-c-format +msgid "" +"In hbm.xml, simply map the properties of the superclass in the <" +"class> element of the entity that needs to inherit them." +msgstr "" + +#. Tag: title +#: basic_mapping.xml:2821 +#, no-c-format +msgid "Mapping one entity to several tables" +msgstr "" + +#. Tag: para +#: basic_mapping.xml:2823 +#, no-c-format +msgid "" +"While not recommended for a fresh schema, some legacy databases force your " +"to map a single entity on several tables." +msgstr "" + +#. Tag: para +#: basic_mapping.xml:2826 +#, no-c-format +msgid "" +"Using the @SecondaryTable or @SecondaryTables class level annotations. To express that a column is in a " +"particular table, use the table parameter of " +"@Column or @JoinColumn." +msgstr "" + +#. Tag: programlisting +#: basic_mapping.xml:2832 +#, no-c-format +msgid "" +"@Entity\n" +"@Table(name=\"MainCat\")\n" +"@SecondaryTables({\n" +" @SecondaryTable(name=\"Cat1\", pkJoinColumns={\n" +" @PrimaryKeyJoinColumn(name=\"cat_id\", referencedColumnName=\"id\")\n" +" ),\n" +" @SecondaryTable(name=\"Cat2\", uniqueConstraints={@UniqueConstraint" +"(columnNames={\"storyPart2\"})})\n" +"})\n" +"public class Cat implements Serializable {\n" +"\n" +" private Integer id;\n" +" private String name;\n" +" private String storyPart1;\n" +" private String storyPart2;\n" +"\n" +" @Id @GeneratedValue\n" +" public Integer getId() {\n" +" return id;\n" +" }\n" +"\n" +" public String getName() {\n" +" return name;\n" +" }\n" +" \n" +" @Column(table=\"Cat1\")\n" +" public String getStoryPart1() {\n" +" return storyPart1;\n" +" }\n" +"\n" +" @Column(table=\"Cat2\")\n" +" public String getStoryPart2() {\n" +" return storyPart2;\n" +" }\n" +"}" +msgstr "" + +#. Tag: para +#: basic_mapping.xml:2834 +#, no-c-format +msgid "" +"In this example, name will be in MainCat. storyPart1 will be in Cat1 " +"and storyPart2 will be in Cat2. " +"Cat1 will be joined to MainCat using " +"the cat_id as a foreign key, and Cat2 " +"using id (ie the same column name, the MainCat id column has). Plus a unique constraint on storyPart2 has been set." +msgstr "" + +#. Tag: para +#: basic_mapping.xml:2844 +#, no-c-format +msgid "" +"There is also additional tuning accessible via the @org.hibernate." +"annotations.Table annotation:" +msgstr "" + +#. Tag: para +#: basic_mapping.xml:2850 +#, fuzzy, no-c-format +msgid "" +"fetch: If set to JOIN, the default, Hibernate will use an " +"inner join to retrieve a secondary table defined by a class or its " +"superclasses and an outer join for a secondary table defined by a subclass. " +"If set to SELECT then Hibernate will use a sequential " +"select for a secondary table defined on a subclass, which will be issued " +"only if a row turns out to represent an instance of the subclass. Inner " +"joins will still be used to retrieve a secondary defined by the class and " +"its superclasses." +msgstr "" +"fetch (オプション - デフォルトは join ): join を設定した場合、 Hibernate はデフォルト" +"で、クラスやスーパークラスで定義された <join> を検索" +"するのに内部結合を使い、サブクラスで定義された <join> を検索するのに外部結合を使います。 select を設定" +"した場合には、 Hibernate はサブクラスで定義された <join> の選択に順次選択を使います。この場合、行がサブクラスのインスタンスを" +"代表することがわかった場合にのみ発行されます。内部結合はクラスやそのスーパー" +"クラスで定義された <join> を検索するために使用しま" +"す。" + +#. Tag: para +#: basic_mapping.xml:2862 +#, fuzzy, no-c-format +msgid "" +"inverse: If true, Hibernate will not try to insert or " +"update the properties defined by this join. Default to false." +msgstr "" +"inverse (オプション - デフォルトは false ): もし可能であれば、 Hibernate はこの結合で定義されているプロパティ" +"に対し挿入や更新を行いません。" + +#. Tag: para +#: basic_mapping.xml:2868 +#, fuzzy, no-c-format +msgid "" +"optional: If enabled (the default), Hibernate will insert " +"a row only if the properties defined by this join are non-null and will " +"always use an outer join to retrieve the properties." +msgstr "" +"optional (オプション - デフォルトは false ): もし可能であれば、 Hibernate はこの結合で定義されたプロパティが " +"null でない場合にのみ行を挿入し、そのプロパティの検索には常に外部結合を使用し" +"ます。" + +#. Tag: para +#: basic_mapping.xml:2875 +#, no-c-format +msgid "" +"foreignKey: defines the Foreign Key name of a secondary " +"table pointing back to the primary table." +msgstr "" + +#. Tag: para +#: basic_mapping.xml:2880 +#, no-c-format +msgid "" +"Make sure to use the secondary table name in the appliesto property" +msgstr "" + +#. Tag: programlisting +#: basic_mapping.xml:2883 +#, no-c-format +msgid "" +"@Entity\n" +"@Table(name=\"MainCat\")\n" +"@SecondaryTable(name=\"Cat1\")\n" +"@org.hibernate.annotations.Table(\n" +" appliesTo=\"Cat1\",\n" +" fetch=FetchMode.SELECT,\n" +" optional=true)\n" +"public class Cat implements Serializable {\n" +"\n" +" private Integer id;\n" +" private String name;\n" +" private String storyPart1;\n" +" private String storyPart2;\n" +"\n" +" @Id @GeneratedValue\n" +" public Integer getId() {\n" +" return id;\n" +" }\n" +"\n" +" public String getName() {\n" +" return name;\n" +" }\n" +" \n" +" @Column(table=\"Cat1\")\n" +" public String getStoryPart1() {\n" +" return storyPart1;\n" +" }\n" +"\n" +" @Column(table=\"Cat2\")\n" +" public String getStoryPart2() {\n" +" return storyPart2;\n" +" }\n" +"}" +msgstr "" + +#. Tag: para +#: basic_mapping.xml:2885 +#, fuzzy, no-c-format +msgid "In hbm.xml, use the <join> element." +msgstr "" +"例えば、もし以下のような <properties> マッピングが" +"あった場合:" + +#. Tag: programlisting +#: basic_mapping.xml:2903 +#, fuzzy, no-c-format +msgid "" +"<join\n" +" table=\"tablename\"\n" +" schema=\"owner\"\n" +" catalog=\"catalog\"\n" +" fetch=\"join|select\"\n" +" inverse=\"true|false\"\n" +" optional=\"true|false\">\n" +"\n" +" <key ... />\n" +"\n" +" <property ... />\n" +" ...\n" +"</join>" +msgstr "" +"<join\n" +" table=\"tablename\"\n" +" schema=\"owner\"\n" +" catalog=\"catalog\"\n" +" fetch=\"join|select\"\n" +" inverse=\"true|false\"\n" +" optional=\"true|false\">\n" +" \n" +" <key ... />\n" +" \n" +" <property ... />\n" +" ...\n" +"</join>" + +#. Tag: para +#: basic_mapping.xml:2907 #, no-c-format msgid "table: the name of the joined table." msgstr "table :結合したテーブルの名前" #. Tag: para +#: basic_mapping.xml:2924 #, no-c-format msgid "" "fetch (optional - defaults to join): " @@ -2980,6 +6150,7 @@ msgstr "" "す。" #. Tag: para +#: basic_mapping.xml:2939 #, no-c-format msgid "" "inverse (optional - defaults to falseoptional (optional - defaults to false<key> element has featured a few times within " +"To link one entity to an other, you need to map the association property as " +"a to one association. In the relational model, you can either use a foreign " +"key or an association table, or (a bit less common) share the same primary " +"key value between the two entities." +msgstr "" + +#. Tag: para +#: basic_mapping.xml:2974 +#, no-c-format +msgid "" +"To mark an association, use either @ManyToOne or " +"@OnetoOne." +msgstr "" + +#. Tag: para +#: basic_mapping.xml:2978 +#, no-c-format +msgid "" +"@ManyToOne and @OneToOne have a " +"parameter named targetEntity which describes the target " +"entity name. You usually don't need this parameter since the default value " +"(the type of the property that stores the association) is good in almost all " +"cases. However this is useful when you want to use interfaces as the return " +"type instead of the regular entity." +msgstr "" + +#. Tag: para +#: basic_mapping.xml:2985 +#, no-c-format +msgid "" +"Setting a value of the cascade attribute to any " +"meaningful value other than nothing will propagate certain operations to the " +"associated object. The meaningful values are divided into three categories." +msgstr "" + +#. Tag: para +#: basic_mapping.xml:2992 +#, no-c-format +msgid "" +"basic operations, which include: persist, merge, delete, save-" +"update, evict, replicate, lock and refresh;" +msgstr "" + +#. Tag: para +#: basic_mapping.xml:2998 +#, fuzzy, no-c-format +msgid "" +"special values: delete-orphan or all ;" +msgstr "" +"関連が class の代わりに entity-name を" +"使って、どのように指定されるのかに注目してください。" + +#. Tag: para +#: basic_mapping.xml:3003 +#, no-c-format +msgid "" +"comma-separated combinations of operation names: cascade=\"persist," +"merge,evict\" or cascade=\"all,delete-orphan\". " +"See for a full explanation. Note " +"that single valued many-to-one associations do not support orphan delete." +msgstr "" + +#. Tag: para +#: basic_mapping.xml:3012 +#, no-c-format +msgid "" +"By default, single point associations are eagerly fetched in JPA 2. You can " +"mark it as lazily fetched by using @ManyToOne(fetch=FetchType." +"LAZY) in which case Hibernate will proxy the association and " +"load it when the state of the associated entity is reached. You can force " +"Hibernate not to use a proxy by using @LazyToOne(NO_PROXY). In this case, the property is fetched lazily when the instance " +"variable is first accessed. This requires build-time bytecode " +"instrumentation. lazy=\"false\" specifies that the association will always " +"be eagerly fetched." +msgstr "" + +#. Tag: para +#: basic_mapping.xml:3022 +#, no-c-format +msgid "" +"With the default JPA options, single-ended associations are loaded with a " +"subsequent select if set to LAZY, or a SQL JOIN is used " +"for EAGER associations. You can however adjust the " +"fetching strategy, ie how data is fetched by using @Fetch. FetchMode can be SELECT (a " +"select is triggered when the association needs to be loaded) or " +"JOIN (use a SQL JOIN to load the association while " +"loading the owner entity). JOIN overrides any lazy " +"attribute (an association loaded through a JOIN strategy " +"cannot be lazy)." +msgstr "" + +#. Tag: title +#: basic_mapping.xml:3034 +#, fuzzy, no-c-format +msgid "Using a foreign key or an association table" +msgstr "ユニーク外部キー関連" + +#. Tag: para +#: basic_mapping.xml:3036 +#, fuzzy, no-c-format +msgid "An ordinary association to another persistent class is declared using a" +msgstr "" +"他の永続クラスへの一対一関連は、one-to-one 要素で定義しま" +"す。" + +#. Tag: para +#: basic_mapping.xml:3041 +#, no-c-format +msgid "" +"@ManyToOne if several entities can point to the the " +"target entity" +msgstr "" + +#. Tag: para +#: basic_mapping.xml:3046 +#, no-c-format +msgid "" +"@OneToOne if only a single entity can point to the " +"the target entity" +msgstr "" + +#. Tag: para +#: basic_mapping.xml:3051 +#, no-c-format +msgid "" +"and a foreign key in one table is referencing the primary key column(s) of " +"the target table." +msgstr "" + +#. Tag: programlisting +#: basic_mapping.xml:3054 +#, no-c-format +msgid "" +"@Entity\n" +"public class Flight implements Serializable {\n" +" @ManyToOne( cascade = {CascadeType.PERSIST, CascadeType.MERGE} )\n" +" @JoinColumn(name=\"COMP_ID\")\n" +" public Company getCompany() {\n" +" return company;\n" +" }\n" +" ...\n" +"}" +msgstr "" + +#. Tag: para +#: basic_mapping.xml:3056 +#, no-c-format +msgid "" +"The @JoinColumn attribute is optional, the default value" +"(s) is the concatenation of the name of the relationship in the owner side, " +"_ (underscore), and the name of the primary key column in " +"the owned side. In this example company_id because the " +"property name is company and the column id of Company is " +"id." +msgstr "" + +#. Tag: programlisting +#: basic_mapping.xml:3064 +#, no-c-format +msgid "" +"@Entity\n" +"public class Flight implements Serializable {\n" +" @ManyToOne( cascade = {CascadeType.PERSIST, CascadeType.MERGE}, " +"targetEntity=CompanyImpl.class )\n" +" @JoinColumn(name=\"COMP_ID\")\n" +" public Company getCompany() {\n" +" return company;\n" +" }\n" +" ...\n" +"}\n" +"\n" +"public interface Company {\n" +" ...\n" +"}" +msgstr "" + +#. Tag: para +#: basic_mapping.xml:3066 +#, no-c-format +msgid "" +"You can also map a to one association through an association table. This " +"association table described by the @JoinTable annotation " +"will contains a foreign key referencing back the entity table (through " +"@JoinTable.joinColumns) and a a foreign key referencing " +"the target entity table (through @JoinTable.inverseJoinColumns)." +msgstr "" + +#. Tag: programlisting +#: basic_mapping.xml:3074 +#, no-c-format +msgid "" +"@Entity\n" +"public class Flight implements Serializable {\n" +" @ManyToOne( cascade = {CascadeType.PERSIST, CascadeType.MERGE} )\n" +" @JoinTable(name=\"Flight_Company\",\n" +" joinColumns = @JoinColumn(name=\"FLIGHT_ID\"),\n" +" inverseJoinColumns = @JoinColumn(name=\"COMP_ID\")\n" +" )\n" +" public Company getCompany() {\n" +" return company;\n" +" }\n" +" ...\n" +"}" +msgstr "" + +#. Tag: para +#: basic_mapping.xml:3077 +#, no-c-format +msgid "" +"You can use a SQL fragment to simulate a physical join column using the " +"@JoinColumnOrFormula / " +"@JoinColumnOrformulas annotations (just like you can " +"use a SQL fragment to simulate a property column via the " +"@Formula annotation)." +msgstr "" + +#. Tag: programlisting +#: basic_mapping.xml:3083 +#, no-c-format +msgid "" +"@Entity\n" +"public class Ticket implements Serializable {\n" +" @ManyToOne\n" +" @JoinColumnOrFormula(formula=\"(firstname + ' ' + lastname)\")\n" +" public Person getOwner() {\n" +" return person;\n" +" }\n" +" ...\n" +"}" +msgstr "" + +#. Tag: para +#: basic_mapping.xml:3086 +#, no-c-format +msgid "" +"You can mark an association as mandatory by using the " +"optional=false attribute. We recommend to use Bean " +"Validation's @NotNull annotation as a better " +"alternative however. As a consequence, the foreign key column(s) will be " +"marked as not nullable (if possible)." +msgstr "" + +#. Tag: para +#: basic_mapping.xml:3092 +#, no-c-format +msgid "" +"When Hibernate cannot resolve the association because the expected " +"associated element is not in database (wrong id on the association column), " +"an exception is raised. This might be inconvenient for legacy and badly " +"maintained schemas. You can ask Hibernate to ignore such elements instead of " +"raising an exception using the @NotFound annotation." +msgstr "" + +#. Tag: title +#: basic_mapping.xml:3100 +#, no-c-format +msgid "@NotFound annotation" +msgstr "" + +#. Tag: programlisting +#: basic_mapping.xml:3102 +#, no-c-format +msgid "" +"@Entity\n" +"public class Child {\n" +" ...\n" +" @ManyToOne\n" +" @NotFound(action=NotFoundAction.IGNORE)\n" +" public Parent getParent() { ... }\n" +" ...\n" +"}" +msgstr "" + +#. Tag: para +#: basic_mapping.xml:3105 +#, no-c-format +msgid "" +"Sometimes you want to delegate to your database the deletion of cascade when " +"a given entity is deleted. In this case Hibernate generates a cascade delete " +"constraint at the database level." +msgstr "" + +#. Tag: title +#: basic_mapping.xml:3110 +#, no-c-format +msgid "@OnDelete annotation" +msgstr "" + +#. Tag: programlisting +#: basic_mapping.xml:3112 +#, no-c-format +msgid "" +"@Entity\n" +"public class Child {\n" +" ...\n" +" @ManyToOne\n" +" @OnDelete(action=OnDeleteAction.CASCADE)\n" +" public Parent getParent() { ... }\n" +" ...\n" +"}" +msgstr "" + +#. Tag: para +#: basic_mapping.xml:3115 +#, no-c-format +msgid "" +"Foreign key constraints, while generated by Hibernate, have a fairly " +"unreadable name. You can override the constraint name using " +"@ForeignKey." +msgstr "" + +#. Tag: title +#: basic_mapping.xml:3120 +#, fuzzy, no-c-format +msgid "@ForeignKey annotation" +msgstr "ユニーク外部キー関連" + +#. Tag: programlisting +#: basic_mapping.xml:3122 +#, no-c-format +msgid "" +"@Entity\n" +"public class Child {\n" +" ...\n" +" @ManyToOne\n" +" @ForeignKey(name=\"FK_PARENT\")\n" +" public Parent getParent() { ... }\n" +" ...\n" +"}\n" +"\n" +"alter table Child add constraint FK_PARENT foreign key (parent_id) " +"references Parent" +msgstr "" + +#. Tag: para +#: basic_mapping.xml:3125 +#, no-c-format +msgid "" +"Sometimes, you want to link one entity to an other not by the target entity " +"primary key but by a different unique key. You can achieve that by " +"referencing the unique key column(s) in @JoinColumn." +"referenceColumnName." +msgstr "" + +#. Tag: programlisting +#: basic_mapping.xml:3130 basic_mapping.xml:3682 +#, no-c-format +msgid "" +"@Entity\n" +"class Person {\n" +" @Id Integer personNumber;\n" +" String firstName;\n" +" @Column(name=\"I\")\n" +" String initial;\n" +" String lastName;\n" +"}\n" +"\n" +"@Entity\n" +"class Home {\n" +" @ManyToOne\n" +" @JoinColumns({\n" +" @JoinColumn(name=\"first_name\", referencedColumnName=\"firstName\"),\n" +" @JoinColumn(name=\"init\", referencedColumnName=\"I\"),\n" +" @JoinColumn(name=\"last_name\", referencedColumnName=\"lastName\"),\n" +" })\n" +" Person owner\n" +"}" +msgstr "" + +#. Tag: para +#: basic_mapping.xml:3132 +#, no-c-format +msgid "" +"This is not encouraged however and should be reserved to legacy mappings." +msgstr "" + +#. Tag: para +#: basic_mapping.xml:3135 +#, no-c-format +msgid "" +"In hbm.xml, mapping an association is similar. The main difference is that a " +"@OneToOne is mapped as <many-to-one " +"unique=\"true\"/>, let's dive into the subject." +msgstr "" + +#. Tag: programlisting +#: basic_mapping.xml:3177 +#, fuzzy, no-c-format +msgid "" +"<many-to-one\n" +" name=\"propertyName\"\n" +" column=\"column_name\"\n" +" class=\"ClassName\"\n" +" cascade=\"cascade_style\"\n" +" fetch=\"join|select\"\n" +" update=\"true|false\"\n" +" insert=\"true|false\"\n" +" property-ref=\"propertyNameFromAssociatedClass\"\n" +" access=\"field|property|ClassName\"\n" +" unique=\"true|false\"\n" +" not-null=\"true|false\"\n" +" optimistic-lock=\"true|false\"\n" +" lazy=\"proxy|no-proxy|false\"\n" +" not-found=\"ignore|exception\"\n" +" entity-name=\"EntityName\"\n" +" formula=\"arbitrary SQL expression\"\n" +" node=\"element-name|@attribute-name|element/@attribute|.\"\n" +" embed-xml=\"true|false\"\n" +" index=\"index_name\"\n" +" unique_key=\"unique_key_id\"\n" +" foreign-key=\"foreign_key_name\"\n" +"/>" +msgstr "" +"<many-to-one\n" +" name=\"propertyName\"\n" +" column=\"column_name\"\n" +" class=\"ClassName\"\n" +" cascade=\"cascade_style\"\n" +" fetch=\"join|select\"\n" +" update=\"true|false\"\n" +" insert=\"true|false\"\n" +" property-ref=\"propertyNameFromAssociatedClass\"\n" +" access=\"field|property|ClassName\"\n" +" unique=\"true|false\"\n" +" not-null=\"true|false\"\n" +" optimistic-lock=\"true|false\"\n" +" lazy=\"proxy|no-proxy|false\"\n" +" not-found=\"ignore|exception\"\n" +" entity-name=\"EntityName\"\n" +" formula=\"arbitrary SQL expression\"\n" +" node=\"element-name|@attribute-name|element/@attribute|.\"\n" +" embed-xml=\"true|false\"\n" +" index=\"index_name\"\n" +" unique_key=\"unique_key_id\"\n" +" foreign-key=\"foreign_key_name\"\n" +"/>" + +#. Tag: para +#: basic_mapping.xml:3185 basic_mapping.xml:3868 +#, no-c-format +msgid "" +"column (optional): the name of the foreign key column. " +"This can also be specified by nested <column> " +"element(s)." +msgstr "" +"column (オプション):外部キーカラムの名前。ネストした " +"<column> カラムによっても指定されます。" + +#. Tag: para +#: basic_mapping.xml:3191 basic_mapping.xml:3385 +#, no-c-format +msgid "" +"class (optional - defaults to the property type " +"determined by reflection): the name of the associated class." +msgstr "" +"class(オプション - デフォルトはリフレクションにより決定さ" +"れるプロパティの型): 関連クラスの名前。" + +#. Tag: para +#: basic_mapping.xml:3197 basic_mapping.xml:3391 +#, no-c-format +msgid "" +"cascade (optional): specifies which operations should be " +"cascaded from the parent object to the associated object." +msgstr "" +"cascade(オプション): 親オブジェクトから関連オブジェクト" +"へ、どの操作をカスケードするかを指定します。" + +#. Tag: para +#: basic_mapping.xml:3203 basic_mapping.xml:3407 +#, no-c-format +msgid "" +"fetch (optional - defaults to select): " +"chooses between outer-join fetching or sequential select fetching." +msgstr "" +"fetch(オプション - デフォルトは select ): 外部結合フェッチと順次選択フェッチ(sequential select fetch)の" +"どちらかを選択します。" + +#. Tag: para +#: basic_mapping.xml:3209 +#, no-c-format +msgid "" +"update, insert (optional - defaults to true): specifies that the mapped columns should be included in SQL " +"UPDATE and/or INSERT statements. " +"Setting both to false allows a pure \"derived\" " +"association whose value is initialized from another property that maps to " +"the same column(s), or by a trigger or other application." +msgstr "" +"update, insert(オプション - デフォルトは true ): マッピングされたカラムが SQL の UPDATE また" +"は INSERT 文に含まれることを指定します。両方とも " +"false に設定すると、その値が同じカラムにマッピングされた他" +"のプロパティやトリガや他のアプリケーションによって初期化された純粋な「導出」" +"プロパティが可能になります。" + +#. Tag: para +#: basic_mapping.xml:3219 +#, no-c-format +msgid "" +"property-ref (optional): the name of a property of the " +"associated class that is joined to this foreign key. If not specified, the " +"primary key of the associated class is used." +msgstr "" +"property-ref: (オプション) この外部キーに加わる、関連クラ" +"スのプロパティの名前。指定されていない場合は、関連クラスの主キーが使用されま" +"す。" + +#. Tag: para +#: basic_mapping.xml:3232 +#, no-c-format +msgid "" +"unique (optional): enables the DDL generation of a unique " +"constraint for the foreign-key column. By allowing this to be the target of " +"a property-ref, you can make the association multiplicity " +"one-to-one." +msgstr "" +"unique(オプション): 外部キーカラムに対してユニーク制約" +"をつけた DDL の生成を可能にします。また、 property-ref の" +"ターゲットにすることもできます。これにより関連の多重度を効果的に一対一にしま" +"す。" + +#. Tag: para +#: basic_mapping.xml:3240 +#, no-c-format +msgid "" +"not-null (optional): enables the DDL generation of a " +"nullability constraint for the foreign key columns." +msgstr "" +"not-null (オプション): 外部キーカラムに対して、 null 値を" +"許可する DDL の生成を可能にします。" + +#. Tag: para +#: basic_mapping.xml:3254 +#, no-c-format +msgid "" +"lazy (optional - defaults to proxy): " +"by default, single point associations are proxied. lazy=\"no-proxy" +"\" specifies that the property should be fetched lazily when the " +"instance variable is first accessed. This requires build-time bytecode " +"instrumentation. lazy=\"false\" specifies that the " +"association will always be eagerly fetched." +msgstr "" +"lazy (オプション - デフォルトは proxy ): デフォルトでは、多重度1の関連がプロキシとなります。 " +"lazy=\"no-proxy\" は、インスタンス変数に最初にアクセスした" +"ときに、プロパティを遅延フェッチするよう指定します (ビルド時にバイトコード実" +"装が必要になります)。 lazy=\"false\" は関連を常に即時に" +"フェッチするよう指定します。" + +#. Tag: para +#: basic_mapping.xml:3264 +#, no-c-format +msgid "" +"not-found (optional - defaults to exception): specifies how foreign keys that reference missing rows will be " +"handled. ignore will treat a missing row as a null " +"association." +msgstr "" +"not-found (オプション - デフォルトは exception): 参照先の行がない外部キーをどのように扱うかを指定します: " +"ignore を指定すると、行がないことを関連がないものとして扱" +"います。" + +#. Tag: para +#: basic_mapping.xml:3272 basic_mapping.xml:3448 +#, no-c-format +msgid "" +"entity-name (optional): the entity name of the associated " +"class." +msgstr "" +"entity-name (オプション):関連したクラスのエンティティ名。" + +#. Tag: para +#: basic_mapping.xml:3277 +#, no-c-format +msgid "" +"formula (optional): an SQL expression that defines the " +"value for a computed foreign key." +msgstr "" +"formula (オプション): 計算された 外" +"部キーに対して値を定義する SQL 式" + +#. Tag: para +#: basic_mapping.xml:3284 +#, fuzzy, no-c-format +msgid "" +"Setting a value of the cascade attribute to any " +"meaningful value other than none will propagate certain " +"operations to the associated object. The meaningful values are divided into " +"three categories. First, basic operations, which include: persist, " +"merge, delete, save-update, evict, replicate, lock and refresh; " +"second, special values: delete-orphan; and third," +"all comma-separated combinations of operation names: " +"cascade=\"persist,merge,evict\" or cascade=\"all," +"delete-orphan\". See " +"for a full explanation. Note that single valued, many-to-one and one-to-one, " +"associations do not support orphan delete." +msgstr "" +"cascade 属性に none 以外の意味のある値" +"を設定すると、関連オブジェクトへある操作が伝播することになります。意味のある" +"値とは Hibernate の基本操作の名前のことで、 delete-orphan " +"と all 、操作名をカンマで区切った組み合わせ (例えば " +"cascade=\"persist,merge,evict\"cascade=\"all," +"delete-orphan\")、またそれだけでなく persist, merge, " +"delete, save-update, evict, replicate, lock, refresh のことを指しま" +"す。詳しい説明は を参照してくださ" +"い。値が一つの関連 (many-to-one と one-to-one関連) は、単独での削除 (orphan " +"delete) をサポートしていないことに注意してください。" + +#. Tag: para +#: basic_mapping.xml:3298 +#, no-c-format +msgid "" +"Here is an example of a typical many-to-one declaration:" +msgstr "" +"典型的な many-to-one 宣言は次のようにシンプルです。:" + +#. Tag: programlisting +#: basic_mapping.xml:3301 +#, fuzzy, no-c-format +msgid "" +"<many-to-one name=\"product\" class=\"Product\" column=\"PRODUCT_ID\"/>" +msgstr "" +"<many-to-one name=\"product\" class=\"Product\" column=\"PRODUCT_ID\"/>" + +#. Tag: para +#: basic_mapping.xml:3303 +#, no-c-format +msgid "" +"The property-ref attribute should only be used for " +"mapping legacy data where a foreign key refers to a unique key of the " +"associated table other than the primary key. This is a complicated and " +"confusing relational model. For example, if the Product " +"class had a unique serial number that is not the primary key. The " +"unique attribute controls Hibernate's DDL generation with " +"the SchemaExport tool." +msgstr "" +"property-ref 属性は、外部キーが関連付けられたテーブルの、" +"主キーでないユニークキーを参照しているレガシーデータをマップするためにだけ使" +"うべきです。これは醜いリレーショナルモデルです。例えば Product クラスが、主キーでないユニークなシリアルナンバーを持っていると仮定し" +"てみてください。( unique 属性は SchemaExport ツールを使っ" +"た Hibernate の DDL 生成を制御します。)" + +#. Tag: programlisting +#: basic_mapping.xml:3311 +#, fuzzy, no-c-format +msgid "" +"<property name=\"serialNumber\" unique=\"true\" type=\"string\" column=" +"\"SERIAL_NUMBER\"/>" +msgstr "" +"<property name=\"serialNumber\" unique=\"true\" type=\"string\" column=" +"\"SERIAL_NUMBER\"/>" + +#. Tag: para +#: basic_mapping.xml:3313 +#, no-c-format +msgid "Then the mapping for OrderItem might use:" +msgstr "" +"以下のように OrderItem に対してマッピングを使えます:" + +#. Tag: programlisting +#: basic_mapping.xml:3316 +#, fuzzy, no-c-format +msgid "" +"<many-to-one name=\"product\" property-ref=\"serialNumber\" column=" +"\"PRODUCT_SERIAL_NUMBER\"/>" +msgstr "" +"<many-to-one name=\"product\" property-ref=\"serialNumber\" column=" +"\"PRODUCT_SERIAL_NUMBER\"/>" + +#. Tag: para +#: basic_mapping.xml:3318 +#, no-c-format +msgid "This is not encouraged, however." +msgstr "しかし、これは決して推奨できません。" + +#. Tag: para +#: basic_mapping.xml:3320 +#, no-c-format +msgid "" +"If the referenced unique key comprises multiple properties of the associated " +"entity, you should map the referenced properties inside a named <" +"properties> element." +msgstr "" +"参照したユニークキーが、関連するエンティティの多数のプロパティから構成される" +"場合、指定した <properties> 要素内で、参照するプロパ" +"ティをマッピングするべきです。" + +#. Tag: para +#: basic_mapping.xml:3324 +#, no-c-format +msgid "" +"If the referenced unique key is the property of a component, you can specify " +"a property path:" +msgstr "" +"もし参照したユニークキーがコンポーネントのプロパティである場合は、プロパティ" +"のパスを指定できます:" + +#. Tag: programlisting +#: basic_mapping.xml:3327 +#, fuzzy, no-c-format +msgid "" +"<many-to-one name=\"owner\" property-ref=\"identity.ssn\" column=" +"\"OWNER_SSN\"/>" +msgstr "" +"<many-to-one name=\"owner\" property-ref=\"identity.ssn\" column=" +"\"OWNER_SSN\"/>" + +#. Tag: title +#: basic_mapping.xml:3331 +#, no-c-format +msgid "Sharing the primary key with the associated entity" +msgstr "" + +#. Tag: para +#: basic_mapping.xml:3333 +#, no-c-format +msgid "" +"The second approach is to ensure an entity and its associated entity share " +"the same primary key. In this case the primary key column is also a foreign " +"key and there is no extra column. These associations are always one to one." +msgstr "" + +#. Tag: title +#: basic_mapping.xml:3339 +#, fuzzy, no-c-format +msgid "One to One association" +msgstr "ユニーク外部キー関連" + +#. Tag: programlisting +#: basic_mapping.xml:3341 +#, no-c-format +msgid "" +"@Entity\n" +"public class Body {\n" +" @Id\n" +" public Long getId() { return id; }\n" +"\n" +" @OneToOne(cascade = CascadeType.ALL)\n" +" @MapsId\n" +" public Heart getHeart() {\n" +" return heart;\n" +" }\n" +" ...\n" +"} \n" +"\n" +"@Entity\n" +"public class Heart {\n" +" @Id\n" +" public Long getId() { ...}\n" +"}" +msgstr "" + +#. Tag: para +#: basic_mapping.xml:3345 +#, no-c-format +msgid "" +"Many people got confused by these primary key based one to one associations. " +"They can only be lazily loaded if Hibernate knows that the other side of the " +"association is always present. To indicate to Hibernate that it is the case, " +"use @OneToOne(optional=false)." +msgstr "" + +#. Tag: para +#: basic_mapping.xml:3352 +#, no-c-format +msgid "In hbm.xml, use the following mapping." +msgstr "" + +#. Tag: programlisting +#: basic_mapping.xml:3377 +#, fuzzy, no-c-format +msgid "" +"<one-to-one\n" +" name=\"propertyName\"\n" +" class=\"ClassName\"\n" +" cascade=\"cascade_style\"\n" +" constrained=\"true|false\"\n" +" fetch=\"join|select\"\n" +" property-ref=\"propertyNameFromAssociatedClass\"\n" +" access=\"field|property|ClassName\"\n" +" formula=\"any SQL expression\"\n" +" lazy=\"proxy|no-proxy|false\"\n" +" entity-name=\"EntityName\"\n" +" node=\"element-name|@attribute-name|element/@attribute|.\"\n" +" embed-xml=\"true|false\"\n" +" foreign-key=\"foreign_key_name\"\n" +"/>" +msgstr "" +"<one-to-one\n" +" name=\"propertyName\"\n" +" class=\"ClassName\"\n" +" cascade=\"cascade_style\"\n" +" constrained=\"true|false\"\n" +" fetch=\"join|select\"\n" +" property-ref=\"propertyNameFromAssociatedClass\"\n" +" access=\"field|property|ClassName\"\n" +" formula=\"any SQL expression\"\n" +" lazy=\"proxy|no-proxy|false\"\n" +" entity-name=\"EntityName\"\n" +" node=\"element-name|@attribute-name|element/@attribute|.\"\n" +" embed-xml=\"true|false\"\n" +" foreign-key=\"foreign_key_name\"\n" +"/>" + +#. Tag: para +#: basic_mapping.xml:3397 +#, no-c-format +msgid "" +"constrained (optional): specifies that a foreign key " +"constraint on the primary key of the mapped table and references the table " +"of the associated class. This option affects the order in which save" +"() and delete() are cascaded, and determines " +"whether the association can be proxied. It is also used by the schema export " +"tool." +msgstr "" +"constrained(オプション): マッピングされたテーブルの主" +"キーに対する外部キー制約が、関連クラスのテーブルを参照することを指定します。" +"このオプションは save()delete() が" +"カスケードされる順序に影響し、そして関連がプロキシされるかどうかにも影響しま" +"す (そしてスキーマエクスポートツールにも使われます)。" + +#. Tag: para +#: basic_mapping.xml:3413 +#, no-c-format +msgid "" +"property-ref (optional): the name of a property of the " +"associated class that is joined to the primary key of this class. If not " +"specified, the primary key of the associated class is used." +msgstr "" +"property-ref(オプション): このクラスの主キーに結合され" +"た関連クラスのプロパティ名。指定されなければ、関連クラスの主キーが使われま" +"す。" + +#. Tag: para +#: basic_mapping.xml:3426 +#, no-c-format +msgid "" +"formula (optional): almost all one-to-one associations " +"map to the primary key of the owning entity. If this is not the case, you " +"can specify another column, columns or expression to join on using an SQL " +"formula. See org.hibernate.test.onetooneformula for an " +"example." +msgstr "" +"formula (オプション): ほとんどすべての一対一関連はオーナー" +"のエンティティの主キーへとマッピングされます。これ以外の稀な場合は、他のカラ" +"ムや、複数のカラム、 SQL 構文を使った結合するための式を指定できます。(例は " +"org.hibernate.test.onetooneformula を参照してください。)" + +#. Tag: para +#: basic_mapping.xml:3435 +#, no-c-format +msgid "" +"lazy (optional - defaults to proxy): " +"by default, single point associations are proxied. lazy=\"no-proxy" +"\" specifies that the property should be fetched lazily when the " +"instance variable is first accessed. It requires build-time bytecode " +"instrumentation. lazy=\"false\" specifies that the " +"association will always be eagerly fetched. Note that if " +"constrained=\"false\", proxying is impossible and " +"Hibernate will eagerly fetch the association." +msgstr "" +"lazy (オプション - デフォルトは proxy ): デフォルトでは、多重度1の関連がプロキシとなります。 " +"lazy=\"no-proxy\" は、インスタンス変数に最初にアクセスした" +"ときに、プロパティを遅延フェッチするよう指定します (ビルド時にバイトコード実" +"装が必要になります)。 lazy=\"false\" は関連を常に即時に" +"フェッチするよう指定します。 もし constrained=\"false\" ならば、プロキシは使用不可能となり、関連を即時にフェッチすることに注" +"意してください。" + +#. Tag: para +#: basic_mapping.xml:3454 +#, no-c-format +msgid "" +"Primary key associations do not need an extra table column. If two rows are " +"related by the association, then the two table rows share the same primary " +"key value. To relate two objects by a primary key association, ensure that " +"they are assigned the same identifier value." +msgstr "" +"主キー関連には、特別なテーブルカラムは必要ありません。もし2つの行が関連により" +"関係していれば、2つのテーブルは同じ主キーの値を共有します。そのため2つのオブ" +"ジェクトを主キー関連によって関連付けたいのであれば、確実に同じ識別子の値を代" +"入しなければなりません。" + +#. Tag: para +#: basic_mapping.xml:3460 +#, no-c-format +msgid "" +"For a primary key association, add the following mappings to " +"Employee and Person respectively:" +msgstr "" +"主キー関連を行うためには、以下のマッピングを Employee と " +"Person のそれぞれに追加してください。" + +#. Tag: programlisting +#: basic_mapping.xml:3464 +#, fuzzy, no-c-format +msgid "<one-to-one name=\"person\" class=\"Person\"/>" +msgstr "<one-to-one name=\"person\" class=\"Person\"/>" + +#. Tag: programlisting +#: basic_mapping.xml:3466 +#, fuzzy, no-c-format +msgid "" +"<one-to-one name=\"employee\" class=\"Employee\" constrained=\"true\"/>" +msgstr "" +"<one-to-one name=\"employee\" class=\"Employee\" constrained=\"true\"/>" + +#. Tag: para +#: basic_mapping.xml:3468 +#, no-c-format +msgid "" +"Ensure that the primary keys of the related rows in the PERSON and EMPLOYEE " +"tables are equal. You use a special Hibernate identifier generation strategy " +"called foreign:" +msgstr "" +"ここで、 PERSON と EMPLOYEE テーブルの関係する行の主キーが同じであることを確" +"実にしなければいけません。ここでは、 foreign という特殊な " +"Hibernate 識別子生成戦略を使います:" + +#. Tag: programlisting +#: basic_mapping.xml:3472 +#, fuzzy, no-c-format +msgid "" +"<class name=\"person\" table=\"PERSON\">\n" +" <id name=\"id\" column=\"PERSON_ID\">\n" +" <generator class=\"foreign\">\n" +" <param name=\"property\">employee</param>\n" +" </generator>\n" +" </id>\n" +" ...\n" +" <one-to-one name=\"employee\"\n" +" class=\"Employee\"\n" +" constrained=\"true\"/>\n" +"</class>" +msgstr "" +"<class name=\"person\" table=\"PERSON\">\n" +" <id name=\"id\" column=\"PERSON_ID\">\n" +" <generator class=\"foreign\">\n" +" <param name=\"property\">employee</param>\n" +" </generator>\n" +" </id>\n" +" ...\n" +" <one-to-one name=\"employee\"\n" +" class=\"Employee\"\n" +" constrained=\"true\"/>\n" +"</class>" + +#. Tag: para +#: basic_mapping.xml:3474 +#, no-c-format +msgid "" +"A newly saved instance of Person is assigned the same " +"primary key value as the Employee instance referred with " +"the employee property of that Person." +msgstr "" +"Employee インスタンスが、 Person の " +"employee プロパティで参照されるように、新しくセーブされた " +"Person のインスタンスには同じ主キーの値が代入されます。新" +"しくセーブする Person インスタンスは、その " +"Personemployee プロパティが参照す" +"る Employee インスタンスとして同じ主キーが割り当てられま" +"す。" + +#. Tag: title +#: basic_mapping.xml:3482 +#, no-c-format +msgid "Natural-id" +msgstr "natural-id" + +#. Tag: para +#: basic_mapping.xml:3484 +#, fuzzy, no-c-format +msgid "" +"Although we recommend the use of surrogate keys as primary keys, you should " +"try to identify natural keys for all entities. A natural key is a property " +"or combination of properties that is unique and non-null. It is also " +"immutable. Map the properties of the natural key as @NaturalId or map them inside the <natural-id> " +"element. Hibernate will generate the necessary unique key and nullability " +"constraints and, as a result, your mapping will be more self-documenting." +msgstr "" +"主キーとして代理キーの使用を推奨しますが、すべてのエンティティに対して自然" +"キーを識別するようにすべきです。自然キーはユニークかつ非 null な一つのプロパ" +"ティ、またはプロパティの連結です。不変であればさらに良いです。 <" +"natural-id> 要素内で自然キーのプロパティをマッピングします。 " +"Hibernate は必然的にユニークかつ null 値を許可する制約を生成し、こうしてマッ" +"ピングはより自己記述的になります。" + +#. Tag: programlisting +#: basic_mapping.xml:3493 +#, no-c-format +msgid "" +"@Entity\n" +"public class Citizen {\n" +" @Id\n" +" @GeneratedValue\n" +" private Integer id;\n" +" private String firstname;\n" +" private String lastname;\n" +" \n" +" @NaturalId\n" +" @ManyToOne\n" +" private State state;\n" +"\n" +" @NaturalId\n" +" private String ssn;\n" +" ...\n" +"}\n" +"\n" +"\n" +"\n" +"//and later on query\n" +"List results = s.createCriteria( Citizen.class )\n" +" .add( Restrictions.naturalId().set( \"ssn\", \"1234\" ).set" +"( \"state\", ste ) )\n" +" .list();" +msgstr "" + +#. Tag: para +#: basic_mapping.xml:3495 +#, no-c-format +msgid "Or in XML," +msgstr "" + +#. Tag: programlisting +#: basic_mapping.xml:3497 +#, fuzzy, no-c-format +msgid "" +"<natural-id mutable=\"true|false\"/>\n" +" <property ... />\n" +" <many-to-one ... />\n" +" ......\n" +"</natural-id>" +msgstr "" +"<natural-id mutable=\"true|false\"/>\n" +" <property ... />\n" +" <many-to-one ... />\n" +" ......\n" +"</natural-id>" + +#. Tag: para +#: basic_mapping.xml:3499 +#, no-c-format +msgid "" +"It is recommended that you implement equals() and " +"hashCode() to compare the natural key properties of the " +"entity." +msgstr "" +"エンティティの自然キープロパティの比較には、 equals() と " +"hashCode() の実装を強くお勧めします。" + +#. Tag: para +#: basic_mapping.xml:3503 +#, no-c-format +msgid "" +"This mapping is not intended for use with entities that have natural primary " +"keys." +msgstr "" +"このマッピングは自然主キーを使ったエンティティでの使用を意図していません。" + +#. Tag: para +#: basic_mapping.xml:3508 +#, no-c-format +msgid "" +"mutable (optional - defaults to false): by default, natural identifier properties are assumed to be " +"immutable (constant)." +msgstr "" +"mutable (オプション、 デフォルトは false ): デフォルトでは、自然識別子プロパティは不変(定数)と想定されていま" +"す。" + +#. Tag: title +#: basic_mapping.xml:3516 +#, fuzzy, no-c-format +msgid "Any" +msgstr "any" + +#. Tag: para +#: basic_mapping.xml:3518 +#, fuzzy, no-c-format +msgid "" +"There is one more type of property mapping. The @Any " +"mapping defines a polymorphic association to classes from multiple tables. " +"This type of mapping requires more than one column. The first column " +"contains the type of the associated entity. The remaining columns contain " +"the identifier. It is impossible to specify a foreign key constraint for " +"this kind of association. This is not the usual way of mapping polymorphic " +"associations and you should use this only in special cases. For example, for " +"audit logs, user session data, etc." +msgstr "" +"プロパティマッピングにはさらにもう1つの型があります。 <any> マッピング要素は、複数のテーブルからクラスへのポリモーフィックな関連" +"を定義します。この型のマッピングには必ず複数のカラムが必要です。1番目のカラム" +"は関連エンティティの型を保持します。残りのカラムは識別子を保持します。この種" +"類の関連には外部キー制約を指定することはできません。そのためこれは最も使われ" +"ることのない(ポリモーフィックな)関連のマッピング方法です。非常に特別な場合" +"(例えば、検査ログやユーザーセッションデータなど)に限って、これを使うべきで" +"す。" + +#. Tag: para +#: basic_mapping.xml:3528 +#, fuzzy, no-c-format +msgid "" +"The @Any annotation describes the column holding the " +"metadata information. To link the value of the metadata information and an " +"actual entity type, The @AnyDef and " +"@AnyDefs annotations are used. The metaType attribute allows the application to specify a custom type that maps " +"database column values to persistent classes that have identifier properties " +"of the type specified by idType. You must specify the " +"mapping from values of the metaType to class names." +msgstr "" +"meta-type により、アプリケーションはカスタム型を指定できま" +"す。このカスタム型はデータベースカラムの値を、 id-type で" +"指定した型の識別子プロパティを持った永続クラスへマッピングします。 meta-type " +"の値からクラス名へのマッピングを指定しなければなりません。" + +#. Tag: programlisting +#: basic_mapping.xml:3538 +#, no-c-format +msgid "" +"@Any( metaColumn = @Column( name = \"property_type\" ), fetch=FetchType." +"EAGER )\n" +"@AnyMetaDef( \n" +" idType = \"integer\", \n" +" metaType = \"string\", \n" +" metaValues = {\n" +" @MetaValue( value = \"S\", targetEntity = StringProperty.class ),\n" +" @MetaValue( value = \"I\", targetEntity = IntegerProperty.class )\n" +" } )\n" +"@JoinColumn( name = \"property_id\" )\n" +"public Property getMainProperty() {\n" +" return mainProperty;\n" +"}" +msgstr "" + +#. Tag: para +#: basic_mapping.xml:3540 +#, no-c-format +msgid "" +"Note that @AnyDef can be mutualized and reused. It is " +"recommended to place it as a package metadata in this case." +msgstr "" + +#. Tag: programlisting +#: basic_mapping.xml:3544 +#, no-c-format +msgid "" +"//on a package\n" +"@AnyMetaDef( name=\"property\" \n" +" idType = \"integer\", \n" +" metaType = \"string\", \n" +" metaValues = {\n" +" @MetaValue( value = \"S\", targetEntity = StringProperty.class ),\n" +" @MetaValue( value = \"I\", targetEntity = IntegerProperty.class )\n" +" } )\n" +"package org.hibernate.test.annotations.any;\n" +"\n" +"\n" +"//in a class\n" +" @Any( metaDef=\"property\", metaColumn = @Column( name = \"property_type" +"\" ), fetch=FetchType.EAGER )\n" +" @JoinColumn( name = \"property_id\" )\n" +" public Property getMainProperty() {\n" +" return mainProperty;\n" +" }" +msgstr "" + +#. Tag: para +#: basic_mapping.xml:3546 +#, no-c-format +msgid "The hbm.xml equivalent is:" +msgstr "" + +#. Tag: programlisting +#: basic_mapping.xml:3548 +#, fuzzy, no-c-format +msgid "" +"<any name=\"being\" id-type=\"long\" meta-type=\"string\">\n" +" <meta-value value=\"TBL_ANIMAL\" class=\"Animal\"/>\n" +" <meta-value value=\"TBL_HUMAN\" class=\"Human\"/>\n" +" <meta-value value=\"TBL_ALIEN\" class=\"Alien\"/>\n" +" <column name=\"table_name\"/>\n" +" <column name=\"id\"/>\n" +"</any>" +msgstr "" +"<any name=\"being\" id-type=\"long\" meta-type=\"string\">\n" +" <meta-value value=\"TBL_ANIMAL\" class=\"Animal\"/>\n" +" <meta-value value=\"TBL_HUMAN\" class=\"Human\"/>\n" +" <meta-value value=\"TBL_ALIEN\" class=\"Alien\"/>\n" +" <column name=\"table_name\"/>\n" +" <column name=\"id\"/>\n" +"</any>" + +#. Tag: para +#: basic_mapping.xml:3551 +#, no-c-format +msgid "You cannot mutualize the metadata in hbm.xml as you can in annotations." +msgstr "" + +#. Tag: programlisting +#: basic_mapping.xml:3570 +#, fuzzy, no-c-format +msgid "" +"<any\n" +" name=\"propertyName\"\n" +" id-type=\"idtypename\"\n" +" meta-type=\"metatypename\"\n" +" cascade=\"cascade_style\"\n" +" access=\"field|property|ClassName\"\n" +" optimistic-lock=\"true|false\"\n" +">\n" +" <meta-value ... />\n" +" <meta-value ... />\n" +" .....\n" +" <column .... />\n" +" <column .... />\n" +" .....\n" +"</any>" +msgstr "" +"<any\n" +" name=\"propertyName\"\n" +" id-type=\"idtypename\"\n" +" meta-type=\"metatypename\"\n" +" cascade=\"cascade_style\"\n" +" access=\"field|property|ClassName\"\n" +" optimistic-lock=\"true|false\"\n" +">\n" +" <meta-value ... />\n" +" <meta-value ... />\n" +" .....\n" +" <column .... />\n" +" <column .... />\n" +" .....\n" +"</any>" + +#. Tag: para +#: basic_mapping.xml:3574 +#, no-c-format +msgid "name: the property name." +msgstr "name: プロパティ名。" + +#. Tag: para +#: basic_mapping.xml:3578 +#, no-c-format +msgid "id-type: the identifier type." +msgstr "id-type: 識別子の型。" + +#. Tag: para +#: basic_mapping.xml:3582 +#, no-c-format +msgid "" +"meta-type (optional - defaults to string): any type that is allowed for a discriminator mapping." +msgstr "" +"meta-type(オプション - デフォルトは string ): ディスクリミネータマッピングで許された型。" + +#. Tag: para +#: basic_mapping.xml:3588 +#, no-c-format +msgid "" +"cascade (optional- defaults to none): " +"the cascade style." +msgstr "" +"cascade(オプション - デフォルトは none ): カスケードのスタイル。" + +#. Tag: para +#: basic_mapping.xml:3599 +#, no-c-format +msgid "" +"optimistic-lock (optional - defaults to true): specifies that updates to this property either do or do not " +"require acquisition of the optimistic lock. It defines whether a version " +"increment should occur if this property is dirty." +msgstr "" +"optimistic-lock (オプション - デフォルトは true ): このプロパティの更新に楽観ロックの取得を要求するかどうかを指定し" +"ます。言い換えれば、このプロパティがダーティであるときにバージョンを増やすべ" +"きかを定義します。" + +#. Tag: title +#: basic_mapping.xml:3610 +#, no-c-format +msgid "Properties" +msgstr "プロパティ" + +#. Tag: para +#: basic_mapping.xml:3612 +#, no-c-format +msgid "" +"The <properties> element allows the definition of a " +"named, logical grouping of the properties of a class. The most important use " +"of the construct is that it allows a combination of properties to be the " +"target of a property-ref. It is also a convenient way to " +"define a multi-column unique constraint. For example:" +msgstr "" +"<properties> 要素はクラスのプロパティの指定された、" +"論理的なグルーピングを可能にします。この構造の最も重要な使用方法は、 " +"property-ref のターゲットになるプロパティの結合を許可する" +"ことです。それはまた、複数カラムのユニーク制約を定義する簡単な方法でもありま" +"す。" + +#. Tag: programlisting +#: basic_mapping.xml:3632 +#, fuzzy, no-c-format +msgid "" +"<properties\n" +" name=\"logicalName\"\n" +" insert=\"true|false\"\n" +" update=\"true|false\"\n" +" optimistic-lock=\"true|false\"\n" +" unique=\"true|false\"\n" +">\n" +"\n" +" <property ...../>\n" +" <many-to-one .... />\n" +" ........\n" +"</properties>" +msgstr "" +"<properties \n" +" name=\"logicalName\" \n" +" insert=\"true|false\"\n" +" update=\"true|false\"\n" +" optimistic-lock=\"true|false\"\n" +" unique=\"true|false\"\n" +">\n" +" \n" +" <property ...../>\n" +" <many-to-one .... />\n" +" ........\n" +"</properties>" + +#. Tag: para +#: basic_mapping.xml:3636 +#, no-c-format +msgid "" +"name: the logical name of the grouping. It is " +"not an actual property name." +msgstr "" +"name : グルーピングの論理名。実際のプロパティ名では " +"ありません 。" + +#. Tag: para +#: basic_mapping.xml:3651 +#, no-c-format +msgid "" +"optimistic-lock (optional - defaults to true): specifies that updates to these properties either do or do not " +"require acquisition of the optimistic lock. It determines if a version " +"increment should occur when these properties are dirty." +msgstr "" +"optimistic-lock (オプション - デフォルトは true ): これらのプロパティの更新に楽観的ロックの取得を要求するかどうかを" +"指定します。言い換えれば、このプロパティがダーティであるときにバージョンを増" +"やすべきかを決定します。" + +#. Tag: para +#: basic_mapping.xml:3666 +#, no-c-format +msgid "" +"For example, if we have the following <properties> " +"mapping:" +msgstr "" +"例えば、もし以下のような <properties> マッピングが" +"あった場合:" + +#. Tag: programlisting +#: basic_mapping.xml:3669 +#, fuzzy, no-c-format +msgid "" +"<class name=\"Person\">\n" +" <id name=\"personNumber\"/>\n" +"\n" +" ...\n" +" <properties name=\"name\"\n" +" unique=\"true\" update=\"false\">\n" +" <property name=\"firstName\"/>\n" +" <property name=\"initial\"/>\n" +" <property name=\"lastName\"/>\n" +" </properties>\n" +"</class>" +msgstr "" +"<class name=\"Person\">\n" +" <id name=\"personNumber\"/>\n" +" ...\n" +" <properties name=\"name\" \n" +" unique=\"true\" update=\"false\">\n" +" <property name=\"firstName\"/>\n" +" <property name=\"initial\"/>\n" +" <property name=\"lastName\"/>\n" +" </properties>\n" +"</class>" + +#. Tag: para +#: basic_mapping.xml:3671 +#, no-c-format +msgid "" +"You might have some legacy data association that refers to this unique key " +"of the Person table, instead of to the primary key:" +msgstr "" +"主キーの代わりに Person テーブルのユニークキーへの参照を持" +"つ、レガシーデータの関連を持つかもしれません。:" + +#. Tag: programlisting +#: basic_mapping.xml:3675 +#, fuzzy, no-c-format +msgid "" +"<many-to-one name=\"owner\"\n" +" class=\"Person\" property-ref=\"name\">\n" +" <column name=\"firstName\"/>\n" +" <column name=\"initial\"/>\n" +" <column name=\"lastName\"/>\n" +"</many-to-one>" +msgstr "" +"<many-to-one name=\"person\" \n" +" class=\"Person\" property-ref=\"name\">\n" +" <column name=\"firstName\"/>\n" +" <column name=\"initial\"/>\n" +" <column name=\"lastName\"/>\n" +"</many-to-one>" + +#. Tag: para +#: basic_mapping.xml:3678 +#, no-c-format +msgid "" +"When using annotations as a mapping strategy, such construct is not " +"necessary as the binding between a column and its related column on the " +"associated table is done directly" +msgstr "" + +#. Tag: para +#: basic_mapping.xml:3685 +#, no-c-format +msgid "" +"The use of this outside the context of mapping legacy data is not " +"recommended." +msgstr "" +"しかし、このようなレガシーデータマッピングのコンテキスト外への使用は推奨しま" +"せん。" + +#. Tag: title +#: basic_mapping.xml:3690 +#, no-c-format +msgid "Some hbm.xml specificities" +msgstr "" + +#. Tag: para +#: basic_mapping.xml:3692 +#, no-c-format +msgid "" +"The hbm.xml structure has some specificities naturally not present when " +"using annotations, let's describe them briefly." +msgstr "" + +#. Tag: title +#: basic_mapping.xml:3696 +#, no-c-format +msgid "Doctype" +msgstr "Doctype" + +#. Tag: para +#: basic_mapping.xml:3698 +#, no-c-format +msgid "" +"All XML mappings should declare the doctype shown. The actual DTD can be " +"found at the URL above, in the directory hibernate-x.x.x/src/org/" +"hibernate , or in hibernate3.jar. Hibernate " +"will always look for the DTD in its classpath first. If you experience " +"lookups of the DTD using an Internet connection, check the DTD declaration " +"against the contents of your classpath." +msgstr "" +"XML マッピングでは、お見せしたようなドキュメント型を必ず定義すべきです。実際" +"の DTD は、上記の URL の hibernate-x.x.x/src/org/hibernate ディレクトリ、または hibernate.jar 内にありま" +"す。 Hibernate は常に、そのクラスパス内で DTD を探し始めます。インターネット" +"にある DTD ファイルを探そうとしたなら、クラスパスの内容を見て、 DTD 宣言を確" +"認してください。" + +#. Tag: title +#: basic_mapping.xml:3707 +#, no-c-format +msgid "EntityResolver" +msgstr "エンティティリゾルバ" + +#. Tag: para +#: basic_mapping.xml:3709 +#, no-c-format +msgid "" +"Hibernate will first attempt to resolve DTDs in its classpath. It does this " +"is by registering a custom org.xml.sax.EntityResolver " +"implementation with the SAXReader it uses to read in the xml files. This " +"custom EntityResolver recognizes two different systemId " +"namespaces:" +msgstr "" +"前述したように、 Hibernate はまずクラスパス内で DTD を解決しようとします。 " +"org.xml.sax.EntityResolver のカスタム実装を XML ファイルを" +"読み込むための SAXReader に登録することによって、 DTD を解決します。このカス" +"タムの EntityResolver は2つの異なるシステム ID 名前空間を" +"認識します。" + +#. Tag: para +#: basic_mapping.xml:3718 +#, no-c-format +msgid "" +"a hibernate namespace is recognized whenever the resolver " +"encounters a systemId starting with http://hibernate.sourceforge." +"net/. The resolver attempts to resolve these entities via the " +"classloader which loaded the Hibernate classes." +msgstr "" +"hibernate namespace は、リゾルバが http://" +"hibernate.sourceforge.net/ で始まるシステム ID に到達したときに認識" +"されます。そしてリゾルバは、 Hibernate のクラスをロードしたクラスローダを用い" +"て、これらのエンティティを解決しようとします。" + +#. Tag: para +#: basic_mapping.xml:3726 +#, no-c-format +msgid "" +"a user namespace is recognized whenever the resolver " +"encounters a systemId using a classpath:// URL protocol. " +"The resolver will attempt to resolve these entities via (1) the current " +"thread context classloader and (2) the classloader which loaded the " +"Hibernate classes." +msgstr "" +"user namespace は、リゾルバが URL プロトコルの " +"classpath:// を使ったシステム ID に到達したときに、認識さ" +"れます。そしてリゾルバは、 (1) カレントスレッドのコンテキストクラスローダー、" +"または (2) Hibernate のクラスをロードしたクラスローダを使って、これらのエン" +"ティティを解決しようとします。" + +#. Tag: para +#: basic_mapping.xml:3735 +#, no-c-format +msgid "The following is an example of utilizing user namespacing:" +msgstr "下記は、ユーザー名前空間を使った例です:" + +#. Tag: programlisting +#: basic_mapping.xml:3738 +#, no-c-format +msgid "" +"" +msgstr "" + +#. Tag: para +#: basic_mapping.xml:3740 +#, fuzzy, no-c-format +msgid "" +"Where types.xml is a resource in the your." +"domain package and contains a custom typedef." +msgstr "" +"ここで types.xmlyour.domain パッ" +"ケージ内のリソースであり、カスタム型定義 を含みます。" + +#. Tag: title +#: basic_mapping.xml:3747 +#, fuzzy, no-c-format +msgid "Hibernate-mapping" +msgstr "hibernate-mapping" + +#. Tag: para +#: basic_mapping.xml:3749 +#, no-c-format +msgid "" +"This element has several optional attributes. The schema " +"and catalog attributes specify that tables referred to in " +"this mapping belong to the named schema and/or catalog. If they are " +"specified, tablenames will be qualified by the given schema and catalog " +"names. If they are missing, tablenames will be unqualified. The " +"default-cascade attribute specifies what cascade style " +"should be assumed for properties and collections that do not specify a " +"cascade attribute. By default, the auto-import attribute allows you to use unqualified class names in the query " +"language." +msgstr "" +"この要素にはいくつかオプション属性があります。 schema 属性" +"と catalog 属性は、このマッピングが参照するテーブルが、こ" +"の属性によって指定されたスキーマと(または)カタログに属することを指定します。" +"この属性が指定されると、テーブル名は与えられたスキーマ名とカタログ名で修飾さ" +"れます。これらの属性が指定されていなければ、テーブル名は修飾されません。 " +"default-cascade 属性は、 cascade 属性を" +"指定していないプロパティやコレクションに、どのカスケードスタイルを割り当てる" +"かを指定します。 auto-import 属性は、クエリ言語内で修飾さ" +"れていないクラス名を、デフォルトで使えるようにします。" + +#. Tag: programlisting +#: basic_mapping.xml:3778 +#, fuzzy, no-c-format +msgid "" +"<hibernate-mapping\n" +" schema=\"schemaName\"\n" +" catalog=\"catalogName\"\n" +" default-cascade=\"cascade_style\"\n" +" default-access=\"field|property|ClassName\"\n" +" default-lazy=\"true|false\"\n" +" auto-import=\"true|false\"\n" +" package=\"package.name\"\n" +" />" +msgstr "" +"<hibernate-mapping\n" +" schema=\"schemaName\"\n" +" catalog=\"catalogName\"\n" +" default-cascade=\"cascade_style\"\n" +" default-access=\"field|property|ClassName\"\n" +" default-lazy=\"true|false\"\n" +" auto-import=\"true|false\"\n" +" package=\"package.name\"\n" +" />" + +#. Tag: para +#: basic_mapping.xml:3782 +#, no-c-format +msgid "schema (optional): the name of a database schema." +msgstr "schema(オプション):データベーススキーマの名前。" + +#. Tag: para +#: basic_mapping.xml:3787 +#, no-c-format +msgid "catalog (optional): the name of a database catalog." +msgstr "" +"catalog (オプション):データベースカタログの名前。" + +#. Tag: para +#: basic_mapping.xml:3792 +#, no-c-format +msgid "" +"default-cascade (optional - defaults to none): a default cascade style." +msgstr "" +"default-cascade (オプション - デフォルトは " +"none): デフォルトのカスケードスタイル。" + +#. Tag: para +#: basic_mapping.xml:3797 +#, no-c-format +msgid "" +"default-access (optional - defaults to property): the strategy Hibernate should use for accessing all properties. " +"It can be a custom implementation of PropertyAccessor." +msgstr "" +"default-access (オプション - デフォルトは " +"property ): Hibernate がプロパティにアクセスする際に取る" +"べき戦略。 PropertyAccessor を実装することでカスタマイズ可" +"能。" + +#. Tag: para +#: basic_mapping.xml:3804 +#, no-c-format +msgid "" +"default-lazy (optional - defaults to true): the default value for unspecified lazy " +"attributes of class and collection mappings." +msgstr "" +"default-lazy (オプション - デフォルトは true ): lazy 属性が指定されていないクラスやコレクショ" +"ンマッピングに対するデフォルト値。" + +#. Tag: para +#: basic_mapping.xml:3811 +#, no-c-format +msgid "" +"auto-import (optional - defaults to true): specifies whether we can use unqualified class names of classes " +"in this mapping in the query language." +msgstr "" +"auto-import (オプション - デフォルトは true):クエリ言語内で、(このマッピング内のクラスの)修飾されていないク" +"ラス名を使えるかどうかを指定します。" + +#. Tag: para +#: basic_mapping.xml:3818 +#, no-c-format +msgid "" +"package (optional): specifies a package prefix to use for " +"unqualified class names in the mapping document." +msgstr "" +"package (オプション): マッピングドキュメント内で修飾されて" +"いないクラス名に対して割り当てる、パッケージの接頭辞 (prefix) を指定します。" + +#. Tag: para +#: basic_mapping.xml:3825 +#, no-c-format +msgid "" +"If you have two persistent classes with the same unqualified name, you " +"should set auto-import=\"false\". An exception will " +"result if you attempt to assign two classes to the same \"imported\" name." +msgstr "" +"(修飾されていない)同じ名前の永続クラスが2つあるなら、 auto-import=" +"\"false\" を設定すべきです。2つのクラスに\"インポートされた\"同じ名" +"前を割り当てようとすると、 Hibernate は例外を送出します。" + +#. Tag: para +#: basic_mapping.xml:3830 +#, no-c-format +msgid "" +"The hibernate-mapping element allows you to nest several " +"persistent <class> mappings, as shown above. It is, " +"however, good practice (and expected by some tools) to map only a single " +"persistent class, or a single class hierarchy, in one mapping file and name " +"it after the persistent superclass. For example, Cat.hbm.xml, Dog.hbm.xml, or if using inheritance, " +"Animal.hbm.xml." +msgstr "" +"hibernate-mapping 要素は、最初の例で示したようにいくつかの" +"永続 <class> マッピングをネストできます。しかし、1" +"つのマッピングファイルではただひとつの永続クラス(またはひとつのクラス階層)に" +"マッピングするようにし、さらに永続スーパークラスの後で指定するべきでしょう(い" +"くつかのツールはこのようなマッピングファイルを想定しています)。例えば次のよう" +"になります。: Cat.hbm.xml , Dog.hbm.xml , または継承を使うなら Animal.hbm.xml 。" + +#. Tag: title +#: basic_mapping.xml:3841 +#, fuzzy, no-c-format +msgid "Key" +msgstr "key" + +#. Tag: para +#: basic_mapping.xml:3843 +#, fuzzy, no-c-format +msgid "" +"The <key> element is featured a few times within " "this guide. It appears anywhere the parent mapping element defines a join to " "a new table that references the primary key of the original table. It also " "defines the foreign key in the joined table:" @@ -3041,7 +7981,30 @@ msgstr "" "しいテーブルへの結合を定義したり、結合テーブルで外部キーを定義したりする親要" "素のどこにでも現れ、オリジナルテーブルの主キーを参照します。" +#. Tag: programlisting +#: basic_mapping.xml:3864 +#, fuzzy, no-c-format +msgid "" +"<key\n" +" column=\"columnname\"\n" +" on-delete=\"noaction|cascade\"\n" +" property-ref=\"propertyName\"\n" +" not-null=\"true|false\"\n" +" update=\"true|false\"\n" +" unique=\"true|false\"\n" +"/>" +msgstr "" +"<key\n" +" column=\"columnname\"\n" +" on-delete=\"noaction|cascade\"\n" +" property-ref=\"propertyName\"\n" +" not-null=\"true|false\"\n" +" update=\"true|false\"\n" +" unique=\"true|false\"\n" +"/>" + #. Tag: para +#: basic_mapping.xml:3874 #, no-c-format msgid "" "on-delete (optional - defaults to noactionproperty-ref (optional): specifies that the foreign key " @@ -3064,6 +8028,7 @@ msgstr "" "す)。" #. Tag: para +#: basic_mapping.xml:3886 #, no-c-format msgid "" "not-null (optional): specifies that the foreign key " @@ -3075,6 +8040,7 @@ msgstr "" "ます)。" #. Tag: para +#: basic_mapping.xml:3892 #, no-c-format msgid "" "update (optional): specifies that the foreign key should " @@ -3086,6 +8052,7 @@ msgstr "" "す)。" #. Tag: para +#: basic_mapping.xml:3898 #, no-c-format msgid "" "unique (optional): specifies that the foreign key should " @@ -3097,6 +8064,7 @@ msgstr "" "ます)。" #. Tag: para +#: basic_mapping.xml:3905 #, no-c-format msgid "" "For systems where delete performance is important, we recommend that all " @@ -3114,6 +8082,7 @@ msgstr "" "るということに注意してください。" #. Tag: para +#: basic_mapping.xml:3913 #, no-c-format msgid "" "The not-null and update attributes are " @@ -3128,51 +8097,13 @@ msgstr "" "カラムを宣言 しなくてはなりません 。" #. Tag: title -#, no-c-format -msgid "Column and formula elements" -msgstr "column と formula 要素" - -#. Tag: para -#, no-c-format -msgid "" -"Mapping elements which accept a column attribute will " -"alternatively accept a <column> subelement. " -"Likewise, <formula> is an alternative to the " -"formula attribute. For example:" -msgstr "" -"column 属性を記述できる任意のマッピング要素はまた、 " -"<column> サブ要素も記述できます。同様に " -"<formula>formula 属性の代替手" -"段です。" - -#. Tag: para -#, no-c-format -msgid "" -"Most of the attributes on column provide a means of " -"tailoring the DDL during automatic schema generation. The read and write attributes allow you to specify custom " -"SQL that Hibernate will use to access the column's value. For more on this, " -"see the discussion of column " -"read and write expressions." -msgstr "" - -#. Tag: para -#, fuzzy, no-c-format -msgid "" -"The column and formula elements can " -"even be combined within the same property or association mapping to express, " -"for example, exotic join conditions." -msgstr "" -"同じプロパティや関連のマッピングの中で、 column と " -"formula 属性を組み合わせることができます。例えば、特殊な結" -"合条件などです。" - -#. Tag: title +#: basic_mapping.xml:3922 #, fuzzy, no-c-format msgid "Import" msgstr "import" #. Tag: para +#: basic_mapping.xml:3924 #, no-c-format msgid "" "If your application has two persistent classes with the same name, and you " @@ -3187,13 +8118,35 @@ msgstr "" "たものであると明示できます。明示的にマッピングされていないクラスやインター" "フェースでさえもインポートできます。" +#. Tag: programlisting +#: basic_mapping.xml:3930 +#, fuzzy, no-c-format +msgid "<import class=\"java.lang.Object\" rename=\"Universe\"/>" +msgstr "<import class=\"java.lang.Object\" rename=\"Universe\"/>" + +#. Tag: programlisting +#: basic_mapping.xml:3939 +#, fuzzy, no-c-format +msgid "" +"<import\n" +" class=\"ClassName\"\n" +" rename=\"ShortName\"\n" +"/>" +msgstr "" +"<import\n" +" class=\"ClassName\"\n" +" rename=\"ShortName\"\n" +"/>" + #. Tag: para +#: basic_mapping.xml:3943 #, no-c-format msgid "" "class: the fully qualified class name of any Java class." msgstr "class: Java クラスの完全修飾されたクラス名。" #. Tag: para +#: basic_mapping.xml:3948 #, no-c-format msgid "" "rename (optional - defaults to the unqualified class " @@ -3202,98 +8155,124 @@ msgstr "" "rename (オプション - デフォルトは修飾されていないクラス" "名): クエリ言語で使われる名前。" -#. Tag: title +#. Tag: para +#: basic_mapping.xml:3956 #, no-c-format -msgid "Any" +msgid "This feature is unique to hbm.xml and is not supported in annotations." msgstr "" -#. Tag: para -#, no-c-format -msgid "" -"There is one more type of property mapping. The <any> mapping element defines a polymorphic association to classes from " -"multiple tables. This type of mapping requires more than one column. The " -"first column contains the type of the associated entity. The remaining " -"columns contain the identifier. It is impossible to specify a foreign key " -"constraint for this kind of association. This is not the usual way of " -"mapping polymorphic associations and you should use this only in special " -"cases. For example, for audit logs, user session data, etc." -msgstr "" -"プロパティマッピングにはさらにもう1つの型があります。 <any> マッピング要素は、複数のテーブルからクラスへのポリモーフィックな関連" -"を定義します。この型のマッピングには必ず複数のカラムが必要です。1番目のカラム" -"は関連エンティティの型を保持します。残りのカラムは識別子を保持します。この種" -"類の関連には外部キー制約を指定することはできません。そのためこれは最も使われ" -"ることのない(ポリモーフィックな)関連のマッピング方法です。非常に特別な場合" -"(例えば、検査ログやユーザーセッションデータなど)に限って、これを使うべきで" -"す。" - -#. Tag: para -#, no-c-format -msgid "" -"The meta-type attribute allows the application to specify " -"a custom type that maps database column values to persistent classes that " -"have identifier properties of the type specified by id-type. You must specify the mapping from values of the meta-type to class " -"names." -msgstr "" -"meta-type により、アプリケーションはカスタム型を指定できま" -"す。このカスタム型はデータベースカラムの値を、 id-type で" -"指定した型の識別子プロパティを持った永続クラスへマッピングします。 meta-type " -"の値からクラス名へのマッピングを指定しなければなりません。" - -#. Tag: para -#, no-c-format -msgid "name: the property name." -msgstr "name: プロパティ名。" - -#. Tag: para -#, no-c-format -msgid "id-type: the identifier type." -msgstr "id-type: 識別子の型。" - -#. Tag: para -#, no-c-format -msgid "" -"meta-type (optional - defaults to string): any type that is allowed for a discriminator mapping." -msgstr "" -"meta-type(オプション - デフォルトは string ): ディスクリミネータマッピングで許された型。" - -#. Tag: para -#, no-c-format -msgid "" -"cascade (optional- defaults to none): " -"the cascade style." -msgstr "" -"cascade(オプション - デフォルトは none ): カスケードのスタイル。" - -#. Tag: para -#, no-c-format -msgid "" -"optimistic-lock (optional - defaults to true): specifies that updates to this property either do or do not " -"require acquisition of the optimistic lock. It defines whether a version " -"increment should occur if this property is dirty." -msgstr "" -"optimistic-lock (オプション - デフォルトは true ): このプロパティの更新に楽観ロックの取得を要求するかどうかを指定し" -"ます。言い換えれば、このプロパティがダーティであるときにバージョンを増やすべ" -"きかを定義します。" - #. Tag: title +#: basic_mapping.xml:3962 +#, no-c-format +msgid "Column and formula elements" +msgstr "column と formula 要素" + +#. Tag: para +#: basic_mapping.xml:3964 +#, no-c-format +msgid "" +"Mapping elements which accept a column attribute will " +"alternatively accept a <column> subelement. " +"Likewise, <formula> is an alternative to the " +"formula attribute. For example:" +msgstr "" +"column 属性を記述できる任意のマッピング要素はまた、 " +"<column> サブ要素も記述できます。同様に " +"<formula>formula 属性の代替手" +"段です。" + +#. Tag: programlisting +#: basic_mapping.xml:3970 +#, fuzzy, no-c-format +msgid "" +"<column\n" +" name=\"column_name\"\n" +" length=\"N\"\n" +" precision=\"N\"\n" +" scale=\"N\"\n" +" not-null=\"true|false\"\n" +" unique=\"true|false\"\n" +" unique-key=\"multicolumn_unique_key_name\"\n" +" index=\"index_name\"\n" +" sql-type=\"sql_type_name\"\n" +" check=\"SQL expression\"\n" +" default=\"SQL expression\"\n" +" read=\"SQL expression\"\n" +" write=\"SQL expression\"/>" +msgstr "" +"<column\n" +" name=\"column_name\"\n" +" length=\"N\"\n" +" precision=\"N\"\n" +" scale=\"N\"\n" +" not-null=\"true|false\"\n" +" unique=\"true|false\"\n" +" unique-key=\"multicolumn_unique_key_name\"\n" +" index=\"index_name\"\n" +" sql-type=\"sql_type_name\"\n" +" check=\"SQL expression\"\n" +" default=\"SQL expression\"/>" + +#. Tag: programlisting +#: basic_mapping.xml:3972 +#, fuzzy, no-c-format +msgid "<formula>SQL expression</formula>" +msgstr "<formula>SQL expression</formula>" + +#. Tag: para +#: basic_mapping.xml:3974 +#, no-c-format +msgid "" +"Most of the attributes on column provide a means of " +"tailoring the DDL during automatic schema generation. The read and write attributes allow you to specify custom " +"SQL that Hibernate will use to access the column's value. For more on this, " +"see the discussion of column " +"read and write expressions." +msgstr "" + +#. Tag: para +#: basic_mapping.xml:3982 +#, fuzzy, no-c-format +msgid "" +"The column and formula elements can " +"even be combined within the same property or association mapping to express, " +"for example, exotic join conditions." +msgstr "" +"同じプロパティや関連のマッピングの中で、 column と " +"formula 属性を組み合わせることができます。例えば、特殊な結" +"合条件などです。" + +#. Tag: programlisting +#: basic_mapping.xml:3986 +#, fuzzy, no-c-format +msgid "" +"<many-to-one name=\"homeAddress\" class=\"Address\"\n" +" insert=\"false\" update=\"false\">\n" +" <column name=\"person_id\" not-null=\"true\" length=\"10\"/>\n" +" <formula>'MAILING'</formula>\n" +"</many-to-one>" +msgstr "" +"<many-to-one name=\"homeAddress\" class=\"Address\"\n" +" insert=\"false\" update=\"false\">\n" +" <column name=\"person_id\" not-null=\"true\" length=\"10\"/>\n" +" <formula>'MAILING'</formula>\n" +"</many-to-one>" + +#. Tag: title +#: basic_mapping.xml:3992 #, no-c-format msgid "Hibernate types" msgstr "Hibernate の型" #. Tag: title +#: basic_mapping.xml:3995 #, no-c-format msgid "Entities and values" msgstr "エンティティと値" #. Tag: para +#: basic_mapping.xml:3997 #, no-c-format msgid "" "In relation to the persistence service, Java language-level objects are " @@ -3301,6 +8280,7 @@ msgid "" msgstr "" #. Tag: para +#: basic_mapping.xml:4000 #, no-c-format msgid "" "An entity exists independently of any other objects " @@ -3324,6 +8304,7 @@ msgstr "" "それらはバージョン付けすることもできます。" #. Tag: para +#: basic_mapping.xml:4010 #, no-c-format msgid "" "An entity's persistent state consists of references to other entities and " @@ -3346,6 +8327,7 @@ msgstr "" "エンティティやコレクションがこれを共有することはできません。" #. Tag: para +#: basic_mapping.xml:4020 #, no-c-format msgid "" "Until now, we have been using the term \"persistent class\" to refer to " @@ -3372,11 +8354,13 @@ msgstr "" "に対する良いヒントになります。一方合成集約や集約は、通常値型へ変換されます。" #. Tag: para +#: basic_mapping.xml:4033 #, no-c-format msgid "We will revisit both concepts throughout this reference guide." msgstr "本ドキュメントを通して、何度もこの概念を取り上げます。" #. Tag: para +#: basic_mapping.xml:4036 #, no-c-format msgid "" "The challenge is to map the Java type system, and the developers' definition " @@ -3401,6 +8385,7 @@ msgstr "" "身のマッピング型を記述し、同様にカスタムの変換戦略を実装することができます。" #. Tag: para +#: basic_mapping.xml:4049 #, no-c-format msgid "" "With the exception of collections, all built-in Hibernate types support null " @@ -3410,11 +8395,13 @@ msgstr "" "ポートします。" #. Tag: title +#: basic_mapping.xml:4054 #, no-c-format msgid "Basic value types" msgstr "基本的な型" #. Tag: para +#: basic_mapping.xml:4056 #, no-c-format msgid "" "The built-in basic mapping types can be roughly " @@ -3423,16 +8410,18 @@ msgstr "" "組み込みの 基本的なマッピング型 は大まかに以下のように分" "けられます。" -#. Tag: term -#, no-c-format +#. Tag: literal +#: basic_mapping.xml:4059 +#, fuzzy, no-c-format msgid "" -"integer, long, short, float, double, character, byte, boolean, " -"yes_no, true_false" +"integer, long, short, float, double, character, byte, boolean, yes_no, " +"true_false" msgstr "" "integer, long, short, float, double, character, byte, boolean, " "yes_no, true_false" #. Tag: para +#: basic_mapping.xml:4063 #, no-c-format msgid "" "Type mappings from Java primitives or wrapper classes to appropriate (vendor-" @@ -3445,12 +8434,14 @@ msgstr "" "true_false は、すべて Java の boolean " "または java.lang.Boolean の代替エンコードです。" -#. Tag: term -#, fuzzy, no-c-format -msgid "string" -msgstr "sequence-identity" +#. Tag: literal +#: basic_mapping.xml:4073 +#, no-c-format +msgid "string" +msgstr "string" #. Tag: para +#: basic_mapping.xml:4076 #, no-c-format msgid "" "A type mapping from java.lang.String to VARCHARjava.lang.String から VARCHAR (または " "Oracle の VARCHAR2 )への型マッピング。" -#. Tag: term -#, no-c-format -msgid "date, time, timestamp" +#. Tag: literal +#: basic_mapping.xml:4083 +#, fuzzy, no-c-format +msgid "date, time, timestamp" msgstr "date, time, timestamp" #. Tag: para +#: basic_mapping.xml:4086 #, no-c-format msgid "" "Type mappings from java.util.Date and its subclasses to " @@ -3475,12 +8468,14 @@ msgstr "" "DATETIMETIMESTAMP (またはそれらと等価なもの) への型マッピング。" -#. Tag: term -#, no-c-format -msgid "calendar, calendar_date" +#. Tag: literal +#: basic_mapping.xml:4094 +#, fuzzy, no-c-format +msgid "calendar, calendar_date" msgstr "calendar, calendar_date" #. Tag: para +#: basic_mapping.xml:4097 #, no-c-format msgid "" "Type mappings from java.util.Calendar to SQL types " @@ -3490,12 +8485,14 @@ msgstr "" "literal> 、 DATE (またはそれらと等価なもの)への型マッピン" "グ。" -#. Tag: term -#, no-c-format -msgid "big_decimal, big_integer" +#. Tag: literal +#: basic_mapping.xml:4104 +#, fuzzy, no-c-format +msgid "big_decimal, big_integer" msgstr "big_decimal, big_integer" #. Tag: para +#: basic_mapping.xml:4107 #, no-c-format msgid "" "Type mappings from java.math.BigDecimal and java." @@ -3506,12 +8503,14 @@ msgstr "" "literal> から NUMERIC(または Oracle の NUMBER )への型マッピング。" -#. Tag: term -#, no-c-format -msgid "locale, timezone, currency" +#. Tag: literal +#: basic_mapping.xml:4115 +#, fuzzy, no-c-format +msgid "locale, timezone, currency" msgstr "locale, timezone, currency" #. Tag: para +#: basic_mapping.xml:4118 #, no-c-format msgid "" "Type mappings from java.util.Locale, java.util." @@ -3528,12 +8527,14 @@ msgstr "" "れらの ISO コードにマッピングされます。 TimeZone のインス" "タンスは、それらの ID にマッピングされます。" -#. Tag: term +#. Tag: literal +#: basic_mapping.xml:4131 #, fuzzy, no-c-format -msgid "class" -msgstr "sequence-identity" +msgid "class" +msgstr "subclass" #. Tag: para +#: basic_mapping.xml:4134 #, no-c-format msgid "" "A type mapping from java.lang.Class to VARCHARVARCHAR2 )への型マッピング。 Class はその完全修飾された名前にマッピングされます。" -#. Tag: term -#, fuzzy, no-c-format -msgid "binary" -msgstr "sequence-identity" +#. Tag: literal +#: basic_mapping.xml:4142 +#, no-c-format +msgid "binary" +msgstr "binary" #. Tag: para +#: basic_mapping.xml:4145 #, no-c-format msgid "Maps byte arrays to an appropriate SQL binary type." msgstr "バイト配列は、適切な SQL のバイナリ型にマッピングされます。" -#. Tag: term -#, fuzzy, no-c-format -msgid "text" -msgstr "sequence-identity" +#. Tag: literal +#: basic_mapping.xml:4150 +#, no-c-format +msgid "text" +msgstr "text" #. Tag: para +#: basic_mapping.xml:4153 #, no-c-format msgid "" "Maps long Java strings to a SQL CLOB or TEXTCLOB または TEXT 型にマッピングされます。" -#. Tag: term -#, fuzzy, no-c-format -msgid "serializable" -msgstr "sequence-identity" +#. Tag: literal +#: basic_mapping.xml:4159 +#, no-c-format +msgid "serializable" +msgstr "serializable" #. Tag: para +#: basic_mapping.xml:4162 #, no-c-format msgid "" "Maps serializable Java types to an appropriate SQL binary type. You can also " @@ -3585,12 +8592,14 @@ msgstr "" "前を指定することで、 Hibernate の型を serializable とする" "こともできます。" -#. Tag: term -#, fuzzy, no-c-format -msgid "clob, blob" -msgstr "calendar, calendar_date" +#. Tag: literal +#: basic_mapping.xml:4171 +#, no-c-format +msgid "clob, blob" +msgstr "clob, blob" #. Tag: para +#: basic_mapping.xml:4174 #, no-c-format msgid "" "Type mappings for the JDBC classes java.sql.Clob and " @@ -3603,16 +8612,18 @@ msgstr "" "外では再利用できないため、アプリケーションによっては不便かもしれません。(さ" "らにはドライバサポートが一貫していません。)" -#. Tag: term -#, no-c-format +#. Tag: literal +#: basic_mapping.xml:4184 +#, fuzzy, no-c-format msgid "" -"imm_date, imm_time, imm_timestamp, imm_calendar, imm_calendar_date, " -"imm_serializable, imm_binary" +"imm_date, imm_time, imm_timestamp, imm_calendar, imm_calendar_date, " +"imm_serializable, imm_binary" msgstr "" "imm_date, imm_time, imm_timestamp, imm_calendar, imm_calendar_date, " "imm_serializable, imm_binary" #. Tag: para +#: basic_mapping.xml:4188 #, no-c-format msgid "" "Type mappings for what are considered mutable Java types. This is where " @@ -3632,6 +8643,7 @@ msgstr "" "ん。" #. Tag: para +#: basic_mapping.xml:4200 #, no-c-format msgid "" "Unique identifiers of entities and collections can be of any basic type " @@ -3644,6 +8656,7 @@ msgstr "" "基本型でも構いません。(複合識別子でも構いません。以下を見てください。)" #. Tag: para +#: basic_mapping.xml:4205 #, no-c-format msgid "" "The basic value types have corresponding Type constants " @@ -3656,11 +8669,13 @@ msgstr "" "STRINGstring 型を表現しています。" #. Tag: title +#: basic_mapping.xml:4212 #, no-c-format msgid "Custom value types" msgstr "カスタム型" #. Tag: para +#: basic_mapping.xml:4214 #, no-c-format msgid "" "It is relatively easy for developers to create their own value types. For " @@ -3684,6 +8699,7 @@ msgstr "" "す。" #. Tag: para +#: basic_mapping.xml:4225 #, no-c-format msgid "" "To implement a custom type, implement either org.hibernate." @@ -3698,7 +8714,24 @@ msgstr "" "は、 org.hibernate.test.DoubleStringType を確認してくださ" "い。" +#. Tag: programlisting +#: basic_mapping.xml:4232 +#, fuzzy, no-c-format +msgid "" +"<property name=\"twoStrings\" type=\"org.hibernate.test.DoubleStringType" +"\">\n" +" <column name=\"first_string\"/>\n" +" <column name=\"second_string\"/>\n" +"</property>" +msgstr "" +"<property name=\"twoStrings\" type=\"org.hibernate.test.DoubleStringType" +"\">\n" +" <column name=\"first_string\"/>\n" +" <column name=\"second_string\"/>\n" +"</property>" + #. Tag: para +#: basic_mapping.xml:4234 #, no-c-format msgid "" "Notice the use of <column> tags to map a property " @@ -3708,6 +8741,7 @@ msgstr "" "グできることに注目してください。" #. Tag: para +#: basic_mapping.xml:4237 #, no-c-format msgid "" "The CompositeUserType, EnhancedUserTypeUserType in the " @@ -3735,7 +8770,24 @@ msgstr "" "ラメータを提供するために、マッピングファイル内で <type> 要素を使用できます。" +#. Tag: programlisting +#: basic_mapping.xml:4250 +#, fuzzy, no-c-format +msgid "" +"<property name=\"priority\">\n" +" <type name=\"com.mycompany.usertypes.DefaultValueIntegerType\">\n" +" <param name=\"default\">0</param>\n" +" </type>\n" +"</property>" +msgstr "" +"<property name=\"priority\">\n" +" <type name=\"com.mycompany.usertypes.DefaultValueIntegerType\">\n" +" <param name=\"default\">0</param>\n" +" </type>\n" +"</property>" + #. Tag: para +#: basic_mapping.xml:4252 #, no-c-format msgid "" "The UserType can now retrieve the value for the parameter " @@ -3747,6 +8799,7 @@ msgstr "" "対する値を検索することができます。" #. Tag: para +#: basic_mapping.xml:4256 #, no-c-format msgid "" "If you regularly use a certain UserType, it is useful to " @@ -3760,7 +8813,28 @@ msgstr "" "うなことが行えます。 Typedefs はカスタム型に名前を割り当てます。その型がパラ" "メータを持つならば、パラメータのデフォルト値のリストを含むこともできます。" +#. Tag: programlisting +#: basic_mapping.xml:4262 +#, fuzzy, no-c-format +msgid "" +"<typedef class=\"com.mycompany.usertypes.DefaultValueIntegerType\" name=" +"\"default_zero\">\n" +" <param name=\"default\">0</param>\n" +"</typedef>" +msgstr "" +"<typedef class=\"com.mycompany.usertypes.DefaultValueIntegerType\" name=" +"\"default_zero\">\n" +" <param name=\"default\">0</param>\n" +"</typedef>" + +#. Tag: programlisting +#: basic_mapping.xml:4264 +#, fuzzy, no-c-format +msgid "<property name=\"priority\" type=\"default_zero\"/>" +msgstr "<property name=\"priority\" type=\"default_zero\"/>" + #. Tag: para +#: basic_mapping.xml:4266 #, no-c-format msgid "" "It is also possible to override the parameters supplied in a typedef on a " @@ -3770,6 +8844,7 @@ msgstr "" "メータをその都度オーバーライドすることが可能です。" #. Tag: para +#: basic_mapping.xml:4270 #, fuzzy, no-c-format msgid "" "Even though Hibernate's rich range of built-in types and support for " @@ -3791,11 +8866,13 @@ msgstr "" "ピングドキュメントは起こりうる変化に対応できます。" #. Tag: title +#: basic_mapping.xml:4283 #, no-c-format msgid "Mapping a class more than once" msgstr "1つのクラスに1つ以上のマッピング" #. Tag: para +#: basic_mapping.xml:4285 #, no-c-format msgid "" "It is possible to provide more than one mapping for a particular persistent " @@ -3812,7 +8889,48 @@ msgstr "" "クエリを書き込むとき、指定されたエンティティへの関連をマッピングするときに、" "エンティティ名を指定しなければなりません。" +#. Tag: programlisting +#: basic_mapping.xml:4293 +#, fuzzy, no-c-format +msgid "" +"<class name=\"Contract\" table=\"Contracts\"\n" +" entity-name=\"CurrentContract\">\n" +" ...\n" +" <set name=\"history\" inverse=\"true\"\n" +" order-by=\"effectiveEndDate desc\">\n" +" <key column=\"currentContractId\"/>\n" +" <one-to-many entity-name=\"HistoricalContract\"/>\n" +" </set>\n" +"</class>\n" +"\n" +"<class name=\"Contract\" table=\"ContractHistory\"\n" +" entity-name=\"HistoricalContract\">\n" +" ...\n" +" <many-to-one name=\"currentContract\"\n" +" column=\"currentContractId\"\n" +" entity-name=\"CurrentContract\"/>\n" +"</class>" +msgstr "" +"<class name=\"Contract\" table=\"Contracts\" \n" +" entity-name=\"CurrentContract\">\n" +" ...\n" +" <set name=\"history\" inverse=\"true\" \n" +" order-by=\"effectiveEndDate desc\">\n" +" <key column=\"currentContractId\"/>\n" +" <one-to-many entity-name=\"HistoricalContract\"/>\n" +" </set>\n" +"</class>\n" +"\n" +"<class name=\"Contract\" table=\"ContractHistory\" \n" +" entity-name=\"HistoricalContract\">\n" +" ...\n" +" <many-to-one name=\"currentContract\" \n" +" column=\"currentContractId\" \n" +" entity-name=\"CurrentContract\"/>\n" +"</class>" + #. Tag: para +#: basic_mapping.xml:4295 #, no-c-format msgid "" "Associations are now specified using entity-name instead " @@ -3821,12 +8939,20 @@ msgstr "" "関連が class の代わりに entity-name を" "使って、どのように指定されるのかに注目してください。" +#. Tag: para +#: basic_mapping.xml:4299 basic_mapping.xml:4379 basic_mapping.xml:4414 +#, no-c-format +msgid "This feature is not supported in Annotations" +msgstr "" + #. Tag: title +#: basic_mapping.xml:4304 #, no-c-format msgid "SQL quoted identifiers" msgstr "バッククォートで囲んだ SQL 識別子" #. Tag: para +#: basic_mapping.xml:4306 #, no-c-format msgid "" "You can force Hibernate to quote an identifier in the generated SQL by " @@ -3841,99 +8967,38 @@ msgstr "" "(普通はダブルクォートですが、 SQL Server ではかぎ括弧、 MySQL ではバック" "クォートです)。" -#. Tag: title -#, no-c-format -msgid "Metadata alternatives" -msgstr "メタデータの代替手段" - -#. Tag: para -#, no-c-format +#. Tag: programlisting +#: basic_mapping.xml:4312 +#, fuzzy, no-c-format msgid "" -"XML does not suit all users so there are some alternative ways to define O/R " -"mapping metadata in Hibernate." +"@Entity @Table(name=\"`Line Item`\")\n" +"class LineItem {\n" +" @id @Column(name=\"`Item Id`\") Integer id;\n" +" @Column(name=\"`Item #`\") int itemNumber\n" +"}\n" +"\n" +"<class name=\"LineItem\" table=\"`Line Item`\">\n" +" <id name=\"id\" column=\"`Item Id`\"/><generator class=" +"\"assigned\"/></id>\n" +" <property name=\"itemNumber\" column=\"`Item #`\"/>\n" +" ...\n" +"</class>" msgstr "" -"XML の記述以外に、 Hibernate では O/R マッピングのメタデータを定義する代替方" -"法があります。" - -#. Tag: title -#, no-c-format -msgid "Using XDoclet markup" -msgstr "XDoclet マークアップの使用" - -#. Tag: para -#, no-c-format -msgid "" -"Many Hibernate users prefer to embed mapping information directly in " -"sourcecode using XDoclet @hibernate.tags. We do not cover " -"this approach in this reference guide since it is considered part of " -"XDoclet. However, we include the following example of the Cat class with XDoclet mappings:" -msgstr "" -"多くの Hibernate ユーザーは XDoclet の @hibernate.tags を" -"使って、ソースコード内に直接マッピング情報を埋め込むことを好みます。これは厳" -"密に言えば XDoclet の分野なので、本ドキュメントではこの方法を対象とはしませ" -"ん。しかし XDoclet を使った以下の Cat マッピングの例を示し" -"ます。" - -#. Tag: para -#, no-c-format -msgid "See the Hibernate website for more examples of XDoclet and Hibernate." -msgstr "" -"Hibernate のウェブサイトには、 XDoclet と Hibernate に関するサンプルが多数あ" -"ります。" - -#. Tag: title -#, no-c-format -msgid "Using JDK 5.0 Annotations" -msgstr "JDK 5.0 アノテーションの使用" - -#. Tag: para -#, no-c-format -msgid "" -"JDK 5.0 introduced XDoclet-style annotations at the language level that are " -"type-safe and checked at compile time. This mechanism is more powerful than " -"XDoclet annotations and better supported by tools and IDEs. IntelliJ IDEA, " -"for example, supports auto-completion and syntax highlighting of JDK 5.0 " -"annotations. The new revision of the EJB specification (JSR-220) uses JDK " -"5.0 annotations as the primary metadata mechanism for entity beans. " -"Hibernate3 implements the EntityManager of JSR-220 (the " -"persistence API). Support for mapping metadata is available via the " -"Hibernate Annotations package as a separate download. " -"Both EJB3 (JSR-220) and Hibernate3 metadata is supported." -msgstr "" -"JDK5.0 ではタイプセーフかつコンパイル時にチェックできる、言語レベルの " -"XDoclet スタイルのアノテーションを導入しました。このメカニズムは XDoclet のア" -"ノテーションよりも強力で、ツールや IDE も多くがサポートしています。例えば " -"IntelliJ IDEA は、 JDK5.0 にアノテーションの自動補完と構文の強調表示をサポー" -"トしています。 EJB 仕様 (JSR-220) の新しいバージョンでは、エンティティ Bean " -"に対する主要なメタデータメカニズムとして JDK5.0 のアノテーションを使用してい" -"ます。 Hibernate3 では JSR-220 (永続化 API) の EntityManager を実装し、メタデータマッピングに対するサポートは、別ダウンロードの " -"Hibernate Annotations パッケージにより利用可能です。これ" -"は EJB3 (JSR-220) と Hibernate3 のメタデータをどちらもサポートしています。" - -#. Tag: para -#, no-c-format -msgid "This is an example of a POJO class annotated as an EJB entity bean:" -msgstr "以下は EJB のエンティティ Bean として注釈された POJO クラスの例です:" - -#. Tag: para -#, no-c-format -msgid "" -"Support for JDK 5.0 Annotations (and JSR-220) is currently under " -"development. Please refer to the Hibernate Annotations module for more " -"details." -msgstr "" -"JDK5.0 のアノテーション (と JSR-220) のサポートは進行中の作業であり、完全では" -"ないことに注意してください。さらに詳しい情報は Hibernate のアノテーションモ" -"ジュールを参照してください。" +"<class name=\"LineItem\" table=\"`Line Item`\">\n" +" <id name=\"id\" column=\"`Item Id`\"/><generator class=" +"\"assigned\"/></id>\n" +" <property name=\"itemNumber\" column=\"`Item #`\"/>\n" +" ...\n" +"</class>" #. Tag: title +#: basic_mapping.xml:4316 #, no-c-format msgid "Generated properties" msgstr "生成プロパティ" #. Tag: para +#: basic_mapping.xml:4318 #, no-c-format msgid "" "Generated properties are properties that have their values generated by the " @@ -3953,6 +9018,7 @@ msgstr "" "ぐに、生成された値を読み込むための SELECT SQL が発行されます。" #. Tag: para +#: basic_mapping.xml:4327 #, fuzzy, no-c-format msgid "" "Properties marked as generated must additionally be non-insertable and non-" @@ -3967,6 +9033,7 @@ msgstr "" "declaration-property\"/> 簡単なプロパティだけが生成されたとマークできます。" #. Tag: para +#: basic_mapping.xml:4334 #, no-c-format msgid "" "never (the default): the given property value is not " @@ -3976,6 +9043,7 @@ msgstr "" "ベースから生成されないことを意味します。" #. Tag: para +#: basic_mapping.xml:4337 #, fuzzy, no-c-format msgid "" "insert: the given property value is generated on insert, " @@ -3993,6 +9061,7 @@ msgstr "" "意してください。" #. Tag: para +#: basic_mapping.xml:4344 #, no-c-format msgid "" "always: the property value is generated both on insert " @@ -4001,24 +9070,43 @@ msgstr "" "always - 挿入時も更新時もプロパティの値が生成されることを" "示します。" +#. Tag: para +#: basic_mapping.xml:4347 +#, no-c-format +msgid "To mark a property as generated, use @Generated." +msgstr "" + #. Tag: title +#: basic_mapping.xml:4352 #, no-c-format msgid "Column read and write expressions" msgstr "" #. Tag: para +#: basic_mapping.xml:4354 #, no-c-format msgid "" "Hibernate allows you to customize the SQL it uses to read and write the " "values of columns mapped to simple properties. For example, if your database provides a set of " "data encryption functions, you can invoke them for individual columns like " -"this: <property name=\"creditCardNumber" -"\"> <column name=\"credit_card_num\" read=\"decrypt(credit_card_num)\" " -"write=\"encrypt(?)\"/> </property>" +"this:" +msgstr "" + +#. Tag: programlisting +#: basic_mapping.xml:4359 +#, no-c-format +msgid "" +"<property name=\"creditCardNumber\">\n" +" <column \n" +" name=\"credit_card_num\"\n" +" read=\"decrypt(credit_card_num)\"\n" +" write=\"encrypt(?)\"/>\n" +"</property>" msgstr "" #. Tag: para +#: basic_mapping.xml:4361 #, no-c-format msgid "" "Hibernate applies the custom expressions automatically whenever the property " @@ -4027,6 +9115,7 @@ msgid "" msgstr "" #. Tag: para +#: basic_mapping.xml:4366 #, no-c-format msgid "" "The property is backed by one or more columns that are exported as part of " @@ -4034,11 +9123,13 @@ msgid "" msgstr "" #. Tag: para +#: basic_mapping.xml:4371 #, no-c-format msgid "The property is read-write, not read-only." msgstr "" #. Tag: para +#: basic_mapping.xml:4375 #, no-c-format msgid "" "The write expression, if specified, must contain exactly " @@ -4046,11 +9137,13 @@ msgid "" msgstr "" #. Tag: title +#: basic_mapping.xml:4384 #, no-c-format msgid "Auxiliary database objects" msgstr "補助的なデータベースオブジェクト" #. Tag: para +#: basic_mapping.xml:4386 #, no-c-format msgid "" "Auxiliary database objects allow for the CREATE and DROP of arbitrary " @@ -4072,6 +9165,7 @@ msgstr "" "の、2つの基本的な方法があります。" #. Tag: para +#: basic_mapping.xml:4396 #, no-c-format msgid "" "The first mode is to explicitly list the CREATE and DROP commands in the " @@ -4080,7 +9174,28 @@ msgstr "" "1つ目の方法は、 CREATE と DROP コマンドをマッピングファイルの外に、明示的に記" "載することです:" +#. Tag: programlisting +#: basic_mapping.xml:4399 +#, fuzzy, no-c-format +msgid "" +"<hibernate-mapping>\n" +" ...\n" +" <database-object>\n" +" <create>CREATE TRIGGER my_trigger ...</create>\n" +" <drop>DROP TRIGGER my_trigger</drop>\n" +" </database-object>\n" +"</hibernate-mapping>" +msgstr "" +"<hibernate-mapping>\n" +" ...\n" +" <database-object>\n" +" <create>CREATE TRIGGER my_trigger ...</create>\n" +" <drop>DROP TRIGGER my_trigger</drop>\n" +" </database-object>\n" +"</hibernate-mapping>" + #. Tag: para +#: basic_mapping.xml:4401 #, no-c-format msgid "" "The second mode is to supply a custom class that constructs the CREATE and " @@ -4091,7 +9206,26 @@ msgstr "" "を提供することです。このカスタムクラスは org.hibernate.mapping." "AuxiliaryDatabaseObject インタフェースを実装しなければなりません。" +#. Tag: programlisting +#: basic_mapping.xml:4406 +#, fuzzy, no-c-format +msgid "" +"<hibernate-mapping>\n" +" ...\n" +" <database-object>\n" +" <definition class=\"MyTriggerDefinition\"/>\n" +" </database-object>\n" +"</hibernate-mapping>" +msgstr "" +"<hibernate-mapping>\n" +" ...\n" +" <database-object>\n" +" <definition class=\"MyTriggerDefinition\"/>\n" +" </database-object>\n" +"</hibernate-mapping>" + #. Tag: para +#: basic_mapping.xml:4408 #, no-c-format msgid "" "Additionally, these database objects can be optionally scoped so that they " @@ -4100,139 +9234,410 @@ msgstr "" "さらに、あるデータベース方言が使用される時にだけ適用するといったように、デー" "タベースオブジェクトが使われるケースを限定できます。" +#. Tag: programlisting +#: basic_mapping.xml:4411 +#, fuzzy, no-c-format +msgid "" +"<hibernate-mapping>\n" +" ...\n" +" <database-object>\n" +" <definition class=\"MyTriggerDefinition\"/>\n" +" <dialect-scope name=\"org.hibernate.dialect.Oracle9iDialect\"/" +">\n" +" <dialect-scope name=\"org.hibernate.dialect.Oracle10gDialect\"/" +">\n" +" </database-object>\n" +"</hibernate-mapping>" +msgstr "" +"<hibernate-mapping>\n" +" ...\n" +" <database-object>\n" +" <definition class=\"MyTriggerDefinition\"/>\n" +" <dialect-scope name=\"org.hibernate.dialect.Oracle9Dialect\"/" +">\n" +" <dialect-scope name=\"org.hibernate.dialect.OracleDialect\"/>\n" +" </database-object>\n" +"</hibernate-mapping>" + +#~ msgid "Class" +#~ msgstr "Class" + +#~ msgid "" +#~ "Use of select-before-update will usually decrease " +#~ "performance. It is useful to prevent a database update trigger being " +#~ "called unnecessarily if you reattach a graph of detached instances to a " +#~ "Session." +#~ msgstr "" +#~ "select-before-update の使用は通常パフォーマンスを落とし" +#~ "ます。もし Session へ分離インスタンスのグラフを再追加す" +#~ "るなら、データベース更新のトリガを不必要に呼び出すのを避けるという点で、非" +#~ "常に有用です。" + +#, fuzzy +#~ msgid "id" +#~ msgstr "uuid" + +#~ msgid "Generator" +#~ msgstr "ジェネレータ" + +#, fuzzy +#~ msgid "increment" +#~ msgstr "sequence-identity" + +#, fuzzy +#~ msgid "identity" +#~ msgstr "sequence-identity" + +#, fuzzy +#~ msgid "sequence" +#~ msgstr "sequence-identity" + +#, fuzzy +#~ msgid "seqhilo" +#~ msgstr "sequence-identity" + +#, fuzzy +#~ msgid "uuid" +#~ msgstr "sequence-identity" + +#~ msgid "" +#~ "uses a 128-bit UUID algorithm to generate identifiers of type string that " +#~ "are unique within a network (the IP address is used). The UUID is encoded " +#~ "as a string of 32 hexadecimal digits in length." +#~ msgstr "" +#~ "( IP アドレスが使用される)ネットワーク内でユニークな文字列型の識別子を生成" +#~ "するために、 128 ビットの UUID アルゴリズムを使用します。 UUID は長さ 32 " +#~ "の 16 進数字の文字列としてエンコードされます。" + +#, fuzzy +#~ msgid "guid" +#~ msgstr "sequence-identity" + +#, fuzzy +#~ msgid "native" +#~ msgstr "sequence-identity" + +#, fuzzy +#~ msgid "select" +#~ msgstr "sequence-identity" + +#, fuzzy +#~ msgid "foreign" +#~ msgstr "sequence-identity" + #, fuzzy #~ msgid "" -#~ "\n" -#~ "\n" -#~ "\n" -#~ "\n" -#~ "\n" -#~ " \n" -#~ "\n" -#~ " \n" -#~ " \n" -#~ " \n" -#~ "\n" -#~ " \n" -#~ "\n" -#~ " \n" -#~ "\n" -#~ " \n" -#~ "\n" -#~ " \n" -#~ "\n" -#~ " \n" -#~ "\n" -#~ " \n" -#~ "\n" -#~ " \n" -#~ "\n" -#~ " \n" -#~ " \n" -#~ " \n" -#~ " \n" -#~ "\n" -#~ " \n" -#~ "\n" -#~ " \n" -#~ "\n" -#~ " \n" -#~ "\n" -#~ " \n" -#~ "\n" -#~ " \n" -#~ " \n" -#~ " \n" -#~ "\n" -#~ "]]>" +#~ "optimizer (optional - defaults to none): See " #~ msgstr "" -#~ "<?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 name=\"Cat\" \n" -#~ " table=\"cats\"\n" -#~ " discriminator-value=\"C\">\n" -#~ " \n" -#~ " <id name=\"id\">\n" -#~ " <generator class=\"native\"/>\n" -#~ " </id>\n" -#~ "\n" -#~ " <discriminator column=\"subclass\" \n" -#~ " type=\"character\"/>\n" -#~ "\n" -#~ " <property name=\"weight\"/>\n" -#~ "\n" -#~ " <property name=\"birthdate\"\n" -#~ " type=\"date\" \n" -#~ " not-null=\"true\" \n" -#~ " update=\"false\"/>\n" -#~ "\n" -#~ " <property name=\"color\"\n" -#~ " type=\"eg.types.ColorUserType\"\n" -#~ " not-null=\"true\"\n" -#~ " update=\"false\"/>\n" -#~ "\n" -#~ " <property name=\"sex\"\n" -#~ " not-null=\"true\" \n" -#~ " update=\"false\"/>\n" -#~ "\n" -#~ " <property name=\"litterId\"\n" -#~ " column=\"litterId\"\n" -#~ " update=\"false\"/>\n" -#~ "\n" -#~ " <many-to-one name=\"mother\"\n" -#~ " column=\"mother_id\"\n" -#~ " update=\"false\"/>\n" -#~ "\n" -#~ " <set name=\"kittens\"\n" -#~ " inverse=\"true\"\n" -#~ " order-by=\"litter_id\">\n" -#~ " <key column=\"mother_id\"/>\n" -#~ " <one-to-many class=\"Cat\"/>\n" -#~ " </set>\n" -#~ "\n" -#~ " <subclass name=\"DomesticCat\"\n" -#~ " discriminator-value=\"D\">\n" -#~ "\n" -#~ " <property name=\"name\" \n" -#~ " type=\"string\"/>\n" -#~ "\n" -#~ " </subclass>\n" -#~ "\n" -#~ " </class>\n" -#~ "\n" -#~ " <class name=\"Dog\">\n" -#~ " <!-- mapping for Dog could go here -->\n" -#~ " </class>\n" -#~ "\n" -#~ "</hibernate-mapping>" +#~ "type (オプション - デフォルトは integer ):バージョン番号の型。" + +#~ msgid "composite-id" +#~ msgstr "composite-id" + +#~ msgid "" +#~ "A table with a composite key can be mapped with multiple properties of " +#~ "the class as identifier properties. The <composite-id> element accepts <key-property> property " +#~ "mappings and <key-many-to-one> mappings as child " +#~ "elements." +#~ msgstr "" +#~ "複合キーのあるテーブルに対し、識別子プロパティとしてクラスの複数のプロパ" +#~ "ティをマッピングすることができます。 <composite-id> 要素は、子要素として <key-property> プロ" +#~ "パティマッピングと <key-many-to-one> マッピングを" +#~ "受け入れます。" + +#~ msgid "" +#~ "The persistent class must override equals()" +#~ " and hashCode() to implement composite " +#~ "identifier equality. It must also implement Serializable." +#~ msgstr "" +#~ "複合識別子の等価性を実装するためには、永続クラスが equals()hashCode() をオーバーライド しな" +#~ "ければなりません 。 また Serializable も実装" +#~ "しなければいけません。" + +#~ msgid "" +#~ "Unfortunately, this approach means that a persistent object is its own " +#~ "identifier. There is no convenient \"handle\" other than the object " +#~ "itself. You must instantiate an instance of the persistent class itself " +#~ "and populate its identifier properties before you can load() the persistent state associated with a composite key. We call " +#~ "this approach an embedded composite identifier, and " +#~ "discourage it for serious applications." +#~ msgstr "" +#~ "残念ながら複合識別子のためのこの方法は、永続オブジェクトが自身の識別子であ" +#~ "ることを意味しています。オブジェクト自身を識別子とする以外に便利な「扱い" +#~ "方」はありません。複合キーに関連した永続状態を load() " +#~ "出来るようになる前に、永続クラス自身をインスタンス化し、識別子プロパティを" +#~ "設定しなければなりません。 組み込みの 複合識別子と呼" +#~ "ばれるこのアプローチは、本格的なアプリケーションには向いていません。" + +#~ msgid "" +#~ "A second approach is what we call a mapped composite " +#~ "identifier, where the identifier properties named inside the <" +#~ "composite-id> element are duplicated on both the persistent " +#~ "class and a separate identifier class." +#~ msgstr "" +#~ "2つ目の方法は マップされた 複合識別子と呼ばれるもの" +#~ "で、 <composite-id>エレメント内で指定した識別プロ" +#~ "パティが永続クラスと分離した識別子クラスの両方に重複して存在します。" + +#~ msgid "" +#~ "In this example, both the composite identifier class, " +#~ "MedicareId, and the entity class itself have " +#~ "properties named medicareNumber and " +#~ "dependent. The identifier class must override " +#~ "equals() and hashCode() and " +#~ "implement Serializable. The main disadvantage of this " +#~ "approach is code duplication." +#~ msgstr "" +#~ "この例では、複合識別子クラス( MedicareId )とエンティ" +#~ "ティクラス自身の両方が、 medicareNumber と " +#~ "dependent という名前のプロパティを持ちます。識別子クラ" +#~ "スは、 equals()hashCode() をオー" +#~ "バライドし、 Serializable を実装しなくてはなりません。" +#~ "この方法には、明らかにコードが重複するという不都合があります。" + +#~ msgid "" +#~ "The following attributes are used to specify a mapped composite " +#~ "identifier:" +#~ msgstr "次の属性はマッピングした複合識別子を指定するために使用します:" + +#~ msgid "" +#~ "mapped (optional - defaults to false): indicates that a mapped composite identifier is used, and that " +#~ "the contained property mappings refer to both the entity class and the " +#~ "composite identifier class." +#~ msgstr "" +#~ "mapped (オプション、デフォルトは false ): マッピングした複合識別子が使用されることと、包含されたプロパ" +#~ "ティのマッピングが、エンティティクラスと複合識別子クラスの両方を参照するこ" +#~ "とを示します。" + +#~ msgid "" +#~ "class (optional - but required for a mapped composite " +#~ "identifier): the class used as a composite identifier." +#~ msgstr "" +#~ "class (オプション、ただしマッピングした複合識別子には必" +#~ "須): 複合識別子として使用するクラス。" + +#~ msgid "" +#~ "We will describe a third, even more convenient approach, where the " +#~ "composite identifier is implemented as a component class in . The attributes described below apply only " +#~ "to this alternative approach:" +#~ msgstr "" +#~ "3つ目のさらに便利な方法は、複合識別子を のコンポーネントクラスとして実装することです。下で記述して" +#~ "いる属性は、この代替方法にのみ適用されます:" + +#~ msgid "" +#~ "name (optional - required for this approach): a " +#~ "property of component type that holds the composite identifier. Please " +#~ "see chapter 9 for more information." +#~ msgstr "" +#~ "name (オプション、このアプローチでは必須): 複合識別子を" +#~ "保持するコンポーネントタイプのプロパティ(9章を参照してください)。" + +#~ msgid "" +#~ "class (optional - defaults to the property type " +#~ "determined by reflection): the component class used as a composite " +#~ "identifier. Please see the next section for more information." +#~ msgstr "" +#~ "class (オプション - デフォルトはリフレクションにより決" +#~ "定されるプロパティの型): 複合識別子として使われるコンポーネントのクラス" +#~ "(次の節を見てください)。" + +#~ msgid "" +#~ "The third approach, an identifier component, is " +#~ "recommended for almost all applications." +#~ msgstr "" +#~ "この3つ目の方法は 識別子コンポーネント と呼び、ほと" +#~ "んどすべてのアプリケーションに対して推奨する方法です。" + +#~ msgid "Version (optional)" +#~ msgstr "version(オプション)" + +#~ msgid "" +#~ "The <version> element is optional and indicates " +#~ "that the table contains versioned data. This is particularly useful if " +#~ "you plan to use long transactions. See below for " +#~ "more information:" +#~ msgstr "" +#~ "<version> 要素はオプションであり、テーブルがバー" +#~ "ジョンデータを含むことを示します。これは ロングトランザクション" +#~ " を使うつもりなら、特に役立ちます(以下を参照してください)。" + +#~ msgid "" +#~ "Version numbers can be of Hibernate type long, " +#~ "integer, short, timestamp or calendar." +#~ msgstr "" +#~ "バージョン番号は Hibernate の long 、 " +#~ "integershort 、 " +#~ "timestampcalendar 型のいずれかで" +#~ "す。" + +#~ msgid "Many-to-one" +#~ msgstr "many-to-one" + +#~ msgid "" +#~ "An ordinary association to another persistent class is declared using a " +#~ "many-to-one element. The relational model is a many-to-" +#~ "one association; a foreign key in one table is referencing the primary " +#~ "key column(s) of the target table." +#~ msgstr "" +#~ "他の永続クラスへの通常の関連は many-to-one 要素を使って" +#~ "定義します。リレーショナルモデルは多対一関連です。つまりあるテーブルの外部" +#~ "キーは、ターゲットとなるテーブルの主キーカラムを参照しています。" + +#~ msgid "One-to-one" +#~ msgstr "one-to-one" + +#~ msgid "There are two varieties of one-to-one associations:" +#~ msgstr "一対一関連には2種類あります:" + +#~ msgid "primary key associations" +#~ msgstr "主キー関連" + +#~ msgid "" +#~ "Alternatively, a foreign key with a unique constraint, from " +#~ "Employee to Person, can be " +#~ "expressed as:" +#~ msgstr "" +#~ "もう1つの方法として、 Employee から Person へのユニーク制約を使った外部キー関連は以下のように表現されます:" + +#~ msgid "" +#~ "This association can be made bidirectional by adding the following to the " +#~ "Person mapping:" +#~ msgstr "" +#~ "そしてこの関連は、以下の記述を Person のマッピングに追" +#~ "加することで双方向にすることができます:" + +#, fuzzy +#~ msgid "Component and dynamic-component" +#~ msgstr "component, dynamic-component" + +#~ msgid "Subclass" +#~ msgstr "subclass" + +#~ msgid "" +#~ "A discriminator column is not required for this mapping strategy. Each " +#~ "subclass must, however, declare a table column holding the object " +#~ "identifier using the <key> element. The mapping " +#~ "at the start of the chapter would then be re-written as:" +#~ msgstr "" +#~ "このマッピング戦略には、識別カラムは必要ありません。しかし各サブクラスは " +#~ "<key> 要素を使い、オブジェクト識別子を保持する" +#~ "テーブルカラムを定義しなければなりません。この章の初めのマッピングは以下の" +#~ "ように書き直せます:" + +#~ msgid "Union-subclass" +#~ msgstr "union-subclass" + +#~ msgid "Join" +#~ msgstr "join" + +#~ msgid "" +#~ "Using the <join> element, it is possible to map " +#~ "properties of one class to several tables that have a one-to-one " +#~ "relationship. For example:" +#~ msgstr "" +#~ "テーブル間に一対一の関係があるとき、 <join> 要素" +#~ "を使うことで、1つのクラスのプロパティをいくつものテーブルにマッピングする" +#~ "ことができます。" + +#, fuzzy +#~ msgid "class" +#~ msgstr "sequence-identity" + +#, fuzzy +#~ msgid "binary" +#~ msgstr "sequence-identity" + +#, fuzzy +#~ msgid "text" +#~ msgstr "sequence-identity" + +#, fuzzy +#~ msgid "clob, blob" +#~ msgstr "calendar, calendar_date" + +#~ msgid "" +#~ "XML does not suit all users so there are some alternative ways to define " +#~ "O/R mapping metadata in Hibernate." +#~ msgstr "" +#~ "XML の記述以外に、 Hibernate では O/R マッピングのメタデータを定義する代替" +#~ "方法があります。" + +#~ msgid "Using XDoclet markup" +#~ msgstr "XDoclet マークアップの使用" + +#~ msgid "" +#~ "Many Hibernate users prefer to embed mapping information directly in " +#~ "sourcecode using XDoclet @hibernate.tags. We do not " +#~ "cover this approach in this reference guide since it is considered part " +#~ "of XDoclet. However, we include the following example of the " +#~ "Cat class with XDoclet mappings:" +#~ msgstr "" +#~ "多くの Hibernate ユーザーは XDoclet の @hibernate.tags " +#~ "を使って、ソースコード内に直接マッピング情報を埋め込むことを好みます。これ" +#~ "は厳密に言えば XDoclet の分野なので、本ドキュメントではこの方法を対象とは" +#~ "しません。しかし XDoclet を使った以下の Cat マッピング" +#~ "の例を示します。" + +#~ msgid "" +#~ "See the Hibernate website for more examples of XDoclet and Hibernate." +#~ msgstr "" +#~ "Hibernate のウェブサイトには、 XDoclet と Hibernate に関するサンプルが多数" +#~ "あります。" + +#~ msgid "Using JDK 5.0 Annotations" +#~ msgstr "JDK 5.0 アノテーションの使用" + +#~ msgid "" +#~ "JDK 5.0 introduced XDoclet-style annotations at the language level that " +#~ "are type-safe and checked at compile time. This mechanism is more " +#~ "powerful than XDoclet annotations and better supported by tools and IDEs. " +#~ "IntelliJ IDEA, for example, supports auto-completion and syntax " +#~ "highlighting of JDK 5.0 annotations. The new revision of the EJB " +#~ "specification (JSR-220) uses JDK 5.0 annotations as the primary metadata " +#~ "mechanism for entity beans. Hibernate3 implements the " +#~ "EntityManager of JSR-220 (the persistence API). " +#~ "Support for mapping metadata is available via the Hibernate " +#~ "Annotations package as a separate download. Both EJB3 (JSR-" +#~ "220) and Hibernate3 metadata is supported." +#~ msgstr "" +#~ "JDK5.0 ではタイプセーフかつコンパイル時にチェックできる、言語レベルの " +#~ "XDoclet スタイルのアノテーションを導入しました。このメカニズムは XDoclet " +#~ "のアノテーションよりも強力で、ツールや IDE も多くがサポートしています。例" +#~ "えば IntelliJ IDEA は、 JDK5.0 にアノテーションの自動補完と構文の強調表示" +#~ "をサポートしています。 EJB 仕様 (JSR-220) の新しいバージョンでは、エンティ" +#~ "ティ Bean に対する主要なメタデータメカニズムとして JDK5.0 のアノテーション" +#~ "を使用しています。 Hibernate3 では JSR-220 (永続化 API) の " +#~ "EntityManager を実装し、メタデータマッピングに対するサ" +#~ "ポートは、別ダウンロードの Hibernate Annotations パッ" +#~ "ケージにより利用可能です。これは EJB3 (JSR-220) と Hibernate3 のメタデータ" +#~ "をどちらもサポートしています。" + +#~ msgid "This is an example of a POJO class annotated as an EJB entity bean:" +#~ msgstr "" +#~ "以下は EJB のエンティティ Bean として注釈された POJO クラスの例です:" + +#~ msgid "" +#~ "Support for JDK 5.0 Annotations (and JSR-220) is currently under " +#~ "development. Please refer to the Hibernate Annotations module for more " +#~ "details." +#~ msgstr "" +#~ "JDK5.0 のアノテーション (と JSR-220) のサポートは進行中の作業であり、完全" +#~ "ではないことに注意してください。さらに詳しい情報は Hibernate のアノテー" +#~ "ションモジュールを参照してください。" #, fuzzy #~ msgid "" @@ -4268,285 +9673,6 @@ msgstr "" #~ " & types;\n" #~ "</hibernate-mapping>" -#, fuzzy -#~ msgid "" -#~ "]]>" -#~ msgstr "" -#~ "<hibernate-mapping\n" -#~ " schema=\"schemaName\"\n" -#~ " catalog=\"catalogName\"\n" -#~ " default-cascade=\"cascade_style\"\n" -#~ " default-access=\"field|property|ClassName\"\n" -#~ " default-lazy=\"true|false\"\n" -#~ " auto-import=\"true|false\"\n" -#~ " package=\"package.name\"\n" -#~ " />" - -#, fuzzy -#~ msgid "" -#~ "]]>" -#~ msgstr "" -#~ "<class\n" -#~ " name=\"ClassName\"\n" -#~ " table=\"tableName\"\n" -#~ " discriminator-value=\"discriminator_value\"\n" -#~ " mutable=\"true|false\"\n" -#~ " schema=\"owner\"\n" -#~ " catalog=\"catalog\"\n" -#~ " proxy=\"ProxyInterface\"\n" -#~ " dynamic-update=\"true|false\"\n" -#~ " dynamic-insert=\"true|false\"\n" -#~ " select-before-update=\"true|false\"\n" -#~ " polymorphism=\"implicit|explicit\"\n" -#~ " where=\"arbitrary sql where condition\"\n" -#~ " persister=\"PersisterClass\"\n" -#~ " batch-size=\"N\"\n" -#~ " optimistic-lock=\"none|version|dirty|all\"\n" -#~ " lazy=\"true|false\"\n" -#~ " entity-name=\"EntityName\"\n" -#~ " check=\"arbitrary sql check condition\"\n" -#~ " rowid=\"rowid\"\n" -#~ " subselect=\"SQL expression\"\n" -#~ " abstract=\"true|false\"\n" -#~ " node=\"element-name\"\n" -#~ "/>" - -#, fuzzy -#~ msgid "" -#~ "\n" -#~ " \n" -#~ " select item.name, max(bid.amount), count(*)\n" -#~ " from item\n" -#~ " join bid on bid.item_id = item.id\n" -#~ " group by item.name\n" -#~ " \n" -#~ " \n" -#~ " \n" -#~ " \n" -#~ " ...\n" -#~ "]]>" -#~ msgstr "" -#~ "<class name=\"Summary\">\n" -#~ " <subselect>\n" -#~ " select item.name, max(bid.amount), count(*)\n" -#~ " from item\n" -#~ " join bid on bid.item_id = item.id\n" -#~ " group by item.name\n" -#~ " </subselect>\n" -#~ " <synchronize table=\"item\"/>\n" -#~ " <synchronize table=\"bid\"/>\n" -#~ " <id name=\"name\"/>\n" -#~ " ...\n" -#~ "</class>" - -#, fuzzy -#~ msgid "" -#~ "\n" -#~ " node=\"element-name|@attribute-name|element/@attribute|.\"\n" -#~ "\n" -#~ " \n" -#~ "]]>" -#~ msgstr "" -#~ "<id\n" -#~ " name=\"propertyName\"\n" -#~ " type=\"typename\"\n" -#~ " column=\"column_name\"\n" -#~ " unsaved-value=\"null|any|none|undefined|id_value\"\n" -#~ " access=\"field|property|ClassName\">\n" -#~ " node=\"element-name|@attribute-name|element/@attribute|.\"\n" -#~ "\n" -#~ " <generator class=\"generatorClass\"/>\n" -#~ "</id>" - -#, fuzzy -#~ msgid "" -#~ "\n" -#~ " \n" -#~ " uid_table\n" -#~ " next_hi_value_column\n" -#~ " \n" -#~ "]]>" -#~ msgstr "" -#~ "<id name=\"id\" type=\"long\" column=\"cat_id\">\n" -#~ " <generator class=\"org.hibernate.id.TableHiLoGenerator\">\n" -#~ " <param name=\"table\">uid_table</param>\n" -#~ " <param name=\"column\">next_hi_value_column</" -#~ "param>\n" -#~ " </generator>\n" -#~ "</id>" - -#~ msgid "increment" -#~ msgstr "increment" - -#~ msgid "identity" -#~ msgstr "identity" - -#~ msgid "sequence" -#~ msgstr "sequence" - -#~ msgid "hilo" -#~ msgstr "hilo" - -#~ msgid "seqhilo" -#~ msgstr "seqhilo" - -#~ msgid "guid" -#~ msgstr "guid" - -#~ msgid "native" -#~ msgstr "native" - -#~ msgid "assigned" -#~ msgstr "assigned" - -#~ msgid "select" -#~ msgstr "select" - -#~ msgid "foreign" -#~ msgstr "foreign" - -#, fuzzy -#~ msgid "" -#~ "\n" -#~ " \n" -#~ " hi_value\n" -#~ " next_value\n" -#~ " 100\n" -#~ " \n" -#~ "]]>" -#~ msgstr "" -#~ "<id name=\"id\" type=\"long\" column=\"cat_id\">\n" -#~ " <generator class=\"hilo\">\n" -#~ " <param name=\"table\">hi_value</param>\n" -#~ " <param name=\"column\">next_value</param>\n" -#~ " <param name=\"max_lo\">100</param>\n" -#~ " </generator>\n" -#~ "</id>" - -#, fuzzy -#~ msgid "" -#~ "\n" -#~ " \n" -#~ " hi_value\n" -#~ " 100\n" -#~ " \n" -#~ "]]>" -#~ msgstr "" -#~ "<id name=\"id\" type=\"long\" column=\"cat_id\">\n" -#~ " <generator class=\"seqhilo\">\n" -#~ " <param name=\"sequence\">hi_value</param>\n" -#~ " <param name=\"max_lo\">100</param>\n" -#~ " </generator>\n" -#~ "</id>" - -#, fuzzy -#~ msgid "" -#~ "\n" -#~ " \n" -#~ " person_id_sequence\n" -#~ " \n" -#~ "]]>" -#~ msgstr "" -#~ "<id name=\"id\" type=\"long\" column=\"person_id\">\n" -#~ " <generator class=\"sequence\">\n" -#~ " <param name=\"sequence\">person_id_sequence</" -#~ "param>\n" -#~ " </generator>\n" -#~ "</id>" - -#, fuzzy -#~ msgid "" -#~ "\n" -#~ " \n" -#~ "]]>" -#~ msgstr "" -#~ "<id name=\"id\" type=\"long\" column=\"person_id\" unsaved-value=\"0" -#~ "\">\n" -#~ " <generator class=\"identity\"/>\n" -#~ "</id>" - -#, fuzzy -#~ msgid "" -#~ "\n" -#~ " \n" -#~ " socialSecurityNumber\n" -#~ " \n" -#~ "]]>" -#~ msgstr "" -#~ "<id name=\"id\" type=\"long\" column=\"person_id\">\n" -#~ " <generator class=\"select\">\n" -#~ " <param name=\"key\">socialSecurityNumber</" -#~ "param>\n" -#~ " </generator>\n" -#~ "</id>" - -#, fuzzy -#~ msgid "" -#~ "\n" -#~ " node=\"element-name|.\"\n" -#~ "\n" -#~ " \n" -#~ " \n" -#~ " ......\n" -#~ "]]>" -#~ msgstr "" -#~ "<composite-id\n" -#~ " name=\"propertyName\"\n" -#~ " class=\"ClassName\"\n" -#~ " mapped=\"true|false\"\n" -#~ " access=\"field|property|ClassName\">\n" -#~ " node=\"element-name|.\"\n" -#~ "\n" -#~ " <key-property name=\"propertyName\" type=\"typename\" column=" -#~ "\"column_name\"/>\n" -#~ " <key-many-to-one name=\"propertyName class=\"ClassName\" " -#~ "column=\"column_name\"/>\n" -#~ " ......\n" -#~ "</composite-id>" - #, fuzzy #~ msgid "" #~ "\n" @@ -4571,297 +9697,6 @@ msgstr "" #~ " <key-property name=\"dependent\"/>\n" #~ "</composite-id>" -#, fuzzy -#~ msgid "" -#~ "]]>" -#~ msgstr "" -#~ "<discriminator\n" -#~ " column=\"discriminator_column\"\n" -#~ " type=\"discriminator_type\"\n" -#~ " force=\"true|false\"\n" -#~ " insert=\"true|false\"\n" -#~ " formula=\"arbitrary sql expression\"\n" -#~ "/>" - -#, fuzzy -#~ msgid "" -#~ "]]>" -#~ msgstr "" -#~ "<discriminator\n" -#~ " formula=\"case when CLASS_TYPE in ('a', 'b', 'c') then 0 else 1 end" -#~ "\"\n" -#~ " type=\"integer\"/>" - -#, fuzzy -#~ msgid "" -#~ "]]>" -#~ msgstr "" -#~ "<version\n" -#~ " column=\"version_column\"\n" -#~ " name=\"propertyName\"\n" -#~ " type=\"typename\"\n" -#~ " access=\"field|property|ClassName\"\n" -#~ " unsaved-value=\"null|negative|undefined\"\n" -#~ " generated=\"never|always\"\n" -#~ " insert=\"true|false\"\n" -#~ " node=\"element-name|@attribute-name|element/@attribute|.\"\n" -#~ "/>" - -#, fuzzy -#~ msgid "" -#~ "]]>" -#~ msgstr "" -#~ "<timestamp\n" -#~ " column=\"timestamp_column\"\n" -#~ " name=\"propertyName\"\n" -#~ " access=\"field|property|ClassName\"\n" -#~ " unsaved-value=\"null|undefined\"\n" -#~ " source=\"vm|db\"\n" -#~ " generated=\"never|always\"\n" -#~ " node=\"element-name|@attribute-name|element/@attribute|.\"\n" -#~ "/>" - -#, fuzzy -#~ msgid "" -#~ "]]>" -#~ msgstr "" -#~ "<property\n" -#~ " name=\"propertyName\"\n" -#~ " column=\"column_name\"\n" -#~ " type=\"typename\"\n" -#~ " update=\"true|false\"\n" -#~ " insert=\"true|false\"\n" -#~ " formula=\"arbitrary SQL expression\"\n" -#~ " access=\"field|property|ClassName\"\n" -#~ " lazy=\"true|false\"\n" -#~ " unique=\"true|false\"\n" -#~ " not-null=\"true|false\"\n" -#~ " optimistic-lock=\"true|false\"\n" -#~ " generated=\"never|insert|always\"\n" -#~ " node=\"element-name|@attribute-name|element/@attribute|.\"\n" -#~ " index=\"index_name\"\n" -#~ " unique_key=\"unique_key_id\"\n" -#~ " length=\"L\"\n" -#~ " precision=\"P\"\n" -#~ " scale=\"S\"\n" -#~ "/>" - -#, fuzzy -#~ msgid "" -#~ "]]>" -#~ msgstr "" -#~ "<property name=\"totalPrice\"\n" -#~ " formula=\"( SELECT SUM (li.quantity*p.price) FROM LineItem li, " -#~ "Product p\n" -#~ " WHERE li.productId = p.productId\n" -#~ " AND li.customerId = customerId\n" -#~ " AND li.orderNumber = orderNumber )\"/>" - -#, fuzzy -#~ msgid "" -#~ "]]>" -#~ msgstr "" -#~ "<many-to-one\n" -#~ " name=\"propertyName\"\n" -#~ " column=\"column_name\"\n" -#~ " class=\"ClassName\"\n" -#~ " cascade=\"cascade_style\"\n" -#~ " fetch=\"join|select\"\n" -#~ " update=\"true|false\"\n" -#~ " insert=\"true|false\"\n" -#~ " property-ref=\"propertyNameFromAssociatedClass\"\n" -#~ " access=\"field|property|ClassName\"\n" -#~ " unique=\"true|false\"\n" -#~ " not-null=\"true|false\"\n" -#~ " optimistic-lock=\"true|false\"\n" -#~ " lazy=\"proxy|no-proxy|false\"\n" -#~ " not-found=\"ignore|exception\"\n" -#~ " entity-name=\"EntityName\"\n" -#~ " formula=\"arbitrary SQL expression\"\n" -#~ " node=\"element-name|@attribute-name|element/@attribute|.\"\n" -#~ " embed-xml=\"true|false\"\n" -#~ " index=\"index_name\"\n" -#~ " unique_key=\"unique_key_id\"\n" -#~ " foreign-key=\"foreign_key_name\"\n" -#~ "/>" - -#, fuzzy -#~ msgid "" -#~ "]]>" -#~ msgstr "" -#~ "<many-to-one name=\"product\" class=\"Product\" column=\"PRODUCT_ID\"/" -#~ ">" - -#, fuzzy -#~ msgid "" -#~ "]]>" -#~ msgstr "" -#~ "<property name=\"serialNumber\" unique=\"true\" type=\"string\" column=" -#~ "\"SERIAL_NUMBER\"/>" - -#, fuzzy -#~ msgid "" -#~ "]]>" -#~ msgstr "" -#~ "<many-to-one name=\"product\" property-ref=\"serialNumber\" column=" -#~ "\"PRODUCT_SERIAL_NUMBER\"/>" - -#, fuzzy -#~ msgid "" -#~ "]]>" -#~ msgstr "" -#~ "<many-to-one name=\"owner\" property-ref=\"identity.ssn\" column=" -#~ "\"OWNER_SSN\"/>" - -#, fuzzy -#~ msgid "" -#~ "]]>" -#~ msgstr "" -#~ "<one-to-one\n" -#~ " name=\"propertyName\"\n" -#~ " class=\"ClassName\"\n" -#~ " cascade=\"cascade_style\"\n" -#~ " constrained=\"true|false\"\n" -#~ " fetch=\"join|select\"\n" -#~ " property-ref=\"propertyNameFromAssociatedClass\"\n" -#~ " access=\"field|property|ClassName\"\n" -#~ " formula=\"any SQL expression\"\n" -#~ " lazy=\"proxy|no-proxy|false\"\n" -#~ " entity-name=\"EntityName\"\n" -#~ " node=\"element-name|@attribute-name|element/@attribute|.\"\n" -#~ " embed-xml=\"true|false\"\n" -#~ " foreign-key=\"foreign_key_name\"\n" -#~ "/>" - -#, fuzzy -#~ msgid "]]>" -#~ msgstr "<one-to-one name=\"person\" class=\"Person\"/>" - -#, fuzzy -#~ msgid "" -#~ "]]>" -#~ msgstr "" -#~ "<one-to-one name=\"employee\" class=\"Employee\" constrained=\"true\"/" -#~ ">" - -#, fuzzy -#~ msgid "" -#~ "\n" -#~ " \n" -#~ " \n" -#~ " employee\n" -#~ " \n" -#~ " \n" -#~ " ...\n" -#~ " \n" -#~ "]]>" -#~ msgstr "" -#~ "<class name=\"person\" table=\"PERSON\">\n" -#~ " <id name=\"id\" column=\"PERSON_ID\">\n" -#~ " <generator class=\"foreign\">\n" -#~ " <param name=\"property\">employee</param>\n" -#~ " </generator>\n" -#~ " </id>\n" -#~ " ...\n" -#~ " <one-to-one name=\"employee\"\n" -#~ " class=\"Employee\"\n" -#~ " constrained=\"true\"/>\n" -#~ "</class>" - #, fuzzy #~ msgid "" #~ "\n" -#~ " \n" -#~ " \n" -#~ " ......\n" -#~ "]]>" -#~ msgstr "" -#~ "<natural-id mutable=\"true|false\"/>\n" -#~ " <property ... />\n" -#~ " <many-to-one ... />\n" -#~ " ......\n" -#~ "</natural-id>" - -#, fuzzy -#~ msgid "" -#~ "\n" -#~ "\n" -#~ " \n" -#~ " \n" -#~ " ........\n" -#~ "]]>" -#~ msgstr "" -#~ "<component \n" -#~ " name=\"propertyName\" \n" -#~ " class=\"className\"\n" -#~ " insert=\"true|false\"\n" -#~ " update=\"true|false\"\n" -#~ " access=\"field|property|ClassName\"\n" -#~ " lazy=\"true|false\"\n" -#~ " optimistic-lock=\"true|false\"\n" -#~ " unique=\"true|false\"\n" -#~ " node=\"element-name|.\"\n" -#~ ">\n" -#~ " \n" -#~ " <property ...../>\n" -#~ " <many-to-one .... />\n" -#~ " ........\n" -#~ "</component>" - -#, fuzzy -#~ msgid "" -#~ "\n" -#~ "\n" -#~ " \n" -#~ " \n" -#~ " ........\n" -#~ "]]>" -#~ msgstr "" -#~ "<properties \n" -#~ " name=\"logicalName\" \n" -#~ " insert=\"true|false\"\n" -#~ " update=\"true|false\"\n" -#~ " optimistic-lock=\"true|false\"\n" -#~ " unique=\"true|false\"\n" -#~ ">\n" -#~ " \n" -#~ " <property ...../>\n" -#~ " <many-to-one .... />\n" -#~ " ........\n" -#~ "</properties>" - -#, fuzzy -#~ msgid "" -#~ "\n" -#~ " \n" -#~ "\n" -#~ " ...\n" -#~ " \n" -#~ " \n" -#~ " \n" -#~ " \n" -#~ " \n" -#~ "]]>" -#~ msgstr "" -#~ "<class name=\"Person\">\n" -#~ " <id name=\"personNumber\"/>\n" -#~ " ...\n" -#~ " <properties name=\"name\" \n" -#~ " unique=\"true\" update=\"false\">\n" -#~ " <property name=\"firstName\"/>\n" -#~ " <property name=\"initial\"/>\n" -#~ " <property name=\"lastName\"/>\n" -#~ " </properties>\n" -#~ "</class>" - -#, fuzzy -#~ msgid "" -#~ "\n" -#~ " \n" -#~ " \n" -#~ " \n" -#~ "]]>" -#~ msgstr "" -#~ "<many-to-one name=\"person\" \n" -#~ " class=\"Person\" property-ref=\"name\">\n" -#~ " <column name=\"firstName\"/>\n" -#~ " <column name=\"initial\"/>\n" -#~ " <column name=\"lastName\"/>\n" -#~ "</many-to-one>" - -#, fuzzy -#~ msgid "" -#~ "\n" -#~ "\n" -#~ " \n" -#~ " .....\n" -#~ "]]>" -#~ msgstr "" -#~ "<subclass\n" -#~ " name=\"ClassName\"\n" -#~ " discriminator-value=\"discriminator_value\"\n" -#~ " proxy=\"ProxyInterface\"\n" -#~ " lazy=\"true|false\"\n" -#~ " dynamic-update=\"true|false\"\n" -#~ " dynamic-insert=\"true|false\"\n" -#~ " entity-name=\"EntityName\"\n" -#~ " node=\"element-name\"\n" -#~ " extends=\"SuperclassName\">\n" -#~ "\n" -#~ " <property .... />\n" -#~ " .....\n" -#~ "</subclass>" - -#, fuzzy -#~ msgid "" -#~ "\n" -#~ "\n" -#~ " \n" -#~ "\n" -#~ " \n" -#~ " .....\n" -#~ "]]>" -#~ msgstr "" -#~ "<joined-subclass\n" -#~ " name=\"ClassName\"\n" -#~ " table=\"tablename\"\n" -#~ " proxy=\"ProxyInterface\"\n" -#~ " lazy=\"true|false\"\n" -#~ " dynamic-update=\"true|false\"\n" -#~ " dynamic-insert=\"true|false\"\n" -#~ " schema=\"schema\"\n" -#~ " catalog=\"catalog\"\n" -#~ " extends=\"SuperclassName\"\n" -#~ " persister=\"ClassName\"\n" -#~ " subselect=\"SQL expression\"\n" -#~ " entity-name=\"EntityName\"\n" -#~ " node=\"element-name\">\n" -#~ "\n" -#~ " <key .... >\n" -#~ "\n" -#~ " <property .... />\n" -#~ " .....\n" -#~ "</joined-subclass>" - -#, fuzzy -#~ msgid "" -#~ "\n" -#~ "\n" -#~ "\n" -#~ "\n" -#~ "\n" -#~ " \n" -#~ " \n" -#~ " \n" -#~ " \n" -#~ " \n" -#~ " \n" -#~ " \n" -#~ " \n" -#~ " \n" -#~ " \n" -#~ " \n" -#~ " \n" -#~ " \n" -#~ " \n" -#~ " \n" -#~ " \n" -#~ " \n" -#~ " \n" -#~ "\n" -#~ " \n" -#~ " \n" -#~ " \n" -#~ "\n" -#~ "]]>" -#~ msgstr "" -#~ "<?xml version=\"1.0\"?>\n" -#~ "<!DOCTYPE hibernate-mapping PUBLIC\n" -#~ " \"-//Hibernate/Hibernate Mapping DTD//EN\"\n" -#~ " \"http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd" -#~ "\">\n" -#~ "\n" -#~ "<hibernate-mapping package=\"eg\">\n" -#~ "\n" -#~ " <class name=\"Cat\" table=\"CATS\">\n" -#~ " <id name=\"id\" column=\"uid\" type=\"long\">\n" -#~ " <generator class=\"hilo\"/>\n" -#~ " </id>\n" -#~ " <property name=\"birthdate\" type=\"date\"/>\n" -#~ " <property name=\"color\" not-null=\"true\"/>\n" -#~ " <property name=\"sex\" not-null=\"true\"/>\n" -#~ " <property name=\"weight\"/>\n" -#~ " <many-to-one name=\"mate\"/>\n" -#~ " <set name=\"kittens\">\n" -#~ " <key column=\"MOTHER\"/>\n" -#~ " <one-to-many class=\"Cat\"/>\n" -#~ " </set>\n" -#~ " <joined-subclass name=\"DomesticCat\" table=" -#~ "\"DOMESTIC_CATS\">\n" -#~ " <key column=\"CAT\"/>\n" -#~ " <property name=\"name\" type=\"string\"/>\n" -#~ " </joined-subclass>\n" -#~ " </class>\n" -#~ "\n" -#~ " <class name=\"eg.Dog\">\n" -#~ " <!-- mapping for Dog could go here -->\n" -#~ " </class>\n" -#~ "\n" -#~ "</hibernate-mapping>" - -#, fuzzy -#~ msgid "" -#~ "\n" -#~ "\n" -#~ " \n" -#~ " .....\n" -#~ "]]>" -#~ msgstr "" -#~ "<union-subclass\n" -#~ " name=\"ClassName\"\n" -#~ " table=\"tablename\"\n" -#~ " proxy=\"ProxyInterface\"\n" -#~ " lazy=\"true|false\"\n" -#~ " dynamic-update=\"true|false\"\n" -#~ " dynamic-insert=\"true|false\"\n" -#~ " schema=\"schema\"\n" -#~ " catalog=\"catalog\"\n" -#~ " extends=\"SuperclassName\"\n" -#~ " abstract=\"true|false\"\n" -#~ " persister=\"ClassName\"\n" -#~ " subselect=\"SQL expression\"\n" -#~ " entity-name=\"EntityName\"\n" -#~ " node=\"element-name\">\n" -#~ "\n" -#~ " <property .... />\n" -#~ " .....\n" -#~ "</union-subclass>" - -#, fuzzy -#~ msgid "" -#~ "\n" -#~ "\n" -#~ " \n" -#~ "\n" -#~ " \n" -#~ " ...\n" -#~ "]]>" -#~ msgstr "" -#~ "<join\n" -#~ " table=\"tablename\"\n" -#~ " schema=\"owner\"\n" -#~ " catalog=\"catalog\"\n" -#~ " fetch=\"join|select\"\n" -#~ " inverse=\"true|false\"\n" -#~ " optional=\"true|false\">\n" -#~ " \n" -#~ " <key ... />\n" -#~ " \n" -#~ " <property ... />\n" -#~ " ...\n" -#~ "</join>" - -#, fuzzy -#~ msgid "" -#~ "\n" -#~ "\n" -#~ " ...\n" -#~ "\n" -#~ " \n" -#~ " \n" -#~ " \n" -#~ " \n" -#~ " \n" -#~ " \n" -#~ " ...]]>" -#~ msgstr "" -#~ "<class name=\"Person\"\n" -#~ " table=\"PERSON\">\n" -#~ "\n" -#~ " <id name=\"id\" column=\"PERSON_ID\">...</id>\n" -#~ "\n" -#~ " <join table=\"ADDRESS\">\n" -#~ " <key column=\"ADDRESS_ID\"/>\n" -#~ " <property name=\"address\"/>\n" -#~ " <property name=\"zip\"/>\n" -#~ " <property name=\"country\"/>\n" -#~ " </join>\n" -#~ " ..." - -#, fuzzy -#~ msgid "Key" -#~ msgstr "key" - -#, fuzzy -#~ msgid "" -#~ "]]>" -#~ msgstr "" -#~ "<key\n" -#~ " column=\"columnname\"\n" -#~ " on-delete=\"noaction|cascade\"\n" -#~ " property-ref=\"propertyName\"\n" -#~ " not-null=\"true|false\"\n" -#~ " update=\"true|false\"\n" -#~ " unique=\"true|false\"\n" -#~ "/>" - -#, fuzzy -#~ msgid "" -#~ "]]>" -#~ msgstr "" -#~ "<column\n" -#~ " name=\"column_name\"\n" -#~ " length=\"N\"\n" -#~ " precision=\"N\"\n" -#~ " scale=\"N\"\n" -#~ " not-null=\"true|false\"\n" -#~ " unique=\"true|false\"\n" -#~ " unique-key=\"multicolumn_unique_key_name\"\n" -#~ " index=\"index_name\"\n" -#~ " sql-type=\"sql_type_name\"\n" -#~ " check=\"SQL expression\"\n" -#~ " default=\"SQL expression\"/>" - -#, fuzzy -#~ msgid "SQL expression]]>" -#~ msgstr "<formula>SQL expression</formula>" - -#, fuzzy -#~ msgid "" -#~ "\n" -#~ " \n" -#~ " 'MAILING'\n" -#~ "]]>" -#~ msgstr "" -#~ "<many-to-one name=\"homeAddress\" class=\"Address\"\n" -#~ " insert=\"false\" update=\"false\">\n" -#~ " <column name=\"person_id\" not-null=\"true\" length=\"10\"/>\n" -#~ " <formula>'MAILING'</formula>\n" -#~ "</many-to-one>" - -#, fuzzy -#~ msgid "]]>" -#~ msgstr "<import class=\"java.lang.Object\" rename=\"Universe\"/>" - -#, fuzzy -#~ msgid "" -#~ "]]>" -#~ msgstr "" -#~ "<import\n" -#~ " class=\"ClassName\"\n" -#~ " rename=\"ShortName\"\n" -#~ "/>" - -#, fuzzy -#~ msgid "Any" -#~ msgstr "any" - -#, fuzzy -#~ msgid "" -#~ "\n" -#~ " \n" -#~ " \n" -#~ " \n" -#~ " \n" -#~ " \n" -#~ "]]>" -#~ msgstr "" -#~ "<any name=\"being\" id-type=\"long\" meta-type=\"string\">\n" -#~ " <meta-value value=\"TBL_ANIMAL\" class=\"Animal\"/>\n" -#~ " <meta-value value=\"TBL_HUMAN\" class=\"Human\"/>\n" -#~ " <meta-value value=\"TBL_ALIEN\" class=\"Alien\"/>\n" -#~ " <column name=\"table_name\"/>\n" -#~ " <column name=\"id\"/>\n" -#~ "</any>" - -#, fuzzy -#~ msgid "" -#~ "\n" -#~ " \n" -#~ " \n" -#~ " .....\n" -#~ " \n" -#~ " \n" -#~ " .....\n" -#~ "]]>" -#~ msgstr "" -#~ "<any\n" -#~ " name=\"propertyName\"\n" -#~ " id-type=\"idtypename\"\n" -#~ " meta-type=\"metatypename\"\n" -#~ " cascade=\"cascade_style\"\n" -#~ " access=\"field|property|ClassName\"\n" -#~ " optimistic-lock=\"true|false\"\n" -#~ ">\n" -#~ " <meta-value ... />\n" -#~ " <meta-value ... />\n" -#~ " .....\n" -#~ " <column .... />\n" -#~ " <column .... />\n" -#~ " .....\n" -#~ "</any>" - -#~ msgid "string" -#~ msgstr "string" - -#, fuzzy -#~ msgid "class" -#~ msgstr "subclass" - -#~ msgid "binary" -#~ msgstr "binary" - -#~ msgid "text" -#~ msgstr "text" - -#~ msgid "serializable" -#~ msgstr "serializable" - -#~ msgid "clob, blob" -#~ msgstr "clob, blob" - -#, fuzzy -#~ msgid "" -#~ "\n" -#~ " \n" -#~ " \n" -#~ "]]>" -#~ msgstr "" -#~ "<property name=\"twoStrings\" type=\"org.hibernate.test." -#~ "DoubleStringType\">\n" -#~ " <column name=\"first_string\"/>\n" -#~ " <column name=\"second_string\"/>\n" -#~ "</property>" - -#, fuzzy -#~ msgid "" -#~ "\n" -#~ " \n" -#~ " 0\n" -#~ " \n" -#~ "]]>" -#~ msgstr "" -#~ "<property name=\"priority\">\n" -#~ " <type name=\"com.mycompany.usertypes.DefaultValueIntegerType" -#~ "\">\n" -#~ " <param name=\"default\">0</param>\n" -#~ " </type>\n" -#~ "</property>" - -#, fuzzy -#~ msgid "" -#~ "\n" -#~ " 0\n" -#~ "]]>" -#~ msgstr "" -#~ "<typedef class=\"com.mycompany.usertypes.DefaultValueIntegerType\" " -#~ "name=\"default_zero\">\n" -#~ " <param name=\"default\">0</param>\n" -#~ "</typedef>" - -#, fuzzy -#~ msgid "]]>" -#~ msgstr "<property name=\"priority\" type=\"default_zero\"/>" - -#, fuzzy -#~ msgid "" -#~ "\n" -#~ " ...\n" -#~ " \n" -#~ " \n" -#~ " \n" -#~ " \n" -#~ "\n" -#~ "\n" -#~ "\n" -#~ " ...\n" -#~ " \n" -#~ "]]>" -#~ msgstr "" -#~ "<class name=\"Contract\" table=\"Contracts\" \n" -#~ " entity-name=\"CurrentContract\">\n" -#~ " ...\n" -#~ " <set name=\"history\" inverse=\"true\" \n" -#~ " order-by=\"effectiveEndDate desc\">\n" -#~ " <key column=\"currentContractId\"/>\n" -#~ " <one-to-many entity-name=\"HistoricalContract\"/>\n" -#~ " </set>\n" -#~ "</class>\n" -#~ "\n" -#~ "<class name=\"Contract\" table=\"ContractHistory\" \n" -#~ " entity-name=\"HistoricalContract\">\n" -#~ " ...\n" -#~ " <many-to-one name=\"currentContract\" \n" -#~ " column=\"currentContractId\" \n" -#~ " entity-name=\"CurrentContract\"/>\n" -#~ "</class>" - -#, fuzzy -#~ msgid "" -#~ "\n" -#~ " \n" -#~ " \n" -#~ " ...\n" -#~ "]]>" -#~ msgstr "" -#~ "<class name=\"LineItem\" table=\"`Line Item`\">\n" -#~ " <id name=\"id\" column=\"`Item Id`\"/><generator class=" -#~ "\"assigned\"/></id>\n" -#~ " <property name=\"itemNumber\" column=\"`Item #`\"/>\n" -#~ " ...\n" -#~ "</class>" - #, fuzzy #~ msgid "" #~ "\n" -#~ " ...\n" -#~ " \n" -#~ " CREATE TRIGGER my_trigger ...\n" -#~ " DROP TRIGGER my_trigger\n" -#~ " \n" -#~ "]]>" -#~ msgstr "" -#~ "<hibernate-mapping>\n" -#~ " ...\n" -#~ " <database-object>\n" -#~ " <create>CREATE TRIGGER my_trigger ...</create>\n" -#~ " <drop>DROP TRIGGER my_trigger</drop>\n" -#~ " </database-object>\n" -#~ "</hibernate-mapping>" - -#, fuzzy -#~ msgid "" -#~ "\n" -#~ " ...\n" -#~ " \n" -#~ " \n" -#~ " \n" -#~ "]]>" -#~ msgstr "" -#~ "<hibernate-mapping>\n" -#~ " ...\n" -#~ " <database-object>\n" -#~ " <definition class=\"MyTriggerDefinition\"/>\n" -#~ " </database-object>\n" -#~ "</hibernate-mapping>" - -#, fuzzy -#~ msgid "" -#~ "\n" -#~ " ...\n" -#~ " \n" -#~ " \n" -#~ " \n" -#~ " \n" -#~ " \n" -#~ "]]>" -#~ msgstr "" -#~ "<hibernate-mapping>\n" -#~ " ...\n" -#~ " <database-object>\n" -#~ " <definition class=\"MyTriggerDefinition\"/>\n" -#~ " <dialect-scope name=\"org.hibernate.dialect.Oracle9Dialect\"/" -#~ ">\n" -#~ " <dialect-scope name=\"org.hibernate.dialect.OracleDialect\"/" -#~ ">\n" -#~ " </database-object>\n" -#~ "</hibernate-mapping>" diff --git a/documentation/manual/src/main/docbook/ja-JP/content/collection_mapping.po b/documentation/manual/src/main/docbook/ja-JP/content/collection_mapping.po index 04750c547b..eb716f2a50 100644 --- a/documentation/manual/src/main/docbook/ja-JP/content/collection_mapping.po +++ b/documentation/manual/src/main/docbook/ja-JP/content/collection_mapping.po @@ -4,7 +4,7 @@ msgid "" msgstr "" "Project-Id-Version: Collection_Mapping\n" "Report-Msgid-Bugs-To: http://bugs.kde.org\n" -"POT-Creation-Date: 2010-02-10T07:25:34\n" +"POT-Creation-Date: 2010-07-20 21:02+0000\n" "PO-Revision-Date: 2010-01-06 16:08+1000\n" "Last-Translator: Xi HUANG \n" "Language-Team: \n" @@ -14,33 +14,51 @@ msgstr "" "X-Generator: KBabel 1.11.4\n" #. Tag: title +#: collection_mapping.xml:31 #, no-c-format msgid "Collection mapping" msgstr "コレクションのマッピング" #. Tag: title +#: collection_mapping.xml:34 #, no-c-format msgid "Persistent collections" msgstr "コレクションの永続化" #. Tag: para -#, no-c-format +#: collection_mapping.xml:36 +#, fuzzy, no-c-format msgid "" -"Hibernate requires that persistent collection-valued fields be declared as " -"an interface type. For example:" +"Naturally Hibernate also allows to persist collections. These persistent " +"collections can contain almost any other Hibernate type, including: basic " +"types, custom types, components and references to other entities. The " +"distinction between value and reference semantics is in this context very " +"important. An object in a collection might be handled with \"value\" " +"semantics (its life cycle fully depends on the collection owner), or it " +"might be a reference to another entity with its own life cycle. In the " +"latter case, only the \"link\" between the two objects is considered to be a " +"state held by the collection." msgstr "" -"コレクション型のフィールドを永続化するには、そのコレクション型がインター" -"フェース型である必要があります。例えば、" +"コレクションは他の Hibernate の型のほとんど(すべての基本型、カスタム型、コン" +"ポーネント、他のエンティティへの参照)を格納することができます。次の点は重要" +"な違いになります。コレクションに格納されたオブジェクトが「値」セマンティクス" +"として扱われるのか (ライフサイクルはコレクションのオーナーに完全に依存しま" +"す)、もしくはそれ自身のライフサイクルを持った別のエンティティへの参照である" +"かのかという違いです。後者は、2つのオブジェクト間の「リンク」をコレクションに" +"保持していると見なしているだけです。" #. Tag: para -#, no-c-format +#: collection_mapping.xml:46 +#, fuzzy, no-c-format msgid "" -"The actual interface might be java.util.Set, " +"As a requirement persistent collection-valued fields must be declared as an " +"interface type (see ). The actual interface might be java.util.Set, " "java.util.Collection, java.util.List, " "java.util.Map, java.util.SortedSet, " "java.util.SortedMap or anything you like (\"anything you " "like\" means you will have to write an implementation of org." -"hibernate.usertype.UserCollectionType.)" +"hibernate.usertype.UserCollectionType)." msgstr "" "実在するインターフェースには java.util.Set、 " "java.util.Collectionjava.util.ListHashSet. This is the best way to initialize collection " +"Notice how in the " +"instance variable parts was initialized with an instance " +"of HashSet. This is the best way to initialize collection " "valued properties of newly instantiated (non-persistent) instances. When you " -"make the instance persistent, by calling persist() for " -"example, Hibernate will actually replace the HashSet with " -"an instance of Hibernate's own implementation of Set. Be " -"aware of the following errors:" +"make the instance persistent, by calling persist(), " +"Hibernate will actually replace the HashSet with an " +"instance of Hibernate's own implementation of Set. Be " +"aware of the following error:" msgstr "" "HashSet のインスタンスを持つインスタンス変数がどのように初" "期化されるかに注目してみましょう。これは新たに生成された(永続化されていな" @@ -69,7 +89,39 @@ msgstr "" "literal> の実装クラスに置き換えます。このため、次のようなエラーには注意が必要" "です。" +#. Tag: title +#: collection_mapping.xml:68 +#, no-c-format +msgid "Hibernate uses its own collection implementations" +msgstr "" + +#. Tag: programlisting +#: collection_mapping.xml:70 +#, fuzzy, no-c-format +msgid "" +"Cat cat = new DomesticCat();\n" +"Cat kitten = new DomesticCat();\n" +"....\n" +"Set kittens = new HashSet();\n" +"kittens.add(kitten);\n" +"cat.setKittens(kittens);\n" +"session.persist(cat);\n" +"\n" +"kittens = cat.getKittens(); // Okay, kittens collection is a Set\n" +"(HashSet) cat.getKittens(); // Error!" +msgstr "" +"Cat cat = new DomesticCat();\n" +"Cat kitten = new DomesticCat();\n" +"....\n" +"Set kittens = new HashSet();\n" +"kittens.add(kitten);\n" +"cat.setKittens(kittens);\n" +"session.persist(cat);\n" +"kittens = cat.getKittens(); // Okay, kittens collection is a Set\n" +"(HashSet) cat.getKittens(); // Error!" + #. Tag: para +#: collection_mapping.xml:73 #, no-c-format msgid "" "The persistent collections injected by Hibernate behave like " @@ -83,6 +135,7 @@ msgstr "" "振舞います。" #. Tag: para +#: collection_mapping.xml:78 #, no-c-format msgid "" "Collections instances have the usual behavior of value types. They are " @@ -104,53 +157,320 @@ msgstr "" "を区別しません。" #. Tag: para -#, no-c-format +#: collection_mapping.xml:89 +#, fuzzy, no-c-format msgid "" "Use persistent collections the same way you use ordinary Java collections. " -"However, please ensure you understand the semantics of bidirectional " -"associations (these are discussed later)." +"However, ensure you understand the semantics of bidirectional associations " +"(see )." msgstr "" "しかしそれほど心配しなくても構いません。普段使っている Java のコレクションと" "同じように、永続化コレクションを使ってください。双方向関連の意味を理解すれば" "よいのです(これは後ほど説明します)。" #. Tag: title -#, no-c-format -msgid "Collection mappings" -msgstr "コレクションのマッピング" +#: collection_mapping.xml:97 +#, fuzzy, no-c-format +msgid "How to map collections" +msgstr "ソートされたコレクション" #. Tag: para +#: collection_mapping.xml:99 #, no-c-format msgid "" -"There are quite a range of mappings that can be generated for collections " -"that cover many common relational models. We suggest you experiment with the " -"schema generation tool so that you understand how various mapping " -"declarations translate to database tables." +"Using annotations you can map Collections, " +"Lists, Maps and " +"Sets of associated entities using @OneToMany and " +"@ManyToMany. For collections of a basic or embeddable type use " +"@ElementCollection. In the simplest case a collection mapping looks like " +"this:" msgstr "" -"多くの一般的なリレーショナルモデルをカバーしたために、コレクションのために利" -"用できるマッピングにはかなりの幅があります。様々なマッピング宣言がどのように" -"データベーステーブルに変換されるかを知るために、スキーマ生成ツールを使ってみ" -"ると良いでしょう。" + +#. Tag: title +#: collection_mapping.xml:107 +#, no-c-format +msgid "Collection mapping using @OneToMany and @JoinColumn" +msgstr "" + +#. Tag: programlisting +#: collection_mapping.xml:109 +#, fuzzy, no-c-format +msgid "" +"@Entity\n" +"public class Product {\n" +"\n" +" private String serialNumber;\n" +" private Set<Part> parts = new HashSet<Part>();\n" +"\n" +" @Id\n" +" public String getSerialNumber() { return serialNumber; }\n" +" void setSerialNumber(String sn) { serialNumber = sn; }\n" +" \n" +" @OneToMany\n" +" @JoinColumn(name=\"PART_ID\")\n" +" public Set<Part> getParts() { return parts; }\n" +" void setParts(Set parts) { this.parts = parts; }\n" +"}\n" +"\n" +"\n" +"@Entity\n" +"public class Part {\n" +" ...\n" +"}" +msgstr "" +"public class Product {\n" +" private String serialNumber;\n" +" private Set parts = new HashSet();\n" +" \n" +" public Set getParts() { return parts; }\n" +" void setParts(Set parts) { this.parts = parts; }\n" +" public String getSerialNumber() { return serialNumber; }\n" +" void setSerialNumber(String sn) { serialNumber = sn; }\n" +"}" #. Tag: para +#: collection_mapping.xml:112 #, no-c-format msgid "" -"The Hibernate mapping element used for mapping a collection depends upon the " -"type of interface. For example, a <set> element is " -"used for mapping properties of type Set." +"Product describes a unidirectional relationship with Part using the join " +"column PART_ID. In this unidirectional one to many scenario you can also use " +"a join table as seen in ." +msgstr "" + +#. Tag: title +#: collection_mapping.xml:118 +#, no-c-format +msgid "Collection mapping using @OneToMany and @JoinTable" +msgstr "" + +#. Tag: programlisting +#: collection_mapping.xml:121 +#, no-c-format +msgid "" +"@Entity\n" +"public class Product {\n" +"\n" +" private String serialNumber;\n" +" private Set<Part> parts = new HashSet<Part>();\n" +"\n" +" @Id\n" +" public String getSerialNumber() { return serialNumber; }\n" +" void setSerialNumber(String sn) { serialNumber = sn; }\n" +" \n" +" @OneToMany\n" +" @JoinTable(\n" +" name=\"PRODUCT_PARTS\",\n" +" joinColumns = @JoinColumn( name=\"PRODUCT_ID\"),\n" +" inverseJoinColumns = @JoinColumn( name=\"PART_ID\")\n" +" )\n" +" public Set<Part> getParts() { return parts; }\n" +" void setParts(Set parts) { this.parts = parts; }\n" +"}\n" +"\n" +"\n" +"@Entity\n" +"public class Part {\n" +" ...\n" +"}" +msgstr "" + +#. Tag: para +#: collection_mapping.xml:124 +#, no-c-format +msgid "" +"Without describing any physical mapping (no @JoinColumn or @JoinTable), a unidirectional one to " +"many with join table is used. The table name is the concatenation of the " +"owner table name, _, and the other side table name. The foreign key name(s) " +"referencing the owner table is the concatenation of the owner table, _, and " +"the owner primary key column(s) name. The foreign key name(s) referencing " +"the other side is the concatenation of the owner property name, _, and the " +"other side primary key column(s) name. A unique constraint is added to the " +"foreign key referencing the other side table to reflect the one to many." +msgstr "" + +#. Tag: para +#: collection_mapping.xml:135 +#, fuzzy, no-c-format +msgid "" +"Lets have a look now how collections are mapped using Hibernate mapping " +"files. In this case the first step is to chose the right mapping element. It " +"depends on the type of interface. For example, a <set> element is used for mapping properties of type Set." msgstr "" "コレクションをマッピングするためのマッピング要素は、インターフェースの型に依" "存します。例えば、 <set> 要素は Set 型のプロパティをマッピングするために使います。" +#. Tag: title +#: collection_mapping.xml:142 +#, no-c-format +msgid "Mapping a Set using <set>" +msgstr "" + +#. Tag: programlisting +#: collection_mapping.xml:144 +#, fuzzy, no-c-format +msgid "" +"<class name=\"Product\">\n" +" <id name=\"serialNumber\" column=\"productSerialNumber\"/>\n" +" <set name=\"parts\">\n" +" <key column=\"productSerialNumber\" not-null=\"true\"/>\n" +" <one-to-many class=\"Part\"/>\n" +" </set>\n" +"</class>" +msgstr "" +"<class name=\"Product\">\n" +" <id name=\"serialNumber\" column=\"productSerialNumber\"/>\n" +" <set name=\"parts\">\n" +" <key column=\"productSerialNumber\" not-null=\"true\"/>\n" +" <one-to-many class=\"Part\"/>\n" +" </set>\n" +"</class>" + #. Tag: para +#: collection_mapping.xml:147 +#, fuzzy, no-c-format +msgid "" +"In a one-to-many " +"association links the Product and " +"Part entities. This association requires the existence of " +"a foreign key column and possibly an index column to the Part table. This mapping loses certain semantics of normal Java " +"collections:" +msgstr "" +"Product から Part への関連は、 " +"Part テーブルへの外部キーカラムと、場合によってはインデッ" +"クスカラムが必要です。 <one-to-many> タグは、これが" +"一対多関連であることを表しています。" + +#. Tag: para +#: collection_mapping.xml:156 #, no-c-format msgid "" -"Apart from <set>, there is also <" -"list>, <map>, <bag>, <array> and <primitive-" -"array> mapping elements. The <map> " -"element is representative:" +"An instance of the contained entity class cannot belong to more than one " +"instance of the collection." +msgstr "" +"エンティティクラスのインスタンスは、2つ以上のコレクションのインスタンスに属し" +"てはいけません。" + +#. Tag: para +#: collection_mapping.xml:161 +#, no-c-format +msgid "" +"An instance of the contained entity class cannot appear at more than one " +"value of the collection index." +msgstr "" +"コレクションに含まれるエンティティクラスのインスタンスは、コレクションイン" +"デックスの値として2度以上現れてはいけません。" + +#. Tag: para +#: collection_mapping.xml:166 +#, no-c-format +msgid "" +"Looking closer at the used <one-to-many> tag we see " +"that it has the following options." +msgstr "" + +#. Tag: title +#: collection_mapping.xml:170 +#, no-c-format +msgid "options of <one-to-many> element" +msgstr "" + +#. Tag: programlisting +#: collection_mapping.xml:181 +#, fuzzy, no-c-format +msgid "" +"<one-to-many\n" +" class=\"ClassName\"\n" +" not-found=\"ignore|exception\"\n" +" entity-name=\"EntityName\"\n" +" node=\"element-name\"\n" +" embed-xml=\"true|false\"\n" +" />" +msgstr "" +"<one-to-many \n" +" class=\"ClassName\"\n" +" not-found=\"ignore|exception\"\n" +" entity-name=\"EntityName\"\n" +" node=\"element-name\"\n" +" embed-xml=\"true|false\"\n" +" />" + +#. Tag: para +#: collection_mapping.xml:185 +#, no-c-format +msgid "class (required): the name of the associated class." +msgstr "class (必須): 関連クラスの名前。" + +#. Tag: para +#: collection_mapping.xml:190 +#, no-c-format +msgid "" +"not-found (optional - defaults to exception): specifies how cached identifiers that reference missing rows will " +"be handled. ignore will treat a missing row as a null " +"association." +msgstr "" +"not-found (オプション - デフォルトは exception): 参照先の行がないキャッシュされた識別子をどのように扱うかを指定し" +"ます: ignore を指定すると、行がないことを関連がないものと" +"して扱います。" + +#. Tag: para +#: collection_mapping.xml:198 +#, no-c-format +msgid "" +"entity-name (optional): the entity name of the associated " +"class, as an alternative to class." +msgstr "" +"entity-name (オプション): class の代" +"替である関連クラスのエンティティ名。 class の代わりに指定" +"する、関連クラスのエンティティ名。" + +#. Tag: para +#: collection_mapping.xml:206 +#, no-c-format +msgid "" +"The <one-to-many> element does not need to declare " +"any columns. Nor is it necessary to specify the table " +"name anywhere." +msgstr "" +"<one-to-many> 要素はカラムを宣言する必要がないことに" +"注意してください。同様に テーブル 名を指定する必要もありま" +"せん。" + +#. Tag: para +#: collection_mapping.xml:211 +#, fuzzy, no-c-format +msgid "" +"If the foreign key column of a <one-to-many> " +"association is declared NOT NULL, you must declare the " +"<key> mapping not-null=\"true\" " +"or use a bidirectional association with the collection " +"mapping marked inverse=\"true\". See ." +msgstr "" +"とても重要な注意: もし <one-to-many> 関連の外部キーカラムが NOT NULLと宣言された場" +"合、 <key> マッピングに not-null=\"true\" を宣言するか、コレクションマッピングに inverse=\"true\" を付けた上で、 双方向関連を使う 必要がありま" +"す。双方向関連についてはこの章の後のほうで説明します。" + +#. Tag: para +#: collection_mapping.xml:221 +#, fuzzy, no-c-format +msgid "" +"Apart from the <set> tag as shown in , there is also <list>, <map>, <bag>, " +"<array> and <primitive-array> mapping elements. The <map> element is " +"representative:" msgstr "" "マッピング要素には <set> の他に <" "list><map><bag> があります。代表として、 <map> " "要素を下記に示します。" +#. Tag: title +#: collection_mapping.xml:229 +#, no-c-format +msgid "Elements of the <map> mapping" +msgstr "" + +#. Tag: programlisting +#: collection_mapping.xml:262 +#, fuzzy, no-c-format +msgid "" +"<map\n" +" name=\"propertyName\"\n" +" table=\"table_name\"\n" +" schema=\"schema_name\"\n" +" lazy=\"true|extra|false\"\n" +" inverse=\"true|false\"\n" +" cascade=\"all|none|save-update|delete|all-delete-orphan|delete-orphan\"\n" +" sort=\"unsorted|natural|comparatorClass\"\n" +" order-by=\"column_name asc|desc\"\n" +" where=\"arbitrary sql where condition\"\n" +" fetch=\"join|select|subselect\"\n" +" batch-size=\"N\"\n" +" access=\"field|property|ClassName\"\n" +" optimistic-lock=\"true|false\"\n" +" mutable=\"true|false\"\n" +" node=\"element-name|.\"\n" +" embed-xml=\"true|false\"\n" +">\n" +"\n" +" <key .... />\n" +" <map-key .... />\n" +" <element .... />\n" +"</map>" +msgstr "" +"<map\n" +" name=\"propertyName\"\n" +" table=\"table_name\"\n" +" schema=\"schema_name\"\n" +" lazy=\"true|extra|false\"\n" +" inverse=\"true|false\"\n" +" cascade=\"all|none|save-update|delete|all-delete-orphan|delete-orphan\"\n" +" sort=\"unsorted|natural|comparatorClass\"\n" +" order-by=\"column_name asc|desc\"\n" +" where=\"arbitrary sql where condition\"\n" +" fetch=\"join|select|subselect\"\n" +" batch-size=\"N\"\n" +" access=\"field|property|ClassName\"\n" +" optimistic-lock=\"true|false\"\n" +" mutable=\"true|false\"\n" +" node=\"element-name|.\"\n" +" embed-xml=\"true|false\"\n" +">\n" +"\n" +" <key .... />\n" +" <map-key .... />\n" +" <element .... />\n" +"</map>" + #. Tag: para +#: collection_mapping.xml:266 #, no-c-format msgid "name: the collection property name" msgstr "name :コレクション型であるプロパティの名前" #. Tag: para +#: collection_mapping.xml:270 #, no-c-format msgid "" "table (optional - defaults to property name): the name of " @@ -173,6 +553,7 @@ msgstr "" "ションテーブルの名前(一対多関連では使用しません)。" #. Tag: para +#: collection_mapping.xml:276 #, no-c-format msgid "" "schema (optional): the name of a table schema to override " @@ -182,6 +563,7 @@ msgstr "" "で宣言されているスキーマより優先されます。" #. Tag: para +#: collection_mapping.xml:281 #, no-c-format msgid "" "lazy (optional - defaults to true): " @@ -197,6 +579,7 @@ msgstr "" "なコレクションに適しています)。" #. Tag: para +#: collection_mapping.xml:290 #, no-c-format msgid "" "inverse (optional - defaults to false):このコレクションが双方向関連の「逆」側であるとマークします。" #. Tag: para +#: collection_mapping.xml:296 #, no-c-format msgid "" "cascade (optional - defaults to none): " @@ -216,6 +600,7 @@ msgstr "" "literal>):子エンティティへのカスケード操作を有効にします。" #. Tag: para +#: collection_mapping.xml:302 #, no-c-format msgid "" "sort (optional): specifies a sorted collection with " @@ -226,12 +611,13 @@ msgstr "" "指定します。" #. Tag: para -#, no-c-format +#: collection_mapping.xml:308 +#, fuzzy, no-c-format msgid "" -"order-by (optional, JDK1.4 only): specifies a table " -"column or columns that define the iteration order of the Map, Set or bag, together with an optional " -"asc or desc." +"order-by (optional): specifies a table column or columns " +"that define the iteration order of the Map, Set or bag, together with an optional asc or " +"desc." msgstr "" "order-by (オプション、 JDK1.4 のみ) MapSet、 bag のイテレーション順序を定義するテーブ" @@ -239,6 +625,7 @@ msgstr "" "desc を指定します。" #. Tag: para +#: collection_mapping.xml:316 #, no-c-format msgid "" "where (optional): specifies an arbitrary SQL " @@ -251,6 +638,7 @@ msgstr "" "分だけをコレクションが含むべきときに、これは有用です)。" #. Tag: para +#: collection_mapping.xml:324 #, no-c-format msgid "" "fetch (optional, defaults to select): " @@ -263,6 +651,7 @@ msgstr "" "選択してください。" #. Tag: para +#: collection_mapping.xml:331 #, no-c-format msgid "" "batch-size (optional, defaults to 1): " @@ -273,6 +662,7 @@ msgstr "" "を指定します。" #. Tag: para +#: collection_mapping.xml:337 #, no-c-format msgid "" "access (optional - defaults to propertyoptimistic-lock (optional - defaults to truemutable (optional - defaults to true): " @@ -308,19 +700,31 @@ msgstr "" "literal>) false 値は、コレクションの要素が変更されないこ" "とを表します (ある場合には、少しパフォーマンスを高めます)。" +#. Tag: para +#: collection_mapping.xml:360 +#, no-c-format +msgid "" +"After exploring the basic mapping of collections in the preceding paragraphs " +"we will now focus details like physical mapping considerations, indexed " +"collections and collections of value types." +msgstr "" + #. Tag: title +#: collection_mapping.xml:365 #, no-c-format msgid "Collection foreign keys" msgstr "コレクションの外部キー" #. Tag: para -#, no-c-format +#: collection_mapping.xml:367 +#, fuzzy, no-c-format msgid "" -"Collection instances are distinguished in the database by the foreign key of " -"the entity that owns the collection. This foreign key is referred to as the " -"collection key column, or columns, of the collection " -"table. The collection key column is mapped by the <key> element." +"On the database level collection instances are distinguished by the foreign " +"key of the entity that owns the collection. This foreign key is referred to " +"as the collection key column, or columns, of the " +"collection table. The collection key column is mapped by the " +"@JoinColumn annotation respectively the <" +"key> XML element." msgstr "" "コレクションのインスタンスは、データベース内では、そのコレクションを所有する" "エンティティの外部キーによって識別されます。この外部キーはコレクションテーブ" @@ -329,108 +733,279 @@ msgstr "" "ングします。" #. Tag: para -#, no-c-format +#: collection_mapping.xml:374 +#, fuzzy, no-c-format msgid "" "There can be a nullability constraint on the foreign key column. For most " "collections, this is implied. For unidirectional one-to-many associations, " -"the foreign key column is nullable by default, so you may need to specify " -"not-null=\"true\"." +"the foreign key column is nullable by default, so you may need to specify" msgstr "" "外部キーカラムには null 設定制約があるかもしれません。ほとんどのコレクション" "に当てはまるでしょう。単方向の一対多関連において、外部キーカラムはデフォルト" "で null を許す設定になっています。よって、 not-null=\"true\" を指定する必要があるかもしれません。" -#. Tag: para +#. Tag: programlisting +#: collection_mapping.xml:379 #, no-c-format +msgid "@JoinColumn(nullable=false)" +msgstr "" + +#. Tag: para +#: collection_mapping.xml:381 +#, no-c-format +msgid "or" +msgstr "" + +#. Tag: programlisting +#: collection_mapping.xml:383 +#, fuzzy, no-c-format +msgid "<key column=\"productSerialNumber\" not-null=\"true\"/>" +msgstr "<key column=\"productSerialNumber\" not-null=\"true\"/>" + +#. Tag: para +#: collection_mapping.xml:385 +#, fuzzy, no-c-format msgid "" -"The foreign key constraint can use ON DELETE CASCADE." +"The foreign key constraint can use ON DELETE CASCADE. In " +"XML this can be expressed via:" msgstr "" "外部キーの制約が ON DELETE CASCADE を使うかもしれません。" +#. Tag: programlisting +#: collection_mapping.xml:388 +#, fuzzy, no-c-format +msgid "<key column=\"productSerialNumber\" on-delete=\"cascade\"/>" +msgstr "<key column=\"productSerialNumber\" on-delete=\"cascade\"/>" + #. Tag: para +#: collection_mapping.xml:390 #, no-c-format msgid "" -"See the previous chapter for a full definition of the <key> element." +"In annotations the Hibernate specific annotation @OnDelete has to be used." +msgstr "" + +#. Tag: programlisting +#: collection_mapping.xml:393 +#, no-c-format +msgid "@OnDelete(action=OnDeleteAction.CASCADE)" +msgstr "" + +#. Tag: para +#: collection_mapping.xml:395 +#, fuzzy, no-c-format +msgid "" +"See for more information about the " +"<key> element." msgstr "" "<key> 要素のすべての定義については前の章を参照してく" "ださい。" #. Tag: title -#, no-c-format -msgid "Collection elements" -msgstr "コレクションの要素" - -#. Tag: para -#, no-c-format -msgid "" -"Collections can contain almost any other Hibernate type, including: basic " -"types, custom types, components and references to other entities. This is an " -"important distinction. An object in a collection might be handled with " -"\"value\" semantics (its life cycle fully depends on the collection owner), " -"or it might be a reference to another entity with its own life cycle. In the " -"latter case, only the \"link\" between the two objects is considered to be a " -"state held by the collection." -msgstr "" -"コレクションは他の Hibernate の型のほとんど(すべての基本型、カスタム型、コン" -"ポーネント、他のエンティティへの参照)を格納することができます。次の点は重要" -"な違いになります。コレクションに格納されたオブジェクトが「値」セマンティクス" -"として扱われるのか (ライフサイクルはコレクションのオーナーに完全に依存しま" -"す)、もしくはそれ自身のライフサイクルを持った別のエンティティへの参照である" -"かのかという違いです。後者は、2つのオブジェクト間の「リンク」をコレクションに" -"保持していると見なしているだけです。" - -#. Tag: para -#, no-c-format -msgid "" -"The contained type is referred to as the collection element type. Collection elements are mapped by <element> or <composite-element>, or in the case of " -"entity references, with <one-to-many> or " -"<many-to-many>. The first two map elements with " -"value semantics, the next two are used to map entity associations." -msgstr "" -"格納される型は コレクション要素型 と呼ばれます。コレク" -"ション要素は、 <element> または <" -"composite-element> によりマッピングされ、エンティティへの参照の" -"場合には <one-to-many> または <many-to-" -"many> によりマッピングされます。最初の二つは値として要素をマッピ" -"ングし、次の二つはエンティティの関連をマッピングするのに使われます。" - -#. Tag: title +#: collection_mapping.xml:400 #, no-c-format msgid "Indexed collections" msgstr "インデックス付きのコレクション" #. Tag: para +#: collection_mapping.xml:402 #, no-c-format msgid "" -"All collection mappings, except those with set and bag semantics, need an " -"index column in the collection table. An index column " -"is a column that maps to an array index, or List index, " -"or Map key. The index of a Map may be " -"of any basic type, mapped with <map-key>. It can be " -"an entity reference mapped with <map-key-many-to-many>, or it can be a composite type mapped with <composite-" -"map-key>. The index of an array or list is always of type " -"integer and is mapped using the <list-" -"index> element. The mapped column contains sequential integers " -"that are numbered from zero by default." +"In the following paragraphs we have a closer at the indexed collections " +"List and Map how the their " +"index can be mapped in Hibernate." +msgstr "" + +#. Tag: title +#: collection_mapping.xml:407 +#, no-c-format +msgid "Lists" msgstr "" -"set と bag を除く全てのコレクションマッピングには、コレクションテーブルの中" -"に インデックス用のカラム が必要です。そのカラムに、配列" -"や List のインデックス、もしくは Map の" -"キーをマッピングします。 Map のインデックスは、 " -"<map-key> によりマッピングされた基本型か、 " -"<map-key-many-to-many> によりマッピングされたエン" -"ティティの関連か、あるいは <composite-map-key> によ" -"りマッピングされたコンポジット型になります。配列かリストのインデックスは、常" -"に integer 型で、 <list-index> 要" -"素によりマッピングします。マッピングされたカラムにはシーケンシャルな整数を格" -"納します (デフォルトでは0から番号が付けられます)。" #. Tag: para +#: collection_mapping.xml:409 +#, no-c-format +msgid "Lists can be mapped in two different ways:" +msgstr "" + +#. Tag: para +#: collection_mapping.xml:413 +#, no-c-format +msgid "as ordered lists, where the order is not materialized in the database" +msgstr "" + +#. Tag: para +#: collection_mapping.xml:418 +#, no-c-format +msgid "as indexed lists, where the order is materialized in the database" +msgstr "" + +#. Tag: para +#: collection_mapping.xml:423 +#, no-c-format +msgid "" +"To order lists in memory, add @javax.persistence.OrderBy " +"to your property. This annotation takes as parameter a list of comma " +"separated properties (of the target entity) and orders the collection " +"accordingly (eg firstname asc, age desc), if the string is " +"empty, the collection will be ordered by the primary key of the target " +"entity." +msgstr "" + +#. Tag: title +#: collection_mapping.xml:432 +#, no-c-format +msgid "Ordered lists using @OrderBy" +msgstr "" + +#. Tag: programlisting +#: collection_mapping.xml:434 +#, no-c-format +msgid "" +"@Entity\n" +"public class Customer {\n" +" @Id @GeneratedValue public Integer getId() { return id; }\n" +" public void setId(Integer id) { this.id = id; }\n" +" private Integer id;\n" +"\n" +" @OneToMany(mappedBy=\"customer\")\n" +" @OrderBy(\"number\")\n" +" public List<Order> getOrders() { return orders; }\n" +" public void setOrders(List<Order> orders) { this.orders = " +"orders; }\n" +" private List<Order> orders;\n" +"}\n" +"\n" +"@Entity\n" +"public class Order {\n" +" @Id @GeneratedValue public Integer getId() { return id; }\n" +" public void setId(Integer id) { this.id = id; }\n" +" private Integer id;\n" +"\n" +" public String getNumber() { return number; }\n" +" public void setNumber(String number) { this.number = number; }\n" +" private String number;\n" +"\n" +" @ManyToOne\n" +" public Customer getCustomer() { return customer; }\n" +" public void setCustomer(Customer customer) { this.customer = customer; }\n" +" private Customer number;\n" +"}\n" +"\n" +"-- Table schema\n" +"|-------------| |----------|\n" +"| Order | | Customer |\n" +"|-------------| |----------|\n" +"| id | | id |\n" +"| number | |----------| \n" +"| customer_id |\n" +"|-------------|" +msgstr "" + +#. Tag: para +#: collection_mapping.xml:437 +#, no-c-format +msgid "" +"To store the index value in a dedicated column, use the @javax." +"persistence.OrderColumn annotation on your property. This " +"annotations describes the column name and attributes of the column keeping " +"the index value. This column is hosted on the table containing the " +"association foreign key. If the column name is not specified, the default is " +"the name of the referencing property, followed by underscore, followed by " +"ORDER (in the following example, it would be " +"orders_ORDER)." +msgstr "" + +#. Tag: title +#: collection_mapping.xml:448 +#, no-c-format +msgid "Explicit index column using @OrderColumn" +msgstr "" + +#. Tag: programlisting +#: collection_mapping.xml:451 +#, no-c-format +msgid "" +"@Entity\n" +"public class Customer {\n" +" @Id @GeneratedValue public Integer getId() { return id; }\n" +" public void setId(Integer id) { this.id = id; }\n" +" private Integer id;\n" +"\n" +" @OneToMany(mappedBy=\"customer\")\n" +" @OrderColumn(name=\"orders_index\")\n" +" public List<Order> getOrders() { return orders; }\n" +" public void setOrders(List<Order> orders) { this.orders = " +"orders; }\n" +" private List<Order> orders;\n" +"}\n" +"\n" +"@Entity\n" +"public class Order {\n" +" @Id @GeneratedValue public Integer getId() { return id; }\n" +" public void setId(Integer id) { this.id = id; }\n" +" private Integer id;\n" +"\n" +" public String getNumber() { return number; }\n" +" public void setNumber(String number) { this.number = number; }\n" +" private String number;\n" +"\n" +" @ManyToOne\n" +" public Customer getCustomer() { return customer; }\n" +" public void setCustomer(Customer customer) { this.customer = customer; }\n" +" private Customer number;\n" +"}\n" +"\n" +"-- Table schema\n" +"|--------------| |----------|\n" +"| Order | | Customer |\n" +"|--------------| |----------|\n" +"| id | | id |\n" +"| number | |----------| \n" +"| customer_id |\n" +"| orders_order |\n" +"|--------------|" +msgstr "" + +#. Tag: para +#: collection_mapping.xml:455 +#, no-c-format +msgid "" +"We recommend you to convert the legacy @org.hibernate.annotations." +"IndexColumn usages to @OrderColumn unless " +"you are making use of the base property. The base " +"property lets you define the index value of the first element (aka as base " +"index). The usual value is 0 or 1. The " +"default is 0 like in Java." +msgstr "" + +#. Tag: para +#: collection_mapping.xml:464 +#, no-c-format +msgid "" +"Looking again at the Hibernate mapping file equivalent, the index of an " +"array or list is always of type integer and is mapped " +"using the <list-index> element. The mapped column " +"contains sequential integers that are numbered from zero by default." +msgstr "" + +#. Tag: title +#: collection_mapping.xml:471 +#, no-c-format +msgid "index-list element for indexed collections in xml mapping" +msgstr "" + +#. Tag: programlisting +#: collection_mapping.xml:481 +#, no-c-format +msgid "" +"<list-index\n" +" column=\"column_name\"\n" +" base=\"0|1|...\"/>" +msgstr "" + +#. Tag: para +#: collection_mapping.xml:485 #, fuzzy, no-c-format msgid "" "column_name (required): the name of the column holding " @@ -438,6 +1013,7 @@ msgid "" msgstr "class (必須): 関連クラスの名前。" #. Tag: para +#: collection_mapping.xml:490 #, fuzzy, no-c-format msgid "" "base (optional - defaults to 0): the " @@ -448,49 +1024,7 @@ msgstr "" "literal>):子エンティティへのカスケード操作を有効にします。" #. Tag: para -#, fuzzy, no-c-format -msgid "" -"column (optional): the name of the column holding the " -"collection index values." -msgstr "" -"schema (オプション):テーブルスキーマの名前。ルート要素" -"で宣言されているスキーマより優先されます。" - -#. Tag: para -#, no-c-format -msgid "" -"formula (optional): a SQL formula used to evaluate the " -"key of the map." -msgstr "" - -#. Tag: para -#, fuzzy, no-c-format -msgid "type (required): the type of the map keys." -msgstr "class (必須): 関連クラスの名前。" - -#. Tag: para -#, fuzzy, no-c-format -msgid "" -"column (optional): the name of the foreign key column for " -"the collection index values." -msgstr "" -"schema (オプション):テーブルスキーマの名前。ルート要素" -"で宣言されているスキーマより優先されます。" - -#. Tag: para -#, no-c-format -msgid "" -"formula (optional): a SQ formula used to evaluate the " -"foreign key of the map key." -msgstr "" - -#. Tag: para -#, fuzzy, no-c-format -msgid "" -"class (required): the entity class used as the map key." -msgstr "class (必須): 関連クラスの名前。" - -#. Tag: para +#: collection_mapping.xml:498 #, fuzzy, no-c-format msgid "" "If your table does not have an index column, and you still wish to use " @@ -506,32 +1040,479 @@ msgstr "" "けしたり(order by)することもできます。" #. Tag: title +#: collection_mapping.xml:506 #, no-c-format -msgid "Collections of values and many-to-many associations" +msgid "Maps" +msgstr "" + +#. Tag: para +#: collection_mapping.xml:508 +#, no-c-format +msgid "" +"The question with Maps is where the key value is " +"stored. There are everal options. Maps can borrow their keys from one of the " +"associated entity properties or have dedicated columns to store an explicit " +"key." +msgstr "" + +#. Tag: para +#: collection_mapping.xml:513 +#, no-c-format +msgid "" +"To use one of the target entity property as a key of the map, use " +"@MapKey(name=\"myProperty\"), where myProperty is a property name in the target entity. When using " +"@MapKey without the name attribuate, the target entity " +"primary key is used. The map key uses the same column as the property " +"pointed out. There is no additional column defined to hold the map key, " +"because the map key represent a target property. Be aware that once loaded, " +"the key is no longer kept in sync with the property. In other words, if you " +"change the property value, the key will not change automatically in your " +"Java model." +msgstr "" + +#. Tag: title +#: collection_mapping.xml:525 +#, no-c-format +msgid "" +"Use of target entity property as map key via @MapKey" +msgstr "" + +#. Tag: programlisting +#: collection_mapping.xml:528 +#, no-c-format +msgid "" +"@Entity\n" +"public class Customer {\n" +" @Id @GeneratedValue public Integer getId() { return id; }\n" +" public void setId(Integer id) { this.id = id; }\n" +" private Integer id;\n" +"\n" +" @OneToMany(mappedBy=\"customer\")\n" +" @MapKey(name=\"number\")\n" +" public Map<String,Order> getOrders() { return orders; }\n" +" public void setOrders(Map<String,Order> order) { this.orders = " +"orders; }\n" +" private Map<String,Order> orders;\n" +"}\n" +"\n" +"@Entity\n" +"public class Order {\n" +" @Id @GeneratedValue public Integer getId() { return id; }\n" +" public void setId(Integer id) { this.id = id; }\n" +" private Integer id;\n" +"\n" +" public String getNumber() { return number; }\n" +" public void setNumber(String number) { this.number = number; }\n" +" private String number;\n" +"\n" +" @ManyToOne\n" +" public Customer getCustomer() { return customer; }\n" +" public void setCustomer(Customer customer) { this.customer = customer; }\n" +" private Customer number;\n" +"}\n" +"\n" +"-- Table schema\n" +"|-------------| |----------|\n" +"| Order | | Customer |\n" +"|-------------| |----------|\n" +"| id | | id |\n" +"| number | |----------| \n" +"| customer_id |\n" +"|-------------|" +msgstr "" + +#. Tag: para +#: collection_mapping.xml:531 +#, no-c-format +msgid "" +"Alternatively the map key is mapped to a dedicated column or columns. In " +"order to customize the mapping use one of the following annotations:" +msgstr "" + +#. Tag: para +#: collection_mapping.xml:537 +#, no-c-format +msgid "" +"@MapKeyColumn if the map key is a basic type. If you " +"don't specify the column name, the name of the property followed by " +"underscore followed by KEY is used (for example " +"orders_KEY)." +msgstr "" + +#. Tag: para +#: collection_mapping.xml:544 +#, no-c-format +msgid "" +"@MapKeyEnumerated / @MapKeyTemporal if the map key type is respectively an enum or a Date." +msgstr "" + +#. Tag: para +#: collection_mapping.xml:550 +#, no-c-format +msgid "" +"@MapKeyJoinColumn/@MapKeyJoinColumns if the map key type is another entity." +msgstr "" + +#. Tag: para +#: collection_mapping.xml:555 +#, no-c-format +msgid "" +"@AttributeOverride/@AttributeOverrides when the map key is a embeddable object. Use key. as a prefix for your embeddable object property names." +msgstr "" + +#. Tag: para +#: collection_mapping.xml:562 +#, no-c-format +msgid "" +"You can also use @MapKeyClass to define the type of " +"the key if you don't use generics." +msgstr "" + +#. Tag: title +#: collection_mapping.xml:566 +#, no-c-format +msgid "Map key as basic type using @MapKeyColumn" +msgstr "" + +#. Tag: programlisting +#: collection_mapping.xml:569 +#, no-c-format +msgid "" +"@Entity\n" +"public class Customer {\n" +" @Id @GeneratedValue public Integer getId() { return id; }\n" +" public void setId(Integer id) { this.id = id; }\n" +" private Integer id;\n" +"\n" +" @OneToMany @JoinTable(name=\"Cust_Order\")\n" +" @MapKeyColumn(name=\"orders_number\")\n" +" public Map<String,Order> getOrders() { return orders; }\n" +" public void setOrders(Map<String,Order> orders) { this.orders = " +"orders; }\n" +" private Map<String,Order> orders;\n" +"}\n" +"\n" +"@Entity\n" +"public class Order {\n" +" @Id @GeneratedValue public Integer getId() { return id; }\n" +" public void setId(Integer id) { this.id = id; }\n" +" private Integer id;\n" +"\n" +" public String getNumber() { return number; }\n" +" public void setNumber(String number) { this.number = number; }\n" +" private String number;\n" +"\n" +" @ManyToOne\n" +" public Customer getCustomer() { return customer; }\n" +" public void setCustomer(Customer customer) { this.customer = customer; }\n" +" private Customer number;\n" +"}\n" +"\n" +"-- Table schema\n" +"|-------------| |----------| |---------------|\n" +"| Order | | Customer | | Cust_Order |\n" +"|-------------| |----------| |---------------|\n" +"| id | | id | | customer_id |\n" +"| number | |----------| | order_id |\n" +"| customer_id | | orders_number |\n" +"|-------------| |---------------|" +msgstr "" + +#. Tag: para +#: collection_mapping.xml:573 +#, no-c-format +msgid "" +"We recommend you to migrate from @org.hibernate.annotations." +"MapKey / @org.hibernate.annotation.MapKeyManyToMany to the new standard approach described above" +msgstr "" + +#. Tag: para +#: collection_mapping.xml:579 +#, fuzzy, no-c-format +msgid "" +"Using Hibernate mapping files there exists equivalent concepts to the " +"descibed annotations. You have to use <map-key>, " +"<map-key-many-to-many> and <composite-" +"map-key>. <map-key> is used for any " +"basic type, <map-key-many-to-many> for an entity " +"reference and <composite-map-key> for a composite " +"type." +msgstr "" +"マッピング要素には <set> の他に <" +"list><map><bag><array><primitive-" +"array> があります。代表として、 <map> " +"要素を下記に示します。" + +#. Tag: title +#: collection_mapping.xml:590 +#, no-c-format +msgid "map-key xml mapping element" +msgstr "" + +#. Tag: programlisting +#: collection_mapping.xml:601 +#, no-c-format +msgid "" +"<map-key\n" +" column=\"column_name\"\n" +" formula=\"any SQL expression\"\n" +" type=\"type_name\"\n" +" node=\"@attribute-name\"\n" +" length=\"N\"/>" +msgstr "" + +#. Tag: para +#: collection_mapping.xml:605 +#, fuzzy, no-c-format +msgid "" +"column (optional): the name of the column holding the " +"collection index values." +msgstr "" +"schema (オプション):テーブルスキーマの名前。ルート要素" +"で宣言されているスキーマより優先されます。" + +#. Tag: para +#: collection_mapping.xml:610 +#, no-c-format +msgid "" +"formula (optional): a SQL formula used to evaluate the " +"key of the map." +msgstr "" + +#. Tag: para +#: collection_mapping.xml:615 +#, fuzzy, no-c-format +msgid "type (required): the type of the map keys." +msgstr "class (必須): 関連クラスの名前。" + +#. Tag: title +#: collection_mapping.xml:623 +#, fuzzy, no-c-format +msgid "map-key-many-to-many" +msgstr "many-to-many" + +#. Tag: programlisting +#: collection_mapping.xml:634 +#, no-c-format +msgid "" +"<map-key-many-to-many\n" +" column=\"column_name\"\n" +" formula=\"any SQL expression\"\n" +" class=\"ClassName\"\n" +"/>" +msgstr "" + +#. Tag: para +#: collection_mapping.xml:638 +#, fuzzy, no-c-format +msgid "" +"column (optional): the name of the foreign key column for " +"the collection index values." +msgstr "" +"schema (オプション):テーブルスキーマの名前。ルート要素" +"で宣言されているスキーマより優先されます。" + +#. Tag: para +#: collection_mapping.xml:643 +#, no-c-format +msgid "" +"formula (optional): a SQ formula used to evaluate the " +"foreign key of the map key." +msgstr "" + +#. Tag: para +#: collection_mapping.xml:648 +#, fuzzy, no-c-format +msgid "" +"class (required): the entity class used as the map key." +msgstr "class (必須): 関連クラスの名前。" + +#. Tag: title +#: collection_mapping.xml:658 +#, fuzzy, no-c-format +msgid "Collections of basic types and embeddable objects" msgstr "値のコレクションと多対多関連" #. Tag: para +#: collection_mapping.xml:660 #, no-c-format msgid "" -"Any collection of values or many-to-many associations requires a dedicated " -"collection table with a foreign key column or columns, " -"collection element column or columns, and possibly an " -"index column or columns." +"In some situations you don't need to associate two entities but simply " +"create a collection of basic types or embeddable objects. Use the " +"@ElementCollection for this case." +msgstr "" + +#. Tag: title +#: collection_mapping.xml:665 +#, no-c-format +msgid "" +"Collection of basic types mapped via @ElementCollection" +msgstr "" + +#. Tag: programlisting +#: collection_mapping.xml:668 +#, no-c-format +msgid "" +"@Entity\n" +"public class User {\n" +" [...]\n" +" public String getLastname() { ...}\n" +"\n" +" @ElementCollection\n" +" @CollectionTable(name=\"Nicknames\", joinColumns=@JoinColumn(name=" +"\"user_id\"))\n" +" @Column(name=\"nickname\")\n" +" public Set<String> getNicknames() { ... } \n" +"}" msgstr "" -"値のコレクションや多対多関連は、専用の コレクションテーブル が必要です。このテーブルは、外部キーカラムと、 コレクショ" -"ン要素のカラム と、場合によってはインデックスカラムを持ちます。" #. Tag: para +#: collection_mapping.xml:671 #, no-c-format msgid "" -"For a collection of values use the <element> tag. " -"For example:" +"The collection table holding the collection data is set using the " +"@CollectionTable annotation. If omitted the " +"collection table name defaults to the concatenation of the name of the " +"containing entity and the name of the collection attribute, separated by an " +"underscore. In our example, it would be User_nicknames." +msgstr "" + +#. Tag: para +#: collection_mapping.xml:678 +#, no-c-format +msgid "" +"The column holding the basic type is set using the @Column annotation. If omitted, the column name defaults to the property " +"name: in our example, it would be nicknames." +msgstr "" + +#. Tag: para +#: collection_mapping.xml:683 +#, no-c-format +msgid "" +"But you are not limited to basic types, the collection type can be any " +"embeddable object. To override the columns of the embeddable object in the " +"collection table, use the @AttributeOverride " +"annotation." +msgstr "" + +#. Tag: title +#: collection_mapping.xml:689 +#, no-c-format +msgid "@ElementCollection for embeddable objects" +msgstr "" + +#. Tag: programlisting +#: collection_mapping.xml:691 +#, no-c-format +msgid "" +"@Entity\n" +"public class User {\n" +" [...]\n" +" public String getLastname() { ...}\n" +"\n" +" @ElementCollection\n" +" @CollectionTable(name=\"Addresses\", joinColumns=@JoinColumn(name=" +"\"user_id\"))\n" +" @AttributeOverrides({\n" +" @AttributeOverride(name=\"street1\", column=@Column(name=\"fld_street" +"\"))\n" +" })\n" +" public Set<Address> getAddresses() { ... } \n" +"}\n" +"\n" +"@Embeddable\n" +"public class Address {\n" +" public String getStreet1() {...}\n" +" [...]\n" +"}" +msgstr "" + +#. Tag: para +#: collection_mapping.xml:694 +#, no-c-format +msgid "Such an embeddable object cannot contains a collection itself." +msgstr "" + +#. Tag: para +#: collection_mapping.xml:698 +#, no-c-format +msgid "" +"in @AttributeOverride, you must use the " +"value. prefix to override properties of the embeddable " +"object used in the map value and the key. prefix to " +"override properties of the embeddable object used in the map key." +msgstr "" + +#. Tag: programlisting +#: collection_mapping.xml:704 +#, no-c-format +msgid "" +"@Entity\n" +"public class User {\n" +" @ElementCollection\n" +" @AttributeOverrides({\n" +" @AttributeOverride(name=\"key.street1\", column=@Column(name=" +"\"fld_street\")),\n" +" @AttributeOverride(name=\"value.stars\", column=@Column(name=\"fld_note" +"\"))\n" +" })\n" +" public Map<Address,Rating> getFavHomes() { ... }" +msgstr "" + +#. Tag: para +#: collection_mapping.xml:708 +#, no-c-format +msgid "" +"We recommend you to migrate from @org.hibernate.annotations." +"CollectionOfElements to the new @ElementCollection annotation." +msgstr "" + +#. Tag: para +#: collection_mapping.xml:714 +#, fuzzy, no-c-format +msgid "" +"Using the mapping file approach a collection of values is mapped using the " +"<element> tag. For example:" msgstr "" "値のコレクションのために、 <element> タグを使用しま" "す。" +#. Tag: title +#: collection_mapping.xml:718 +#, no-c-format +msgid "<element> tag for collection values using mapping files" +msgstr "" + +#. Tag: programlisting +#: collection_mapping.xml:730 +#, no-c-format +msgid "" +"<element\n" +" column=\"column_name\"\n" +" formula=\"any SQL expression\"\n" +" type=\"typename\"\n" +" length=\"L\"\n" +" precision=\"P\"\n" +" scale=\"S\"\n" +" not-null=\"true|false\"\n" +" unique=\"true|false\"\n" +" node=\"element-name\"\n" +"/>" +msgstr "" + #. Tag: para +#: collection_mapping.xml:734 #, fuzzy, no-c-format msgid "" "column (optional): the name of the column holding the " @@ -541,6 +1522,7 @@ msgstr "" "で宣言されているスキーマより優先されます。" #. Tag: para +#: collection_mapping.xml:739 #, fuzzy, no-c-format msgid "" "formula (optional): an SQL formula used to evaluate the " @@ -550,243 +1532,101 @@ msgstr "" "で宣言されているスキーマより優先されます。" #. Tag: para +#: collection_mapping.xml:744 #, fuzzy, no-c-format msgid "type (required): the type of the collection element." msgstr "class (必須): 関連クラスの名前。" -#. Tag: para -#, no-c-format -msgid "" -"A many-to-many association is specified using the " -"<many-to-many> element." -msgstr "" - -#. Tag: para -#, fuzzy, no-c-format -msgid "" -"column (optional): the name of the element foreign key " -"column." -msgstr "class (必須): 関連クラスの名前。" - -#. Tag: para -#, no-c-format -msgid "" -"formula (optional): an SQL formula used to evaluate the " -"element foreign key value." -msgstr "" - -#. Tag: para -#, no-c-format -msgid "class (required): the name of the associated class." -msgstr "class (必須): 関連クラスの名前。" - -#. Tag: para -#, no-c-format -msgid "" -"fetch (optional - defaults to join): " -"enables outer-join or sequential select fetching for this association. This " -"is a special case; for full eager fetching in a single SELECT of an entity and its many-to-many relationships to other entities, " -"you would enable join fetching,not only of the collection " -"itself, but also with this attribute on the <many-to-many> nested element." -msgstr "" - -#. Tag: para -#, no-c-format -msgid "" -"unique (optional): enables the DDL generation of a unique " -"constraint for the foreign-key column. This makes the association " -"multiplicity effectively one-to-many." -msgstr "" - -#. Tag: para -#, fuzzy, no-c-format -msgid "" -"not-found (optional - defaults to exception): specifies how foreign keys that reference missing rows will be " -"handled: ignore will treat a missing row as a null " -"association." -msgstr "" -"not-found (オプション - デフォルトは exception): 参照先の行がないキャッシュされた識別子をどのように扱うかを指定し" -"ます: ignore を指定すると、行がないことを関連がないものと" -"して扱います。" - -#. Tag: para -#, no-c-format -msgid "" -"entity-name (optional): the entity name of the associated " -"class, as an alternative to class." -msgstr "" -"entity-name (オプション): class の代" -"替である関連クラスのエンティティ名。 class の代わりに指定" -"する、関連クラスのエンティティ名。" - -#. Tag: para -#, no-c-format -msgid "" -"property-ref (optional): the name of a property of the " -"associated class that is joined to this foreign key. If not specified, the " -"primary key of the associated class is used." -msgstr "" - -#. Tag: para -#, no-c-format -msgid "Here are some examples." -msgstr "" - -#. Tag: para -#, no-c-format -msgid "A set of strings:" -msgstr "" - -#. Tag: para -#, no-c-format -msgid "" -"A bag containing integers with an iteration order determined by the " -"order-by attribute:" -msgstr "" -"整数値を含む bag (bagは order-by 属性によって反復順序が定" -"義されています):" - -#. Tag: para -#, no-c-format -msgid "An array of entities, in this case, a many-to-many association:" -msgstr "エンティティの配列 - この場合、多対多の関連です。" - -#. Tag: para -#, no-c-format -msgid "A map from string indices to dates:" -msgstr "文字列と日付の map" - -#. Tag: para -#, no-c-format -msgid "A list of components (this is discussed in the next chapter):" -msgstr "コンポーネントの list (次の章で詳しく説明します)" - -#. Tag: title -#, no-c-format -msgid "One-to-many associations" -msgstr "一対多関連" - -#. Tag: para -#, no-c-format -msgid "" -"A one-to-many association links the tables of two " -"classes via a foreign key with no intervening collection table. This mapping " -"loses certain semantics of normal Java collections:" -msgstr "" -"一対多関連 は、コレクションテーブルを介さず、外部キーに" -"より2つのクラスのテーブルを関連付けます。このマッピングは標準的な Java のコレ" -"クションのセマンティクスをいくつか失います:" - -#. Tag: para -#, no-c-format -msgid "" -"An instance of the contained entity class cannot belong to more than one " -"instance of the collection." -msgstr "" -"エンティティクラスのインスタンスは、2つ以上のコレクションのインスタンスに属し" -"てはいけません。" - -#. Tag: para -#, no-c-format -msgid "" -"An instance of the contained entity class cannot appear at more than one " -"value of the collection index." -msgstr "" -"コレクションに含まれるエンティティクラスのインスタンスは、コレクションイン" -"デックスの値として2度以上現れてはいけません。" - -#. Tag: para -#, no-c-format -msgid "" -"An association from Product to Part " -"requires the existence of a foreign key column and possibly an index column " -"to the Part table. A <one-to-many> tag indicates that this is a one-to-many association." -msgstr "" -"Product から Part への関連は、 " -"Part テーブルへの外部キーカラムと、場合によってはインデッ" -"クスカラムが必要です。 <one-to-many> タグは、これが" -"一対多関連であることを表しています。" - -#. Tag: para -#, no-c-format -msgid "" -"not-found (optional - defaults to exception): specifies how cached identifiers that reference missing rows will " -"be handled. ignore will treat a missing row as a null " -"association." -msgstr "" -"not-found (オプション - デフォルトは exception): 参照先の行がないキャッシュされた識別子をどのように扱うかを指定し" -"ます: ignore を指定すると、行がないことを関連がないものと" -"して扱います。" - -#. Tag: para -#, no-c-format -msgid "" -"The <one-to-many> element does not need to declare " -"any columns. Nor is it necessary to specify the table " -"name anywhere." -msgstr "" -"<one-to-many> 要素はカラムを宣言する必要がないことに" -"注意してください。同様に テーブル 名を指定する必要もありま" -"せん。" - -#. Tag: para -#, fuzzy, no-c-format -msgid "" -"If the foreign key column of a <one-to-many> " -"association is declared NOT NULL, you must declare the " -"<key> mapping not-null=\"true\" " -"or use a bidirectional association with the collection " -"mapping marked inverse=\"true\". See the discussion of " -"bidirectional associations later in this chapter for more information." -msgstr "" -"とても重要な注意: もし <one-to-many> 関連の外部キーカラムが NOT NULLと宣言された場" -"合、 <key> マッピングに not-null=\"true\" を宣言するか、コレクションマッピングに inverse=\"true\" を付けた上で、 双方向関連を使う 必要がありま" -"す。双方向関連についてはこの章の後のほうで説明します。" - -#. Tag: para -#, no-c-format -msgid "" -"The following example shows a map of Part entities by " -"name, where partName is a persistent property of " -"Part. Notice the use of a formula-based index:" -msgstr "" -"次の例は、名称(Part の永続的なプロパティである " -"partName) による Part エンティティの " -"map を表しています。 formula によるインデックスを使っていることに注意してくだ" -"さい。" - #. Tag: title +#: collection_mapping.xml:754 #, no-c-format msgid "Advanced collection mappings" msgstr "高度なコレクションマッピング" #. Tag: title +#: collection_mapping.xml:757 #, no-c-format msgid "Sorted collections" msgstr "ソートされたコレクション" #. Tag: para +#: collection_mapping.xml:759 #, no-c-format msgid "" "Hibernate supports collections implementing java.util.SortedMap and java.util.SortedSet. You must specify a " -"comparator in the mapping file:" +"literal> and java.util.SortedSet. With annotations you " +"declare a sort comparator using @Sort. You chose between " +"the comparator types unsorted, natural or custom. If you want to use your " +"own comparator implementation, you'll also have to specify the " +"implementation class using the comparator attribute. Note " +"that you need to use either a SortedSet or a " +"SortedMap interface." +msgstr "" + +#. Tag: title +#: collection_mapping.xml:770 +#, fuzzy, no-c-format +msgid "Sorted collection with @Sort" +msgstr "ソートされたコレクション" + +#. Tag: programlisting +#: collection_mapping.xml:772 +#, no-c-format +msgid "" +"@OneToMany(cascade=CascadeType.ALL, fetch=FetchType.EAGER)\n" +"@JoinColumn(name=\"CUST_ID\")\n" +"@Sort(type = SortType.COMPARATOR, comparator = TicketComparator.class)\n" +"public SortedSet<Ticket> getTickets() {\n" +" return tickets;\n" +"}" msgstr "" -"Hibernate は java.util.SortedMapjava.util." -"SortedSet を実装したコレクションをサポートしています。開発者はマッ" -"ピング定義ファイルにコンパレータを指定しなければなりません: " #. Tag: para +#: collection_mapping.xml:775 +#, no-c-format +msgid "" +"Using Hibernate mapping files you specify a comparator in the mapping file " +"with <sort>:" +msgstr "" + +#. Tag: title +#: collection_mapping.xml:779 +#, fuzzy, no-c-format +msgid "Sorted collection using xml mapping" +msgstr "ソートされたコレクション" + +#. Tag: programlisting +#: collection_mapping.xml:781 +#, fuzzy, no-c-format +msgid "" +"<set name=\"aliases\"\n" +" table=\"person_aliases\" \n" +" sort=\"natural\">\n" +" <key column=\"person\"/>\n" +" <element column=\"name\" type=\"string\"/>\n" +"</set>\n" +"\n" +"<map name=\"holidays\" sort=\"my.custom.HolidayComparator\">\n" +" <key column=\"year_id\"/>\n" +" <map-key column=\"hol_name\" type=\"string\"/>\n" +" <element column=\"hol_date\" type=\"date\"/>\n" +"</map>" +msgstr "" +"<set name=\"aliases\" \n" +" table=\"person_aliases\" \n" +" sort=\"natural\">\n" +" <key column=\"person\"/>\n" +" <element column=\"name\" type=\"string\"/>\n" +"</set>\n" +"\n" +"<map name=\"holidays\" sort=\"my.custom.HolidayComparator\">\n" +" <key column=\"year_id\"/>\n" +" <map-key column=\"hol_name\" type=\"string\"/>\n" +" <element column=\"hol_date\" type=\"date\"/>\n" +"</map>" + +#. Tag: para +#: collection_mapping.xml:784 #, no-c-format msgid "" "Allowed values of the sort attribute are " @@ -798,6 +1638,7 @@ msgstr "" "を実装したクラスの名前です。" #. Tag: para +#: collection_mapping.xml:789 #, no-c-format msgid "" "Sorted collections actually behave like java.util.TreeSet " @@ -807,14 +1648,15 @@ msgstr "" "java.util.TreeMap のように振舞います。" #. Tag: para -#, no-c-format +#: collection_mapping.xml:794 +#, fuzzy, no-c-format msgid "" "If you want the database itself to order the collection elements, use the " "order-by attribute of set, " "bag or map mappings. This solution is " -"only available under JDK 1.4 or higher and is implemented using " -"LinkedHashSet or LinkedHashMap. This " -"performs the ordering in the SQL query and not in the memory." +"implemented using LinkedHashSet or " +"LinkedHashMap and performs the ordering in the SQL query " +"and not in the memory." msgstr "" "もしデータベース自身にコレクションの要素を並べさせたいなら、 setbagmaporder-" @@ -824,11 +1666,47 @@ msgstr "" "はなく、 SQL クエリ内で実行されます。" #. Tag: title +#: collection_mapping.xml:802 +#, no-c-format +msgid "Sorting in database using order-by" +msgstr "" + +#. Tag: programlisting +#: collection_mapping.xml:804 +#, fuzzy, no-c-format +msgid "" +"<set name=\"aliases\" table=\"person_aliases\" order-by=\"lower(name) asc" +"\">\n" +" <key column=\"person\"/>\n" +" <element column=\"name\" type=\"string\"/>\n" +"</set>\n" +"\n" +"<map name=\"holidays\" order-by=\"hol_date, hol_name\">\n" +" <key column=\"year_id\"/>\n" +" <map-key column=\"hol_name\" type=\"string\"/>\n" +" <element column=\"hol_date type=\"date\"/>\n" +"</map>" +msgstr "" +"<set name=\"aliases\" table=\"person_aliases\" order-by=\"lower(name) asc" +"\">\n" +" <key column=\"person\"/>\n" +" <element column=\"name\" type=\"string\"/>\n" +"</set>\n" +"\n" +"<map name=\"holidays\" order-by=\"hol_date, hol_name\">\n" +" <key column=\"year_id\"/>\n" +" <map-key column=\"hol_name\" type=\"string\"/>\n" +" <element column=\"hol_date type=\"date\"/>\n" +"</map>" + +#. Tag: title +#: collection_mapping.xml:808 #, no-c-format msgid "Note" msgstr "注記" #. Tag: para +#: collection_mapping.xml:810 #, fuzzy, no-c-format msgid "" "The value of the order-by attribute is an SQL ordering, " @@ -838,6 +1716,7 @@ msgstr "" "とに注意してください。" #. Tag: para +#: collection_mapping.xml:814 #, no-c-format msgid "" "Associations can even be sorted by arbitrary criteria at runtime using a " @@ -847,11 +1726,29 @@ msgstr "" "の criteria によってソートすることも可能です。" #. Tag: title +#: collection_mapping.xml:818 +#, no-c-format +msgid "Sorting via a query filter" +msgstr "" + +#. Tag: programlisting +#: collection_mapping.xml:820 +#, fuzzy, no-c-format +msgid "" +"sortedUsers = s.createFilter( group.getUsers(), \"order by this.name\" ).list" +"();" +msgstr "" +"sortedUsers = s.createFilter( group.getUsers(), \"order by this.name\" ).list" +"();" + +#. Tag: title +#: collection_mapping.xml:825 #, no-c-format msgid "Bidirectional associations" msgstr "双方向関連" #. Tag: para +#: collection_mapping.xml:827 #, no-c-format msgid "" "A bidirectional association allows navigation from both " @@ -862,31 +1759,361 @@ msgstr "" "きます。2種類の双方向関連がサポートされています:" #. Tag: term +#: collection_mapping.xml:831 #, no-c-format msgid "one-to-many" msgstr "one-to-many" #. Tag: para +#: collection_mapping.xml:834 #, no-c-format msgid "set or bag valued at one end and single-valued at the other" msgstr "片側が set か bag 、もう片方が単一値です。" #. Tag: term +#: collection_mapping.xml:840 #, no-c-format msgid "many-to-many" msgstr "many-to-many" #. Tag: para +#: collection_mapping.xml:843 #, no-c-format msgid "set or bag valued at both ends" msgstr "両側が set か bag です。" #. Tag: para +#: collection_mapping.xml:848 #, no-c-format msgid "" -"You can specify a bidirectional many-to-many association by mapping two many-" -"to-many associations to the same database table and declaring one end as " -"inverse. You cannot select an indexed collection." +"Often there exists a many to one association which is the owner side of a " +"bidirectional relationship. The corresponding one to many association is in " +"this case annotated by @OneToMany(mappedBy=...)" +msgstr "" + +#. Tag: title +#: collection_mapping.xml:854 +#, no-c-format +msgid "Bidirectional one to many with many to one side as association owner" +msgstr "" + +#. Tag: programlisting +#: collection_mapping.xml:857 +#, no-c-format +msgid "" +"@Entity\n" +"public class Troop {\n" +" @OneToMany(mappedBy=\"troop\")\n" +" public Set<Soldier> getSoldiers() {\n" +" ...\n" +"}\n" +"\n" +"@Entity\n" +"public class Soldier {\n" +" @ManyToOne\n" +" @JoinColumn(name=\"troop_fk\")\n" +" public Troop getTroop() {\n" +" ...\n" +"}" +msgstr "" + +#. Tag: para +#: collection_mapping.xml:860 +#, no-c-format +msgid "" +"Troop has a bidirectional one to many relationship " +"with Soldier through the troop " +"property. You don't have to (must not) define any physical mapping in the " +"mappedBy side." +msgstr "" + +#. Tag: para +#: collection_mapping.xml:865 +#, no-c-format +msgid "" +"To map a bidirectional one to many, with the one-to-many side as the owning " +"side, you have to remove the mappedBy element and set the " +"many to one @JoinColumn as insertable and updatable to " +"false. This solution is not optimized and will produce additional UPDATE " +"statements." +msgstr "" + +#. Tag: title +#: collection_mapping.xml:872 +#, fuzzy, no-c-format +msgid "Bidirectional associtaion with one to many side as owner" +msgstr "インデックス付きコレクションと双方向関連" + +#. Tag: programlisting +#: collection_mapping.xml:875 +#, no-c-format +msgid "" +"@Entity\n" +"public class Troop {\n" +" @OneToMany\n" +" @JoinColumn(name=\"troop_fk\") //we need to duplicate the physical " +"information\n" +" public Set<Soldier> getSoldiers() {\n" +" ...\n" +"}\n" +"\n" +"@Entity\n" +"public class Soldier {\n" +" @ManyToOne\n" +" @JoinColumn(name=\"troop_fk\", insertable=false, updatable=false)\n" +" public Troop getTroop() {\n" +" ...\n" +"}" +msgstr "" + +#. Tag: para +#: collection_mapping.xml:878 +#, fuzzy, no-c-format +msgid "" +"How does the mappping of a bidirectional mapping look like in Hibernate " +"mapping xml? There you define a bidirectional one-to-many association by " +"mapping a one-to-many association to the same table column(s) as a many-to-" +"one association and declaring the many-valued end inverse=\"true\"." +msgstr "" +"双方向の一対多関連を定義するには、一対多関連を多対一関連と同じテーブルのカラ" +"ムにマッピングし、多側に inverse=\"true\" と宣言します。" + +#. Tag: title +#: collection_mapping.xml:885 +#, no-c-format +msgid "Bidirectional one to many via Hibernate mapping files" +msgstr "" + +#. Tag: programlisting +#: collection_mapping.xml:887 +#, fuzzy, no-c-format +msgid "" +"<class name=\"Parent\">\n" +" <id name=\"id\" column=\"parent_id\"/>\n" +" ....\n" +" <set name=\"children\" inverse=\"true\">\n" +" <key column=\"parent_id\"/>\n" +" <one-to-many class=\"Child\"/>\n" +" </set>\n" +"</class>\n" +"\n" +"<class name=\"Child\">\n" +" <id name=\"id\" column=\"child_id\"/>\n" +" ....\n" +" <many-to-one name=\"parent\" \n" +" class=\"Parent\" \n" +" column=\"parent_id\"\n" +" not-null=\"true\"/>\n" +"</class>" +msgstr "" +"<class name=\"Parent\">\n" +" <id name=\"id\" column=\"parent_id\"/>\n" +" ....\n" +" <set name=\"children\" inverse=\"true\">\n" +" <key column=\"parent_id\"/>\n" +" <one-to-many class=\"Child\"/>\n" +" </set>\n" +"</class>\n" +"\n" +"<class name=\"Child\">\n" +" <id name=\"id\" column=\"child_id\"/>\n" +" ....\n" +" <many-to-one name=\"parent\" \n" +" class=\"Parent\" \n" +" column=\"parent_id\"\n" +" not-null=\"true\"/>\n" +"</class>" + +#. Tag: para +#: collection_mapping.xml:890 +#, no-c-format +msgid "" +"Mapping one end of an association with inverse=\"true\" " +"does not affect the operation of cascades as these are orthogonal concepts." +msgstr "" +"関連の片側に inverse=\"true\" を設定しても、カスケード操作" +"に影響を与えません。これらは直交した概念です。" + +#. Tag: para +#: collection_mapping.xml:894 +#, no-c-format +msgid "" +"A many-to-many association is defined logically using the " +"@ManyToMany annotation. You also have to describe the " +"association table and the join conditions using the @JoinTable annotation. If the association is bidirectional, one side has to be " +"the owner and one side has to be the inverse end (ie. it will be ignored " +"when updating the relationship values in the association table):" +msgstr "" + +#. Tag: title +#: collection_mapping.xml:903 +#, no-c-format +msgid "Many to many association via @ManyToMany" +msgstr "" + +#. Tag: programlisting +#: collection_mapping.xml:905 +#, no-c-format +msgid "" +"@Entity\n" +"public class Employer implements Serializable {\n" +" @ManyToMany(\n" +" targetEntity=org.hibernate.test.metadata.manytomany.Employee.class,\n" +" cascade={CascadeType.PERSIST, CascadeType.MERGE}\n" +" )\n" +" @JoinTable(\n" +" name=\"EMPLOYER_EMPLOYEE\",\n" +" joinColumns=@JoinColumn(name=\"EMPER_ID\"),\n" +" inverseJoinColumns=@JoinColumn(name=\"EMPEE_ID\")\n" +" )\n" +" public Collection getEmployees() {\n" +" return employees;\n" +" }\n" +" ...\n" +"}" +msgstr "" + +#. Tag: programlisting +#: collection_mapping.xml:907 +#, no-c-format +msgid "" +"@Entity\n" +"public class Employee implements Serializable {\n" +" @ManyToMany(\n" +" cascade = {CascadeType.PERSIST, CascadeType.MERGE},\n" +" mappedBy = \"employees\",\n" +" targetEntity = Employer.class\n" +" )\n" +" public Collection getEmployers() {\n" +" return employers;\n" +" }\n" +"}" +msgstr "" + +#. Tag: para +#: collection_mapping.xml:910 +#, no-c-format +msgid "" +"In this example @JoinTable defines a name, an array of join columns, and an array of inverse join columns. " +"The latter ones are the columns of the association table which refer to the " +"Employee primary key (the \"other side\"). As seen " +"previously, the other side don't have to (must not) describe the physical " +"mapping: a simple mappedBy argument containing the owner " +"side property name bind the two." +msgstr "" + +#. Tag: para +#: collection_mapping.xml:919 +#, no-c-format +msgid "" +"As any other annotations, most values are guessed in a many to many " +"relationship. Without describing any physical mapping in a unidirectional " +"many to many the following rules applied. The table name is the " +"concatenation of the owner table name, _ and the other side " +"table name. The foreign key name(s) referencing the owner table is the " +"concatenation of the owner table name, _ and the owner " +"primary key column(s). The foreign key name(s) referencing the other side is " +"the concatenation of the owner property name, _, and the " +"other side primary key column(s). These are the same rules used for a " +"unidirectional one to many relationship." +msgstr "" + +#. Tag: title +#: collection_mapping.xml:932 +#, no-c-format +msgid "Default values for @ManyToMany (uni-directional)" +msgstr "" + +#. Tag: programlisting +#: collection_mapping.xml:935 +#, no-c-format +msgid "" +"@Entity\n" +"public class Store {\n" +" @ManyToMany(cascade = CascadeType.PERSIST)\n" +" public Set<City> getImplantedIn() {\n" +" ...\n" +" }\n" +"}\n" +"\n" +"@Entity\n" +"public class City {\n" +" ... //no bidirectional relationship\n" +"}" +msgstr "" + +#. Tag: para +#: collection_mapping.xml:938 +#, no-c-format +msgid "" +"A Store_City is used as the join table. The " +"Store_id column is a foreign key to the Store table. The implantedIn_id column is a foreign " +"key to the City table." +msgstr "" + +#. Tag: para +#: collection_mapping.xml:943 +#, no-c-format +msgid "" +"Without describing any physical mapping in a bidirectional many to many the " +"following rules applied. The table name is the concatenation of the owner " +"table name, _ and the other side table name. The foreign " +"key name(s) referencing the owner table is the concatenation of the other " +"side property name, _, and the owner primary key column(s). " +"The foreign key name(s) referencing the other side is the concatenation of " +"the owner property name, _, and the other side primary key " +"column(s). These are the same rules used for a unidirectional one to many " +"relationship." +msgstr "" + +#. Tag: title +#: collection_mapping.xml:955 +#, no-c-format +msgid "Default values for @ManyToMany (bi-directional)" +msgstr "" + +#. Tag: programlisting +#: collection_mapping.xml:958 +#, no-c-format +msgid "" +"@Entity\n" +"public class Store {\n" +" @ManyToMany(cascade = {CascadeType.PERSIST, CascadeType.MERGE})\n" +" public Set<Customer> getCustomers() {\n" +" ...\n" +" }\n" +"}\n" +"\n" +"@Entity\n" +"public class Customer {\n" +" @ManyToMany(mappedBy=\"customers\")\n" +" public Set<Store> getStores() {\n" +" ...\n" +" }\n" +"}" +msgstr "" + +#. Tag: para +#: collection_mapping.xml:961 +#, no-c-format +msgid "" +"A Store_Customer is used as the join table. The " +"stores_id column is a foreign key to the Store table. The customers_id column is a foreign key " +"to the Customer table." +msgstr "" + +#. Tag: para +#: collection_mapping.xml:966 +#, fuzzy, no-c-format +msgid "" +"Using Hibernate mapping files you can map a bidirectional many-to-many " +"association by mapping two many-to-many associations to the same database " +"table and declaring one end as inverse." msgstr "" "2つの多対多関連で同じデータベーステーブルをマッピングし、片方を " "inverse として宣言することで、双方向の多対多関連を指定す" @@ -894,16 +2121,75 @@ msgstr "" "ス付きのコレクションは使えません)。" #. Tag: para +#: collection_mapping.xml:970 #, no-c-format +msgid "You cannot select an indexed collection." +msgstr "" + +#. Tag: para +#: collection_mapping.xml:973 +#, fuzzy, no-c-format msgid "" -"Here is an example of a bidirectional many-to-many association that " -"illustrates how each category can have many items and each item can be in " -"many categories:" +"shows a bidirectional many-to-many association that illustrates how each " +"category can have many items and each item can be in many categories:" msgstr "" "次に双方向の多対多関連の例を示します。各カテゴリは多数のアイテムを持つことが" "でき、各アイテムは多くのカテゴリに属することが出来ます。" +#. Tag: title +#: collection_mapping.xml:979 +#, no-c-format +msgid "Many to many association using Hibernate mapping files" +msgstr "" + +#. Tag: programlisting +#: collection_mapping.xml:981 +#, fuzzy, no-c-format +msgid "" +"<class name=\"Category\">\n" +" <id name=\"id\" column=\"CATEGORY_ID\"/>\n" +" ...\n" +" <bag name=\"items\" table=\"CATEGORY_ITEM\">\n" +" <key column=\"CATEGORY_ID\"/>\n" +" <many-to-many class=\"Item\" column=\"ITEM_ID\"/>\n" +" </bag>\n" +"</class>\n" +"\n" +"<class name=\"Item\">\n" +" <id name=\"id\" column=\"ITEM_ID\"/>\n" +" ...\n" +"\n" +" <!-- inverse end -->\n" +" <bag name=\"categories\" table=\"CATEGORY_ITEM\" inverse=\"true" +"\">\n" +" <key column=\"ITEM_ID\"/>\n" +" <many-to-many class=\"Category\" column=\"CATEGORY_ID\"/>\n" +" </bag>\n" +"</class>" +msgstr "" +"<class name=\"Category\">\n" +" <id name=\"id\" column=\"CATEGORY_ID\"/>\n" +" ...\n" +" <bag name=\"items\" table=\"CATEGORY_ITEM\">\n" +" <key column=\"CATEGORY_ID\"/>\n" +" <many-to-many class=\"Item\" column=\"ITEM_ID\"/>\n" +" </bag>\n" +"</class>\n" +"\n" +"<class name=\"Item\">\n" +" <id name=\"id\" column=\"CATEGORY_ID\"/>\n" +" ...\n" +"\n" +" <!-- inverse end -->\n" +" <bag name=\"categories\" table=\"CATEGORY_ITEM\" inverse=\"true" +"\">\n" +" <key column=\"ITEM_ID\"/>\n" +" <many-to-many class=\"Category\" column=\"CATEGORY_ID\"/>\n" +" </bag>\n" +"</class>" + #. Tag: para +#: collection_mapping.xml:984 #, no-c-format msgid "" "Changes made only to the inverse end of the association are notinverse=\"true\"." -msgstr "" -"双方向の一対多関連を定義するには、一対多関連を多対一関連と同じテーブルのカラ" -"ムにマッピングし、多側に inverse=\"true\" と宣言します。" - -#. Tag: para -#, no-c-format -msgid "" -"Mapping one end of an association with inverse=\"true\" " -"does not affect the operation of cascades as these are orthogonal concepts." -msgstr "" -"関連の片側に inverse=\"true\" を設定しても、カスケード操作" -"に影響を与えません。これらは直交した概念です。" - #. Tag: title +#: collection_mapping.xml:1003 #, no-c-format msgid "Bidirectional associations with indexed collections" msgstr "インデックス付きコレクションと双方向関連" #. Tag: para -#, no-c-format +#: collection_mapping.xml:1005 +#, fuzzy, no-c-format msgid "" -"A bidirectional association where one end is represented as a <" -"list> or <map>, requires special " -"consideration. If there is a property of the child class that maps to the " -"index column you can use inverse=\"true\" on the " -"collection mapping:" +"There are some additional considerations for bidirectional mappings with " +"indexed collections (where one end is represented as a <list>" +" or <map>) when using Hibernate mapping " +"files. If there is a property of the child class that maps to the index " +"column you can use inverse=\"true\" on the collection " +"mapping:" msgstr "" "片側が <list><map> であ" "る双方向関連は、特によく考える必要があります。インデックスカラムにマップされ" "る子クラスのプロパティがある場合は、問題ないです。コレクションのマッピングで " "inverse=\"true\" を使い続けられます。" +#. Tag: title +#: collection_mapping.xml:1013 +#, fuzzy, no-c-format +msgid "Bidirectional association with indexed collection" +msgstr "インデックス付きコレクションと双方向関連" + +#. Tag: programlisting +#: collection_mapping.xml:1015 +#, fuzzy, no-c-format +msgid "" +"<class name=\"Parent\">\n" +" <id name=\"id\" column=\"parent_id\"/>\n" +" ....\n" +" <map name=\"children\" inverse=\"true\">\n" +" <key column=\"parent_id\"/>\n" +" <map-key column=\"name\" \n" +" type=\"string\"/>\n" +" <one-to-many class=\"Child\"/>\n" +" </map>\n" +"</class>\n" +"\n" +"<class name=\"Child\">\n" +" <id name=\"id\" column=\"child_id\"/>\n" +" ....\n" +" <property name=\"name\" \n" +" not-null=\"true\"/>\n" +" <many-to-one name=\"parent\" \n" +" class=\"Parent\" \n" +" column=\"parent_id\"\n" +" not-null=\"true\"/>\n" +"</class>" +msgstr "" +"<class name=\"Parent\">\n" +" <id name=\"id\" column=\"parent_id\"/>\n" +" ....\n" +" <map name=\"children\" inverse=\"true\">\n" +" <key column=\"parent_id\"/>\n" +" <map-key column=\"name\" \n" +" type=\"string\"/>\n" +" <one-to-many class=\"Child\"/>\n" +" </map>\n" +"</class>\n" +"\n" +"<class name=\"Child\">\n" +" <id name=\"id\" column=\"child_id\"/>\n" +" ....\n" +" <property name=\"name\" \n" +" not-null=\"true\"/>\n" +" <many-to-one name=\"parent\" \n" +" class=\"Parent\" \n" +" column=\"parent_id\"\n" +" not-null=\"true\"/>\n" +"</class>" + #. Tag: para +#: collection_mapping.xml:1018 #, no-c-format msgid "" "If there is no such property on the child class, the association cannot be " @@ -980,7 +2334,64 @@ msgstr "" "ありません)。この場合は、コレクションに inverse=\"true\" " "をマッピングできません。代わりに、次のようなマッピングが使えます:" +#. Tag: title +#: collection_mapping.xml:1026 +#, fuzzy, no-c-format +msgid "Bidirectional association with indexed collection, but no index column" +msgstr "インデックス付きコレクションと双方向関連" + +#. Tag: programlisting +#: collection_mapping.xml:1029 +#, fuzzy, no-c-format +msgid "" +"<class name=\"Parent\">\n" +" <id name=\"id\" column=\"parent_id\"/>\n" +" ....\n" +" <map name=\"children\">\n" +" <key column=\"parent_id\"\n" +" not-null=\"true\"/>\n" +" <map-key column=\"name\" \n" +" type=\"string\"/>\n" +" <one-to-many class=\"Child\"/>\n" +" </map>\n" +"</class>\n" +"\n" +"<class name=\"Child\">\n" +" <id name=\"id\" column=\"child_id\"/>\n" +" ....\n" +" <many-to-one name=\"parent\" \n" +" class=\"Parent\" \n" +" column=\"parent_id\"\n" +" insert=\"false\"\n" +" update=\"false\"\n" +" not-null=\"true\"/>\n" +"</class>" +msgstr "" +"<class name=\"Parent\">\n" +" <id name=\"id\" column=\"parent_id\"/>\n" +" ....\n" +" <map name=\"children\">\n" +" <key column=\"parent_id\"\n" +" not-null=\"true\"/>\n" +" <map-key column=\"name\" \n" +" type=\"string\"/>\n" +" <one-to-many class=\"Child\"/>\n" +" </map>\n" +"</class>\n" +"\n" +"<class name=\"Child\">\n" +" <id name=\"id\" column=\"child_id\"/>\n" +" ....\n" +" <many-to-one name=\"parent\" \n" +" class=\"Parent\" \n" +" column=\"parent_id\"\n" +" insert=\"false\"\n" +" update=\"false\"\n" +" not-null=\"true\"/>\n" +"</class>" + #. Tag: para +#: collection_mapping.xml:1032 #, fuzzy, no-c-format msgid "" "Note that in this mapping, the collection-valued end of the association is " @@ -991,11 +2402,13 @@ msgstr "" "テートメントをもたらすのでしょうか? -->" #. Tag: title +#: collection_mapping.xml:1037 #, no-c-format msgid "Ternary associations" msgstr "3項関連" #. Tag: para +#: collection_mapping.xml:1039 #, no-c-format msgid "" "There are three possible approaches to mapping a ternary association. One " @@ -1004,39 +2417,64 @@ msgstr "" "3項関連のマッピングには3つのアプローチがあります。1つ目は関連をインデックスと" "して Map を使用するアプローチです:" -#. Tag: para +#. Tag: title +#: collection_mapping.xml:1044 +#, fuzzy, no-c-format +msgid "Ternary association mapping" +msgstr "3項関連" + +#. Tag: programlisting +#: collection_mapping.xml:1046 #, no-c-format msgid "" +"@Entity\n" +"public class Company {\n" +" @Id \n" +" int id;\n" +" ...\n" +" @OneToMany // unidirectional\n" +" @MapKeyJoinColumn(name=\"employee_id\")\n" +" Map<Employee, Contract> contracts;\n" +"}\n" +"\n" +"// or\n" +"\n" +"<map name=\"contracts\">\n" +" <key column=\"employer_id\" not-null=\"true\"/>\n" +" <map-key-many-to-many column=\"employee_id\" class=\"Employee\"/>\n" +" <one-to-many class=\"Contract\"/>\n" +"</map>" +msgstr "" + +#. Tag: para +#: collection_mapping.xml:1049 +#, fuzzy, no-c-format +msgid "" "A second approach is to remodel the association as an entity class. This is " -"the most common approach." +"the most common approach. A final alternative is to use composite elements, " +"which will be discussed later." msgstr "" "2つ目は単純に関連をエンティティクラスとしてモデルを作り直すアプローチで、頻繁" "に使われます。" -#. Tag: para -#, no-c-format -msgid "" -"A final alternative is to use composite elements, which will be discussed " -"later." -msgstr "" -"最後は composite 要素を使うアプローチです。これに関する議論は後ほど行います。" - -#. Tag: title +#. Tag: literal +#: collection_mapping.xml:1055 #, fuzzy, no-c-format -msgid "Using an <idbag>" +msgid "Using an <idbag>" msgstr "<idbag>の使用" #. Tag: para +#: collection_mapping.xml:1057 #, fuzzy, no-c-format msgid "" "The majority of the many-to-many associations and collections of values " "shown previously all map to tables with composite keys, even though it has " -"been have suggested that entities should have synthetic identifiers " -"(surrogate keys). A pure association table does not seem to benefit much " -"from a surrogate key, although a collection of composite values " -"might. It is for this reason that Hibernate provides a " -"feature that allows you to map many-to-many associations and collections of " -"values to a table with a surrogate key." +"been suggested that entities should have synthetic identifiers (surrogate " +"keys). A pure association table does not seem to benefit much from a " +"surrogate key, although a collection of composite values might. For this reason Hibernate provides a feature that allows you to " +"map many-to-many associations and collections of values to a table with a " +"surrogate key." msgstr "" "複合キーは悪いもので、エンティティは人工の識別子(代理キー)を持つべきであると" "いう考え方からは、多対多関連と値のコレクションを複合キーを用いたテーブルへ" @@ -1047,6 +2485,7 @@ msgstr "" "のコレクションをマッピングする機能も備えています。" #. Tag: para +#: collection_mapping.xml:1066 #, no-c-format msgid "" "The <idbag> element lets you map a ListCollection)を <idbag> 要素にマッ" "ピングできます。" +#. Tag: programlisting +#: collection_mapping.xml:1070 +#, fuzzy, no-c-format +msgid "" +"<idbag name=\"lovers\" table=\"LOVERS\">\n" +" <collection-id column=\"ID\" type=\"long\">\n" +" <generator class=\"sequence\"/>\n" +" </collection-id>\n" +" <key column=\"PERSON1\"/>\n" +" <many-to-many column=\"PERSON2\" class=\"Person\" fetch=\"join\"/" +">\n" +"</idbag>" +msgstr "" +"<idbag name=\"lovers\" table=\"LOVERS\">\n" +" <collection-id column=\"ID\" type=\"long\">\n" +" <generator class=\"sequence\"/>\n" +" </collection-id>\n" +" <key column=\"PERSON1\"/>\n" +" <many-to-many column=\"PERSON2\" class=\"Person\" fetch=\"join\"/" +">\n" +"</idbag>" + #. Tag: para +#: collection_mapping.xml:1072 #, no-c-format msgid "" "An <idbag> has a synthetic id generator, just like " @@ -1070,6 +2532,7 @@ msgstr "" "構を持っていません。" #. Tag: para +#: collection_mapping.xml:1077 #, no-c-format msgid "" "The update performance of an <idbag> supersedes a " @@ -1083,6 +2546,7 @@ msgstr "" "の行を更新、削除できます。" #. Tag: para +#: collection_mapping.xml:1082 #, no-c-format msgid "" "In the current implementation, the native identifier " @@ -1093,16 +2557,19 @@ msgstr "" "idbag> コレクションの識別子に対して使えません。" #. Tag: title +#: collection_mapping.xml:1103 #, no-c-format msgid "Collection examples" msgstr "コレクションの例" #. Tag: para +#: collection_mapping.xml:1105 #, fuzzy, no-c-format msgid "This section covers collection examples." msgstr "コレクションの例" #. Tag: para +#: collection_mapping.xml:1107 #, fuzzy, no-c-format msgid "" "The following class has a collection of Child instances:" @@ -1110,7 +2577,39 @@ msgstr "" "以下のコードを使えば、新しい Child を追加することができま" "す。" +#. Tag: title +#: collection_mapping.xml:1111 +#, no-c-format +msgid "" +"Example classes Parent and Child" +msgstr "" + +#. Tag: programlisting +#: collection_mapping.xml:1114 +#, no-c-format +msgid "" +"public class Parent {\n" +" private long id;\n" +" private Set<Child> children;\n" +"\n" +" // getter/setter\n" +" ...\n" +"}\n" +"\n" +"\n" +"public class Child {\n" +" private long id;\n" +" private String name\n" +"\n" +" \n" +" // getter/setter\n" +" ...\n" +"}" +msgstr "" + #. Tag: para +#: collection_mapping.xml:1117 #, fuzzy, no-c-format msgid "" "If each child has, at most, one parent, the most natural mapping is a one-to-" @@ -1120,12 +2619,127 @@ msgstr "" "す。もし各々の child が最大でも一つの parent を持っているならば、最も自然な" "マッピングは一対多関連です。" +#. Tag: title +#: collection_mapping.xml:1121 +#, no-c-format +msgid "" +"One to many unidirectional Parent-Child relationship " +"using annotations" +msgstr "" + +#. Tag: programlisting +#: collection_mapping.xml:1124 +#, no-c-format +msgid "" +"public class Parent {\n" +" @Id\n" +" @GeneratedValue\n" +" private long id;\n" +"\n" +" @OneToMany\n" +" private Set<Child> children;\n" +"\n" +" // getter/setter\n" +" ...\n" +"}\n" +"\n" +"\n" +"public class Child {\n" +" @Id\n" +" @GeneratedValue\n" +" private long id;\n" +" private String name;\n" +"\n" +" \n" +" // getter/setter\n" +" ...\n" +"}" +msgstr "" + +#. Tag: title +#: collection_mapping.xml:1128 +#, no-c-format +msgid "" +"One to many unidirectional Parent-Child relationship " +"using mapping files" +msgstr "" + +#. Tag: programlisting +#: collection_mapping.xml:1131 +#, fuzzy, no-c-format +msgid "" +"<hibernate-mapping>\n" +"\n" +" <class name=\"Parent\">\n" +" <id name=\"id\">\n" +" <generator class=\"sequence\"/>\n" +" </id>\n" +" <set name=\"children\">\n" +" <key column=\"parent_id\"/>\n" +" <one-to-many class=\"Child\"/>\n" +" </set>\n" +" </class>\n" +"\n" +" <class name=\"Child\">\n" +" <id name=\"id\">\n" +" <generator class=\"sequence\"/>\n" +" </id>\n" +" <property name=\"name\"/>\n" +" </class>\n" +"\n" +"</hibernate-mapping>" +msgstr "" +"<hibernate-mapping>\n" +"\n" +" <class name=\"Parent\">\n" +" <id name=\"id\">\n" +" <generator class=\"sequence\"/>\n" +" </id>\n" +" <set name=\"children\">\n" +" <key column=\"parent_id\"/>\n" +" <one-to-many class=\"Child\"/>\n" +" </set>\n" +" </class>\n" +"\n" +" <class name=\"Child\">\n" +" <id name=\"id\">\n" +" <generator class=\"sequence\"/>\n" +" </id>\n" +" <property name=\"name\"/>\n" +" </class>\n" +"\n" +"</hibernate-mapping>" + #. Tag: para +#: collection_mapping.xml:1134 #, no-c-format msgid "This maps to the following table definitions:" msgstr "これは以下のテーブル定義にマッピングします。" +#. Tag: title +#: collection_mapping.xml:1137 +#, no-c-format +msgid "" +"Table definitions for unidirectional Parent-" +"Child relationship" +msgstr "" + +#. Tag: programlisting +#: collection_mapping.xml:1141 +#, fuzzy, no-c-format +msgid "" +"create table parent ( id bigint not null primary key )\n" +"create table child ( id bigint not null primary key, name varchar(255), " +"parent_id bigint )\n" +"alter table child add constraint childfk0 (parent_id) references parent" +msgstr "" +"create table parent ( id bigint not null primary key )\n" +"create table child ( id bigint not null primary key, name varchar(255), " +"parent_id bigint )\n" +"alter table child add constraint childfk0 (parent_id) references parent" + #. Tag: para +#: collection_mapping.xml:1144 #, no-c-format msgid "" "If the parent is required, use a bidirectional one-to-" @@ -1134,171 +2748,538 @@ msgstr "" "もし parent が 要求 されるなら、双方向の一対多関連を使用" "してください:" +#. Tag: title +#: collection_mapping.xml:1148 +#, no-c-format +msgid "" +"One to many bidirectional Parent-Child relationship " +"using annotations" +msgstr "" + +#. Tag: programlisting +#: collection_mapping.xml:1151 +#, no-c-format +msgid "" +"public class Parent {\n" +" @Id\n" +" @GeneratedValue\n" +" private long id;\n" +"\n" +" @OneToMany(mappedBy=\"parent\")\n" +" private Set<Child> children;\n" +"\n" +" // getter/setter\n" +" ...\n" +"}\n" +"\n" +"\n" +"public class Child {\n" +" @Id\n" +" @GeneratedValue\n" +" private long id;\n" +"\n" +" private String name;\n" +" \n" +" @ManyToOne\n" +" private Parent parent;\n" +"\n" +" \n" +" // getter/setter\n" +" ...\n" +"}" +msgstr "" + +#. Tag: title +#: collection_mapping.xml:1155 +#, no-c-format +msgid "" +"One to many bidirectional Parent-Child relationship " +"using mapping files" +msgstr "" + +#. Tag: programlisting +#: collection_mapping.xml:1158 +#, fuzzy, no-c-format +msgid "" +"<hibernate-mapping>\n" +"\n" +" <class name=\"Parent\">\n" +" <id name=\"id\">\n" +" <generator class=\"sequence\"/>\n" +" </id>\n" +" <set name=\"children\" inverse=\"true\">\n" +" <key column=\"parent_id\"/>\n" +" <one-to-many class=\"Child\"/>\n" +" </set>\n" +" </class>\n" +"\n" +" <class name=\"Child\">\n" +" <id name=\"id\">\n" +" <generator class=\"sequence\"/>\n" +" </id>\n" +" <property name=\"name\"/>\n" +" <many-to-one name=\"parent\" class=\"Parent\" column=\"parent_id" +"\" not-null=\"true\"/>\n" +" </class>\n" +"\n" +"</hibernate-mapping>" +msgstr "" +"<hibernate-mapping>\n" +"\n" +" <class name=\"Parent\">\n" +" <id name=\"id\">\n" +" <generator class=\"sequence\"/>\n" +" </id>\n" +" <set name=\"children\" inverse=\"true\">\n" +" <key column=\"parent_id\"/>\n" +" <one-to-many class=\"Child\"/>\n" +" </set>\n" +" </class>\n" +"\n" +" <class name=\"Child\">\n" +" <id name=\"id\">\n" +" <generator class=\"sequence\"/>\n" +" </id>\n" +" <property name=\"name\"/>\n" +" <many-to-one name=\"parent\" class=\"Parent\" column=\"parent_id" +"\" not-null=\"true\"/>\n" +" </class>\n" +"\n" +"</hibernate-mapping>" + #. Tag: para +#: collection_mapping.xml:1161 #, no-c-format msgid "Notice the NOT NULL constraint:" msgstr "NOT NULL 制約に注意してください。" -#. Tag: para +#. Tag: title +#: collection_mapping.xml:1164 #, no-c-format msgid "" -"Alternatively, if this association must be unidirectional you can declare " -"the NOT NULL constraint on the <key> mapping:" +"Table definitions for bidirectional Parent-" +"Child relationship" +msgstr "" + +#. Tag: programlisting +#: collection_mapping.xml:1168 +#, fuzzy, no-c-format +msgid "" +"create table parent ( id bigint not null primary key )\n" +"create table child ( id bigint not null\n" +" primary key,\n" +" name varchar(255),\n" +" parent_id bigint not null )\n" +"alter table child add constraint childfk0 (parent_id) references parent" +msgstr "" +"create table parent ( id bigint not null primary key )\n" +"create table child ( id bigint not null\n" +" primary key,\n" +" name varchar(255),\n" +" parent_id bigint not null )\n" +"alter table child add constraint childfk0 (parent_id) references parent" + +#. Tag: para +#: collection_mapping.xml:1171 +#, fuzzy, no-c-format +msgid "" +"Alternatively, if this association must be unidirectional you can enforce " +"the NOT NULL constraint." msgstr "" "あるいは、もしこの関連は単方向であるべきと強く主張するのであれば、 " "<key> マッピングに NOT NULL 制約" "を宣言できます:" -#. Tag: para +#. Tag: title +#: collection_mapping.xml:1175 #, no-c-format msgid "" +"Enforcing NOT NULL constraint in unidirectional relation using annotations" +msgstr "" + +#. Tag: programlisting +#: collection_mapping.xml:1178 +#, no-c-format +msgid "" +"public class Parent {\n" +" @Id\n" +" @GeneratedValue\n" +" private long id;\n" +"\n" +" @OneToMany(optional=false)\n" +" private Set<Child> children;\n" +"\n" +" // getter/setter\n" +" ...\n" +"}\n" +"\n" +"\n" +"public class Child {\n" +" @Id\n" +" @GeneratedValue\n" +" private long id;\n" +" private String name;\n" +"\n" +" \n" +" // getter/setter\n" +" ...\n" +"}" +msgstr "" + +#. Tag: title +#: collection_mapping.xml:1182 +#, no-c-format +msgid "" +"Enforcing NOT NULL constraint in unidirectional relation using mapping files" +msgstr "" + +#. Tag: programlisting +#: collection_mapping.xml:1185 +#, fuzzy, no-c-format +msgid "" +"<hibernate-mapping>\n" +"\n" +" <class name=\"Parent\">\n" +" <id name=\"id\">\n" +" <generator class=\"sequence\"/>\n" +" </id>\n" +" <set name=\"children\">\n" +" <key column=\"parent_id\" not-null=\"true\"/>\n" +" <one-to-many class=\"Child\"/>\n" +" </set>\n" +" </class>\n" +"\n" +" <class name=\"Child\">\n" +" <id name=\"id\">\n" +" <generator class=\"sequence\"/>\n" +" </id>\n" +" <property name=\"name\"/>\n" +" </class>\n" +"\n" +"</hibernate-mapping>" +msgstr "" +"<hibernate-mapping>\n" +"\n" +" <class name=\"Parent\">\n" +" <id name=\"id\">\n" +" <generator class=\"sequence\"/>\n" +" </id>\n" +" <set name=\"children\">\n" +" <key column=\"parent_id\" not-null=\"true\"/>\n" +" <one-to-many class=\"Child\"/>\n" +" </set>\n" +" </class>\n" +"\n" +" <class name=\"Child\">\n" +" <id name=\"id\">\n" +" <generator class=\"sequence\"/>\n" +" </id>\n" +" <property name=\"name\"/>\n" +" </class>\n" +"\n" +"</hibernate-mapping>" + +#. Tag: para +#: collection_mapping.xml:1188 +#, fuzzy, no-c-format +msgid "" "On the other hand, if a child has multiple parents, a many-to-many " -"association is appropriate:" +"association is appropriate." msgstr "" "一方で、もし child が複数の parent を持てるならば、多対多関連が妥当です:" +#. Tag: title +#: collection_mapping.xml:1192 +#, no-c-format +msgid "" +"Many to many Parent-Child relationship using " +"annotations" +msgstr "" + +#. Tag: programlisting +#: collection_mapping.xml:1195 +#, no-c-format +msgid "" +"public class Parent {\n" +" @Id\n" +" @GeneratedValue\n" +" private long id;\n" +"\n" +" @ManyToMany\n" +" private Set<Child> children;\n" +"\n" +" // getter/setter\n" +" ...\n" +"}\n" +"\n" +"\n" +"public class Child {\n" +" @Id\n" +" @GeneratedValue\n" +" private long id;\n" +"\n" +" private String name;\n" +"\n" +" \n" +" // getter/setter\n" +" ...\n" +"}" +msgstr "" + +#. Tag: title +#: collection_mapping.xml:1199 +#, no-c-format +msgid "" +"Many to many Parent-Child relationship using mapping " +"files" +msgstr "" + +#. Tag: programlisting +#: collection_mapping.xml:1202 +#, fuzzy, no-c-format +msgid "" +"<hibernate-mapping>\n" +"\n" +" <class name=\"Parent\">\n" +" <id name=\"id\">\n" +" <generator class=\"sequence\"/>\n" +" </id>\n" +" <set name=\"children\" table=\"childset\">\n" +" <key column=\"parent_id\"/>\n" +" <many-to-many class=\"Child\" column=\"child_id\"/>\n" +" </set>\n" +" </class>\n" +"\n" +" <class name=\"Child\">\n" +" <id name=\"id\">\n" +" <generator class=\"sequence\"/>\n" +" </id>\n" +" <property name=\"name\"/>\n" +" </class>\n" +"\n" +"</hibernate-mapping>" +msgstr "" +"<hibernate-mapping>\n" +"\n" +" <class name=\"Parent\">\n" +" <id name=\"id\">\n" +" <generator class=\"sequence\"/>\n" +" </id>\n" +" <set name=\"children\" table=\"childset\">\n" +" <key column=\"parent_id\"/>\n" +" <many-to-many class=\"Child\" column=\"child_id\"/>\n" +" </set>\n" +" </class>\n" +"\n" +" <class name=\"Child\">\n" +" <id name=\"id\">\n" +" <generator class=\"sequence\"/>\n" +" </id>\n" +" <property name=\"name\"/>\n" +" </class>\n" +"\n" +"</hibernate-mapping>" + #. Tag: para +#: collection_mapping.xml:1205 #, no-c-format msgid "Table definitions:" msgstr "テーブル定義は以下のようになります:" +#. Tag: title +#: collection_mapping.xml:1208 +#, no-c-format +msgid "Table definitions for many to many releationship" +msgstr "" + +#. Tag: programlisting +#: collection_mapping.xml:1210 +#, fuzzy, no-c-format +msgid "" +"create table parent ( id bigint not null primary key )\n" +"create table child ( id bigint not null primary key, name varchar(255) )\n" +"create table childset ( parent_id bigint not null,\n" +" child_id bigint not null,\n" +" primary key ( parent_id, child_id ) )\n" +"alter table childset add constraint childsetfk0 (parent_id) references " +"parent\n" +"alter table childset add constraint childsetfk1 (child_id) references child" +msgstr "" +"create table parent ( id bigint not null primary key )\n" +"create table child ( id bigint not null primary key, name varchar(255) )\n" +"create table childset ( parent_id bigint not null,\n" +" child_id bigint not null,\n" +" primary key ( parent_id, child_id ) )\n" +"alter table childset add constraint childsetfk0 (parent_id) references " +"parent\n" +"alter table childset add constraint childsetfk1 (child_id) references child" + #. Tag: para +#: collection_mapping.xml:1213 #, fuzzy, no-c-format msgid "" "For more examples and a complete explanation of a parent/child relationship " -"mapping, see for more information." +"mapping, see for more information. " +"Even more complex association mappings are covered in the next chapter." msgstr "" "parent/child 関係のマッピングについてのより多くの例や完全な手順が必要であれ" "ば、 をご覧ください。" -#. Tag: para -#, fuzzy, no-c-format -msgid "Even more complex association mappings are covered in the next chapter." -msgstr "また、さらに特殊な関連マッピングも可能です。次の章で詳しく述べます。" - -#, fuzzy #~ msgid "" -#~ "" +#~ "Hibernate requires that persistent collection-valued fields be declared " +#~ "as an interface type. For example:" #~ msgstr "" -#~ "public class Product {\n" -#~ " private String serialNumber;\n" -#~ " private Set parts = new HashSet();\n" -#~ " \n" -#~ " public Set getParts() { return parts; }\n" -#~ " void setParts(Set parts) { this.parts = parts; }\n" -#~ " public String getSerialNumber() { return serialNumber; }\n" -#~ " void setSerialNumber(String sn) { serialNumber = sn; }\n" -#~ "}" +#~ "コレクション型のフィールドを永続化するには、そのコレクション型がインター" +#~ "フェース型である必要があります。例えば、" + +#~ msgid "Collection mappings" +#~ msgstr "コレクションのマッピング" -#, fuzzy #~ msgid "" -#~ "" +#~ "There are quite a range of mappings that can be generated for collections " +#~ "that cover many common relational models. We suggest you experiment with " +#~ "the schema generation tool so that you understand how various mapping " +#~ "declarations translate to database tables." #~ msgstr "" -#~ "Cat cat = new DomesticCat();\n" -#~ "Cat kitten = new DomesticCat();\n" -#~ "....\n" -#~ "Set kittens = new HashSet();\n" -#~ "kittens.add(kitten);\n" -#~ "cat.setKittens(kittens);\n" -#~ "session.persist(cat);\n" -#~ "kittens = cat.getKittens(); // Okay, kittens collection is a Set\n" -#~ "(HashSet) cat.getKittens(); // Error!" +#~ "多くの一般的なリレーショナルモデルをカバーしたために、コレクションのために" +#~ "利用できるマッピングにはかなりの幅があります。様々なマッピング宣言がどのよ" +#~ "うにデータベーステーブルに変換されるかを知るために、スキーマ生成ツールを" +#~ "使ってみると良いでしょう。" + +#~ msgid "Collection elements" +#~ msgstr "コレクションの要素" -#, fuzzy #~ msgid "" -#~ "\n" -#~ " \n" -#~ " \n" -#~ " \n" -#~ " \n" -#~ " \n" -#~ "]]>" +#~ "The contained type is referred to as the collection element " +#~ "type. Collection elements are mapped by <" +#~ "element> or <composite-element>, or " +#~ "in the case of entity references, with <one-to-many> or <many-to-many>. The first two map " +#~ "elements with value semantics, the next two are used to map entity " +#~ "associations." #~ msgstr "" -#~ "<class name=\"Product\">\n" -#~ " <id name=\"serialNumber\" column=\"productSerialNumber\"/>\n" -#~ " <set name=\"parts\">\n" -#~ " <key column=\"productSerialNumber\" not-null=\"true\"/>\n" -#~ " <one-to-many class=\"Part\"/>\n" -#~ " </set>\n" -#~ "</class>" +#~ "格納される型は コレクション要素型 と呼ばれます。コレ" +#~ "クション要素は、 <element> または <" +#~ "composite-element> によりマッピングされ、エンティティへの参照" +#~ "の場合には <one-to-many> または <" +#~ "many-to-many> によりマッピングされます。最初の二つは値として" +#~ "要素をマッピングし、次の二つはエンティティの関連をマッピングするのに使われ" +#~ "ます。" -#, fuzzy #~ msgid "" -#~ "\n" -#~ "\n" -#~ " \n" -#~ " \n" -#~ " \n" -#~ "]]>" +#~ "All collection mappings, except those with set and bag semantics, need an " +#~ "index column in the collection table. An index " +#~ "column is a column that maps to an array index, or List index, or Map key. The index of a " +#~ "Map may be of any basic type, mapped with <" +#~ "map-key>. It can be an entity reference mapped with " +#~ "<map-key-many-to-many>, or it can be a composite " +#~ "type mapped with <composite-map-key>. The index " +#~ "of an array or list is always of type integer and is " +#~ "mapped using the <list-index> element. The " +#~ "mapped column contains sequential integers that are numbered from zero by " +#~ "default." #~ msgstr "" -#~ "<map\n" -#~ " name=\"propertyName\"\n" -#~ " table=\"table_name\"\n" -#~ " schema=\"schema_name\"\n" -#~ " lazy=\"true|extra|false\"\n" -#~ " inverse=\"true|false\"\n" -#~ " cascade=\"all|none|save-update|delete|all-delete-orphan|delete-orphan" -#~ "\"\n" -#~ " sort=\"unsorted|natural|comparatorClass\"\n" -#~ " order-by=\"column_name asc|desc\"\n" -#~ " where=\"arbitrary sql where condition\"\n" -#~ " fetch=\"join|select|subselect\"\n" -#~ " batch-size=\"N\"\n" -#~ " access=\"field|property|ClassName\"\n" -#~ " optimistic-lock=\"true|false\"\n" -#~ " mutable=\"true|false\"\n" -#~ " node=\"element-name|.\"\n" -#~ " embed-xml=\"true|false\"\n" -#~ ">\n" -#~ "\n" -#~ " <key .... />\n" -#~ " <map-key .... />\n" -#~ " <element .... />\n" -#~ "</map>" +#~ "set と bag を除く全てのコレクションマッピングには、コレクションテーブルの" +#~ "中に インデックス用のカラム が必要です。そのカラム" +#~ "に、配列や List のインデックス、もしくは Map のキーをマッピングします。 Map のインデックス" +#~ "は、 <map-key> によりマッピングされた基本型か、 " +#~ "<map-key-many-to-many> によりマッピングされたエン" +#~ "ティティの関連か、あるいは <composite-map-key> に" +#~ "よりマッピングされたコンポジット型になります。配列かリストのインデックス" +#~ "は、常に integer 型で、 <list-index> 要素によりマッピングします。マッピングされたカラムにはシーケン" +#~ "シャルな整数を格納します (デフォルトでは0から番号が付けられます)。" -#, fuzzy -#~ msgid "]]>" -#~ msgstr "<key column=\"productSerialNumber\" not-null=\"true\"/>" +#~ msgid "" +#~ "Any collection of values or many-to-many associations requires a " +#~ "dedicated collection table with a foreign key column " +#~ "or columns, collection element column or columns, " +#~ "and possibly an index column or columns." +#~ msgstr "" +#~ "値のコレクションや多対多関連は、専用の コレクションテーブル が必要です。このテーブルは、外部キーカラムと、 コレク" +#~ "ション要素のカラム と、場合によってはインデックスカラムを持ちま" +#~ "す。" #, fuzzy #~ msgid "" -#~ "]]>" -#~ msgstr "<key column=\"productSerialNumber\" on-delete=\"cascade\"/>" +#~ "column (optional): the name of the element foreign key " +#~ "column." +#~ msgstr "class (必須): 関連クラスの名前。" + +#, fuzzy +#~ msgid "" +#~ "not-found (optional - defaults to exception): specifies how foreign keys that reference missing rows will be " +#~ "handled: ignore will treat a missing row as a null " +#~ "association." +#~ msgstr "" +#~ "not-found (オプション - デフォルトは " +#~ "exception): 参照先の行がないキャッシュされた識別子をど" +#~ "のように扱うかを指定します: ignore を指定すると、行がな" +#~ "いことを関連がないものとして扱います。" + +#~ msgid "" +#~ "A bag containing integers with an iteration order determined by the " +#~ "order-by attribute:" +#~ msgstr "" +#~ "整数値を含む bag (bagは order-by 属性によって反復順序" +#~ "が定義されています):" + +#~ msgid "An array of entities, in this case, a many-to-many association:" +#~ msgstr "エンティティの配列 - この場合、多対多の関連です。" + +#~ msgid "A map from string indices to dates:" +#~ msgstr "文字列と日付の map" + +#~ msgid "A list of components (this is discussed in the next chapter):" +#~ msgstr "コンポーネントの list (次の章で詳しく説明します)" + +#~ msgid "One-to-many associations" +#~ msgstr "一対多関連" + +#~ msgid "" +#~ "A one-to-many association links the tables of two " +#~ "classes via a foreign key with no intervening collection table. This " +#~ "mapping loses certain semantics of normal Java collections:" +#~ msgstr "" +#~ "一対多関連 は、コレクションテーブルを介さず、外部キー" +#~ "により2つのクラスのテーブルを関連付けます。このマッピングは標準的な Java " +#~ "のコレクションのセマンティクスをいくつか失います:" + +#~ msgid "" +#~ "The following example shows a map of Part entities by " +#~ "name, where partName is a persistent property of " +#~ "Part. Notice the use of a formula-based index:" +#~ msgstr "" +#~ "次の例は、名称(Part の永続的なプロパティである " +#~ "partName) による Part エンティティ" +#~ "の map を表しています。 formula によるインデックスを使っていることに注意し" +#~ "てください。" + +#~ msgid "" +#~ "Hibernate supports collections implementing java.util.SortedMap and java.util.SortedSet. You must specify a " +#~ "comparator in the mapping file:" +#~ msgstr "" +#~ "Hibernate は java.util.SortedMapjava.util." +#~ "SortedSet を実装したコレクションをサポートしています。開発者は" +#~ "マッピング定義ファイルにコンパレータを指定しなければなりません: " + +#~ msgid "" +#~ "A final alternative is to use composite elements, which will be discussed " +#~ "later." +#~ msgstr "" +#~ "最後は composite 要素を使うアプローチです。これに関する議論は後ほど行いま" +#~ "す。" + +#, fuzzy +#~ msgid "" +#~ "Even more complex association mappings are covered in the next chapter." +#~ msgstr "" +#~ "また、さらに特殊な関連マッピングも可能です。次の章で詳しく述べます。" #, fuzzy #~ msgid "" @@ -1390,24 +3371,6 @@ msgstr "また、さらに特殊な関連マッピングも可能です。次の #~ " </composite-element>\n" #~ "</list>" -#, fuzzy -#~ msgid "" -#~ "]]>" -#~ msgstr "" -#~ "<one-to-many \n" -#~ " class=\"ClassName\"\n" -#~ " not-found=\"ignore|exception\"\n" -#~ " entity-name=\"EntityName\"\n" -#~ " node=\"element-name\"\n" -#~ " embed-xml=\"true|false\"\n" -#~ " />" - #, fuzzy #~ msgid "" #~ "\n" -#~ " \n" -#~ " \n" -#~ "\n" -#~ "\n" -#~ "\n" -#~ " \n" -#~ " \n" -#~ " \n" -#~ "]]>" -#~ msgstr "" -#~ "<set name=\"aliases\" \n" -#~ " table=\"person_aliases\" \n" -#~ " sort=\"natural\">\n" -#~ " <key column=\"person\"/>\n" -#~ " <element column=\"name\" type=\"string\"/>\n" -#~ "</set>\n" -#~ "\n" -#~ "<map name=\"holidays\" sort=\"my.custom.HolidayComparator\">\n" -#~ " <key column=\"year_id\"/>\n" -#~ " <map-key column=\"hol_name\" type=\"string\"/>\n" -#~ " <element column=\"hol_date\" type=\"date\"/>\n" -#~ "</map>" - -#, fuzzy -#~ msgid "" -#~ "\n" -#~ " \n" -#~ " \n" -#~ "\n" -#~ "\n" -#~ "\n" -#~ " \n" -#~ " \n" -#~ " \n" -#~ "]]>" -#~ msgstr "" -#~ "<set name=\"aliases\" table=\"person_aliases\" order-by=\"lower(name) " -#~ "asc\">\n" -#~ " <key column=\"person\"/>\n" -#~ " <element column=\"name\" type=\"string\"/>\n" -#~ "</set>\n" -#~ "\n" -#~ "<map name=\"holidays\" order-by=\"hol_date, hol_name\">\n" -#~ " <key column=\"year_id\"/>\n" -#~ " <map-key column=\"hol_name\" type=\"string\"/>\n" -#~ " <element column=\"hol_date type=\"date\"/>\n" -#~ "</map>" - -#, fuzzy -#~ msgid "" -#~ "" -#~ msgstr "" -#~ "sortedUsers = s.createFilter( group.getUsers(), \"order by this.name\" )." -#~ "list();" - -#, fuzzy -#~ msgid "" -#~ "\n" -#~ " \n" -#~ " ...\n" -#~ " \n" -#~ " \n" -#~ " \n" -#~ " \n" -#~ "\n" -#~ "\n" -#~ "\n" -#~ " \n" -#~ " ...\n" -#~ "\n" -#~ " \n" -#~ " \n" -#~ " \n" -#~ " \n" -#~ " \n" -#~ "]]>" -#~ msgstr "" -#~ "<class name=\"Category\">\n" -#~ " <id name=\"id\" column=\"CATEGORY_ID\"/>\n" -#~ " ...\n" -#~ " <bag name=\"items\" table=\"CATEGORY_ITEM\">\n" -#~ " <key column=\"CATEGORY_ID\"/>\n" -#~ " <many-to-many class=\"Item\" column=\"ITEM_ID\"/>\n" -#~ " </bag>\n" -#~ "</class>\n" -#~ "\n" -#~ "<class name=\"Item\">\n" -#~ " <id name=\"id\" column=\"CATEGORY_ID\"/>\n" -#~ " ...\n" -#~ "\n" -#~ " <!-- inverse end -->\n" -#~ " <bag name=\"categories\" table=\"CATEGORY_ITEM\" inverse=\"true" -#~ "\">\n" -#~ " <key column=\"ITEM_ID\"/>\n" -#~ " <many-to-many class=\"Category\" column=\"CATEGORY_ID\"/>\n" -#~ " </bag>\n" -#~ "</class>" - -#, fuzzy -#~ msgid "" -#~ "" -#~ msgstr "" -#~ "category.getItems().add(item); // The category now \"knows\" " -#~ "about the relationship\n" -#~ "item.getCategories().add(category); // The item now \"knows\" about " -#~ "the relationship\n" -#~ "\n" -#~ "session.persist(item); // The relationship won't be " -#~ "saved!\n" -#~ "session.persist(category); // The relationship will be saved" - -#, fuzzy -#~ msgid "" -#~ "\n" -#~ " \n" -#~ " ....\n" -#~ " \n" -#~ " \n" -#~ " \n" -#~ " \n" -#~ "\n" -#~ "\n" -#~ "\n" -#~ " \n" -#~ " ....\n" -#~ " \n" -#~ "]]>" -#~ msgstr "" -#~ "<class name=\"Parent\">\n" -#~ " <id name=\"id\" column=\"parent_id\"/>\n" -#~ " ....\n" -#~ " <set name=\"children\" inverse=\"true\">\n" -#~ " <key column=\"parent_id\"/>\n" -#~ " <one-to-many class=\"Child\"/>\n" -#~ " </set>\n" -#~ "</class>\n" -#~ "\n" -#~ "<class name=\"Child\">\n" -#~ " <id name=\"id\" column=\"child_id\"/>\n" -#~ " ....\n" -#~ " <many-to-one name=\"parent\" \n" -#~ " class=\"Parent\" \n" -#~ " column=\"parent_id\"\n" -#~ " not-null=\"true\"/>\n" -#~ "</class>" - -#, fuzzy -#~ msgid "" -#~ "\n" -#~ " \n" -#~ " ....\n" -#~ " \n" -#~ " \n" -#~ " \n" -#~ " \n" -#~ " \n" -#~ "\n" -#~ "\n" -#~ "\n" -#~ " \n" -#~ " ....\n" -#~ " \n" -#~ " \n" -#~ "]]>" -#~ msgstr "" -#~ "<class name=\"Parent\">\n" -#~ " <id name=\"id\" column=\"parent_id\"/>\n" -#~ " ....\n" -#~ " <map name=\"children\" inverse=\"true\">\n" -#~ " <key column=\"parent_id\"/>\n" -#~ " <map-key column=\"name\" \n" -#~ " type=\"string\"/>\n" -#~ " <one-to-many class=\"Child\"/>\n" -#~ " </map>\n" -#~ "</class>\n" -#~ "\n" -#~ "<class name=\"Child\">\n" -#~ " <id name=\"id\" column=\"child_id\"/>\n" -#~ " ....\n" -#~ " <property name=\"name\" \n" -#~ " not-null=\"true\"/>\n" -#~ " <many-to-one name=\"parent\" \n" -#~ " class=\"Parent\" \n" -#~ " column=\"parent_id\"\n" -#~ " not-null=\"true\"/>\n" -#~ "</class>" - -#, fuzzy -#~ msgid "" -#~ "\n" -#~ " \n" -#~ " ....\n" -#~ " \n" -#~ " \n" -#~ " \n" -#~ " \n" -#~ " \n" -#~ "\n" -#~ "\n" -#~ "\n" -#~ " \n" -#~ " ....\n" -#~ " \n" -#~ "]]>" -#~ msgstr "" -#~ "<class name=\"Parent\">\n" -#~ " <id name=\"id\" column=\"parent_id\"/>\n" -#~ " ....\n" -#~ " <map name=\"children\">\n" -#~ " <key column=\"parent_id\"\n" -#~ " not-null=\"true\"/>\n" -#~ " <map-key column=\"name\" \n" -#~ " type=\"string\"/>\n" -#~ " <one-to-many class=\"Child\"/>\n" -#~ " </map>\n" -#~ "</class>\n" -#~ "\n" -#~ "<class name=\"Child\">\n" -#~ " <id name=\"id\" column=\"child_id\"/>\n" -#~ " ....\n" -#~ " <many-to-one name=\"parent\" \n" -#~ " class=\"Parent\" \n" -#~ " column=\"parent_id\"\n" -#~ " insert=\"false\"\n" -#~ " update=\"false\"\n" -#~ " not-null=\"true\"/>\n" -#~ "</class>" - #, fuzzy #~ msgid "" #~ "\n" @@ -1713,25 +3417,6 @@ msgstr "また、さらに特殊な関連マッピングも可能です。次の #~ " <many-to-many column=\"connection_id\" class=\"Connection\"/>\n" #~ "</map>" -#, fuzzy -#~ msgid "" -#~ "\n" -#~ " \n" -#~ " \n" -#~ " \n" -#~ " \n" -#~ " \n" -#~ "]]>" -#~ msgstr "" -#~ "<idbag name=\"lovers\" table=\"LOVERS\">\n" -#~ " <collection-id column=\"ID\" type=\"long\">\n" -#~ " <generator class=\"sequence\"/>\n" -#~ " </collection-id>\n" -#~ " <key column=\"PERSON1\"/>\n" -#~ " <many-to-many column=\"PERSON2\" class=\"Person\" fetch=\"join\"/" -#~ ">\n" -#~ "</idbag>" - #, fuzzy #~ msgid "" #~ "\n" -#~ "\n" -#~ " \n" -#~ " \n" -#~ " \n" -#~ " \n" -#~ " \n" -#~ " \n" -#~ " \n" -#~ " \n" -#~ " \n" -#~ "\n" -#~ " \n" -#~ " \n" -#~ " \n" -#~ " \n" -#~ " \n" -#~ " \n" -#~ "\n" -#~ "]]>" -#~ msgstr "" -#~ "<hibernate-mapping>\n" -#~ "\n" -#~ " <class name=\"Parent\">\n" -#~ " <id name=\"id\">\n" -#~ " <generator class=\"sequence\"/>\n" -#~ " </id>\n" -#~ " <set name=\"children\">\n" -#~ " <key column=\"parent_id\"/>\n" -#~ " <one-to-many class=\"Child\"/>\n" -#~ " </set>\n" -#~ " </class>\n" -#~ "\n" -#~ " <class name=\"Child\">\n" -#~ " <id name=\"id\">\n" -#~ " <generator class=\"sequence\"/>\n" -#~ " </id>\n" -#~ " <property name=\"name\"/>\n" -#~ " </class>\n" -#~ "\n" -#~ "</hibernate-mapping>" - -#, fuzzy -#~ msgid "" -#~ "" -#~ msgstr "" -#~ "create table parent ( id bigint not null primary key )\n" -#~ "create table child ( id bigint not null primary key, name varchar(255), " -#~ "parent_id bigint )\n" -#~ "alter table child add constraint childfk0 (parent_id) references parent" - -#, fuzzy -#~ msgid "" -#~ "\n" -#~ "\n" -#~ " \n" -#~ " \n" -#~ " \n" -#~ " \n" -#~ " \n" -#~ " \n" -#~ " \n" -#~ " \n" -#~ " \n" -#~ "\n" -#~ " \n" -#~ " \n" -#~ " \n" -#~ " \n" -#~ " \n" -#~ " \n" -#~ " \n" -#~ "\n" -#~ "]]>" -#~ msgstr "" -#~ "<hibernate-mapping>\n" -#~ "\n" -#~ " <class name=\"Parent\">\n" -#~ " <id name=\"id\">\n" -#~ " <generator class=\"sequence\"/>\n" -#~ " </id>\n" -#~ " <set name=\"children\" inverse=\"true\">\n" -#~ " <key column=\"parent_id\"/>\n" -#~ " <one-to-many class=\"Child\"/>\n" -#~ " </set>\n" -#~ " </class>\n" -#~ "\n" -#~ " <class name=\"Child\">\n" -#~ " <id name=\"id\">\n" -#~ " <generator class=\"sequence\"/>\n" -#~ " </id>\n" -#~ " <property name=\"name\"/>\n" -#~ " <many-to-one name=\"parent\" class=\"Parent\" column=" -#~ "\"parent_id\" not-null=\"true\"/>\n" -#~ " </class>\n" -#~ "\n" -#~ "</hibernate-mapping>" - -#, fuzzy -#~ msgid "" -#~ "" -#~ msgstr "" -#~ "create table parent ( id bigint not null primary key )\n" -#~ "create table child ( id bigint not null\n" -#~ " primary key,\n" -#~ " name varchar(255),\n" -#~ " parent_id bigint not null )\n" -#~ "alter table child add constraint childfk0 (parent_id) references parent" - -#, fuzzy -#~ msgid "" -#~ "\n" -#~ "\n" -#~ " \n" -#~ " \n" -#~ " \n" -#~ " \n" -#~ " \n" -#~ " \n" -#~ " \n" -#~ " \n" -#~ " \n" -#~ "\n" -#~ " \n" -#~ " \n" -#~ " \n" -#~ " \n" -#~ " \n" -#~ " \n" -#~ "\n" -#~ "]]>" -#~ msgstr "" -#~ "<hibernate-mapping>\n" -#~ "\n" -#~ " <class name=\"Parent\">\n" -#~ " <id name=\"id\">\n" -#~ " <generator class=\"sequence\"/>\n" -#~ " </id>\n" -#~ " <set name=\"children\">\n" -#~ " <key column=\"parent_id\" not-null=\"true\"/>\n" -#~ " <one-to-many class=\"Child\"/>\n" -#~ " </set>\n" -#~ " </class>\n" -#~ "\n" -#~ " <class name=\"Child\">\n" -#~ " <id name=\"id\">\n" -#~ " <generator class=\"sequence\"/>\n" -#~ " </id>\n" -#~ " <property name=\"name\"/>\n" -#~ " </class>\n" -#~ "\n" -#~ "</hibernate-mapping>" - -#, fuzzy -#~ msgid "" -#~ "\n" -#~ "\n" -#~ " \n" -#~ " \n" -#~ " \n" -#~ " \n" -#~ " \n" -#~ " \n" -#~ " \n" -#~ " \n" -#~ " \n" -#~ "\n" -#~ " \n" -#~ " \n" -#~ " \n" -#~ " \n" -#~ " \n" -#~ " \n" -#~ "\n" -#~ "]]>" -#~ msgstr "" -#~ "<hibernate-mapping>\n" -#~ "\n" -#~ " <class name=\"Parent\">\n" -#~ " <id name=\"id\">\n" -#~ " <generator class=\"sequence\"/>\n" -#~ " </id>\n" -#~ " <set name=\"children\" table=\"childset\">\n" -#~ " <key column=\"parent_id\"/>\n" -#~ " <many-to-many class=\"Child\" column=\"child_id\"/>\n" -#~ " </set>\n" -#~ " </class>\n" -#~ "\n" -#~ " <class name=\"Child\">\n" -#~ " <id name=\"id\">\n" -#~ " <generator class=\"sequence\"/>\n" -#~ " </id>\n" -#~ " <property name=\"name\"/>\n" -#~ " </class>\n" -#~ "\n" -#~ "</hibernate-mapping>" - -#, fuzzy -#~ msgid "" -#~ "" -#~ msgstr "" -#~ "create table parent ( id bigint not null primary key )\n" -#~ "create table child ( id bigint not null primary key, name varchar(255) )\n" -#~ "create table childset ( parent_id bigint not null,\n" -#~ " child_id bigint not null,\n" -#~ " primary key ( parent_id, child_id ) )\n" -#~ "alter table childset add constraint childsetfk0 (parent_id) references " -#~ "parent\n" -#~ "alter table childset add constraint childsetfk1 (child_id) references " -#~ "child" diff --git a/documentation/manual/src/main/docbook/ja-JP/content/configuration.po b/documentation/manual/src/main/docbook/ja-JP/content/configuration.po index 7c0856b5ba..7e5fdbb014 100644 --- a/documentation/manual/src/main/docbook/ja-JP/content/configuration.po +++ b/documentation/manual/src/main/docbook/ja-JP/content/configuration.po @@ -4,7 +4,7 @@ msgid "" msgstr "" "Project-Id-Version: Collection_Mapping\n" "Report-Msgid-Bugs-To: http://bugs.kde.org\n" -"POT-Creation-Date: 2010-02-11T05:38:15\n" +"POT-Creation-Date: 2010-07-20 21:02+0000\n" "PO-Revision-Date: 2009-12-21 17:12+1000\n" "Last-Translator: Xi HUANG \n" "Language-Team: \n" @@ -14,11 +14,13 @@ msgstr "" "X-Generator: KBabel 1.11.4\n" #. Tag: title +#: configuration.xml:31 #, no-c-format msgid "Configuration" msgstr "設定" #. Tag: para +#: configuration.xml:33 #, no-c-format msgid "" "Hibernate is designed to operate in many different environments and, as " @@ -36,11 +38,13 @@ msgstr "" "タマイズするだけです。" #. Tag: title +#: configuration.xml:41 #, no-c-format msgid "Programmatic configuration" msgstr "プログラム上の設定" #. Tag: para +#: configuration.xml:43 #, no-c-format msgid "" "An instance of org.hibernate.cfg.Configuration " @@ -56,6 +60,7 @@ msgstr "" "数の XML マッピングファイルを変換し、マッピング情報にします。" #. Tag: para +#: configuration.xml:51 #, no-c-format msgid "" "You can obtain a org.hibernate.cfg.Configuration " @@ -68,7 +73,20 @@ msgstr "" "ファイルがクラスパスに設定されている場合、次のメソッドを使ってください。 " "addResource() :" +#. Tag: programlisting +#: configuration.xml:57 +#, fuzzy, no-c-format +msgid "" +"Configuration cfg = new Configuration()\n" +" .addResource(\"Item.hbm.xml\")\n" +" .addResource(\"Bid.hbm.xml\");" +msgstr "" +"Configuration cfg = new Configuration()\n" +" .addResource(\"Item.hbm.xml\")\n" +" .addResource(\"Bid.hbm.xml\");" + #. Tag: para +#: configuration.xml:59 #, no-c-format msgid "" "An alternative way is to specify the mapped class and allow Hibernate to " @@ -77,7 +95,20 @@ msgstr "" "代替案 (こちらのほうが良いときもあります) としてマッピングクラスを指定する方" "法もあります。 Hibernate に、マッピングファイルを 見つけさせてください:" +#. Tag: programlisting +#: configuration.xml:62 +#, fuzzy, no-c-format +msgid "" +"Configuration cfg = new Configuration()\n" +" .addClass(org.hibernate.auction.Item.class)\n" +" .addClass(org.hibernate.auction.Bid.class);" +msgstr "" +"Configuration cfg = new Configuration()\n" +" .addClass(org.hibernate.auction.Item.class)\n" +" .addClass(org.hibernate.auction.Bid.class);" + #. Tag: para +#: configuration.xml:64 #, no-c-format msgid "" "Hibernate will then search for mapping files named /org/hibernate/" @@ -91,6 +122,7 @@ msgstr "" "グされたファイル名を排除できます。" #. Tag: para +#: configuration.xml:69 #, no-c-format msgid "" "A org.hibernate.cfg.Configuration also allows you to " @@ -99,7 +131,30 @@ msgstr "" "org.hibernate.cfg.Configuration は、設定プロパティを指" "定することもできます:" +#. Tag: programlisting +#: configuration.xml:72 +#, fuzzy, no-c-format +msgid "" +"Configuration cfg = new Configuration()\n" +" .addClass(org.hibernate.auction.Item.class)\n" +" .addClass(org.hibernate.auction.Bid.class)\n" +" .setProperty(\"hibernate.dialect\", \"org.hibernate.dialect." +"MySQLInnoDBDialect\")\n" +" .setProperty(\"hibernate.connection.datasource\", \"java:comp/env/jdbc/" +"test\")\n" +" .setProperty(\"hibernate.order_updates\", \"true\");" +msgstr "" +"Configuration cfg = new Configuration()\n" +" .addClass(org.hibernate.auction.Item.class)\n" +" .addClass(org.hibernate.auction.Bid.class)\n" +" .setProperty(\"hibernate.dialect\", \"org.hibernate.dialect." +"MySQLInnoDBDialect\")\n" +" .setProperty(\"hibernate.connection.datasource\", \"java:comp/env/jdbc/" +"test\")\n" +" .setProperty(\"hibernate.order_updates\", \"true\");" + #. Tag: para +#: configuration.xml:74 #, no-c-format msgid "" "This is not the only way to pass configuration properties to Hibernate. Some " @@ -109,6 +164,7 @@ msgstr "" "を用意しています:" #. Tag: para +#: configuration.xml:79 #, no-c-format msgid "" "Pass an instance of java.util.Properties to " @@ -118,6 +174,7 @@ msgstr "" "Configuration.setProperties() に渡します。" #. Tag: para +#: configuration.xml:84 #, no-c-format msgid "" "Place a file named hibernate.properties in a root " @@ -127,6 +184,7 @@ msgstr "" "きます。" #. Tag: para +#: configuration.xml:89 #, no-c-format msgid "" "Set System properties using java -" @@ -136,6 +194,7 @@ msgstr "" "literal> を使うように設定します。" #. Tag: para +#: configuration.xml:94 #, no-c-format msgid "" "Include <property> elements in hibernate." @@ -145,6 +204,7 @@ msgstr "" "filename> (後述)に設定します。" #. Tag: para +#: configuration.xml:99 #, fuzzy, no-c-format msgid "" "If you want to get started quicklyhibernate.properties " @@ -154,6 +214,7 @@ msgstr "" "きます。" #. Tag: para +#: configuration.xml:103 #, no-c-format msgid "" "The org.hibernate.cfg.Configuration is intended as a " @@ -165,11 +226,13 @@ msgstr "" "されることを意図しています。" #. Tag: title +#: configuration.xml:109 #, no-c-format msgid "Obtaining a SessionFactory" msgstr "SessionFactory を取得する" #. Tag: para +#: configuration.xml:111 #, fuzzy, no-c-format msgid "" "When all mappings have been parsed by the org.hibernate.cfg." @@ -182,7 +245,14 @@ msgstr "" "classname> インスタンスのためにファクトリを取得しなければなりません。この " "SessionFactory は、 Hibernate を使用するすべてのスレッドで共有されるべきです:" +#. Tag: programlisting +#: configuration.xml:117 +#, fuzzy, no-c-format +msgid "SessionFactory sessions = cfg.buildSessionFactory();" +msgstr "SessionFactory sessions = cfg.buildSessionFactory();" + #. Tag: para +#: configuration.xml:119 #, fuzzy, no-c-format msgid "" "Hibernate does allow your application to instantiate more than one " @@ -194,11 +264,13 @@ msgstr "" "する場合に便利です。" #. Tag: title +#: configuration.xml:125 #, no-c-format msgid "JDBC connections" msgstr "JDBC コネクション" #. Tag: para +#: configuration.xml:127 #, no-c-format msgid "" "It is advisable to have the org.hibernate.SessionFactoryorg.hibernate.Session をオープンしてください:" +#. Tag: programlisting +#: configuration.xml:133 +#, fuzzy, no-c-format +msgid "Session session = sessions.openSession(); // open a new Session" +msgstr "Session session = sessions.openSession(); // open a new Session" + #. Tag: para +#: configuration.xml:135 #, no-c-format msgid "" "Once you start a task that requires access to the database, a JDBC " @@ -221,6 +300,7 @@ msgstr "" "セスすることができます。" #. Tag: para +#: configuration.xml:138 #, no-c-format msgid "" "Before you can do this, you first need to pass some JDBC connection " @@ -235,6 +315,7 @@ msgstr "" "JDBC コネクション設定の中で一番重要なものです。" #. Tag: para +#: configuration.xml:144 #, no-c-format msgid "" "Hibernate will obtain and pool connections using java.sql." @@ -244,71 +325,89 @@ msgstr "" "(プールも) java.sql.DriverManager を使います:" #. Tag: title +#: configuration.xml:149 #, no-c-format msgid "Hibernate JDBC Properties" msgstr "Hibernate JDBC プロパティ" #. Tag: entry +#: configuration.xml:158 configuration.xml:236 configuration.xml:327 +#: configuration.xml:495 configuration.xml:657 configuration.xml:753 +#: configuration.xml:826 #, no-c-format msgid "Property name" msgstr "プロパティ名" #. Tag: entry +#: configuration.xml:160 configuration.xml:238 configuration.xml:329 +#: configuration.xml:497 configuration.xml:659 configuration.xml:755 +#: configuration.xml:828 #, no-c-format msgid "Purpose" msgstr "意味" -#. Tag: entry -#, no-c-format -msgid "hibernate.connection.driver_class" +#. Tag: property +#: configuration.xml:166 +#, fuzzy, no-c-format +msgid "hibernate.connection.driver_class" msgstr "hibernate.connection.driver_class" -#. Tag: entry -#, no-c-format -msgid "JDBC driver class" +#. Tag: emphasis +#: configuration.xml:168 +#, fuzzy, no-c-format +msgid "JDBC driver class" msgstr "JDBC のドライバークラス" -#. Tag: entry -#, no-c-format -msgid "hibernate.connection.url" +#. Tag: property +#: configuration.xml:172 +#, fuzzy, no-c-format +msgid "hibernate.connection.url" msgstr "hibernate.connection.url" -#. Tag: entry -#, fuzzy, no-c-format -msgid "JDBC URL" -msgstr "JDBC のドライバークラス" - -#. Tag: entry +#. Tag: emphasis +#: configuration.xml:174 #, no-c-format -msgid "hibernate.connection.username" +msgid "JDBC URL" +msgstr "" + +#. Tag: property +#: configuration.xml:178 configuration.xml:265 +#, fuzzy, no-c-format +msgid "hibernate.connection.username" msgstr "hibernate.connection.username" -#. Tag: entry -#, fuzzy, no-c-format -msgid "database user" -msgstr "データベースユーザ (オプション)" - -#. Tag: entry +#. Tag: emphasis +#: configuration.xml:180 #, no-c-format -msgid "hibernate.connection.password" +msgid "database user" +msgstr "データベースのユーザー" + +#. Tag: property +#: configuration.xml:184 configuration.xml:271 +#, fuzzy, no-c-format +msgid "hibernate.connection.password" msgstr "hibernate.connection.password" -#. Tag: entry -#, fuzzy, no-c-format -msgid "database user password" -msgstr "データベースユーザのパスワード (オプション)" - -#. Tag: entry +#. Tag: emphasis +#: configuration.xml:186 #, no-c-format -msgid "hibernate.connection.pool_size" +msgid "database user password" +msgstr "データベースユーザーパスワード" + +#. Tag: property +#: configuration.xml:190 +#, fuzzy, no-c-format +msgid "hibernate.connection.pool_size" msgstr "hibernate.connection.pool_size" -#. Tag: entry -#, no-c-format -msgid "maximum number of pooled connections" +#. Tag: emphasis +#: configuration.xml:192 +#, fuzzy, no-c-format +msgid "maximum number of pooled connections" msgstr "プールするコネクションの最大数" #. Tag: para +#: configuration.xml:199 #, no-c-format msgid "" "Hibernate's own connection pooling algorithm is, however, quite rudimentary. " @@ -329,6 +428,7 @@ msgstr "" "使います。" #. Tag: para +#: configuration.xml:208 #, no-c-format msgid "" "C3P0 is an open source JDBC connection pool distributed along with Hibernate " @@ -347,6 +447,7 @@ msgstr "" "くの情報を取得してください。" #. Tag: para +#: configuration.xml:216 #, no-c-format msgid "" "The following is an example hibernate.properties file " @@ -355,7 +456,32 @@ msgstr "" "C3P0 用の hibernate.properties ファイルを例として示しま" "す:" +#. Tag: programlisting +#: configuration.xml:219 +#, fuzzy, no-c-format +msgid "" +"hibernate.connection.driver_class = org.postgresql.Driver\n" +"hibernate.connection.url = jdbc:postgresql://localhost/mydatabase\n" +"hibernate.connection.username = myuser\n" +"hibernate.connection.password = secret\n" +"hibernate.c3p0.min_size=5\n" +"hibernate.c3p0.max_size=20\n" +"hibernate.c3p0.timeout=1800\n" +"hibernate.c3p0.max_statements=50\n" +"hibernate.dialect = org.hibernate.dialect.PostgreSQLDialect" +msgstr "" +"hibernate.connection.driver_class = org.postgresql.Driver\n" +"hibernate.connection.url = jdbc:postgresql://localhost/mydatabase\n" +"hibernate.connection.username = myuser\n" +"hibernate.connection.password = secret\n" +"hibernate.c3p0.min_size=5\n" +"hibernate.c3p0.max_size=20\n" +"hibernate.c3p0.timeout=1800\n" +"hibernate.c3p0.max_statements=50\n" +"hibernate.dialect = org.hibernate.dialect.PostgreSQLDialect" + #. Tag: para +#: configuration.xml:221 #, no-c-format msgid "" "For use inside an application server, you should almost always configure " @@ -369,36 +495,43 @@ msgstr "" "ように設定してください:" #. Tag: title +#: configuration.xml:227 #, no-c-format msgid "Hibernate Datasource Properties" msgstr "Hibernate データソースプロパティ" -#. Tag: entry -#, no-c-format -msgid "hibernate.connection.datasource" +#. Tag: property +#: configuration.xml:244 +#, fuzzy, no-c-format +msgid "hibernate.connection.datasource" msgstr "hibernate.connection.datasource" -#. Tag: entry -#, fuzzy, no-c-format -msgid "datasource JNDI name" -msgstr "データベースユーザ (オプション)" - -#. Tag: entry +#. Tag: emphasis +#: configuration.xml:246 #, no-c-format -msgid "hibernate.jndi.url" +msgid "datasource JNDI name" +msgstr "データソースの JNDI 名" + +#. Tag: property +#: configuration.xml:250 +#, fuzzy, no-c-format +msgid "hibernate.jndi.url" msgstr "hibernate.jndi.url" #. Tag: entry +#: configuration.xml:252 #, no-c-format msgid "URL of the JNDI provider (optional)" msgstr "JNDI プロバイダの URL (オプション)" -#. Tag: entry -#, no-c-format -msgid "hibernate.jndi.class" +#. Tag: property +#: configuration.xml:257 +#, fuzzy, no-c-format +msgid "hibernate.jndi.class" msgstr "hibernate.jndi.class" #. Tag: entry +#: configuration.xml:259 #, no-c-format msgid "" "class of the JNDI InitialContextFactorydatabase user (optional)" msgstr "データベースユーザ (オプション)" #. Tag: entry +#: configuration.xml:273 #, no-c-format msgid "database user password (optional)" msgstr "データベースユーザのパスワード (オプション)" #. Tag: para +#: configuration.xml:280 #, no-c-format msgid "" "Here is an example hibernate.properties file for an " @@ -426,7 +562,26 @@ msgstr "" "アプリケーションサーバーから提供された JNDI データソースを使う " "hibernate.properties ファイルの例を示します:" +#. Tag: programlisting +#: configuration.xml:283 +#, fuzzy, no-c-format +msgid "" +"hibernate.connection.datasource = java:/comp/env/jdbc/test\n" +"hibernate.transaction.factory_class = \\\n" +" org.hibernate.transaction.JTATransactionFactory\n" +"hibernate.transaction.manager_lookup_class = \\\n" +" org.hibernate.transaction.JBossTransactionManagerLookup\n" +"hibernate.dialect = org.hibernate.dialect.PostgreSQLDialect" +msgstr "" +"hibernate.connection.datasource = java:/comp/env/jdbc/test\n" +"hibernate.transaction.factory_class = \\n" +" org.hibernate.transaction.JTATransactionFactory\n" +"hibernate.transaction.manager_lookup_class = \\n" +" org.hibernate.transaction.JBossTransactionManagerLookup\n" +"hibernate.dialect = org.hibernate.dialect.PostgreSQLDialect" + #. Tag: para +#: configuration.xml:285 #, no-c-format msgid "" "JDBC connections obtained from a JNDI datasource will automatically " @@ -436,6 +591,7 @@ msgstr "" "コンテナ管理トランザクションに自動的に参加します。" #. Tag: para +#: configuration.xml:289 #, no-c-format msgid "" "Arbitrary connection properties can be given by prepending " @@ -449,6 +605,7 @@ msgstr "" "property> を使います。" #. Tag: para +#: configuration.xml:294 #, no-c-format msgid "" "You can define your own plugin strategy for obtaining JDBC connections by " @@ -463,11 +620,13 @@ msgstr "" "connection.provider_class
に設定してください。" #. Tag: title +#: configuration.xml:302 #, no-c-format msgid "Optional configuration properties" msgstr "オプション設定プロパティ" #. Tag: para +#: configuration.xml:304 #, no-c-format msgid "" "There are a number of other properties that control the behavior of " @@ -477,6 +636,7 @@ msgstr "" "プロパティはすべて妥当なデフォルト値があり、任意で設定します。" #. Tag: para +#: configuration.xml:309 #, fuzzy, no-c-format msgid "" "Some of these properties are \"system-level\" only. " @@ -490,16 +650,19 @@ msgstr "" "方法は ありません 。" #. Tag: title +#: configuration.xml:318 #, no-c-format msgid "Hibernate Configuration Properties" msgstr "Hibernate 設定プロパティ" -#. Tag: entry -#, no-c-format -msgid "hibernate.dialect" +#. Tag: property +#: configuration.xml:335 +#, fuzzy, no-c-format +msgid "hibernate.dialect" msgstr "hibernate.dialect" #. Tag: entry +#: configuration.xml:337 #, no-c-format msgid "" "The classname of a Hibernate org.hibernate.dialect.Dialecte.g. full.classname.of." @@ -520,6 +684,7 @@ msgstr "" "literal>" #. Tag: para +#: configuration.xml:341 #, no-c-format msgid "" "In most cases Hibernate will actually be able to choose the correct " @@ -527,12 +692,14 @@ msgid "" "the JDBC metadata returned by the JDBC driver." msgstr "" -#. Tag: entry -#, no-c-format -msgid "hibernate.show_sql" +#. Tag: property +#: configuration.xml:349 +#, fuzzy, no-c-format +msgid "hibernate.show_sql" msgstr "hibernate.show_sql" #. Tag: entry +#: configuration.xml:351 #, no-c-format msgid "" "Write all SQL statements to console. This is an alternative to setting the " @@ -544,6 +711,11 @@ msgstr "" "法の代替手段です。" #. Tag: para +#: configuration.xml:353 configuration.xml:361 configuration.xml:426 +#: configuration.xml:435 configuration.xml:443 configuration.xml:453 +#: configuration.xml:468 configuration.xml:525 configuration.xml:545 +#: configuration.xml:555 configuration.xml:598 configuration.xml:797 +#: configuration.xml:808 configuration.xml:904 #, no-c-format msgid "" "e.g. true | " @@ -552,22 +724,26 @@ msgstr "" "true | " "false" -#. Tag: entry -#, no-c-format -msgid "hibernate.format_sql" +#. Tag: property +#: configuration.xml:359 +#, fuzzy, no-c-format +msgid "hibernate.format_sql" msgstr "hibernate.format_sql" #. Tag: entry +#: configuration.xml:361 #, no-c-format msgid "Pretty print the SQL in the log and console." msgstr "ログとコンソールの SQL を整形して表示します。" -#. Tag: entry -#, no-c-format -msgid "hibernate.default_schema" +#. Tag: property +#: configuration.xml:367 +#, fuzzy, no-c-format +msgid "hibernate.default_schema" msgstr "hibernate.default_schema" #. Tag: entry +#: configuration.xml:369 #, no-c-format msgid "" "Qualify unqualified table names with the given schema/tablespace in " @@ -575,34 +751,40 @@ msgid "" msgstr "生成される SQL 文のテーブルに設定するスキーマ/テーブルスペースです。" #. Tag: para +#: configuration.xml:370 #, no-c-format msgid "" "e.g. SCHEMA_NAME" msgstr "例.SCHEMA_NAME" -#. Tag: entry -#, no-c-format -msgid "hibernate.default_catalog" +#. Tag: property +#: configuration.xml:376 +#, fuzzy, no-c-format +msgid "hibernate.default_catalog" msgstr "hibernate.default_catalog" #. Tag: entry +#: configuration.xml:378 #, no-c-format msgid "" "Qualifies unqualified table names with the given catalog in generated SQL." msgstr "生成される SQL 文のテーブルに設定するカタログです。" #. Tag: para +#: configuration.xml:379 #, no-c-format msgid "" "e.g. CATALOG_NAME" msgstr "CATALOG_NAME" -#. Tag: entry -#, no-c-format -msgid "hibernate.session_factory_name" +#. Tag: property +#: configuration.xml:384 +#, fuzzy, no-c-format +msgid "hibernate.session_factory_name" msgstr "hibernate.session_factory_name" #. Tag: entry +#: configuration.xml:386 #, no-c-format msgid "" "The org.hibernate.SessionFactory will be " @@ -612,6 +794,7 @@ msgstr "" "前で JNDI に自動的に登録されます。" #. Tag: para +#: configuration.xml:389 configuration.xml:776 #, no-c-format msgid "" "e.g. jndi/composite/namejndi/composite/name" -#. Tag: entry -#, no-c-format -msgid "hibernate.max_fetch_depth" +#. Tag: property +#: configuration.xml:394 +#, fuzzy, no-c-format +msgid "hibernate.max_fetch_depth" msgstr "hibernate.max_fetch_depth" #. Tag: entry +#: configuration.xml:396 #, no-c-format msgid "" "Sets a maximum \"depth\" for the outer join fetch tree for single-ended " @@ -636,6 +821,7 @@ msgstr "" "ます。" #. Tag: para +#: configuration.xml:398 #, no-c-format msgid "" "e.g. recommended values between " @@ -644,17 +830,20 @@ msgstr "" "例: 推奨する値は 0 " "から 3 の間です。" -#. Tag: entry -#, no-c-format -msgid "hibernate.default_batch_fetch_size" +#. Tag: property +#: configuration.xml:404 +#, fuzzy, no-c-format +msgid "hibernate.default_batch_fetch_size" msgstr "hibernate.default_batch_fetch_size" #. Tag: entry +#: configuration.xml:406 #, no-c-format msgid "Sets a default size for Hibernate batch fetching of associations." msgstr "関連フェッチのデフォルト Hibernate バッチサイズを指定します。" #. Tag: para +#: configuration.xml:407 #, no-c-format msgid "" "e.g. recommended values 4例: 推奨する値は 4 , 8 , 16 です。" -#. Tag: entry -#, no-c-format -msgid "hibernate.default_entity_mode" +#. Tag: property +#: configuration.xml:413 +#, fuzzy, no-c-format +msgid "hibernate.default_entity_mode" msgstr "hibernate.default_entity_mode" #. Tag: entry +#: configuration.xml:415 #, fuzzy, no-c-format msgid "" "Sets a default mode for entity representation for all sessions opened from " @@ -678,6 +869,7 @@ msgstr "" "エンティティのデフォルトモードを設定します。" #. Tag: para +#: configuration.xml:416 #, no-c-format msgid "" "dynamic-map, dom4j, pojodynamic-map, dom4j, pojo" -#. Tag: entry -#, no-c-format -msgid "hibernate.order_updates" +#. Tag: property +#: configuration.xml:422 +#, fuzzy, no-c-format +msgid "hibernate.order_updates" msgstr "hibernate.order_updates" #. Tag: entry +#: configuration.xml:424 #, no-c-format msgid "" "Forces Hibernate to order SQL updates by the primary key value of the items " @@ -702,12 +896,14 @@ msgstr "" "合、同時実行可能なシステムでは、まれにデッドロックが発生する可能性がありま" "す。" -#. Tag: entry -#, no-c-format -msgid "hibernate.generate_statistics" -msgstr "hibernate.generate_statistics" +#. Tag: property +#: configuration.xml:432 +#, fuzzy, no-c-format +msgid "hibernate.generate_statistics" +msgstr "Hibernate 統計" #. Tag: entry +#: configuration.xml:434 #, no-c-format msgid "" "If enabled, Hibernate will collect statistics useful for performance tuning." @@ -715,12 +911,14 @@ msgstr "" "有効の場合、 Hibernate はパフォーマンスチューニングに有効な統計情報を収集しま" "す。" -#. Tag: entry -#, no-c-format -msgid "hibernate.use_identifier_rollback" +#. Tag: property +#: configuration.xml:440 +#, fuzzy, no-c-format +msgid "hibernate.use_identifier_rollback" msgstr "hibernate.use_identifier_rollback" #. Tag: entry +#: configuration.xml:442 #, no-c-format msgid "" "If enabled, generated identifier properties will be reset to default values " @@ -729,12 +927,14 @@ msgstr "" "有効の場合、オブジェクトが削除されたときに識別子プロパティをリセットし、デ" "フォルト値にしたものを生成します。" -#. Tag: entry -#, no-c-format -msgid "hibernate.use_sql_comments" +#. Tag: property +#: configuration.xml:449 +#, fuzzy, no-c-format +msgid "hibernate.use_sql_comments" msgstr "hibernate.use_sql_comments" #. Tag: entry +#: configuration.xml:451 #, no-c-format msgid "" "If turned on, Hibernate will generate comments inside the SQL, for easier " @@ -743,17 +943,51 @@ msgstr "" "有効の場合、 SQL 内にコメントを生成します。これはデバックを容易にします。デ" "フォルトの値は false です。" +#. Tag: property +#: configuration.xml:458 +#, no-c-format +msgid "hibernate.id.new_generator_mappings" +msgstr "" + +#. Tag: entry +#: configuration.xml:460 +#, no-c-format +msgid "" +"Setting is relevant when using @GeneratedValue. It " +"indicates whether or not the new IdentifierGenerator " +"implementations are used for javax.persistence.GenerationType." +"AUTO, javax.persistence.GenerationType.TABLE and javax.persistence.GenerationType.SEQUENCE. Default to false to keep backward " +"compatibility." +msgstr "" + +#. Tag: para +#: configuration.xml:476 +#, no-c-format +msgid "" +"We recommend all new projects which make use of to use " +"@GeneratedValue to also set hibernate.id." +"new_generator_mappings=true as the new generators are more efficient " +"and closer to the JPA 2 specification semantic. However they are not " +"backward compatible with existing databases (if a sequence or a table is " +"used for id generation)." +msgstr "" + #. Tag: title +#: configuration.xml:485 #, no-c-format msgid "Hibernate JDBC and Connection Properties" msgstr "Hibernate JDBC とコネクションプロパティ" -#. Tag: entry -#, no-c-format -msgid "hibernate.jdbc.fetch_size" +#. Tag: property +#: configuration.xml:503 +#, fuzzy, no-c-format +msgid "hibernate.jdbc.fetch_size" msgstr "hibernate.jdbc.fetch_size" #. Tag: entry +#: configuration.xml:505 #, no-c-format msgid "" "A non-zero value determines the JDBC fetch size (calls Statement." @@ -762,17 +996,20 @@ msgstr "" "値が0でない場合、 JDBC フェッチサイズを決定します ( Statement." "setFetchSize() を呼びます)。" -#. Tag: entry -#, no-c-format -msgid "hibernate.jdbc.batch_size" +#. Tag: property +#: configuration.xml:510 +#, fuzzy, no-c-format +msgid "hibernate.jdbc.batch_size" msgstr "hibernate.jdbc.batch_size" #. Tag: entry +#: configuration.xml:512 #, no-c-format msgid "A non-zero value enables use of JDBC2 batch updates by Hibernate." msgstr "値が0でない場合、 Hibernate が JDBC2 バッチ更新を使用します。" #. Tag: para +#: configuration.xml:513 #, no-c-format msgid "" "e.g. recommended values between " @@ -781,16 +1018,18 @@ msgstr "" "例: 推奨する値は 5 " "から 30 の間です。" -#. Tag: entry -#, no-c-format -msgid "hibernate.jdbc.batch_versioned_data" +#. Tag: property +#: configuration.xml:519 +#, fuzzy, no-c-format +msgid "hibernate.jdbc.batch_versioned_data" msgstr "hibernate.jdbc.batch_versioned_data" #. Tag: entry -#, no-c-format +#: configuration.xml:521 +#, fuzzy, no-c-format msgid "" "Set this property to true if your JDBC driver returns " -"correct row counts from executeBatch(). Iit is usually " +"correct row counts from executeBatch(). It is usually " "safe to turn this option on. Hibernate will then use batched DML for " "automatically versioned data. Defaults to false." msgstr "" @@ -799,12 +1038,14 @@ msgstr "" "オプションを ON するのが安全です)。 Hibernate は、自動バージョンデータのため" "バッチ DML を使います。デフォルトの値は false です。" -#. Tag: entry -#, no-c-format -msgid "hibernate.jdbc.factory_class" +#. Tag: property +#: configuration.xml:531 +#, fuzzy, no-c-format +msgid "hibernate.jdbc.factory_class" msgstr "hibernate.jdbc.factory_class" #. Tag: entry +#: configuration.xml:533 #, no-c-format msgid "" "Select a custom org.hibernate.jdbc.Batcher. " @@ -814,6 +1055,7 @@ msgstr "" "す。ほとんどのアプリケーションに、この設定プロパティは必要ありません。" #. Tag: para +#: configuration.xml:535 #, no-c-format msgid "" "e.g. classname.of." @@ -822,12 +1064,14 @@ msgstr "" "classname.of.BatcherFactory" -#. Tag: entry -#, no-c-format -msgid "hibernate.jdbc.use_scrollable_resultset" +#. Tag: property +#: configuration.xml:541 +#, fuzzy, no-c-format +msgid "hibernate.jdbc.use_scrollable_resultset" msgstr "hibernate.jdbc.use_scrollable_resultset" #. Tag: entry +#: configuration.xml:543 #, no-c-format msgid "" "Enables use of JDBC2 scrollable resultsets by Hibernate. This property is " @@ -839,12 +1083,14 @@ msgstr "" "場合のみ必要で、そうでなければ Hibernate はコネクションメタデータを使用しま" "す。" -#. Tag: entry -#, no-c-format -msgid "hibernate.jdbc.use_streams_for_binary" +#. Tag: property +#: configuration.xml:551 +#, fuzzy, no-c-format +msgid "hibernate.jdbc.use_streams_for_binary" msgstr "hibernate.jdbc.use_streams_for_binary" #. Tag: entry +#: configuration.xml:553 #, no-c-format msgid "" "Use streams when writing/reading binary or " @@ -854,12 +1100,14 @@ msgstr "" "JDBC へ/から binaryserializable の" "書き込み/読み込みストリームを使います (システムレベルのプロパティ)。" -#. Tag: entry -#, no-c-format -msgid "hibernate.jdbc.use_get_generated_keys" +#. Tag: property +#: configuration.xml:561 +#, fuzzy, no-c-format +msgid "hibernate.jdbc.use_get_generated_keys" msgstr "hibernate.jdbc.use_get_generated_keys" #. Tag: entry +#: configuration.xml:563 #, no-c-format msgid "" "Enables use of JDBC3 PreparedStatement.getGeneratedKeys() " @@ -875,16 +1123,20 @@ msgstr "" "クションメタデータを使いドライバの能力を決定します。" #. Tag: para +#: configuration.xml:569 configuration.xml:678 configuration.xml:687 +#: configuration.xml:696 configuration.xml:723 #, no-c-format msgid "e.g. true|false" msgstr "true|false" -#. Tag: entry -#, no-c-format -msgid "hibernate.connection.provider_class" +#. Tag: property +#: configuration.xml:574 +#, fuzzy, no-c-format +msgid "hibernate.connection.provider_class" msgstr "hibernate.connection.provider_class" #. Tag: entry +#: configuration.xml:576 #, no-c-format msgid "" "The classname of a custom org.hibernate.connection." @@ -895,6 +1147,7 @@ msgstr "" "literal> のクラス名。" #. Tag: para +#: configuration.xml:578 #, no-c-format msgid "" "e.g. classname.of." @@ -903,12 +1156,14 @@ msgstr "" "classname.of." "ConnectionProvider" -#. Tag: entry -#, no-c-format -msgid "hibernate.connection.isolation" +#. Tag: property +#: configuration.xml:584 +#, fuzzy, no-c-format +msgid "hibernate.connection.isolation" msgstr "hibernate.connection.isolation" #. Tag: entry +#: configuration.xml:586 #, no-c-format msgid "" "Sets the JDBC transaction isolation level. Check java.sql." @@ -922,27 +1177,32 @@ msgstr "" "ん。" #. Tag: para +#: configuration.xml:589 #, no-c-format msgid "e.g. 1, 2, 4, 8" msgstr "1, 2, 4, 8" -#. Tag: entry -#, no-c-format -msgid "hibernate.connection.autocommit" +#. Tag: property +#: configuration.xml:595 +#, fuzzy, no-c-format +msgid "hibernate.connection.autocommit" msgstr "hibernate.connection.autocommit" #. Tag: entry +#: configuration.xml:597 #, no-c-format msgid "Enables autocommit for JDBC pooled connections (it is not recommended)." msgstr "" "プールされている JDBC コネクションの自動コミットを有効にする(非推奨)。" -#. Tag: entry -#, no-c-format -msgid "hibernate.connection.release_mode" +#. Tag: property +#: configuration.xml:603 +#, fuzzy, no-c-format +msgid "hibernate.connection.release_mode" msgstr "hibernate.connection.release_mode" #. Tag: entry +#: configuration.xml:605 #, no-c-format msgid "" "Specifies when Hibernate should release JDBC connections. By default, a JDBC " @@ -966,6 +1226,7 @@ msgstr "" "の場合、 after_transaction でクローズします。" #. Tag: para +#: configuration.xml:615 #, no-c-format msgid "" "e.g. auto (default) " @@ -977,15 +1238,15 @@ msgstr "" "after_statement" #. Tag: para -#, no-c-format +#: configuration.xml:618 +#, fuzzy, no-c-format msgid "" "This setting only affects Sessions returned from " "SessionFactory.openSession. For Sessions obtained through SessionFactory.getCurrentSession, the CurrentSessionContext implementation " "configured for use controls the connection release mode for those " -"Sessions. See " +"Sessions. See" msgstr "" "この設定は SessionFactory.openSession から取得した " "Session だけに効果があります。 SessionFactory." @@ -995,6 +1256,7 @@ msgstr "" "> を参照してください。" #. Tag: entry +#: configuration.xml:630 #, no-c-format msgid "" "hibernate.connection.<propertyName>" #. Tag: entry +#: configuration.xml:632 #, no-c-format msgid "" "Pass the JDBC property <propertyName> to " @@ -1013,6 +1276,7 @@ msgstr "" "DriverManager.getConnection() に渡します。" #. Tag: entry +#: configuration.xml:638 #, fuzzy, no-c-format msgid "" "hibernate.jndi.<propertyName>" @@ -1021,6 +1285,7 @@ msgstr "" "使って、システムプロパティとして" #. Tag: entry +#: configuration.xml:640 #, no-c-format msgid "" "Pass the property <propertyName> to the JNDI " @@ -1030,21 +1295,25 @@ msgstr "" "InitialContextFactory に渡します。" #. Tag: title +#: configuration.xml:648 #, no-c-format msgid "Hibernate Cache Properties" msgstr "Hibernate キャッシュプロパティ" -#. Tag: entry -#, no-c-format -msgid "hibernate.cache.provider_class" +#. Tag: literal +#: configuration.xml:665 +#, fuzzy, no-c-format +msgid "hibernate.cache.provider_class" msgstr "hibernate.cache.provider_class" #. Tag: entry +#: configuration.xml:667 #, no-c-format msgid "The classname of a custom CacheProvider." msgstr "カスタム CacheProvider のクラス名です。" #. Tag: para +#: configuration.xml:668 #, no-c-format msgid "" "e.g. classname.of." @@ -1053,12 +1322,14 @@ msgstr "" "classname.of.CacheProvider" -#. Tag: entry -#, no-c-format -msgid "hibernate.cache.use_minimal_puts" +#. Tag: literal +#: configuration.xml:673 +#, fuzzy, no-c-format +msgid "hibernate.cache.use_minimal_puts" msgstr "hibernate.cache.use_minimal_puts" #. Tag: entry +#: configuration.xml:675 #, no-c-format msgid "" "Optimizes second-level cache operation to minimize writes, at the cost of " @@ -1070,24 +1341,28 @@ msgstr "" "キャッシュで役に立ちます。 Hibernate3 ではクラスタキャッシュ実装用にデフォル" "トでは有効になっています。 " -#. Tag: entry -#, no-c-format -msgid "hibernate.cache.use_query_cache" +#. Tag: literal +#: configuration.xml:684 +#, fuzzy, no-c-format +msgid "hibernate.cache.use_query_cache" msgstr "hibernate.cache.use_query_cache" #. Tag: entry +#: configuration.xml:686 #, no-c-format msgid "" "Enables the query cache. Individual queries still have to be set cachable." msgstr "" "特定のクエリがキャッシュ可能な場合に、クエリキャッシュを有効にします。 " -#. Tag: entry -#, no-c-format -msgid "hibernate.cache.use_second_level_cache" +#. Tag: literal +#: configuration.xml:692 +#, fuzzy, no-c-format +msgid "hibernate.cache.use_second_level_cache" msgstr "hibernate.cache.use_second_level_cache" #. Tag: entry +#: configuration.xml:694 #, no-c-format msgid "" "Can be used to completely disable the second level cache, which is enabled " @@ -1097,12 +1372,14 @@ msgstr "" "二次キャッシュを完全に無効にする場合に使います。デフォルトでは有効で、クラス" "の <cache> マッピングで制御します。" -#. Tag: entry -#, no-c-format -msgid "hibernate.cache.query_cache_factory" +#. Tag: literal +#: configuration.xml:702 +#, fuzzy, no-c-format +msgid "hibernate.cache.query_cache_factory" msgstr "hibernate.cache.query_cache_factory" #. Tag: entry +#: configuration.xml:704 #, no-c-format msgid "" "The classname of a custom QueryCache interface, defaults " @@ -1112,6 +1389,7 @@ msgstr "" "す。デフォルトでは StandardQueryCache になります。" #. Tag: para +#: configuration.xml:706 #, no-c-format msgid "" "e.g. classname.of.QueryCachee.g. classname.of.QueryCache" -#. Tag: entry -#, no-c-format -msgid "hibernate.cache.region_prefix" +#. Tag: literal +#: configuration.xml:712 +#, fuzzy, no-c-format +msgid "hibernate.cache.region_prefix" msgstr "hibernate.cache.region_prefix" #. Tag: entry +#: configuration.xml:714 #, no-c-format msgid "A prefix to use for second-level cache region names." msgstr "二次キャッシュの領域名の接頭辞です。" #. Tag: para +#: configuration.xml:714 #, no-c-format msgid "e.g. prefix" msgstr "prefix" -#. Tag: entry -#, no-c-format -msgid "hibernate.cache.use_structured_entries" +#. Tag: literal +#: configuration.xml:720 +#, fuzzy, no-c-format +msgid "hibernate.cache.use_structured_entries" msgstr "hibernate.cache.use_structured_entries" #. Tag: entry +#: configuration.xml:722 #, no-c-format msgid "" "Forces Hibernate to store data in the second-level cache in a more human-" @@ -1148,17 +1431,36 @@ msgid "" msgstr "" "二次キャッシュに格納するデータを、人が理解しやすいフォーマットにします。 " +#. Tag: literal +#: configuration.xml:729 +#, no-c-format +msgid "hibernate.cache.default_cache_concurrency_strategy" +msgstr "" + +#. Tag: entry +#: configuration.xml:731 +#, no-c-format +msgid "" +"Setting used to give the name of the default org.hibernate." +"annotations.CacheConcurrencyStrategy to use when either " +"@Cacheable or @Cache is used. " +"@Cache(strategy=\"..\") is used to override this default." +msgstr "" + #. Tag: title +#: configuration.xml:744 #, no-c-format msgid "Hibernate Transaction Properties" msgstr "Hibernate トランザクションプロパティ" -#. Tag: entry -#, no-c-format -msgid "hibernate.transaction.factory_class" +#. Tag: literal +#: configuration.xml:761 +#, fuzzy, no-c-format +msgid "hibernate.transaction.factory_class" msgstr "hibernate.transaction.factory_class" #. Tag: entry +#: configuration.xml:763 #, no-c-format msgid "" "The classname of a TransactionFactory to use with " @@ -1170,6 +1472,7 @@ msgstr "" "JDBCTransactionFactory です)。" #. Tag: para +#: configuration.xml:765 #, no-c-format msgid "" "e.g. classname.of." @@ -1178,12 +1481,14 @@ msgstr "" "classname.of." "TransactionFactory>" -#. Tag: entry -#, no-c-format -msgid "jta.UserTransaction" +#. Tag: literal +#: configuration.xml:771 +#, fuzzy, no-c-format +msgid "jta.UserTransaction" msgstr "jta.UserTransaction" #. Tag: entry +#: configuration.xml:773 #, no-c-format msgid "" "A JNDI name used by JTATransactionFactory to obtain the " @@ -1192,12 +1497,14 @@ msgstr "" "アプリケーションサーバーから JTA UserTransaction を取得す" "るために JTATransactionFactory に使われる JNDI 名です。" -#. Tag: entry +#. Tag: literal +#: configuration.xml:781 #, fuzzy, no-c-format -msgid "hibernate.transaction.manager_lookup_class" +msgid "hibernate.transaction.manager_lookup_class" msgstr "hibernate.transaction. manager_lookup_class" #. Tag: entry +#: configuration.xml:783 #, no-c-format msgid "" "The classname of a TransactionManagerLookup. It is " @@ -1209,6 +1516,7 @@ msgstr "" "ときに必要です。" #. Tag: para +#: configuration.xml:786 #, no-c-format msgid "" "e.g. classname.of." @@ -1217,34 +1525,38 @@ msgstr "" "classname.of." "TransactionManagerLookup" -#. Tag: entry +#. Tag: literal +#: configuration.xml:792 #, fuzzy, no-c-format -msgid "hibernate.transaction.flush_before_completion" +msgid "hibernate.transaction.flush_before_completion" msgstr "hibernate.transaction. flush_before_completion" #. Tag: entry -#, no-c-format +#: configuration.xml:794 +#, fuzzy, no-c-format msgid "" "If enabled, the session will be automatically flushed during the before " "completion phase of the transaction. Built-in and automatic session context " -"management is preferred, see ." msgstr "" "有効の場合、トランザクションの completion フェーズの前に自動的にセッションを" "フラッシュします。内蔵の自動セッションコンテキスト管理に適しています。 を参照してください。" -#. Tag: entry +#. Tag: literal +#: configuration.xml:803 #, fuzzy, no-c-format -msgid "hibernate.transaction.auto_close_session" +msgid "hibernate.transaction.auto_close_session" msgstr "hibernate.transaction. auto_close_session" #. Tag: entry -#, no-c-format +#: configuration.xml:805 +#, fuzzy, no-c-format msgid "" "If enabled, the session will be automatically closed during the after " "completion phase of the transaction. Built-in and automatic session context " -"management is preferred, see ." msgstr "" "有効の場合、トランザクションの completion フェーズの後にセッションを自動的に" @@ -1252,27 +1564,31 @@ msgstr "" "linkend=\"architecture-current-session\"/> を参照してください。" #. Tag: title +#: configuration.xml:817 #, no-c-format msgid "Miscellaneous Properties" msgstr "その他のプロパティ" -#. Tag: entry +#. Tag: literal +#: configuration.xml:834 #, fuzzy, no-c-format -msgid "hibernate.current_session_context_class" +msgid "hibernate.current_session_context_class" msgstr "hibernate. current_session_context_class" #. Tag: entry -#, no-c-format +#: configuration.xml:836 +#, fuzzy, no-c-format msgid "" "Supply a custom strategy for the scoping of the \"current\" " "Session. See for more information about the built-in strategies." +"\"/> for more information about the built-in strategies." msgstr "" "「現在の」 Session のための(カスタム)戦略を提供します。" "ビルトインストラテジーに関するその他の情報については を参照してください。" #. Tag: para +#: configuration.xml:839 #, no-c-format msgid "" "e.g. jta | " @@ -1283,17 +1599,20 @@ msgstr "" "thread | managed | custom." "Class" -#. Tag: entry -#, no-c-format -msgid "hibernate.query.factory_class" +#. Tag: literal +#: configuration.xml:846 +#, fuzzy, no-c-format +msgid "hibernate.query.factory_class" msgstr "hibernate.query.factory_class" #. Tag: entry +#: configuration.xml:848 #, no-c-format msgid "Chooses the HQL parser implementation." msgstr "HQL パーサーの実装を選択します。" #. Tag: para +#: configuration.xml:848 #, no-c-format msgid "" "e.g. org.hibernate.hql.ast." @@ -1304,12 +1623,14 @@ msgstr "" "ASTQueryTranslatorFactory or org.hibernate.hql.classic." "ClassicQueryTranslatorFactory" -#. Tag: entry -#, no-c-format -msgid "hibernate.query.substitutions" -msgstr "hibernate.query.substitutions" +#. Tag: literal +#: configuration.xml:857 +#, fuzzy, no-c-format +msgid "hibernate.query.substitutions" +msgstr "hibernate.query.substitutions true=1, false=0" #. Tag: entry +#: configuration.xml:859 #, no-c-format msgid "" "Is used to map from tokens in Hibernate queries to SQL tokens (tokens might " @@ -1319,6 +1640,7 @@ msgstr "" "名です)。" #. Tag: para +#: configuration.xml:861 #, no-c-format msgid "" "e.g. hqlLiteral=SQL_LITERAL, " @@ -1327,12 +1649,14 @@ msgstr "" "hqlLiteral=SQL_LITERAL, " "hqlFunction=SQLFUNC" -#. Tag: entry -#, no-c-format -msgid "hibernate.hbm2ddl.auto" +#. Tag: literal +#: configuration.xml:867 +#, fuzzy, no-c-format +msgid "hibernate.hbm2ddl.auto" msgstr "hibernate.hbm2ddl.auto" #. Tag: entry +#: configuration.xml:869 #, no-c-format msgid "" "Automatically validates or exports schema DDL to the database when the " @@ -1346,6 +1670,7 @@ msgstr "" "をドロップします。" #. Tag: para +#: configuration.xml:873 #, no-c-format msgid "" "e.g. validate | " @@ -1356,12 +1681,48 @@ msgstr "" "update | create | create-" "drop" -#. Tag: entry +#. Tag: literal +#: configuration.xml:880 #, fuzzy, no-c-format -msgid "hibernate.cglib.use_reflection_optimizer" +msgid "hibernate.hbm2ddl.import_file" +msgstr "hibernate.hbm2ddl.auto" + +#. Tag: para +#: configuration.xml:882 +#, no-c-format +msgid "" +"Comma-separated names of the optional files containing SQL DML statements " +"executed during the SessionFactory creation. This is " +"useful for testing or demoing: by adding INSERT statements for example you " +"can populate your database with a minimal set of data when it is deployed." +msgstr "" + +#. Tag: para +#: configuration.xml:887 +#, no-c-format +msgid "" +"File order matters, the statements of a give file are executed before the " +"statements of the following files. These statements are only executed if the " +"schema is created ie if hibernate.hbm2ddl.auto is set to " +"create or create-drop." +msgstr "" + +#. Tag: para +#: configuration.xml:892 +#, fuzzy, no-c-format +msgid "" +"e.g. /humans.sql,/dogs.sql" +msgstr "true|false" + +#. Tag: literal +#: configuration.xml:898 +#, fuzzy, no-c-format +msgid "hibernate.cglib.use_reflection_optimizer" msgstr "hibernate.cglib. use_reflection_optimizer" #. Tag: entry +#: configuration.xml:900 #, no-c-format msgid "" "Enables the use of CGLIB instead of runtime reflection (System-level " @@ -1376,11 +1737,13 @@ msgstr "" "literal> で設定できません。" #. Tag: title +#: configuration.xml:913 #, no-c-format msgid "SQL Dialects" msgstr "SQL 方言(Dialect)" #. Tag: para +#: configuration.xml:915 #, no-c-format msgid "" "Always set the hibernate.dialect property to the correct " @@ -1396,256 +1759,307 @@ msgstr "" "定する手間が省けます。" #. Tag: title +#: configuration.xml:922 #, no-c-format msgid "Hibernate SQL Dialects (hibernate.dialect)" msgstr "Hibernate SQL Dialects (hibernate.dialect)" #. Tag: entry +#: configuration.xml:933 #, no-c-format msgid "RDBMS" msgstr "RDBMS" #. Tag: entry +#: configuration.xml:935 #, no-c-format msgid "Dialect" msgstr "Dialect" #. Tag: entry +#: configuration.xml:941 #, no-c-format -msgid "DB2" -msgstr "DB2" +msgid "DB2" +msgstr "DB2" -#. Tag: entry -#, no-c-format -msgid "org.hibernate.dialect.DB2Dialect" +#. Tag: literal +#: configuration.xml:943 +#, fuzzy, no-c-format +msgid "org.hibernate.dialect.DB2Dialect" msgstr "org.hibernate.dialect.DB2Dialect" #. Tag: entry +#: configuration.xml:947 #, no-c-format msgid "DB2 AS/400" msgstr "DB2 AS/400" -#. Tag: entry -#, no-c-format -msgid "org.hibernate.dialect.DB2400Dialect" +#. Tag: literal +#: configuration.xml:949 +#, fuzzy, no-c-format +msgid "org.hibernate.dialect.DB2400Dialect" msgstr "org.hibernate.dialect.DB2400Dialect" #. Tag: entry +#: configuration.xml:953 #, no-c-format msgid "DB2 OS390" msgstr "DB2 OS390" -#. Tag: entry -#, no-c-format -msgid "org.hibernate.dialect.DB2390Dialect" +#. Tag: literal +#: configuration.xml:955 +#, fuzzy, no-c-format +msgid "org.hibernate.dialect.DB2390Dialect" msgstr "org.hibernate.dialect.DB2390Dialect" #. Tag: entry +#: configuration.xml:959 #, no-c-format msgid "PostgreSQL" msgstr "PostgreSQL" -#. Tag: entry -#, no-c-format -msgid "org.hibernate.dialect.PostgreSQLDialect" +#. Tag: literal +#: configuration.xml:961 +#, fuzzy, no-c-format +msgid "org.hibernate.dialect.PostgreSQLDialect" msgstr "org.hibernate.dialect.PostgreSQLDialect" #. Tag: entry +#: configuration.xml:965 #, no-c-format msgid "MySQL" msgstr "MySQL" -#. Tag: entry -#, no-c-format -msgid "org.hibernate.dialect.MySQLDialect" +#. Tag: literal +#: configuration.xml:967 +#, fuzzy, no-c-format +msgid "org.hibernate.dialect.MySQLDialect" msgstr "org.hibernate.dialect.MySQLDialect" #. Tag: entry +#: configuration.xml:971 #, no-c-format msgid "MySQL with InnoDB" msgstr "MySQL with InnoDB" -#. Tag: entry -#, no-c-format -msgid "org.hibernate.dialect.MySQLInnoDBDialect" +#. Tag: literal +#: configuration.xml:973 +#, fuzzy, no-c-format +msgid "org.hibernate.dialect.MySQLInnoDBDialect" msgstr "org.hibernate.dialect.MySQLInnoDBDialect" #. Tag: entry +#: configuration.xml:977 #, no-c-format msgid "MySQL with MyISAM" msgstr "MySQL with MyISAM" -#. Tag: entry -#, no-c-format -msgid "org.hibernate.dialect.MySQLMyISAMDialect" +#. Tag: literal +#: configuration.xml:979 +#, fuzzy, no-c-format +msgid "org.hibernate.dialect.MySQLMyISAMDialect" msgstr "org.hibernate.dialect.MySQLMyISAMDialect" #. Tag: entry +#: configuration.xml:983 #, no-c-format msgid "Oracle (any version)" msgstr "Oracle (いずれのバージョンでも)" -#. Tag: entry -#, no-c-format -msgid "org.hibernate.dialect.OracleDialect" +#. Tag: literal +#: configuration.xml:985 +#, fuzzy, no-c-format +msgid "org.hibernate.dialect.OracleDialect" msgstr "org.hibernate.dialect.OracleDialect" #. Tag: entry +#: configuration.xml:989 #, no-c-format msgid "Oracle 9i" msgstr "Oracle 9i" -#. Tag: entry -#, no-c-format -msgid "org.hibernate.dialect.Oracle9iDialect" +#. Tag: literal +#: configuration.xml:991 +#, fuzzy, no-c-format +msgid "org.hibernate.dialect.Oracle9iDialect" msgstr "org.hibernate.dialect.Oracle9iDialect" #. Tag: entry +#: configuration.xml:995 #, no-c-format msgid "Oracle 10g" msgstr "Oracle 10g" -#. Tag: entry -#, no-c-format -msgid "org.hibernate.dialect.Oracle10gDialect" +#. Tag: literal +#: configuration.xml:997 +#, fuzzy, no-c-format +msgid "org.hibernate.dialect.Oracle10gDialect" msgstr "org.hibernate.dialect.Oracle10gDialect" #. Tag: entry +#: configuration.xml:1001 #, no-c-format msgid "Sybase" msgstr "Sybase" -#. Tag: entry -#, no-c-format -msgid "org.hibernate.dialect.SybaseDialect" +#. Tag: literal +#: configuration.xml:1003 +#, fuzzy, no-c-format +msgid "org.hibernate.dialect.SybaseDialect" msgstr "org.hibernate.dialect.SybaseDialect" #. Tag: entry +#: configuration.xml:1007 #, no-c-format msgid "Sybase Anywhere" msgstr "Sybase Anywhere" -#. Tag: entry -#, no-c-format -msgid "org.hibernate.dialect.SybaseAnywhereDialect" +#. Tag: literal +#: configuration.xml:1009 +#, fuzzy, no-c-format +msgid "org.hibernate.dialect.SybaseAnywhereDialect" msgstr "org.hibernate.dialect.SybaseAnywhereDialect" #. Tag: entry +#: configuration.xml:1013 #, no-c-format msgid "Microsoft SQL Server" msgstr "Microsoft SQL Server" -#. Tag: entry -#, no-c-format -msgid "org.hibernate.dialect.SQLServerDialect" +#. Tag: literal +#: configuration.xml:1015 +#, fuzzy, no-c-format +msgid "org.hibernate.dialect.SQLServerDialect" msgstr "org.hibernate.dialect.SQLServerDialect" #. Tag: entry +#: configuration.xml:1019 #, no-c-format msgid "SAP DB" msgstr "SAP DB" -#. Tag: entry -#, no-c-format -msgid "org.hibernate.dialect.SAPDBDialect" +#. Tag: literal +#: configuration.xml:1021 +#, fuzzy, no-c-format +msgid "org.hibernate.dialect.SAPDBDialect" msgstr "org.hibernate.dialect.SAPDBDialect" #. Tag: entry +#: configuration.xml:1025 #, no-c-format msgid "Informix" msgstr "Informix" -#. Tag: entry -#, no-c-format -msgid "org.hibernate.dialect.InformixDialect" +#. Tag: literal +#: configuration.xml:1027 +#, fuzzy, no-c-format +msgid "org.hibernate.dialect.InformixDialect" msgstr "org.hibernate.dialect.InformixDialect" #. Tag: entry +#: configuration.xml:1031 #, no-c-format msgid "HypersonicSQL" msgstr "HypersonicSQL" -#. Tag: entry -#, no-c-format -msgid "org.hibernate.dialect.HSQLDialect" +#. Tag: literal +#: configuration.xml:1033 +#, fuzzy, no-c-format +msgid "org.hibernate.dialect.HSQLDialect" msgstr "org.hibernate.dialect.HSQLDialect" #. Tag: entry +#: configuration.xml:1037 #, no-c-format msgid "Ingres" msgstr "Ingres" -#. Tag: entry -#, no-c-format -msgid "org.hibernate.dialect.IngresDialect" +#. Tag: literal +#: configuration.xml:1039 +#, fuzzy, no-c-format +msgid "org.hibernate.dialect.IngresDialect" msgstr "org.hibernate.dialect.IngresDialect" #. Tag: entry +#: configuration.xml:1043 #, no-c-format msgid "Progress" msgstr "Progress" -#. Tag: entry -#, no-c-format -msgid "org.hibernate.dialect.ProgressDialect" +#. Tag: literal +#: configuration.xml:1045 +#, fuzzy, no-c-format +msgid "org.hibernate.dialect.ProgressDialect" msgstr "org.hibernate.dialect.ProgressDialect" #. Tag: entry +#: configuration.xml:1049 #, no-c-format msgid "Mckoi SQL" msgstr "Mckoi SQL" -#. Tag: entry -#, no-c-format -msgid "org.hibernate.dialect.MckoiDialect" +#. Tag: literal +#: configuration.xml:1051 +#, fuzzy, no-c-format +msgid "org.hibernate.dialect.MckoiDialect" msgstr "org.hibernate.dialect.MckoiDialect" #. Tag: entry +#: configuration.xml:1055 #, no-c-format msgid "Interbase" msgstr "Interbase" -#. Tag: entry -#, no-c-format -msgid "org.hibernate.dialect.InterbaseDialect" +#. Tag: literal +#: configuration.xml:1057 +#, fuzzy, no-c-format +msgid "org.hibernate.dialect.InterbaseDialect" msgstr "org.hibernate.dialect.InterbaseDialect" #. Tag: entry +#: configuration.xml:1061 #, no-c-format msgid "Pointbase" msgstr "Pointbase" -#. Tag: entry -#, no-c-format -msgid "org.hibernate.dialect.PointbaseDialect" +#. Tag: literal +#: configuration.xml:1063 +#, fuzzy, no-c-format +msgid "org.hibernate.dialect.PointbaseDialect" msgstr "org.hibernate.dialect.PointbaseDialect" #. Tag: entry +#: configuration.xml:1067 #, no-c-format msgid "FrontBase" msgstr "FrontBase" -#. Tag: entry -#, no-c-format -msgid "org.hibernate.dialect.FrontbaseDialect" +#. Tag: literal +#: configuration.xml:1069 +#, fuzzy, no-c-format +msgid "org.hibernate.dialect.FrontbaseDialect" msgstr "org.hibernate.dialect.FrontbaseDialect" #. Tag: entry +#: configuration.xml:1073 #, no-c-format msgid "Firebird" msgstr "Firebird" -#. Tag: entry -#, no-c-format -msgid "org.hibernate.dialect.FirebirdDialect" +#. Tag: literal +#: configuration.xml:1075 +#, fuzzy, no-c-format +msgid "org.hibernate.dialect.FirebirdDialect" msgstr "org.hibernate.dialect.FirebirdDialect" #. Tag: title +#: configuration.xml:1083 #, no-c-format msgid "Outer Join Fetching" msgstr "外部結合フェッチ" #. Tag: para +#: configuration.xml:1085 #, no-c-format msgid "" "If your database supports ANSI, Oracle or Sybase style outer joins, " @@ -1664,6 +2078,7 @@ msgstr "" "ます。" #. Tag: para +#: configuration.xml:1094 #, no-c-format msgid "" "Outer join fetching can be disabled globally by setting " @@ -1679,18 +2094,21 @@ msgstr "" "としてマッピングされます。" #. Tag: para -#, no-c-format -msgid "See for more information." +#: configuration.xml:1100 +#, fuzzy, no-c-format +msgid "See for more information." msgstr "" "さらに情報が見たければ を参照してく" "ださい。" #. Tag: title +#: configuration.xml:1105 #, no-c-format msgid "Binary Streams" msgstr "バイナリストリーム" #. Tag: para +#: configuration.xml:1107 #, no-c-format msgid "" "Oracle limits the size of byte arrays that can be passed " @@ -1706,27 +2124,31 @@ msgstr "" "はシステムレベルの設定だけです 。" #. Tag: title +#: configuration.xml:1116 #, no-c-format msgid "Second-level and query cache" msgstr "ニ次キャッシュとクエリキャッシュ" #. Tag: para -#, no-c-format +#: configuration.xml:1118 +#, fuzzy, no-c-format msgid "" "The properties prefixed by hibernate.cache allow you to " "use a process or cluster scoped second-level cache system with Hibernate. " -"See the for more information." +"See the for more information." msgstr "" "hibernate.cache プロパティ接頭辞は Hibernate でプロセスや" "クラスタ二次キャッシュを使うとことを許可します。 により多くの詳細があります。" #. Tag: title +#: configuration.xml:1125 #, no-c-format msgid "Query Language Substitution" msgstr "クエリ言語の置き換え" #. Tag: para +#: configuration.xml:1127 #, no-c-format msgid "" "You can define new Hibernate query tokens using hibernate.query." @@ -1735,7 +2157,14 @@ msgstr "" "hibernate.query.substitutions を使うことで、新しい " "Hibernate クエリトークンを定義できます。例:" +#. Tag: programlisting +#: configuration.xml:1130 +#, no-c-format +msgid "hibernate.query.substitutions true=1, false=0" +msgstr "hibernate.query.substitutions true=1, false=0" + #. Tag: para +#: configuration.xml:1132 #, no-c-format msgid "" "This would cause the tokens true and falsetruefalse を、生成さ" "れる SQL において整数リテラルに翻訳します。" +#. Tag: programlisting +#: configuration.xml:1136 +#, no-c-format +msgid "hibernate.query.substitutions toLowercase=LOWER" +msgstr "hibernate.query.substitutions toLowercase=LOWER" + #. Tag: para +#: configuration.xml:1138 #, no-c-format msgid "" "This would allow you to rename the SQL LOWER function." @@ -1752,11 +2188,13 @@ msgstr "" "これは SQL の LOWER 関数の名前の付け替えを可能にします。" #. Tag: title +#: configuration.xml:1143 #, no-c-format msgid "Hibernate statistics" msgstr "Hibernate 統計" #. Tag: para +#: configuration.xml:1145 #, no-c-format msgid "" "If you enable hibernate.generate_statistics, Hibernate " @@ -1772,11 +2210,13 @@ msgstr "" "stats パッケージ内のインターフェースにはより多くの情報があります。" #. Tag: title +#: configuration.xml:1155 #, no-c-format msgid "Logging" msgstr "ロギング" #. Tag: para +#: configuration.xml:1157 #, no-c-format msgid "" "Hibernate utilizes Simple Logging " @@ -1794,6 +2234,7 @@ msgid "" msgstr "" #. Tag: para +#: configuration.xml:1171 #, no-c-format msgid "" "It is recommended that you familiarize yourself with Hibernate's log " @@ -1807,56 +2248,67 @@ msgstr "" "ルシューティングデバイスです。以下に重要なログのカテゴリを示します:" #. Tag: title +#: configuration.xml:1178 #, no-c-format msgid "Hibernate Log Categories" msgstr "Hibernate ログカテゴリ" #. Tag: entry +#: configuration.xml:1187 #, no-c-format msgid "Category" msgstr "カテゴリ" #. Tag: entry +#: configuration.xml:1189 #, no-c-format msgid "Function" msgstr "機能" -#. Tag: entry -#, no-c-format -msgid "org.hibernate.SQL" -msgstr "org.hibernate.SQL" +#. Tag: literal +#: configuration.xml:1195 +#, fuzzy, no-c-format +msgid "org.hibernate.SQL" +msgstr "org.hibernate" #. Tag: entry +#: configuration.xml:1197 #, no-c-format msgid "Log all SQL DML statements as they are executed" msgstr "実行したすべての SQL(DDL)ステートメントをロギングします。" -#. Tag: entry -#, no-c-format -msgid "org.hibernate.type" -msgstr "org.hibernate.type" +#. Tag: literal +#: configuration.xml:1201 +#, fuzzy, no-c-format +msgid "org.hibernate.type" +msgstr "org.hibernate" #. Tag: entry +#: configuration.xml:1203 #, no-c-format msgid "Log all JDBC parameters" msgstr "すべての JDBC パラメータをロギングします。" -#. Tag: entry +#. Tag: literal +#: configuration.xml:1207 #, fuzzy, no-c-format -msgid "org.hibernate.tool.hbm2ddl" +msgid "org.hibernate.tool.hbm2ddl" msgstr "org.hibernate.tool. hbm2ddl" #. Tag: entry +#: configuration.xml:1209 #, no-c-format msgid "Log all SQL DDL statements as they are executed" msgstr "実行したすべての SQL(DDL)ステートメントをロギングします。" -#. Tag: entry -#, no-c-format -msgid "org.hibernate.pretty" -msgstr "org.hibernate.pretty" +#. Tag: literal +#: configuration.xml:1213 +#, fuzzy, no-c-format +msgid "org.hibernate.pretty" +msgstr "org.hibernate" #. Tag: entry +#: configuration.xml:1215 #, no-c-format msgid "" "Log the state of all entities (max 20 entities) associated with the session " @@ -1865,62 +2317,74 @@ msgstr "" "session に関連するすべてのエンティティ(最大20)のフラッシュ時間をロギング" "します。" -#. Tag: entry -#, no-c-format -msgid "org.hibernate.cache" -msgstr "org.hibernate.cache" +#. Tag: literal +#: configuration.xml:1220 +#, fuzzy, no-c-format +msgid "org.hibernate.cache" +msgstr "org.hibernate" #. Tag: entry +#: configuration.xml:1222 #, no-c-format msgid "Log all second-level cache activity" msgstr "すべてのニ次キャッシュの動作をロギングします。" -#. Tag: entry +#. Tag: literal +#: configuration.xml:1226 #, fuzzy, no-c-format -msgid "org.hibernate.transaction" +msgid "org.hibernate.transaction" msgstr "org.hibernate. transaction" #. Tag: entry +#: configuration.xml:1228 #, no-c-format msgid "Log transaction related activity" msgstr "トランザクションに関連する動作をロギングします。" -#. Tag: entry -#, no-c-format -msgid "org.hibernate.jdbc" -msgstr "org.hibernate.jdbc" +#. Tag: literal +#: configuration.xml:1232 +#, fuzzy, no-c-format +msgid "org.hibernate.jdbc" +msgstr "org.hibernate" #. Tag: entry +#: configuration.xml:1234 #, no-c-format msgid "Log all JDBC resource acquisition" msgstr "JDBC リソース取得をロギングします。" -#. Tag: entry +#. Tag: literal +#: configuration.xml:1238 #, fuzzy, no-c-format -msgid "org.hibernate.hql.ast.AST" +msgid "org.hibernate.hql.ast.AST" msgstr "org.hibernate.hql. ast.AST" #. Tag: entry +#: configuration.xml:1240 #, no-c-format msgid "Log HQL and SQL ASTs during query parsing" msgstr "HQL と SQL の AST のクエリパースをロギングします。" -#. Tag: entry -#, no-c-format -msgid "org.hibernate.secure" -msgstr "org.hibernate.secure" +#. Tag: literal +#: configuration.xml:1244 +#, fuzzy, no-c-format +msgid "org.hibernate.secure" +msgstr "org.hibernate" #. Tag: entry +#: configuration.xml:1246 #, no-c-format msgid "Log all JAAS authorization requests" msgstr "すべての JAAS 分析をロギングします。" -#. Tag: entry -#, fuzzy, no-c-format -msgid "org.hibernate" -msgstr "SessionFactory の JNDI への登録" +#. Tag: literal +#: configuration.xml:1250 +#, no-c-format +msgid "org.hibernate" +msgstr "org.hibernate" #. Tag: entry +#: configuration.xml:1252 #, no-c-format msgid "" "Log everything. This is a lot of information but it is useful for " @@ -1930,6 +2394,7 @@ msgstr "" "便利です)" #. Tag: para +#: configuration.xml:1259 #, no-c-format msgid "" "When developing applications with Hibernate, you should almost always work " @@ -1943,11 +2408,13 @@ msgstr "" "有効にする方法があります。" #. Tag: title +#: configuration.xml:1266 #, no-c-format msgid "Implementing a NamingStrategy" msgstr "NamingStrategy を選択" #. Tag: para +#: configuration.xml:1268 #, no-c-format msgid "" "The interface org.hibernate.cfg.NamingStrategy allows you " @@ -1958,6 +2425,7 @@ msgstr "" "す。" #. Tag: para +#: configuration.xml:1272 #, no-c-format msgid "" "You can provide rules for automatically generating database identifiers from " @@ -1975,6 +2443,7 @@ msgstr "" "なり最小限に近いものです。" #. Tag: para +#: configuration.xml:1279 #, no-c-format msgid "" "You can specify a different strategy by calling Configuration." @@ -1983,7 +2452,24 @@ msgstr "" "マッピングを追加する前に Configuration.setNamingStrategy() を呼ぶことで以下のように異なる戦略を指定することができます:" +#. Tag: programlisting +#: configuration.xml:1283 +#, fuzzy, no-c-format +msgid "" +"SessionFactory sf = new Configuration()\n" +" .setNamingStrategy(ImprovedNamingStrategy.INSTANCE)\n" +" .addFile(\"Item.hbm.xml\")\n" +" .addFile(\"Bid.hbm.xml\")\n" +" .buildSessionFactory();" +msgstr "" +"SessionFactory sf = new Configuration()\n" +" .setNamingStrategy(ImprovedNamingStrategy.INSTANCE)\n" +" .addFile(\"Item.hbm.xml\")\n" +" .addFile(\"Bid.hbm.xml\")\n" +" .buildSessionFactory();" + #. Tag: para +#: configuration.xml:1285 #, no-c-format msgid "" "org.hibernate.cfg.ImprovedNamingStrategy is a built-in " @@ -1994,11 +2480,13 @@ msgstr "" "ん。" #. Tag: title +#: configuration.xml:1291 #, no-c-format msgid "XML configuration file" msgstr "XML 設定ファイル" #. Tag: para +#: configuration.xml:1293 #, no-c-format msgid "" "An alternative approach to configuration is to specify a full configuration " @@ -2012,6 +2500,7 @@ msgstr "" "置き換えられます。" #. Tag: para +#: configuration.xml:1299 #, no-c-format msgid "" "The XML configuration file is by default expected to be in the root of your " @@ -2020,7 +2509,92 @@ msgstr "" "XML 設定ファイルは初期設定で CLASSPATH の root に配置して" "ください。これが例です:" +#. Tag: programlisting +#: configuration.xml:1302 +#, fuzzy, no-c-format +msgid "" +"<?xml version='1.0' encoding='utf-8'?>\n" +"<!DOCTYPE hibernate-configuration PUBLIC\n" +" \"-//Hibernate/Hibernate Configuration DTD//EN\"\n" +" \"http://hibernate.sourceforge.net/hibernate-configuration-3.0.dtd" +"\">\n" +"\n" +"<hibernate-configuration>\n" +"\n" +" <!-- a SessionFactory instance listed as /jndi/name -->\n" +" <session-factory\n" +" name=\"java:hibernate/SessionFactory\">\n" +"\n" +" <!-- properties -->\n" +" <property name=\"connection.datasource\">java:/comp/env/jdbc/" +"MyDB</property>\n" +" <property name=\"dialect\">org.hibernate.dialect." +"MySQLDialect</property>\n" +" <property name=\"show_sql\">false</property>\n" +" <property name=\"transaction.factory_class\">\n" +" org.hibernate.transaction.JTATransactionFactory\n" +" </property>\n" +" <property name=\"jta.UserTransaction\">java:comp/" +"UserTransaction</property>\n" +"\n" +" <!-- mapping files -->\n" +" <mapping resource=\"org/hibernate/auction/Item.hbm.xml\"/>\n" +" <mapping resource=\"org/hibernate/auction/Bid.hbm.xml\"/>\n" +"\n" +" <!-- cache settings -->\n" +" <class-cache class=\"org.hibernate.auction.Item\" usage=\"read-" +"write\"/>\n" +" <class-cache class=\"org.hibernate.auction.Bid\" usage=\"read-only" +"\"/>\n" +" <collection-cache collection=\"org.hibernate.auction.Item.bids\" " +"usage=\"read-write\"/>\n" +"\n" +" </session-factory>\n" +"\n" +"</hibernate-configuration>" +msgstr "" +"<?xml version='1.0' encoding='utf-8'?>\n" +"<!DOCTYPE hibernate-configuration PUBLIC\n" +" \"-//Hibernate/Hibernate Configuration DTD//EN\"\n" +" \"http://hibernate.sourceforge.net/hibernate-configuration-3.0.dtd" +"\">\n" +"\n" +"<hibernate-configuration>\n" +"\n" +" <!-- a SessionFactory instance listed as /jndi/name -->\n" +" <session-factory\n" +" name=\"java:hibernate/SessionFactory\">\n" +"\n" +" <!-- properties -->\n" +" <property name=\"connection.datasource\">java:/comp/env/jdbc/" +"MyDB</property>\n" +" <property name=\"dialect\">org.hibernate.dialect." +"MySQLDialect</property>\n" +" <property name=\"show_sql\">false</property>\n" +" <property name=\"transaction.factory_class\">\n" +" org.hibernate.transaction.JTATransactionFactory\n" +" </property>\n" +" <property name=\"jta.UserTransaction\">java:comp/" +"UserTransaction</property>\n" +"\n" +" <!-- mapping files -->\n" +" <mapping resource=\"org/hibernate/auction/Item.hbm.xml\"/>\n" +" <mapping resource=\"org/hibernate/auction/Bid.hbm.xml\"/>\n" +"\n" +" <!-- cache settings -->\n" +" <class-cache class=\"org.hibernate.auction.Item\" usage=\"read-" +"write\"/>\n" +" <class-cache class=\"org.hibernate.auction.Bid\" usage=\"read-only" +"\"/>\n" +" <collection-cache collection=\"org.hibernate.auction.Item.bids\" " +"usage=\"read-write\"/>\n" +"\n" +" </session-factory>\n" +"\n" +"</hibernate-configuration>" + #. Tag: para +#: configuration.xml:1304 #, no-c-format msgid "" "The advantage of this approach is the externalization of the mapping file " @@ -2038,26 +2612,51 @@ msgstr "" "ところといえば XML 構文を使うことの利点だけです。" #. Tag: para +#: configuration.xml:1311 #, no-c-format msgid "With the XML configuration, starting Hibernate is then as simple as:" msgstr "XML 設定を使うことで、 Hibernate は以下のようにシンプルになります。" +#. Tag: programlisting +#: configuration.xml:1314 +#, fuzzy, no-c-format +msgid "" +"SessionFactory sf = new Configuration().configure().buildSessionFactory();" +msgstr "" +"SessionFactory sf = new Configuration().configure().buildSessionFactory();" + #. Tag: para +#: configuration.xml:1316 #, no-c-format msgid "You can select a different XML configuration file using:" msgstr "違う XML 設定ファイルを使うこともできます。" +#. Tag: programlisting +#: configuration.xml:1318 +#, fuzzy, no-c-format +msgid "" +"SessionFactory sf = new Configuration()\n" +" .configure(\"catdb.cfg.xml\")\n" +" .buildSessionFactory();" +msgstr "" +"SessionFactory sf = new Configuration()\n" +" .configure(\"catdb.cfg.xml\")\n" +" .buildSessionFactory();" + #. Tag: title +#: configuration.xml:1322 #, no-c-format msgid "J2EE Application Server integration" msgstr "J2EE アプリケーションサーバーとの統合" #. Tag: para +#: configuration.xml:1324 #, no-c-format msgid "Hibernate has the following integration points for J2EE infrastructure:" msgstr "Hibernate は J2EE 構造と統合するポイントをサポートしています:" #. Tag: para +#: configuration.xml:1329 #, no-c-format msgid "" "Container-managed datasources: Hibernate can use JDBC " @@ -2078,6 +2677,7 @@ msgstr "" "の Transaction API を使いたくなるかもしれません。" #. Tag: para +#: configuration.xml:1343 #, no-c-format msgid "" "Automatic JNDI binding: Hibernate can bind its " @@ -2087,6 +2687,7 @@ msgstr "" "がった後に SessionFactory を生成します。" #. Tag: para +#: configuration.xml:1350 #, no-c-format msgid "" "JTA Session binding: the Hibernate SessionJMX deployment: if you have a JMX capable application " @@ -2125,6 +2727,7 @@ msgstr "" "しなければなりません)。" #. Tag: para +#: configuration.xml:1373 #, no-c-format msgid "" "Depending on your environment, you might have to set the configuration " @@ -2136,11 +2739,13 @@ msgstr "" "aggressive_release を true にしてください。" #. Tag: title +#: configuration.xml:1379 #, no-c-format msgid "Transaction strategy configuration" msgstr "トランザクション戦略設定" #. Tag: para +#: configuration.xml:1381 #, no-c-format msgid "" "The Hibernate Session API is independent of any " @@ -2158,6 +2763,7 @@ msgstr "" "ことになるでしょう。" #. Tag: para +#: configuration.xml:1389 #, no-c-format msgid "" "To keep your code portable between these two (and other) environments we " @@ -2174,26 +2780,31 @@ msgstr "" "literal> クラスのインスタンスを持つことができます。" #. Tag: para +#: configuration.xml:1397 #, no-c-format msgid "There are three standard, or built-in, choices:" msgstr "3つの基本的な(既にある)選択を挙げます:" -#. Tag: term -#, no-c-format -msgid "org.hibernate.transaction.JDBCTransactionFactory" +#. Tag: literal +#: configuration.xml:1401 +#, fuzzy, no-c-format +msgid "org.hibernate.transaction.JDBCTransactionFactory" msgstr "org.hibernate.transaction.JDBCTransactionFactory" #. Tag: para +#: configuration.xml:1404 #, no-c-format msgid "delegates to database (JDBC) transactions (default)" msgstr "データベース (JDBC) トランザクションに委譲します(デフォルト)" -#. Tag: term -#, no-c-format -msgid "org.hibernate.transaction.JTATransactionFactory" +#. Tag: literal +#: configuration.xml:1409 +#, fuzzy, no-c-format +msgid "org.hibernate.transaction.JTATransactionFactory" msgstr "org.hibernate.transaction.JTATransactionFactory" #. Tag: para +#: configuration.xml:1412 #, no-c-format msgid "" "delegates to container-managed transactions if an existing transaction is " @@ -2205,17 +2816,20 @@ msgstr "" "ない場合は、新しいトランザクションが開始されており、 Bean 管理トランザクショ" "ンが使われます。" -#. Tag: term -#, no-c-format -msgid "org.hibernate.transaction.CMTTransactionFactory" +#. Tag: literal +#: configuration.xml:1420 +#, fuzzy, no-c-format +msgid "org.hibernate.transaction.CMTTransactionFactory" msgstr "org.hibernate.transaction.CMTTransactionFactory" #. Tag: para +#: configuration.xml:1423 #, no-c-format msgid "delegates to container-managed JTA transactions" msgstr "コンテナ管理 JTA トランザクションに委譲します" #. Tag: para +#: configuration.xml:1428 #, no-c-format msgid "" "You can also define your own transaction strategies (for a CORBA transaction " @@ -2225,6 +2839,7 @@ msgstr "" "義することもできます。" #. Tag: para +#: configuration.xml:1431 #, no-c-format msgid "" "Some features in Hibernate (i.e., the second level cache, Contextual " @@ -2242,151 +2857,164 @@ msgstr "" "る必要があります。" #. Tag: title +#: configuration.xml:1439 #, no-c-format msgid "JTA TransactionManagers" msgstr "JTA トランザクションマネージャ" #. Tag: entry +#: configuration.xml:1448 #, no-c-format msgid "Transaction Factory" msgstr "Transaction Factory" #. Tag: entry +#: configuration.xml:1450 #, no-c-format msgid "Application Server" msgstr "Application Server" -#. Tag: entry +#. Tag: literal +#: configuration.xml:1456 #, fuzzy, no-c-format -msgid "" -"org.hibernate.transaction.JBossTransactionManagerLookup" +msgid "org.hibernate.transaction.JBossTransactionManagerLookup" msgstr "" "org.hibernate.transaction. JBossTransactionManagerLookup" #. Tag: entry +#: configuration.xml:1458 #, no-c-format msgid "JBoss" msgstr "JBoss" -#. Tag: entry +#. Tag: literal +#: configuration.xml:1462 #, fuzzy, no-c-format -msgid "" -"org.hibernate.transaction.WeblogicTransactionManagerLookup" +msgid "org.hibernate.transaction.WeblogicTransactionManagerLookup" msgstr "" "org.hibernate.transaction. WeblogicTransactionManagerLookup" #. Tag: entry +#: configuration.xml:1464 #, no-c-format msgid "Weblogic" msgstr "Weblogic" -#. Tag: entry +#. Tag: literal +#: configuration.xml:1468 #, fuzzy, no-c-format -msgid "" -"org.hibernate.transaction.WebSphereTransactionManagerLookup" +msgid "org.hibernate.transaction.WebSphereTransactionManagerLookup" msgstr "" "org.hibernate.transaction. WebSphereTransactionManagerLookup" #. Tag: entry +#: configuration.xml:1470 #, no-c-format msgid "WebSphere" msgstr "WebSphere" -#. Tag: entry +#. Tag: literal +#: configuration.xml:1474 #, fuzzy, no-c-format -msgid "" -"org.hibernate.transaction.WebSphereExtendedJTATransactionLookup" +msgid "org.hibernate.transaction.WebSphereExtendedJTATransactionLookup" msgstr "" "org.hibernate.transaction. WebSphereExtendedJTATransactionLookup" #. Tag: entry +#: configuration.xml:1476 #, no-c-format msgid "WebSphere 6" msgstr "WebSphere 6" -#. Tag: entry +#. Tag: literal +#: configuration.xml:1480 #, fuzzy, no-c-format -msgid "" -"org.hibernate.transaction.OrionTransactionManagerLookup" +msgid "org.hibernate.transaction.OrionTransactionManagerLookup" msgstr "" "org.hibernate.transaction. OrionTransactionManagerLookup" #. Tag: entry +#: configuration.xml:1482 #, no-c-format msgid "Orion" msgstr "Orion" -#. Tag: entry +#. Tag: literal +#: configuration.xml:1486 #, fuzzy, no-c-format -msgid "" -"org.hibernate.transaction.ResinTransactionManagerLookup" +msgid "org.hibernate.transaction.ResinTransactionManagerLookup" msgstr "" "org.hibernate.transaction. ResinTransactionManagerLookup" #. Tag: entry +#: configuration.xml:1488 #, no-c-format msgid "Resin" msgstr "Resin" -#. Tag: entry +#. Tag: literal +#: configuration.xml:1492 #, fuzzy, no-c-format -msgid "" -"org.hibernate.transaction.JOTMTransactionManagerLookup" +msgid "org.hibernate.transaction.JOTMTransactionManagerLookup" msgstr "" "org.hibernate.transaction. JOTMTransactionManagerLookup" #. Tag: entry +#: configuration.xml:1494 #, no-c-format msgid "JOTM" msgstr "JOTM" -#. Tag: entry +#. Tag: literal +#: configuration.xml:1498 #, fuzzy, no-c-format -msgid "" -"org.hibernate.transaction.JOnASTransactionManagerLookup" +msgid "org.hibernate.transaction.JOnASTransactionManagerLookup" msgstr "" "org.hibernate.transaction. JOnASTransactionManagerLookup" #. Tag: entry +#: configuration.xml:1500 #, no-c-format msgid "JOnAS" msgstr "JOnAS" -#. Tag: entry +#. Tag: literal +#: configuration.xml:1504 #, fuzzy, no-c-format -msgid "" -"org.hibernate.transaction.JRun4TransactionManagerLookup" +msgid "org.hibernate.transaction.JRun4TransactionManagerLookup" msgstr "" "org.hibernate.transaction. JRun4TransactionManagerLookup" #. Tag: entry +#: configuration.xml:1506 #, no-c-format msgid "JRun4" msgstr "JRun4" -#. Tag: entry +#. Tag: literal +#: configuration.xml:1510 #, fuzzy, no-c-format -msgid "" -"org.hibernate.transaction.BESTransactionManagerLookup" +msgid "org.hibernate.transaction.BESTransactionManagerLookup" msgstr "" "org.hibernate.transaction. BESTransactionManagerLookup" #. Tag: entry +#: configuration.xml:1512 #, no-c-format msgid "Borland ES" msgstr "Borland ES" #. Tag: title +#: configuration.xml:1520 #, no-c-format msgid "JNDI-bound SessionFactory" msgstr "SessionFactory の JNDI への登録" #. Tag: para +#: configuration.xml:1522 #, no-c-format msgid "" "A JNDI-bound Hibernate SessionFactory can simplify the " @@ -2400,6 +3028,7 @@ msgstr "" "じ登録を使うことに注意してください。" #. Tag: para +#: configuration.xml:1528 #, no-c-format msgid "" "If you wish to have the SessionFactory bound to a JNDI " @@ -2417,6 +3046,7 @@ msgstr "" "り専用の環境の場合は特に便利です。)" #. Tag: para +#: configuration.xml:1536 #, no-c-format msgid "" "When binding the SessionFactory to JNDI, Hibernate will " @@ -2430,6 +3060,7 @@ msgstr "" "い場合は、デフォルトの InitialContext を使用します。" #. Tag: para +#: configuration.xml:1542 #, no-c-format msgid "" "Hibernate will automatically place the SessionFactory in " @@ -2447,6 +3078,7 @@ msgstr "" "論します)。" #. Tag: para +#: configuration.xml:1550 #, no-c-format msgid "" "If you use a JNDI SessionFactory, an EJB or any other " @@ -2457,7 +3089,8 @@ msgstr "" "JNDI ルックアップを使って SessionFactory を取得します。" #. Tag: para -#, no-c-format +#: configuration.xml:1554 +#, fuzzy, no-c-format msgid "" "It is recommended that you bind the SessionFactory to " "JNDI in a managed environment and use a static singleton " @@ -2465,7 +3098,7 @@ msgid "" "recommend to hide the actual lookup code for a SessionFactory in a helper class, such as HibernateUtil.getSessionFactory" "(). Note that such a class is also a convenient way to startup " -"Hibernate—see chapter 1." +"Hibernate—see chapter 1." msgstr "" "管理された環境では SessionFactory を JNDI にバインドし、そ" "うでなければ static シングルトンを使うことを推奨します。こ" @@ -2476,22 +3109,24 @@ msgstr "" "ます。 - 1章を参照してください。" #. Tag: title +#: configuration.xml:1565 #, no-c-format msgid "Current Session context management with JTA" msgstr "JTA による現在のセッションコンテキストマネージメント" #. Tag: para -#, no-c-format +#: configuration.xml:1567 +#, fuzzy, no-c-format msgid "" "The easiest way to handle Sessions and transactions is " "Hibernate's automatic \"current\" Session management. For " "a discussion of contextual sessions see . Using the \"jta\" session context, if there " +"session\"/>. Using the \"jta\" session context, if there " "is no Hibernate Session associated with the current JTA " "transaction, one will be started and associated with that JTA transaction " "the first time you call sessionFactory.getCurrentSession(). The Sessions retrieved via " -"getCurrentSession() in the\"jta\" " +"getCurrentSession() in the \"jta\" " "context are set to automatically flush before the transaction completes, " "close after the transaction completes, and aggressively release JDBC " "connections after each statement. This allows the Sessioncfg.buildSessionFactory() still has to be " @@ -2543,6 +3180,7 @@ msgstr "" "emphasis> として Hibernate をデプロイするか、どちらかで実行できます。" #. Tag: para +#: configuration.xml:1598 #, no-c-format msgid "" "Hibernate is distributed with org.hibernate.jmx.HibernateServicejboss-service.xml を示します。" +#. Tag: programlisting +#: configuration.xml:1604 +#, fuzzy, no-c-format +msgid "" +"<?xml version=\"1.0\"?>\n" +"<server>\n" +"\n" +"<mbean code=\"org.hibernate.jmx.HibernateService\"\n" +" name=\"jboss.jca:service=HibernateFactory,name=HibernateFactory\">\n" +"\n" +" <!-- Required services -->\n" +" <depends>jboss.jca:service=RARDeployer</depends>\n" +" <depends>jboss.jca:service=LocalTxCM,name=HsqlDS</depends>\n" +"\n" +" <!-- Bind the Hibernate service to JNDI -->\n" +" <attribute name=\"JndiName\">java:/hibernate/SessionFactory</" +"attribute>\n" +"\n" +" <!-- Datasource settings -->\n" +" <attribute name=\"Datasource\">java:HsqlDS</attribute>\n" +" <attribute name=\"Dialect\">org.hibernate.dialect.HSQLDialect</" +"attribute>\n" +"\n" +" <!-- Transaction integration -->\n" +" <attribute name=\"TransactionStrategy\">\n" +" org.hibernate.transaction.JTATransactionFactory</attribute>\n" +" <attribute name=\"TransactionManagerLookupStrategy\">\n" +" org.hibernate.transaction.JBossTransactionManagerLookup</" +"attribute>\n" +" <attribute name=\"FlushBeforeCompletionEnabled\">true</" +"attribute>\n" +" <attribute name=\"AutoCloseSessionEnabled\">true</" +"attribute>\n" +"\n" +" <!-- Fetching options -->\n" +" <attribute name=\"MaximumFetchDepth\">5</attribute>\n" +"\n" +" <!-- Second-level caching -->\n" +" <attribute name=\"SecondLevelCacheEnabled\">true</" +"attribute>\n" +" <attribute name=\"CacheProviderClass\">org.hibernate.cache." +"EhCacheProvider</attribute>\n" +" <attribute name=\"QueryCacheEnabled\">true</attribute>\n" +"\n" +" <!-- Logging -->\n" +" <attribute name=\"ShowSqlEnabled\">true</attribute>\n" +"\n" +" <!-- Mapping files -->\n" +" <attribute name=\"MapResources\">auction/Item.hbm.xml,auction/" +"Category.hbm.xml</attribute>\n" +"\n" +"</mbean>\n" +"\n" +"</server>" +msgstr "" +"<?xml version=\"1.0\"?>\n" +"<server>\n" +"\n" +"<mbean code=\"org.hibernate.jmx.HibernateService\"\n" +" name=\"jboss.jca:service=HibernateFactory,name=HibernateFactory\">\n" +"\n" +" <!-- Required services -->\n" +" <depends>jboss.jca:service=RARDeployer</depends>\n" +" <depends>jboss.jca:service=LocalTxCM,name=HsqlDS</depends>\n" +"\n" +" <!-- Bind the Hibernate service to JNDI -->\n" +" <attribute name=\"JndiName\">java:/hibernate/SessionFactory</" +"attribute>\n" +"\n" +" <!-- Datasource settings -->\n" +" <attribute name=\"Datasource\">java:HsqlDS</attribute>\n" +" <attribute name=\"Dialect\">org.hibernate.dialect.HSQLDialect</" +"attribute>\n" +"\n" +" <!-- Transaction integration -->\n" +" <attribute name=\"TransactionStrategy\">\n" +" org.hibernate.transaction.JTATransactionFactory</attribute>\n" +" <attribute name=\"TransactionManagerLookupStrategy\">\n" +" org.hibernate.transaction.JBossTransactionManagerLookup</" +"attribute>\n" +" <attribute name=\"FlushBeforeCompletionEnabled\">true</" +"attribute>\n" +" <attribute name=\"AutoCloseSessionEnabled\">true</" +"attribute>\n" +"\n" +" <!-- Fetching options -->\n" +" <attribute name=\"MaximumFetchDepth\">5</attribute>\n" +"\n" +" <!-- Second-level caching -->\n" +" <attribute name=\"SecondLevelCacheEnabled\">true</" +"attribute>\n" +" <attribute name=\"CacheProviderClass\">org.hibernate.cache." +"EhCacheProvider</attribute>\n" +" <attribute name=\"QueryCacheEnabled\">true</attribute>\n" +"\n" +" <!-- Logging -->\n" +" <attribute name=\"ShowSqlEnabled\">true</attribute>\n" +"\n" +" <!-- Mapping files -->\n" +" <attribute name=\"MapResources\">auction/Item.hbm.xml,auction/" +"Category.hbm.xml</attribute>\n" +"\n" +"</mbean>\n" +"\n" +"</server>" + #. Tag: para +#: configuration.xml:1606 #, no-c-format msgid "" "This file is deployed in a directory called META-INF and " @@ -2579,327 +3324,48 @@ msgstr "" "メントのより多くの情報があります。" #, fuzzy -#~ msgid "" -#~ "" -#~ msgstr "" -#~ "Configuration cfg = new Configuration()\n" -#~ " .addResource(\"Item.hbm.xml\")\n" -#~ " .addResource(\"Bid.hbm.xml\");" +#~ msgid "JDBC URL" +#~ msgstr "JDBC のドライバークラス" #, fuzzy -#~ msgid "" -#~ "" -#~ msgstr "" -#~ "Configuration cfg = new Configuration()\n" -#~ " .addClass(org.hibernate.auction.Item.class)\n" -#~ " .addClass(org.hibernate.auction.Bid.class);" +#~ msgid "database user" +#~ msgstr "データベースユーザ (オプション)" #, fuzzy -#~ msgid "" -#~ "" -#~ msgstr "" -#~ "Configuration cfg = new Configuration()\n" -#~ " .addClass(org.hibernate.auction.Item.class)\n" -#~ " .addClass(org.hibernate.auction.Bid.class)\n" -#~ " .setProperty(\"hibernate.dialect\", \"org.hibernate.dialect." -#~ "MySQLInnoDBDialect\")\n" -#~ " .setProperty(\"hibernate.connection.datasource\", \"java:comp/env/" -#~ "jdbc/test\")\n" -#~ " .setProperty(\"hibernate.order_updates\", \"true\");" +#~ msgid "database user password" +#~ msgstr "データベースユーザのパスワード (オプション)" #, fuzzy -#~ msgid "" -#~ msgstr "SessionFactory sessions = cfg.buildSessionFactory();" +#~ msgid "datasource JNDI name" +#~ msgstr "データベースユーザ (オプション)" + +#~ msgid "hibernate.generate_statistics" +#~ msgstr "hibernate.generate_statistics" + +#~ msgid "hibernate.query.substitutions" +#~ msgstr "hibernate.query.substitutions" + +#~ msgid "DB2" +#~ msgstr "DB2" + +#~ msgid "org.hibernate.SQL" +#~ msgstr "org.hibernate.SQL" + +#~ msgid "org.hibernate.type" +#~ msgstr "org.hibernate.type" + +#~ msgid "org.hibernate.pretty" +#~ msgstr "org.hibernate.pretty" + +#~ msgid "org.hibernate.cache" +#~ msgstr "org.hibernate.cache" + +#~ msgid "org.hibernate.jdbc" +#~ msgstr "org.hibernate.jdbc" + +#~ msgid "org.hibernate.secure" +#~ msgstr "org.hibernate.secure" #, fuzzy -#~ msgid "" -#~ "" -#~ msgstr "Session session = sessions.openSession(); // open a new Session" - -#~ msgid "database user" -#~ msgstr "データベースのユーザー" - -#~ msgid "database user password" -#~ msgstr "データベースユーザーパスワード" - -#, fuzzy -#~ msgid "" -#~ "" -#~ msgstr "" -#~ "hibernate.connection.driver_class = org.postgresql.Driver\n" -#~ "hibernate.connection.url = jdbc:postgresql://localhost/mydatabase\n" -#~ "hibernate.connection.username = myuser\n" -#~ "hibernate.connection.password = secret\n" -#~ "hibernate.c3p0.min_size=5\n" -#~ "hibernate.c3p0.max_size=20\n" -#~ "hibernate.c3p0.timeout=1800\n" -#~ "hibernate.c3p0.max_statements=50\n" -#~ "hibernate.dialect = org.hibernate.dialect.PostgreSQLDialect" - -#~ msgid "datasource JNDI name" -#~ msgstr "データソースの JNDI 名" - -#, fuzzy -#~ msgid "" -#~ "" -#~ msgstr "" -#~ "hibernate.connection.datasource = java:/comp/env/jdbc/test\n" -#~ "hibernate.transaction.factory_class = \\n" -#~ " org.hibernate.transaction.JTATransactionFactory\n" -#~ "hibernate.transaction.manager_lookup_class = \\n" -#~ " org.hibernate.transaction.JBossTransactionManagerLookup\n" -#~ "hibernate.dialect = org.hibernate.dialect.PostgreSQLDialect" - -#~ msgid "DB2" -#~ msgstr "DB2" - -#~ msgid "hibernate.query.substitutions true=1, false=0" -#~ msgstr "hibernate.query.substitutions true=1, false=0" - -#~ msgid "hibernate.query.substitutions toLowercase=LOWER" -#~ msgstr "hibernate.query.substitutions toLowercase=LOWER" - -#~ msgid "org.hibernate" -#~ msgstr "org.hibernate" - -#, fuzzy -#~ msgid "" -#~ "" -#~ msgstr "" -#~ "SessionFactory sf = new Configuration()\n" -#~ " .setNamingStrategy(ImprovedNamingStrategy.INSTANCE)\n" -#~ " .addFile(\"Item.hbm.xml\")\n" -#~ " .addFile(\"Bid.hbm.xml\")\n" -#~ " .buildSessionFactory();" - -#, fuzzy -#~ msgid "" -#~ "\n" -#~ "\n" -#~ "\n" -#~ "\n" -#~ "\n" -#~ " \n" -#~ " \n" -#~ "\n" -#~ " \n" -#~ " java:/comp/env/jdbc/" -#~ "MyDB\n" -#~ " org.hibernate.dialect.MySQLDialect\n" -#~ " false\n" -#~ " \n" -#~ " org.hibernate.transaction.JTATransactionFactory\n" -#~ " \n" -#~ " java:comp/UserTransaction\n" -#~ "\n" -#~ " \n" -#~ " \n" -#~ " \n" -#~ "\n" -#~ " \n" -#~ " \n" -#~ " \n" -#~ " \n" -#~ "\n" -#~ " \n" -#~ "\n" -#~ "]]>" -#~ msgstr "" -#~ "<?xml version='1.0' encoding='utf-8'?>\n" -#~ "<!DOCTYPE hibernate-configuration PUBLIC\n" -#~ " \"-//Hibernate/Hibernate Configuration DTD//EN\"\n" -#~ " \"http://hibernate.sourceforge.net/hibernate-configuration-3.0.dtd" -#~ "\">\n" -#~ "\n" -#~ "<hibernate-configuration>\n" -#~ "\n" -#~ " <!-- a SessionFactory instance listed as /jndi/name -->\n" -#~ " <session-factory\n" -#~ " name=\"java:hibernate/SessionFactory\">\n" -#~ "\n" -#~ " <!-- properties -->\n" -#~ " <property name=\"connection.datasource\">java:/comp/env/" -#~ "jdbc/MyDB</property>\n" -#~ " <property name=\"dialect\">org.hibernate.dialect." -#~ "MySQLDialect</property>\n" -#~ " <property name=\"show_sql\">false</property>\n" -#~ " <property name=\"transaction.factory_class\">\n" -#~ " org.hibernate.transaction.JTATransactionFactory\n" -#~ " </property>\n" -#~ " <property name=\"jta.UserTransaction\">java:comp/" -#~ "UserTransaction</property>\n" -#~ "\n" -#~ " <!-- mapping files -->\n" -#~ " <mapping resource=\"org/hibernate/auction/Item.hbm.xml\"/>\n" -#~ " <mapping resource=\"org/hibernate/auction/Bid.hbm.xml\"/>\n" -#~ "\n" -#~ " <!-- cache settings -->\n" -#~ " <class-cache class=\"org.hibernate.auction.Item\" usage=\"read-" -#~ "write\"/>\n" -#~ " <class-cache class=\"org.hibernate.auction.Bid\" usage=\"read-" -#~ "only\"/>\n" -#~ " <collection-cache collection=\"org.hibernate.auction.Item.bids" -#~ "\" usage=\"read-write\"/>\n" -#~ "\n" -#~ " </session-factory>\n" -#~ "\n" -#~ "</hibernate-configuration>" - -#, fuzzy -#~ msgid "" -#~ "" -#~ msgstr "" -#~ "SessionFactory sf = new Configuration().configure().buildSessionFactory();" - -#, fuzzy -#~ msgid "" -#~ "" -#~ msgstr "" -#~ "SessionFactory sf = new Configuration()\n" -#~ " .configure(\"catdb.cfg.xml\")\n" -#~ " .buildSessionFactory();" - -#, fuzzy -#~ msgid "" -#~ "\n" -#~ "\n" -#~ "\n" -#~ "\n" -#~ "\n" -#~ " \n" -#~ " jboss.jca:service=RARDeployer\n" -#~ " jboss.jca:service=LocalTxCM,name=HsqlDS\n" -#~ "\n" -#~ " \n" -#~ " java:/hibernate/SessionFactory\n" -#~ "\n" -#~ " \n" -#~ " java:HsqlDS\n" -#~ " org.hibernate.dialect.HSQLDialect\n" -#~ "\n" -#~ " \n" -#~ " \n" -#~ " org.hibernate.transaction.JTATransactionFactory\n" -#~ " \n" -#~ " org.hibernate.transaction.JBossTransactionManagerLookup\n" -#~ " true\n" -#~ " true\n" -#~ "\n" -#~ " \n" -#~ " 5\n" -#~ "\n" -#~ " \n" -#~ " true\n" -#~ " org.hibernate.cache." -#~ "EhCacheProvider\n" -#~ " true\n" -#~ "\n" -#~ " \n" -#~ " true\n" -#~ "\n" -#~ " \n" -#~ " auction/Item.hbm.xml,auction/" -#~ "Category.hbm.xml\n" -#~ "\n" -#~ "\n" -#~ "\n" -#~ "]]>" -#~ msgstr "" -#~ "<?xml version=\"1.0\"?>\n" -#~ "<server>\n" -#~ "\n" -#~ "<mbean code=\"org.hibernate.jmx.HibernateService\"\n" -#~ " name=\"jboss.jca:service=HibernateFactory,name=HibernateFactory" -#~ "\">\n" -#~ "\n" -#~ " <!-- Required services -->\n" -#~ " <depends>jboss.jca:service=RARDeployer</depends>\n" -#~ " <depends>jboss.jca:service=LocalTxCM,name=HsqlDS</" -#~ "depends>\n" -#~ "\n" -#~ " <!-- Bind the Hibernate service to JNDI -->\n" -#~ " <attribute name=\"JndiName\">java:/hibernate/SessionFactory</" -#~ "attribute>\n" -#~ "\n" -#~ " <!-- Datasource settings -->\n" -#~ " <attribute name=\"Datasource\">java:HsqlDS</attribute>\n" -#~ " <attribute name=\"Dialect\">org.hibernate.dialect." -#~ "HSQLDialect</attribute>\n" -#~ "\n" -#~ " <!-- Transaction integration -->\n" -#~ " <attribute name=\"TransactionStrategy\">\n" -#~ " org.hibernate.transaction.JTATransactionFactory</" -#~ "attribute>\n" -#~ " <attribute name=\"TransactionManagerLookupStrategy\">\n" -#~ " org.hibernate.transaction.JBossTransactionManagerLookup</" -#~ "attribute>\n" -#~ " <attribute name=\"FlushBeforeCompletionEnabled\">true</" -#~ "attribute>\n" -#~ " <attribute name=\"AutoCloseSessionEnabled\">true</" -#~ "attribute>\n" -#~ "\n" -#~ " <!-- Fetching options -->\n" -#~ " <attribute name=\"MaximumFetchDepth\">5</attribute>\n" -#~ "\n" -#~ " <!-- Second-level caching -->\n" -#~ " <attribute name=\"SecondLevelCacheEnabled\">true</" -#~ "attribute>\n" -#~ " <attribute name=\"CacheProviderClass\">org.hibernate.cache." -#~ "EhCacheProvider</attribute>\n" -#~ " <attribute name=\"QueryCacheEnabled\">true</attribute>\n" -#~ "\n" -#~ " <!-- Logging -->\n" -#~ " <attribute name=\"ShowSqlEnabled\">true</attribute>\n" -#~ "\n" -#~ " <!-- Mapping files -->\n" -#~ " <attribute name=\"MapResources\">auction/Item.hbm.xml,auction/" -#~ "Category.hbm.xml</attribute>\n" -#~ "\n" -#~ "</mbean>\n" -#~ "\n" -#~ "</server>" +#~ msgid "org.hibernate" +#~ msgstr "SessionFactory の JNDI への登録" diff --git a/documentation/manual/src/main/docbook/ja-JP/content/filters.po b/documentation/manual/src/main/docbook/ja-JP/content/filters.po index d3c606ed4d..f453635241 100644 --- a/documentation/manual/src/main/docbook/ja-JP/content/filters.po +++ b/documentation/manual/src/main/docbook/ja-JP/content/filters.po @@ -4,7 +4,7 @@ msgid "" msgstr "" "Project-Id-Version: Collection_Mapping\n" "Report-Msgid-Bugs-To: http://bugs.kde.org\n" -"POT-Creation-Date: 2010-02-10T07:25:35\n" +"POT-Creation-Date: 2010-07-20 21:02+0000\n" "PO-Revision-Date: 2010-01-18 15:28+1000\n" "Last-Translator: Xi HUANG \n" "Language-Team: \n" @@ -14,11 +14,13 @@ msgstr "" "X-Generator: KBabel 1.11.4\n" #. Tag: title +#: filters.xml:31 #, no-c-format msgid "Filtering data" msgstr "データのフィルタリング" #. Tag: para +#: filters.xml:33 #, no-c-format msgid "" "Hibernate3 provides an innovative new approach to handling data with " @@ -32,11 +34,13 @@ msgstr "" "を切り替えられます。" #. Tag: title +#: filters.xml:39 #, no-c-format msgid "Hibernate filters" msgstr "Hibernate のフィルタ" #. Tag: para +#: filters.xml:41 #, no-c-format msgid "" "Hibernate3 has the ability to pre-define filter criteria and attach those " @@ -57,9 +61,95 @@ msgstr "" "スビューのように使用されますが、アプリケーション内ではパラメータ化されます。" #. Tag: para +#: filters.xml:50 #, no-c-format msgid "" -"In order to use filters, they must first be defined and then attached to the " +"Using annotatons filters are defined via @org.hibernate.annotations." +"FilterDef or @org.hibernate.annotations.FilterDefs. A filter definition has a name() and an " +"array of parameters(). A parameter will allow you to adjust the behavior of " +"the filter at runtime. Each parameter is defined by a @ParamDef which has a name and a type. You can also define a " +"defaultCondition() parameter for a given " +"@FilterDef to set the default condition to use when none " +"are defined in each individual @Filter. " +"@FilterDef(s) can be defined at the class or package " +"level." +msgstr "" + +#. Tag: para +#: filters.xml:63 +#, no-c-format +msgid "" +"We now need to define the SQL filter clause applied to either the entity " +"load or the collection load. @Filter is used and placed " +"either on the entity or the collection element. The connection between " +"@FilterName and @Filter is a " +"matching name." +msgstr "" + +#. Tag: title +#: filters.xml:70 +#, no-c-format +msgid "@FilterDef and @Filter annotations" +msgstr "" + +#. Tag: programlisting +#: filters.xml:72 +#, no-c-format +msgid "" +"@Entity\n" +"@FilterDef(name=\"minLength\", parameters=@ParamDef( name=\"minLength\", " +"type=\"integer\" ) )\n" +"@Filters( {\n" +" @Filter(name=\"betweenLength\", condition=\":minLength <= length and :" +"maxLength >= length\"),\n" +" @Filter(name=\"minLength\", condition=\":minLength <= length\")\n" +"} )\n" +"public class Forest { ... }" +msgstr "" + +#. Tag: para +#: filters.xml:75 +#, no-c-format +msgid "" +"When the collection use an association table as a relational representation, " +"you might want to apply the filter condition to the association table itself " +"or to the target entity table. To apply the constraint on the target entity, " +"use the regular @Filter annotation. However, if you want " +"to target the association table, use the @FilterJoinTable " +"annotation." +msgstr "" + +#. Tag: title +#: filters.xml:84 +#, no-c-format +msgid "" +"Using @FilterJoinTable for filterting on the " +"association table" +msgstr "" + +#. Tag: programlisting +#: filters.xml:87 +#, no-c-format +msgid "" +"@OneToMany\n" +" @JoinTable\n" +" //filter on the target entity table\n" +" @Filter(name=\"betweenLength\", condition=\":minLength <= length and :" +"maxLength >= length\")\n" +" //filter on the association table\n" +" @FilterJoinTable(name=\"security\", condition=\":userlevel >= " +"requredLevel\")\n" +" public Set<Forest> getForests() { ... }" +msgstr "" + +#. Tag: para +#: filters.xml:90 +#, fuzzy, no-c-format +msgid "" +"Using Hibernate mapping files for defining filters the situtation is very " +"similar. The filters must first be defined and then attached to the " "appropriate mapping elements. To define a filter, use the <" "filter-def/> element within a <hibernate-mapping/" "> element:" @@ -68,22 +158,58 @@ msgstr "" "せん。フィルタを定義するためには、 <hibernate-mapping/> 要素内で <filter-def/> 要素を使用します:" -#. Tag: para +#. Tag: title +#: filters.xml:97 #, no-c-format -msgid "This filter can then be attached to a class:" -msgstr "そうしてフィルタはクラスへと結び付けられます:" +msgid "Defining a filter definition via <filter-def>" +msgstr "" + +#. Tag: programlisting +#: filters.xml:100 +#, fuzzy, no-c-format +msgid "" +"<filter-def name=\"myFilter\">\n" +" <filter-param name=\"myFilterParam\" type=\"string\"/>\n" +"</filter-def>" +msgstr "" +"<filter-def name=\"myFilter\">\n" +" <filter-param name=\"myFilterParam\" type=\"string\"/>\n" +"</filter-def>" #. Tag: para -#, no-c-format -msgid "Or, to a collection:" -msgstr "また、コレクションに対しては次のようになります:" - -#. Tag: para -#, no-c-format -msgid "Or, to both or multiples of each at the same time." +#: filters.xml:103 +#, fuzzy, no-c-format +msgid "" +"This filter can then be attached to a class or collection (or, to both or " +"multiples of each at the same time):" msgstr "どちらに対しても (また、それぞれを複数) 同時に設定することもできます。" +#. Tag: title +#: filters.xml:107 +#, no-c-format +msgid "" +"Attaching a filter to a class or collection using <filter>" +msgstr "" + +#. Tag: programlisting +#: filters.xml:110 +#, no-c-format +msgid "" +"<class name=\"myClass\" ...>\n" +" ...\n" +" <filter name=\"myFilter\" condition=\":myFilterParam = " +"MY_FILTERED_COLUMN\"/>\n" +"\n" +" <set ...>\n" +" <filter name=\"myFilter\" condition=\":myFilterParam = " +"MY_FILTERED_COLUMN\"/>\n" +" </set> \n" +"</class>" +msgstr "" + #. Tag: para +#: filters.xml:113 #, no-c-format msgid "" "The methods on Session are: enableFilter(String " @@ -104,7 +230,18 @@ msgstr "" "示的に使用可能となります。上で定義した単純なフィルタの使用は、このようになり" "ます:" +#. Tag: programlisting +#: filters.xml:123 +#, fuzzy, no-c-format +msgid "" +"session.enableFilter(\"myFilter\").setParameter(\"myFilterParam\", \"some-" +"value\");" +msgstr "" +"session.enableFilter(\"myFilter\").setParameter(\"myFilterParam\", \"some-" +"value\");" + #. Tag: para +#: filters.xml:125 #, no-c-format msgid "" "Methods on the org.hibernate.Filter interface do allow the method-chaining " @@ -114,13 +251,87 @@ msgstr "" "ているメソッド連鎖を許していることに注意してください。" #. Tag: para +#: filters.xml:128 #, no-c-format msgid "" "The following is a full example, using temporal data with an effective " "record date pattern:" msgstr "有効なレコードデータパターンを持つ一時データを使った完全な例です:" +#. Tag: programlisting +#: filters.xml:131 +#, fuzzy, no-c-format +msgid "" +"<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 "" +"<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>" + #. Tag: para +#: filters.xml:133 #, no-c-format msgid "" "In order to ensure that you are provided with currently effective records, " @@ -129,7 +340,28 @@ msgstr "" "常に現在の有効レコードを返却することを保証するために、単純に、社員データの検" "索より前にセッション上のフィルタを有効にします:" +#. Tag: programlisting +#: filters.xml:137 +#, fuzzy, no-c-format +msgid "" +"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();" +msgstr "" +"Session session = ...;\n" +"session.enabledFilter(\"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();" + #. Tag: para +#: filters.xml:139 #, no-c-format msgid "" "Even though a salary constraint was mentioned explicitly on the results in " @@ -142,6 +374,7 @@ msgstr "" "します。" #. Tag: para +#: filters.xml:144 #, no-c-format msgid "" "If you want to use filters with outer joining, either through HQL or load " @@ -154,6 +387,7 @@ msgstr "" "す。一般的に、演算子の後カラム名に続けて最初のパラメータを配置してください。" #. Tag: para +#: filters.xml:149 #, no-c-format msgid "" "After being defined, a filter might be attached to multiple entities and/or " @@ -167,7 +401,20 @@ msgstr "" "面倒かもしれません。従って、 <filter-def/> は、属性" "または CDATA としてデフォルトコンディションを定義することが可能になります:" +#. Tag: programlisting +#: filters.xml:155 +#, fuzzy, no-c-format +msgid "" +"<filter-def name=\"myFilter\" condition=\"abc > xyz\">...</" +"filter-def>\n" +"<filter-def name=\"myOtherFilter\">abc=xyz</filter-def>" +msgstr "" +"<filter-def name=\"myFilter\" condition=\"abc > xyz\">...</" +"filter-def>\n" +"<filter-def name=\"myOtherFilter\">abc=xyz</filter-def>" + #. Tag: para +#: filters.xml:157 #, no-c-format msgid "" "This default condition will be used whenever the filter is attached to " @@ -180,15 +427,11 @@ msgstr "" "ションをオーバーライドするフィルターのアタッチメントの一部として、特定のコン" "ディションを与えることができることを意味します。" -#, fuzzy -#~ msgid "" -#~ "\n" -#~ " \n" -#~ "]]>" -#~ msgstr "" -#~ "<filter-def name=\"myFilter\">\n" -#~ " <filter-param name=\"myFilterParam\" type=\"string\"/>\n" -#~ "</filter-def>" +#~ msgid "This filter can then be attached to a class:" +#~ msgstr "そうしてフィルタはクラスへと結び付けられます:" + +#~ msgid "Or, to a collection:" +#~ msgstr "また、コレクションに対しては次のようになります:" #, fuzzy #~ msgid "" @@ -215,110 +458,3 @@ msgstr "" #~ " <filter name=\"myFilter\" condition=\":myFilterParam = " #~ "MY_FILTERED_COLUMN\"/>\n" #~ "</set>" - -#, fuzzy -#~ msgid "" -#~ "" -#~ msgstr "" -#~ "session.enableFilter(\"myFilter\").setParameter(\"myFilterParam\", \"some-" -#~ "value\");" - -#, fuzzy -#~ msgid "" -#~ "\n" -#~ " \n" -#~ "\n" -#~ "\n" -#~ "\n" -#~ "...\n" -#~ " \n" -#~ " \n" -#~ " \n" -#~ "...\n" -#~ " \n" -#~ " \n" -#~ "\n" -#~ "\n" -#~ "\n" -#~ "...\n" -#~ " \n" -#~ " \n" -#~ " \n" -#~ " \n" -#~ " \n" -#~ "]]>" -#~ msgstr "" -#~ "<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>" - -#, fuzzy -#~ msgid "" -#~ " :" -#~ "targetSalary\")\n" -#~ " .setLong(\"targetSalary\", new Long(1000000))\n" -#~ " .list();\n" -#~ "]]>" -#~ msgstr "" -#~ "Session session = ...;\n" -#~ "session.enabledFilter(\"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();" - -#, fuzzy -#~ msgid "" -#~ " xyz\">...\n" -#~ "abc=xyz]]>" -#~ msgstr "" -#~ "<filter-def name=\"myFilter\" condition=\"abc > xyz\">...</" -#~ "filter-def>\n" -#~ "<filter-def name=\"myOtherFilter\">abc=xyz</filter-def>" diff --git a/documentation/manual/src/main/docbook/ja-JP/content/performance.po b/documentation/manual/src/main/docbook/ja-JP/content/performance.po index b5537e7341..fa2bae85aa 100644 --- a/documentation/manual/src/main/docbook/ja-JP/content/performance.po +++ b/documentation/manual/src/main/docbook/ja-JP/content/performance.po @@ -4,7 +4,7 @@ msgid "" msgstr "" "Project-Id-Version: Collection_Mapping\n" "Report-Msgid-Bugs-To: http://bugs.kde.org\n" -"POT-Creation-Date: 2010-02-11T05:38:15\n" +"POT-Creation-Date: 2010-07-20 21:02+0000\n" "PO-Revision-Date: 2010-01-20 14:25+1000\n" "Last-Translator: Xi HUANG \n" "Language-Team: \n" @@ -14,16 +14,19 @@ msgstr "" "X-Generator: KBabel 1.11.4\n" #. Tag: title +#: performance.xml:31 #, no-c-format msgid "Improving performance" msgstr "パフォーマンスの改善" #. Tag: title +#: performance.xml:34 #, no-c-format msgid "Fetching strategies" msgstr "フェッチ戦略" #. Tag: para +#: performance.xml:36 #, no-c-format msgid "" "Hibernate uses a fetching strategy to retrieve " @@ -37,11 +40,13 @@ msgstr "" "Criteria クエリでオーバーライドします。" #. Tag: para +#: performance.xml:42 #, no-c-format msgid "Hibernate3 defines the following fetching strategies:" msgstr "Hibernate3 は次に示すフェッチ戦略を定義しています:" #. Tag: para +#: performance.xml:46 #, no-c-format msgid "" "Join fetching: Hibernate retrieves the associated " @@ -53,6 +58,7 @@ msgstr "" "SELECT で復元します。" #. Tag: para +#: performance.xml:53 #, no-c-format msgid "" "Select fetching: a second SELECT is " @@ -66,6 +72,7 @@ msgstr "" "に関連にアクセスしたときのみ実行されるでしょう。" #. Tag: para +#: performance.xml:61 #, no-c-format msgid "" "Subselect fetching: a second SELECT " @@ -81,6 +88,7 @@ msgstr "" "るでしょう。" #. Tag: para +#: performance.xml:70 #, no-c-format msgid "" "Batch fetching: an optimization strategy for select " @@ -94,11 +102,13 @@ msgstr "" "することにより行います。" #. Tag: para +#: performance.xml:77 #, no-c-format msgid "Hibernate also distinguishes between:" msgstr "Hibernate は次に示す戦略とも区別をします: " #. Tag: para +#: performance.xml:81 #, no-c-format msgid "" "Immediate fetching: an association, collection or " @@ -108,6 +118,7 @@ msgstr "" "に、関連、コレクションは即時にフェッチされます。" #. Tag: para +#: performance.xml:87 #, no-c-format msgid "" "Lazy collection fetching: a collection is fetched when " @@ -119,6 +130,7 @@ msgstr "" "に対するデフォルトの動作です)" #. Tag: para +#: performance.xml:93 #, no-c-format msgid "" "\"Extra-lazy\" collection fetching: individual elements " @@ -132,6 +144,7 @@ msgstr "" "きなコレクションに適しています)。" #. Tag: para +#: performance.xml:101 #, no-c-format msgid "" "Proxy fetching: a single-valued association is fetched " @@ -142,6 +155,7 @@ msgstr "" "メソッドが関連オブジェクトで呼び出されるときにフェッチされます。" #. Tag: para +#: performance.xml:107 #, no-c-format msgid "" "\"No-proxy\" fetching: a single-valued association is " @@ -159,6 +173,7 @@ msgstr "" "す。" #. Tag: para +#: performance.xml:117 #, no-c-format msgid "" "Lazy attribute fetching: an attribute or single valued " @@ -170,6 +185,7 @@ msgstr "" "みが必要になり、使う場面はまれです。" #. Tag: para +#: performance.xml:124 #, no-c-format msgid "" "We have two orthogonal notions here: when is the " @@ -187,11 +203,13 @@ msgstr "" "す。" #. Tag: title +#: performance.xml:132 #, no-c-format msgid "Working with lazy associations" msgstr "遅延関連の働き" #. Tag: para +#: performance.xml:134 #, no-c-format msgid "" "By default, Hibernate3 uses lazy select fetching for collections and lazy " @@ -203,6 +221,7 @@ msgstr "" "ぼすべてのアプリケーションのほぼすべての関連で意味があります。" #. Tag: para +#: performance.xml:138 #, no-c-format msgid "" "If you set hibernate.default_batch_fetch_size, Hibernate " @@ -215,6 +234,7 @@ msgstr "" "す)。" #. Tag: para +#: performance.xml:142 #, no-c-format msgid "" "Please be aware that access to a lazy association outside of the context of " @@ -224,7 +244,36 @@ msgstr "" "Hibernate の session をオープンしているコンテキストの外から遅延関連にアクセス" "すると、例外が発生します。例:" +#. Tag: programlisting +#: performance.xml:146 +#, fuzzy, no-c-format +msgid "" +"s = sessions.openSession();\n" +"Transaction tx = s.beginTransaction();\n" +" \n" +"User u = (User) s.createQuery(\"from User u where u.name=:userName\")\n" +" .setString(\"userName\", userName).uniqueResult();\n" +"Map permissions = u.getPermissions();\n" +"\n" +"tx.commit();\n" +"s.close();\n" +"\n" +"Integer accessLevel = (Integer) permissions.get(\"accounts\"); // Error!" +msgstr "" +"s = sessions.openSession();\n" +"Transaction tx = s.beginTransaction();\n" +" \n" +"User u = (User) s.createQuery(\"from User u where u.name=:userName\")\n" +" .setString(\"userName\", userName).uniqueResult();\n" +"Map permissions = u.getPermissions();\n" +"\n" +"tx.commit();\n" +"s.close();\n" +"\n" +"Integer accessLevel = (Integer) permissions.get(\"accounts\"); // Error!" + #. Tag: para +#: performance.xml:148 #, no-c-format msgid "" "Since the permissions collection was not initialized when the " @@ -240,6 +289,7 @@ msgstr "" "ンザクションをコミットする直前に移動させます。" #. Tag: para +#: performance.xml:155 #, no-c-format msgid "" "Alternatively, you can use a non-lazy collection or association, by " @@ -257,6 +307,7 @@ msgstr "" "にフェッチすることになるでしょう。" #. Tag: para +#: performance.xml:162 #, no-c-format msgid "" "On the other hand, you can use join fetching, which is non-lazy by nature, " @@ -271,11 +322,13 @@ msgstr "" "フェッチ戦略を選択する仕組みは単一値関連とコレクションで変わりはありません。" #. Tag: title +#: performance.xml:170 #, no-c-format msgid "Tuning fetch strategies" msgstr "フェッチ戦略のチューニング" #. Tag: para +#: performance.xml:172 #, no-c-format msgid "" "Select fetching (the default) is extremely vulnerable to N+1 selects " @@ -284,7 +337,30 @@ msgstr "" "セレクトフェッチ(デフォルト)は N+1 セレクト問題という大きな弱点があるため、" "マッピング定義で結合フェッチを有効にすることができます:" +#. Tag: programlisting +#: performance.xml:176 +#, fuzzy, no-c-format +msgid "" +"<set name=\"permissions\"\n" +" fetch=\"join\">\n" +" <key column=\"userId\"/>\n" +" <one-to-many class=\"Permission\"/>\n" +"</set" +msgstr "" +"<set name=\"permissions\" \n" +" fetch=\"join\">\n" +" <key column=\"userId\"/>\n" +" <one-to-many class=\"Permission\"/>\n" +"</set" + +#. Tag: programlisting +#: performance.xml:178 +#, fuzzy, no-c-format +msgid "<many-to-one name=\"mother\" class=\"Cat\" fetch=\"join\"/>" +msgstr "<many-to-one name=\"mother\" class=\"Cat\" fetch=\"join\"/>" + #. Tag: para +#: performance.xml:180 #, no-c-format msgid "" "The fetch strategy defined in the mapping document " @@ -294,26 +370,31 @@ msgstr "" "す:" #. Tag: para +#: performance.xml:185 #, no-c-format msgid "retrieval via get() or load()" msgstr "get()load() による復元" #. Tag: para +#: performance.xml:190 #, no-c-format msgid "retrieval that happens implicitly when an association is navigated" msgstr "関連にナビゲートしたときに発生する暗黙的な復元" #. Tag: para +#: performance.xml:195 #, no-c-format msgid "Criteria queries" msgstr "Criteria クエリ" #. Tag: para +#: performance.xml:199 #, no-c-format msgid "HQL queries if subselect fetching is used" msgstr "サブセレクト フェッチを使う HQL クエリ" #. Tag: para +#: performance.xml:204 #, no-c-format msgid "" "Irrespective of the fetching strategy you use, the defined non-lazy graph is " @@ -325,6 +406,7 @@ msgstr "" "の SELECT 文が即時実行されることがあるので注意してください。" #. Tag: para +#: performance.xml:209 #, no-c-format msgid "" "Usually, the mapping document is not used to customize fetching. Instead, we " @@ -342,6 +424,7 @@ msgstr "" "setFetchMode(FetchMode.JOIN) を使うことが出来ます。" #. Tag: para +#: performance.xml:216 #, no-c-format msgid "" "If you want to change the fetching strategy used by get() " @@ -352,7 +435,22 @@ msgstr "" "戦略を変えたいと感じたときには、単純に Criteria クエリを" "使ってください。例:" +#. Tag: programlisting +#: performance.xml:220 +#, fuzzy, no-c-format +msgid "" +"User user = (User) session.createCriteria(User.class)\n" +" .setFetchMode(\"permissions\", FetchMode.JOIN)\n" +" .add( Restrictions.idEq(userId) )\n" +" .uniqueResult();" +msgstr "" +"User user = (User) session.createCriteria(User.class)\n" +" .setFetchMode(\"permissions\", FetchMode.JOIN)\n" +" .add( Restrictions.idEq(userId) )\n" +" .uniqueResult();" + #. Tag: para +#: performance.xml:222 #, no-c-format msgid "" "This is Hibernate's equivalent of what some ORM solutions call a \"fetch plan" @@ -362,6 +460,7 @@ msgstr "" "です。)" #. Tag: para +#: performance.xml:225 #, no-c-format msgid "" "A completely different approach to problems with N+1 selects is to use the " @@ -371,11 +470,13 @@ msgstr "" "とです。" #. Tag: title +#: performance.xml:230 #, no-c-format msgid "Single-ended association proxies" msgstr "単一端関連プロキシ" #. Tag: para +#: performance.xml:232 #, no-c-format msgid "" "Lazy fetching for collections is implemented using Hibernate's own " @@ -392,6 +493,7 @@ msgstr "" "ジェクトの遅延初期化プロキシを実現しています。" #. Tag: para +#: performance.xml:239 #, no-c-format msgid "" "At startup, Hibernate3 generates proxies by default for all persistent " @@ -403,6 +505,7 @@ msgstr "" "literal> 関連の遅延フェッチを可能にしています。" #. Tag: para +#: performance.xml:244 #, no-c-format msgid "" "The mapping file may declare an interface to use as the proxy interface for " @@ -419,6 +522,7 @@ msgstr "" "emphasis>" #. Tag: para +#: performance.xml:251 #, no-c-format msgid "" "There are potential problems to note when extending this approach to " @@ -427,7 +531,26 @@ msgstr "" "ポリモーフィズムのクラスに対してこの方法を適用するときにいくつか考慮すること" "があります。例:" +#. Tag: programlisting +#: performance.xml:254 +#, fuzzy, no-c-format +msgid "" +"<class name=\"Cat\" proxy=\"Cat\">\n" +" ......\n" +" <subclass name=\"DomesticCat\">\n" +" .....\n" +" </subclass>\n" +"</class>" +msgstr "" +"<class name=\"Cat\" proxy=\"Cat\">\n" +" ......\n" +" <subclass name=\"DomesticCat\">\n" +" .....\n" +" </subclass>\n" +"</class>" + #. Tag: para +#: performance.xml:256 #, no-c-format msgid "" "Firstly, instances of Cat will never be castable to " @@ -438,12 +561,52 @@ msgstr "" "literal> にキャストできません。たとえ基となるインスタンスが " "DomesticCat であったとしてもです:" +#. Tag: programlisting +#: performance.xml:260 +#, fuzzy, no-c-format +msgid "" +"Cat cat = (Cat) session.load(Cat.class, id); // instantiate a proxy (does " +"not hit the db)\n" +"if ( cat.isDomesticCat() ) { // hit the db to initialize " +"the proxy\n" +" DomesticCat dc = (DomesticCat) cat; // Error!\n" +" ....\n" +"}" +msgstr "" +"Cat cat = (Cat) session.load(Cat.class, id); // instantiate a proxy (does " +"not hit the db)\n" +"if ( cat.isDomesticCat() ) { // hit the db to initialize " +"the proxy\n" +" DomesticCat dc = (DomesticCat) cat; // Error!\n" +" ....\n" +"}" + #. Tag: para +#: performance.xml:262 #, no-c-format msgid "Secondly, it is possible to break proxy ==:" msgstr "第二に、プロキシの == は成立しないことがあります。" +#. Tag: programlisting +#: performance.xml:265 +#, fuzzy, no-c-format +msgid "" +"Cat cat = (Cat) session.load(Cat.class, id); // instantiate a Cat " +"proxy\n" +"DomesticCat dc = \n" +" (DomesticCat) session.load(DomesticCat.class, id); // acquire new " +"DomesticCat proxy!\n" +"System.out.println(cat==dc); // false" +msgstr "" +"Cat cat = (Cat) session.load(Cat.class, id); // instantiate a Cat " +"proxy\n" +"DomesticCat dc = \n" +" (DomesticCat) session.load(DomesticCat.class, id); // acquire new " +"DomesticCat proxy!\n" +"System.out.println(cat==dc); // false" + #. Tag: para +#: performance.xml:267 #, no-c-format msgid "" "However, the situation is not quite as bad as it looks. Even though we now " @@ -454,7 +617,18 @@ msgstr "" "キシオブジェクトへの二つの参照があったとしても、基となるインスタンスは同じオ" "ブジェクトです:" +#. Tag: programlisting +#: performance.xml:271 +#, fuzzy, no-c-format +msgid "" +"cat.setWeight(11.0); // hit the db to initialize the proxy\n" +"System.out.println( dc.getWeight() ); // 11.0" +msgstr "" +"cat.setWeight(11.0); // hit the db to initialize the proxy\n" +"System.out.println( dc.getWeight() ); // 11.0" + #. Tag: para +#: performance.xml:273 #, no-c-format msgid "" "Third, you cannot use a CGLIB proxy for a final class or " @@ -464,6 +638,7 @@ msgstr "" "を持つクラスに CGLIB プロキシを使えません。" #. Tag: para +#: performance.xml:276 #, no-c-format msgid "" "Finally, if your persistent object acquires any resources upon instantiation " @@ -477,6 +652,7 @@ msgstr "" "クラスです。" #. Tag: para +#: performance.xml:281 #, no-c-format msgid "" "These problems are all due to fundamental limitations in Java's single " @@ -492,7 +668,26 @@ msgstr "" "クラスで実装しなければなりません。マッピングファイルでこれらのインターフェー" "スを指定する必要があります。例:" +#. Tag: programlisting +#: performance.xml:289 +#, fuzzy, no-c-format +msgid "" +"<class name=\"CatImpl\" proxy=\"Cat\">\n" +" ......\n" +" <subclass name=\"DomesticCatImpl\" proxy=\"DomesticCat\">\n" +" .....\n" +" </subclass>\n" +"</class>" +msgstr "" +"<class name=\"CatImpl\" proxy=\"Cat\">\n" +" ......\n" +" <subclass name=\"DomesticCatImpl\" proxy=\"DomesticCat\">\n" +" .....\n" +" </subclass>\n" +"</class>" + #. Tag: para +#: performance.xml:291 #, fuzzy, no-c-format msgid "" "Then proxies for instances of Cat and " @@ -503,17 +698,34 @@ msgstr "" "literal> にキャストできません。たとえ基となるインスタンスが " "DomesticCat であったとしてもです:" +#. Tag: programlisting +#: performance.xml:295 +#, fuzzy, no-c-format +msgid "" +"Cat cat = (Cat) session.load(CatImpl.class, catid);\n" +"Iterator iter = session.createQuery(\"from CatImpl as cat where cat." +"name='fritz'\").iterate();\n" +"Cat fritz = (Cat) iter.next();" +msgstr "" +"Cat cat = (Cat) session.load(CatImpl.class, catid);\n" +"Iterator iter = session.iterate(\"from CatImpl as cat where cat." +"name='fritz'\");\n" +"Cat fritz = (Cat) iter.next();" + #. Tag: title +#: performance.xml:298 #, no-c-format msgid "Note" msgstr "" #. Tag: para +#: performance.xml:300 #, fuzzy, no-c-format msgid "list() does not usually return proxies." msgstr "full join (たいていの場合使いづらい)" #. Tag: para +#: performance.xml:304 #, no-c-format msgid "" "Relationships are also lazily initialized. This means you must declare any " @@ -525,6 +737,7 @@ msgstr "" "ん。" #. Tag: para +#: performance.xml:308 #, no-c-format msgid "" "Certain operations do not require proxy initialization:" @@ -532,6 +745,7 @@ msgstr "" "プロキシの初期化を 必要としない 操作も存在します。" #. Tag: para +#: performance.xml:313 #, no-c-format msgid "" "equals(): if the persistent class does not override " @@ -541,6 +755,7 @@ msgstr "" "バーライドしないとき)" #. Tag: para +#: performance.xml:318 #, no-c-format msgid "" "hashCode(): if the persistent class does not override " @@ -550,11 +765,13 @@ msgstr "" "オーバーライドしないとき)" #. Tag: para +#: performance.xml:323 #, no-c-format msgid "The identifier getter method" msgstr "識別子の getter メソッド" #. Tag: para +#: performance.xml:327 #, no-c-format msgid "" "Hibernate will detect persistent classes that override equals()lazy=\"no-proxy\" instead of the default " @@ -577,11 +795,13 @@ msgstr "" "あっても、ただちにプロキシの初期化を行うことになるでしょう。" #. Tag: title +#: performance.xml:338 #, no-c-format msgid "Initializing collections and proxies" msgstr "コレクションとプロキシの初期化" #. Tag: para +#: performance.xml:340 #, no-c-format msgid "" "A LazyInitializationException will be thrown by Hibernate " @@ -595,6 +815,7 @@ msgstr "" "への参照を持つエンティティが分離された状態の時です。" #. Tag: para +#: performance.xml:346 #, no-c-format msgid "" "Sometimes a proxy or collection needs to be initialized before closing the " @@ -610,6 +831,7 @@ msgstr "" "いう点からも不便です。" #. Tag: para +#: performance.xml:353 #, no-c-format msgid "" "The static methods Hibernate.initialize() and " @@ -629,6 +851,7 @@ msgstr "" "コレクションに対して同様の効果があります。" #. Tag: para +#: performance.xml:362 #, no-c-format msgid "" "Another option is to keep the Session open until all " @@ -648,6 +871,7 @@ msgstr "" "つの基本的な方法があります:" #. Tag: para +#: performance.xml:372 #, no-c-format msgid "" "In a web-based application, a servlet filter can be used to close the " @@ -670,6 +894,7 @@ msgstr "" "View\" パターンの例を参照してください。" #. Tag: para +#: performance.xml:385 #, no-c-format msgid "" "In an application with a separate business tier, the business logic must " @@ -697,6 +922,7 @@ msgstr "" "emphasis> パターンを採用するほうがより簡単です。" #. Tag: para +#: performance.xml:401 #, no-c-format msgid "" "You can also attach a previously loaded object to a new Session 。" #. Tag: para +#: performance.xml:410 #, no-c-format msgid "" "Sometimes you do not want to initialize a large collection, but still need " @@ -723,6 +950,7 @@ msgstr "" "報(サイズのような)やデータのサブセットを必要とすることがあります。" #. Tag: para +#: performance.xml:414 #, no-c-format msgid "" "You can use a collection filter to get the size of a collection without " @@ -731,7 +959,18 @@ msgstr "" "コレクションフィルタを使うことで、初期化せずにコレクションのサイズを取得する" "ことが出来ます:" +#. Tag: programlisting +#: performance.xml:417 +#, fuzzy, no-c-format +msgid "" +"( (Integer) s.createFilter( collection, \"select count(*)\" ).list().get" +"(0) ).intValue()" +msgstr "" +"( (Integer) s.createFilter( collection, \"select count(*)\" ).list().get" +"(0) ).intValue()" + #. Tag: para +#: performance.xml:419 #, no-c-format msgid "" "The createFilter() method is also used to efficiently " @@ -741,12 +980,24 @@ msgstr "" "createFilter() メソッドは、コレクション全体を初期化する必" "要なしに、コレクションのサブセットを復元するために効果的に使えます:" +#. Tag: programlisting +#: performance.xml:423 +#, fuzzy, no-c-format +msgid "" +"s.createFilter( lazyCollection, \"\").setFirstResult(0).setMaxResults(10)." +"list();" +msgstr "" +"s.createFilter( lazyCollection, \"\").setFirstResult(0).setMaxResults(10)." +"list();" + #. Tag: title +#: performance.xml:427 #, no-c-format msgid "Using batch fetching" msgstr "バッチフェッチの使用" #. Tag: para +#: performance.xml:429 #, no-c-format msgid "" "Using batch fetching, Hibernate can load several uninitialized proxies if " @@ -761,6 +1012,7 @@ msgstr "" "レクションレベルです。" #. Tag: para +#: performance.xml:434 #, no-c-format msgid "" "Batch fetching for classes/entities is easier to understand. Consider the " @@ -785,7 +1037,14 @@ msgstr "" "舞いを Person のマッピングの batch-size の指定で調整できます。" +#. Tag: programlisting +#: performance.xml:447 +#, fuzzy, no-c-format +msgid "<class name=\"Person\" batch-size=\"10\">...</class>" +msgstr "<class name=\"Person\" batch-size=\"10\">...</class>" + #. Tag: para +#: performance.xml:449 #, no-c-format msgid "" "Hibernate will now execute only three queries: the pattern is 10, 10, 5." @@ -794,6 +1053,7 @@ msgstr "" "す。" #. Tag: para +#: performance.xml:452 #, no-c-format msgid "" "You can also enable batch fetching of collections. For example, if each " @@ -813,7 +1073,24 @@ msgstr "" "のバッチフェッチを有効にすれば、 Hibernate はコレクションの事前フェッチが出来" "ます。" +#. Tag: programlisting +#: performance.xml:461 +#, fuzzy, no-c-format +msgid "" +"<class name=\"Person\">\n" +" <set name=\"cats\" batch-size=\"3\">\n" +" ...\n" +" </set>\n" +"</class>" +msgstr "" +"<class name=\"Person\">\n" +" <set name=\"cats\" batch-size=\"3\">\n" +" ...\n" +" </set>\n" +"</class>" + #. Tag: para +#: performance.xml:463 #, no-c-format msgid "" "With a batch-size of 3, Hibernate will load 3, 3, 3, 1 " @@ -827,6 +1104,7 @@ msgstr "" "レクションの期待数に依存します。" #. Tag: para +#: performance.xml:468 #, no-c-format msgid "" "Batch fetching of collections is particularly useful if you have a nested " @@ -840,11 +1118,13 @@ msgstr "" "よりよい選択になります。)" #. Tag: title +#: performance.xml:475 #, no-c-format msgid "Using subselect fetching" msgstr "サブセレクトフェッチの使用" #. Tag: para +#: performance.xml:477 #, no-c-format msgid "" "If one lazy collection or single-valued proxy has to be fetched, Hibernate " @@ -857,11 +1137,13 @@ msgstr "" "ん。" #. Tag: title +#: performance.xml:486 #, fuzzy, no-c-format msgid "Fetch profiles" msgstr "フェッチ戦略" #. Tag: para +#: performance.xml:488 #, no-c-format msgid "" "Another way to affect the fetching strategy for loading associated objects " @@ -869,19 +1151,112 @@ msgid "" "associated with the org.hibernate.SessionFactory but enabled, by name, on the org.hibernate." "Session. Once enabled on a org.hibernate." -"Session, the fetch profile wull be in affect for that " +"Session, the fetch profile will be in affect for that " "org.hibernate.Session until it is explicitly " "disabled." msgstr "" #. Tag: para +#: performance.xml:498 #, no-c-format msgid "" -"So what does that mean? Well lets explain that by way of an example. Say we " -"have the following mappings:" +"So what does that mean? Well lets explain that by way of an example which " +"show the different available approaches to configure a fetch profile:" +msgstr "" + +#. Tag: title +#: performance.xml:503 +#, no-c-format +msgid "Specifying a fetch profile using @FetchProfile" +msgstr "" + +#. Tag: programlisting +#: performance.xml:506 +#, no-c-format +msgid "" +"@Entity\n" +"@FetchProfile(name = \"customer-with-orders\", fetchOverrides = {\n" +" @FetchProfile.FetchOverride(entity = Customer.class, association = " +"\"orders\", mode = FetchMode.JOIN)\n" +"})\n" +"public class Customer {\n" +" @Id\n" +" @GeneratedValue\n" +" private long id;\n" +"\n" +" private String name;\n" +"\n" +" private long customerNumber;\n" +"\n" +" @OneToMany\n" +" private Set<Order> orders;\n" +"\n" +" // standard getter/setter\n" +" ...\n" +"}" +msgstr "" + +#. Tag: title +#: performance.xml:510 +#, no-c-format +msgid "" +"Specifying a fetch profile using <fetch-profile> " +"outside <class> node" +msgstr "" + +#. Tag: programlisting +#: performance.xml:514 +#, no-c-format +msgid "" +"<hibernate-mapping>\n" +" <class name=\"Customer\">\n" +" ...\n" +" <set name=\"orders\" inverse=\"true\">\n" +" <key column=\"cust_id\"/>\n" +" <one-to-many class=\"Order\"/>\n" +" </set>\n" +" </class>\n" +" <class name=\"Order\">\n" +" ...\n" +" </class>\n" +" <fetch-profile name=\"customer-with-orders\">\n" +" <fetch entity=\"Customer\" association=\"orders\" style=\"join\"/" +">\n" +" </fetch-profile>\n" +"</hibernate-mapping>" +msgstr "" + +#. Tag: title +#: performance.xml:518 +#, no-c-format +msgid "" +"Specifying a fetch profile using <fetch-profile> " +"inside <class> node" +msgstr "" + +#. Tag: programlisting +#: performance.xml:522 +#, no-c-format +msgid "" +"<hibernate-mapping>\n" +" <class name=\"Customer\">\n" +" ...\n" +" <set name=\"orders\" inverse=\"true\">\n" +" <key column=\"cust_id\"/>\n" +" <one-to-many class=\"Order\"/>\n" +" </set>\n" +" <fetch-profile name=\"customer-with-orders\">\n" +" <fetch association=\"orders\" style=\"join\"/>\n" +" </fetch-profile>\n" +" </class>\n" +" <class name=\"Order\">\n" +" ...\n" +" </class>\n" +"</hibernate-mapping>" msgstr "" #. Tag: para +#: performance.xml:525 #, no-c-format msgid "" "Now normally when you get a reference to a particular customer, that " @@ -890,23 +1265,39 @@ msgid "" "that you have a certain use case where it is more efficient to load the " "customer and their orders together. One way certainly is to use \"dynamic " "fetching\" strategies via an HQL or criteria queries. But another option is " -"to use a fetch profile to achieve that. Just add the following to your " -"mapping:" +"to use a fetch profile to achieve that. The following code will load both " +"the customer andtheir orders:" msgstr "" -#. Tag: para +#. Tag: title +#: performance.xml:536 #, no-c-format -msgid "or even:" +msgid "Activating a fetch profile for a given Session" msgstr "" -#. Tag: para +#. Tag: programlisting +#: performance.xml:539 #, no-c-format msgid "" -"Now the following code will actually load both the customer and " -"their orders:" +"Session session = ...;\n" +"session.enableFetchProfile( \"customer-with-orders\" ); // name matches " +"from mapping\n" +"Customer customer = (Customer) session.get( Customer.class, customerId );" msgstr "" #. Tag: para +#: performance.xml:543 +#, no-c-format +msgid "" +"@FetchProfile definitions are global and it does not " +"matter on which class you place them. You can place the " +"@FetchProfile annotation either onto a class or " +"package (package-info.java). In order to define multiple fetch profiles for " +"the same class or package @FetchProfiles can be used." +msgstr "" + +#. Tag: para +#: performance.xml:551 #, no-c-format msgid "" "Currently only join style fetch profiles are supported, but they plan is to " @@ -915,11 +1306,13 @@ msgid "" msgstr "" #. Tag: title +#: performance.xml:558 #, no-c-format msgid "Using lazy property fetching" msgstr "遅延プロパティフェッチの使用" #. Tag: para +#: performance.xml:560 #, no-c-format msgid "" "Hibernate3 supports the lazy fetching of individual properties. This " @@ -938,6 +1331,7 @@ msgstr "" "善できないなどの極端な場合には有用です。" #. Tag: para +#: performance.xml:568 #, no-c-format msgid "" "To enable lazy property loading, set the lazy attribute " @@ -946,7 +1340,34 @@ msgstr "" "遅延プロパティ読み込みを有効にするには、対象のプロパティのマッピングで " "lazy 属性をセットしてください:" +#. Tag: programlisting +#: performance.xml:571 +#, fuzzy, no-c-format +msgid "" +"<class name=\"Document\">\n" +" <id name=\"id\">\n" +" <generator class=\"native\"/>\n" +" </id>\n" +" <property name=\"name\" not-null=\"true\" length=\"50\"/>\n" +" <property name=\"summary\" not-null=\"true\" length=\"200\" lazy=" +"\"true\"/>\n" +" <property name=\"text\" not-null=\"true\" length=\"2000\" lazy=\"true" +"\"/>\n" +"</class>" +msgstr "" +"<class name=\"Document\">\n" +" <id name=\"id\">\n" +" <generator class=\"native\"/>\n" +" </id>\n" +" <property name=\"name\" not-null=\"true\" length=\"50\"/>\n" +" <property name=\"summary\" not-null=\"true\" length=\"200\" lazy=" +"\"true\"/>\n" +" <property name=\"text\" not-null=\"true\" length=\"2000\" lazy=\"true" +"\"/>\n" +"</class>" + #. Tag: para +#: performance.xml:573 #, no-c-format msgid "" "Lazy property loading requires buildtime bytecode instrumentation. If your " @@ -958,11 +1379,49 @@ msgstr "" "を無視して、即時フェッチに戻します。" #. Tag: para +#: performance.xml:577 #, no-c-format msgid "For bytecode instrumentation, use the following Ant task:" msgstr "バイトコード組み込みは以下の Ant タスクを使ってください: " +#. Tag: programlisting +#: performance.xml:579 +#, fuzzy, no-c-format +msgid "" +"<target name=\"instrument\" depends=\"compile\">\n" +" <taskdef name=\"instrument\" classname=\"org.hibernate.tool." +"instrument.InstrumentTask\">\n" +" <classpath path=\"${jar.path}\"/>\n" +" <classpath path=\"${classes.dir}\"/>\n" +" <classpath refid=\"lib.class.path\"/>\n" +" </taskdef>\n" +"\n" +" <instrument verbose=\"true\">\n" +" <fileset dir=\"${testclasses.dir}/org/hibernate/auction/model" +"\">\n" +" <include name=\"*.class\"/>\n" +" </fileset>\n" +" </instrument>\n" +"</target>" +msgstr "" +"<target name=\"instrument\" depends=\"compile\">\n" +" <taskdef name=\"instrument\" classname=\"org.hibernate.tool." +"instrument.InstrumentTask\">\n" +" <classpath path=\"${jar.path}\"/>\n" +" <classpath path=\"${classes.dir}\"/>\n" +" <classpath refid=\"lib.class.path\"/>\n" +" </taskdef>\n" +"\n" +" <instrument verbose=\"true\">\n" +" <fileset dir=\"${testclasses.dir}/org/hibernate/auction/model" +"\">\n" +" <include name=\"*.class\"/>\n" +" </fileset>\n" +" </instrument>\n" +"</target>" + #. Tag: para +#: performance.xml:581 #, no-c-format msgid "" "A different way of avoiding unnecessary column reads, at least for read-only " @@ -976,6 +1435,7 @@ msgstr "" "す。" #. Tag: para +#: performance.xml:586 #, no-c-format msgid "" "You can force the usual eager fetching of properties using fetch " @@ -985,11 +1445,13 @@ msgstr "" "パティの即時フェッチングを強制することが出来ます。" #. Tag: title +#: performance.xml:592 #, no-c-format msgid "The Second Level Cache" msgstr "第2レベルキャッシュ" #. Tag: para +#: performance.xml:594 #, no-c-format msgid "" "A Hibernate Session is a transaction-level cache of " @@ -1009,15 +1471,17 @@ msgstr "" "す)。" #. Tag: para -#, no-c-format +#: performance.xml:602 +#, fuzzy, no-c-format msgid "" "You have the option to tell Hibernate which caching implementation to use by " "specifying the name of a class that implements org.hibernate.cache." "CacheProvider using the property hibernate.cache." "provider_class. Hibernate is bundled with a number of built-in " -"integrations with the open-source cache providers that are listed below. You " -"can also implement your own and plug it in as outlined above. Note that " -"versions prior to 3.2 use EhCache as the default cache provider." +"integrations with the open-source cache providers that are listed in . You can also implement your own and plug it in " +"as outlined above. Note that versions prior to Hibernate 3.2 use EhCache as " +"the default cache provider." msgstr "" "Hibernate が使用するキャッシュ実装は、 hibernate.cache." "provider_class プロパティに org.hibernate.cache." @@ -1029,155 +1493,401 @@ msgstr "" "ジョン3.2ではこれは当てはまりません。" #. Tag: title +#: performance.xml:613 #, no-c-format msgid "Cache Providers" msgstr "キャッシュプロバイダ" #. Tag: entry +#: performance.xml:628 performance.xml:976 #, no-c-format msgid "Cache" msgstr "キャッシュ" #. Tag: entry +#: performance.xml:630 #, no-c-format msgid "Provider class" msgstr "プロバイダクラス" #. Tag: entry +#: performance.xml:632 #, no-c-format msgid "Type" msgstr "タイプ" #. Tag: entry +#: performance.xml:634 #, no-c-format msgid "Cluster Safe" msgstr "クラスタセーフ" #. Tag: entry +#: performance.xml:636 #, no-c-format msgid "Query Cache Supported" msgstr "クエリキャッシュのサポート" #. Tag: entry +#: performance.xml:642 performance.xml:990 #, no-c-format msgid "Hashtable (not intended for production use)" msgstr "Hashtable(製品用として意図していません)" -#. Tag: entry +#. Tag: literal +#: performance.xml:644 #, fuzzy, no-c-format -msgid "org.hibernate.cache.HashtableCacheProvider" +msgid "org.hibernate.cache.HashtableCacheProvider" msgstr "org.hibernate.cache.HashtableCacheProvider" #. Tag: entry +#: performance.xml:646 #, no-c-format msgid "memory" msgstr "メモリ" #. Tag: entry +#: performance.xml:650 performance.xml:662 performance.xml:674 +#: performance.xml:992 performance.xml:994 performance.xml:996 +#: performance.xml:1004 performance.xml:1006 performance.xml:1008 +#: performance.xml:1016 performance.xml:1018 performance.xml:1020 +#: performance.xml:1028 performance.xml:1030 performance.xml:1040 +#: performance.xml:1046 performance.xml:1052 performance.xml:1058 #, no-c-format -msgid "yes" -msgstr "" +msgid "yes" +msgstr "yes" #. Tag: entry +#: performance.xml:654 performance.xml:1002 #, no-c-format msgid "EHCache" msgstr "EHCache" -#. Tag: entry +#. Tag: literal +#: performance.xml:656 #, fuzzy, no-c-format -msgid "org.hibernate.cache.EhCacheProvider" +msgid "org.hibernate.cache.EhCacheProvider" msgstr "org.hibernate.cache.EhCacheProvider" #. Tag: entry +#: performance.xml:658 performance.xml:670 #, no-c-format msgid "memory, disk" msgstr "メモリ、ディスク" #. Tag: entry +#: performance.xml:666 performance.xml:1014 #, no-c-format msgid "OSCache" msgstr "OSCache" -#. Tag: entry +#. Tag: literal +#: performance.xml:668 #, fuzzy, no-c-format -msgid "org.hibernate.cache.OSCacheProvider" +msgid "org.hibernate.cache.OSCacheProvider" msgstr "org.hibernate.cache.OSCacheProvider" #. Tag: entry +#: performance.xml:678 performance.xml:1026 #, no-c-format msgid "SwarmCache" msgstr "SwarmCache" -#. Tag: entry +#. Tag: literal +#: performance.xml:680 #, fuzzy, no-c-format -msgid "org.hibernate.cache.SwarmCacheProvider" +msgid "org.hibernate.cache.SwarmCacheProvider" msgstr "org.hibernate.cache.SwarmCacheProvider" #. Tag: entry +#: performance.xml:682 #, no-c-format msgid "clustered (ip multicast)" msgstr "クラスタ(ip マルチキャスト)" #. Tag: entry +#: performance.xml:684 #, no-c-format msgid "yes (clustered invalidation)" msgstr "yes(クラスタ無効化)" #. Tag: entry +#: performance.xml:690 performance.xml:1038 #, no-c-format msgid "JBoss Cache 1.x" msgstr "" -#. Tag: entry +#. Tag: literal +#: performance.xml:692 #, fuzzy, no-c-format -msgid "org.hibernate.cache.TreeCacheProvider" +msgid "org.hibernate.cache.TreeCacheProvider" msgstr "org.hibernate.cache.TreeCacheProvider" #. Tag: entry +#: performance.xml:694 performance.xml:706 #, no-c-format msgid "clustered (ip multicast), transactional" msgstr "クラスタ(ip マルチキャスト)、トランザクショナル" #. Tag: entry +#: performance.xml:696 #, no-c-format msgid "yes (replication)" msgstr "yes(複製)" #. Tag: entry +#: performance.xml:698 performance.xml:710 #, no-c-format msgid "yes (clock sync req.)" msgstr "yes(時刻同期が必要)" #. Tag: entry +#: performance.xml:702 performance.xml:1050 #, no-c-format msgid "JBoss Cache 2" msgstr "" -#. Tag: entry +#. Tag: literal +#: performance.xml:704 #, fuzzy, no-c-format -msgid "org.hibernate.cache.jbc.JBossCacheRegionFactory" +msgid "org.hibernate.cache.jbc.JBossCacheRegionFactory" msgstr "org.hibernate.cache.jbc2.JBossCacheRegionFactory" #. Tag: entry +#: performance.xml:708 #, fuzzy, no-c-format msgid "yes (replication or invalidation)" msgstr "yes(クラスタ無効化)" #. Tag: title +#: performance.xml:717 #, no-c-format msgid "Cache mappings" msgstr "キャッシュのマッピング" #. Tag: para +#: performance.xml:719 #, no-c-format msgid "" -"The <cache> element of a class or collection " -"mapping has the following form:" +"As we have done in previous chapters we are looking at the two different " +"possibiltites to configure caching. First configuration via annotations and " +"then via Hibernate mapping files." msgstr "" -"クラスやコレクションのマッピングの <cache> 要素は以" -"下の形式です。" #. Tag: para +#: performance.xml:723 +#, no-c-format +msgid "" +"By default, entities are not part of the second level cache and we recommend " +"you to stick to this setting. However, you can override this by setting the " +"shared-cache-mode element in your persistence." +"xml file or by using the javax.persistence.sharedCache." +"mode property in your configuration. The following values are " +"possible:" +msgstr "" + +#. Tag: para +#: performance.xml:732 +#, no-c-format +msgid "" +"ENABLE_SELECTIVE (Default and recommended value): " +"entities are not cached unless explicitly marked as cacheable." +msgstr "" + +#. Tag: para +#: performance.xml:738 +#, no-c-format +msgid "" +"DISABLE_SELECTIVE: entities are cached unless explicitly " +"marked as not cacheable." +msgstr "" + +#. Tag: para +#: performance.xml:743 +#, no-c-format +msgid "" +"ALL: all entities are always cached even if marked as non " +"cacheable." +msgstr "" + +#. Tag: para +#: performance.xml:748 +#, no-c-format +msgid "" +"NONE: no entity are cached even if marked as cacheable. " +"This option can make sense to disable second-level cache altogether." +msgstr "" + +#. Tag: para +#: performance.xml:754 +#, no-c-format +msgid "" +"The cache concurrency strategy used by default can be set globaly via the " +"hibernate.cache.default_cache_concurrency_strategy " +"configuration property. The values for this property are:" +msgstr "" + +#. Tag: literal +#: performance.xml:761 +#, fuzzy, no-c-format +msgid "read-only" +msgstr "Criteria クエリ" + +#. Tag: literal +#: performance.xml:765 +#, fuzzy, no-c-format +msgid "read-write" +msgstr "Criteria クエリ" + +#. Tag: literal +#: performance.xml:769 +#, fuzzy, no-c-format +msgid "nonstrict-read-write" +msgstr "厳密ではない read-write" + +#. Tag: literal +#: performance.xml:773 +#, fuzzy, no-c-format +msgid "transactional" +msgstr "Criteria クエリ" + +#. Tag: para +#: performance.xml:778 +#, no-c-format +msgid "" +"It is recommended to define the cache concurrency strategy per entity rather " +"than using a global one. Use the @org.hibernate.annotations." +"Cache annotation for that." +msgstr "" + +#. Tag: title +#: performance.xml:785 +#, no-c-format +msgid "" +"Definition of cache concurrency strategy via @Cache" +msgstr "" + +#. Tag: programlisting +#: performance.xml:788 +#, no-c-format +msgid "" +"@Entity \n" +"@Cacheable\n" +"@Cache(usage = CacheConcurrencyStrategy.NONSTRICT_READ_WRITE)\n" +"public class Forest { ... }" +msgstr "" + +#. Tag: para +#: performance.xml:791 +#, no-c-format +msgid "" +"Hibernate also let's you cache the content of a collection or the " +"identifiers if the collection contains other entities. Use the " +"@Cache annotation on the collection property." +msgstr "" + +#. Tag: title +#: performance.xml:797 +#, fuzzy, no-c-format +msgid "Caching collections using annotations" +msgstr "コレクションとプロキシの初期化" + +#. Tag: programlisting +#: performance.xml:799 +#, no-c-format +msgid "" +"@OneToMany(cascade=CascadeType.ALL, fetch=FetchType.EAGER)\n" +"@JoinColumn(name=\"CUST_ID\")\n" +"@Cache(usage = CacheConcurrencyStrategy.NONSTRICT_READ_WRITE)\n" +"public SortedSet<Ticket> getTickets() {\n" +" return tickets;\n" +"}" +msgstr "" + +#. Tag: para +#: performance.xml:802 +#, no-c-format +msgid "" +"shows the @org.hibernate.annotations.Cache annotations " +"with its attributes. It allows you to define the caching strategy and region " +"of a given second level cache." +msgstr "" + +#. Tag: title +#: performance.xml:808 +#, no-c-format +msgid "@Cache annotation with attributes" +msgstr "" + +#. Tag: programlisting +#: performance.xml:820 +#, no-c-format +msgid "" +"@Cache(\n" +" CacheConcurrencyStrategy usage();\n" +" String region() default \"\";\n" +" String include() default \"all\";\n" +")" +msgstr "" + +#. Tag: para +#: performance.xml:824 +#, no-c-format +msgid "" +"usage: the given cache concurrency strategy (NONE, READ_ONLY, " +"NONSTRICT_READ_WRITE, READ_WRITE, TRANSACTIONAL)" +msgstr "" + +#. Tag: para +#: performance.xml:830 +#, no-c-format +msgid "" +"region (optional): the cache region (default to the fqcn of the class or the " +"fq role name of the collection)" +msgstr "" + +#. Tag: para +#: performance.xml:835 +#, no-c-format +msgid "" +"include (optional): all to include all properties, non-" +"lazy to only include non lazy properties (default all)." +msgstr "" + +#. Tag: para +#: performance.xml:843 +#, no-c-format +msgid "" +"Let's now take a look at Hibernate mapping files. There the <" +"cache> element of a class or collection mapping is used to " +"configure the second level cache. Looking at the parallels to anotations is obvious." +msgstr "" + +#. Tag: title +#: performance.xml:850 +#, no-c-format +msgid "The Hibernate <cache> mapping element" +msgstr "" + +#. Tag: programlisting +#: performance.xml:862 +#, fuzzy, no-c-format +msgid "" +"<cache\n" +" usage=\"transactional|read-write|nonstrict-read-write|read-only\"\n" +" region=\"RegionName\"\n" +" include=\"all|non-lazy\"\n" +"/>" +msgstr "" +"<cache \n" +" usage=\"transactional|read-write|nonstrict-read-write|read-only\"\n" +" region=\"RegionName\"\n" +" include=\"all|non-lazy\"\n" +"/>" + +#. Tag: para +#: performance.xml:866 #, no-c-format msgid "" "usage (required) specifies the caching strategy: " @@ -1189,6 +1899,7 @@ msgstr "" "nonstrict-read-write または read-only" #. Tag: para +#: performance.xml:874 #, no-c-format msgid "" "region (optional: defaults to the class or collection " @@ -1198,6 +1909,7 @@ msgstr "" "のデフォルト) 2次レベルのキャッシュ領域の名前を指定します" #. Tag: para +#: performance.xml:880 #, no-c-format msgid "" "include (optional: defaults to all) " @@ -1211,31 +1923,31 @@ msgstr "" "ティのプロパティはキャッシュされなくてもよいことを指定します。" #. Tag: para -#, no-c-format +#: performance.xml:890 +#, fuzzy, no-c-format msgid "" -"Alternatively, you can specify <class-cache> and " -"<collection-cache> elements in hibernate." -"cfg.xml." +"Alternatively to <cache>, you can use <" +"class-cache> and <collection-cache> " +"elements in hibernate.cfg.xml." msgstr "" "または(よりよい方法として?)、 hibernate.cfg.xml に " "<class-cache><collection-cache> 要素を指定することも出来ます。" #. Tag: para +#: performance.xml:895 #, no-c-format -msgid "" -"The usage attribute specifies a cache " -"concurrency strategy." +msgid "Let's now have a closer look at the different usage strategies" msgstr "" -"usage 属性は キャッシュの並列性戦略 " -"を指定します。" #. Tag: title +#: performance.xml:900 #, no-c-format msgid "Strategy: read only" msgstr "read only 戦略" #. Tag: para +#: performance.xml:902 #, no-c-format msgid "" "If your application needs to read, but not modify, instances of a persistent " @@ -1249,11 +1961,13 @@ msgstr "" "安全です。" #. Tag: title +#: performance.xml:909 #, no-c-format msgid "Strategy: read/write" msgstr "read/write 戦略" #. Tag: para +#: performance.xml:911 #, no-c-format msgid "" "If the application needs to update data, a read-write " @@ -1282,11 +1996,13 @@ msgstr "" "emphasis> 。" #. Tag: title +#: performance.xml:927 #, no-c-format msgid "Strategy: nonstrict read/write" msgstr "厳密ではない read/write 戦略" #. Tag: para +#: performance.xml:929 #, no-c-format msgid "" "If the application only occasionally needs to update data (i.e. if it is " @@ -1308,11 +2024,13 @@ msgstr "" "ションが完了していなければなりません。" #. Tag: title +#: performance.xml:941 #, no-c-format msgid "Strategy: transactional" msgstr "transactional 戦略" #. Tag: para +#: performance.xml:943 #, no-c-format msgid "" "The transactional cache strategy provides support for " @@ -1326,11 +2044,13 @@ msgstr "" "manager_lookup_class を指定しなければなりません。" #. Tag: title +#: performance.xml:950 #, fuzzy, no-c-format msgid "Cache-provider/concurrency-strategy compatibility" msgstr "同時並行性キャッシュ戦略のサポート" #. Tag: para +#: performance.xml:953 #, no-c-format msgid "" "None of the cache providers support all of the cache concurrency strategies." @@ -1339,6 +2059,7 @@ msgstr "" "ません。" #. Tag: para +#: performance.xml:957 #, no-c-format msgid "" "The following table shows which providers are compatible with which " @@ -1347,36 +2068,43 @@ msgstr "" "以下の表はどのプロバイダがどの同時並列性戦略に対応するかを表しています。" #. Tag: title +#: performance.xml:961 #, no-c-format msgid "Cache Concurrency Strategy Support" msgstr "同時並行性キャッシュ戦略のサポート" #. Tag: entry -#, no-c-format -msgid "read-only" -msgstr "read-only" +#: performance.xml:978 +#, fuzzy, no-c-format +msgid "read-only" +msgstr "yes" #. Tag: entry -#, no-c-format -msgid "nonstrict-read-write" +#: performance.xml:980 +#, fuzzy, no-c-format +msgid "nonstrict-read-write" msgstr "厳密ではない read-write" #. Tag: entry -#, no-c-format -msgid "read-write" -msgstr "read-write" +#: performance.xml:982 +#, fuzzy, no-c-format +msgid "read-write" +msgstr "yes" #. Tag: entry -#, no-c-format -msgid "transactional" -msgstr "transactional" +#: performance.xml:984 +#, fuzzy, no-c-format +msgid "transactional" +msgstr "yes" #. Tag: title +#: performance.xml:1067 #, no-c-format msgid "Managing the caches" msgstr "キャッシュの管理" #. Tag: para +#: performance.xml:1069 #, no-c-format msgid "" "Whenever you pass an object to save(), update()flush() is subsequently called, the state of that " @@ -1409,7 +2138,36 @@ msgstr "" " メソッドを使って一次キャッシュからオブジェクトやコレクションを削除" "することが出来ます。" +#. Tag: title +#: performance.xml:1084 +#, no-c-format +msgid "" +"Explcitly evicting a cached instance from the first level cache using " +"Session.evict()" +msgstr "" + +#. Tag: programlisting +#: performance.xml:1087 +#, fuzzy, no-c-format +msgid "" +"ScrollableResult cats = sess.createQuery(\"from Cat as cat\").scroll(); //a " +"huge result set\n" +"while ( cats.next() ) {\n" +" Cat cat = (Cat) cats.get(0);\n" +" doSomethingWithACat(cat);\n" +" sess.evict(cat);\n" +"}" +msgstr "" +"ScrollableResult cats = sess.createQuery(\"from Cat as cat\").scroll(); //a " +"huge result set\n" +"while ( cats.next() ) {\n" +" Cat cat = (Cat) cats.get(0);\n" +" doSomethingWithACat(cat);\n" +" sess.evict(cat);\n" +"}" + #. Tag: para +#: performance.xml:1090 #, no-c-format msgid "" "The Session also provides a contains() " @@ -1419,6 +2177,7 @@ msgstr "" "うかを判断するための contains() メソッドも提供します。" #. Tag: para +#: performance.xml:1094 #, no-c-format msgid "" "To evict all objects from the session cache, call Session.clear()Session.clear() を呼び出してください。" #. Tag: para +#: performance.xml:1097 #, no-c-format msgid "" "For the second-level cache, there are methods defined on " @@ -1438,7 +2198,34 @@ msgstr "" "クラス全体、コレクションのインスタンス、コレクション全体をキャッシュから削除" "するためのメソッドがそれぞれ定義されています。" +#. Tag: title +#: performance.xml:1103 +#, no-c-format +msgid "" +"Second-level cache eviction via SessionFactoty.evict() and SessionFacyory.evictCollection()" +msgstr "" + +#. Tag: programlisting +#: performance.xml:1107 +#, fuzzy, no-c-format +msgid "" +"sessionFactory.evict(Cat.class, catId); //evict a particular Cat\n" +"sessionFactory.evict(Cat.class); //evict all Cats\n" +"sessionFactory.evictCollection(\"Cat.kittens\", catId); //evict a particular " +"collection of kittens\n" +"sessionFactory.evictCollection(\"Cat.kittens\"); //evict all kitten " +"collections" +msgstr "" +"sessionFactory.evict(Cat.class, catId); //evict a particular Cat\n" +"sessionFactory.evict(Cat.class); //evict all Cats\n" +"sessionFactory.evictCollection(\"Cat.kittens\", catId); //evict a particular " +"collection of kittens\n" +"sessionFactory.evictCollection(\"Cat.kittens\"); //evict all kitten " +"collections" + #. Tag: para +#: performance.xml:1110 #, no-c-format msgid "" "The CacheMode controls how a particular session interacts " @@ -1448,6 +2235,7 @@ msgstr "" "互作用するかを指定します。" #. Tag: para +#: performance.xml:1115 #, no-c-format msgid "" "CacheMode.NORMAL: will read items from and write items to " @@ -1457,6 +2245,7 @@ msgstr "" "キャッシュを使います" #. Tag: para +#: performance.xml:1120 #, no-c-format msgid "" "CacheMode.GET: will read items from the second-level " @@ -1466,6 +2255,7 @@ msgstr "" "データを更新した場合を除いて二次キャッシュに書き込みをしません。" #. Tag: para +#: performance.xml:1126 #, no-c-format msgid "" "CacheMode.PUT: will write items to the second-level " @@ -1475,6 +2265,7 @@ msgstr "" "読み込みには二次キャッシュを使いません。" #. Tag: para +#: performance.xml:1131 #, no-c-format msgid "" "CacheMode.REFRESH: will write items to the second-level " @@ -1488,6 +2279,7 @@ msgstr "" "アイテムの二次キャッシュを強制的にリフレッシュします。" #. Tag: para +#: performance.xml:1139 #, no-c-format msgid "" "To browse the contents of a second-level or query cache region, use the " @@ -1496,7 +2288,30 @@ msgstr "" "二次キャッシュの内容やクエリキャッシュ領域を見るために、 " "Statistics API を使ってください:" +#. Tag: title +#: performance.xml:1143 +#, fuzzy, no-c-format +msgid "" +"Browsing the second-level cache entries via the Statistics API" +msgstr "" +"二次キャッシュの内容やクエリキャッシュ領域を見るために、 " +"Statistics API を使ってください:" + +#. Tag: programlisting +#: performance.xml:1146 +#, fuzzy, no-c-format +msgid "" +"Map cacheEntries = sessionFactory.getStatistics()\n" +" .getSecondLevelCacheStatistics(regionName)\n" +" .getEntries();" +msgstr "" +"Map cacheEntries = sessionFactory.getStatistics()\n" +" .getSecondLevelCacheStatistics(regionName)\n" +" .getEntries();" + #. Tag: para +#: performance.xml:1149 #, no-c-format msgid "" "You will need to enable statistics and, optionally, force Hibernate to keep " @@ -1506,11 +2321,29 @@ msgstr "" "解可能な形式で保持することを Hibernate に強制します:" #. Tag: title +#: performance.xml:1153 +#, no-c-format +msgid "Enabling Hibernate statistics" +msgstr "" + +#. Tag: programlisting +#: performance.xml:1155 +#, fuzzy, no-c-format +msgid "" +"hibernate.generate_statistics true\n" +"hibernate.cache.use_structured_entries true" +msgstr "" +"hibernate.generate_statistics true\n" +"hibernate.cache.use_structured_entries true" + +#. Tag: title +#: performance.xml:1160 #, no-c-format msgid "The Query Cache" msgstr "クエリキャッシュ" #. Tag: para +#: performance.xml:1162 #, fuzzy, no-c-format msgid "" "Query result sets can also be cached. This is only useful for queries that " @@ -1521,11 +2354,13 @@ msgstr "" "にしなくてはなりません:" #. Tag: title +#: performance.xml:1166 #, no-c-format msgid "Enabling query caching" msgstr "" #. Tag: para +#: performance.xml:1168 #, no-c-format msgid "" "Caching of query results introduces some overhead in terms of your " @@ -1538,12 +2373,20 @@ msgid "" "need to enable the query cache:" msgstr "" +#. Tag: programlisting +#: performance.xml:1177 +#, fuzzy, no-c-format +msgid "hibernate.cache.use_query_cache true" +msgstr "hibernate.cache.use_query_cache true" + #. Tag: para +#: performance.xml:1179 #, no-c-format msgid "This setting creates two new cache regions:" msgstr "" #. Tag: para +#: performance.xml:1181 #, no-c-format msgid "" "org.hibernate.cache.StandardQueryCache, holding the " @@ -1551,6 +2394,7 @@ msgid "" msgstr "" #. Tag: para +#: performance.xml:1186 #, no-c-format msgid "" "org.hibernate.cache.UpdateTimestampsCache, holding " @@ -1559,10 +2403,11 @@ msgid "" msgstr "" #. Tag: para +#: performance.xml:1194 #, no-c-format msgid "" "If you configure your underlying cache implementation to use expiry or " -"timeouts is is very important that the cache timeout of the underlying cache " +"timeouts is very important that the cache timeout of the underlying cache " "region for the UpdateTimestampsCache be set to a higher value than the " "timeouts of any of the query caches. In fact, we recommend that the the " "UpdateTimestampsCache region not be configured for expiry at all. Note, in " @@ -1570,6 +2415,7 @@ msgid "" msgstr "" #. Tag: para +#: performance.xml:1203 #, fuzzy, no-c-format msgid "" "As mentioned above, most queries do not benefit from caching or their " @@ -1586,6 +2432,7 @@ msgstr "" "ます。" #. Tag: para +#: performance.xml:1211 #, no-c-format msgid "" "The query cache does not cache the state of the actual entities in the " @@ -1596,11 +2443,13 @@ msgid "" msgstr "" #. Tag: title +#: performance.xml:1221 #, fuzzy, no-c-format msgid "Query cache regions" msgstr "クエリキャッシュのサポート" #. Tag: para +#: performance.xml:1223 #, no-c-format msgid "" "If you require fine-grained control over query cache expiration policies, " @@ -1611,7 +2460,28 @@ msgstr "" "setCacheRegion() を呼び出して特定のクエリに対するキャッシュ領域を指" "定することが出来ます。" +#. Tag: programlisting +#: performance.xml:1227 +#, fuzzy, no-c-format +msgid "" +"List blogs = sess.createQuery(\"from Blog blog where blog.blogger = :blogger" +"\")\n" +" .setEntity(\"blogger\", blogger)\n" +" .setMaxResults(15)\n" +" .setCacheable(true)\n" +" .setCacheRegion(\"frontpages\")\n" +" .list();" +msgstr "" +"List blogs = sess.createQuery(\"from Blog blog where blog.blogger = :blogger" +"\")\n" +" .setEntity(\"blogger\", blogger)\n" +" .setMaxResults(15)\n" +" .setCacheable(true)\n" +" .setCacheRegion(\"frontpages\")\n" +" .list();" + #. Tag: para +#: performance.xml:1229 #, fuzzy, no-c-format msgid "" "If you want to force the query cache to refresh one of its regions " @@ -1633,11 +2503,13 @@ msgstr "" "シュ領域を消去することです。" #. Tag: title +#: performance.xml:1242 #, no-c-format msgid "Understanding Collection performance" msgstr "コレクションのパフォーマンスの理解" #. Tag: para +#: performance.xml:1244 #, no-c-format msgid "" "In the previous sections we have covered collections and their applications. " @@ -1646,31 +2518,37 @@ msgid "" msgstr "" #. Tag: title +#: performance.xml:1249 #, no-c-format msgid "Taxonomy" msgstr "分類" #. Tag: para +#: performance.xml:1251 #, no-c-format msgid "Hibernate defines three basic kinds of collections:" msgstr "Hibernate は3つの基本的なコレクションの種類を定義しています:" #. Tag: para +#: performance.xml:1255 #, no-c-format msgid "collections of values" msgstr "値のコレクション" #. Tag: para +#: performance.xml:1259 #, no-c-format msgid "one-to-many associations" msgstr "一対多関連" #. Tag: para +#: performance.xml:1263 #, no-c-format msgid "many-to-many associations" msgstr "多対多関連" #. Tag: para +#: performance.xml:1267 #, no-c-format msgid "" "This classification distinguishes the various table and foreign key " @@ -1687,21 +2565,25 @@ msgstr "" "す。" #. Tag: para +#: performance.xml:1276 #, no-c-format msgid "indexed collections" msgstr "インデックス付きコレクション" #. Tag: para +#: performance.xml:1280 #, no-c-format msgid "sets" msgstr "set" #. Tag: para +#: performance.xml:1284 #, no-c-format msgid "bags" msgstr "bag" #. Tag: para +#: performance.xml:1288 #, no-c-format msgid "" "All indexed collections (maps, lists, and arrays) have a primary key " @@ -1717,6 +2599,7 @@ msgstr "" "に、その行を効率的に見つけることができます。" #. Tag: para +#: performance.xml:1295 #, no-c-format msgid "" "Sets have a primary key consisting of <key> and " @@ -1739,6 +2622,7 @@ msgstr "" "\" を宣言しなければなりません。)" #. Tag: para +#: performance.xml:1306 #, no-c-format msgid "" "<idbag> mappings define a surrogate key, so they " @@ -1748,6 +2632,7 @@ msgstr "" "新は常に非常に効率的です。事実上、これは最善のケースです。" #. Tag: para +#: performance.xml:1309 #, no-c-format msgid "" "Bags are the worst case since they permit duplicate element values and, as " @@ -1763,6 +2648,7 @@ msgstr "" "ションの再作成を行います。これは非常に非効率的かもしれません。" #. Tag: para +#: performance.xml:1316 #, no-c-format msgid "" "For a one-to-many association, the \"primary key\" may not be the physical " @@ -1776,12 +2662,14 @@ msgstr "" "ます。)" #. Tag: title +#: performance.xml:1323 #, no-c-format msgid "" "Lists, maps, idbags and sets are the most efficient collections to update" msgstr "更新にもっとも効率的なコレクション list、map、idbag、set" #. Tag: para +#: performance.xml:1326 #, no-c-format msgid "" "From the discussion above, it should be clear that indexed collections and " @@ -1792,6 +2680,7 @@ msgstr "" "除、更新でもっとも効率的な操作が出来ることは明らかです。" #. Tag: para +#: performance.xml:1330 #, no-c-format msgid "" "There is, arguably, one more advantage that indexed collections have over " @@ -1810,6 +2699,7 @@ msgstr "" "て行います。繰り返しますが、これは一対多関連には当てはまりません。" #. Tag: para +#: performance.xml:1338 #, no-c-format msgid "" "After observing that arrays cannot be lazy, you can conclude that lists, " @@ -1825,6 +2715,7 @@ msgstr "" "デルではもっとも自然だからです。" #. Tag: para +#: performance.xml:1344 #, no-c-format msgid "" "However, in well-designed Hibernate domain models, most collections are in " @@ -1839,11 +2730,13 @@ msgstr "" "フォーマンスの問題は当てはまりません。" #. Tag: title +#: performance.xml:1352 #, no-c-format msgid "Bags and lists are the most efficient inverse collections" msgstr "inverse コレクションにもっとも最適な bag と list" #. Tag: para +#: performance.xml:1354 #, no-c-format msgid "" "There is a particular case, however, in which bags, and also lists, are much " @@ -1864,12 +2757,30 @@ msgstr "" "いからです ( Set とは異なります)。これは以下の共通処理を" "より速くすることができます。" +#. Tag: programlisting +#: performance.xml:1365 +#, fuzzy, no-c-format +msgid "" +"Parent p = (Parent) sess.load(Parent.class, id);\n" +"Child c = new Child();\n" +"c.setParent(p);\n" +"p.getChildren().add(c); //no need to fetch the collection!\n" +"sess.flush();" +msgstr "" +"Parent p = (Parent) sess.load(Parent.class, id);\n" +"Child c = new Child();\n" +"c.setParent(p);\n" +"p.getChildren().add(c); //no need to fetch the collection!\n" +"sess.flush();" + #. Tag: title +#: performance.xml:1369 #, no-c-format msgid "One shot delete" msgstr "一括削除" #. Tag: para +#: performance.xml:1371 #, no-c-format msgid "" "Deleting collection elements one by one can sometimes be extremely " @@ -1884,6 +2795,7 @@ msgstr "" "一回発行して、それですべて終わります。" #. Tag: para +#: performance.xml:1377 #, no-c-format msgid "" "Suppose you added a single element to a collection of size twenty and then " @@ -1897,6 +2809,7 @@ msgstr "" "これは確かに望ましい動作です。" #. Tag: para +#: performance.xml:1383 #, no-c-format msgid "" "However, suppose that we remove eighteen elements, leaving two and then add " @@ -1906,11 +2819,13 @@ msgstr "" "す。このとき二つの方法があります。" #. Tag: para +#: performance.xml:1389 #, no-c-format msgid "delete eighteen rows one by one and then insert three rows" msgstr "18行を一つ一つ削除して、3行を追加する" #. Tag: para +#: performance.xml:1394 #, no-c-format msgid "" "remove the whole collection in one SQL DELETE and insert " @@ -1920,6 +2835,7 @@ msgstr "" "つの要素すべてを(一つずつ)追加する" #. Tag: para +#: performance.xml:1400 #, no-c-format msgid "" "Hibernate cannot know that the second option is probably quicker. It would " @@ -1931,6 +2847,7 @@ msgstr "" "振る舞いはデータベースのトリガなどを混乱させるかもしれません。)" #. Tag: para +#: performance.xml:1404 #, no-c-format msgid "" "Fortunately, you can force this behavior (i.e. the second strategy) at any " @@ -1942,6 +2859,7 @@ msgstr "" "戦略)を強制することが出来ます。時にこれはとても便利で強力です。" #. Tag: para +#: performance.xml:1409 #, no-c-format msgid "" "One-shot-delete does not apply to collections mapped inverse=\"true" @@ -1951,11 +2869,13 @@ msgstr "" "ンには行いません。" #. Tag: title +#: performance.xml:1415 #, no-c-format msgid "Monitoring performance" msgstr "パフォーマンスのモニタリング" #. Tag: para +#: performance.xml:1417 #, no-c-format msgid "" "Optimization is not much use without monitoring and access to performance " @@ -1968,11 +2888,13 @@ msgstr "" "は SessionFactory 単位で取得可能です。" #. Tag: title +#: performance.xml:1423 #, no-c-format msgid "Monitoring a SessionFactory" msgstr "SessionFactory のモニタリング" #. Tag: para +#: performance.xml:1425 #, no-c-format msgid "" "You can access SessionFactory metrics in two ways. Your " @@ -1984,6 +2906,7 @@ msgstr "" "び出し、自分で Statistics の読み込みや表示を行います。" #. Tag: para +#: performance.xml:1430 #, no-c-format msgid "" "Hibernate can also use JMX to publish metrics if you enable the " @@ -1997,7 +2920,56 @@ msgstr "" "に一つの MBean を有効にすることが出来ます。最小限の設定例である以下のコードを" "見てください:" +#. Tag: programlisting +#: performance.xml:1435 +#, fuzzy, no-c-format +msgid "" +"// MBean service registration for a specific SessionFactory\n" +"Hashtable tb = new Hashtable();\n" +"tb.put(\"type\", \"statistics\");\n" +"tb.put(\"sessionFactory\", \"myFinancialApp\");\n" +"ObjectName on = new ObjectName(\"hibernate\", tb); // MBean object name\n" +"\n" +"StatisticsService stats = new StatisticsService(); // MBean implementation\n" +"stats.setSessionFactory(sessionFactory); // Bind the stats to a " +"SessionFactory\n" +"server.registerMBean(stats, on); // Register the Mbean on the server" +msgstr "" +"// MBean service registration for a specific SessionFactory\n" +"Hashtable tb = new Hashtable();\n" +"tb.put(\"type\", \"statistics\");\n" +"tb.put(\"sessionFactory\", \"myFinancialApp\");\n" +"ObjectName on = new ObjectName(\"hibernate\", tb); // MBean object name\n" +"\n" +"StatisticsService stats = new StatisticsService(); // MBean implementation\n" +"stats.setSessionFactory(sessionFactory); // Bind the stats to a " +"SessionFactory\n" +"server.registerMBean(stats, on); // Register the Mbean on the server" + +#. Tag: programlisting +#: performance.xml:1437 +#, fuzzy, no-c-format +msgid "" +"// MBean service registration for all SessionFactory's\n" +"Hashtable tb = new Hashtable();\n" +"tb.put(\"type\", \"statistics\");\n" +"tb.put(\"sessionFactory\", \"all\");\n" +"ObjectName on = new ObjectName(\"hibernate\", tb); // MBean object name\n" +"\n" +"StatisticsService stats = new StatisticsService(); // MBean implementation\n" +"server.registerMBean(stats, on); // Register the MBean on the server" +msgstr "" +"// MBean service registration for all SessionFactory's\n" +"Hashtable tb = new Hashtable();\n" +"tb.put(\"type\", \"statistics\");\n" +"tb.put(\"sessionFactory\", \"all\");\n" +"ObjectName on = new ObjectName(\"hibernate\", tb); // MBean object name\n" +"\n" +"StatisticsService stats = new StatisticsService(); // MBean implementation\n" +"server.registerMBean(stats, on); // Register the MBean on the server" + #. Tag: para +#: performance.xml:1439 #, no-c-format msgid "" "You can activate and deactivate the monitoring for a " @@ -2007,6 +2979,7 @@ msgstr "" "とが出来ます。" #. Tag: para +#: performance.xml:1444 #, no-c-format msgid "" "at configuration time, set hibernate.generate_statistics " @@ -2016,6 +2989,7 @@ msgstr "" "false にします" #. Tag: para +#: performance.xml:1452 #, no-c-format msgid "" "at runtime: sf.getStatistics().setStatisticsEnabled(true) " @@ -2026,6 +3000,7 @@ msgstr "" "び出します" #. Tag: para +#: performance.xml:1458 #, no-c-format msgid "" "Statistics can be reset programmatically using the clear() インターフェースの API に書かれており、3つの分類があります:" #. Tag: para +#: performance.xml:1473 #, no-c-format msgid "" "Metrics related to the general Session usage, such as " @@ -2062,6 +3040,7 @@ msgstr "" "オープンしたセッションの数が JDBC コネクションと関連しているのと同じです。" #. Tag: para +#: performance.xml:1479 #, no-c-format msgid "" "Metrics related to the entities, collections, queries, and caches as a whole " @@ -2071,6 +3050,7 @@ msgstr "" "(別名はグローバルメトリクスです)。" #. Tag: para +#: performance.xml:1484 #, no-c-format msgid "" "Detailed metrics related to a particular entity, collection, query or cache " @@ -2080,6 +3060,7 @@ msgstr "" "関係しています。" #. Tag: para +#: performance.xml:1489 #, no-c-format msgid "" "For example, you can check the cache hit, miss, and put ratio of entities, " @@ -2094,6 +3075,7 @@ msgstr "" "フォームによっては10秒単位でしか正確でないかもしれません。" #. Tag: para +#: performance.xml:1495 #, no-c-format msgid "" "Simple getters are used to access the global metrics (i.e. not tied to a " @@ -2115,7 +3097,46 @@ msgstr "" "SecondLevelCacheStatisticsQueryStatistics API の javadoc を参照してください。以下のコードは簡単な例です:" +#. Tag: programlisting +#: performance.xml:1506 +#, fuzzy, no-c-format +msgid "" +"Statistics stats = HibernateUtil.sessionFactory.getStatistics();\n" +"\n" +"double queryCacheHitCount = stats.getQueryCacheHitCount();\n" +"double queryCacheMissCount = stats.getQueryCacheMissCount();\n" +"double queryCacheHitRatio =\n" +" queryCacheHitCount / (queryCacheHitCount + queryCacheMissCount);\n" +"\n" +"log.info(\"Query Hit ratio:\" + queryCacheHitRatio);\n" +"\n" +"EntityStatistics entityStats =\n" +" stats.getEntityStatistics( Cat.class.getName() );\n" +"long changes =\n" +" entityStats.getInsertCount()\n" +" + entityStats.getUpdateCount()\n" +" + entityStats.getDeleteCount();\n" +"log.info(Cat.class.getName() + \" changed \" + changes + \"times\" );" +msgstr "" +"Statistics stats = HibernateUtil.sessionFactory.getStatistics();\n" +"\n" +"double queryCacheHitCount = stats.getQueryCacheHitCount();\n" +"double queryCacheMissCount = stats.getQueryCacheMissCount();\n" +"double queryCacheHitRatio =\n" +" queryCacheHitCount / (queryCacheHitCount + queryCacheMissCount);\n" +"\n" +"log.info(\"Query Hit ratio:\" + queryCacheHitRatio);\n" +"\n" +"EntityStatistics entityStats =\n" +" stats.getEntityStatistics( Cat.class.getName() );\n" +"long changes =\n" +" entityStats.getInsertCount()\n" +" + entityStats.getUpdateCount()\n" +" + entityStats.getDeleteCount();\n" +"log.info(Cat.class.getName() + \" changed \" + changes + \"times\" );" + #. Tag: para +#: performance.xml:1508 #, no-c-format msgid "" "You can work on all entities, collections, queries and region caches, by " @@ -2130,6 +3151,29 @@ msgstr "" "getSecondLevelCacheRegionNames() メソッドでそれぞれの名前" "のリストを取得することが出来ます。" +#~ msgid "" +#~ "The <cache> element of a class or collection " +#~ "mapping has the following form:" +#~ msgstr "" +#~ "クラスやコレクションのマッピングの <cache> 要素は" +#~ "以下の形式です。" + +#~ msgid "" +#~ "The usage attribute specifies a cache " +#~ "concurrency strategy." +#~ msgstr "" +#~ "usage 属性は キャッシュの並列性戦略 を指定します。" + +#~ msgid "read-only" +#~ msgstr "read-only" + +#~ msgid "read-write" +#~ msgstr "read-write" + +#~ msgid "transactional" +#~ msgstr "transactional" + #~ msgid "" #~ "This setting creates two new cache regions: one holding cached query " #~ "result sets (org.hibernate.cache.StandardQueryCache), " @@ -2149,258 +3193,6 @@ msgstr "" #~ "みです。そのため、クエリキャッシュは常に二次キャッシュと一緒に使うべきで" #~ "す。" -#, fuzzy -#~ msgid "" -#~ "" -#~ msgstr "" -#~ "s = sessions.openSession();\n" -#~ "Transaction tx = s.beginTransaction();\n" -#~ " \n" -#~ "User u = (User) s.createQuery(\"from User u where u.name=:userName\")\n" -#~ " .setString(\"userName\", userName).uniqueResult();\n" -#~ "Map permissions = u.getPermissions();\n" -#~ "\n" -#~ "tx.commit();\n" -#~ "s.close();\n" -#~ "\n" -#~ "Integer accessLevel = (Integer) permissions.get(\"accounts\"); // Error!" - -#, fuzzy -#~ msgid "" -#~ "\n" -#~ " \n" -#~ " \n" -#~ "" -#~ msgstr "" -#~ "<set name=\"permissions\" \n" -#~ " fetch=\"join\">\n" -#~ " <key column=\"userId\"/>\n" -#~ " <one-to-many class=\"Permission\"/>\n" -#~ "</set" - -#, fuzzy -#~ msgid "" -#~ "]]>" -#~ msgstr "<many-to-one name=\"mother\" class=\"Cat\" fetch=\"join\"/>" - -#, fuzzy -#~ msgid "" -#~ "" -#~ msgstr "" -#~ "User user = (User) session.createCriteria(User.class)\n" -#~ " .setFetchMode(\"permissions\", FetchMode.JOIN)\n" -#~ " .add( Restrictions.idEq(userId) )\n" -#~ " .uniqueResult();" - -#, fuzzy -#~ msgid "" -#~ "\n" -#~ " ......\n" -#~ " \n" -#~ " .....\n" -#~ " \n" -#~ "]]>" -#~ msgstr "" -#~ "<class name=\"Cat\" proxy=\"Cat\">\n" -#~ " ......\n" -#~ " <subclass name=\"DomesticCat\">\n" -#~ " .....\n" -#~ " </subclass>\n" -#~ "</class>" - -#, fuzzy -#~ msgid "" -#~ "" -#~ msgstr "" -#~ "Cat cat = (Cat) session.load(Cat.class, id); // instantiate a proxy " -#~ "(does not hit the db)\n" -#~ "if ( cat.isDomesticCat() ) { // hit the db to initialize " -#~ "the proxy\n" -#~ " DomesticCat dc = (DomesticCat) cat; // Error!\n" -#~ " ....\n" -#~ "}" - -#, fuzzy -#~ msgid "" -#~ "" -#~ msgstr "" -#~ "Cat cat = (Cat) session.load(Cat.class, id); // instantiate a " -#~ "Cat proxy\n" -#~ "DomesticCat dc = \n" -#~ " (DomesticCat) session.load(DomesticCat.class, id); // acquire " -#~ "new DomesticCat proxy!\n" -#~ "System.out.println(cat==dc); // false" - -#, fuzzy -#~ msgid "" -#~ "" -#~ msgstr "" -#~ "cat.setWeight(11.0); // hit the db to initialize the proxy\n" -#~ "System.out.println( dc.getWeight() ); // 11.0" - -#, fuzzy -#~ msgid "" -#~ "\n" -#~ " ......\n" -#~ " \n" -#~ " .....\n" -#~ " \n" -#~ "]]>" -#~ msgstr "" -#~ "<class name=\"CatImpl\" proxy=\"Cat\">\n" -#~ " ......\n" -#~ " <subclass name=\"DomesticCatImpl\" proxy=\"DomesticCat\">\n" -#~ " .....\n" -#~ " </subclass>\n" -#~ "</class>" - -#, fuzzy -#~ msgid "" -#~ "" -#~ msgstr "" -#~ "Cat cat = (Cat) session.load(CatImpl.class, catid);\n" -#~ "Iterator iter = session.iterate(\"from CatImpl as cat where cat." -#~ "name='fritz'\");\n" -#~ "Cat fritz = (Cat) iter.next();" - -#, fuzzy -#~ msgid "" -#~ "" -#~ msgstr "" -#~ "( (Integer) s.createFilter( collection, \"select count(*)\" ).list().get" -#~ "(0) ).intValue()" - -#, fuzzy -#~ msgid "" -#~ "" -#~ msgstr "" -#~ "s.createFilter( lazyCollection, \"\").setFirstResult(0).setMaxResults(10)." -#~ "list();" - -#, fuzzy -#~ msgid "...]]>" -#~ msgstr "<class name=\"Person\" batch-size=\"10\">...</class>" - -#, fuzzy -#~ msgid "" -#~ "\n" -#~ " \n" -#~ " ...\n" -#~ " \n" -#~ "]]>" -#~ msgstr "" -#~ "<class name=\"Person\">\n" -#~ " <set name=\"cats\" batch-size=\"3\">\n" -#~ " ...\n" -#~ " </set>\n" -#~ "</class>" - -#, fuzzy -#~ msgid "" -#~ "\n" -#~ " \n" -#~ " \n" -#~ " \n" -#~ " \n" -#~ " \n" -#~ " \n" -#~ "]]>" -#~ msgstr "" -#~ "<class name=\"Document\">\n" -#~ " <id name=\"id\">\n" -#~ " <generator class=\"native\"/>\n" -#~ " </id>\n" -#~ " <property name=\"name\" not-null=\"true\" length=\"50\"/>\n" -#~ " <property name=\"summary\" not-null=\"true\" length=\"200\" lazy=" -#~ "\"true\"/>\n" -#~ " <property name=\"text\" not-null=\"true\" length=\"2000\" lazy=" -#~ "\"true\"/>\n" -#~ "</class>" - -#, fuzzy -#~ msgid "" -#~ "\n" -#~ " \n" -#~ " \n" -#~ " \n" -#~ " \n" -#~ " \n" -#~ "\n" -#~ " \n" -#~ " \n" -#~ " \n" -#~ " \n" -#~ " \n" -#~ "]]>" -#~ msgstr "" -#~ "<target name=\"instrument\" depends=\"compile\">\n" -#~ " <taskdef name=\"instrument\" classname=\"org.hibernate.tool." -#~ "instrument.InstrumentTask\">\n" -#~ " <classpath path=\"${jar.path}\"/>\n" -#~ " <classpath path=\"${classes.dir}\"/>\n" -#~ " <classpath refid=\"lib.class.path\"/>\n" -#~ " </taskdef>\n" -#~ "\n" -#~ " <instrument verbose=\"true\">\n" -#~ " <fileset dir=\"${testclasses.dir}/org/hibernate/auction/" -#~ "model\">\n" -#~ " <include name=\"*.class\"/>\n" -#~ " </fileset>\n" -#~ " </instrument>\n" -#~ "</target>" - -#~ msgid "yes" -#~ msgstr "yes" - -#, fuzzy -#~ msgid "" -#~ "]]>" -#~ msgstr "" -#~ "<cache \n" -#~ " usage=\"transactional|read-write|nonstrict-read-write|read-only\"\n" -#~ " region=\"RegionName\"\n" -#~ " include=\"all|non-lazy\"\n" -#~ "/>" - #, fuzzy #~ msgid "" #~ "\n" @@ -2432,177 +3224,3 @@ msgstr "" #~ " ....\n" #~ " </set>\n" #~ "</class>" - -#, fuzzy -#~ msgid "" -#~ "" -#~ msgstr "" -#~ "ScrollableResult cats = sess.createQuery(\"from Cat as cat\").scroll(); //" -#~ "a huge result set\n" -#~ "while ( cats.next() ) {\n" -#~ " Cat cat = (Cat) cats.get(0);\n" -#~ " doSomethingWithACat(cat);\n" -#~ " sess.evict(cat);\n" -#~ "}" - -#, fuzzy -#~ msgid "" -#~ "" -#~ msgstr "" -#~ "sessionFactory.evict(Cat.class, catId); //evict a particular Cat\n" -#~ "sessionFactory.evict(Cat.class); //evict all Cats\n" -#~ "sessionFactory.evictCollection(\"Cat.kittens\", catId); //evict a " -#~ "particular collection of kittens\n" -#~ "sessionFactory.evictCollection(\"Cat.kittens\"); //evict all kitten " -#~ "collections" - -#, fuzzy -#~ msgid "" -#~ "" -#~ msgstr "" -#~ "Map cacheEntries = sessionFactory.getStatistics()\n" -#~ " .getSecondLevelCacheStatistics(regionName)\n" -#~ " .getEntries();" - -#, fuzzy -#~ msgid "" -#~ "" -#~ msgstr "" -#~ "hibernate.generate_statistics true\n" -#~ "hibernate.cache.use_structured_entries true" - -#, fuzzy -#~ msgid "" -#~ msgstr "hibernate.cache.use_query_cache true" - -#, fuzzy -#~ msgid "" -#~ "" -#~ msgstr "" -#~ "List blogs = sess.createQuery(\"from Blog blog where blog.blogger = :" -#~ "blogger\")\n" -#~ " .setEntity(\"blogger\", blogger)\n" -#~ " .setMaxResults(15)\n" -#~ " .setCacheable(true)\n" -#~ " .setCacheRegion(\"frontpages\")\n" -#~ " .list();" - -#, fuzzy -#~ msgid "" -#~ "" -#~ msgstr "" -#~ "Parent p = (Parent) sess.load(Parent.class, id);\n" -#~ "Child c = new Child();\n" -#~ "c.setParent(p);\n" -#~ "p.getChildren().add(c); //no need to fetch the collection!\n" -#~ "sess.flush();" - -#, fuzzy -#~ msgid "" -#~ "" -#~ msgstr "" -#~ "// MBean service registration for a specific SessionFactory\n" -#~ "Hashtable tb = new Hashtable();\n" -#~ "tb.put(\"type\", \"statistics\");\n" -#~ "tb.put(\"sessionFactory\", \"myFinancialApp\");\n" -#~ "ObjectName on = new ObjectName(\"hibernate\", tb); // MBean object name\n" -#~ "\n" -#~ "StatisticsService stats = new StatisticsService(); // MBean " -#~ "implementation\n" -#~ "stats.setSessionFactory(sessionFactory); // Bind the stats to a " -#~ "SessionFactory\n" -#~ "server.registerMBean(stats, on); // Register the Mbean on the server" - -#, fuzzy -#~ msgid "" -#~ "" -#~ msgstr "" -#~ "// MBean service registration for all SessionFactory's\n" -#~ "Hashtable tb = new Hashtable();\n" -#~ "tb.put(\"type\", \"statistics\");\n" -#~ "tb.put(\"sessionFactory\", \"all\");\n" -#~ "ObjectName on = new ObjectName(\"hibernate\", tb); // MBean object name\n" -#~ "\n" -#~ "StatisticsService stats = new StatisticsService(); // MBean " -#~ "implementation\n" -#~ "server.registerMBean(stats, on); // Register the MBean on the server" - -#, fuzzy -#~ msgid "" -#~ "" -#~ msgstr "" -#~ "Statistics stats = HibernateUtil.sessionFactory.getStatistics();\n" -#~ "\n" -#~ "double queryCacheHitCount = stats.getQueryCacheHitCount();\n" -#~ "double queryCacheMissCount = stats.getQueryCacheMissCount();\n" -#~ "double queryCacheHitRatio =\n" -#~ " queryCacheHitCount / (queryCacheHitCount + queryCacheMissCount);\n" -#~ "\n" -#~ "log.info(\"Query Hit ratio:\" + queryCacheHitRatio);\n" -#~ "\n" -#~ "EntityStatistics entityStats =\n" -#~ " stats.getEntityStatistics( Cat.class.getName() );\n" -#~ "long changes =\n" -#~ " entityStats.getInsertCount()\n" -#~ " + entityStats.getUpdateCount()\n" -#~ " + entityStats.getDeleteCount();\n" -#~ "log.info(Cat.class.getName() + \" changed \" + changes + \"times\" );" diff --git a/documentation/manual/src/main/docbook/ja-JP/content/persistent_classes.po b/documentation/manual/src/main/docbook/ja-JP/content/persistent_classes.po index 7244d3b29a..606d4593a6 100644 --- a/documentation/manual/src/main/docbook/ja-JP/content/persistent_classes.po +++ b/documentation/manual/src/main/docbook/ja-JP/content/persistent_classes.po @@ -4,7 +4,7 @@ msgid "" msgstr "" "Project-Id-Version: Collection_Mapping\n" "Report-Msgid-Bugs-To: http://bugs.kde.org\n" -"POT-Creation-Date: 2010-02-11T05:38:15\n" +"POT-Creation-Date: 2010-07-20 21:02+0000\n" "PO-Revision-Date: 2010-01-04 13:58+1000\n" "Last-Translator: Xi HUANG \n" "Language-Team: \n" @@ -14,18 +14,20 @@ msgstr "" "X-Generator: KBabel 1.11.4\n" #. Tag: title +#: persistent_classes.xml:32 #, no-c-format msgid "Persistent Classes" msgstr "永続クラス" #. Tag: para -#, no-c-format +#: persistent_classes.xml:34 +#, fuzzy, 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. For example, an instance can instead be transient " -"or detached." +"application). The term \"persistent\" here means that the classes are able " +"to be persisted, not that they are in the persistent state (see for discussion)." msgstr "" "永続クラスはビジネス上の問題のエンティティ(例えば、 E コマースアプリケーショ" "ンの顧客や注文) を実装するアプリケーションのクラスです。永続クラスのすべての" @@ -34,13 +36,15 @@ msgstr "" "せん。" #. Tag: para -#, no-c-format +#: persistent_classes.xml:41 +#, fuzzy, 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 " +"these rules are hard requirements. Indeed, Hibernate assumes very little " "about the nature of your persistent objects. You can express a domain model " -"in other ways (using trees of Map instances, for example)." +"in other ways (using trees of java.util.Map " +"instances, for example)." msgstr "" "Plain Old Java Object (POJO)プログラミングモデルとしても知られるいくつかの単" "純なルールに従うなら、 Hibernate は最もよく働きます。しかしこれらのルールは難" @@ -49,18 +53,181 @@ msgstr "" "えば Map インスタンスのツリーを使う方法があります。" #. Tag: title +#: persistent_classes.xml:49 #, no-c-format msgid "A simple POJO example" msgstr "単純な POJO の例" -#. Tag: para +#. Tag: title +#: persistent_classes.xml:52 +#, no-c-format +msgid "Simple POJO representing a cat" +msgstr "" + +#. Tag: programlisting +#: persistent_classes.xml:53 #, fuzzy, no-c-format msgid "" -"Most Java applications require a persistent class representing felines. For " -"example:" -msgstr "以下はネコ科の動物を表現する永続クラスです。" +"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 "" +"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" +"}" #. Tag: para +#: persistent_classes.xml:57 #, no-c-format msgid "" "The four main rules of persistent classes are explored in more detail in the " @@ -68,19 +235,21 @@ msgid "" msgstr "" #. Tag: title +#: persistent_classes.xml:62 #, no-c-format msgid "Implement a no-argument constructor" msgstr "引数のないコンストラクタを実装する" #. Tag: para -#, no-c-format +#: persistent_classes.xml:64 +#, fuzzy, no-c-format msgid "" -"Cat has a no-argument constructor. All persistent classes " -"must have a default constructor (which can be non-public) so that Hibernate " -"can instantiate them using Constructor.newInstance(). It " -"is recommended that you have a default constructor with at least " -"package visibility for runtime proxy generation in " -"Hibernate." +"Cat has a no-argument constructor. All persistent " +"classes must have a default constructor (which can be non-public) so that " +"Hibernate can instantiate them using java.lang.reflect." +"Constructor.newInstance(). It is recommended that this " +"constructor be defined with at least package visibility " +"in order for runtime proxy generation to work properly." msgstr "" "Cat には引数のないコンストラクタがあります。 Hibernate が " "Constructor.newInstance() を使って永続クラスのインスタンス" @@ -90,69 +259,42 @@ msgstr "" "ストラクタを強くお勧めします。" #. Tag: title -#, no-c-format -msgid "Provide an identifier property (optional)" +#: persistent_classes.xml:74 +#, fuzzy, no-c-format +msgid "Provide an identifier property" msgstr "識別子プロパティを用意する(オプション)" #. Tag: para -#, fuzzy, no-c-format -msgid "" -"Cat has a property called id. 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, java.lang.String or " -"java.util.Date. If your legacy database table has " -"composite keys, you can use a user-defined class with properties of these " -"types (see the section on composite identifiers later in the chapter.)" -msgstr "" -"Cat には id というプロパティがありま" -"す。このプロパティはデータベーステーブルの主キーカラムへマッピングされます。" -"このプロパティの名前は何でも構いませんし、型はどのようなプリミティブ型でも、" -"プリミティブの「ラッパー」型でも、 java.lang.String や " -"java.util.Date でも構いません。 (もしレガシーデータベース" -"テーブルが複合キーを持つならば、今述べたような型のプロパティを持つユーザー定" -"義のクラスを使うことさえ可能です。後で複合識別子のセクションを見てくださ" -"い。)" - -#. Tag: para +#: persistent_classes.xml:77 #, 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." +"Historically this was considered option. While still not (yet) enforced, " +"this should be considered a deprecated feature as it will be completely " +"required to provide a identifier property in an upcoming release." msgstr "" -"識別子プロパティは厳密にはオプションです。これを省略して、 Hibernate に内部的" -"にオブジェクトの識別子を追跡させることは可能です。しかしお勧めはしません。" #. Tag: para +#: persistent_classes.xml:84 #, no-c-format msgid "" -"In fact, some functionality is available only to classes that declare an " -"identifier property:" +"Cat has a property named id. This " +"property maps to the primary key column(s) of the underlying database table. " +"The type of the identifier property can be any \"basic\" type (see ). See for information on mapping composite (multi-column) identifiers." msgstr "" -"実際に、識別子プロパティを宣言するクラスだけが利用可能な機能がいくつかありま" -"す:" #. Tag: para -#, fuzzy, no-c-format +#: persistent_classes.xml:92 +#, no-c-format msgid "" -"Transitive reattachment for detached objects (cascade update or cascade " -"merge) - see " +"Identifiers do not necessarily need to identify column(s) in the database " +"physically defined as a primary key. They should just identify columns that " +"can be used to uniquely identify rows in the underlying table." msgstr "" -"分離オブジェクトの連鎖的な再追加(カスケード更新やカスケードマージ) - 次を参照してください。" - -#. Tag: para -#, fuzzy, no-c-format -msgid "Session.saveOrUpdate()" -msgstr "" - -#. Tag: para -#, fuzzy, no-c-format -msgid "Session.merge()" -msgstr "Session.merge()" #. Tag: para +#: persistent_classes.xml:99 #, no-c-format msgid "" "We recommend that you declare consistently-named identifier properties on " @@ -163,41 +305,100 @@ msgstr "" "う。" #. Tag: title -#, no-c-format -msgid "Prefer non-final classes (optional)" +#: persistent_classes.xml:107 +#, fuzzy, no-c-format +msgid "Prefer non-final classes (semi-optional)" msgstr "final クラスにしない(オプション)" #. Tag: para +#: persistent_classes.xml:109 #, no-c-format msgid "" -"A central feature of Hibernate, proxies, depends upon " -"the persistent class being either non-final, or the implementation of an " -"interface that declares all public methods." +"A central feature of Hibernate, proxies (lazy loading), " +"depends upon the persistent class being either non-final, or the " +"implementation of an interface that declares all public methods. You can " +"persist final classes that do not implement an interface " +"with Hibernate; you will not, however, be able to use proxies for lazy " +"association fetching which will ultimately limit your options for " +"performance tuning. To persist a final class which does " +"not implement a \"full\" interface you must disable proxy generation. See " +" and ." +msgstr "" + +#. Tag: title +#: persistent_classes.xml:121 +#, no-c-format +msgid "Disabling proxies in hbm.xml" +msgstr "" + +#. Tag: programlisting +#: persistent_classes.xml:122 +#, no-c-format +msgid "...]]>" +msgstr "" + +#. Tag: title +#: persistent_classes.xml:126 +#, no-c-format +msgid "Disabling proxies in annotations" +msgstr "" + +#. Tag: programlisting +#: persistent_classes.xml:127 +#, no-c-format +msgid "" msgstr "" -"Hibernate の中心的な特徴である プロキシ は、永続クラス" -"が final でないこと、またはメソッドを全部 public で宣言しているインターフェー" -"スが実装されているかに依存しています。" #. Tag: para +#: persistent_classes.xml:130 #, no-c-format msgid "" -"You can persist final classes that do not implement an " -"interface with Hibernate. You will not, however, be able to use proxies for " -"lazy association fetching which will ultimately limit your options for " -"performance tuning." +"If the final class does implement a proper interface, you " +"could alternatively tell Hibernate to use the interface instead when " +"generating the proxies. See and ." +msgstr "" + +#. Tag: title +#: persistent_classes.xml:139 +#, no-c-format +msgid "Proxying an interface in hbm.xml" +msgstr "" + +#. Tag: programlisting +#: persistent_classes.xml:140 +#, no-c-format +msgid "...]]>" +msgstr "" + +#. Tag: title +#: persistent_classes.xml:144 +#, no-c-format +msgid "Proxying an interface in annotations" +msgstr "" + +#. Tag: programlisting +#: persistent_classes.xml:145 +#, no-c-format +msgid "" +"" msgstr "" -"Hibernate でインターフェースを実装していない final クラス" -"を永続化することはできますが、遅延関連フェッチに対してプロキシを使うことはで" -"きなくなります。これはパフォーマンスチューニングへの選択肢を狭めることになり" -"ます。" #. Tag: para -#, no-c-format +#: persistent_classes.xml:148 +#, fuzzy, no-c-format msgid "" -"You should also avoid declaring public final methods on " -"the non-final classes. If you want to use a class with a public " -"final method, you must explicitly disable proxying by setting " -"lazy=\"false\"." +"You should also avoid declaring public final methods as " +"this will again limit the ability to generate proxies " +"from this class. If you want to use a class with public final methods, you must explicitly disable proxying. Again, see and " +"." msgstr "" "final ではないクラスで public final メソッドを定義すること" "も避けるべきです。 public final メソッドを持つクラスを使い" @@ -205,14 +406,16 @@ msgstr "" "にしなければなりません。" #. Tag: title +#: persistent_classes.xml:158 #, no-c-format msgid "Declare accessors and mutators for persistent fields (optional)" msgstr "永続フィールドに対するアクセサとミューテータを定義する(オプション)" #. Tag: para +#: persistent_classes.xml:160 #, fuzzy, no-c-format msgid "" -"Cat declares accessor methods for all its persistent " +"Cat declares accessor methods for all its persistent " "fields. Many other ORM tools directly persist instance variables. It is " "better to provide an indirection between the relational schema and internal " "data structures of the class. By default, Hibernate persists JavaBeans style " @@ -229,11 +432,13 @@ msgstr "" "て、直接のフィールドアクセスに切り替えることは可能です。" #. Tag: para -#, no-c-format +#: persistent_classes.xml:169 +#, fuzzy, no-c-format msgid "" -"Properties need not be declared public - Hibernate can " -"persist a property with a default, protected or " -"private get / set pair." +"Properties need not be declared public. Hibernate can " +"persist a property declared with package, " +"protected or private visibility as " +"well." msgstr "" "プロパティは public で宣言する必要は ありません 。 " "Hibernate はデフォルトで、 protected もしくは " @@ -241,11 +446,13 @@ msgstr "" "とができます。" #. Tag: title +#: persistent_classes.xml:178 #, no-c-format msgid "Implementing inheritance" msgstr "継承の実装" #. Tag: para +#: persistent_classes.xml:180 #, no-c-format msgid "" "A subclass must also observe the first and second rules. It inherits its " @@ -254,13 +461,45 @@ msgstr "" "サブクラスも1番目と2番目のルールを守らなければなりません。サブクラスはスー" "パークラス Cat から識別子プロパティを継承します。" +#. Tag: programlisting +#: persistent_classes.xml:184 +#, fuzzy, no-c-format +msgid "" +"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 "" +"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" +"}" + #. Tag: title +#: persistent_classes.xml:188 #, no-c-format msgid "" "Implementing equals() and hashCode()" msgstr "equals()hashCode()の実装" #. Tag: para +#: persistent_classes.xml:191 #, no-c-format msgid "" "You have to override the equals() and hashCode()" @@ -270,6 +509,7 @@ msgstr "" "literal> メソッドをオーバーライドしなければなりません、" #. Tag: para +#: persistent_classes.xml:196 #, no-c-format msgid "" "intend to put instances of persistent classes in a Set " @@ -280,11 +520,13 @@ msgstr "" "関連を表現するおすすめの方法です) そして同時に" #. Tag: para +#: persistent_classes.xml:202 #, no-c-format msgid "intend to use reattachment of detached instances" msgstr "分離インスタンスをセッションへ再追加する場合。" #. Tag: para +#: persistent_classes.xml:206 #, no-c-format msgid "" "Hibernate guarantees equivalence of persistent identity (database row) and " @@ -300,6 +542,7 @@ msgstr "" "と hashCode() を実装しなければなりません。" #. Tag: para +#: persistent_classes.xml:212 #, no-c-format msgid "" "The most obvious way is to implement equals()/" @@ -334,6 +577,7 @@ msgstr "" "注意してください。" #. Tag: para +#: persistent_classes.xml:228 #, no-c-format msgid "" "It is recommended that you implement equals() and " @@ -349,11 +593,64 @@ msgstr "" "つまり現実の世界においてインスタンスを特定するキー(自然 候補キー) を形成するプロパティだけを比較することを意味します。" +#. Tag: programlisting +#: persistent_classes.xml:235 +#, fuzzy, no-c-format +msgid "" +"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 "" +"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" +"}" + #. Tag: para +#: persistent_classes.xml:237 #, fuzzy, no-c-format msgid "" "A business key does not have to be as solid as a database primary key " -"candidate (see ). Immutable " +"candidate (see ). Immutable " "or unique properties are usually good candidates for a business key." msgstr "" "ビジネスキーはデータベースの主キー候補ほど安定である必要はないことに注意して" @@ -362,25 +659,29 @@ msgstr "" "補です。" #. Tag: title +#: persistent_classes.xml:244 #, no-c-format msgid "Dynamic models" msgstr "動的モデル" #. Tag: title +#: persistent_classes.xml:247 #, no-c-format msgid "Note" msgstr "注意" -#. Tag: para +#. Tag: emphasis +#: persistent_classes.xml:249 #, fuzzy, no-c-format msgid "" -"The following features are currently considered experimental and " -"may change in the near future." +"The following features are currently considered experimental and may change " +"in the near future." msgstr "" "以下の機能は現在実験段階にあると見なされており、近い将来変更される可能性があ" "ることに注意してください。" #. Tag: para +#: persistent_classes.xml:253 #, no-c-format msgid "" "Persistent entities do not necessarily have to be represented as POJO " @@ -396,12 +697,13 @@ msgstr "" "ングファイルだけを書くことになります。" #. Tag: para +#: persistent_classes.xml:259 #, fuzzy, no-c-format msgid "" "By default, Hibernate works in normal POJO mode. You can set a default " "entity representation mode for a particular SessionFactory using the default_entity_mode configuration " -"option (see )." +"option (see )." msgstr "" "デフォルトでは、 Hibernate は通常の POJO モードで動作します。 " "default_entity_mode 設定オプションを使って、特定の " @@ -410,6 +712,7 @@ msgstr "" "\"/> を見てください)。" #. Tag: para +#: persistent_classes.xml:265 #, no-c-format msgid "" "The following examples demonstrate the representation using Mapentity-name を定義しなければなりません:" +#. Tag: programlisting +#: persistent_classes.xml:270 +#, fuzzy, no-c-format +msgid "" +"<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 "" +"<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>" + #. Tag: para +#: persistent_classes.xml:272 #, no-c-format msgid "" "Even though associations are declared using target class names, the target " @@ -430,6 +806,7 @@ msgstr "" "POJO ではなく動的なエンティティでも構わないことに注意してください。" #. Tag: para +#: persistent_classes.xml:276 #, no-c-format msgid "" "After setting the default entity mode to dynamic-map for " @@ -440,7 +817,55 @@ msgstr "" "dynamic-map に設定した後、実行時に Map " "の Map を使うことができます:" +#. Tag: programlisting +#: persistent_classes.xml:281 +#, fuzzy, no-c-format +msgid "" +"Session s = openSession();\n" +"Transaction tx = s.beginTransaction();\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 "" +"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();" + #. Tag: para +#: persistent_classes.xml:283 #, no-c-format msgid "" "One of the main advantages of dynamic mapping is quick turnaround time for " @@ -458,6 +883,7 @@ msgstr "" "ます。" #. Tag: para +#: persistent_classes.xml:290 #, no-c-format msgid "" "Entity representation modes can also be set on a per SessionSession ごとに設定することも可能" "です。" +#. Tag: programlisting +#: persistent_classes.xml:293 +#, fuzzy, no-c-format +msgid "" +"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" +msgstr "" +"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" + #. Tag: para +#: persistent_classes.xml:295 #, no-c-format msgid "" "Please note that the call to getSession() using an " @@ -488,31 +943,35 @@ msgstr "" "of Work)に任せることができるということです。" #. Tag: para +#: persistent_classes.xml:304 #, fuzzy, no-c-format msgid "" "More information about the XML representation capabilities can be found in " -"." +"." msgstr "" "XML 表現の能力についてのさらなる情報は に記述されてい" "ます。" #. Tag: title +#: persistent_classes.xml:310 #, no-c-format msgid "Tuplizers" msgstr "Tuplizer" #. Tag: para -#, no-c-format +#: persistent_classes.xml:312 +#, fuzzy, no-c-format msgid "" -"org.hibernate.tuple.Tuplizer, and its sub-interfaces, are " -"responsible for managing a particular representation of a piece of data " -"given that representation's org.hibernate.EntityMode. If " -"a given piece of data is thought of as a data structure, then a tuplizer is " -"the thing that 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 corresponding tuplizer knows how create the POJO " -"through its constructor. It also knows how to access the POJO properties " -"using the defined property accessors." +"org.hibernate.tuple.Tuplizer and its sub-" +"interfaces are responsible for managing a particular representation of a " +"piece of data given that representation's org.hibernate." +"EntityMode. If a given piece of data is thought of as a data " +"structure, then a tuplizer is the thing that knows how to create such a data " +"structure, how to extract values from such a data structure and how to " +"inject values into such a data structure. For example, for the POJO entity " +"mode, the corresponding tuplizer knows how create the POJO through its " +"constructor. It also knows how to access the POJO properties using the " +"defined property accessors." msgstr "" "org.hibernate.tuple.Tuplizer とそのサブインターフェース" "は、表現の org.hibernate.EntityMode を利用して、データ断片" @@ -524,33 +983,44 @@ msgstr "" "ティにどのようにアクセスするかを知ります。" #. Tag: para +#: persistent_classes.xml:322 #, no-c-format -msgid "" -"There are two high-level types of Tuplizers, represented by the org." -"hibernate.tuple.entity.EntityTuplizer and org.hibernate." -"tuple.component.ComponentTuplizer interfaces. " -"EntityTuplizers are responsible for managing the above " -"mentioned contracts in regards to entities, while " -"ComponentTuplizers do the same for components." +msgid "There are two (high-level) types of Tuplizers:" msgstr "" -"Tuplizer には二つのハイレベルの型があります。それらは、org." -"hibernate.tuple.entity.EntityTuplizerorg.hibernate." -"tuple.component.ComponentTuplizer インターフェースで表現されます。 " -"EntityTuplizer は上で述べたようなエンティティに関する契約" -"の管理に責任を持ちます。一方、 ComponentTuplizer はコン" -"ポーネントに関する契約の管理に責任を持ちます。" #. Tag: para +#: persistent_classes.xml:326 #, no-c-format msgid "" -"Users can also plug in their own tuplizers. Perhaps you require that a " -"java.util.Map implementation other than java." -"util.HashMap 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. Tuplizer definitions are attached to the entity or component " -"mapping they are meant to manage. Going back to the example of our customer " -"entity:" +"org.hibernate.tuple.entity.EntityTuplizer " +"which is responsible for managing the above mentioned contracts in regards " +"to entities" +msgstr "" + +#. Tag: para +#: persistent_classes.xml:332 +#, no-c-format +msgid "" +"org.hibernate.tuple.component.ComponentTuplizer which does the same for components" +msgstr "" + +#. Tag: para +#: persistent_classes.xml:340 +#, fuzzy, no-c-format +msgid "" +"Users can also plug in their own tuplizers. Perhaps you require that " +"java.util.Map implementation other than " +"java.util.HashMap 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. Tuplizer definitions are attached to the " +"entity or component mapping they are meant to manage. Going back to the " +"example of our Customer entity, shows how to specify a custom " +"org.hibernate.tuple.entity.EntityTuplizer " +"using annotations while shows how to do the same in hbm.xml" msgstr "" "ユーザーは独自の Tuplizer に差し替えることも可能です。おそらく dynamic-map " "entity-mode の際に java.util.HashMap を使うのではなく、 " @@ -561,29 +1031,217 @@ msgstr "" "客エンティティの例は以下になります:" #. Tag: title +#: persistent_classes.xml:353 +#, no-c-format +msgid "Specify custom tuplizers in annotations" +msgstr "" + +#. Tag: programlisting +#: persistent_classes.xml:354 +#, no-c-format +msgid "" +"@Entity\n" +"@Tuplizer(impl = DynamicEntityTuplizer.class)\n" +"public interface Cuisine {\n" +" @Id\n" +" @GeneratedValue\n" +" public Long getId();\n" +" public void setId(Long id);\n" +"\n" +" public String getName();\n" +" public void setName(String name);\n" +"\n" +" @Tuplizer(impl = DynamicComponentTuplizer.class)\n" +" public Country getCountry();\n" +" public void setCountry(Country country);\n" +"}" +msgstr "" + +#. Tag: title +#: persistent_classes.xml:357 +#, no-c-format +msgid "Specify custom tuplizers in hbm.xml" +msgstr "" + +#. Tag: programlisting +#: persistent_classes.xml:358 +#, no-c-format +msgid "" +"<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>" +msgstr "" + +#. Tag: title +#: persistent_classes.xml:363 #, fuzzy, no-c-format msgid "EntityNameResolvers" msgstr "エンティティリゾルバ" #. Tag: para +#: persistent_classes.xml:365 #, no-c-format msgid "" -"The org.hibernate.EntityNameResolver " -"interface is a contract for resolving the entity name of a given entity " -"instance. The interface defines a single method " -"resolveEntityName which is passed the entity " -"instance and is expected to return the appropriate entity name (null is " -"allowed and would indicate that the resolver does not know how to resolve " -"the entity name of the given entity instance). Generally speaking, an " -"org.hibernate.EntityNameResolver is going to " -"be most useful in the case of dynamic models. One example might be using " -"proxied interfaces as your domain model. The hibernate test suite has an " -"example of this exact style of usage under the org.hibernate.test." -"dynamicentity.tuplizer2. Here is some of the code from that " -"package for illustration." +"org.hibernate.EntityNameResolver is a " +"contract for resolving the entity name of a given entity instance. The " +"interface defines a single method resolveEntityName " +"which is passed the entity instance and is expected to return the " +"appropriate entity name (null is allowed and would indicate that the " +"resolver does not know how to resolve the entity name of the given entity " +"instance). Generally speaking, an org.hibernate." +"EntityNameResolver is going to be most useful in the case of " +"dynamic models. One example might be using proxied interfaces as your domain " +"model. The hibernate test suite has an example of this exact style of usage " +"under the org.hibernate.test.dynamicentity.tuplizer2. " +"Here is some of the code from that package for illustration." +msgstr "" + +#. Tag: programlisting +#: persistent_classes.xml:377 +#, no-c-format +msgid "" +"/**\n" +" * A very trivial JDK Proxy InvocationHandler implementation where we proxy " +"an\n" +" * interface as the domain model and simply store persistent state in an " +"internal\n" +" * Map. This is an extremely trivial example meant only for illustration.\n" +" */\n" +"public final class DataProxyHandler implements InvocationHandler {\n" +" private String entityName;\n" +" private HashMap data = new HashMap();\n" +"\n" +" public DataProxyHandler(String entityName, Serializable id) {\n" +" this.entityName = entityName;\n" +" data.put( \"Id\", id );\n" +" }\n" +"\n" +" public Object invoke(Object proxy, Method method, Object[] args) " +"throws Throwable {\n" +" String methodName = method.getName();\n" +" if ( methodName.startsWith( \"set\" ) ) {\n" +" String propertyName = methodName.substring( 3 );\n" +" data.put( propertyName, args[0] );\n" +" }\n" +" else if ( methodName.startsWith( \"get\" ) ) {\n" +" String propertyName = methodName.substring( 3 );\n" +" return data.get( propertyName );\n" +" }\n" +" else if ( \"toString\".equals( methodName ) ) {\n" +" return entityName + \"#\" + data.get( \"Id\" );\n" +" }\n" +" else if ( \"hashCode\".equals( methodName ) ) {\n" +" return new Integer( this.hashCode() );\n" +" }\n" +" return null;\n" +" }\n" +"\n" +" public String getEntityName() {\n" +" return entityName;\n" +" }\n" +"\n" +" public HashMap getData() {\n" +" return data;\n" +" }\n" +"}\n" +"\n" +"public class ProxyHelper {\n" +" public static String extractEntityName(Object object) {\n" +" // Our custom java.lang.reflect.Proxy instances actually bundle\n" +" // their appropriate entity name, so we simply extract it from " +"there\n" +" // if this represents one of our proxies; otherwise, we return null\n" +" if ( Proxy.isProxyClass( object.getClass() ) ) {\n" +" InvocationHandler handler = Proxy.getInvocationHandler" +"( object );\n" +" if ( DataProxyHandler.class.isAssignableFrom( handler.getClass" +"() ) ) {\n" +" DataProxyHandler myHandler = ( DataProxyHandler ) handler;\n" +" return myHandler.getEntityName();\n" +" }\n" +" }\n" +" return null;\n" +" }\n" +"\n" +" // various other utility methods ....\n" +"\n" +"}\n" +"\n" +"/**\n" +" * The EntityNameResolver implementation.\n" +" *\n" +" * IMPL NOTE : An EntityNameResolver really defines a strategy for how " +"entity names\n" +" * should be resolved. Since this particular impl can handle resolution for " +"all of our\n" +" * entities we want to take advantage of the fact that SessionFactoryImpl " +"keeps these\n" +" * in a Set so that we only ever have one instance registered. Why? Well, " +"when it\n" +" * comes time to resolve an entity name, Hibernate must iterate over all the " +"registered\n" +" * resolvers. So keeping that number down helps that process be as speedy " +"as possible.\n" +" * Hence the equals and hashCode implementations as is\n" +" */\n" +"public class MyEntityNameResolver implements EntityNameResolver {\n" +" public static final MyEntityNameResolver INSTANCE = new " +"MyEntityNameResolver();\n" +"\n" +" public String resolveEntityName(Object entity) {\n" +" return ProxyHelper.extractEntityName( entity );\n" +" }\n" +"\n" +" public boolean equals(Object obj) {\n" +" return getClass().equals( obj.getClass() );\n" +" }\n" +"\n" +" public int hashCode() {\n" +" return getClass().hashCode();\n" +" }\n" +"}\n" +"\n" +"public class MyEntityTuplizer extends PojoEntityTuplizer {\n" +" public MyEntityTuplizer(EntityMetamodel entityMetamodel, " +"PersistentClass mappedEntity) {\n" +" super( entityMetamodel, mappedEntity );\n" +" }\n" +"\n" +" public EntityNameResolver[] getEntityNameResolvers() {\n" +" return new EntityNameResolver[] { MyEntityNameResolver." +"INSTANCE };\n" +" }\n" +"\n" +" public String determineConcreteSubclassEntityName(Object entityInstance, " +"SessionFactoryImplementor factory) {\n" +" String entityName = ProxyHelper.extractEntityName" +"( entityInstance );\n" +" if ( entityName == null ) {\n" +" entityName = super.determineConcreteSubclassEntityName" +"( entityInstance, factory );\n" +" }\n" +" return entityName;\n" +" }\n" +"\n" +" ..." msgstr "" #. Tag: para +#: persistent_classes.xml:379 #, no-c-format msgid "" "In order to register an org.hibernate.EntityNameResolverTuplizer, implementing the getEntityNameResolvers " -"method." +"Implement a custom tuplizer (see ), implementing the getEntityNameResolvers " +"method" msgstr "" #. Tag: para +#: persistent_classes.xml:389 #, no-c-format msgid "" "Register it with the org.hibernate.impl.SessionFactoryImpl" -#~ msgstr "" -#~ "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" -#~ "}" +#~ "Most Java applications require a persistent class representing felines. " +#~ "For example:" +#~ msgstr "以下はネコ科の動物を表現する永続クラスです。" #, fuzzy #~ msgid "" -#~ "" +#~ "Cat has a property called id. 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, java.lang." +#~ "String or java.util.Date. If your legacy " +#~ "database table has composite keys, you can use a user-defined class with " +#~ "properties of these types (see the section on composite identifiers later " +#~ "in the chapter.)" #~ msgstr "" -#~ "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" -#~ "}" +#~ "Cat には id というプロパティがありま" +#~ "す。このプロパティはデータベーステーブルの主キーカラムへマッピングされま" +#~ "す。このプロパティの名前は何でも構いませんし、型はどのようなプリミティブ型" +#~ "でも、プリミティブの「ラッパー」型でも、 java.lang.Stringjava.util.Date でも構いません。 (もしレガ" +#~ "シーデータベーステーブルが複合キーを持つならば、今述べたような型のプロパ" +#~ "ティを持つユーザー定義のクラスを使うことさえ可能です。後で複合識別子のセク" +#~ "ションを見てください。)" + +#~ 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 "" +#~ "識別子プロパティは厳密にはオプションです。これを省略して、 Hibernate に内" +#~ "部的にオブジェクトの識別子を追跡させることは可能です。しかしお勧めはしませ" +#~ "ん。" + +#~ msgid "" +#~ "In fact, some functionality is available only to classes that declare an " +#~ "identifier property:" +#~ msgstr "" +#~ "実際に、識別子プロパティを宣言するクラスだけが利用可能な機能がいくつかあり" +#~ "ます:" #, fuzzy #~ msgid "" -#~ "" +#~ "Transitive reattachment for detached objects (cascade update or cascade " +#~ "merge) - see " #~ msgstr "" -#~ "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" -#~ "}" +#~ "分離オブジェクトの連鎖的な再追加(カスケード更新やカスケードマージ) - " +#~ "次を参照してください。" #, fuzzy -#~ msgid "" -#~ "\n" -#~ "\n" -#~ " \n" -#~ "\n" -#~ " \n" -#~ " \n" -#~ " \n" -#~ "\n" -#~ " \n" -#~ "\n" -#~ " \n" -#~ "\n" -#~ " \n" -#~ "\n" -#~ " \n" -#~ " \n" -#~ " \n" -#~ " \n" -#~ "\n" -#~ " \n" -#~ " \n" -#~ "]]>" -#~ msgstr "" -#~ "<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>" +#~ msgid "Session.saveOrUpdate()" +#~ msgstr "" #, fuzzy -#~ msgid "" -#~ "" -#~ msgstr "" -#~ "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();" +#~ msgid "Session.merge()" +#~ msgstr "Session.merge()" -#, fuzzy #~ msgid "" -#~ "" +#~ "A central feature of Hibernate, proxies, depends " +#~ "upon the persistent class being either non-final, or the implementation " +#~ "of an interface that declares all public methods." #~ msgstr "" -#~ "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" +#~ "Hibernate の中心的な特徴である プロキシ は、永続クラ" +#~ "スが final でないこと、またはメソッドを全部 public で宣言しているインター" +#~ "フェースが実装されているかに依存しています。" + +#~ msgid "" +#~ "You can persist final classes that do not implement an " +#~ "interface with Hibernate. You will not, however, be able to use proxies " +#~ "for lazy association fetching which will ultimately limit your options " +#~ "for performance tuning." +#~ msgstr "" +#~ "Hibernate でインターフェースを実装していない final クラ" +#~ "スを永続化することはできますが、遅延関連フェッチに対してプロキシを使うこと" +#~ "はできなくなります。これはパフォーマンスチューニングへの選択肢を狭めること" +#~ "になります。" + +#~ msgid "" +#~ "There are two high-level types of Tuplizers, represented by the " +#~ "org.hibernate.tuple.entity.EntityTuplizer and " +#~ "org.hibernate.tuple.component.ComponentTuplizer " +#~ "interfaces. EntityTuplizers are responsible for " +#~ "managing the above mentioned contracts in regards to entities, while " +#~ "ComponentTuplizers do the same for components." +#~ msgstr "" +#~ "Tuplizer には二つのハイレベルの型があります。それらは、org." +#~ "hibernate.tuple.entity.EntityTuplizerorg.hibernate." +#~ "tuple.component.ComponentTuplizer インターフェースで表現されま" +#~ "す。 EntityTuplizer は上で述べたようなエンティティに関" +#~ "する契約の管理に責任を持ちます。一方、 ComponentTuplizer はコンポーネントに関する契約の管理に責任を持ちます。" #, fuzzy #~ msgid "" diff --git a/documentation/manual/src/main/docbook/ja-JP/content/preface.po b/documentation/manual/src/main/docbook/ja-JP/content/preface.po index 9a6d412459..e3a1545e08 100644 --- a/documentation/manual/src/main/docbook/ja-JP/content/preface.po +++ b/documentation/manual/src/main/docbook/ja-JP/content/preface.po @@ -4,7 +4,7 @@ msgid "" msgstr "" "Project-Id-Version: Collection_Mapping\n" "Report-Msgid-Bugs-To: http://bugs.kde.org\n" -"POT-Creation-Date: 2010-02-11T05:38:15\n" +"POT-Creation-Date: 2010-07-20 21:02+0000\n" "PO-Revision-Date: 2009-12-21 17:17+1000\n" "Last-Translator: Xi HUANG \n" "Language-Team: \n" @@ -14,19 +14,24 @@ msgstr "" "X-Generator: KBabel 1.11.4\n" #. Tag: title +#: preface.xml:33 #, no-c-format msgid "Preface" msgstr "前書き" #. Tag: para +#: preface.xml:35 #, fuzzy, 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." +"Working with both Object-Oriented software and Relational Databases can be " +"cumbersome and time consuming. Development costs are significantly higher " +"due to a paradigm mismatch between how data is represented in objects versus " +"relational databases. Hibernate is an Object/Relational Mapping solution for " +"Java environments. The term Object/Relational Mapping refers to the " +"technique of mapping a data representation from an object model to a " +"relational data model with a SQL-based schema; see http://en.wikipedia.org/wiki/" +"Object-relational_mapping for a discussion." msgstr "" "オブジェクト指向のソフトウェアやリレーショナルデータベースの使用は、 今日のエ" "ンタープライズ環境では非常に繁雑で時間のかかる作業となります。 Hibernate は " @@ -36,6 +41,30 @@ msgstr "" "指します。 " #. Tag: para +#: preface.xml:46 +#, no-c-format +msgid "" +"While having a strong background in SQL is not required to use Hibernate, " +"having a basic understanding of the concepts can greatly help you understand " +"Hibernate more fully and quickly. Probably the single best background is an " +"understanding of data modeling principles. You might want to consider these " +"resources as a good starting point:" +msgstr "" + +#. Tag: ulink +#: preface.xml:54 +#, no-c-format +msgid "http://www.agiledata.org/essays/dataModeling101.html" +msgstr "" + +#. Tag: ulink +#: preface.xml:59 +#, no-c-format +msgid "http://en.wikipedia.org/wiki/Data_modeling" +msgstr "" + +#. Tag: para +#: preface.xml:66 #, no-c-format msgid "" "Hibernate not only takes care of the mapping from Java classes to database " @@ -49,16 +78,28 @@ msgstr "" "する時間を大幅に削減することが可能になります。" #. Tag: para +#: preface.xml:72 #, no-c-format msgid "" -"Hibernate's 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." +"Hibernate’s design goal is to relieve the developer from 95% of common data " +"persistence-related programming tasks by eliminating the need for manual, " +"hand-crafted data processing using SQL and JDBC. However, unlike many other " +"persistence solutions, Hibernate does not hide the power of SQL from you and " +"guarantees that your investment in relational technology and knowledge is as " +"valid as always." +msgstr "" + +#. Tag: para +#: preface.xml:79 +#, fuzzy, no-c-format +msgid "" +"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 "" "Hibernate の目標は、 開発者にとってのプログラミングにおける一般的なデータ永続" "性の作業の 95 % を軽減することです。 Hibernate データベース内でビジネスロジッ" @@ -70,6 +111,7 @@ msgstr "" "る一般的な作業に役立ちます。" #. Tag: para +#: preface.xml:88 #, no-c-format msgid "" "If you are new to Hibernate and Object/Relational Mapping or even Java, " @@ -79,9 +121,10 @@ msgstr "" "な方は、 次の手順を行ってください。" #. Tag: para +#: preface.xml:95 #, fuzzy, no-c-format msgid "" -"Read for a tutorial with step-by-step " +"Read for a tutorial with step-by-step " "instructions. The source code for the tutorial is included in the " "distribution in the doc/reference/tutorial/ directory." msgstr "" @@ -91,15 +134,17 @@ msgstr "" "にあります。" #. Tag: para +#: preface.xml:103 #, fuzzy, no-c-format msgid "" -"Read to understand the environments where " +"Read to understand the environments where " "Hibernate can be used." msgstr "" "Hibernate が使用できる環境について理解するため、 をお読みください。" #. Tag: para +#: preface.xml:109 #, no-c-format msgid "" "View the eg/ directory in the Hibernate distribution. It " @@ -118,13 +163,15 @@ msgstr "" "するか、 Windows 環境の場合は build eg と入力します。" #. Tag: para +#: preface.xml:120 #, fuzzy, no-c-format msgid "" "Use this reference documentation as your primary source of information. " "Consider reading if you need " "more help with application design, or if you prefer a step-by-step tutorial. " -"Also visit and download " -"the example application from ." +"Also visit and " +"download the example application from ." msgstr "" "おもな情報源として本リファレンスドキュメントをご利用ください。 アプリケーショ" "ンのデザインに関する詳細、 ステップバイステップによる解説が必要な場合は、 " @@ -134,11 +181,13 @@ msgstr "" "す。" #. Tag: para +#: preface.xml:130 #, no-c-format msgid "FAQs are answered on the Hibernate website." msgstr "よくある質問とその答え (FAQ) は Hibernate ウェブサイトでご覧ください。" #. Tag: para +#: preface.xml:135 #, fuzzy, no-c-format msgid "" "Links to third party demos, examples, and tutorials are maintained on the " @@ -148,6 +197,7 @@ msgstr "" "ト上にリンクされています。" #. Tag: para +#: preface.xml:141 #, no-c-format msgid "" "The Community Area on the Hibernate website is a good resource for design " @@ -159,31 +209,91 @@ msgstr "" "いリソースになります。" #. Tag: para +#: preface.xml:149 #, no-c-format msgid "" -"If you have questions, use the user forum linked on the Hibernate website. " -"We also provide a JIRA issue tracking 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." +"There are a number of ways to become involved in the Hibernate community, " +"including" msgstr "" -"質問がある場合は、 Hibernate ウェブサイト上にリンクされたユーザーフォーラムを" -"ご利用ください。 また、 バグ報告及び今後のリクエストに関しては JIRA (問題追跡" -"システム) を提供しています。 Hibernate, の開発に興味がある方は、 開発者用メー" -"リングリストにご参加ください。 本ドキュメントの翻訳に興味がある方は、 開発者" -"用メーリングリストよりご連絡ください。" #. Tag: para +#: preface.xml:153 #, 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." +"Trying stuff out and reporting bugs. See http://hibernate.org/issuetracker.html details." msgstr "" -"Hibernate に関する商業用開発サポート、 実稼働サポート、 トレーニングについて" -"は JBoss Inc よりご利用頂けます (http://www.hibernate.org/SupportTraining/ を" -"参照)。 Hibernate はプロフェッショナルなオープンソースプロジェクトであり、 " -"JBoss Enterprise Middleware System (JEMS) スィート製品の重要なコンポーネント" -"になります。" + +#. Tag: para +#: preface.xml:160 +#, no-c-format +msgid "" +"Trying your hand at fixing some bugs or implementing enhancements. Again, " +"see http://hibernate." +"org/issuetracker.html details." +msgstr "" + +#. Tag: para +#: preface.xml:167 +#, no-c-format +msgid "" +"http://hibernate.org/" +"community.html list a few ways to engage in the community." +msgstr "" + +#. Tag: para +#: preface.xml:172 +#, no-c-format +msgid "" +"There are forums for users to ask questions and receive help from the " +"community." +msgstr "" + +#. Tag: para +#: preface.xml:177 +#, no-c-format +msgid "" +"There are also IRC channels for both user and developer discussions." +msgstr "" + +#. Tag: para +#: preface.xml:186 +#, no-c-format +msgid "" +"Helping improve or translate this documentation. Contact us on the developer " +"mailing list if you have interest." +msgstr "" + +#. Tag: para +#: preface.xml:192 +#, no-c-format +msgid "Evangelizing Hibernate within your organization." +msgstr "" + +#~ msgid "" +#~ "If you have questions, use the user forum linked on the Hibernate " +#~ "website. We also provide a JIRA issue tracking 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 "" +#~ "質問がある場合は、 Hibernate ウェブサイト上にリンクされたユーザーフォーラ" +#~ "ムをご利用ください。 また、 バグ報告及び今後のリクエストに関しては JIRA " +#~ "(問題追跡システム) を提供しています。 Hibernate, の開発に興味がある方は、 " +#~ "開発者用メーリングリストにご参加ください。 本ドキュメントの翻訳に興味があ" +#~ "る方は、 開発者用メーリングリストよりご連絡ください。" + +#~ 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 "" +#~ "Hibernate に関する商業用開発サポート、 実稼働サポート、 トレーニングについ" +#~ "ては JBoss Inc よりご利用頂けます (http://www.hibernate.org/" +#~ "SupportTraining/ を参照)。 Hibernate はプロフェッショナルなオープンソース" +#~ "プロジェクトであり、 JBoss Enterprise Middleware System (JEMS) スィート製" +#~ "品の重要なコンポーネントになります。" diff --git a/documentation/manual/src/main/docbook/ja-JP/content/query_sql.po b/documentation/manual/src/main/docbook/ja-JP/content/query_sql.po index 0ab498df8d..571da9d107 100644 --- a/documentation/manual/src/main/docbook/ja-JP/content/query_sql.po +++ b/documentation/manual/src/main/docbook/ja-JP/content/query_sql.po @@ -4,7 +4,7 @@ msgid "" msgstr "" "Project-Id-Version: Collection_Mapping\n" "Report-Msgid-Bugs-To: http://bugs.kde.org\n" -"POT-Creation-Date: 2010-03-12T00:03:47\n" +"POT-Creation-Date: 2010-07-20 21:02+0000\n" "PO-Revision-Date: 2010-01-18 15:09+1000\n" "Last-Translator: Xi HUANG \n" "Language-Team: \n" @@ -14,11 +14,13 @@ msgstr "" "X-Generator: KBabel 1.11.4\n" #. Tag: title +#: query_sql.xml:31 #, no-c-format msgid "Native SQL" msgstr "ネイティブ SQL" #. Tag: para +#: query_sql.xml:33 #, no-c-format msgid "" "You can also express queries in the native SQL dialect of your database. " @@ -33,6 +35,7 @@ msgstr "" "リケーションから Hibernate への移行も容易にしています。" #. Tag: para +#: query_sql.xml:39 #, no-c-format msgid "" "Hibernate3 allows you to specify handwritten SQL, including stored " @@ -42,11 +45,13 @@ msgstr "" "ドプロシージャを含む)を手書きできます。" #. Tag: title +#: query_sql.xml:43 #, fuzzy, no-c-format msgid "Using a SQLQuery" msgstr "もしくは List として、" #. Tag: para +#: query_sql.xml:45 #, no-c-format msgid "" "Execution of native SQL queries is controlled via the SQLQueryResultSetMetadata, or " @@ -91,22 +110,40 @@ msgstr "" "しくは単に何が返されるか明確にするため、 addScalar() を使" "えます。" +#. Tag: programlisting +#: query_sql.xml:67 +#, fuzzy, no-c-format +msgid "" +"sess.createSQLQuery(\"SELECT * FROM CATS\")\n" +" .addScalar(\"ID\", Hibernate.LONG)\n" +" .addScalar(\"NAME\", Hibernate.STRING)\n" +" .addScalar(\"BIRTHDATE\", Hibernate.DATE)" +msgstr "" +"sess.createSQLQuery(\"SELECT * FROM CATS\")\n" +" .addScalar(\"ID\", Hibernate.LONG)\n" +" .addScalar(\"NAME\", Hibernate.STRING)\n" +" .addScalar(\"BIRTHDATE\", Hibernate.DATE)" + #. Tag: para +#: query_sql.xml:69 query_sql.xml:116 query_sql.xml:197 query_sql.xml:349 #, no-c-format msgid "This query specified:" msgstr "このクエリで指定されているものを下記に示します:" #. Tag: para +#: query_sql.xml:73 query_sql.xml:120 query_sql.xml:353 #, no-c-format msgid "the SQL query string" msgstr "SQL クエリ文字列" #. Tag: para +#: query_sql.xml:77 #, no-c-format msgid "the columns and types to return" msgstr "返されるカラムと型" #. Tag: para +#: query_sql.xml:81 #, no-c-format msgid "" "This will return Object arrays, but now it will not use " @@ -123,13 +160,29 @@ msgstr "" "literal> を使用し、列挙した3つより多くのカラムを返せるとしてもです。" #. Tag: para +#: query_sql.xml:89 #, no-c-format msgid "" "It is possible to leave out the type information for all or some of the " "scalars." msgstr "スカラーの型情報を省くこともできます。" +#. Tag: programlisting +#: query_sql.xml:92 +#, fuzzy, no-c-format +msgid "" +"sess.createSQLQuery(\"SELECT * FROM CATS\")\n" +" .addScalar(\"ID\", Hibernate.LONG)\n" +" .addScalar(\"NAME\")\n" +" .addScalar(\"BIRTHDATE\")" +msgstr "" +"sess.createSQLQuery(\"SELECT * FROM CATS\")\n" +" .addScalar(\"ID\", Hibernate.LONG)\n" +" .addScalar(\"NAME\")\n" +" .addScalar(\"BIRTHDATE\")" + #. Tag: para +#: query_sql.xml:94 #, no-c-format msgid "" "This is essentially the same query as before, but now " @@ -141,6 +194,7 @@ msgstr "" "定されています。" #. Tag: para +#: query_sql.xml:99 #, no-c-format msgid "" "How the java.sql.Types returned from ResultSetMetaData is mapped to " @@ -154,11 +208,13 @@ msgstr "" "registerHibernateType を呼び出し、カスタマイズできます。" #. Tag: title +#: query_sql.xml:107 #, no-c-format msgid "Entity queries" msgstr "エンティティのクエリ" #. Tag: para +#: query_sql.xml:109 #, no-c-format msgid "" "The above queries were all about returning scalar values, basically " @@ -171,12 +227,26 @@ msgstr "" "より、ネイティブ SQL クエリからエンティティオブジェクトを取得する方法を示しま" "す。" +#. Tag: programlisting +#: query_sql.xml:114 +#, fuzzy, no-c-format +msgid "" +"sess.createSQLQuery(\"SELECT * FROM CATS\").addEntity(Cat.class);\n" +"sess.createSQLQuery(\"SELECT ID, NAME, BIRTHDATE FROM CATS\").addEntity(Cat." +"class);" +msgstr "" +"sess.createSQLQuery(\"SELECT * FROM CATS\").addEntity(Cat.class);\n" +"sess.createSQLQuery(\"SELECT ID, NAME, BIRTHDATE FROM CATS\").addEntity(Cat." +"class);" + #. Tag: para +#: query_sql.xml:124 #, no-c-format msgid "the entity returned by the query" msgstr "クエリが返すエンティティと SQL テーブルの別名" #. Tag: para +#: query_sql.xml:128 #, no-c-format msgid "" "Assuming that Cat is mapped as a class with the columns ID, NAME and " @@ -187,6 +257,7 @@ msgstr "" "上記のクエリはどちらも、要素が Cat エンティティであるリストを返します。" #. Tag: para +#: query_sql.xml:132 #, no-c-format msgid "" "If the entity is mapped with a many-to-one to another " @@ -203,17 +274,30 @@ msgstr "" "されますが、次の例のように、 Dog多対一 であることを明示することを私たちは好みます。" +#. Tag: programlisting +#: query_sql.xml:140 +#, fuzzy, no-c-format +msgid "" +"sess.createSQLQuery(\"SELECT ID, NAME, BIRTHDATE, DOG_ID FROM CATS\")." +"addEntity(Cat.class);" +msgstr "" +"sess.createSQLQuery(\"SELECT ID, NAME, BIRTHDATE, DOG_ID FROM CATS\")." +"addEntity(Cat.class);" + #. Tag: para +#: query_sql.xml:142 #, no-c-format msgid "This will allow cat.getDog() to function properly." msgstr "これにより cat.getDog() が正しく機能します。" #. Tag: title +#: query_sql.xml:146 #, no-c-format msgid "Handling associations and collections" msgstr "関連とコレクションの操作" #. Tag: para +#: query_sql.xml:148 #, no-c-format msgid "" "It is possible to eagerly join in the Dog to avoid the " @@ -225,7 +309,23 @@ msgstr "" "中で即時結合できます。これは addJoin() メソッドにより行い" "ます。関連もしくはコレクションに結合できます。" +#. Tag: programlisting +#: query_sql.xml:153 +#, fuzzy, no-c-format +msgid "" +"sess.createSQLQuery(\"SELECT c.ID, NAME, BIRTHDATE, DOG_ID, D_ID, D_NAME " +"FROM CATS c, DOGS d WHERE c.DOG_ID = d.D_ID\")\n" +" .addEntity(\"cat\", Cat.class)\n" +" .addJoin(\"cat.dog\");" +msgstr "" +"sess.createSQLQuery(\"SELECT c.ID, NAME, BIRTHDATE, DOG_ID, D_ID, D_NAME " +"FROM CATS c, DOGS d \n" +" WHERE c.DOG_ID = d.D_ID\")\n" +" .addEntity(\"cat\", Cat.class)\n" +" .addJoin(\"cat.dog\");" + #. Tag: para +#: query_sql.xml:155 #, no-c-format msgid "" "In this example, the returned Cat's will have their " @@ -242,7 +342,23 @@ msgstr "" "Cat が一対多で Dog を持っていた場合、次" "のようになります。" +#. Tag: programlisting +#: query_sql.xml:163 +#, fuzzy, no-c-format +msgid "" +"sess.createSQLQuery(\"SELECT ID, NAME, BIRTHDATE, D_ID, D_NAME, CAT_ID FROM " +"CATS c, DOGS d WHERE c.ID = d.CAT_ID\")\n" +" .addEntity(\"cat\", Cat.class)\n" +" .addJoin(\"cat.dogs\");" +msgstr "" +"sess.createSQLQuery(\"SELECT ID, NAME, BIRTHDATE, D_ID, D_NAME, CAT_ID FROM " +"CATS c, DOGS d\n" +" WHERE c.ID = d.CAT_ID\")\n" +" .addEntity(\"cat\", Cat.class)\n" +" .addJoin(\"cat.dogs\");" + #. Tag: para +#: query_sql.xml:165 #, no-c-format msgid "" "At this stage you are reaching the limits of what is possible with native " @@ -255,11 +371,13 @@ msgstr "" "す際や、デフォルトの別名や列名で十分ではない場合に、問題は起こり始めます。" #. Tag: title +#: query_sql.xml:173 #, no-c-format msgid "Returning multiple entities" msgstr "複数エンティティの取得" #. Tag: para +#: query_sql.xml:175 #, no-c-format msgid "" "Until now, the result set column names are assumed to be the same as the " @@ -272,6 +390,7 @@ msgstr "" "があるため、複数テーブルを結合する SQL クエリで問題となる場合があります。" #. Tag: para +#: query_sql.xml:180 #, no-c-format msgid "" "Column alias injection is needed in the following query (which most likely " @@ -280,7 +399,22 @@ msgstr "" "下記のような(失敗しそうな)クエリでは、カラム別名インジェクション(column " "alias injection)が必要です:" +#. Tag: programlisting +#: query_sql.xml:183 +#, fuzzy, no-c-format +msgid "" +"sess.createSQLQuery(\"SELECT c.*, m.* FROM CATS c, CATS m WHERE c.MOTHER_ID " +"= c.ID\")\n" +" .addEntity(\"cat\", Cat.class)\n" +" .addEntity(\"mother\", Cat.class)" +msgstr "" +"sess.createSQLQuery(\"SELECT c.*, m.* FROM CATS c, CATS m WHERE c.MOTHER_ID " +"= c.ID\")\n" +" .addEntity(\"cat\", Cat.class)\n" +" .addEntity(\"mother\", Cat.class)" + #. Tag: para +#: query_sql.xml:185 #, no-c-format msgid "" "The query was intended to return two Cat instances per row: a cat and its " @@ -297,11 +431,27 @@ msgstr "" "\"NAME\")と等しくないため、失敗します。" #. Tag: para +#: query_sql.xml:192 #, no-c-format msgid "The following form is not vulnerable to column name duplication:" msgstr "下記の形式は、カラム名が重複しても大丈夫です:" +#. Tag: programlisting +#: query_sql.xml:195 +#, fuzzy, no-c-format +msgid "" +"sess.createSQLQuery(\"SELECT {cat.*}, {mother.*} FROM CATS c, CATS m WHERE " +"c.MOTHER_ID = c.ID\")\n" +" .addEntity(\"cat\", Cat.class)\n" +" .addEntity(\"mother\", Cat.class)" +msgstr "" +"sess.createSQLQuery(\"SELECT {cat.*}, {mother.*} FROM CATS c, CATS m WHERE " +"c.MOTHER_ID = c.ID\")\n" +" .addEntity(\"cat\", Cat.class)\n" +" .addEntity(\"mother\", Cat.class)" + #. Tag: para +#: query_sql.xml:201 #, no-c-format msgid "" "the SQL query string, with placeholders for Hibernate to inject column " @@ -311,11 +461,13 @@ msgstr "" "む)" #. Tag: para +#: query_sql.xml:206 #, no-c-format msgid "the entities returned by the query" msgstr "クエリによって返されるエンティティ" #. Tag: para +#: query_sql.xml:210 #, no-c-format msgid "" "The {cat.*} and {mother.*} notation used above is a shorthand for \"all " @@ -334,12 +486,36 @@ msgstr "" "データで定義された Cat とその母親を復元します。もし好むなら、 where 節の中で" "も、プロパティの別名を使えます。" +#. Tag: programlisting +#: query_sql.xml:219 +#, fuzzy, no-c-format +msgid "" +"String sql = \"SELECT ID as {c.id}, NAME as {c.name}, \" +\n" +" \"BIRTHDATE as {c.birthDate}, MOTHER_ID as {c.mother}, {mother.*} " +"\" +\n" +" \"FROM CAT_LOG c, CAT_LOG m WHERE {c.mother} = c.ID\";\n" +"\n" +"List loggedCats = sess.createSQLQuery(sql)\n" +" .addEntity(\"cat\", Cat.class)\n" +" .addEntity(\"mother\", Cat.class).list()" +msgstr "" +"String sql = \"SELECT ID as {c.id}, NAME as {c.name}, \" + \n" +" \"BIRTHDATE as {c.birthDate}, MOTHER_ID as {c.mother}, {mother.*} " +"\" +\n" +" \"FROM CAT_LOG c, CAT_LOG m WHERE {c.mother} = c.ID\";\n" +"\n" +"List loggedCats = sess.createSQLQuery(sql)\n" +" .addEntity(\"cat\", Cat.class)\n" +" .addEntity(\"mother\", Cat.class).list()" + #. Tag: title +#: query_sql.xml:222 #, no-c-format msgid "Alias and property references" msgstr "別名とプロパティのリファレンス" #. Tag: para +#: query_sql.xml:224 #, no-c-format msgid "" "In most cases the above alias injection is needed. For queries relating to " @@ -353,6 +529,7 @@ msgstr "" "を挿入できます。" #. Tag: para +#: query_sql.xml:229 #, no-c-format msgid "" "The following table shows the different ways you can use the alias " @@ -365,180 +542,213 @@ msgstr "" "ます。" #. Tag: title +#: query_sql.xml:235 #, no-c-format msgid "Alias injection names" msgstr "別名に挿入する名前" #. Tag: entry +#: query_sql.xml:246 #, no-c-format msgid "Description" msgstr "説明" #. Tag: entry +#: query_sql.xml:248 #, no-c-format msgid "Syntax" msgstr "構文" #. Tag: entry +#: query_sql.xml:250 #, no-c-format msgid "Example" msgstr "例" #. Tag: entry +#: query_sql.xml:256 #, no-c-format msgid "A simple property" msgstr "単純なプロパティ" -#. Tag: entry +#. Tag: literal +#: query_sql.xml:258 #, fuzzy, no-c-format -msgid "{[aliasname].[propertyname]" +msgid "{[aliasname].[propertyname]" msgstr "{[aliasname].[propertyname]" -#. Tag: entry +#. Tag: literal +#: query_sql.xml:260 #, fuzzy, no-c-format -msgid "A_NAME as {item.name}" -msgstr "{item.*}" +msgid "A_NAME as {item.name}" +msgstr "A_NAME as {item.name}" #. Tag: entry +#: query_sql.xml:264 #, no-c-format msgid "A composite property" msgstr "複合プロパティ" -#. Tag: entry +#. Tag: literal +#: query_sql.xml:266 #, fuzzy, no-c-format -msgid "{[aliasname].[componentname].[propertyname]}" +msgid "{[aliasname].[componentname].[propertyname]}" msgstr "{[aliasname].[componentname].[propertyname]}" -#. Tag: entry +#. Tag: literal +#: query_sql.xml:268 #, fuzzy, no-c-format -msgid "" -"CURRENCY as {item.amount.currency}, VALUE as {item.amount.value}" +msgid "CURRENCY as {item.amount.currency}, VALUE as {item.amount.value}" msgstr "" "CURRENCY as {item.amount.currency}, VALUE as {item.amount.value}" #. Tag: entry +#: query_sql.xml:273 #, no-c-format msgid "Discriminator of an entity" msgstr "エンティティのクラスを識別する値" -#. Tag: entry +#. Tag: literal +#: query_sql.xml:275 #, fuzzy, no-c-format -msgid "{[aliasname].class}" -msgstr "{item.*}" - -#. Tag: entry -#, fuzzy, no-c-format -msgid "DISC as {item.class}" -msgstr "{item.*}" +msgid "{[aliasname].class}" +msgstr "{[aliasname].class}" + +#. Tag: literal +#: query_sql.xml:277 +#, fuzzy, no-c-format +msgid "DISC as {item.class}" +msgstr "DISC as {item.class}" #. Tag: entry +#: query_sql.xml:281 #, no-c-format msgid "All properties of an entity" msgstr "エンティティの全プロパティ" -#. Tag: entry +#. Tag: literal +#: query_sql.xml:283 query_sql.xml:331 #, fuzzy, no-c-format -msgid "{[aliasname].*}" -msgstr "{item.*}" +msgid "{[aliasname].*}" +msgstr "{[aliasname].*}" -#. Tag: entry +#. Tag: literal +#: query_sql.xml:285 #, no-c-format -msgid "{item.*}" -msgstr "{item.*}" +msgid "{item.*}" +msgstr "{item.*}" #. Tag: entry +#: query_sql.xml:289 #, no-c-format msgid "A collection key" msgstr "コレクションのキー" -#. Tag: entry +#. Tag: literal +#: query_sql.xml:291 #, fuzzy, no-c-format -msgid "{[aliasname].key}" -msgstr "{item.*}" - -#. Tag: entry -#, fuzzy, no-c-format -msgid "ORGID as {coll.key}" -msgstr "{coll.*}" +msgid "{[aliasname].key}" +msgstr "{[aliasname].key}" + +#. Tag: literal +#: query_sql.xml:293 +#, fuzzy, no-c-format +msgid "ORGID as {coll.key}" +msgstr "ORGID as {coll.key}" #. Tag: entry +#: query_sql.xml:297 #, no-c-format msgid "The id of an collection" msgstr "コレクションの ID" -#. Tag: entry +#. Tag: literal +#: query_sql.xml:299 #, fuzzy, no-c-format -msgid "{[aliasname].id}" -msgstr "{item.*}" - -#. Tag: entry -#, fuzzy, no-c-format -msgid "EMPID as {coll.id}" -msgstr "{coll.*}" +msgid "{[aliasname].id}" +msgstr "{[aliasname].id}" + +#. Tag: literal +#: query_sql.xml:301 +#, fuzzy, no-c-format +msgid "EMPID as {coll.id}" +msgstr "EMPID as {coll.id}" #. Tag: entry +#: query_sql.xml:305 #, no-c-format msgid "The element of an collection" msgstr "コレクションの要素" -#. Tag: entry +#. Tag: literal +#: query_sql.xml:307 #, fuzzy, no-c-format -msgid "{[aliasname].element}" -msgstr "{coll.element.*}" - -#. Tag: entry -#, fuzzy, no-c-format -msgid "XID as {coll.element}" -msgstr "{coll.element.*}" +msgid "{[aliasname].element}" +msgstr "{[aliasname].element}" + +#. Tag: literal +#: query_sql.xml:309 +#, fuzzy, no-c-format +msgid "XID as {coll.element}" +msgstr "XID as {coll.element}" #. Tag: entry +#: query_sql.xml:313 #, no-c-format msgid "property of the element in the collection" msgstr "コレクションの要素のプロパティ" -#. Tag: entry +#. Tag: literal +#: query_sql.xml:315 #, fuzzy, no-c-format -msgid "{[aliasname].element.[propertyname]}" +msgid "{[aliasname].element.[propertyname]}" msgstr "{[aliasname].element.[propertyname]}" -#. Tag: entry +#. Tag: literal +#: query_sql.xml:317 #, fuzzy, no-c-format -msgid "NAME as {coll.element.name}" -msgstr "{coll.element.*}" +msgid "NAME as {coll.element.name}" +msgstr "NAME as {coll.element.name}" #. Tag: entry +#: query_sql.xml:321 #, no-c-format msgid "All properties of the element in the collection" msgstr "コレクションの要素の全プロパティ" -#. Tag: entry +#. Tag: literal +#: query_sql.xml:323 #, fuzzy, no-c-format -msgid "{[aliasname].element.*}" -msgstr "{coll.element.*}" - -#. Tag: entry -#, no-c-format -msgid "{coll.element.*}" -msgstr "{coll.element.*}" +msgid "{[aliasname].element.*}" +msgstr "{[aliasname].element.*}" + +#. Tag: literal +#: query_sql.xml:325 +#, fuzzy, no-c-format +msgid "{coll.element.*}" +msgstr "{coll.*}" #. Tag: entry +#: query_sql.xml:329 #, fuzzy, no-c-format msgid "All properties of the collection" msgstr "コレクションの全プロパティ" -#. Tag: entry +#. Tag: literal +#: query_sql.xml:333 #, no-c-format -msgid "{coll.*}" -msgstr "{coll.*}" +msgid "{coll.*}" +msgstr "{coll.*}" #. Tag: title +#: query_sql.xml:342 #, no-c-format msgid "Returning non-managed entities" msgstr "管理されていないエンティティの取得" #. Tag: para +#: query_sql.xml:344 #, no-c-format msgid "" "It is possible to apply a ResultTransformer to native SQL queries, allowing " @@ -547,12 +757,24 @@ msgstr "" "ネイティブ SQL クエリに ResultTransformer を適用できます。下記のように、例え" "ば、管理されていないエンティティを返します。" +#. Tag: programlisting +#: query_sql.xml:347 +#, fuzzy, no-c-format +msgid "" +"sess.createSQLQuery(\"SELECT NAME, BIRTHDATE FROM CATS\")\n" +" .setResultTransformer(Transformers.aliasToBean(CatDTO.class))" +msgstr "" +"sess.createSQLQuery(\"SELECT NAME, BIRTHDATE FROM CATS\")\n" +" .setResultTransformer(Transformers.aliasToBean(CatDTO.class))" + #. Tag: para +#: query_sql.xml:357 #, no-c-format msgid "a result transformer" msgstr "結果を変換したもの" #. Tag: para +#: query_sql.xml:361 #, no-c-format msgid "" "The above query will return a list of CatDTO which has " @@ -563,11 +785,13 @@ msgstr "" "もしくはフィールドに挿入した CatDTO のリストを返します。" #. Tag: title +#: query_sql.xml:367 #, no-c-format msgid "Handling inheritance" msgstr "継承の制御" #. Tag: para +#: query_sql.xml:369 #, no-c-format msgid "" "Native SQL queries which query for entities that are mapped as part of an " @@ -579,34 +803,108 @@ msgstr "" "なりません。" #. Tag: title +#: query_sql.xml:375 #, no-c-format msgid "Parameters" msgstr "パラメータ" #. Tag: para +#: query_sql.xml:377 #, no-c-format msgid "Native SQL queries support positional as well as named parameters:" msgstr "" "ネイティブ SQL クエリは、以下のように、名前付きパラメータ(:name)と同様に位" "置パラメータをサポートします:" +#. Tag: programlisting +#: query_sql.xml:380 +#, fuzzy, no-c-format +msgid "" +"Query query = sess.createSQLQuery(\"SELECT * FROM CATS WHERE NAME like ?\")." +"addEntity(Cat.class);\n" +"List pusList = query.setString(0, \"Pus%\").list();\n" +" \n" +"query = sess.createSQLQuery(\"SELECT * FROM CATS WHERE NAME like :name\")." +"addEntity(Cat.class);\n" +"List pusList = query.setString(\"name\", \"Pus%\").list();" +msgstr "" +"Query query = sess.createSQLQuery(\"SELECT * FROM CATS WHERE NAME like ?\")." +"addEntity(Cat.class);\n" +"List pusList = query.setString(0, \"Pus%\").list();\n" +" \n" +"query = sess.createSQLQuery(\"SELECT * FROM CATS WHERE NAME like :name\")." +"addEntity(Cat.class);\n" +"List pusList = query.setString(\"name\", \"Pus%\").list();" + #. Tag: title +#: query_sql.xml:385 #, no-c-format msgid "Named SQL queries" msgstr "名前付き SQL クエリ" #. Tag: para -#, no-c-format +#: query_sql.xml:387 +#, fuzzy, no-c-format msgid "" -"Named SQL queries can be defined in the mapping document and called in " -"exactly the same way as a named HQL query. In this case, you do " -"not need to call addEntity()." +"Named SQL queries can also be defined in the mapping document and called in " +"exactly the same way as a named HQL query (see ). In this case, you do not " +"need to call addEntity()." msgstr "" "名前付き SQL クエリはマッピングドキュメントで定義することができ、名前付き " "HQL クエリと全く同じ方法で呼ぶことができます。この場合、 addEntity()" " を呼び出す必要は ありません 。" +#. Tag: title +#: query_sql.xml:394 +#, no-c-format +msgid "Named sql query using the <sql-query> maping element" +msgstr "" + +#. Tag: programlisting +#: query_sql.xml:397 +#, fuzzy, no-c-format +msgid "" +"<sql-query name=\"persons\">\n" +" <return alias=\"person\" class=\"eg.Person\"/>\n" +" SELECT person.NAME AS {person.name},\n" +" person.AGE AS {person.age},\n" +" person.SEX AS {person.sex}\n" +" FROM PERSON person\n" +" WHERE person.NAME LIKE :namePattern\n" +"</sql-query>" +msgstr "" +"<sql-query name=\"persons\">\n" +" <return alias=\"person\" class=\"eg.Person\"/>\n" +" SELECT person.NAME AS {person.name},\n" +" person.AGE AS {person.age},\n" +" person.SEX AS {person.sex}\n" +" FROM PERSON person\n" +" WHERE person.NAME LIKE :namePattern\n" +"</sql-query>" + +#. Tag: title +#: query_sql.xml:401 +#, no-c-format +msgid "Execution of a named query" +msgstr "" + +#. Tag: programlisting +#: query_sql.xml:403 +#, fuzzy, no-c-format +msgid "" +"List people = sess.getNamedQuery(\"persons\")\n" +" .setString(\"namePattern\", namePattern)\n" +" .setMaxResults(50)\n" +" .list();" +msgstr "" +"List people = sess.getNamedQuery(\"persons\")\n" +" .setString(\"namePattern\", namePattern)\n" +" .setMaxResults(50)\n" +" .list();" + #. Tag: para +#: query_sql.xml:406 #, fuzzy, no-c-format msgid "" "The <return-join> element is use to join " @@ -617,7 +915,52 @@ msgstr "" "<return-join><load-collection> 要素を使います。" +#. Tag: title +#: query_sql.xml:411 +#, no-c-format +msgid "Named sql query with association" +msgstr "" + +#. Tag: programlisting +#: query_sql.xml:413 +#, fuzzy, no-c-format +msgid "" +"<sql-query name=\"personsWith\">\n" +" <return alias=\"person\" class=\"eg.Person\"/>\n" +" <return-join alias=\"address\" property=\"person.mailingAddress\"/" +">\n" +" SELECT person.NAME AS {person.name},\n" +" person.AGE AS {person.age},\n" +" person.SEX AS {person.sex},\n" +" address.STREET AS {address.street},\n" +" address.CITY AS {address.city},\n" +" address.STATE AS {address.state},\n" +" address.ZIP AS {address.zip}\n" +" FROM PERSON person\n" +" JOIN ADDRESS address\n" +" ON person.ID = address.PERSON_ID AND address.TYPE='MAILING'\n" +" WHERE person.NAME LIKE :namePattern\n" +"</sql-query>" +msgstr "" +"<sql-query name=\"personsWith\">\n" +" <return alias=\"person\" class=\"eg.Person\"/>\n" +" <return-join alias=\"address\" property=\"person.mailingAddress\"/" +">\n" +" SELECT person.NAME AS {person.name},\n" +" person.AGE AS {person.age},\n" +" person.SEX AS {person.sex},\n" +" adddress.STREET AS {address.street},\n" +" adddress.CITY AS {address.city},\n" +" adddress.STATE AS {address.state},\n" +" adddress.ZIP AS {address.zip}\n" +" FROM PERSON person\n" +" JOIN ADDRESS adddress\n" +" ON person.ID = address.PERSON_ID AND address.TYPE='MAILING'\n" +" WHERE person.NAME LIKE :namePattern\n" +"</sql-query>" + #. Tag: para +#: query_sql.xml:416 #, no-c-format msgid "" "A named SQL query may return a scalar value. You must declare the column " @@ -628,7 +971,34 @@ msgstr "" "scalar> 要素を使って、列の別名と Hibernate の型を宣言しなければ" "なりません:" +#. Tag: title +#: query_sql.xml:421 +#, no-c-format +msgid "Named query returning a scalar" +msgstr "" + +#. Tag: programlisting +#: query_sql.xml:423 +#, fuzzy, no-c-format +msgid "" +"<sql-query name=\"mySqlQuery\">\n" +" <return-scalar column=\"name\" type=\"string\"/>\n" +" <return-scalar column=\"age\" type=\"long\"/>\n" +" SELECT p.NAME AS name, \n" +" p.AGE AS age,\n" +" FROM PERSON p WHERE p.NAME LIKE 'Hiber%'\n" +"</sql-query>" +msgstr "" +"<sql-query name=\"mySqlQuery\">\n" +" <return-scalar column=\"name\" type=\"string\"/>\n" +" <return-scalar column=\"age\" type=\"long\"/>\n" +" SELECT p.NAME AS name,\n" +" p.AGE AS age,\n" +" FROM PERSON p WHERE p.NAME LIKE 'Hiber%'\n" +"</sql-query>" + #. Tag: para +#: query_sql.xml:426 #, no-c-format msgid "" "You can externalize the resultset mapping information in a <" @@ -640,7 +1010,58 @@ msgstr "" "化することができます。複数の名前付きクエリで再利用したり、 " "setResultSetMapping() API を通して再利用したりできます。" +#. Tag: title +#: query_sql.xml:432 +#, no-c-format +msgid "<resultset> mapping used to externalize mapping information" +msgstr "" + +#. Tag: programlisting +#: query_sql.xml:435 +#, fuzzy, no-c-format +msgid "" +"<resultset name=\"personAddress\">\n" +" <return alias=\"person\" class=\"eg.Person\"/>\n" +" <return-join alias=\"address\" property=\"person.mailingAddress\"/" +">\n" +"</resultset>\n" +"\n" +"<sql-query name=\"personsWith\" resultset-ref=\"personAddress\">\n" +" SELECT person.NAME AS {person.name},\n" +" person.AGE AS {person.age},\n" +" person.SEX AS {person.sex},\n" +" address.STREET AS {address.street},\n" +" address.CITY AS {address.city},\n" +" address.STATE AS {address.state},\n" +" address.ZIP AS {address.zip}\n" +" FROM PERSON person\n" +" JOIN ADDRESS address\n" +" ON person.ID = address.PERSON_ID AND address.TYPE='MAILING'\n" +" WHERE person.NAME LIKE :namePattern\n" +"</sql-query>" +msgstr "" +"<resultset name=\"personAddress\">\n" +" <return alias=\"person\" class=\"eg.Person\"/>\n" +" <return-join alias=\"address\" property=\"person.mailingAddress\"/" +">\n" +"</resultset>\n" +"\n" +"<sql-query name=\"personsWith\" resultset-ref=\"personAddress\">\n" +" SELECT person.NAME AS {person.name},\n" +" person.AGE AS {person.age},\n" +" person.SEX AS {person.sex},\n" +" adddress.STREET AS {address.street},\n" +" adddress.CITY AS {address.city},\n" +" adddress.STATE AS {address.state},\n" +" adddress.ZIP AS {address.zip}\n" +" FROM PERSON person\n" +" JOIN ADDRESS adddress\n" +" ON person.ID = address.PERSON_ID AND address.TYPE='MAILING'\n" +" WHERE person.NAME LIKE :namePattern\n" +"</sql-query>" + #. Tag: para +#: query_sql.xml:438 #, no-c-format msgid "" "You can, alternatively, use the resultset mapping information in your hbm " @@ -650,11 +1071,344 @@ msgstr "" "中で使用できます。" #. Tag: title +#: query_sql.xml:442 +#, no-c-format +msgid "Programmatically specifying the result mapping information" +msgstr "" + +#. Tag: programlisting +#: query_sql.xml:445 +#, fuzzy, no-c-format +msgid "" +"List cats = sess.createSQLQuery(\n" +" \"select {cat.*}, {kitten.*} from cats cat, cats kitten where kitten." +"mother = cat.id\"\n" +" )\n" +" .setResultSetMapping(\"catAndKitten\")\n" +" .list();" +msgstr "" +"List cats = sess.createSQLQuery(\n" +" \"select {cat.*}, {kitten.*} from cats cat, cats kitten where kitten." +"mother = cat.id\"\n" +" )\n" +" .setResultSetMapping(\"catAndKitten\")\n" +" .list();" + +#. Tag: para +#: query_sql.xml:448 +#, no-c-format +msgid "" +"So far we have only looked at externalizing SQL queries using Hibernate " +"mapping files. The same concept is also available with anntations and is " +"called named native queries. You can use @NamedNativeQuery (@NamedNativeQueries) in conjunction with " +"@SqlResultSetMapping (@SqlResultSetMappings). Like @NamedQuery, " +"@NamedNativeQuery and @SqlResultSetMapping can be defined at class level, but their scope is global to the " +"application. Lets look at a view examples." +msgstr "" + +#. Tag: para +#: query_sql.xml:460 +#, no-c-format +msgid "" +"shows how a resultSetMapping parameter is defined in " +"@NamedNativeQuery. It represents the name of a defined " +"@SqlResultSetMapping. The resultset mapping declares the " +"entities retrieved by this native query. Each field of the entity is bound " +"to an SQL alias (or column name). All fields of the entity including the " +"ones of subclasses and the foreign key columns of related entities have to " +"be present in the SQL query. Field definitions are optional provided that " +"they map to the same column name as the one declared on the class property. " +"In the example 2 entities, Night and Area, are returned and each property is declared and associated to a " +"column name, actually the column name retrieved by the query." +msgstr "" + +#. Tag: para +#: query_sql.xml:475 +#, no-c-format +msgid "" +"In the result set " +"mapping is implicit. We only describe the entity class of the result set " +"mapping. The property / column mappings is done using the entity mapping " +"values. In this case the model property is bound to the model_txt column." +msgstr "" + +#. Tag: para +#: query_sql.xml:481 +#, no-c-format +msgid "" +"Finally, if the association to a related entity involve a composite primary " +"key, a @FieldResult element should be used for each " +"foreign key column. The @FieldResult name is composed of " +"the property name for the relationship, followed by a dot (\".\"), followed " +"by the name or the field or property of the primary key. This can be seen in " +"." +msgstr "" + +#. Tag: title +#: query_sql.xml:490 +#, no-c-format +msgid "" +"Named SQL query using @NamedNativeQuery together with " +"@SqlResultSetMapping" +msgstr "" + +#. Tag: programlisting +#: query_sql.xml:493 +#, no-c-format +msgid "" +"@NamedNativeQuery(name=\"night&area\", query=\"select night.id nid, " +"night.night_duration, \"\n" +" + \" night.night_date, area.id aid, night.area_id, area.name \"\n" +" + \"from Night night, Area area where night.area_id = area.id\", \n" +" resultSetMapping=\"joinMapping\")\n" +"@SqlResultSetMapping(name=\"joinMapping\", entities={\n" +" @EntityResult(entityClass=Night.class, fields = {\n" +" @FieldResult(name=\"id\", column=\"nid\"),\n" +" @FieldResult(name=\"duration\", column=\"night_duration\"),\n" +" @FieldResult(name=\"date\", column=\"night_date\"),\n" +" @FieldResult(name=\"area\", column=\"area_id\"),\n" +" discriminatorColumn=\"disc\"\n" +" }),\n" +" @EntityResult(entityClass=org.hibernate.test.annotations.query.Area." +"class, fields = {\n" +" @FieldResult(name=\"id\", column=\"aid\"),\n" +" @FieldResult(name=\"name\", column=\"name\")\n" +" })\n" +" }\n" +")" +msgstr "" + +#. Tag: title +#: query_sql.xml:497 +#, no-c-format +msgid "Implicit result set mapping" +msgstr "" + +#. Tag: programlisting +#: query_sql.xml:499 +#, no-c-format +msgid "" +"@Entity\n" +"@SqlResultSetMapping(name=\"implicit\",\n" +" entities=@EntityResult(entityClass=SpaceShip.class))\n" +"@NamedNativeQuery(name=\"implicitSample\", \n" +" query=\"select * from SpaceShip\", \n" +" resultSetMapping=\"implicit\")\n" +"public class SpaceShip {\n" +" private String name;\n" +" private String model;\n" +" private double speed;\n" +"\n" +" @Id\n" +" public String getName() {\n" +" return name;\n" +" }\n" +"\n" +" public void setName(String name) {\n" +" this.name = name;\n" +" }\n" +"\n" +" @Column(name=\"model_txt\")\n" +" public String getModel() {\n" +" return model;\n" +" }\n" +"\n" +" public void setModel(String model) {\n" +" this.model = model;\n" +" }\n" +"\n" +" public double getSpeed() {\n" +" return speed;\n" +" }\n" +"\n" +" public void setSpeed(double speed) {\n" +" this.speed = speed;\n" +" }\n" +"}" +msgstr "" + +#. Tag: title +#: query_sql.xml:503 +#, no-c-format +msgid "Using dot notation in @FieldResult for specifying associations" +msgstr "" + +#. Tag: programlisting +#: query_sql.xml:506 +#, no-c-format +msgid "" +"@Entity\n" +"@SqlResultSetMapping(name=\"compositekey\",\n" +" entities=@EntityResult(entityClass=SpaceShip.class,\n" +" fields = {\n" +" @FieldResult(name=\"name\", column = \"name\"),\n" +" @FieldResult(name=\"model\", column = \"model\"),\n" +" @FieldResult(name=\"speed\", column = \"speed\"),\n" +" @FieldResult(name=\"captain.firstname\", column = " +"\"firstn\"),\n" +" @FieldResult(name=\"captain.lastname\", column = \"lastn" +"\"),\n" +" @FieldResult(name=\"dimensions.length\", column = " +"\"length\"),\n" +" @FieldResult(name=\"dimensions.width\", column = \"width" +"\")\n" +" }),\n" +" columns = { @ColumnResult(name = \"surface\"),\n" +" @ColumnResult(name = \"volume\") } )\n" +"\n" +"@NamedNativeQuery(name=\"compositekey\",\n" +" query=\"select name, model, speed, lname as lastn, fname as firstn, " +"length, width, length * width as surface from SpaceShip\", \n" +" resultSetMapping=\"compositekey\")\n" +"} )\n" +"public class SpaceShip {\n" +" private String name;\n" +" private String model;\n" +" private double speed;\n" +" private Captain captain;\n" +" private Dimensions dimensions;\n" +"\n" +" @Id\n" +" public String getName() {\n" +" return name;\n" +" }\n" +"\n" +" public void setName(String name) {\n" +" this.name = name;\n" +" }\n" +"\n" +" @ManyToOne(fetch= FetchType.LAZY)\n" +" @JoinColumns( {\n" +" @JoinColumn(name=\"fname\", referencedColumnName = \"firstname" +"\"),\n" +" @JoinColumn(name=\"lname\", referencedColumnName = \"lastname" +"\")\n" +" } )\n" +" public Captain getCaptain() {\n" +" return captain;\n" +" }\n" +"\n" +" public void setCaptain(Captain captain) {\n" +" this.captain = captain;\n" +" }\n" +"\n" +" public String getModel() {\n" +" return model;\n" +" }\n" +"\n" +" public void setModel(String model) {\n" +" this.model = model;\n" +" }\n" +"\n" +" public double getSpeed() {\n" +" return speed;\n" +" }\n" +"\n" +" public void setSpeed(double speed) {\n" +" this.speed = speed;\n" +" }\n" +"\n" +" public Dimensions getDimensions() {\n" +" return dimensions;\n" +" }\n" +"\n" +" public void setDimensions(Dimensions dimensions) {\n" +" this.dimensions = dimensions;\n" +" }\n" +"}\n" +"\n" +"@Entity\n" +"@IdClass(Identity.class)\n" +"public class Captain implements Serializable {\n" +" private String firstname;\n" +" private String lastname;\n" +"\n" +" @Id\n" +" public String getFirstname() {\n" +" return firstname;\n" +" }\n" +"\n" +" public void setFirstname(String firstname) {\n" +" this.firstname = firstname;\n" +" }\n" +"\n" +" @Id\n" +" public String getLastname() {\n" +" return lastname;\n" +" }\n" +"\n" +" public void setLastname(String lastname) {\n" +" this.lastname = lastname;\n" +" }\n" +"}" +msgstr "" + +#. Tag: para +#: query_sql.xml:510 +#, no-c-format +msgid "" +"If you retrieve a single entity using the default mapping, you can specify " +"the resultClass attribute instead of " +"resultSetMapping:" +msgstr "" + +#. Tag: programlisting +#: query_sql.xml:514 +#, no-c-format +msgid "" +"@NamedNativeQuery(name=\"implicitSample\", query=\"select * from SpaceShip" +"\", resultClass=SpaceShip.class)\n" +"public class SpaceShip {" +msgstr "" + +#. Tag: para +#: query_sql.xml:517 +#, no-c-format +msgid "" +"In some of your native queries, you'll have to return scalar values, for " +"example when building report queries. You can map them in the " +"@SqlResultsetMapping through @ColumnResult. You actually can even mix, entities and scalar returns in the same " +"native query (this is probably not that common though)." +msgstr "" + +#. Tag: title +#: query_sql.xml:525 +#, no-c-format +msgid "Scalar values via @ColumnResult" +msgstr "" + +#. Tag: programlisting +#: query_sql.xml:527 +#, no-c-format +msgid "" +"@SqlResultSetMapping(name=\"scalar\", columns=@ColumnResult(name=\"dimension" +"\"))\n" +"@NamedNativeQuery(name=\"scalar\", query=\"select length*width as dimension " +"from SpaceShip\", resultSetMapping=\"scalar\")" +msgstr "" + +#. Tag: para +#: query_sql.xml:530 +#, no-c-format +msgid "" +"An other query hint specific to native queries has been introduced: " +"org.hibernate.callable which can be true or false " +"depending on whether the query is a stored procedure or not." +msgstr "" + +#. Tag: title +#: query_sql.xml:535 #, no-c-format msgid "Using return-property to explicitly specify column/alias names" msgstr "列と列の別名を明示的に指定するために return-property を使う" #. Tag: para +#: query_sql.xml:538 #, no-c-format msgid "" "You can explicitly tell Hibernate what column aliases to use with " @@ -664,7 +1418,36 @@ msgstr "" "別名を挿入するために {} 構文を使う代わりに、 <" "return-property> を使い、どの列の別名を使うのかを明示できます。" +#. Tag: programlisting +#: query_sql.xml:543 +#, fuzzy, no-c-format +msgid "" +"<sql-query name=\"mySqlQuery\">\n" +" <return alias=\"person\" class=\"eg.Person\">\n" +" <return-property name=\"name\" column=\"myName\"/>\n" +" <return-property name=\"age\" column=\"myAge\"/>\n" +" <return-property name=\"sex\" column=\"mySex\"/>\n" +" </return>\n" +" SELECT person.NAME AS myName,\n" +" person.AGE AS myAge,\n" +" person.SEX AS mySex,\n" +" FROM PERSON person WHERE person.NAME LIKE :name\n" +"</sql-query>" +msgstr "" +"<sql-query name=\"mySqlQuery\">\n" +" <return alias=\"person\" class=\"eg.Person\">\n" +" <return-property name=\"name\" column=\"myName\"/>\n" +" <return-property name=\"age\" column=\"myAge\"/>\n" +" <return-property name=\"sex\" column=\"mySex\"/>\n" +" </return>\n" +" SELECT person.NAME AS myName,\n" +" person.AGE AS myAge,\n" +" person.SEX AS mySex,\n" +" FROM PERSON person WHERE person.NAME LIKE :name\n" +"</sql-query>" + #. Tag: para +#: query_sql.xml:545 #, no-c-format msgid "" "<return-property> also works with multiple columns. " @@ -675,7 +1458,44 @@ msgstr "" "列のプロパティをきめ細かく制御できないという、 {} 構文の制" "限を解決します。" +#. Tag: programlisting +#: query_sql.xml:550 +#, fuzzy, no-c-format +msgid "" +"<sql-query name=\"organizationCurrentEmployments\">\n" +" <return alias=\"emp\" class=\"Employment\">\n" +" <return-property name=\"salary\">\n" +" <return-column name=\"VALUE\"/>\n" +" <return-column name=\"CURRENCY\"/>\n" +" </return-property>\n" +" <return-property name=\"endDate\" column=\"myEndDate\"/>\n" +" </return>\n" +" SELECT EMPLOYEE AS {emp.employee}, EMPLOYER AS {emp.employer},\n" +" STARTDATE AS {emp.startDate}, ENDDATE AS {emp.endDate},\n" +" REGIONCODE as {emp.regionCode}, EID AS {emp.id}, VALUE, CURRENCY\n" +" FROM EMPLOYMENT\n" +" WHERE EMPLOYER = :id AND ENDDATE IS NULL\n" +" ORDER BY STARTDATE ASC\n" +"</sql-query>" +msgstr "" +"<sql-query name=\"organizationCurrentEmployments\">\n" +" <return alias=\"emp\" class=\"Employment\">\n" +" <return-property name=\"salary\">\n" +" <return-column name=\"VALUE\"/>\n" +" <return-column name=\"CURRENCY\"/>\n" +" </return-property>\n" +" <return-property name=\"endDate\" column=\"myEndDate\"/>\n" +" </return>\n" +" SELECT EMPLOYEE AS {emp.employee}, EMPLOYER AS {emp.employer},\n" +" STARTDATE AS {emp.startDate}, ENDDATE AS {emp.endDate},\n" +" REGIONCODE as {emp.regionCode}, EID AS {emp.id}, VALUE, CURRENCY\n" +" FROM EMPLOYMENT\n" +" WHERE EMPLOYER = :id AND ENDDATE IS NULL\n" +" ORDER BY STARTDATE ASC\n" +"</sql-query>" + #. Tag: para +#: query_sql.xml:552 #, no-c-format msgid "" "In this example <return-property> was used in " @@ -687,6 +1507,7 @@ msgstr "" "い。列とプロパティをどのように参照するかを選べます。" #. Tag: para +#: query_sql.xml:557 #, no-c-format msgid "" "If your mapping has a discriminator you must use <return-" @@ -697,11 +1518,13 @@ msgstr "" "せん。" #. Tag: title +#: query_sql.xml:563 #, no-c-format msgid "Using stored procedures for querying" msgstr "問い合わせするためにストアドプロシージャを使う" #. Tag: para +#: query_sql.xml:565 #, no-c-format msgid "" "Hibernate3 provides support for queries via stored procedures and functions. " @@ -716,14 +1539,82 @@ msgstr "" "してリザルトセットを返さなければなりません。 Oracle 9(もしくはそれ以上のバー" "ジョン)のストアドプロシージャの例を以下に示します:" +#. Tag: programlisting +#: query_sql.xml:571 +#, fuzzy, no-c-format +msgid "" +"CREATE OR REPLACE FUNCTION selectAllEmployments\n" +" RETURN SYS_REFCURSOR\n" +"AS\n" +" st_cursor SYS_REFCURSOR;\n" +"BEGIN\n" +" OPEN st_cursor FOR\n" +" SELECT EMPLOYEE, EMPLOYER,\n" +" STARTDATE, ENDDATE,\n" +" REGIONCODE, EID, VALUE, CURRENCY\n" +" FROM EMPLOYMENT;\n" +" RETURN st_cursor;\n" +" END;" +msgstr "" +"CREATE OR REPLACE FUNCTION selectAllEmployments\n" +" RETURN SYS_REFCURSOR\n" +"AS\n" +" st_cursor SYS_REFCURSOR;\n" +"BEGIN\n" +" OPEN st_cursor FOR\n" +" SELECT EMPLOYEE, EMPLOYER,\n" +" STARTDATE, ENDDATE,\n" +" REGIONCODE, EID, VALUE, CURRENCY\n" +" FROM EMPLOYMENT;\n" +" RETURN st_cursor;\n" +" END;" + #. Tag: para +#: query_sql.xml:573 #, no-c-format msgid "To use this query in Hibernate you need to map it via a named query." msgstr "" "Hibernate でこのクエリを使うためには、名前付きクエリでマッピングする必要があ" "ります。" +#. Tag: programlisting +#: query_sql.xml:576 +#, fuzzy, no-c-format +msgid "" +"<sql-query name=\"selectAllEmployees_SP\" callable=\"true\">\n" +" <return alias=\"emp\" class=\"Employment\">\n" +" <return-property name=\"employee\" column=\"EMPLOYEE\"/>\n" +" <return-property name=\"employer\" column=\"EMPLOYER\"/>\n" +" <return-property name=\"startDate\" column=\"STARTDATE\"/>\n" +" <return-property name=\"endDate\" column=\"ENDDATE\"/>\n" +" <return-property name=\"regionCode\" column=\"REGIONCODE\"/>\n" +" <return-property name=\"id\" column=\"EID\"/>\n" +" <return-property name=\"salary\">\n" +" <return-column name=\"VALUE\"/>\n" +" <return-column name=\"CURRENCY\"/>\n" +" </return-property>\n" +" </return>\n" +" { ? = call selectAllEmployments() }\n" +"</sql-query>" +msgstr "" +"<sql-query name=\"selectAllEmployees_SP\" callable=\"true\">\n" +" <return alias=\"emp\" class=\"Employment\">\n" +" <return-property name=\"employee\" column=\"EMPLOYEE\"/>\n" +" <return-property name=\"employer\" column=\"EMPLOYER\"/>\n" +" <return-property name=\"startDate\" column=\"STARTDATE\"/>\n" +" <return-property name=\"endDate\" column=\"ENDDATE\"/>\n" +" <return-property name=\"regionCode\" column=\"REGIONCODE\"/>\n" +" <return-property name=\"id\" column=\"EID\"/>\n" +" <return-property name=\"salary\">\n" +" <return-column name=\"VALUE\"/>\n" +" <return-column name=\"CURRENCY\"/>\n" +" </return-property>\n" +" </return>\n" +" { ? = call selectAllEmployments() }\n" +"</sql-query>" + #. Tag: para +#: query_sql.xml:578 #, no-c-format msgid "" "Stored procedures currently only return scalars and entities. <" @@ -735,11 +1626,13 @@ msgstr "" "literal> はサポートされていません。" #. Tag: title +#: query_sql.xml:583 #, no-c-format msgid "Rules/limitations for using stored procedures" msgstr "ストアドプロシージャを使う上でのルールと制限" #. Tag: para +#: query_sql.xml:585 #, no-c-format msgid "" "You cannot use stored procedures with Hibernate unless you follow some " @@ -757,6 +1650,7 @@ msgstr "" "マンティックスとシンタックスは、データベースベンダごとに異なるためです。" #. Tag: para +#: query_sql.xml:593 #, no-c-format msgid "" "Stored procedure queries cannot be paged with setFirstResult()/" @@ -766,6 +1660,7 @@ msgstr "" "シージャクエリをページ分けすることはできません。" #. Tag: para +#: query_sql.xml:596 #, no-c-format msgid "" "The recommended call form is standard SQL92: { ? = call functionName" @@ -778,11 +1673,13 @@ msgstr "" "サポートされていません。" #. Tag: para +#: query_sql.xml:601 #, no-c-format msgid "For Oracle the following rules apply:" msgstr "Oracle には下記のルールが適用されます:" #. Tag: para +#: query_sql.xml:605 #, no-c-format msgid "" "A function must return a result set. The first parameter of a procedure must " @@ -798,11 +1695,13 @@ msgstr "" "Oracle の文献を参照してください。" #. Tag: para +#: query_sql.xml:614 #, no-c-format msgid "For Sybase or MS SQL server the following rules apply:" msgstr "Sybase と MS SQL サーバーに適用されるルールを下記に示します:" #. Tag: para +#: query_sql.xml:618 #, no-c-format msgid "" "The procedure must return a result set. Note that since these servers can " @@ -815,6 +1714,7 @@ msgstr "" "返すことに注意してください。その他はすべて捨てられます。" #. Tag: para +#: query_sql.xml:626 #, no-c-format msgid "" "If you can enable SET NOCOUNT ON in your procedure it " @@ -824,72 +1724,185 @@ msgstr "" "く効率がよくなるでしょう。しかし、これは必要条件ではありません。" #. Tag: title +#: query_sql.xml:636 #, no-c-format msgid "Custom SQL for create, update and delete" msgstr "作成、更新、削除のためのカスタム SQL" #. Tag: para +#: query_sql.xml:638 #, no-c-format msgid "" "Hibernate3 can use custom SQL for create, update, and delete operations. The " "SQL can be overridden at the statement level or inidividual column level. " "This section describes statement overrides. For columns, see ." +"\"mapping-column-read-and-write\"/>. shows how to define custom SQL operatons using annotations." +msgstr "" + +#. Tag: title +#: query_sql.xml:646 +#, no-c-format +msgid "Custom CRUD via annotations" +msgstr "" + +#. Tag: programlisting +#: query_sql.xml:648 +#, no-c-format +msgid "" +"@Entity\n" +"@Table(name=\"CHAOS\")\n" +"@SQLInsert( sql=\"INSERT INTO CHAOS(size, name, nickname, id) VALUES(?,upper" +"(?),?,?)\")\n" +"@SQLUpdate( sql=\"UPDATE CHAOS SET size = ?, name = upper(?), nickname = ? " +"WHERE id = ?\")\n" +"@SQLDelete( sql=\"DELETE CHAOS WHERE id = ?\")\n" +"@SQLDeleteAll( sql=\"DELETE CHAOS\")\n" +"@Loader(namedQuery = \"chaos\")\n" +"@NamedNativeQuery(name=\"chaos\", query=\"select id, size, name, lower" +"( nickname ) as nickname from CHAOS where id= ?\", resultClass = Chaos." +"class)\n" +"public class Chaos {\n" +" @Id\n" +" private Long id;\n" +" private Long size;\n" +" private String name;\n" +" private String nickname;" msgstr "" #. Tag: para +#: query_sql.xml:651 +#, no-c-format +msgid "" +"@SQLInsert, @SQLUpdate, " +"@SQLDelete, @SQLDeleteAll respectively " +"override the INSERT, UPDATE, DELETE, and DELETE all statement. The same can " +"be achieved using Hibernate mapping files and the <sql-insert>" +", <sql-update> and <sql-" +"delete> nodes. This can be seen in ." +msgstr "" + +#. Tag: title +#: query_sql.xml:661 +#, no-c-format +msgid "Custom CRUD XML" +msgstr "" + +#. Tag: programlisting +#: query_sql.xml:663 #, fuzzy, no-c-format msgid "" -"The class and collection persisters in Hibernate already contain a set of " -"configuration time generated strings (insertsql, deletesql, updatesql etc.). " -"The mapping tags <sql-insert>, <sql-" -"delete>, and <sql-update> override " -"these strings:" +"<class name=\"Person\">\n" +" <id name=\"id\">\n" +" <generator class=\"increment\"/>\n" +" </id>\n" +" <property name=\"name\" not-null=\"true\"/>\n" +" <sql-insert>INSERT INTO PERSON (NAME, ID) VALUES ( UPPER(?), ? )" +"</sql-insert>\n" +" <sql-update>UPDATE PERSON SET NAME=UPPER(?) WHERE ID=?</sql-" +"update>\n" +" <sql-delete>DELETE FROM PERSON WHERE ID=?</sql-delete>\n" +"</class>" msgstr "" -"Hibernate3 は作成、更新、削除処理のためのカスタム SQL 文を使用できます。クラ" -"スとコレクションの永続化機構は、コンフィグレーション時に生成された文字列 " -"(insertsql、deletesql、updatesql など)のセットをすでに保持しています。これ" -"らの文字列より、 <sql-insert><sql-" -"delete><sql-update> というマッピング" -"タグが優先されます:" +"<class name=\"Person\">\n" +" <id name=\"id\">\n" +" <generator class=\"increment\"/>\n" +" </id>\n" +" <property name=\"name\" not-null=\"true\"/>\n" +" <sql-insert>INSERT INTO PERSON (NAME, ID) VALUES ( UPPER(?), ? )" +"</sql-insert>\n" +" <sql-update>UPDATE PERSON SET NAME=UPPER(?) WHERE ID=?</sql-" +"update>\n" +" <sql-delete>DELETE FROM PERSON WHERE ID=?</sql-delete>\n" +"</class>" #. Tag: para +#: query_sql.xml:666 #, no-c-format msgid "" -"The SQL is directly executed in your database, so you can use any dialect " -"you like. This will reduce the portability of your mapping if you use " -"database specific SQL." +"If you expect to call a store procedure, be sure to set the " +"callable attribute to true. In " +"annotations as well as in xml." msgstr "" -"SQL を直接データベースで実行するため、好みの方言を自由に使用できます。データ" -"ベース独自の SQL を使えば、当然マッピングのポータビリティが下がります。" #. Tag: para +#: query_sql.xml:670 #, no-c-format msgid "" -"Stored procedures are supported if the callable attribute " -"is set:" +"To check that the execution happens correctly, Hibernate allows you to " +"define one of those three strategies:" msgstr "" -"callable 属性をセットすれば、ストアドプロシージャを使用で" -"きます:" #. Tag: para +#: query_sql.xml:675 #, no-c-format msgid "" -"The order of the positional parameters is vital, as they must be in the same " -"sequence as Hibernate expects them." +"none: no check is performed: the store procedure is expected to fail upon " +"issues" msgstr "" -"今のところ、位置パラメータの順番はとても重要です。すなわち、 Hibernate が期待" -"する順序でなければなりません。" #. Tag: para +#: query_sql.xml:680 +#, no-c-format +msgid "count: use of rowcount to check that the update is successful" +msgstr "" + +#. Tag: para +#: query_sql.xml:685 #, no-c-format msgid "" -"You can view the expected order by enabling debug logging for the " -"org.hibernate.persister.entity level. With this level " -"enabled, Hibernate will print out the static SQL that is used to create, " -"update, delete etc. entities. To view the expected sequence, do not include " -"your custom SQL in the mapping files, as this will override the Hibernate " -"generated static SQL." +"param: like COUNT but using an output parameter rather that the standard " +"mechanism" +msgstr "" + +#. Tag: para +#: query_sql.xml:690 +#, no-c-format +msgid "" +"To define the result check style, use the check parameter " +"which is again available in annoations as well as in xml." +msgstr "" + +#. Tag: para +#: query_sql.xml:693 +#, no-c-format +msgid "" +"You can use the exact same set of annotations respectively xml nodes to " +"override the collection related statements -see ." +msgstr "" + +#. Tag: title +#: query_sql.xml:698 +#, no-c-format +msgid "Overriding SQL statements for collections using annotations" +msgstr "" + +#. Tag: programlisting +#: query_sql.xml:701 +#, no-c-format +msgid "" +"@OneToMany\n" +"@JoinColumn(name=\"chaos_fk\")\n" +"@SQLInsert( sql=\"UPDATE CASIMIR_PARTICULE SET chaos_fk = ? where id = ?\")\n" +"@SQLDelete( sql=\"UPDATE CASIMIR_PARTICULE SET chaos_fk = null where id = ?" +"\")\n" +"private Set<CasimirParticle> particles = new HashSet<" +"CasimirParticle>();" +msgstr "" + +#. Tag: para +#: query_sql.xml:705 +#, fuzzy, no-c-format +msgid "" +"The parameter order is important and is defined by the order Hibernate " +"handles properties. You can see the expected order by enabling debug logging " +"for the org.hibernate.persister.entity level. With this " +"level enabled Hibernate will print out the static SQL that is used to " +"create, update, delete etc. entities. (To see the expected sequence, " +"remember to not include your custom SQL through annotations or mapping files " +"as that will override the Hibernate generated static sql)" msgstr "" "org.hiberante.persister.entity レベルのデバッグログを有効" "にすることによって、期待される順番を確かめられます。このレベルを有効にするこ" @@ -899,12 +1912,66 @@ msgstr "" "ください。)" #. Tag: para +#: query_sql.xml:715 #, no-c-format msgid "" -"The stored procedures are in most cases required to return the number of " -"rows inserted, updated and deleted, as Hibernate has some runtime checks for " -"the success of the statement. Hibernate always registers the first statement " -"parameter as a numeric output parameter for the CUD operations:" +"Overriding SQL statements for secondary tables is also possible using " +"@org.hibernate.annotations.Table and either (or all) " +"attributes sqlInsert, sqlUpdate, " +"sqlDelete:" +msgstr "" + +#. Tag: title +#: query_sql.xml:721 +#, no-c-format +msgid "Overriding SQL statements for secondary tables" +msgstr "" + +#. Tag: programlisting +#: query_sql.xml:723 +#, no-c-format +msgid "" +"@Entity\n" +"@SecondaryTables({\n" +" @SecondaryTable(name = \"`Cat nbr1`\"),\n" +" @SecondaryTable(name = \"Cat2\"})\n" +"@org.hibernate.annotations.Tables( {\n" +" @Table(appliesTo = \"Cat\", comment = \"My cat table\" ),\n" +" @Table(appliesTo = \"Cat2\", foreignKey = @ForeignKey(name=\"FK_CAT2_CAT" +"\"), fetch = FetchMode.SELECT,\n" +" sqlInsert=@SQLInsert(sql=\"insert into Cat2(storyPart2, id) values" +"(upper(?), ?)\") )\n" +"} )\n" +"public class Cat implements Serializable {" +msgstr "" + +#. Tag: para +#: query_sql.xml:726 +#, no-c-format +msgid "" +"The previous example also shows that you can give a comment to a given table " +"(primary or secondary): This comment will be used for DDL generation." +msgstr "" + +#. Tag: para +#: query_sql.xml:731 +#, fuzzy, no-c-format +msgid "" +"The SQL is directly executed in your database, so you can use any dialect " +"you like. This will, however, reduce the portability of your mapping if you " +"use database specific SQL." +msgstr "" +"SQL を直接データベースで実行するため、好みの方言を自由に使用できます。データ" +"ベース独自の SQL を使えば、当然マッピングのポータビリティが下がります。" + +#. Tag: para +#: query_sql.xml:736 +#, fuzzy, no-c-format +msgid "" +"Last but not least, stored procedures are in most cases required to return " +"the number of rows inserted, updated and deleted. Hibernate always registers " +"the first statement parameter as a numeric output parameter for the CUD " +"operations:" msgstr "" "ストアドプロシージャは挿入/更新/削除された行数を返す必要があります(読み込み" "の場合は、返さないよりは返す方がよいです)。実行時に Hibernate が SQL 文の成" @@ -912,21 +1979,82 @@ msgstr "" "タとして、 SQL 文の最初のパラメータをいつも記録します:" #. Tag: title +#: query_sql.xml:742 +#, no-c-format +msgid "Stored procedures and their return value" +msgstr "" + +#. Tag: programlisting +#: query_sql.xml:744 +#, fuzzy, no-c-format +msgid "" +"CREATE OR REPLACE FUNCTION updatePerson (uid IN NUMBER, uname IN VARCHAR2)\n" +" RETURN NUMBER IS\n" +"BEGIN\n" +"\n" +" update PERSON\n" +" set\n" +" NAME = uname,\n" +" where\n" +" ID = uid;\n" +"\n" +" return SQL%ROWCOUNT;\n" +"\n" +"END updatePerson;" +msgstr "" +"CREATE OR REPLACE FUNCTION updatePerson (uid IN NUMBER, uname IN VARCHAR2)\n" +" RETURN NUMBER IS\n" +"BEGIN\n" +"\n" +" update PERSON\n" +" set\n" +" NAME = uname,\n" +" where\n" +" ID = uid;\n" +"\n" +" return SQL%ROWCOUNT;\n" +"\n" +"END updatePerson;" + +#. Tag: title +#: query_sql.xml:749 #, no-c-format msgid "Custom SQL for loading" msgstr "ロードのためのカスタム SQL" #. Tag: para +#: query_sql.xml:751 #, no-c-format msgid "" "You can also declare your own SQL (or HQL) queries for entity loading. As " "with inserts, updates, and deletes, this can be done at the individual " -"column level as described in or at the statement level. Here is an example of a statement level " +"column level as described in or at the statement level. Here is an example of a statement level " "override:" msgstr "" +#. Tag: programlisting +#: query_sql.xml:757 +#, fuzzy, no-c-format +msgid "" +"<sql-query name=\"person\">\n" +" <return alias=\"pers\" class=\"Person\" lock-mode=\"upgrade\"/>\n" +" SELECT NAME AS {pers.name}, ID AS {pers.id}\n" +" FROM PERSON\n" +" WHERE ID=?\n" +" FOR UPDATE\n" +"</sql-query>" +msgstr "" +"<sql-query name=\"person\">\n" +" <return alias=\"pers\" class=\"Person\" lock-mode=\"upgrade\"/>\n" +" SELECT NAME AS {pers.name}, ID AS {pers.id}\n" +" FROM PERSON\n" +" WHERE ID=?\n" +" FOR UPDATE\n" +"</sql-query>" + #. Tag: para +#: query_sql.xml:759 #, no-c-format msgid "" "This is just a named query declaration, as discussed earlier. You can " @@ -935,17 +2063,76 @@ msgstr "" "これは、まさに(以前議論した)名前付きクエリの宣言です。この名前付きクエリを" "クラスのマッピングから参照できます:" +#. Tag: programlisting +#: query_sql.xml:762 +#, fuzzy, no-c-format +msgid "" +"<class name=\"Person\">\n" +" <id name=\"id\">\n" +" <generator class=\"increment\"/>\n" +" </id>\n" +" <property name=\"name\" not-null=\"true\"/>\n" +" <loader query-ref=\"person\"/>\n" +"</class>" +msgstr "" +"<class name=\"Person\">\n" +" <id name=\"id\">\n" +" <generator class=\"increment\"/>\n" +" </id>\n" +" <property name=\"name\" not-null=\"true\"/>\n" +" <loader query-ref=\"person\"/>\n" +"</class>" + #. Tag: para +#: query_sql.xml:764 #, no-c-format msgid "This even works with stored procedures." msgstr "これはストアドプロシージャでさえも動作します。" #. Tag: para +#: query_sql.xml:766 #, no-c-format msgid "You can even define a query for collection loading:" msgstr "次のように、コレクションをロードするためのクエリさえ定義してよいです:" +#. Tag: programlisting +#: query_sql.xml:768 +#, fuzzy, no-c-format +msgid "" +"<set name=\"employments\" inverse=\"true\">\n" +" <key/>\n" +" <one-to-many class=\"Employment\"/>\n" +" <loader query-ref=\"employments\"/>\n" +"</set>" +msgstr "" +"<set name=\"employments\" inverse=\"true\">\n" +" <key/>\n" +" <one-to-many class=\"Employment\"/>\n" +" <loader query-ref=\"employments\"/>\n" +"</set>" + +#. Tag: programlisting +#: query_sql.xml:770 +#, fuzzy, no-c-format +msgid "" +"<sql-query name=\"employments\">\n" +" <load-collection alias=\"emp\" role=\"Person.employments\"/>\n" +" SELECT {emp.*}\n" +" FROM EMPLOYMENT emp\n" +" WHERE EMPLOYER = :id\n" +" ORDER BY STARTDATE ASC, EMPLOYEE ASC\n" +"</sql-query>" +msgstr "" +"<sql-query name=\"employments\">\n" +" <load-collection alias=\"emp\" role=\"Person.employments\"/>\n" +" SELECT {emp.*}\n" +" FROM EMPLOYMENT emp\n" +" WHERE EMPLOYER = :id\n" +" ORDER BY STARTDATE ASC, EMPLOYEE ASC\n" +"</sql-query>" + #. Tag: para +#: query_sql.xml:772 #, no-c-format msgid "" "You can also define an entity loader that loads a collection by join " @@ -954,518 +2141,131 @@ msgstr "" "次のように、結合フェッチによりコレクションをロードするエンティティローダーを" "定義できます:" +#. Tag: programlisting +#: query_sql.xml:775 +#, fuzzy, no-c-format +msgid "" +"<sql-query name=\"person\">\n" +" <return alias=\"pers\" class=\"Person\"/>\n" +" <return-join alias=\"emp\" property=\"pers.employments\"/>\n" +" SELECT NAME AS {pers.*}, {emp.*}\n" +" FROM PERSON pers\n" +" LEFT OUTER JOIN EMPLOYMENT emp\n" +" ON pers.ID = emp.PERSON_ID\n" +" WHERE ID=?\n" +"</sql-query>" +msgstr "" +"<sql-query name=\"person\">\n" +" <return alias=\"pers\" class=\"Person\"/>\n" +" <return-join alias=\"emp\" property=\"pers.employments\"/>\n" +" SELECT NAME AS {pers.*}, {emp.*}\n" +" FROM PERSON pers\n" +" LEFT OUTER JOIN EMPLOYMENT emp\n" +" ON pers.ID = emp.PERSON_ID\n" +" WHERE ID=?\n" +"</sql-query>" + +#. Tag: para +#: query_sql.xml:777 +#, no-c-format +msgid "" +"The annotation equivalent <loader> is the @Loader " +"annotation as seen in ." +msgstr "" + +#, fuzzy +#~ msgid "A_NAME as {item.name}" +#~ msgstr "{item.*}" + +#, fuzzy +#~ msgid "{[aliasname].class}" +#~ msgstr "{item.*}" + +#, fuzzy +#~ msgid "DISC as {item.class}" +#~ msgstr "{item.*}" + +#, fuzzy +#~ msgid "{[aliasname].*}" +#~ msgstr "{item.*}" + +#~ msgid "{item.*}" +#~ msgstr "{item.*}" + +#, fuzzy +#~ msgid "{[aliasname].key}" +#~ msgstr "{item.*}" + +#, fuzzy +#~ msgid "ORGID as {coll.key}" +#~ msgstr "{coll.*}" + +#, fuzzy +#~ msgid "{[aliasname].id}" +#~ msgstr "{item.*}" + +#, fuzzy +#~ msgid "EMPID as {coll.id}" +#~ msgstr "{coll.*}" + +#, fuzzy +#~ msgid "{[aliasname].element}" +#~ msgstr "{coll.element.*}" + +#, fuzzy +#~ msgid "XID as {coll.element}" +#~ msgstr "{coll.element.*}" + +#, fuzzy +#~ msgid "NAME as {coll.element.name}" +#~ msgstr "{coll.element.*}" + +#, fuzzy +#~ msgid "{[aliasname].element.*}" +#~ msgstr "{coll.element.*}" + +#~ msgid "{coll.element.*}" +#~ msgstr "{coll.element.*}" + +#~ msgid "{coll.*}" +#~ msgstr "{coll.*}" + +#, fuzzy +#~ msgid "" +#~ "The class and collection persisters in Hibernate already contain a set of " +#~ "configuration time generated strings (insertsql, deletesql, updatesql " +#~ "etc.). The mapping tags <sql-insert>, " +#~ "<sql-delete>, and <sql-update> override these strings:" +#~ msgstr "" +#~ "Hibernate3 は作成、更新、削除処理のためのカスタム SQL 文を使用できます。ク" +#~ "ラスとコレクションの永続化機構は、コンフィグレーション時に生成された文字" +#~ "列 (insertsql、deletesql、updatesql など)のセットをすでに保持していま" +#~ "す。これらの文字列より、 <sql-insert>、 " +#~ "<sql-delete><sql-update> というマッピングタグが優先されます:" + +#~ msgid "" +#~ "Stored procedures are supported if the callable " +#~ "attribute is set:" +#~ msgstr "" +#~ "callable 属性をセットすれば、ストアドプロシージャを使用" +#~ "できます:" + +#~ msgid "" +#~ "The order of the positional parameters is vital, as they must be in the " +#~ "same sequence as Hibernate expects them." +#~ msgstr "" +#~ "今のところ、位置パラメータの順番はとても重要です。すなわち、 Hibernate が" +#~ "期待する順序でなければなりません。" + #~ msgid "" #~ "You can also declare your own SQL (or HQL) queries for entity loading:" #~ msgstr "" #~ "エンティティを読み込むための独自の SQL (もしくは HQL)クエリも宣言できま" #~ "す:" -#, fuzzy -#~ msgid "" -#~ "" -#~ msgstr "" -#~ "sess.createSQLQuery(\"SELECT * FROM CATS\").list();\n" -#~ "sess.createSQLQuery(\"SELECT ID, NAME, BIRTHDATE FROM CATS\").list();" - -#, fuzzy -#~ msgid "" -#~ "" -#~ msgstr "" -#~ "sess.createSQLQuery(\"SELECT * FROM CATS\")\n" -#~ " .addScalar(\"ID\", Hibernate.LONG)\n" -#~ " .addScalar(\"NAME\", Hibernate.STRING)\n" -#~ " .addScalar(\"BIRTHDATE\", Hibernate.DATE)" - -#, fuzzy -#~ msgid "" -#~ "" -#~ msgstr "" -#~ "sess.createSQLQuery(\"SELECT * FROM CATS\")\n" -#~ " .addScalar(\"ID\", Hibernate.LONG)\n" -#~ " .addScalar(\"NAME\")\n" -#~ " .addScalar(\"BIRTHDATE\")" - -#, fuzzy -#~ msgid "" -#~ "" -#~ msgstr "" -#~ "sess.createSQLQuery(\"SELECT * FROM CATS\").addEntity(Cat.class);\n" -#~ "sess.createSQLQuery(\"SELECT ID, NAME, BIRTHDATE FROM CATS\").addEntity" -#~ "(Cat.class);" - -#, fuzzy -#~ msgid "" -#~ "" -#~ msgstr "" -#~ "sess.createSQLQuery(\"SELECT ID, NAME, BIRTHDATE, DOG_ID FROM CATS\")." -#~ "addEntity(Cat.class);" - -#, fuzzy -#~ msgid "" -#~ "" -#~ msgstr "" -#~ "sess.createSQLQuery(\"SELECT c.ID, NAME, BIRTHDATE, DOG_ID, D_ID, D_NAME " -#~ "FROM CATS c, DOGS d \n" -#~ " WHERE c.DOG_ID = d.D_ID\")\n" -#~ " .addEntity(\"cat\", Cat.class)\n" -#~ " .addJoin(\"cat.dog\");" - -#, fuzzy -#~ msgid "" -#~ "" -#~ msgstr "" -#~ "sess.createSQLQuery(\"SELECT ID, NAME, BIRTHDATE, D_ID, D_NAME, CAT_ID " -#~ "FROM CATS c, DOGS d\n" -#~ " WHERE c.ID = d.CAT_ID\")\n" -#~ " .addEntity(\"cat\", Cat.class)\n" -#~ " .addJoin(\"cat.dogs\");" - -#, fuzzy -#~ msgid "" -#~ "" -#~ msgstr "" -#~ "sess.createSQLQuery(\"SELECT c.*, m.* FROM CATS c, CATS m WHERE c." -#~ "MOTHER_ID = c.ID\")\n" -#~ " .addEntity(\"cat\", Cat.class)\n" -#~ " .addEntity(\"mother\", Cat.class)" - -#, fuzzy -#~ msgid "" -#~ "" -#~ msgstr "" -#~ "sess.createSQLQuery(\"SELECT {cat.*}, {mother.*} FROM CATS c, CATS m " -#~ "WHERE c.MOTHER_ID = c.ID\")\n" -#~ " .addEntity(\"cat\", Cat.class)\n" -#~ " .addEntity(\"mother\", Cat.class)" - -#, fuzzy -#~ msgid "" -#~ "" -#~ msgstr "" -#~ "String sql = \"SELECT ID as {c.id}, NAME as {c.name}, \" + \n" -#~ " \"BIRTHDATE as {c.birthDate}, MOTHER_ID as {c.mother}, {mother." -#~ "*} \" +\n" -#~ " \"FROM CAT_LOG c, CAT_LOG m WHERE {c.mother} = c.ID\";\n" -#~ "\n" -#~ "List loggedCats = sess.createSQLQuery(sql)\n" -#~ " .addEntity(\"cat\", Cat.class)\n" -#~ " .addEntity(\"mother\", Cat.class).list()" - -#, fuzzy -#~ msgid "A_NAME as {item.name}" -#~ msgstr "A_NAME as {item.name}" - -#, fuzzy -#~ msgid "{[aliasname].class}" -#~ msgstr "{[aliasname].class}" - -#, fuzzy -#~ msgid "DISC as {item.class}" -#~ msgstr "DISC as {item.class}" - -#, fuzzy -#~ msgid "{[aliasname].*}" -#~ msgstr "{[aliasname].*}" - -#~ msgid "{item.*}" -#~ msgstr "{item.*}" - -#, fuzzy -#~ msgid "{[aliasname].key}" -#~ msgstr "{[aliasname].key}" - -#, fuzzy -#~ msgid "ORGID as {coll.key}" -#~ msgstr "ORGID as {coll.key}" - -#, fuzzy -#~ msgid "{[aliasname].id}" -#~ msgstr "{[aliasname].id}" - -#, fuzzy -#~ msgid "EMPID as {coll.id}" -#~ msgstr "EMPID as {coll.id}" - -#, fuzzy -#~ msgid "{[aliasname].element}" -#~ msgstr "{[aliasname].element}" - -#, fuzzy -#~ msgid "XID as {coll.element}" -#~ msgstr "XID as {coll.element}" - -#, fuzzy -#~ msgid "NAME as {coll.element.name}" -#~ msgstr "NAME as {coll.element.name}" - -#, fuzzy -#~ msgid "{[aliasname].element.*}" -#~ msgstr "{[aliasname].element.*}" - -#, fuzzy -#~ msgid "{coll.element.*}" -#~ msgstr "{coll.*}" - -#~ msgid "{coll.*}" -#~ msgstr "{coll.*}" - -#, fuzzy -#~ msgid "" -#~ "" -#~ msgstr "" -#~ "sess.createSQLQuery(\"SELECT NAME, BIRTHDATE FROM CATS\")\n" -#~ " .setResultTransformer(Transformers.aliasToBean(CatDTO.class))" - -#, fuzzy -#~ msgid "" -#~ "" -#~ msgstr "" -#~ "Query query = sess.createSQLQuery(\"SELECT * FROM CATS WHERE NAME like ?" -#~ "\").addEntity(Cat.class);\n" -#~ "List pusList = query.setString(0, \"Pus%\").list();\n" -#~ " \n" -#~ "query = sess.createSQLQuery(\"SELECT * FROM CATS WHERE NAME like :name\")." -#~ "addEntity(Cat.class);\n" -#~ "List pusList = query.setString(\"name\", \"Pus%\").list();" - -#, fuzzy -#~ msgid "" -#~ "\n" -#~ " \n" -#~ " SELECT person.NAME AS {person.name},\n" -#~ " person.AGE AS {person.age},\n" -#~ " person.SEX AS {person.sex}\n" -#~ " FROM PERSON person\n" -#~ " WHERE person.NAME LIKE :namePattern\n" -#~ "]]>" -#~ msgstr "" -#~ "<sql-query name=\"persons\">\n" -#~ " <return alias=\"person\" class=\"eg.Person\"/>\n" -#~ " SELECT person.NAME AS {person.name},\n" -#~ " person.AGE AS {person.age},\n" -#~ " person.SEX AS {person.sex}\n" -#~ " FROM PERSON person\n" -#~ " WHERE person.NAME LIKE :namePattern\n" -#~ "</sql-query>" - -#, fuzzy -#~ msgid "" -#~ "" -#~ msgstr "" -#~ "List people = sess.getNamedQuery(\"persons\")\n" -#~ " .setString(\"namePattern\", namePattern)\n" -#~ " .setMaxResults(50)\n" -#~ " .list();" - -#, fuzzy -#~ msgid "" -#~ "\n" -#~ " \n" -#~ " \n" -#~ " SELECT person.NAME AS {person.name},\n" -#~ " person.AGE AS {person.age},\n" -#~ " person.SEX AS {person.sex},\n" -#~ " address.STREET AS {address.street},\n" -#~ " address.CITY AS {address.city},\n" -#~ " address.STATE AS {address.state},\n" -#~ " address.ZIP AS {address.zip}\n" -#~ " FROM PERSON person\n" -#~ " JOIN ADDRESS address\n" -#~ " ON person.ID = address.PERSON_ID AND address.TYPE='MAILING'\n" -#~ " WHERE person.NAME LIKE :namePattern\n" -#~ "]]>" -#~ msgstr "" -#~ "<sql-query name=\"personsWith\">\n" -#~ " <return alias=\"person\" class=\"eg.Person\"/>\n" -#~ " <return-join alias=\"address\" property=\"person.mailingAddress\"/" -#~ ">\n" -#~ " SELECT person.NAME AS {person.name},\n" -#~ " person.AGE AS {person.age},\n" -#~ " person.SEX AS {person.sex},\n" -#~ " adddress.STREET AS {address.street},\n" -#~ " adddress.CITY AS {address.city},\n" -#~ " adddress.STATE AS {address.state},\n" -#~ " adddress.ZIP AS {address.zip}\n" -#~ " FROM PERSON person\n" -#~ " JOIN ADDRESS adddress\n" -#~ " ON person.ID = address.PERSON_ID AND address.TYPE='MAILING'\n" -#~ " WHERE person.NAME LIKE :namePattern\n" -#~ "</sql-query>" - -#, fuzzy -#~ msgid "" -#~ "\n" -#~ " \n" -#~ " \n" -#~ " SELECT p.NAME AS name,\n" -#~ " p.AGE AS age,\n" -#~ " FROM PERSON p WHERE p.NAME LIKE 'Hiber%'\n" -#~ "]]>" -#~ msgstr "" -#~ "<sql-query name=\"mySqlQuery\">\n" -#~ " <return-scalar column=\"name\" type=\"string\"/>\n" -#~ " <return-scalar column=\"age\" type=\"long\"/>\n" -#~ " SELECT p.NAME AS name,\n" -#~ " p.AGE AS age,\n" -#~ " FROM PERSON p WHERE p.NAME LIKE 'Hiber%'\n" -#~ "</sql-query>" - -#, fuzzy -#~ msgid "" -#~ "\n" -#~ " \n" -#~ " \n" -#~ "\n" -#~ "\n" -#~ "\n" -#~ " SELECT person.NAME AS {person.name},\n" -#~ " person.AGE AS {person.age},\n" -#~ " person.SEX AS {person.sex},\n" -#~ " address.STREET AS {address.street},\n" -#~ " address.CITY AS {address.city},\n" -#~ " address.STATE AS {address.state},\n" -#~ " address.ZIP AS {address.zip}\n" -#~ " FROM PERSON person\n" -#~ " JOIN ADDRESS address\n" -#~ " ON person.ID = address.PERSON_ID AND address.TYPE='MAILING'\n" -#~ " WHERE person.NAME LIKE :namePattern\n" -#~ "]]>" -#~ msgstr "" -#~ "<resultset name=\"personAddress\">\n" -#~ " <return alias=\"person\" class=\"eg.Person\"/>\n" -#~ " <return-join alias=\"address\" property=\"person.mailingAddress\"/" -#~ ">\n" -#~ "</resultset>\n" -#~ "\n" -#~ "<sql-query name=\"personsWith\" resultset-ref=\"personAddress\">\n" -#~ " SELECT person.NAME AS {person.name},\n" -#~ " person.AGE AS {person.age},\n" -#~ " person.SEX AS {person.sex},\n" -#~ " adddress.STREET AS {address.street},\n" -#~ " adddress.CITY AS {address.city},\n" -#~ " adddress.STATE AS {address.state},\n" -#~ " adddress.ZIP AS {address.zip}\n" -#~ " FROM PERSON person\n" -#~ " JOIN ADDRESS adddress\n" -#~ " ON person.ID = address.PERSON_ID AND address.TYPE='MAILING'\n" -#~ " WHERE person.NAME LIKE :namePattern\n" -#~ "</sql-query>" - -#, fuzzy -#~ msgid "" -#~ "" -#~ msgstr "" -#~ "List cats = sess.createSQLQuery(\n" -#~ " \"select {cat.*}, {kitten.*} from cats cat, cats kitten where " -#~ "kitten.mother = cat.id\"\n" -#~ " )\n" -#~ " .setResultSetMapping(\"catAndKitten\")\n" -#~ " .list();" - -#, fuzzy -#~ msgid "" -#~ "\n" -#~ " \n" -#~ " \n" -#~ " \n" -#~ " \n" -#~ " \n" -#~ " SELECT person.NAME AS myName,\n" -#~ " person.AGE AS myAge,\n" -#~ " person.SEX AS mySex,\n" -#~ " FROM PERSON person WHERE person.NAME LIKE :name\n" -#~ "\n" -#~ "]]>" -#~ msgstr "" -#~ "<sql-query name=\"mySqlQuery\">\n" -#~ " <return alias=\"person\" class=\"eg.Person\">\n" -#~ " <return-property name=\"name\" column=\"myName\"/>\n" -#~ " <return-property name=\"age\" column=\"myAge\"/>\n" -#~ " <return-property name=\"sex\" column=\"mySex\"/>\n" -#~ " </return>\n" -#~ " SELECT person.NAME AS myName,\n" -#~ " person.AGE AS myAge,\n" -#~ " person.SEX AS mySex,\n" -#~ " FROM PERSON person WHERE person.NAME LIKE :name\n" -#~ "</sql-query>" - -#, fuzzy -#~ msgid "" -#~ "\n" -#~ " \n" -#~ " \n" -#~ " \n" -#~ " \n" -#~ " \n" -#~ " \n" -#~ " \n" -#~ " SELECT EMPLOYEE AS {emp.employee}, EMPLOYER AS {emp.employer},\n" -#~ " STARTDATE AS {emp.startDate}, ENDDATE AS {emp.endDate},\n" -#~ " REGIONCODE as {emp.regionCode}, EID AS {emp.id}, VALUE, CURRENCY\n" -#~ " FROM EMPLOYMENT\n" -#~ " WHERE EMPLOYER = :id AND ENDDATE IS NULL\n" -#~ " ORDER BY STARTDATE ASC\n" -#~ "]]>" -#~ msgstr "" -#~ "<sql-query name=\"organizationCurrentEmployments\">\n" -#~ " <return alias=\"emp\" class=\"Employment\">\n" -#~ " <return-property name=\"salary\">\n" -#~ " <return-column name=\"VALUE\"/>\n" -#~ " <return-column name=\"CURRENCY\"/>\n" -#~ " </return-property>\n" -#~ " <return-property name=\"endDate\" column=\"myEndDate\"/>\n" -#~ " </return>\n" -#~ " SELECT EMPLOYEE AS {emp.employee}, EMPLOYER AS {emp.employer},\n" -#~ " STARTDATE AS {emp.startDate}, ENDDATE AS {emp.endDate},\n" -#~ " REGIONCODE as {emp.regionCode}, EID AS {emp.id}, VALUE, CURRENCY\n" -#~ " FROM EMPLOYMENT\n" -#~ " WHERE EMPLOYER = :id AND ENDDATE IS NULL\n" -#~ " ORDER BY STARTDATE ASC\n" -#~ "</sql-query>" - -#, fuzzy -#~ msgid "" -#~ "" -#~ msgstr "" -#~ "CREATE OR REPLACE FUNCTION selectAllEmployments\n" -#~ " RETURN SYS_REFCURSOR\n" -#~ "AS\n" -#~ " st_cursor SYS_REFCURSOR;\n" -#~ "BEGIN\n" -#~ " OPEN st_cursor FOR\n" -#~ " SELECT EMPLOYEE, EMPLOYER,\n" -#~ " STARTDATE, ENDDATE,\n" -#~ " REGIONCODE, EID, VALUE, CURRENCY\n" -#~ " FROM EMPLOYMENT;\n" -#~ " RETURN st_cursor;\n" -#~ " END;" - -#, fuzzy -#~ msgid "" -#~ "\n" -#~ " \n" -#~ " \n" -#~ " \n" -#~ " \n" -#~ " \n" -#~ " \n" -#~ " \n" -#~ " \n" -#~ " \n" -#~ " \n" -#~ " \n" -#~ " \n" -#~ " { ? = call selectAllEmployments() }\n" -#~ "]]>" -#~ msgstr "" -#~ "<sql-query name=\"selectAllEmployees_SP\" callable=\"true\">\n" -#~ " <return alias=\"emp\" class=\"Employment\">\n" -#~ " <return-property name=\"employee\" column=\"EMPLOYEE\"/>\n" -#~ " <return-property name=\"employer\" column=\"EMPLOYER\"/>\n" -#~ " <return-property name=\"startDate\" column=\"STARTDATE\"/>\n" -#~ " <return-property name=\"endDate\" column=\"ENDDATE\"/>\n" -#~ " <return-property name=\"regionCode\" column=\"REGIONCODE\"/" -#~ ">\n" -#~ " <return-property name=\"id\" column=\"EID\"/>\n" -#~ " <return-property name=\"salary\">\n" -#~ " <return-column name=\"VALUE\"/>\n" -#~ " <return-column name=\"CURRENCY\"/>\n" -#~ " </return-property>\n" -#~ " </return>\n" -#~ " { ? = call selectAllEmployments() }\n" -#~ "</sql-query>" - -#, fuzzy -#~ msgid "" -#~ "\n" -#~ " \n" -#~ " \n" -#~ " \n" -#~ " \n" -#~ " INSERT INTO PERSON (NAME, ID) VALUES ( UPPER(?), ? )\n" -#~ " UPDATE PERSON SET NAME=UPPER(?) WHERE ID=?\n" -#~ " DELETE FROM PERSON WHERE ID=?\n" -#~ "]]>" -#~ msgstr "" -#~ "<class name=\"Person\">\n" -#~ " <id name=\"id\">\n" -#~ " <generator class=\"increment\"/>\n" -#~ " </id>\n" -#~ " <property name=\"name\" not-null=\"true\"/>\n" -#~ " <sql-insert>INSERT INTO PERSON (NAME, ID) VALUES ( UPPER(?), ? )" -#~ "</sql-insert>\n" -#~ " <sql-update>UPDATE PERSON SET NAME=UPPER(?) WHERE ID=?</sql-" -#~ "update>\n" -#~ " <sql-delete>DELETE FROM PERSON WHERE ID=?</sql-delete>\n" -#~ "</class>" - #, fuzzy #~ msgid "" #~ "\n" @@ -1493,126 +2293,3 @@ msgstr "" #~ " <sql-update callable=\"true\">{? = call updatePerson (?, ?)}" #~ "</sql-update>\n" #~ "</class>" - -#, fuzzy -#~ msgid "" -#~ "" -#~ msgstr "" -#~ "CREATE OR REPLACE FUNCTION updatePerson (uid IN NUMBER, uname IN " -#~ "VARCHAR2)\n" -#~ " RETURN NUMBER IS\n" -#~ "BEGIN\n" -#~ "\n" -#~ " update PERSON\n" -#~ " set\n" -#~ " NAME = uname,\n" -#~ " where\n" -#~ " ID = uid;\n" -#~ "\n" -#~ " return SQL%ROWCOUNT;\n" -#~ "\n" -#~ "END updatePerson;" - -#, fuzzy -#~ msgid "" -#~ "\n" -#~ " \n" -#~ " SELECT NAME AS {pers.name}, ID AS {pers.id}\n" -#~ " FROM PERSON\n" -#~ " WHERE ID=?\n" -#~ " FOR UPDATE\n" -#~ "]]>" -#~ msgstr "" -#~ "<sql-query name=\"person\">\n" -#~ " <return alias=\"pers\" class=\"Person\" lock-mode=\"upgrade\"/" -#~ ">\n" -#~ " SELECT NAME AS {pers.name}, ID AS {pers.id}\n" -#~ " FROM PERSON\n" -#~ " WHERE ID=?\n" -#~ " FOR UPDATE\n" -#~ "</sql-query>" - -#, fuzzy -#~ msgid "" -#~ "\n" -#~ " \n" -#~ " \n" -#~ " \n" -#~ " \n" -#~ " \n" -#~ "]]>" -#~ msgstr "" -#~ "<class name=\"Person\">\n" -#~ " <id name=\"id\">\n" -#~ " <generator class=\"increment\"/>\n" -#~ " </id>\n" -#~ " <property name=\"name\" not-null=\"true\"/>\n" -#~ " <loader query-ref=\"person\"/>\n" -#~ "</class>" - -#, fuzzy -#~ msgid "" -#~ "\n" -#~ " \n" -#~ " \n" -#~ " \n" -#~ "]]>" -#~ msgstr "" -#~ "<set name=\"employments\" inverse=\"true\">\n" -#~ " <key/>\n" -#~ " <one-to-many class=\"Employment\"/>\n" -#~ " <loader query-ref=\"employments\"/>\n" -#~ "</set>" - -#, fuzzy -#~ msgid "" -#~ "\n" -#~ " \n" -#~ " SELECT {emp.*}\n" -#~ " FROM EMPLOYMENT emp\n" -#~ " WHERE EMPLOYER = :id\n" -#~ " ORDER BY STARTDATE ASC, EMPLOYEE ASC\n" -#~ "]]>" -#~ msgstr "" -#~ "<sql-query name=\"employments\">\n" -#~ " <load-collection alias=\"emp\" role=\"Person.employments\"/>\n" -#~ " SELECT {emp.*}\n" -#~ " FROM EMPLOYMENT emp\n" -#~ " WHERE EMPLOYER = :id\n" -#~ " ORDER BY STARTDATE ASC, EMPLOYEE ASC\n" -#~ "</sql-query>" - -#, fuzzy -#~ msgid "" -#~ "\n" -#~ " \n" -#~ " \n" -#~ " SELECT NAME AS {pers.*}, {emp.*}\n" -#~ " FROM PERSON pers\n" -#~ " LEFT OUTER JOIN EMPLOYMENT emp\n" -#~ " ON pers.ID = emp.PERSON_ID\n" -#~ " WHERE ID=?\n" -#~ "]]>" -#~ msgstr "" -#~ "<sql-query name=\"person\">\n" -#~ " <return alias=\"pers\" class=\"Person\"/>\n" -#~ " <return-join alias=\"emp\" property=\"pers.employments\"/>\n" -#~ " SELECT NAME AS {pers.*}, {emp.*}\n" -#~ " FROM PERSON pers\n" -#~ " LEFT OUTER JOIN EMPLOYMENT emp\n" -#~ " ON pers.ID = emp.PERSON_ID\n" -#~ " WHERE ID=?\n" -#~ "</sql-query>" diff --git a/documentation/manual/src/main/docbook/ja-JP/content/session_api.po b/documentation/manual/src/main/docbook/ja-JP/content/session_api.po index f8f3011663..0c2cd972a9 100644 --- a/documentation/manual/src/main/docbook/ja-JP/content/session_api.po +++ b/documentation/manual/src/main/docbook/ja-JP/content/session_api.po @@ -4,7 +4,7 @@ msgid "" msgstr "" "Project-Id-Version: Collection_Mapping\n" "Report-Msgid-Bugs-To: http://bugs.kde.org\n" -"POT-Creation-Date: 2010-03-12T00:03:48\n" +"POT-Creation-Date: 2010-07-20 21:02+0000\n" "PO-Revision-Date: 2010-01-07 14:56+1000\n" "Last-Translator: Xi HUANG \n" "Language-Team: \n" @@ -14,11 +14,13 @@ msgstr "" "X-Generator: KBabel 1.11.4\n" #. Tag: title +#: session_api.xml:31 #, no-c-format msgid "Working with objects" msgstr "オブジェクトを扱う" #. Tag: para +#: session_api.xml:33 #, no-c-format msgid "" "Hibernate is a full object/relational mapping solution that not only shields " @@ -35,6 +37,7 @@ msgstr "" "における永続化に対する、とても自然なオブジェクト指向の考え方を提供します。" #. Tag: para +#: session_api.xml:40 #, no-c-format msgid "" "In other words, Hibernate application developers should always think about " @@ -49,16 +52,19 @@ msgstr "" "ムのパフォーマンスをチューニングするときにだけ、問題になってきます。" #. Tag: title +#: session_api.xml:47 #, no-c-format msgid "Hibernate object states" msgstr "Hibernate におけるオブジェクトの状態" #. Tag: para +#: session_api.xml:49 #, no-c-format msgid "Hibernate defines and supports the following object states:" msgstr "Hibernate は次のようなオブジェクトの状態を定義し、サポートしています:" #. Tag: para +#: session_api.xml:53 #, no-c-format msgid "" "Transient - an object is transient if it has just been " @@ -81,6 +87,7 @@ msgstr "" "なる SQL 文の発行は、 Hibernate に任せましょう)。" #. Tag: para +#: session_api.xml:65 #, no-c-format msgid "" "Persistent - a persistent instance has a representation " @@ -102,6 +109,7 @@ msgstr "" "ません。" #. Tag: para +#: session_api.xml:77 #, no-c-format msgid "" "Detached - a detached instance is an object that has " @@ -126,6 +134,7 @@ msgstr "" "ち、ユーザーから見た作業単位だということです。" #. Tag: para +#: session_api.xml:90 #, no-c-format msgid "" "We will now discuss the states and state transitions (and the Hibernate " @@ -135,11 +144,13 @@ msgstr "" "について、詳細に述べます。" #. Tag: title +#: session_api.xml:95 #, no-c-format msgid "Making objects persistent" msgstr "オブジェクトを永続状態にする" #. Tag: para +#: session_api.xml:97 #, fuzzy, no-c-format msgid "" "Newly instantiated instances of a persistent class are considered " @@ -151,7 +162,24 @@ msgstr "" "づけることで、 transient インスタンスを 永続状態 (persistent) にできます。" +#. Tag: programlisting +#: session_api.xml:102 +#, fuzzy, no-c-format +msgid "" +"DomesticCat fritz = new DomesticCat();\n" +"fritz.setColor(Color.GINGER);\n" +"fritz.setSex('M');\n" +"fritz.setName(\"Fritz\");\n" +"Long generatedId = (Long) sess.save(fritz);" +msgstr "" +"DomesticCat fritz = new DomesticCat();\n" +"fritz.setColor(Color.GINGER);\n" +"fritz.setSex('M');\n" +"fritz.setName(\"Fritz\");\n" +"Long generatedId = (Long) sess.save(fritz);" + #. Tag: para +#: session_api.xml:104 #, no-c-format msgid "" "If Cat has a generated identifier, the identifier is " @@ -173,6 +201,7 @@ msgstr "" "も可能です。" #. Tag: para +#: session_api.xml:115 #, no-c-format msgid "" "persist() makes a transient instance persistent. However, " @@ -185,6 +214,7 @@ msgid "" msgstr "" #. Tag: para +#: session_api.xml:126 #, no-c-format msgid "" "save() does guarantee to return an identifier. If an " @@ -195,6 +225,7 @@ msgid "" msgstr "" #. Tag: para +#: session_api.xml:135 #, fuzzy, no-c-format msgid "" "Alternatively, you can assign the identifier using an overloaded version of " @@ -203,7 +234,28 @@ msgstr "" "代わりに、識別子を引数にとる save() メソッドを使って、識別" "子を割り当てることもできます。" +#. Tag: programlisting +#: session_api.xml:138 +#, fuzzy, no-c-format +msgid "" +"DomesticCat pk = new DomesticCat();\n" +"pk.setColor(Color.TABBY);\n" +"pk.setSex('F');\n" +"pk.setName(\"PK\");\n" +"pk.setKittens( new HashSet() );\n" +"pk.addKitten(fritz);\n" +"sess.save( pk, new Long(1234) );" +msgstr "" +"DomesticCat pk = new DomesticCat();\n" +"pk.setColor(Color.TABBY);\n" +"pk.setSex('F');\n" +"pk.setName(\"PK\");\n" +"pk.setKittens( new HashSet() );\n" +"pk.addKitten(fritz);\n" +"sess.save( pk, new Long(1234) );" + #. Tag: para +#: session_api.xml:140 #, no-c-format msgid "" "If the object you make persistent has associated objects (e.g. the " @@ -223,6 +275,7 @@ msgstr "" "ん。" #. Tag: para +#: session_api.xml:148 #, no-c-format msgid "" "Usually you do not bother with this detail, as you will normally use " @@ -238,11 +291,13 @@ msgstr "" "章の後半に書かれています。" #. Tag: title +#: session_api.xml:157 #, no-c-format msgid "Loading an object" msgstr "オブジェクトのロード" #. Tag: para +#: session_api.xml:159 #, no-c-format msgid "" "The load() methods of Session provide " @@ -256,13 +311,47 @@ msgstr "" "そのクラスのインスタンスを新たに生成し、状態をロードします。そのインスタンス" "の状態は、永続 (persistent) 状態です。" +#. Tag: programlisting +#: session_api.xml:165 +#, fuzzy, no-c-format +msgid "Cat fritz = (Cat) sess.load(Cat.class, generatedId);" +msgstr "Cat fritz = (Cat) sess.load(Cat.class, generatedId);" + +#. Tag: programlisting +#: session_api.xml:167 +#, fuzzy, no-c-format +msgid "" +"// you need to wrap primitive identifiers\n" +"long id = 1234;\n" +"DomesticCat pk = (DomesticCat) sess.load( DomesticCat.class, new Long(id) );" +msgstr "" +"// you need to wrap primitive identifiers\n" +"long id = 1234;\n" +"DomesticCat pk = (DomesticCat) sess.load( DomesticCat.class, new Long(id) );" + #. Tag: para +#: session_api.xml:169 #, no-c-format msgid "Alternatively, you can load state into a given instance:" msgstr "" "あるいは、以下のように、既存のインスタンスに状態をロードすることもできます:" +#. Tag: programlisting +#: session_api.xml:171 +#, fuzzy, no-c-format +msgid "" +"Cat cat = new DomesticCat();\n" +"// load pk's state into cat\n" +"sess.load( cat, new Long(pkId) );\n" +"Set kittens = cat.getKittens();" +msgstr "" +"Cat cat = new DomesticCat();\n" +"// load pk's state into cat\n" +"sess.load( cat, new Long(pkId) );\n" +"Set kittens = cat.getKittens();" + #. Tag: para +#: session_api.xml:173 #, no-c-format msgid "" "Be aware that load() will throw an unrecoverable " @@ -283,6 +372,7 @@ msgstr "" "定義されているならば、複数のインスタンスを一括でロードすることが可能です。" #. Tag: para +#: session_api.xml:182 #, no-c-format msgid "" "If you are not certain that a matching row exists, you should use the " @@ -293,7 +383,26 @@ msgstr "" "ソッドを使うべきです。それは、データベースにすぐにアクセスし、該当する行が無" "い場合は null を返します。" +#. Tag: programlisting +#: session_api.xml:186 +#, fuzzy, no-c-format +msgid "" +"Cat cat = (Cat) sess.get(Cat.class, id);\n" +"if (cat==null) {\n" +" cat = new Cat();\n" +" sess.save(cat, id);\n" +"}\n" +"return cat;" +msgstr "" +"Cat cat = (Cat) sess.get(Cat.class, id);\n" +"if (cat==null) {\n" +" cat = new Cat();\n" +" sess.save(cat, id);\n" +"}\n" +"return cat;" + #. Tag: para +#: session_api.xml:188 #, no-c-format msgid "" "You can even load an object using an SQL SELECT ... FOR UPDATE という SQL を使ってオブジェクトをロードすることができます。詳細な情" "報は、 API ドキュメントを参照してください。" +#. Tag: programlisting +#: session_api.xml:192 +#, fuzzy, no-c-format +msgid "Cat cat = (Cat) sess.get(Cat.class, id, LockMode.UPGRADE);" +msgstr "Cat cat = (Cat) sess.get(Cat.class, id, LockMode.UPGRADE);" + #. Tag: para +#: session_api.xml:194 #, no-c-format msgid "" "Any associated instances or contained collections will notSELECTs will it use? This depends on the " "fetching strategy. This is explained in ." +"\"performance-fetching\"/>." msgstr "" "大切な問題は、いつも次の点に関するものです。それは、 Hibernate がデータベース" "から、どのくらいの量を復元するのかと、どのくらいの数の SQL の " @@ -344,11 +474,13 @@ msgstr "" "fetching\"/> で説明しています。" #. Tag: title +#: session_api.xml:213 #, no-c-format msgid "Querying" msgstr "クエリ" #. Tag: para +#: session_api.xml:215 #, no-c-format msgid "" "If you do not know the identifiers of the objects you are looking for, you " @@ -366,11 +498,13 @@ msgstr "" "データベースのネイティブな SQL でクエリを表現することもできます。" #. Tag: title +#: session_api.xml:224 #, no-c-format msgid "Executing queries" msgstr "クエリの実行" #. Tag: para +#: session_api.xml:226 #, no-c-format msgid "" "HQL and native SQL queries are represented with an instance of org." @@ -385,7 +519,62 @@ msgstr "" "常、 Query は、以下に示すように、その時点の " "Session を使って取得します。" +#. Tag: programlisting +#: session_api.xml:232 +#, fuzzy, no-c-format +msgid "" +"List cats = session.createQuery(\n" +" \"from Cat as cat where cat.birthdate < ?\")\n" +" .setDate(0, date)\n" +" .list();\n" +"\n" +"List mothers = session.createQuery(\n" +" \"select mother from Cat as cat join cat.mother as mother where cat.name " +"= ?\")\n" +" .setString(0, name)\n" +" .list();\n" +"\n" +"List kittens = session.createQuery(\n" +" \"from Cat as cat where cat.mother = ?\")\n" +" .setEntity(0, pk)\n" +" .list();\n" +"\n" +"Cat mother = (Cat) session.createQuery(\n" +" \"select cat.mother from Cat as cat where cat = ?\")\n" +" .setEntity(0, izi)\n" +" .uniqueResult();]]\n" +"\n" +"Query mothersWithKittens = (Cat) session.createQuery(\n" +" \"select mother from Cat as mother left join fetch mother.kittens\");\n" +"Set uniqueMothers = new HashSet(mothersWithKittens.list());" +msgstr "" +"List cats = session.createQuery(\n" +" \"from Cat as cat where cat.birthdate < ?\")\n" +" .setDate(0, date)\n" +" .list();\n" +"\n" +"List mothers = session.createQuery(\n" +" \"select mother from Cat as cat join cat.mother as mother where cat.name " +"= ?\")\n" +" .setString(0, name)\n" +" .list();\n" +"\n" +"List kittens = session.createQuery(\n" +" \"from Cat as cat where cat.mother = ?\")\n" +" .setEntity(0, pk)\n" +" .list();\n" +"\n" +"Cat mother = (Cat) session.createQuery(\n" +" \"select cat.mother from Cat as cat where cat = ?\")\n" +" .setEntity(0, izi)\n" +" .uniqueResult();]]\n" +"\n" +"Query mothersWithKittens = (Cat) session.createQuery(\n" +" \"select mother from Cat as mother left join fetch mother.kittens\");\n" +"Set uniqueMothers = new HashSet(mothersWithKittens.list());" + #. Tag: para +#: session_api.xml:234 #, no-c-format msgid "" "A query is usually executed by invoking list(). The " @@ -407,11 +596,13 @@ msgstr "" "複は Set を使って取り除くことができます。" #. Tag: title +#: session_api.xml:244 #, no-c-format msgid "Iterating results" msgstr "結果をイテレートする" #. Tag: para +#: session_api.xml:246 #, no-c-format msgid "" "Occasionally, you might be able to achieve better performance by executing " @@ -434,12 +625,46 @@ msgstr "" "と、実際のインスタンスを初期化するために後から行う n回 " "の select のことです。" +#. Tag: programlisting +#: session_api.xml:257 +#, fuzzy, no-c-format +msgid "" +"// fetch ids\n" +"Iterator iter = sess.createQuery(\"from eg.Qux q order by q.likeliness\")." +"iterate();\n" +"while ( iter.hasNext() ) {\n" +" Qux qux = (Qux) iter.next(); // fetch the object\n" +" // something we couldnt express in the query\n" +" if ( qux.calculateComplicatedAlgorithm() ) {\n" +" // delete the current instance\n" +" iter.remove();\n" +" // dont need to process the rest\n" +" break;\n" +" }\n" +"}" +msgstr "" +"// fetch ids\n" +"Iterator iter = sess.createQuery(\"from eg.Qux q order by q.likeliness\")." +"iterate();\n" +"while ( iter.hasNext() ) {\n" +" Qux qux = (Qux) iter.next(); // fetch the object\n" +" // something we couldnt express in the query\n" +" if ( qux.calculateComplicatedAlgorithm() ) {\n" +" // delete the current instance\n" +" iter.remove();\n" +" // dont need to process the rest\n" +" break;\n" +" }\n" +"}" + #. Tag: title +#: session_api.xml:261 #, no-c-format msgid "Queries that return tuples" msgstr "オブジェクトの組(tuple)を返すクエリ" #. Tag: para +#: session_api.xml:263 #, no-c-format msgid "" "Hibernate queries sometimes return tuples of objects. Each tuple is returned " @@ -448,12 +673,44 @@ msgstr "" "Hibernate のクエリでは、時々、オブジェクトの組を返すことがあります。その場合" "は、各タプルは配列として返されます:" +#. Tag: programlisting +#: session_api.xml:266 +#, fuzzy, no-c-format +msgid "" +"Iterator kittensAndMothers = sess.createQuery(\n" +" \"select kitten, mother from Cat kitten join kitten.mother mother" +"\")\n" +" .list()\n" +" .iterator();\n" +"\n" +"while ( kittensAndMothers.hasNext() ) {\n" +" Object[] tuple = (Object[]) kittensAndMothers.next();\n" +" Cat kitten = (Cat) tuple[0];\n" +" Cat mother = (Cat) tuple[1];\n" +" ....\n" +"}" +msgstr "" +"Iterator kittensAndMothers = sess.createQuery(\n" +" \"select kitten, mother from Cat kitten join kitten.mother mother" +"\")\n" +" .list()\n" +" .iterator();\n" +"\n" +"while ( kittensAndMothers.hasNext() ) {\n" +" Object[] tuple = (Object[]) kittensAndMothers.next();\n" +" Cat kitten = tuple[0];\n" +" Cat mother = tuple[1];\n" +" ....\n" +"}" + #. Tag: title +#: session_api.xml:270 #, no-c-format msgid "Scalar results" msgstr "スカラーの結果" #. Tag: para +#: session_api.xml:272 #, no-c-format msgid "" "Queries can specify a property of a class in the select " @@ -464,12 +721,48 @@ msgstr "" "す。 SQL の集合関数を呼ぶこともできます。プロパティや集合関数は、(永続状態の" "エンティティではなく)「スカラー値」であると見なされます。" +#. Tag: programlisting +#: session_api.xml:277 +#, fuzzy, no-c-format +msgid "" +"Iterator results = sess.createQuery(\n" +" \"select cat.color, min(cat.birthdate), count(cat) from Cat cat \" " +"+\n" +" \"group by cat.color\")\n" +" .list()\n" +" .iterator();\n" +"\n" +"while ( results.hasNext() ) {\n" +" Object[] row = (Object[]) results.next();\n" +" Color type = (Color) row[0];\n" +" Date oldest = (Date) row[1];\n" +" Integer count = (Integer) row[2];\n" +" .....\n" +"}" +msgstr "" +"Iterator results = sess.createQuery(\n" +" \"select cat.color, min(cat.birthdate), count(cat) from Cat cat \" " +"+\n" +" \"group by cat.color\")\n" +" .list()\n" +" .iterator();\n" +"\n" +"while ( results.hasNext() ) {\n" +" Object[] row = (Object[]) results.next();\n" +" Color type = (Color) row[0];\n" +" Date oldest = (Date) row[1];\n" +" Integer count = (Integer) row[2];\n" +" .....\n" +"}" + #. Tag: title +#: session_api.xml:281 #, no-c-format msgid "Bind parameters" msgstr "パラメータのバインド" #. Tag: para +#: session_api.xml:283 #, no-c-format msgid "" "Methods on Query are provided for binding values to named " @@ -486,27 +779,84 @@ msgstr "" "です。" #. Tag: para +#: session_api.xml:292 #, no-c-format msgid "" "named parameters are insensitive to the order they occur in the query string" msgstr "名前付きパラメータは、クエリ文字列に登場する順番と無関係です" #. Tag: para +#: session_api.xml:297 #, no-c-format msgid "they can occur multiple times in the same query" msgstr "同じクエリ内に複数回登場することができます" #. Tag: para +#: session_api.xml:301 #, no-c-format msgid "they are self-documenting" msgstr "自分自身を説明します" +#. Tag: programlisting +#: session_api.xml:305 +#, fuzzy, no-c-format +msgid "" +"//named parameter (preferred)\n" +"Query q = sess.createQuery(\"from DomesticCat cat where cat.name = :name" +"\");\n" +"q.setString(\"name\", \"Fritz\");\n" +"Iterator cats = q.iterate();" +msgstr "" +"//named parameter (preferred)\n" +"Query q = sess.createQuery(\"from DomesticCat cat where cat.name = :name" +"\");\n" +"q.setString(\"name\", \"Fritz\");\n" +"Iterator cats = q.iterate();" + +#. Tag: programlisting +#: session_api.xml:307 +#, fuzzy, no-c-format +msgid "" +"//positional parameter\n" +"Query q = sess.createQuery(\"from DomesticCat cat where cat.name = ?\");\n" +"q.setString(0, \"Izi\");\n" +"Iterator cats = q.iterate();" +msgstr "" +"//positional parameter\n" +"Query q = sess.createQuery(\"from DomesticCat cat where cat.name = ?\");\n" +"q.setString(0, \"Izi\");\n" +"Iterator cats = q.iterate();" + +#. Tag: programlisting +#: session_api.xml:309 +#, fuzzy, no-c-format +msgid "" +"//named parameter list\n" +"List names = new ArrayList();\n" +"names.add(\"Izi\");\n" +"names.add(\"Fritz\");\n" +"Query q = sess.createQuery(\"from DomesticCat cat where cat.name in (:" +"namesList)\");\n" +"q.setParameterList(\"namesList\", names);\n" +"List cats = q.list();" +msgstr "" +"//named parameter list\n" +"List names = new ArrayList();\n" +"names.add(\"Izi\");\n" +"names.add(\"Fritz\");\n" +"Query q = sess.createQuery(\"from DomesticCat cat where cat.name in (:" +"namesList)\");\n" +"q.setParameterList(\"namesList\", names);\n" +"List cats = q.list();" + #. Tag: title +#: session_api.xml:313 #, no-c-format msgid "Pagination" msgstr "ページ分け" #. Tag: para +#: session_api.xml:315 #, no-c-format msgid "" "If you need to specify bounds upon your result set, that is, the maximum " @@ -517,7 +867,22 @@ msgstr "" "ば、以下のように、 Query インターフェースのメソッドを使い" "ます。" +#. Tag: programlisting +#: session_api.xml:320 +#, fuzzy, no-c-format +msgid "" +"Query q = sess.createQuery(\"from DomesticCat cat\");\n" +"q.setFirstResult(20);\n" +"q.setMaxResults(10);\n" +"List cats = q.list();" +msgstr "" +"Query q = sess.createQuery(\"from DomesticCat cat\");\n" +"q.setFirstResult(20);\n" +"q.setMaxResults(10);\n" +"List cats = q.list();" + #. Tag: para +#: session_api.xml:322 #, no-c-format msgid "" "Hibernate knows how to translate this limit query into the native SQL of " @@ -527,11 +892,13 @@ msgstr "" "知っています。" #. Tag: title +#: session_api.xml:327 #, no-c-format msgid "Scrollable iteration" msgstr "スクロール可能なイテレーション" #. Tag: para +#: session_api.xml:329 #, no-c-format msgid "" "If your JDBC driver supports scrollable ResultSets, the " @@ -544,7 +911,60 @@ msgstr "" "ScrollableResults オブジェクトを取得できます。それを使う" "と、クエリの結果に対して柔軟にナビゲーションできます。" +#. Tag: programlisting +#: session_api.xml:334 +#, fuzzy, no-c-format +msgid "" +"Query q = sess.createQuery(\"select cat.name, cat from DomesticCat cat \" +\n" +" \"order by cat.name\");\n" +"ScrollableResults cats = q.scroll();\n" +"if ( cats.first() ) {\n" +"\n" +" // find the first name on each page of an alphabetical list of cats by " +"name\n" +" firstNamesOfPages = new ArrayList();\n" +" do {\n" +" String name = cats.getString(0);\n" +" firstNamesOfPages.add(name);\n" +" }\n" +" while ( cats.scroll(PAGE_SIZE) );\n" +"\n" +" // Now get the first page of cats\n" +" pageOfCats = new ArrayList();\n" +" cats.beforeFirst();\n" +" int i=0;\n" +" while( ( PAGE_SIZE > i++ ) && cats.next() ) pageOfCats.add" +"( cats.get(1) );\n" +"\n" +"}\n" +"cats.close()" +msgstr "" +"Query q = sess.createQuery(\"select cat.name, cat from DomesticCat cat \" +\n" +" \"order by cat.name\");\n" +"ScrollableResults cats = q.scroll();\n" +"if ( cats.first() ) {\n" +"\n" +" // find the first name on each page of an alphabetical list of cats by " +"name\n" +" firstNamesOfPages = new ArrayList();\n" +" do {\n" +" String name = cats.getString(0);\n" +" firstNamesOfPages.add(name);\n" +" }\n" +" while ( cats.scroll(PAGE_SIZE) );\n" +"\n" +" // Now get the first page of cats\n" +" pageOfCats = new ArrayList();\n" +" cats.beforeFirst();\n" +" int i=0;\n" +" while( ( PAGE_SIZE > i++ ) && cats.next() ) pageOfCats.add" +"( cats.get(1) );\n" +"\n" +"}\n" +"cats.close()" + #. Tag: para +#: session_api.xml:336 #, no-c-format msgid "" "Note that an open database connection and cursor is required for this " @@ -557,28 +977,116 @@ msgstr "" "いましょう。" #. Tag: title +#: session_api.xml:343 #, no-c-format msgid "Externalizing named queries" msgstr "名前付きクエリの外出し" #. Tag: para +#: session_api.xml:345 #, no-c-format msgid "" -"You can also define named queries in the mapping document. Remember to use a " -"CDATA section if your query contains characters that " -"could be interpreted as markup." +"Queries can also be configured as so called named queries using annotations " +"or Hibernate mapping documents. @NamedQuery and " +"@NamedQueries can be defined at the class level as seen " +"in . However their " +"definitions are global to the session factory/entity manager factory scope. " +"A named query is defined by its name and the actual query string." +msgstr "" + +#. Tag: title +#: session_api.xml:355 +#, no-c-format +msgid "Defining a named query using @NamedQuery" +msgstr "" + +#. Tag: programlisting +#: session_api.xml:358 +#, no-c-format +msgid "" +"@Entity\n" +"@NamedQuery(name=\"night.moreRecentThan\", query=\"select n from Night n " +"where n.date >= :date\")\n" +"public class Night {\n" +" ...\n" +"}\n" +"\n" +"public class MyDao {\n" +" doStuff() {\n" +" Query q = s.getNamedQuery(\"night.moreRecentThan\");\n" +" q.setDate( \"date\", aMonthAgo );\n" +" List results = q.list();\n" +" ...\n" +" }\n" +" ...\n" +"}" +msgstr "" + +#. Tag: para +#: session_api.xml:361 +#, fuzzy, no-c-format +msgid "" +"Using a mapping document can be configured using the <query> node. Remember to use a CDATA section if your " +"query contains characters that could be interpreted as markup." msgstr "" "マッピングドキュメントに名前付きのクエリを定義することができます。(マーク" "アップと解釈される文字がクエリに含まれるなら、 CDATA セク" "ションを使うことを忘れないようにしましょう。)" -#. Tag: para +#. Tag: title +#: session_api.xml:367 #, no-c-format -msgid "Parameter binding and executing is done programatically:" +msgid "Defining a named query using <query>" +msgstr "" + +#. Tag: programlisting +#: session_api.xml:370 +#, fuzzy, no-c-format +msgid "" +"<query name=\"ByNameAndMaximumWeight\"><![CDATA[\n" +" from eg.DomesticCat as cat\n" +" where cat.name = ?\n" +" and cat.weight > ?\n" +"] ]></query>" +msgstr "" +"<query name=\"ByNameAndMaximumWeight\"><![CDATA[\n" +" from eg.DomesticCat as cat\n" +" where cat.name = ?\n" +" and cat.weight > ?\n" +"] ]></query>" + +#. Tag: para +#: session_api.xml:373 +#, fuzzy, no-c-format +msgid "" +"Parameter binding and executing is done programatically as seen in ." msgstr "" "パラメータのバインディングと実行は、以下のようなプログラムで行われます:" +#. Tag: title +#: session_api.xml:377 +#, no-c-format +msgid "Parameter binding of a named query" +msgstr "" + +#. Tag: programlisting +#: session_api.xml:379 +#, fuzzy, no-c-format +msgid "" +"Query q = sess.getNamedQuery(\"ByNameAndMaximumWeight\");\n" +"q.setString(0, name);\n" +"q.setInt(1, minWeight);\n" +"List cats = q.list();" +msgstr "" +"Query q = sess.getNamedQuery(\"ByNameAndMaximumWeight\");\n" +"q.setString(0, name);\n" +"q.setInt(1, minWeight);\n" +"List cats = q.list();" + #. Tag: para +#: session_api.xml:382 #, no-c-format msgid "" "The actual program code is independent of the query language that is used. " @@ -591,6 +1099,7 @@ msgstr "" "ます。" #. Tag: para +#: session_api.xml:387 #, no-c-format msgid "" "Also note that a query declaration inside a <hibernate-" @@ -606,11 +1115,13 @@ msgstr "" "ByNameAndMaximumWeight" #. Tag: title +#: session_api.xml:397 #, no-c-format msgid "Filtering collections" msgstr "フィルタリングコレクション" #. Tag: para +#: session_api.xml:399 #, no-c-format msgid "" "A collection filter is a special type of query that can " @@ -621,7 +1132,26 @@ msgstr "" "配列に適用される特殊なタイプのクエリです。そのクエリ文字列では、コレクション" "のその時点での要素を意味する this を使います。" +#. Tag: programlisting +#: session_api.xml:404 +#, fuzzy, no-c-format +msgid "" +"Collection blackKittens = session.createFilter(\n" +" pk.getKittens(), \n" +" \"where this.color = ?\")\n" +" .setParameter( Color.BLACK, Hibernate.custom(ColorUserType.class) )\n" +" .list()\n" +");" +msgstr "" +"Collection blackKittens = session.createFilter(\n" +" pk.getKittens(), \n" +" \"where this.color = ?\")\n" +" .setParameter( Color.BLACK, Hibernate.custom(ColorUserType.class) )\n" +" .list()\n" +");" + #. Tag: para +#: session_api.xml:406 #, no-c-format msgid "" "The returned collection is considered a bag that is a copy of the given " @@ -633,6 +1163,7 @@ msgstr "" "う名前の意味とは異なりますが、期待される動きとは一致しています)。" #. Tag: para +#: session_api.xml:411 #, no-c-format msgid "" "Observe that filters do not require a from clause, " @@ -643,7 +1174,22 @@ msgstr "" "なら、持つことも可能ですが)。フィルタは、コレクションの要素自体を返して構い" "ません。" +#. Tag: programlisting +#: session_api.xml:415 +#, fuzzy, no-c-format +msgid "" +"Collection blackKittenMates = session.createFilter(\n" +" pk.getKittens(), \n" +" \"select this.mate where this.color = eg.Color.BLACK.intValue\")\n" +" .list();" +msgstr "" +"Collection blackKittenMates = session.createFilter(\n" +" pk.getKittens(), \n" +" \"select this.mate where this.color = eg.Color.BLACK.intValue\")\n" +" .list();" + #. Tag: para +#: session_api.xml:417 #, no-c-format msgid "" "Even an empty filter query is useful, e.g. to load a subset of elements in a " @@ -652,12 +1198,28 @@ msgstr "" "クエリを含まないフィルタも役に立ちます。例えば、非常に大きなコレクションの部" "分集合をロードするために使えます。" +#. Tag: programlisting +#: session_api.xml:420 +#, fuzzy, no-c-format +msgid "" +"Collection tenKittens = session.createFilter(\n" +" mother.getKittens(), \"\")\n" +" .setFirstResult(0).setMaxResults(10)\n" +" .list();" +msgstr "" +"Collection tenKittens = session.createFilter(\n" +" mother.getKittens(), \"\")\n" +" .setFirstResult(0).setMaxResults(10)\n" +" .list();" + #. Tag: title +#: session_api.xml:424 #, no-c-format msgid "Criteria queries" msgstr "クライテリアのクエリ" #. Tag: para +#: session_api.xml:426 #, no-c-format msgid "" "HQL is extremely powerful, but some developers prefer to build queries " @@ -670,22 +1232,39 @@ msgstr "" "Hibernate は直感的な Criteria クエリ API を提供していま" "す。" +#. Tag: programlisting +#: session_api.xml:431 +#, fuzzy, no-c-format +msgid "" +"Criteria crit = session.createCriteria(Cat.class);\n" +"crit.add( Restrictions.eq( \"color\", eg.Color.BLACK ) );\n" +"crit.setMaxResults(10);\n" +"List cats = crit.list();" +msgstr "" +"Criteria crit = session.createCriteria(Cat.class);\n" +"crit.add( Expression.eq( \"color\", eg.Color.BLACK ) );\n" +"crit.setMaxResults(10);\n" +"List cats = crit.list();" + #. Tag: para +#: session_api.xml:433 #, fuzzy, no-c-format msgid "" "The Criteria and the associated Example API are discussed in more detail in ." +"literal> API are discussed in more detail in ." msgstr "" "CriteriaExample API の詳細は、 " " に述べられています。" #. Tag: title +#: session_api.xml:439 #, no-c-format msgid "Queries in native SQL" msgstr "ネイティブ SQL のクエリ" #. Tag: para +#: session_api.xml:441 #, no-c-format msgid "" "You can express a query in SQL, using createSQLQuery() " @@ -701,23 +1280,62 @@ msgstr "" "う。もし、 Hibernate API を使うのであれば、下記のように SQL の別名を括弧でく" "くらなければなりません。" +#. Tag: programlisting +#: session_api.xml:448 +#, fuzzy, no-c-format +msgid "" +"List cats = session.createSQLQuery(\"SELECT {cat.*} FROM CAT {cat} WHERE " +"ROWNUM<10\")\n" +" .addEntity(\"cat\", Cat.class)\n" +".list();" +msgstr "" +"List cats = session.createSQLQuery(\n" +" \"SELECT {cat.*} FROM CAT {cat} WHERE ROWNUM<10\",\n" +" \"cat\",\n" +" Cat.class\n" +").list();" + +#. Tag: programlisting +#: session_api.xml:450 +#, fuzzy, no-c-format +msgid "" +"List cats = session.createSQLQuery(\n" +" \"SELECT {cat}.ID AS {cat.id}, {cat}.SEX AS {cat.sex}, \" +\n" +" \"{cat}.MATE AS {cat.mate}, {cat}.SUBCLASS AS {cat.class}, ... \" " +"+\n" +" \"FROM CAT {cat} WHERE ROWNUM<10\")\n" +" .addEntity(\"cat\", Cat.class)\n" +".list()" +msgstr "" +"List cats = session.createSQLQuery(\n" +" \"SELECT {cat}.ID AS {cat.id}, {cat}.SEX AS {cat.sex}, \" +\n" +" \"{cat}.MATE AS {cat.mate}, {cat}.SUBCLASS AS {cat.class}, ... \" " +"+\n" +" \"FROM CAT {cat} WHERE ROWNUM<10\",\n" +" \"cat\",\n" +" Cat.class\n" +").list()" + #. Tag: para +#: session_api.xml:452 #, fuzzy, no-c-format msgid "" "SQL queries can contain named and positional parameters, just like Hibernate " "queries. More information about native SQL queries in Hibernate can be found " -"in ." +"in ." msgstr "" "SQL クエリは、 Hibernate クエリと同じように、名前付きのパラメータと位置パラ" "メータを持つことができます。 Hibernate におけるネイティブな SQL クエリの詳細" "については、 を参照してください。" #. Tag: title +#: session_api.xml:459 #, no-c-format msgid "Modifying persistent objects" msgstr "永続オブジェクトの修正" #. Tag: para +#: session_api.xml:461 #, no-c-format msgid "" "Transactional persistent instances (i.e. objects " @@ -740,7 +1358,20 @@ msgstr "" "クトを load() し、 Session をオープンに" "している間に、直接操作することです。" +#. Tag: programlisting +#: session_api.xml:473 +#, fuzzy, no-c-format +msgid "" +"DomesticCat cat = (DomesticCat) sess.load( Cat.class, new Long(69) );\n" +"cat.setName(\"PK\");\n" +"sess.flush(); // changes to cat are automatically detected and persisted" +msgstr "" +"DomesticCat cat = (DomesticCat) sess.load( Cat.class, new Long(69) );\n" +"cat.setName(\"PK\");\n" +"sess.flush(); // changes to cat are automatically detected and persisted" + #. Tag: para +#: session_api.xml:475 #, no-c-format msgid "" "Sometimes this programming model is inefficient, as it requires in the same " @@ -755,6 +1386,7 @@ msgstr "" "スタンスを使用する方法です。" #. Tag: para +#: session_api.xml:481 #, fuzzy, no-c-format msgid "" "Hibernate does not offer its own API for direct execution of " @@ -766,7 +1398,7 @@ msgid "" "the notion of mass operations conflicts with object/relational mapping for " "online transaction processing-oriented applications. Future versions of " "Hibernate can, however, provide special mass operation functions. See for some possible batch operation tricks." +"linkend=\"batch\"/> for some possible batch operation tricks." msgstr "" "Hibernate は、 UPDATE 文や DELETE 文を" "直接実行する API を用意していません。 Hibernate は、 ステートマネー" @@ -781,11 +1413,13 @@ msgstr "" "参照してください。" #. Tag: title +#: session_api.xml:497 #, no-c-format msgid "Modifying detached objects" msgstr "detached オブジェクトの修正" #. Tag: para +#: session_api.xml:499 #, no-c-format msgid "" "Many applications need to retrieve an object in one transaction, send it to " @@ -801,6 +1435,7 @@ msgstr "" "離性を保証するために、バージョンデータが通常使われます。" #. Tag: para +#: session_api.xml:505 #, no-c-format msgid "" "Hibernate supports this model by providing for reattachment of detached " @@ -811,7 +1446,36 @@ msgstr "" "() メソッドを使って、 detached インスタンスを再追加することで、この" "モデルに対応します。" +#. Tag: programlisting +#: session_api.xml:509 +#, fuzzy, no-c-format +msgid "" +"// in the first session\n" +"Cat cat = (Cat) firstSession.load(Cat.class, catId);\n" +"Cat potentialMate = new Cat();\n" +"firstSession.save(potentialMate);\n" +"\n" +"// in a higher layer of the application\n" +"cat.setMate(potentialMate);\n" +"\n" +"// later, in a new session\n" +"secondSession.update(cat); // update cat\n" +"secondSession.update(mate); // update mate" +msgstr "" +"// in the first session\n" +"Cat cat = (Cat) firstSession.load(Cat.class, catId);\n" +"Cat potentialMate = new Cat();\n" +"firstSession.save(potentialMate);\n" +"\n" +"// in a higher layer of the application\n" +"cat.setMate(potentialMate);\n" +"\n" +"// later, in a new session\n" +"secondSession.update(cat); // update cat\n" +"secondSession.update(mate); // update mate" + #. Tag: para +#: session_api.xml:511 #, no-c-format msgid "" "If the Cat with identifier catId had " @@ -823,6 +1487,7 @@ msgstr "" "ときに、例外が投げられます。" #. Tag: para +#: session_api.xml:516 #, no-c-format msgid "" "Use update() if you are certain that the session does not " @@ -841,13 +1506,14 @@ msgstr "" "のなかで最初に呼ばれるメソッドになります。" #. Tag: para +#: session_api.xml:524 #, fuzzy, no-c-format msgid "" "The application should individually update() detached " "instances that are reachable from the given detached instance " "only if it wants their state to be updated. This can be " "automated using transitive persistence. See for more information." +"linkend=\"objectstate-transitive\"/> for more information." msgstr "" "detached インスタンスから到達可能な、 detached インスタンスをアプリケーション" "は個別に update() すべきです。それは、その状態を更新したい" @@ -856,6 +1522,7 @@ msgstr "" "を参照してください。" #. Tag: para +#: session_api.xml:530 #, no-c-format msgid "" "The lock() method also allows an application to " @@ -866,7 +1533,26 @@ msgstr "" "再関連付けできます。しかし、 detached インスタンスは無修正でなければなりませ" "ん。" +#. Tag: programlisting +#: session_api.xml:534 +#, fuzzy, no-c-format +msgid "" +"//just reassociate:\n" +"sess.lock(fritz, LockMode.NONE);\n" +"//do a version check, then reassociate:\n" +"sess.lock(izi, LockMode.READ);\n" +"//do a version check, using SELECT ... FOR UPDATE, then reassociate:\n" +"sess.lock(pk, LockMode.UPGRADE);" +msgstr "" +"//just reassociate:\n" +"sess.lock(fritz, LockMode.NONE);\n" +"//do a version check, then reassociate:\n" +"sess.lock(izi, LockMode.READ);\n" +"//do a version check, using SELECT ... FOR UPDATE, then reassociate:\n" +"sess.lock(pk, LockMode.UPGRADE);" + #. Tag: para +#: session_api.xml:536 #, no-c-format msgid "" "Note that lock() can be used with various " @@ -880,20 +1566,23 @@ msgstr "" "はありません。" #. Tag: para +#: session_api.xml:541 #, fuzzy, no-c-format msgid "" "Other models for long units of work are discussed in ." +"\"transactions-optimistic\"/>." msgstr "" "期間の長い作業単位の、その他のモデルは、 で述べています。" #. Tag: title +#: session_api.xml:546 #, no-c-format msgid "Automatic state detection" msgstr "自動的な状態検出" #. Tag: para +#: session_api.xml:548 #, no-c-format msgid "" "Hibernate users have requested a general purpose method that either saves a " @@ -907,7 +1596,38 @@ msgstr "" "することのできるメソッドです。 saveOrUpdate() はこのような" "機能を実現したメソッドです。" +#. Tag: programlisting +#: session_api.xml:554 +#, fuzzy, no-c-format +msgid "" +"// in the first session\n" +"Cat cat = (Cat) firstSession.load(Cat.class, catID);\n" +"\n" +"// in a higher tier of the application\n" +"Cat mate = new Cat();\n" +"cat.setMate(mate);\n" +"\n" +"// later, in a new session\n" +"secondSession.saveOrUpdate(cat); // update existing state (cat has a non-" +"null id)\n" +"secondSession.saveOrUpdate(mate); // save the new instance (mate has a null " +"id)" +msgstr "" +"// in the first session\n" +"Cat cat = (Cat) firstSession.load(Cat.class, catID);\n" +"\n" +"// in a higher tier of the application\n" +"Cat mate = new Cat();\n" +"cat.setMate(mate);\n" +"\n" +"// later, in a new session\n" +"secondSession.saveOrUpdate(cat); // update existing state (cat has a non-" +"null id)\n" +"secondSession.saveOrUpdate(mate); // save the new instance (mate has a null " +"id)" + #. Tag: para +#: session_api.xml:556 #, no-c-format msgid "" "The usage and semantics of saveOrUpdate() seems to be " @@ -925,6 +1645,7 @@ msgstr "" "もあります。" #. Tag: para +#: session_api.xml:563 #, no-c-format msgid "" "Usually update() or saveOrUpdate() are " @@ -934,26 +1655,31 @@ msgstr "" "のシナリオで使われます:" #. Tag: para +#: session_api.xml:569 #, no-c-format msgid "the application loads an object in the first session" msgstr "アプリケーションが最初のセッションでオブジェクトをロードします。" #. Tag: para +#: session_api.xml:573 #, no-c-format msgid "the object is passed up to the UI tier" msgstr "オブジェクトが UI 層に送られます。" #. Tag: para +#: session_api.xml:577 #, no-c-format msgid "some modifications are made to the object" msgstr "オブジェクトに対して変更が加えられます。" #. Tag: para +#: session_api.xml:581 #, no-c-format msgid "the object is passed back down to the business logic tier" msgstr "オブジェクトがビジネスロジック層に送られます。" #. Tag: para +#: session_api.xml:585 #, no-c-format msgid "" "the application persists these modifications by calling update()saveOrUpdate() does the following:" msgstr "saveOrUpdate() は以下のことを行います:" #. Tag: para +#: session_api.xml:594 #, no-c-format msgid "if the object is already persistent in this session, do nothing" msgstr "" "オブジェクトがこのセッションで、すでに永続化されていれば、何もしません。" #. Tag: para +#: session_api.xml:599 #, no-c-format msgid "" "if another object associated with the session has the same identifier, throw " @@ -983,12 +1712,14 @@ msgstr "" "例外を投げます。" #. Tag: para +#: session_api.xml:604 #, no-c-format msgid "if the object has no identifier property, save() it" msgstr "" "オブジェクトの識別子が値を持たないならば、 save() します。" #. Tag: para +#: session_api.xml:609 #, no-c-format msgid "" "if the object's identifier has the value assigned to a newly instantiated " @@ -998,6 +1729,7 @@ msgstr "" "トのための値である場合、そのオブジェクトを save() します。" #. Tag: para +#: session_api.xml:614 #, no-c-format msgid "" "if the object is versioned by a <version> or " @@ -1011,17 +1743,20 @@ msgstr "" "ある場合、そのオブジェクトを save() します。" #. Tag: para +#: session_api.xml:622 #, no-c-format msgid "otherwise update() the object" msgstr "" "そうでない場合は、そのオブジェクトを update() します。" #. Tag: para +#: session_api.xml:626 #, no-c-format msgid "and merge() is very different:" msgstr "そして、 merge() は以下のように非常に異なります:" #. Tag: para +#: session_api.xml:630 #, no-c-format msgid "" "if there is a persistent instance with the same identifier currently " @@ -1032,6 +1767,7 @@ msgstr "" "ば、引数で受け取ったオブジェクトの状態を永続化インスタンスにコピーします。" #. Tag: para +#: session_api.xml:636 #, no-c-format msgid "" "if there is no persistent instance currently associated with the session, " @@ -1041,11 +1777,13 @@ msgstr "" "からそれをロードするか、あるいは、新しい永続化インスタンスを作成します。" #. Tag: para +#: session_api.xml:642 #, no-c-format msgid "the persistent instance is returned" msgstr "永続化インスタンスが返されます。" #. Tag: para +#: session_api.xml:646 #, no-c-format msgid "" "the given instance does not become associated with the session, it remains " @@ -1055,11 +1793,13 @@ msgstr "" "のままです。" #. Tag: title +#: session_api.xml:653 #, no-c-format msgid "Deleting persistent objects" msgstr "永続オブジェクトの削除" #. Tag: para +#: session_api.xml:655 #, no-c-format msgid "" "Session.delete() will remove an object's state from the " @@ -1072,7 +1812,14 @@ msgstr "" "よいです。そのため、 delete() は永続インスタンスを " "transient にするものと考えるのが一番です。" +#. Tag: programlisting +#: session_api.xml:660 +#, fuzzy, no-c-format +msgid "sess.delete(cat);" +msgstr "sess.delete(cat);" + #. Tag: para +#: session_api.xml:662 #, no-c-format msgid "" "You can delete objects in any order, without risk of foreign key constraint " @@ -1086,11 +1833,13 @@ msgstr "" "ジェクトを削除したときに、子供オブジェクトを削除し忘れた場合です。" #. Tag: title +#: session_api.xml:670 #, no-c-format msgid "Replicating object between two different datastores" msgstr "異なる二つのデータストア間でのオブジェクトのレプリケーション" #. Tag: para +#: session_api.xml:672 #, no-c-format msgid "" "It is sometimes useful to be able to take a graph of persistent instances " @@ -1100,7 +1849,40 @@ msgstr "" "永続インスタンスのグラフを別のデータストアに永続化する場合に、識別子の値を再" "生成せずにすむと便利な場合があります。" +#. Tag: programlisting +#: session_api.xml:676 +#, fuzzy, no-c-format +msgid "" +"//retrieve a cat from one database\n" +"Session session1 = factory1.openSession();\n" +"Transaction tx1 = session1.beginTransaction();\n" +"Cat cat = session1.get(Cat.class, catId);\n" +"tx1.commit();\n" +"session1.close();\n" +"\n" +"//reconcile with a second database\n" +"Session session2 = factory2.openSession();\n" +"Transaction tx2 = session2.beginTransaction();\n" +"session2.replicate(cat, ReplicationMode.LATEST_VERSION);\n" +"tx2.commit();\n" +"session2.close();" +msgstr "" +"//retrieve a cat from one database\n" +"Session session1 = factory1.openSession();\n" +"Transaction tx1 = session1.beginTransaction();\n" +"Cat cat = session1.get(Cat.class, catId);\n" +"tx1.commit();\n" +"session1.close();\n" +"\n" +"//reconcile with a second database\n" +"Session session2 = factory2.openSession();\n" +"Transaction tx2 = session2.beginTransaction();\n" +"session2.replicate(cat, ReplicationMode.LATEST_VERSION);\n" +"tx2.commit();\n" +"session2.close();" + #. Tag: para +#: session_api.xml:678 #, no-c-format msgid "" "The ReplicationMode determines how replicate()ReplicationMode.IGNORE: ignores the object when there is " @@ -1120,6 +1903,7 @@ msgstr "" "に存在するなら、そのオブジェクトを無視します。" #. Tag: para +#: session_api.xml:689 #, no-c-format msgid "" "ReplicationMode.OVERWRITE: overwrites any existing " @@ -1129,6 +1913,7 @@ msgstr "" "て上書きします。" #. Tag: para +#: session_api.xml:694 #, no-c-format msgid "" "ReplicationMode.EXCEPTION: throws an exception if there " @@ -1138,6 +1923,7 @@ msgstr "" "スに存在するなら、例外を投げます。" #. Tag: para +#: session_api.xml:700 #, no-c-format msgid "" "ReplicationMode.LATEST_VERSION: overwrites the row if its " @@ -1149,6 +1935,7 @@ msgstr "" "きします。" #. Tag: para +#: session_api.xml:706 #, no-c-format msgid "" "Usecases for this feature include reconciling data entered into different " @@ -1161,11 +1948,13 @@ msgstr "" "ンザクションのなかで加えられた変更のロールバックなどです。" #. Tag: title +#: session_api.xml:713 #, no-c-format msgid "Flushing the Session" msgstr "セッションのフラッシュ" #. Tag: para +#: session_api.xml:715 #, no-c-format msgid "" "Sometimes the Session will execute the SQL statements " @@ -1178,26 +1967,31 @@ msgstr "" "処理 flush は、デフォルトでは次のときに起こります。" #. Tag: para +#: session_api.xml:723 #, no-c-format msgid "before some query executions" msgstr "クエリを実行する前" #. Tag: para +#: session_api.xml:727 #, no-c-format msgid "from org.hibernate.Transaction.commit()" msgstr "org.hibernate.Transaction.commit() を実行したとき" #. Tag: para +#: session_api.xml:732 #, no-c-format msgid "from Session.flush()" msgstr "Session.flush() を実行したとき" #. Tag: para +#: session_api.xml:736 #, no-c-format msgid "The SQL statements are issued in the following order:" msgstr "SQL 文は以下の順番で発行されます。" #. Tag: para +#: session_api.xml:740 #, no-c-format msgid "" "all entity insertions in the same order the corresponding objects were saved " @@ -1207,26 +2001,31 @@ msgstr "" "てセーブしたオブジェクトの順に実行していきます。" #. Tag: para +#: session_api.xml:745 #, no-c-format msgid "all entity updates" msgstr "すべてのエンティティの更新" #. Tag: para +#: session_api.xml:749 #, no-c-format msgid "all collection deletions" msgstr "すべてのコレクションの削除" #. Tag: para +#: session_api.xml:753 #, no-c-format msgid "all collection element deletions, updates and insertions" msgstr "すべてのコレクションの要素に対する削除、更新、挿入" #. Tag: para +#: session_api.xml:757 #, no-c-format msgid "all collection insertions" msgstr "すべてのコレクションの挿入" #. Tag: para +#: session_api.xml:761 #, no-c-format msgid "" "all entity deletions in the same order the corresponding objects were " @@ -1236,6 +2035,7 @@ msgstr "" "使って削除したオブジェクトの順に実行していきます。" #. Tag: para +#: session_api.xml:766 #, no-c-format msgid "" "An exception is that objects using native ID generation " @@ -1245,6 +2045,7 @@ msgstr "" "は、それらがセーブされたときに挿入されます。)" #. Tag: para +#: session_api.xml:769 #, no-c-format msgid "" "Except when you explicitly flush(), there are absolutely " @@ -1260,6 +2061,7 @@ msgstr "" "データや間違ったデータ返さないことを保証しています。" #. Tag: para +#: session_api.xml:776 #, fuzzy, no-c-format msgid "" "It is possible to change the default behavior so that flush occurs less " @@ -1269,7 +2071,7 @@ msgid "" "never flush unless flush() is called explicitly. The last " "mode is useful for long running units of work, where a Session is kept open and disconnected for a long time (see )." +"\"transactions-optimistic-longsession\"/>)." msgstr "" "フラッシュが頻繁に起こらないようにデフォルトの振る舞いを変えることができま" "す。 FlushMode クラスは3つの異なるモードを定義します。それ" @@ -1280,13 +2082,48 @@ msgstr "" "役に立ちます ( を参照" "してください)。" +#. Tag: programlisting +#: session_api.xml:786 +#, fuzzy, no-c-format +msgid "" +"sess = sf.openSession();\n" +"Transaction tx = sess.beginTransaction();\n" +"sess.setFlushMode(FlushMode.COMMIT); // allow queries to return stale state\n" +"\n" +"Cat izi = (Cat) sess.load(Cat.class, id);\n" +"izi.setName(iznizi);\n" +"\n" +"// might return stale data\n" +"sess.find(\"from Cat as cat left outer join cat.kittens kitten\");\n" +"\n" +"// change to izi is not flushed!\n" +"...\n" +"tx.commit(); // flush occurs\n" +"sess.close();" +msgstr "" +"sess = sf.openSession();\n" +"Transaction tx = sess.beginTransaction();\n" +"sess.setFlushMode(FlushMode.COMMIT); // allow queries to return stale state\n" +"\n" +"Cat izi = (Cat) sess.load(Cat.class, id);\n" +"izi.setName(iznizi);\n" +"\n" +"// might return stale data\n" +"sess.find(\"from Cat as cat left outer join cat.kittens kitten\");\n" +"\n" +"// change to izi is not flushed!\n" +"...\n" +"tx.commit(); // flush occurs\n" +"sess.close();" + #. Tag: para +#: session_api.xml:788 #, fuzzy, no-c-format msgid "" "During flush, an exception might occur (e.g. if a DML operation violates a " "constraint). Since handling exceptions involves some understanding of " "Hibernate's transactional behavior, we discuss it in ." +"\"transactions\"/>." msgstr "" "フラッシュのとき、例外が発生するかもしれません(例えば、 DML 操作が制約を違反" "するような場合です)。例外処理を理解するためには、 Hibernate のトランザクショ" @@ -1294,11 +2131,13 @@ msgstr "" "明します。" #. Tag: title +#: session_api.xml:795 #, no-c-format msgid "Transitive persistence" msgstr "連鎖的な永続化" #. Tag: para +#: session_api.xml:797 #, no-c-format msgid "" "It is quite cumbersome to save, delete, or reattach individual objects, " @@ -1310,6 +2149,7 @@ msgstr "" "は、親子関係を扱うケースです。以下の例を考えてみましょう:" #. Tag: para +#: session_api.xml:802 #, no-c-format msgid "" "If the children in a parent/child relationship would be value typed (e.g. a " @@ -1330,6 +2170,7 @@ msgstr "" "を共有できないので、データベースからその子供を削除します。" #. Tag: para +#: session_api.xml:812 #, no-c-format msgid "" "Now consider the same scenario with parent and child objects being entities, " @@ -1349,6 +2190,7 @@ msgstr "" "よる永続化 をデフォルトでは実行しません。" #. Tag: para +#: session_api.xml:820 #, no-c-format msgid "" "For each basic operation of the Hibernate session - including " @@ -1367,12 +2209,26 @@ msgstr "" "沿ってカスケードさせたい操作があるなら、マッピングファイルにそう指定しなけれ" "ばなりません。例えば、以下のようにします:" +#. Tag: programlisting +#: session_api.xml:828 +#, fuzzy, no-c-format +msgid "<one-to-one name=\"person\" cascade=\"persist\"/>" +msgstr "<one-to-one name=\"person\" cascade=\"persist\"/>" + #. Tag: para +#: session_api.xml:830 #, no-c-format msgid "Cascade styles my be combined:" msgstr "カスケードスタイルは、組み合わせることができます:" +#. Tag: programlisting +#: session_api.xml:832 +#, fuzzy, no-c-format +msgid "<one-to-one name=\"person\" cascade=\"persist,delete,lock\"/>" +msgstr "<one-to-one name=\"person\" cascade=\"persist,delete,lock\"/>" + #. Tag: para +#: session_api.xml:834 #, no-c-format msgid "" "You can even use cascade=\"all\" to specify that " @@ -1386,29 +2242,133 @@ msgstr "" "します。" #. Tag: para +#: session_api.xml:839 +#, no-c-format +msgid "" +"In case you are using annotatons you probably have noticed the " +"cascade attribute taking an array of " +"CascadeType as a value. The cascade concept in JPA is " +"very is similar to the transitive persistence and cascading of operations as " +"described above, but with slightly different semantics and cascading types:" +msgstr "" + +#. Tag: para +#: session_api.xml:848 +#, no-c-format +msgid "" +"CascadeType.PERSIST: cascades the persist (create) " +"operation to associated entities persist() is called or if the entity is " +"managed" +msgstr "" + +#. Tag: para +#: session_api.xml:854 +#, no-c-format +msgid "" +"CascadeType.MERGE: cascades the merge operation to " +"associated entities if merge() is called or if the entity is managed" +msgstr "" + +#. Tag: para +#: session_api.xml:860 +#, no-c-format +msgid "" +"CascadeType.REMOVE: cascades the remove operation to " +"associated entities if delete() is called" +msgstr "" + +#. Tag: para +#: session_api.xml:865 +#, no-c-format +msgid "" +"CascadeType.REFRESH: cascades the refresh operation to " +"associated entities if refresh() is called" +msgstr "" + +#. Tag: para +#: session_api.xml:870 +#, no-c-format +msgid "" +"CascadeType.DETACH: cascades the detach operation to " +"associated entities if detach() is called" +msgstr "" + +#. Tag: para +#: session_api.xml:875 +#, fuzzy, no-c-format +msgid "CascadeType.ALL: all of the above" +msgstr "saveOrUpdate() は以下のことを行います:" + +#. Tag: para +#: session_api.xml:880 +#, no-c-format +msgid "" +"CascadeType.ALL also covers Hibernate specific operations like save-update, " +"lock etc..." +msgstr "" + +#. Tag: para +#: session_api.xml:884 #, no-c-format msgid "" "A special cascade style, delete-orphan, applies only to " "one-to-many associations, and indicates that the delete() " "operation should be applied to any child object that is removed from the " -"association." +"association. Using annotations there is no CascadeType.DELETE-" +"ORPHAN equivalent. Instead you can use the attribute " +"orphanRemoval as seen in . If an entity is removed from a " +"@OneToMany collection or an associated entity is " +"dereferenced from a @OneToOne association, this " +"associated entity can be marked for deletion if orphanRemoval is set to true." +msgstr "" + +#. Tag: title +#: session_api.xml:897 +#, no-c-format +msgid "@OneToMany with orphanRemoval" +msgstr "" + +#. Tag: programlisting +#: session_api.xml:900 +#, no-c-format +msgid "" +"@Entity \n" +"public class Customer {\n" +" private Set<Order> orders;\n" +"\n" +" @OneToMany(cascade=CascadeType.ALL, orphanRemoval=true) \n" +" public Set<Order> getOrders() { return orders; }\n" +"\n" +" public void setOrders(Set<Order> orders) { this.orders = orders; }\n" +"\n" +" [...]\n" +"}\n" +"\n" +"@Entity \n" +"public class Order { ... }\n" +"\n" +"Customer customer = em.find(Customer.class, 1l);\n" +"Order order = em.find(Order.class, 1l);\n" +"customer.getOrders().remove(order); //order will be deleted by cascade" msgstr "" -"特殊なカスケードスタイル delete-orphan は、一対多関連にだ" -"け適用できます。これは、関連から削除された子供のオブジェクトに対して、 " -"delete() 操作が適用されることを意味します。" #. Tag: para +#: session_api.xml:903 #, no-c-format msgid "Recommendations:" msgstr "おすすめ:" #. Tag: para -#, no-c-format +#: session_api.xml:907 +#, fuzzy, no-c-format msgid "" -"It does not usually make sense to enable cascade on a <many-to-" -"one> or <many-to-many> association. " -"Cascade is often useful for <one-to-one> and " -"<one-to-many> associations." +"It does not usually make sense to enable cascade on a many-to-one or many-to-" +"many association. In fact the @ManyToOne and " +"@ManyToMany don't even offer a orphanRemoval attribute. Cascading is often useful for one-to-one and one-to-many " +"associations." msgstr "" "普通、 <many-to-one><many-to-" "many> 関連に対しては、カスケードを設定する意味はありません。 " @@ -1416,17 +2376,20 @@ msgstr "" "literal> 関連に対しては、カスケードが役に立つことがあります。" #. Tag: para -#, no-c-format +#: session_api.xml:915 +#, fuzzy, no-c-format msgid "" "If the child object's lifespan is bounded by the lifespan of the parent " "object, make it a life cycle object by specifying " -"cascade=\"all,delete-orphan\"." +"cascade=\"all,delete-orphan\"(@OneToMany" +"(cascade=CascadeType.ALL, orphanRemoval=true))." msgstr "" "子供オブジェクトの寿命が親オブジェクトの寿命に制限を受けるならば、 " "cascade=\"all,delete-orphan\" を指定し、子供オブジェクト" "を ライフサイクルオブジェクト にします。" #. Tag: para +#: session_api.xml:923 #, no-c-format msgid "" "Otherwise, you might not need cascade at all. But if you think that you will " @@ -1440,6 +2403,7 @@ msgstr "" "literal> を使うことを考えましょう。" #. Tag: para +#: session_api.xml:931 #, no-c-format msgid "" "Mapping an association (either a single valued association, or a collection) " @@ -1452,15 +2416,16 @@ msgstr "" "のセーブ/更新/削除が、子のセーブ/更新/削除を引き起こす関係のことです。" #. Tag: para -#, no-c-format +#: session_api.xml:937 +#, fuzzy, no-c-format msgid "" "Furthermore, a mere reference to a child from a persistent parent will " "result in save/update of the child. This metaphor is incomplete, however. A " "child which becomes unreferenced by its parent is not " -"automatically deleted, except in the case of a <one-to-many> association mapped with cascade=\"delete-orphan\". The precise semantics of cascading operations for a parent/child " -"relationship are as follows:" +"automatically deleted, except in the case of a one-to-many association " +"mapped with cascade=\"delete-orphan\". The precise " +"semantics of cascading operations for a parent/child relationship are as " +"follows:" msgstr "" "さらに、永続化された親が子を単に参照しているだけで、子のセーブ/更新を引き起こ" "します。しかし、このメタファーは不完全です。親から参照されなくなった子は、自" @@ -1470,6 +2435,7 @@ msgstr "" "なります:" #. Tag: para +#: session_api.xml:948 #, no-c-format msgid "" "If a parent is passed to persist(), all children are " @@ -1479,6 +2445,7 @@ msgstr "" "persist() に渡されます。" #. Tag: para +#: session_api.xml:953 #, no-c-format msgid "" "If a parent is passed to merge(), all children are passed " @@ -1488,6 +2455,7 @@ msgstr "" "literal> に渡されます。" #. Tag: para +#: session_api.xml:958 #, no-c-format msgid "" "If a parent is passed to save(), update()saveOrUpdate() に渡されます。" #. Tag: para +#: session_api.xml:964 #, no-c-format msgid "" "If a transient or detached child becomes referenced by a persistent parent, " @@ -1508,6 +2477,7 @@ msgstr "" "saveOrUpdate() に渡されます。" #. Tag: para +#: session_api.xml:970 #, no-c-format msgid "" "If a parent is deleted, all children are passed to delete()nothing special " @@ -1530,6 +2501,7 @@ msgstr "" "きます。この場合、「親のない」子は削除されます。" #. Tag: para +#: session_api.xml:983 #, no-c-format msgid "" "Finally, note that cascading of operations can be applied to an object graph " @@ -1548,11 +2520,13 @@ msgstr "" "エンティティに伝播します。" #. Tag: title +#: session_api.xml:993 #, no-c-format msgid "Using metadata" msgstr "メタデータの使用" #. Tag: para +#: session_api.xml:995 #, no-c-format msgid "" "Hibernate requires a rich meta-level model of all entity and value types. " @@ -1571,6 +2545,7 @@ msgstr "" "るものです。" #. Tag: para +#: session_api.xml:1002 #, no-c-format msgid "" "Hibernate exposes metadata via the ClassMetadata and " @@ -1583,650 +2558,48 @@ msgstr "" "literal> 階層を通してメタデータを公開します。メタデータインターフェースのイン" "スタンスは、 SessionFactory から得られます。" -#, fuzzy +#. Tag: programlisting +#: session_api.xml:1007 +#, fuzzy, no-c-format +msgid "" +"Cat fritz = ......;\n" +"ClassMetadata catMeta = sessionfactory.getClassMetadata(Cat.class);\n" +"\n" +"Object[] propertyValues = catMeta.getPropertyValues(fritz);\n" +"String[] propertyNames = catMeta.getPropertyNames();\n" +"Type[] propertyTypes = catMeta.getPropertyTypes();\n" +"\n" +"// get a Map of all properties which are not collections or associations\n" +"Map namedValues = new HashMap();\n" +"for ( int i=0; i<propertyNames.length; i++ ) {\n" +" if ( !propertyTypes[i].isEntityType() && !propertyTypes[i]." +"isCollectionType() ) {\n" +" namedValues.put( propertyNames[i], propertyValues[i] );\n" +" }\n" +"}" +msgstr "" +"Cat fritz = ......;\n" +"ClassMetadata catMeta = sessionfactory.getClassMetadata(Cat.class);\n" +"\n" +"Object[] propertyValues = catMeta.getPropertyValues(fritz);\n" +"String[] propertyNames = catMeta.getPropertyNames();\n" +"Type[] propertyTypes = catMeta.getPropertyTypes();\n" +"\n" +"// get a Map of all properties which are not collections or associations\n" +"Map namedValues = new HashMap();\n" +"for ( int i=0; i<propertyNames.length; i++ ) {\n" +" if ( !propertyTypes[i].isEntityType() && !propertyTypes[i]." +"isCollectionType() ) {\n" +" namedValues.put( propertyNames[i], propertyValues[i] );\n" +" }\n" +"}" + #~ msgid "" -#~ "" +#~ "A special cascade style, delete-orphan, applies only " +#~ "to one-to-many associations, and indicates that the delete() operation should be applied to any child object that is removed " +#~ "from the association." #~ msgstr "" -#~ "DomesticCat fritz = new DomesticCat();\n" -#~ "fritz.setColor(Color.GINGER);\n" -#~ "fritz.setSex('M');\n" -#~ "fritz.setName(\"Fritz\");\n" -#~ "Long generatedId = (Long) sess.save(fritz);" - -#, fuzzy -#~ msgid "" -#~ "" -#~ msgstr "" -#~ "DomesticCat pk = new DomesticCat();\n" -#~ "pk.setColor(Color.TABBY);\n" -#~ "pk.setSex('F');\n" -#~ "pk.setName(\"PK\");\n" -#~ "pk.setKittens( new HashSet() );\n" -#~ "pk.addKitten(fritz);\n" -#~ "sess.save( pk, new Long(1234) );" - -#, fuzzy -#~ msgid "" -#~ msgstr "Cat fritz = (Cat) sess.load(Cat.class, generatedId);" - -#, fuzzy -#~ msgid "" -#~ "" -#~ msgstr "" -#~ "// you need to wrap primitive identifiers\n" -#~ "long id = 1234;\n" -#~ "DomesticCat pk = (DomesticCat) sess.load( DomesticCat.class, new Long" -#~ "(id) );" - -#, fuzzy -#~ msgid "" -#~ "" -#~ msgstr "" -#~ "Cat cat = new DomesticCat();\n" -#~ "// load pk's state into cat\n" -#~ "sess.load( cat, new Long(pkId) );\n" -#~ "Set kittens = cat.getKittens();" - -#, fuzzy -#~ msgid "" -#~ "" -#~ msgstr "" -#~ "Cat cat = (Cat) sess.get(Cat.class, id);\n" -#~ "if (cat==null) {\n" -#~ " cat = new Cat();\n" -#~ " sess.save(cat, id);\n" -#~ "}\n" -#~ "return cat;" - -#, fuzzy -#~ msgid "" -#~ "" -#~ msgstr "Cat cat = (Cat) sess.get(Cat.class, id, LockMode.UPGRADE);" - -#, fuzzy -#~ msgid "" -#~ "" -#~ msgstr "" -#~ "sess.save(cat);\n" -#~ "sess.flush(); //force the SQL INSERT\n" -#~ "sess.refresh(cat); //re-read the state (after the trigger executes)" - -#, fuzzy -#~ msgid "" -#~ "" -#~ msgstr "" -#~ "List cats = session.createQuery(\n" -#~ " \"from Cat as cat where cat.birthdate < ?\")\n" -#~ " .setDate(0, date)\n" -#~ " .list();\n" -#~ "\n" -#~ "List mothers = session.createQuery(\n" -#~ " \"select mother from Cat as cat join cat.mother as mother where cat." -#~ "name = ?\")\n" -#~ " .setString(0, name)\n" -#~ " .list();\n" -#~ "\n" -#~ "List kittens = session.createQuery(\n" -#~ " \"from Cat as cat where cat.mother = ?\")\n" -#~ " .setEntity(0, pk)\n" -#~ " .list();\n" -#~ "\n" -#~ "Cat mother = (Cat) session.createQuery(\n" -#~ " \"select cat.mother from Cat as cat where cat = ?\")\n" -#~ " .setEntity(0, izi)\n" -#~ " .uniqueResult();]]\n" -#~ "\n" -#~ "Query mothersWithKittens = (Cat) session.createQuery(\n" -#~ " \"select mother from Cat as mother left join fetch mother.kittens" -#~ "\");\n" -#~ "Set uniqueMothers = new HashSet(mothersWithKittens.list());" - -#, fuzzy -#~ msgid "" -#~ "" -#~ msgstr "" -#~ "// fetch ids\n" -#~ "Iterator iter = sess.createQuery(\"from eg.Qux q order by q.likeliness\")." -#~ "iterate();\n" -#~ "while ( iter.hasNext() ) {\n" -#~ " Qux qux = (Qux) iter.next(); // fetch the object\n" -#~ " // something we couldnt express in the query\n" -#~ " if ( qux.calculateComplicatedAlgorithm() ) {\n" -#~ " // delete the current instance\n" -#~ " iter.remove();\n" -#~ " // dont need to process the rest\n" -#~ " break;\n" -#~ " }\n" -#~ "}" - -#, fuzzy -#~ msgid "" -#~ "" -#~ msgstr "" -#~ "Iterator kittensAndMothers = sess.createQuery(\n" -#~ " \"select kitten, mother from Cat kitten join kitten.mother " -#~ "mother\")\n" -#~ " .list()\n" -#~ " .iterator();\n" -#~ "\n" -#~ "while ( kittensAndMothers.hasNext() ) {\n" -#~ " Object[] tuple = (Object[]) kittensAndMothers.next();\n" -#~ " Cat kitten = tuple[0];\n" -#~ " Cat mother = tuple[1];\n" -#~ " ....\n" -#~ "}" - -#, fuzzy -#~ msgid "" -#~ "" -#~ msgstr "" -#~ "Iterator results = sess.createQuery(\n" -#~ " \"select cat.color, min(cat.birthdate), count(cat) from Cat cat " -#~ "\" +\n" -#~ " \"group by cat.color\")\n" -#~ " .list()\n" -#~ " .iterator();\n" -#~ "\n" -#~ "while ( results.hasNext() ) {\n" -#~ " Object[] row = (Object[]) results.next();\n" -#~ " Color type = (Color) row[0];\n" -#~ " Date oldest = (Date) row[1];\n" -#~ " Integer count = (Integer) row[2];\n" -#~ " .....\n" -#~ "}" - -#, fuzzy -#~ msgid "" -#~ "" -#~ msgstr "" -#~ "//named parameter (preferred)\n" -#~ "Query q = sess.createQuery(\"from DomesticCat cat where cat.name = :name" -#~ "\");\n" -#~ "q.setString(\"name\", \"Fritz\");\n" -#~ "Iterator cats = q.iterate();" - -#, fuzzy -#~ msgid "" -#~ "" -#~ msgstr "" -#~ "//positional parameter\n" -#~ "Query q = sess.createQuery(\"from DomesticCat cat where cat.name = ?\");\n" -#~ "q.setString(0, \"Izi\");\n" -#~ "Iterator cats = q.iterate();" - -#, fuzzy -#~ msgid "" -#~ "" -#~ msgstr "" -#~ "//named parameter list\n" -#~ "List names = new ArrayList();\n" -#~ "names.add(\"Izi\");\n" -#~ "names.add(\"Fritz\");\n" -#~ "Query q = sess.createQuery(\"from DomesticCat cat where cat.name in (:" -#~ "namesList)\");\n" -#~ "q.setParameterList(\"namesList\", names);\n" -#~ "List cats = q.list();" - -#, fuzzy -#~ msgid "" -#~ "" -#~ msgstr "" -#~ "Query q = sess.createQuery(\"from DomesticCat cat\");\n" -#~ "q.setFirstResult(20);\n" -#~ "q.setMaxResults(10);\n" -#~ "List cats = q.list();" - -#, fuzzy -#~ msgid "" -#~ " i++ ) && cats.next() ) pageOfCats.add( cats.get" -#~ "(1) );\n" -#~ "\n" -#~ "}\n" -#~ "cats.close()]]>" -#~ msgstr "" -#~ "Query q = sess.createQuery(\"select cat.name, cat from DomesticCat cat \" " -#~ "+\n" -#~ " \"order by cat.name\");\n" -#~ "ScrollableResults cats = q.scroll();\n" -#~ "if ( cats.first() ) {\n" -#~ "\n" -#~ " // find the first name on each page of an alphabetical list of cats " -#~ "by name\n" -#~ " firstNamesOfPages = new ArrayList();\n" -#~ " do {\n" -#~ " String name = cats.getString(0);\n" -#~ " firstNamesOfPages.add(name);\n" -#~ " }\n" -#~ " while ( cats.scroll(PAGE_SIZE) );\n" -#~ "\n" -#~ " // Now get the first page of cats\n" -#~ " pageOfCats = new ArrayList();\n" -#~ " cats.beforeFirst();\n" -#~ " int i=0;\n" -#~ " while( ( PAGE_SIZE > i++ ) && cats.next() ) pageOfCats.add" -#~ "( cats.get(1) );\n" -#~ "\n" -#~ "}\n" -#~ "cats.close()" - -#, fuzzy -#~ msgid "" -#~ " ?\n" -#~ "] ]>]]>" -#~ msgstr "" -#~ "<query name=\"ByNameAndMaximumWeight\"><![CDATA[\n" -#~ " from eg.DomesticCat as cat\n" -#~ " where cat.name = ?\n" -#~ " and cat.weight > ?\n" -#~ "] ]></query>" - -#, fuzzy -#~ msgid "" -#~ "" -#~ msgstr "" -#~ "Query q = sess.getNamedQuery(\"ByNameAndMaximumWeight\");\n" -#~ "q.setString(0, name);\n" -#~ "q.setInt(1, minWeight);\n" -#~ "List cats = q.list();" - -#, fuzzy -#~ msgid "" -#~ "" -#~ msgstr "" -#~ "Collection blackKittens = session.createFilter(\n" -#~ " pk.getKittens(), \n" -#~ " \"where this.color = ?\")\n" -#~ " .setParameter( Color.BLACK, Hibernate.custom(ColorUserType.class) )\n" -#~ " .list()\n" -#~ ");" - -#, fuzzy -#~ msgid "" -#~ "" -#~ msgstr "" -#~ "Collection blackKittenMates = session.createFilter(\n" -#~ " pk.getKittens(), \n" -#~ " \"select this.mate where this.color = eg.Color.BLACK.intValue\")\n" -#~ " .list();" - -#, fuzzy -#~ msgid "" -#~ "" -#~ msgstr "" -#~ "Collection tenKittens = session.createFilter(\n" -#~ " mother.getKittens(), \"\")\n" -#~ " .setFirstResult(0).setMaxResults(10)\n" -#~ " .list();" - -#, fuzzy -#~ msgid "" -#~ "" -#~ msgstr "" -#~ "Criteria crit = session.createCriteria(Cat.class);\n" -#~ "crit.add( Expression.eq( \"color\", eg.Color.BLACK ) );\n" -#~ "crit.setMaxResults(10);\n" -#~ "List cats = crit.list();" - -#, fuzzy -#~ msgid "" -#~ "" -#~ msgstr "" -#~ "List cats = session.createSQLQuery(\n" -#~ " \"SELECT {cat.*} FROM CAT {cat} WHERE ROWNUM<10\",\n" -#~ " \"cat\",\n" -#~ " Cat.class\n" -#~ ").list();" - -#, fuzzy -#~ msgid "" -#~ "" -#~ msgstr "" -#~ "List cats = session.createSQLQuery(\n" -#~ " \"SELECT {cat}.ID AS {cat.id}, {cat}.SEX AS {cat.sex}, \" +\n" -#~ " \"{cat}.MATE AS {cat.mate}, {cat}.SUBCLASS AS {cat.class}, ... " -#~ "\" +\n" -#~ " \"FROM CAT {cat} WHERE ROWNUM<10\",\n" -#~ " \"cat\",\n" -#~ " Cat.class\n" -#~ ").list()" - -#, fuzzy -#~ msgid "" -#~ "" -#~ msgstr "" -#~ "DomesticCat cat = (DomesticCat) sess.load( Cat.class, new Long(69) );\n" -#~ "cat.setName(\"PK\");\n" -#~ "sess.flush(); // changes to cat are automatically detected and persisted" - -#, fuzzy -#~ msgid "" -#~ "" -#~ msgstr "" -#~ "// in the first session\n" -#~ "Cat cat = (Cat) firstSession.load(Cat.class, catId);\n" -#~ "Cat potentialMate = new Cat();\n" -#~ "firstSession.save(potentialMate);\n" -#~ "\n" -#~ "// in a higher layer of the application\n" -#~ "cat.setMate(potentialMate);\n" -#~ "\n" -#~ "// later, in a new session\n" -#~ "secondSession.update(cat); // update cat\n" -#~ "secondSession.update(mate); // update mate" - -#, fuzzy -#~ msgid "" -#~ "" -#~ msgstr "" -#~ "//just reassociate:\n" -#~ "sess.lock(fritz, LockMode.NONE);\n" -#~ "//do a version check, then reassociate:\n" -#~ "sess.lock(izi, LockMode.READ);\n" -#~ "//do a version check, using SELECT ... FOR UPDATE, then reassociate:\n" -#~ "sess.lock(pk, LockMode.UPGRADE);" - -#, fuzzy -#~ msgid "" -#~ "" -#~ msgstr "" -#~ "// in the first session\n" -#~ "Cat cat = (Cat) firstSession.load(Cat.class, catID);\n" -#~ "\n" -#~ "// in a higher tier of the application\n" -#~ "Cat mate = new Cat();\n" -#~ "cat.setMate(mate);\n" -#~ "\n" -#~ "// later, in a new session\n" -#~ "secondSession.saveOrUpdate(cat); // update existing state (cat has a " -#~ "non-null id)\n" -#~ "secondSession.saveOrUpdate(mate); // save the new instance (mate has a " -#~ "null id)" - -#, fuzzy -#~ msgid "" -#~ msgstr "sess.delete(cat);" - -#, fuzzy -#~ msgid "" -#~ "" -#~ msgstr "" -#~ "//retrieve a cat from one database\n" -#~ "Session session1 = factory1.openSession();\n" -#~ "Transaction tx1 = session1.beginTransaction();\n" -#~ "Cat cat = session1.get(Cat.class, catId);\n" -#~ "tx1.commit();\n" -#~ "session1.close();\n" -#~ "\n" -#~ "//reconcile with a second database\n" -#~ "Session session2 = factory2.openSession();\n" -#~ "Transaction tx2 = session2.beginTransaction();\n" -#~ "session2.replicate(cat, ReplicationMode.LATEST_VERSION);\n" -#~ "tx2.commit();\n" -#~ "session2.close();" - -#, fuzzy -#~ msgid "" -#~ "" -#~ msgstr "" -#~ "sess = sf.openSession();\n" -#~ "Transaction tx = sess.beginTransaction();\n" -#~ "sess.setFlushMode(FlushMode.COMMIT); // allow queries to return stale " -#~ "state\n" -#~ "\n" -#~ "Cat izi = (Cat) sess.load(Cat.class, id);\n" -#~ "izi.setName(iznizi);\n" -#~ "\n" -#~ "// might return stale data\n" -#~ "sess.find(\"from Cat as cat left outer join cat.kittens kitten\");\n" -#~ "\n" -#~ "// change to izi is not flushed!\n" -#~ "...\n" -#~ "tx.commit(); // flush occurs\n" -#~ "sess.close();" - -#, fuzzy -#~ msgid "]]>" -#~ msgstr "<one-to-one name=\"person\" cascade=\"persist\"/>" - -#, fuzzy -#~ msgid "" -#~ "]]>" -#~ msgstr "<one-to-one name=\"person\" cascade=\"persist,delete,lock\"/>" - -#, fuzzy -#~ msgid "" -#~ "" -#~ msgstr "" -#~ "Cat fritz = ......;\n" -#~ "ClassMetadata catMeta = sessionfactory.getClassMetadata(Cat.class);\n" -#~ "\n" -#~ "Object[] propertyValues = catMeta.getPropertyValues(fritz);\n" -#~ "String[] propertyNames = catMeta.getPropertyNames();\n" -#~ "Type[] propertyTypes = catMeta.getPropertyTypes();\n" -#~ "\n" -#~ "// get a Map of all properties which are not collections or associations\n" -#~ "Map namedValues = new HashMap();\n" -#~ "for ( int i=0; i<propertyNames.length; i++ ) {\n" -#~ " if ( !propertyTypes[i].isEntityType() && !propertyTypes[i]." -#~ "isCollectionType() ) {\n" -#~ " namedValues.put( propertyNames[i], propertyValues[i] );\n" -#~ " }\n" -#~ "}" +#~ "特殊なカスケードスタイル delete-orphan は、一対多関連に" +#~ "だけ適用できます。これは、関連から削除された子供のオブジェクトに対して、 " +#~ "delete() 操作が適用されることを意味します。" diff --git a/documentation/manual/src/main/docbook/ja-JP/content/tutorial.po b/documentation/manual/src/main/docbook/ja-JP/content/tutorial.po index a38be3eccf..73bba4cc41 100644 --- a/documentation/manual/src/main/docbook/ja-JP/content/tutorial.po +++ b/documentation/manual/src/main/docbook/ja-JP/content/tutorial.po @@ -4,7 +4,7 @@ msgid "" msgstr "" "Project-Id-Version: Collection_Mapping\n" "Report-Msgid-Bugs-To: http://bugs.kde.org\n" -"POT-Creation-Date: 2010-02-11T05:38:16\n" +"POT-Creation-Date: 2010-07-20 21:02+0000\n" "PO-Revision-Date: 2010-01-21 16:43+1000\n" "Last-Translator: Xi HUANG \n" "Language-Team: \n" @@ -14,11 +14,13 @@ msgstr "" "X-Generator: KBabel 1.11.4\n" #. Tag: title +#: tutorial.xml:34 #, no-c-format msgid "Tutorial" msgstr "" #. Tag: para +#: tutorial.xml:36 #, no-c-format msgid "" "Intended for new users, this chapter provides an step-by-step introduction " @@ -29,6 +31,7 @@ msgid "" msgstr "" #. Tag: para +#: tutorial.xml:45 #, no-c-format msgid "" "This tutorial expects the user have knowledge of both Java and SQL. If you " @@ -37,6 +40,7 @@ msgid "" msgstr "" #. Tag: para +#: tutorial.xml:54 #, no-c-format msgid "" "The distribution contains another example application under the " @@ -44,11 +48,13 @@ msgid "" msgstr "" #. Tag: title +#: tutorial.xml:62 #, no-c-format msgid "Part 1 - The first Hibernate Application" msgstr "パート1 - 初めての Hibernate アプリケーション" #. Tag: para +#: tutorial.xml:64 #, no-c-format msgid "" "For this example, we will set up a small database application that can store " @@ -59,6 +65,7 @@ msgstr "" "ものとします。" #. Tag: para +#: tutorial.xml:70 #, no-c-format msgid "" "Although you can use whatever database you feel comfortable using, we will " @@ -68,11 +75,13 @@ msgid "" msgstr "" #. Tag: title +#: tutorial.xml:79 #, no-c-format msgid "Setup" msgstr "" #. Tag: para +#: tutorial.xml:81 #, no-c-format msgid "" "The first thing we need to do is to set up the development environment. We " @@ -86,6 +95,7 @@ msgid "" msgstr "" #. Tag: para +#: tutorial.xml:91 #, no-c-format msgid "" "We will be using Maven in this tutorial, taking advantage of its transitive " @@ -93,11 +103,65 @@ msgid "" "automatically set up a project for us based on the maven descriptor." msgstr "" +#. Tag: programlisting +#: tutorial.xml:97 +#, no-c-format +msgid "" +"\n" +"\n" +" 4.0.0\n" +"\n" +" org.hibernate.tutorials\n" +" hibernate-tutorial\n" +" 1.0.0-SNAPSHOT\n" +" First Hibernate Tutorial\n" +"\n" +" \n" +" \n" +" ${artifactId}\n" +" \n" +"\n" +" \n" +" \n" +" org.hibernate\n" +" hibernate-core\n" +" \n" +"\n" +" \n" +" \n" +" javax.servlet\n" +" servlet-api\n" +" \n" +"\n" +" \n" +" \n" +" org.slf4j\n" +" slf4j-simple\n" +" \n" +"\n" +" \n" +" \n" +" javassist\n" +" javassist\n" +" \n" +" \n" +"\n" +"]]>" +msgstr "" + #. Tag: para +#: tutorial.xml:100 #, no-c-format msgid "" "It is not a requirement to use Maven. If you wish to use something else to " -"build this tutoial (such as Ant), the layout will remain the same. The only " +"build this tutorial (such as Ant), the layout will remain the same. The only " "change is that you will need to manually account for all the needed " "dependencies. If you use something like Ivy providing transitive dependency management you would " @@ -112,24 +176,106 @@ msgid "" msgstr "" #. Tag: para +#: tutorial.xml:117 #, no-c-format msgid "" "Save this file as pom.xml in the project root directory." msgstr "" #. Tag: title +#: tutorial.xml:124 #, no-c-format msgid "The first class" msgstr "最初のクラス" #. Tag: para +#: tutorial.xml:126 #, no-c-format msgid "" "Next, we create a class that represents the event we want to store in the " "database; it is a simple JavaBean class with some properties:" msgstr "次にデータベースに格納するイベントを表すクラスを作成します。" +#. Tag: programlisting +#: tutorial.xml:131 +#, fuzzy, no-c-format +msgid "" +"" +msgstr "" +"package events;\n" +"\n" +"import java.util.Date;\n" +"\n" +"public class Event {\n" +" private Long id;\n" +"\n" +" private String title;\n" +" private Date date;\n" +"\n" +" public Event() {}\n" +"\n" +" public Long getId() {\n" +" return id;\n" +" }\n" +"\n" +" private void setId(Long id) {\n" +" this.id = id;\n" +" }\n" +"\n" +" public Date getDate() {\n" +" return date;\n" +" }\n" +"\n" +" public void setDate(Date date) {\n" +" this.date = date;\n" +" }\n" +"\n" +" public String getTitle() {\n" +" return title;\n" +" }\n" +"\n" +" public void setTitle(String title) {\n" +" this.title = title;\n" +" }\n" +"}" + #. Tag: para +#: tutorial.xml:133 #, fuzzy, no-c-format msgid "" "This class uses standard JavaBean naming conventions for property getter and " @@ -146,6 +292,7 @@ msgstr "" "のインスタンスを作成するために必要です。" #. Tag: para +#: tutorial.xml:141 #, no-c-format msgid "" "The id property holds a unique identifier value for a " @@ -174,6 +321,7 @@ msgstr "" "リケーションの設計に合わせることができます。" #. Tag: para +#: tutorial.xml:156 #, no-c-format msgid "" "The no-argument constructor is a requirement for all persistent classes; " @@ -188,6 +336,7 @@ msgstr "" "トコード操作なしの効率的なデータの抽出には、 package 可視性が必要です。" #. Tag: para +#: tutorial.xml:164 #, no-c-format msgid "" "Save this file to the src/main/java/org/hibernate/tutorial/domain\n" +"\n" +"\n" +"\n" +"[...]\n" +"]]>" +msgstr "" +"<?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>\n" +"[...]\n" +"</hibernate-mapping>" + #. Tag: para +#: tutorial.xml:187 #, no-c-format msgid "" "Hibernate DTD is sophisticated. You can use it for auto-completion of XML " @@ -239,6 +414,7 @@ msgstr "" "ディレクトリと同様、hibernate3.jar にも含まれています。" #. Tag: para +#: tutorial.xml:200 #, no-c-format msgid "" "We will omit the DTD declaration in future examples to shorten the code. It " @@ -248,6 +424,7 @@ msgstr "" "ションではありません。" #. Tag: para +#: tutorial.xml:206 #, no-c-format msgid "" "Between the two hibernate-mapping tags, include a " @@ -260,7 +437,28 @@ msgstr "" "が、ファーストクラスのエンティティではない依存クラスというものが後ほど登場し" "ます)は SQL データベース内のテーブルへのこのようなマッピングを必要とします。" +#. Tag: programlisting +#: tutorial.xml:213 +#, fuzzy, no-c-format +msgid "" +"\n" +"\n" +" \n" +"\n" +" \n" +"\n" +"]]>" +msgstr "" +"<hibernate-mapping>\n" +"\n" +" <class name=\"events.Event\" table=\"EVENTS\">\n" +"\n" +" </class>\n" +"\n" +"</hibernate-mapping>" + #. Tag: para +#: tutorial.xml:215 #, no-c-format msgid "" "So far we have told Hibernate how to persist and load object of class " @@ -278,7 +476,32 @@ msgstr "" "なかったのと同様に、代理の主キーカラムに対する Hibernate の識別子生成戦略を設" "定します。" +#. Tag: programlisting +#: tutorial.xml:225 +#, fuzzy, no-c-format +msgid "" +"\n" +"\n" +" \n" +" \n" +" \n" +" \n" +" \n" +"\n" +"]]>" +msgstr "" +"<hibernate-mapping>\n" +"\n" +" <class name=\"events.Event\" table=\"EVENTS\">\n" +" <id name=\"id\" column=\"EVENT_ID\">\n" +" <generator class=\"native\"/>\n" +" </id>\n" +" </class>\n" +"\n" +"</hibernate-mapping>" + #. Tag: para +#: tutorial.xml:227 #, no-c-format msgid "" "The id element is the declaration of the identifier " @@ -290,6 +513,7 @@ msgid "" msgstr "" #. Tag: para +#: tutorial.xml:237 #, no-c-format msgid "" "The nested generator element specifies the identifier " @@ -302,14 +526,15 @@ msgid "" msgstr "" #. Tag: para +#: tutorial.xml:249 #, no-c-format msgid "" "native is no longer consider the best strategy in terms " -"of portability. for further discussion, see " +"of portability. for further discussion, see" msgstr "" #. Tag: para +#: tutorial.xml:255 #, no-c-format msgid "" "Lastly, we need to tell Hibernate about the remaining entity class " @@ -318,7 +543,38 @@ msgstr "" "最後にクラスの永続プロパティの宣言をマッピングファイルに含めます。デフォルト" "では、クラスのプロパティは永続と見なされません:" +#. Tag: programlisting +#: tutorial.xml:261 +#, fuzzy, no-c-format +msgid "" +"\n" +"\n" +" \n" +" \n" +" \n" +" \n" +" \n" +" \n" +" \n" +"\n" +"]]>" +msgstr "" +"<hibernate-mapping>\n" +"\n" +" <class name=\"events.Event\" table=\"EVENTS\">\n" +" <id name=\"id\" column=\"EVENT_ID\">\n" +" <generator class=\"native\"/>\n" +" </id>\n" +" <property name=\"date\" type=\"timestamp\" column=\"EVENT_DATE\"/" +">\n" +" <property name=\"title\"/>\n" +" </class>\n" +"\n" +"</hibernate-mapping>" + #. Tag: para +#: tutorial.xml:263 #, no-c-format msgid "" "Similar to the id element, the name " @@ -333,6 +589,7 @@ msgstr "" "()getTitle()/setTitle() を探します。" #. Tag: para +#: tutorial.xml:274 #, no-c-format msgid "" "Why does the date property mapping include the " @@ -350,6 +607,7 @@ msgstr "" "ので、違う名前でマッピングした方がよいのです。" #. Tag: para +#: tutorial.xml:284 #, no-c-format msgid "" "The title mapping also lacks a type " @@ -384,6 +642,7 @@ msgstr "" "ます。" #. Tag: para +#: tutorial.xml:300 #, no-c-format msgid "" "Hibernate makes this mapping type determination using reflection when the " @@ -393,6 +652,7 @@ msgid "" msgstr "" #. Tag: para +#: tutorial.xml:307 #, no-c-format msgid "" "Save this mapping file as src/main/resources/org/hibernate/" @@ -400,11 +660,13 @@ msgid "" msgstr "" #. Tag: title +#: tutorial.xml:315 #, no-c-format msgid "Hibernate configuration" msgstr "Hibernate の設定" #. Tag: para +#: tutorial.xml:317 #, no-c-format msgid "" "At this point, you should have the persistent class and its mapping file in " @@ -413,11 +675,13 @@ msgid "" msgstr "" #. Tag: para +#: tutorial.xml:324 #, no-c-format msgid "We do this do that the data remains between runs." msgstr "" #. Tag: para +#: tutorial.xml:329 #, fuzzy, no-c-format msgid "" "We will utilize the Maven exec plugin to launch the HSQLDB server by " @@ -439,6 +703,7 @@ msgstr "" "HSQL DB を再起動します。" #. Tag: para +#: tutorial.xml:340 #, no-c-format msgid "" "Hibernate will be connecting to the database on behalf of your application, " @@ -452,6 +717,7 @@ msgid "" msgstr "" #. Tag: para +#: tutorial.xml:351 #, no-c-format msgid "" "The built-in Hibernate connection pool is in no way intended for production " @@ -459,6 +725,7 @@ msgid "" msgstr "" #. Tag: para +#: tutorial.xml:357 #, no-c-format msgid "" "For Hibernate's configuration, we can use a simple hibernate." @@ -471,12 +738,108 @@ msgstr "" "ル、または完全にプログラム上でセットアップする方法が利用できます。ほとんどの" "ユーザーが好むのは XML 設定ファイルです:" +#. Tag: programlisting +#: tutorial.xml:363 +#, fuzzy, no-c-format +msgid "" +"\n" +"\n" +"\n" +"\n" +"\n" +" \n" +"\n" +" \n" +" org.hsqldb.jdbcDriver\n" +" jdbc:hsqldb:hsql://localhost\n" +" sa\n" +" \n" +"\n" +" \n" +" 1\n" +"\n" +" \n" +" org.hibernate.dialect.HSQLDialect\n" +"\n" +" \n" +" thread\n" +"\n" +" \n" +" org.hibernate.cache." +"NoCacheProvider\n" +"\n" +" \n" +" true\n" +"\n" +" \n" +" update\n" +"\n" +" \n" +"\n" +" \n" +"\n" +"]]>" +msgstr "" +"<?xml version='1.0' encoding='utf-8'?>\n" +"<!DOCTYPE hibernate-configuration PUBLIC\n" +" \"-//Hibernate/Hibernate Configuration DTD 3.0//EN\"\n" +" \"http://hibernate.sourceforge.net/hibernate-configuration-3.0.dtd" +"\">\n" +"\n" +"<hibernate-configuration>\n" +"\n" +" <session-factory>\n" +"\n" +" <!-- Database connection settings -->\n" +" <property name=\"connection.driver_class\">org.hsqldb." +"jdbcDriver</property>\n" +" <property name=\"connection.url\">jdbc:hsqldb:hsql://" +"localhost</property>\n" +" <property name=\"connection.username\">sa</property>\n" +" <property name=\"connection.password\"></property>\n" +"\n" +" <!-- JDBC connection pool (use the built-in) -->\n" +" <property name=\"connection.pool_size\">1</property>\n" +"\n" +" <!-- SQL dialect -->\n" +" <property name=\"dialect\">org.hibernate.dialect." +"HSQLDialect</property>\n" +"\n" +" <!-- Enable Hibernate's automatic session context management --" +">\n" +" <property name=\"current_session_context_class\">thread</" +"property>\n" +"\n" +" <!-- Disable the second-level cache -->\n" +" <property name=\"cache.provider_class\">org.hibernate.cache." +"NoCacheProvider</property>\n" +"\n" +" <!-- Echo all executed SQL to stdout -->\n" +" <property name=\"show_sql\">true</property>\n" +"\n" +" <!-- Drop and re-create the database schema on startup -->\n" +" <property name=\"hbm2ddl.auto\">create</property>\n" +"\n" +" <mapping resource=\"events/Event.hbm.xml\"/>\n" +"\n" +" </session-factory>\n" +"\n" +"</hibernate-configuration>" + #. Tag: para +#: tutorial.xml:366 #, no-c-format msgid "Notice that this configuration file specifies a different DTD" msgstr "この XML の設定が異なる DTD を使うことに注意してください。" #. Tag: para +#: tutorial.xml:369 #, no-c-format msgid "" "You configure Hibernate's SessionFactory. SessionFactory " @@ -491,6 +854,7 @@ msgstr "" "い。" #. Tag: para +#: tutorial.xml:376 #, no-c-format msgid "" "The first four property elements contain the necessary " @@ -502,13 +866,15 @@ msgstr "" "Hibernate が生成する特定の SQL 方言を指定します。" #. Tag: para +#: tutorial.xml:383 #, no-c-format msgid "" "In most cases, Hibernate is able to properly determine which dialect to use. " -"See for more information." +"See for more information." msgstr "" #. Tag: para +#: tutorial.xml:389 #, no-c-format msgid "" "Hibernate's automatic session management for persistence contexts is " @@ -528,6 +894,7 @@ msgstr "" "加します。" #. Tag: para +#: tutorial.xml:398 #, no-c-format msgid "" "Save this file as hibernate.cfg.xml into the " @@ -535,11 +902,13 @@ msgid "" msgstr "" #. Tag: title +#: tutorial.xml:406 #, no-c-format msgid "Building with Maven" msgstr "Maven によるビルド" #. Tag: para +#: tutorial.xml:408 #, no-c-format msgid "" "We will now build the tutorial with Maven. You will need to have Maven " @@ -550,12 +919,43 @@ msgid "" "make sure we can compile everything so far:" msgstr "" +#. Tag: programlisting +#: tutorial.xml:418 +#, no-c-format +msgid "" +"" +msgstr "" + #. Tag: title +#: tutorial.xml:423 #, no-c-format msgid "Startup and helpers" msgstr "スタートアップとヘルパ" #. Tag: para +#: tutorial.xml:425 #, no-c-format msgid "" "It is time to load and store some Event objects, but " @@ -582,6 +982,7 @@ msgstr "" "セーフのグローバルオブジェクトであり、一度だけインスタンス化されます。" #. Tag: para +#: tutorial.xml:439 #, no-c-format msgid "" "We will create a HibernateUtil helper class that takes " @@ -592,7 +993,69 @@ msgstr "" "SessionFactory へアクセスする HibernateUtil ヘルパクラスを作成します。実装を見てみましょう:" +#. Tag: programlisting +#: tutorial.xml:445 +#, fuzzy, no-c-format +msgid "" +"" +msgstr "" +"package util;\n" +"\n" +"import org.hibernate.*;\n" +"import org.hibernate.cfg.*;\n" +"\n" +"public class HibernateUtil {\n" +"\n" +" private static final SessionFactory sessionFactory;\n" +"\n" +" static {\n" +" try {\n" +" // Create the SessionFactory from hibernate.cfg.xml\n" +" sessionFactory = new Configuration().configure()." +"buildSessionFactory();\n" +" } catch (Throwable ex) {\n" +" // Make sure you log the exception, as it might be swallowed\n" +" System.err.println(\"Initial SessionFactory creation failed.\" + " +"ex);\n" +" throw new ExceptionInInitializerError(ex);\n" +" }\n" +" }\n" +"\n" +" public static SessionFactory getSessionFactory() {\n" +" return sessionFactory;\n" +" }\n" +"\n" +"}" + #. Tag: para +#: tutorial.xml:447 #, no-c-format msgid "" "Save this code as src/main/java/org/hibernate/tutorial/util/" @@ -600,6 +1063,7 @@ msgid "" msgstr "" #. Tag: para +#: tutorial.xml:452 #, fuzzy, no-c-format msgid "" "This class not only produces the global org.hibernate." @@ -616,6 +1080,7 @@ msgstr "" "SessionFactory をルックアップするのと同様です。" #. Tag: para +#: tutorial.xml:461 #, fuzzy, no-c-format msgid "" "If you give the org.hibernate.SessionFactory " @@ -634,6 +1099,7 @@ msgstr "" "ントで説明されています。" #. Tag: para +#: tutorial.xml:470 #, fuzzy, no-c-format msgid "" "You now need to configure a logging system. Hibernate uses commons logging " @@ -655,6 +1121,7 @@ msgstr "" "ルトでは Hibernate のスタートアップメッセージだけが標準出力に表示されます。" #. Tag: para +#: tutorial.xml:480 #, no-c-format msgid "" "The tutorial infrastructure is complete and you are now ready to do some " @@ -664,14 +1131,16 @@ msgstr "" "整いました。" #. Tag: title +#: tutorial.xml:488 #, no-c-format msgid "Loading and storing objects" msgstr "オブジェクトのロードと格納" #. Tag: para -#, no-c-format +#: tutorial.xml:490 +#, fuzzy, no-c-format msgid "" -"We are now ready to start doing some real worjk with Hibernate. Let's start " +"We are now ready to start doing some real work with Hibernate. Let's start " "by writing an EventManager class with a main() method:" msgstr "" @@ -679,7 +1148,85 @@ msgstr "" "main() メソッドを持つ EventManager クラ" "スを書きます:" +#. Tag: programlisting +#: tutorial.xml:496 +#, fuzzy, no-c-format +msgid "" +"" +msgstr "" +"package events;\n" +"import org.hibernate.Session;\n" +"\n" +"import java.util.Date;\n" +"\n" +"import util.HibernateUtil;\n" +"\n" +"public class EventManager {\n" +"\n" +" public static void main(String[] args) {\n" +" EventManager mgr = new EventManager();\n" +"\n" +" if (args[0].equals(\"store\")) {\n" +" mgr.createAndStoreEvent(\"My Event\", new Date());\n" +" }\n" +"\n" +" HibernateUtil.getSessionFactory().close();\n" +" }\n" +"\n" +" private void createAndStoreEvent(String title, Date theDate) {\n" +"\n" +" Session session = HibernateUtil.getSessionFactory().getCurrentSession" +"();\n" +"\n" +" session.beginTransaction();\n" +"\n" +" Event theEvent = new Event();\n" +" theEvent.setTitle(title);\n" +" theEvent.setDate(theDate);\n" +"\n" +" session.save(theEvent);\n" +"\n" +" session.getTransaction().commit();\n" +" }\n" +"\n" +"}" + #. Tag: para +#: tutorial.xml:498 #, fuzzy, no-c-format msgid "" "In createAndStoreEvent() we created a new Event を処理するコードを確認してください。" #. Tag: para +#: tutorial.xml:505 #, fuzzy, no-c-format msgid "" "A org.hibernate.Session is designed to represent a " -"single unit of work (a single atmoic piece of work to be performed). For now " +"single unit of work (a single atomic piece of work to be performed). For now " "we will keep things simple and assume a one-to-one granularity between a " "Hibernate org.hibernate.Session and a database " "transaction. To shield our code from the actual underlying transaction " @@ -713,6 +1261,7 @@ msgstr "" "用します。" #. Tag: para +#: tutorial.xml:518 #, fuzzy, no-c-format msgid "" "What does sessionFactory.getCurrentSession() do? First, " @@ -736,6 +1285,7 @@ msgstr "" "はスコープも考慮する必要があります。" #. Tag: para +#: tutorial.xml:532 #, no-c-format msgid "" "Hibernate offers three methods of current session tracking. The \"thread\" " @@ -745,6 +1295,7 @@ msgid "" msgstr "" #. Tag: para +#: tutorial.xml:541 #, fuzzy, no-c-format msgid "" "A org.hibernate.Session begins when the first call to " @@ -769,6 +1320,7 @@ msgstr "" "クセスコードとは区別されます)。" #. Tag: para +#: tutorial.xml:554 #, no-c-format msgid "" "Related to the unit of work scope, should the Hibernate org." @@ -797,9 +1349,10 @@ msgstr "" "トリアルで後に見ることができます。" #. Tag: para +#: tutorial.xml:571 #, fuzzy, no-c-format msgid "" -"See for more information about transaction " +"See for more information about transaction " "handling and demarcation. The previous example also skipped any error " "handling and rollback." msgstr "" @@ -808,6 +1361,7 @@ msgstr "" "ます。" #. Tag: para +#: tutorial.xml:577 #, no-c-format msgid "" "To run this, we will make use of the Maven exec plugin to call our class " @@ -816,11 +1370,13 @@ msgid "" msgstr "" #. Tag: para +#: tutorial.xml:584 #, no-c-format msgid "You may need to perform mvn compile first." msgstr "" #. Tag: para +#: tutorial.xml:589 #, no-c-format msgid "" "You should see Hibernate starting up and, depending on your configuration, " @@ -829,31 +1385,102 @@ msgstr "" "コンパイルすると、 Hibernate がスタートし、設定によりますが、多くのログ出力が" "あるはずです。その最後には以下の行があるでしょう:" +#. Tag: programlisting +#: tutorial.xml:594 +#, fuzzy, no-c-format +msgid "" +"" +msgstr "" +"[java] Hibernate: insert into EVENTS (EVENT_DATE, title, EVENT_ID) values " +"(?, ?, ?)" + #. Tag: para +#: tutorial.xml:596 #, fuzzy, no-c-format msgid "This is the INSERT executed by Hibernate." msgstr "HQL の INSERT 文の実行例です:" #. Tag: para +#: tutorial.xml:600 #, fuzzy, no-c-format msgid "To list stored events an option is added to the main method:" msgstr "" "それでは同じように格納されたイベントの一覧を見ようと思います。そのためメイン" "メソッドにオプションを追加します:" +#. Tag: programlisting +#: tutorial.xml:604 +#, fuzzy, no-c-format +msgid "" +"" +msgstr "" +"if (args[0].equals(\"store\")) {\n" +" mgr.createAndStoreEvent(\"My Event\", new Date());\n" +"}\n" +"else if (args[0].equals(\"list\")) {\n" +" List events = mgr.listEvents();\n" +" for (int i = 0; i < events.size(); i++) {\n" +" Event theEvent = (Event) events.get(i);\n" +" System.out.println(\"Event: \" + theEvent.getTitle() +\n" +" \" Time: \" + theEvent.getDate());\n" +" }\n" +"}" + #. Tag: para +#: tutorial.xml:606 #, no-c-format msgid "A new listEvents() method is also added:" msgstr "新しい listEvents()メソッド も追加します。" +#. Tag: programlisting +#: tutorial.xml:610 +#, fuzzy, no-c-format +msgid "" +"" +msgstr "" +"private List listEvents() {\n" +"\n" +" Session session = HibernateUtil.getSessionFactory().getCurrentSession" +"();\n" +"\n" +" session.beginTransaction();\n" +"\n" +" List result = session.createQuery(\"from Event\").list();\n" +"\n" +" session.getTransaction().commit();\n" +"\n" +" return result;\n" +"}" + #. Tag: para +#: tutorial.xml:612 #, fuzzy, no-c-format msgid "" "Here, we are using a Hibernate Query Language (HQL) query to load all " "existing Event objects from the database. Hibernate will " "generate the appropriate SQL, send it to the database and populate " "Event objects with the data. You can create more complex " -"queries with HQL. See for more information." +"queries with HQL. See for more information." msgstr "" "ここですることは、データベースから存在するすべての Event " "オブジェクトをロードする HQL (Hibernate Query Language) クエリを使うことで" @@ -862,6 +1489,7 @@ msgstr "" "雑なクエリを作成できます。" #. Tag: para +#: tutorial.xml:620 #, no-c-format msgid "" "Now we can call our new functionality, again using the Maven exec plugin: " @@ -870,11 +1498,13 @@ msgid "" msgstr "" #. Tag: title +#: tutorial.xml:630 #, no-c-format msgid "Part 2 - Mapping associations" msgstr "パート2 - 関連のマッピング" #. Tag: para +#: tutorial.xml:632 #, no-c-format msgid "" "So far we have mapped a single persistent entity class to a table in " @@ -887,16 +1517,53 @@ msgstr "" "らが参加するイベントのリストを格納します。" #. Tag: title +#: tutorial.xml:640 #, no-c-format msgid "Mapping the Person class" msgstr "Person クラスのマッピング" #. Tag: para +#: tutorial.xml:642 #, no-c-format msgid "The first cut of the Person class looks like this:" msgstr "最初の Person クラスは単純です:" +#. Tag: programlisting +#: tutorial.xml:646 +#, fuzzy, no-c-format +msgid "" +"" +msgstr "" +"package events;\n" +"\n" +"public class Person {\n" +"\n" +" private Long id;\n" +" private int age;\n" +" private String firstname;\n" +" private String lastname;\n" +"\n" +" public Person() {}\n" +"\n" +" // Accessor methods for all properties, private setter for 'id'\n" +"\n" +"}" + #. Tag: para +#: tutorial.xml:648 #, no-c-format msgid "" "Save this to a file named src/main/java/org/hibernate/tutorial/" @@ -904,18 +1571,61 @@ msgid "" msgstr "" #. Tag: para +#: tutorial.xml:653 #, no-c-format msgid "" "Next, create the new mapping file as src/main/resources/org/" "hibernate/tutorial/domain/Person.hbm.xml" msgstr "" +#. Tag: programlisting +#: tutorial.xml:658 +#, fuzzy, no-c-format +msgid "" +"\n" +"\n" +" \n" +" \n" +" \n" +" \n" +" \n" +" \n" +" \n" +" \n" +"\n" +"]]>" +msgstr "" +"<hibernate-mapping>\n" +"\n" +" <class name=\"events.Person\" table=\"PERSON\">\n" +" <id name=\"id\" column=\"PERSON_ID\">\n" +" <generator class=\"native\"/>\n" +" </id>\n" +" <property name=\"age\"/>\n" +" <property name=\"firstname\"/>\n" +" <property name=\"lastname\"/>\n" +" </class>\n" +"\n" +"</hibernate-mapping>" + #. Tag: para +#: tutorial.xml:660 #, no-c-format msgid "Finally, add the new mapping to Hibernate's configuration:" msgstr "最後に Hibernate の設定に新しいマッピングを追加してください:" +#. Tag: programlisting +#: tutorial.xml:664 +#, fuzzy, no-c-format +msgid "" +"\n" +"]]>" +msgstr "" +"<mapping resource=\"events/Event.hbm.xml\"/>\n" +"<mapping resource=\"events/Person.hbm.xml\"/>" + #. Tag: para +#: tutorial.xml:666 #, no-c-format msgid "" "Create an association between these two entities. Persons can participate in " @@ -927,11 +1637,13 @@ msgstr "" "方向、多重度、コレクションの振る舞いです。" #. Tag: title +#: tutorial.xml:676 #, no-c-format msgid "A unidirectional Set-based association" msgstr "単方向 Set ベース関連" #. Tag: para +#: tutorial.xml:678 #, fuzzy, no-c-format msgid "" "By adding a collection of events to the Person class, you " @@ -949,7 +1661,38 @@ msgstr "" "interfacename> を使います。コレクションは重複要素を持たないし、順番は私たちに" "は意味がないからです。" +#. Tag: programlisting +#: tutorial.xml:689 +#, fuzzy, no-c-format +msgid "" +"" +msgstr "" +"public class Person {\n" +"\n" +" private Set events = new HashSet();\n" +"\n" +" public Set getEvents() {\n" +" return events;\n" +" }\n" +"\n" +" public void setEvents(Set events) {\n" +" this.events = events;\n" +" }\n" +"}" + #. Tag: para +#: tutorial.xml:691 #, fuzzy, no-c-format msgid "" "Before mapping this association, let's consider the other side. We could " @@ -972,7 +1715,42 @@ msgstr "" "にする、 多対多 と呼ばれる関連です。そのため Hibernate " "の多対多マッピングを使います:" +#. Tag: programlisting +#: tutorial.xml:704 +#, fuzzy, no-c-format +msgid "" +"\n" +" \n" +" \n" +" \n" +" \n" +" \n" +" \n" +"\n" +" \n" +" \n" +" \n" +" \n" +"\n" +"]]>" +msgstr "" +"<class name=\"events.Person\" table=\"PERSON\">\n" +" <id name=\"id\" column=\"PERSON_ID\">\n" +" <generator class=\"native\"/>\n" +" </id>\n" +" <property name=\"age\"/>\n" +" <property name=\"firstname\"/>\n" +" <property name=\"lastname\"/>\n" +"\n" +" <set name=\"events\" table=\"PERSON_EVENT\">\n" +" <key column=\"PERSON_ID\"/>\n" +" <many-to-many column=\"EVENT_ID\" class=\"events.Event\"/>\n" +" </set>\n" +"\n" +"</class>" + #. Tag: para +#: tutorial.xml:706 #, no-c-format msgid "" "Hibernate supports a broad range of collection mappings, a set | *EVENT_ID | | |\n" +" | EVENT_DATE | | *PERSON_ID | <--> | *PERSON_ID |\n" +" | TITLE | |__________________| | AGE |\n" +" |_____________| | FIRSTNAME |\n" +" | LASTNAME |\n" +" |_____________|\n" +" ]]>" +msgstr "" +"_____________ __________________\n" +" | | | | _____________\n" +" | EVENTS | | PERSON_EVENT | | |\n" +" |_____________| |__________________| | PERSON |\n" +" | | | | |_____________|\n" +" | *EVENT_ID | <--> | *EVENT_ID | | |\n" +" | EVENT_DATE | | *PERSON_ID | <--> | *PERSON_ID |\n" +" | TITLE | |__________________| | AGE |\n" +" |_____________| | FIRSTNAME |\n" +" | LASTNAME |\n" +" |_____________|" + #. Tag: title +#: tutorial.xml:731 #, no-c-format msgid "Working the association" msgstr "関連を働かせる" #. Tag: para +#: tutorial.xml:733 #, no-c-format msgid "" "Now we will bring some people and events together in a new method in " @@ -1016,7 +1827,38 @@ msgstr "" "EventManager の新しいメソッドで人々とイベントを一緒にしま" "しょう:" +#. Tag: programlisting +#: tutorial.xml:737 +#, fuzzy, no-c-format +msgid "" +"" +msgstr "" +"private void addPersonToEvent(Long personId, Long eventId) {\n" +"\n" +" Session session = HibernateUtil.getSessionFactory().getCurrentSession" +"();\n" +" session.beginTransaction();\n" +"\n" +" Person aPerson = (Person) session.load(Person.class, personId);\n" +" Event anEvent = (Event) session.load(Event.class, eventId);\n" +"\n" +" aPerson.getEvents().add(anEvent);\n" +"\n" +" session.getTransaction().commit();\n" +"}" + #. Tag: para +#: tutorial.xml:739 #, fuzzy, no-c-format msgid "" "After loading a Person and an Event, " @@ -1050,6 +1892,7 @@ msgstr "" "スに対して thread を設定したためです。" #. Tag: para +#: tutorial.xml:758 #, no-c-format msgid "" "You can load person and event in different units of work. Or you can modify " @@ -1064,7 +1907,75 @@ msgstr "" "hibernate.Session の外部でオブジェクトを修正します。分離され" "るときにはコレクションを変更することも可能です:" +#. Tag: programlisting +#: tutorial.xml:767 +#, fuzzy, no-c-format +msgid "" +"" +msgstr "" +"private void addPersonToEvent(Long personId, Long eventId) {\n" +"\n" +" Session session = HibernateUtil.getSessionFactory().getCurrentSession" +"();\n" +" session.beginTransaction();\n" +"\n" +" Person aPerson = (Person) session\n" +" .createQuery(\"select p from Person p left join fetch p.events " +"where p.id = :pid\")\n" +" .setParameter(\"pid\", personId)\n" +" .uniqueResult(); // Eager fetch the collection so we can use it " +"detached\n" +"\n" +" Event anEvent = (Event) session.load(Event.class, eventId);\n" +"\n" +" session.getTransaction().commit();\n" +"\n" +" // End of first unit of work\n" +"\n" +" aPerson.getEvents().add(anEvent); // aPerson (and its collection) is " +"detached\n" +"\n" +" // Begin second unit of work\n" +"\n" +" Session session2 = HibernateUtil.getSessionFactory().getCurrentSession" +"();\n" +" session2.beginTransaction();\n" +"\n" +" session2.update(aPerson); // Reattachment of aPerson\n" +"\n" +" session2.getTransaction().commit();\n" +"}" + #. Tag: para +#: tutorial.xml:769 #, no-c-format msgid "" "The call to update makes a detached object persistent " @@ -1079,6 +1990,7 @@ msgstr "" "ティオブジェクトのコレクションへの修正(追加・削除)も同様にセーブできます。" #. Tag: para +#: tutorial.xml:778 #, no-c-format msgid "" "This is not much use in our example, but it is an important concept you can " @@ -1095,7 +2007,29 @@ msgstr "" "save() メソッドが返してくれます (場合によっては識別子を返" "すためにメソッドを修正する必要があるかもしれません)。" +#. Tag: programlisting +#: tutorial.xml:786 +#, fuzzy, no-c-format +msgid "" +"" +msgstr "" +"else if (args[0].equals(\"addpersontoevent\")) {\n" +" Long eventId = mgr.createAndStoreEvent(\"My Event\", new Date());\n" +" Long personId = mgr.createAndStorePerson(\"Foo\", \"Bar\");\n" +" mgr.addPersonToEvent(personId, eventId);\n" +" System.out.println(\"Added person \" + personId + \" to event \" + " +"eventId);\n" +"}" + #. Tag: para +#: tutorial.xml:788 #, no-c-format msgid "" "This is an example of an association between two equally important classes : " @@ -1125,6 +2059,7 @@ msgstr "" "な独自の依存クラスを書くこともできます。" #. Tag: para +#: tutorial.xml:806 #, no-c-format msgid "" "You can also design a collection of value types. This is conceptually " @@ -1136,11 +2071,13 @@ msgstr "" "ます。" #. Tag: title +#: tutorial.xml:815 #, no-c-format msgid "Collection of values" msgstr "値のコレクション" #. Tag: para +#: tutorial.xml:817 #, no-c-format msgid "" "Let's add a collection of email addresses to the Person " @@ -1148,12 +2085,52 @@ msgid "" "interfacename> of java.lang.String instances:" msgstr "" +#. Tag: programlisting +#: tutorial.xml:823 +#, fuzzy, no-c-format +msgid "" +"" +msgstr "" +"private Set emailAddresses = new HashSet();\n" +"\n" +"public Set getEmailAddresses() {\n" +" return emailAddresses;\n" +"}\n" +"\n" +"public void setEmailAddresses(Set emailAddresses) {\n" +" this.emailAddresses = emailAddresses;\n" +"}" + #. Tag: para +#: tutorial.xml:825 #, no-c-format msgid "The mapping of this Set is as follows:" msgstr "この Set のマッピングです:" +#. Tag: programlisting +#: tutorial.xml:829 +#, fuzzy, no-c-format +msgid "" +"\n" +" \n" +" \n" +" ]]>" +msgstr "" +"<set name=\"emailAddresses\" table=\"PERSON_EMAIL_ADDR\">\n" +" <key column=\"PERSON_ID\"/>\n" +" <element type=\"string\" column=\"EMAIL_ADDR\"/>\n" +"</set>" + #. Tag: para +#: tutorial.xml:831 #, no-c-format msgid "" "The difference compared with the earlier mapping is the use of the " @@ -1179,11 +2156,57 @@ msgstr "" "値が実際に格納されるカラムの名前を定義します。" #. Tag: para +#: tutorial.xml:847 #, no-c-format msgid "Here is the updated schema:" msgstr "更新したスキーマを見てください:" +#. Tag: programlisting +#: tutorial.xml:851 +#, fuzzy, no-c-format +msgid "" +" | *EVENT_ID | | | |" +"___________________|\n" +" | EVENT_DATE | | *PERSON_ID | <--> | *PERSON_ID | <--> | " +"*PERSON_ID |\n" +" | TITLE | |__________________| | AGE | | " +"*EMAIL_ADDR |\n" +" |_____________| | FIRSTNAME | |" +"___________________|\n" +" | LASTNAME |\n" +" |_____________|\n" +" ]]>" +msgstr "" +"_____________ __________________\n" +" | | | | _____________\n" +" | EVENTS | | PERSON_EVENT | | | " +"___________________\n" +" |_____________| |__________________| | PERSON | " +"| |\n" +" | | | | |_____________| | " +"PERSON_EMAIL_ADDR |\n" +" | *EVENT_ID | <--> | *EVENT_ID | | | |" +"___________________|\n" +" | EVENT_DATE | | *PERSON_ID | <--> | *PERSON_ID | <--" +"> | *PERSON_ID |\n" +" | TITLE | |__________________| | AGE | | " +"*EMAIL_ADDR |\n" +" |_____________| | FIRSTNAME | |" +"___________________|\n" +" | LASTNAME |\n" +" |_____________|" + #. Tag: para +#: tutorial.xml:853 #, no-c-format msgid "" "You can see that the primary key of the collection table is in fact a " @@ -1196,6 +2219,7 @@ msgstr "" "Java の set に要求されるセマンティクスそのものです。" #. Tag: para +#: tutorial.xml:859 #, no-c-format msgid "" "You can now try to add elements to this collection, just like we did before " @@ -1204,7 +2228,40 @@ msgstr "" "以前人とイベントを関連づけたときと全く同じように、今や試しにコレクションに要" "素を追加することができるようになりました。 両方とも Java では同じコードです。" +#. Tag: programlisting +#: tutorial.xml:864 +#, fuzzy, no-c-format +msgid "" +"" +msgstr "" +"private void addEmailToPerson(Long personId, String emailAddress) {\n" +"\n" +" Session session = HibernateUtil.getSessionFactory().getCurrentSession" +"();\n" +" session.beginTransaction();\n" +"\n" +" Person aPerson = (Person) session.load(Person.class, personId);\n" +"\n" +" // The getEmailAddresses() might trigger a lazy load of the collection\n" +" aPerson.getEmailAddresses().add(emailAddress);\n" +"\n" +" session.getTransaction().commit();\n" +"}" + #. Tag: para +#: tutorial.xml:866 #, fuzzy, no-c-format msgid "" "This time we did not use a fetch query to initialize " @@ -1217,11 +2274,13 @@ msgstr "" "を監視して、即時フェッチを使って最適化してください。" #. Tag: title +#: tutorial.xml:875 #, no-c-format msgid "Bi-directional associations" msgstr "双方向関連" #. Tag: para +#: tutorial.xml:877 #, no-c-format msgid "" "Next you will map a bi-directional association. You will make the " @@ -1234,6 +2293,7 @@ msgstr "" "です。" #. Tag: para +#: tutorial.xml:885 #, no-c-format msgid "" "A relational database is more flexible than a network programming language, " @@ -1245,6 +2305,7 @@ msgstr "" "り復元できるということです。" #. Tag: para +#: tutorial.xml:893 #, no-c-format msgid "" "First, add a collection of participants to the Event " @@ -1253,7 +2314,32 @@ msgstr "" "まず Event イベントクラスに参加者のコレクションを追加しま" "す:" +#. Tag: programlisting +#: tutorial.xml:898 +#, fuzzy, no-c-format +msgid "" +"" +msgstr "" +"private Set participants = new HashSet();\n" +"\n" +"public Set getParticipants() {\n" +" return participants;\n" +"}\n" +"\n" +"public void setParticipants(Set participants) {\n" +" this.participants = participants;\n" +"}" + #. Tag: para +#: tutorial.xml:900 #, no-c-format msgid "" "Now map this side of the association in Event.hbm.xml." @@ -1261,7 +2347,23 @@ msgstr "" "それでは Event.hbm.xml で関連のこちら側をマッピングしてく" "ださい。" +#. Tag: programlisting +#: tutorial.xml:904 +#, fuzzy, no-c-format +msgid "" +"\n" +" \n" +" \n" +" ]]>" +msgstr "" +"<set name=\"participants\" table=\"PERSON_EVENT\" inverse=\"true\">\n" +" <key column=\"EVENT_ID\"/>\n" +" <many-to-many column=\"PERSON_ID\" class=\"events.Person\"/>\n" +"</set>" + #. Tag: para +#: tutorial.xml:906 #, no-c-format msgid "" "These are normal set mappings in both mapping documents. " @@ -1279,6 +2381,7 @@ msgstr "" "素にある inverse=\"true\" 属性です。" #. Tag: para +#: tutorial.xml:914 #, no-c-format msgid "" "What this means is that Hibernate should take the other side, the " @@ -1292,11 +2395,13 @@ msgstr "" "に作成されるかがわかれば、これを理解することはとても簡単です。" #. Tag: title +#: tutorial.xml:923 #, no-c-format msgid "Working bi-directional links" msgstr "双方向リンクの動作" #. Tag: para +#: tutorial.xml:925 #, no-c-format msgid "" "First, keep in mind that Hibernate does not affect normal Java semantics. " @@ -1320,6 +2425,7 @@ msgstr "" "で、決して忘れないでください。" #. Tag: para +#: tutorial.xml:935 #, no-c-format msgid "" "Many developers program defensively and create link management methods to " @@ -1329,7 +2435,48 @@ msgstr "" "するリンク管理メソッドを作成します。例えば Person では以下" "のようになります。:" +#. Tag: programlisting +#: tutorial.xml:940 +#, fuzzy, no-c-format +msgid "" +"" +msgstr "" +"protected Set getEvents() {\n" +" return events;\n" +"}\n" +"\n" +"protected void setEvents(Set events) {\n" +" this.events = events;\n" +"}\n" +"\n" +"public void addToEvent(Event event) {\n" +" this.getEvents().add(event);\n" +" event.getParticipants().add(this);\n" +"}\n" +"\n" +"public void removeFromEvent(Event event) {\n" +" this.getEvents().remove(event);\n" +" event.getParticipants().remove(this);\n" +"}" + #. Tag: para +#: tutorial.xml:942 #, no-c-format msgid "" "The get and set methods for the collection are now protected. This allows " @@ -1344,6 +2491,7 @@ msgstr "" "をした方がいいでしょう。" #. Tag: para +#: tutorial.xml:949 #, no-c-format msgid "" "What about the inverse mapping attribute? For you, and " @@ -1373,11 +2521,13 @@ msgstr "" "多対多関連ではどちら側でも構いません。どちらでも違いはありません。" #. Tag: title +#: tutorial.xml:965 #, no-c-format msgid "Part 3 - The EventManager web application" msgstr "パート3 - EventManager Web アプリケーション" #. Tag: para +#: tutorial.xml:967 #, no-c-format msgid "" "A Hibernate web application uses Session and " @@ -1394,11 +2544,13 @@ msgstr "" "いイベントを入力できるものです。" #. Tag: title +#: tutorial.xml:975 #, no-c-format msgid "Writing the basic servlet" msgstr "基本的な Servlet の記述" #. Tag: para +#: tutorial.xml:977 #, no-c-format msgid "" "First we need create our basic processing servlet. Since our servlet only " @@ -1408,7 +2560,76 @@ msgstr "" "Servlet は HTTP の GET リクエストのみを処理するので、 " "doGet() を実装します。" +#. Tag: programlisting +#: tutorial.xml:983 +#, fuzzy, no-c-format +msgid "" +"" +msgstr "" +"protected void doGet(HttpServletRequest request,\n" +" HttpServletResponse response)\n" +" throws ServletException, IOException {\n" +"\n" +" SimpleDateFormat dateFormatter = new SimpleDateFormat(\"dd.MM.yyyy\");\n" +"\n" +" try {\n" +" // Begin unit of work\n" +" HibernateUtil.getSessionFactory()\n" +" .getCurrentSession().beginTransaction();\n" +"\n" +" // Process request and render page...\n" +"\n" +" // End unit of work\n" +" HibernateUtil.getSessionFactory()\n" +" .getCurrentSession().getTransaction().commit();\n" +"\n" +" } catch (Exception ex) {\n" +" HibernateUtil.getSessionFactory()\n" +" .getCurrentSession().getTransaction().rollback();\n" +" throw new ServletException(ex);\n" +" }\n" +"\n" +"}" + #. Tag: para +#: tutorial.xml:985 #, no-c-format msgid "" "Save this servlet as src/main/java/org/hibernate/tutorial/web/" @@ -1416,6 +2637,7 @@ msgid "" msgstr "" #. Tag: para +#: tutorial.xml:990 #, no-c-format msgid "" "The pattern applied here is called session-per-request. " @@ -1434,6 +2656,7 @@ msgstr "" "しません)。" #. Tag: para +#: tutorial.xml:999 #, no-c-format msgid "" "Do not use a new Hibernate Session " @@ -1448,6 +2671,7 @@ msgstr "" "literal> を使用してください。" #. Tag: para +#: tutorial.xml:1006 #, no-c-format msgid "" "Next, the possible actions of the request are processed and the response " @@ -1457,6 +2681,7 @@ msgstr "" "す。これについてはすぐに説明します。" #. Tag: para +#: tutorial.xml:1011 #, no-c-format msgid "" "Finally, the unit of work ends when processing and rendering are complete. " @@ -1479,18 +2704,86 @@ msgstr "" "しょう。" #. Tag: title +#: tutorial.xml:1025 #, no-c-format msgid "Processing and rendering" msgstr "処理と描画" #. Tag: para +#: tutorial.xml:1027 #, no-c-format msgid "" "Now you can implement the processing of the request and the rendering of the " "page." msgstr "では、リクエストの処理とページの描画を実装します。" +#. Tag: programlisting +#: tutorial.xml:1031 +#, fuzzy, no-c-format +msgid "" +"Event Manager" +"\");\n" +"\n" +" // Handle actions\n" +" if ( \"store\".equals(request.getParameter(\"action\")) ) {\n" +"\n" +" String eventTitle = request.getParameter(\"eventTitle\");\n" +" String eventDate = request.getParameter(\"eventDate\");\n" +"\n" +" if ( \"\".equals(eventTitle) || \"\".equals(eventDate) ) {\n" +" out.println(\"Please enter event title and date.\");\n" +" }\n" +" else {\n" +" createAndStoreEvent(eventTitle, dateFormatter.parse" +"(eventDate));\n" +" out.println(\"Added event.\");\n" +" }\n" +" }\n" +"\n" +" // Print page\n" +" printEventForm(out);\n" +" listEvents(out, dateFormatter);\n" +"\n" +" // Write HTML footer\n" +" out.println(\"\");\n" +" out.flush();\n" +" out.close();]]>" +msgstr "" +"// Write HTML header\n" +"PrintWriter out = response.getWriter();\n" +"out.println(\"<html><head><title>Event Manager</" +"title></head><body>\");\n" +"\n" +"// Handle actions\n" +"if ( \"store\".equals(request.getParameter(\"action\")) ) {\n" +"\n" +" String eventTitle = request.getParameter(\"eventTitle\");\n" +" String eventDate = request.getParameter(\"eventDate\");\n" +"\n" +" if ( \"\".equals(eventTitle) || \"\".equals(eventDate) ) {\n" +" out.println(\"<b><i>Please enter event title and date." +"</i></b>\");\n" +" } else {\n" +" createAndStoreEvent(eventTitle, dateFormatter.parse(eventDate));\n" +" out.println(\"<b><i>Added event.</i></b>" +"\");\n" +" }\n" +"}\n" +"\n" +"// Print page\n" +"printEventForm(out);\n" +"listEvents(out, dateFormatter);\n" +"\n" +"// Write HTML footer\n" +"out.println(\"</body></html>\");\n" +"out.flush();\n" +"out.close();" + #. Tag: para +#: tutorial.xml:1033 #, no-c-format msgid "" "This coding style, with a mix of Java and HTML, would not scale in a more " @@ -1507,7 +2800,36 @@ msgstr "" "ムと、データベースにある全てのイベントのリストが表示されます。最初のメソッド" "はごく単純な HTML 出力です。" +#. Tag: programlisting +#: tutorial.xml:1042 +#, fuzzy, no-c-format +msgid "" +"Add new event:\");\n" +" out.println(\"
\");\n" +" out.println(\"Title:
" +"\");\n" +" out.println(\"Date (e.g. 24.12.2009):
\");\n" +" out.println(\"" +"\");\n" +" out.println(\"
\");\n" +" }]]>" +msgstr "" +"private void printEventForm(PrintWriter out) {\n" +" out.println(\"<h2>Add new event:</h2>\");\n" +" out.println(\"<form>\");\n" +" out.println(\"Title: <input name='eventTitle' length='50'/><br/" +">\");\n" +" out.println(\"Date (e.g. 24.12.2009): <input name='eventDate' " +"length='10'/><br/>\");\n" +" out.println(\"<input type='submit' name='action' value='store'/>" +"\");\n" +" out.println(\"</form>\");\n" +"}" + #. Tag: para +#: tutorial.xml:1044 #, no-c-format msgid "" "The listEvents() method uses the Hibernate " @@ -1516,7 +2838,62 @@ msgstr "" "listEvents() メソッドは、現在のスレッドに結びつく " "Hibernate の Session を使用して、クエリを実行します。" +#. Tag: programlisting +#: tutorial.xml:1050 +#, fuzzy, no-c-format +msgid "" +" 0) {\n" +" out.println(\"

Events in database:

\");\n" +" out.println(\"\");\n" +" out.println(\"\");\n" +" out.println(\"\");\n" +" out.println(\"\");\n" +" out.println(\"\");\n" +" Iterator it = result.iterator();\n" +" while (it.hasNext()) {\n" +" Event event = (Event) it.next();\n" +" out.println(\"\");\n" +" out.println(\"\");\n" +" out.println(\"\");\n" +" out.println(\"\");\n" +" }\n" +" out.println(\"
Event titleEvent date
\" + event.getTitle() + \"\" + dateFormatter.format(event.getDate()) " +"+ \"
\");\n" +" }\n" +" }]]>" +msgstr "" +"private void listEvents(PrintWriter out, SimpleDateFormat dateFormatter) {\n" +"\n" +" List result = HibernateUtil.getSessionFactory()\n" +" .getCurrentSession().createCriteria(Event.class).list" +"();\n" +" if (result.size() > 0) {\n" +" out.println(\"<h2>Events in database:</h2>\");\n" +" out.println(\"<table border='1'>\");\n" +" out.println(\"<tr>\");\n" +" out.println(\"<th>Event title</th>\");\n" +" out.println(\"<th>Event date</th>\");\n" +" out.println(\"</tr>\");\n" +" for (Iterator it = result.iterator(); it.hasNext();) {\n" +" Event event = (Event) it.next();\n" +" out.println(\"<tr>\");\n" +" out.println(\"<td>\" + event.getTitle() + \"</td>" +"\");\n" +" out.println(\"<td>\" + dateFormatter.format(event.getDate" +"()) + \"</td>\");\n" +" out.println(\"</tr>\");\n" +" }\n" +" out.println(\"</table>\");\n" +" }\n" +"}" + #. Tag: para +#: tutorial.xml:1052 #, no-c-format msgid "" "Finally, the store action is dispatched to the " @@ -1527,7 +2904,31 @@ msgstr "" "
メソッドを呼び出します。このメソッドでも現在のスレッドの " "Session を利用します。" +#. Tag: programlisting +#: tutorial.xml:1058 +#, fuzzy, no-c-format +msgid "" +"" +msgstr "" +"protected void createAndStoreEvent(String title, Date theDate) {\n" +" Event theEvent = new Event();\n" +" theEvent.setTitle(title);\n" +" theEvent.setDate(theDate);\n" +"\n" +" HibernateUtil.getSessionFactory()\n" +" .getCurrentSession().save(theEvent);\n" +"}" + #. Tag: para +#: tutorial.xml:1060 #, no-c-format msgid "" "The servlet is now complete. A request to the servlet will be processed in a " @@ -1550,11 +2951,13 @@ msgstr "" "Hibernate の Wiki を参照してください。" #. Tag: title +#: tutorial.xml:1074 #, no-c-format msgid "Deploying and testing" msgstr "デプロイとテスト" #. Tag: para +#: tutorial.xml:1076 #, no-c-format msgid "" "To deploy this application for testing we must create a Web ARchive (WAR). " @@ -1562,7 +2965,50 @@ msgid "" "web.xml
" msgstr "" +#. Tag: programlisting +#: tutorial.xml:1082 +#, fuzzy, no-c-format +msgid "" +"\n" +"\n" +"\n" +" \n" +" Event Manager\n" +" org.hibernate.tutorial.web.EventManagerServlet\n" +" \n" +"\n" +" \n" +" Event Manager\n" +" /eventmanager\n" +" \n" +"]]>" +msgstr "" +"<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n" +"<web-app version=\"2.4\"\n" +" xmlns=\"http://java.sun.com/xml/ns/j2ee\"\n" +" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"\n" +" xsi:schemaLocation=\"http://java.sun.com/xml/ns/j2ee\n" +" http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd\">\n" +"\n" +" <servlet>\n" +" <servlet-name>Event Manager</servlet-name>\n" +" <servlet-class>events.EventManagerServlet</servlet-" +"class>\n" +" </servlet>\n" +"\n" +" <servlet-mapping>\n" +" <servlet-name>Event Manager</servlet-name>\n" +" <url-pattern>/eventmanager</url-pattern>\n" +" </servlet-mapping>\n" +"</web-app>" + #. Tag: para +#: tutorial.xml:1084 #, no-c-format msgid "" "To build and deploy call mvn package in your project " @@ -1574,10 +3020,11 @@ msgstr "" "Tomcat の webapp ディレクトリにコピーしてください。" #. Tag: para +#: tutorial.xml:1091 #, fuzzy, no-c-format msgid "" "If you do not have Tomcat installed, download it from and follow the installation instructions. Our " +"tomcat.apache.org/\"> and follow the installation instructions. Our " "application requires no changes to the standard Tomcat configuration." msgstr "" "まだ Tomcat をインストールしていなければ、ダウンロードして、インストールガイ" @@ -1585,6 +3032,7 @@ msgstr "" "Tomcat の設定を変更する必要はありません。" #. Tag: para +#: tutorial.xml:1099 #, no-c-format msgid "" "Once deployed and Tomcat is running, access the application at " @@ -1602,11 +3050,13 @@ msgstr "" "細を確認してください。" #. Tag: title +#: tutorial.xml:1112 #, no-c-format msgid "Summary" msgstr "要約" #. Tag: para +#: tutorial.xml:1114 #, no-c-format msgid "" "This tutorial covered the basics of writing a simple standalone Hibernate " @@ -1615,1181 +3065,3 @@ msgid "" msgstr "" "このチュートリアルでは、簡単なスタンドアローンの Hibernate アプリケーションと" "小規模の Web アプリケーションを書くための基本を紹介しました。" - -#, fuzzy -#~ msgid "" -#~ "" -#~ msgstr "" -#~ "package events;\n" -#~ "\n" -#~ "import java.util.Date;\n" -#~ "\n" -#~ "public class Event {\n" -#~ " private Long id;\n" -#~ "\n" -#~ " private String title;\n" -#~ " private Date date;\n" -#~ "\n" -#~ " public Event() {}\n" -#~ "\n" -#~ " public Long getId() {\n" -#~ " return id;\n" -#~ " }\n" -#~ "\n" -#~ " private void setId(Long id) {\n" -#~ " this.id = id;\n" -#~ " }\n" -#~ "\n" -#~ " public Date getDate() {\n" -#~ " return date;\n" -#~ " }\n" -#~ "\n" -#~ " public void setDate(Date date) {\n" -#~ " this.date = date;\n" -#~ " }\n" -#~ "\n" -#~ " public String getTitle() {\n" -#~ " return title;\n" -#~ " }\n" -#~ "\n" -#~ " public void setTitle(String title) {\n" -#~ " this.title = title;\n" -#~ " }\n" -#~ "}" - -#, fuzzy -#~ msgid "" -#~ "\n" -#~ "\n" -#~ "\n" -#~ "\n" -#~ "[...]\n" -#~ "]]>" -#~ msgstr "" -#~ "<?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>\n" -#~ "[...]\n" -#~ "</hibernate-mapping>" - -#, fuzzy -#~ msgid "" -#~ "\n" -#~ "\n" -#~ " \n" -#~ "\n" -#~ " \n" -#~ "\n" -#~ "]]>" -#~ msgstr "" -#~ "<hibernate-mapping>\n" -#~ "\n" -#~ " <class name=\"events.Event\" table=\"EVENTS\">\n" -#~ "\n" -#~ " </class>\n" -#~ "\n" -#~ "</hibernate-mapping>" - -#, fuzzy -#~ msgid "" -#~ "\n" -#~ "\n" -#~ " \n" -#~ " \n" -#~ " \n" -#~ " \n" -#~ " \n" -#~ "\n" -#~ "]]>" -#~ msgstr "" -#~ "<hibernate-mapping>\n" -#~ "\n" -#~ " <class name=\"events.Event\" table=\"EVENTS\">\n" -#~ " <id name=\"id\" column=\"EVENT_ID\">\n" -#~ " <generator class=\"native\"/>\n" -#~ " </id>\n" -#~ " </class>\n" -#~ "\n" -#~ "</hibernate-mapping>" - -#, fuzzy -#~ msgid "" -#~ "\n" -#~ "\n" -#~ " \n" -#~ " \n" -#~ " \n" -#~ " \n" -#~ " \n" -#~ " \n" -#~ " \n" -#~ "\n" -#~ "]]>" -#~ msgstr "" -#~ "<hibernate-mapping>\n" -#~ "\n" -#~ " <class name=\"events.Event\" table=\"EVENTS\">\n" -#~ " <id name=\"id\" column=\"EVENT_ID\">\n" -#~ " <generator class=\"native\"/>\n" -#~ " </id>\n" -#~ " <property name=\"date\" type=\"timestamp\" column=\"EVENT_DATE" -#~ "\"/>\n" -#~ " <property name=\"title\"/>\n" -#~ " </class>\n" -#~ "\n" -#~ "</hibernate-mapping>" - -#, fuzzy -#~ msgid "" -#~ "\n" -#~ "\n" -#~ "\n" -#~ "\n" -#~ "\n" -#~ " \n" -#~ "\n" -#~ " \n" -#~ " org.hsqldb.jdbcDriver\n" -#~ " jdbc:hsqldb:hsql://localhost\n" -#~ " sa\n" -#~ " \n" -#~ "\n" -#~ " \n" -#~ " 1\n" -#~ "\n" -#~ " \n" -#~ " org.hibernate.dialect.HSQLDialect\n" -#~ "\n" -#~ " \n" -#~ " thread\n" -#~ "\n" -#~ " \n" -#~ " org.hibernate.cache." -#~ "NoCacheProvider\n" -#~ "\n" -#~ " \n" -#~ " true\n" -#~ "\n" -#~ " \n" -#~ " update\n" -#~ "\n" -#~ " \n" -#~ "\n" -#~ " \n" -#~ "\n" -#~ "]]>" -#~ msgstr "" -#~ "<?xml version='1.0' encoding='utf-8'?>\n" -#~ "<!DOCTYPE hibernate-configuration PUBLIC\n" -#~ " \"-//Hibernate/Hibernate Configuration DTD 3.0//EN\"\n" -#~ " \"http://hibernate.sourceforge.net/hibernate-configuration-3.0.dtd" -#~ "\">\n" -#~ "\n" -#~ "<hibernate-configuration>\n" -#~ "\n" -#~ " <session-factory>\n" -#~ "\n" -#~ " <!-- Database connection settings -->\n" -#~ " <property name=\"connection.driver_class\">org.hsqldb." -#~ "jdbcDriver</property>\n" -#~ " <property name=\"connection.url\">jdbc:hsqldb:hsql://" -#~ "localhost</property>\n" -#~ " <property name=\"connection.username\">sa</property>\n" -#~ " <property name=\"connection.password\"></property>\n" -#~ "\n" -#~ " <!-- JDBC connection pool (use the built-in) -->\n" -#~ " <property name=\"connection.pool_size\">1</property>\n" -#~ "\n" -#~ " <!-- SQL dialect -->\n" -#~ " <property name=\"dialect\">org.hibernate.dialect." -#~ "HSQLDialect</property>\n" -#~ "\n" -#~ " <!-- Enable Hibernate's automatic session context management --" -#~ ">\n" -#~ " <property name=\"current_session_context_class\">thread</" -#~ "property>\n" -#~ "\n" -#~ " <!-- Disable the second-level cache -->\n" -#~ " <property name=\"cache.provider_class\">org.hibernate.cache." -#~ "NoCacheProvider</property>\n" -#~ "\n" -#~ " <!-- Echo all executed SQL to stdout -->\n" -#~ " <property name=\"show_sql\">true</property>\n" -#~ "\n" -#~ " <!-- Drop and re-create the database schema on startup -->\n" -#~ " <property name=\"hbm2ddl.auto\">create</property>\n" -#~ "\n" -#~ " <mapping resource=\"events/Event.hbm.xml\"/>\n" -#~ "\n" -#~ " </session-factory>\n" -#~ "\n" -#~ "</hibernate-configuration>" - -#, fuzzy -#~ msgid "" -#~ "" -#~ msgstr "" -#~ "package util;\n" -#~ "\n" -#~ "import org.hibernate.*;\n" -#~ "import org.hibernate.cfg.*;\n" -#~ "\n" -#~ "public class HibernateUtil {\n" -#~ "\n" -#~ " private static final SessionFactory sessionFactory;\n" -#~ "\n" -#~ " static {\n" -#~ " try {\n" -#~ " // Create the SessionFactory from hibernate.cfg.xml\n" -#~ " sessionFactory = new Configuration().configure()." -#~ "buildSessionFactory();\n" -#~ " } catch (Throwable ex) {\n" -#~ " // Make sure you log the exception, as it might be swallowed\n" -#~ " System.err.println(\"Initial SessionFactory creation failed." -#~ "\" + ex);\n" -#~ " throw new ExceptionInInitializerError(ex);\n" -#~ " }\n" -#~ " }\n" -#~ "\n" -#~ " public static SessionFactory getSessionFactory() {\n" -#~ " return sessionFactory;\n" -#~ " }\n" -#~ "\n" -#~ "}" - -#, fuzzy -#~ msgid "" -#~ "" -#~ msgstr "" -#~ "package events;\n" -#~ "import org.hibernate.Session;\n" -#~ "\n" -#~ "import java.util.Date;\n" -#~ "\n" -#~ "import util.HibernateUtil;\n" -#~ "\n" -#~ "public class EventManager {\n" -#~ "\n" -#~ " public static void main(String[] args) {\n" -#~ " EventManager mgr = new EventManager();\n" -#~ "\n" -#~ " if (args[0].equals(\"store\")) {\n" -#~ " mgr.createAndStoreEvent(\"My Event\", new Date());\n" -#~ " }\n" -#~ "\n" -#~ " HibernateUtil.getSessionFactory().close();\n" -#~ " }\n" -#~ "\n" -#~ " private void createAndStoreEvent(String title, Date theDate) {\n" -#~ "\n" -#~ " Session session = HibernateUtil.getSessionFactory()." -#~ "getCurrentSession();\n" -#~ "\n" -#~ " session.beginTransaction();\n" -#~ "\n" -#~ " Event theEvent = new Event();\n" -#~ " theEvent.setTitle(title);\n" -#~ " theEvent.setDate(theDate);\n" -#~ "\n" -#~ " session.save(theEvent);\n" -#~ "\n" -#~ " session.getTransaction().commit();\n" -#~ " }\n" -#~ "\n" -#~ "}" - -#, fuzzy -#~ msgid "" -#~ "" -#~ msgstr "" -#~ "[java] Hibernate: insert into EVENTS (EVENT_DATE, title, EVENT_ID) values " -#~ "(?, ?, ?)" - -#, fuzzy -#~ msgid "" -#~ "" -#~ msgstr "" -#~ "if (args[0].equals(\"store\")) {\n" -#~ " mgr.createAndStoreEvent(\"My Event\", new Date());\n" -#~ "}\n" -#~ "else if (args[0].equals(\"list\")) {\n" -#~ " List events = mgr.listEvents();\n" -#~ " for (int i = 0; i < events.size(); i++) {\n" -#~ " Event theEvent = (Event) events.get(i);\n" -#~ " System.out.println(\"Event: \" + theEvent.getTitle() +\n" -#~ " \" Time: \" + theEvent.getDate());\n" -#~ " }\n" -#~ "}" - -#, fuzzy -#~ msgid "" -#~ "" -#~ msgstr "" -#~ "private List listEvents() {\n" -#~ "\n" -#~ " Session session = HibernateUtil.getSessionFactory().getCurrentSession" -#~ "();\n" -#~ "\n" -#~ " session.beginTransaction();\n" -#~ "\n" -#~ " List result = session.createQuery(\"from Event\").list();\n" -#~ "\n" -#~ " session.getTransaction().commit();\n" -#~ "\n" -#~ " return result;\n" -#~ "}" - -#, fuzzy -#~ msgid "" -#~ "" -#~ msgstr "" -#~ "package events;\n" -#~ "\n" -#~ "public class Person {\n" -#~ "\n" -#~ " private Long id;\n" -#~ " private int age;\n" -#~ " private String firstname;\n" -#~ " private String lastname;\n" -#~ "\n" -#~ " public Person() {}\n" -#~ "\n" -#~ " // Accessor methods for all properties, private setter for 'id'\n" -#~ "\n" -#~ "}" - -#, fuzzy -#~ msgid "" -#~ "\n" -#~ "\n" -#~ " \n" -#~ " \n" -#~ " \n" -#~ " \n" -#~ " \n" -#~ " \n" -#~ " \n" -#~ " \n" -#~ "\n" -#~ "]]>" -#~ msgstr "" -#~ "<hibernate-mapping>\n" -#~ "\n" -#~ " <class name=\"events.Person\" table=\"PERSON\">\n" -#~ " <id name=\"id\" column=\"PERSON_ID\">\n" -#~ " <generator class=\"native\"/>\n" -#~ " </id>\n" -#~ " <property name=\"age\"/>\n" -#~ " <property name=\"firstname\"/>\n" -#~ " <property name=\"lastname\"/>\n" -#~ " </class>\n" -#~ "\n" -#~ "</hibernate-mapping>" - -#, fuzzy -#~ msgid "" -#~ "\n" -#~ "]]>" -#~ msgstr "" -#~ "<mapping resource=\"events/Event.hbm.xml\"/>\n" -#~ "<mapping resource=\"events/Person.hbm.xml\"/>" - -#, fuzzy -#~ msgid "" -#~ "" -#~ msgstr "" -#~ "public class Person {\n" -#~ "\n" -#~ " private Set events = new HashSet();\n" -#~ "\n" -#~ " public Set getEvents() {\n" -#~ " return events;\n" -#~ " }\n" -#~ "\n" -#~ " public void setEvents(Set events) {\n" -#~ " this.events = events;\n" -#~ " }\n" -#~ "}" - -#, fuzzy -#~ msgid "" -#~ "\n" -#~ " \n" -#~ " \n" -#~ " \n" -#~ " \n" -#~ " \n" -#~ " \n" -#~ "\n" -#~ " \n" -#~ " \n" -#~ " \n" -#~ " \n" -#~ "\n" -#~ "]]>" -#~ msgstr "" -#~ "<class name=\"events.Person\" table=\"PERSON\">\n" -#~ " <id name=\"id\" column=\"PERSON_ID\">\n" -#~ " <generator class=\"native\"/>\n" -#~ " </id>\n" -#~ " <property name=\"age\"/>\n" -#~ " <property name=\"firstname\"/>\n" -#~ " <property name=\"lastname\"/>\n" -#~ "\n" -#~ " <set name=\"events\" table=\"PERSON_EVENT\">\n" -#~ " <key column=\"PERSON_ID\"/>\n" -#~ " <many-to-many column=\"EVENT_ID\" class=\"events.Event\"/>\n" -#~ " </set>\n" -#~ "\n" -#~ "</class>" - -#, fuzzy -#~ msgid "" -#~ " | *EVENT_ID | | |\n" -#~ " | EVENT_DATE | | *PERSON_ID | <--> | *PERSON_ID |\n" -#~ " | TITLE | |__________________| | AGE |\n" -#~ " |_____________| | FIRSTNAME |\n" -#~ " | LASTNAME |\n" -#~ " |_____________|\n" -#~ " ]]>" -#~ msgstr "" -#~ "_____________ __________________\n" -#~ " | | | | _____________\n" -#~ " | EVENTS | | PERSON_EVENT | | |\n" -#~ " |_____________| |__________________| | PERSON |\n" -#~ " | | | | |_____________|\n" -#~ " | *EVENT_ID | <--> | *EVENT_ID | | |\n" -#~ " | EVENT_DATE | | *PERSON_ID | <--> | *PERSON_ID |\n" -#~ " | TITLE | |__________________| | AGE |\n" -#~ " |_____________| | FIRSTNAME |\n" -#~ " | LASTNAME |\n" -#~ " |_____________|" - -#, fuzzy -#~ msgid "" -#~ "" -#~ msgstr "" -#~ "private void addPersonToEvent(Long personId, Long eventId) {\n" -#~ "\n" -#~ " Session session = HibernateUtil.getSessionFactory().getCurrentSession" -#~ "();\n" -#~ " session.beginTransaction();\n" -#~ "\n" -#~ " Person aPerson = (Person) session.load(Person.class, personId);\n" -#~ " Event anEvent = (Event) session.load(Event.class, eventId);\n" -#~ "\n" -#~ " aPerson.getEvents().add(anEvent);\n" -#~ "\n" -#~ " session.getTransaction().commit();\n" -#~ "}" - -#, fuzzy -#~ msgid "" -#~ "" -#~ msgstr "" -#~ "private void addPersonToEvent(Long personId, Long eventId) {\n" -#~ "\n" -#~ " Session session = HibernateUtil.getSessionFactory().getCurrentSession" -#~ "();\n" -#~ " session.beginTransaction();\n" -#~ "\n" -#~ " Person aPerson = (Person) session\n" -#~ " .createQuery(\"select p from Person p left join fetch p." -#~ "events where p.id = :pid\")\n" -#~ " .setParameter(\"pid\", personId)\n" -#~ " .uniqueResult(); // Eager fetch the collection so we can use " -#~ "it detached\n" -#~ "\n" -#~ " Event anEvent = (Event) session.load(Event.class, eventId);\n" -#~ "\n" -#~ " session.getTransaction().commit();\n" -#~ "\n" -#~ " // End of first unit of work\n" -#~ "\n" -#~ " aPerson.getEvents().add(anEvent); // aPerson (and its collection) is " -#~ "detached\n" -#~ "\n" -#~ " // Begin second unit of work\n" -#~ "\n" -#~ " Session session2 = HibernateUtil.getSessionFactory().getCurrentSession" -#~ "();\n" -#~ " session2.beginTransaction();\n" -#~ "\n" -#~ " session2.update(aPerson); // Reattachment of aPerson\n" -#~ "\n" -#~ " session2.getTransaction().commit();\n" -#~ "}" - -#, fuzzy -#~ msgid "" -#~ "" -#~ msgstr "" -#~ "else if (args[0].equals(\"addpersontoevent\")) {\n" -#~ " Long eventId = mgr.createAndStoreEvent(\"My Event\", new Date());\n" -#~ " Long personId = mgr.createAndStorePerson(\"Foo\", \"Bar\");\n" -#~ " mgr.addPersonToEvent(personId, eventId);\n" -#~ " System.out.println(\"Added person \" + personId + \" to event \" + " -#~ "eventId);\n" -#~ "}" - -#, fuzzy -#~ msgid "" -#~ "" -#~ msgstr "" -#~ "private Set emailAddresses = new HashSet();\n" -#~ "\n" -#~ "public Set getEmailAddresses() {\n" -#~ " return emailAddresses;\n" -#~ "}\n" -#~ "\n" -#~ "public void setEmailAddresses(Set emailAddresses) {\n" -#~ " this.emailAddresses = emailAddresses;\n" -#~ "}" - -#, fuzzy -#~ msgid "" -#~ "\n" -#~ " \n" -#~ " \n" -#~ " ]]>" -#~ msgstr "" -#~ "<set name=\"emailAddresses\" table=\"PERSON_EMAIL_ADDR\">\n" -#~ " <key column=\"PERSON_ID\"/>\n" -#~ " <element type=\"string\" column=\"EMAIL_ADDR\"/>\n" -#~ "</set>" - -#, fuzzy -#~ msgid "" -#~ " | *EVENT_ID | | | |" -#~ "___________________|\n" -#~ " | EVENT_DATE | | *PERSON_ID | <--> | *PERSON_ID | <--> | " -#~ "*PERSON_ID |\n" -#~ " | TITLE | |__________________| | AGE | | " -#~ "*EMAIL_ADDR |\n" -#~ " |_____________| | FIRSTNAME | |" -#~ "___________________|\n" -#~ " | LASTNAME |\n" -#~ " |_____________|\n" -#~ " ]]>" -#~ msgstr "" -#~ "_____________ __________________\n" -#~ " | | | | _____________\n" -#~ " | EVENTS | | PERSON_EVENT | | | " -#~ "___________________\n" -#~ " |_____________| |__________________| | PERSON | " -#~ "| |\n" -#~ " | | | | |_____________| | " -#~ "PERSON_EMAIL_ADDR |\n" -#~ " | *EVENT_ID | <--> | *EVENT_ID | | " -#~ "| |___________________|\n" -#~ " | EVENT_DATE | | *PERSON_ID | <--> | *PERSON_ID | " -#~ "<--> | *PERSON_ID |\n" -#~ " | TITLE | |__________________| | AGE | | " -#~ "*EMAIL_ADDR |\n" -#~ " |_____________| | FIRSTNAME | |" -#~ "___________________|\n" -#~ " | LASTNAME |\n" -#~ " |_____________|" - -#, fuzzy -#~ msgid "" -#~ "" -#~ msgstr "" -#~ "private void addEmailToPerson(Long personId, String emailAddress) {\n" -#~ "\n" -#~ " Session session = HibernateUtil.getSessionFactory().getCurrentSession" -#~ "();\n" -#~ " session.beginTransaction();\n" -#~ "\n" -#~ " Person aPerson = (Person) session.load(Person.class, personId);\n" -#~ "\n" -#~ " // The getEmailAddresses() might trigger a lazy load of the " -#~ "collection\n" -#~ " aPerson.getEmailAddresses().add(emailAddress);\n" -#~ "\n" -#~ " session.getTransaction().commit();\n" -#~ "}" - -#, fuzzy -#~ msgid "" -#~ "" -#~ msgstr "" -#~ "private Set participants = new HashSet();\n" -#~ "\n" -#~ "public Set getParticipants() {\n" -#~ " return participants;\n" -#~ "}\n" -#~ "\n" -#~ "public void setParticipants(Set participants) {\n" -#~ " this.participants = participants;\n" -#~ "}" - -#, fuzzy -#~ msgid "" -#~ "\n" -#~ " \n" -#~ " \n" -#~ " ]]>" -#~ msgstr "" -#~ "<set name=\"participants\" table=\"PERSON_EVENT\" inverse=\"true" -#~ "\">\n" -#~ " <key column=\"EVENT_ID\"/>\n" -#~ " <many-to-many column=\"PERSON_ID\" class=\"events.Person\"/>\n" -#~ "</set>" - -#, fuzzy -#~ msgid "" -#~ "" -#~ msgstr "" -#~ "protected Set getEvents() {\n" -#~ " return events;\n" -#~ "}\n" -#~ "\n" -#~ "protected void setEvents(Set events) {\n" -#~ " this.events = events;\n" -#~ "}\n" -#~ "\n" -#~ "public void addToEvent(Event event) {\n" -#~ " this.getEvents().add(event);\n" -#~ " event.getParticipants().add(this);\n" -#~ "}\n" -#~ "\n" -#~ "public void removeFromEvent(Event event) {\n" -#~ " this.getEvents().remove(event);\n" -#~ " event.getParticipants().remove(this);\n" -#~ "}" - -#, fuzzy -#~ msgid "" -#~ "" -#~ msgstr "" -#~ "protected void doGet(HttpServletRequest request,\n" -#~ " HttpServletResponse response)\n" -#~ " throws ServletException, IOException {\n" -#~ "\n" -#~ " SimpleDateFormat dateFormatter = new SimpleDateFormat(\"dd.MM.yyyy" -#~ "\");\n" -#~ "\n" -#~ " try {\n" -#~ " // Begin unit of work\n" -#~ " HibernateUtil.getSessionFactory()\n" -#~ " .getCurrentSession().beginTransaction();\n" -#~ "\n" -#~ " // Process request and render page...\n" -#~ "\n" -#~ " // End unit of work\n" -#~ " HibernateUtil.getSessionFactory()\n" -#~ " .getCurrentSession().getTransaction().commit();\n" -#~ "\n" -#~ " } catch (Exception ex) {\n" -#~ " HibernateUtil.getSessionFactory()\n" -#~ " .getCurrentSession().getTransaction().rollback();\n" -#~ " throw new ServletException(ex);\n" -#~ " }\n" -#~ "\n" -#~ "}" - -#, fuzzy -#~ msgid "" -#~ "Event Manager\");\n" -#~ "\n" -#~ " // Handle actions\n" -#~ " if ( \"store\".equals(request.getParameter(\"action\")) ) {\n" -#~ "\n" -#~ " String eventTitle = request.getParameter(\"eventTitle\");\n" -#~ " String eventDate = request.getParameter(\"eventDate\");\n" -#~ "\n" -#~ " if ( \"\".equals(eventTitle) || \"\".equals(eventDate) ) {\n" -#~ " out.println(\"Please enter event title and date.\");\n" -#~ " }\n" -#~ " else {\n" -#~ " createAndStoreEvent(eventTitle, dateFormatter.parse" -#~ "(eventDate));\n" -#~ " out.println(\"Added event.\");\n" -#~ " }\n" -#~ " }\n" -#~ "\n" -#~ " // Print page\n" -#~ " printEventForm(out);\n" -#~ " listEvents(out, dateFormatter);\n" -#~ "\n" -#~ " // Write HTML footer\n" -#~ " out.println(\"\");\n" -#~ " out.flush();\n" -#~ " out.close();]]>" -#~ msgstr "" -#~ "// Write HTML header\n" -#~ "PrintWriter out = response.getWriter();\n" -#~ "out.println(\"<html><head><title>Event Manager</" -#~ "title></head><body>\");\n" -#~ "\n" -#~ "// Handle actions\n" -#~ "if ( \"store\".equals(request.getParameter(\"action\")) ) {\n" -#~ "\n" -#~ " String eventTitle = request.getParameter(\"eventTitle\");\n" -#~ " String eventDate = request.getParameter(\"eventDate\");\n" -#~ "\n" -#~ " if ( \"\".equals(eventTitle) || \"\".equals(eventDate) ) {\n" -#~ " out.println(\"<b><i>Please enter event title and date." -#~ "</i></b>\");\n" -#~ " } else {\n" -#~ " createAndStoreEvent(eventTitle, dateFormatter.parse(eventDate));\n" -#~ " out.println(\"<b><i>Added event.</i></b>" -#~ "\");\n" -#~ " }\n" -#~ "}\n" -#~ "\n" -#~ "// Print page\n" -#~ "printEventForm(out);\n" -#~ "listEvents(out, dateFormatter);\n" -#~ "\n" -#~ "// Write HTML footer\n" -#~ "out.println(\"</body></html>\");\n" -#~ "out.flush();\n" -#~ "out.close();" - -#, fuzzy -#~ msgid "" -#~ "Add new event:\");\n" -#~ " out.println(\"
\");\n" -#~ " out.println(\"Title:
" -#~ "\");\n" -#~ " out.println(\"Date (e.g. 24.12.2009):
\");\n" -#~ " out.println(\"" -#~ "\");\n" -#~ " out.println(\"
\");\n" -#~ " }]]>" -#~ msgstr "" -#~ "private void printEventForm(PrintWriter out) {\n" -#~ " out.println(\"<h2>Add new event:</h2>\");\n" -#~ " out.println(\"<form>\");\n" -#~ " out.println(\"Title: <input name='eventTitle' length='50'/><" -#~ "br/>\");\n" -#~ " out.println(\"Date (e.g. 24.12.2009): <input name='eventDate' " -#~ "length='10'/><br/>\");\n" -#~ " out.println(\"<input type='submit' name='action' value='store'/>" -#~ "\");\n" -#~ " out.println(\"</form>\");\n" -#~ "}" - -#, fuzzy -#~ msgid "" -#~ " 0) {\n" -#~ " out.println(\"

Events in database:

\");\n" -#~ " out.println(\"\");\n" -#~ " out.println(\"\");\n" -#~ " out.println(\"\");\n" -#~ " out.println(\"\");\n" -#~ " out.println(\"\");\n" -#~ " Iterator it = result.iterator();\n" -#~ " while (it.hasNext()) {\n" -#~ " Event event = (Event) it.next();\n" -#~ " out.println(\"\");\n" -#~ " out.println(\"\");\n" -#~ " out.println(\"\");\n" -#~ " out.println(\"\");\n" -#~ " }\n" -#~ " out.println(\"
Event titleEvent date
\" + event.getTitle() + \"\" + dateFormatter.format(event.getDate" -#~ "()) + \"
\");\n" -#~ " }\n" -#~ " }]]>" -#~ msgstr "" -#~ "private void listEvents(PrintWriter out, SimpleDateFormat dateFormatter) " -#~ "{\n" -#~ "\n" -#~ " List result = HibernateUtil.getSessionFactory()\n" -#~ " .getCurrentSession().createCriteria(Event.class).list" -#~ "();\n" -#~ " if (result.size() > 0) {\n" -#~ " out.println(\"<h2>Events in database:</h2>\");\n" -#~ " out.println(\"<table border='1'>\");\n" -#~ " out.println(\"<tr>\");\n" -#~ " out.println(\"<th>Event title</th>\");\n" -#~ " out.println(\"<th>Event date</th>\");\n" -#~ " out.println(\"</tr>\");\n" -#~ " for (Iterator it = result.iterator(); it.hasNext();) {\n" -#~ " Event event = (Event) it.next();\n" -#~ " out.println(\"<tr>\");\n" -#~ " out.println(\"<td>\" + event.getTitle() + \"</td>" -#~ "\");\n" -#~ " out.println(\"<td>\" + dateFormatter.format(event." -#~ "getDate()) + \"</td>\");\n" -#~ " out.println(\"</tr>\");\n" -#~ " }\n" -#~ " out.println(\"</table>\");\n" -#~ " }\n" -#~ "}" - -#, fuzzy -#~ msgid "" -#~ "" -#~ msgstr "" -#~ "protected void createAndStoreEvent(String title, Date theDate) {\n" -#~ " Event theEvent = new Event();\n" -#~ " theEvent.setTitle(title);\n" -#~ " theEvent.setDate(theDate);\n" -#~ "\n" -#~ " HibernateUtil.getSessionFactory()\n" -#~ " .getCurrentSession().save(theEvent);\n" -#~ "}" - -#, fuzzy -#~ msgid "" -#~ "\n" -#~ "\n" -#~ "\n" -#~ " \n" -#~ " Event Manager\n" -#~ " org.hibernate.tutorial.web.EventManagerServlet\n" -#~ " \n" -#~ "\n" -#~ " \n" -#~ " Event Manager\n" -#~ " /eventmanager\n" -#~ " \n" -#~ "]]>" -#~ msgstr "" -#~ "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n" -#~ "<web-app version=\"2.4\"\n" -#~ " xmlns=\"http://java.sun.com/xml/ns/j2ee\"\n" -#~ " xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"\n" -#~ " xsi:schemaLocation=\"http://java.sun.com/xml/ns/j2ee\n" -#~ " http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd\">\n" -#~ "\n" -#~ " <servlet>\n" -#~ " <servlet-name>Event Manager</servlet-name>\n" -#~ " <servlet-class>events.EventManagerServlet</servlet-" -#~ "class>\n" -#~ " </servlet>\n" -#~ "\n" -#~ " <servlet-mapping>\n" -#~ " <servlet-name>Event Manager</servlet-name>\n" -#~ " <url-pattern>/eventmanager</url-pattern>\n" -#~ " </servlet-mapping>\n" -#~ "</web-app>" diff --git a/documentation/manual/src/main/docbook/pot/HIBERNATE_-_Relational_Persistence_for_Idiomatic_Java.pot b/documentation/manual/src/main/docbook/pot/HIBERNATE_-_Relational_Persistence_for_Idiomatic_Java.pot index b8717b2283..0b4665fcfb 100644 --- a/documentation/manual/src/main/docbook/pot/HIBERNATE_-_Relational_Persistence_for_Idiomatic_Java.pot +++ b/documentation/manual/src/main/docbook/pot/HIBERNATE_-_Relational_Persistence_for_Idiomatic_Java.pot @@ -1,14 +1,16 @@ -# -# AUTHOR , YEAR. +# SOME DESCRIPTIVE TITLE. +# FIRST AUTHOR , YEAR. # +#, fuzzy msgid "" msgstr "" -"Project-Id-Version: 0\n" -"POT-Creation-Date: 2010-03-31T00:33:04\n" -"PO-Revision-Date: 2010-03-31T00:33:04\n" -"Last-Translator: Automatically generated\n" -"Language-Team: None\n" +"Project-Id-Version: PACKAGE VERSION\n" +"Report-Msgid-Bugs-To: http://bugs.kde.org\n" +"POT-Creation-Date: 2010-07-20 21:02+0000\n" +"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" +"Last-Translator: FULL NAME \n" +"Language-Team: LANGUAGE \n" "MIME-Version: 1.0\n" -"Content-Type: application/x-publican; charset=UTF-8\n" +"Content-Type: application/x-xml2pot; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" diff --git a/documentation/manual/src/main/docbook/pot/author_group.pot b/documentation/manual/src/main/docbook/pot/author_group.pot index b7b04eb8af..566dd44e88 100644 --- a/documentation/manual/src/main/docbook/pot/author_group.pot +++ b/documentation/manual/src/main/docbook/pot/author_group.pot @@ -1,149 +1,196 @@ -# -# AUTHOR , YEAR. +# SOME DESCRIPTIVE TITLE. +# FIRST AUTHOR , YEAR. # +#, fuzzy msgid "" msgstr "" -"Project-Id-Version: 0\n" -"POT-Creation-Date: 2010-03-31T00:33:04\n" -"PO-Revision-Date: 2010-03-31T00:33:04\n" -"Last-Translator: Automatically generated\n" -"Language-Team: None\n" +"Project-Id-Version: PACKAGE VERSION\n" +"Report-Msgid-Bugs-To: http://bugs.kde.org\n" +"POT-Creation-Date: 2010-07-20 21:02+0000\n" +"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" +"Last-Translator: FULL NAME \n" +"Language-Team: LANGUAGE \n" "MIME-Version: 1.0\n" -"Content-Type: application/x-publican; charset=UTF-8\n" +"Content-Type: application/x-xml2pot; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" -#. Tag: firstname +#. Tag: author +#: author_group.xml:28 #, no-c-format -msgid "Gavin" +msgid "Gavin King" msgstr "" -#. Tag: firstname +#. Tag: author +#: author_group.xml:32 #, no-c-format -msgid "Christian" +msgid "Christian Bauer" msgstr "" -#. Tag: firstname +#. Tag: author +#: author_group.xml:36 #, no-c-format -msgid "Max" +msgid "Max Rydahl Andersen" msgstr "" -#. Tag: firstname +#. Tag: author +#: author_group.xml:41 #, no-c-format -msgid "Emmanuel" +msgid "Emmanuel Bernard" msgstr "" -#. Tag: firstname +#. Tag: author +#: author_group.xml:45 #, no-c-format -msgid "Steve" +msgid "Steve Ebersole" msgstr "" -#. Tag: firstname +#. Tag: author +#: author_group.xml:49 #, no-c-format -msgid "James" +msgid "Hardy Ferentschik" msgstr "" -#. Tag: firstname +#. Tag: othercredit +#: author_group.xml:54 #, no-c-format -msgid "Cheyenne" +msgid "James Cobb" msgstr "" -#. Tag: firstname +#. Tag: shortaffil +#: author_group.xml:58 author_group.xml:65 #, no-c-format -msgid "Vincent" +msgid "Graphic Design" msgstr "" -#. Tag: firstname +#. Tag: othercredit +#: author_group.xml:61 #, no-c-format -msgid "Sebastien" +msgid "Cheyenne Weaver" msgstr "" -#. Tag: firstname +#. Tag: othercredit +#: author_group.xml:74 #, no-c-format -msgid "Michael" +msgid " kreimer@bbs.frc.utn.edu.ar" msgstr "" -#. Tag: firstname +#. Tag: othercredit +#: author_group.xml:84 #, no-c-format -msgid "Baptiste" +msgid "Vincent Ricard" msgstr "" -#. Tag: firstname +#. Tag: othercredit +#: author_group.xml:88 #, no-c-format -msgid "Anthony" +msgid "Sebastien Cesbron" msgstr "" -#. Tag: firstname +#. Tag: othercredit +#: author_group.xml:92 #, no-c-format -msgid "Alvaro" +msgid "Michael Courcy" msgstr "" -#. Tag: firstname +#. Tag: othercredit +#: author_group.xml:96 #, no-c-format -msgid "Anderson" +msgid "Vincent Giguère" msgstr "" -#. Tag: firstname +#. Tag: othercredit +#: author_group.xml:100 #, no-c-format -msgid "Daniel Vieira" +msgid "Baptiste Mathus" msgstr "" -#. Tag: firstname +#. Tag: othercredit +#: author_group.xml:104 #, no-c-format -msgid "Francisco" +msgid "Emmanuel Bernard" msgstr "" -#. Tag: firstname +#. Tag: othercredit +#: author_group.xml:108 #, no-c-format -msgid "Gamarra" +msgid "Anthony Patricio" msgstr "" -#. Tag: firstname +#. Tag: othercredit +#: author_group.xml:118 #, no-c-format -msgid "Luiz Carlos" +msgid "Alvaro Netto alvaronetto@cetip.com.br" msgstr "" -#. Tag: firstname +#. Tag: othercredit +#: author_group.xml:123 #, no-c-format -msgid "Marcel" +msgid "Anderson Braulio andersonbraulio@gmail.com" msgstr "" -#. Tag: firstname +#. Tag: othercredit +#: author_group.xml:128 #, no-c-format -msgid "Paulo" +msgid "Daniel Vieira Costa danielvc@gmail.com" msgstr "" -#. Tag: firstname +#. Tag: othercredit +#: author_group.xml:133 #, no-c-format -msgid "Pablo L." +msgid "Francisco gamarra francisco.gamarra@gmail.com" msgstr "" -#. Tag: firstname +#. Tag: othercredit +#: author_group.xml:138 #, no-c-format -msgid "Renato" +msgid "Gamarra mauricio.gamarra@gmail.com" msgstr "" -#. Tag: firstname +#. Tag: othercredit +#: author_group.xml:142 #, no-c-format -msgid "Rogério" +msgid "Luiz Carlos Rodrigues luizcarlos_rodrigues@yahoo.com.br" msgstr "" -#. Tag: firstname +#. Tag: othercredit +#: author_group.xml:147 #, no-c-format -msgid "Wanderson" +msgid "Marcel Castelo marcel.castelo@gmail.com" msgstr "" -#. Tag: firstname +#. Tag: othercredit +#: author_group.xml:152 #, no-c-format -msgid "Cao" +msgid "Paulo César paulocol@gmail.com" msgstr "" -#. Tag: orgname +#. Tag: othercredit +#: author_group.xml:157 #, no-c-format -msgid "RedSaga" +msgid "Pablo L. de Miranda pablolmiranda@gmail.com" msgstr "" -#. Tag: contrib +#. Tag: othercredit +#: author_group.xml:162 #, no-c-format -msgid "Translation Lead" +msgid "Renato Deggau rdeggau@gmail.com" +msgstr "" + +#. Tag: othercredit +#: author_group.xml:167 +#, no-c-format +msgid "Rogério Araújo rgildoaraujo@yahoo.com.br" +msgstr "" + +#. Tag: othercredit +#: author_group.xml:172 +#, no-c-format +msgid "Wanderson Siqueira wandersonxs@gmail.com" +msgstr "" + +#. Tag: othercredit +#: author_group.xml:183 +#, no-c-format +msgid "Cao Xiaogang RedSaga Translation Lead caoxg@yahoo.com" msgstr "" diff --git a/documentation/manual/src/main/docbook/pot/content/basic_mapping.pot b/documentation/manual/src/main/docbook/pot/content/basic_mapping.pot index 8915b1cafa..4cdef1d066 100644 --- a/documentation/manual/src/main/docbook/pot/content/basic_mapping.pot +++ b/documentation/manual/src/main/docbook/pot/content/basic_mapping.pot @@ -1,1959 +1,5925 @@ -# -# AUTHOR , YEAR. +# SOME DESCRIPTIVE TITLE. +# FIRST AUTHOR , YEAR. # +#, fuzzy msgid "" msgstr "" -"Project-Id-Version: 0\n" -"POT-Creation-Date: 2010-02-11T05:38:15\n" -"PO-Revision-Date: 2010-02-11T05:38:15\n" -"Last-Translator: Automatically generated\n" -"Language-Team: None\n" +"Project-Id-Version: PACKAGE VERSION\n" +"Report-Msgid-Bugs-To: http://bugs.kde.org\n" +"POT-Creation-Date: 2010-07-20 21:02+0000\n" +"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" +"Last-Translator: FULL NAME \n" +"Language-Team: LANGUAGE \n" "MIME-Version: 1.0\n" -"Content-Type: application/x-publican; charset=UTF-8\n" +"Content-Type: application/x-xml2pot; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" #. Tag: title +#: basic_mapping.xml:31 #, no-c-format msgid "Basic O/R Mapping" msgstr "" #. Tag: title +#: basic_mapping.xml:34 #, no-c-format msgid "Mapping declaration" msgstr "" #. Tag: para +#: basic_mapping.xml:36 #, no-c-format -msgid "Object/relational mappings are usually defined in an XML document. The mapping document is designed to be readable and hand-editable. The mapping language is Java-centric, meaning that mappings are constructed around persistent class declarations and not table declarations." +msgid "Object/relational mappings can be defined in three approaches:" msgstr "" #. Tag: para +#: basic_mapping.xml:41 +#, no-c-format +msgid "using Java 5 annotations (via the Java Persistence 2 annotations)" +msgstr "" + +#. Tag: para +#: basic_mapping.xml:46 +#, no-c-format +msgid "using JPA 2 XML deployment descriptors (described in chapter XXX)" +msgstr "" + +#. Tag: para +#: basic_mapping.xml:51 +#, no-c-format +msgid "using the Hibernate legacy XML files approach known as hbm.xml" +msgstr "" + +#. Tag: para +#: basic_mapping.xml:56 +#, no-c-format +msgid "Annotations are split in two categories, the logical mapping annotations (describing the object model, the association between two entities etc.) and the physical mapping annotations (describing the physical schema, tables, columns, indexes, etc). We will mix annotations from both categories in the following code examples." +msgstr "" + +#. Tag: para +#: basic_mapping.xml:62 +#, no-c-format +msgid "JPA annotations are in the javax.persistence.* package. Hibernate specific extensions are in org.hibernate.annotations.*. You favorite IDE can auto-complete annotations and their attributes for you (even without a specific \"JPA\" plugin, since JPA annotations are plain Java 5 annotations)." +msgstr "" + +#. Tag: para +#: basic_mapping.xml:69 +#, no-c-format +msgid "Here is an example of mapping" +msgstr "" + +#. Tag: programlisting +#: basic_mapping.xml:71 +#, no-c-format +msgid "" + "package eg;\n" + "\n" + "@Entity \n" + "@Table(name=\"cats\") @Inheritance(strategy=SINGLE_TABLE)\n" + "@DiscriminatorValue(\"C\") @DiscriminatorColumn(name=\"subclass\", discriminatorType=CHAR)\n" + "public class Cat {\n" + " \n" + " @Id @GeneratedValue\n" + " public Integer getId() { return id; }\n" + " public void setId(Integer id) { this.id = id; }\n" + " private Integer id;\n" + "\n" + " public BigDecimal getWeight() { return weight; }\n" + " public void setWeight(BigDecimal weight) { this.weight = weight; }\n" + " private BigDecimal weight;\n" + "\n" + " @Temporal(DATE) @NotNull @Column(updatable=false)\n" + " public Date getBirthdate() { return birthdate; }\n" + " public void setBirthdate(Date birthdate) { this.birthdate = birthdate; }\n" + " private Date birthdate;\n" + "\n" + " @org.hibernate.annotations.Type(type=\"eg.types.ColorUserType\")\n" + " @NotNull @Column(updatable=false)\n" + " public ColorType getColor() { return color; }\n" + " public void setColor(ColorType color) { this.color = color; }\n" + " private ColorType color;\n" + "\n" + " @NotNull @Column(updatable=false)\n" + " public String getSex() { return sex; }\n" + " public void setSex(String sex) { this.sex = sex; }\n" + " private String sex;\n" + "\n" + " @NotNull @Column(updatable=false)\n" + " public Integer getLitterId() { return litterId; }\n" + " public void setLitterId(Integer litterId) { this.litterId = litterId; }\n" + " private Integer litterId;\n" + "\n" + " @ManyToOne @JoinColumn(name=\"mother_id\", updatable=false)\n" + " public Cat getMother() { return mother; }\n" + " public void setMother(Cat mother) { this.mother = mother; }\n" + " private Cat mother;\n" + "\n" + " @OneToMany(mappedBy=\"mother\") @OrderBy(\"litterId\")\n" + " public Set<Cat> getKittens() { return kittens; }\n" + " public void setKittens(Set<Cat> kittens) { this.kittens = kittens; }\n" + " private Set<Cat> kittens = new HashSet<Cat>();\n" + "}\n" + "\n" + "@Entity @DiscriminatorValue(\"D\")\n" + "public class DomesticCat extends Cat {\n" + "\n" + " public String getName() { return name; }\n" + " public void setName(String name) { this.name = name }\n" + " private String name;\n" + "}\n" + "\n" + "@Entity\n" + "public class Dog { ... }" +msgstr "" + +#. Tag: para +#: basic_mapping.xml:73 +#, no-c-format +msgid "The legacy hbm.xml approach uses an XML schema designed to be readable and hand-editable. The mapping language is Java-centric, meaning that mappings are constructed around persistent class declarations and not table declarations." +msgstr "" + +#. Tag: para +#: basic_mapping.xml:78 #, no-c-format msgid "Please note that even though many Hibernate users choose to write the XML by hand, a number of tools exist to generate the mapping document. These include XDoclet, Middlegen and AndroMDA." msgstr "" #. Tag: para +#: basic_mapping.xml:82 #, no-c-format msgid "Here is an example mapping:" msgstr "" -#. Tag: para +#. Tag: programlisting +#: basic_mapping.xml:84 #, no-c-format -msgid "We will now discuss the content of the mapping document. We will only describe, however, the document elements and attributes that are used by Hibernate at runtime. The mapping document also contains some extra optional attributes and elements that affect the database schemas exported by the schema export tool (for example, the not-null attribute)." +msgid "" + "<?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 name=\"Cat\"\n" + " table=\"cats\"\n" + " discriminator-value=\"C\">\n" + "\n" + " <id name=\"id\">\n" + " <generator class=\"native\"/>\n" + " </id>\n" + "\n" + " <discriminator column=\"subclass\"\n" + " type=\"character\"/>\n" + "\n" + " <property name=\"weight\"/>\n" + "\n" + " <property name=\"birthdate\"\n" + " type=\"date\"\n" + " not-null=\"true\"\n" + " update=\"false\"/>\n" + "\n" + " <property name=\"color\"\n" + " type=\"eg.types.ColorUserType\"\n" + " not-null=\"true\"\n" + " update=\"false\"/>\n" + "\n" + " <property name=\"sex\"\n" + " not-null=\"true\"\n" + " update=\"false\"/>\n" + "\n" + " <property name=\"litterId\"\n" + " column=\"litterId\"\n" + " update=\"false\"/>\n" + "\n" + " <many-to-one name=\"mother\"\n" + " column=\"mother_id\"\n" + " update=\"false\"/>\n" + "\n" + " <set name=\"kittens\"\n" + " inverse=\"true\"\n" + " order-by=\"litter_id\">\n" + " <key column=\"mother_id\"/>\n" + " <one-to-many class=\"Cat\"/>\n" + " </set>\n" + "\n" + " <subclass name=\"DomesticCat\"\n" + " discriminator-value=\"D\">\n" + "\n" + " <property name=\"name\"\n" + " type=\"string\"/>\n" + "\n" + " </subclass>\n" + "\n" + " </class>\n" + "\n" + " <class name=\"Dog\">\n" + " <!-- mapping for Dog could go here -->\n" + " </class>\n" + "\n" + "</hibernate-mapping>" +msgstr "" + +#. Tag: para +#: basic_mapping.xml:86 +#, no-c-format +msgid "We will now discuss the concepts of the mapping documents (both annotations and XML). We will only describe, however, the document elements and attributes that are used by Hibernate at runtime. The mapping document also contains some extra optional attributes and elements that affect the database schemas exported by the schema export tool (for example, the not-null attribute)." msgstr "" #. Tag: title +#: basic_mapping.xml:94 #, no-c-format -msgid "Doctype" +msgid "Entity" msgstr "" #. Tag: para +#: basic_mapping.xml:96 #, no-c-format -msgid "All XML mappings should declare the doctype shown. The actual DTD can be found at the URL above, in the directory hibernate-x.x.x/src/org/hibernate , or in hibernate3.jar. Hibernate will always look for the DTD in its classpath first. If you experience lookups of the DTD using an Internet connection, check the DTD declaration against the contents of your classpath." -msgstr "" - -#. Tag: title -#, no-c-format -msgid "EntityResolver" +msgid "An entity is a regular Java object (aka POJO) which will be persisted by Hibernate." msgstr "" #. Tag: para +#: basic_mapping.xml:99 #, no-c-format -msgid "Hibernate will first attempt to resolve DTDs in its classpath. It does this is by registering a custom org.xml.sax.EntityResolver implementation with the SAXReader it uses to read in the xml files. This custom EntityResolver recognizes two different systemId namespaces:" +msgid "To mark an object as an entity in annotations, use the @Entity annotation." +msgstr "" + +#. Tag: programlisting +#: basic_mapping.xml:102 +#, no-c-format +msgid "" + "@Entity\n" + "public class Flight implements Serializable {\n" + " Long id;\n" + "\n" + " @Id\n" + " public Long getId() { return id; }\n" + "\n" + " public void setId(Long id) { this.id = id; }\n" + "}" msgstr "" #. Tag: para +#: basic_mapping.xml:104 #, no-c-format -msgid "a hibernate namespace is recognized whenever the resolver encounters a systemId starting with http://hibernate.sourceforge.net/. The resolver attempts to resolve these entities via the classloader which loaded the Hibernate classes." +msgid "That's pretty much it, the rest is optional. There are however any options to tweak your entity mapping, let's explore them." msgstr "" #. Tag: para +#: basic_mapping.xml:107 #, no-c-format -msgid "a user namespace is recognized whenever the resolver encounters a systemId using a classpath:// URL protocol. The resolver will attempt to resolve these entities via (1) the current thread context classloader and (2) the classloader which loaded the Hibernate classes." +msgid "@Table lets you define the table the entity will be persisted into. If undefined, the table name is the unqualified class name of the entity. You can also optionally define the catalog, the schema as well as unique constraints on the table." +msgstr "" + +#. Tag: programlisting +#: basic_mapping.xml:112 +#, no-c-format +msgid "" + "@Entity\n" + "@Table(name=\"TBL_FLIGHT\", \n" + " schema=\"AIR_COMMAND\", \n" + " uniqueConstraints=\n" + " @UniqueConstraint(\n" + " name=\"flight_number\", \n" + " columnNames={\"comp_prefix\", \"flight_number\"} ) )\n" + "public class Flight implements Serializable {\n" + " @Column(name=\"comp_prefix\")\n" + " public String getCompagnyPrefix() { return companyPrefix; }\n" + "\n" + " @Column(name=\"flight_number\")\n" + " public String getNumber() { return number; }\n" + "}" msgstr "" #. Tag: para +#: basic_mapping.xml:114 #, no-c-format -msgid "The following is an example of utilizing user namespacing:" +msgid "The constraint name is optional (generated if left undefined). The column names composing the constraint correspond to the column names as defined before the Hibernate NamingStrategy is applied." msgstr "" #. Tag: para +#: basic_mapping.xml:119 #, no-c-format -msgid "Where types.xml is a resource in the your.domain package and contains a custom typedef." -msgstr "" - -#. Tag: title -#, no-c-format -msgid "Hibernate-mapping" +msgid "@Entity.name lets you define the shortcut name of the entity you can used in JP-QL and HQL queries. It defaults to the unqualified class name of the class." msgstr "" #. Tag: para +#: basic_mapping.xml:123 #, no-c-format -msgid "This element has several optional attributes. The schema and catalog attributes specify that tables referred to in this mapping belong to the named schema and/or catalog. If they are specified, tablenames will be qualified by the given schema and catalog names. If they are missing, tablenames will be unqualified. The default-cascade attribute specifies what cascade style should be assumed for properties and collections that do not specify a cascade attribute. By default, the auto-import attribute allows you to use unqualified class names in the query language." +msgid "Hibernate goes beyond the JPA specification and provide additional configurations. Some of them are hosted on @org.hibernate.annotations.Entity:" msgstr "" #. Tag: para +#: basic_mapping.xml:129 #, no-c-format -msgid "schema (optional): the name of a database schema." +msgid "dynamicInsert / dynamicUpdate (defaults to false): specifies that INSERT / UPDATE SQL should be generated at runtime and contain only the columns whose values are not null. The dynamic-update and dynamic-insert settings are not inherited by subclasses. Although these settings can increase performance in some cases, they can actually decrease performance in others." msgstr "" #. Tag: para +#: basic_mapping.xml:140 #, no-c-format -msgid "catalog (optional): the name of a database catalog." +msgid "selectBeforeUpdate (defaults to false): specifies that Hibernate should never perform an SQL UPDATE unless it is certain that an object is actually modified. Only when a transient object has been associated with a new session using update(), will Hibernate perform an extra SQL SELECT to determine if an UPDATE is actually required. Use of select-before-update will usually decrease performance. It is useful to prevent a database update trigger being called unnecessarily if you reattach a graph of detached instances to a Session." msgstr "" #. Tag: para +#: basic_mapping.xml:154 #, no-c-format -msgid "default-cascade (optional - defaults to none): a default cascade style." +msgid "polymorphisms (defaults to IMPLICIT): determines whether implicit or explicit query polymorphisms is used. Implicit polymorphisms means that instances of the class will be returned by a query that names any superclass or implemented interface or class, and that instances of any subclass of the class will be returned by a query that names the class itself. Explicit polymorphisms means that class instances will be returned only by queries that explicitly name that class. Queries that name the class will return only instances of subclasses mapped. For most purposes, the default polymorphisms=IMPLICIT is appropriate. Explicit polymorphisms is useful when two different classes are mapped to the same table This allows a \"lightweight\" class that contains a subset of the table columns." msgstr "" #. Tag: para +#: basic_mapping.xml:171 #, no-c-format -msgid "default-access (optional - defaults to property): the strategy Hibernate should use for accessing all properties. It can be a custom implementation of PropertyAccessor." +msgid "persister: specifies a custom ClassPersister. The persister attribute lets you customize the persistence strategy used for the class. You can, for example, specify your own subclass of org.hibernate.persister.EntityPersister, or you can even provide a completely new implementation of the interface org.hibernate.persister.ClassPersister that implements, for example, persistence via stored procedure calls, serialization to flat files or LDAP. See org.hibernate.test.CustomPersister for a simple example of \"persistence\" to a Hashtable." msgstr "" #. Tag: para +#: basic_mapping.xml:185 #, no-c-format -msgid "default-lazy (optional - defaults to true): the default value for unspecified lazy attributes of class and collection mappings." -msgstr "" - -#. Tag: para -#, no-c-format -msgid "auto-import (optional - defaults to true): specifies whether we can use unqualified class names of classes in this mapping in the query language." -msgstr "" - -#. Tag: para -#, no-c-format -msgid "package (optional): specifies a package prefix to use for unqualified class names in the mapping document." -msgstr "" - -#. Tag: para -#, no-c-format -msgid "If you have two persistent classes with the same unqualified name, you should set auto-import=\"false\". An exception will result if you attempt to assign two classes to the same \"imported\" name." -msgstr "" - -#. Tag: para -#, no-c-format -msgid "The hibernate-mapping element allows you to nest several persistent <class> mappings, as shown above. It is, however, good practice (and expected by some tools) to map only a single persistent class, or a single class hierarchy, in one mapping file and name it after the persistent superclass. For example, Cat.hbm.xml, Dog.hbm.xml, or if using inheritance, Animal.hbm.xml." -msgstr "" - -#. Tag: title -#, no-c-format -msgid "Class" -msgstr "" - -#. Tag: para -#, no-c-format -msgid "You can declare a persistent class using the class element. For example:" -msgstr "" - -#. Tag: para -#, no-c-format -msgid "name (optional): the fully qualified Java class name of the persistent class or interface. If this attribute is missing, it is assumed that the mapping is for a non-POJO entity." -msgstr "" - -#. Tag: para -#, no-c-format -msgid "table (optional - defaults to the unqualified class name): the name of its database table." -msgstr "" - -#. Tag: para -#, no-c-format -msgid "discriminator-value (optional - defaults to the class name): a value that distinguishes individual subclasses that is used for polymorphic behavior. Acceptable values include null and not null." -msgstr "" - -#. Tag: para -#, no-c-format -msgid "mutable (optional - defaults to true): specifies that instances of the class are (not) mutable." -msgstr "" - -#. Tag: para -#, no-c-format -msgid "schema (optional): overrides the schema name specified by the root <hibernate-mapping> element." -msgstr "" - -#. Tag: para -#, no-c-format -msgid "catalog (optional): overrides the catalog name specified by the root <hibernate-mapping> element." -msgstr "" - -#. Tag: para -#, no-c-format -msgid "proxy (optional): specifies an interface to use for lazy initializing proxies. You can specify the name of the class itself." -msgstr "" - -#. Tag: para -#, no-c-format -msgid "dynamic-update (optional - defaults to false): specifies that UPDATE SQL should be generated at runtime and can contain only those columns whose values have changed." -msgstr "" - -#. Tag: para -#, no-c-format -msgid "dynamic-insert (optional - defaults to false): specifies that INSERT SQL should be generated at runtime and contain only the columns whose values are not null." -msgstr "" - -#. Tag: para -#, no-c-format -msgid "select-before-update (optional - defaults to false): specifies that Hibernate should never perform an SQL UPDATE unless it is certain that an object is actually modified. Only when a transient object has been associated with a new session using update(), will Hibernate perform an extra SQL SELECT to determine if an UPDATE is actually required." -msgstr "" - -#. Tag: para -#, no-c-format -msgid "polymorphism (optional - defaults to implicit): determines whether implicit or explicit query polymorphism is used." -msgstr "" - -#. Tag: para -#, no-c-format -msgid "where (optional): specifies an arbitrary SQL WHERE condition to be used when retrieving objects of this class." -msgstr "" - -#. Tag: para -#, no-c-format -msgid "persister (optional): specifies a custom ClassPersister." -msgstr "" - -#. Tag: para -#, no-c-format -msgid "batch-size (optional - defaults to 1): specifies a \"batch size\" for fetching instances of this class by identifier." -msgstr "" - -#. Tag: para -#, no-c-format -msgid "optimistic-lock (optional - defaults to version): determines the optimistic locking strategy." -msgstr "" - -#. Tag: para -#, no-c-format -msgid "lazy (optional): lazy fetching can be disabled by setting lazy=\"false\"." -msgstr "" - -#. Tag: para -#, no-c-format -msgid "entity-name (optional - defaults to the class name): Hibernate3 allows a class to be mapped multiple times, potentially to different tables. It also allows entity mappings that are represented by Maps or XML at the Java level. In these cases, you should provide an explicit arbitrary name for the entity. See and for more information." -msgstr "" - -#. Tag: para -#, no-c-format -msgid "check (optional): an SQL expression used to generate a multi-row check constraint for automatic schema generation." -msgstr "" - -#. Tag: para -#, no-c-format -msgid "rowid (optional): Hibernate can use ROWIDs on databases. On Oracle, for example, Hibernate can use the rowid extra column for fast updates once this option has been set to rowid. A ROWID is an implementation detail and represents the physical location of a stored tuple." -msgstr "" - -#. Tag: para -#, no-c-format -msgid "subselect (optional): maps an immutable and read-only entity to a database subselect. This is useful if you want to have a view instead of a base table. See below for more information." -msgstr "" - -#. Tag: para -#, no-c-format -msgid "abstract (optional): is used to mark abstract superclasses in <union-subclass> hierarchies." -msgstr "" - -#. Tag: para -#, no-c-format -msgid "It is acceptable for the named persistent class to be an interface. You can declare implementing classes of that interface using the <subclass> element. You can persist any static inner class. Specify the class name using the standard form i.e. e.g.Foo$Bar." -msgstr "" - -#. Tag: para -#, no-c-format -msgid "Immutable classes, mutable=\"false\", cannot be updated or deleted by the application. This allows Hibernate to make some minor performance optimizations." -msgstr "" - -#. Tag: para -#, no-c-format -msgid "The optional proxy attribute enables lazy initialization of persistent instances of the class. Hibernate will initially return CGLIB proxies that implement the named interface. The persistent object will load when a method of the proxy is invoked. See \"Initializing collections and proxies\" below." -msgstr "" - -#. Tag: para -#, no-c-format -msgid "Implicit polymorphism means that instances of the class will be returned by a query that names any superclass or implemented interface or class, and that instances of any subclass of the class will be returned by a query that names the class itself. Explicit polymorphism means that class instances will be returned only by queries that explicitly name that class. Queries that name the class will return only instances of subclasses mapped inside this <class> declaration as a <subclass> or <joined-subclass>. For most purposes, the default polymorphism=\"implicit\" is appropriate. Explicit polymorphism is useful when two different classes are mapped to the same table This allows a \"lightweight\" class that contains a subset of the table columns." -msgstr "" - -#. Tag: para -#, no-c-format -msgid "The persister attribute lets you customize the persistence strategy used for the class. You can, for example, specify your own subclass of org.hibernate.persister.EntityPersister, or you can even provide a completely new implementation of the interface org.hibernate.persister.ClassPersister that implements, for example, persistence via stored procedure calls, serialization to flat files or LDAP. See org.hibernate.test.CustomPersister for a simple example of \"persistence\" to a Hashtable." -msgstr "" - -#. Tag: para -#, no-c-format -msgid "The dynamic-update and dynamic-insert settings are not inherited by subclasses, so they can also be specified on the <subclass> or <joined-subclass> elements. Although these settings can increase performance in some cases, they can actually decrease performance in others." -msgstr "" - -#. Tag: para -#, no-c-format -msgid "Use of select-before-update will usually decrease performance. It is useful to prevent a database update trigger being called unnecessarily if you reattach a graph of detached instances to a Session." -msgstr "" - -#. Tag: para -#, no-c-format -msgid "If you enable dynamic-update, you will have a choice of optimistic locking strategies:" +msgid "optimisticLock (defaults to VERSION): determines the optimistic locking strategy. If you enable dynamicUpdate, you will have a choice of optimistic locking strategies:" msgstr "" #. Tag: para +#: basic_mapping.xml:192 #, no-c-format msgid "version: check the version/timestamp columns" msgstr "" #. Tag: para +#: basic_mapping.xml:197 #, no-c-format msgid "all: check all columns" msgstr "" #. Tag: para +#: basic_mapping.xml:201 #, no-c-format msgid "dirty: check the changed columns, allowing some concurrent updates" msgstr "" #. Tag: para +#: basic_mapping.xml:206 #, no-c-format msgid "none: do not use optimistic locking" msgstr "" #. Tag: para +#: basic_mapping.xml:211 #, no-c-format msgid "It is strongly recommended that you use version/timestamp columns for optimistic locking with Hibernate. This strategy optimizes performance and correctly handles modifications made to detached instances (i.e. when Session.merge() is used)." msgstr "" #. Tag: para +#: basic_mapping.xml:220 #, no-c-format -msgid "There is no difference between a view and a base table for a Hibernate mapping. This is transparent at the database level, although some DBMS do not support views properly, especially with updates. Sometimes you want to use a view, but you cannot create one in the database (i.e. with a legacy schema). In this case, you can map an immutable and read-only entity to a given SQL subselect expression:" +msgid "Be sure to import @javax.persistence.Entity to mark a class as an entity. It's a common mistake to import @org.hibernate.annotations.Entity by accident." msgstr "" #. Tag: para +#: basic_mapping.xml:227 +#, no-c-format +msgid "Some entities are not mutable. They cannot be updated or deleted by the application. This allows Hibernate to make some minor performance optimizations.. Use the @Immutable annotation." +msgstr "" + +#. Tag: para +#: basic_mapping.xml:232 +#, no-c-format +msgid "You can also alter how Hibernate deals with lazy initialization for this class. On @Proxy, use lazy=false to disable lazy fetching (not recommended). You can also specify an interface to use for lazy initializing proxies (defaults to the class itself): use proxyClass on @Proxy. Hibernate will initially return proxies (Javassist or CGLIB) that implement the named interface. The persistent object will load when a method of the proxy is invoked. See \"Initializing collections and proxies\" below." +msgstr "" + +#. Tag: para +#: basic_mapping.xml:243 +#, no-c-format +msgid "@BatchSize specifies a \"batch size\" for fetching instances of this class by identifier. Not yet loaded instances are loaded batch-size at a time (default 1)." +msgstr "" + +#. Tag: para +#: basic_mapping.xml:247 +#, no-c-format +msgid "You can specific an arbitrary SQL WHERE condition to be used when retrieving objects of this class. Use @Where for that." +msgstr "" + +#. Tag: para +#: basic_mapping.xml:251 +#, no-c-format +msgid "In the same vein, @Check lets you define an SQL expression used to generate a multi-row check constraint for automatic schema generation." +msgstr "" + +#. Tag: para +#: basic_mapping.xml:255 +#, no-c-format +msgid "There is no difference between a view and a base table for a Hibernate mapping. This is transparent at the database level, although some DBMS do not support views properly, especially with updates. Sometimes you want to use a view, but you cannot create one in the database (i.e. with a legacy schema). In this case, you can map an immutable and read-only entity to a given SQL subselect expression using @org.hibernate.annotations.Subselect:" +msgstr "" + +#. Tag: programlisting +#: basic_mapping.xml:263 +#, no-c-format +msgid "" + "@Entity\n" + "@Subselect(\"select item.name, max(bid.amount), count(*) \"\n" + " + \"from item \"\n" + " + \"join bid on bid.item_id = item.id \"\n" + " + \"group by item.name\")\n" + "@Synchronize( {\"item\", \"bid\"} ) //tables impacted\n" + "public class Summary {\n" + " @Id\n" + " public String getId() { return id; }\n" + " ...\n" + "}" +msgstr "" + +#. Tag: para +#: basic_mapping.xml:265 #, no-c-format msgid "Declare the tables to synchronize this entity with, ensuring that auto-flush happens correctly and that queries against the derived entity do not return stale data. The <subselect> is available both as an attribute and a nested mapping element." msgstr "" +#. Tag: para +#: basic_mapping.xml:270 +#, no-c-format +msgid "We will now explore the same options using the hbm.xml structure. You can declare a persistent class using the class element. For example:" +msgstr "" + +#. Tag: programlisting +#: basic_mapping.xml:319 +#, no-c-format +msgid "" + "<class\n" + " name=\"ClassName\"\n" + " table=\"tableName\"\n" + " discriminator-value=\"discriminator_value\"\n" + " mutable=\"true|false\"\n" + " schema=\"owner\"\n" + " catalog=\"catalog\"\n" + " proxy=\"ProxyInterface\"\n" + " dynamic-update=\"true|false\"\n" + " dynamic-insert=\"true|false\"\n" + " select-before-update=\"true|false\"\n" + " polymorphism=\"implicit|explicit\"\n" + " where=\"arbitrary sql where condition\"\n" + " persister=\"PersisterClass\"\n" + " batch-size=\"N\"\n" + " optimistic-lock=\"none|version|dirty|all\"\n" + " lazy=\"true|false\"\n" + " entity-name=\"EntityName\"\n" + " check=\"arbitrary sql check condition\"\n" + " rowid=\"rowid\"\n" + " subselect=\"SQL expression\"\n" + " abstract=\"true|false\"\n" + " node=\"element-name\"\n" + "/>" +msgstr "" + +#. Tag: para +#: basic_mapping.xml:323 +#, no-c-format +msgid "name (optional): the fully qualified Java class name of the persistent class or interface. If this attribute is missing, it is assumed that the mapping is for a non-POJO entity." +msgstr "" + +#. Tag: para +#: basic_mapping.xml:330 +#, no-c-format +msgid "table (optional - defaults to the unqualified class name): the name of its database table." +msgstr "" + +#. Tag: para +#: basic_mapping.xml:335 +#, no-c-format +msgid "discriminator-value (optional - defaults to the class name): a value that distinguishes individual subclasses that is used for polymorphic behavior. Acceptable values include null and not null." +msgstr "" + +#. Tag: para +#: basic_mapping.xml:343 +#, no-c-format +msgid "mutable (optional - defaults to true): specifies that instances of the class are (not) mutable." +msgstr "" + +#. Tag: para +#: basic_mapping.xml:349 basic_mapping.xml:2912 +#, no-c-format +msgid "schema (optional): overrides the schema name specified by the root <hibernate-mapping> element." +msgstr "" + +#. Tag: para +#: basic_mapping.xml:355 basic_mapping.xml:2918 +#, no-c-format +msgid "catalog (optional): overrides the catalog name specified by the root <hibernate-mapping> element." +msgstr "" + +#. Tag: para +#: basic_mapping.xml:361 +#, no-c-format +msgid "proxy (optional): specifies an interface to use for lazy initializing proxies. You can specify the name of the class itself." +msgstr "" + +#. Tag: para +#: basic_mapping.xml:367 +#, no-c-format +msgid "dynamic-update (optional - defaults to false): specifies that UPDATE SQL should be generated at runtime and can contain only those columns whose values have changed." +msgstr "" + +#. Tag: para +#: basic_mapping.xml:374 +#, no-c-format +msgid "dynamic-insert (optional - defaults to false): specifies that INSERT SQL should be generated at runtime and contain only the columns whose values are not null." +msgstr "" + +#. Tag: para +#: basic_mapping.xml:381 +#, no-c-format +msgid "select-before-update (optional - defaults to false): specifies that Hibernate should never perform an SQL UPDATE unless it is certain that an object is actually modified. Only when a transient object has been associated with a new session using update(), will Hibernate perform an extra SQL SELECT to determine if an UPDATE is actually required." +msgstr "" + +#. Tag: para +#: basic_mapping.xml:393 +#, no-c-format +msgid "polymorphisms (optional - defaults to implicit): determines whether implicit or explicit query polymorphisms is used." +msgstr "" + +#. Tag: para +#: basic_mapping.xml:399 +#, no-c-format +msgid "where (optional): specifies an arbitrary SQL WHERE condition to be used when retrieving objects of this class." +msgstr "" + +#. Tag: para +#: basic_mapping.xml:405 +#, no-c-format +msgid "persister (optional): specifies a custom ClassPersister." +msgstr "" + +#. Tag: para +#: basic_mapping.xml:410 +#, no-c-format +msgid "batch-size (optional - defaults to 1): specifies a \"batch size\" for fetching instances of this class by identifier." +msgstr "" + +#. Tag: para +#: basic_mapping.xml:416 +#, no-c-format +msgid "optimistic-lock (optional - defaults to version): determines the optimistic locking strategy." +msgstr "" + +#. Tag: para +#: basic_mapping.xml:422 +#, no-c-format +msgid "lazy (optional): lazy fetching can be disabled by setting lazy=\"false\"." +msgstr "" + +#. Tag: para +#: basic_mapping.xml:427 +#, no-c-format +msgid "entity-name (optional - defaults to the class name): Hibernate3 allows a class to be mapped multiple times, potentially to different tables. It also allows entity mappings that are represented by Maps or XML at the Java level. In these cases, you should provide an explicit arbitrary name for the entity. See and for more information." +msgstr "" + +#. Tag: para +#: basic_mapping.xml:437 +#, no-c-format +msgid "check (optional): an SQL expression used to generate a multi-row check constraint for automatic schema generation." +msgstr "" + +#. Tag: para +#: basic_mapping.xml:443 +#, no-c-format +msgid "rowid (optional): Hibernate can use ROWIDs on databases. On Oracle, for example, Hibernate can use the rowid extra column for fast updates once this option has been set to rowid. A ROWID is an implementation detail and represents the physical location of a stored tuple." +msgstr "" + +#. Tag: para +#: basic_mapping.xml:452 +#, no-c-format +msgid "subselect (optional): maps an immutable and read-only entity to a database subselect. This is useful if you want to have a view instead of a base table. See below for more information." +msgstr "" + +#. Tag: para +#: basic_mapping.xml:459 +#, no-c-format +msgid "abstract (optional): is used to mark abstract superclasses in <union-subclass> hierarchies." +msgstr "" + +#. Tag: para +#: basic_mapping.xml:466 +#, no-c-format +msgid "It is acceptable for the named persistent class to be an interface. You can declare implementing classes of that interface using the <subclass> element. You can persist any static inner class. Specify the class name using the standard form i.e. e.g.Foo$Bar." +msgstr "" + +#. Tag: para +#: basic_mapping.xml:472 +#, no-c-format +msgid "Here is how to do a virtual view (subselect) in XML:" +msgstr "" + +#. Tag: programlisting +#: basic_mapping.xml:474 +#, no-c-format +msgid "" + "<class name=\"Summary\">\n" + " <subselect>\n" + " select item.name, max(bid.amount), count(*)\n" + " from item\n" + " join bid on bid.item_id = item.id\n" + " group by item.name\n" + " </subselect>\n" + " <synchronize table=\"item\"/>\n" + " <synchronize table=\"bid\"/>\n" + " <id name=\"name\"/>\n" + " ...\n" + "</class>" +msgstr "" + +#. Tag: para +#: basic_mapping.xml:476 +#, no-c-format +msgid "The <subselect> is available both as an attribute and a nested mapping element." +msgstr "" + #. Tag: title +#: basic_mapping.xml:481 #, no-c-format -msgid "id" +msgid "Identifiers" msgstr "" #. Tag: para +#: basic_mapping.xml:483 #, no-c-format -msgid "Mapped classes must declare the primary key column of the database table. Most classes will also have a JavaBeans-style property holding the unique identifier of an instance. The <id> element defines the mapping from that property to the primary key column." +msgid "Mapped classes must declare the primary key column of the database table. Most classes will also have a JavaBeans-style property holding the unique identifier of an instance." msgstr "" #. Tag: para +#: basic_mapping.xml:488 +#, no-c-format +msgid "Mark the identifier property with @Id." +msgstr "" + +#. Tag: programlisting +#: basic_mapping.xml:491 +#, no-c-format +msgid "" + "@Entity\n" + "public class Person {\n" + " @Id Integer getId() { ... }\n" + " ...\n" + "}" +msgstr "" + +#. Tag: para +#: basic_mapping.xml:493 +#, no-c-format +msgid "In hbm.xml, use the <id> element which defines the mapping from that property to the primary key column." +msgstr "" + +#. Tag: programlisting +#: basic_mapping.xml:509 +#, no-c-format +msgid "" + "<id\n" + " name=\"propertyName\"\n" + " type=\"typename\"\n" + " column=\"column_name\"\n" + " unsaved-value=\"null|any|none|undefined|id_value\"\n" + " access=\"field|property|ClassName\">\n" + " node=\"element-name|@attribute-name|element/@attribute|.\"\n" + "\n" + " <generator class=\"generatorClass\"/>\n" + "</id>" +msgstr "" + +#. Tag: para +#: basic_mapping.xml:513 #, no-c-format msgid "name (optional): the name of the identifier property." msgstr "" #. Tag: para +#: basic_mapping.xml:518 basic_mapping.xml:2141 #, no-c-format msgid "type (optional): a name that indicates the Hibernate type." msgstr "" #. Tag: para +#: basic_mapping.xml:523 #, no-c-format msgid "column (optional - defaults to the property name): the name of the primary key column." msgstr "" #. Tag: para +#: basic_mapping.xml:528 #, no-c-format msgid "unsaved-value (optional - defaults to a \"sensible\" value): an identifier property value that indicates an instance is newly instantiated (unsaved), distinguishing it from detached instances that were saved or loaded in a previous session." msgstr "" #. Tag: para +#: basic_mapping.xml:536 #, no-c-format msgid "access (optional - defaults to property): the strategy Hibernate should use for accessing the property value." msgstr "" #. Tag: para +#: basic_mapping.xml:543 #, no-c-format msgid "If the name attribute is missing, it is assumed that the class has no identifier property." msgstr "" #. Tag: para +#: basic_mapping.xml:546 #, no-c-format -msgid "The unsaved-value attribute is almost never needed in Hibernate3." +msgid "The unsaved-value attribute is almost never needed in Hibernate3 and indeed has no corresponding element in annotations." msgstr "" #. Tag: para +#: basic_mapping.xml:550 #, no-c-format -msgid "There is an alternative <composite-id> declaration that allows access to legacy data with composite keys. Its use is strongly discouraged for anything else." +msgid "You can also declare the identifier as a composite identifier. This allows access to legacy data with composite keys. Its use is strongly discouraged for anything else." msgstr "" #. Tag: title +#: basic_mapping.xml:555 #, no-c-format -msgid "Generator" +msgid "Composite identifier" msgstr "" #. Tag: para +#: basic_mapping.xml:557 #, no-c-format -msgid "The optional <generator> child element names a Java class used to generate unique identifiers for instances of the persistent class. If any parameters are required to configure or initialize the generator instance, they are passed using the <param> element." +msgid "You can define a composite primary key through several syntaxes:" msgstr "" #. Tag: para +#: basic_mapping.xml:562 +#, no-c-format +msgid "use a component type to represent the identifier and map it as a property in the entity: you then annotated the property as @EmbeddedId. The component type has to be Serializable." +msgstr "" + +#. Tag: para +#: basic_mapping.xml:569 +#, no-c-format +msgid "map multiple properties as @Id properties: the identifier type is then the entity class itself and needs to be Serializable. This approach is unfortunately not standard and only supported by Hibernate." +msgstr "" + +#. Tag: para +#: basic_mapping.xml:577 +#, no-c-format +msgid "map multiple properties as @Id properties and declare an external class to be the identifier type. This class, which needs to be Serializable, is declared on the entity via the @IdClass annotation. The identifier type must contain the same properties as the identifier properties of the entity: each property name must be the same, its type must be the same as well if the entity property is of a basic type, its type must be the type of the primary key of the associated entity if the entity property is an association (either a @OneToOne or a @ManyToOne)." +msgstr "" + +#. Tag: para +#: basic_mapping.xml:592 +#, no-c-format +msgid "As you can see the last case is far from obvious. It has been inherited from the dark ages of EJB 2 for backward compatibilities and we recommend you not to use it (for simplicity sake)." +msgstr "" + +#. Tag: para +#: basic_mapping.xml:596 +#, no-c-format +msgid "Let's explore all three cases using examples." +msgstr "" + +#. Tag: title +#: basic_mapping.xml:599 +#, no-c-format +msgid "id as a property using a component type" +msgstr "" + +#. Tag: para +#: basic_mapping.xml:601 +#, no-c-format +msgid "Here is a simple example of @EmbeddedId." +msgstr "" + +#. Tag: programlisting +#: basic_mapping.xml:604 +#, no-c-format +msgid "" + "@Entity\n" + "class User {\n" + " @EmbeddedId\n" + " @AttributeOverride(name=\"firstName\", column=@Column(name=\"fld_firstname\")\n" + " UserId id;\n" + "\n" + " Integer age;\n" + "}\n" + "\n" + "@Embeddable\n" + "class UserId implements Serializable {\n" + " String firstName;\n" + " String lastName;\n" + "}" +msgstr "" + +#. Tag: para +#: basic_mapping.xml:606 +#, no-c-format +msgid "You can notice that the UserId class is serializable. To override the column mapping, use @AttributeOverride." +msgstr "" + +#. Tag: para +#: basic_mapping.xml:610 +#, no-c-format +msgid "An embedded id can itself contains the primary key of an associated entity." +msgstr "" + +#. Tag: programlisting +#: basic_mapping.xml:613 +#, no-c-format +msgid "" + "@Entity\n" + "class Customer {\n" + " @EmbeddedId CustomerId id;\n" + " boolean preferredCustomer;\n" + "\n" + " @MapsId(\"userId\")\n" + " @JoinColumns({\n" + " @JoinColumn(name=\"userfirstname_fk\", referencedColumnName=\"firstName\"),\n" + " @JoinColumn(name=\"userlastname_fk\", referencedColumnName=\"lastName\")\n" + " })\n" + " @OneToOne User user;\n" + "}\n" + "\n" + "@Embeddable\n" + "class CustomerId implements Serializable {\n" + " UserId userId;\n" + " String customerNumber;\n" + "\n" + " //implements equals and hashCode\n" + "}\n" + "\n" + "@Entity \n" + "class User {\n" + " @EmbeddedId UserId id;\n" + " Integer age;\n" + "}\n" + "\n" + "@Embeddable\n" + "class UserId implements Serializable {\n" + " String firstName;\n" + " String lastName;\n" + "\n" + " //implements equals and hashCode\n" + "}" +msgstr "" + +#. Tag: para +#: basic_mapping.xml:615 +#, no-c-format +msgid "In the embedded id object, the association is represented as the identifier of the associated entity. But you can link its value to a regular association in the entity via the @MapsId annotation. The @MapsId value correspond to the property name of the embedded id object containing the associated entity's identifier. In the database, it means that the Customer.user and the CustomerId.userId properties share the same underlying column (user_fk in this case)." +msgstr "" + +#. Tag: para +#: basic_mapping.xml:627 +#, no-c-format +msgid "The component type used as identifier must implement equals() and hashCode()." +msgstr "" + +#. Tag: para +#: basic_mapping.xml:632 +#, no-c-format +msgid "In practice, your code only sets the Customer.user property and the user id value is copied by Hibernate into the CustomerId.userId property." +msgstr "" + +#. Tag: para +#: basic_mapping.xml:638 +#, no-c-format +msgid "The id value can be copied as late as flush time, don't rely on it until after flush time." +msgstr "" + +#. Tag: para +#: basic_mapping.xml:642 +#, no-c-format +msgid "While not supported in JPA, Hibernate lets you place your association directly in the embedded id component (instead of having to use the @MapsId annotation)." +msgstr "" + +#. Tag: programlisting +#: basic_mapping.xml:646 +#, no-c-format +msgid "" + "@Entity\n" + "class Customer {\n" + " @EmbeddedId CustomerId id;\n" + " boolean preferredCustomer;\n" + "}\n" + "\n" + "@Embeddable\n" + "class CustomerId implements Serializable {\n" + " @OneToOne\n" + " @JoinColumns({\n" + " @JoinColumn(name=\"userfirstname_fk\", referencedColumnName=\"firstName\"),\n" + " @JoinColumn(name=\"userlastname_fk\", referencedColumnName=\"lastName\")\n" + " }) \n" + " User user;\n" + " String customerNumber;\n" + "\n" + " //implements equals and hashCode\n" + "}\n" + "\n" + "@Entity \n" + "class User {\n" + " @EmbeddedId UserId id;\n" + " Integer age;\n" + "}\n" + "\n" + "@Embeddable\n" + "class UserId implements Serializable {\n" + " String firstName;\n" + " String lastName;\n" + "\n" + "\n" + " //implements equals and hashCode\n" + "}" +msgstr "" + +#. Tag: para +#: basic_mapping.xml:648 +#, no-c-format +msgid "Let's now rewrite these examples using the hbm.xml syntax." +msgstr "" + +#. Tag: programlisting +#: basic_mapping.xml:651 +#, no-c-format +msgid "" + "<composite-id\n" + " name=\"propertyName\"\n" + " class=\"ClassName\"\n" + " mapped=\"true|false\"\n" + " access=\"field|property|ClassName\"\n" + " node=\"element-name|.\">\n" + "\n" + " <key-property name=\"propertyName\" type=\"typename\" column=\"column_name\"/>\n" + " <key-many-to-one name=\"propertyName\" class=\"ClassName\" column=\"column_name\"/>\n" + " ......\n" + "</composite-id>" +msgstr "" + +#. Tag: para +#: basic_mapping.xml:653 +#, no-c-format +msgid "First a simple example:" +msgstr "" + +#. Tag: programlisting +#: basic_mapping.xml:655 +#, no-c-format +msgid "" + "<class name=\"User\">\n" + " <composite-id name=\"id\" class=\"UserId\">\n" + " <key-property name=\"firstName\" column=\"fld_firstname\"/>\n" + " <key-property name=\"lastName\"/>\n" + " </composite-id>\n" + "</class>" +msgstr "" + +#. Tag: para +#: basic_mapping.xml:657 +#, no-c-format +msgid "Then an example showing how an association can be mapped." +msgstr "" + +#. Tag: programlisting +#: basic_mapping.xml:660 +#, no-c-format +msgid "" + "<class name=\"Customer\">\n" + " <composite-id name=\"id\" class=\"CustomerId\">\n" + " <key-property name=\"firstName\" column=\"userfirstname_fk\"/>\n" + " <key-property name=\"lastName\" column=\"userfirstname_fk\"/>\n" + " <key-property name=\"customerNumber\"/>\n" + " </composite-id>\n" + "\n" + " <property name=\"preferredCustomer\"/>\n" + "\n" + " <many-to-one name=\"user\">\n" + " <column name=\"userfirstname_fk\" updatable=\"false\" insertable=\"false\"/>\n" + " <column name=\"userlastname_fk\" updatable=\"false\" insertable=\"false\"/>\n" + " </many-to-one>\n" + "</class>\n" + "\n" + "<class name=\"User\">\n" + " <composite-id name=\"id\" class=\"UserId\">\n" + " <key-property name=\"firstName\"/>\n" + " <key-property name=\"lastName\"/>\n" + " </composite-id>\n" + "\n" + " <property name=\"age\"/>\n" + "</class>" +msgstr "" + +#. Tag: para +#: basic_mapping.xml:662 +#, no-c-format +msgid "Notice a few things in the previous example:" +msgstr "" + +#. Tag: para +#: basic_mapping.xml:666 +#, no-c-format +msgid "the order of the properties (and column) matters. It must be the same between the association and the primary key of the associated entity" +msgstr "" + +#. Tag: para +#: basic_mapping.xml:672 +#, no-c-format +msgid "the many to one uses the same columns as the primary key and thus must be marked as read only (insertable and updatable to false)." +msgstr "" + +#. Tag: para +#: basic_mapping.xml:679 +#, no-c-format +msgid "unlike with @MapsId, the id value of the associated entity is not transparently copied, check the foreign id generator for more information." +msgstr "" + +#. Tag: para +#: basic_mapping.xml:686 +#, no-c-format +msgid "The last example shows how to map association directly in the embedded id component." +msgstr "" + +#. Tag: programlisting +#: basic_mapping.xml:689 +#, no-c-format +msgid "" + "<class name=\"Customer\">\n" + " <composite-id name=\"id\" class=\"CustomerId\">\n" + " <key-many-to-one name=\"user\">\n" + " <column name=\"userfirstname_fk\"/>\n" + " <column name=\"userlastname_fk\"/>\n" + " </key-many-to-one>\n" + " <key-property name=\"customerNumber\"/>\n" + " </composite-id>\n" + "\n" + " <property name=\"preferredCustomer\"/>\n" + "</class>\n" + "\n" + "<class name=\"User\">\n" + " <composite-id name=\"id\" class=\"UserId\">\n" + " <key-property name=\"firstName\"/>\n" + " <key-property name=\"lastName\"/>\n" + " </composite-id>\n" + "\n" + " <property name=\"age\"/>\n" + "</class>" +msgstr "" + +#. Tag: para +#: basic_mapping.xml:691 +#, no-c-format +msgid "This is the recommended approach to map composite identifier. The following options should not be considered unless some constraint are present." +msgstr "" + +#. Tag: title +#: basic_mapping.xml:697 +#, no-c-format +msgid "Multiple id properties without identifier type" +msgstr "" + +#. Tag: para +#: basic_mapping.xml:699 +#, no-c-format +msgid "Another, arguably more natural, approach is to place @Id on multiple properties of your entity. This approach is only supported by Hibernate (not JPA compliant) but does not require an extra embeddable component." +msgstr "" + +#. Tag: programlisting +#: basic_mapping.xml:704 +#, no-c-format +msgid "" + "@Entity\n" + "class Customer implements Serializable {\n" + " @Id @OneToOne\n" + " @JoinColumns({\n" + " @JoinColumn(name=\"userfirstname_fk\", referencedColumnName=\"firstName\"),\n" + " @JoinColumn(name=\"userlastname_fk\", referencedColumnName=\"lastName\")\n" + " })\n" + " User user;\n" + " \n" + " @Id String customerNumber;\n" + "\n" + " boolean preferredCustomer;\n" + "\n" + " //implements equals and hashCode\n" + "}\n" + "\n" + "@Entity \n" + "class User {\n" + " @EmbeddedId UserId id;\n" + " Integer age;\n" + "}\n" + "\n" + "@Embeddable\n" + "class UserId implements Serializable {\n" + " String firstName;\n" + " String lastName;\n" + "\n" + " //implements equals and hashCode\n" + "}" +msgstr "" + +#. Tag: para +#: basic_mapping.xml:706 +#, no-c-format +msgid "In this case Customer is its own identifier representation: it must implement Serializable and must implement equals() and hashCode()." +msgstr "" + +#. Tag: para +#: basic_mapping.xml:712 +#, no-c-format +msgid "In hbm.xml, the same mapping is:" +msgstr "" + +#. Tag: programlisting +#: basic_mapping.xml:714 +#, no-c-format +msgid "" + "<class name=\"Customer\">\n" + " <composite-id>\n" + " <key-many-to-one name=\"user\">\n" + " <column name=\"userfirstname_fk\"/>\n" + " <column name=\"userlastname_fk\"/>\n" + " </key-many-to-one>\n" + " <key-property name=\"customerNumber\"/>\n" + " </composite-id>\n" + "\n" + " <property name=\"preferredCustomer\"/>\n" + "</class>\n" + "\n" + "<class name=\"User\">\n" + " <composite-id name=\"id\" class=\"UserId\">\n" + " <key-property name=\"firstName\"/>\n" + " <key-property name=\"lastName\"/>\n" + " </composite-id>\n" + "\n" + " <property name=\"age\"/>\n" + "</class>" +msgstr "" + +#. Tag: title +#: basic_mapping.xml:718 +#, no-c-format +msgid "Multiple id properties with with a dedicated identifier type" +msgstr "" + +#. Tag: para +#: basic_mapping.xml:721 +#, no-c-format +msgid "@IdClass on an entity points to the class (component) representing the identifier of the class. The properties marked @Id on the entity must have their corresponding property on the @IdClass. The return type of search twin property must be either identical for basic properties or must correspond to the identifier class of the associated entity for an association." +msgstr "" + +#. Tag: para +#: basic_mapping.xml:730 +#, no-c-format +msgid "This approach is inherited from the EJB 2 days and we recommend against its use. But, after all it's your application and Hibernate supports it." +msgstr "" + +#. Tag: programlisting +#: basic_mapping.xml:735 +#, no-c-format +msgid "" + "@Entity\n" + "@IdClass(CustomerId.class)\n" + "class Customer implements Serializable {\n" + " @Id @OneToOne\n" + " @JoinColumns({\n" + " @JoinColumn(name=\"userfirstname_fk\", referencedColumnName=\"firstName\"),\n" + " @JoinColumn(name=\"userlastname_fk\", referencedColumnName=\"lastName\")\n" + " }) \n" + " User user;\n" + " \n" + " @Id String customerNumber;\n" + "\n" + " boolean preferredCustomer;\n" + "}\n" + "\n" + "class CustomerId implements Serializable {\n" + " UserId user;\n" + " String customerNumber;\n" + "\n" + " //implements equals and hashCode\n" + "}\n" + "\n" + "@Entity \n" + "class User {\n" + " @EmbeddedId UserId id;\n" + " Integer age;\n" + "\n" + " //implements equals and hashCode\n" + "}\n" + "\n" + "@Embeddable\n" + "class UserId implements Serializable {\n" + " String firstName;\n" + " String lastName;\n" + "\n" + " //implements equals and hashCode\n" + "}" +msgstr "" + +#. Tag: para +#: basic_mapping.xml:737 +#, no-c-format +msgid "Customer and CustomerId do have the same properties customerNumber as well as user. CustomerId must be Serializable and implement equals() and hashCode()." +msgstr "" + +#. Tag: para +#: basic_mapping.xml:745 +#, no-c-format +msgid "While not JPA standard, Hibernate let's you declare the vanilla associated property in the @IdClass." +msgstr "" + +#. Tag: programlisting +#: basic_mapping.xml:749 +#, no-c-format +msgid "" + "@Entity\n" + "@IdClass(CustomerId.class)\n" + "class Customer implements Serializable {\n" + " @Id @OneToOne\n" + " @JoinColumns({\n" + " @JoinColumn(name=\"userfirstname_fk\", referencedColumnName=\"firstName\"),\n" + " @JoinColumn(name=\"userlastname_fk\", referencedColumnName=\"lastName\")\n" + " }) \n" + " User user;\n" + " \n" + " @Id String customerNumber;\n" + "\n" + " boolean preferredCustomer;\n" + "}\n" + "\n" + "class CustomerId implements Serializable {\n" + " @OneToOne User user;\n" + " String customerNumber;\n" + "\n" + " //implements equals and hashCode\n" + "}\n" + "\n" + "@Entity \n" + "class User {\n" + " @EmbeddedId UserId id;\n" + " Integer age;\n" + "\n" + " //implements equals and hashCode\n" + "}\n" + "\n" + "@Embeddable\n" + "class UserId implements Serializable {\n" + " String firstName;\n" + " String lastName;\n" + "}" +msgstr "" + +#. Tag: para +#: basic_mapping.xml:751 +#, no-c-format +msgid "This feature is of limited interest though as you are likely to have chosen the @IdClass approach to stay JPA compliant or you have a quite twisted mind." +msgstr "" + +#. Tag: para +#: basic_mapping.xml:755 +#, no-c-format +msgid "Here are the equivalent on hbm.xml files:" +msgstr "" + +#. Tag: programlisting +#: basic_mapping.xml:757 +#, no-c-format +msgid "" + "<class name=\"Customer\">\n" + " <composite-id class=\"CustomerId\" mapped=\"true\">\n" + " <key-many-to-one name=\"user\">\n" + " <column name=\"userfirstname_fk\"/>\n" + " <column name=\"userlastname_fk\"/>\n" + " </key-many-to-one>\n" + " <key-property name=\"customerNumber\"/>\n" + " </composite-id>\n" + "\n" + " <property name=\"preferredCustomer\"/>\n" + "</class>\n" + "\n" + "<class name=\"User\">\n" + " <composite-id name=\"id\" class=\"UserId\">\n" + " <key-property name=\"firstName\"/>\n" + " <key-property name=\"lastName\"/>\n" + " </composite-id>\n" + "\n" + " <property name=\"age\"/>\n" + "</class>" +msgstr "" + +#. Tag: title +#: basic_mapping.xml:762 +#, no-c-format +msgid "Identifier generator" +msgstr "" + +#. Tag: para +#: basic_mapping.xml:764 +#, no-c-format +msgid "Hibernate can generate and populate identifier values for you automatically. This is the recommended approach over \"business\" or \"natural\" id (especially composite ids)." +msgstr "" + +#. Tag: para +#: basic_mapping.xml:768 +#, no-c-format +msgid "Hibernate offers various generation strategies, let's explore the most common ones first that happens to be standardized by JPA:" +msgstr "" + +#. Tag: para +#: basic_mapping.xml:774 +#, no-c-format +msgid "IDENTITY: supports identity columns in DB2, MySQL, MS SQL Server, Sybase and HypersonicSQL. The returned identifier is of type long, short or int." +msgstr "" + +#. Tag: para +#: basic_mapping.xml:781 +#, no-c-format +msgid "SEQUENCE (called seqhilo in Hibernate): uses a hi/lo algorithm to efficiently generate identifiers of type long, short or int, given a named database sequence." +msgstr "" + +#. Tag: para +#: basic_mapping.xml:788 +#, no-c-format +msgid "TABLE (called MultipleHiLoPerTableGenerator in Hibernate) : uses a hi/lo algorithm to efficiently generate identifiers of type long, short or int, given a table and column as a source of hi values. The hi/lo algorithm generates identifiers that are unique only for a particular database." +msgstr "" + +#. Tag: para +#: basic_mapping.xml:798 +#, no-c-format +msgid "AUTO: selects IDENTITY, SEQUENCE or TABLE depending upon the capabilities of the underlying database." +msgstr "" + +#. Tag: para +#: basic_mapping.xml:805 +#, no-c-format +msgid "We recommend all new projects to use the new enhanced identifier generators. They are deactivated by default for entities using annotations but can be activated using hibernate.id.new_generator_mappings=true. These new generators are more efficient and closer to the JPA 2 specification semantic." +msgstr "" + +#. Tag: para +#: basic_mapping.xml:812 +#, no-c-format +msgid "However they are not backward compatible with existing Hibernate based application (if a sequence or a table is used for id generation). See XXXXXXX for more information on how to activate them." +msgstr "" + +#. Tag: para +#: basic_mapping.xml:818 +#, no-c-format +msgid "To mark an id property as generated, use the @GeneratedValue annotation. You can specify the strategy used (default to AUTO) by setting strategy." +msgstr "" + +#. Tag: programlisting +#: basic_mapping.xml:823 +#, no-c-format +msgid "" + "@Entity\n" + "public class Customer {\n" + " @Id @GeneratedValue\n" + " Integer getId() { ... };\n" + "}\n" + "\n" + "@Entity \n" + "public class Invoice {\n" + " @Id @GeneratedValue(strategy=GenerationType.IDENTITY)\n" + " Integer getId() { ... };\n" + "}" +msgstr "" + +#. Tag: para +#: basic_mapping.xml:825 +#, no-c-format +msgid "SEQUENCE and TABLE require additional configurations that you can set using @SequenceGenerator and @TableGenerator:" +msgstr "" + +#. Tag: para +#: basic_mapping.xml:832 +#, no-c-format +msgid "name: name of the generator" +msgstr "" + +#. Tag: para +#: basic_mapping.xml:836 +#, no-c-format +msgid "table / sequenceName: name of the table or the sequence (defaulting respectively to hibernate_sequences and hibernate_sequence)" +msgstr "" + +#. Tag: para +#: basic_mapping.xml:843 +#, no-c-format +msgid "catalog / schema:" +msgstr "" + +#. Tag: para +#: basic_mapping.xml:848 +#, no-c-format +msgid "initialValue: the value from which the id is to start generating" +msgstr "" + +#. Tag: para +#: basic_mapping.xml:853 +#, no-c-format +msgid "allocationSize: the amount to increment by when allocating id numbers from the generator" +msgstr "" + +#. Tag: para +#: basic_mapping.xml:858 +#, no-c-format +msgid "In addition, the TABLE strategy also let you customize:" +msgstr "" + +#. Tag: para +#: basic_mapping.xml:863 +#, no-c-format +msgid "pkColumnName: the column name containing the entity identifier" +msgstr "" + +#. Tag: para +#: basic_mapping.xml:868 +#, no-c-format +msgid "valueColumnName: the column name containing the identifier value" +msgstr "" + +#. Tag: para +#: basic_mapping.xml:873 +#, no-c-format +msgid "pkColumnValue: the entity identifier" +msgstr "" + +#. Tag: para +#: basic_mapping.xml:878 +#, no-c-format +msgid "uniqueConstraints: any potential column constraint on the table containing the ids" +msgstr "" + +#. Tag: para +#: basic_mapping.xml:883 +#, no-c-format +msgid "To link a table or sequence generator definition with an actual generated property, use the same name in both the definition name and the generator value generator as shown below." +msgstr "" + +#. Tag: programlisting +#: basic_mapping.xml:888 +#, no-c-format +msgid "" + "@Id \n" + "@GeneratedValue(\n" + " strategy=GenerationType.SEQUENCE, \n" + " generator=\"SEQ_GEN\")\n" + "@javax.persistence.SequenceGenerator(\n" + " name=\"SEQ_GEN\",\n" + " sequenceName=\"my_sequence\",\n" + " allocationSize=20\n" + ")\n" + "public Integer getId() { ... }" +msgstr "" + +#. Tag: para +#: basic_mapping.xml:890 +#, no-c-format +msgid "The scope of a generator definition can be the application or the class. Class-defined generators are not visible outside the class and can override application level generators. Application level generators are defined in JPA's XML deployment descriptors (see XXXXXX ):" +msgstr "" + +#. Tag: programlisting +#: basic_mapping.xml:896 +#, no-c-format +msgid "" + "<table-generator name=\"EMP_GEN\"\n" + " table=\"GENERATOR_TABLE\"\n" + " pk-column-name=\"key\"\n" + " value-column-name=\"hi\"\n" + " pk-column-value=\"EMP\"\n" + " allocation-size=\"20\"/>\n" + "\n" + "//and the annotation equivalent\n" + "\n" + "@javax.persistence.TableGenerator(\n" + " name=\"EMP_GEN\",\n" + " table=\"GENERATOR_TABLE\",\n" + " pkColumnName = \"key\",\n" + " valueColumnName = \"hi\"\n" + " pkColumnValue=\"EMP\",\n" + " allocationSize=20\n" + ")\n" + "\n" + "<sequence-generator name=\"SEQ_GEN\" \n" + " sequence-name=\"my_sequence\"\n" + " allocation-size=\"20\"/>\n" + "\n" + "//and the annotation equivalent\n" + "\n" + "@javax.persistence.SequenceGenerator(\n" + " name=\"SEQ_GEN\",\n" + " sequenceName=\"my_sequence\",\n" + " allocationSize=20\n" + ")" +msgstr "" + +#. Tag: para +#: basic_mapping.xml:898 +#, no-c-format +msgid "If a JPA XML descriptor (like META-INF/orm.xml) is used to define the generators, EMP_GEN and SEQ_GEN are application level generators." +msgstr "" + +#. Tag: para +#: basic_mapping.xml:904 +#, no-c-format +msgid "Package level definition is not supported by the JPA specification. However, you can use the @GenericGenerator at the package level (see )." +msgstr "" + +#. Tag: para +#: basic_mapping.xml:910 +#, no-c-format +msgid "These are the four standard JPA generators. Hibernate goes beyond that and provide additional generators or additional options as we will see below. You can also write your own custom identifier generator by implementing org.hibernate.id.IdentifierGenerator." +msgstr "" + +#. Tag: para +#: basic_mapping.xml:916 +#, no-c-format +msgid "To define a custom generator, use the @GenericGenerator annotation (and its plural counter part @GenericGenerators) that describes the class of the identifier generator or its short cut name (as described below) and a list of key/value parameters. When using @GenericGenerator and assigning it via @GeneratedValue.generator, the @GeneratedValue.strategy is ignored: leave it blank." +msgstr "" + +#. Tag: programlisting +#: basic_mapping.xml:926 +#, no-c-format +msgid "" + "@Id @GeneratedValue(generator=\"system-uuid\")\n" + "@GenericGenerator(name=\"system-uuid\", strategy = \"uuid\")\n" + "public String getId() {\n" + "\n" + "@Id @GeneratedValue(generator=\"trigger-generated\")\n" + "@GenericGenerator(\n" + " name=\"trigger-generated\", \n" + " strategy = \"select\",\n" + " parameters = @Parameter(name=\"key\", value = \"socialSecurityNumber\")\n" + ")\n" + "public String getId() {" +msgstr "" + +#. Tag: para +#: basic_mapping.xml:928 +#, no-c-format +msgid "The hbm.xml approach uses the optional <generator> child element inside <id>. If any parameters are required to configure or initialize the generator instance, they are passed using the <param> element." +msgstr "" + +#. Tag: programlisting +#: basic_mapping.xml:934 +#, no-c-format +msgid "" + "<id name=\"id\" type=\"long\" column=\"cat_id\">\n" + " <generator class=\"org.hibernate.id.TableHiLoGenerator\">\n" + " <param name=\"table\">uid_table</param>\n" + " <param name=\"column\">next_hi_value_column</param>\n" + " </generator>\n" + "</id>" +msgstr "" + +#. Tag: title +#: basic_mapping.xml:937 +#, no-c-format +msgid "Various additional generators" +msgstr "" + +#. Tag: para +#: basic_mapping.xml:939 #, no-c-format msgid "All generators implement the interface org.hibernate.id.IdentifierGenerator. This is a very simple interface. Some applications can choose to provide their own specialized implementations, however, Hibernate provides a range of built-in implementations. The shortcut names for the built-in generators are as follows:" msgstr "" -#. Tag: term +#. Tag: literal +#: basic_mapping.xml:946 #, no-c-format -msgid "increment" +msgid "increment" msgstr "" #. Tag: para +#: basic_mapping.xml:949 #, no-c-format msgid "generates identifiers of type long, short or int that are unique only when no other process is inserting data into the same table. Do not use in a cluster." msgstr "" -#. Tag: term +#. Tag: literal +#: basic_mapping.xml:958 #, no-c-format -msgid "identity" +msgid "identity" msgstr "" #. Tag: para +#: basic_mapping.xml:961 #, no-c-format msgid "supports identity columns in DB2, MySQL, MS SQL Server, Sybase and HypersonicSQL. The returned identifier is of type long, short or int." msgstr "" -#. Tag: term +#. Tag: literal +#: basic_mapping.xml:969 #, no-c-format -msgid "sequence" +msgid "sequence" msgstr "" #. Tag: para +#: basic_mapping.xml:972 #, no-c-format msgid "uses a sequence in DB2, PostgreSQL, Oracle, SAP DB, McKoi or a generator in Interbase. The returned identifier is of type long, short or int" msgstr "" -#. Tag: term +#. Tag: literal +#: basic_mapping.xml:980 #, no-c-format -msgid "hilo" +msgid "hilo" msgstr "" #. Tag: para +#: basic_mapping.xml:984 #, no-c-format msgid "uses a hi/lo algorithm to efficiently generate identifiers of type long, short or int, given a table and column (by default hibernate_unique_key and next_hi respectively) as a source of hi values. The hi/lo algorithm generates identifiers that are unique only for a particular database." msgstr "" -#. Tag: term +#. Tag: literal +#: basic_mapping.xml:996 #, no-c-format -msgid "seqhilo" +msgid "seqhilo" msgstr "" #. Tag: para +#: basic_mapping.xml:999 #, no-c-format msgid "uses a hi/lo algorithm to efficiently generate identifiers of type long, short or int, given a named database sequence." msgstr "" -#. Tag: term +#. Tag: literal +#: basic_mapping.xml:1007 #, no-c-format -msgid "uuid" +msgid "uuid" msgstr "" #. Tag: para +#: basic_mapping.xml:1010 #, no-c-format -msgid "uses a 128-bit UUID algorithm to generate identifiers of type string that are unique within a network (the IP address is used). The UUID is encoded as a string of 32 hexadecimal digits in length." +msgid "Generates a 128-bit UUID based on a custom algorithm. The value generated is represented as a string of 32 hexidecimal digits. Users can also configure it to use a separator (config parameter \"separator\") which separates the hexidecimal digits into 8{sep}8{sep}4{sep}8{sep}4. Note specifically that this is different than the IETF RFC 4122 representation of 8-4-4-4-12. If you need RFC 4122 compliant UUIDs, consider using \"uuid2\" generator discussed below." msgstr "" -#. Tag: term +#. Tag: literal +#: basic_mapping.xml:1023 #, no-c-format -msgid "guid" +msgid "uuid2" msgstr "" #. Tag: para +#: basic_mapping.xml:1026 +#, no-c-format +msgid "Generates a IETF RFC 4122 compliant (variant 2) 128-bit UUID. The exact \"version\" (the RFC term) generated depends on the pluggable \"generation strategy\" used (see below). Capable of generating values as java.util.UUID, java.lang.String or as a byte array of length 16 (byte[16]). The \"generation strategy\" is defined by the interface org.hibernate.id.UUIDGenerationStrategy. The generator defines 2 configuration parameters for defining which generation strategy to use:" +msgstr "" + +#. Tag: literal +#: basic_mapping.xml:1038 +#, no-c-format +msgid "uuid_gen_strategy_class" +msgstr "" + +#. Tag: para +#: basic_mapping.xml:1041 +#, no-c-format +msgid "Names the UUIDGenerationStrategy class to use" +msgstr "" + +#. Tag: literal +#: basic_mapping.xml:1047 +#, no-c-format +msgid "uuid_gen_strategy" +msgstr "" + +#. Tag: para +#: basic_mapping.xml:1050 +#, no-c-format +msgid "Names the UUIDGenerationStrategy instance to use" +msgstr "" + +#. Tag: para +#: basic_mapping.xml:1056 +#, no-c-format +msgid "Out of the box, comes with the following strategies:" +msgstr "" + +#. Tag: para +#: basic_mapping.xml:1059 +#, no-c-format +msgid "org.hibernate.id.uuid.StandardRandomStrategy (the default) - generates \"version 3\" (aka, \"random\") UUID values via the randomUUID method of java.util.UUID" +msgstr "" + +#. Tag: para +#: basic_mapping.xml:1067 +#, no-c-format +msgid "org.hibernate.id.uuid.CustomVersionOneStrategy - generates \"version 1\" UUID values, using IP address since mac address not available. If you need mac address to be used, consider leveraging one of the existing third party UUID generators which sniff out mac address and integrating it via the org.hibernate.id.UUIDGenerationStrategy contract. Two such libraries known at time of this writing include http://johannburkard.de/software/uuid/ and http://commons.apache.org/sandbox/id/uuid.html" +msgstr "" + +#. Tag: literal +#: basic_mapping.xml:1085 +#, no-c-format +msgid "guid" +msgstr "" + +#. Tag: para +#: basic_mapping.xml:1088 #, no-c-format msgid "uses a database-generated GUID string on MS SQL Server and MySQL." msgstr "" -#. Tag: term +#. Tag: literal +#: basic_mapping.xml:1094 #, no-c-format -msgid "native" +msgid "native" msgstr "" #. Tag: para +#: basic_mapping.xml:1097 #, no-c-format msgid "selects identity, sequence or hilo depending upon the capabilities of the underlying database." msgstr "" -#. Tag: term +#. Tag: literal +#: basic_mapping.xml:1105 #, no-c-format -msgid "assigned" +msgid "assigned" msgstr "" #. Tag: para +#: basic_mapping.xml:1108 #, no-c-format msgid "lets the application assign an identifier to the object before save() is called. This is the default strategy if no <generator> element is specified." msgstr "" -#. Tag: term +#. Tag: literal +#: basic_mapping.xml:1117 #, no-c-format -msgid "select" +msgid "select" msgstr "" #. Tag: para +#: basic_mapping.xml:1120 #, no-c-format msgid "retrieves a primary key, assigned by a database trigger, by selecting the row by some unique key and retrieving the primary key value." msgstr "" -#. Tag: term +#. Tag: literal +#: basic_mapping.xml:1127 #, no-c-format -msgid "foreign" +msgid "foreign" msgstr "" #. Tag: para +#: basic_mapping.xml:1130 #, no-c-format msgid "uses the identifier of another associated object. It is usually used in conjunction with a <one-to-one> primary key association." msgstr "" -#. Tag: term +#. Tag: literal +#: basic_mapping.xml:1138 #, no-c-format -msgid "sequence-identity" +msgid "sequence-identity" msgstr "" #. Tag: para +#: basic_mapping.xml:1141 #, no-c-format msgid "a specialized sequence generation strategy that utilizes a database sequence for the actual value generation, but combines this with JDBC3 getGeneratedKeys to return the generated identifier value as part of the insert statement execution. This strategy is only supported on Oracle 10g drivers targeted for JDK 1.4. Comments on these insert statements are disabled due to a bug in the Oracle drivers." msgstr "" #. Tag: title +#: basic_mapping.xml:1155 #, no-c-format msgid "Hi/lo algorithm" msgstr "" #. Tag: para +#: basic_mapping.xml:1157 #, no-c-format msgid "The hilo and seqhilo generators provide two alternate implementations of the hi/lo algorithm. The first implementation requires a \"special\" database table to hold the next available \"hi\" value. Where supported, the second uses an Oracle-style sequence." msgstr "" +#. Tag: programlisting +#: basic_mapping.xml:1163 +#, no-c-format +msgid "" + "<id name=\"id\" type=\"long\" column=\"cat_id\">\n" + " <generator class=\"hilo\">\n" + " <param name=\"table\">hi_value</param>\n" + " <param name=\"column\">next_value</param>\n" + " <param name=\"max_lo\">100</param>\n" + " </generator>\n" + "</id>" +msgstr "" + +#. Tag: programlisting +#: basic_mapping.xml:1165 +#, no-c-format +msgid "" + "<id name=\"id\" type=\"long\" column=\"cat_id\">\n" + " <generator class=\"seqhilo\">\n" + " <param name=\"sequence\">hi_value</param>\n" + " <param name=\"max_lo\">100</param>\n" + " </generator>\n" + "</id>" +msgstr "" + #. Tag: para +#: basic_mapping.xml:1167 #, no-c-format msgid "Unfortunately, you cannot use hilo when supplying your own Connection to Hibernate. When Hibernate uses an application server datasource to obtain connections enlisted with JTA, you must configure the hibernate.transaction.manager_lookup_class." msgstr "" #. Tag: title +#: basic_mapping.xml:1175 #, no-c-format msgid "UUID algorithm" msgstr "" #. Tag: para +#: basic_mapping.xml:1177 #, no-c-format msgid "The UUID contains: IP address, startup time of the JVM that is accurate to a quarter second, system time and a counter value that is unique within the JVM. It is not possible to obtain a MAC address or memory address from Java code, so this is the best option without using JNI." msgstr "" #. Tag: title +#: basic_mapping.xml:1185 #, no-c-format msgid "Identity columns and sequences" msgstr "" #. Tag: para +#: basic_mapping.xml:1187 #, no-c-format msgid "For databases that support identity columns (DB2, MySQL, Sybase, MS SQL), you can use identity key generation. For databases that support sequences (DB2, Oracle, PostgreSQL, Interbase, McKoi, SAP DB) you can use sequence style key generation. Both of these strategies require two SQL queries to insert a new object. For example:" msgstr "" +#. Tag: programlisting +#: basic_mapping.xml:1195 +#, no-c-format +msgid "" + "<id name=\"id\" type=\"long\" column=\"person_id\">\n" + " <generator class=\"sequence\">\n" + " <param name=\"sequence\">person_id_sequence</param>\n" + " </generator>\n" + "</id>" +msgstr "" + +#. Tag: programlisting +#: basic_mapping.xml:1197 +#, no-c-format +msgid "" + "<id name=\"id\" type=\"long\" column=\"person_id\" unsaved-value=\"0\">\n" + " <generator class=\"identity\"/>\n" + "</id>" +msgstr "" + #. Tag: para +#: basic_mapping.xml:1199 #, no-c-format msgid "For cross-platform development, the native strategy will, depending on the capabilities of the underlying database, choose from the identity, sequence and hilo strategies." msgstr "" #. Tag: title +#: basic_mapping.xml:1207 #, no-c-format msgid "Assigned identifiers" msgstr "" #. Tag: para +#: basic_mapping.xml:1209 #, no-c-format -msgid "If you want the application to assign identifiers, as opposed to having Hibernate generate them, you can use the assigned generator. This special generator uses the identifier value already assigned to the object's identifier property. The generator is used when the primary key is a natural key instead of a surrogate key. This is the default behavior if you do not specify a <generator> element." +msgid "If you want the application to assign identifiers, as opposed to having Hibernate generate them, you can use the assigned generator. This special generator uses the identifier value already assigned to the object's identifier property. The generator is used when the primary key is a natural key instead of a surrogate key. This is the default behavior if you do not specify @GeneratedValue nor <generator> elements." msgstr "" #. Tag: para +#: basic_mapping.xml:1218 #, no-c-format msgid "The assigned generator makes Hibernate use unsaved-value=\"undefined\". This forces Hibernate to go to the database to determine if an instance is transient or detached, unless there is a version or timestamp property, or you define Interceptor.isUnsaved()." msgstr "" #. Tag: title +#: basic_mapping.xml:1226 #, no-c-format msgid "Primary keys assigned by triggers" msgstr "" #. Tag: para +#: basic_mapping.xml:1228 #, no-c-format msgid "Hibernate does not generate DDL with triggers. It is for legacy schemas only." msgstr "" +#. Tag: programlisting +#: basic_mapping.xml:1231 +#, no-c-format +msgid "" + "<id name=\"id\" type=\"long\" column=\"person_id\">\n" + " <generator class=\"select\">\n" + " <param name=\"key\">socialSecurityNumber</param>\n" + " </generator>\n" + "</id>" +msgstr "" + #. Tag: para +#: basic_mapping.xml:1233 #, no-c-format msgid "In the above example, there is a unique valued property named socialSecurityNumber. It is defined by the class, as a natural key and a surrogate key named person_id, whose value is generated by a trigger." msgstr "" #. Tag: title +#: basic_mapping.xml:1241 +#, no-c-format +msgid "Identity copy (foreign generator)" +msgstr "" + +#. Tag: para +#: basic_mapping.xml:1243 +#, no-c-format +msgid "Finally, you can ask Hibernate to copy the identifier from another associated entity. In the Hibernate jargon, it is known as a foreign generator but the JPA mapping reads better and is encouraged." +msgstr "" + +#. Tag: programlisting +#: basic_mapping.xml:1248 +#, no-c-format +msgid "" + "@Entity\n" + "class MedicalHistory implements Serializable {\n" + " @Id @OneToOne\n" + " @JoinColumn(name = \"person_id\")\n" + " Person patient;\n" + "}\n" + "\n" + "@Entity\n" + "public class Person implements Serializable {\n" + " @Id @GeneratedValue Integer id;\n" + "}" +msgstr "" + +#. Tag: para +#: basic_mapping.xml:1250 +#, no-c-format +msgid "Or alternatively" +msgstr "" + +#. Tag: programlisting +#: basic_mapping.xml:1252 +#, no-c-format +msgid "" + "@Entity\n" + "class MedicalHistory implements Serializable {\n" + " @Id Integer id;\n" + "\n" + " @MapsId @OneToOne\n" + " @JoinColumn(name = \"patient_id\")\n" + " Person patient;\n" + "}\n" + "\n" + "@Entity\n" + "class Person {\n" + " @Id @GeneratedValue Integer id;\n" + "}" +msgstr "" + +#. Tag: para +#: basic_mapping.xml:1254 +#, no-c-format +msgid "In hbm.xml use the following approach:" +msgstr "" + +#. Tag: programlisting +#: basic_mapping.xml:1256 +#, no-c-format +msgid "" + "<class name=\"MedicalHistory\">\n" + " <id name=\"id\">\n" + " <generator class=\"foreign\">\n" + " <param name=\"property\">patient</param>\n" + " </generator>\n" + " </id>\n" + " <one-to-one name=\"patient\" class=\"Person\" constrained=\"true\"/>\n" + "</class>" +msgstr "" + +#. Tag: title +#: basic_mapping.xml:1261 #, no-c-format msgid "Enhanced identifier generators" msgstr "" #. Tag: para +#: basic_mapping.xml:1263 #, no-c-format msgid "Starting with release 3.2.3, there are 2 new generators which represent a re-thinking of 2 different aspects of identifier generation. The first aspect is database portability; the second is optimization Optimization means that you do not have to query the database for every request for a new identifier value. These two new generators are intended to take the place of some of the named generators described above, starting in 3.3.x. However, they are included in the current releases and can be referenced by FQN." msgstr "" #. Tag: para +#: basic_mapping.xml:1272 #, no-c-format msgid "The first of these new generators is org.hibernate.id.enhanced.SequenceStyleGenerator which is intended, firstly, as a replacement for the sequence generator and, secondly, as a better portability generator than native. This is because native generally chooses between identity and sequence which have largely different semantics that can cause subtle issues in applications eyeing portability. org.hibernate.id.enhanced.SequenceStyleGenerator, however, achieves portability in a different manner. It chooses between a table or a sequence in the database to store its incrementing values, depending on the capabilities of the dialect being used. The difference between this and native is that table-based and sequence-based storage have the same exact semantic. In fact, sequences are exactly what Hibernate tries to emulate with its table-based generators. This generator has a number of configuration parameters:" msgstr "" #. Tag: para +#: basic_mapping.xml:1291 #, no-c-format msgid "sequence_name (optional, defaults to hibernate_sequence): the name of the sequence or table to be used." msgstr "" #. Tag: para +#: basic_mapping.xml:1297 #, no-c-format msgid "initial_value (optional, defaults to 1): the initial value to be retrieved from the sequence/table. In sequence creation terms, this is analogous to the clause typically named \"STARTS WITH\"." msgstr "" #. Tag: para +#: basic_mapping.xml:1304 #, no-c-format msgid "increment_size (optional - defaults to 1): the value by which subsequent calls to the sequence/table should differ. In sequence creation terms, this is analogous to the clause typically named \"INCREMENT BY\"." msgstr "" #. Tag: para +#: basic_mapping.xml:1312 #, no-c-format msgid "force_table_use (optional - defaults to false): should we force the use of a table as the backing structure even though the dialect might support sequence?" msgstr "" #. Tag: para +#: basic_mapping.xml:1319 #, no-c-format msgid "value_column (optional - defaults to next_val): only relevant for table structures, it is the name of the column on the table which is used to hold the value." msgstr "" #. Tag: para +#: basic_mapping.xml:1326 #, no-c-format -msgid "optimizer (optional - defaults to none): See " +msgid "optimizer (optional - defaults to none): See" msgstr "" #. Tag: para +#: basic_mapping.xml:1332 #, no-c-format msgid "The second of these new generators is org.hibernate.id.enhanced.TableGenerator, which is intended, firstly, as a replacement for the table generator, even though it actually functions much more like org.hibernate.id.MultipleHiLoPerTableGenerator, and secondly, as a re-implementation of org.hibernate.id.MultipleHiLoPerTableGenerator that utilizes the notion of pluggable optimizers. Essentially this generator defines a table capable of holding a number of different increment values simultaneously by using multiple distinctly keyed rows. This generator has a number of configuration parameters:" msgstr "" #. Tag: para +#: basic_mapping.xml:1345 #, no-c-format msgid "table_name (optional - defaults to hibernate_sequences): the name of the table to be used." msgstr "" #. Tag: para +#: basic_mapping.xml:1351 #, no-c-format msgid "value_column_name (optional - defaults to next_val): the name of the column on the table that is used to hold the value." msgstr "" #. Tag: para +#: basic_mapping.xml:1357 #, no-c-format msgid "segment_column_name (optional - defaults to sequence_name): the name of the column on the table that is used to hold the \"segment key\". This is the value which identifies which increment value to use." msgstr "" #. Tag: para +#: basic_mapping.xml:1365 #, no-c-format msgid "segment_value (optional - defaults to default): The \"segment key\" value for the segment from which we want to pull increment values for this generator." msgstr "" #. Tag: para +#: basic_mapping.xml:1372 #, no-c-format msgid "segment_value_length (optional - defaults to 255): Used for schema generation; the column size to create this segment key column." msgstr "" #. Tag: para +#: basic_mapping.xml:1378 #, no-c-format msgid "initial_value (optional - defaults to 1): The initial value to be retrieved from the table." msgstr "" #. Tag: para +#: basic_mapping.xml:1384 #, no-c-format msgid "increment_size (optional - defaults to 1): The value by which subsequent calls to the table should differ." msgstr "" #. Tag: para +#: basic_mapping.xml:1390 #, no-c-format -msgid "optimizer (optional - defaults to ): See " +msgid "optimizer (optional - defaults to ??): See ." msgstr "" #. Tag: title +#: basic_mapping.xml:1397 #, no-c-format msgid "Identifier generator optimization" msgstr "" #. Tag: para +#: basic_mapping.xml:1399 #, no-c-format -msgid "For identifier generators that store values in the database, it is inefficient for them to hit the database on each and every call to generate a new identifier value. Instead, you can group a bunch of them in memory and only hit the database when you have exhausted your in-memory value group. This is the role of the pluggable optimizers. Currently only the two enhanced generators ( support this operation." +msgid "For identifier generators that store values in the database, it is inefficient for them to hit the database on each and every call to generate a new identifier value. Instead, you can group a bunch of them in memory and only hit the database when you have exhausted your in-memory value group. This is the role of the pluggable optimizers. Currently only the two enhanced generators ( support this operation." msgstr "" #. Tag: para +#: basic_mapping.xml:1410 #, no-c-format msgid "none (generally this is the default if no optimizer was specified): this will not perform any optimizations and hit the database for each and every request." msgstr "" #. Tag: para +#: basic_mapping.xml:1417 #, no-c-format msgid "hilo: applies a hi/lo algorithm around the database retrieved values. The values from the database for this optimizer are expected to be sequential. The values retrieved from the database structure for this optimizer indicates the \"group number\". The increment_size is multiplied by that value in memory to define a group \"hi value\"." msgstr "" #. Tag: para +#: basic_mapping.xml:1427 #, no-c-format msgid "pooled: as with the case of hilo, this optimizer attempts to minimize the number of hits to the database. Here, however, we simply store the starting value for the \"next group\" into the database structure rather than a sequential value in combination with an in-memory grouping algorithm. Here, increment_size refers to the values coming from the database." msgstr "" #. Tag: title +#: basic_mapping.xml:1441 #, no-c-format -msgid "composite-id" +msgid "Partial identifier generation" msgstr "" #. Tag: para +#: basic_mapping.xml:1443 #, no-c-format -msgid "A table with a composite key can be mapped with multiple properties of the class as identifier properties. The <composite-id> element accepts <key-property> property mappings and <key-many-to-one> mappings as child elements." +msgid "Hibernate supports the automatic generation of some of the identifier properties. Simply use the @GeneratedValue annotation on one or several id properties." msgstr "" #. Tag: para +#: basic_mapping.xml:1449 #, no-c-format -msgid "The persistent class must override equals() and hashCode() to implement composite identifier equality. It must also implement Serializable." +msgid "The Hibernate team has always felt such a construct as fundamentally wrong. Try hard to fix your data model before using this feature." +msgstr "" + +#. Tag: programlisting +#: basic_mapping.xml:1454 +#, no-c-format +msgid "" + "@Entity\n" + "public class CustomerInventory implements Serializable {\n" + " @Id\n" + " @TableGenerator(name = \"inventory\",\n" + " table = \"U_SEQUENCES\",\n" + " pkColumnName = \"S_ID\",\n" + " valueColumnName = \"S_NEXTNUM\",\n" + " pkColumnValue = \"inventory\",\n" + " allocationSize = 1000)\n" + " @GeneratedValue(strategy = GenerationType.TABLE, generator = \"inventory\")\n" + " Integer id;\n" + "\n" + "\n" + " @Id @ManyToOne(cascade = CascadeType.MERGE)\n" + " Customer customer;\n" + "}\n" + "\n" + "@Entity\n" + "public class Customer implements Serializable {\n" + " @Id\n" + " private int id;\n" + "}" msgstr "" #. Tag: para +#: basic_mapping.xml:1456 #, no-c-format -msgid "Unfortunately, this approach means that a persistent object is its own identifier. There is no convenient \"handle\" other than the object itself. You must instantiate an instance of the persistent class itself and populate its identifier properties before you can load() the persistent state associated with a composite key. We call this approach an embedded composite identifier, and discourage it for serious applications." -msgstr "" - -#. Tag: para -#, no-c-format -msgid "A second approach is what we call a mapped composite identifier, where the identifier properties named inside the <composite-id> element are duplicated on both the persistent class and a separate identifier class." -msgstr "" - -#. Tag: para -#, no-c-format -msgid "In this example, both the composite identifier class, MedicareId, and the entity class itself have properties named medicareNumber and dependent. The identifier class must override equals() and hashCode() and implement Serializable. The main disadvantage of this approach is code duplication." -msgstr "" - -#. Tag: para -#, no-c-format -msgid "The following attributes are used to specify a mapped composite identifier:" -msgstr "" - -#. Tag: para -#, no-c-format -msgid "mapped (optional - defaults to false): indicates that a mapped composite identifier is used, and that the contained property mappings refer to both the entity class and the composite identifier class." -msgstr "" - -#. Tag: para -#, no-c-format -msgid "class (optional - but required for a mapped composite identifier): the class used as a composite identifier." -msgstr "" - -#. Tag: para -#, no-c-format -msgid "We will describe a third, even more convenient approach, where the composite identifier is implemented as a component class in . The attributes described below apply only to this alternative approach:" -msgstr "" - -#. Tag: para -#, no-c-format -msgid "name (optional - required for this approach): a property of component type that holds the composite identifier. Please see chapter 9 for more information." -msgstr "" - -#. Tag: para -#, no-c-format -msgid "access (optional - defaults to property): the strategy Hibernate uses for accessing the property value." -msgstr "" - -#. Tag: para -#, no-c-format -msgid "class (optional - defaults to the property type determined by reflection): the component class used as a composite identifier. Please see the next section for more information." -msgstr "" - -#. Tag: para -#, no-c-format -msgid "The third approach, an identifier component, is recommended for almost all applications." +msgid "You can also generate properties inside an @EmbeddedId class." msgstr "" #. Tag: title +#: basic_mapping.xml:1462 #, no-c-format -msgid "Discriminator" +msgid "Optimistic locking properties (optional)" msgstr "" #. Tag: para +#: basic_mapping.xml:1464 #, no-c-format -msgid "The <discriminator> element is required for polymorphic persistence using the table-per-class-hierarchy mapping strategy. It declares a discriminator column of the table. The discriminator column contains marker values that tell the persistence layer what subclass to instantiate for a particular row. A restricted set of types can be used: string, character, integer, byte, short, boolean, yes_no, true_false." +msgid "When using long transactions or conversations that span several database transactions, it is useful to store versioning data to ensure that if the same entity is updated by two conversations, the last to commit changes will be informed and not override the other conversation's work. It guarantees some isolation while still allowing for good scalability and works particularly well in read-often write-sometimes situations." msgstr "" #. Tag: para +#: basic_mapping.xml:1472 #, no-c-format -msgid "column (optional - defaults to class): the name of the discriminator column." -msgstr "" - -#. Tag: para -#, no-c-format -msgid "type (optional - defaults to string): a name that indicates the Hibernate type" -msgstr "" - -#. Tag: para -#, no-c-format -msgid "force (optional - defaults to false): \"forces\" Hibernate to specify the allowed discriminator values, even when retrieving all instances of the root class." -msgstr "" - -#. Tag: para -#, no-c-format -msgid "insert (optional - defaults to true): set this to false if your discriminator column is also part of a mapped composite identifier. It tells Hibernate not to include the column in SQL INSERTs." -msgstr "" - -#. Tag: para -#, no-c-format -msgid "formula (optional): an arbitrary SQL expression that is executed when a type has to be evaluated. It allows content-based discrimination." -msgstr "" - -#. Tag: para -#, no-c-format -msgid "Actual values of the discriminator column are specified by the discriminator-value attribute of the <class> and <subclass> elements." -msgstr "" - -#. Tag: para -#, no-c-format -msgid "The force attribute is only useful if the table contains rows with \"extra\" discriminator values that are not mapped to a persistent class. This will not usually be the case." -msgstr "" - -#. Tag: para -#, no-c-format -msgid "The formula attribute allows you to declare an arbitrary SQL expression that will be used to evaluate the type of a row. For example:" -msgstr "" - -#. Tag: title -#, no-c-format -msgid "Version (optional)" -msgstr "" - -#. Tag: para -#, no-c-format -msgid "The <version> element is optional and indicates that the table contains versioned data. This is particularly useful if you plan to use long transactions. See below for more information:" -msgstr "" - -#. Tag: para -#, no-c-format -msgid "column (optional - defaults to the property name): the name of the column holding the version number." -msgstr "" - -#. Tag: para -#, no-c-format -msgid "name: the name of a property of the persistent class." -msgstr "" - -#. Tag: para -#, no-c-format -msgid "type (optional - defaults to integer): the type of the version number." -msgstr "" - -#. Tag: para -#, no-c-format -msgid "access (optional - defaults to property): the strategy Hibernate uses to access the property value." -msgstr "" - -#. Tag: para -#, no-c-format -msgid "unsaved-value (optional - defaults to undefined): a version property value that indicates that an instance is newly instantiated (unsaved), distinguishing it from detached instances that were saved or loaded in a previous session. Undefined specifies that the identifier property value should be used." -msgstr "" - -#. Tag: para -#, no-c-format -msgid "generated (optional - defaults to never): specifies that this version property value is generated by the database. See the discussion of generated properties for more information." -msgstr "" - -#. Tag: para -#, no-c-format -msgid "insert (optional - defaults to true): specifies whether the version column should be included in SQL insert statements. It can be set to false if the database column is defined with a default value of 0." -msgstr "" - -#. Tag: para -#, no-c-format -msgid "Version numbers can be of Hibernate type long, integer, short, timestamp or calendar." +msgid "You can use two approaches: a dedicated version number or a timestamp." msgstr "" #. Tag: para +#: basic_mapping.xml:1475 #, no-c-format msgid "A version or timestamp property should never be null for a detached instance. Hibernate will detect any instance with a null version or timestamp as transient, irrespective of what other unsaved-value strategies are specified. Declaring a nullable version or timestamp property is an easy way to avoid problems with transitive reattachment in Hibernate. It is especially useful for people using assigned identifiers or composite keys." msgstr "" #. Tag: title +#: basic_mapping.xml:1485 #, no-c-format -msgid "Timestamp (optional)" +msgid "Version number" msgstr "" #. Tag: para +#: basic_mapping.xml:1487 #, no-c-format -msgid "The optional <timestamp> element indicates that the table contains timestamped data. This provides an alternative to versioning. Timestamps are a less safe implementation of optimistic locking. However, sometimes the application might use the timestamps in other ways." +msgid "You can add optimistic locking capability to an entity using the @Version annotation:" +msgstr "" + +#. Tag: programlisting +#: basic_mapping.xml:1490 +#, no-c-format +msgid "" + "@Entity\n" + "public class Flight implements Serializable {\n" + "...\n" + " @Version\n" + " @Column(name=\"OPTLOCK\")\n" + " public Integer getVersion() { ... }\n" + "}" msgstr "" #. Tag: para +#: basic_mapping.xml:1492 +#, no-c-format +msgid "The version property will be mapped to the OPTLOCK column, and the entity manager will use it to detect conflicting updates (preventing lost updates you might otherwise see with the last-commit-wins strategy)." +msgstr "" + +#. Tag: para +#: basic_mapping.xml:1497 +#, no-c-format +msgid "The version column may be a numeric. Hibernate supports any kind of type provided that you define and implement the appropriate UserVersionType." +msgstr "" + +#. Tag: para +#: basic_mapping.xml:1501 +#, no-c-format +msgid "The application must not alter the version number set up by Hibernate in any way. To artificially increase the version number, check in Hibernate Entity Manager's reference documentation LockModeType.OPTIMISTIC_FORCE_INCREMENT or LockModeType.PESSIMISTIC_FORCE_INCREMENT." +msgstr "" + +#. Tag: para +#: basic_mapping.xml:1507 +#, no-c-format +msgid "If the version number is generated by the database (via a trigger for example), make sure to use @org.hibernate.annotations.Generated(GenerationTime.ALWAYS)." +msgstr "" + +#. Tag: para +#: basic_mapping.xml:1511 +#, no-c-format +msgid "To declare a version property in hbm.xml, use:" +msgstr "" + +#. Tag: programlisting +#: basic_mapping.xml:1530 +#, no-c-format +msgid "" + "<version\n" + " column=\"version_column\"\n" + " name=\"propertyName\"\n" + " type=\"typename\"\n" + " access=\"field|property|ClassName\"\n" + " unsaved-value=\"null|negative|undefined\"\n" + " generated=\"never|always\"\n" + " insert=\"true|false\"\n" + " node=\"element-name|@attribute-name|element/@attribute|.\"\n" + "/>" +msgstr "" + +#. Tag: para +#: basic_mapping.xml:1534 +#, no-c-format +msgid "column (optional - defaults to the property name): the name of the column holding the version number." +msgstr "" + +#. Tag: para +#: basic_mapping.xml:1540 +#, no-c-format +msgid "name: the name of a property of the persistent class." +msgstr "" + +#. Tag: para +#: basic_mapping.xml:1545 +#, no-c-format +msgid "type (optional - defaults to integer): the type of the version number." +msgstr "" + +#. Tag: para +#: basic_mapping.xml:1551 +#, no-c-format +msgid "access (optional - defaults to property): the strategy Hibernate uses to access the property value." +msgstr "" + +#. Tag: para +#: basic_mapping.xml:1557 +#, no-c-format +msgid "unsaved-value (optional - defaults to undefined): a version property value that indicates that an instance is newly instantiated (unsaved), distinguishing it from detached instances that were saved or loaded in a previous session. Undefined specifies that the identifier property value should be used." +msgstr "" + +#. Tag: para +#: basic_mapping.xml:1567 +#, no-c-format +msgid "generated (optional - defaults to never): specifies that this version property value is generated by the database. See the discussion of generated properties for more information." +msgstr "" + +#. Tag: para +#: basic_mapping.xml:1575 +#, no-c-format +msgid "insert (optional - defaults to true): specifies whether the version column should be included in SQL insert statements. It can be set to false if the database column is defined with a default value of 0." +msgstr "" + +#. Tag: title +#: basic_mapping.xml:1586 +#, no-c-format +msgid "Timestamp" +msgstr "" + +#. Tag: para +#: basic_mapping.xml:1588 +#, no-c-format +msgid "Alternatively, you can use a timestamp. Timestamps are a less safe implementation of optimistic locking. However, sometimes the application might use the timestamps in other ways." +msgstr "" + +#. Tag: para +#: basic_mapping.xml:1592 +#, no-c-format +msgid "Simply mark a property of type Date or Calendar as @Version." +msgstr "" + +#. Tag: programlisting +#: basic_mapping.xml:1596 +#, no-c-format +msgid "" + "@Entity\n" + "public class Flight implements Serializable {\n" + "...\n" + " @Version\n" + " public Date getLastUpdate() { ... }\n" + "}" +msgstr "" + +#. Tag: para +#: basic_mapping.xml:1598 +#, no-c-format +msgid "Like version numbers, the timestamp can be generated by the database instead of Hibernate. To do that, use @org.hibernate.annotations.Generated(GenerationTime.ALWAYS)." +msgstr "" + +#. Tag: para +#: basic_mapping.xml:1602 +#, no-c-format +msgid "In hbm.xml, use the <timestamp> element:" +msgstr "" + +#. Tag: programlisting +#: basic_mapping.xml:1620 +#, no-c-format +msgid "" + "<timestamp\n" + " column=\"timestamp_column\"\n" + " name=\"propertyName\"\n" + " access=\"field|property|ClassName\"\n" + " unsaved-value=\"null|undefined\"\n" + " source=\"vm|db\"\n" + " generated=\"never|always\"\n" + " node=\"element-name|@attribute-name|element/@attribute|.\"\n" + "/>" +msgstr "" + +#. Tag: para +#: basic_mapping.xml:1624 #, no-c-format msgid "column (optional - defaults to the property name): the name of a column holding the timestamp." msgstr "" #. Tag: para +#: basic_mapping.xml:1630 #, no-c-format msgid "name: the name of a JavaBeans style property of Java type Date or Timestamp of the persistent class." msgstr "" #. Tag: para +#: basic_mapping.xml:1636 basic_mapping.xml:2163 basic_mapping.xml:2380 basic_mapping.xml:3226 basic_mapping.xml:3420 basic_mapping.xml:3593 +#, no-c-format +msgid "access (optional - defaults to property): the strategy Hibernate uses for accessing the property value." +msgstr "" + +#. Tag: para +#: basic_mapping.xml:1642 #, no-c-format msgid "unsaved-value (optional - defaults to null): a version property value that indicates that an instance is newly instantiated (unsaved), distinguishing it from detached instances that were saved or loaded in a previous session. Undefined specifies that the identifier property value should be used." msgstr "" #. Tag: para +#: basic_mapping.xml:1652 #, no-c-format msgid "source (optional - defaults to vm): Where should Hibernate retrieve the timestamp value from? From the database, or from the current JVM? Database-based timestamps incur an overhead because Hibernate must hit the database in order to determine the \"next value\". It is safer to use in clustered environments. Not all Dialects are known to support the retrieval of the database's current timestamp. Others may also be unsafe for usage in locking due to lack of precision (Oracle 8, for example)." msgstr "" #. Tag: para +#: basic_mapping.xml:1665 #, no-c-format msgid "generated (optional - defaults to never): specifies that this timestamp property value is actually generated by the database. See the discussion of generated properties for more information." msgstr "" #. Tag: title +#: basic_mapping.xml:1675 #, no-c-format msgid "Note" msgstr "" #. Tag: para +#: basic_mapping.xml:1677 #, no-c-format msgid "<Timestamp> is equivalent to <version type=\"timestamp\">. And <timestamp source=\"db\"> is equivalent to <version type=\"dbtimestamp\">" msgstr "" #. Tag: title +#: basic_mapping.xml:1686 #, no-c-format msgid "Property" msgstr "" #. Tag: para +#: basic_mapping.xml:1688 #, no-c-format -msgid "The <property> element declares a persistent JavaBean style property of the class." +msgid "You need to decide which property needs to be made persistent in a given entity. This differs slightly between the annotation driven metadata and the hbm.xml files." +msgstr "" + +#. Tag: title +#: basic_mapping.xml:1693 +#, no-c-format +msgid "Property mapping with annotations" msgstr "" #. Tag: para +#: basic_mapping.xml:1695 #, no-c-format -msgid "name: the name of the property, with an initial lowercase letter." +msgid "In the annotations world, every non static non transient property (field or method depending on the access type) of an entity is considered persistent, unless you annotate it as @Transient. Not having an annotation for your property is equivalent to the appropriate @Basic annotation." msgstr "" #. Tag: para +#: basic_mapping.xml:1702 #, no-c-format -msgid "column (optional - defaults to the property name): the name of the mapped database table column. This can also be specified by nested <column> element(s)." +msgid "The @Basic annotation allows you to declare the fetching strategy for a property. If set to LAZY, specifies that this property should be fetched lazily when the instance variable is first accessed. It requires build-time bytecode instrumentation, if your classes are not instrumented, property level lazy loading is silently ignored. The default is EAGER. You can also mark a property as not optional thanks to the @Basic.optional attribute. This will ensure that the underlying column are not nullable (if possible). Note that a better approach is to use the @NotNull annotation of the Bean Validation specification." msgstr "" #. Tag: para +#: basic_mapping.xml:1715 #, no-c-format -msgid "update, insert (optional - defaults to true): specifies that the mapped columns should be included in SQL UPDATE and/or INSERT statements. Setting both to false allows a pure \"derived\" property whose value is initialized from some other property that maps to the same column(s), or by a trigger or other application." +msgid "Let's look at a few examples:" +msgstr "" + +#. Tag: programlisting +#: basic_mapping.xml:1717 +#, no-c-format +msgid "" + "public transient int counter; //transient property\n" + "\n" + "private String firstname; //persistent property\n" + "\n" + "@Transient\n" + "String getLengthInMeter() { ... } //transient property\n" + "\n" + "String getName() {... } // persistent property\n" + "\n" + "@Basic\n" + "int getLength() { ... } // persistent property\n" + "\n" + "@Basic(fetch = FetchType.LAZY)\n" + "String getDetailedComment() { ... } // persistent property\n" + "\n" + "@Temporal(TemporalType.TIME)\n" + "java.util.Date getDepartureTime() { ... } // persistent property \n" + "\n" + "@Enumerated(EnumType.STRING)\n" + "Starred getNote() { ... } //enum persisted as String in database" msgstr "" #. Tag: para +#: basic_mapping.xml:1719 #, no-c-format -msgid "formula (optional): an SQL expression that defines the value for a computed property. Computed properties do not have a column mapping of their own." +msgid "counter, a transient field, and lengthInMeter, a method annotated as @Transient, and will be ignored by the Hibernate. name, length, and firstname properties are mapped persistent and eagerly fetched (the default for simple properties). The detailedComment property value will be lazily fetched from the database once a lazy property of the entity is accessed for the first time. Usually you don't need to lazy simple properties (not to be confused with lazy association fetching). The recommended alternative is to use the projection capability of JP-QL (Java Persistence Query Language) or Criteria queries." msgstr "" #. Tag: para +#: basic_mapping.xml:1732 #, no-c-format -msgid "lazy (optional - defaults to false): specifies that this property should be fetched lazily when the instance variable is first accessed. It requires build-time bytecode instrumentation." +msgid "JPA support property mapping of all basic types supported by Hibernate (all basic Java types , their respective wrappers and serializable classes). Hibernate Annotations supports out of the box enum type mapping either into a ordinal column (saving the enum ordinal) or a string based column (saving the enum string representation): the persistence representation, defaulted to ordinal, can be overridden through the @Enumerated annotation as shown in the note property example." msgstr "" #. Tag: para +#: basic_mapping.xml:1742 #, no-c-format -msgid "unique (optional): enables the DDL generation of a unique constraint for the columns. Also, allow this to be the target of a property-ref." +msgid "In plain Java APIs, the temporal precision of time is not defined. When dealing with temporal data you might want to describe the expected precision in database. Temporal data can have DATE, TIME, or TIMESTAMP precision (ie the actual date, only the time, or both). Use the @Temporal annotation to fine tune that." msgstr "" #. Tag: para +#: basic_mapping.xml:1750 #, no-c-format -msgid "not-null (optional): enables the DDL generation of a nullability constraint for the columns." +msgid "@Lob indicates that the property should be persisted in a Blob or a Clob depending on the property type: java.sql.Clob, Character[], char[] and java.lang.String will be persisted in a Clob. java.sql.Blob, Byte[], byte[] and Serializable type will be persisted in a Blob." +msgstr "" + +#. Tag: programlisting +#: basic_mapping.xml:1759 +#, no-c-format +msgid "" + "@Lob\n" + "public String getFullText() {\n" + " return fullText;\n" + "}\n" + "\n" + "@Lob\n" + "public byte[] getFullCode() {\n" + " return fullCode;\n" + "}" msgstr "" #. Tag: para +#: basic_mapping.xml:1761 #, no-c-format -msgid "optimistic-lock (optional - defaults to true): specifies that updates to this property do or do not require acquisition of the optimistic lock. In other words, it determines if a version increment should occur when this property is dirty." +msgid "If the property type implements java.io.Serializable and is not a basic type, and if the property is not annotated with @Lob, then the Hibernate serializable type is used." +msgstr "" + +#. Tag: title +#: basic_mapping.xml:1768 +#, no-c-format +msgid "Type" msgstr "" #. Tag: para +#: basic_mapping.xml:1770 #, no-c-format -msgid "generated (optional - defaults to never): specifies that this property value is actually generated by the database. See the discussion of generated properties for more information." -msgstr "" - -#. Tag: para -#, no-c-format -msgid "typename could be:" +msgid "You can also manually specify a type using the @org.hibernate.annotations.Type and some parameters if needed. @Type.type could be:" msgstr "" #. Tag: para +#: basic_mapping.xml:1777 basic_mapping.xml:2209 #, no-c-format msgid "The name of a Hibernate basic type: integer, string, character, date, timestamp, float, binary, serializable, object, blob etc." msgstr "" #. Tag: para +#: basic_mapping.xml:1783 basic_mapping.xml:2215 #, no-c-format msgid "The name of a Java class with a default basic type: int, float, char, java.lang.String, java.util.Date, java.lang.Integer, java.sql.Clob etc." msgstr "" #. Tag: para +#: basic_mapping.xml:1789 basic_mapping.xml:2221 #, no-c-format msgid "The name of a serializable Java class." msgstr "" #. Tag: para +#: basic_mapping.xml:1793 basic_mapping.xml:2225 #, no-c-format msgid "The class name of a custom type: com.illflow.type.MyCustomType etc." msgstr "" #. Tag: para +#: basic_mapping.xml:1798 +#, no-c-format +msgid "If you do not specify a type, Hibernate will use reflection upon the named property and guess the correct Hibernate type. Hibernate will attempt to interpret the name of the return class of the property getter using, in order, rules 2, 3, and 4." +msgstr "" + +#. Tag: para +#: basic_mapping.xml:1803 +#, no-c-format +msgid "@org.hibernate.annotations.TypeDef and @org.hibernate.annotations.TypeDefs allows you to declare type definitions. These annotations can be placed at the class or package level. Note that these definitions are global for the session factory (even when defined at the class level). If the type is used on a single entity, you can place the definition on the entity itself. Otherwise, it is recommended to place the definition at the package level. In the example below, when Hibernate encounters a property of class PhoneNumer, it delegates the persistence strategy to the custom mapping type PhoneNumberType. However, properties belonging to other classes, too, can delegate their persistence strategy to PhoneNumberType, by explicitly using the @Type annotation." +msgstr "" + +#. Tag: para +#: basic_mapping.xml:1819 +#, no-c-format +msgid "Package level annotations are placed in a file named package-info.java in the appropriate package. Place your annotations before the package declaration." +msgstr "" + +#. Tag: programlisting +#: basic_mapping.xml:1824 +#, no-c-format +msgid "" + "@TypeDef(\n" + " name = \"phoneNumber\",\n" + " defaultForType = PhoneNumber.class,\n" + " typeClass = PhoneNumberType.class\n" + ")\n" + "\n" + "@Entity\n" + "public class ContactDetails {\n" + " [...]\n" + " private PhoneNumber localPhoneNumber;\n" + " @Type(type=\"phoneNumber\")\n" + " private OverseasPhoneNumber overseasPhoneNumber;\n" + " [...]\n" + "}" +msgstr "" + +#. Tag: para +#: basic_mapping.xml:1826 +#, no-c-format +msgid "The following example shows the usage of the parameters attribute to customize the TypeDef." +msgstr "" + +#. Tag: programlisting +#: basic_mapping.xml:1830 +#, no-c-format +msgid "" + "//in org/hibernate/test/annotations/entity/package-info.java\n" + "@TypeDefs(\n" + " {\n" + " @TypeDef(\n" + " name=\"caster\",\n" + " typeClass = CasterStringType.class,\n" + " parameters = {\n" + " @Parameter(name=\"cast\", value=\"lower\")\n" + " }\n" + " )\n" + " }\n" + ")\n" + "package org.hibernate.test.annotations.entity;\n" + "\n" + "//in org/hibernate/test/annotations/entity/Forest.java\n" + "public class Forest {\n" + " @Type(type=\"caster\")\n" + " public String getSmallText() {\n" + " ...\n" + "}" +msgstr "" + +#. Tag: para +#: basic_mapping.xml:1832 +#, no-c-format +msgid "When using composite user type, you will have to express column definitions. The @Columns has been introduced for that purpose." +msgstr "" + +#. Tag: programlisting +#: basic_mapping.xml:1836 +#, no-c-format +msgid "" + "@Type(type=\"org.hibernate.test.annotations.entity.MonetaryAmountUserType\")\n" + "@Columns(columns = {\n" + " @Column(name=\"r_amount\"),\n" + " @Column(name=\"r_currency\")\n" + "})\n" + "public MonetaryAmount getAmount() {\n" + " return amount;\n" + "}\n" + "\n" + "\n" + "public class MonetaryAmount implements Serializable {\n" + " private BigDecimal amount;\n" + " private Currency currency;\n" + " ...\n" + "}" +msgstr "" + +#. Tag: title +#: basic_mapping.xml:1840 +#, no-c-format +msgid "Access type" +msgstr "" + +#. Tag: para +#: basic_mapping.xml:1842 +#, no-c-format +msgid "By default the access type of a class hierarchy is defined by the position of the @Id or @EmbeddedId annotations. If these annotations are on a field, then only fields are considered for persistence and the state is accessed via the field. If there annotations are on a getter, then only the getters are considered for persistence and the state is accessed via the getter/setter. That works well in practice and is the recommended approach." +msgstr "" + +#. Tag: para +#: basic_mapping.xml:1850 +#, no-c-format +msgid "The placement of annotations within a class hierarchy has to be consistent (either field or on property) to be able to determine the default access type. It is recommended to stick to one single annotation placement strategy throughout your whole application." +msgstr "" + +#. Tag: para +#: basic_mapping.xml:1857 +#, no-c-format +msgid "However in some situations, you need to:" +msgstr "" + +#. Tag: para +#: basic_mapping.xml:1861 +#, no-c-format +msgid "force the access type of the entity hierarchy" +msgstr "" + +#. Tag: para +#: basic_mapping.xml:1865 +#, no-c-format +msgid "override the access type of a specific entity in the class hierarchy" +msgstr "" + +#. Tag: para +#: basic_mapping.xml:1870 +#, no-c-format +msgid "override the access type of an embeddable type" +msgstr "" + +#. Tag: para +#: basic_mapping.xml:1874 +#, no-c-format +msgid "The best use case is an embeddable class used by several entities that might not use the same access type. In this case it is better to force the access type at the embeddable class level." +msgstr "" + +#. Tag: para +#: basic_mapping.xml:1879 +#, no-c-format +msgid "To force the access type on a given class, use the @Access annotation as showed below:" +msgstr "" + +#. Tag: programlisting +#: basic_mapping.xml:1882 +#, no-c-format +msgid "" + "@Entity\n" + "public class Order {\n" + " @Id private Long id;\n" + " public Long getId() { return id; }\n" + " public void setId(Long id) { this.id = id; }\n" + "\n" + " @Embedded private Address address;\n" + " public Address getAddress() { return address; }\n" + " public void setAddress() { this.address = address; }\n" + "}\n" + "\n" + "@Entity\n" + "public class User {\n" + " private Long id;\n" + " @Id public Long getId() { return id; }\n" + " public void setId(Long id) { this.id = id; }\n" + "\n" + " private Address address;\n" + " @Embedded public Address getAddress() { return address; }\n" + " public void setAddress() { this.address = address; }\n" + "}\n" + "\n" + "@Embeddable\n" + "@Access(AcessType.PROPERTY)\n" + "public class Address {\n" + " private String street1;\n" + " public String getStreet1() { return street1; }\n" + " public void setStreet1() { this.street1 = street1; }\n" + "\n" + " private hashCode; //not persistent\n" + "}" +msgstr "" + +#. Tag: para +#: basic_mapping.xml:1884 +#, no-c-format +msgid "You can also override the access type of a single property while keeping the other properties standard." +msgstr "" + +#. Tag: programlisting +#: basic_mapping.xml:1887 +#, no-c-format +msgid "" + "@Entity\n" + "public class Order {\n" + " @Id private Long id;\n" + " public Long getId() { return id; }\n" + " public void setId(Long id) { this.id = id; }\n" + " @Transient private String userId;\n" + " @Transient private String orderId;\n" + "\n" + " @Access(AccessType.PROPERTY)\n" + " public String getOrderNumber() { return userId + \":\" + orderId; }\n" + " public void setOrderNumber() { this.userId = ...; this.orderId = ...; }\n" + "}" +msgstr "" + +#. Tag: para +#: basic_mapping.xml:1889 +#, no-c-format +msgid "In this example, the default access type is FIELD except for the orderNumber property. Note that the corresponding field, if any must be marked as @Transient or transient." +msgstr "" + +#. Tag: title +#: basic_mapping.xml:1896 +#, no-c-format +msgid "@org.hibernate.annotations.AccessType" +msgstr "" + +#. Tag: para +#: basic_mapping.xml:1898 +#, no-c-format +msgid "The annotation @org.hibernate.annotations.AccessType should be considered deprecated for FIELD and PROPERTY access. It is still useful however if you need to use a custom access type." +msgstr "" + +#. Tag: title +#: basic_mapping.xml:1907 +#, no-c-format +msgid "Optimistic lock" +msgstr "" + +#. Tag: para +#: basic_mapping.xml:1909 +#, no-c-format +msgid "It is sometimes useful to avoid increasing the version number even if a given property is dirty (particularly collections). You can do that by annotating the property (or collection) with @OptimisticLock(excluded=true)." +msgstr "" + +#. Tag: para +#: basic_mapping.xml:1914 +#, no-c-format +msgid "More formally, specifies that updates to this property do not require acquisition of the optimistic lock." +msgstr "" + +#. Tag: title +#: basic_mapping.xml:1919 +#, no-c-format +msgid "Declaring column attributes" +msgstr "" + +#. Tag: para +#: basic_mapping.xml:1921 +#, no-c-format +msgid "The column(s) used for a property mapping can be defined using the @Column annotation. Use it to override default values (see the JPA specification for more information on the defaults). You can use this annotation at the property level for properties that are:" +msgstr "" + +#. Tag: para +#: basic_mapping.xml:1929 +#, no-c-format +msgid "not annotated at all" +msgstr "" + +#. Tag: para +#: basic_mapping.xml:1933 +#, no-c-format +msgid "annotated with @Basic" +msgstr "" + +#. Tag: para +#: basic_mapping.xml:1937 +#, no-c-format +msgid "annotated with @Version" +msgstr "" + +#. Tag: para +#: basic_mapping.xml:1941 +#, no-c-format +msgid "annotated with @Lob" +msgstr "" + +#. Tag: para +#: basic_mapping.xml:1945 +#, no-c-format +msgid "annotated with @Temporal" +msgstr "" + +#. Tag: programlisting +#: basic_mapping.xml:1949 +#, no-c-format +msgid "" + "@Entity\n" + "public class Flight implements Serializable {\n" + "...\n" + "@Column(updatable = false, name = \"flight_name\", nullable = false, length=50)\n" + "public String getName() { ... }" +msgstr "" + +#. Tag: para +#: basic_mapping.xml:1951 +#, no-c-format +msgid "The name property is mapped to the flight_name column, which is not nullable, has a length of 50 and is not updatable (making the property immutable)." +msgstr "" + +#. Tag: para +#: basic_mapping.xml:1956 +#, no-c-format +msgid "This annotation can be applied to regular properties as well as @Id or @Version properties." +msgstr "" + +#. Tag: programlisting +#: basic_mapping.xml:1983 +#, no-c-format +msgid "" + "@Column(\n" + " name=\"columnName\";\n" + " boolean unique() default false;\n" + " boolean nullable() default true;\n" + " boolean insertable() default true;\n" + " boolean updatable() default true;\n" + " String columnDefinition() default \"\";\n" + " String table() default \"\";\n" + " int length() default 255;\n" + " int precision() default 0; // decimal precision\n" + " int scale() default 0; // decimal scale" +msgstr "" + +#. Tag: para +#: basic_mapping.xml:1987 +#, no-c-format +msgid "name (optional): the column name (default to the property name)" +msgstr "" + +#. Tag: para +#: basic_mapping.xml:1992 +#, no-c-format +msgid "unique (optional): set a unique constraint on this column or not (default false)" +msgstr "" + +#. Tag: para +#: basic_mapping.xml:1997 +#, no-c-format +msgid "nullable (optional): set the column as nullable (default true)." +msgstr "" + +#. Tag: para +#: basic_mapping.xml:2002 +#, no-c-format +msgid "insertable (optional): whether or not the column will be part of the insert statement (default true)" +msgstr "" + +#. Tag: para +#: basic_mapping.xml:2008 +#, no-c-format +msgid "updatable (optional): whether or not the column will be part of the update statement (default true)" +msgstr "" + +#. Tag: para +#: basic_mapping.xml:2014 +#, no-c-format +msgid "columnDefinition (optional): override the sql DDL fragment for this particular column (non portable)" +msgstr "" + +#. Tag: para +#: basic_mapping.xml:2020 +#, no-c-format +msgid "table (optional): define the targeted table (default primary table)" +msgstr "" + +#. Tag: para +#: basic_mapping.xml:2025 +#, no-c-format +msgid "length (optional): column length (default 255)" +msgstr "" + +#. Tag: para +#: basic_mapping.xml:2030 +#, no-c-format +msgid "precision (optional): column decimal precision (default 0)" +msgstr "" + +#. Tag: para +#: basic_mapping.xml:2035 +#, no-c-format +msgid "scale (optional): column decimal scale if useful (default 0)" +msgstr "" + +#. Tag: title +#: basic_mapping.xml:2043 +#, no-c-format +msgid "Formula" +msgstr "" + +#. Tag: para +#: basic_mapping.xml:2045 +#, no-c-format +msgid "Sometimes, you want the Database to do some computation for you rather than in the JVM, you might also create some kind of virtual column. You can use a SQL fragment (aka formula) instead of mapping a property into a column. This kind of property is read only (its value is calculated by your formula fragment)." +msgstr "" + +#. Tag: programlisting +#: basic_mapping.xml:2051 +#, no-c-format +msgid "" + "@Formula(\"obj_length * obj_height * obj_width\")\n" + "public long getObjectVolume()" +msgstr "" + +#. Tag: para +#: basic_mapping.xml:2053 +#, no-c-format +msgid "The SQL fragment can be as complex as you want and even include subselects." +msgstr "" + +#. Tag: title +#: basic_mapping.xml:2058 +#, no-c-format +msgid "Non-annotated property defaults" +msgstr "" + +#. Tag: para +#: basic_mapping.xml:2060 +#, no-c-format +msgid "If a property is not annotated, the following rules apply:" +msgstr "" + +#. Tag: para +#: basic_mapping.xml:2063 +#, no-c-format +msgid "If the property is of a single type, it is mapped as @Basic" +msgstr "" + +#. Tag: para +#: basic_mapping.xml:2068 +#, no-c-format +msgid "Otherwise, if the type of the property is annotated as @Embeddable, it is mapped as @Embedded" +msgstr "" + +#. Tag: para +#: basic_mapping.xml:2073 +#, no-c-format +msgid "Otherwise, if the type of the property is Serializable, it is mapped as @Basic in a column holding the object in its serialized version" +msgstr "" + +#. Tag: para +#: basic_mapping.xml:2080 +#, no-c-format +msgid "Otherwise, if the type of the property is java.sql.Clob or java.sql.Blob, it is mapped as @Lob with the appropriate LobType" +msgstr "" + +#. Tag: title +#: basic_mapping.xml:2091 +#, no-c-format +msgid "Property mapping with hbm.xml" +msgstr "" + +#. Tag: para +#: basic_mapping.xml:2093 +#, no-c-format +msgid "The <property> element declares a persistent JavaBean style property of the class." +msgstr "" + +#. Tag: programlisting +#: basic_mapping.xml:2125 +#, no-c-format +msgid "" + "<property\n" + " name=\"propertyName\"\n" + " column=\"column_name\"\n" + " type=\"typename\"\n" + " update=\"true|false\"\n" + " insert=\"true|false\"\n" + " formula=\"arbitrary SQL expression\"\n" + " access=\"field|property|ClassName\"\n" + " lazy=\"true|false\"\n" + " unique=\"true|false\"\n" + " not-null=\"true|false\"\n" + " optimistic-lock=\"true|false\"\n" + " generated=\"never|insert|always\"\n" + " node=\"element-name|@attribute-name|element/@attribute|.\"\n" + " index=\"index_name\"\n" + " unique_key=\"unique_key_id\"\n" + " length=\"L\"\n" + " precision=\"P\"\n" + " scale=\"S\"\n" + "/>" +msgstr "" + +#. Tag: para +#: basic_mapping.xml:2129 +#, no-c-format +msgid "name: the name of the property, with an initial lowercase letter." +msgstr "" + +#. Tag: para +#: basic_mapping.xml:2134 +#, no-c-format +msgid "column (optional - defaults to the property name): the name of the mapped database table column. This can also be specified by nested <column> element(s)." +msgstr "" + +#. Tag: para +#: basic_mapping.xml:2146 +#, no-c-format +msgid "update, insert (optional - defaults to true): specifies that the mapped columns should be included in SQL UPDATE and/or INSERT statements. Setting both to false allows a pure \"derived\" property whose value is initialized from some other property that maps to the same column(s), or by a trigger or other application." +msgstr "" + +#. Tag: para +#: basic_mapping.xml:2156 +#, no-c-format +msgid "formula (optional): an SQL expression that defines the value for a computed property. Computed properties do not have a column mapping of their own." +msgstr "" + +#. Tag: para +#: basic_mapping.xml:2169 +#, no-c-format +msgid "lazy (optional - defaults to false): specifies that this property should be fetched lazily when the instance variable is first accessed. It requires build-time bytecode instrumentation." +msgstr "" + +#. Tag: para +#: basic_mapping.xml:2176 +#, no-c-format +msgid "unique (optional): enables the DDL generation of a unique constraint for the columns. Also, allow this to be the target of a property-ref." +msgstr "" + +#. Tag: para +#: basic_mapping.xml:2183 +#, no-c-format +msgid "not-null (optional): enables the DDL generation of a nullability constraint for the columns." +msgstr "" + +#. Tag: para +#: basic_mapping.xml:2188 basic_mapping.xml:3246 +#, no-c-format +msgid "optimistic-lock (optional - defaults to true): specifies that updates to this property do or do not require acquisition of the optimistic lock. In other words, it determines if a version increment should occur when this property is dirty." +msgstr "" + +#. Tag: para +#: basic_mapping.xml:2196 +#, no-c-format +msgid "generated (optional - defaults to never): specifies that this property value is actually generated by the database. See the discussion of generated properties for more information." +msgstr "" + +#. Tag: para +#: basic_mapping.xml:2205 +#, no-c-format +msgid "typename could be:" +msgstr "" + +#. Tag: para +#: basic_mapping.xml:2230 #, no-c-format msgid "If you do not specify a type, Hibernate will use reflection upon the named property and guess the correct Hibernate type. Hibernate will attempt to interpret the name of the return class of the property getter using, in order, rules 2, 3, and 4. In certain cases you will need the type attribute. For example, to distinguish between Hibernate.DATE and Hibernate.TIMESTAMP, or to specify a custom type." msgstr "" #. Tag: para +#: basic_mapping.xml:2239 #, no-c-format msgid "The access attribute allows you to control how Hibernate accesses the property at runtime. By default, Hibernate will call the property get/set pair. If you specify access=\"field\", Hibernate will bypass the get/set pair and access the field directly using reflection. You can specify your own strategy for property access by naming a class that implements the interface org.hibernate.property.PropertyAccessor." msgstr "" #. Tag: para +#: basic_mapping.xml:2248 #, no-c-format msgid "A powerful feature is derived properties. These properties are by definition read-only. The property value is computed at load time. You declare the computation as an SQL expression. This then translates to a SELECT clause subquery in the SQL query that loads an instance:" msgstr "" +#. Tag: programlisting +#: basic_mapping.xml:2254 +#, no-c-format +msgid "" + "<property name=\"totalPrice\"\n" + " formula=\"( SELECT SUM (li.quantity*p.price) FROM LineItem li, Product p\n" + " WHERE li.productId = p.productId\n" + " AND li.customerId = customerId\n" + " AND li.orderNumber = orderNumber )\"/>" +msgstr "" + #. Tag: para +#: basic_mapping.xml:2256 #, no-c-format msgid "You can reference the entity table by not declaring an alias on a particular column. This would be customerId in the given example. You can also use the nested <formula> mapping element if you do not want to use the attribute." msgstr "" #. Tag: title +#: basic_mapping.xml:2265 #, no-c-format -msgid "Many-to-one" +msgid "Embedded objects (aka components)" msgstr "" #. Tag: para +#: basic_mapping.xml:2267 #, no-c-format -msgid "An ordinary association to another persistent class is declared using a many-to-one element. The relational model is a many-to-one association; a foreign key in one table is referencing the primary key column(s) of the target table." +msgid "Embeddable objects (or components) are objects whose properties are mapped to the same table as the owning entity's table. Components can, in turn, declare their own properties, components or collections" msgstr "" #. Tag: para +#: basic_mapping.xml:2272 +#, no-c-format +msgid "It is possible to declare an embedded component inside an entity and even override its column mapping. Component classes have to be annotated at the class level with the @Embeddable annotation. It is possible to override the column mapping of an embedded object for a particular entity using the @Embedded and @AttributeOverride annotation in the associated property:" +msgstr "" + +#. Tag: programlisting +#: basic_mapping.xml:2280 +#, no-c-format +msgid "" + "@Entity\n" + "public class Person implements Serializable {\n" + "\n" + " // Persistent component using defaults\n" + " Address homeAddress;\n" + "\n" + " @Embedded\n" + " @AttributeOverrides( {\n" + " @AttributeOverride(name=\"iso2\", column = @Column(name=\"bornIso2\") ),\n" + " @AttributeOverride(name=\"name\", column = @Column(name=\"bornCountryName\") )\n" + " } )\n" + " Country bornIn;\n" + " ...\n" + "}" +msgstr "" + +#. Tag: programlisting +#: basic_mapping.xml:2282 +#, no-c-format +msgid "" + "@Embeddable\n" + "public class Address implements Serializable {\n" + " String city;\n" + " Country nationality; //no overriding here\n" + "}" +msgstr "" + +#. Tag: programlisting +#: basic_mapping.xml:2284 +#, no-c-format +msgid "" + "@Embeddable\n" + "public class Country implements Serializable {\n" + " private String iso2;\n" + " @Column(name=\"countryName\") private String name;\n" + "\n" + " public String getIso2() { return iso2; }\n" + " public void setIso2(String iso2) { this.iso2 = iso2; }\n" + "\n" + " \n" + " public String getName() { return name; }\n" + " public void setName(String name) { this.name = name; }\n" + " ...\n" + "}" +msgstr "" + +#. Tag: para +#: basic_mapping.xml:2286 +#, no-c-format +msgid "An embeddable object inherits the access type of its owning entity (note that you can override that using the @Access annotation)." +msgstr "" + +#. Tag: para +#: basic_mapping.xml:2290 +#, no-c-format +msgid "The Person entity has two component properties, homeAddress and bornIn. homeAddress property has not been annotated, but Hibernate will guess that it is a persistent component by looking for the @Embeddable annotation in the Address class. We also override the mapping of a column name (to bornCountryName) with the @Embedded and @AttributeOverride annotations for each mapped attribute of Country. As you can see, Country is also a nested component of Address, again using auto-detection by Hibernate and JPA defaults. Overriding columns of embedded objects of embedded objects is through dotted expressions." +msgstr "" + +#. Tag: programlisting +#: basic_mapping.xml:2305 +#, no-c-format +msgid "" + "@Embedded\n" + " @AttributeOverrides( {\n" + " @AttributeOverride(name=\"city\", column = @Column(name=\"fld_city\") ),\n" + " @AttributeOverride(name=\"nationality.iso2\", column = @Column(name=\"nat_Iso2\") ),\n" + " @AttributeOverride(name=\"nationality.name\", column = @Column(name=\"nat_CountryName\") )\n" + " //nationality columns in homeAddress are overridden\n" + " } )\n" + " Address homeAddress;" +msgstr "" + +#. Tag: para +#: basic_mapping.xml:2307 +#, no-c-format +msgid "Hibernate Annotations supports something that is not explicitly supported by the JPA specification. You can annotate a embedded object with the @MappedSuperclass annotation to make the superclass properties persistent (see @MappedSuperclass for more informations)." +msgstr "" + +#. Tag: para +#: basic_mapping.xml:2313 +#, no-c-format +msgid "You can also use association annotations in an embeddable object (ie @OneToOne, @ManyToOne, @OneToMany or @ManyToMany). To override the association columns you can use @AssociationOverride." +msgstr "" + +#. Tag: para +#: basic_mapping.xml:2319 +#, no-c-format +msgid "If you want to have the same embeddable object type twice in the same entity, the column name defaulting will not work as several embedded objects would share the same set of columns. In plain JPA, you need to override at least one set of columns. Hibernate, however, allows you to enhance the default naming mechanism through the NamingStrategy interface. You can write a strategy that prevent name clashing in such a situation. DefaultComponentSafeNamingStrategy is an example of this." +msgstr "" + +#. Tag: para +#: basic_mapping.xml:2329 +#, no-c-format +msgid "If a property of the embedded object points back to the owning entity, annotate it with the @Parent annotation. Hibernate will make sure this property is properly loaded with the entity reference." +msgstr "" + +#. Tag: para +#: basic_mapping.xml:2334 +#, no-c-format +msgid "In XML, use the <component> element." +msgstr "" + +#. Tag: programlisting +#: basic_mapping.xml:2356 +#, no-c-format +msgid "" + "<component\n" + " name=\"propertyName\"\n" + " class=\"className\"\n" + " insert=\"true|false\"\n" + " update=\"true|false\"\n" + " access=\"field|property|ClassName\"\n" + " lazy=\"true|false\"\n" + " optimistic-lock=\"true|false\"\n" + " unique=\"true|false\"\n" + " node=\"element-name|.\"\n" + ">\n" + "\n" + " <property ...../>\n" + " <many-to-one .... />\n" + " ........\n" + "</component>" +msgstr "" + +#. Tag: para +#: basic_mapping.xml:2360 basic_mapping.xml:3181 basic_mapping.xml:3381 #, no-c-format msgid "name: the name of the property." msgstr "" #. Tag: para -#, no-c-format -msgid "column (optional): the name of the foreign key column. This can also be specified by nested <column> element(s)." -msgstr "" - -#. Tag: para -#, no-c-format -msgid "class (optional - defaults to the property type determined by reflection): the name of the associated class." -msgstr "" - -#. Tag: para -#, no-c-format -msgid "cascade (optional): specifies which operations should be cascaded from the parent object to the associated object." -msgstr "" - -#. Tag: para -#, no-c-format -msgid "fetch (optional - defaults to select): chooses between outer-join fetching or sequential select fetching." -msgstr "" - -#. Tag: para -#, no-c-format -msgid "update, insert (optional - defaults to true): specifies that the mapped columns should be included in SQL UPDATE and/or INSERT statements. Setting both to false allows a pure \"derived\" association whose value is initialized from another property that maps to the same column(s), or by a trigger or other application." -msgstr "" - -#. Tag: para -#, no-c-format -msgid "property-ref (optional): the name of a property of the associated class that is joined to this foreign key. If not specified, the primary key of the associated class is used." -msgstr "" - -#. Tag: para -#, no-c-format -msgid "unique (optional): enables the DDL generation of a unique constraint for the foreign-key column. By allowing this to be the target of a property-ref, you can make the association multiplicity one-to-one." -msgstr "" - -#. Tag: para -#, no-c-format -msgid "not-null (optional): enables the DDL generation of a nullability constraint for the foreign key columns." -msgstr "" - -#. Tag: para -#, no-c-format -msgid "lazy (optional - defaults to proxy): by default, single point associations are proxied. lazy=\"no-proxy\" specifies that the property should be fetched lazily when the instance variable is first accessed. This requires build-time bytecode instrumentation. lazy=\"false\" specifies that the association will always be eagerly fetched." -msgstr "" - -#. Tag: para -#, no-c-format -msgid "not-found (optional - defaults to exception): specifies how foreign keys that reference missing rows will be handled. ignore will treat a missing row as a null association." -msgstr "" - -#. Tag: para -#, no-c-format -msgid "entity-name (optional): the entity name of the associated class." -msgstr "" - -#. Tag: para -#, no-c-format -msgid "formula (optional): an SQL expression that defines the value for a computed foreign key." -msgstr "" - -#. Tag: para -#, no-c-format -msgid "Setting a value of the cascade attribute to any meaningful value other than none will propagate certain operations to the associated object. The meaningful values are divided into three categories. First, basic operations, which include: persist, merge, delete, save-update, evict, replicate, lock and refresh; second, special values: delete-orphan; and third,all comma-separated combinations of operation names: cascade=\"persist,merge,evict\" or cascade=\"all,delete-orphan\". See for a full explanation. Note that single valued, many-to-one and one-to-one, associations do not support orphan delete." -msgstr "" - -#. Tag: para -#, no-c-format -msgid "Here is an example of a typical many-to-one declaration:" -msgstr "" - -#. Tag: para -#, no-c-format -msgid "The property-ref attribute should only be used for mapping legacy data where a foreign key refers to a unique key of the associated table other than the primary key. This is a complicated and confusing relational model. For example, if the Product class had a unique serial number that is not the primary key. The unique attribute controls Hibernate's DDL generation with the SchemaExport tool." -msgstr "" - -#. Tag: para -#, no-c-format -msgid "Then the mapping for OrderItem might use:" -msgstr "" - -#. Tag: para -#, no-c-format -msgid "This is not encouraged, however." -msgstr "" - -#. Tag: para -#, no-c-format -msgid "If the referenced unique key comprises multiple properties of the associated entity, you should map the referenced properties inside a named <properties> element." -msgstr "" - -#. Tag: para -#, no-c-format -msgid "If the referenced unique key is the property of a component, you can specify a property path:" -msgstr "" - -#. Tag: title -#, no-c-format -msgid "One-to-one" -msgstr "" - -#. Tag: para -#, no-c-format -msgid "A one-to-one association to another persistent class is declared using a one-to-one element." -msgstr "" - -#. Tag: para -#, no-c-format -msgid "constrained (optional): specifies that a foreign key constraint on the primary key of the mapped table and references the table of the associated class. This option affects the order in which save() and delete() are cascaded, and determines whether the association can be proxied. It is also used by the schema export tool." -msgstr "" - -#. Tag: para -#, no-c-format -msgid "property-ref (optional): the name of a property of the associated class that is joined to the primary key of this class. If not specified, the primary key of the associated class is used." -msgstr "" - -#. Tag: para -#, no-c-format -msgid "formula (optional): almost all one-to-one associations map to the primary key of the owning entity. If this is not the case, you can specify another column, columns or expression to join on using an SQL formula. See org.hibernate.test.onetooneformula for an example." -msgstr "" - -#. Tag: para -#, no-c-format -msgid "lazy (optional - defaults to proxy): by default, single point associations are proxied. lazy=\"no-proxy\" specifies that the property should be fetched lazily when the instance variable is first accessed. It requires build-time bytecode instrumentation. lazy=\"false\" specifies that the association will always be eagerly fetched. Note that if constrained=\"false\", proxying is impossible and Hibernate will eagerly fetch the association." -msgstr "" - -#. Tag: para -#, no-c-format -msgid "There are two varieties of one-to-one associations:" -msgstr "" - -#. Tag: para -#, no-c-format -msgid "primary key associations" -msgstr "" - -#. Tag: para -#, no-c-format -msgid "unique foreign key associations" -msgstr "" - -#. Tag: para -#, no-c-format -msgid "Primary key associations do not need an extra table column. If two rows are related by the association, then the two table rows share the same primary key value. To relate two objects by a primary key association, ensure that they are assigned the same identifier value." -msgstr "" - -#. Tag: para -#, no-c-format -msgid "For a primary key association, add the following mappings to Employee and Person respectively:" -msgstr "" - -#. Tag: para -#, no-c-format -msgid "Ensure that the primary keys of the related rows in the PERSON and EMPLOYEE tables are equal. You use a special Hibernate identifier generation strategy called foreign:" -msgstr "" - -#. Tag: para -#, no-c-format -msgid "A newly saved instance of Person is assigned the same primary key value as the Employee instance referred with the employee property of that Person." -msgstr "" - -#. Tag: para -#, no-c-format -msgid "Alternatively, a foreign key with a unique constraint, from Employee to Person, can be expressed as:" -msgstr "" - -#. Tag: para -#, no-c-format -msgid "This association can be made bidirectional by adding the following to the Person mapping:" -msgstr "" - -#. Tag: title -#, no-c-format -msgid "Natural-id" -msgstr "" - -#. Tag: para -#, no-c-format -msgid "Although we recommend the use of surrogate keys as primary keys, you should try to identify natural keys for all entities. A natural key is a property or combination of properties that is unique and non-null. It is also immutable. Map the properties of the natural key inside the <natural-id> element. Hibernate will generate the necessary unique key and nullability constraints and, as a result, your mapping will be more self-documenting." -msgstr "" - -#. Tag: para -#, no-c-format -msgid "It is recommended that you implement equals() and hashCode() to compare the natural key properties of the entity." -msgstr "" - -#. Tag: para -#, no-c-format -msgid "This mapping is not intended for use with entities that have natural primary keys." -msgstr "" - -#. Tag: para -#, no-c-format -msgid "mutable (optional - defaults to false): by default, natural identifier properties are assumed to be immutable (constant)." -msgstr "" - -#. Tag: title -#, no-c-format -msgid "Component and dynamic-component" -msgstr "" - -#. Tag: para -#, no-c-format -msgid "The <component> element maps properties of a child object to columns of the table of a parent class. Components can, in turn, declare their own properties, components or collections. See the \"Component\" examples below:" -msgstr "" - -#. Tag: para +#: basic_mapping.xml:2364 #, no-c-format msgid "class (optional - defaults to the property type determined by reflection): the name of the component (child) class." msgstr "" #. Tag: para +#: basic_mapping.xml:2370 basic_mapping.xml:3641 #, no-c-format msgid "insert: do the mapped columns appear in SQL INSERTs?" msgstr "" #. Tag: para +#: basic_mapping.xml:2375 basic_mapping.xml:3646 #, no-c-format msgid "update: do the mapped columns appear in SQL UPDATEs?" msgstr "" #. Tag: para +#: basic_mapping.xml:2386 #, no-c-format msgid "lazy (optional - defaults to false): specifies that this component should be fetched lazily when the instance variable is first accessed. It requires build-time bytecode instrumentation." msgstr "" #. Tag: para +#: basic_mapping.xml:2393 #, no-c-format msgid "optimistic-lock (optional - defaults to true): specifies that updates to this component either do or do not require acquisition of the optimistic lock. It determines if a version increment should occur when this property is dirty." msgstr "" #. Tag: para +#: basic_mapping.xml:2401 basic_mapping.xml:3659 #, no-c-format msgid "unique (optional - defaults to false): specifies that a unique constraint exists upon all mapped columns of the component." msgstr "" #. Tag: para +#: basic_mapping.xml:2408 #, no-c-format msgid "The child <property> tags map properties of the child class to table columns." msgstr "" #. Tag: para +#: basic_mapping.xml:2411 #, no-c-format msgid "The <component> element allows a <parent> subelement that maps a property of the component class as a reference back to the containing entity." msgstr "" #. Tag: para +#: basic_mapping.xml:2415 #, no-c-format -msgid "The <dynamic-component> element allows a Map to be mapped as a component, where the property names refer to keys of the map. See for more information." +msgid "The <dynamic-component> element allows a Map to be mapped as a component, where the property names refer to keys of the map. See for more information. This feature is not supported in annotations." msgstr "" #. Tag: title +#: basic_mapping.xml:2423 #, no-c-format -msgid "Properties" +msgid "Inheritance strategy" msgstr "" #. Tag: para +#: basic_mapping.xml:2425 #, no-c-format -msgid "The <properties> element allows the definition of a named, logical grouping of the properties of a class. The most important use of the construct is that it allows a combination of properties to be the target of a property-ref. It is also a convenient way to define a multi-column unique constraint. For example:" +msgid "Java is a language supporting polymorphism: a class can inherit from another. Several strategies are possible to persist a class hierarchy:" msgstr "" #. Tag: para +#: basic_mapping.xml:2431 #, no-c-format -msgid "name: the logical name of the grouping. It is not an actual property name." +msgid "Single table per class hierarchy strategy: a single table hosts all the instances of a class hierarchy" msgstr "" #. Tag: para +#: basic_mapping.xml:2436 #, no-c-format -msgid "optimistic-lock (optional - defaults to true): specifies that updates to these properties either do or do not require acquisition of the optimistic lock. It determines if a version increment should occur when these properties are dirty." +msgid "Joined subclass strategy: one table per class and subclass is present and each table persist the properties specific to a given subclass. The state of the entity is then stored in its corresponding class table and all its superclasses" msgstr "" #. Tag: para +#: basic_mapping.xml:2443 #, no-c-format -msgid "For example, if we have the following <properties> mapping:" -msgstr "" - -#. Tag: para -#, no-c-format -msgid "You might have some legacy data association that refers to this unique key of the Person table, instead of to the primary key:" -msgstr "" - -#. Tag: para -#, no-c-format -msgid "The use of this outside the context of mapping legacy data is not recommended." +msgid "Table per class strategy: one table per concrete class and subclass is present and each table persist the properties of the class and its superclasses. The state of the entity is then stored entirely in the dedicated table for its class." msgstr "" #. Tag: title +#: basic_mapping.xml:2451 #, no-c-format -msgid "Subclass" +msgid "Single table per class hierarchy strategy" msgstr "" #. Tag: para +#: basic_mapping.xml:2453 #, no-c-format -msgid "Polymorphic persistence requires the declaration of each subclass of the root persistent class. For the table-per-class-hierarchy mapping strategy, the <subclass> declaration is used. For example:" +msgid "With this approach the properties of all the subclasses in a given mapped class hierarchy are stored in a single table." msgstr "" #. Tag: para +#: basic_mapping.xml:2456 +#, no-c-format +msgid "Each subclass declares its own persistent properties and subclasses. Version and id properties are assumed to be inherited from the root class. Each subclass in a hierarchy must define a unique discriminator value. If this is not specified, the fully qualified Java class name is used." +msgstr "" + +#. Tag: programlisting +#: basic_mapping.xml:2462 basic_mapping.xml:2540 +#, no-c-format +msgid "" + "@Entity\n" + "@Inheritance(strategy=InheritanceType.SINGLE_TABLE)\n" + "@DiscriminatorColumn(\n" + " name=\"planetype\",\n" + " discriminatorType=DiscriminatorType.STRING\n" + ")\n" + "@DiscriminatorValue(\"Plane\")\n" + "public class Plane { ... }\n" + "\n" + "@Entity\n" + "@DiscriminatorValue(\"A320\")\n" + "public class A320 extends Plane { ... }" +msgstr "" + +#. Tag: para +#: basic_mapping.xml:2464 +#, no-c-format +msgid "In hbm.xml, for the table-per-class-hierarchy mapping strategy, the <subclass> declaration is used. For example:" +msgstr "" + +#. Tag: programlisting +#: basic_mapping.xml:2479 +#, no-c-format +msgid "" + "<subclass\n" + " name=\"ClassName\"\n" + " discriminator-value=\"discriminator_value\"\n" + " proxy=\"ProxyInterface\"\n" + " lazy=\"true|false\"\n" + " dynamic-update=\"true|false\"\n" + " dynamic-insert=\"true|false\"\n" + " entity-name=\"EntityName\"\n" + " node=\"element-name\"\n" + " extends=\"SuperclassName\">\n" + "\n" + " <property .... />\n" + " .....\n" + "</subclass>" +msgstr "" + +#. Tag: para +#: basic_mapping.xml:2483 basic_mapping.xml:2656 basic_mapping.xml:2720 #, no-c-format msgid "name: the fully qualified class name of the subclass." msgstr "" #. Tag: para +#: basic_mapping.xml:2488 #, no-c-format msgid "discriminator-value (optional - defaults to the class name): a value that distinguishes individual subclasses." msgstr "" #. Tag: para +#: basic_mapping.xml:2494 #, no-c-format msgid "proxy (optional): specifies a class or interface used for lazy initializing proxies." msgstr "" #. Tag: para +#: basic_mapping.xml:2499 #, no-c-format msgid "lazy (optional - defaults to true): setting lazy=\"false\" disables the use of lazy fetching." msgstr "" #. Tag: para +#: basic_mapping.xml:2507 basic_mapping.xml:2685 basic_mapping.xml:2746 #, no-c-format -msgid "Each subclass declares its own persistent properties and subclasses. <version> and <id> properties are assumed to be inherited from the root class. Each subclass in a hierarchy must define a unique discriminator-value. If this is not specified, the fully qualified Java class name is used." -msgstr "" - -#. Tag: para -#, no-c-format -msgid "For information about inheritance mappings see ." +msgid "For information about inheritance mappings see ." msgstr "" #. Tag: title +#: basic_mapping.xml:2511 #, no-c-format -msgid "Joined-subclass" +msgid "Discriminator" msgstr "" #. Tag: para +#: basic_mapping.xml:2513 #, no-c-format -msgid "Each subclass can also be mapped to its own table. This is called the table-per-subclass mapping strategy. An inherited state is retrieved by joining with the table of the superclass. To do this you use the <joined-subclass> element. For example:" +msgid "Discriminators are required for polymorphic persistence using the table-per-class-hierarchy mapping strategy. It declares a discriminator column of the table. The discriminator column contains marker values that tell the persistence layer what subclass to instantiate for a particular row. A restricted set of types can be used: string, character, integer, byte, short, boolean, yes_no, true_false." msgstr "" #. Tag: para +#: basic_mapping.xml:2523 +#, no-c-format +msgid "Use the @DiscriminatorColumn to define the discriminator column as well as the discriminator type. Alternatively, you can also use @DiscriminatorFormula to express in SQL what would be in a virtual discriminator column. This is particularly handy when the discriminator value can be extracted from one or more columns of the table. Both @DiscriminatorColumn and @DiscriminatorFormula are to be set on the root entity (once per persisted hierarchy)." +msgstr "" + +#. Tag: para +#: basic_mapping.xml:2534 +#, no-c-format +msgid "Finally, use @DiscriminatorValue on each class of the hierarchy to specify the value stored in the discriminator column for a given entity. If you do not set @DiscriminatorValue on a class, the fully qualified class name is used." +msgstr "" + +#. Tag: para +#: basic_mapping.xml:2542 +#, no-c-format +msgid "In hbm.xml, the <discriminator> element is used to define the discriminator column or formula:" +msgstr "" + +#. Tag: programlisting +#: basic_mapping.xml:2559 +#, no-c-format +msgid "" + "<discriminator\n" + " column=\"discriminator_column\"\n" + " type=\"discriminator_type\"\n" + " force=\"true|false\"\n" + " insert=\"true|false\"\n" + " formula=\"arbitrary sql expression\"\n" + "/>" +msgstr "" + +#. Tag: para +#: basic_mapping.xml:2563 +#, no-c-format +msgid "column (optional - defaults to class): the name of the discriminator column." +msgstr "" + +#. Tag: para +#: basic_mapping.xml:2569 +#, no-c-format +msgid "type (optional - defaults to string): a name that indicates the Hibernate type" +msgstr "" + +#. Tag: para +#: basic_mapping.xml:2575 +#, no-c-format +msgid "force (optional - defaults to false): \"forces\" Hibernate to specify the allowed discriminator values, even when retrieving all instances of the root class." +msgstr "" + +#. Tag: para +#: basic_mapping.xml:2582 +#, no-c-format +msgid "insert (optional - defaults to true): set this to false if your discriminator column is also part of a mapped composite identifier. It tells Hibernate not to include the column in SQL INSERTs." +msgstr "" + +#. Tag: para +#: basic_mapping.xml:2590 +#, no-c-format +msgid "formula (optional): an arbitrary SQL expression that is executed when a type has to be evaluated. It allows content-based discrimination." +msgstr "" + +#. Tag: para +#: basic_mapping.xml:2597 +#, no-c-format +msgid "Actual values of the discriminator column are specified by the discriminator-value attribute of the <class> and <subclass> elements." +msgstr "" + +#. Tag: para +#: basic_mapping.xml:2602 +#, no-c-format +msgid "The force attribute is only useful if the table contains rows with \"extra\" discriminator values that are not mapped to a persistent class. This will not usually be the case." +msgstr "" + +#. Tag: para +#: basic_mapping.xml:2607 +#, no-c-format +msgid "The formula attribute allows you to declare an arbitrary SQL expression that will be used to evaluate the type of a row. For example:" +msgstr "" + +#. Tag: programlisting +#: basic_mapping.xml:2611 +#, no-c-format +msgid "" + "<discriminator\n" + " formula=\"case when CLASS_TYPE in ('a', 'b', 'c') then 0 else 1 end\"\n" + " type=\"integer\"/>" +msgstr "" + +#. Tag: title +#: basic_mapping.xml:2616 +#, no-c-format +msgid "Joined subclass strategy" +msgstr "" + +#. Tag: para +#: basic_mapping.xml:2618 +#, no-c-format +msgid "Each subclass can also be mapped to its own table. This is called the table-per-subclass mapping strategy. An inherited state is retrieved by joining with the table of the superclass. A discriminator column is not required for this mapping strategy. Each subclass must, however, declare a table column holding the object identifier. The primary key of this table is also a foreign key to the superclass table and described by the @PrimaryKeyJoinColumns or the <key> element." +msgstr "" + +#. Tag: programlisting +#: basic_mapping.xml:2628 +#, no-c-format +msgid "" + "@Entity @Table(name=\"CATS\")\n" + "@Inheritance(strategy=InheritanceType.JOINED)\n" + "public class Cat implements Serializable { \n" + " @Id @GeneratedValue(generator=\"cat-uuid\") \n" + " @GenericGenerator(name=\"cat-uuid\", strategy=\"uuid\")\n" + " String getId() { return id; }\n" + "\n" + " ...\n" + "}\n" + "\n" + "@Entity @Table(name=\"DOMESTIC_CATS\")\n" + "@PrimaryKeyJoinColumn(name=\"CAT\")\n" + "public class DomesticCat extends Cat { \n" + " public String getName() { return name; }\n" + "}" +msgstr "" + +#. Tag: para +#: basic_mapping.xml:2631 +#, no-c-format +msgid "The table name still defaults to the non qualified class name. Also if @PrimaryKeyJoinColumn is not set, the primary key / foreign key columns are assumed to have the same names as the primary key columns of the primary table of the superclass." +msgstr "" + +#. Tag: para +#: basic_mapping.xml:2638 +#, no-c-format +msgid "In hbm.xml, use the <joined-subclass> element. For example:" +msgstr "" + +#. Tag: programlisting +#: basic_mapping.xml:2652 +#, no-c-format +msgid "" + "<joined-subclass\n" + " name=\"ClassName\"\n" + " table=\"tablename\"\n" + " proxy=\"ProxyInterface\"\n" + " lazy=\"true|false\"\n" + " dynamic-update=\"true|false\"\n" + " dynamic-insert=\"true|false\"\n" + " schema=\"schema\"\n" + " catalog=\"catalog\"\n" + " extends=\"SuperclassName\"\n" + " persister=\"ClassName\"\n" + " subselect=\"SQL expression\"\n" + " entity-name=\"EntityName\"\n" + " node=\"element-name\">\n" + "\n" + " <key .... >\n" + "\n" + " <property .... />\n" + " .....\n" + "</joined-subclass>" +msgstr "" + +#. Tag: para +#: basic_mapping.xml:2661 basic_mapping.xml:2725 #, no-c-format msgid "table: the name of the subclass table." msgstr "" #. Tag: para +#: basic_mapping.xml:2666 basic_mapping.xml:2730 #, no-c-format msgid "proxy (optional): specifies a class or interface to use for lazy initializing proxies." msgstr "" #. Tag: para +#: basic_mapping.xml:2671 basic_mapping.xml:2735 #, no-c-format msgid "lazy (optional, defaults to true): setting lazy=\"false\" disables the use of lazy fetching." msgstr "" #. Tag: para +#: basic_mapping.xml:2679 #, no-c-format -msgid "A discriminator column is not required for this mapping strategy. Each subclass must, however, declare a table column holding the object identifier using the <key> element. The mapping at the start of the chapter would then be re-written as:" +msgid "Use the <key> element to declare the primary key / foreign key column. The mapping at the start of the chapter would then be re-written as:" +msgstr "" + +#. Tag: programlisting +#: basic_mapping.xml:2683 +#, no-c-format +msgid "" + "<?xml version=\"1.0\"?>\n" + "<!DOCTYPE hibernate-mapping PUBLIC\n" + " \"-//Hibernate/Hibernate Mapping DTD//EN\"\n" + " \"http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd\">\n" + "\n" + "<hibernate-mapping package=\"eg\">\n" + "\n" + " <class name=\"Cat\" table=\"CATS\">\n" + " <id name=\"id\" column=\"uid\" type=\"long\">\n" + " <generator class=\"hilo\"/>\n" + " </id>\n" + " <property name=\"birthdate\" type=\"date\"/>\n" + " <property name=\"color\" not-null=\"true\"/>\n" + " <property name=\"sex\" not-null=\"true\"/>\n" + " <property name=\"weight\"/>\n" + " <many-to-one name=\"mate\"/>\n" + " <set name=\"kittens\">\n" + " <key column=\"MOTHER\"/>\n" + " <one-to-many class=\"Cat\"/>\n" + " </set>\n" + " <joined-subclass name=\"DomesticCat\" table=\"DOMESTIC_CATS\">\n" + " <key column=\"CAT\"/>\n" + " <property name=\"name\" type=\"string\"/>\n" + " </joined-subclass>\n" + " </class>\n" + "\n" + " <class name=\"eg.Dog\">\n" + " <!-- mapping for Dog could go here -->\n" + " </class>\n" + "\n" + "</hibernate-mapping>" msgstr "" #. Tag: title +#: basic_mapping.xml:2690 #, no-c-format -msgid "Union-subclass" +msgid "Table per class strategy" msgstr "" #. Tag: para +#: basic_mapping.xml:2692 #, no-c-format -msgid "A third option is to map only the concrete classes of an inheritance hierarchy to tables. This is called the table-per-concrete-class strategy. Each table defines all persistent states of the class, including the inherited state. In Hibernate, it is not necessary to explicitly map such inheritance hierarchies. You can map each class with a separate <class> declaration. However, if you wish use polymorphic associations (e.g. an association to the superclass of your hierarchy), you need to use the <union-subclass> mapping. For example:" +msgid "A third option is to map only the concrete classes of an inheritance hierarchy to tables. This is called the table-per-concrete-class strategy. Each table defines all persistent states of the class, including the inherited state. In Hibernate, it is not necessary to explicitly map such inheritance hierarchies. You can map each class as a separate entity root. However, if you wish use polymorphic associations (e.g. an association to the superclass of your hierarchy), you need to use the union subclass mapping." +msgstr "" + +#. Tag: programlisting +#: basic_mapping.xml:2701 +#, no-c-format +msgid "" + "@Entity\n" + "@Inheritance(strategy = InheritanceType.TABLE_PER_CLASS)\n" + "public class Flight implements Serializable { ... }" msgstr "" #. Tag: para +#: basic_mapping.xml:2703 +#, no-c-format +msgid "Or in hbm.xml:" +msgstr "" + +#. Tag: programlisting +#: basic_mapping.xml:2716 +#, no-c-format +msgid "" + "<union-subclass\n" + " name=\"ClassName\"\n" + " table=\"tablename\"\n" + " proxy=\"ProxyInterface\"\n" + " lazy=\"true|false\"\n" + " dynamic-update=\"true|false\"\n" + " dynamic-insert=\"true|false\"\n" + " schema=\"schema\"\n" + " catalog=\"catalog\"\n" + " extends=\"SuperclassName\"\n" + " abstract=\"true|false\"\n" + " persister=\"ClassName\"\n" + " subselect=\"SQL expression\"\n" + " entity-name=\"EntityName\"\n" + " node=\"element-name\">\n" + "\n" + " <property .... />\n" + " .....\n" + "</union-subclass>" +msgstr "" + +#. Tag: para +#: basic_mapping.xml:2743 #, no-c-format msgid "No discriminator column or key column is required for this mapping strategy." msgstr "" #. Tag: title +#: basic_mapping.xml:2751 #, no-c-format -msgid "Join" +msgid "Inherit properties from superclasses" msgstr "" #. Tag: para +#: basic_mapping.xml:2753 #, no-c-format -msgid "Using the <join> element, it is possible to map properties of one class to several tables that have a one-to-one relationship. For example:" +msgid "This is sometimes useful to share common properties through a technical or a business superclass without including it as a regular mapped entity (ie no specific table for this entity). For that purpose you can map them as @MappedSuperclass." +msgstr "" + +#. Tag: programlisting +#: basic_mapping.xml:2758 +#, no-c-format +msgid "" + "@MappedSuperclass\n" + "public class BaseEntity {\n" + " @Basic\n" + " @Temporal(TemporalType.TIMESTAMP)\n" + " public Date getLastUpdate() { ... }\n" + " public String getLastUpdater() { ... }\n" + " ...\n" + "}\n" + "\n" + "@Entity class Order extends BaseEntity {\n" + " @Id public Integer getId() { ... }\n" + " ...\n" + "}" msgstr "" #. Tag: para +#: basic_mapping.xml:2760 +#, no-c-format +msgid "In database, this hierarchy will be represented as an Order table having the id, lastUpdate and lastUpdater columns. The embedded superclass property mappings are copied into their entity subclasses. Remember that the embeddable superclass is not the root of the hierarchy though." +msgstr "" + +#. Tag: para +#: basic_mapping.xml:2768 +#, no-c-format +msgid "Properties from superclasses not mapped as @MappedSuperclass are ignored." +msgstr "" + +#. Tag: para +#: basic_mapping.xml:2773 +#, no-c-format +msgid "The default access type (field or methods) is used, unless you use the @Access annotation." +msgstr "" + +#. Tag: para +#: basic_mapping.xml:2778 +#, no-c-format +msgid "The same notion can be applied to @Embeddable objects to persist properties from their superclasses. You also need to use @MappedSuperclass to do that (this should not be considered as a standard EJB3 feature though)" +msgstr "" + +#. Tag: para +#: basic_mapping.xml:2786 +#, no-c-format +msgid "It is allowed to mark a class as @MappedSuperclass in the middle of the mapped inheritance hierarchy." +msgstr "" + +#. Tag: para +#: basic_mapping.xml:2792 +#, no-c-format +msgid "Any class in the hierarchy non annotated with @MappedSuperclass nor @Entity will be ignored." +msgstr "" + +#. Tag: para +#: basic_mapping.xml:2797 +#, no-c-format +msgid "You can override columns defined in entity superclasses at the root entity level using the @AttributeOverride annotation." +msgstr "" + +#. Tag: programlisting +#: basic_mapping.xml:2801 +#, no-c-format +msgid "" + "@MappedSuperclass\n" + "public class FlyingObject implements Serializable {\n" + "\n" + " public int getAltitude() {\n" + " return altitude;\n" + " }\n" + "\n" + " @Transient\n" + " public int getMetricAltitude() {\n" + " return metricAltitude;\n" + " }\n" + "\n" + " @ManyToOne\n" + " public PropulsionType getPropulsion() {\n" + " return metricAltitude;\n" + " }\n" + " ...\n" + "}\n" + "\n" + "@Entity\n" + "@AttributeOverride( name=\"altitude\", column = @Column(name=\"fld_altitude\") )\n" + "@AssociationOverride( \n" + " name=\"propulsion\", \n" + " joinColumns = @JoinColumn(name=\"fld_propulsion_fk\") \n" + ")\n" + "public class Plane extends FlyingObject {\n" + " ...\n" + "}" +msgstr "" + +#. Tag: para +#: basic_mapping.xml:2803 +#, no-c-format +msgid "The altitude property will be persisted in an fld_altitude column of table Plane and the propulsion association will be materialized in a fld_propulsion_fk foreign key column." +msgstr "" + +#. Tag: para +#: basic_mapping.xml:2809 +#, no-c-format +msgid "You can define @AttributeOverride(s) and @AssociationOverride(s) on @Entity classes, @MappedSuperclass classes and properties pointing to an @Embeddable object." +msgstr "" + +#. Tag: para +#: basic_mapping.xml:2815 +#, no-c-format +msgid "In hbm.xml, simply map the properties of the superclass in the <class> element of the entity that needs to inherit them." +msgstr "" + +#. Tag: title +#: basic_mapping.xml:2821 +#, no-c-format +msgid "Mapping one entity to several tables" +msgstr "" + +#. Tag: para +#: basic_mapping.xml:2823 +#, no-c-format +msgid "While not recommended for a fresh schema, some legacy databases force your to map a single entity on several tables." +msgstr "" + +#. Tag: para +#: basic_mapping.xml:2826 +#, no-c-format +msgid "Using the @SecondaryTable or @SecondaryTables class level annotations. To express that a column is in a particular table, use the table parameter of @Column or @JoinColumn." +msgstr "" + +#. Tag: programlisting +#: basic_mapping.xml:2832 +#, no-c-format +msgid "" + "@Entity\n" + "@Table(name=\"MainCat\")\n" + "@SecondaryTables({\n" + " @SecondaryTable(name=\"Cat1\", pkJoinColumns={\n" + " @PrimaryKeyJoinColumn(name=\"cat_id\", referencedColumnName=\"id\")\n" + " ),\n" + " @SecondaryTable(name=\"Cat2\", uniqueConstraints={@UniqueConstraint(columnNames={\"storyPart2\"})})\n" + "})\n" + "public class Cat implements Serializable {\n" + "\n" + " private Integer id;\n" + " private String name;\n" + " private String storyPart1;\n" + " private String storyPart2;\n" + "\n" + " @Id @GeneratedValue\n" + " public Integer getId() {\n" + " return id;\n" + " }\n" + "\n" + " public String getName() {\n" + " return name;\n" + " }\n" + " \n" + " @Column(table=\"Cat1\")\n" + " public String getStoryPart1() {\n" + " return storyPart1;\n" + " }\n" + "\n" + " @Column(table=\"Cat2\")\n" + " public String getStoryPart2() {\n" + " return storyPart2;\n" + " }\n" + "}" +msgstr "" + +#. Tag: para +#: basic_mapping.xml:2834 +#, no-c-format +msgid "In this example, name will be in MainCat. storyPart1 will be in Cat1 and storyPart2 will be in Cat2. Cat1 will be joined to MainCat using the cat_id as a foreign key, and Cat2 using id (ie the same column name, the MainCat id column has). Plus a unique constraint on storyPart2 has been set." +msgstr "" + +#. Tag: para +#: basic_mapping.xml:2844 +#, no-c-format +msgid "There is also additional tuning accessible via the @org.hibernate.annotations.Table annotation:" +msgstr "" + +#. Tag: para +#: basic_mapping.xml:2850 +#, no-c-format +msgid "fetch: If set to JOIN, the default, Hibernate will use an inner join to retrieve a secondary table defined by a class or its superclasses and an outer join for a secondary table defined by a subclass. If set to SELECT then Hibernate will use a sequential select for a secondary table defined on a subclass, which will be issued only if a row turns out to represent an instance of the subclass. Inner joins will still be used to retrieve a secondary defined by the class and its superclasses." +msgstr "" + +#. Tag: para +#: basic_mapping.xml:2862 +#, no-c-format +msgid "inverse: If true, Hibernate will not try to insert or update the properties defined by this join. Default to false." +msgstr "" + +#. Tag: para +#: basic_mapping.xml:2868 +#, no-c-format +msgid "optional: If enabled (the default), Hibernate will insert a row only if the properties defined by this join are non-null and will always use an outer join to retrieve the properties." +msgstr "" + +#. Tag: para +#: basic_mapping.xml:2875 +#, no-c-format +msgid "foreignKey: defines the Foreign Key name of a secondary table pointing back to the primary table." +msgstr "" + +#. Tag: para +#: basic_mapping.xml:2880 +#, no-c-format +msgid "Make sure to use the secondary table name in the appliesto property" +msgstr "" + +#. Tag: programlisting +#: basic_mapping.xml:2883 +#, no-c-format +msgid "" + "@Entity\n" + "@Table(name=\"MainCat\")\n" + "@SecondaryTable(name=\"Cat1\")\n" + "@org.hibernate.annotations.Table(\n" + " appliesTo=\"Cat1\",\n" + " fetch=FetchMode.SELECT,\n" + " optional=true)\n" + "public class Cat implements Serializable {\n" + "\n" + " private Integer id;\n" + " private String name;\n" + " private String storyPart1;\n" + " private String storyPart2;\n" + "\n" + " @Id @GeneratedValue\n" + " public Integer getId() {\n" + " return id;\n" + " }\n" + "\n" + " public String getName() {\n" + " return name;\n" + " }\n" + " \n" + " @Column(table=\"Cat1\")\n" + " public String getStoryPart1() {\n" + " return storyPart1;\n" + " }\n" + "\n" + " @Column(table=\"Cat2\")\n" + " public String getStoryPart2() {\n" + " return storyPart2;\n" + " }\n" + "}" +msgstr "" + +#. Tag: para +#: basic_mapping.xml:2885 +#, no-c-format +msgid "In hbm.xml, use the <join> element." +msgstr "" + +#. Tag: programlisting +#: basic_mapping.xml:2903 +#, no-c-format +msgid "" + "<join\n" + " table=\"tablename\"\n" + " schema=\"owner\"\n" + " catalog=\"catalog\"\n" + " fetch=\"join|select\"\n" + " inverse=\"true|false\"\n" + " optional=\"true|false\">\n" + "\n" + " <key ... />\n" + "\n" + " <property ... />\n" + " ...\n" + "</join>" +msgstr "" + +#. Tag: para +#: basic_mapping.xml:2907 #, no-c-format msgid "table: the name of the joined table." msgstr "" #. Tag: para +#: basic_mapping.xml:2924 #, no-c-format msgid "fetch (optional - defaults to join): if set to join, the default, Hibernate will use an inner join to retrieve a <join> defined by a class or its superclasses. It will use an outer join for a <join> defined by a subclass. If set to select then Hibernate will use a sequential select for a <join> defined on a subclass. This will be issued only if a row represents an instance of the subclass. Inner joins will still be used to retrieve a <join> defined by the class and its superclasses." msgstr "" #. Tag: para +#: basic_mapping.xml:2939 #, no-c-format msgid "inverse (optional - defaults to false): if enabled, Hibernate will not insert or update the properties defined by this join." msgstr "" #. Tag: para +#: basic_mapping.xml:2945 #, no-c-format msgid "optional (optional - defaults to false): if enabled, Hibernate will insert a row only if the properties defined by this join are non-null. It will always use an outer join to retrieve the properties." msgstr "" #. Tag: para +#: basic_mapping.xml:2953 #, no-c-format msgid "For example, address information for a person can be mapped to a separate table while preserving value type semantics for all properties:" msgstr "" +#. Tag: programlisting +#: basic_mapping.xml:2957 +#, no-c-format +msgid "" + "<class name=\"Person\"\n" + " table=\"PERSON\">\n" + "\n" + " <id name=\"id\" column=\"PERSON_ID\">...</id>\n" + "\n" + " <join table=\"ADDRESS\">\n" + " <key column=\"ADDRESS_ID\"/>\n" + " <property name=\"address\"/>\n" + " <property name=\"zip\"/>\n" + " <property name=\"country\"/>\n" + " </join>\n" + " ..." +msgstr "" + #. Tag: para +#: basic_mapping.xml:2959 #, no-c-format msgid "This feature is often only useful for legacy data models. We recommend fewer tables than classes and a fine-grained domain model. However, it is useful for switching between inheritance mapping strategies in a single hierarchy, as explained later." msgstr "" #. Tag: title +#: basic_mapping.xml:2967 #, no-c-format -msgid "Key" +msgid "Mapping one to one and one to many associations" msgstr "" #. Tag: para +#: basic_mapping.xml:2969 #, no-c-format -msgid "The <key> element has featured a few times within this guide. It appears anywhere the parent mapping element defines a join to a new table that references the primary key of the original table. It also defines the foreign key in the joined table:" +msgid "To link one entity to an other, you need to map the association property as a to one association. In the relational model, you can either use a foreign key or an association table, or (a bit less common) share the same primary key value between the two entities." msgstr "" #. Tag: para +#: basic_mapping.xml:2974 #, no-c-format -msgid "on-delete (optional - defaults to noaction): specifies whether the foreign key constraint has database-level cascade delete enabled." +msgid "To mark an association, use either @ManyToOne or @OnetoOne." msgstr "" #. Tag: para +#: basic_mapping.xml:2978 #, no-c-format -msgid "property-ref (optional): specifies that the foreign key refers to columns that are not the primary key of the original table. It is provided for legacy data." +msgid "@ManyToOne and @OneToOne have a parameter named targetEntity which describes the target entity name. You usually don't need this parameter since the default value (the type of the property that stores the association) is good in almost all cases. However this is useful when you want to use interfaces as the return type instead of the regular entity." msgstr "" #. Tag: para +#: basic_mapping.xml:2985 #, no-c-format -msgid "not-null (optional): specifies that the foreign key columns are not nullable. This is implied whenever the foreign key is also part of the primary key." +msgid "Setting a value of the cascade attribute to any meaningful value other than nothing will propagate certain operations to the associated object. The meaningful values are divided into three categories." msgstr "" #. Tag: para +#: basic_mapping.xml:2992 #, no-c-format -msgid "update (optional): specifies that the foreign key should never be updated. This is implied whenever the foreign key is also part of the primary key." +msgid "basic operations, which include: persist, merge, delete, save-update, evict, replicate, lock and refresh;" msgstr "" #. Tag: para +#: basic_mapping.xml:2998 #, no-c-format -msgid "unique (optional): specifies that the foreign key should have a unique constraint. This is implied whenever the foreign key is also the primary key." +msgid "special values: delete-orphan or all ;" msgstr "" #. Tag: para +#: basic_mapping.xml:3003 #, no-c-format -msgid "For systems where delete performance is important, we recommend that all keys should be defined on-delete=\"cascade\". Hibernate uses a database-level ON CASCADE DELETE constraint, instead of many individual DELETE statements. Be aware that this feature bypasses Hibernate's usual optimistic locking strategy for versioned data." +msgid "comma-separated combinations of operation names: cascade=\"persist,merge,evict\" or cascade=\"all,delete-orphan\". See for a full explanation. Note that single valued many-to-one associations do not support orphan delete." msgstr "" #. Tag: para +#: basic_mapping.xml:3012 #, no-c-format -msgid "The not-null and update attributes are useful when mapping a unidirectional one-to-many association. If you map a unidirectional one-to-many association to a non-nullable foreign key, you must declare the key column using <key not-null=\"true\">." +msgid "By default, single point associations are eagerly fetched in JPA 2. You can mark it as lazily fetched by using @ManyToOne(fetch=FetchType.LAZY) in which case Hibernate will proxy the association and load it when the state of the associated entity is reached. You can force Hibernate not to use a proxy by using @LazyToOne(NO_PROXY). In this case, the property is fetched lazily when the instance variable is first accessed. This requires build-time bytecode instrumentation. lazy=\"false\" specifies that the association will always be eagerly fetched." +msgstr "" + +#. Tag: para +#: basic_mapping.xml:3022 +#, no-c-format +msgid "With the default JPA options, single-ended associations are loaded with a subsequent select if set to LAZY, or a SQL JOIN is used for EAGER associations. You can however adjust the fetching strategy, ie how data is fetched by using @Fetch. FetchMode can be SELECT (a select is triggered when the association needs to be loaded) or JOIN (use a SQL JOIN to load the association while loading the owner entity). JOIN overrides any lazy attribute (an association loaded through a JOIN strategy cannot be lazy)." msgstr "" #. Tag: title +#: basic_mapping.xml:3034 #, no-c-format -msgid "Column and formula elements" +msgid "Using a foreign key or an association table" msgstr "" #. Tag: para +#: basic_mapping.xml:3036 #, no-c-format -msgid "Mapping elements which accept a column attribute will alternatively accept a <column> subelement. Likewise, <formula> is an alternative to the formula attribute. For example:" +msgid "An ordinary association to another persistent class is declared using a" msgstr "" #. Tag: para +#: basic_mapping.xml:3041 #, no-c-format -msgid "Most of the attributes on column provide a means of tailoring the DDL during automatic schema generation. The read and write attributes allow you to specify custom SQL that Hibernate will use to access the column's value. For more on this, see the discussion of column read and write expressions." +msgid "@ManyToOne if several entities can point to the the target entity" msgstr "" #. Tag: para +#: basic_mapping.xml:3046 #, no-c-format -msgid "The column and formula elements can even be combined within the same property or association mapping to express, for example, exotic join conditions." +msgid "@OneToOne if only a single entity can point to the the target entity" +msgstr "" + +#. Tag: para +#: basic_mapping.xml:3051 +#, no-c-format +msgid "and a foreign key in one table is referencing the primary key column(s) of the target table." +msgstr "" + +#. Tag: programlisting +#: basic_mapping.xml:3054 +#, no-c-format +msgid "" + "@Entity\n" + "public class Flight implements Serializable {\n" + " @ManyToOne( cascade = {CascadeType.PERSIST, CascadeType.MERGE} )\n" + " @JoinColumn(name=\"COMP_ID\")\n" + " public Company getCompany() {\n" + " return company;\n" + " }\n" + " ...\n" + "}" +msgstr "" + +#. Tag: para +#: basic_mapping.xml:3056 +#, no-c-format +msgid "The @JoinColumn attribute is optional, the default value(s) is the concatenation of the name of the relationship in the owner side, _ (underscore), and the name of the primary key column in the owned side. In this example company_id because the property name is company and the column id of Company is id." +msgstr "" + +#. Tag: programlisting +#: basic_mapping.xml:3064 +#, no-c-format +msgid "" + "@Entity\n" + "public class Flight implements Serializable {\n" + " @ManyToOne( cascade = {CascadeType.PERSIST, CascadeType.MERGE}, targetEntity=CompanyImpl.class )\n" + " @JoinColumn(name=\"COMP_ID\")\n" + " public Company getCompany() {\n" + " return company;\n" + " }\n" + " ...\n" + "}\n" + "\n" + "public interface Company {\n" + " ...\n" + "}" +msgstr "" + +#. Tag: para +#: basic_mapping.xml:3066 +#, no-c-format +msgid "You can also map a to one association through an association table. This association table described by the @JoinTable annotation will contains a foreign key referencing back the entity table (through @JoinTable.joinColumns) and a a foreign key referencing the target entity table (through @JoinTable.inverseJoinColumns)." +msgstr "" + +#. Tag: programlisting +#: basic_mapping.xml:3074 +#, no-c-format +msgid "" + "@Entity\n" + "public class Flight implements Serializable {\n" + " @ManyToOne( cascade = {CascadeType.PERSIST, CascadeType.MERGE} )\n" + " @JoinTable(name=\"Flight_Company\",\n" + " joinColumns = @JoinColumn(name=\"FLIGHT_ID\"),\n" + " inverseJoinColumns = @JoinColumn(name=\"COMP_ID\")\n" + " )\n" + " public Company getCompany() {\n" + " return company;\n" + " }\n" + " ...\n" + "}" +msgstr "" + +#. Tag: para +#: basic_mapping.xml:3077 +#, no-c-format +msgid "You can use a SQL fragment to simulate a physical join column using the @JoinColumnOrFormula / @JoinColumnOrformulas annotations (just like you can use a SQL fragment to simulate a property column via the @Formula annotation)." +msgstr "" + +#. Tag: programlisting +#: basic_mapping.xml:3083 +#, no-c-format +msgid "" + "@Entity\n" + "public class Ticket implements Serializable {\n" + " @ManyToOne\n" + " @JoinColumnOrFormula(formula=\"(firstname + ' ' + lastname)\")\n" + " public Person getOwner() {\n" + " return person;\n" + " }\n" + " ...\n" + "}" +msgstr "" + +#. Tag: para +#: basic_mapping.xml:3086 +#, no-c-format +msgid "You can mark an association as mandatory by using the optional=false attribute. We recommend to use Bean Validation's @NotNull annotation as a better alternative however. As a consequence, the foreign key column(s) will be marked as not nullable (if possible)." +msgstr "" + +#. Tag: para +#: basic_mapping.xml:3092 +#, no-c-format +msgid "When Hibernate cannot resolve the association because the expected associated element is not in database (wrong id on the association column), an exception is raised. This might be inconvenient for legacy and badly maintained schemas. You can ask Hibernate to ignore such elements instead of raising an exception using the @NotFound annotation." msgstr "" #. Tag: title +#: basic_mapping.xml:3100 #, no-c-format -msgid "Import" +msgid "@NotFound annotation" +msgstr "" + +#. Tag: programlisting +#: basic_mapping.xml:3102 +#, no-c-format +msgid "" + "@Entity\n" + "public class Child {\n" + " ...\n" + " @ManyToOne\n" + " @NotFound(action=NotFoundAction.IGNORE)\n" + " public Parent getParent() { ... }\n" + " ...\n" + "}" msgstr "" #. Tag: para +#: basic_mapping.xml:3105 #, no-c-format -msgid "If your application has two persistent classes with the same name, and you do not want to specify the fully qualified package name in Hibernate queries, classes can be \"imported\" explicitly, rather than relying upon auto-import=\"true\". You can also import classes and interfaces that are not explicitly mapped:" -msgstr "" - -#. Tag: para -#, no-c-format -msgid "class: the fully qualified class name of any Java class." -msgstr "" - -#. Tag: para -#, no-c-format -msgid "rename (optional - defaults to the unqualified class name): a name that can be used in the query language." +msgid "Sometimes you want to delegate to your database the deletion of cascade when a given entity is deleted. In this case Hibernate generates a cascade delete constraint at the database level." msgstr "" #. Tag: title +#: basic_mapping.xml:3110 #, no-c-format -msgid "Any" +msgid "@OnDelete annotation" +msgstr "" + +#. Tag: programlisting +#: basic_mapping.xml:3112 +#, no-c-format +msgid "" + "@Entity\n" + "public class Child {\n" + " ...\n" + " @ManyToOne\n" + " @OnDelete(action=OnDeleteAction.CASCADE)\n" + " public Parent getParent() { ... }\n" + " ...\n" + "}" msgstr "" #. Tag: para +#: basic_mapping.xml:3115 #, no-c-format -msgid "There is one more type of property mapping. The <any> mapping element defines a polymorphic association to classes from multiple tables. This type of mapping requires more than one column. The first column contains the type of the associated entity. The remaining columns contain the identifier. It is impossible to specify a foreign key constraint for this kind of association. This is not the usual way of mapping polymorphic associations and you should use this only in special cases. For example, for audit logs, user session data, etc." +msgid "Foreign key constraints, while generated by Hibernate, have a fairly unreadable name. You can override the constraint name using @ForeignKey." +msgstr "" + +#. Tag: title +#: basic_mapping.xml:3120 +#, no-c-format +msgid "@ForeignKey annotation" +msgstr "" + +#. Tag: programlisting +#: basic_mapping.xml:3122 +#, no-c-format +msgid "" + "@Entity\n" + "public class Child {\n" + " ...\n" + " @ManyToOne\n" + " @ForeignKey(name=\"FK_PARENT\")\n" + " public Parent getParent() { ... }\n" + " ...\n" + "}\n" + "\n" + "alter table Child add constraint FK_PARENT foreign key (parent_id) references Parent" msgstr "" #. Tag: para +#: basic_mapping.xml:3125 #, no-c-format -msgid "The meta-type attribute allows the application to specify a custom type that maps database column values to persistent classes that have identifier properties of the type specified by id-type. You must specify the mapping from values of the meta-type to class names." +msgid "Sometimes, you want to link one entity to an other not by the target entity primary key but by a different unique key. You can achieve that by referencing the unique key column(s) in @JoinColumn.referenceColumnName." +msgstr "" + +#. Tag: programlisting +#: basic_mapping.xml:3130 basic_mapping.xml:3682 +#, no-c-format +msgid "" + "@Entity\n" + "class Person {\n" + " @Id Integer personNumber;\n" + " String firstName;\n" + " @Column(name=\"I\")\n" + " String initial;\n" + " String lastName;\n" + "}\n" + "\n" + "@Entity\n" + "class Home {\n" + " @ManyToOne\n" + " @JoinColumns({\n" + " @JoinColumn(name=\"first_name\", referencedColumnName=\"firstName\"),\n" + " @JoinColumn(name=\"init\", referencedColumnName=\"I\"),\n" + " @JoinColumn(name=\"last_name\", referencedColumnName=\"lastName\"),\n" + " })\n" + " Person owner\n" + "}" msgstr "" #. Tag: para +#: basic_mapping.xml:3132 +#, no-c-format +msgid "This is not encouraged however and should be reserved to legacy mappings." +msgstr "" + +#. Tag: para +#: basic_mapping.xml:3135 +#, no-c-format +msgid "In hbm.xml, mapping an association is similar. The main difference is that a @OneToOne is mapped as <many-to-one unique=\"true\"/>, let's dive into the subject." +msgstr "" + +#. Tag: programlisting +#: basic_mapping.xml:3177 +#, no-c-format +msgid "" + "<many-to-one\n" + " name=\"propertyName\"\n" + " column=\"column_name\"\n" + " class=\"ClassName\"\n" + " cascade=\"cascade_style\"\n" + " fetch=\"join|select\"\n" + " update=\"true|false\"\n" + " insert=\"true|false\"\n" + " property-ref=\"propertyNameFromAssociatedClass\"\n" + " access=\"field|property|ClassName\"\n" + " unique=\"true|false\"\n" + " not-null=\"true|false\"\n" + " optimistic-lock=\"true|false\"\n" + " lazy=\"proxy|no-proxy|false\"\n" + " not-found=\"ignore|exception\"\n" + " entity-name=\"EntityName\"\n" + " formula=\"arbitrary SQL expression\"\n" + " node=\"element-name|@attribute-name|element/@attribute|.\"\n" + " embed-xml=\"true|false\"\n" + " index=\"index_name\"\n" + " unique_key=\"unique_key_id\"\n" + " foreign-key=\"foreign_key_name\"\n" + "/>" +msgstr "" + +#. Tag: para +#: basic_mapping.xml:3185 basic_mapping.xml:3868 +#, no-c-format +msgid "column (optional): the name of the foreign key column. This can also be specified by nested <column> element(s)." +msgstr "" + +#. Tag: para +#: basic_mapping.xml:3191 basic_mapping.xml:3385 +#, no-c-format +msgid "class (optional - defaults to the property type determined by reflection): the name of the associated class." +msgstr "" + +#. Tag: para +#: basic_mapping.xml:3197 basic_mapping.xml:3391 +#, no-c-format +msgid "cascade (optional): specifies which operations should be cascaded from the parent object to the associated object." +msgstr "" + +#. Tag: para +#: basic_mapping.xml:3203 basic_mapping.xml:3407 +#, no-c-format +msgid "fetch (optional - defaults to select): chooses between outer-join fetching or sequential select fetching." +msgstr "" + +#. Tag: para +#: basic_mapping.xml:3209 +#, no-c-format +msgid "update, insert (optional - defaults to true): specifies that the mapped columns should be included in SQL UPDATE and/or INSERT statements. Setting both to false allows a pure \"derived\" association whose value is initialized from another property that maps to the same column(s), or by a trigger or other application." +msgstr "" + +#. Tag: para +#: basic_mapping.xml:3219 +#, no-c-format +msgid "property-ref (optional): the name of a property of the associated class that is joined to this foreign key. If not specified, the primary key of the associated class is used." +msgstr "" + +#. Tag: para +#: basic_mapping.xml:3232 +#, no-c-format +msgid "unique (optional): enables the DDL generation of a unique constraint for the foreign-key column. By allowing this to be the target of a property-ref, you can make the association multiplicity one-to-one." +msgstr "" + +#. Tag: para +#: basic_mapping.xml:3240 +#, no-c-format +msgid "not-null (optional): enables the DDL generation of a nullability constraint for the foreign key columns." +msgstr "" + +#. Tag: para +#: basic_mapping.xml:3254 +#, no-c-format +msgid "lazy (optional - defaults to proxy): by default, single point associations are proxied. lazy=\"no-proxy\" specifies that the property should be fetched lazily when the instance variable is first accessed. This requires build-time bytecode instrumentation. lazy=\"false\" specifies that the association will always be eagerly fetched." +msgstr "" + +#. Tag: para +#: basic_mapping.xml:3264 +#, no-c-format +msgid "not-found (optional - defaults to exception): specifies how foreign keys that reference missing rows will be handled. ignore will treat a missing row as a null association." +msgstr "" + +#. Tag: para +#: basic_mapping.xml:3272 basic_mapping.xml:3448 +#, no-c-format +msgid "entity-name (optional): the entity name of the associated class." +msgstr "" + +#. Tag: para +#: basic_mapping.xml:3277 +#, no-c-format +msgid "formula (optional): an SQL expression that defines the value for a computed foreign key." +msgstr "" + +#. Tag: para +#: basic_mapping.xml:3284 +#, no-c-format +msgid "Setting a value of the cascade attribute to any meaningful value other than none will propagate certain operations to the associated object. The meaningful values are divided into three categories. First, basic operations, which include: persist, merge, delete, save-update, evict, replicate, lock and refresh; second, special values: delete-orphan; and third,all comma-separated combinations of operation names: cascade=\"persist,merge,evict\" or cascade=\"all,delete-orphan\". See for a full explanation. Note that single valued, many-to-one and one-to-one, associations do not support orphan delete." +msgstr "" + +#. Tag: para +#: basic_mapping.xml:3298 +#, no-c-format +msgid "Here is an example of a typical many-to-one declaration:" +msgstr "" + +#. Tag: programlisting +#: basic_mapping.xml:3301 +#, no-c-format +msgid "<many-to-one name=\"product\" class=\"Product\" column=\"PRODUCT_ID\"/>" +msgstr "" + +#. Tag: para +#: basic_mapping.xml:3303 +#, no-c-format +msgid "The property-ref attribute should only be used for mapping legacy data where a foreign key refers to a unique key of the associated table other than the primary key. This is a complicated and confusing relational model. For example, if the Product class had a unique serial number that is not the primary key. The unique attribute controls Hibernate's DDL generation with the SchemaExport tool." +msgstr "" + +#. Tag: programlisting +#: basic_mapping.xml:3311 +#, no-c-format +msgid "<property name=\"serialNumber\" unique=\"true\" type=\"string\" column=\"SERIAL_NUMBER\"/>" +msgstr "" + +#. Tag: para +#: basic_mapping.xml:3313 +#, no-c-format +msgid "Then the mapping for OrderItem might use:" +msgstr "" + +#. Tag: programlisting +#: basic_mapping.xml:3316 +#, no-c-format +msgid "<many-to-one name=\"product\" property-ref=\"serialNumber\" column=\"PRODUCT_SERIAL_NUMBER\"/>" +msgstr "" + +#. Tag: para +#: basic_mapping.xml:3318 +#, no-c-format +msgid "This is not encouraged, however." +msgstr "" + +#. Tag: para +#: basic_mapping.xml:3320 +#, no-c-format +msgid "If the referenced unique key comprises multiple properties of the associated entity, you should map the referenced properties inside a named <properties> element." +msgstr "" + +#. Tag: para +#: basic_mapping.xml:3324 +#, no-c-format +msgid "If the referenced unique key is the property of a component, you can specify a property path:" +msgstr "" + +#. Tag: programlisting +#: basic_mapping.xml:3327 +#, no-c-format +msgid "<many-to-one name=\"owner\" property-ref=\"identity.ssn\" column=\"OWNER_SSN\"/>" +msgstr "" + +#. Tag: title +#: basic_mapping.xml:3331 +#, no-c-format +msgid "Sharing the primary key with the associated entity" +msgstr "" + +#. Tag: para +#: basic_mapping.xml:3333 +#, no-c-format +msgid "The second approach is to ensure an entity and its associated entity share the same primary key. In this case the primary key column is also a foreign key and there is no extra column. These associations are always one to one." +msgstr "" + +#. Tag: title +#: basic_mapping.xml:3339 +#, no-c-format +msgid "One to One association" +msgstr "" + +#. Tag: programlisting +#: basic_mapping.xml:3341 +#, no-c-format +msgid "" + "@Entity\n" + "public class Body {\n" + " @Id\n" + " public Long getId() { return id; }\n" + "\n" + " @OneToOne(cascade = CascadeType.ALL)\n" + " @MapsId\n" + " public Heart getHeart() {\n" + " return heart;\n" + " }\n" + " ...\n" + "} \n" + "\n" + "@Entity\n" + "public class Heart {\n" + " @Id\n" + " public Long getId() { ...}\n" + "}" +msgstr "" + +#. Tag: para +#: basic_mapping.xml:3345 +#, no-c-format +msgid "Many people got confused by these primary key based one to one associations. They can only be lazily loaded if Hibernate knows that the other side of the association is always present. To indicate to Hibernate that it is the case, use @OneToOne(optional=false)." +msgstr "" + +#. Tag: para +#: basic_mapping.xml:3352 +#, no-c-format +msgid "In hbm.xml, use the following mapping." +msgstr "" + +#. Tag: programlisting +#: basic_mapping.xml:3377 +#, no-c-format +msgid "" + "<one-to-one\n" + " name=\"propertyName\"\n" + " class=\"ClassName\"\n" + " cascade=\"cascade_style\"\n" + " constrained=\"true|false\"\n" + " fetch=\"join|select\"\n" + " property-ref=\"propertyNameFromAssociatedClass\"\n" + " access=\"field|property|ClassName\"\n" + " formula=\"any SQL expression\"\n" + " lazy=\"proxy|no-proxy|false\"\n" + " entity-name=\"EntityName\"\n" + " node=\"element-name|@attribute-name|element/@attribute|.\"\n" + " embed-xml=\"true|false\"\n" + " foreign-key=\"foreign_key_name\"\n" + "/>" +msgstr "" + +#. Tag: para +#: basic_mapping.xml:3397 +#, no-c-format +msgid "constrained (optional): specifies that a foreign key constraint on the primary key of the mapped table and references the table of the associated class. This option affects the order in which save() and delete() are cascaded, and determines whether the association can be proxied. It is also used by the schema export tool." +msgstr "" + +#. Tag: para +#: basic_mapping.xml:3413 +#, no-c-format +msgid "property-ref (optional): the name of a property of the associated class that is joined to the primary key of this class. If not specified, the primary key of the associated class is used." +msgstr "" + +#. Tag: para +#: basic_mapping.xml:3426 +#, no-c-format +msgid "formula (optional): almost all one-to-one associations map to the primary key of the owning entity. If this is not the case, you can specify another column, columns or expression to join on using an SQL formula. See org.hibernate.test.onetooneformula for an example." +msgstr "" + +#. Tag: para +#: basic_mapping.xml:3435 +#, no-c-format +msgid "lazy (optional - defaults to proxy): by default, single point associations are proxied. lazy=\"no-proxy\" specifies that the property should be fetched lazily when the instance variable is first accessed. It requires build-time bytecode instrumentation. lazy=\"false\" specifies that the association will always be eagerly fetched. Note that if constrained=\"false\", proxying is impossible and Hibernate will eagerly fetch the association." +msgstr "" + +#. Tag: para +#: basic_mapping.xml:3454 +#, no-c-format +msgid "Primary key associations do not need an extra table column. If two rows are related by the association, then the two table rows share the same primary key value. To relate two objects by a primary key association, ensure that they are assigned the same identifier value." +msgstr "" + +#. Tag: para +#: basic_mapping.xml:3460 +#, no-c-format +msgid "For a primary key association, add the following mappings to Employee and Person respectively:" +msgstr "" + +#. Tag: programlisting +#: basic_mapping.xml:3464 +#, no-c-format +msgid "<one-to-one name=\"person\" class=\"Person\"/>" +msgstr "" + +#. Tag: programlisting +#: basic_mapping.xml:3466 +#, no-c-format +msgid "<one-to-one name=\"employee\" class=\"Employee\" constrained=\"true\"/>" +msgstr "" + +#. Tag: para +#: basic_mapping.xml:3468 +#, no-c-format +msgid "Ensure that the primary keys of the related rows in the PERSON and EMPLOYEE tables are equal. You use a special Hibernate identifier generation strategy called foreign:" +msgstr "" + +#. Tag: programlisting +#: basic_mapping.xml:3472 +#, no-c-format +msgid "" + "<class name=\"person\" table=\"PERSON\">\n" + " <id name=\"id\" column=\"PERSON_ID\">\n" + " <generator class=\"foreign\">\n" + " <param name=\"property\">employee</param>\n" + " </generator>\n" + " </id>\n" + " ...\n" + " <one-to-one name=\"employee\"\n" + " class=\"Employee\"\n" + " constrained=\"true\"/>\n" + "</class>" +msgstr "" + +#. Tag: para +#: basic_mapping.xml:3474 +#, no-c-format +msgid "A newly saved instance of Person is assigned the same primary key value as the Employee instance referred with the employee property of that Person." +msgstr "" + +#. Tag: title +#: basic_mapping.xml:3482 +#, no-c-format +msgid "Natural-id" +msgstr "" + +#. Tag: para +#: basic_mapping.xml:3484 +#, no-c-format +msgid "Although we recommend the use of surrogate keys as primary keys, you should try to identify natural keys for all entities. A natural key is a property or combination of properties that is unique and non-null. It is also immutable. Map the properties of the natural key as @NaturalId or map them inside the <natural-id> element. Hibernate will generate the necessary unique key and nullability constraints and, as a result, your mapping will be more self-documenting." +msgstr "" + +#. Tag: programlisting +#: basic_mapping.xml:3493 +#, no-c-format +msgid "" + "@Entity\n" + "public class Citizen {\n" + " @Id\n" + " @GeneratedValue\n" + " private Integer id;\n" + " private String firstname;\n" + " private String lastname;\n" + " \n" + " @NaturalId\n" + " @ManyToOne\n" + " private State state;\n" + "\n" + " @NaturalId\n" + " private String ssn;\n" + " ...\n" + "}\n" + "\n" + "\n" + "\n" + "//and later on query\n" + "List results = s.createCriteria( Citizen.class )\n" + " .add( Restrictions.naturalId().set( \"ssn\", \"1234\" ).set( \"state\", ste ) )\n" + " .list();" +msgstr "" + +#. Tag: para +#: basic_mapping.xml:3495 +#, no-c-format +msgid "Or in XML," +msgstr "" + +#. Tag: programlisting +#: basic_mapping.xml:3497 +#, no-c-format +msgid "" + "<natural-id mutable=\"true|false\"/>\n" + " <property ... />\n" + " <many-to-one ... />\n" + " ......\n" + "</natural-id>" +msgstr "" + +#. Tag: para +#: basic_mapping.xml:3499 +#, no-c-format +msgid "It is recommended that you implement equals() and hashCode() to compare the natural key properties of the entity." +msgstr "" + +#. Tag: para +#: basic_mapping.xml:3503 +#, no-c-format +msgid "This mapping is not intended for use with entities that have natural primary keys." +msgstr "" + +#. Tag: para +#: basic_mapping.xml:3508 +#, no-c-format +msgid "mutable (optional - defaults to false): by default, natural identifier properties are assumed to be immutable (constant)." +msgstr "" + +#. Tag: title +#: basic_mapping.xml:3516 +#, no-c-format +msgid "Any" +msgstr "" + +#. Tag: para +#: basic_mapping.xml:3518 +#, no-c-format +msgid "There is one more type of property mapping. The @Any mapping defines a polymorphic association to classes from multiple tables. This type of mapping requires more than one column. The first column contains the type of the associated entity. The remaining columns contain the identifier. It is impossible to specify a foreign key constraint for this kind of association. This is not the usual way of mapping polymorphic associations and you should use this only in special cases. For example, for audit logs, user session data, etc." +msgstr "" + +#. Tag: para +#: basic_mapping.xml:3528 +#, no-c-format +msgid "The @Any annotation describes the column holding the metadata information. To link the value of the metadata information and an actual entity type, The @AnyDef and @AnyDefs annotations are used. The metaType attribute allows the application to specify a custom type that maps database column values to persistent classes that have identifier properties of the type specified by idType. You must specify the mapping from values of the metaType to class names." +msgstr "" + +#. Tag: programlisting +#: basic_mapping.xml:3538 +#, no-c-format +msgid "" + "@Any( metaColumn = @Column( name = \"property_type\" ), fetch=FetchType.EAGER )\n" + "@AnyMetaDef( \n" + " idType = \"integer\", \n" + " metaType = \"string\", \n" + " metaValues = {\n" + " @MetaValue( value = \"S\", targetEntity = StringProperty.class ),\n" + " @MetaValue( value = \"I\", targetEntity = IntegerProperty.class )\n" + " } )\n" + "@JoinColumn( name = \"property_id\" )\n" + "public Property getMainProperty() {\n" + " return mainProperty;\n" + "}" +msgstr "" + +#. Tag: para +#: basic_mapping.xml:3540 +#, no-c-format +msgid "Note that @AnyDef can be mutualized and reused. It is recommended to place it as a package metadata in this case." +msgstr "" + +#. Tag: programlisting +#: basic_mapping.xml:3544 +#, no-c-format +msgid "" + "//on a package\n" + "@AnyMetaDef( name=\"property\" \n" + " idType = \"integer\", \n" + " metaType = \"string\", \n" + " metaValues = {\n" + " @MetaValue( value = \"S\", targetEntity = StringProperty.class ),\n" + " @MetaValue( value = \"I\", targetEntity = IntegerProperty.class )\n" + " } )\n" + "package org.hibernate.test.annotations.any;\n" + "\n" + "\n" + "//in a class\n" + " @Any( metaDef=\"property\", metaColumn = @Column( name = \"property_type\" ), fetch=FetchType.EAGER )\n" + " @JoinColumn( name = \"property_id\" )\n" + " public Property getMainProperty() {\n" + " return mainProperty;\n" + " }" +msgstr "" + +#. Tag: para +#: basic_mapping.xml:3546 +#, no-c-format +msgid "The hbm.xml equivalent is:" +msgstr "" + +#. Tag: programlisting +#: basic_mapping.xml:3548 +#, no-c-format +msgid "" + "<any name=\"being\" id-type=\"long\" meta-type=\"string\">\n" + " <meta-value value=\"TBL_ANIMAL\" class=\"Animal\"/>\n" + " <meta-value value=\"TBL_HUMAN\" class=\"Human\"/>\n" + " <meta-value value=\"TBL_ALIEN\" class=\"Alien\"/>\n" + " <column name=\"table_name\"/>\n" + " <column name=\"id\"/>\n" + "</any>" +msgstr "" + +#. Tag: para +#: basic_mapping.xml:3551 +#, no-c-format +msgid "You cannot mutualize the metadata in hbm.xml as you can in annotations." +msgstr "" + +#. Tag: programlisting +#: basic_mapping.xml:3570 +#, no-c-format +msgid "" + "<any\n" + " name=\"propertyName\"\n" + " id-type=\"idtypename\"\n" + " meta-type=\"metatypename\"\n" + " cascade=\"cascade_style\"\n" + " access=\"field|property|ClassName\"\n" + " optimistic-lock=\"true|false\"\n" + ">\n" + " <meta-value ... />\n" + " <meta-value ... />\n" + " .....\n" + " <column .... />\n" + " <column .... />\n" + " .....\n" + "</any>" +msgstr "" + +#. Tag: para +#: basic_mapping.xml:3574 #, no-c-format msgid "name: the property name." msgstr "" #. Tag: para +#: basic_mapping.xml:3578 #, no-c-format msgid "id-type: the identifier type." msgstr "" #. Tag: para +#: basic_mapping.xml:3582 #, no-c-format msgid "meta-type (optional - defaults to string): any type that is allowed for a discriminator mapping." msgstr "" #. Tag: para +#: basic_mapping.xml:3588 #, no-c-format msgid "cascade (optional- defaults to none): the cascade style." msgstr "" #. Tag: para +#: basic_mapping.xml:3599 #, no-c-format msgid "optimistic-lock (optional - defaults to true): specifies that updates to this property either do or do not require acquisition of the optimistic lock. It defines whether a version increment should occur if this property is dirty." msgstr "" #. Tag: title +#: basic_mapping.xml:3610 +#, no-c-format +msgid "Properties" +msgstr "" + +#. Tag: para +#: basic_mapping.xml:3612 +#, no-c-format +msgid "The <properties> element allows the definition of a named, logical grouping of the properties of a class. The most important use of the construct is that it allows a combination of properties to be the target of a property-ref. It is also a convenient way to define a multi-column unique constraint. For example:" +msgstr "" + +#. Tag: programlisting +#: basic_mapping.xml:3632 +#, no-c-format +msgid "" + "<properties\n" + " name=\"logicalName\"\n" + " insert=\"true|false\"\n" + " update=\"true|false\"\n" + " optimistic-lock=\"true|false\"\n" + " unique=\"true|false\"\n" + ">\n" + "\n" + " <property ...../>\n" + " <many-to-one .... />\n" + " ........\n" + "</properties>" +msgstr "" + +#. Tag: para +#: basic_mapping.xml:3636 +#, no-c-format +msgid "name: the logical name of the grouping. It is not an actual property name." +msgstr "" + +#. Tag: para +#: basic_mapping.xml:3651 +#, no-c-format +msgid "optimistic-lock (optional - defaults to true): specifies that updates to these properties either do or do not require acquisition of the optimistic lock. It determines if a version increment should occur when these properties are dirty." +msgstr "" + +#. Tag: para +#: basic_mapping.xml:3666 +#, no-c-format +msgid "For example, if we have the following <properties> mapping:" +msgstr "" + +#. Tag: programlisting +#: basic_mapping.xml:3669 +#, no-c-format +msgid "" + "<class name=\"Person\">\n" + " <id name=\"personNumber\"/>\n" + "\n" + " ...\n" + " <properties name=\"name\"\n" + " unique=\"true\" update=\"false\">\n" + " <property name=\"firstName\"/>\n" + " <property name=\"initial\"/>\n" + " <property name=\"lastName\"/>\n" + " </properties>\n" + "</class>" +msgstr "" + +#. Tag: para +#: basic_mapping.xml:3671 +#, no-c-format +msgid "You might have some legacy data association that refers to this unique key of the Person table, instead of to the primary key:" +msgstr "" + +#. Tag: programlisting +#: basic_mapping.xml:3675 +#, no-c-format +msgid "" + "<many-to-one name=\"owner\"\n" + " class=\"Person\" property-ref=\"name\">\n" + " <column name=\"firstName\"/>\n" + " <column name=\"initial\"/>\n" + " <column name=\"lastName\"/>\n" + "</many-to-one>" +msgstr "" + +#. Tag: para +#: basic_mapping.xml:3678 +#, no-c-format +msgid "When using annotations as a mapping strategy, such construct is not necessary as the binding between a column and its related column on the associated table is done directly" +msgstr "" + +#. Tag: para +#: basic_mapping.xml:3685 +#, no-c-format +msgid "The use of this outside the context of mapping legacy data is not recommended." +msgstr "" + +#. Tag: title +#: basic_mapping.xml:3690 +#, no-c-format +msgid "Some hbm.xml specificities" +msgstr "" + +#. Tag: para +#: basic_mapping.xml:3692 +#, no-c-format +msgid "The hbm.xml structure has some specificities naturally not present when using annotations, let's describe them briefly." +msgstr "" + +#. Tag: title +#: basic_mapping.xml:3696 +#, no-c-format +msgid "Doctype" +msgstr "" + +#. Tag: para +#: basic_mapping.xml:3698 +#, no-c-format +msgid "All XML mappings should declare the doctype shown. The actual DTD can be found at the URL above, in the directory hibernate-x.x.x/src/org/hibernate , or in hibernate3.jar. Hibernate will always look for the DTD in its classpath first. If you experience lookups of the DTD using an Internet connection, check the DTD declaration against the contents of your classpath." +msgstr "" + +#. Tag: title +#: basic_mapping.xml:3707 +#, no-c-format +msgid "EntityResolver" +msgstr "" + +#. Tag: para +#: basic_mapping.xml:3709 +#, no-c-format +msgid "Hibernate will first attempt to resolve DTDs in its classpath. It does this is by registering a custom org.xml.sax.EntityResolver implementation with the SAXReader it uses to read in the xml files. This custom EntityResolver recognizes two different systemId namespaces:" +msgstr "" + +#. Tag: para +#: basic_mapping.xml:3718 +#, no-c-format +msgid "a hibernate namespace is recognized whenever the resolver encounters a systemId starting with http://hibernate.sourceforge.net/. The resolver attempts to resolve these entities via the classloader which loaded the Hibernate classes." +msgstr "" + +#. Tag: para +#: basic_mapping.xml:3726 +#, no-c-format +msgid "a user namespace is recognized whenever the resolver encounters a systemId using a classpath:// URL protocol. The resolver will attempt to resolve these entities via (1) the current thread context classloader and (2) the classloader which loaded the Hibernate classes." +msgstr "" + +#. Tag: para +#: basic_mapping.xml:3735 +#, no-c-format +msgid "The following is an example of utilizing user namespacing:" +msgstr "" + +#. Tag: programlisting +#: basic_mapping.xml:3738 +#, no-c-format +msgid "" + "" +msgstr "" + +#. Tag: para +#: basic_mapping.xml:3740 +#, no-c-format +msgid "Where types.xml is a resource in the your.domain package and contains a custom typedef." +msgstr "" + +#. Tag: title +#: basic_mapping.xml:3747 +#, no-c-format +msgid "Hibernate-mapping" +msgstr "" + +#. Tag: para +#: basic_mapping.xml:3749 +#, no-c-format +msgid "This element has several optional attributes. The schema and catalog attributes specify that tables referred to in this mapping belong to the named schema and/or catalog. If they are specified, tablenames will be qualified by the given schema and catalog names. If they are missing, tablenames will be unqualified. The default-cascade attribute specifies what cascade style should be assumed for properties and collections that do not specify a cascade attribute. By default, the auto-import attribute allows you to use unqualified class names in the query language." +msgstr "" + +#. Tag: programlisting +#: basic_mapping.xml:3778 +#, no-c-format +msgid "" + "<hibernate-mapping\n" + " schema=\"schemaName\"\n" + " catalog=\"catalogName\"\n" + " default-cascade=\"cascade_style\"\n" + " default-access=\"field|property|ClassName\"\n" + " default-lazy=\"true|false\"\n" + " auto-import=\"true|false\"\n" + " package=\"package.name\"\n" + " />" +msgstr "" + +#. Tag: para +#: basic_mapping.xml:3782 +#, no-c-format +msgid "schema (optional): the name of a database schema." +msgstr "" + +#. Tag: para +#: basic_mapping.xml:3787 +#, no-c-format +msgid "catalog (optional): the name of a database catalog." +msgstr "" + +#. Tag: para +#: basic_mapping.xml:3792 +#, no-c-format +msgid "default-cascade (optional - defaults to none): a default cascade style." +msgstr "" + +#. Tag: para +#: basic_mapping.xml:3797 +#, no-c-format +msgid "default-access (optional - defaults to property): the strategy Hibernate should use for accessing all properties. It can be a custom implementation of PropertyAccessor." +msgstr "" + +#. Tag: para +#: basic_mapping.xml:3804 +#, no-c-format +msgid "default-lazy (optional - defaults to true): the default value for unspecified lazy attributes of class and collection mappings." +msgstr "" + +#. Tag: para +#: basic_mapping.xml:3811 +#, no-c-format +msgid "auto-import (optional - defaults to true): specifies whether we can use unqualified class names of classes in this mapping in the query language." +msgstr "" + +#. Tag: para +#: basic_mapping.xml:3818 +#, no-c-format +msgid "package (optional): specifies a package prefix to use for unqualified class names in the mapping document." +msgstr "" + +#. Tag: para +#: basic_mapping.xml:3825 +#, no-c-format +msgid "If you have two persistent classes with the same unqualified name, you should set auto-import=\"false\". An exception will result if you attempt to assign two classes to the same \"imported\" name." +msgstr "" + +#. Tag: para +#: basic_mapping.xml:3830 +#, no-c-format +msgid "The hibernate-mapping element allows you to nest several persistent <class> mappings, as shown above. It is, however, good practice (and expected by some tools) to map only a single persistent class, or a single class hierarchy, in one mapping file and name it after the persistent superclass. For example, Cat.hbm.xml, Dog.hbm.xml, or if using inheritance, Animal.hbm.xml." +msgstr "" + +#. Tag: title +#: basic_mapping.xml:3841 +#, no-c-format +msgid "Key" +msgstr "" + +#. Tag: para +#: basic_mapping.xml:3843 +#, no-c-format +msgid "The <key> element is featured a few times within this guide. It appears anywhere the parent mapping element defines a join to a new table that references the primary key of the original table. It also defines the foreign key in the joined table:" +msgstr "" + +#. Tag: programlisting +#: basic_mapping.xml:3864 +#, no-c-format +msgid "" + "<key\n" + " column=\"columnname\"\n" + " on-delete=\"noaction|cascade\"\n" + " property-ref=\"propertyName\"\n" + " not-null=\"true|false\"\n" + " update=\"true|false\"\n" + " unique=\"true|false\"\n" + "/>" +msgstr "" + +#. Tag: para +#: basic_mapping.xml:3874 +#, no-c-format +msgid "on-delete (optional - defaults to noaction): specifies whether the foreign key constraint has database-level cascade delete enabled." +msgstr "" + +#. Tag: para +#: basic_mapping.xml:3880 +#, no-c-format +msgid "property-ref (optional): specifies that the foreign key refers to columns that are not the primary key of the original table. It is provided for legacy data." +msgstr "" + +#. Tag: para +#: basic_mapping.xml:3886 +#, no-c-format +msgid "not-null (optional): specifies that the foreign key columns are not nullable. This is implied whenever the foreign key is also part of the primary key." +msgstr "" + +#. Tag: para +#: basic_mapping.xml:3892 +#, no-c-format +msgid "update (optional): specifies that the foreign key should never be updated. This is implied whenever the foreign key is also part of the primary key." +msgstr "" + +#. Tag: para +#: basic_mapping.xml:3898 +#, no-c-format +msgid "unique (optional): specifies that the foreign key should have a unique constraint. This is implied whenever the foreign key is also the primary key." +msgstr "" + +#. Tag: para +#: basic_mapping.xml:3905 +#, no-c-format +msgid "For systems where delete performance is important, we recommend that all keys should be defined on-delete=\"cascade\". Hibernate uses a database-level ON CASCADE DELETE constraint, instead of many individual DELETE statements. Be aware that this feature bypasses Hibernate's usual optimistic locking strategy for versioned data." +msgstr "" + +#. Tag: para +#: basic_mapping.xml:3913 +#, no-c-format +msgid "The not-null and update attributes are useful when mapping a unidirectional one-to-many association. If you map a unidirectional one-to-many association to a non-nullable foreign key, you must declare the key column using <key not-null=\"true\">." +msgstr "" + +#. Tag: title +#: basic_mapping.xml:3922 +#, no-c-format +msgid "Import" +msgstr "" + +#. Tag: para +#: basic_mapping.xml:3924 +#, no-c-format +msgid "If your application has two persistent classes with the same name, and you do not want to specify the fully qualified package name in Hibernate queries, classes can be \"imported\" explicitly, rather than relying upon auto-import=\"true\". You can also import classes and interfaces that are not explicitly mapped:" +msgstr "" + +#. Tag: programlisting +#: basic_mapping.xml:3930 +#, no-c-format +msgid "<import class=\"java.lang.Object\" rename=\"Universe\"/>" +msgstr "" + +#. Tag: programlisting +#: basic_mapping.xml:3939 +#, no-c-format +msgid "" + "<import\n" + " class=\"ClassName\"\n" + " rename=\"ShortName\"\n" + "/>" +msgstr "" + +#. Tag: para +#: basic_mapping.xml:3943 +#, no-c-format +msgid "class: the fully qualified class name of any Java class." +msgstr "" + +#. Tag: para +#: basic_mapping.xml:3948 +#, no-c-format +msgid "rename (optional - defaults to the unqualified class name): a name that can be used in the query language." +msgstr "" + +#. Tag: para +#: basic_mapping.xml:3956 +#, no-c-format +msgid "This feature is unique to hbm.xml and is not supported in annotations." +msgstr "" + +#. Tag: title +#: basic_mapping.xml:3962 +#, no-c-format +msgid "Column and formula elements" +msgstr "" + +#. Tag: para +#: basic_mapping.xml:3964 +#, no-c-format +msgid "Mapping elements which accept a column attribute will alternatively accept a <column> subelement. Likewise, <formula> is an alternative to the formula attribute. For example:" +msgstr "" + +#. Tag: programlisting +#: basic_mapping.xml:3970 +#, no-c-format +msgid "" + "<column\n" + " name=\"column_name\"\n" + " length=\"N\"\n" + " precision=\"N\"\n" + " scale=\"N\"\n" + " not-null=\"true|false\"\n" + " unique=\"true|false\"\n" + " unique-key=\"multicolumn_unique_key_name\"\n" + " index=\"index_name\"\n" + " sql-type=\"sql_type_name\"\n" + " check=\"SQL expression\"\n" + " default=\"SQL expression\"\n" + " read=\"SQL expression\"\n" + " write=\"SQL expression\"/>" +msgstr "" + +#. Tag: programlisting +#: basic_mapping.xml:3972 +#, no-c-format +msgid "<formula>SQL expression</formula>" +msgstr "" + +#. Tag: para +#: basic_mapping.xml:3974 +#, no-c-format +msgid "Most of the attributes on column provide a means of tailoring the DDL during automatic schema generation. The read and write attributes allow you to specify custom SQL that Hibernate will use to access the column's value. For more on this, see the discussion of column read and write expressions." +msgstr "" + +#. Tag: para +#: basic_mapping.xml:3982 +#, no-c-format +msgid "The column and formula elements can even be combined within the same property or association mapping to express, for example, exotic join conditions." +msgstr "" + +#. Tag: programlisting +#: basic_mapping.xml:3986 +#, no-c-format +msgid "" + "<many-to-one name=\"homeAddress\" class=\"Address\"\n" + " insert=\"false\" update=\"false\">\n" + " <column name=\"person_id\" not-null=\"true\" length=\"10\"/>\n" + " <formula>'MAILING'</formula>\n" + "</many-to-one>" +msgstr "" + +#. Tag: title +#: basic_mapping.xml:3992 #, no-c-format msgid "Hibernate types" msgstr "" #. Tag: title +#: basic_mapping.xml:3995 #, no-c-format msgid "Entities and values" msgstr "" #. Tag: para +#: basic_mapping.xml:3997 #, no-c-format msgid "In relation to the persistence service, Java language-level objects are classified into two groups:" msgstr "" #. Tag: para +#: basic_mapping.xml:4000 #, no-c-format msgid "An entity exists independently of any other objects holding references to the entity. Contrast this with the usual Java model, where an unreferenced object is garbage collected. Entities must be explicitly saved and deleted. Saves and deletions, however, can be cascaded from a parent entity to its children. This is different from the ODMG model of object persistence by reachability and corresponds more closely to how application objects are usually used in large systems. Entities support circular and shared references. They can also be versioned." msgstr "" #. Tag: para +#: basic_mapping.xml:4010 #, no-c-format msgid "An entity's persistent state consists of references to other entities and instances of value types. Values are primitives: collections (not what is inside a collection), components and certain immutable objects. Unlike entities, values in particular collections and components, are persisted and deleted by reachability. Since value objects and primitives are persisted and deleted along with their containing entity, they cannot be independently versioned. Values have no independent identity, so they cannot be shared by two entities or collections." msgstr "" #. Tag: para +#: basic_mapping.xml:4020 #, no-c-format msgid "Until now, we have been using the term \"persistent class\" to refer to entities. We will continue to do that. Not all user-defined classes with a persistent state, however, are entities. A component is a user-defined class with value semantics. A Java property of type java.lang.String also has value semantics. Given this definition, all types (classes) provided by the JDK have value type semantics in Java, while user-defined types can be mapped with entity or value type semantics. This decision is up to the application developer. An entity class in a domain model will normally have shared references to a single instance of that class, while composition or aggregation usually translates to a value type." msgstr "" #. Tag: para +#: basic_mapping.xml:4033 #, no-c-format msgid "We will revisit both concepts throughout this reference guide." msgstr "" #. Tag: para +#: basic_mapping.xml:4036 #, no-c-format msgid "The challenge is to map the Java type system, and the developers' definition of entities and value types, to the SQL/database type system. The bridge between both systems is provided by Hibernate. For entities, <class>, <subclass> and so on are used. For value types we use <property>, <component>etc., that usually have a type attribute. The value of this attribute is the name of a Hibernate mapping type. Hibernate provides a range of mappings for standard JDK value types out of the box. You can write your own mapping types and implement your own custom conversion strategies." msgstr "" #. Tag: para +#: basic_mapping.xml:4049 #, no-c-format msgid "With the exception of collections, all built-in Hibernate types support null semantics." msgstr "" #. Tag: title +#: basic_mapping.xml:4054 #, no-c-format msgid "Basic value types" msgstr "" #. Tag: para +#: basic_mapping.xml:4056 #, no-c-format msgid "The built-in basic mapping types can be roughly categorized into the following:" msgstr "" -#. Tag: term +#. Tag: literal +#: basic_mapping.xml:4059 #, no-c-format -msgid "integer, long, short, float, double, character, byte, boolean, yes_no, true_false" +msgid "integer, long, short, float, double, character, byte, boolean, yes_no, true_false" msgstr "" #. Tag: para +#: basic_mapping.xml:4063 #, no-c-format msgid "Type mappings from Java primitives or wrapper classes to appropriate (vendor-specific) SQL column types. boolean, yes_no and true_false are all alternative encodings for a Java boolean or java.lang.Boolean." msgstr "" -#. Tag: term +#. Tag: literal +#: basic_mapping.xml:4073 #, no-c-format -msgid "string" +msgid "string" msgstr "" #. Tag: para +#: basic_mapping.xml:4076 #, no-c-format msgid "A type mapping from java.lang.String to VARCHAR (or Oracle VARCHAR2)." msgstr "" -#. Tag: term +#. Tag: literal +#: basic_mapping.xml:4083 #, no-c-format -msgid "date, time, timestamp" +msgid "date, time, timestamp" msgstr "" #. Tag: para +#: basic_mapping.xml:4086 #, no-c-format msgid "Type mappings from java.util.Date and its subclasses to SQL types DATE, TIME and TIMESTAMP (or equivalent)." msgstr "" -#. Tag: term +#. Tag: literal +#: basic_mapping.xml:4094 #, no-c-format -msgid "calendar, calendar_date" +msgid "calendar, calendar_date" msgstr "" #. Tag: para +#: basic_mapping.xml:4097 #, no-c-format msgid "Type mappings from java.util.Calendar to SQL types TIMESTAMP and DATE (or equivalent)." msgstr "" -#. Tag: term +#. Tag: literal +#: basic_mapping.xml:4104 #, no-c-format -msgid "big_decimal, big_integer" +msgid "big_decimal, big_integer" msgstr "" #. Tag: para +#: basic_mapping.xml:4107 #, no-c-format msgid "Type mappings from java.math.BigDecimal and java.math.BigInteger to NUMERIC (or Oracle NUMBER)." msgstr "" -#. Tag: term +#. Tag: literal +#: basic_mapping.xml:4115 #, no-c-format -msgid "locale, timezone, currency" +msgid "locale, timezone, currency" msgstr "" #. Tag: para +#: basic_mapping.xml:4118 #, no-c-format msgid "Type mappings from java.util.Locale, java.util.TimeZone and java.util.Currency to VARCHAR (or Oracle VARCHAR2). Instances of Locale and Currency are mapped to their ISO codes. Instances of TimeZone are mapped to their ID." msgstr "" -#. Tag: term +#. Tag: literal +#: basic_mapping.xml:4131 #, no-c-format -msgid "class" +msgid "class" msgstr "" #. Tag: para +#: basic_mapping.xml:4134 #, no-c-format msgid "A type mapping from java.lang.Class to VARCHAR (or Oracle VARCHAR2). A Class is mapped to its fully qualified name." msgstr "" -#. Tag: term +#. Tag: literal +#: basic_mapping.xml:4142 #, no-c-format -msgid "binary" +msgid "binary" msgstr "" #. Tag: para +#: basic_mapping.xml:4145 #, no-c-format msgid "Maps byte arrays to an appropriate SQL binary type." msgstr "" -#. Tag: term +#. Tag: literal +#: basic_mapping.xml:4150 #, no-c-format -msgid "text" +msgid "text" msgstr "" #. Tag: para +#: basic_mapping.xml:4153 #, no-c-format msgid "Maps long Java strings to a SQL CLOB or TEXT type." msgstr "" -#. Tag: term +#. Tag: literal +#: basic_mapping.xml:4159 #, no-c-format -msgid "serializable" +msgid "serializable" msgstr "" #. Tag: para +#: basic_mapping.xml:4162 #, no-c-format msgid "Maps serializable Java types to an appropriate SQL binary type. You can also indicate the Hibernate type serializable with the name of a serializable Java class or interface that does not default to a basic type." msgstr "" -#. Tag: term +#. Tag: literal +#: basic_mapping.xml:4171 #, no-c-format -msgid "clob, blob" +msgid "clob, blob" msgstr "" #. Tag: para +#: basic_mapping.xml:4174 #, no-c-format msgid "Type mappings for the JDBC classes java.sql.Clob and java.sql.Blob. These types can be inconvenient for some applications, since the blob or clob object cannot be reused outside of a transaction. Driver support is patchy and inconsistent." msgstr "" -#. Tag: term +#. Tag: literal +#: basic_mapping.xml:4184 #, no-c-format -msgid "imm_date, imm_time, imm_timestamp, imm_calendar, imm_calendar_date, imm_serializable, imm_binary" +msgid "imm_date, imm_time, imm_timestamp, imm_calendar, imm_calendar_date, imm_serializable, imm_binary" msgstr "" #. Tag: para +#: basic_mapping.xml:4188 #, no-c-format msgid "Type mappings for what are considered mutable Java types. This is where Hibernate makes certain optimizations appropriate only for immutable Java types, and the application treats the object as immutable. For example, you should not call Date.setTime() for an instance mapped as imm_timestamp. To change the value of the property, and have that change made persistent, the application must assign a new, nonidentical, object to the property." msgstr "" #. Tag: para +#: basic_mapping.xml:4200 #, no-c-format msgid "Unique identifiers of entities and collections can be of any basic type except binary, blob and clob. Composite identifiers are also allowed. See below for more information." msgstr "" #. Tag: para +#: basic_mapping.xml:4205 #, no-c-format msgid "The basic value types have corresponding Type constants defined on org.hibernate.Hibernate. For example, Hibernate.STRING represents the string type." msgstr "" #. Tag: title +#: basic_mapping.xml:4212 #, no-c-format msgid "Custom value types" msgstr "" #. Tag: para +#: basic_mapping.xml:4214 #, no-c-format msgid "It is relatively easy for developers to create their own value types. For example, you might want to persist properties of type java.lang.BigInteger to VARCHAR columns. Hibernate does not provide a built-in type for this. Custom types are not limited to mapping a property, or collection element, to a single table column. So, for example, you might have a Java property getName()/setName() of type java.lang.String that is persisted to the columns FIRST_NAME, INITIAL, SURNAME." msgstr "" #. Tag: para +#: basic_mapping.xml:4225 #, no-c-format msgid "To implement a custom type, implement either org.hibernate.UserType or org.hibernate.CompositeUserType and declare properties using the fully qualified classname of the type. View org.hibernate.test.DoubleStringType to see the kind of things that are possible." msgstr "" +#. Tag: programlisting +#: basic_mapping.xml:4232 +#, no-c-format +msgid "" + "<property name=\"twoStrings\" type=\"org.hibernate.test.DoubleStringType\">\n" + " <column name=\"first_string\"/>\n" + " <column name=\"second_string\"/>\n" + "</property>" +msgstr "" + #. Tag: para +#: basic_mapping.xml:4234 #, no-c-format msgid "Notice the use of <column> tags to map a property to multiple columns." msgstr "" #. Tag: para +#: basic_mapping.xml:4237 #, no-c-format msgid "The CompositeUserType, EnhancedUserType, UserCollectionType, and UserVersionType interfaces provide support for more specialized uses." msgstr "" #. Tag: para +#: basic_mapping.xml:4243 #, no-c-format msgid "You can even supply parameters to a UserType in the mapping file. To do this, your UserType must implement the org.hibernate.usertype.ParameterizedType interface. To supply parameters to your custom type, you can use the <type> element in your mapping files." msgstr "" +#. Tag: programlisting +#: basic_mapping.xml:4250 +#, no-c-format +msgid "" + "<property name=\"priority\">\n" + " <type name=\"com.mycompany.usertypes.DefaultValueIntegerType\">\n" + " <param name=\"default\">0</param>\n" + " </type>\n" + "</property>" +msgstr "" + #. Tag: para +#: basic_mapping.xml:4252 #, no-c-format msgid "The UserType can now retrieve the value for the parameter named default from the Properties object passed to it." msgstr "" #. Tag: para +#: basic_mapping.xml:4256 #, no-c-format msgid "If you regularly use a certain UserType, it is useful to define a shorter name for it. You can do this using the <typedef> element. Typedefs assign a name to a custom type, and can also contain a list of default parameter values if the type is parameterized." msgstr "" +#. Tag: programlisting +#: basic_mapping.xml:4262 +#, no-c-format +msgid "" + "<typedef class=\"com.mycompany.usertypes.DefaultValueIntegerType\" name=\"default_zero\">\n" + " <param name=\"default\">0</param>\n" + "</typedef>" +msgstr "" + +#. Tag: programlisting +#: basic_mapping.xml:4264 +#, no-c-format +msgid "<property name=\"priority\" type=\"default_zero\"/>" +msgstr "" + #. Tag: para +#: basic_mapping.xml:4266 #, no-c-format msgid "It is also possible to override the parameters supplied in a typedef on a case-by-case basis by using type parameters on the property mapping." msgstr "" #. Tag: para +#: basic_mapping.xml:4270 #, no-c-format msgid "Even though Hibernate's rich range of built-in types and support for components means you will rarely need to use a custom type, it is considered good practice to use custom types for non-entity classes that occur frequently in your application. For example, a MonetaryAmount class is a good candidate for a CompositeUserType, even though it could be mapped as a component. One reason for this is abstraction. With a custom type, your mapping documents would be protected against changes to the way monetary values are represented." msgstr "" #. Tag: title +#: basic_mapping.xml:4283 #, no-c-format msgid "Mapping a class more than once" msgstr "" #. Tag: para +#: basic_mapping.xml:4285 #, no-c-format msgid "It is possible to provide more than one mapping for a particular persistent class. In this case, you must specify an entity name to disambiguate between instances of the two mapped entities. By default, the entity name is the same as the class name. Hibernate lets you specify the entity name when working with persistent objects, when writing queries, or when mapping associations to the named entity." msgstr "" +#. Tag: programlisting +#: basic_mapping.xml:4293 +#, no-c-format +msgid "" + "<class name=\"Contract\" table=\"Contracts\"\n" + " entity-name=\"CurrentContract\">\n" + " ...\n" + " <set name=\"history\" inverse=\"true\"\n" + " order-by=\"effectiveEndDate desc\">\n" + " <key column=\"currentContractId\"/>\n" + " <one-to-many entity-name=\"HistoricalContract\"/>\n" + " </set>\n" + "</class>\n" + "\n" + "<class name=\"Contract\" table=\"ContractHistory\"\n" + " entity-name=\"HistoricalContract\">\n" + " ...\n" + " <many-to-one name=\"currentContract\"\n" + " column=\"currentContractId\"\n" + " entity-name=\"CurrentContract\"/>\n" + "</class>" +msgstr "" + #. Tag: para +#: basic_mapping.xml:4295 #, no-c-format msgid "Associations are now specified using entity-name instead of class." msgstr "" +#. Tag: para +#: basic_mapping.xml:4299 basic_mapping.xml:4379 basic_mapping.xml:4414 +#, no-c-format +msgid "This feature is not supported in Annotations" +msgstr "" + #. Tag: title +#: basic_mapping.xml:4304 #, no-c-format msgid "SQL quoted identifiers" msgstr "" #. Tag: para +#: basic_mapping.xml:4306 #, no-c-format msgid "You can force Hibernate to quote an identifier in the generated SQL by enclosing the table or column name in backticks in the mapping document. Hibernate will use the correct quotation style for the SQL Dialect. This is usually double quotes, but the SQL Server uses brackets and MySQL uses backticks." msgstr "" -#. Tag: title +#. Tag: programlisting +#: basic_mapping.xml:4312 #, no-c-format -msgid "Metadata alternatives" -msgstr "" - -#. Tag: para -#, no-c-format -msgid "XML does not suit all users so there are some alternative ways to define O/R mapping metadata in Hibernate." -msgstr "" - -#. Tag: title -#, no-c-format -msgid "Using XDoclet markup" -msgstr "" - -#. Tag: para -#, no-c-format -msgid "Many Hibernate users prefer to embed mapping information directly in sourcecode using XDoclet @hibernate.tags. We do not cover this approach in this reference guide since it is considered part of XDoclet. However, we include the following example of the Cat class with XDoclet mappings:" -msgstr "" - -#. Tag: para -#, no-c-format -msgid "See the Hibernate website for more examples of XDoclet and Hibernate." -msgstr "" - -#. Tag: title -#, no-c-format -msgid "Using JDK 5.0 Annotations" -msgstr "" - -#. Tag: para -#, no-c-format -msgid "JDK 5.0 introduced XDoclet-style annotations at the language level that are type-safe and checked at compile time. This mechanism is more powerful than XDoclet annotations and better supported by tools and IDEs. IntelliJ IDEA, for example, supports auto-completion and syntax highlighting of JDK 5.0 annotations. The new revision of the EJB specification (JSR-220) uses JDK 5.0 annotations as the primary metadata mechanism for entity beans. Hibernate3 implements the EntityManager of JSR-220 (the persistence API). Support for mapping metadata is available via the Hibernate Annotations package as a separate download. Both EJB3 (JSR-220) and Hibernate3 metadata is supported." -msgstr "" - -#. Tag: para -#, no-c-format -msgid "This is an example of a POJO class annotated as an EJB entity bean:" -msgstr "" - -#. Tag: para -#, no-c-format -msgid "Support for JDK 5.0 Annotations (and JSR-220) is currently under development. Please refer to the Hibernate Annotations module for more details." +msgid "" + "@Entity @Table(name=\"`Line Item`\")\n" + "class LineItem {\n" + " @id @Column(name=\"`Item Id`\") Integer id;\n" + " @Column(name=\"`Item #`\") int itemNumber\n" + "}\n" + "\n" + "<class name=\"LineItem\" table=\"`Line Item`\">\n" + " <id name=\"id\" column=\"`Item Id`\"/><generator class=\"assigned\"/></id>\n" + " <property name=\"itemNumber\" column=\"`Item #`\"/>\n" + " ...\n" + "</class>" msgstr "" #. Tag: title +#: basic_mapping.xml:4316 #, no-c-format msgid "Generated properties" msgstr "" #. Tag: para +#: basic_mapping.xml:4318 #, no-c-format msgid "Generated properties are properties that have their values generated by the database. Typically, Hibernate applications needed to refresh objects that contain any properties for which the database was generating values. Marking properties as generated, however, lets the application delegate this responsibility to Hibernate. When Hibernate issues an SQL INSERT or UPDATE for an entity that has defined generated properties, it immediately issues a select afterwards to retrieve the generated values." msgstr "" #. Tag: para +#: basic_mapping.xml:4327 #, no-c-format msgid "Properties marked as generated must additionally be non-insertable and non-updateable. Only versions, timestamps, and simple properties, can be marked as generated." msgstr "" #. Tag: para +#: basic_mapping.xml:4334 #, no-c-format msgid "never (the default): the given property value is not generated within the database." msgstr "" #. Tag: para +#: basic_mapping.xml:4337 #, no-c-format msgid "insert: the given property value is generated on insert, but is not regenerated on subsequent updates. Properties like created-date fall into this category. Even though version and timestamp properties can be marked as generated, this option is not available." msgstr "" #. Tag: para +#: basic_mapping.xml:4344 #, no-c-format msgid "always: the property value is generated both on insert and on update." msgstr "" +#. Tag: para +#: basic_mapping.xml:4347 +#, no-c-format +msgid "To mark a property as generated, use @Generated." +msgstr "" + #. Tag: title +#: basic_mapping.xml:4352 #, no-c-format msgid "Column read and write expressions" msgstr "" #. Tag: para +#: basic_mapping.xml:4354 #, no-c-format -msgid "Hibernate allows you to customize the SQL it uses to read and write the values of columns mapped to simple properties. For example, if your database provides a set of data encryption functions, you can invoke them for individual columns like this: <property name=\"creditCardNumber\"> <column name=\"credit_card_num\" read=\"decrypt(credit_card_num)\" write=\"encrypt(?)\"/> </property>" +msgid "Hibernate allows you to customize the SQL it uses to read and write the values of columns mapped to simple properties. For example, if your database provides a set of data encryption functions, you can invoke them for individual columns like this:" +msgstr "" + +#. Tag: programlisting +#: basic_mapping.xml:4359 +#, no-c-format +msgid "" + "<property name=\"creditCardNumber\">\n" + " <column \n" + " name=\"credit_card_num\"\n" + " read=\"decrypt(credit_card_num)\"\n" + " write=\"encrypt(?)\"/>\n" + "</property>" msgstr "" #. Tag: para +#: basic_mapping.xml:4361 #, no-c-format msgid "Hibernate applies the custom expressions automatically whenever the property is referenced in a query. This functionality is similar to a derived-property formula with two differences:" msgstr "" #. Tag: para +#: basic_mapping.xml:4366 #, no-c-format msgid "The property is backed by one or more columns that are exported as part of automatic schema generation." msgstr "" #. Tag: para +#: basic_mapping.xml:4371 #, no-c-format msgid "The property is read-write, not read-only." msgstr "" #. Tag: para +#: basic_mapping.xml:4375 #, no-c-format msgid "The write expression, if specified, must contain exactly one '?' placeholder for the value." msgstr "" #. Tag: title +#: basic_mapping.xml:4384 #, no-c-format msgid "Auxiliary database objects" msgstr "" #. Tag: para +#: basic_mapping.xml:4386 #, no-c-format msgid "Auxiliary database objects allow for the CREATE and DROP of arbitrary database objects. In conjunction with Hibernate's schema evolution tools, they have the ability to fully define a user schema within the Hibernate mapping files. Although designed specifically for creating and dropping things like triggers or stored procedures, any SQL command that can be run via a java.sql.Statement.execute() method is valid (for example, ALTERs, INSERTS, etc.). There are essentially two modes for defining auxiliary database objects:" msgstr "" #. Tag: para +#: basic_mapping.xml:4396 #, no-c-format msgid "The first mode is to explicitly list the CREATE and DROP commands in the mapping file:" msgstr "" +#. Tag: programlisting +#: basic_mapping.xml:4399 +#, no-c-format +msgid "" + "<hibernate-mapping>\n" + " ...\n" + " <database-object>\n" + " <create>CREATE TRIGGER my_trigger ...</create>\n" + " <drop>DROP TRIGGER my_trigger</drop>\n" + " </database-object>\n" + "</hibernate-mapping>" +msgstr "" + #. Tag: para +#: basic_mapping.xml:4401 #, no-c-format msgid "The second mode is to supply a custom class that constructs the CREATE and DROP commands. This custom class must implement the org.hibernate.mapping.AuxiliaryDatabaseObject interface." msgstr "" +#. Tag: programlisting +#: basic_mapping.xml:4406 +#, no-c-format +msgid "" + "<hibernate-mapping>\n" + " ...\n" + " <database-object>\n" + " <definition class=\"MyTriggerDefinition\"/>\n" + " </database-object>\n" + "</hibernate-mapping>" +msgstr "" + #. Tag: para +#: basic_mapping.xml:4408 #, no-c-format msgid "Additionally, these database objects can be optionally scoped so that they only apply when certain dialects are used." msgstr "" +#. Tag: programlisting +#: basic_mapping.xml:4411 +#, no-c-format +msgid "" + "<hibernate-mapping>\n" + " ...\n" + " <database-object>\n" + " <definition class=\"MyTriggerDefinition\"/>\n" + " <dialect-scope name=\"org.hibernate.dialect.Oracle9iDialect\"/>\n" + " <dialect-scope name=\"org.hibernate.dialect.Oracle10gDialect\"/>\n" + " </database-object>\n" + "</hibernate-mapping>" +msgstr "" + diff --git a/documentation/manual/src/main/docbook/pot/content/collection_mapping.pot b/documentation/manual/src/main/docbook/pot/content/collection_mapping.pot index 4e78f5144f..4a7cb53760 100644 --- a/documentation/manual/src/main/docbook/pot/content/collection_mapping.pot +++ b/documentation/manual/src/main/docbook/pot/content/collection_mapping.pot @@ -1,624 +1,2165 @@ -# -# AUTHOR , YEAR. +# SOME DESCRIPTIVE TITLE. +# FIRST AUTHOR , YEAR. # +#, fuzzy msgid "" msgstr "" -"Project-Id-Version: 0\n" -"POT-Creation-Date: 2010-02-11T05:38:15\n" -"PO-Revision-Date: 2010-02-11T05:38:15\n" -"Last-Translator: Automatically generated\n" -"Language-Team: None\n" +"Project-Id-Version: PACKAGE VERSION\n" +"Report-Msgid-Bugs-To: http://bugs.kde.org\n" +"POT-Creation-Date: 2010-07-20 21:02+0000\n" +"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" +"Last-Translator: FULL NAME \n" +"Language-Team: LANGUAGE \n" "MIME-Version: 1.0\n" -"Content-Type: application/x-publican; charset=UTF-8\n" +"Content-Type: application/x-xml2pot; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" #. Tag: title +#: collection_mapping.xml:31 #, no-c-format msgid "Collection mapping" msgstr "" #. Tag: title +#: collection_mapping.xml:34 #, no-c-format msgid "Persistent collections" msgstr "" #. Tag: para +#: collection_mapping.xml:36 #, no-c-format -msgid "Hibernate requires that persistent collection-valued fields be declared as an interface type. For example:" +msgid "Naturally Hibernate also allows to persist collections. These persistent collections can contain almost any other Hibernate type, including: basic types, custom types, components and references to other entities. The distinction between value and reference semantics is in this context very important. An object in a collection might be handled with \"value\" semantics (its life cycle fully depends on the collection owner), or it might be a reference to another entity with its own life cycle. In the latter case, only the \"link\" between the two objects is considered to be a state held by the collection." msgstr "" #. Tag: para +#: collection_mapping.xml:46 #, no-c-format -msgid "The actual interface might be java.util.Set, java.util.Collection, java.util.List, java.util.Map, java.util.SortedSet, java.util.SortedMap or anything you like (\"anything you like\" means you will have to write an implementation of org.hibernate.usertype.UserCollectionType.)" +msgid "As a requirement persistent collection-valued fields must be declared as an interface type (see ). The actual interface might be java.util.Set, java.util.Collection, java.util.List, java.util.Map, java.util.SortedSet, java.util.SortedMap or anything you like (\"anything you like\" means you will have to write an implementation of org.hibernate.usertype.UserCollectionType)." msgstr "" #. Tag: para +#: collection_mapping.xml:57 #, no-c-format -msgid "Notice how the instance variable was initialized with an instance of HashSet. This is the best way to initialize collection valued properties of newly instantiated (non-persistent) instances. When you make the instance persistent, by calling persist() for example, Hibernate will actually replace the HashSet with an instance of Hibernate's own implementation of Set. Be aware of the following errors:" +msgid "Notice how in the instance variable parts was initialized with an instance of HashSet. This is the best way to initialize collection valued properties of newly instantiated (non-persistent) instances. When you make the instance persistent, by calling persist(), Hibernate will actually replace the HashSet with an instance of Hibernate's own implementation of Set. Be aware of the following error:" +msgstr "" + +#. Tag: title +#: collection_mapping.xml:68 +#, no-c-format +msgid "Hibernate uses its own collection implementations" +msgstr "" + +#. Tag: programlisting +#: collection_mapping.xml:70 +#, no-c-format +msgid "" + "Cat cat = new DomesticCat();\n" + "Cat kitten = new DomesticCat();\n" + "....\n" + "Set kittens = new HashSet();\n" + "kittens.add(kitten);\n" + "cat.setKittens(kittens);\n" + "session.persist(cat);\n" + "\n" + "kittens = cat.getKittens(); // Okay, kittens collection is a Set\n" + "(HashSet) cat.getKittens(); // Error!" msgstr "" #. Tag: para +#: collection_mapping.xml:73 #, no-c-format msgid "The persistent collections injected by Hibernate behave like HashMap, HashSet, TreeMap, TreeSet or ArrayList, depending on the interface type." msgstr "" #. Tag: para +#: collection_mapping.xml:78 #, no-c-format msgid "Collections instances have the usual behavior of value types. They are automatically persisted when referenced by a persistent object and are automatically deleted when unreferenced. If a collection is passed from one persistent object to another, its elements might be moved from one table to another. Two entities cannot share a reference to the same collection instance. Due to the underlying relational model, collection-valued properties do not support null value semantics. Hibernate does not distinguish between a null collection reference and an empty collection." msgstr "" #. Tag: para +#: collection_mapping.xml:89 #, no-c-format -msgid "Use persistent collections the same way you use ordinary Java collections. However, please ensure you understand the semantics of bidirectional associations (these are discussed later)." +msgid "Use persistent collections the same way you use ordinary Java collections. However, ensure you understand the semantics of bidirectional associations (see )." msgstr "" #. Tag: title +#: collection_mapping.xml:97 #, no-c-format -msgid "Collection mappings" +msgid "How to map collections" msgstr "" #. Tag: para +#: collection_mapping.xml:99 #, no-c-format -msgid "There are quite a range of mappings that can be generated for collections that cover many common relational models. We suggest you experiment with the schema generation tool so that you understand how various mapping declarations translate to database tables." -msgstr "" - -#. Tag: para -#, no-c-format -msgid "The Hibernate mapping element used for mapping a collection depends upon the type of interface. For example, a <set> element is used for mapping properties of type Set." -msgstr "" - -#. Tag: para -#, no-c-format -msgid "Apart from <set>, there is also <list>, <map>, <bag>, <array> and <primitive-array> mapping elements. The <map> element is representative:" -msgstr "" - -#. Tag: para -#, no-c-format -msgid "name: the collection property name" -msgstr "" - -#. Tag: para -#, no-c-format -msgid "table (optional - defaults to property name): the name of the collection table. It is not used for one-to-many associations." -msgstr "" - -#. Tag: para -#, no-c-format -msgid "schema (optional): the name of a table schema to override the schema declared on the root element" -msgstr "" - -#. Tag: para -#, no-c-format -msgid "lazy (optional - defaults to true): disables lazy fetching and specifies that the association is always eagerly fetched. It can also be used to enable \"extra-lazy\" fetching where most operations do not initialize the collection. This is suitable for large collections." -msgstr "" - -#. Tag: para -#, no-c-format -msgid "inverse (optional - defaults to false): marks this collection as the \"inverse\" end of a bidirectional association." -msgstr "" - -#. Tag: para -#, no-c-format -msgid "cascade (optional - defaults to none): enables operations to cascade to child entities." -msgstr "" - -#. Tag: para -#, no-c-format -msgid "sort (optional): specifies a sorted collection with natural sort order or a given comparator class." -msgstr "" - -#. Tag: para -#, no-c-format -msgid "order-by (optional, JDK1.4 only): specifies a table column or columns that define the iteration order of the Map, Set or bag, together with an optional asc or desc." -msgstr "" - -#. Tag: para -#, no-c-format -msgid "where (optional): specifies an arbitrary SQL WHERE condition that is used when retrieving or removing the collection. This is useful if the collection needs to contain only a subset of the available data." -msgstr "" - -#. Tag: para -#, no-c-format -msgid "fetch (optional, defaults to select): chooses between outer-join fetching, fetching by sequential select, and fetching by sequential subselect." -msgstr "" - -#. Tag: para -#, no-c-format -msgid "batch-size (optional, defaults to 1): specifies a \"batch size\" for lazily fetching instances of this collection." -msgstr "" - -#. Tag: para -#, no-c-format -msgid "access (optional - defaults to property): the strategy Hibernate uses for accessing the collection property value." -msgstr "" - -#. Tag: para -#, no-c-format -msgid "optimistic-lock (optional - defaults to true): specifies that changes to the state of the collection results in increments of the owning entity's version. For one-to-many associations you may want to disable this setting." -msgstr "" - -#. Tag: para -#, no-c-format -msgid "mutable (optional - defaults to true): a value of false specifies that the elements of the collection never change. This allows for minor performance optimization in some cases." +msgid "Using annotations you can map Collections, Lists, Maps and Sets of associated entities using @OneToMany and @ManyToMany. For collections of a basic or embeddable type use @ElementCollection. In the simplest case a collection mapping looks like this:" msgstr "" #. Tag: title +#: collection_mapping.xml:107 #, no-c-format -msgid "Collection foreign keys" +msgid "Collection mapping using @OneToMany and @JoinColumn" +msgstr "" + +#. Tag: programlisting +#: collection_mapping.xml:109 +#, no-c-format +msgid "" + "@Entity\n" + "public class Product {\n" + "\n" + " private String serialNumber;\n" + " private Set<Part> parts = new HashSet<Part>();\n" + "\n" + " @Id\n" + " public String getSerialNumber() { return serialNumber; }\n" + " void setSerialNumber(String sn) { serialNumber = sn; }\n" + " \n" + " @OneToMany\n" + " @JoinColumn(name=\"PART_ID\")\n" + " public Set<Part> getParts() { return parts; }\n" + " void setParts(Set parts) { this.parts = parts; }\n" + "}\n" + "\n" + "\n" + "@Entity\n" + "public class Part {\n" + " ...\n" + "}" msgstr "" #. Tag: para +#: collection_mapping.xml:112 #, no-c-format -msgid "Collection instances are distinguished in the database by the foreign key of the entity that owns the collection. This foreign key is referred to as the collection key column, or columns, of the collection table. The collection key column is mapped by the <key> element." -msgstr "" - -#. Tag: para -#, no-c-format -msgid "There can be a nullability constraint on the foreign key column. For most collections, this is implied. For unidirectional one-to-many associations, the foreign key column is nullable by default, so you may need to specify not-null=\"true\"." -msgstr "" - -#. Tag: para -#, no-c-format -msgid "The foreign key constraint can use ON DELETE CASCADE." -msgstr "" - -#. Tag: para -#, no-c-format -msgid "See the previous chapter for a full definition of the <key> element." +msgid "Product describes a unidirectional relationship with Part using the join column PART_ID. In this unidirectional one to many scenario you can also use a join table as seen in ." msgstr "" #. Tag: title +#: collection_mapping.xml:118 #, no-c-format -msgid "Collection elements" +msgid "Collection mapping using @OneToMany and @JoinTable" +msgstr "" + +#. Tag: programlisting +#: collection_mapping.xml:121 +#, no-c-format +msgid "" + "@Entity\n" + "public class Product {\n" + "\n" + " private String serialNumber;\n" + " private Set<Part> parts = new HashSet<Part>();\n" + "\n" + " @Id\n" + " public String getSerialNumber() { return serialNumber; }\n" + " void setSerialNumber(String sn) { serialNumber = sn; }\n" + " \n" + " @OneToMany\n" + " @JoinTable(\n" + " name=\"PRODUCT_PARTS\",\n" + " joinColumns = @JoinColumn( name=\"PRODUCT_ID\"),\n" + " inverseJoinColumns = @JoinColumn( name=\"PART_ID\")\n" + " )\n" + " public Set<Part> getParts() { return parts; }\n" + " void setParts(Set parts) { this.parts = parts; }\n" + "}\n" + "\n" + "\n" + "@Entity\n" + "public class Part {\n" + " ...\n" + "}" msgstr "" #. Tag: para +#: collection_mapping.xml:124 #, no-c-format -msgid "Collections can contain almost any other Hibernate type, including: basic types, custom types, components and references to other entities. This is an important distinction. An object in a collection might be handled with \"value\" semantics (its life cycle fully depends on the collection owner), or it might be a reference to another entity with its own life cycle. In the latter case, only the \"link\" between the two objects is considered to be a state held by the collection." +msgid "Without describing any physical mapping (no @JoinColumn or @JoinTable), a unidirectional one to many with join table is used. The table name is the concatenation of the owner table name, _, and the other side table name. The foreign key name(s) referencing the owner table is the concatenation of the owner table, _, and the owner primary key column(s) name. The foreign key name(s) referencing the other side is the concatenation of the owner property name, _, and the other side primary key column(s) name. A unique constraint is added to the foreign key referencing the other side table to reflect the one to many." msgstr "" #. Tag: para +#: collection_mapping.xml:135 #, no-c-format -msgid "The contained type is referred to as the collection element type. Collection elements are mapped by <element> or <composite-element>, or in the case of entity references, with <one-to-many> or <many-to-many>. The first two map elements with value semantics, the next two are used to map entity associations." +msgid "Lets have a look now how collections are mapped using Hibernate mapping files. In this case the first step is to chose the right mapping element. It depends on the type of interface. For example, a <set> element is used for mapping properties of type Set." msgstr "" #. Tag: title +#: collection_mapping.xml:142 #, no-c-format -msgid "Indexed collections" +msgid "Mapping a Set using <set>" +msgstr "" + +#. Tag: programlisting +#: collection_mapping.xml:144 +#, no-c-format +msgid "" + "<class name=\"Product\">\n" + " <id name=\"serialNumber\" column=\"productSerialNumber\"/>\n" + " <set name=\"parts\">\n" + " <key column=\"productSerialNumber\" not-null=\"true\"/>\n" + " <one-to-many class=\"Part\"/>\n" + " </set>\n" + "</class>" msgstr "" #. Tag: para +#: collection_mapping.xml:147 #, no-c-format -msgid "All collection mappings, except those with set and bag semantics, need an index column in the collection table. An index column is a column that maps to an array index, or List index, or Map key. The index of a Map may be of any basic type, mapped with <map-key>. It can be an entity reference mapped with <map-key-many-to-many>, or it can be a composite type mapped with <composite-map-key>. The index of an array or list is always of type integer and is mapped using the <list-index> element. The mapped column contains sequential integers that are numbered from zero by default." -msgstr "" - -#. Tag: para -#, no-c-format -msgid "column_name (required): the name of the column holding the collection index values." -msgstr "" - -#. Tag: para -#, no-c-format -msgid "base (optional - defaults to 0): the value of the index column that corresponds to the first element of the list or array." -msgstr "" - -#. Tag: para -#, no-c-format -msgid "column (optional): the name of the column holding the collection index values." -msgstr "" - -#. Tag: para -#, no-c-format -msgid "formula (optional): a SQL formula used to evaluate the key of the map." -msgstr "" - -#. Tag: para -#, no-c-format -msgid "type (required): the type of the map keys." -msgstr "" - -#. Tag: para -#, no-c-format -msgid "column (optional): the name of the foreign key column for the collection index values." -msgstr "" - -#. Tag: para -#, no-c-format -msgid "formula (optional): a SQ formula used to evaluate the foreign key of the map key." -msgstr "" - -#. Tag: para -#, no-c-format -msgid "class (required): the entity class used as the map key." -msgstr "" - -#. Tag: para -#, no-c-format -msgid "If your table does not have an index column, and you still wish to use List as the property type, you can map the property as a Hibernate <bag>. A bag does not retain its order when it is retrieved from the database, but it can be optionally sorted or ordered." -msgstr "" - -#. Tag: title -#, no-c-format -msgid "Collections of values and many-to-many associations" -msgstr "" - -#. Tag: para -#, no-c-format -msgid "Any collection of values or many-to-many associations requires a dedicated collection table with a foreign key column or columns, collection element column or columns, and possibly an index column or columns." -msgstr "" - -#. Tag: para -#, no-c-format -msgid "For a collection of values use the <element> tag. For example:" -msgstr "" - -#. Tag: para -#, no-c-format -msgid "column (optional): the name of the column holding the collection element values." -msgstr "" - -#. Tag: para -#, no-c-format -msgid "formula (optional): an SQL formula used to evaluate the element." -msgstr "" - -#. Tag: para -#, no-c-format -msgid "type (required): the type of the collection element." -msgstr "" - -#. Tag: para -#, no-c-format -msgid "A many-to-many association is specified using the <many-to-many> element." -msgstr "" - -#. Tag: para -#, no-c-format -msgid "column (optional): the name of the element foreign key column." -msgstr "" - -#. Tag: para -#, no-c-format -msgid "formula (optional): an SQL formula used to evaluate the element foreign key value." -msgstr "" - -#. Tag: para -#, no-c-format -msgid "class (required): the name of the associated class." -msgstr "" - -#. Tag: para -#, no-c-format -msgid "fetch (optional - defaults to join): enables outer-join or sequential select fetching for this association. This is a special case; for full eager fetching in a single SELECT of an entity and its many-to-many relationships to other entities, you would enable join fetching,not only of the collection itself, but also with this attribute on the <many-to-many> nested element." -msgstr "" - -#. Tag: para -#, no-c-format -msgid "unique (optional): enables the DDL generation of a unique constraint for the foreign-key column. This makes the association multiplicity effectively one-to-many." -msgstr "" - -#. Tag: para -#, no-c-format -msgid "not-found (optional - defaults to exception): specifies how foreign keys that reference missing rows will be handled: ignore will treat a missing row as a null association." -msgstr "" - -#. Tag: para -#, no-c-format -msgid "entity-name (optional): the entity name of the associated class, as an alternative to class." -msgstr "" - -#. Tag: para -#, no-c-format -msgid "property-ref (optional): the name of a property of the associated class that is joined to this foreign key. If not specified, the primary key of the associated class is used." -msgstr "" - -#. Tag: para -#, no-c-format -msgid "Here are some examples." -msgstr "" - -#. Tag: para -#, no-c-format -msgid "A set of strings:" -msgstr "" - -#. Tag: para -#, no-c-format -msgid "A bag containing integers with an iteration order determined by the order-by attribute:" -msgstr "" - -#. Tag: para -#, no-c-format -msgid "An array of entities, in this case, a many-to-many association:" -msgstr "" - -#. Tag: para -#, no-c-format -msgid "A map from string indices to dates:" -msgstr "" - -#. Tag: para -#, no-c-format -msgid "A list of components (this is discussed in the next chapter):" -msgstr "" - -#. Tag: title -#, no-c-format -msgid "One-to-many associations" -msgstr "" - -#. Tag: para -#, no-c-format -msgid "A one-to-many association links the tables of two classes via a foreign key with no intervening collection table. This mapping loses certain semantics of normal Java collections:" +msgid "In a one-to-many association links the Product and Part entities. This association requires the existence of a foreign key column and possibly an index column to the Part table. This mapping loses certain semantics of normal Java collections:" msgstr "" #. Tag: para +#: collection_mapping.xml:156 #, no-c-format msgid "An instance of the contained entity class cannot belong to more than one instance of the collection." msgstr "" #. Tag: para +#: collection_mapping.xml:161 #, no-c-format msgid "An instance of the contained entity class cannot appear at more than one value of the collection index." msgstr "" #. Tag: para +#: collection_mapping.xml:166 #, no-c-format -msgid "An association from Product to Part requires the existence of a foreign key column and possibly an index column to the Part table. A <one-to-many> tag indicates that this is a one-to-many association." +msgid "Looking closer at the used <one-to-many> tag we see that it has the following options." +msgstr "" + +#. Tag: title +#: collection_mapping.xml:170 +#, no-c-format +msgid "options of <one-to-many> element" +msgstr "" + +#. Tag: programlisting +#: collection_mapping.xml:181 +#, no-c-format +msgid "" + "<one-to-many\n" + " class=\"ClassName\"\n" + " not-found=\"ignore|exception\"\n" + " entity-name=\"EntityName\"\n" + " node=\"element-name\"\n" + " embed-xml=\"true|false\"\n" + " />" msgstr "" #. Tag: para +#: collection_mapping.xml:185 +#, no-c-format +msgid "class (required): the name of the associated class." +msgstr "" + +#. Tag: para +#: collection_mapping.xml:190 #, no-c-format msgid "not-found (optional - defaults to exception): specifies how cached identifiers that reference missing rows will be handled. ignore will treat a missing row as a null association." msgstr "" #. Tag: para +#: collection_mapping.xml:198 +#, no-c-format +msgid "entity-name (optional): the entity name of the associated class, as an alternative to class." +msgstr "" + +#. Tag: para +#: collection_mapping.xml:206 #, no-c-format msgid "The <one-to-many> element does not need to declare any columns. Nor is it necessary to specify the table name anywhere." msgstr "" #. Tag: para +#: collection_mapping.xml:211 #, no-c-format -msgid "If the foreign key column of a <one-to-many> association is declared NOT NULL, you must declare the <key> mapping not-null=\"true\" or use a bidirectional association with the collection mapping marked inverse=\"true\". See the discussion of bidirectional associations later in this chapter for more information." +msgid "If the foreign key column of a <one-to-many> association is declared NOT NULL, you must declare the <key> mapping not-null=\"true\" or use a bidirectional association with the collection mapping marked inverse=\"true\". See ." msgstr "" #. Tag: para +#: collection_mapping.xml:221 #, no-c-format -msgid "The following example shows a map of Part entities by name, where partName is a persistent property of Part. Notice the use of a formula-based index:" +msgid "Apart from the <set> tag as shown in , there is also <list>, <map>, <bag>, <array> and <primitive-array> mapping elements. The <map> element is representative:" msgstr "" #. Tag: title +#: collection_mapping.xml:229 +#, no-c-format +msgid "Elements of the <map> mapping" +msgstr "" + +#. Tag: programlisting +#: collection_mapping.xml:262 +#, no-c-format +msgid "" + "<map\n" + " name=\"propertyName\"\n" + " table=\"table_name\"\n" + " schema=\"schema_name\"\n" + " lazy=\"true|extra|false\"\n" + " inverse=\"true|false\"\n" + " cascade=\"all|none|save-update|delete|all-delete-orphan|delete-orphan\"\n" + " sort=\"unsorted|natural|comparatorClass\"\n" + " order-by=\"column_name asc|desc\"\n" + " where=\"arbitrary sql where condition\"\n" + " fetch=\"join|select|subselect\"\n" + " batch-size=\"N\"\n" + " access=\"field|property|ClassName\"\n" + " optimistic-lock=\"true|false\"\n" + " mutable=\"true|false\"\n" + " node=\"element-name|.\"\n" + " embed-xml=\"true|false\"\n" + ">\n" + "\n" + " <key .... />\n" + " <map-key .... />\n" + " <element .... />\n" + "</map>" +msgstr "" + +#. Tag: para +#: collection_mapping.xml:266 +#, no-c-format +msgid "name: the collection property name" +msgstr "" + +#. Tag: para +#: collection_mapping.xml:270 +#, no-c-format +msgid "table (optional - defaults to property name): the name of the collection table. It is not used for one-to-many associations." +msgstr "" + +#. Tag: para +#: collection_mapping.xml:276 +#, no-c-format +msgid "schema (optional): the name of a table schema to override the schema declared on the root element" +msgstr "" + +#. Tag: para +#: collection_mapping.xml:281 +#, no-c-format +msgid "lazy (optional - defaults to true): disables lazy fetching and specifies that the association is always eagerly fetched. It can also be used to enable \"extra-lazy\" fetching where most operations do not initialize the collection. This is suitable for large collections." +msgstr "" + +#. Tag: para +#: collection_mapping.xml:290 +#, no-c-format +msgid "inverse (optional - defaults to false): marks this collection as the \"inverse\" end of a bidirectional association." +msgstr "" + +#. Tag: para +#: collection_mapping.xml:296 +#, no-c-format +msgid "cascade (optional - defaults to none): enables operations to cascade to child entities." +msgstr "" + +#. Tag: para +#: collection_mapping.xml:302 +#, no-c-format +msgid "sort (optional): specifies a sorted collection with natural sort order or a given comparator class." +msgstr "" + +#. Tag: para +#: collection_mapping.xml:308 +#, no-c-format +msgid "order-by (optional): specifies a table column or columns that define the iteration order of the Map, Set or bag, together with an optional asc or desc." +msgstr "" + +#. Tag: para +#: collection_mapping.xml:316 +#, no-c-format +msgid "where (optional): specifies an arbitrary SQL WHERE condition that is used when retrieving or removing the collection. This is useful if the collection needs to contain only a subset of the available data." +msgstr "" + +#. Tag: para +#: collection_mapping.xml:324 +#, no-c-format +msgid "fetch (optional, defaults to select): chooses between outer-join fetching, fetching by sequential select, and fetching by sequential subselect." +msgstr "" + +#. Tag: para +#: collection_mapping.xml:331 +#, no-c-format +msgid "batch-size (optional, defaults to 1): specifies a \"batch size\" for lazily fetching instances of this collection." +msgstr "" + +#. Tag: para +#: collection_mapping.xml:337 +#, no-c-format +msgid "access (optional - defaults to property): the strategy Hibernate uses for accessing the collection property value." +msgstr "" + +#. Tag: para +#: collection_mapping.xml:343 +#, no-c-format +msgid "optimistic-lock (optional - defaults to true): specifies that changes to the state of the collection results in increments of the owning entity's version. For one-to-many associations you may want to disable this setting." +msgstr "" + +#. Tag: para +#: collection_mapping.xml:351 +#, no-c-format +msgid "mutable (optional - defaults to true): a value of false specifies that the elements of the collection never change. This allows for minor performance optimization in some cases." +msgstr "" + +#. Tag: para +#: collection_mapping.xml:360 +#, no-c-format +msgid "After exploring the basic mapping of collections in the preceding paragraphs we will now focus details like physical mapping considerations, indexed collections and collections of value types." +msgstr "" + +#. Tag: title +#: collection_mapping.xml:365 +#, no-c-format +msgid "Collection foreign keys" +msgstr "" + +#. Tag: para +#: collection_mapping.xml:367 +#, no-c-format +msgid "On the database level collection instances are distinguished by the foreign key of the entity that owns the collection. This foreign key is referred to as the collection key column, or columns, of the collection table. The collection key column is mapped by the @JoinColumn annotation respectively the <key> XML element." +msgstr "" + +#. Tag: para +#: collection_mapping.xml:374 +#, no-c-format +msgid "There can be a nullability constraint on the foreign key column. For most collections, this is implied. For unidirectional one-to-many associations, the foreign key column is nullable by default, so you may need to specify" +msgstr "" + +#. Tag: programlisting +#: collection_mapping.xml:379 +#, no-c-format +msgid "@JoinColumn(nullable=false)" +msgstr "" + +#. Tag: para +#: collection_mapping.xml:381 +#, no-c-format +msgid "or" +msgstr "" + +#. Tag: programlisting +#: collection_mapping.xml:383 +#, no-c-format +msgid "<key column=\"productSerialNumber\" not-null=\"true\"/>" +msgstr "" + +#. Tag: para +#: collection_mapping.xml:385 +#, no-c-format +msgid "The foreign key constraint can use ON DELETE CASCADE. In XML this can be expressed via:" +msgstr "" + +#. Tag: programlisting +#: collection_mapping.xml:388 +#, no-c-format +msgid "<key column=\"productSerialNumber\" on-delete=\"cascade\"/>" +msgstr "" + +#. Tag: para +#: collection_mapping.xml:390 +#, no-c-format +msgid "In annotations the Hibernate specific annotation @OnDelete has to be used." +msgstr "" + +#. Tag: programlisting +#: collection_mapping.xml:393 +#, no-c-format +msgid "@OnDelete(action=OnDeleteAction.CASCADE)" +msgstr "" + +#. Tag: para +#: collection_mapping.xml:395 +#, no-c-format +msgid "See for more information about the <key> element." +msgstr "" + +#. Tag: title +#: collection_mapping.xml:400 +#, no-c-format +msgid "Indexed collections" +msgstr "" + +#. Tag: para +#: collection_mapping.xml:402 +#, no-c-format +msgid "In the following paragraphs we have a closer at the indexed collections List and Map how the their index can be mapped in Hibernate." +msgstr "" + +#. Tag: title +#: collection_mapping.xml:407 +#, no-c-format +msgid "Lists" +msgstr "" + +#. Tag: para +#: collection_mapping.xml:409 +#, no-c-format +msgid "Lists can be mapped in two different ways:" +msgstr "" + +#. Tag: para +#: collection_mapping.xml:413 +#, no-c-format +msgid "as ordered lists, where the order is not materialized in the database" +msgstr "" + +#. Tag: para +#: collection_mapping.xml:418 +#, no-c-format +msgid "as indexed lists, where the order is materialized in the database" +msgstr "" + +#. Tag: para +#: collection_mapping.xml:423 +#, no-c-format +msgid "To order lists in memory, add @javax.persistence.OrderBy to your property. This annotation takes as parameter a list of comma separated properties (of the target entity) and orders the collection accordingly (eg firstname asc, age desc), if the string is empty, the collection will be ordered by the primary key of the target entity." +msgstr "" + +#. Tag: title +#: collection_mapping.xml:432 +#, no-c-format +msgid "Ordered lists using @OrderBy" +msgstr "" + +#. Tag: programlisting +#: collection_mapping.xml:434 +#, no-c-format +msgid "" + "@Entity\n" + "public class Customer {\n" + " @Id @GeneratedValue public Integer getId() { return id; }\n" + " public void setId(Integer id) { this.id = id; }\n" + " private Integer id;\n" + "\n" + " @OneToMany(mappedBy=\"customer\")\n" + " @OrderBy(\"number\")\n" + " public List<Order> getOrders() { return orders; }\n" + " public void setOrders(List<Order> orders) { this.orders = orders; }\n" + " private List<Order> orders;\n" + "}\n" + "\n" + "@Entity\n" + "public class Order {\n" + " @Id @GeneratedValue public Integer getId() { return id; }\n" + " public void setId(Integer id) { this.id = id; }\n" + " private Integer id;\n" + "\n" + " public String getNumber() { return number; }\n" + " public void setNumber(String number) { this.number = number; }\n" + " private String number;\n" + "\n" + " @ManyToOne\n" + " public Customer getCustomer() { return customer; }\n" + " public void setCustomer(Customer customer) { this.customer = customer; }\n" + " private Customer number;\n" + "}\n" + "\n" + "-- Table schema\n" + "|-------------| |----------|\n" + "| Order | | Customer |\n" + "|-------------| |----------|\n" + "| id | | id |\n" + "| number | |----------| \n" + "| customer_id |\n" + "|-------------|" +msgstr "" + +#. Tag: para +#: collection_mapping.xml:437 +#, no-c-format +msgid "To store the index value in a dedicated column, use the @javax.persistence.OrderColumn annotation on your property. This annotations describes the column name and attributes of the column keeping the index value. This column is hosted on the table containing the association foreign key. If the column name is not specified, the default is the name of the referencing property, followed by underscore, followed by ORDER (in the following example, it would be orders_ORDER)." +msgstr "" + +#. Tag: title +#: collection_mapping.xml:448 +#, no-c-format +msgid "Explicit index column using @OrderColumn" +msgstr "" + +#. Tag: programlisting +#: collection_mapping.xml:451 +#, no-c-format +msgid "" + "@Entity\n" + "public class Customer {\n" + " @Id @GeneratedValue public Integer getId() { return id; }\n" + " public void setId(Integer id) { this.id = id; }\n" + " private Integer id;\n" + "\n" + " @OneToMany(mappedBy=\"customer\")\n" + " @OrderColumn(name=\"orders_index\")\n" + " public List<Order> getOrders() { return orders; }\n" + " public void setOrders(List<Order> orders) { this.orders = orders; }\n" + " private List<Order> orders;\n" + "}\n" + "\n" + "@Entity\n" + "public class Order {\n" + " @Id @GeneratedValue public Integer getId() { return id; }\n" + " public void setId(Integer id) { this.id = id; }\n" + " private Integer id;\n" + "\n" + " public String getNumber() { return number; }\n" + " public void setNumber(String number) { this.number = number; }\n" + " private String number;\n" + "\n" + " @ManyToOne\n" + " public Customer getCustomer() { return customer; }\n" + " public void setCustomer(Customer customer) { this.customer = customer; }\n" + " private Customer number;\n" + "}\n" + "\n" + "-- Table schema\n" + "|--------------| |----------|\n" + "| Order | | Customer |\n" + "|--------------| |----------|\n" + "| id | | id |\n" + "| number | |----------| \n" + "| customer_id |\n" + "| orders_order |\n" + "|--------------|" +msgstr "" + +#. Tag: para +#: collection_mapping.xml:455 +#, no-c-format +msgid "We recommend you to convert the legacy @org.hibernate.annotations.IndexColumn usages to @OrderColumn unless you are making use of the base property. The base property lets you define the index value of the first element (aka as base index). The usual value is 0 or 1. The default is 0 like in Java." +msgstr "" + +#. Tag: para +#: collection_mapping.xml:464 +#, no-c-format +msgid "Looking again at the Hibernate mapping file equivalent, the index of an array or list is always of type integer and is mapped using the <list-index> element. The mapped column contains sequential integers that are numbered from zero by default." +msgstr "" + +#. Tag: title +#: collection_mapping.xml:471 +#, no-c-format +msgid "index-list element for indexed collections in xml mapping" +msgstr "" + +#. Tag: programlisting +#: collection_mapping.xml:481 +#, no-c-format +msgid "" + "<list-index\n" + " column=\"column_name\"\n" + " base=\"0|1|...\"/>" +msgstr "" + +#. Tag: para +#: collection_mapping.xml:485 +#, no-c-format +msgid "column_name (required): the name of the column holding the collection index values." +msgstr "" + +#. Tag: para +#: collection_mapping.xml:490 +#, no-c-format +msgid "base (optional - defaults to 0): the value of the index column that corresponds to the first element of the list or array." +msgstr "" + +#. Tag: para +#: collection_mapping.xml:498 +#, no-c-format +msgid "If your table does not have an index column, and you still wish to use List as the property type, you can map the property as a Hibernate <bag>. A bag does not retain its order when it is retrieved from the database, but it can be optionally sorted or ordered." +msgstr "" + +#. Tag: title +#: collection_mapping.xml:506 +#, no-c-format +msgid "Maps" +msgstr "" + +#. Tag: para +#: collection_mapping.xml:508 +#, no-c-format +msgid "The question with Maps is where the key value is stored. There are everal options. Maps can borrow their keys from one of the associated entity properties or have dedicated columns to store an explicit key." +msgstr "" + +#. Tag: para +#: collection_mapping.xml:513 +#, no-c-format +msgid "To use one of the target entity property as a key of the map, use @MapKey(name=\"myProperty\"), where myProperty is a property name in the target entity. When using @MapKey without the name attribuate, the target entity primary key is used. The map key uses the same column as the property pointed out. There is no additional column defined to hold the map key, because the map key represent a target property. Be aware that once loaded, the key is no longer kept in sync with the property. In other words, if you change the property value, the key will not change automatically in your Java model." +msgstr "" + +#. Tag: title +#: collection_mapping.xml:525 +#, no-c-format +msgid "Use of target entity property as map key via @MapKey" +msgstr "" + +#. Tag: programlisting +#: collection_mapping.xml:528 +#, no-c-format +msgid "" + "@Entity\n" + "public class Customer {\n" + " @Id @GeneratedValue public Integer getId() { return id; }\n" + " public void setId(Integer id) { this.id = id; }\n" + " private Integer id;\n" + "\n" + " @OneToMany(mappedBy=\"customer\")\n" + " @MapKey(name=\"number\")\n" + " public Map<String,Order> getOrders() { return orders; }\n" + " public void setOrders(Map<String,Order> order) { this.orders = orders; }\n" + " private Map<String,Order> orders;\n" + "}\n" + "\n" + "@Entity\n" + "public class Order {\n" + " @Id @GeneratedValue public Integer getId() { return id; }\n" + " public void setId(Integer id) { this.id = id; }\n" + " private Integer id;\n" + "\n" + " public String getNumber() { return number; }\n" + " public void setNumber(String number) { this.number = number; }\n" + " private String number;\n" + "\n" + " @ManyToOne\n" + " public Customer getCustomer() { return customer; }\n" + " public void setCustomer(Customer customer) { this.customer = customer; }\n" + " private Customer number;\n" + "}\n" + "\n" + "-- Table schema\n" + "|-------------| |----------|\n" + "| Order | | Customer |\n" + "|-------------| |----------|\n" + "| id | | id |\n" + "| number | |----------| \n" + "| customer_id |\n" + "|-------------|" +msgstr "" + +#. Tag: para +#: collection_mapping.xml:531 +#, no-c-format +msgid "Alternatively the map key is mapped to a dedicated column or columns. In order to customize the mapping use one of the following annotations:" +msgstr "" + +#. Tag: para +#: collection_mapping.xml:537 +#, no-c-format +msgid "@MapKeyColumn if the map key is a basic type. If you don't specify the column name, the name of the property followed by underscore followed by KEY is used (for example orders_KEY)." +msgstr "" + +#. Tag: para +#: collection_mapping.xml:544 +#, no-c-format +msgid "@MapKeyEnumerated / @MapKeyTemporal if the map key type is respectively an enum or a Date." +msgstr "" + +#. Tag: para +#: collection_mapping.xml:550 +#, no-c-format +msgid "@MapKeyJoinColumn/@MapKeyJoinColumns if the map key type is another entity." +msgstr "" + +#. Tag: para +#: collection_mapping.xml:555 +#, no-c-format +msgid "@AttributeOverride/@AttributeOverrides when the map key is a embeddable object. Use key. as a prefix for your embeddable object property names." +msgstr "" + +#. Tag: para +#: collection_mapping.xml:562 +#, no-c-format +msgid "You can also use @MapKeyClass to define the type of the key if you don't use generics." +msgstr "" + +#. Tag: title +#: collection_mapping.xml:566 +#, no-c-format +msgid "Map key as basic type using @MapKeyColumn" +msgstr "" + +#. Tag: programlisting +#: collection_mapping.xml:569 +#, no-c-format +msgid "" + "@Entity\n" + "public class Customer {\n" + " @Id @GeneratedValue public Integer getId() { return id; }\n" + " public void setId(Integer id) { this.id = id; }\n" + " private Integer id;\n" + "\n" + " @OneToMany @JoinTable(name=\"Cust_Order\")\n" + " @MapKeyColumn(name=\"orders_number\")\n" + " public Map<String,Order> getOrders() { return orders; }\n" + " public void setOrders(Map<String,Order> orders) { this.orders = orders; }\n" + " private Map<String,Order> orders;\n" + "}\n" + "\n" + "@Entity\n" + "public class Order {\n" + " @Id @GeneratedValue public Integer getId() { return id; }\n" + " public void setId(Integer id) { this.id = id; }\n" + " private Integer id;\n" + "\n" + " public String getNumber() { return number; }\n" + " public void setNumber(String number) { this.number = number; }\n" + " private String number;\n" + "\n" + " @ManyToOne\n" + " public Customer getCustomer() { return customer; }\n" + " public void setCustomer(Customer customer) { this.customer = customer; }\n" + " private Customer number;\n" + "}\n" + "\n" + "-- Table schema\n" + "|-------------| |----------| |---------------|\n" + "| Order | | Customer | | Cust_Order |\n" + "|-------------| |----------| |---------------|\n" + "| id | | id | | customer_id |\n" + "| number | |----------| | order_id |\n" + "| customer_id | | orders_number |\n" + "|-------------| |---------------|" +msgstr "" + +#. Tag: para +#: collection_mapping.xml:573 +#, no-c-format +msgid "We recommend you to migrate from @org.hibernate.annotations.MapKey / @org.hibernate.annotation.MapKeyManyToMany to the new standard approach described above" +msgstr "" + +#. Tag: para +#: collection_mapping.xml:579 +#, no-c-format +msgid "Using Hibernate mapping files there exists equivalent concepts to the descibed annotations. You have to use <map-key>, <map-key-many-to-many> and <composite-map-key>. <map-key> is used for any basic type, <map-key-many-to-many> for an entity reference and <composite-map-key> for a composite type." +msgstr "" + +#. Tag: title +#: collection_mapping.xml:590 +#, no-c-format +msgid "map-key xml mapping element" +msgstr "" + +#. Tag: programlisting +#: collection_mapping.xml:601 +#, no-c-format +msgid "" + "<map-key\n" + " column=\"column_name\"\n" + " formula=\"any SQL expression\"\n" + " type=\"type_name\"\n" + " node=\"@attribute-name\"\n" + " length=\"N\"/>" +msgstr "" + +#. Tag: para +#: collection_mapping.xml:605 +#, no-c-format +msgid "column (optional): the name of the column holding the collection index values." +msgstr "" + +#. Tag: para +#: collection_mapping.xml:610 +#, no-c-format +msgid "formula (optional): a SQL formula used to evaluate the key of the map." +msgstr "" + +#. Tag: para +#: collection_mapping.xml:615 +#, no-c-format +msgid "type (required): the type of the map keys." +msgstr "" + +#. Tag: title +#: collection_mapping.xml:623 +#, no-c-format +msgid "map-key-many-to-many" +msgstr "" + +#. Tag: programlisting +#: collection_mapping.xml:634 +#, no-c-format +msgid "" + "<map-key-many-to-many\n" + " column=\"column_name\"\n" + " formula=\"any SQL expression\"\n" + " class=\"ClassName\"\n" + "/>" +msgstr "" + +#. Tag: para +#: collection_mapping.xml:638 +#, no-c-format +msgid "column (optional): the name of the foreign key column for the collection index values." +msgstr "" + +#. Tag: para +#: collection_mapping.xml:643 +#, no-c-format +msgid "formula (optional): a SQ formula used to evaluate the foreign key of the map key." +msgstr "" + +#. Tag: para +#: collection_mapping.xml:648 +#, no-c-format +msgid "class (required): the entity class used as the map key." +msgstr "" + +#. Tag: title +#: collection_mapping.xml:658 +#, no-c-format +msgid "Collections of basic types and embeddable objects" +msgstr "" + +#. Tag: para +#: collection_mapping.xml:660 +#, no-c-format +msgid "In some situations you don't need to associate two entities but simply create a collection of basic types or embeddable objects. Use the @ElementCollection for this case." +msgstr "" + +#. Tag: title +#: collection_mapping.xml:665 +#, no-c-format +msgid "Collection of basic types mapped via @ElementCollection" +msgstr "" + +#. Tag: programlisting +#: collection_mapping.xml:668 +#, no-c-format +msgid "" + "@Entity\n" + "public class User {\n" + " [...]\n" + " public String getLastname() { ...}\n" + "\n" + " @ElementCollection\n" + " @CollectionTable(name=\"Nicknames\", joinColumns=@JoinColumn(name=\"user_id\"))\n" + " @Column(name=\"nickname\")\n" + " public Set<String> getNicknames() { ... } \n" + "}" +msgstr "" + +#. Tag: para +#: collection_mapping.xml:671 +#, no-c-format +msgid "The collection table holding the collection data is set using the @CollectionTable annotation. If omitted the collection table name defaults to the concatenation of the name of the containing entity and the name of the collection attribute, separated by an underscore. In our example, it would be User_nicknames." +msgstr "" + +#. Tag: para +#: collection_mapping.xml:678 +#, no-c-format +msgid "The column holding the basic type is set using the @Column annotation. If omitted, the column name defaults to the property name: in our example, it would be nicknames." +msgstr "" + +#. Tag: para +#: collection_mapping.xml:683 +#, no-c-format +msgid "But you are not limited to basic types, the collection type can be any embeddable object. To override the columns of the embeddable object in the collection table, use the @AttributeOverride annotation." +msgstr "" + +#. Tag: title +#: collection_mapping.xml:689 +#, no-c-format +msgid "@ElementCollection for embeddable objects" +msgstr "" + +#. Tag: programlisting +#: collection_mapping.xml:691 +#, no-c-format +msgid "" + "@Entity\n" + "public class User {\n" + " [...]\n" + " public String getLastname() { ...}\n" + "\n" + " @ElementCollection\n" + " @CollectionTable(name=\"Addresses\", joinColumns=@JoinColumn(name=\"user_id\"))\n" + " @AttributeOverrides({\n" + " @AttributeOverride(name=\"street1\", column=@Column(name=\"fld_street\"))\n" + " })\n" + " public Set<Address> getAddresses() { ... } \n" + "}\n" + "\n" + "@Embeddable\n" + "public class Address {\n" + " public String getStreet1() {...}\n" + " [...]\n" + "}" +msgstr "" + +#. Tag: para +#: collection_mapping.xml:694 +#, no-c-format +msgid "Such an embeddable object cannot contains a collection itself." +msgstr "" + +#. Tag: para +#: collection_mapping.xml:698 +#, no-c-format +msgid "in @AttributeOverride, you must use the value. prefix to override properties of the embeddable object used in the map value and the key. prefix to override properties of the embeddable object used in the map key." +msgstr "" + +#. Tag: programlisting +#: collection_mapping.xml:704 +#, no-c-format +msgid "" + "@Entity\n" + "public class User {\n" + " @ElementCollection\n" + " @AttributeOverrides({\n" + " @AttributeOverride(name=\"key.street1\", column=@Column(name=\"fld_street\")),\n" + " @AttributeOverride(name=\"value.stars\", column=@Column(name=\"fld_note\"))\n" + " })\n" + " public Map<Address,Rating> getFavHomes() { ... }" +msgstr "" + +#. Tag: para +#: collection_mapping.xml:708 +#, no-c-format +msgid "We recommend you to migrate from @org.hibernate.annotations.CollectionOfElements to the new @ElementCollection annotation." +msgstr "" + +#. Tag: para +#: collection_mapping.xml:714 +#, no-c-format +msgid "Using the mapping file approach a collection of values is mapped using the <element> tag. For example:" +msgstr "" + +#. Tag: title +#: collection_mapping.xml:718 +#, no-c-format +msgid "<element> tag for collection values using mapping files" +msgstr "" + +#. Tag: programlisting +#: collection_mapping.xml:730 +#, no-c-format +msgid "" + "<element\n" + " column=\"column_name\"\n" + " formula=\"any SQL expression\"\n" + " type=\"typename\"\n" + " length=\"L\"\n" + " precision=\"P\"\n" + " scale=\"S\"\n" + " not-null=\"true|false\"\n" + " unique=\"true|false\"\n" + " node=\"element-name\"\n" + "/>" +msgstr "" + +#. Tag: para +#: collection_mapping.xml:734 +#, no-c-format +msgid "column (optional): the name of the column holding the collection element values." +msgstr "" + +#. Tag: para +#: collection_mapping.xml:739 +#, no-c-format +msgid "formula (optional): an SQL formula used to evaluate the element." +msgstr "" + +#. Tag: para +#: collection_mapping.xml:744 +#, no-c-format +msgid "type (required): the type of the collection element." +msgstr "" + +#. Tag: title +#: collection_mapping.xml:754 #, no-c-format msgid "Advanced collection mappings" msgstr "" #. Tag: title +#: collection_mapping.xml:757 #, no-c-format msgid "Sorted collections" msgstr "" #. Tag: para +#: collection_mapping.xml:759 #, no-c-format -msgid "Hibernate supports collections implementing java.util.SortedMap and java.util.SortedSet. You must specify a comparator in the mapping file:" +msgid "Hibernate supports collections implementing java.util.SortedMap and java.util.SortedSet. With annotations you declare a sort comparator using @Sort. You chose between the comparator types unsorted, natural or custom. If you want to use your own comparator implementation, you'll also have to specify the implementation class using the comparator attribute. Note that you need to use either a SortedSet or a SortedMap interface." +msgstr "" + +#. Tag: title +#: collection_mapping.xml:770 +#, no-c-format +msgid "Sorted collection with @Sort" +msgstr "" + +#. Tag: programlisting +#: collection_mapping.xml:772 +#, no-c-format +msgid "" + "@OneToMany(cascade=CascadeType.ALL, fetch=FetchType.EAGER)\n" + "@JoinColumn(name=\"CUST_ID\")\n" + "@Sort(type = SortType.COMPARATOR, comparator = TicketComparator.class)\n" + "public SortedSet<Ticket> getTickets() {\n" + " return tickets;\n" + "}" msgstr "" #. Tag: para +#: collection_mapping.xml:775 +#, no-c-format +msgid "Using Hibernate mapping files you specify a comparator in the mapping file with <sort>:" +msgstr "" + +#. Tag: title +#: collection_mapping.xml:779 +#, no-c-format +msgid "Sorted collection using xml mapping" +msgstr "" + +#. Tag: programlisting +#: collection_mapping.xml:781 +#, no-c-format +msgid "" + "<set name=\"aliases\"\n" + " table=\"person_aliases\" \n" + " sort=\"natural\">\n" + " <key column=\"person\"/>\n" + " <element column=\"name\" type=\"string\"/>\n" + "</set>\n" + "\n" + "<map name=\"holidays\" sort=\"my.custom.HolidayComparator\">\n" + " <key column=\"year_id\"/>\n" + " <map-key column=\"hol_name\" type=\"string\"/>\n" + " <element column=\"hol_date\" type=\"date\"/>\n" + "</map>" +msgstr "" + +#. Tag: para +#: collection_mapping.xml:784 #, no-c-format msgid "Allowed values of the sort attribute are unsorted, natural and the name of a class implementing java.util.Comparator." msgstr "" #. Tag: para +#: collection_mapping.xml:789 #, no-c-format msgid "Sorted collections actually behave like java.util.TreeSet or java.util.TreeMap." msgstr "" #. Tag: para +#: collection_mapping.xml:794 #, no-c-format -msgid "If you want the database itself to order the collection elements, use the order-by attribute of set, bag or map mappings. This solution is only available under JDK 1.4 or higher and is implemented using LinkedHashSet or LinkedHashMap. This performs the ordering in the SQL query and not in the memory." +msgid "If you want the database itself to order the collection elements, use the order-by attribute of set, bag or map mappings. This solution is implemented using LinkedHashSet or LinkedHashMap and performs the ordering in the SQL query and not in the memory." msgstr "" #. Tag: title +#: collection_mapping.xml:802 +#, no-c-format +msgid "Sorting in database using order-by" +msgstr "" + +#. Tag: programlisting +#: collection_mapping.xml:804 +#, no-c-format +msgid "" + "<set name=\"aliases\" table=\"person_aliases\" order-by=\"lower(name) asc\">\n" + " <key column=\"person\"/>\n" + " <element column=\"name\" type=\"string\"/>\n" + "</set>\n" + "\n" + "<map name=\"holidays\" order-by=\"hol_date, hol_name\">\n" + " <key column=\"year_id\"/>\n" + " <map-key column=\"hol_name\" type=\"string\"/>\n" + " <element column=\"hol_date type=\"date\"/>\n" + "</map>" +msgstr "" + +#. Tag: title +#: collection_mapping.xml:808 #, no-c-format msgid "Note" msgstr "" #. Tag: para +#: collection_mapping.xml:810 #, no-c-format msgid "The value of the order-by attribute is an SQL ordering, not an HQL ordering." msgstr "" #. Tag: para +#: collection_mapping.xml:814 #, no-c-format msgid "Associations can even be sorted by arbitrary criteria at runtime using a collection filter():" msgstr "" #. Tag: title +#: collection_mapping.xml:818 +#, no-c-format +msgid "Sorting via a query filter" +msgstr "" + +#. Tag: programlisting +#: collection_mapping.xml:820 +#, no-c-format +msgid "sortedUsers = s.createFilter( group.getUsers(), \"order by this.name\" ).list();" +msgstr "" + +#. Tag: title +#: collection_mapping.xml:825 #, no-c-format msgid "Bidirectional associations" msgstr "" #. Tag: para +#: collection_mapping.xml:827 #, no-c-format msgid "A bidirectional association allows navigation from both \"ends\" of the association. Two kinds of bidirectional association are supported:" msgstr "" #. Tag: term +#: collection_mapping.xml:831 #, no-c-format msgid "one-to-many" msgstr "" #. Tag: para +#: collection_mapping.xml:834 #, no-c-format msgid "set or bag valued at one end and single-valued at the other" msgstr "" #. Tag: term +#: collection_mapping.xml:840 #, no-c-format msgid "many-to-many" msgstr "" #. Tag: para +#: collection_mapping.xml:843 #, no-c-format msgid "set or bag valued at both ends" msgstr "" #. Tag: para +#: collection_mapping.xml:848 #, no-c-format -msgid "You can specify a bidirectional many-to-many association by mapping two many-to-many associations to the same database table and declaring one end as inverse. You cannot select an indexed collection." +msgid "Often there exists a many to one association which is the owner side of a bidirectional relationship. The corresponding one to many association is in this case annotated by @OneToMany(mappedBy=...)" +msgstr "" + +#. Tag: title +#: collection_mapping.xml:854 +#, no-c-format +msgid "Bidirectional one to many with many to one side as association owner" +msgstr "" + +#. Tag: programlisting +#: collection_mapping.xml:857 +#, no-c-format +msgid "" + "@Entity\n" + "public class Troop {\n" + " @OneToMany(mappedBy=\"troop\")\n" + " public Set<Soldier> getSoldiers() {\n" + " ...\n" + "}\n" + "\n" + "@Entity\n" + "public class Soldier {\n" + " @ManyToOne\n" + " @JoinColumn(name=\"troop_fk\")\n" + " public Troop getTroop() {\n" + " ...\n" + "}" msgstr "" #. Tag: para +#: collection_mapping.xml:860 #, no-c-format -msgid "Here is an example of a bidirectional many-to-many association that illustrates how each category can have many items and each item can be in many categories:" +msgid "Troop has a bidirectional one to many relationship with Soldier through the troop property. You don't have to (must not) define any physical mapping in the mappedBy side." msgstr "" #. Tag: para +#: collection_mapping.xml:865 #, no-c-format -msgid "Changes made only to the inverse end of the association are not persisted. This means that Hibernate has two representations in memory for every bidirectional association: one link from A to B and another link from B to A. This is easier to understand if you think about the Java object model and how a many-to-many relationship in Javais created:" +msgid "To map a bidirectional one to many, with the one-to-many side as the owning side, you have to remove the mappedBy element and set the many to one @JoinColumn as insertable and updatable to false. This solution is not optimized and will produce additional UPDATE statements." +msgstr "" + +#. Tag: title +#: collection_mapping.xml:872 +#, no-c-format +msgid "Bidirectional associtaion with one to many side as owner" +msgstr "" + +#. Tag: programlisting +#: collection_mapping.xml:875 +#, no-c-format +msgid "" + "@Entity\n" + "public class Troop {\n" + " @OneToMany\n" + " @JoinColumn(name=\"troop_fk\") //we need to duplicate the physical information\n" + " public Set<Soldier> getSoldiers() {\n" + " ...\n" + "}\n" + "\n" + "@Entity\n" + "public class Soldier {\n" + " @ManyToOne\n" + " @JoinColumn(name=\"troop_fk\", insertable=false, updatable=false)\n" + " public Troop getTroop() {\n" + " ...\n" + "}" msgstr "" #. Tag: para +#: collection_mapping.xml:878 #, no-c-format -msgid "The non-inverse side is used to save the in-memory representation to the database." -msgstr "" - -#. Tag: para -#, no-c-format -msgid "You can define a bidirectional one-to-many association by mapping a one-to-many association to the same table column(s) as a many-to-one association and declaring the many-valued end inverse=\"true\"." +msgid "How does the mappping of a bidirectional mapping look like in Hibernate mapping xml? There you define a bidirectional one-to-many association by mapping a one-to-many association to the same table column(s) as a many-to-one association and declaring the many-valued end inverse=\"true\"." +msgstr "" + +#. Tag: title +#: collection_mapping.xml:885 +#, no-c-format +msgid "Bidirectional one to many via Hibernate mapping files" +msgstr "" + +#. Tag: programlisting +#: collection_mapping.xml:887 +#, no-c-format +msgid "" + "<class name=\"Parent\">\n" + " <id name=\"id\" column=\"parent_id\"/>\n" + " ....\n" + " <set name=\"children\" inverse=\"true\">\n" + " <key column=\"parent_id\"/>\n" + " <one-to-many class=\"Child\"/>\n" + " </set>\n" + "</class>\n" + "\n" + "<class name=\"Child\">\n" + " <id name=\"id\" column=\"child_id\"/>\n" + " ....\n" + " <many-to-one name=\"parent\" \n" + " class=\"Parent\" \n" + " column=\"parent_id\"\n" + " not-null=\"true\"/>\n" + "</class>" msgstr "" #. Tag: para +#: collection_mapping.xml:890 #, no-c-format msgid "Mapping one end of an association with inverse=\"true\" does not affect the operation of cascades as these are orthogonal concepts." msgstr "" +#. Tag: para +#: collection_mapping.xml:894 +#, no-c-format +msgid "A many-to-many association is defined logically using the @ManyToMany annotation. You also have to describe the association table and the join conditions using the @JoinTable annotation. If the association is bidirectional, one side has to be the owner and one side has to be the inverse end (ie. it will be ignored when updating the relationship values in the association table):" +msgstr "" + #. Tag: title +#: collection_mapping.xml:903 +#, no-c-format +msgid "Many to many association via @ManyToMany" +msgstr "" + +#. Tag: programlisting +#: collection_mapping.xml:905 +#, no-c-format +msgid "" + "@Entity\n" + "public class Employer implements Serializable {\n" + " @ManyToMany(\n" + " targetEntity=org.hibernate.test.metadata.manytomany.Employee.class,\n" + " cascade={CascadeType.PERSIST, CascadeType.MERGE}\n" + " )\n" + " @JoinTable(\n" + " name=\"EMPLOYER_EMPLOYEE\",\n" + " joinColumns=@JoinColumn(name=\"EMPER_ID\"),\n" + " inverseJoinColumns=@JoinColumn(name=\"EMPEE_ID\")\n" + " )\n" + " public Collection getEmployees() {\n" + " return employees;\n" + " }\n" + " ...\n" + "}" +msgstr "" + +#. Tag: programlisting +#: collection_mapping.xml:907 +#, no-c-format +msgid "" + "@Entity\n" + "public class Employee implements Serializable {\n" + " @ManyToMany(\n" + " cascade = {CascadeType.PERSIST, CascadeType.MERGE},\n" + " mappedBy = \"employees\",\n" + " targetEntity = Employer.class\n" + " )\n" + " public Collection getEmployers() {\n" + " return employers;\n" + " }\n" + "}" +msgstr "" + +#. Tag: para +#: collection_mapping.xml:910 +#, no-c-format +msgid "In this example @JoinTable defines a name, an array of join columns, and an array of inverse join columns. The latter ones are the columns of the association table which refer to the Employee primary key (the \"other side\"). As seen previously, the other side don't have to (must not) describe the physical mapping: a simple mappedBy argument containing the owner side property name bind the two." +msgstr "" + +#. Tag: para +#: collection_mapping.xml:919 +#, no-c-format +msgid "As any other annotations, most values are guessed in a many to many relationship. Without describing any physical mapping in a unidirectional many to many the following rules applied. The table name is the concatenation of the owner table name, _ and the other side table name. The foreign key name(s) referencing the owner table is the concatenation of the owner table name, _ and the owner primary key column(s). The foreign key name(s) referencing the other side is the concatenation of the owner property name, _, and the other side primary key column(s). These are the same rules used for a unidirectional one to many relationship." +msgstr "" + +#. Tag: title +#: collection_mapping.xml:932 +#, no-c-format +msgid "Default values for @ManyToMany (uni-directional)" +msgstr "" + +#. Tag: programlisting +#: collection_mapping.xml:935 +#, no-c-format +msgid "" + "@Entity\n" + "public class Store {\n" + " @ManyToMany(cascade = CascadeType.PERSIST)\n" + " public Set<City> getImplantedIn() {\n" + " ...\n" + " }\n" + "}\n" + "\n" + "@Entity\n" + "public class City {\n" + " ... //no bidirectional relationship\n" + "}" +msgstr "" + +#. Tag: para +#: collection_mapping.xml:938 +#, no-c-format +msgid "A Store_City is used as the join table. The Store_id column is a foreign key to the Store table. The implantedIn_id column is a foreign key to the City table." +msgstr "" + +#. Tag: para +#: collection_mapping.xml:943 +#, no-c-format +msgid "Without describing any physical mapping in a bidirectional many to many the following rules applied. The table name is the concatenation of the owner table name, _ and the other side table name. The foreign key name(s) referencing the owner table is the concatenation of the other side property name, _, and the owner primary key column(s). The foreign key name(s) referencing the other side is the concatenation of the owner property name, _, and the other side primary key column(s). These are the same rules used for a unidirectional one to many relationship." +msgstr "" + +#. Tag: title +#: collection_mapping.xml:955 +#, no-c-format +msgid "Default values for @ManyToMany (bi-directional)" +msgstr "" + +#. Tag: programlisting +#: collection_mapping.xml:958 +#, no-c-format +msgid "" + "@Entity\n" + "public class Store {\n" + " @ManyToMany(cascade = {CascadeType.PERSIST, CascadeType.MERGE})\n" + " public Set<Customer> getCustomers() {\n" + " ...\n" + " }\n" + "}\n" + "\n" + "@Entity\n" + "public class Customer {\n" + " @ManyToMany(mappedBy=\"customers\")\n" + " public Set<Store> getStores() {\n" + " ...\n" + " }\n" + "}" +msgstr "" + +#. Tag: para +#: collection_mapping.xml:961 +#, no-c-format +msgid "A Store_Customer is used as the join table. The stores_id column is a foreign key to the Store table. The customers_id column is a foreign key to the Customer table." +msgstr "" + +#. Tag: para +#: collection_mapping.xml:966 +#, no-c-format +msgid "Using Hibernate mapping files you can map a bidirectional many-to-many association by mapping two many-to-many associations to the same database table and declaring one end as inverse." +msgstr "" + +#. Tag: para +#: collection_mapping.xml:970 +#, no-c-format +msgid "You cannot select an indexed collection." +msgstr "" + +#. Tag: para +#: collection_mapping.xml:973 +#, no-c-format +msgid "shows a bidirectional many-to-many association that illustrates how each category can have many items and each item can be in many categories:" +msgstr "" + +#. Tag: title +#: collection_mapping.xml:979 +#, no-c-format +msgid "Many to many association using Hibernate mapping files" +msgstr "" + +#. Tag: programlisting +#: collection_mapping.xml:981 +#, no-c-format +msgid "" + "<class name=\"Category\">\n" + " <id name=\"id\" column=\"CATEGORY_ID\"/>\n" + " ...\n" + " <bag name=\"items\" table=\"CATEGORY_ITEM\">\n" + " <key column=\"CATEGORY_ID\"/>\n" + " <many-to-many class=\"Item\" column=\"ITEM_ID\"/>\n" + " </bag>\n" + "</class>\n" + "\n" + "<class name=\"Item\">\n" + " <id name=\"id\" column=\"ITEM_ID\"/>\n" + " ...\n" + "\n" + " <!-- inverse end -->\n" + " <bag name=\"categories\" table=\"CATEGORY_ITEM\" inverse=\"true\">\n" + " <key column=\"ITEM_ID\"/>\n" + " <many-to-many class=\"Category\" column=\"CATEGORY_ID\"/>\n" + " </bag>\n" + "</class>" +msgstr "" + +#. Tag: para +#: collection_mapping.xml:984 +#, no-c-format +msgid "Changes made only to the inverse end of the association are not persisted. This means that Hibernate has two representations in memory for every bidirectional association: one link from A to B and another link from B to A. This is easier to understand if you think about the Java object model and how a many-to-many relationship in Javais created:" +msgstr "" + +#. Tag: title +#: collection_mapping.xml:992 +#, no-c-format +msgid "Effect of inverse vs. non-inverse side of many to many associations" +msgstr "" + +#. Tag: programlisting +#: collection_mapping.xml:995 +#, no-c-format +msgid "" + "category.getItems().add(item); // The category now \"knows\" about the relationship\n" + "item.getCategories().add(category); // The item now \"knows\" about the relationship\n" + "\n" + "session.persist(item); // The relationship won't be saved!\n" + "session.persist(category); // The relationship will be saved" +msgstr "" + +#. Tag: para +#: collection_mapping.xml:998 +#, no-c-format +msgid "The non-inverse side is used to save the in-memory representation to the database." +msgstr "" + +#. Tag: title +#: collection_mapping.xml:1003 #, no-c-format msgid "Bidirectional associations with indexed collections" msgstr "" #. Tag: para +#: collection_mapping.xml:1005 #, no-c-format -msgid "A bidirectional association where one end is represented as a <list> or <map>, requires special consideration. If there is a property of the child class that maps to the index column you can use inverse=\"true\" on the collection mapping:" +msgid "There are some additional considerations for bidirectional mappings with indexed collections (where one end is represented as a <list> or <map>) when using Hibernate mapping files. If there is a property of the child class that maps to the index column you can use inverse=\"true\" on the collection mapping:" +msgstr "" + +#. Tag: title +#: collection_mapping.xml:1013 +#, no-c-format +msgid "Bidirectional association with indexed collection" +msgstr "" + +#. Tag: programlisting +#: collection_mapping.xml:1015 +#, no-c-format +msgid "" + "<class name=\"Parent\">\n" + " <id name=\"id\" column=\"parent_id\"/>\n" + " ....\n" + " <map name=\"children\" inverse=\"true\">\n" + " <key column=\"parent_id\"/>\n" + " <map-key column=\"name\" \n" + " type=\"string\"/>\n" + " <one-to-many class=\"Child\"/>\n" + " </map>\n" + "</class>\n" + "\n" + "<class name=\"Child\">\n" + " <id name=\"id\" column=\"child_id\"/>\n" + " ....\n" + " <property name=\"name\" \n" + " not-null=\"true\"/>\n" + " <many-to-one name=\"parent\" \n" + " class=\"Parent\" \n" + " column=\"parent_id\"\n" + " not-null=\"true\"/>\n" + "</class>" msgstr "" #. Tag: para +#: collection_mapping.xml:1018 #, no-c-format msgid "If there is no such property on the child class, the association cannot be considered truly bidirectional. That is, there is information available at one end of the association that is not available at the other end. In this case, you cannot map the collection inverse=\"true\". Instead, you could use the following mapping:" msgstr "" +#. Tag: title +#: collection_mapping.xml:1026 +#, no-c-format +msgid "Bidirectional association with indexed collection, but no index column" +msgstr "" + +#. Tag: programlisting +#: collection_mapping.xml:1029 +#, no-c-format +msgid "" + "<class name=\"Parent\">\n" + " <id name=\"id\" column=\"parent_id\"/>\n" + " ....\n" + " <map name=\"children\">\n" + " <key column=\"parent_id\"\n" + " not-null=\"true\"/>\n" + " <map-key column=\"name\" \n" + " type=\"string\"/>\n" + " <one-to-many class=\"Child\"/>\n" + " </map>\n" + "</class>\n" + "\n" + "<class name=\"Child\">\n" + " <id name=\"id\" column=\"child_id\"/>\n" + " ....\n" + " <many-to-one name=\"parent\" \n" + " class=\"Parent\" \n" + " column=\"parent_id\"\n" + " insert=\"false\"\n" + " update=\"false\"\n" + " not-null=\"true\"/>\n" + "</class>" +msgstr "" + #. Tag: para +#: collection_mapping.xml:1032 #, no-c-format msgid "Note that in this mapping, the collection-valued end of the association is responsible for updates to the foreign key." msgstr "" #. Tag: title +#: collection_mapping.xml:1037 #, no-c-format msgid "Ternary associations" msgstr "" #. Tag: para +#: collection_mapping.xml:1039 #, no-c-format msgid "There are three possible approaches to mapping a ternary association. One approach is to use a Map with an association as its index:" msgstr "" -#. Tag: para -#, no-c-format -msgid "A second approach is to remodel the association as an entity class. This is the most common approach." -msgstr "" - -#. Tag: para -#, no-c-format -msgid "A final alternative is to use composite elements, which will be discussed later." -msgstr "" - #. Tag: title +#: collection_mapping.xml:1044 #, no-c-format -msgid "Using an <idbag>" +msgid "Ternary association mapping" +msgstr "" + +#. Tag: programlisting +#: collection_mapping.xml:1046 +#, no-c-format +msgid "" + "@Entity\n" + "public class Company {\n" + " @Id \n" + " int id;\n" + " ...\n" + " @OneToMany // unidirectional\n" + " @MapKeyJoinColumn(name=\"employee_id\")\n" + " Map<Employee, Contract> contracts;\n" + "}\n" + "\n" + "// or\n" + "\n" + "<map name=\"contracts\">\n" + " <key column=\"employer_id\" not-null=\"true\"/>\n" + " <map-key-many-to-many column=\"employee_id\" class=\"Employee\"/>\n" + " <one-to-many class=\"Contract\"/>\n" + "</map>" msgstr "" #. Tag: para +#: collection_mapping.xml:1049 #, no-c-format -msgid "The majority of the many-to-many associations and collections of values shown previously all map to tables with composite keys, even though it has been have suggested that entities should have synthetic identifiers (surrogate keys). A pure association table does not seem to benefit much from a surrogate key, although a collection of composite values might. It is for this reason that Hibernate provides a feature that allows you to map many-to-many associations and collections of values to a table with a surrogate key." +msgid "A second approach is to remodel the association as an entity class. This is the most common approach. A final alternative is to use composite elements, which will be discussed later." +msgstr "" + +#. Tag: literal +#: collection_mapping.xml:1055 +#, no-c-format +msgid "Using an <idbag>" msgstr "" #. Tag: para +#: collection_mapping.xml:1057 +#, no-c-format +msgid "The majority of the many-to-many associations and collections of values shown previously all map to tables with composite keys, even though it has been suggested that entities should have synthetic identifiers (surrogate keys). A pure association table does not seem to benefit much from a surrogate key, although a collection of composite values might. For this reason Hibernate provides a feature that allows you to map many-to-many associations and collections of values to a table with a surrogate key." +msgstr "" + +#. Tag: para +#: collection_mapping.xml:1066 #, no-c-format msgid "The <idbag> element lets you map a List (or Collection) with bag semantics. For example:" msgstr "" +#. Tag: programlisting +#: collection_mapping.xml:1070 +#, no-c-format +msgid "" + "<idbag name=\"lovers\" table=\"LOVERS\">\n" + " <collection-id column=\"ID\" type=\"long\">\n" + " <generator class=\"sequence\"/>\n" + " </collection-id>\n" + " <key column=\"PERSON1\"/>\n" + " <many-to-many column=\"PERSON2\" class=\"Person\" fetch=\"join\"/>\n" + "</idbag>" +msgstr "" + #. Tag: para +#: collection_mapping.xml:1072 #, no-c-format msgid "An <idbag> has a synthetic id generator, just like an entity class. A different surrogate key is assigned to each collection row. Hibernate does not, however, provide any mechanism for discovering the surrogate key value of a particular row." msgstr "" #. Tag: para +#: collection_mapping.xml:1077 #, no-c-format msgid "The update performance of an <idbag> supersedes a regular <bag>. Hibernate can locate individual rows efficiently and update or delete them individually, similar to a list, map or set." msgstr "" #. Tag: para +#: collection_mapping.xml:1082 #, no-c-format msgid "In the current implementation, the native identifier generation strategy is not supported for <idbag> collection identifiers." msgstr "" #. Tag: title +#: collection_mapping.xml:1103 #, no-c-format msgid "Collection examples" msgstr "" #. Tag: para +#: collection_mapping.xml:1105 #, no-c-format msgid "This section covers collection examples." msgstr "" #. Tag: para +#: collection_mapping.xml:1107 #, no-c-format msgid "The following class has a collection of Child instances:" msgstr "" +#. Tag: title +#: collection_mapping.xml:1111 +#, no-c-format +msgid "Example classes Parent and Child" +msgstr "" + +#. Tag: programlisting +#: collection_mapping.xml:1114 +#, no-c-format +msgid "" + "public class Parent {\n" + " private long id;\n" + " private Set<Child> children;\n" + "\n" + " // getter/setter\n" + " ...\n" + "}\n" + "\n" + "\n" + "public class Child {\n" + " private long id;\n" + " private String name\n" + "\n" + " \n" + " // getter/setter\n" + " ...\n" + "}" +msgstr "" + #. Tag: para +#: collection_mapping.xml:1117 #, no-c-format msgid "If each child has, at most, one parent, the most natural mapping is a one-to-many association:" msgstr "" +#. Tag: title +#: collection_mapping.xml:1121 +#, no-c-format +msgid "One to many unidirectional Parent-Child relationship using annotations" +msgstr "" + +#. Tag: programlisting +#: collection_mapping.xml:1124 +#, no-c-format +msgid "" + "public class Parent {\n" + " @Id\n" + " @GeneratedValue\n" + " private long id;\n" + "\n" + " @OneToMany\n" + " private Set<Child> children;\n" + "\n" + " // getter/setter\n" + " ...\n" + "}\n" + "\n" + "\n" + "public class Child {\n" + " @Id\n" + " @GeneratedValue\n" + " private long id;\n" + " private String name;\n" + "\n" + " \n" + " // getter/setter\n" + " ...\n" + "}" +msgstr "" + +#. Tag: title +#: collection_mapping.xml:1128 +#, no-c-format +msgid "One to many unidirectional Parent-Child relationship using mapping files" +msgstr "" + +#. Tag: programlisting +#: collection_mapping.xml:1131 +#, no-c-format +msgid "" + "<hibernate-mapping>\n" + "\n" + " <class name=\"Parent\">\n" + " <id name=\"id\">\n" + " <generator class=\"sequence\"/>\n" + " </id>\n" + " <set name=\"children\">\n" + " <key column=\"parent_id\"/>\n" + " <one-to-many class=\"Child\"/>\n" + " </set>\n" + " </class>\n" + "\n" + " <class name=\"Child\">\n" + " <id name=\"id\">\n" + " <generator class=\"sequence\"/>\n" + " </id>\n" + " <property name=\"name\"/>\n" + " </class>\n" + "\n" + "</hibernate-mapping>" +msgstr "" + #. Tag: para +#: collection_mapping.xml:1134 #, no-c-format msgid "This maps to the following table definitions:" msgstr "" +#. Tag: title +#: collection_mapping.xml:1137 +#, no-c-format +msgid "Table definitions for unidirectional Parent-Child relationship" +msgstr "" + +#. Tag: programlisting +#: collection_mapping.xml:1141 +#, no-c-format +msgid "" + "create table parent ( id bigint not null primary key )\n" + "create table child ( id bigint not null primary key, name varchar(255), parent_id bigint )\n" + "alter table child add constraint childfk0 (parent_id) references parent" +msgstr "" + #. Tag: para +#: collection_mapping.xml:1144 #, no-c-format msgid "If the parent is required, use a bidirectional one-to-many association:" msgstr "" +#. Tag: title +#: collection_mapping.xml:1148 +#, no-c-format +msgid "One to many bidirectional Parent-Child relationship using annotations" +msgstr "" + +#. Tag: programlisting +#: collection_mapping.xml:1151 +#, no-c-format +msgid "" + "public class Parent {\n" + " @Id\n" + " @GeneratedValue\n" + " private long id;\n" + "\n" + " @OneToMany(mappedBy=\"parent\")\n" + " private Set<Child> children;\n" + "\n" + " // getter/setter\n" + " ...\n" + "}\n" + "\n" + "\n" + "public class Child {\n" + " @Id\n" + " @GeneratedValue\n" + " private long id;\n" + "\n" + " private String name;\n" + " \n" + " @ManyToOne\n" + " private Parent parent;\n" + "\n" + " \n" + " // getter/setter\n" + " ...\n" + "}" +msgstr "" + +#. Tag: title +#: collection_mapping.xml:1155 +#, no-c-format +msgid "One to many bidirectional Parent-Child relationship using mapping files" +msgstr "" + +#. Tag: programlisting +#: collection_mapping.xml:1158 +#, no-c-format +msgid "" + "<hibernate-mapping>\n" + "\n" + " <class name=\"Parent\">\n" + " <id name=\"id\">\n" + " <generator class=\"sequence\"/>\n" + " </id>\n" + " <set name=\"children\" inverse=\"true\">\n" + " <key column=\"parent_id\"/>\n" + " <one-to-many class=\"Child\"/>\n" + " </set>\n" + " </class>\n" + "\n" + " <class name=\"Child\">\n" + " <id name=\"id\">\n" + " <generator class=\"sequence\"/>\n" + " </id>\n" + " <property name=\"name\"/>\n" + " <many-to-one name=\"parent\" class=\"Parent\" column=\"parent_id\" not-null=\"true\"/>\n" + " </class>\n" + "\n" + "</hibernate-mapping>" +msgstr "" + #. Tag: para +#: collection_mapping.xml:1161 #, no-c-format msgid "Notice the NOT NULL constraint:" msgstr "" -#. Tag: para +#. Tag: title +#: collection_mapping.xml:1164 #, no-c-format -msgid "Alternatively, if this association must be unidirectional you can declare the NOT NULL constraint on the <key> mapping:" +msgid "Table definitions for bidirectional Parent-Child relationship" +msgstr "" + +#. Tag: programlisting +#: collection_mapping.xml:1168 +#, no-c-format +msgid "" + "create table parent ( id bigint not null primary key )\n" + "create table child ( id bigint not null\n" + " primary key,\n" + " name varchar(255),\n" + " parent_id bigint not null )\n" + "alter table child add constraint childfk0 (parent_id) references parent" msgstr "" #. Tag: para +#: collection_mapping.xml:1171 #, no-c-format -msgid "On the other hand, if a child has multiple parents, a many-to-many association is appropriate:" +msgid "Alternatively, if this association must be unidirectional you can enforce the NOT NULL constraint." +msgstr "" + +#. Tag: title +#: collection_mapping.xml:1175 +#, no-c-format +msgid "Enforcing NOT NULL constraint in unidirectional relation using annotations" +msgstr "" + +#. Tag: programlisting +#: collection_mapping.xml:1178 +#, no-c-format +msgid "" + "public class Parent {\n" + " @Id\n" + " @GeneratedValue\n" + " private long id;\n" + "\n" + " @OneToMany(optional=false)\n" + " private Set<Child> children;\n" + "\n" + " // getter/setter\n" + " ...\n" + "}\n" + "\n" + "\n" + "public class Child {\n" + " @Id\n" + " @GeneratedValue\n" + " private long id;\n" + " private String name;\n" + "\n" + " \n" + " // getter/setter\n" + " ...\n" + "}" +msgstr "" + +#. Tag: title +#: collection_mapping.xml:1182 +#, no-c-format +msgid "Enforcing NOT NULL constraint in unidirectional relation using mapping files" +msgstr "" + +#. Tag: programlisting +#: collection_mapping.xml:1185 +#, no-c-format +msgid "" + "<hibernate-mapping>\n" + "\n" + " <class name=\"Parent\">\n" + " <id name=\"id\">\n" + " <generator class=\"sequence\"/>\n" + " </id>\n" + " <set name=\"children\">\n" + " <key column=\"parent_id\" not-null=\"true\"/>\n" + " <one-to-many class=\"Child\"/>\n" + " </set>\n" + " </class>\n" + "\n" + " <class name=\"Child\">\n" + " <id name=\"id\">\n" + " <generator class=\"sequence\"/>\n" + " </id>\n" + " <property name=\"name\"/>\n" + " </class>\n" + "\n" + "</hibernate-mapping>" msgstr "" #. Tag: para +#: collection_mapping.xml:1188 +#, no-c-format +msgid "On the other hand, if a child has multiple parents, a many-to-many association is appropriate." +msgstr "" + +#. Tag: title +#: collection_mapping.xml:1192 +#, no-c-format +msgid "Many to many Parent-Child relationship using annotations" +msgstr "" + +#. Tag: programlisting +#: collection_mapping.xml:1195 +#, no-c-format +msgid "" + "public class Parent {\n" + " @Id\n" + " @GeneratedValue\n" + " private long id;\n" + "\n" + " @ManyToMany\n" + " private Set<Child> children;\n" + "\n" + " // getter/setter\n" + " ...\n" + "}\n" + "\n" + "\n" + "public class Child {\n" + " @Id\n" + " @GeneratedValue\n" + " private long id;\n" + "\n" + " private String name;\n" + "\n" + " \n" + " // getter/setter\n" + " ...\n" + "}" +msgstr "" + +#. Tag: title +#: collection_mapping.xml:1199 +#, no-c-format +msgid "Many to many Parent-Child relationship using mapping files" +msgstr "" + +#. Tag: programlisting +#: collection_mapping.xml:1202 +#, no-c-format +msgid "" + "<hibernate-mapping>\n" + "\n" + " <class name=\"Parent\">\n" + " <id name=\"id\">\n" + " <generator class=\"sequence\"/>\n" + " </id>\n" + " <set name=\"children\" table=\"childset\">\n" + " <key column=\"parent_id\"/>\n" + " <many-to-many class=\"Child\" column=\"child_id\"/>\n" + " </set>\n" + " </class>\n" + "\n" + " <class name=\"Child\">\n" + " <id name=\"id\">\n" + " <generator class=\"sequence\"/>\n" + " </id>\n" + " <property name=\"name\"/>\n" + " </class>\n" + "\n" + "</hibernate-mapping>" +msgstr "" + +#. Tag: para +#: collection_mapping.xml:1205 #, no-c-format msgid "Table definitions:" msgstr "" -#. Tag: para +#. Tag: title +#: collection_mapping.xml:1208 #, no-c-format -msgid "For more examples and a complete explanation of a parent/child relationship mapping, see for more information." +msgid "Table definitions for many to many releationship" +msgstr "" + +#. Tag: programlisting +#: collection_mapping.xml:1210 +#, no-c-format +msgid "" + "create table parent ( id bigint not null primary key )\n" + "create table child ( id bigint not null primary key, name varchar(255) )\n" + "create table childset ( parent_id bigint not null,\n" + " child_id bigint not null,\n" + " primary key ( parent_id, child_id ) )\n" + "alter table childset add constraint childsetfk0 (parent_id) references parent\n" + "alter table childset add constraint childsetfk1 (child_id) references child" msgstr "" #. Tag: para +#: collection_mapping.xml:1213 #, no-c-format -msgid "Even more complex association mappings are covered in the next chapter." +msgid "For more examples and a complete explanation of a parent/child relationship mapping, see for more information. Even more complex association mappings are covered in the next chapter." msgstr "" diff --git a/documentation/manual/src/main/docbook/pot/content/configuration.pot b/documentation/manual/src/main/docbook/pot/content/configuration.pot index 3735f16741..815f634ab5 100644 --- a/documentation/manual/src/main/docbook/pot/content/configuration.pot +++ b/documentation/manual/src/main/docbook/pot/content/configuration.pot @@ -1,1663 +1,2242 @@ -# -# AUTHOR , YEAR. +# SOME DESCRIPTIVE TITLE. +# FIRST AUTHOR , YEAR. # +#, fuzzy msgid "" msgstr "" -"Project-Id-Version: 0\n" -"POT-Creation-Date: 2010-02-11T05:38:15\n" -"PO-Revision-Date: 2010-02-11T05:38:15\n" -"Last-Translator: Automatically generated\n" -"Language-Team: None\n" +"Project-Id-Version: PACKAGE VERSION\n" +"Report-Msgid-Bugs-To: http://bugs.kde.org\n" +"POT-Creation-Date: 2010-07-20 21:02+0000\n" +"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" +"Last-Translator: FULL NAME \n" +"Language-Team: LANGUAGE \n" "MIME-Version: 1.0\n" -"Content-Type: application/x-publican; charset=UTF-8\n" +"Content-Type: application/x-xml2pot; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" #. Tag: title +#: configuration.xml:31 #, no-c-format msgid "Configuration" msgstr "" #. Tag: para +#: configuration.xml:33 #, no-c-format msgid "Hibernate is designed to operate in many different environments and, as such, there is a broad range of configuration parameters. Fortunately, most have sensible default values and Hibernate is distributed with an example hibernate.properties file in etc/ that displays the various options. Simply put the example file in your classpath and customize it to suit your needs." msgstr "" #. Tag: title +#: configuration.xml:41 #, no-c-format msgid "Programmatic configuration" msgstr "" #. Tag: para +#: configuration.xml:43 #, no-c-format msgid "An instance of org.hibernate.cfg.Configuration represents an entire set of mappings of an application's Java types to an SQL database. The org.hibernate.cfg.Configuration is used to build an immutable org.hibernate.SessionFactory. The mappings are compiled from various XML mapping files." msgstr "" #. Tag: para +#: configuration.xml:51 #, no-c-format msgid "You can obtain a org.hibernate.cfg.Configuration instance by instantiating it directly and specifying XML mapping documents. If the mapping files are in the classpath, use addResource(). For example:" msgstr "" +#. Tag: programlisting +#: configuration.xml:57 +#, no-c-format +msgid "" + "Configuration cfg = new Configuration()\n" + " .addResource(\"Item.hbm.xml\")\n" + " .addResource(\"Bid.hbm.xml\");" +msgstr "" + #. Tag: para +#: configuration.xml:59 #, no-c-format msgid "An alternative way is to specify the mapped class and allow Hibernate to find the mapping document for you:" msgstr "" +#. Tag: programlisting +#: configuration.xml:62 +#, no-c-format +msgid "" + "Configuration cfg = new Configuration()\n" + " .addClass(org.hibernate.auction.Item.class)\n" + " .addClass(org.hibernate.auction.Bid.class);" +msgstr "" + #. Tag: para +#: configuration.xml:64 #, no-c-format msgid "Hibernate will then search for mapping files named /org/hibernate/auction/Item.hbm.xml and /org/hibernate/auction/Bid.hbm.xml in the classpath. This approach eliminates any hardcoded filenames." msgstr "" #. Tag: para +#: configuration.xml:69 #, no-c-format msgid "A org.hibernate.cfg.Configuration also allows you to specify configuration properties. For example:" msgstr "" +#. Tag: programlisting +#: configuration.xml:72 +#, no-c-format +msgid "" + "Configuration cfg = new Configuration()\n" + " .addClass(org.hibernate.auction.Item.class)\n" + " .addClass(org.hibernate.auction.Bid.class)\n" + " .setProperty(\"hibernate.dialect\", \"org.hibernate.dialect.MySQLInnoDBDialect\")\n" + " .setProperty(\"hibernate.connection.datasource\", \"java:comp/env/jdbc/test\")\n" + " .setProperty(\"hibernate.order_updates\", \"true\");" +msgstr "" + #. Tag: para +#: configuration.xml:74 #, no-c-format msgid "This is not the only way to pass configuration properties to Hibernate. Some alternative options include:" msgstr "" #. Tag: para +#: configuration.xml:79 #, no-c-format msgid "Pass an instance of java.util.Properties to Configuration.setProperties()." msgstr "" #. Tag: para +#: configuration.xml:84 #, no-c-format msgid "Place a file named hibernate.properties in a root directory of the classpath." msgstr "" #. Tag: para +#: configuration.xml:89 #, no-c-format msgid "Set System properties using java -Dproperty=value." msgstr "" #. Tag: para +#: configuration.xml:94 #, no-c-format msgid "Include <property> elements in hibernate.cfg.xml (this is discussed later)." msgstr "" #. Tag: para +#: configuration.xml:99 #, no-c-format msgid "If you want to get started quicklyhibernate.properties is the easiest approach." msgstr "" #. Tag: para +#: configuration.xml:103 #, no-c-format msgid "The org.hibernate.cfg.Configuration is intended as a startup-time object that will be discarded once a SessionFactory is created." msgstr "" #. Tag: title +#: configuration.xml:109 #, no-c-format msgid "Obtaining a SessionFactory" msgstr "" #. Tag: para +#: configuration.xml:111 #, no-c-format msgid "When all mappings have been parsed by the org.hibernate.cfg.Configuration, the application must obtain a factory for org.hibernate.Session instances. This factory is intended to be shared by all application threads:" msgstr "" +#. Tag: programlisting +#: configuration.xml:117 +#, no-c-format +msgid "SessionFactory sessions = cfg.buildSessionFactory();" +msgstr "" + #. Tag: para +#: configuration.xml:119 #, no-c-format msgid "Hibernate does allow your application to instantiate more than one org.hibernate.SessionFactory. This is useful if you are using more than one database." msgstr "" #. Tag: title +#: configuration.xml:125 #, no-c-format msgid "JDBC connections" msgstr "" #. Tag: para +#: configuration.xml:127 #, no-c-format msgid "It is advisable to have the org.hibernate.SessionFactory create and pool JDBC connections for you. If you take this approach, opening a org.hibernate.Session is as simple as:" msgstr "" +#. Tag: programlisting +#: configuration.xml:133 +#, no-c-format +msgid "Session session = sessions.openSession(); // open a new Session" +msgstr "" + #. Tag: para +#: configuration.xml:135 #, no-c-format msgid "Once you start a task that requires access to the database, a JDBC connection will be obtained from the pool." msgstr "" #. Tag: para +#: configuration.xml:138 #, no-c-format msgid "Before you can do this, you first need to pass some JDBC connection properties to Hibernate. All Hibernate property names and semantics are defined on the class org.hibernate.cfg.Environment. The most important settings for JDBC connection configuration are outlined below." msgstr "" #. Tag: para +#: configuration.xml:144 #, no-c-format msgid "Hibernate will obtain and pool connections using java.sql.DriverManager if you set the following properties:" msgstr "" #. Tag: title +#: configuration.xml:149 #, no-c-format msgid "Hibernate JDBC Properties" msgstr "" #. Tag: entry +#: configuration.xml:158 configuration.xml:236 configuration.xml:327 configuration.xml:495 configuration.xml:657 configuration.xml:753 configuration.xml:826 #, no-c-format msgid "Property name" msgstr "" #. Tag: entry +#: configuration.xml:160 configuration.xml:238 configuration.xml:329 configuration.xml:497 configuration.xml:659 configuration.xml:755 configuration.xml:828 #, no-c-format msgid "Purpose" msgstr "" -#. Tag: entry +#. Tag: property +#: configuration.xml:166 #, no-c-format -msgid "hibernate.connection.driver_class" +msgid "hibernate.connection.driver_class" msgstr "" -#. Tag: entry +#. Tag: emphasis +#: configuration.xml:168 #, no-c-format -msgid "JDBC driver class" +msgid "JDBC driver class" msgstr "" -#. Tag: entry +#. Tag: property +#: configuration.xml:172 #, no-c-format -msgid "hibernate.connection.url" +msgid "hibernate.connection.url" msgstr "" -#. Tag: entry +#. Tag: emphasis +#: configuration.xml:174 #, no-c-format -msgid "JDBC URL" +msgid "JDBC URL" msgstr "" -#. Tag: entry +#. Tag: property +#: configuration.xml:178 configuration.xml:265 #, no-c-format -msgid "hibernate.connection.username" +msgid "hibernate.connection.username" msgstr "" -#. Tag: entry +#. Tag: emphasis +#: configuration.xml:180 #, no-c-format -msgid "database user" +msgid "database user" msgstr "" -#. Tag: entry +#. Tag: property +#: configuration.xml:184 configuration.xml:271 #, no-c-format -msgid "hibernate.connection.password" +msgid "hibernate.connection.password" msgstr "" -#. Tag: entry +#. Tag: emphasis +#: configuration.xml:186 #, no-c-format -msgid "database user password" +msgid "database user password" msgstr "" -#. Tag: entry +#. Tag: property +#: configuration.xml:190 #, no-c-format -msgid "hibernate.connection.pool_size" +msgid "hibernate.connection.pool_size" msgstr "" -#. Tag: entry +#. Tag: emphasis +#: configuration.xml:192 #, no-c-format -msgid "maximum number of pooled connections" +msgid "maximum number of pooled connections" msgstr "" #. Tag: para +#: configuration.xml:199 #, no-c-format msgid "Hibernate's own connection pooling algorithm is, however, quite rudimentary. It is intended to help you get started and is not intended for use in a production system, or even for performance testing. You should use a third party pool for best performance and stability. Just replace the hibernate.connection.pool_size property with connection pool specific settings. This will turn off Hibernate's internal pool. For example, you might like to use c3p0." msgstr "" #. Tag: para +#: configuration.xml:208 #, no-c-format msgid "C3P0 is an open source JDBC connection pool distributed along with Hibernate in the lib directory. Hibernate will use its org.hibernate.connection.C3P0ConnectionProvider for connection pooling if you set hibernate.c3p0.* properties. If you would like to use Proxool, refer to the packaged hibernate.properties and the Hibernate web site for more information." msgstr "" #. Tag: para +#: configuration.xml:216 #, no-c-format msgid "The following is an example hibernate.properties file for c3p0:" msgstr "" +#. Tag: programlisting +#: configuration.xml:219 +#, no-c-format +msgid "" + "hibernate.connection.driver_class = org.postgresql.Driver\n" + "hibernate.connection.url = jdbc:postgresql://localhost/mydatabase\n" + "hibernate.connection.username = myuser\n" + "hibernate.connection.password = secret\n" + "hibernate.c3p0.min_size=5\n" + "hibernate.c3p0.max_size=20\n" + "hibernate.c3p0.timeout=1800\n" + "hibernate.c3p0.max_statements=50\n" + "hibernate.dialect = org.hibernate.dialect.PostgreSQLDialect" +msgstr "" + #. Tag: para +#: configuration.xml:221 #, no-c-format msgid "For use inside an application server, you should almost always configure Hibernate to obtain connections from an application server javax.sql.Datasource registered in JNDI. You will need to set at least one of the following properties:" msgstr "" #. Tag: title +#: configuration.xml:227 #, no-c-format msgid "Hibernate Datasource Properties" msgstr "" -#. Tag: entry +#. Tag: property +#: configuration.xml:244 #, no-c-format -msgid "hibernate.connection.datasource" -msgstr "" - -#. Tag: entry -#, no-c-format -msgid "datasource JNDI name" -msgstr "" - -#. Tag: entry -#, no-c-format -msgid "hibernate.jndi.url" +msgid "hibernate.connection.datasource" +msgstr "" + +#. Tag: emphasis +#: configuration.xml:246 +#, no-c-format +msgid "datasource JNDI name" +msgstr "" + +#. Tag: property +#: configuration.xml:250 +#, no-c-format +msgid "hibernate.jndi.url" msgstr "" #. Tag: entry +#: configuration.xml:252 #, no-c-format msgid "URL of the JNDI provider (optional)" msgstr "" -#. Tag: entry +#. Tag: property +#: configuration.xml:257 #, no-c-format -msgid "hibernate.jndi.class" +msgid "hibernate.jndi.class" msgstr "" #. Tag: entry +#: configuration.xml:259 #, no-c-format msgid "class of the JNDI InitialContextFactory (optional)" msgstr "" #. Tag: entry +#: configuration.xml:267 #, no-c-format msgid "database user (optional)" msgstr "" #. Tag: entry +#: configuration.xml:273 #, no-c-format msgid "database user password (optional)" msgstr "" #. Tag: para +#: configuration.xml:280 #, no-c-format msgid "Here is an example hibernate.properties file for an application server provided JNDI datasource:" msgstr "" +#. Tag: programlisting +#: configuration.xml:283 +#, no-c-format +msgid "" + "hibernate.connection.datasource = java:/comp/env/jdbc/test\n" + "hibernate.transaction.factory_class = \\\n" + " org.hibernate.transaction.JTATransactionFactory\n" + "hibernate.transaction.manager_lookup_class = \\\n" + " org.hibernate.transaction.JBossTransactionManagerLookup\n" + "hibernate.dialect = org.hibernate.dialect.PostgreSQLDialect" +msgstr "" + #. Tag: para +#: configuration.xml:285 #, no-c-format msgid "JDBC connections obtained from a JNDI datasource will automatically participate in the container-managed transactions of the application server." msgstr "" #. Tag: para +#: configuration.xml:289 #, no-c-format msgid "Arbitrary connection properties can be given by prepending \"hibernate.connection\" to the connection property name. For example, you can specify a charSet connection property using hibernate.connection.charSet." msgstr "" #. Tag: para +#: configuration.xml:294 #, no-c-format msgid "You can define your own plugin strategy for obtaining JDBC connections by implementing the interface org.hibernate.connection.ConnectionProvider, and specifying your custom implementation via the hibernate.connection.provider_class property." msgstr "" #. Tag: title +#: configuration.xml:302 #, no-c-format msgid "Optional configuration properties" msgstr "" #. Tag: para +#: configuration.xml:304 #, no-c-format msgid "There are a number of other properties that control the behavior of Hibernate at runtime. All are optional and have reasonable default values." msgstr "" #. Tag: para +#: configuration.xml:309 #, no-c-format msgid "Some of these properties are \"system-level\" only. System-level properties can be set only via java -Dproperty=value or hibernate.properties. They cannot be set by the other techniques described above." msgstr "" #. Tag: title +#: configuration.xml:318 #, no-c-format msgid "Hibernate Configuration Properties" msgstr "" -#. Tag: entry +#. Tag: property +#: configuration.xml:335 #, no-c-format -msgid "hibernate.dialect" +msgid "hibernate.dialect" msgstr "" #. Tag: entry +#: configuration.xml:337 #, no-c-format msgid "The classname of a Hibernate org.hibernate.dialect.Dialect which allows Hibernate to generate SQL optimized for a particular relational database." msgstr "" #. Tag: para +#: configuration.xml:340 #, no-c-format msgid "e.g. full.classname.of.Dialect" msgstr "" #. Tag: para +#: configuration.xml:341 #, no-c-format msgid "In most cases Hibernate will actually be able to choose the correct org.hibernate.dialect.Dialect implementation based on the JDBC metadata returned by the JDBC driver." msgstr "" -#. Tag: entry +#. Tag: property +#: configuration.xml:349 #, no-c-format -msgid "hibernate.show_sql" +msgid "hibernate.show_sql" msgstr "" #. Tag: entry +#: configuration.xml:351 #, no-c-format msgid "Write all SQL statements to console. This is an alternative to setting the log category org.hibernate.SQL to debug." msgstr "" #. Tag: para +#: configuration.xml:353 configuration.xml:361 configuration.xml:426 configuration.xml:435 configuration.xml:443 configuration.xml:453 configuration.xml:468 configuration.xml:525 configuration.xml:545 configuration.xml:555 configuration.xml:598 configuration.xml:797 configuration.xml:808 configuration.xml:904 #, no-c-format msgid "e.g. true | false" msgstr "" -#. Tag: entry +#. Tag: property +#: configuration.xml:359 #, no-c-format -msgid "hibernate.format_sql" +msgid "hibernate.format_sql" msgstr "" #. Tag: entry +#: configuration.xml:361 #, no-c-format msgid "Pretty print the SQL in the log and console." msgstr "" -#. Tag: entry +#. Tag: property +#: configuration.xml:367 #, no-c-format -msgid "hibernate.default_schema" +msgid "hibernate.default_schema" msgstr "" #. Tag: entry +#: configuration.xml:369 #, no-c-format msgid "Qualify unqualified table names with the given schema/tablespace in generated SQL." msgstr "" #. Tag: para +#: configuration.xml:370 #, no-c-format msgid "e.g. SCHEMA_NAME" msgstr "" -#. Tag: entry +#. Tag: property +#: configuration.xml:376 #, no-c-format -msgid "hibernate.default_catalog" +msgid "hibernate.default_catalog" msgstr "" #. Tag: entry +#: configuration.xml:378 #, no-c-format msgid "Qualifies unqualified table names with the given catalog in generated SQL." msgstr "" #. Tag: para +#: configuration.xml:379 #, no-c-format msgid "e.g. CATALOG_NAME" msgstr "" -#. Tag: entry +#. Tag: property +#: configuration.xml:384 #, no-c-format -msgid "hibernate.session_factory_name" +msgid "hibernate.session_factory_name" msgstr "" #. Tag: entry +#: configuration.xml:386 #, no-c-format msgid "The org.hibernate.SessionFactory will be automatically bound to this name in JNDI after it has been created." msgstr "" #. Tag: para +#: configuration.xml:389 configuration.xml:776 #, no-c-format msgid "e.g. jndi/composite/name" msgstr "" -#. Tag: entry +#. Tag: property +#: configuration.xml:394 #, no-c-format -msgid "hibernate.max_fetch_depth" +msgid "hibernate.max_fetch_depth" msgstr "" #. Tag: entry +#: configuration.xml:396 #, no-c-format msgid "Sets a maximum \"depth\" for the outer join fetch tree for single-ended associations (one-to-one, many-to-one). A 0 disables default outer join fetching." msgstr "" #. Tag: para +#: configuration.xml:398 #, no-c-format msgid "e.g. recommended values between 0 and 3" msgstr "" -#. Tag: entry +#. Tag: property +#: configuration.xml:404 #, no-c-format -msgid "hibernate.default_batch_fetch_size" +msgid "hibernate.default_batch_fetch_size" msgstr "" #. Tag: entry +#: configuration.xml:406 #, no-c-format msgid "Sets a default size for Hibernate batch fetching of associations." msgstr "" #. Tag: para +#: configuration.xml:407 #, no-c-format msgid "e.g. recommended values 4, 8, 16" msgstr "" -#. Tag: entry +#. Tag: property +#: configuration.xml:413 #, no-c-format -msgid "hibernate.default_entity_mode" +msgid "hibernate.default_entity_mode" msgstr "" #. Tag: entry +#: configuration.xml:415 #, no-c-format msgid "Sets a default mode for entity representation for all sessions opened from this SessionFactory" msgstr "" #. Tag: para +#: configuration.xml:416 #, no-c-format msgid "dynamic-map, dom4j, pojo" msgstr "" -#. Tag: entry +#. Tag: property +#: configuration.xml:422 #, no-c-format -msgid "hibernate.order_updates" +msgid "hibernate.order_updates" msgstr "" #. Tag: entry +#: configuration.xml:424 #, no-c-format msgid "Forces Hibernate to order SQL updates by the primary key value of the items being updated. This will result in fewer transaction deadlocks in highly concurrent systems." msgstr "" -#. Tag: entry +#. Tag: property +#: configuration.xml:432 #, no-c-format -msgid "hibernate.generate_statistics" +msgid "hibernate.generate_statistics" msgstr "" #. Tag: entry +#: configuration.xml:434 #, no-c-format msgid "If enabled, Hibernate will collect statistics useful for performance tuning." msgstr "" -#. Tag: entry +#. Tag: property +#: configuration.xml:440 #, no-c-format -msgid "hibernate.use_identifier_rollback" +msgid "hibernate.use_identifier_rollback" msgstr "" #. Tag: entry +#: configuration.xml:442 #, no-c-format msgid "If enabled, generated identifier properties will be reset to default values when objects are deleted." msgstr "" -#. Tag: entry +#. Tag: property +#: configuration.xml:449 #, no-c-format -msgid "hibernate.use_sql_comments" +msgid "hibernate.use_sql_comments" msgstr "" #. Tag: entry +#: configuration.xml:451 #, no-c-format msgid "If turned on, Hibernate will generate comments inside the SQL, for easier debugging, defaults to false." msgstr "" +#. Tag: property +#: configuration.xml:458 +#, no-c-format +msgid "hibernate.id.new_generator_mappings" +msgstr "" + +#. Tag: entry +#: configuration.xml:460 +#, no-c-format +msgid "Setting is relevant when using @GeneratedValue. It indicates whether or not the new IdentifierGenerator implementations are used for javax.persistence.GenerationType.AUTO, javax.persistence.GenerationType.TABLE and javax.persistence.GenerationType.SEQUENCE. Default to false to keep backward compatibility." +msgstr "" + +#. Tag: para +#: configuration.xml:476 +#, no-c-format +msgid "We recommend all new projects which make use of to use @GeneratedValue to also set hibernate.id.new_generator_mappings=true as the new generators are more efficient and closer to the JPA 2 specification semantic. However they are not backward compatible with existing databases (if a sequence or a table is used for id generation)." +msgstr "" + #. Tag: title +#: configuration.xml:485 #, no-c-format msgid "Hibernate JDBC and Connection Properties" msgstr "" -#. Tag: entry +#. Tag: property +#: configuration.xml:503 #, no-c-format -msgid "hibernate.jdbc.fetch_size" +msgid "hibernate.jdbc.fetch_size" msgstr "" #. Tag: entry +#: configuration.xml:505 #, no-c-format msgid "A non-zero value determines the JDBC fetch size (calls Statement.setFetchSize())." msgstr "" -#. Tag: entry +#. Tag: property +#: configuration.xml:510 #, no-c-format -msgid "hibernate.jdbc.batch_size" +msgid "hibernate.jdbc.batch_size" msgstr "" #. Tag: entry +#: configuration.xml:512 #, no-c-format msgid "A non-zero value enables use of JDBC2 batch updates by Hibernate." msgstr "" #. Tag: para +#: configuration.xml:513 #, no-c-format msgid "e.g. recommended values between 5 and 30" msgstr "" -#. Tag: entry +#. Tag: property +#: configuration.xml:519 #, no-c-format -msgid "hibernate.jdbc.batch_versioned_data" +msgid "hibernate.jdbc.batch_versioned_data" msgstr "" #. Tag: entry +#: configuration.xml:521 #, no-c-format -msgid "Set this property to true if your JDBC driver returns correct row counts from executeBatch(). Iit is usually safe to turn this option on. Hibernate will then use batched DML for automatically versioned data. Defaults to false." -msgstr "" - -#. Tag: entry -#, no-c-format -msgid "hibernate.jdbc.factory_class" +msgid "Set this property to true if your JDBC driver returns correct row counts from executeBatch(). It is usually safe to turn this option on. Hibernate will then use batched DML for automatically versioned data. Defaults to false." +msgstr "" + +#. Tag: property +#: configuration.xml:531 +#, no-c-format +msgid "hibernate.jdbc.factory_class" msgstr "" #. Tag: entry +#: configuration.xml:533 #, no-c-format msgid "Select a custom org.hibernate.jdbc.Batcher. Most applications will not need this configuration property." msgstr "" #. Tag: para +#: configuration.xml:535 #, no-c-format msgid "e.g. classname.of.BatcherFactory" msgstr "" -#. Tag: entry +#. Tag: property +#: configuration.xml:541 #, no-c-format -msgid "hibernate.jdbc.use_scrollable_resultset" +msgid "hibernate.jdbc.use_scrollable_resultset" msgstr "" #. Tag: entry +#: configuration.xml:543 #, no-c-format msgid "Enables use of JDBC2 scrollable resultsets by Hibernate. This property is only necessary when using user-supplied JDBC connections. Hibernate uses connection metadata otherwise." msgstr "" -#. Tag: entry +#. Tag: property +#: configuration.xml:551 #, no-c-format -msgid "hibernate.jdbc.use_streams_for_binary" +msgid "hibernate.jdbc.use_streams_for_binary" msgstr "" #. Tag: entry +#: configuration.xml:553 #, no-c-format msgid "Use streams when writing/reading binary or serializable types to/from JDBC. *system-level property*" msgstr "" -#. Tag: entry +#. Tag: property +#: configuration.xml:561 #, no-c-format -msgid "hibernate.jdbc.use_get_generated_keys" +msgid "hibernate.jdbc.use_get_generated_keys" msgstr "" #. Tag: entry +#: configuration.xml:563 #, no-c-format msgid "Enables use of JDBC3 PreparedStatement.getGeneratedKeys() to retrieve natively generated keys after insert. Requires JDBC3+ driver and JRE1.4+, set to false if your driver has problems with the Hibernate identifier generators. By default, it tries to determine the driver capabilities using connection metadata." msgstr "" #. Tag: para +#: configuration.xml:569 configuration.xml:678 configuration.xml:687 configuration.xml:696 configuration.xml:723 #, no-c-format msgid "e.g. true|false" msgstr "" -#. Tag: entry +#. Tag: property +#: configuration.xml:574 #, no-c-format -msgid "hibernate.connection.provider_class" +msgid "hibernate.connection.provider_class" msgstr "" #. Tag: entry +#: configuration.xml:576 #, no-c-format msgid "The classname of a custom org.hibernate.connection.ConnectionProvider which provides JDBC connections to Hibernate." msgstr "" #. Tag: para +#: configuration.xml:578 #, no-c-format msgid "e.g. classname.of.ConnectionProvider" msgstr "" -#. Tag: entry +#. Tag: property +#: configuration.xml:584 #, no-c-format -msgid "hibernate.connection.isolation" +msgid "hibernate.connection.isolation" msgstr "" #. Tag: entry +#: configuration.xml:586 #, no-c-format msgid "Sets the JDBC transaction isolation level. Check java.sql.Connection for meaningful values, but note that most databases do not support all isolation levels and some define additional, non-standard isolations." msgstr "" #. Tag: para +#: configuration.xml:589 #, no-c-format msgid "e.g. 1, 2, 4, 8" msgstr "" -#. Tag: entry +#. Tag: property +#: configuration.xml:595 #, no-c-format -msgid "hibernate.connection.autocommit" +msgid "hibernate.connection.autocommit" msgstr "" #. Tag: entry +#: configuration.xml:597 #, no-c-format msgid "Enables autocommit for JDBC pooled connections (it is not recommended)." msgstr "" -#. Tag: entry +#. Tag: property +#: configuration.xml:603 #, no-c-format -msgid "hibernate.connection.release_mode" +msgid "hibernate.connection.release_mode" msgstr "" #. Tag: entry +#: configuration.xml:605 #, no-c-format msgid "Specifies when Hibernate should release JDBC connections. By default, a JDBC connection is held until the session is explicitly closed or disconnected. For an application server JTA datasource, use after_statement to aggressively release connections after every JDBC call. For a non-JTA connection, it often makes sense to release the connection at the end of each transaction, by using after_transaction. auto will choose after_statement for the JTA and CMT transaction strategies and after_transaction for the JDBC transaction strategy." msgstr "" #. Tag: para +#: configuration.xml:615 #, no-c-format msgid "e.g. auto (default) | on_close | after_transaction | after_statement" msgstr "" #. Tag: para +#: configuration.xml:618 #, no-c-format -msgid "This setting only affects Sessions returned from SessionFactory.openSession. For Sessions obtained through SessionFactory.getCurrentSession, the CurrentSessionContext implementation configured for use controls the connection release mode for those Sessions. See " +msgid "This setting only affects Sessions returned from SessionFactory.openSession. For Sessions obtained through SessionFactory.getCurrentSession, the CurrentSessionContext implementation configured for use controls the connection release mode for those Sessions. See" msgstr "" #. Tag: entry +#: configuration.xml:630 #, no-c-format msgid "hibernate.connection.<propertyName>" msgstr "" #. Tag: entry +#: configuration.xml:632 #, no-c-format msgid "Pass the JDBC property <propertyName> to DriverManager.getConnection()." msgstr "" #. Tag: entry +#: configuration.xml:638 #, no-c-format msgid "hibernate.jndi.<propertyName>" msgstr "" #. Tag: entry +#: configuration.xml:640 #, no-c-format msgid "Pass the property <propertyName> to the JNDI InitialContextFactory." msgstr "" #. Tag: title +#: configuration.xml:648 #, no-c-format msgid "Hibernate Cache Properties" msgstr "" -#. Tag: entry +#. Tag: literal +#: configuration.xml:665 #, no-c-format -msgid "hibernate.cache.provider_class" +msgid "hibernate.cache.provider_class" msgstr "" #. Tag: entry +#: configuration.xml:667 #, no-c-format msgid "The classname of a custom CacheProvider." msgstr "" #. Tag: para +#: configuration.xml:668 #, no-c-format msgid "e.g. classname.of.CacheProvider" msgstr "" -#. Tag: entry +#. Tag: literal +#: configuration.xml:673 #, no-c-format -msgid "hibernate.cache.use_minimal_puts" +msgid "hibernate.cache.use_minimal_puts" msgstr "" #. Tag: entry +#: configuration.xml:675 #, no-c-format msgid "Optimizes second-level cache operation to minimize writes, at the cost of more frequent reads. This setting is most useful for clustered caches and, in Hibernate3, is enabled by default for clustered cache implementations." msgstr "" -#. Tag: entry +#. Tag: literal +#: configuration.xml:684 #, no-c-format -msgid "hibernate.cache.use_query_cache" +msgid "hibernate.cache.use_query_cache" msgstr "" #. Tag: entry +#: configuration.xml:686 #, no-c-format msgid "Enables the query cache. Individual queries still have to be set cachable." msgstr "" -#. Tag: entry +#. Tag: literal +#: configuration.xml:692 #, no-c-format -msgid "hibernate.cache.use_second_level_cache" +msgid "hibernate.cache.use_second_level_cache" msgstr "" #. Tag: entry +#: configuration.xml:694 #, no-c-format msgid "Can be used to completely disable the second level cache, which is enabled by default for classes which specify a <cache> mapping." msgstr "" -#. Tag: entry +#. Tag: literal +#: configuration.xml:702 #, no-c-format -msgid "hibernate.cache.query_cache_factory" +msgid "hibernate.cache.query_cache_factory" msgstr "" #. Tag: entry +#: configuration.xml:704 #, no-c-format msgid "The classname of a custom QueryCache interface, defaults to the built-in StandardQueryCache." msgstr "" #. Tag: para +#: configuration.xml:706 #, no-c-format msgid "e.g. classname.of.QueryCache" msgstr "" -#. Tag: entry +#. Tag: literal +#: configuration.xml:712 #, no-c-format -msgid "hibernate.cache.region_prefix" +msgid "hibernate.cache.region_prefix" msgstr "" #. Tag: entry +#: configuration.xml:714 #, no-c-format msgid "A prefix to use for second-level cache region names." msgstr "" #. Tag: para +#: configuration.xml:714 #, no-c-format msgid "e.g. prefix" msgstr "" -#. Tag: entry +#. Tag: literal +#: configuration.xml:720 #, no-c-format -msgid "hibernate.cache.use_structured_entries" +msgid "hibernate.cache.use_structured_entries" msgstr "" #. Tag: entry +#: configuration.xml:722 #, no-c-format msgid "Forces Hibernate to store data in the second-level cache in a more human-friendly format." msgstr "" +#. Tag: literal +#: configuration.xml:729 +#, no-c-format +msgid "hibernate.cache.default_cache_concurrency_strategy" +msgstr "" + +#. Tag: entry +#: configuration.xml:731 +#, no-c-format +msgid "Setting used to give the name of the default org.hibernate.annotations.CacheConcurrencyStrategy to use when either @Cacheable or @Cache is used. @Cache(strategy=\"..\") is used to override this default." +msgstr "" + #. Tag: title +#: configuration.xml:744 #, no-c-format msgid "Hibernate Transaction Properties" msgstr "" -#. Tag: entry +#. Tag: literal +#: configuration.xml:761 #, no-c-format -msgid "hibernate.transaction.factory_class" +msgid "hibernate.transaction.factory_class" msgstr "" #. Tag: entry +#: configuration.xml:763 #, no-c-format msgid "The classname of a TransactionFactory to use with Hibernate Transaction API (defaults to JDBCTransactionFactory)." msgstr "" #. Tag: para +#: configuration.xml:765 #, no-c-format msgid "e.g. classname.of.TransactionFactory" msgstr "" -#. Tag: entry +#. Tag: literal +#: configuration.xml:771 #, no-c-format -msgid "jta.UserTransaction" +msgid "jta.UserTransaction" msgstr "" #. Tag: entry +#: configuration.xml:773 #, no-c-format msgid "A JNDI name used by JTATransactionFactory to obtain the JTA UserTransaction from the application server." msgstr "" -#. Tag: entry +#. Tag: literal +#: configuration.xml:781 #, no-c-format -msgid "hibernate.transaction.manager_lookup_class" +msgid "hibernate.transaction.manager_lookup_class" msgstr "" #. Tag: entry +#: configuration.xml:783 #, no-c-format msgid "The classname of a TransactionManagerLookup. It is required when JVM-level caching is enabled or when using hilo generator in a JTA environment." msgstr "" #. Tag: para +#: configuration.xml:786 #, no-c-format msgid "e.g. classname.of.TransactionManagerLookup" msgstr "" -#. Tag: entry +#. Tag: literal +#: configuration.xml:792 #, no-c-format -msgid "hibernate.transaction.flush_before_completion" +msgid "hibernate.transaction.flush_before_completion" msgstr "" #. Tag: entry +#: configuration.xml:794 #, no-c-format -msgid "If enabled, the session will be automatically flushed during the before completion phase of the transaction. Built-in and automatic session context management is preferred, see ." +msgid "If enabled, the session will be automatically flushed during the before completion phase of the transaction. Built-in and automatic session context management is preferred, see ." +msgstr "" + +#. Tag: literal +#: configuration.xml:803 +#, no-c-format +msgid "hibernate.transaction.auto_close_session" msgstr "" #. Tag: entry +#: configuration.xml:805 #, no-c-format -msgid "hibernate.transaction.auto_close_session" -msgstr "" - -#. Tag: entry -#, no-c-format -msgid "If enabled, the session will be automatically closed during the after completion phase of the transaction. Built-in and automatic session context management is preferred, see ." +msgid "If enabled, the session will be automatically closed during the after completion phase of the transaction. Built-in and automatic session context management is preferred, see ." msgstr "" #. Tag: title +#: configuration.xml:817 #, no-c-format msgid "Miscellaneous Properties" msgstr "" -#. Tag: entry +#. Tag: literal +#: configuration.xml:834 #, no-c-format -msgid "hibernate.current_session_context_class" +msgid "hibernate.current_session_context_class" msgstr "" #. Tag: entry +#: configuration.xml:836 #, no-c-format -msgid "Supply a custom strategy for the scoping of the \"current\" Session. See for more information about the built-in strategies." +msgid "Supply a custom strategy for the scoping of the \"current\" Session. See for more information about the built-in strategies." msgstr "" #. Tag: para +#: configuration.xml:839 #, no-c-format msgid "e.g. jta | thread | managed | custom.Class" msgstr "" -#. Tag: entry +#. Tag: literal +#: configuration.xml:846 #, no-c-format -msgid "hibernate.query.factory_class" +msgid "hibernate.query.factory_class" msgstr "" #. Tag: entry +#: configuration.xml:848 #, no-c-format msgid "Chooses the HQL parser implementation." msgstr "" #. Tag: para +#: configuration.xml:848 #, no-c-format msgid "e.g. org.hibernate.hql.ast.ASTQueryTranslatorFactory or org.hibernate.hql.classic.ClassicQueryTranslatorFactory" msgstr "" -#. Tag: entry +#. Tag: literal +#: configuration.xml:857 #, no-c-format -msgid "hibernate.query.substitutions" +msgid "hibernate.query.substitutions" msgstr "" #. Tag: entry +#: configuration.xml:859 #, no-c-format msgid "Is used to map from tokens in Hibernate queries to SQL tokens (tokens might be function or literal names, for example)." msgstr "" #. Tag: para +#: configuration.xml:861 #, no-c-format msgid "e.g. hqlLiteral=SQL_LITERAL, hqlFunction=SQLFUNC" msgstr "" -#. Tag: entry +#. Tag: literal +#: configuration.xml:867 #, no-c-format -msgid "hibernate.hbm2ddl.auto" +msgid "hibernate.hbm2ddl.auto" msgstr "" #. Tag: entry +#: configuration.xml:869 #, no-c-format msgid "Automatically validates or exports schema DDL to the database when the SessionFactory is created. With create-drop, the database schema will be dropped when the SessionFactory is closed explicitly." msgstr "" #. Tag: para +#: configuration.xml:873 #, no-c-format msgid "e.g. validate | update | create | create-drop" msgstr "" -#. Tag: entry +#. Tag: literal +#: configuration.xml:880 #, no-c-format -msgid "hibernate.cglib.use_reflection_optimizer" +msgid "hibernate.hbm2ddl.import_file" +msgstr "" + +#. Tag: para +#: configuration.xml:882 +#, no-c-format +msgid "Comma-separated names of the optional files containing SQL DML statements executed during the SessionFactory creation. This is useful for testing or demoing: by adding INSERT statements for example you can populate your database with a minimal set of data when it is deployed." +msgstr "" + +#. Tag: para +#: configuration.xml:887 +#, no-c-format +msgid "File order matters, the statements of a give file are executed before the statements of the following files. These statements are only executed if the schema is created ie if hibernate.hbm2ddl.auto is set to create or create-drop." +msgstr "" + +#. Tag: para +#: configuration.xml:892 +#, no-c-format +msgid "e.g. /humans.sql,/dogs.sql" +msgstr "" + +#. Tag: literal +#: configuration.xml:898 +#, no-c-format +msgid "hibernate.cglib.use_reflection_optimizer" msgstr "" #. Tag: entry +#: configuration.xml:900 #, no-c-format msgid "Enables the use of CGLIB instead of runtime reflection (System-level property). Reflection can sometimes be useful when troubleshooting. Hibernate always requires CGLIB even if you turn off the optimizer. You cannot set this property in hibernate.cfg.xml." msgstr "" #. Tag: title +#: configuration.xml:913 #, no-c-format msgid "SQL Dialects" msgstr "" #. Tag: para +#: configuration.xml:915 #, no-c-format msgid "Always set the hibernate.dialect property to the correct org.hibernate.dialect.Dialect subclass for your database. If you specify a dialect, Hibernate will use sensible defaults for some of the other properties listed above. This means that you will not have to specify them manually." msgstr "" #. Tag: title +#: configuration.xml:922 #, no-c-format msgid "Hibernate SQL Dialects (hibernate.dialect)" msgstr "" #. Tag: entry +#: configuration.xml:933 #, no-c-format msgid "RDBMS" msgstr "" #. Tag: entry +#: configuration.xml:935 #, no-c-format msgid "Dialect" msgstr "" #. Tag: entry +#: configuration.xml:941 #, no-c-format -msgid "DB2" -msgstr "" - -#. Tag: entry -#, no-c-format -msgid "org.hibernate.dialect.DB2Dialect" +msgid "DB2" +msgstr "" + +#. Tag: literal +#: configuration.xml:943 +#, no-c-format +msgid "org.hibernate.dialect.DB2Dialect" msgstr "" #. Tag: entry +#: configuration.xml:947 #, no-c-format msgid "DB2 AS/400" msgstr "" -#. Tag: entry +#. Tag: literal +#: configuration.xml:949 #, no-c-format -msgid "org.hibernate.dialect.DB2400Dialect" +msgid "org.hibernate.dialect.DB2400Dialect" msgstr "" #. Tag: entry +#: configuration.xml:953 #, no-c-format msgid "DB2 OS390" msgstr "" -#. Tag: entry +#. Tag: literal +#: configuration.xml:955 #, no-c-format -msgid "org.hibernate.dialect.DB2390Dialect" +msgid "org.hibernate.dialect.DB2390Dialect" msgstr "" #. Tag: entry +#: configuration.xml:959 #, no-c-format msgid "PostgreSQL" msgstr "" -#. Tag: entry +#. Tag: literal +#: configuration.xml:961 #, no-c-format -msgid "org.hibernate.dialect.PostgreSQLDialect" +msgid "org.hibernate.dialect.PostgreSQLDialect" msgstr "" #. Tag: entry +#: configuration.xml:965 #, no-c-format msgid "MySQL" msgstr "" -#. Tag: entry +#. Tag: literal +#: configuration.xml:967 #, no-c-format -msgid "org.hibernate.dialect.MySQLDialect" +msgid "org.hibernate.dialect.MySQLDialect" msgstr "" #. Tag: entry +#: configuration.xml:971 #, no-c-format msgid "MySQL with InnoDB" msgstr "" -#. Tag: entry +#. Tag: literal +#: configuration.xml:973 #, no-c-format -msgid "org.hibernate.dialect.MySQLInnoDBDialect" +msgid "org.hibernate.dialect.MySQLInnoDBDialect" msgstr "" #. Tag: entry +#: configuration.xml:977 #, no-c-format msgid "MySQL with MyISAM" msgstr "" -#. Tag: entry +#. Tag: literal +#: configuration.xml:979 #, no-c-format -msgid "org.hibernate.dialect.MySQLMyISAMDialect" +msgid "org.hibernate.dialect.MySQLMyISAMDialect" msgstr "" #. Tag: entry +#: configuration.xml:983 #, no-c-format msgid "Oracle (any version)" msgstr "" -#. Tag: entry +#. Tag: literal +#: configuration.xml:985 #, no-c-format -msgid "org.hibernate.dialect.OracleDialect" +msgid "org.hibernate.dialect.OracleDialect" msgstr "" #. Tag: entry +#: configuration.xml:989 #, no-c-format msgid "Oracle 9i" msgstr "" -#. Tag: entry +#. Tag: literal +#: configuration.xml:991 #, no-c-format -msgid "org.hibernate.dialect.Oracle9iDialect" +msgid "org.hibernate.dialect.Oracle9iDialect" msgstr "" #. Tag: entry +#: configuration.xml:995 #, no-c-format msgid "Oracle 10g" msgstr "" -#. Tag: entry +#. Tag: literal +#: configuration.xml:997 #, no-c-format -msgid "org.hibernate.dialect.Oracle10gDialect" +msgid "org.hibernate.dialect.Oracle10gDialect" msgstr "" #. Tag: entry +#: configuration.xml:1001 #, no-c-format msgid "Sybase" msgstr "" -#. Tag: entry +#. Tag: literal +#: configuration.xml:1003 #, no-c-format -msgid "org.hibernate.dialect.SybaseDialect" +msgid "org.hibernate.dialect.SybaseDialect" msgstr "" #. Tag: entry +#: configuration.xml:1007 #, no-c-format msgid "Sybase Anywhere" msgstr "" -#. Tag: entry +#. Tag: literal +#: configuration.xml:1009 #, no-c-format -msgid "org.hibernate.dialect.SybaseAnywhereDialect" +msgid "org.hibernate.dialect.SybaseAnywhereDialect" msgstr "" #. Tag: entry +#: configuration.xml:1013 #, no-c-format msgid "Microsoft SQL Server" msgstr "" -#. Tag: entry +#. Tag: literal +#: configuration.xml:1015 #, no-c-format -msgid "org.hibernate.dialect.SQLServerDialect" +msgid "org.hibernate.dialect.SQLServerDialect" msgstr "" #. Tag: entry +#: configuration.xml:1019 #, no-c-format msgid "SAP DB" msgstr "" -#. Tag: entry +#. Tag: literal +#: configuration.xml:1021 #, no-c-format -msgid "org.hibernate.dialect.SAPDBDialect" +msgid "org.hibernate.dialect.SAPDBDialect" msgstr "" #. Tag: entry +#: configuration.xml:1025 #, no-c-format msgid "Informix" msgstr "" -#. Tag: entry +#. Tag: literal +#: configuration.xml:1027 #, no-c-format -msgid "org.hibernate.dialect.InformixDialect" +msgid "org.hibernate.dialect.InformixDialect" msgstr "" #. Tag: entry +#: configuration.xml:1031 #, no-c-format msgid "HypersonicSQL" msgstr "" -#. Tag: entry +#. Tag: literal +#: configuration.xml:1033 #, no-c-format -msgid "org.hibernate.dialect.HSQLDialect" +msgid "org.hibernate.dialect.HSQLDialect" msgstr "" #. Tag: entry +#: configuration.xml:1037 #, no-c-format msgid "Ingres" msgstr "" -#. Tag: entry +#. Tag: literal +#: configuration.xml:1039 #, no-c-format -msgid "org.hibernate.dialect.IngresDialect" +msgid "org.hibernate.dialect.IngresDialect" msgstr "" #. Tag: entry +#: configuration.xml:1043 #, no-c-format msgid "Progress" msgstr "" -#. Tag: entry +#. Tag: literal +#: configuration.xml:1045 #, no-c-format -msgid "org.hibernate.dialect.ProgressDialect" +msgid "org.hibernate.dialect.ProgressDialect" msgstr "" #. Tag: entry +#: configuration.xml:1049 #, no-c-format msgid "Mckoi SQL" msgstr "" -#. Tag: entry +#. Tag: literal +#: configuration.xml:1051 #, no-c-format -msgid "org.hibernate.dialect.MckoiDialect" +msgid "org.hibernate.dialect.MckoiDialect" msgstr "" #. Tag: entry +#: configuration.xml:1055 #, no-c-format msgid "Interbase" msgstr "" -#. Tag: entry +#. Tag: literal +#: configuration.xml:1057 #, no-c-format -msgid "org.hibernate.dialect.InterbaseDialect" +msgid "org.hibernate.dialect.InterbaseDialect" msgstr "" #. Tag: entry +#: configuration.xml:1061 #, no-c-format msgid "Pointbase" msgstr "" -#. Tag: entry +#. Tag: literal +#: configuration.xml:1063 #, no-c-format -msgid "org.hibernate.dialect.PointbaseDialect" +msgid "org.hibernate.dialect.PointbaseDialect" msgstr "" #. Tag: entry +#: configuration.xml:1067 #, no-c-format msgid "FrontBase" msgstr "" -#. Tag: entry +#. Tag: literal +#: configuration.xml:1069 #, no-c-format -msgid "org.hibernate.dialect.FrontbaseDialect" +msgid "org.hibernate.dialect.FrontbaseDialect" msgstr "" #. Tag: entry +#: configuration.xml:1073 #, no-c-format msgid "Firebird" msgstr "" -#. Tag: entry +#. Tag: literal +#: configuration.xml:1075 #, no-c-format -msgid "org.hibernate.dialect.FirebirdDialect" +msgid "org.hibernate.dialect.FirebirdDialect" msgstr "" #. Tag: title +#: configuration.xml:1083 #, no-c-format msgid "Outer Join Fetching" msgstr "" #. Tag: para +#: configuration.xml:1085 #, no-c-format msgid "If your database supports ANSI, Oracle or Sybase style outer joins, outer join fetching will often increase performance by limiting the number of round trips to and from the database. This is, however, at the cost of possibly more work performed by the database itself. Outer join fetching allows a whole graph of objects connected by many-to-one, one-to-many, many-to-many and one-to-one associations to be retrieved in a single SQL SELECT." msgstr "" #. Tag: para +#: configuration.xml:1094 #, no-c-format msgid "Outer join fetching can be disabled globally by setting the property hibernate.max_fetch_depth to 0. A setting of 1 or higher enables outer join fetching for one-to-one and many-to-one associations that have been mapped with fetch=\"join\"." msgstr "" #. Tag: para +#: configuration.xml:1100 #, no-c-format -msgid "See for more information." +msgid "See for more information." msgstr "" #. Tag: title +#: configuration.xml:1105 #, no-c-format msgid "Binary Streams" msgstr "" #. Tag: para +#: configuration.xml:1107 #, no-c-format msgid "Oracle limits the size of byte arrays that can be passed to and/or from its JDBC driver. If you wish to use large instances of binary or serializable type, you should enable hibernate.jdbc.use_streams_for_binary. This is a system-level setting only." msgstr "" #. Tag: title +#: configuration.xml:1116 #, no-c-format msgid "Second-level and query cache" msgstr "" #. Tag: para +#: configuration.xml:1118 #, no-c-format -msgid "The properties prefixed by hibernate.cache allow you to use a process or cluster scoped second-level cache system with Hibernate. See the for more information." +msgid "The properties prefixed by hibernate.cache allow you to use a process or cluster scoped second-level cache system with Hibernate. See the for more information." msgstr "" #. Tag: title +#: configuration.xml:1125 #, no-c-format msgid "Query Language Substitution" msgstr "" #. Tag: para +#: configuration.xml:1127 #, no-c-format msgid "You can define new Hibernate query tokens using hibernate.query.substitutions. For example:" msgstr "" +#. Tag: programlisting +#: configuration.xml:1130 +#, no-c-format +msgid "hibernate.query.substitutions true=1, false=0" +msgstr "" + #. Tag: para +#: configuration.xml:1132 #, no-c-format msgid "This would cause the tokens true and false to be translated to integer literals in the generated SQL." msgstr "" +#. Tag: programlisting +#: configuration.xml:1136 +#, no-c-format +msgid "hibernate.query.substitutions toLowercase=LOWER" +msgstr "" + #. Tag: para +#: configuration.xml:1138 #, no-c-format msgid "This would allow you to rename the SQL LOWER function." msgstr "" #. Tag: title +#: configuration.xml:1143 #, no-c-format msgid "Hibernate statistics" msgstr "" #. Tag: para +#: configuration.xml:1145 #, no-c-format msgid "If you enable hibernate.generate_statistics, Hibernate exposes a number of metrics that are useful when tuning a running system via SessionFactory.getStatistics(). Hibernate can even be configured to expose these statistics via JMX. Read the Javadoc of the interfaces in org.hibernate.stats for more information." msgstr "" #. Tag: title +#: configuration.xml:1155 #, no-c-format msgid "Logging" msgstr "" #. Tag: para +#: configuration.xml:1157 #, no-c-format msgid "Hibernate utilizes Simple Logging Facade for Java (SLF4J) in order to log various system events. SLF4J can direct your logging output to several logging frameworks (NOP, Simple, log4j version 1.2, JDK 1.4 logging, JCL or logback) depending on your chosen binding. In order to setup logging you will need slf4j-api.jar in your classpath together with the jar file for your preferred binding - slf4j-log4j12.jar in the case of Log4J. See the SLF4J documentation for more detail. To use Log4j you will also need to place a log4j.properties file in your classpath. An example properties file is distributed with Hibernate in the src/ directory." msgstr "" #. Tag: para +#: configuration.xml:1171 #, no-c-format msgid "It is recommended that you familiarize yourself with Hibernate's log messages. A lot of work has been put into making the Hibernate log as detailed as possible, without making it unreadable. It is an essential troubleshooting device. The most interesting log categories are the following:" msgstr "" #. Tag: title +#: configuration.xml:1178 #, no-c-format msgid "Hibernate Log Categories" msgstr "" #. Tag: entry +#: configuration.xml:1187 #, no-c-format msgid "Category" msgstr "" #. Tag: entry +#: configuration.xml:1189 #, no-c-format msgid "Function" msgstr "" -#. Tag: entry +#. Tag: literal +#: configuration.xml:1195 #, no-c-format -msgid "org.hibernate.SQL" +msgid "org.hibernate.SQL" msgstr "" #. Tag: entry +#: configuration.xml:1197 #, no-c-format msgid "Log all SQL DML statements as they are executed" msgstr "" -#. Tag: entry +#. Tag: literal +#: configuration.xml:1201 #, no-c-format -msgid "org.hibernate.type" +msgid "org.hibernate.type" msgstr "" #. Tag: entry +#: configuration.xml:1203 #, no-c-format msgid "Log all JDBC parameters" msgstr "" -#. Tag: entry +#. Tag: literal +#: configuration.xml:1207 #, no-c-format -msgid "org.hibernate.tool.hbm2ddl" +msgid "org.hibernate.tool.hbm2ddl" msgstr "" #. Tag: entry +#: configuration.xml:1209 #, no-c-format msgid "Log all SQL DDL statements as they are executed" msgstr "" -#. Tag: entry +#. Tag: literal +#: configuration.xml:1213 #, no-c-format -msgid "org.hibernate.pretty" +msgid "org.hibernate.pretty" msgstr "" #. Tag: entry +#: configuration.xml:1215 #, no-c-format msgid "Log the state of all entities (max 20 entities) associated with the session at flush time" msgstr "" -#. Tag: entry +#. Tag: literal +#: configuration.xml:1220 #, no-c-format -msgid "org.hibernate.cache" +msgid "org.hibernate.cache" msgstr "" #. Tag: entry +#: configuration.xml:1222 #, no-c-format msgid "Log all second-level cache activity" msgstr "" -#. Tag: entry +#. Tag: literal +#: configuration.xml:1226 #, no-c-format -msgid "org.hibernate.transaction" +msgid "org.hibernate.transaction" msgstr "" #. Tag: entry +#: configuration.xml:1228 #, no-c-format msgid "Log transaction related activity" msgstr "" -#. Tag: entry +#. Tag: literal +#: configuration.xml:1232 #, no-c-format -msgid "org.hibernate.jdbc" +msgid "org.hibernate.jdbc" msgstr "" #. Tag: entry +#: configuration.xml:1234 #, no-c-format msgid "Log all JDBC resource acquisition" msgstr "" -#. Tag: entry +#. Tag: literal +#: configuration.xml:1238 #, no-c-format -msgid "org.hibernate.hql.ast.AST" +msgid "org.hibernate.hql.ast.AST" msgstr "" #. Tag: entry +#: configuration.xml:1240 #, no-c-format msgid "Log HQL and SQL ASTs during query parsing" msgstr "" -#. Tag: entry +#. Tag: literal +#: configuration.xml:1244 #, no-c-format -msgid "org.hibernate.secure" +msgid "org.hibernate.secure" msgstr "" #. Tag: entry +#: configuration.xml:1246 #, no-c-format msgid "Log all JAAS authorization requests" msgstr "" -#. Tag: entry +#. Tag: literal +#: configuration.xml:1250 #, no-c-format -msgid "org.hibernate" +msgid "org.hibernate" msgstr "" #. Tag: entry +#: configuration.xml:1252 #, no-c-format msgid "Log everything. This is a lot of information but it is useful for troubleshooting" msgstr "" #. Tag: para +#: configuration.xml:1259 #, no-c-format msgid "When developing applications with Hibernate, you should almost always work with debug enabled for the category org.hibernate.SQL, or, alternatively, the property hibernate.show_sql enabled." msgstr "" #. Tag: title +#: configuration.xml:1266 #, no-c-format msgid "Implementing a NamingStrategy" msgstr "" #. Tag: para +#: configuration.xml:1268 #, no-c-format msgid "The interface org.hibernate.cfg.NamingStrategy allows you to specify a \"naming standard\" for database objects and schema elements." msgstr "" #. Tag: para +#: configuration.xml:1272 #, no-c-format msgid "You can provide rules for automatically generating database identifiers from Java identifiers or for processing \"logical\" column and table names given in the mapping file into \"physical\" table and column names. This feature helps reduce the verbosity of the mapping document, eliminating repetitive noise (TBL_ prefixes, for example). The default strategy used by Hibernate is quite minimal." msgstr "" #. Tag: para +#: configuration.xml:1279 #, no-c-format msgid "You can specify a different strategy by calling Configuration.setNamingStrategy() before adding mappings:" msgstr "" +#. Tag: programlisting +#: configuration.xml:1283 +#, no-c-format +msgid "" + "SessionFactory sf = new Configuration()\n" + " .setNamingStrategy(ImprovedNamingStrategy.INSTANCE)\n" + " .addFile(\"Item.hbm.xml\")\n" + " .addFile(\"Bid.hbm.xml\")\n" + " .buildSessionFactory();" +msgstr "" + #. Tag: para +#: configuration.xml:1285 #, no-c-format msgid "org.hibernate.cfg.ImprovedNamingStrategy is a built-in strategy that might be a useful starting point for some applications." msgstr "" #. Tag: title +#: configuration.xml:1291 #, no-c-format msgid "XML configuration file" msgstr "" #. Tag: para +#: configuration.xml:1293 #, no-c-format msgid "An alternative approach to configuration is to specify a full configuration in a file named hibernate.cfg.xml. This file can be used as a replacement for the hibernate.properties file or, if both are present, to override properties." msgstr "" #. Tag: para +#: configuration.xml:1299 #, no-c-format msgid "The XML configuration file is by default expected to be in the root of your CLASSPATH. Here is an example:" msgstr "" +#. Tag: programlisting +#: configuration.xml:1302 +#, no-c-format +msgid "" + "<?xml version='1.0' encoding='utf-8'?>\n" + "<!DOCTYPE hibernate-configuration PUBLIC\n" + " \"-//Hibernate/Hibernate Configuration DTD//EN\"\n" + " \"http://hibernate.sourceforge.net/hibernate-configuration-3.0.dtd\">\n" + "\n" + "<hibernate-configuration>\n" + "\n" + " <!-- a SessionFactory instance listed as /jndi/name -->\n" + " <session-factory\n" + " name=\"java:hibernate/SessionFactory\">\n" + "\n" + " <!-- properties -->\n" + " <property name=\"connection.datasource\">java:/comp/env/jdbc/MyDB</property>\n" + " <property name=\"dialect\">org.hibernate.dialect.MySQLDialect</property>\n" + " <property name=\"show_sql\">false</property>\n" + " <property name=\"transaction.factory_class\">\n" + " org.hibernate.transaction.JTATransactionFactory\n" + " </property>\n" + " <property name=\"jta.UserTransaction\">java:comp/UserTransaction</property>\n" + "\n" + " <!-- mapping files -->\n" + " <mapping resource=\"org/hibernate/auction/Item.hbm.xml\"/>\n" + " <mapping resource=\"org/hibernate/auction/Bid.hbm.xml\"/>\n" + "\n" + " <!-- cache settings -->\n" + " <class-cache class=\"org.hibernate.auction.Item\" usage=\"read-write\"/>\n" + " <class-cache class=\"org.hibernate.auction.Bid\" usage=\"read-only\"/>\n" + " <collection-cache collection=\"org.hibernate.auction.Item.bids\" usage=\"read-write\"/>\n" + "\n" + " </session-factory>\n" + "\n" + "</hibernate-configuration>" +msgstr "" + #. Tag: para +#: configuration.xml:1304 #, no-c-format msgid "The advantage of this approach is the externalization of the mapping file names to configuration. The hibernate.cfg.xml is also more convenient once you have to tune the Hibernate cache. It is your choice to use either hibernate.properties or hibernate.cfg.xml. Both are equivalent, except for the above mentioned benefits of using the XML syntax." msgstr "" #. Tag: para +#: configuration.xml:1311 #, no-c-format msgid "With the XML configuration, starting Hibernate is then as simple as:" msgstr "" +#. Tag: programlisting +#: configuration.xml:1314 +#, no-c-format +msgid "SessionFactory sf = new Configuration().configure().buildSessionFactory();" +msgstr "" + #. Tag: para +#: configuration.xml:1316 #, no-c-format msgid "You can select a different XML configuration file using:" msgstr "" +#. Tag: programlisting +#: configuration.xml:1318 +#, no-c-format +msgid "" + "SessionFactory sf = new Configuration()\n" + " .configure(\"catdb.cfg.xml\")\n" + " .buildSessionFactory();" +msgstr "" + #. Tag: title +#: configuration.xml:1322 #, no-c-format msgid "J2EE Application Server integration" msgstr "" #. Tag: para +#: configuration.xml:1324 #, no-c-format msgid "Hibernate has the following integration points for J2EE infrastructure:" msgstr "" #. Tag: para +#: configuration.xml:1329 #, no-c-format msgid "Container-managed datasources: Hibernate can use JDBC connections managed by the container and provided through JNDI. Usually, a JTA compatible TransactionManager and a ResourceManager take care of transaction management (CMT), especially distributed transaction handling across several datasources. You can also demarcate transaction boundaries programmatically (BMT), or you might want to use the optional Hibernate Transaction API for this to keep your code portable." msgstr "" #. Tag: para +#: configuration.xml:1343 #, no-c-format msgid "Automatic JNDI binding: Hibernate can bind its SessionFactory to JNDI after startup." msgstr "" #. Tag: para +#: configuration.xml:1350 #, no-c-format msgid "JTA Session binding: the Hibernate Session can be automatically bound to the scope of JTA transactions. Simply lookup the SessionFactory from JNDI and get the current Session. Let Hibernate manage flushing and closing the Session when your JTA transaction completes. Transaction demarcation is either declarative (CMT) or programmatic (BMT/UserTransaction)." msgstr "" #. Tag: para +#: configuration.xml:1362 #, no-c-format msgid "JMX deployment: if you have a JMX capable application server (e.g. JBoss AS), you can choose to deploy Hibernate as a managed MBean. This saves you the one line startup code to build your SessionFactory from a Configuration. The container will startup your HibernateService and also take care of service dependencies (datasource has to be available before Hibernate starts, etc)." msgstr "" #. Tag: para +#: configuration.xml:1373 #, no-c-format msgid "Depending on your environment, you might have to set the configuration option hibernate.connection.aggressive_release to true if your application server shows \"connection containment\" exceptions." msgstr "" #. Tag: title +#: configuration.xml:1379 #, no-c-format msgid "Transaction strategy configuration" msgstr "" #. Tag: para +#: configuration.xml:1381 #, no-c-format msgid "The Hibernate Session API is independent of any transaction demarcation system in your architecture. If you let Hibernate use JDBC directly through a connection pool, you can begin and end your transactions by calling the JDBC API. If you run in a J2EE application server, you might want to use bean-managed transactions and call the JTA API and UserTransaction when needed." msgstr "" #. Tag: para +#: configuration.xml:1389 #, no-c-format msgid "To keep your code portable between these two (and other) environments we recommend the optional Hibernate Transaction API, which wraps and hides the underlying system. You have to specify a factory class for Transaction instances by setting the Hibernate configuration property hibernate.transaction.factory_class." msgstr "" #. Tag: para +#: configuration.xml:1397 #, no-c-format msgid "There are three standard, or built-in, choices:" msgstr "" -#. Tag: term +#. Tag: literal +#: configuration.xml:1401 #, no-c-format -msgid "org.hibernate.transaction.JDBCTransactionFactory" +msgid "org.hibernate.transaction.JDBCTransactionFactory" msgstr "" #. Tag: para +#: configuration.xml:1404 #, no-c-format msgid "delegates to database (JDBC) transactions (default)" msgstr "" -#. Tag: term +#. Tag: literal +#: configuration.xml:1409 #, no-c-format -msgid "org.hibernate.transaction.JTATransactionFactory" +msgid "org.hibernate.transaction.JTATransactionFactory" msgstr "" #. Tag: para +#: configuration.xml:1412 #, no-c-format msgid "delegates to container-managed transactions if an existing transaction is underway in this context (for example, EJB session bean method). Otherwise, a new transaction is started and bean-managed transactions are used." msgstr "" -#. Tag: term +#. Tag: literal +#: configuration.xml:1420 #, no-c-format -msgid "org.hibernate.transaction.CMTTransactionFactory" +msgid "org.hibernate.transaction.CMTTransactionFactory" msgstr "" #. Tag: para +#: configuration.xml:1423 #, no-c-format msgid "delegates to container-managed JTA transactions" msgstr "" #. Tag: para +#: configuration.xml:1428 #, no-c-format msgid "You can also define your own transaction strategies (for a CORBA transaction service, for example)." msgstr "" #. Tag: para +#: configuration.xml:1431 #, no-c-format msgid "Some features in Hibernate (i.e., the second level cache, Contextual Sessions with JTA, etc.) require access to the JTA TransactionManager in a managed environment. In an application server, since J2EE does not standardize a single mechanism, you have to specify how Hibernate should obtain a reference to the TransactionManager:" msgstr "" #. Tag: title +#: configuration.xml:1439 #, no-c-format msgid "JTA TransactionManagers" msgstr "" #. Tag: entry +#: configuration.xml:1448 #, no-c-format msgid "Transaction Factory" msgstr "" #. Tag: entry +#: configuration.xml:1450 #, no-c-format msgid "Application Server" msgstr "" -#. Tag: entry +#. Tag: literal +#: configuration.xml:1456 #, no-c-format -msgid "org.hibernate.transaction.JBossTransactionManagerLookup" +msgid "org.hibernate.transaction.JBossTransactionManagerLookup" msgstr "" #. Tag: entry +#: configuration.xml:1458 #, no-c-format msgid "JBoss" msgstr "" -#. Tag: entry +#. Tag: literal +#: configuration.xml:1462 #, no-c-format -msgid "org.hibernate.transaction.WeblogicTransactionManagerLookup" +msgid "org.hibernate.transaction.WeblogicTransactionManagerLookup" msgstr "" #. Tag: entry +#: configuration.xml:1464 #, no-c-format msgid "Weblogic" msgstr "" -#. Tag: entry +#. Tag: literal +#: configuration.xml:1468 #, no-c-format -msgid "org.hibernate.transaction.WebSphereTransactionManagerLookup" +msgid "org.hibernate.transaction.WebSphereTransactionManagerLookup" msgstr "" #. Tag: entry +#: configuration.xml:1470 #, no-c-format msgid "WebSphere" msgstr "" -#. Tag: entry +#. Tag: literal +#: configuration.xml:1474 #, no-c-format -msgid "org.hibernate.transaction.WebSphereExtendedJTATransactionLookup" +msgid "org.hibernate.transaction.WebSphereExtendedJTATransactionLookup" msgstr "" #. Tag: entry +#: configuration.xml:1476 #, no-c-format msgid "WebSphere 6" msgstr "" -#. Tag: entry +#. Tag: literal +#: configuration.xml:1480 #, no-c-format -msgid "org.hibernate.transaction.OrionTransactionManagerLookup" +msgid "org.hibernate.transaction.OrionTransactionManagerLookup" msgstr "" #. Tag: entry +#: configuration.xml:1482 #, no-c-format msgid "Orion" msgstr "" -#. Tag: entry +#. Tag: literal +#: configuration.xml:1486 #, no-c-format -msgid "org.hibernate.transaction.ResinTransactionManagerLookup" +msgid "org.hibernate.transaction.ResinTransactionManagerLookup" msgstr "" #. Tag: entry +#: configuration.xml:1488 #, no-c-format msgid "Resin" msgstr "" -#. Tag: entry +#. Tag: literal +#: configuration.xml:1492 #, no-c-format -msgid "org.hibernate.transaction.JOTMTransactionManagerLookup" +msgid "org.hibernate.transaction.JOTMTransactionManagerLookup" msgstr "" #. Tag: entry +#: configuration.xml:1494 #, no-c-format msgid "JOTM" msgstr "" -#. Tag: entry +#. Tag: literal +#: configuration.xml:1498 #, no-c-format -msgid "org.hibernate.transaction.JOnASTransactionManagerLookup" +msgid "org.hibernate.transaction.JOnASTransactionManagerLookup" msgstr "" #. Tag: entry +#: configuration.xml:1500 #, no-c-format msgid "JOnAS" msgstr "" -#. Tag: entry +#. Tag: literal +#: configuration.xml:1504 #, no-c-format -msgid "org.hibernate.transaction.JRun4TransactionManagerLookup" +msgid "org.hibernate.transaction.JRun4TransactionManagerLookup" msgstr "" #. Tag: entry +#: configuration.xml:1506 #, no-c-format msgid "JRun4" msgstr "" -#. Tag: entry +#. Tag: literal +#: configuration.xml:1510 #, no-c-format -msgid "org.hibernate.transaction.BESTransactionManagerLookup" +msgid "org.hibernate.transaction.BESTransactionManagerLookup" msgstr "" #. Tag: entry +#: configuration.xml:1512 #, no-c-format msgid "Borland ES" msgstr "" #. Tag: title +#: configuration.xml:1520 #, no-c-format msgid "JNDI-bound SessionFactory" msgstr "" #. Tag: para +#: configuration.xml:1522 #, no-c-format msgid "A JNDI-bound Hibernate SessionFactory can simplify the lookup function of the factory and create new Sessions. This is not, however, related to a JNDI bound Datasource; both simply use the same registry." msgstr "" #. Tag: para +#: configuration.xml:1528 #, no-c-format msgid "If you wish to have the SessionFactory bound to a JNDI namespace, specify a name (e.g. java:hibernate/SessionFactory) using the property hibernate.session_factory_name. If this property is omitted, the SessionFactory will not be bound to JNDI. This is especially useful in environments with a read-only JNDI default implementation (in Tomcat, for example)." msgstr "" #. Tag: para +#: configuration.xml:1536 #, no-c-format msgid "When binding the SessionFactory to JNDI, Hibernate will use the values of hibernate.jndi.url, hibernate.jndi.class to instantiate an initial context. If they are not specified, the default InitialContext will be used." msgstr "" #. Tag: para +#: configuration.xml:1542 #, no-c-format msgid "Hibernate will automatically place the SessionFactory in JNDI after you call cfg.buildSessionFactory(). This means you will have this call in some startup code, or utility class in your application, unless you use JMX deployment with the HibernateService (this is discussed later in greater detail)." msgstr "" #. Tag: para +#: configuration.xml:1550 #, no-c-format msgid "If you use a JNDI SessionFactory, an EJB or any other class, you can obtain the SessionFactory using a JNDI lookup." msgstr "" #. Tag: para +#: configuration.xml:1554 #, no-c-format -msgid "It is recommended that you bind the SessionFactory to JNDI in a managed environment and use a static singleton otherwise. To shield your application code from these details, we also recommend to hide the actual lookup code for a SessionFactory in a helper class, such as HibernateUtil.getSessionFactory(). Note that such a class is also a convenient way to startup Hibernate—see chapter 1." +msgid "It is recommended that you bind the SessionFactory to JNDI in a managed environment and use a static singleton otherwise. To shield your application code from these details, we also recommend to hide the actual lookup code for a SessionFactory in a helper class, such as HibernateUtil.getSessionFactory(). Note that such a class is also a convenient way to startup Hibernate—see chapter 1." msgstr "" #. Tag: title +#: configuration.xml:1565 #, no-c-format msgid "Current Session context management with JTA" msgstr "" #. Tag: para +#: configuration.xml:1567 #, no-c-format -msgid "The easiest way to handle Sessions and transactions is Hibernate's automatic \"current\" Session management. For a discussion of contextual sessions see . Using the \"jta\" session context, if there is no Hibernate Session associated with the current JTA transaction, one will be started and associated with that JTA transaction the first time you call sessionFactory.getCurrentSession(). The Sessions retrieved via getCurrentSession() in the\"jta\" context are set to automatically flush before the transaction completes, close after the transaction completes, and aggressively release JDBC connections after each statement. This allows the Sessions to be managed by the life cycle of the JTA transaction to which it is associated, keeping user code clean of such management concerns. Your code can either use JTA programmatically through UserTransaction, or (recommended for portable code) use the Hibernate Transaction API to set transaction boundaries. If you run in an EJB container, declarative transaction demarcation with CMT is preferred." +msgid "The easiest way to handle Sessions and transactions is Hibernate's automatic \"current\" Session management. For a discussion of contextual sessions see . Using the \"jta\" session context, if there is no Hibernate Session associated with the current JTA transaction, one will be started and associated with that JTA transaction the first time you call sessionFactory.getCurrentSession(). The Sessions retrieved via getCurrentSession() in the \"jta\" context are set to automatically flush before the transaction completes, close after the transaction completes, and aggressively release JDBC connections after each statement. This allows the Sessions to be managed by the life cycle of the JTA transaction to which it is associated, keeping user code clean of such management concerns. Your code can either use JTA programmatically through UserTransaction, or (recommended for portable code) use the Hibernate Transaction API to set transaction boundaries. If you run in an EJB container, declarative transaction demarcation with CMT is preferred." msgstr "" #. Tag: title +#: configuration.xml:1590 #, no-c-format msgid "JMX deployment" msgstr "" #. Tag: para +#: configuration.xml:1592 #, no-c-format msgid "The line cfg.buildSessionFactory() still has to be executed somewhere to get a SessionFactory into JNDI. You can do this either in a static initializer block, like the one in HibernateUtil, or you can deploy Hibernate as a managed service." msgstr "" #. Tag: para +#: configuration.xml:1598 #, no-c-format msgid "Hibernate is distributed with org.hibernate.jmx.HibernateService for deployment on an application server with JMX capabilities, such as JBoss AS. The actual deployment and configuration is vendor-specific. Here is an example jboss-service.xml for JBoss 4.0.x:" msgstr "" +#. Tag: programlisting +#: configuration.xml:1604 +#, no-c-format +msgid "" + "<?xml version=\"1.0\"?>\n" + "<server>\n" + "\n" + "<mbean code=\"org.hibernate.jmx.HibernateService\"\n" + " name=\"jboss.jca:service=HibernateFactory,name=HibernateFactory\">\n" + "\n" + " <!-- Required services -->\n" + " <depends>jboss.jca:service=RARDeployer</depends>\n" + " <depends>jboss.jca:service=LocalTxCM,name=HsqlDS</depends>\n" + "\n" + " <!-- Bind the Hibernate service to JNDI -->\n" + " <attribute name=\"JndiName\">java:/hibernate/SessionFactory</attribute>\n" + "\n" + " <!-- Datasource settings -->\n" + " <attribute name=\"Datasource\">java:HsqlDS</attribute>\n" + " <attribute name=\"Dialect\">org.hibernate.dialect.HSQLDialect</attribute>\n" + "\n" + " <!-- Transaction integration -->\n" + " <attribute name=\"TransactionStrategy\">\n" + " org.hibernate.transaction.JTATransactionFactory</attribute>\n" + " <attribute name=\"TransactionManagerLookupStrategy\">\n" + " org.hibernate.transaction.JBossTransactionManagerLookup</attribute>\n" + " <attribute name=\"FlushBeforeCompletionEnabled\">true</attribute>\n" + " <attribute name=\"AutoCloseSessionEnabled\">true</attribute>\n" + "\n" + " <!-- Fetching options -->\n" + " <attribute name=\"MaximumFetchDepth\">5</attribute>\n" + "\n" + " <!-- Second-level caching -->\n" + " <attribute name=\"SecondLevelCacheEnabled\">true</attribute>\n" + " <attribute name=\"CacheProviderClass\">org.hibernate.cache.EhCacheProvider</attribute>\n" + " <attribute name=\"QueryCacheEnabled\">true</attribute>\n" + "\n" + " <!-- Logging -->\n" + " <attribute name=\"ShowSqlEnabled\">true</attribute>\n" + "\n" + " <!-- Mapping files -->\n" + " <attribute name=\"MapResources\">auction/Item.hbm.xml,auction/Category.hbm.xml</attribute>\n" + "\n" + "</mbean>\n" + "\n" + "</server>" +msgstr "" + #. Tag: para +#: configuration.xml:1606 #, no-c-format msgid "This file is deployed in a directory called META-INF and packaged in a JAR file with the extension .sar (service archive). You also need to package Hibernate, its required third-party libraries, your compiled persistent classes, as well as your mapping files in the same archive. Your enterprise beans (usually session beans) can be kept in their own JAR file, but you can include this EJB JAR file in the main service archive to get a single (hot-)deployable unit. Consult the JBoss AS documentation for more information about JMX service and EJB deployment." msgstr "" diff --git a/documentation/manual/src/main/docbook/pot/content/filters.pot b/documentation/manual/src/main/docbook/pot/content/filters.pot index afcdd06573..3c36999d4d 100644 --- a/documentation/manual/src/main/docbook/pot/content/filters.pot +++ b/documentation/manual/src/main/docbook/pot/content/filters.pot @@ -1,93 +1,248 @@ -# -# AUTHOR , YEAR. +# SOME DESCRIPTIVE TITLE. +# FIRST AUTHOR , YEAR. # +#, fuzzy msgid "" msgstr "" -"Project-Id-Version: 0\n" -"POT-Creation-Date: 2010-02-11T05:38:15\n" -"PO-Revision-Date: 2010-02-11T05:38:15\n" -"Last-Translator: Automatically generated\n" -"Language-Team: None\n" +"Project-Id-Version: PACKAGE VERSION\n" +"Report-Msgid-Bugs-To: http://bugs.kde.org\n" +"POT-Creation-Date: 2010-07-20 21:02+0000\n" +"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" +"Last-Translator: FULL NAME \n" +"Language-Team: LANGUAGE \n" "MIME-Version: 1.0\n" -"Content-Type: application/x-publican; charset=UTF-8\n" +"Content-Type: application/x-xml2pot; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" #. Tag: title +#: filters.xml:31 #, no-c-format msgid "Filtering data" msgstr "" #. Tag: para +#: filters.xml:33 #, no-c-format msgid "Hibernate3 provides an innovative new approach to handling data with \"visibility\" rules. A Hibernate filter is a global, named, parameterized filter that can be enabled or disabled for a particular Hibernate session." msgstr "" #. Tag: title +#: filters.xml:39 #, no-c-format msgid "Hibernate filters" msgstr "" #. Tag: para +#: filters.xml:41 #, no-c-format msgid "Hibernate3 has the ability to pre-define filter criteria and attach those filters at both a class level and a collection level. A filter criteria allows you to define a restriction clause similar to the existing \"where\" attribute available on the class and various collection elements. These filter conditions, however, can be parameterized. The application can then decide at runtime whether certain filters should be enabled and what their parameter values should be. Filters can be used like database views, but they are parameterized inside the application." msgstr "" #. 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 <filter-def/> element within a <hibernate-mapping/> element:" +msgid "Using annotatons filters are defined via @org.hibernate.annotations.FilterDef or @org.hibernate.annotations.FilterDefs. A filter definition has a name() and an array of parameters(). A parameter will allow you to adjust the behavior of the filter at runtime. Each parameter is defined by a @ParamDef which has a name and a type. You can also define a defaultCondition() parameter for a given @FilterDef to set the default condition to use when none are defined in each individual @Filter. @FilterDef(s) can be defined at the class or package level." msgstr "" #. Tag: para +#: filters.xml:63 #, no-c-format -msgid "This filter can then be attached to a class:" +msgid "We now need to define the SQL filter clause applied to either the entity load or the collection load. @Filter is used and placed either on the entity or the collection element. The connection between @FilterName and @Filter is a matching name." +msgstr "" + +#. Tag: title +#: filters.xml:70 +#, no-c-format +msgid "@FilterDef and @Filter annotations" +msgstr "" + +#. Tag: programlisting +#: filters.xml:72 +#, no-c-format +msgid "" + "@Entity\n" + "@FilterDef(name=\"minLength\", parameters=@ParamDef( name=\"minLength\", type=\"integer\" ) )\n" + "@Filters( {\n" + " @Filter(name=\"betweenLength\", condition=\":minLength <= length and :maxLength >= length\"),\n" + " @Filter(name=\"minLength\", condition=\":minLength <= length\")\n" + "} )\n" + "public class Forest { ... }" msgstr "" #. Tag: para +#: filters.xml:75 #, no-c-format -msgid "Or, to a collection:" +msgid "When the collection use an association table as a relational representation, you might want to apply the filter condition to the association table itself or to the target entity table. To apply the constraint on the target entity, use the regular @Filter annotation. However, if you want to target the association table, use the @FilterJoinTable annotation." +msgstr "" + +#. Tag: title +#: filters.xml:84 +#, no-c-format +msgid "Using @FilterJoinTable for filterting on the association table" +msgstr "" + +#. Tag: programlisting +#: filters.xml:87 +#, no-c-format +msgid "" + "@OneToMany\n" + " @JoinTable\n" + " //filter on the target entity table\n" + " @Filter(name=\"betweenLength\", condition=\":minLength <= length and :maxLength >= length\")\n" + " //filter on the association table\n" + " @FilterJoinTable(name=\"security\", condition=\":userlevel >= requredLevel\")\n" + " public Set<Forest> getForests() { ... }" msgstr "" #. Tag: para +#: filters.xml:90 #, no-c-format -msgid "Or, to both or multiples of each at the same time." +msgid "Using Hibernate mapping files for defining filters the situtation is very similar. The filters must first be defined and then attached to the appropriate mapping elements. To define a filter, use the <filter-def/> element within a <hibernate-mapping/> element:" +msgstr "" + +#. Tag: title +#: filters.xml:97 +#, no-c-format +msgid "Defining a filter definition via <filter-def>" +msgstr "" + +#. Tag: programlisting +#: filters.xml:100 +#, no-c-format +msgid "" + "<filter-def name=\"myFilter\">\n" + " <filter-param name=\"myFilterParam\" type=\"string\"/>\n" + "</filter-def>" msgstr "" #. Tag: para +#: filters.xml:103 +#, no-c-format +msgid "This filter can then be attached to a class or collection (or, to both or multiples of each at the same time):" +msgstr "" + +#. Tag: title +#: filters.xml:107 +#, no-c-format +msgid "Attaching a filter to a class or collection using <filter>" +msgstr "" + +#. Tag: programlisting +#: filters.xml:110 +#, no-c-format +msgid "" + "<class name=\"myClass\" ...>\n" + " ...\n" + " <filter name=\"myFilter\" condition=\":myFilterParam = MY_FILTERED_COLUMN\"/>\n" + "\n" + " <set ...>\n" + " <filter name=\"myFilter\" condition=\":myFilterParam = MY_FILTERED_COLUMN\"/>\n" + " </set> \n" + "</class>" +msgstr "" + +#. Tag: para +#: filters.xml:113 #, no-c-format msgid "The methods on Session are: enableFilter(String filterName), getEnabledFilter(String filterName), and disableFilter(String filterName). By default, filters are not enabled for a given session. Filters must be enabled through use of the Session.enableFilter() method, which returns an instance of the Filter interface. If you used the simple filter defined above, it would look like this:" msgstr "" +#. Tag: programlisting +#: filters.xml:123 +#, no-c-format +msgid "session.enableFilter(\"myFilter\").setParameter(\"myFilterParam\", \"some-value\");" +msgstr "" + #. Tag: para +#: filters.xml:125 #, no-c-format msgid "Methods on the org.hibernate.Filter interface do allow the method-chaining common to much of Hibernate." msgstr "" #. Tag: para +#: filters.xml:128 #, no-c-format msgid "The following is a full example, using temporal data with an effective record date pattern:" msgstr "" +#. Tag: programlisting +#: filters.xml:131 +#, no-c-format +msgid "" + "<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:133 #, no-c-format msgid "In order to ensure that you are provided with currently effective records, enable the filter on the session prior to retrieving employee data:" msgstr "" +#. Tag: programlisting +#: filters.xml:137 +#, no-c-format +msgid "" + "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();" +msgstr "" + #. Tag: para +#: filters.xml:139 #, no-c-format msgid "Even though a salary constraint was mentioned explicitly on the results in the above HQL, because of the enabled filter, the query will return only currently active employees who have a salary greater than one million dollars." msgstr "" #. Tag: para +#: filters.xml:144 #, no-c-format msgid "If you want to use filters with outer joining, either through HQL or load fetching, be careful of the direction of the condition expression. It is safest to set this up for left outer joining. Place the parameter first followed by the column name(s) after the operator." msgstr "" #. Tag: para +#: filters.xml:149 #, no-c-format msgid "After being defined, a filter might be attached to multiple entities and/or collections each with its own condition. This can be problematic when the conditions are the same each time. Using <filter-def/> allows you to definine a default condition, either as an attribute or CDATA:" msgstr "" +#. Tag: programlisting +#: filters.xml:155 +#, no-c-format +msgid "" + "<filter-def name=\"myFilter\" condition=\"abc > xyz\">...</filter-def>\n" + "<filter-def name=\"myOtherFilter\">abc=xyz</filter-def>" +msgstr "" + #. Tag: para +#: filters.xml:157 #, no-c-format msgid "This default condition will be used whenever the filter is attached to something without specifying a condition. This means you can give a specific condition as part of the attachment of the filter that overrides the default condition in that particular case." msgstr "" diff --git a/documentation/manual/src/main/docbook/pot/content/performance.pot b/documentation/manual/src/main/docbook/pot/content/performance.pot index 5fe7351df0..933cc52274 100644 --- a/documentation/manual/src/main/docbook/pot/content/performance.pot +++ b/documentation/manual/src/main/docbook/pot/content/performance.pot @@ -1,1103 +1,1898 @@ -# -# AUTHOR , YEAR. +# SOME DESCRIPTIVE TITLE. +# FIRST AUTHOR , YEAR. # +#, fuzzy msgid "" msgstr "" -"Project-Id-Version: 0\n" -"POT-Creation-Date: 2010-02-11T05:38:15\n" -"PO-Revision-Date: 2010-02-11T05:38:15\n" -"Last-Translator: Automatically generated\n" -"Language-Team: None\n" +"Project-Id-Version: PACKAGE VERSION\n" +"Report-Msgid-Bugs-To: http://bugs.kde.org\n" +"POT-Creation-Date: 2010-07-20 21:02+0000\n" +"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" +"Last-Translator: FULL NAME \n" +"Language-Team: LANGUAGE \n" "MIME-Version: 1.0\n" -"Content-Type: application/x-publican; charset=UTF-8\n" +"Content-Type: application/x-xml2pot; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" #. Tag: title +#: performance.xml:31 #, no-c-format msgid "Improving performance" msgstr "" #. Tag: title +#: performance.xml:34 #, no-c-format msgid "Fetching strategies" msgstr "" #. Tag: para +#: performance.xml:36 #, no-c-format msgid "Hibernate uses a fetching strategy to retrieve associated objects if the application needs to navigate the association. Fetch strategies can be declared in the O/R mapping metadata, or over-ridden by a particular HQL or Criteria query." msgstr "" #. Tag: para +#: performance.xml:42 #, no-c-format msgid "Hibernate3 defines the following fetching strategies:" msgstr "" #. Tag: para +#: performance.xml:46 #, no-c-format msgid "Join fetching: Hibernate retrieves the associated instance or collection in the same SELECT, using an OUTER JOIN." msgstr "" #. Tag: para +#: performance.xml:53 #, no-c-format msgid "Select fetching: a second SELECT is used to retrieve the associated entity or collection. Unless you explicitly disable lazy fetching by specifying lazy=\"false\", this second select will only be executed when you access the association." msgstr "" #. Tag: para +#: performance.xml:61 #, no-c-format msgid "Subselect fetching: a second SELECT is used to retrieve the associated collections for all entities retrieved in a previous query or fetch. Unless you explicitly disable lazy fetching by specifying lazy=\"false\", this second select will only be executed when you access the association." msgstr "" #. Tag: para +#: performance.xml:70 #, no-c-format msgid "Batch fetching: an optimization strategy for select fetching. Hibernate retrieves a batch of entity instances or collections in a single SELECT by specifying a list of primary or foreign keys." msgstr "" #. Tag: para +#: performance.xml:77 #, no-c-format msgid "Hibernate also distinguishes between:" msgstr "" #. Tag: para +#: performance.xml:81 #, no-c-format msgid "Immediate fetching: an association, collection or attribute is fetched immediately when the owner is loaded." msgstr "" #. Tag: para +#: performance.xml:87 #, no-c-format msgid "Lazy collection fetching: a collection is fetched when the application invokes an operation upon that collection. This is the default for collections." msgstr "" #. Tag: para +#: performance.xml:93 #, no-c-format msgid "\"Extra-lazy\" collection fetching: individual elements of the collection are accessed from the database as needed. Hibernate tries not to fetch the whole collection into memory unless absolutely needed. It is suitable for large collections." msgstr "" #. Tag: para +#: performance.xml:101 #, no-c-format msgid "Proxy fetching: a single-valued association is fetched when a method other than the identifier getter is invoked upon the associated object." msgstr "" #. Tag: para +#: performance.xml:107 #, no-c-format msgid "\"No-proxy\" fetching: a single-valued association is fetched when the instance variable is accessed. Compared to proxy fetching, this approach is less lazy; the association is fetched even when only the identifier is accessed. It is also more transparent, since no proxy is visible to the application. This approach requires buildtime bytecode instrumentation and is rarely necessary." msgstr "" #. Tag: para +#: performance.xml:117 #, no-c-format msgid "Lazy attribute fetching: an attribute or single valued association is fetched when the instance variable is accessed. This approach requires buildtime bytecode instrumentation and is rarely necessary." msgstr "" #. Tag: para +#: performance.xml:124 #, no-c-format msgid "We have two orthogonal notions here: when is the association fetched and how is it fetched. It is important that you do not confuse them. We use fetch to tune performance. We can use lazy to define a contract for what data is always available in any detached instance of a particular class." msgstr "" #. Tag: title +#: performance.xml:132 #, no-c-format msgid "Working with lazy associations" msgstr "" #. Tag: para +#: performance.xml:134 #, no-c-format msgid "By default, Hibernate3 uses lazy select fetching for collections and lazy proxy fetching for single-valued associations. These defaults make sense for most associations in the majority of applications." msgstr "" #. Tag: para +#: performance.xml:138 #, no-c-format msgid "If you set hibernate.default_batch_fetch_size, Hibernate will use the batch fetch optimization for lazy fetching. This optimization can also be enabled at a more granular level." msgstr "" #. Tag: para +#: performance.xml:142 #, no-c-format msgid "Please be aware that access to a lazy association outside of the context of an open Hibernate session will result in an exception. For example:" msgstr "" +#. Tag: programlisting +#: performance.xml:146 +#, no-c-format +msgid "" + "s = sessions.openSession();\n" + "Transaction tx = s.beginTransaction();\n" + " \n" + "User u = (User) s.createQuery(\"from User u where u.name=:userName\")\n" + " .setString(\"userName\", userName).uniqueResult();\n" + "Map permissions = u.getPermissions();\n" + "\n" + "tx.commit();\n" + "s.close();\n" + "\n" + "Integer accessLevel = (Integer) permissions.get(\"accounts\"); // Error!" +msgstr "" + #. Tag: para +#: performance.xml:148 #, no-c-format msgid "Since the permissions collection was not initialized when the Session was closed, the collection will not be able to load its state. Hibernate does not support lazy initialization for detached objects. This can be fixed by moving the code that reads from the collection to just before the transaction is committed." msgstr "" #. Tag: para +#: performance.xml:155 #, no-c-format msgid "Alternatively, you can use a non-lazy collection or association, by specifying lazy=\"false\" for the association mapping. However, it is intended that lazy initialization be used for almost all collections and associations. If you define too many non-lazy associations in your object model, Hibernate will fetch the entire database into memory in every transaction." msgstr "" #. Tag: para +#: performance.xml:162 #, no-c-format msgid "On the other hand, you can use join fetching, which is non-lazy by nature, instead of select fetching in a particular transaction. We will now explain how to customize the fetching strategy. In Hibernate3, the mechanisms for choosing a fetch strategy are identical for single-valued associations and collections." msgstr "" #. Tag: title +#: performance.xml:170 #, no-c-format msgid "Tuning fetch strategies" msgstr "" #. Tag: para +#: performance.xml:172 #, no-c-format msgid "Select fetching (the default) is extremely vulnerable to N+1 selects problems, so we might want to enable join fetching in the mapping document:" msgstr "" +#. Tag: programlisting +#: performance.xml:176 +#, no-c-format +msgid "" + "<set name=\"permissions\"\n" + " fetch=\"join\">\n" + " <key column=\"userId\"/>\n" + " <one-to-many class=\"Permission\"/>\n" + "</set" +msgstr "" + +#. Tag: programlisting +#: performance.xml:178 +#, no-c-format +msgid "<many-to-one name=\"mother\" class=\"Cat\" fetch=\"join\"/>" +msgstr "" + #. Tag: para +#: performance.xml:180 #, no-c-format msgid "The fetch strategy defined in the mapping document affects:" msgstr "" #. Tag: para +#: performance.xml:185 #, no-c-format msgid "retrieval via get() or load()" msgstr "" #. Tag: para +#: performance.xml:190 #, no-c-format msgid "retrieval that happens implicitly when an association is navigated" msgstr "" #. Tag: para +#: performance.xml:195 #, no-c-format msgid "Criteria queries" msgstr "" #. Tag: para +#: performance.xml:199 #, no-c-format msgid "HQL queries if subselect fetching is used" msgstr "" #. Tag: para +#: performance.xml:204 #, no-c-format msgid "Irrespective of the fetching strategy you use, the defined non-lazy graph is guaranteed to be loaded into memory. This might, however, result in several immediate selects being used to execute a particular HQL query." msgstr "" #. Tag: para +#: performance.xml:209 #, no-c-format msgid "Usually, the mapping document is not used to customize fetching. Instead, we keep the default behavior, and override it for a particular transaction, using left join fetch in HQL. This tells Hibernate to fetch the association eagerly in the first select, using an outer join. In the Criteria query API, you would use setFetchMode(FetchMode.JOIN)." msgstr "" #. Tag: para +#: performance.xml:216 #, no-c-format msgid "If you want to change the fetching strategy used by get() or load(), you can use a Criteria query. For example:" msgstr "" +#. Tag: programlisting +#: performance.xml:220 +#, no-c-format +msgid "" + "User user = (User) session.createCriteria(User.class)\n" + " .setFetchMode(\"permissions\", FetchMode.JOIN)\n" + " .add( Restrictions.idEq(userId) )\n" + " .uniqueResult();" +msgstr "" + #. Tag: para +#: performance.xml:222 #, no-c-format msgid "This is Hibernate's equivalent of what some ORM solutions call a \"fetch plan\"." msgstr "" #. Tag: para +#: performance.xml:225 #, no-c-format msgid "A completely different approach to problems with N+1 selects is to use the second-level cache." msgstr "" #. Tag: title +#: performance.xml:230 #, no-c-format msgid "Single-ended association proxies" msgstr "" #. Tag: para +#: performance.xml:232 #, no-c-format msgid "Lazy fetching for collections is implemented using Hibernate's own implementation of persistent collections. However, a different mechanism is needed for lazy behavior in single-ended associations. The target entity of the association must be proxied. Hibernate implements lazy initializing proxies for persistent objects using runtime bytecode enhancement which is accessed via the CGLIB library." msgstr "" #. Tag: para +#: performance.xml:239 #, no-c-format msgid "At startup, Hibernate3 generates proxies by default for all persistent classes and uses them to enable lazy fetching of many-to-one and one-to-one associations." msgstr "" #. Tag: para +#: performance.xml:244 #, no-c-format msgid "The mapping file may declare an interface to use as the proxy interface for that class, with the proxy attribute. By default, Hibernate uses a subclass of the class. The proxied class must implement a default constructor with at least package visibility. This constructor is recommended for all persistent classes." msgstr "" #. Tag: para +#: performance.xml:251 #, no-c-format msgid "There are potential problems to note when extending this approach to polymorphic classes.For example:" msgstr "" +#. Tag: programlisting +#: performance.xml:254 +#, no-c-format +msgid "" + "<class name=\"Cat\" proxy=\"Cat\">\n" + " ......\n" + " <subclass name=\"DomesticCat\">\n" + " .....\n" + " </subclass>\n" + "</class>" +msgstr "" + #. Tag: para +#: performance.xml:256 #, no-c-format msgid "Firstly, instances of Cat will never be castable to DomesticCat, even if the underlying instance is an instance of DomesticCat:" msgstr "" +#. Tag: programlisting +#: performance.xml:260 +#, no-c-format +msgid "" + "Cat cat = (Cat) session.load(Cat.class, id); // instantiate a proxy (does not hit the db)\n" + "if ( cat.isDomesticCat() ) { // hit the db to initialize the proxy\n" + " DomesticCat dc = (DomesticCat) cat; // Error!\n" + " ....\n" + "}" +msgstr "" + #. Tag: para +#: performance.xml:262 #, no-c-format msgid "Secondly, it is possible to break proxy ==:" msgstr "" +#. Tag: programlisting +#: performance.xml:265 +#, no-c-format +msgid "" + "Cat cat = (Cat) session.load(Cat.class, id); // instantiate a Cat proxy\n" + "DomesticCat dc = \n" + " (DomesticCat) session.load(DomesticCat.class, id); // acquire new DomesticCat proxy!\n" + "System.out.println(cat==dc); // false" +msgstr "" + #. Tag: para +#: performance.xml:267 #, no-c-format msgid "However, the situation is not quite as bad as it looks. Even though we now have two references to different proxy objects, the underlying instance will still be the same object:" msgstr "" +#. Tag: programlisting +#: performance.xml:271 +#, no-c-format +msgid "" + "cat.setWeight(11.0); // hit the db to initialize the proxy\n" + "System.out.println( dc.getWeight() ); // 11.0" +msgstr "" + #. Tag: para +#: performance.xml:273 #, no-c-format msgid "Third, you cannot use a CGLIB proxy for a final class or a class with any final methods." msgstr "" #. Tag: para +#: performance.xml:276 #, no-c-format msgid "Finally, if your persistent object acquires any resources upon instantiation (e.g. in initializers or default constructor), then those resources will also be acquired by the proxy. The proxy class is an actual subclass of the persistent class." msgstr "" #. Tag: para +#: performance.xml:281 #, no-c-format msgid "These problems are all due to fundamental limitations in Java's single inheritance model. To avoid these problems your persistent classes must each implement an interface that declares its business methods. You should specify these interfaces in the mapping file where CatImpl implements the interface Cat and DomesticCatImpl implements the interface DomesticCat. For example:" msgstr "" +#. Tag: programlisting +#: performance.xml:289 +#, no-c-format +msgid "" + "<class name=\"CatImpl\" proxy=\"Cat\">\n" + " ......\n" + " <subclass name=\"DomesticCatImpl\" proxy=\"DomesticCat\">\n" + " .....\n" + " </subclass>\n" + "</class>" +msgstr "" + #. Tag: para +#: performance.xml:291 #, no-c-format msgid "Then proxies for instances of Cat and DomesticCat can be returned by load() or iterate()." msgstr "" +#. Tag: programlisting +#: performance.xml:295 +#, no-c-format +msgid "" + "Cat cat = (Cat) session.load(CatImpl.class, catid);\n" + "Iterator iter = session.createQuery(\"from CatImpl as cat where cat.name='fritz'\").iterate();\n" + "Cat fritz = (Cat) iter.next();" +msgstr "" + #. Tag: title +#: performance.xml:298 #, no-c-format msgid "Note" msgstr "" #. Tag: para +#: performance.xml:300 #, no-c-format msgid "list() does not usually return proxies." msgstr "" #. Tag: para +#: performance.xml:304 #, no-c-format msgid "Relationships are also lazily initialized. This means you must declare any properties to be of type Cat, not CatImpl." msgstr "" #. Tag: para +#: performance.xml:308 #, no-c-format msgid "Certain operations do not require proxy initialization:" msgstr "" #. Tag: para +#: performance.xml:313 #, no-c-format msgid "equals(): if the persistent class does not override equals()" msgstr "" #. Tag: para +#: performance.xml:318 #, no-c-format msgid "hashCode(): if the persistent class does not override hashCode()" msgstr "" #. Tag: para +#: performance.xml:323 #, no-c-format msgid "The identifier getter method" msgstr "" #. Tag: para +#: performance.xml:327 #, no-c-format msgid "Hibernate will detect persistent classes that override equals() or hashCode()." msgstr "" #. Tag: para +#: performance.xml:330 #, no-c-format msgid "By choosing lazy=\"no-proxy\" instead of the default lazy=\"proxy\", you can avoid problems associated with typecasting. However, buildtime bytecode instrumentation is required, and all operations will result in immediate proxy initialization." msgstr "" #. Tag: title +#: performance.xml:338 #, no-c-format msgid "Initializing collections and proxies" msgstr "" #. Tag: para +#: performance.xml:340 #, no-c-format msgid "A LazyInitializationException will be thrown by Hibernate if an uninitialized collection or proxy is accessed outside of the scope of the Session, i.e., when the entity owning the collection or having the reference to the proxy is in the detached state." msgstr "" #. Tag: para +#: performance.xml:346 #, no-c-format msgid "Sometimes a proxy or collection needs to be initialized before closing the Session. You can force initialization by calling cat.getSex() or cat.getKittens().size(), for example. However, this can be confusing to readers of the code and it is not convenient for generic code." msgstr "" #. Tag: para +#: performance.xml:353 #, no-c-format msgid "The static methods Hibernate.initialize() and Hibernate.isInitialized(), provide the application with a convenient way of working with lazily initialized collections or proxies. Hibernate.initialize(cat) will force the initialization of a proxy, cat, as long as its Session is still open. Hibernate.initialize( cat.getKittens() ) has a similar effect for the collection of kittens." msgstr "" #. Tag: para +#: performance.xml:362 #, no-c-format msgid "Another option is to keep the Session open until all required collections and proxies have been loaded. In some application architectures, particularly where the code that accesses data using Hibernate, and the code that uses it are in different application layers or different physical processes, it can be a problem to ensure that the Session is open when a collection is initialized. There are two basic ways to deal with this issue:" msgstr "" #. Tag: para +#: performance.xml:372 #, no-c-format msgid "In a web-based application, a servlet filter can be used to close the Session only at the end of a user request, once the rendering of the view is complete (the Open Session in View pattern). Of course, this places heavy demands on the correctness of the exception handling of your application infrastructure. It is vitally important that the Session is closed and the transaction ended before returning to the user, even when an exception occurs during rendering of the view. See the Hibernate Wiki for examples of this \"Open Session in View\" pattern." msgstr "" #. Tag: para +#: performance.xml:385 #, no-c-format msgid "In an application with a separate business tier, the business logic must \"prepare\" all collections that the web tier needs before returning. This means that the business tier should load all the data and return all the data already initialized to the presentation/web tier that is required for a particular use case. Usually, the application calls Hibernate.initialize() for each collection that will be needed in the web tier (this call must occur before the session is closed) or retrieves the collection eagerly using a Hibernate query with a FETCH clause or a FetchMode.JOIN in Criteria. This is usually easier if you adopt the Command pattern instead of a Session Facade." msgstr "" #. Tag: para +#: performance.xml:401 #, no-c-format msgid "You can also attach a previously loaded object to a new Session with merge() or lock() before accessing uninitialized collections or other proxies. Hibernate does not, and certainly should not, do this automatically since it would introduce impromptu transaction semantics." msgstr "" #. Tag: para +#: performance.xml:410 #, no-c-format msgid "Sometimes you do not want to initialize a large collection, but still need some information about it, like its size, for example, or a subset of the data." msgstr "" #. Tag: para +#: performance.xml:414 #, no-c-format msgid "You can use a collection filter to get the size of a collection without initializing it:" msgstr "" +#. Tag: programlisting +#: performance.xml:417 +#, no-c-format +msgid "( (Integer) s.createFilter( collection, \"select count(*)\" ).list().get(0) ).intValue()" +msgstr "" + #. Tag: para +#: performance.xml:419 #, no-c-format msgid "The createFilter() method is also used to efficiently retrieve subsets of a collection without needing to initialize the whole collection:" msgstr "" +#. Tag: programlisting +#: performance.xml:423 +#, no-c-format +msgid "s.createFilter( lazyCollection, \"\").setFirstResult(0).setMaxResults(10).list();" +msgstr "" + #. Tag: title +#: performance.xml:427 #, no-c-format msgid "Using batch fetching" msgstr "" #. Tag: para +#: performance.xml:429 #, no-c-format msgid "Using batch fetching, Hibernate can load several uninitialized proxies if one proxy is accessed. Batch fetching is an optimization of the lazy select fetching strategy. There are two ways you can configure batch fetching: on the class level and the collection level." msgstr "" #. Tag: para +#: performance.xml:434 #, no-c-format msgid "Batch fetching for classes/entities is easier to understand. Consider the following example: at runtime you have 25 Cat instances loaded in a Session, and each Cat has a reference to its owner, a Person. The Person class is mapped with a proxy, lazy=\"true\". If you now iterate through all cats and call getOwner() on each, Hibernate will, by default, execute 25 SELECT statements to retrieve the proxied owners. You can tune this behavior by specifying a batch-size in the mapping of Person:" msgstr "" +#. Tag: programlisting +#: performance.xml:447 +#, no-c-format +msgid "<class name=\"Person\" batch-size=\"10\">...</class>" +msgstr "" + #. Tag: para +#: performance.xml:449 #, no-c-format msgid "Hibernate will now execute only three queries: the pattern is 10, 10, 5." msgstr "" #. Tag: para +#: performance.xml:452 #, no-c-format msgid "You can also enable batch fetching of collections. For example, if each Person has a lazy collection of Cats, and 10 persons are currently loaded in the Session, iterating through all persons will generate 10 SELECTs, one for every call to getCats(). If you enable batch fetching for the cats collection in the mapping of Person, Hibernate can pre-fetch collections:" msgstr "" +#. Tag: programlisting +#: performance.xml:461 +#, no-c-format +msgid "" + "<class name=\"Person\">\n" + " <set name=\"cats\" batch-size=\"3\">\n" + " ...\n" + " </set>\n" + "</class>" +msgstr "" + #. Tag: para +#: performance.xml:463 #, no-c-format msgid "With a batch-size of 3, Hibernate will load 3, 3, 3, 1 collections in four SELECTs. Again, the value of the attribute depends on the expected number of uninitialized collections in a particular Session." msgstr "" #. Tag: para +#: performance.xml:468 #, no-c-format msgid "Batch fetching of collections is particularly useful if you have a nested tree of items, i.e. the typical bill-of-materials pattern. However, a nested set or a materialized path might be a better option for read-mostly trees." msgstr "" #. Tag: title +#: performance.xml:475 #, no-c-format msgid "Using subselect fetching" msgstr "" #. Tag: para +#: performance.xml:477 #, no-c-format msgid "If one lazy collection or single-valued proxy has to be fetched, Hibernate will load all of them, re-running the original query in a subselect. This works in the same way as batch-fetching but without the piecemeal loading." msgstr "" #. Tag: title +#: performance.xml:486 #, no-c-format msgid "Fetch profiles" msgstr "" #. Tag: para +#: performance.xml:488 #, no-c-format -msgid "Another way to affect the fetching strategy for loading associated objects is through something called a fetch profile, which is a named configuration associated with the org.hibernate.SessionFactory but enabled, by name, on the org.hibernate.Session. Once enabled on a org.hibernate.Session, the fetch profile wull be in affect for that org.hibernate.Session until it is explicitly disabled." +msgid "Another way to affect the fetching strategy for loading associated objects is through something called a fetch profile, which is a named configuration associated with the org.hibernate.SessionFactory but enabled, by name, on the org.hibernate.Session. Once enabled on a org.hibernate.Session, the fetch profile will be in affect for that org.hibernate.Session until it is explicitly disabled." msgstr "" #. Tag: para +#: performance.xml:498 #, no-c-format -msgid "So what does that mean? Well lets explain that by way of an example. Say we have the following mappings:" +msgid "So what does that mean? Well lets explain that by way of an example which show the different available approaches to configure a fetch profile:" +msgstr "" + +#. Tag: title +#: performance.xml:503 +#, no-c-format +msgid "Specifying a fetch profile using @FetchProfile" +msgstr "" + +#. Tag: programlisting +#: performance.xml:506 +#, no-c-format +msgid "" + "@Entity\n" + "@FetchProfile(name = \"customer-with-orders\", fetchOverrides = {\n" + " @FetchProfile.FetchOverride(entity = Customer.class, association = \"orders\", mode = FetchMode.JOIN)\n" + "})\n" + "public class Customer {\n" + " @Id\n" + " @GeneratedValue\n" + " private long id;\n" + "\n" + " private String name;\n" + "\n" + " private long customerNumber;\n" + "\n" + " @OneToMany\n" + " private Set<Order> orders;\n" + "\n" + " // standard getter/setter\n" + " ...\n" + "}" +msgstr "" + +#. Tag: title +#: performance.xml:510 +#, no-c-format +msgid "Specifying a fetch profile using <fetch-profile> outside <class> node" +msgstr "" + +#. Tag: programlisting +#: performance.xml:514 +#, no-c-format +msgid "" + "<hibernate-mapping>\n" + " <class name=\"Customer\">\n" + " ...\n" + " <set name=\"orders\" inverse=\"true\">\n" + " <key column=\"cust_id\"/>\n" + " <one-to-many class=\"Order\"/>\n" + " </set>\n" + " </class>\n" + " <class name=\"Order\">\n" + " ...\n" + " </class>\n" + " <fetch-profile name=\"customer-with-orders\">\n" + " <fetch entity=\"Customer\" association=\"orders\" style=\"join\"/>\n" + " </fetch-profile>\n" + "</hibernate-mapping>" +msgstr "" + +#. Tag: title +#: performance.xml:518 +#, no-c-format +msgid "Specifying a fetch profile using <fetch-profile> inside <class> node" +msgstr "" + +#. Tag: programlisting +#: performance.xml:522 +#, no-c-format +msgid "" + "<hibernate-mapping>\n" + " <class name=\"Customer\">\n" + " ...\n" + " <set name=\"orders\" inverse=\"true\">\n" + " <key column=\"cust_id\"/>\n" + " <one-to-many class=\"Order\"/>\n" + " </set>\n" + " <fetch-profile name=\"customer-with-orders\">\n" + " <fetch association=\"orders\" style=\"join\"/>\n" + " </fetch-profile>\n" + " </class>\n" + " <class name=\"Order\">\n" + " ...\n" + " </class>\n" + "</hibernate-mapping>" msgstr "" #. Tag: para +#: performance.xml:525 #, no-c-format -msgid "Now normally when you get a reference to a particular customer, that customer's set of orders will be lazy meaning we will not yet have loaded those orders from the database. Normally this is a good thing. Now lets say that you have a certain use case where it is more efficient to load the customer and their orders together. One way certainly is to use \"dynamic fetching\" strategies via an HQL or criteria queries. But another option is to use a fetch profile to achieve that. Just add the following to your mapping:" +msgid "Now normally when you get a reference to a particular customer, that customer's set of orders will be lazy meaning we will not yet have loaded those orders from the database. Normally this is a good thing. Now lets say that you have a certain use case where it is more efficient to load the customer and their orders together. One way certainly is to use \"dynamic fetching\" strategies via an HQL or criteria queries. But another option is to use a fetch profile to achieve that. The following code will load both the customer andtheir orders:" +msgstr "" + +#. Tag: title +#: performance.xml:536 +#, no-c-format +msgid "Activating a fetch profile for a given Session" +msgstr "" + +#. Tag: programlisting +#: performance.xml:539 +#, no-c-format +msgid "" + "Session session = ...;\n" + "session.enableFetchProfile( \"customer-with-orders\" ); // name matches from mapping\n" + "Customer customer = (Customer) session.get( Customer.class, customerId );" msgstr "" #. Tag: para +#: performance.xml:543 #, no-c-format -msgid "or even:" -msgstr "" - -#. Tag: para -#, no-c-format -msgid "Now the following code will actually load both the customer and their orders:" +msgid "@FetchProfile definitions are global and it does not matter on which class you place them. You can place the @FetchProfile annotation either onto a class or package (package-info.java). In order to define multiple fetch profiles for the same class or package @FetchProfiles can be used." msgstr "" #. Tag: para +#: performance.xml:551 #, no-c-format msgid "Currently only join style fetch profiles are supported, but they plan is to support additional styles. See HHH-3414 for details." msgstr "" #. Tag: title +#: performance.xml:558 #, no-c-format msgid "Using lazy property fetching" msgstr "" #. Tag: para +#: performance.xml:560 #, no-c-format msgid "Hibernate3 supports the lazy fetching of individual properties. This optimization technique is also known as fetch groups. Please note that this is mostly a marketing feature; optimizing row reads is much more important than optimization of column reads. However, only loading some properties of a class could be useful in extreme cases. For example, when legacy tables have hundreds of columns and the data model cannot be improved." msgstr "" #. Tag: para +#: performance.xml:568 #, no-c-format msgid "To enable lazy property loading, set the lazy attribute on your particular property mappings:" msgstr "" +#. Tag: programlisting +#: performance.xml:571 +#, no-c-format +msgid "" + "<class name=\"Document\">\n" + " <id name=\"id\">\n" + " <generator class=\"native\"/>\n" + " </id>\n" + " <property name=\"name\" not-null=\"true\" length=\"50\"/>\n" + " <property name=\"summary\" not-null=\"true\" length=\"200\" lazy=\"true\"/>\n" + " <property name=\"text\" not-null=\"true\" length=\"2000\" lazy=\"true\"/>\n" + "</class>" +msgstr "" + #. Tag: para +#: performance.xml:573 #, no-c-format msgid "Lazy property loading requires buildtime bytecode instrumentation. If your persistent classes are not enhanced, Hibernate will ignore lazy property settings and return to immediate fetching." msgstr "" #. Tag: para +#: performance.xml:577 #, no-c-format msgid "For bytecode instrumentation, use the following Ant task:" msgstr "" +#. Tag: programlisting +#: performance.xml:579 +#, no-c-format +msgid "" + "<target name=\"instrument\" depends=\"compile\">\n" + " <taskdef name=\"instrument\" classname=\"org.hibernate.tool.instrument.InstrumentTask\">\n" + " <classpath path=\"${jar.path}\"/>\n" + " <classpath path=\"${classes.dir}\"/>\n" + " <classpath refid=\"lib.class.path\"/>\n" + " </taskdef>\n" + "\n" + " <instrument verbose=\"true\">\n" + " <fileset dir=\"${testclasses.dir}/org/hibernate/auction/model\">\n" + " <include name=\"*.class\"/>\n" + " </fileset>\n" + " </instrument>\n" + "</target>" +msgstr "" + #. Tag: para +#: performance.xml:581 #, no-c-format msgid "A different way of avoiding unnecessary column reads, at least for read-only transactions, is to use the projection features of HQL or Criteria queries. This avoids the need for buildtime bytecode processing and is certainly a preferred solution." msgstr "" #. Tag: para +#: performance.xml:586 #, no-c-format msgid "You can force the usual eager fetching of properties using fetch all properties in HQL." msgstr "" #. Tag: title +#: performance.xml:592 #, no-c-format msgid "The Second Level Cache" msgstr "" #. Tag: para +#: performance.xml:594 #, no-c-format msgid "A Hibernate Session is a transaction-level cache of persistent data. It is possible to configure a cluster or JVM-level (SessionFactory-level) cache on a class-by-class and collection-by-collection basis. You can even plug in a clustered cache. Be aware that caches are not aware of changes made to the persistent store by another application. They can, however, be configured to regularly expire cached data." msgstr "" #. Tag: para +#: performance.xml:602 #, no-c-format -msgid "You have the option to tell Hibernate which caching implementation to use by specifying the name of a class that implements org.hibernate.cache.CacheProvider using the property hibernate.cache.provider_class. Hibernate is bundled with a number of built-in integrations with the open-source cache providers that are listed below. You can also implement your own and plug it in as outlined above. Note that versions prior to 3.2 use EhCache as the default cache provider." +msgid "You have the option to tell Hibernate which caching implementation to use by specifying the name of a class that implements org.hibernate.cache.CacheProvider using the property hibernate.cache.provider_class. Hibernate is bundled with a number of built-in integrations with the open-source cache providers that are listed in . You can also implement your own and plug it in as outlined above. Note that versions prior to Hibernate 3.2 use EhCache as the default cache provider." msgstr "" #. Tag: title +#: performance.xml:613 #, no-c-format msgid "Cache Providers" msgstr "" #. Tag: entry +#: performance.xml:628 performance.xml:976 #, no-c-format msgid "Cache" msgstr "" #. Tag: entry +#: performance.xml:630 #, no-c-format msgid "Provider class" msgstr "" #. Tag: entry +#: performance.xml:632 #, no-c-format msgid "Type" msgstr "" #. Tag: entry +#: performance.xml:634 #, no-c-format msgid "Cluster Safe" msgstr "" #. Tag: entry +#: performance.xml:636 #, no-c-format msgid "Query Cache Supported" msgstr "" #. Tag: entry +#: performance.xml:642 performance.xml:990 #, no-c-format msgid "Hashtable (not intended for production use)" msgstr "" -#. Tag: entry +#. Tag: literal +#: performance.xml:644 #, no-c-format -msgid "org.hibernate.cache.HashtableCacheProvider" +msgid "org.hibernate.cache.HashtableCacheProvider" msgstr "" #. Tag: entry +#: performance.xml:646 #, no-c-format msgid "memory" msgstr "" #. Tag: entry +#: performance.xml:650 performance.xml:662 performance.xml:674 performance.xml:992 performance.xml:994 performance.xml:996 performance.xml:1004 performance.xml:1006 performance.xml:1008 performance.xml:1016 performance.xml:1018 performance.xml:1020 performance.xml:1028 performance.xml:1030 performance.xml:1040 performance.xml:1046 performance.xml:1052 performance.xml:1058 #, no-c-format -msgid "yes" +msgid "yes" msgstr "" #. Tag: entry +#: performance.xml:654 performance.xml:1002 #, no-c-format msgid "EHCache" msgstr "" -#. Tag: entry +#. Tag: literal +#: performance.xml:656 #, no-c-format -msgid "org.hibernate.cache.EhCacheProvider" +msgid "org.hibernate.cache.EhCacheProvider" msgstr "" #. Tag: entry +#: performance.xml:658 performance.xml:670 #, no-c-format msgid "memory, disk" msgstr "" #. Tag: entry +#: performance.xml:666 performance.xml:1014 #, no-c-format msgid "OSCache" msgstr "" -#. Tag: entry +#. Tag: literal +#: performance.xml:668 #, no-c-format -msgid "org.hibernate.cache.OSCacheProvider" +msgid "org.hibernate.cache.OSCacheProvider" msgstr "" #. Tag: entry +#: performance.xml:678 performance.xml:1026 #, no-c-format msgid "SwarmCache" msgstr "" -#. Tag: entry +#. Tag: literal +#: performance.xml:680 #, no-c-format -msgid "org.hibernate.cache.SwarmCacheProvider" +msgid "org.hibernate.cache.SwarmCacheProvider" msgstr "" #. Tag: entry +#: performance.xml:682 #, no-c-format msgid "clustered (ip multicast)" msgstr "" #. Tag: entry +#: performance.xml:684 #, no-c-format msgid "yes (clustered invalidation)" msgstr "" #. Tag: entry +#: performance.xml:690 performance.xml:1038 #, no-c-format msgid "JBoss Cache 1.x" msgstr "" -#. Tag: entry +#. Tag: literal +#: performance.xml:692 #, no-c-format -msgid "org.hibernate.cache.TreeCacheProvider" +msgid "org.hibernate.cache.TreeCacheProvider" msgstr "" #. Tag: entry +#: performance.xml:694 performance.xml:706 #, no-c-format msgid "clustered (ip multicast), transactional" msgstr "" #. Tag: entry +#: performance.xml:696 #, no-c-format msgid "yes (replication)" msgstr "" #. Tag: entry +#: performance.xml:698 performance.xml:710 #, no-c-format msgid "yes (clock sync req.)" msgstr "" #. Tag: entry +#: performance.xml:702 performance.xml:1050 #, no-c-format msgid "JBoss Cache 2" msgstr "" -#. Tag: entry +#. Tag: literal +#: performance.xml:704 #, no-c-format -msgid "org.hibernate.cache.jbc.JBossCacheRegionFactory" +msgid "org.hibernate.cache.jbc.JBossCacheRegionFactory" msgstr "" #. Tag: entry +#: performance.xml:708 #, no-c-format msgid "yes (replication or invalidation)" msgstr "" #. Tag: title +#: performance.xml:717 #, no-c-format msgid "Cache mappings" msgstr "" #. Tag: para +#: performance.xml:719 #, no-c-format -msgid "The <cache> element of a class or collection mapping has the following form:" +msgid "As we have done in previous chapters we are looking at the two different possibiltites to configure caching. First configuration via annotations and then via Hibernate mapping files." msgstr "" #. Tag: para +#: performance.xml:723 +#, no-c-format +msgid "By default, entities are not part of the second level cache and we recommend you to stick to this setting. However, you can override this by setting the shared-cache-mode element in your persistence.xml file or by using the javax.persistence.sharedCache.mode property in your configuration. The following values are possible:" +msgstr "" + +#. Tag: para +#: performance.xml:732 +#, no-c-format +msgid "ENABLE_SELECTIVE (Default and recommended value): entities are not cached unless explicitly marked as cacheable." +msgstr "" + +#. Tag: para +#: performance.xml:738 +#, no-c-format +msgid "DISABLE_SELECTIVE: entities are cached unless explicitly marked as not cacheable." +msgstr "" + +#. Tag: para +#: performance.xml:743 +#, no-c-format +msgid "ALL: all entities are always cached even if marked as non cacheable." +msgstr "" + +#. Tag: para +#: performance.xml:748 +#, no-c-format +msgid "NONE: no entity are cached even if marked as cacheable. This option can make sense to disable second-level cache altogether." +msgstr "" + +#. Tag: para +#: performance.xml:754 +#, no-c-format +msgid "The cache concurrency strategy used by default can be set globaly via the hibernate.cache.default_cache_concurrency_strategy configuration property. The values for this property are:" +msgstr "" + +#. Tag: literal +#: performance.xml:761 +#, no-c-format +msgid "read-only" +msgstr "" + +#. Tag: literal +#: performance.xml:765 +#, no-c-format +msgid "read-write" +msgstr "" + +#. Tag: literal +#: performance.xml:769 +#, no-c-format +msgid "nonstrict-read-write" +msgstr "" + +#. Tag: literal +#: performance.xml:773 +#, no-c-format +msgid "transactional" +msgstr "" + +#. Tag: para +#: performance.xml:778 +#, no-c-format +msgid "It is recommended to define the cache concurrency strategy per entity rather than using a global one. Use the @org.hibernate.annotations.Cache annotation for that." +msgstr "" + +#. Tag: title +#: performance.xml:785 +#, no-c-format +msgid "Definition of cache concurrency strategy via @Cache" +msgstr "" + +#. Tag: programlisting +#: performance.xml:788 +#, no-c-format +msgid "" + "@Entity \n" + "@Cacheable\n" + "@Cache(usage = CacheConcurrencyStrategy.NONSTRICT_READ_WRITE)\n" + "public class Forest { ... }" +msgstr "" + +#. Tag: para +#: performance.xml:791 +#, no-c-format +msgid "Hibernate also let's you cache the content of a collection or the identifiers if the collection contains other entities. Use the @Cache annotation on the collection property." +msgstr "" + +#. Tag: title +#: performance.xml:797 +#, no-c-format +msgid "Caching collections using annotations" +msgstr "" + +#. Tag: programlisting +#: performance.xml:799 +#, no-c-format +msgid "" + "@OneToMany(cascade=CascadeType.ALL, fetch=FetchType.EAGER)\n" + "@JoinColumn(name=\"CUST_ID\")\n" + "@Cache(usage = CacheConcurrencyStrategy.NONSTRICT_READ_WRITE)\n" + "public SortedSet<Ticket> getTickets() {\n" + " return tickets;\n" + "}" +msgstr "" + +#. Tag: para +#: performance.xml:802 +#, no-c-format +msgid "shows the @org.hibernate.annotations.Cache annotations with its attributes. It allows you to define the caching strategy and region of a given second level cache." +msgstr "" + +#. Tag: title +#: performance.xml:808 +#, no-c-format +msgid "@Cache annotation with attributes" +msgstr "" + +#. Tag: programlisting +#: performance.xml:820 +#, no-c-format +msgid "" + "@Cache(\n" + " CacheConcurrencyStrategy usage();\n" + " String region() default \"\";\n" + " String include() default \"all\";\n" + ")" +msgstr "" + +#. Tag: para +#: performance.xml:824 +#, no-c-format +msgid "usage: the given cache concurrency strategy (NONE, READ_ONLY, NONSTRICT_READ_WRITE, READ_WRITE, TRANSACTIONAL)" +msgstr "" + +#. Tag: para +#: performance.xml:830 +#, no-c-format +msgid "region (optional): the cache region (default to the fqcn of the class or the fq role name of the collection)" +msgstr "" + +#. Tag: para +#: performance.xml:835 +#, no-c-format +msgid "include (optional): all to include all properties, non-lazy to only include non lazy properties (default all)." +msgstr "" + +#. Tag: para +#: performance.xml:843 +#, no-c-format +msgid "Let's now take a look at Hibernate mapping files. There the <cache> element of a class or collection mapping is used to configure the second level cache. Looking at the parallels to anotations is obvious." +msgstr "" + +#. Tag: title +#: performance.xml:850 +#, no-c-format +msgid "The Hibernate <cache> mapping element" +msgstr "" + +#. Tag: programlisting +#: performance.xml:862 +#, no-c-format +msgid "" + "<cache\n" + " usage=\"transactional|read-write|nonstrict-read-write|read-only\"\n" + " region=\"RegionName\"\n" + " include=\"all|non-lazy\"\n" + "/>" +msgstr "" + +#. Tag: para +#: performance.xml:866 #, no-c-format msgid "usage (required) specifies the caching strategy: transactional, read-write, nonstrict-read-write or read-only" msgstr "" #. Tag: para +#: performance.xml:874 #, no-c-format msgid "region (optional: defaults to the class or collection role name): specifies the name of the second level cache region" msgstr "" #. Tag: para +#: performance.xml:880 #, no-c-format msgid "include (optional: defaults to all) non-lazy: specifies that properties of the entity mapped with lazy=\"true\" cannot be cached when attribute-level lazy fetching is enabled" msgstr "" #. Tag: para +#: performance.xml:890 #, no-c-format -msgid "Alternatively, you can specify <class-cache> and <collection-cache> elements in hibernate.cfg.xml." +msgid "Alternatively to <cache>, you can use <class-cache> and <collection-cache> elements in hibernate.cfg.xml." msgstr "" #. Tag: para +#: performance.xml:895 #, no-c-format -msgid "The usage attribute specifies a cache concurrency strategy." +msgid "Let's now have a closer look at the different usage strategies" msgstr "" #. Tag: title +#: performance.xml:900 #, no-c-format msgid "Strategy: read only" msgstr "" #. Tag: para +#: performance.xml:902 #, no-c-format msgid "If your application needs to read, but not modify, instances of a persistent class, a read-only cache can be used. This is the simplest and optimal performing strategy. It is even safe for use in a cluster." msgstr "" #. Tag: title +#: performance.xml:909 #, no-c-format msgid "Strategy: read/write" msgstr "" #. Tag: para +#: performance.xml:911 #, no-c-format msgid "If the application needs to update data, a read-write cache might be appropriate. This cache strategy should never be used if serializable transaction isolation level is required. If the cache is used in a JTA environment, you must specify the property hibernate.transaction.manager_lookup_class and naming a strategy for obtaining the JTA TransactionManager. In other environments, you should ensure that the transaction is completed when Session.close() or Session.disconnect() is called. If you want to use this strategy in a cluster, you should ensure that the underlying cache implementation supports locking. The built-in cache providers do not support locking." msgstr "" #. Tag: title +#: performance.xml:927 #, no-c-format msgid "Strategy: nonstrict read/write" msgstr "" #. Tag: para +#: performance.xml:929 #, no-c-format msgid "If the application only occasionally needs to update data (i.e. if it is extremely unlikely that two transactions would try to update the same item simultaneously), and strict transaction isolation is not required, a nonstrict-read-write cache might be appropriate. If the cache is used in a JTA environment, you must specify hibernate.transaction.manager_lookup_class. In other environments, you should ensure that the transaction is completed when Session.close() or Session.disconnect() is called." msgstr "" #. Tag: title +#: performance.xml:941 #, no-c-format msgid "Strategy: transactional" msgstr "" #. Tag: para +#: performance.xml:943 #, no-c-format msgid "The transactional cache strategy provides support for fully transactional cache providers such as JBoss TreeCache. Such a cache can only be used in a JTA environment and you must specify hibernate.transaction.manager_lookup_class." msgstr "" #. Tag: title +#: performance.xml:950 #, no-c-format msgid "Cache-provider/concurrency-strategy compatibility" msgstr "" #. Tag: para +#: performance.xml:953 #, no-c-format msgid "None of the cache providers support all of the cache concurrency strategies." msgstr "" #. Tag: para +#: performance.xml:957 #, no-c-format msgid "The following table shows which providers are compatible with which concurrency strategies." msgstr "" #. Tag: title +#: performance.xml:961 #, no-c-format msgid "Cache Concurrency Strategy Support" msgstr "" #. Tag: entry +#: performance.xml:978 #, no-c-format -msgid "read-only" +msgid "read-only" msgstr "" #. Tag: entry +#: performance.xml:980 #, no-c-format -msgid "nonstrict-read-write" +msgid "nonstrict-read-write" msgstr "" #. Tag: entry +#: performance.xml:982 #, no-c-format -msgid "read-write" +msgid "read-write" msgstr "" #. Tag: entry +#: performance.xml:984 #, no-c-format -msgid "transactional" +msgid "transactional" msgstr "" #. Tag: title +#: performance.xml:1067 #, no-c-format msgid "Managing the caches" msgstr "" #. Tag: para +#: performance.xml:1069 #, no-c-format msgid "Whenever you pass an object to save(), update() or saveOrUpdate(), and whenever you retrieve an object using load(), get(), list(), iterate() or scroll(), that object is added to the internal cache of the Session." msgstr "" #. Tag: para +#: performance.xml:1076 #, no-c-format msgid "When flush() is subsequently called, the state of that object will be synchronized with the database. If you do not want this synchronization to occur, or if you are processing a huge number of objects and need to manage memory efficiently, the evict() method can be used to remove the object and its collections from the first-level cache." msgstr "" +#. Tag: title +#: performance.xml:1084 +#, no-c-format +msgid "Explcitly evicting a cached instance from the first level cache using Session.evict()" +msgstr "" + +#. Tag: programlisting +#: performance.xml:1087 +#, no-c-format +msgid "" + "ScrollableResult cats = sess.createQuery(\"from Cat as cat\").scroll(); //a huge result set\n" + "while ( cats.next() ) {\n" + " Cat cat = (Cat) cats.get(0);\n" + " doSomethingWithACat(cat);\n" + " sess.evict(cat);\n" + "}" +msgstr "" + #. Tag: para +#: performance.xml:1090 #, no-c-format msgid "The Session also provides a contains() method to determine if an instance belongs to the session cache." msgstr "" #. Tag: para +#: performance.xml:1094 #, no-c-format msgid "To evict all objects from the session cache, call Session.clear()" msgstr "" #. Tag: para +#: performance.xml:1097 #, no-c-format msgid "For the second-level cache, there are methods defined on SessionFactory for evicting the cached state of an instance, entire class, collection instance or entire collection role." msgstr "" +#. Tag: title +#: performance.xml:1103 +#, no-c-format +msgid "Second-level cache eviction via SessionFactoty.evict() and SessionFacyory.evictCollection()" +msgstr "" + +#. Tag: programlisting +#: performance.xml:1107 +#, no-c-format +msgid "" + "sessionFactory.evict(Cat.class, catId); //evict a particular Cat\n" + "sessionFactory.evict(Cat.class); //evict all Cats\n" + "sessionFactory.evictCollection(\"Cat.kittens\", catId); //evict a particular collection of kittens\n" + "sessionFactory.evictCollection(\"Cat.kittens\"); //evict all kitten collections" +msgstr "" + #. Tag: para +#: performance.xml:1110 #, no-c-format msgid "The CacheMode controls how a particular session interacts with the second-level cache:" msgstr "" #. Tag: para +#: performance.xml:1115 #, no-c-format msgid "CacheMode.NORMAL: will read items from and write items to the second-level cache" msgstr "" #. Tag: para +#: performance.xml:1120 #, no-c-format msgid "CacheMode.GET: will read items from the second-level cache. Do not write to the second-level cache except when updating data" msgstr "" #. Tag: para +#: performance.xml:1126 #, no-c-format msgid "CacheMode.PUT: will write items to the second-level cache. Do not read from the second-level cache" msgstr "" #. Tag: para +#: performance.xml:1131 #, no-c-format msgid "CacheMode.REFRESH: will write items to the second-level cache. Do not read from the second-level cache. Bypass the effect of hibernate.cache.use_minimal_puts forcing a refresh of the second-level cache for all items read from the database" msgstr "" #. Tag: para +#: performance.xml:1139 #, no-c-format msgid "To browse the contents of a second-level or query cache region, use the Statistics API:" msgstr "" +#. Tag: title +#: performance.xml:1143 +#, no-c-format +msgid "Browsing the second-level cache entries via the Statistics API" +msgstr "" + +#. Tag: programlisting +#: performance.xml:1146 +#, no-c-format +msgid "" + "Map cacheEntries = sessionFactory.getStatistics()\n" + " .getSecondLevelCacheStatistics(regionName)\n" + " .getEntries();" +msgstr "" + #. Tag: para +#: performance.xml:1149 #, no-c-format msgid "You will need to enable statistics and, optionally, force Hibernate to keep the cache entries in a more readable format:" msgstr "" #. Tag: title +#: performance.xml:1153 +#, no-c-format +msgid "Enabling Hibernate statistics" +msgstr "" + +#. Tag: programlisting +#: performance.xml:1155 +#, no-c-format +msgid "" + "hibernate.generate_statistics true\n" + "hibernate.cache.use_structured_entries true" +msgstr "" + +#. Tag: title +#: performance.xml:1160 #, no-c-format msgid "The Query Cache" msgstr "" #. Tag: para +#: performance.xml:1162 #, no-c-format msgid "Query result sets can also be cached. This is only useful for queries that are run frequently with the same parameters." msgstr "" #. Tag: title +#: performance.xml:1166 #, no-c-format msgid "Enabling query caching" msgstr "" #. Tag: para +#: performance.xml:1168 #, no-c-format msgid "Caching of query results introduces some overhead in terms of your applications normal transactional processing. For example, if you cache results of a query against Person Hibernate will need to keep track of when those results should be invalidated because changes have been committed against Person. That, coupled with the fact that most applications simply gain no benefit from caching query results, leads Hibernate to disable caching of query results by default. To use query caching, you will first need to enable the query cache:" msgstr "" +#. Tag: programlisting +#: performance.xml:1177 +#, no-c-format +msgid "hibernate.cache.use_query_cache true" +msgstr "" + #. Tag: para +#: performance.xml:1179 #, no-c-format msgid "This setting creates two new cache regions:" msgstr "" #. Tag: para +#: performance.xml:1181 #, no-c-format msgid "org.hibernate.cache.StandardQueryCache, holding the cached query results" msgstr "" #. Tag: para +#: performance.xml:1186 #, no-c-format msgid "org.hibernate.cache.UpdateTimestampsCache, holding timestamps of the most recent updates to queryable tables. These are used to validate the results as they are served from the query cache." msgstr "" #. Tag: para +#: performance.xml:1194 #, no-c-format -msgid "If you configure your underlying cache implementation to use expiry or timeouts is is very important that the cache timeout of the underlying cache region for the UpdateTimestampsCache be set to a higher value than the timeouts of any of the query caches. In fact, we recommend that the the UpdateTimestampsCache region not be configured for expiry at all. Note, in particular, that an LRU cache expiry policy is never appropriate." +msgid "If you configure your underlying cache implementation to use expiry or timeouts is very important that the cache timeout of the underlying cache region for the UpdateTimestampsCache be set to a higher value than the timeouts of any of the query caches. In fact, we recommend that the the UpdateTimestampsCache region not be configured for expiry at all. Note, in particular, that an LRU cache expiry policy is never appropriate." msgstr "" #. Tag: para +#: performance.xml:1203 #, no-c-format msgid "As mentioned above, most queries do not benefit from caching or their results. So by default, individual queries are not cached even after enabling query caching. To enable results caching for a particular query, call org.hibernate.Query.setCacheable(true). This call allows the query to look for existing cache results or add its results to the cache when it is executed." msgstr "" #. Tag: para +#: performance.xml:1211 #, no-c-format msgid "The query cache does not cache the state of the actual entities in the cache; it caches only identifier values and results of value type. For this reaso, the query cache should always be used in conjunction with the second-level cache for those entities expected to be cached as part of a query result cache (just as with collection caching)." msgstr "" #. Tag: title +#: performance.xml:1221 #, no-c-format msgid "Query cache regions" msgstr "" #. Tag: para +#: performance.xml:1223 #, no-c-format msgid "If you require fine-grained control over query cache expiration policies, you can specify a named cache region for a particular query by calling Query.setCacheRegion()." msgstr "" +#. Tag: programlisting +#: performance.xml:1227 +#, no-c-format +msgid "" + "List blogs = sess.createQuery(\"from Blog blog where blog.blogger = :blogger\")\n" + " .setEntity(\"blogger\", blogger)\n" + " .setMaxResults(15)\n" + " .setCacheable(true)\n" + " .setCacheRegion(\"frontpages\")\n" + " .list();" +msgstr "" + #. Tag: para +#: performance.xml:1229 #, no-c-format msgid "If you want to force the query cache to refresh one of its regions (disregard any cached results it finds there) you can use org.hibernate.Query.setCacheMode(CacheMode.REFRESH). In conjunction with the region you have defined for the given query, Hibernate will selectively force the results cached in that particular region to be refreshed. This is particularly useful in cases where underlying data may have been updated via a separate process and is a far more efficient alternative to bulk eviction of the region via org.hibernate.SessionFactory.evictQueries()." msgstr "" #. Tag: title +#: performance.xml:1242 #, no-c-format msgid "Understanding Collection performance" msgstr "" #. Tag: para +#: performance.xml:1244 #, no-c-format msgid "In the previous sections we have covered collections and their applications. In this section we explore some more issues in relation to collections at runtime." msgstr "" #. Tag: title +#: performance.xml:1249 #, no-c-format msgid "Taxonomy" msgstr "" #. Tag: para +#: performance.xml:1251 #, no-c-format msgid "Hibernate defines three basic kinds of collections:" msgstr "" #. Tag: para +#: performance.xml:1255 #, no-c-format msgid "collections of values" msgstr "" #. Tag: para +#: performance.xml:1259 #, no-c-format msgid "one-to-many associations" msgstr "" #. Tag: para +#: performance.xml:1263 #, no-c-format msgid "many-to-many associations" msgstr "" #. Tag: para +#: performance.xml:1267 #, no-c-format msgid "This classification distinguishes the various table and foreign key relationships but does not tell us quite everything we need to know about the relational model. To fully understand the relational structure and performance characteristics, we must also consider the structure of the primary key that is used by Hibernate to update or delete collection rows. This suggests the following classification:" msgstr "" #. Tag: para +#: performance.xml:1276 #, no-c-format msgid "indexed collections" msgstr "" #. Tag: para +#: performance.xml:1280 #, no-c-format msgid "sets" msgstr "" #. Tag: para +#: performance.xml:1284 #, no-c-format msgid "bags" msgstr "" #. Tag: para +#: performance.xml:1288 #, no-c-format msgid "All indexed collections (maps, lists, and arrays) have a primary key consisting of the <key> and <index> columns. In this case, collection updates are extremely efficient. The primary key can be efficiently indexed and a particular row can be efficiently located when Hibernate tries to update or delete it." msgstr "" #. Tag: para +#: performance.xml:1295 #, no-c-format msgid "Sets have a primary key consisting of <key> and element columns. This can be less efficient for some types of collection element, particularly composite elements or large text or binary fields, as the database may not be able to index a complex primary key as efficiently. However, for one-to-many or many-to-many associations, particularly in the case of synthetic identifiers, it is likely to be just as efficient. If you want SchemaExport to actually create the primary key of a <set>, you must declare all columns as not-null=\"true\"." msgstr "" #. Tag: para +#: performance.xml:1306 #, no-c-format msgid "<idbag> mappings define a surrogate key, so they are efficient to update. In fact, they are the best case." msgstr "" #. Tag: para +#: performance.xml:1309 #, no-c-format msgid "Bags are the worst case since they permit duplicate element values and, as they have no index column, no primary key can be defined. Hibernate has no way of distinguishing between duplicate rows. Hibernate resolves this problem by completely removing in a single DELETE and recreating the collection whenever it changes. This can be inefficient." msgstr "" #. Tag: para +#: performance.xml:1316 #, no-c-format msgid "For a one-to-many association, the \"primary key\" may not be the physical primary key of the database table. Even in this case, the above classification is still useful. It reflects how Hibernate \"locates\" individual rows of the collection." msgstr "" #. Tag: title +#: performance.xml:1323 #, no-c-format msgid "Lists, maps, idbags and sets are the most efficient collections to update" msgstr "" #. Tag: para +#: performance.xml:1326 #, no-c-format msgid "From the discussion above, it should be clear that indexed collections and sets allow the most efficient operation in terms of adding, removing and updating elements." msgstr "" #. Tag: para +#: performance.xml:1330 #, no-c-format msgid "There is, arguably, one more advantage that indexed collections have over sets for many-to-many associations or collections of values. Because of the structure of a Set, Hibernate does not UPDATE a row when an element is \"changed\". Changes to a Set always work via INSERT and DELETE of individual rows. Once again, this consideration does not apply to one-to-many associations." msgstr "" #. Tag: para +#: performance.xml:1338 #, no-c-format msgid "After observing that arrays cannot be lazy, you can conclude that lists, maps and idbags are the most performant (non-inverse) collection types, with sets not far behind. You can expect sets to be the most common kind of collection in Hibernate applications. This is because the \"set\" semantics are most natural in the relational model." msgstr "" #. Tag: para +#: performance.xml:1344 #, no-c-format msgid "However, in well-designed Hibernate domain models, most collections are in fact one-to-many associations with inverse=\"true\". For these associations, the update is handled by the many-to-one end of the association, and so considerations of collection update performance simply do not apply." msgstr "" #. Tag: title +#: performance.xml:1352 #, no-c-format msgid "Bags and lists are the most efficient inverse collections" msgstr "" #. Tag: para +#: performance.xml:1354 #, no-c-format msgid "There is a particular case, however, in which bags, and also lists, are much more performant than sets. For a collection with inverse=\"true\", the standard bidirectional one-to-many relationship idiom, for example, we can add elements to a bag or list without needing to initialize (fetch) the bag elements. This is because, unlike a set, Collection.add() or Collection.addAll() must always return true for a bag or List. This can make the following common code much faster:" msgstr "" +#. Tag: programlisting +#: performance.xml:1365 +#, no-c-format +msgid "" + "Parent p = (Parent) sess.load(Parent.class, id);\n" + "Child c = new Child();\n" + "c.setParent(p);\n" + "p.getChildren().add(c); //no need to fetch the collection!\n" + "sess.flush();" +msgstr "" + #. Tag: title +#: performance.xml:1369 #, no-c-format msgid "One shot delete" msgstr "" #. Tag: para +#: performance.xml:1371 #, no-c-format msgid "Deleting collection elements one by one can sometimes be extremely inefficient. Hibernate knows not to do that in the case of an newly-empty collection (if you called list.clear(), for example). In this case, Hibernate will issue a single DELETE." msgstr "" #. Tag: para +#: performance.xml:1377 #, no-c-format msgid "Suppose you added a single element to a collection of size twenty and then remove two elements. Hibernate will issue one INSERT statement and two DELETE statements, unless the collection is a bag. This is certainly desirable." msgstr "" #. Tag: para +#: performance.xml:1383 #, no-c-format msgid "However, suppose that we remove eighteen elements, leaving two and then add thee new elements. There are two possible ways to proceed" msgstr "" #. Tag: para +#: performance.xml:1389 #, no-c-format msgid "delete eighteen rows one by one and then insert three rows" msgstr "" #. Tag: para +#: performance.xml:1394 #, no-c-format msgid "remove the whole collection in one SQL DELETE and insert all five current elements one by one" msgstr "" #. Tag: para +#: performance.xml:1400 #, no-c-format msgid "Hibernate cannot know that the second option is probably quicker. It would probably be undesirable for Hibernate to be that intuitive as such behavior might confuse database triggers, etc." msgstr "" #. Tag: para +#: performance.xml:1404 #, no-c-format msgid "Fortunately, you can force this behavior (i.e. the second strategy) at any time by discarding (i.e. dereferencing) the original collection and returning a newly instantiated collection with all the current elements." msgstr "" #. Tag: para +#: performance.xml:1409 #, no-c-format msgid "One-shot-delete does not apply to collections mapped inverse=\"true\"." msgstr "" #. Tag: title +#: performance.xml:1415 #, no-c-format msgid "Monitoring performance" msgstr "" #. Tag: para +#: performance.xml:1417 #, no-c-format msgid "Optimization is not much use without monitoring and access to performance numbers. Hibernate provides a full range of figures about its internal operations. Statistics in Hibernate are available per SessionFactory." msgstr "" #. Tag: title +#: performance.xml:1423 #, no-c-format msgid "Monitoring a SessionFactory" msgstr "" #. Tag: para +#: performance.xml:1425 #, no-c-format msgid "You can access SessionFactory metrics in two ways. Your first option is to call sessionFactory.getStatistics() and read or display the Statistics yourself." msgstr "" #. Tag: para +#: performance.xml:1430 #, no-c-format msgid "Hibernate can also use JMX to publish metrics if you enable the StatisticsService MBean. You can enable a single MBean for all your SessionFactory or one per factory. See the following code for minimalistic configuration examples:" msgstr "" +#. Tag: programlisting +#: performance.xml:1435 +#, no-c-format +msgid "" + "// MBean service registration for a specific SessionFactory\n" + "Hashtable tb = new Hashtable();\n" + "tb.put(\"type\", \"statistics\");\n" + "tb.put(\"sessionFactory\", \"myFinancialApp\");\n" + "ObjectName on = new ObjectName(\"hibernate\", tb); // MBean object name\n" + "\n" + "StatisticsService stats = new StatisticsService(); // MBean implementation\n" + "stats.setSessionFactory(sessionFactory); // Bind the stats to a SessionFactory\n" + "server.registerMBean(stats, on); // Register the Mbean on the server" +msgstr "" + +#. Tag: programlisting +#: performance.xml:1437 +#, no-c-format +msgid "" + "// MBean service registration for all SessionFactory's\n" + "Hashtable tb = new Hashtable();\n" + "tb.put(\"type\", \"statistics\");\n" + "tb.put(\"sessionFactory\", \"all\");\n" + "ObjectName on = new ObjectName(\"hibernate\", tb); // MBean object name\n" + "\n" + "StatisticsService stats = new StatisticsService(); // MBean implementation\n" + "server.registerMBean(stats, on); // Register the MBean on the server" +msgstr "" + #. Tag: para +#: performance.xml:1439 #, no-c-format msgid "You can activate and deactivate the monitoring for a SessionFactory:" msgstr "" #. Tag: para +#: performance.xml:1444 #, no-c-format msgid "at configuration time, set hibernate.generate_statistics to false" msgstr "" #. Tag: para +#: performance.xml:1452 #, no-c-format msgid "at runtime: sf.getStatistics().setStatisticsEnabled(true) or hibernateStatsBean.setStatisticsEnabled(true)" msgstr "" #. Tag: para +#: performance.xml:1458 #, no-c-format msgid "Statistics can be reset programmatically using the clear() method. A summary can be sent to a logger (info level) using the logSummary() method." msgstr "" #. Tag: title +#: performance.xml:1464 #, no-c-format msgid "Metrics" msgstr "" #. Tag: para +#: performance.xml:1466 #, no-c-format msgid "Hibernate provides a number of metrics, from basic information to more specialized information that is only relevant in certain scenarios. All available counters are described in the Statistics interface API, in three categories:" msgstr "" #. Tag: para +#: performance.xml:1473 #, no-c-format msgid "Metrics related to the general Session usage, such as number of open sessions, retrieved JDBC connections, etc." msgstr "" #. Tag: para +#: performance.xml:1479 #, no-c-format msgid "Metrics related to the entities, collections, queries, and caches as a whole (aka global metrics)." msgstr "" #. Tag: para +#: performance.xml:1484 #, no-c-format msgid "Detailed metrics related to a particular entity, collection, query or cache region." msgstr "" #. Tag: para +#: performance.xml:1489 #, no-c-format msgid "For example, you can check the cache hit, miss, and put ratio of entities, collections and queries, and the average time a query needs. Be aware that the number of milliseconds is subject to approximation in Java. Hibernate is tied to the JVM precision and on some platforms this might only be accurate to 10 seconds." msgstr "" #. Tag: para +#: performance.xml:1495 #, no-c-format msgid "Simple getters are used to access the global metrics (i.e. not tied to a particular entity, collection, cache region, etc.). You can access the metrics of a particular entity, collection or cache region through its name, and through its HQL or SQL representation for queries. Please refer to the Statistics, EntityStatistics, CollectionStatistics, SecondLevelCacheStatistics, and QueryStatistics API Javadoc for more information. The following code is a simple example:" msgstr "" +#. Tag: programlisting +#: performance.xml:1506 +#, no-c-format +msgid "" + "Statistics stats = HibernateUtil.sessionFactory.getStatistics();\n" + "\n" + "double queryCacheHitCount = stats.getQueryCacheHitCount();\n" + "double queryCacheMissCount = stats.getQueryCacheMissCount();\n" + "double queryCacheHitRatio =\n" + " queryCacheHitCount / (queryCacheHitCount + queryCacheMissCount);\n" + "\n" + "log.info(\"Query Hit ratio:\" + queryCacheHitRatio);\n" + "\n" + "EntityStatistics entityStats =\n" + " stats.getEntityStatistics( Cat.class.getName() );\n" + "long changes =\n" + " entityStats.getInsertCount()\n" + " + entityStats.getUpdateCount()\n" + " + entityStats.getDeleteCount();\n" + "log.info(Cat.class.getName() + \" changed \" + changes + \"times\" );" +msgstr "" + #. Tag: para +#: performance.xml:1508 #, no-c-format msgid "You can work on all entities, collections, queries and region caches, by retrieving the list of names of entities, collections, queries and region caches using the following methods: getQueries(), getEntityNames(), getCollectionRoleNames(), and getSecondLevelCacheRegionNames()." msgstr "" diff --git a/documentation/manual/src/main/docbook/pot/content/persistent_classes.pot b/documentation/manual/src/main/docbook/pot/content/persistent_classes.pot index d9e18bc6bb..c552f91491 100644 --- a/documentation/manual/src/main/docbook/pot/content/persistent_classes.pot +++ b/documentation/manual/src/main/docbook/pot/content/persistent_classes.pot @@ -1,283 +1,762 @@ -# -# AUTHOR , YEAR. +# SOME DESCRIPTIVE TITLE. +# FIRST AUTHOR , YEAR. # +#, fuzzy msgid "" msgstr "" -"Project-Id-Version: 0\n" -"POT-Creation-Date: 2010-02-11T05:38:15\n" -"PO-Revision-Date: 2010-02-11T05:38:15\n" -"Last-Translator: Automatically generated\n" -"Language-Team: None\n" +"Project-Id-Version: PACKAGE VERSION\n" +"Report-Msgid-Bugs-To: http://bugs.kde.org\n" +"POT-Creation-Date: 2010-07-20 21:02+0000\n" +"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" +"Last-Translator: FULL NAME \n" +"Language-Team: LANGUAGE \n" "MIME-Version: 1.0\n" -"Content-Type: application/x-publican; charset=UTF-8\n" +"Content-Type: application/x-xml2pot; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" #. Tag: title +#: persistent_classes.xml:32 #, no-c-format msgid "Persistent Classes" msgstr "" #. Tag: para +#: persistent_classes.xml:34 #, 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. For example, an instance can instead be transient or detached." +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). The term \"persistent\" here means that the classes are able to be persisted, not that they are in the persistent state (see for discussion)." msgstr "" #. Tag: para +#: persistent_classes.xml:41 #, 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 can express a domain model in other ways (using trees of Map instances, for example)." +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, Hibernate assumes very little about the nature of your persistent objects. You can express a domain model in other ways (using trees of java.util.Map instances, for example)." msgstr "" #. Tag: title +#: persistent_classes.xml:49 #, no-c-format msgid "A simple POJO example" msgstr "" -#. Tag: para +#. Tag: title +#: persistent_classes.xml:52 #, no-c-format -msgid "Most Java applications require a persistent class representing felines. For example:" +msgid "Simple POJO representing a cat" +msgstr "" + +#. Tag: programlisting +#: persistent_classes.xml:53 +#, no-c-format +msgid "" + "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:57 #, no-c-format msgid "The four main rules of persistent classes are explored in more detail in the following sections." msgstr "" #. Tag: title +#: persistent_classes.xml:62 #, no-c-format msgid "Implement a no-argument constructor" msgstr "" #. Tag: para +#: persistent_classes.xml:64 #, no-c-format -msgid "Cat has a no-argument constructor. All persistent classes must have a default constructor (which can be non-public) so that Hibernate can instantiate them using Constructor.newInstance(). It is recommended that you have a default constructor with at least package visibility for runtime proxy generation in Hibernate." +msgid "Cat has a no-argument constructor. All persistent classes must have a default constructor (which can be non-public) so that Hibernate can instantiate them using java.lang.reflect.Constructor.newInstance(). It is recommended that this constructor be defined with at least package visibility in order for runtime proxy generation to work properly." msgstr "" #. Tag: title +#: persistent_classes.xml:74 #, no-c-format -msgid "Provide an identifier property (optional)" +msgid "Provide an identifier property" msgstr "" #. Tag: para +#: persistent_classes.xml:77 #, no-c-format -msgid "Cat has a property called id. 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, java.lang.String or java.util.Date. If your legacy database table has composite keys, you can use a user-defined class with properties of these types (see the section on composite identifiers later in the chapter.)" +msgid "Historically this was considered option. While still not (yet) enforced, this should be considered a deprecated feature as it will be completely required to provide a identifier property in an upcoming release." msgstr "" #. 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." +msgid "Cat has a property named id. This property maps to the primary key column(s) of the underlying database table. The type of the identifier property can be any \"basic\" type (see ). See for information on mapping composite (multi-column) identifiers." msgstr "" #. Tag: para +#: persistent_classes.xml:92 #, no-c-format -msgid "In fact, some functionality is available only to classes that declare an identifier property:" -msgstr "" - -#. Tag: para -#, no-c-format -msgid "Transitive reattachment for detached objects (cascade update or cascade merge) - see " -msgstr "" - -#. Tag: para -#, no-c-format -msgid "Session.saveOrUpdate()" -msgstr "" - -#. Tag: para -#, no-c-format -msgid "Session.merge()" +msgid "Identifiers do not necessarily need to identify column(s) in the database physically defined as a primary key. They should just identify columns that can be used to uniquely identify rows in the underlying table." msgstr "" #. Tag: para +#: persistent_classes.xml:99 #, no-c-format msgid "We recommend that you declare consistently-named identifier properties on persistent classes and that you use a nullable (i.e., non-primitive) type." msgstr "" #. Tag: title +#: persistent_classes.xml:107 #, no-c-format -msgid "Prefer non-final classes (optional)" +msgid "Prefer non-final classes (semi-optional)" msgstr "" #. Tag: para +#: persistent_classes.xml:109 #, no-c-format -msgid "A central feature of Hibernate, proxies, depends upon the persistent class being either non-final, or the implementation of an interface that declares all public methods." -msgstr "" - -#. Tag: para -#, no-c-format -msgid "You can persist final classes that do not implement an interface with Hibernate. You will not, however, be able to use proxies for lazy association fetching which will ultimately limit your options for performance tuning." -msgstr "" - -#. Tag: para -#, no-c-format -msgid "You should also avoid declaring public final methods on the non-final classes. If you want to use a class with a public final method, you must explicitly disable proxying by setting lazy=\"false\"." +msgid "A central feature of Hibernate, proxies (lazy loading), depends upon the persistent class being either non-final, or the implementation of an interface that declares all public methods. You can persist final classes that do not implement an interface with Hibernate; you will not, however, be able to use proxies for lazy association fetching which will ultimately limit your options for performance tuning. To persist a final class which does not implement a \"full\" interface you must disable proxy generation. See and ." msgstr "" #. Tag: title +#: persistent_classes.xml:121 +#, no-c-format +msgid "Disabling proxies in hbm.xml" +msgstr "" + +#. Tag: programlisting +#: persistent_classes.xml:122 +#, no-c-format +msgid "...]]>" +msgstr "" + +#. Tag: title +#: persistent_classes.xml:126 +#, no-c-format +msgid "Disabling proxies in annotations" +msgstr "" + +#. Tag: programlisting +#: persistent_classes.xml:127 +#, no-c-format +msgid "" +msgstr "" + +#. Tag: para +#: persistent_classes.xml:130 +#, no-c-format +msgid "If the final class does implement a proper interface, you could alternatively tell Hibernate to use the interface instead when generating the proxies. See and ." +msgstr "" + +#. Tag: title +#: persistent_classes.xml:139 +#, no-c-format +msgid "Proxying an interface in hbm.xml" +msgstr "" + +#. Tag: programlisting +#: persistent_classes.xml:140 +#, no-c-format +msgid "...]]>" +msgstr "" + +#. Tag: title +#: persistent_classes.xml:144 +#, no-c-format +msgid "Proxying an interface in annotations" +msgstr "" + +#. Tag: programlisting +#: persistent_classes.xml:145 +#, no-c-format +msgid "" +msgstr "" + +#. Tag: para +#: persistent_classes.xml:148 +#, no-c-format +msgid "You should also avoid declaring public final methods as this will again limit the ability to generate proxies from this class. If you want to use a class with public final methods, you must explicitly disable proxying. Again, see and ." +msgstr "" + +#. Tag: title +#: persistent_classes.xml:158 #, no-c-format msgid "Declare accessors and mutators for persistent fields (optional)" msgstr "" #. Tag: para +#: persistent_classes.xml:160 #, no-c-format -msgid "Cat declares accessor methods for all its persistent fields. Many other ORM tools directly persist instance variables. 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 getFoo, isFoo and setFoo. If required, you can switch to direct field access for particular properties." +msgid "Cat declares accessor methods for all its persistent fields. Many other ORM tools directly persist instance variables. 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 getFoo, isFoo and setFoo. If required, you can switch to direct field access for particular properties." msgstr "" #. Tag: para +#: persistent_classes.xml:169 #, no-c-format -msgid "Properties need not be declared public - Hibernate can persist a property with a default, protected or private get / set pair." +msgid "Properties need not be declared public. Hibernate can persist a property declared with package, protected or private visibility as well." msgstr "" #. Tag: title +#: persistent_classes.xml:178 #, no-c-format msgid "Implementing inheritance" msgstr "" #. Tag: para +#: persistent_classes.xml:180 #, no-c-format msgid "A subclass must also observe the first and second rules. It inherits its identifier property from the superclass, Cat. For example:" msgstr "" +#. Tag: programlisting +#: persistent_classes.xml:184 +#, no-c-format +msgid "" + "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:188 #, no-c-format msgid "Implementing equals() and hashCode()" msgstr "" #. Tag: para +#: persistent_classes.xml:191 #, no-c-format msgid "You have to override the equals() and hashCode() methods if you:" msgstr "" #. Tag: para +#: persistent_classes.xml:196 #, no-c-format msgid "intend to put instances of persistent classes in a Set (the recommended way to represent many-valued associations); and" msgstr "" #. Tag: para +#: persistent_classes.xml:202 #, no-c-format msgid "intend to use reattachment of detached instances" msgstr "" #. Tag: para +#: persistent_classes.xml:206 #, no-c-format msgid "Hibernate guarantees equivalence of persistent identity (database row) and Java identity only inside a particular session scope. When you mix instances retrieved in different sessions, you must implement equals() and hashCode() if you wish to have meaningful semantics for Sets." msgstr "" #. Tag: para +#: persistent_classes.xml:212 #, no-c-format msgid "The most obvious way is to implement equals()/hashCode() by comparing the identifier value of both objects. If the value is the same, both must be the same database row, because they are equal. If both are added to a Set, you will only have one element in the Set). Unfortunately, you cannot 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 Set, saving it will assign an identifier value to the object. If equals() and hashCode() are based on the identifier value, the hash code would change, breaking the contract of the Set. See the Hibernate website for a full discussion of this problem. This is not a Hibernate issue, but normal Java semantics of object identity and equality." msgstr "" #. Tag: para +#: persistent_classes.xml:228 #, no-c-format msgid "It is recommended that you implement equals() and hashCode() using Business key equality. Business key equality means that the equals() method compares only the properties that form the business key. It is a key that would identify our instance in the real world (a natural candidate key):" msgstr "" -#. Tag: para +#. Tag: programlisting +#: persistent_classes.xml:235 #, no-c-format -msgid "A business key does not have to be as solid as a database primary key candidate (see ). Immutable or unique properties are usually good candidates for a business key." +msgid "" + "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:237 +#, no-c-format +msgid "A business key does not have to be as solid as a database primary key candidate (see ). Immutable or unique properties are usually good candidates for a business key." msgstr "" #. Tag: title +#: persistent_classes.xml:244 #, no-c-format msgid "Dynamic models" msgstr "" #. Tag: title +#: persistent_classes.xml:247 #, no-c-format msgid "Note" msgstr "" -#. Tag: para +#. Tag: emphasis +#: persistent_classes.xml:249 #, no-c-format -msgid "The following features are currently considered experimental and may change in the near future." +msgid "The following features are currently considered experimental and may change in the near future." msgstr "" #. Tag: para +#: persistent_classes.xml:253 #, no-c-format msgid "Persistent entities do not necessarily have to be represented as POJO classes or as JavaBean objects at runtime. Hibernate also supports dynamic models (using Maps of Maps at runtime) and the representation of entities as DOM4J trees. With this approach, you do not write persistent classes, only mapping files." msgstr "" #. Tag: para +#: persistent_classes.xml:259 #, no-c-format -msgid "By default, Hibernate works in normal POJO mode. You can set a default entity representation mode for a particular SessionFactory using the default_entity_mode configuration option (see )." +msgid "By default, Hibernate works in normal POJO mode. You can set a default entity representation mode for a particular SessionFactory using the default_entity_mode configuration option (see )." msgstr "" #. Tag: para +#: persistent_classes.xml:265 #, no-c-format msgid "The following examples demonstrate the representation using Maps. First, in the mapping file an entity-name has to be declared instead of, or in addition to, a class name:" msgstr "" +#. Tag: programlisting +#: persistent_classes.xml:270 +#, no-c-format +msgid "" + "<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:272 #, no-c-format msgid "Even though associations are declared using target class names, the target type of associations can also be a dynamic entity instead of a POJO." msgstr "" #. Tag: para +#: persistent_classes.xml:276 #, no-c-format msgid "After setting the default entity mode to dynamic-map for the SessionFactory, you can, at runtime, work with Maps of Maps:" msgstr "" +#. Tag: programlisting +#: persistent_classes.xml:281 +#, no-c-format +msgid "" + "Session s = openSession();\n" + "Transaction tx = s.beginTransaction();\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:283 #, no-c-format msgid "One of the main advantages of dynamic mapping is quick turnaround time for prototyping, without the need for entity class implementation. However, you lose compile-time type checking and will likely deal with many exceptions at runtime. As a result of 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 "" #. Tag: para +#: persistent_classes.xml:290 #, no-c-format msgid "Entity representation modes can also be set on a per Session basis:" msgstr "" +#. Tag: programlisting +#: persistent_classes.xml:293 +#, no-c-format +msgid "" + "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" +msgstr "" + #. Tag: para +#: persistent_classes.xml:295 #, no-c-format msgid "Please note that the call to getSession() using an EntityMode is on the Session API, not the SessionFactory. That way, the new Session shares the underlying JDBC connection, transaction, and other context information. This means you do not have to call flush() and close() on the secondary Session, and also leave the transaction and connection handling to the primary unit of work." msgstr "" #. Tag: para +#: persistent_classes.xml:304 #, no-c-format -msgid "More information about the XML representation capabilities can be found in ." +msgid "More information about the XML representation capabilities can be found in ." msgstr "" #. Tag: title +#: persistent_classes.xml:310 #, no-c-format msgid "Tuplizers" msgstr "" #. Tag: para +#: persistent_classes.xml:312 #, no-c-format -msgid "org.hibernate.tuple.Tuplizer, and its sub-interfaces, are responsible for managing a particular representation of a piece of data given that representation's org.hibernate.EntityMode. If a given piece of data is thought of as a data structure, then a tuplizer is the thing that 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 corresponding tuplizer knows how create the POJO through its constructor. It also knows how to access the POJO properties using the defined property accessors." +msgid "org.hibernate.tuple.Tuplizer and its sub-interfaces are responsible for managing a particular representation of a piece of data given that representation's org.hibernate.EntityMode. If a given piece of data is thought of as a data structure, then a tuplizer is the thing that knows how to create such a data structure, how to extract values from such a data structure and how to inject values into such a data structure. For example, for the POJO entity mode, the corresponding tuplizer knows how create the POJO through its constructor. It also knows how to access the POJO properties using the defined property accessors." msgstr "" #. Tag: para +#: persistent_classes.xml:322 #, no-c-format -msgid "There are two high-level types of Tuplizers, represented by the org.hibernate.tuple.entity.EntityTuplizer and org.hibernate.tuple.component.ComponentTuplizer interfaces. EntityTuplizers are responsible for managing the above mentioned contracts in regards to entities, while ComponentTuplizers do the same for components." +msgid "There are two (high-level) types of Tuplizers:" msgstr "" #. Tag: para +#: persistent_classes.xml:326 #, no-c-format -msgid "Users can also plug in their own tuplizers. Perhaps you require that a java.util.Map implementation other than java.util.HashMap 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. Tuplizer definitions are attached to the entity or component mapping they are meant to manage. Going back to the example of our customer entity:" +msgid "org.hibernate.tuple.entity.EntityTuplizer which is responsible for managing the above mentioned contracts in regards to entities" +msgstr "" + +#. Tag: para +#: persistent_classes.xml:332 +#, no-c-format +msgid "org.hibernate.tuple.component.ComponentTuplizer which does the same for components" +msgstr "" + +#. Tag: para +#: persistent_classes.xml:340 +#, no-c-format +msgid "Users can also plug in their own tuplizers. Perhaps you require that java.util.Map implementation other than java.util.HashMap 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. Tuplizer definitions are attached to the entity or component mapping they are meant to manage. Going back to the example of our Customer entity, shows how to specify a custom org.hibernate.tuple.entity.EntityTuplizer using annotations while shows how to do the same in hbm.xml" msgstr "" #. Tag: title +#: persistent_classes.xml:353 +#, no-c-format +msgid "Specify custom tuplizers in annotations" +msgstr "" + +#. Tag: programlisting +#: persistent_classes.xml:354 +#, no-c-format +msgid "" + "@Entity\n" + "@Tuplizer(impl = DynamicEntityTuplizer.class)\n" + "public interface Cuisine {\n" + " @Id\n" + " @GeneratedValue\n" + " public Long getId();\n" + " public void setId(Long id);\n" + "\n" + " public String getName();\n" + " public void setName(String name);\n" + "\n" + " @Tuplizer(impl = DynamicComponentTuplizer.class)\n" + " public Country getCountry();\n" + " public void setCountry(Country country);\n" + "}" +msgstr "" + +#. Tag: title +#: persistent_classes.xml:357 +#, no-c-format +msgid "Specify custom tuplizers in hbm.xml" +msgstr "" + +#. Tag: programlisting +#: persistent_classes.xml:358 +#, no-c-format +msgid "" + "<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>" +msgstr "" + +#. Tag: title +#: persistent_classes.xml:363 #, no-c-format msgid "EntityNameResolvers" msgstr "" #. Tag: para +#: persistent_classes.xml:365 #, no-c-format -msgid "The org.hibernate.EntityNameResolver interface is a contract for resolving the entity name of a given entity instance. The interface defines a single method resolveEntityName which is passed the entity instance and is expected to return the appropriate entity name (null is allowed and would indicate that the resolver does not know how to resolve the entity name of the given entity instance). Generally speaking, an org.hibernate.EntityNameResolver is going to be most useful in the case of dynamic models. One example might be using proxied interfaces as your domain model. The hibernate test suite has an example of this exact style of usage under the org.hibernate.test.dynamicentity.tuplizer2. Here is some of the code from that package for illustration." +msgid "org.hibernate.EntityNameResolver is a contract for resolving the entity name of a given entity instance. The interface defines a single method resolveEntityName which is passed the entity instance and is expected to return the appropriate entity name (null is allowed and would indicate that the resolver does not know how to resolve the entity name of the given entity instance). Generally speaking, an org.hibernate.EntityNameResolver is going to be most useful in the case of dynamic models. One example might be using proxied interfaces as your domain model. The hibernate test suite has an example of this exact style of usage under the org.hibernate.test.dynamicentity.tuplizer2. Here is some of the code from that package for illustration." +msgstr "" + +#. Tag: programlisting +#: persistent_classes.xml:377 +#, no-c-format +msgid "" + "/**\n" + " * A very trivial JDK Proxy InvocationHandler implementation where we proxy an\n" + " * interface as the domain model and simply store persistent state in an internal\n" + " * Map. This is an extremely trivial example meant only for illustration.\n" + " */\n" + "public final class DataProxyHandler implements InvocationHandler {\n" + " private String entityName;\n" + " private HashMap data = new HashMap();\n" + "\n" + " public DataProxyHandler(String entityName, Serializable id) {\n" + " this.entityName = entityName;\n" + " data.put( \"Id\", id );\n" + " }\n" + "\n" + " public Object invoke(Object proxy, Method method, Object[] args) throws Throwable {\n" + " String methodName = method.getName();\n" + " if ( methodName.startsWith( \"set\" ) ) {\n" + " String propertyName = methodName.substring( 3 );\n" + " data.put( propertyName, args[0] );\n" + " }\n" + " else if ( methodName.startsWith( \"get\" ) ) {\n" + " String propertyName = methodName.substring( 3 );\n" + " return data.get( propertyName );\n" + " }\n" + " else if ( \"toString\".equals( methodName ) ) {\n" + " return entityName + \"#\" + data.get( \"Id\" );\n" + " }\n" + " else if ( \"hashCode\".equals( methodName ) ) {\n" + " return new Integer( this.hashCode() );\n" + " }\n" + " return null;\n" + " }\n" + "\n" + " public String getEntityName() {\n" + " return entityName;\n" + " }\n" + "\n" + " public HashMap getData() {\n" + " return data;\n" + " }\n" + "}\n" + "\n" + "public class ProxyHelper {\n" + " public static String extractEntityName(Object object) {\n" + " // Our custom java.lang.reflect.Proxy instances actually bundle\n" + " // their appropriate entity name, so we simply extract it from there\n" + " // if this represents one of our proxies; otherwise, we return null\n" + " if ( Proxy.isProxyClass( object.getClass() ) ) {\n" + " InvocationHandler handler = Proxy.getInvocationHandler( object );\n" + " if ( DataProxyHandler.class.isAssignableFrom( handler.getClass() ) ) {\n" + " DataProxyHandler myHandler = ( DataProxyHandler ) handler;\n" + " return myHandler.getEntityName();\n" + " }\n" + " }\n" + " return null;\n" + " }\n" + "\n" + " // various other utility methods ....\n" + "\n" + "}\n" + "\n" + "/**\n" + " * The EntityNameResolver implementation.\n" + " *\n" + " * IMPL NOTE : An EntityNameResolver really defines a strategy for how entity names\n" + " * should be resolved. Since this particular impl can handle resolution for all of our\n" + " * entities we want to take advantage of the fact that SessionFactoryImpl keeps these\n" + " * in a Set so that we only ever have one instance registered. Why? Well, when it\n" + " * comes time to resolve an entity name, Hibernate must iterate over all the registered\n" + " * resolvers. So keeping that number down helps that process be as speedy as possible.\n" + " * Hence the equals and hashCode implementations as is\n" + " */\n" + "public class MyEntityNameResolver implements EntityNameResolver {\n" + " public static final MyEntityNameResolver INSTANCE = new MyEntityNameResolver();\n" + "\n" + " public String resolveEntityName(Object entity) {\n" + " return ProxyHelper.extractEntityName( entity );\n" + " }\n" + "\n" + " public boolean equals(Object obj) {\n" + " return getClass().equals( obj.getClass() );\n" + " }\n" + "\n" + " public int hashCode() {\n" + " return getClass().hashCode();\n" + " }\n" + "}\n" + "\n" + "public class MyEntityTuplizer extends PojoEntityTuplizer {\n" + " public MyEntityTuplizer(EntityMetamodel entityMetamodel, PersistentClass mappedEntity) {\n" + " super( entityMetamodel, mappedEntity );\n" + " }\n" + "\n" + " public EntityNameResolver[] getEntityNameResolvers() {\n" + " return new EntityNameResolver[] { MyEntityNameResolver.INSTANCE };\n" + " }\n" + "\n" + " public String determineConcreteSubclassEntityName(Object entityInstance, SessionFactoryImplementor factory) {\n" + " String entityName = ProxyHelper.extractEntityName( entityInstance );\n" + " if ( entityName == null ) {\n" + " entityName = super.determineConcreteSubclassEntityName( entityInstance, factory );\n" + " }\n" + " return entityName;\n" + " }\n" + "\n" + " ..." msgstr "" #. Tag: para +#: persistent_classes.xml:379 #, no-c-format msgid "In order to register an org.hibernate.EntityNameResolver users must either:" msgstr "" #. Tag: para +#: persistent_classes.xml:383 #, no-c-format -msgid "Implement a custom Tuplizer, implementing the getEntityNameResolvers method." +msgid "Implement a custom tuplizer (see ), implementing the getEntityNameResolvers method" msgstr "" #. Tag: para +#: persistent_classes.xml:389 #, no-c-format msgid "Register it with the org.hibernate.impl.SessionFactoryImpl (which is the implementation class for org.hibernate.SessionFactory) using the registerEntityNameResolver method." msgstr "" diff --git a/documentation/manual/src/main/docbook/pot/content/preface.pot b/documentation/manual/src/main/docbook/pot/content/preface.pot index 239636d3c2..0a1c56ab21 100644 --- a/documentation/manual/src/main/docbook/pot/content/preface.pot +++ b/documentation/manual/src/main/docbook/pot/content/preface.pot @@ -1,84 +1,160 @@ -# -# AUTHOR , YEAR. +# SOME DESCRIPTIVE TITLE. +# FIRST AUTHOR , YEAR. # +#, fuzzy msgid "" msgstr "" -"Project-Id-Version: 0\n" -"POT-Creation-Date: 2010-02-11T05:38:15\n" -"PO-Revision-Date: 2010-02-11T05:38:15\n" -"Last-Translator: Automatically generated\n" -"Language-Team: None\n" +"Project-Id-Version: PACKAGE VERSION\n" +"Report-Msgid-Bugs-To: http://bugs.kde.org\n" +"POT-Creation-Date: 2010-07-20 21:02+0000\n" +"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" +"Last-Translator: FULL NAME \n" +"Language-Team: LANGUAGE \n" "MIME-Version: 1.0\n" -"Content-Type: application/x-publican; charset=UTF-8\n" +"Content-Type: application/x-xml2pot; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" #. Tag: title +#: preface.xml:33 #, no-c-format msgid "Preface" msgstr "" #. Tag: para +#: preface.xml:35 #, 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." +msgid "Working with both Object-Oriented software and Relational Databases can be cumbersome and time consuming. Development costs are significantly higher due to a paradigm mismatch between how data is represented in objects versus relational databases. Hibernate is an Object/Relational Mapping solution for Java environments. The term Object/Relational Mapping refers to the technique of mapping a data representation from an object model to a relational data model with a SQL-based schema; see http://en.wikipedia.org/wiki/Object-relational_mapping for a discussion." msgstr "" #. Tag: para +#: preface.xml:46 +#, no-c-format +msgid "While having a strong background in SQL is not required to use Hibernate, having a basic understanding of the concepts can greatly help you understand Hibernate more fully and quickly. Probably the single best background is an understanding of data modeling principles. You might want to consider these resources as a good starting point:" +msgstr "" + +#. Tag: ulink +#: preface.xml:54 +#, no-c-format +msgid "http://www.agiledata.org/essays/dataModeling101.html" +msgstr "" + +#. Tag: ulink +#: preface.xml:59 +#, no-c-format +msgid "http://en.wikipedia.org/wiki/Data_modeling" +msgstr "" + +#. Tag: para +#: preface.xml:66 #, 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. It can also significantly reduce development time otherwise spent with manual data handling in SQL and JDBC." msgstr "" #. Tag: para +#: preface.xml:72 #, no-c-format -msgid "Hibernate's 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." +msgid "Hibernate’s design goal is to relieve the developer from 95% of common data persistence-related programming tasks by eliminating the need for manual, hand-crafted data processing using SQL and JDBC. However, unlike many other persistence solutions, Hibernate does not hide the power of SQL from you and guarantees that your investment in relational technology and knowledge is as valid as always." msgstr "" #. Tag: para +#: preface.xml:79 +#, no-c-format +msgid "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 "" + +#. Tag: para +#: preface.xml:88 #, no-c-format msgid "If you are new to Hibernate and Object/Relational Mapping or even Java, please follow these steps:" msgstr "" #. Tag: para +#: preface.xml:95 #, no-c-format -msgid "Read for a tutorial with step-by-step instructions. The source code for the tutorial is included in the distribution in the doc/reference/tutorial/ directory." +msgid "Read for a tutorial with step-by-step instructions. The source code for the tutorial is included in the distribution in the doc/reference/tutorial/ directory." msgstr "" #. Tag: para +#: preface.xml:103 #, no-c-format -msgid "Read to understand the environments where Hibernate can be used." +msgid "Read to understand the environments where Hibernate can be used." msgstr "" #. Tag: para +#: preface.xml:109 #, no-c-format msgid "View the eg/ directory in the Hibernate distribution. It contains a simple standalone application. Copy your JDBC driver to the lib/ directory and edit etc/hibernate.properties, specifying correct values for your database. From a command prompt in the distribution directory, type ant eg (using Ant), or under Windows, type build eg." msgstr "" #. Tag: para +#: preface.xml:120 #, no-c-format -msgid "Use this reference documentation as your primary source of information. Consider reading if you need more help with application design, or if you prefer a step-by-step tutorial. Also visit and download the example application from ." +msgid "Use this reference documentation as your primary source of information. Consider reading if you need more help with application design, or if you prefer a step-by-step tutorial. Also visit and download the example application from ." msgstr "" #. Tag: para +#: preface.xml:130 #, no-c-format msgid "FAQs are answered on the Hibernate website." msgstr "" #. Tag: para +#: preface.xml:135 #, no-c-format msgid "Links to third party demos, examples, and tutorials are maintained on the Hibernate website." msgstr "" #. Tag: para +#: preface.xml:141 #, 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 "" #. Tag: para +#: preface.xml:149 #, no-c-format -msgid "If you have questions, use the user forum linked on the Hibernate website. We also provide a JIRA issue tracking 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." +msgid "There are a number of ways to become involved in the Hibernate community, including" msgstr "" #. Tag: para +#: preface.xml:153 #, 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." +msgid "Trying stuff out and reporting bugs. See http://hibernate.org/issuetracker.html details." +msgstr "" + +#. Tag: para +#: preface.xml:160 +#, no-c-format +msgid "Trying your hand at fixing some bugs or implementing enhancements. Again, see http://hibernate.org/issuetracker.html details." +msgstr "" + +#. Tag: para +#: preface.xml:167 +#, no-c-format +msgid "http://hibernate.org/community.html list a few ways to engage in the community." +msgstr "" + +#. Tag: para +#: preface.xml:172 +#, no-c-format +msgid "There are forums for users to ask questions and receive help from the community." +msgstr "" + +#. Tag: para +#: preface.xml:177 +#, no-c-format +msgid "There are also IRC channels for both user and developer discussions." +msgstr "" + +#. Tag: para +#: preface.xml:186 +#, no-c-format +msgid "Helping improve or translate this documentation. Contact us on the developer mailing list if you have interest." +msgstr "" + +#. Tag: para +#: preface.xml:192 +#, no-c-format +msgid "Evangelizing Hibernate within your organization." msgstr "" diff --git a/documentation/manual/src/main/docbook/pot/content/query_sql.pot b/documentation/manual/src/main/docbook/pot/content/query_sql.pot index 409a280b5b..005cd973e7 100644 --- a/documentation/manual/src/main/docbook/pot/content/query_sql.pot +++ b/documentation/manual/src/main/docbook/pot/content/query_sql.pot @@ -1,594 +1,1504 @@ -# -# AUTHOR , YEAR. +# SOME DESCRIPTIVE TITLE. +# FIRST AUTHOR , YEAR. # +#, fuzzy msgid "" msgstr "" -"Project-Id-Version: 0\n" -"POT-Creation-Date: 2010-02-11T05:38:15\n" -"PO-Revision-Date: 2010-02-11T05:38:15\n" -"Last-Translator: Automatically generated\n" -"Language-Team: None\n" +"Project-Id-Version: PACKAGE VERSION\n" +"Report-Msgid-Bugs-To: http://bugs.kde.org\n" +"POT-Creation-Date: 2010-07-20 21:02+0000\n" +"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" +"Last-Translator: FULL NAME \n" +"Language-Team: LANGUAGE \n" "MIME-Version: 1.0\n" -"Content-Type: application/x-publican; charset=UTF-8\n" +"Content-Type: application/x-xml2pot; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" #. Tag: title +#: query_sql.xml:31 #, no-c-format msgid "Native SQL" msgstr "" #. Tag: para +#: query_sql.xml:33 #, no-c-format msgid "You can also express queries in the native SQL dialect of your database. This is useful if you want to utilize database-specific features such as query hints or the CONNECT keyword in Oracle. It also provides a clean migration path from a direct SQL/JDBC based application to Hibernate." msgstr "" #. Tag: para +#: query_sql.xml:39 #, no-c-format msgid "Hibernate3 allows you to specify handwritten SQL, including stored procedures, for all create, update, delete, and load operations." msgstr "" #. Tag: title +#: query_sql.xml:43 #, no-c-format msgid "Using a SQLQuery" msgstr "" #. Tag: para +#: query_sql.xml:45 #, no-c-format msgid "Execution of native SQL queries is controlled via the SQLQuery interface, which is obtained by calling Session.createSQLQuery(). The following sections describe how to use this API for querying." msgstr "" #. Tag: title +#: query_sql.xml:51 #, no-c-format msgid "Scalar queries" msgstr "" #. Tag: para +#: query_sql.xml:53 #, no-c-format msgid "The most basic SQL query is to get a list of scalars (values)." msgstr "" +#. Tag: programlisting +#: query_sql.xml:56 +#, no-c-format +msgid "" + "sess.createSQLQuery(\"SELECT * FROM CATS\").list();\n" + "sess.createSQLQuery(\"SELECT ID, NAME, BIRTHDATE FROM CATS\").list();" +msgstr "" + #. Tag: para +#: query_sql.xml:58 #, no-c-format msgid "These will return a List of Object arrays (Object[]) with scalar values for each column in the CATS table. Hibernate will use ResultSetMetadata to deduce the actual order and types of the returned scalar values." msgstr "" #. Tag: para +#: query_sql.xml:63 #, no-c-format msgid "To avoid the overhead of using ResultSetMetadata, or simply to be more explicit in what is returned, one can use addScalar():" msgstr "" +#. Tag: programlisting +#: query_sql.xml:67 +#, no-c-format +msgid "" + "sess.createSQLQuery(\"SELECT * FROM CATS\")\n" + " .addScalar(\"ID\", Hibernate.LONG)\n" + " .addScalar(\"NAME\", Hibernate.STRING)\n" + " .addScalar(\"BIRTHDATE\", Hibernate.DATE)" +msgstr "" + #. Tag: para +#: query_sql.xml:69 query_sql.xml:116 query_sql.xml:197 query_sql.xml:349 #, no-c-format msgid "This query specified:" msgstr "" #. Tag: para +#: query_sql.xml:73 query_sql.xml:120 query_sql.xml:353 #, no-c-format msgid "the SQL query string" msgstr "" #. Tag: para +#: query_sql.xml:77 #, no-c-format msgid "the columns and types to return" msgstr "" #. Tag: para +#: query_sql.xml:81 #, no-c-format msgid "This will return Object arrays, but now it will not use ResultSetMetadata but will instead explicitly get the ID, NAME and BIRTHDATE column as respectively a Long, String and a Short from the underlying resultset. This also means that only these three columns will be returned, even though the query is using * and could return more than the three listed columns." msgstr "" #. Tag: para +#: query_sql.xml:89 #, no-c-format msgid "It is possible to leave out the type information for all or some of the scalars." msgstr "" +#. Tag: programlisting +#: query_sql.xml:92 +#, no-c-format +msgid "" + "sess.createSQLQuery(\"SELECT * FROM CATS\")\n" + " .addScalar(\"ID\", Hibernate.LONG)\n" + " .addScalar(\"NAME\")\n" + " .addScalar(\"BIRTHDATE\")" +msgstr "" + #. Tag: para +#: query_sql.xml:94 #, no-c-format msgid "This is essentially the same query as before, but now ResultSetMetaData is used to determine the type of NAME and BIRTHDATE, where as the type of ID is explicitly specified." msgstr "" #. Tag: para +#: query_sql.xml:99 #, no-c-format msgid "How the java.sql.Types returned from ResultSetMetaData is mapped to Hibernate types is controlled by the Dialect. If a specific type is not mapped, or does not result in the expected type, it is possible to customize it via calls to registerHibernateType in the Dialect." msgstr "" #. Tag: title +#: query_sql.xml:107 #, no-c-format msgid "Entity queries" msgstr "" #. Tag: para +#: query_sql.xml:109 #, no-c-format msgid "The above queries were all about returning scalar values, basically returning the \"raw\" values from the resultset. The following shows how to get entity objects from a native sql query via addEntity()." msgstr "" +#. Tag: programlisting +#: query_sql.xml:114 +#, no-c-format +msgid "" + "sess.createSQLQuery(\"SELECT * FROM CATS\").addEntity(Cat.class);\n" + "sess.createSQLQuery(\"SELECT ID, NAME, BIRTHDATE FROM CATS\").addEntity(Cat.class);" +msgstr "" + #. Tag: para +#: query_sql.xml:124 #, no-c-format msgid "the entity returned by the query" msgstr "" #. Tag: para +#: query_sql.xml:128 #, no-c-format msgid "Assuming that Cat is mapped as a class with the columns ID, NAME and BIRTHDATE the above queries will both return a List where each element is a Cat entity." msgstr "" #. Tag: para +#: query_sql.xml:132 #, no-c-format msgid "If the entity is mapped with a many-to-one to another entity it is required to also return this when performing the native query, otherwise a database specific \"column not found\" error will occur. The additional columns will automatically be returned when using the * notation, but we prefer to be explicit as in the following example for a many-to-one to a Dog:" msgstr "" +#. Tag: programlisting +#: query_sql.xml:140 +#, no-c-format +msgid "sess.createSQLQuery(\"SELECT ID, NAME, BIRTHDATE, DOG_ID FROM CATS\").addEntity(Cat.class);" +msgstr "" + #. Tag: para +#: query_sql.xml:142 #, no-c-format msgid "This will allow cat.getDog() to function properly." msgstr "" #. Tag: title +#: query_sql.xml:146 #, no-c-format msgid "Handling associations and collections" msgstr "" #. Tag: para +#: query_sql.xml:148 #, no-c-format msgid "It is possible to eagerly join in the Dog to avoid the possible extra roundtrip for initializing the proxy. This is done via the addJoin() method, which allows you to join in an association or collection." msgstr "" +#. Tag: programlisting +#: query_sql.xml:153 +#, no-c-format +msgid "" + "sess.createSQLQuery(\"SELECT c.ID, NAME, BIRTHDATE, DOG_ID, D_ID, D_NAME FROM CATS c, DOGS d WHERE c.DOG_ID = d.D_ID\")\n" + " .addEntity(\"cat\", Cat.class)\n" + " .addJoin(\"cat.dog\");" +msgstr "" + #. Tag: para +#: query_sql.xml:155 #, no-c-format msgid "In this example, the returned Cat's will have their dog property fully initialized without any extra roundtrip to the database. Notice that you added an alias name (\"cat\") to be able to specify the target property path of the join. It is possible to do the same eager joining for collections, e.g. if the Cat had a one-to-many to Dog instead." msgstr "" +#. Tag: programlisting +#: query_sql.xml:163 +#, no-c-format +msgid "" + "sess.createSQLQuery(\"SELECT ID, NAME, BIRTHDATE, D_ID, D_NAME, CAT_ID FROM CATS c, DOGS d WHERE c.ID = d.CAT_ID\")\n" + " .addEntity(\"cat\", Cat.class)\n" + " .addJoin(\"cat.dogs\");" +msgstr "" + #. Tag: para +#: query_sql.xml:165 #, no-c-format msgid "At this stage you are reaching the limits of what is possible with native queries, without starting to enhance the sql queries to make them usable in Hibernate. Problems can arise when returning multiple entities of the same type or when the default alias/column names are not enough." msgstr "" #. Tag: title +#: query_sql.xml:173 #, no-c-format msgid "Returning multiple entities" msgstr "" #. Tag: para +#: query_sql.xml:175 #, no-c-format msgid "Until now, the result set column names are assumed to be the same as the column names specified in the mapping document. This can be problematic for SQL queries that join multiple tables, since the same column names can appear in more than one table." msgstr "" #. Tag: para +#: query_sql.xml:180 #, no-c-format msgid "Column alias injection is needed in the following query (which most likely will fail):" msgstr "" +#. Tag: programlisting +#: query_sql.xml:183 +#, no-c-format +msgid "" + "sess.createSQLQuery(\"SELECT c.*, m.* FROM CATS c, CATS m WHERE c.MOTHER_ID = c.ID\")\n" + " .addEntity(\"cat\", Cat.class)\n" + " .addEntity(\"mother\", Cat.class)" +msgstr "" + #. Tag: para +#: query_sql.xml:185 #, no-c-format msgid "The query was intended to return two Cat instances per row: a cat and its mother. The query will, however, fail because there is a conflict of names; the instances are mapped to the same column names. Also, on some databases the returned column aliases will most likely be on the form \"c.ID\", \"c.NAME\", etc. which are not equal to the columns specified in the mappings (\"ID\" and \"NAME\")." msgstr "" #. Tag: para +#: query_sql.xml:192 #, no-c-format msgid "The following form is not vulnerable to column name duplication:" msgstr "" +#. Tag: programlisting +#: query_sql.xml:195 +#, no-c-format +msgid "" + "sess.createSQLQuery(\"SELECT {cat.*}, {mother.*} FROM CATS c, CATS m WHERE c.MOTHER_ID = c.ID\")\n" + " .addEntity(\"cat\", Cat.class)\n" + " .addEntity(\"mother\", Cat.class)" +msgstr "" + #. Tag: para +#: query_sql.xml:201 #, no-c-format msgid "the SQL query string, with placeholders for Hibernate to inject column aliases" msgstr "" #. Tag: para +#: query_sql.xml:206 #, no-c-format msgid "the entities returned by the query" msgstr "" #. Tag: para +#: query_sql.xml:210 #, no-c-format msgid "The {cat.*} and {mother.*} notation used above is a shorthand for \"all properties\". Alternatively, you can list the columns explicitly, but even in this case Hibernate injects the SQL column aliases for each property. The placeholder for a column alias is just the property name qualified by the table alias. In the following example, you retrieve Cats and their mothers from a different table (cat_log) to the one declared in the mapping metadata. You can even use the property aliases in the where clause." msgstr "" +#. Tag: programlisting +#: query_sql.xml:219 +#, no-c-format +msgid "" + "String sql = \"SELECT ID as {c.id}, NAME as {c.name}, \" +\n" + " \"BIRTHDATE as {c.birthDate}, MOTHER_ID as {c.mother}, {mother.*} \" +\n" + " \"FROM CAT_LOG c, CAT_LOG m WHERE {c.mother} = c.ID\";\n" + "\n" + "List loggedCats = sess.createSQLQuery(sql)\n" + " .addEntity(\"cat\", Cat.class)\n" + " .addEntity(\"mother\", Cat.class).list()" +msgstr "" + #. Tag: title +#: query_sql.xml:222 #, no-c-format msgid "Alias and property references" msgstr "" #. Tag: para +#: query_sql.xml:224 #, no-c-format msgid "In most cases the above alias injection is needed. For queries relating to more complex mappings, like composite properties, inheritance discriminators, collections etc., you can use specific aliases that allow Hibernate to inject the proper aliases." msgstr "" #. Tag: para +#: query_sql.xml:229 #, no-c-format msgid "The following table shows the different ways you can use the alias injection. Please note that the alias names in the result are simply examples; each alias will have a unique and probably different name when used." msgstr "" #. Tag: title +#: query_sql.xml:235 #, no-c-format msgid "Alias injection names" msgstr "" #. Tag: entry +#: query_sql.xml:246 #, no-c-format msgid "Description" msgstr "" #. Tag: entry +#: query_sql.xml:248 #, no-c-format msgid "Syntax" msgstr "" #. Tag: entry +#: query_sql.xml:250 #, no-c-format msgid "Example" msgstr "" #. Tag: entry +#: query_sql.xml:256 #, no-c-format msgid "A simple property" msgstr "" -#. Tag: entry +#. Tag: literal +#: query_sql.xml:258 #, no-c-format -msgid "{[aliasname].[propertyname]" -msgstr "" - -#. Tag: entry -#, no-c-format -msgid "A_NAME as {item.name}" +msgid "{[aliasname].[propertyname]" +msgstr "" + +#. Tag: literal +#: query_sql.xml:260 +#, no-c-format +msgid "A_NAME as {item.name}" msgstr "" #. Tag: entry +#: query_sql.xml:264 #, no-c-format msgid "A composite property" msgstr "" -#. Tag: entry +#. Tag: literal +#: query_sql.xml:266 #, no-c-format -msgid "{[aliasname].[componentname].[propertyname]}" -msgstr "" - -#. Tag: entry -#, no-c-format -msgid "CURRENCY as {item.amount.currency}, VALUE as {item.amount.value}" +msgid "{[aliasname].[componentname].[propertyname]}" +msgstr "" + +#. Tag: literal +#: query_sql.xml:268 +#, no-c-format +msgid "CURRENCY as {item.amount.currency}, VALUE as {item.amount.value}" msgstr "" #. Tag: entry +#: query_sql.xml:273 #, no-c-format msgid "Discriminator of an entity" msgstr "" -#. Tag: entry +#. Tag: literal +#: query_sql.xml:275 #, no-c-format -msgid "{[aliasname].class}" -msgstr "" - -#. Tag: entry -#, no-c-format -msgid "DISC as {item.class}" +msgid "{[aliasname].class}" +msgstr "" + +#. Tag: literal +#: query_sql.xml:277 +#, no-c-format +msgid "DISC as {item.class}" msgstr "" #. Tag: entry +#: query_sql.xml:281 #, no-c-format msgid "All properties of an entity" msgstr "" -#. Tag: entry +#. Tag: literal +#: query_sql.xml:283 query_sql.xml:331 #, no-c-format -msgid "{[aliasname].*}" -msgstr "" - -#. Tag: entry -#, no-c-format -msgid "{item.*}" +msgid "{[aliasname].*}" +msgstr "" + +#. Tag: literal +#: query_sql.xml:285 +#, no-c-format +msgid "{item.*}" msgstr "" #. Tag: entry +#: query_sql.xml:289 #, no-c-format msgid "A collection key" msgstr "" -#. Tag: entry +#. Tag: literal +#: query_sql.xml:291 #, no-c-format -msgid "{[aliasname].key}" -msgstr "" - -#. Tag: entry -#, no-c-format -msgid "ORGID as {coll.key}" +msgid "{[aliasname].key}" +msgstr "" + +#. Tag: literal +#: query_sql.xml:293 +#, no-c-format +msgid "ORGID as {coll.key}" msgstr "" #. Tag: entry +#: query_sql.xml:297 #, no-c-format msgid "The id of an collection" msgstr "" -#. Tag: entry +#. Tag: literal +#: query_sql.xml:299 #, no-c-format -msgid "{[aliasname].id}" -msgstr "" - -#. Tag: entry -#, no-c-format -msgid "EMPID as {coll.id}" +msgid "{[aliasname].id}" +msgstr "" + +#. Tag: literal +#: query_sql.xml:301 +#, no-c-format +msgid "EMPID as {coll.id}" msgstr "" #. Tag: entry +#: query_sql.xml:305 #, no-c-format msgid "The element of an collection" msgstr "" -#. Tag: entry +#. Tag: literal +#: query_sql.xml:307 #, no-c-format -msgid "{[aliasname].element}" -msgstr "" - -#. Tag: entry -#, no-c-format -msgid "XID as {coll.element}" +msgid "{[aliasname].element}" +msgstr "" + +#. Tag: literal +#: query_sql.xml:309 +#, no-c-format +msgid "XID as {coll.element}" msgstr "" #. Tag: entry +#: query_sql.xml:313 #, no-c-format msgid "property of the element in the collection" msgstr "" -#. Tag: entry +#. Tag: literal +#: query_sql.xml:315 #, no-c-format -msgid "{[aliasname].element.[propertyname]}" -msgstr "" - -#. Tag: entry -#, no-c-format -msgid "NAME as {coll.element.name}" +msgid "{[aliasname].element.[propertyname]}" +msgstr "" + +#. Tag: literal +#: query_sql.xml:317 +#, no-c-format +msgid "NAME as {coll.element.name}" msgstr "" #. Tag: entry +#: query_sql.xml:321 #, no-c-format msgid "All properties of the element in the collection" msgstr "" -#. Tag: entry +#. Tag: literal +#: query_sql.xml:323 #, no-c-format -msgid "{[aliasname].element.*}" +msgid "{[aliasname].element.*}" +msgstr "" + +#. Tag: literal +#: query_sql.xml:325 +#, no-c-format +msgid "{coll.element.*}" msgstr "" #. Tag: entry +#: query_sql.xml:329 #, no-c-format -msgid "{coll.element.*}" +msgid "All properties of the collection" msgstr "" -#. Tag: entry +#. Tag: literal +#: query_sql.xml:333 #, no-c-format -msgid "All properties of the the collection" -msgstr "" - -#. Tag: entry -#, no-c-format -msgid "{coll.*}" +msgid "{coll.*}" msgstr "" #. Tag: title +#: query_sql.xml:342 #, no-c-format msgid "Returning non-managed entities" msgstr "" #. Tag: para +#: query_sql.xml:344 #, no-c-format msgid "It is possible to apply a ResultTransformer to native SQL queries, allowing it to return non-managed entities." msgstr "" +#. Tag: programlisting +#: query_sql.xml:347 +#, no-c-format +msgid "" + "sess.createSQLQuery(\"SELECT NAME, BIRTHDATE FROM CATS\")\n" + " .setResultTransformer(Transformers.aliasToBean(CatDTO.class))" +msgstr "" + #. Tag: para +#: query_sql.xml:357 #, no-c-format msgid "a result transformer" msgstr "" #. Tag: para +#: query_sql.xml:361 #, no-c-format msgid "The above query will return a list of CatDTO which has been instantiated and injected the values of NAME and BIRTHNAME into its corresponding properties or fields." msgstr "" #. Tag: title +#: query_sql.xml:367 #, no-c-format msgid "Handling inheritance" msgstr "" #. Tag: para +#: query_sql.xml:369 #, no-c-format msgid "Native SQL queries which query for entities that are mapped as part of an inheritance must include all properties for the baseclass and all its subclasses." msgstr "" #. Tag: title +#: query_sql.xml:375 #, no-c-format msgid "Parameters" msgstr "" #. Tag: para +#: query_sql.xml:377 #, no-c-format msgid "Native SQL queries support positional as well as named parameters:" msgstr "" +#. Tag: programlisting +#: query_sql.xml:380 +#, no-c-format +msgid "" + "Query query = sess.createSQLQuery(\"SELECT * FROM CATS WHERE NAME like ?\").addEntity(Cat.class);\n" + "List pusList = query.setString(0, \"Pus%\").list();\n" + " \n" + "query = sess.createSQLQuery(\"SELECT * FROM CATS WHERE NAME like :name\").addEntity(Cat.class);\n" + "List pusList = query.setString(\"name\", \"Pus%\").list();" +msgstr "" + #. Tag: title +#: query_sql.xml:385 #, no-c-format msgid "Named SQL queries" msgstr "" #. Tag: para +#: query_sql.xml:387 #, no-c-format -msgid "Named SQL queries can be defined in the mapping document and called in exactly the same way as a named HQL query. In this case, you do not need to call addEntity()." +msgid "Named SQL queries can also be defined in the mapping document and called in exactly the same way as a named HQL query (see ). In this case, you do not need to call addEntity()." +msgstr "" + +#. Tag: title +#: query_sql.xml:394 +#, no-c-format +msgid "Named sql query using the <sql-query> maping element" +msgstr "" + +#. Tag: programlisting +#: query_sql.xml:397 +#, no-c-format +msgid "" + "<sql-query name=\"persons\">\n" + " <return alias=\"person\" class=\"eg.Person\"/>\n" + " SELECT person.NAME AS {person.name},\n" + " person.AGE AS {person.age},\n" + " person.SEX AS {person.sex}\n" + " FROM PERSON person\n" + " WHERE person.NAME LIKE :namePattern\n" + "</sql-query>" +msgstr "" + +#. Tag: title +#: query_sql.xml:401 +#, no-c-format +msgid "Execution of a named query" +msgstr "" + +#. Tag: programlisting +#: query_sql.xml:403 +#, no-c-format +msgid "" + "List people = sess.getNamedQuery(\"persons\")\n" + " .setString(\"namePattern\", namePattern)\n" + " .setMaxResults(50)\n" + " .list();" msgstr "" #. Tag: para +#: query_sql.xml:406 #, no-c-format msgid "The <return-join> element is use to join associations and the <load-collection> element is used to define queries which initialize collections," msgstr "" +#. Tag: title +#: query_sql.xml:411 +#, no-c-format +msgid "Named sql query with association" +msgstr "" + +#. Tag: programlisting +#: query_sql.xml:413 +#, no-c-format +msgid "" + "<sql-query name=\"personsWith\">\n" + " <return alias=\"person\" class=\"eg.Person\"/>\n" + " <return-join alias=\"address\" property=\"person.mailingAddress\"/>\n" + " SELECT person.NAME AS {person.name},\n" + " person.AGE AS {person.age},\n" + " person.SEX AS {person.sex},\n" + " address.STREET AS {address.street},\n" + " address.CITY AS {address.city},\n" + " address.STATE AS {address.state},\n" + " address.ZIP AS {address.zip}\n" + " FROM PERSON person\n" + " JOIN ADDRESS address\n" + " ON person.ID = address.PERSON_ID AND address.TYPE='MAILING'\n" + " WHERE person.NAME LIKE :namePattern\n" + "</sql-query>" +msgstr "" + #. Tag: para +#: query_sql.xml:416 #, no-c-format msgid "A named SQL query may return a scalar value. You must declare the column alias and Hibernate type using the <return-scalar> element:" msgstr "" +#. Tag: title +#: query_sql.xml:421 +#, no-c-format +msgid "Named query returning a scalar" +msgstr "" + +#. Tag: programlisting +#: query_sql.xml:423 +#, no-c-format +msgid "" + "<sql-query name=\"mySqlQuery\">\n" + " <return-scalar column=\"name\" type=\"string\"/>\n" + " <return-scalar column=\"age\" type=\"long\"/>\n" + " SELECT p.NAME AS name, \n" + " p.AGE AS age,\n" + " FROM PERSON p WHERE p.NAME LIKE 'Hiber%'\n" + "</sql-query>" +msgstr "" + #. Tag: para +#: query_sql.xml:426 #, no-c-format msgid "You can externalize the resultset mapping information in a <resultset> element which will allow you to either reuse them across several named queries or through the setResultSetMapping() API." msgstr "" +#. Tag: title +#: query_sql.xml:432 +#, no-c-format +msgid "<resultset> mapping used to externalize mapping information" +msgstr "" + +#. Tag: programlisting +#: query_sql.xml:435 +#, no-c-format +msgid "" + "<resultset name=\"personAddress\">\n" + " <return alias=\"person\" class=\"eg.Person\"/>\n" + " <return-join alias=\"address\" property=\"person.mailingAddress\"/>\n" + "</resultset>\n" + "\n" + "<sql-query name=\"personsWith\" resultset-ref=\"personAddress\">\n" + " SELECT person.NAME AS {person.name},\n" + " person.AGE AS {person.age},\n" + " person.SEX AS {person.sex},\n" + " address.STREET AS {address.street},\n" + " address.CITY AS {address.city},\n" + " address.STATE AS {address.state},\n" + " address.ZIP AS {address.zip}\n" + " FROM PERSON person\n" + " JOIN ADDRESS address\n" + " ON person.ID = address.PERSON_ID AND address.TYPE='MAILING'\n" + " WHERE person.NAME LIKE :namePattern\n" + "</sql-query>" +msgstr "" + #. Tag: para +#: query_sql.xml:438 #, no-c-format msgid "You can, alternatively, use the resultset mapping information in your hbm files directly in java code." msgstr "" #. Tag: title +#: query_sql.xml:442 +#, no-c-format +msgid "Programmatically specifying the result mapping information" +msgstr "" + +#. Tag: programlisting +#: query_sql.xml:445 +#, no-c-format +msgid "" + "List cats = sess.createSQLQuery(\n" + " \"select {cat.*}, {kitten.*} from cats cat, cats kitten where kitten.mother = cat.id\"\n" + " )\n" + " .setResultSetMapping(\"catAndKitten\")\n" + " .list();" +msgstr "" + +#. Tag: para +#: query_sql.xml:448 +#, no-c-format +msgid "So far we have only looked at externalizing SQL queries using Hibernate mapping files. The same concept is also available with anntations and is called named native queries. You can use @NamedNativeQuery (@NamedNativeQueries) in conjunction with @SqlResultSetMapping (@SqlResultSetMappings). Like @NamedQuery, @NamedNativeQuery and @SqlResultSetMapping can be defined at class level, but their scope is global to the application. Lets look at a view examples." +msgstr "" + +#. Tag: para +#: query_sql.xml:460 +#, no-c-format +msgid "shows how a resultSetMapping parameter is defined in @NamedNativeQuery. It represents the name of a defined @SqlResultSetMapping. The resultset mapping declares the entities retrieved by this native query. Each field of the entity is bound to an SQL alias (or column name). All fields of the entity including the ones of subclasses and the foreign key columns of related entities have to be present in the SQL query. Field definitions are optional provided that they map to the same column name as the one declared on the class property. In the example 2 entities, Night and Area, are returned and each property is declared and associated to a column name, actually the column name retrieved by the query." +msgstr "" + +#. Tag: para +#: query_sql.xml:475 +#, no-c-format +msgid "In the result set mapping is implicit. We only describe the entity class of the result set mapping. The property / column mappings is done using the entity mapping values. In this case the model property is bound to the model_txt column." +msgstr "" + +#. Tag: para +#: query_sql.xml:481 +#, no-c-format +msgid "Finally, if the association to a related entity involve a composite primary key, a @FieldResult element should be used for each foreign key column. The @FieldResult name is composed of the property name for the relationship, followed by a dot (\".\"), followed by the name or the field or property of the primary key. This can be seen in ." +msgstr "" + +#. Tag: title +#: query_sql.xml:490 +#, no-c-format +msgid "Named SQL query using @NamedNativeQuery together with @SqlResultSetMapping" +msgstr "" + +#. Tag: programlisting +#: query_sql.xml:493 +#, no-c-format +msgid "" + "@NamedNativeQuery(name=\"night&area\", query=\"select night.id nid, night.night_duration, \"\n" + " + \" night.night_date, area.id aid, night.area_id, area.name \"\n" + " + \"from Night night, Area area where night.area_id = area.id\", \n" + " resultSetMapping=\"joinMapping\")\n" + "@SqlResultSetMapping(name=\"joinMapping\", entities={\n" + " @EntityResult(entityClass=Night.class, fields = {\n" + " @FieldResult(name=\"id\", column=\"nid\"),\n" + " @FieldResult(name=\"duration\", column=\"night_duration\"),\n" + " @FieldResult(name=\"date\", column=\"night_date\"),\n" + " @FieldResult(name=\"area\", column=\"area_id\"),\n" + " discriminatorColumn=\"disc\"\n" + " }),\n" + " @EntityResult(entityClass=org.hibernate.test.annotations.query.Area.class, fields = {\n" + " @FieldResult(name=\"id\", column=\"aid\"),\n" + " @FieldResult(name=\"name\", column=\"name\")\n" + " })\n" + " }\n" + ")" +msgstr "" + +#. Tag: title +#: query_sql.xml:497 +#, no-c-format +msgid "Implicit result set mapping" +msgstr "" + +#. Tag: programlisting +#: query_sql.xml:499 +#, no-c-format +msgid "" + "@Entity\n" + "@SqlResultSetMapping(name=\"implicit\",\n" + " entities=@EntityResult(entityClass=SpaceShip.class))\n" + "@NamedNativeQuery(name=\"implicitSample\", \n" + " query=\"select * from SpaceShip\", \n" + " resultSetMapping=\"implicit\")\n" + "public class SpaceShip {\n" + " private String name;\n" + " private String model;\n" + " private double speed;\n" + "\n" + " @Id\n" + " public String getName() {\n" + " return name;\n" + " }\n" + "\n" + " public void setName(String name) {\n" + " this.name = name;\n" + " }\n" + "\n" + " @Column(name=\"model_txt\")\n" + " public String getModel() {\n" + " return model;\n" + " }\n" + "\n" + " public void setModel(String model) {\n" + " this.model = model;\n" + " }\n" + "\n" + " public double getSpeed() {\n" + " return speed;\n" + " }\n" + "\n" + " public void setSpeed(double speed) {\n" + " this.speed = speed;\n" + " }\n" + "}" +msgstr "" + +#. Tag: title +#: query_sql.xml:503 +#, no-c-format +msgid "Using dot notation in @FieldResult for specifying associations" +msgstr "" + +#. Tag: programlisting +#: query_sql.xml:506 +#, no-c-format +msgid "" + "@Entity\n" + "@SqlResultSetMapping(name=\"compositekey\",\n" + " entities=@EntityResult(entityClass=SpaceShip.class,\n" + " fields = {\n" + " @FieldResult(name=\"name\", column = \"name\"),\n" + " @FieldResult(name=\"model\", column = \"model\"),\n" + " @FieldResult(name=\"speed\", column = \"speed\"),\n" + " @FieldResult(name=\"captain.firstname\", column = \"firstn\"),\n" + " @FieldResult(name=\"captain.lastname\", column = \"lastn\"),\n" + " @FieldResult(name=\"dimensions.length\", column = \"length\"),\n" + " @FieldResult(name=\"dimensions.width\", column = \"width\")\n" + " }),\n" + " columns = { @ColumnResult(name = \"surface\"),\n" + " @ColumnResult(name = \"volume\") } )\n" + "\n" + "@NamedNativeQuery(name=\"compositekey\",\n" + " query=\"select name, model, speed, lname as lastn, fname as firstn, length, width, length * width as surface from SpaceShip\", \n" + " resultSetMapping=\"compositekey\")\n" + "} )\n" + "public class SpaceShip {\n" + " private String name;\n" + " private String model;\n" + " private double speed;\n" + " private Captain captain;\n" + " private Dimensions dimensions;\n" + "\n" + " @Id\n" + " public String getName() {\n" + " return name;\n" + " }\n" + "\n" + " public void setName(String name) {\n" + " this.name = name;\n" + " }\n" + "\n" + " @ManyToOne(fetch= FetchType.LAZY)\n" + " @JoinColumns( {\n" + " @JoinColumn(name=\"fname\", referencedColumnName = \"firstname\"),\n" + " @JoinColumn(name=\"lname\", referencedColumnName = \"lastname\")\n" + " } )\n" + " public Captain getCaptain() {\n" + " return captain;\n" + " }\n" + "\n" + " public void setCaptain(Captain captain) {\n" + " this.captain = captain;\n" + " }\n" + "\n" + " public String getModel() {\n" + " return model;\n" + " }\n" + "\n" + " public void setModel(String model) {\n" + " this.model = model;\n" + " }\n" + "\n" + " public double getSpeed() {\n" + " return speed;\n" + " }\n" + "\n" + " public void setSpeed(double speed) {\n" + " this.speed = speed;\n" + " }\n" + "\n" + " public Dimensions getDimensions() {\n" + " return dimensions;\n" + " }\n" + "\n" + " public void setDimensions(Dimensions dimensions) {\n" + " this.dimensions = dimensions;\n" + " }\n" + "}\n" + "\n" + "@Entity\n" + "@IdClass(Identity.class)\n" + "public class Captain implements Serializable {\n" + " private String firstname;\n" + " private String lastname;\n" + "\n" + " @Id\n" + " public String getFirstname() {\n" + " return firstname;\n" + " }\n" + "\n" + " public void setFirstname(String firstname) {\n" + " this.firstname = firstname;\n" + " }\n" + "\n" + " @Id\n" + " public String getLastname() {\n" + " return lastname;\n" + " }\n" + "\n" + " public void setLastname(String lastname) {\n" + " this.lastname = lastname;\n" + " }\n" + "}" +msgstr "" + +#. Tag: para +#: query_sql.xml:510 +#, no-c-format +msgid "If you retrieve a single entity using the default mapping, you can specify the resultClass attribute instead of resultSetMapping:" +msgstr "" + +#. Tag: programlisting +#: query_sql.xml:514 +#, no-c-format +msgid "" + "@NamedNativeQuery(name=\"implicitSample\", query=\"select * from SpaceShip\", resultClass=SpaceShip.class)\n" + "public class SpaceShip {" +msgstr "" + +#. Tag: para +#: query_sql.xml:517 +#, no-c-format +msgid "In some of your native queries, you'll have to return scalar values, for example when building report queries. You can map them in the @SqlResultsetMapping through @ColumnResult. You actually can even mix, entities and scalar returns in the same native query (this is probably not that common though)." +msgstr "" + +#. Tag: title +#: query_sql.xml:525 +#, no-c-format +msgid "Scalar values via @ColumnResult" +msgstr "" + +#. Tag: programlisting +#: query_sql.xml:527 +#, no-c-format +msgid "" + "@SqlResultSetMapping(name=\"scalar\", columns=@ColumnResult(name=\"dimension\"))\n" + "@NamedNativeQuery(name=\"scalar\", query=\"select length*width as dimension from SpaceShip\", resultSetMapping=\"scalar\")" +msgstr "" + +#. Tag: para +#: query_sql.xml:530 +#, no-c-format +msgid "An other query hint specific to native queries has been introduced: org.hibernate.callable which can be true or false depending on whether the query is a stored procedure or not." +msgstr "" + +#. Tag: title +#: query_sql.xml:535 #, no-c-format msgid "Using return-property to explicitly specify column/alias names" msgstr "" #. Tag: para +#: query_sql.xml:538 #, no-c-format msgid "You can explicitly tell Hibernate what column aliases to use with <return-property>, instead of using the {}-syntax to let Hibernate inject its own aliases.For example:" msgstr "" +#. Tag: programlisting +#: query_sql.xml:543 +#, no-c-format +msgid "" + "<sql-query name=\"mySqlQuery\">\n" + " <return alias=\"person\" class=\"eg.Person\">\n" + " <return-property name=\"name\" column=\"myName\"/>\n" + " <return-property name=\"age\" column=\"myAge\"/>\n" + " <return-property name=\"sex\" column=\"mySex\"/>\n" + " </return>\n" + " SELECT person.NAME AS myName,\n" + " person.AGE AS myAge,\n" + " person.SEX AS mySex,\n" + " FROM PERSON person WHERE person.NAME LIKE :name\n" + "</sql-query>" +msgstr "" + #. Tag: para +#: query_sql.xml:545 #, no-c-format msgid "<return-property> also works with multiple columns. This solves a limitation with the {}-syntax which cannot allow fine grained control of multi-column properties." msgstr "" +#. Tag: programlisting +#: query_sql.xml:550 +#, no-c-format +msgid "" + "<sql-query name=\"organizationCurrentEmployments\">\n" + " <return alias=\"emp\" class=\"Employment\">\n" + " <return-property name=\"salary\">\n" + " <return-column name=\"VALUE\"/>\n" + " <return-column name=\"CURRENCY\"/>\n" + " </return-property>\n" + " <return-property name=\"endDate\" column=\"myEndDate\"/>\n" + " </return>\n" + " SELECT EMPLOYEE AS {emp.employee}, EMPLOYER AS {emp.employer},\n" + " STARTDATE AS {emp.startDate}, ENDDATE AS {emp.endDate},\n" + " REGIONCODE as {emp.regionCode}, EID AS {emp.id}, VALUE, CURRENCY\n" + " FROM EMPLOYMENT\n" + " WHERE EMPLOYER = :id AND ENDDATE IS NULL\n" + " ORDER BY STARTDATE ASC\n" + "</sql-query>" +msgstr "" + #. Tag: para +#: query_sql.xml:552 #, no-c-format msgid "In this example <return-property> was used in combination with the {}-syntax for injection. This allows users to choose how they want to refer column and properties." msgstr "" #. Tag: para +#: query_sql.xml:557 #, no-c-format msgid "If your mapping has a discriminator you must use <return-discriminator> to specify the discriminator column." msgstr "" #. Tag: title +#: query_sql.xml:563 #, no-c-format msgid "Using stored procedures for querying" msgstr "" #. Tag: para +#: query_sql.xml:565 #, no-c-format msgid "Hibernate3 provides support for queries via stored procedures and functions. Most of the following documentation is equivalent for both. The stored procedure/function must return a resultset as the first out-parameter to be able to work with Hibernate. An example of such a stored function in Oracle 9 and higher is as follows:" msgstr "" +#. Tag: programlisting +#: query_sql.xml:571 +#, no-c-format +msgid "" + "CREATE OR REPLACE FUNCTION selectAllEmployments\n" + " RETURN SYS_REFCURSOR\n" + "AS\n" + " st_cursor SYS_REFCURSOR;\n" + "BEGIN\n" + " OPEN st_cursor FOR\n" + " SELECT EMPLOYEE, EMPLOYER,\n" + " STARTDATE, ENDDATE,\n" + " REGIONCODE, EID, VALUE, CURRENCY\n" + " FROM EMPLOYMENT;\n" + " RETURN st_cursor;\n" + " END;" +msgstr "" + #. Tag: para +#: query_sql.xml:573 #, no-c-format msgid "To use this query in Hibernate you need to map it via a named query." msgstr "" +#. Tag: programlisting +#: query_sql.xml:576 +#, no-c-format +msgid "" + "<sql-query name=\"selectAllEmployees_SP\" callable=\"true\">\n" + " <return alias=\"emp\" class=\"Employment\">\n" + " <return-property name=\"employee\" column=\"EMPLOYEE\"/>\n" + " <return-property name=\"employer\" column=\"EMPLOYER\"/>\n" + " <return-property name=\"startDate\" column=\"STARTDATE\"/>\n" + " <return-property name=\"endDate\" column=\"ENDDATE\"/>\n" + " <return-property name=\"regionCode\" column=\"REGIONCODE\"/>\n" + " <return-property name=\"id\" column=\"EID\"/>\n" + " <return-property name=\"salary\">\n" + " <return-column name=\"VALUE\"/>\n" + " <return-column name=\"CURRENCY\"/>\n" + " </return-property>\n" + " </return>\n" + " { ? = call selectAllEmployments() }\n" + "</sql-query>" +msgstr "" + #. Tag: para +#: query_sql.xml:578 #, no-c-format msgid "Stored procedures currently only return scalars and entities. <return-join> and <load-collection> are not supported." msgstr "" #. Tag: title +#: query_sql.xml:583 #, no-c-format msgid "Rules/limitations for using stored procedures" msgstr "" #. Tag: para +#: query_sql.xml:585 #, no-c-format msgid "You cannot use stored procedures with Hibernate unless you follow some procedure/function rules. If they do not follow those rules they are not usable with Hibernate. If you still want to use these procedures you have to execute them via session.connection(). The rules are different for each database, since database vendors have different stored procedure semantics/syntax." msgstr "" #. Tag: para +#: query_sql.xml:593 #, no-c-format msgid "Stored procedure queries cannot be paged with setFirstResult()/setMaxResults()." msgstr "" #. Tag: para +#: query_sql.xml:596 #, no-c-format msgid "The recommended call form is standard SQL92: { ? = call functionName(<parameters>) } or { ? = call procedureName(<parameters>}. Native call syntax is not supported." msgstr "" #. Tag: para +#: query_sql.xml:601 #, no-c-format msgid "For Oracle the following rules apply:" msgstr "" #. Tag: para +#: query_sql.xml:605 #, no-c-format msgid "A function must return a result set. The first parameter of a procedure must be an OUT that returns a result set. This is done by using a SYS_REFCURSOR type in Oracle 9 or 10. In Oracle you need to define a REF CURSOR type. See Oracle literature for further information." msgstr "" #. Tag: para +#: query_sql.xml:614 #, no-c-format msgid "For Sybase or MS SQL server the following rules apply:" msgstr "" #. Tag: para +#: query_sql.xml:618 #, no-c-format msgid "The procedure must return a result set. Note that since these servers can return multiple result sets and update counts, Hibernate will iterate the results and take the first result that is a result set as its return value. Everything else will be discarded." msgstr "" #. Tag: para +#: query_sql.xml:626 #, no-c-format msgid "If you can enable SET NOCOUNT ON in your procedure it will probably be more efficient, but this is not a requirement." msgstr "" #. Tag: title +#: query_sql.xml:636 #, no-c-format msgid "Custom SQL for create, update and delete" msgstr "" #. Tag: para +#: query_sql.xml:638 #, no-c-format -msgid "Hibernate3 can use custom SQL for create, update, and delete operations. The SQL can be overridden at the statement level or inidividual column level. This section describes statement overrides. For columns, see ." -msgstr "" - -#. Tag: para -#, no-c-format -msgid "The class and collection persisters in Hibernate already contain a set of configuration time generated strings (insertsql, deletesql, updatesql etc.). The mapping tags <sql-insert>, <sql-delete>, and <sql-update> override these strings:" -msgstr "" - -#. Tag: para -#, no-c-format -msgid "The SQL is directly executed in your database, so you can use any dialect you like. This will reduce the portability of your mapping if you use database specific SQL." -msgstr "" - -#. Tag: para -#, no-c-format -msgid "Stored procedures are supported if the callable attribute is set:" -msgstr "" - -#. Tag: para -#, no-c-format -msgid "The order of the positional parameters is vital, as they must be in the same sequence as Hibernate expects them." -msgstr "" - -#. Tag: para -#, no-c-format -msgid "You can view the expected order by enabling debug logging for the org.hibernate.persister.entity level. With this level enabled, Hibernate will print out the static SQL that is used to create, update, delete etc. entities. To view the expected sequence, do not include your custom SQL in the mapping files, as this will override the Hibernate generated static SQL." -msgstr "" - -#. Tag: para -#, no-c-format -msgid "The stored procedures are in most cases required to return the number of rows inserted, updated and deleted, as Hibernate has some runtime checks for the success of the statement. Hibernate always registers the first statement parameter as a numeric output parameter for the CUD operations:" +msgid "Hibernate3 can use custom SQL for create, update, and delete operations. The SQL can be overridden at the statement level or inidividual column level. This section describes statement overrides. For columns, see . shows how to define custom SQL operatons using annotations." msgstr "" #. Tag: title +#: query_sql.xml:646 +#, no-c-format +msgid "Custom CRUD via annotations" +msgstr "" + +#. Tag: programlisting +#: query_sql.xml:648 +#, no-c-format +msgid "" + "@Entity\n" + "@Table(name=\"CHAOS\")\n" + "@SQLInsert( sql=\"INSERT INTO CHAOS(size, name, nickname, id) VALUES(?,upper(?),?,?)\")\n" + "@SQLUpdate( sql=\"UPDATE CHAOS SET size = ?, name = upper(?), nickname = ? WHERE id = ?\")\n" + "@SQLDelete( sql=\"DELETE CHAOS WHERE id = ?\")\n" + "@SQLDeleteAll( sql=\"DELETE CHAOS\")\n" + "@Loader(namedQuery = \"chaos\")\n" + "@NamedNativeQuery(name=\"chaos\", query=\"select id, size, name, lower( nickname ) as nickname from CHAOS where id= ?\", resultClass = Chaos.class)\n" + "public class Chaos {\n" + " @Id\n" + " private Long id;\n" + " private Long size;\n" + " private String name;\n" + " private String nickname;" +msgstr "" + +#. Tag: para +#: query_sql.xml:651 +#, no-c-format +msgid "@SQLInsert, @SQLUpdate, @SQLDelete, @SQLDeleteAll respectively override the INSERT, UPDATE, DELETE, and DELETE all statement. The same can be achieved using Hibernate mapping files and the <sql-insert>, <sql-update> and <sql-delete> nodes. This can be seen in ." +msgstr "" + +#. Tag: title +#: query_sql.xml:661 +#, no-c-format +msgid "Custom CRUD XML" +msgstr "" + +#. Tag: programlisting +#: query_sql.xml:663 +#, no-c-format +msgid "" + "<class name=\"Person\">\n" + " <id name=\"id\">\n" + " <generator class=\"increment\"/>\n" + " </id>\n" + " <property name=\"name\" not-null=\"true\"/>\n" + " <sql-insert>INSERT INTO PERSON (NAME, ID) VALUES ( UPPER(?), ? )</sql-insert>\n" + " <sql-update>UPDATE PERSON SET NAME=UPPER(?) WHERE ID=?</sql-update>\n" + " <sql-delete>DELETE FROM PERSON WHERE ID=?</sql-delete>\n" + "</class>" +msgstr "" + +#. Tag: para +#: query_sql.xml:666 +#, no-c-format +msgid "If you expect to call a store procedure, be sure to set the callable attribute to true. In annotations as well as in xml." +msgstr "" + +#. Tag: para +#: query_sql.xml:670 +#, no-c-format +msgid "To check that the execution happens correctly, Hibernate allows you to define one of those three strategies:" +msgstr "" + +#. Tag: para +#: query_sql.xml:675 +#, no-c-format +msgid "none: no check is performed: the store procedure is expected to fail upon issues" +msgstr "" + +#. Tag: para +#: query_sql.xml:680 +#, no-c-format +msgid "count: use of rowcount to check that the update is successful" +msgstr "" + +#. Tag: para +#: query_sql.xml:685 +#, no-c-format +msgid "param: like COUNT but using an output parameter rather that the standard mechanism" +msgstr "" + +#. Tag: para +#: query_sql.xml:690 +#, no-c-format +msgid "To define the result check style, use the check parameter which is again available in annoations as well as in xml." +msgstr "" + +#. Tag: para +#: query_sql.xml:693 +#, no-c-format +msgid "You can use the exact same set of annotations respectively xml nodes to override the collection related statements -see ." +msgstr "" + +#. Tag: title +#: query_sql.xml:698 +#, no-c-format +msgid "Overriding SQL statements for collections using annotations" +msgstr "" + +#. Tag: programlisting +#: query_sql.xml:701 +#, no-c-format +msgid "" + "@OneToMany\n" + "@JoinColumn(name=\"chaos_fk\")\n" + "@SQLInsert( sql=\"UPDATE CASIMIR_PARTICULE SET chaos_fk = ? where id = ?\")\n" + "@SQLDelete( sql=\"UPDATE CASIMIR_PARTICULE SET chaos_fk = null where id = ?\")\n" + "private Set<CasimirParticle> particles = new HashSet<CasimirParticle>();" +msgstr "" + +#. Tag: para +#: query_sql.xml:705 +#, no-c-format +msgid "The parameter order is important and is defined by the order Hibernate handles properties. You can see the expected order by enabling debug logging for the org.hibernate.persister.entity level. With this level enabled Hibernate will print out the static SQL that is used to create, update, delete etc. entities. (To see the expected sequence, remember to not include your custom SQL through annotations or mapping files as that will override the Hibernate generated static sql)" +msgstr "" + +#. Tag: para +#: query_sql.xml:715 +#, no-c-format +msgid "Overriding SQL statements for secondary tables is also possible using @org.hibernate.annotations.Table and either (or all) attributes sqlInsert, sqlUpdate, sqlDelete:" +msgstr "" + +#. Tag: title +#: query_sql.xml:721 +#, no-c-format +msgid "Overriding SQL statements for secondary tables" +msgstr "" + +#. Tag: programlisting +#: query_sql.xml:723 +#, no-c-format +msgid "" + "@Entity\n" + "@SecondaryTables({\n" + " @SecondaryTable(name = \"`Cat nbr1`\"),\n" + " @SecondaryTable(name = \"Cat2\"})\n" + "@org.hibernate.annotations.Tables( {\n" + " @Table(appliesTo = \"Cat\", comment = \"My cat table\" ),\n" + " @Table(appliesTo = \"Cat2\", foreignKey = @ForeignKey(name=\"FK_CAT2_CAT\"), fetch = FetchMode.SELECT,\n" + " sqlInsert=@SQLInsert(sql=\"insert into Cat2(storyPart2, id) values(upper(?), ?)\") )\n" + "} )\n" + "public class Cat implements Serializable {" +msgstr "" + +#. Tag: para +#: query_sql.xml:726 +#, no-c-format +msgid "The previous example also shows that you can give a comment to a given table (primary or secondary): This comment will be used for DDL generation." +msgstr "" + +#. Tag: para +#: query_sql.xml:731 +#, no-c-format +msgid "The SQL is directly executed in your database, so you can use any dialect you like. This will, however, reduce the portability of your mapping if you use database specific SQL." +msgstr "" + +#. Tag: para +#: query_sql.xml:736 +#, no-c-format +msgid "Last but not least, stored procedures are in most cases required to return the number of rows inserted, updated and deleted. Hibernate always registers the first statement parameter as a numeric output parameter for the CUD operations:" +msgstr "" + +#. Tag: title +#: query_sql.xml:742 +#, no-c-format +msgid "Stored procedures and their return value" +msgstr "" + +#. Tag: programlisting +#: query_sql.xml:744 +#, no-c-format +msgid "" + "CREATE OR REPLACE FUNCTION updatePerson (uid IN NUMBER, uname IN VARCHAR2)\n" + " RETURN NUMBER IS\n" + "BEGIN\n" + "\n" + " update PERSON\n" + " set\n" + " NAME = uname,\n" + " where\n" + " ID = uid;\n" + "\n" + " return SQL%ROWCOUNT;\n" + "\n" + "END updatePerson;" +msgstr "" + +#. Tag: title +#: query_sql.xml:749 #, no-c-format msgid "Custom SQL for loading" msgstr "" #. Tag: para +#: query_sql.xml:751 #, no-c-format -msgid "You can also declare your own SQL (or HQL) queries for entity loading. As with inserts, updates, and deletes, this can be done at the individual column level as described in or at the statement level. Here is an example of a statement level override:" +msgid "You can also declare your own SQL (or HQL) queries for entity loading. As with inserts, updates, and deletes, this can be done at the individual column level as described in or at the statement level. Here is an example of a statement level override:" +msgstr "" + +#. Tag: programlisting +#: query_sql.xml:757 +#, no-c-format +msgid "" + "<sql-query name=\"person\">\n" + " <return alias=\"pers\" class=\"Person\" lock-mode=\"upgrade\"/>\n" + " SELECT NAME AS {pers.name}, ID AS {pers.id}\n" + " FROM PERSON\n" + " WHERE ID=?\n" + " FOR UPDATE\n" + "</sql-query>" msgstr "" #. Tag: para +#: query_sql.xml:759 #, no-c-format msgid "This is just a named query declaration, as discussed earlier. You can reference this named query in a class mapping:" msgstr "" +#. Tag: programlisting +#: query_sql.xml:762 +#, no-c-format +msgid "" + "<class name=\"Person\">\n" + " <id name=\"id\">\n" + " <generator class=\"increment\"/>\n" + " </id>\n" + " <property name=\"name\" not-null=\"true\"/>\n" + " <loader query-ref=\"person\"/>\n" + "</class>" +msgstr "" + #. Tag: para +#: query_sql.xml:764 #, no-c-format msgid "This even works with stored procedures." msgstr "" #. Tag: para +#: query_sql.xml:766 #, no-c-format msgid "You can even define a query for collection loading:" msgstr "" +#. Tag: programlisting +#: query_sql.xml:768 +#, no-c-format +msgid "" + "<set name=\"employments\" inverse=\"true\">\n" + " <key/>\n" + " <one-to-many class=\"Employment\"/>\n" + " <loader query-ref=\"employments\"/>\n" + "</set>" +msgstr "" + +#. Tag: programlisting +#: query_sql.xml:770 +#, no-c-format +msgid "" + "<sql-query name=\"employments\">\n" + " <load-collection alias=\"emp\" role=\"Person.employments\"/>\n" + " SELECT {emp.*}\n" + " FROM EMPLOYMENT emp\n" + " WHERE EMPLOYER = :id\n" + " ORDER BY STARTDATE ASC, EMPLOYEE ASC\n" + "</sql-query>" +msgstr "" + #. Tag: para +#: query_sql.xml:772 #, no-c-format msgid "You can also define an entity loader that loads a collection by join fetching:" msgstr "" +#. Tag: programlisting +#: query_sql.xml:775 +#, no-c-format +msgid "" + "<sql-query name=\"person\">\n" + " <return alias=\"pers\" class=\"Person\"/>\n" + " <return-join alias=\"emp\" property=\"pers.employments\"/>\n" + " SELECT NAME AS {pers.*}, {emp.*}\n" + " FROM PERSON pers\n" + " LEFT OUTER JOIN EMPLOYMENT emp\n" + " ON pers.ID = emp.PERSON_ID\n" + " WHERE ID=?\n" + "</sql-query>" +msgstr "" + +#. Tag: para +#: query_sql.xml:777 +#, no-c-format +msgid "The annotation equivalent <loader> is the @Loader annotation as seen in ." +msgstr "" + diff --git a/documentation/manual/src/main/docbook/pot/content/session_api.pot b/documentation/manual/src/main/docbook/pot/content/session_api.pot index 342212f0cf..a0badd3648 100644 --- a/documentation/manual/src/main/docbook/pot/content/session_api.pot +++ b/documentation/manual/src/main/docbook/pot/content/session_api.pot @@ -1,759 +1,1477 @@ -# -# AUTHOR , YEAR. +# SOME DESCRIPTIVE TITLE. +# FIRST AUTHOR , YEAR. # +#, fuzzy msgid "" msgstr "" -"Project-Id-Version: 0\n" -"POT-Creation-Date: 2010-02-11T05:38:15\n" -"PO-Revision-Date: 2010-02-11T05:38:15\n" -"Last-Translator: Automatically generated\n" -"Language-Team: None\n" +"Project-Id-Version: PACKAGE VERSION\n" +"Report-Msgid-Bugs-To: http://bugs.kde.org\n" +"POT-Creation-Date: 2010-07-20 21:02+0000\n" +"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" +"Last-Translator: FULL NAME \n" +"Language-Team: LANGUAGE \n" "MIME-Version: 1.0\n" -"Content-Type: application/x-publican; charset=UTF-8\n" +"Content-Type: application/x-xml2pot; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" #. Tag: title +#: session_api.xml:31 #, no-c-format msgid "Working with objects" msgstr "" #. Tag: para +#: session_api.xml:33 #, no-c-format msgid "Hibernate is a full object/relational mapping solution that not only shields the developer from the details of the underlying database management system, but also offers state management of objects. This is, contrary to the management of SQL statements in common JDBC/SQL persistence layers, a natural object-oriented view of persistence in Java applications." msgstr "" #. Tag: para +#: session_api.xml:40 #, no-c-format msgid "In other words, Hibernate application developers should always think about the state of their objects, and not necessarily about the execution of SQL statements. This part is taken care of by Hibernate and is only relevant for the application developer when tuning the performance of the system." msgstr "" #. Tag: title +#: session_api.xml:47 #, no-c-format msgid "Hibernate object states" msgstr "" #. Tag: para +#: session_api.xml:49 #, no-c-format msgid "Hibernate defines and supports the following object states:" msgstr "" #. Tag: para +#: session_api.xml:53 #, no-c-format msgid "Transient - an object is transient if it has just been instantiated using the new operator, and it is not associated with a Hibernate Session. It has no persistent representation in the database and no identifier value has been assigned. Transient instances will be destroyed by the garbage collector if the application does not hold a reference anymore. Use the Hibernate Session to make an object persistent (and let Hibernate take care of the SQL statements that need to be executed for this transition)." msgstr "" #. Tag: para +#: session_api.xml:65 #, no-c-format msgid "Persistent - a persistent instance has a representation in the database and an identifier value. It might just have been saved or loaded, however, it is by definition in the scope of a Session. Hibernate will detect any changes made to an object in persistent state and synchronize the state with the database when the unit of work completes. Developers do not execute manual UPDATE statements, or DELETE statements when an object should be made transient." msgstr "" #. Tag: para +#: session_api.xml:77 #, no-c-format msgid "Detached - a detached instance is an object that has been persistent, but its Session has been closed. The reference to the object is still valid, of course, and the detached instance might even be modified in this state. A detached instance can be reattached to a new Session at a later point in time, making it (and all the modifications) persistent again. This feature enables a programming model for long running units of work that require user think-time. We call them application transactions, i.e., a unit of work from the point of view of the user." msgstr "" #. Tag: para +#: session_api.xml:90 #, no-c-format msgid "We will now discuss the states and state transitions (and the Hibernate methods that trigger a transition) in more detail." msgstr "" #. Tag: title +#: session_api.xml:95 #, no-c-format msgid "Making objects persistent" msgstr "" #. Tag: para +#: session_api.xml:97 #, no-c-format -msgid "Newly instantiated instances of a a persistent class are considered transient by Hibernate. We can make a transient instance persistent by associating it with a session:" +msgid "Newly instantiated instances of a persistent class are considered transient by Hibernate. We can make a transient instance persistent by associating it with a session:" +msgstr "" + +#. Tag: programlisting +#: session_api.xml:102 +#, no-c-format +msgid "" + "DomesticCat fritz = new DomesticCat();\n" + "fritz.setColor(Color.GINGER);\n" + "fritz.setSex('M');\n" + "fritz.setName(\"Fritz\");\n" + "Long generatedId = (Long) sess.save(fritz);" msgstr "" #. Tag: para +#: session_api.xml:104 #, no-c-format msgid "If Cat has a generated identifier, the identifier is generated and assigned to the cat when save() is called. If Cat has an assigned identifier, or a composite key, the identifier should be assigned to the cat instance before calling save(). You can also use persist() instead of save(), with the semantics defined in the EJB3 early draft." msgstr "" #. Tag: para +#: session_api.xml:115 #, no-c-format msgid "persist() makes a transient instance persistent. However, it does not guarantee that the identifier value will be assigned to the persistent instance immediately, the assignment might happen at flush time. persist() also guarantees that it will not execute an INSERT statement if it is called outside of transaction boundaries. This is useful in long-running conversations with an extended Session/persistence context." msgstr "" #. Tag: para +#: session_api.xml:126 #, no-c-format msgid "save() does guarantee to return an identifier. If an INSERT has to be executed to get the identifier ( e.g. \"identity\" generator, not \"sequence\"), this INSERT happens immediately, no matter if you are inside or outside of a transaction. This is problematic in a long-running conversation with an extended Session/persistence context." msgstr "" #. Tag: para +#: session_api.xml:135 #, no-c-format msgid "Alternatively, you can assign the identifier using an overloaded version of save()." msgstr "" +#. Tag: programlisting +#: session_api.xml:138 +#, no-c-format +msgid "" + "DomesticCat pk = new DomesticCat();\n" + "pk.setColor(Color.TABBY);\n" + "pk.setSex('F');\n" + "pk.setName(\"PK\");\n" + "pk.setKittens( new HashSet() );\n" + "pk.addKitten(fritz);\n" + "sess.save( pk, new Long(1234) );" +msgstr "" + #. Tag: para +#: session_api.xml:140 #, no-c-format msgid "If the object you make persistent has associated objects (e.g. the kittens collection in the previous example), these objects can be made persistent in any order you like unless you have a NOT NULL constraint upon a foreign key column. There is never a risk of violating foreign key constraints. However, you might violate a NOT NULL constraint if you save() the objects in the wrong order." msgstr "" #. Tag: para +#: session_api.xml:148 #, no-c-format msgid "Usually you do not bother with this detail, as you will normally use Hibernate's transitive persistence feature to save the associated objects automatically. Then, even NOT NULL constraint violations do not occur - Hibernate will take care of everything. Transitive persistence is discussed later in this chapter." msgstr "" #. Tag: title +#: session_api.xml:157 #, no-c-format msgid "Loading an object" msgstr "" #. Tag: para +#: session_api.xml:159 #, no-c-format msgid "The load() methods of Session provide a way of retrieving a persistent instance if you know its identifier. load() takes a class object and loads the state into a newly instantiated instance of that class in a persistent state." msgstr "" +#. Tag: programlisting +#: session_api.xml:165 +#, no-c-format +msgid "Cat fritz = (Cat) sess.load(Cat.class, generatedId);" +msgstr "" + +#. Tag: programlisting +#: session_api.xml:167 +#, no-c-format +msgid "" + "// you need to wrap primitive identifiers\n" + "long id = 1234;\n" + "DomesticCat pk = (DomesticCat) sess.load( DomesticCat.class, new Long(id) );" +msgstr "" + #. Tag: para +#: session_api.xml:169 #, no-c-format msgid "Alternatively, you can load state into a given instance:" msgstr "" +#. Tag: programlisting +#: session_api.xml:171 +#, no-c-format +msgid "" + "Cat cat = new DomesticCat();\n" + "// load pk's state into cat\n" + "sess.load( cat, new Long(pkId) );\n" + "Set kittens = cat.getKittens();" +msgstr "" + #. Tag: para +#: session_api.xml:173 #, no-c-format msgid "Be aware that load() will throw an unrecoverable exception if there is no matching database row. If the class is mapped with a proxy, load() just returns an uninitialized proxy and does not actually hit the database until you invoke a method of the proxy. This is useful if you wish to create an association to an object without actually loading it from the database. It also allows multiple instances to be loaded as a batch if batch-size is defined for the class mapping." msgstr "" #. Tag: para +#: session_api.xml:182 #, no-c-format msgid "If you are not certain that a matching row exists, you should use the get() method which hits the database immediately and returns null if there is no matching row." msgstr "" +#. Tag: programlisting +#: session_api.xml:186 +#, no-c-format +msgid "" + "Cat cat = (Cat) sess.get(Cat.class, id);\n" + "if (cat==null) {\n" + " cat = new Cat();\n" + " sess.save(cat, id);\n" + "}\n" + "return cat;" +msgstr "" + #. Tag: para +#: session_api.xml:188 #, no-c-format msgid "You can even load an object using an SQL SELECT ... FOR UPDATE, using a LockMode. See the API documentation for more information." msgstr "" +#. Tag: programlisting +#: session_api.xml:192 +#, no-c-format +msgid "Cat cat = (Cat) sess.get(Cat.class, id, LockMode.UPGRADE);" +msgstr "" + #. Tag: para +#: session_api.xml:194 #, no-c-format msgid "Any associated instances or contained collections will not be selected FOR UPDATE, unless you decide to specify lock or all as a cascade style for the association." msgstr "" #. Tag: para +#: session_api.xml:199 #, no-c-format msgid "It is possible to re-load an object and all its collections at any time, using the refresh() method. This is useful when database triggers are used to initialize some of the properties of the object." msgstr "" -#. Tag: para +#. Tag: programlisting +#: session_api.xml:204 #, no-c-format -msgid "How much does Hibernate load from the database and how many SQL SELECTs will it use? This depends on the fetching strategy. This is explained in ." +msgid "" + "sess.save(cat);\n" + "sess.flush(); //force the SQL INSERT\n" + "sess.refresh(cat); //re-read the state (after the trigger executes)" +msgstr "" + +#. Tag: para +#: session_api.xml:206 +#, no-c-format +msgid "How much does Hibernate load from the database and how many SQL SELECTs will it use? This depends on the fetching strategy. This is explained in ." msgstr "" #. Tag: title +#: session_api.xml:213 #, no-c-format msgid "Querying" msgstr "" #. Tag: para +#: session_api.xml:215 #, no-c-format msgid "If you do not know the identifiers of the objects you are looking for, you need a query. Hibernate supports an easy-to-use but powerful object oriented query language (HQL). For programmatic query creation, Hibernate supports a sophisticated Criteria and Example query feature (QBC and QBE). You can also express your query in the native SQL of your database, with optional support from Hibernate for result set conversion into objects." msgstr "" #. Tag: title +#: session_api.xml:224 #, no-c-format msgid "Executing queries" msgstr "" #. Tag: para +#: session_api.xml:226 #, no-c-format msgid "HQL and native SQL queries are represented with an instance of org.hibernate.Query. This interface offers methods for parameter binding, result set handling, and for the execution of the actual query. You always obtain a Query using the current Session:" msgstr "" +#. Tag: programlisting +#: session_api.xml:232 +#, no-c-format +msgid "" + "List cats = session.createQuery(\n" + " \"from Cat as cat where cat.birthdate < ?\")\n" + " .setDate(0, date)\n" + " .list();\n" + "\n" + "List mothers = session.createQuery(\n" + " \"select mother from Cat as cat join cat.mother as mother where cat.name = ?\")\n" + " .setString(0, name)\n" + " .list();\n" + "\n" + "List kittens = session.createQuery(\n" + " \"from Cat as cat where cat.mother = ?\")\n" + " .setEntity(0, pk)\n" + " .list();\n" + "\n" + "Cat mother = (Cat) session.createQuery(\n" + " \"select cat.mother from Cat as cat where cat = ?\")\n" + " .setEntity(0, izi)\n" + " .uniqueResult();]]\n" + "\n" + "Query mothersWithKittens = (Cat) session.createQuery(\n" + " \"select mother from Cat as mother left join fetch mother.kittens\");\n" + "Set uniqueMothers = new HashSet(mothersWithKittens.list());" +msgstr "" + #. Tag: para +#: session_api.xml:234 #, no-c-format msgid "A query is usually executed by invoking list(). The result of the query will be loaded completely into a collection in memory. Entity instances retrieved by a query are in a persistent state. The uniqueResult() method offers a shortcut if you know your query will only return a single object. Queries that make use of eager fetching of collections usually return duplicates of the root objects, but with their collections initialized. You can filter these duplicates through a Set." msgstr "" #. Tag: title +#: session_api.xml:244 #, no-c-format msgid "Iterating results" msgstr "" #. Tag: para +#: session_api.xml:246 #, no-c-format msgid "Occasionally, you might be able to achieve better performance by executing the query using the iterate() method. This will usually be the case if you expect that the actual entity instances returned by the query will already be in the session or second-level cache. If they are not already cached, iterate() will be slower than list() and might require many database hits for a simple query, usually 1 for the initial select which only returns identifiers, and n additional selects to initialize the actual instances." msgstr "" +#. Tag: programlisting +#: session_api.xml:257 +#, no-c-format +msgid "" + "// fetch ids\n" + "Iterator iter = sess.createQuery(\"from eg.Qux q order by q.likeliness\").iterate();\n" + "while ( iter.hasNext() ) {\n" + " Qux qux = (Qux) iter.next(); // fetch the object\n" + " // something we couldnt express in the query\n" + " if ( qux.calculateComplicatedAlgorithm() ) {\n" + " // delete the current instance\n" + " iter.remove();\n" + " // dont need to process the rest\n" + " break;\n" + " }\n" + "}" +msgstr "" + #. Tag: title +#: session_api.xml:261 #, no-c-format msgid "Queries that return tuples" msgstr "" #. Tag: para +#: session_api.xml:263 #, no-c-format msgid "Hibernate queries sometimes return tuples of objects. Each tuple is returned as an array:" msgstr "" +#. Tag: programlisting +#: session_api.xml:266 +#, no-c-format +msgid "" + "Iterator kittensAndMothers = sess.createQuery(\n" + " \"select kitten, mother from Cat kitten join kitten.mother mother\")\n" + " .list()\n" + " .iterator();\n" + "\n" + "while ( kittensAndMothers.hasNext() ) {\n" + " Object[] tuple = (Object[]) kittensAndMothers.next();\n" + " Cat kitten = (Cat) tuple[0];\n" + " Cat mother = (Cat) tuple[1];\n" + " ....\n" + "}" +msgstr "" + #. Tag: title +#: session_api.xml:270 #, no-c-format msgid "Scalar results" msgstr "" #. Tag: para +#: session_api.xml:272 #, no-c-format msgid "Queries can specify a property of a class in the select clause. They can even call SQL aggregate functions. Properties or aggregates are considered \"scalar\" results and not entities in persistent state." msgstr "" +#. Tag: programlisting +#: session_api.xml:277 +#, no-c-format +msgid "" + "Iterator results = sess.createQuery(\n" + " \"select cat.color, min(cat.birthdate), count(cat) from Cat cat \" +\n" + " \"group by cat.color\")\n" + " .list()\n" + " .iterator();\n" + "\n" + "while ( results.hasNext() ) {\n" + " Object[] row = (Object[]) results.next();\n" + " Color type = (Color) row[0];\n" + " Date oldest = (Date) row[1];\n" + " Integer count = (Integer) row[2];\n" + " .....\n" + "}" +msgstr "" + #. Tag: title +#: session_api.xml:281 #, no-c-format msgid "Bind parameters" msgstr "" #. Tag: para +#: session_api.xml:283 #, no-c-format msgid "Methods on Query are provided for binding values to named parameters or JDBC-style ? parameters. Contrary to JDBC, Hibernate numbers parameters from zero. Named parameters are identifiers of the form :name in the query string. The advantages of named parameters are as follows:" msgstr "" #. Tag: para +#: session_api.xml:292 #, no-c-format msgid "named parameters are insensitive to the order they occur in the query string" msgstr "" #. Tag: para +#: session_api.xml:297 #, no-c-format msgid "they can occur multiple times in the same query" msgstr "" #. Tag: para +#: session_api.xml:301 #, no-c-format msgid "they are self-documenting" msgstr "" +#. Tag: programlisting +#: session_api.xml:305 +#, no-c-format +msgid "" + "//named parameter (preferred)\n" + "Query q = sess.createQuery(\"from DomesticCat cat where cat.name = :name\");\n" + "q.setString(\"name\", \"Fritz\");\n" + "Iterator cats = q.iterate();" +msgstr "" + +#. Tag: programlisting +#: session_api.xml:307 +#, no-c-format +msgid "" + "//positional parameter\n" + "Query q = sess.createQuery(\"from DomesticCat cat where cat.name = ?\");\n" + "q.setString(0, \"Izi\");\n" + "Iterator cats = q.iterate();" +msgstr "" + +#. Tag: programlisting +#: session_api.xml:309 +#, no-c-format +msgid "" + "//named parameter list\n" + "List names = new ArrayList();\n" + "names.add(\"Izi\");\n" + "names.add(\"Fritz\");\n" + "Query q = sess.createQuery(\"from DomesticCat cat where cat.name in (:namesList)\");\n" + "q.setParameterList(\"namesList\", names);\n" + "List cats = q.list();" +msgstr "" + #. Tag: title +#: session_api.xml:313 #, no-c-format msgid "Pagination" msgstr "" #. Tag: para +#: session_api.xml:315 #, no-c-format msgid "If you need to specify bounds upon your result set, that is, the maximum number of rows you want to retrieve and/or the first row you want to retrieve, you can use methods of the Query interface:" msgstr "" +#. Tag: programlisting +#: session_api.xml:320 +#, no-c-format +msgid "" + "Query q = sess.createQuery(\"from DomesticCat cat\");\n" + "q.setFirstResult(20);\n" + "q.setMaxResults(10);\n" + "List cats = q.list();" +msgstr "" + #. Tag: para +#: session_api.xml:322 #, no-c-format msgid "Hibernate knows how to translate this limit query into the native SQL of your DBMS." msgstr "" #. Tag: title +#: session_api.xml:327 #, no-c-format msgid "Scrollable iteration" msgstr "" #. Tag: para +#: session_api.xml:329 #, no-c-format msgid "If your JDBC driver supports scrollable ResultSets, the Query interface can be used to obtain a ScrollableResults object that allows flexible navigation of the query results." msgstr "" +#. Tag: programlisting +#: session_api.xml:334 +#, no-c-format +msgid "" + "Query q = sess.createQuery(\"select cat.name, cat from DomesticCat cat \" +\n" + " \"order by cat.name\");\n" + "ScrollableResults cats = q.scroll();\n" + "if ( cats.first() ) {\n" + "\n" + " // find the first name on each page of an alphabetical list of cats by name\n" + " firstNamesOfPages = new ArrayList();\n" + " do {\n" + " String name = cats.getString(0);\n" + " firstNamesOfPages.add(name);\n" + " }\n" + " while ( cats.scroll(PAGE_SIZE) );\n" + "\n" + " // Now get the first page of cats\n" + " pageOfCats = new ArrayList();\n" + " cats.beforeFirst();\n" + " int i=0;\n" + " while( ( PAGE_SIZE > i++ ) && cats.next() ) pageOfCats.add( cats.get(1) );\n" + "\n" + "}\n" + "cats.close()" +msgstr "" + #. Tag: para +#: session_api.xml:336 #, no-c-format msgid "Note that an open database connection and cursor is required for this functionality. Use setMaxResult()/setFirstResult() if you need offline pagination functionality." msgstr "" #. Tag: title +#: session_api.xml:343 #, no-c-format msgid "Externalizing named queries" msgstr "" #. Tag: para +#: session_api.xml:345 #, no-c-format -msgid "You can also define named queries in the mapping document. Remember to use a CDATA section if your query contains characters that could be interpreted as markup." +msgid "Queries can also be configured as so called named queries using annotations or Hibernate mapping documents. @NamedQuery and @NamedQueries can be defined at the class level as seen in . However their definitions are global to the session factory/entity manager factory scope. A named query is defined by its name and the actual query string." +msgstr "" + +#. Tag: title +#: session_api.xml:355 +#, no-c-format +msgid "Defining a named query using @NamedQuery" +msgstr "" + +#. Tag: programlisting +#: session_api.xml:358 +#, no-c-format +msgid "" + "@Entity\n" + "@NamedQuery(name=\"night.moreRecentThan\", query=\"select n from Night n where n.date >= :date\")\n" + "public class Night {\n" + " ...\n" + "}\n" + "\n" + "public class MyDao {\n" + " doStuff() {\n" + " Query q = s.getNamedQuery(\"night.moreRecentThan\");\n" + " q.setDate( \"date\", aMonthAgo );\n" + " List results = q.list();\n" + " ...\n" + " }\n" + " ...\n" + "}" msgstr "" #. Tag: para +#: session_api.xml:361 #, no-c-format -msgid "Parameter binding and executing is done programatically:" +msgid "Using a mapping document can be configured using the <query> node. Remember to use a CDATA section if your query contains characters that could be interpreted as markup." +msgstr "" + +#. Tag: title +#: session_api.xml:367 +#, no-c-format +msgid "Defining a named query using <query>" +msgstr "" + +#. Tag: programlisting +#: session_api.xml:370 +#, no-c-format +msgid "" + "<query name=\"ByNameAndMaximumWeight\"><![CDATA[\n" + " from eg.DomesticCat as cat\n" + " where cat.name = ?\n" + " and cat.weight > ?\n" + "] ]></query>" msgstr "" #. Tag: para +#: session_api.xml:373 +#, no-c-format +msgid "Parameter binding and executing is done programatically as seen in ." +msgstr "" + +#. Tag: title +#: session_api.xml:377 +#, no-c-format +msgid "Parameter binding of a named query" +msgstr "" + +#. Tag: programlisting +#: session_api.xml:379 +#, no-c-format +msgid "" + "Query q = sess.getNamedQuery(\"ByNameAndMaximumWeight\");\n" + "q.setString(0, name);\n" + "q.setInt(1, minWeight);\n" + "List cats = q.list();" +msgstr "" + +#. Tag: para +#: session_api.xml:382 #, no-c-format msgid "The actual program code is independent of the query language that is used. You can also define native SQL queries in metadata, or migrate existing queries to Hibernate by placing them in mapping files." msgstr "" #. Tag: para +#: session_api.xml:387 #, no-c-format msgid "Also note that a query declaration inside a <hibernate-mapping> element requires a global unique name for the query, while a query declaration inside a <class> element is made unique automatically by prepending the fully qualified name of the class. For example eg.Cat.ByNameAndMaximumWeight." msgstr "" #. Tag: title +#: session_api.xml:397 #, no-c-format msgid "Filtering collections" msgstr "" #. Tag: para +#: session_api.xml:399 #, no-c-format msgid "A collection filter is a special type of query that can be applied to a persistent collection or array. The query string can refer to this, meaning the current collection element." msgstr "" +#. Tag: programlisting +#: session_api.xml:404 +#, no-c-format +msgid "" + "Collection blackKittens = session.createFilter(\n" + " pk.getKittens(), \n" + " \"where this.color = ?\")\n" + " .setParameter( Color.BLACK, Hibernate.custom(ColorUserType.class) )\n" + " .list()\n" + ");" +msgstr "" + #. Tag: para +#: session_api.xml:406 #, no-c-format msgid "The returned collection is considered a bag that is a copy of the given collection. The original collection is not modified. This is contrary to the implication of the name \"filter\", but consistent with expected behavior." msgstr "" #. Tag: para +#: session_api.xml:411 #, no-c-format msgid "Observe that filters do not require a from clause, although they can have one if required. Filters are not limited to returning the collection elements themselves." msgstr "" +#. Tag: programlisting +#: session_api.xml:415 +#, no-c-format +msgid "" + "Collection blackKittenMates = session.createFilter(\n" + " pk.getKittens(), \n" + " \"select this.mate where this.color = eg.Color.BLACK.intValue\")\n" + " .list();" +msgstr "" + #. Tag: para +#: session_api.xml:417 #, no-c-format msgid "Even an empty filter query is useful, e.g. to load a subset of elements in a large collection:" msgstr "" +#. Tag: programlisting +#: session_api.xml:420 +#, no-c-format +msgid "" + "Collection tenKittens = session.createFilter(\n" + " mother.getKittens(), \"\")\n" + " .setFirstResult(0).setMaxResults(10)\n" + " .list();" +msgstr "" + #. Tag: title +#: session_api.xml:424 #, no-c-format msgid "Criteria queries" msgstr "" #. Tag: para +#: session_api.xml:426 #, no-c-format msgid "HQL is extremely powerful, but some developers prefer to build queries dynamically using an object-oriented API, rather than building query strings. Hibernate provides an intuitive Criteria query API for these cases:" msgstr "" -#. Tag: para +#. Tag: programlisting +#: session_api.xml:431 #, no-c-format -msgid "The Criteria and the associated Example API are discussed in more detail in ." +msgid "" + "Criteria crit = session.createCriteria(Cat.class);\n" + "crit.add( Restrictions.eq( \"color\", eg.Color.BLACK ) );\n" + "crit.setMaxResults(10);\n" + "List cats = crit.list();" +msgstr "" + +#. Tag: para +#: session_api.xml:433 +#, no-c-format +msgid "The Criteria and the associated Example API are discussed in more detail in ." msgstr "" #. Tag: title +#: session_api.xml:439 #, no-c-format msgid "Queries in native SQL" msgstr "" #. Tag: para +#: session_api.xml:441 #, no-c-format msgid "You can express a query in SQL, using createSQLQuery() and let Hibernate manage the mapping from result sets to objects. You can at any time call session.connection() and use the JDBC Connection directly. If you choose to use the Hibernate API, you must enclose SQL aliases in braces:" msgstr "" -#. Tag: para +#. Tag: programlisting +#: session_api.xml:448 #, no-c-format -msgid "SQL queries can contain named and positional parameters, just like Hibernate queries. More information about native SQL queries in Hibernate can be found in ." +msgid "" + "List cats = session.createSQLQuery(\"SELECT {cat.*} FROM CAT {cat} WHERE ROWNUM<10\")\n" + " .addEntity(\"cat\", Cat.class)\n" + ".list();" +msgstr "" + +#. Tag: programlisting +#: session_api.xml:450 +#, no-c-format +msgid "" + "List cats = session.createSQLQuery(\n" + " \"SELECT {cat}.ID AS {cat.id}, {cat}.SEX AS {cat.sex}, \" +\n" + " \"{cat}.MATE AS {cat.mate}, {cat}.SUBCLASS AS {cat.class}, ... \" +\n" + " \"FROM CAT {cat} WHERE ROWNUM<10\")\n" + " .addEntity(\"cat\", Cat.class)\n" + ".list()" +msgstr "" + +#. Tag: para +#: session_api.xml:452 +#, no-c-format +msgid "SQL queries can contain named and positional parameters, just like Hibernate queries. More information about native SQL queries in Hibernate can be found in ." msgstr "" #. Tag: title +#: session_api.xml:459 #, no-c-format msgid "Modifying persistent objects" msgstr "" #. Tag: para +#: session_api.xml:461 #, no-c-format msgid "Transactional persistent instances (i.e. objects loaded, saved, created or queried by the Session) can be manipulated by the application, and any changes to persistent state will be persisted when the Session is flushed. This is discussed later in this chapter. There is no need to call a particular method (like update(), which has a different purpose) to make your modifications persistent. The most straightforward way to update the state of an object is to load() it and then manipulate it directly while the Session is open:" msgstr "" +#. Tag: programlisting +#: session_api.xml:473 +#, no-c-format +msgid "" + "DomesticCat cat = (DomesticCat) sess.load( Cat.class, new Long(69) );\n" + "cat.setName(\"PK\");\n" + "sess.flush(); // changes to cat are automatically detected and persisted" +msgstr "" + #. Tag: para +#: session_api.xml:475 #, no-c-format msgid "Sometimes this programming model is inefficient, as it requires in the same session both an SQL SELECT to load an object and an SQL UPDATE to persist its updated state. Hibernate offers an alternate approach by using detached instances." msgstr "" #. Tag: para +#: session_api.xml:481 #, no-c-format -msgid "Hibernate does not offer its own API for direct execution of UPDATE or DELETE statements. Hibernate is a state management service, you do not have to think in statements to use it. JDBC is a perfect API for executing SQL statements, you can get a JDBC Connection at any time by calling session.connection(). Furthermore, the notion of mass operations conflicts with object/relational mapping for online transaction processing-oriented applications. Future versions of Hibernate can, however, provide special mass operation functions. See for some possible batch operation tricks." +msgid "Hibernate does not offer its own API for direct execution of UPDATE or DELETE statements. Hibernate is a state management service, you do not have to think in statements to use it. JDBC is a perfect API for executing SQL statements, you can get a JDBC Connection at any time by calling session.connection(). Furthermore, the notion of mass operations conflicts with object/relational mapping for online transaction processing-oriented applications. Future versions of Hibernate can, however, provide special mass operation functions. See for some possible batch operation tricks." msgstr "" #. Tag: title +#: session_api.xml:497 #, no-c-format msgid "Modifying detached objects" msgstr "" #. Tag: para +#: session_api.xml:499 #, no-c-format msgid "Many applications need to retrieve an object in one transaction, send it to the UI layer for manipulation, then save the changes in a new transaction. Applications that use this kind of approach in a high-concurrency environment usually use versioned data to ensure isolation for the \"long\" unit of work." msgstr "" #. Tag: para +#: session_api.xml:505 #, no-c-format msgid "Hibernate supports this model by providing for reattachment of detached instances using the Session.update() or Session.merge() methods:" msgstr "" +#. Tag: programlisting +#: session_api.xml:509 +#, no-c-format +msgid "" + "// in the first session\n" + "Cat cat = (Cat) firstSession.load(Cat.class, catId);\n" + "Cat potentialMate = new Cat();\n" + "firstSession.save(potentialMate);\n" + "\n" + "// in a higher layer of the application\n" + "cat.setMate(potentialMate);\n" + "\n" + "// later, in a new session\n" + "secondSession.update(cat); // update cat\n" + "secondSession.update(mate); // update mate" +msgstr "" + #. Tag: para +#: session_api.xml:511 #, no-c-format msgid "If the Cat with identifier catId had already been loaded by secondSession when the application tried to reattach it, an exception would have been thrown." msgstr "" #. Tag: para +#: session_api.xml:516 #, no-c-format msgid "Use update() if you are certain that the session does not contain an already persistent instance with the same identifier. Use merge() if you want to merge your modifications at any time without consideration of the state of the session. In other words, update() is usually the first method you would call in a fresh session, ensuring that the reattachment of your detached instances is the first operation that is executed." msgstr "" #. Tag: para +#: session_api.xml:524 #, no-c-format -msgid "The application should individually update() detached instances that are reachable from the given detached instance only if it wants their state to be updated. This can be automated using transitive persistence. See for more information." +msgid "The application should individually update() detached instances that are reachable from the given detached instance only if it wants their state to be updated. This can be automated using transitive persistence. See for more information." msgstr "" #. Tag: para +#: session_api.xml:530 #, no-c-format msgid "The lock() method also allows an application to reassociate an object with a new session. However, the detached instance has to be unmodified." msgstr "" +#. Tag: programlisting +#: session_api.xml:534 +#, no-c-format +msgid "" + "//just reassociate:\n" + "sess.lock(fritz, LockMode.NONE);\n" + "//do a version check, then reassociate:\n" + "sess.lock(izi, LockMode.READ);\n" + "//do a version check, using SELECT ... FOR UPDATE, then reassociate:\n" + "sess.lock(pk, LockMode.UPGRADE);" +msgstr "" + #. Tag: para +#: session_api.xml:536 #, no-c-format msgid "Note that lock() can be used with various LockModes. See the API documentation and the chapter on transaction handling for more information. Reattachment is not the only usecase for lock()." msgstr "" #. Tag: para +#: session_api.xml:541 #, no-c-format -msgid "Other models for long units of work are discussed in ." +msgid "Other models for long units of work are discussed in ." msgstr "" #. Tag: title +#: session_api.xml:546 #, no-c-format msgid "Automatic state detection" msgstr "" #. Tag: para +#: session_api.xml:548 #, no-c-format msgid "Hibernate users have requested a general purpose method that either saves a transient instance by generating a new identifier or updates/reattaches the detached instances associated with its current identifier. The saveOrUpdate() method implements this functionality." msgstr "" +#. Tag: programlisting +#: session_api.xml:554 +#, no-c-format +msgid "" + "// in the first session\n" + "Cat cat = (Cat) firstSession.load(Cat.class, catID);\n" + "\n" + "// in a higher tier of the application\n" + "Cat mate = new Cat();\n" + "cat.setMate(mate);\n" + "\n" + "// later, in a new session\n" + "secondSession.saveOrUpdate(cat); // update existing state (cat has a non-null id)\n" + "secondSession.saveOrUpdate(mate); // save the new instance (mate has a null id)" +msgstr "" + #. Tag: para +#: session_api.xml:556 #, no-c-format msgid "The usage and semantics of saveOrUpdate() seems to be confusing for new users. Firstly, so long as you are not trying to use instances from one session in another new session, you should not need to use update(), saveOrUpdate(), or merge(). Some whole applications will never use either of these methods." msgstr "" #. Tag: para +#: session_api.xml:563 #, no-c-format msgid "Usually update() or saveOrUpdate() are used in the following scenario:" msgstr "" #. Tag: para +#: session_api.xml:569 #, no-c-format msgid "the application loads an object in the first session" msgstr "" #. Tag: para +#: session_api.xml:573 #, no-c-format msgid "the object is passed up to the UI tier" msgstr "" #. Tag: para +#: session_api.xml:577 #, no-c-format msgid "some modifications are made to the object" msgstr "" #. Tag: para +#: session_api.xml:581 #, no-c-format msgid "the object is passed back down to the business logic tier" msgstr "" #. Tag: para +#: session_api.xml:585 #, no-c-format msgid "the application persists these modifications by calling update() in a second session" msgstr "" #. Tag: para +#: session_api.xml:590 #, no-c-format msgid "saveOrUpdate() does the following:" msgstr "" #. Tag: para +#: session_api.xml:594 #, no-c-format msgid "if the object is already persistent in this session, do nothing" msgstr "" #. Tag: para +#: session_api.xml:599 #, no-c-format msgid "if another object associated with the session has the same identifier, throw an exception" msgstr "" #. Tag: para +#: session_api.xml:604 #, no-c-format msgid "if the object has no identifier property, save() it" msgstr "" #. Tag: para +#: session_api.xml:609 #, no-c-format msgid "if the object's identifier has the value assigned to a newly instantiated object, save() it" msgstr "" #. Tag: para +#: session_api.xml:614 #, no-c-format msgid "if the object is versioned by a <version> or <timestamp>, and the version property value is the same value assigned to a newly instantiated object, save() it" msgstr "" #. Tag: para +#: session_api.xml:622 #, no-c-format msgid "otherwise update() the object" msgstr "" #. Tag: para +#: session_api.xml:626 #, no-c-format msgid "and merge() is very different:" msgstr "" #. Tag: para +#: session_api.xml:630 #, no-c-format msgid "if there is a persistent instance with the same identifier currently associated with the session, copy the state of the given object onto the persistent instance" msgstr "" #. Tag: para +#: session_api.xml:636 #, no-c-format msgid "if there is no persistent instance currently associated with the session, try to load it from the database, or create a new persistent instance" msgstr "" #. Tag: para +#: session_api.xml:642 #, no-c-format msgid "the persistent instance is returned" msgstr "" #. Tag: para +#: session_api.xml:646 #, no-c-format msgid "the given instance does not become associated with the session, it remains detached" msgstr "" #. Tag: title +#: session_api.xml:653 #, no-c-format msgid "Deleting persistent objects" msgstr "" #. Tag: para +#: session_api.xml:655 #, no-c-format msgid "Session.delete() will remove an object's state from the database. Your application, however, can still hold a reference to a deleted object. It is best to think of delete() as making a persistent instance, transient." msgstr "" +#. Tag: programlisting +#: session_api.xml:660 +#, no-c-format +msgid "sess.delete(cat);" +msgstr "" + #. Tag: para +#: session_api.xml:662 #, no-c-format msgid "You can delete objects in any order, without risk of foreign key constraint violations. It is still possible to violate a NOT NULL constraint on a foreign key column by deleting objects in the wrong order, e.g. if you delete the parent, but forget to delete the children." msgstr "" #. Tag: title +#: session_api.xml:670 #, no-c-format msgid "Replicating object between two different datastores" msgstr "" #. Tag: para +#: session_api.xml:672 #, no-c-format msgid "It is sometimes useful to be able to take a graph of persistent instances and make them persistent in a different datastore, without regenerating identifier values." msgstr "" +#. Tag: programlisting +#: session_api.xml:676 +#, no-c-format +msgid "" + "//retrieve a cat from one database\n" + "Session session1 = factory1.openSession();\n" + "Transaction tx1 = session1.beginTransaction();\n" + "Cat cat = session1.get(Cat.class, catId);\n" + "tx1.commit();\n" + "session1.close();\n" + "\n" + "//reconcile with a second database\n" + "Session session2 = factory2.openSession();\n" + "Transaction tx2 = session2.beginTransaction();\n" + "session2.replicate(cat, ReplicationMode.LATEST_VERSION);\n" + "tx2.commit();\n" + "session2.close();" +msgstr "" + #. Tag: para +#: session_api.xml:678 #, no-c-format msgid "The ReplicationMode determines how replicate() will deal with conflicts with existing rows in the database:" msgstr "" #. Tag: para +#: session_api.xml:684 #, no-c-format msgid "ReplicationMode.IGNORE: ignores the object when there is an existing database row with the same identifier" msgstr "" #. Tag: para +#: session_api.xml:689 #, no-c-format msgid "ReplicationMode.OVERWRITE: overwrites any existing database row with the same identifier" msgstr "" #. Tag: para +#: session_api.xml:694 #, no-c-format msgid "ReplicationMode.EXCEPTION: throws an exception if there is an existing database row with the same identifier" msgstr "" #. Tag: para +#: session_api.xml:700 #, no-c-format msgid "ReplicationMode.LATEST_VERSION: overwrites the row if its version number is earlier than the version number of the object, or ignore the object otherwise" msgstr "" #. Tag: para +#: session_api.xml:706 #, no-c-format msgid "Usecases for this feature include reconciling data entered into different database instances, upgrading system configuration information during product upgrades, rolling back changes made during non-ACID transactions and more." msgstr "" #. Tag: title +#: session_api.xml:713 #, no-c-format msgid "Flushing the Session" msgstr "" #. Tag: para +#: session_api.xml:715 #, no-c-format msgid "Sometimes the Session will execute the SQL statements needed to synchronize the JDBC connection's state with the state of objects held in memory. This process, called flush, occurs by default at the following points:" msgstr "" #. Tag: para +#: session_api.xml:723 #, no-c-format msgid "before some query executions" msgstr "" #. Tag: para +#: session_api.xml:727 #, no-c-format msgid "from org.hibernate.Transaction.commit()" msgstr "" #. Tag: para +#: session_api.xml:732 #, no-c-format msgid "from Session.flush()" msgstr "" #. Tag: para +#: session_api.xml:736 #, no-c-format msgid "The SQL statements are issued in the following order:" msgstr "" #. Tag: para +#: session_api.xml:740 #, no-c-format msgid "all entity insertions in the same order the corresponding objects were saved using Session.save()" msgstr "" #. Tag: para +#: session_api.xml:745 #, no-c-format msgid "all entity updates" msgstr "" #. Tag: para +#: session_api.xml:749 #, no-c-format msgid "all collection deletions" msgstr "" #. Tag: para +#: session_api.xml:753 #, no-c-format msgid "all collection element deletions, updates and insertions" msgstr "" #. Tag: para +#: session_api.xml:757 #, no-c-format msgid "all collection insertions" msgstr "" #. Tag: para +#: session_api.xml:761 #, no-c-format msgid "all entity deletions in the same order the corresponding objects were deleted using Session.delete()" msgstr "" #. Tag: para +#: session_api.xml:766 #, no-c-format msgid "An exception is that objects using native ID generation are inserted when they are saved." msgstr "" #. Tag: para +#: session_api.xml:769 #, no-c-format msgid "Except when you explicitly flush(), there are absolutely no guarantees about when the Session executes the JDBC calls, only the order in which they are executed. However, Hibernate does guarantee that the Query.list(..) will never return stale or incorrect data." msgstr "" #. Tag: para +#: session_api.xml:776 #, no-c-format -msgid "It is possible to change the default behavior so that flush occurs less frequently. The FlushMode class defines three different modes: only flush at commit time when the Hibernate Transaction API is used, flush automatically using the explained routine, or never flush unless flush() is called explicitly. The last mode is useful for long running units of work, where a Session is kept open and disconnected for a long time (see )." +msgid "It is possible to change the default behavior so that flush occurs less frequently. The FlushMode class defines three different modes: only flush at commit time when the Hibernate Transaction API is used, flush automatically using the explained routine, or never flush unless flush() is called explicitly. The last mode is useful for long running units of work, where a Session is kept open and disconnected for a long time (see )." +msgstr "" + +#. Tag: programlisting +#: session_api.xml:786 +#, no-c-format +msgid "" + "sess = sf.openSession();\n" + "Transaction tx = sess.beginTransaction();\n" + "sess.setFlushMode(FlushMode.COMMIT); // allow queries to return stale state\n" + "\n" + "Cat izi = (Cat) sess.load(Cat.class, id);\n" + "izi.setName(iznizi);\n" + "\n" + "// might return stale data\n" + "sess.find(\"from Cat as cat left outer join cat.kittens kitten\");\n" + "\n" + "// change to izi is not flushed!\n" + "...\n" + "tx.commit(); // flush occurs\n" + "sess.close();" msgstr "" #. Tag: para +#: session_api.xml:788 #, no-c-format -msgid "During flush, an exception might occur (e.g. if a DML operation violates a constraint). Since handling exceptions involves some understanding of Hibernate's transactional behavior, we discuss it in ." +msgid "During flush, an exception might occur (e.g. if a DML operation violates a constraint). Since handling exceptions involves some understanding of Hibernate's transactional behavior, we discuss it in ." msgstr "" #. Tag: title +#: session_api.xml:795 #, no-c-format msgid "Transitive persistence" msgstr "" #. Tag: para +#: session_api.xml:797 #, no-c-format msgid "It is quite cumbersome to save, delete, or reattach individual objects, especially if you deal with a graph of associated objects. A common case is a parent/child relationship. Consider the following example:" msgstr "" #. Tag: para +#: session_api.xml:802 #, no-c-format msgid "If the children in a parent/child relationship would be value typed (e.g. a collection of addresses or strings), their life cycle would depend on the parent and no further action would be required for convenient \"cascading\" of state changes. When the parent is saved, the value-typed child objects are saved and when the parent is deleted, the children will be deleted, etc. This works for operations such as the removal of a child from the collection. Since value-typed objects cannot have shared references, Hibernate will detect this and delete the child from the database." msgstr "" #. Tag: para +#: session_api.xml:812 #, no-c-format msgid "Now consider the same scenario with parent and child objects being entities, not value-types (e.g. categories and items, or parent and child cats). Entities have their own life cycle and support shared references. Removing an entity from the collection does not mean it can be deleted), and there is by default no cascading of state from one entity to any other associated entities. Hibernate does not implement persistence by reachability by default." msgstr "" #. Tag: para +#: session_api.xml:820 #, no-c-format msgid "For each basic operation of the Hibernate session - including persist(), merge(), saveOrUpdate(), delete(), lock(), refresh(), evict(), replicate() - there is a corresponding cascade style. Respectively, the cascade styles are named create, merge, save-update, delete, lock, refresh, evict, replicate. If you want an operation to be cascaded along an association, you must indicate that in the mapping document. For example:" msgstr "" +#. Tag: programlisting +#: session_api.xml:828 +#, no-c-format +msgid "<one-to-one name=\"person\" cascade=\"persist\"/>" +msgstr "" + #. Tag: para +#: session_api.xml:830 #, no-c-format msgid "Cascade styles my be combined:" msgstr "" +#. Tag: programlisting +#: session_api.xml:832 +#, no-c-format +msgid "<one-to-one name=\"person\" cascade=\"persist,delete,lock\"/>" +msgstr "" + #. Tag: para +#: session_api.xml:834 #, no-c-format msgid "You can even use cascade=\"all\" to specify that all operations should be cascaded along the association. The default cascade=\"none\" specifies that no operations are to be cascaded." msgstr "" #. Tag: para +#: session_api.xml:839 #, no-c-format -msgid "A special cascade style, delete-orphan, applies only to one-to-many associations, and indicates that the delete() operation should be applied to any child object that is removed from the association." +msgid "In case you are using annotatons you probably have noticed the cascade attribute taking an array of CascadeType as a value. The cascade concept in JPA is very is similar to the transitive persistence and cascading of operations as described above, but with slightly different semantics and cascading types:" msgstr "" #. Tag: para +#: session_api.xml:848 +#, no-c-format +msgid "CascadeType.PERSIST: cascades the persist (create) operation to associated entities persist() is called or if the entity is managed" +msgstr "" + +#. Tag: para +#: session_api.xml:854 +#, no-c-format +msgid "CascadeType.MERGE: cascades the merge operation to associated entities if merge() is called or if the entity is managed" +msgstr "" + +#. Tag: para +#: session_api.xml:860 +#, no-c-format +msgid "CascadeType.REMOVE: cascades the remove operation to associated entities if delete() is called" +msgstr "" + +#. Tag: para +#: session_api.xml:865 +#, no-c-format +msgid "CascadeType.REFRESH: cascades the refresh operation to associated entities if refresh() is called" +msgstr "" + +#. Tag: para +#: session_api.xml:870 +#, no-c-format +msgid "CascadeType.DETACH: cascades the detach operation to associated entities if detach() is called" +msgstr "" + +#. Tag: para +#: session_api.xml:875 +#, no-c-format +msgid "CascadeType.ALL: all of the above" +msgstr "" + +#. Tag: para +#: session_api.xml:880 +#, no-c-format +msgid "CascadeType.ALL also covers Hibernate specific operations like save-update, lock etc..." +msgstr "" + +#. Tag: para +#: session_api.xml:884 +#, no-c-format +msgid "A special cascade style, delete-orphan, applies only to one-to-many associations, and indicates that the delete() operation should be applied to any child object that is removed from the association. Using annotations there is no CascadeType.DELETE-ORPHAN equivalent. Instead you can use the attribute orphanRemoval as seen in . If an entity is removed from a @OneToMany collection or an associated entity is dereferenced from a @OneToOne association, this associated entity can be marked for deletion if orphanRemoval is set to true." +msgstr "" + +#. Tag: title +#: session_api.xml:897 +#, no-c-format +msgid "@OneToMany with orphanRemoval" +msgstr "" + +#. Tag: programlisting +#: session_api.xml:900 +#, no-c-format +msgid "" + "@Entity \n" + "public class Customer {\n" + " private Set<Order> orders;\n" + "\n" + " @OneToMany(cascade=CascadeType.ALL, orphanRemoval=true) \n" + " public Set<Order> getOrders() { return orders; }\n" + "\n" + " public void setOrders(Set<Order> orders) { this.orders = orders; }\n" + "\n" + " [...]\n" + "}\n" + "\n" + "@Entity \n" + "public class Order { ... }\n" + "\n" + "Customer customer = em.find(Customer.class, 1l);\n" + "Order order = em.find(Order.class, 1l);\n" + "customer.getOrders().remove(order); //order will be deleted by cascade" +msgstr "" + +#. Tag: para +#: session_api.xml:903 #, no-c-format msgid "Recommendations:" msgstr "" #. Tag: para +#: session_api.xml:907 #, no-c-format -msgid "It does not usually make sense to enable cascade on a <many-to-one> or <many-to-many> association. Cascade is often useful for <one-to-one> and <one-to-many> associations." +msgid "It does not usually make sense to enable cascade on a many-to-one or many-to-many association. In fact the @ManyToOne and @ManyToMany don't even offer a orphanRemoval attribute. Cascading is often useful for one-to-one and one-to-many associations." msgstr "" #. Tag: para +#: session_api.xml:915 #, no-c-format -msgid "If the child object's lifespan is bounded by the lifespan of the parent object, make it a life cycle object by specifying cascade=\"all,delete-orphan\"." +msgid "If the child object's lifespan is bounded by the lifespan of the parent object, make it a life cycle object by specifying cascade=\"all,delete-orphan\"(@OneToMany(cascade=CascadeType.ALL, orphanRemoval=true))." msgstr "" #. Tag: para +#: session_api.xml:923 #, no-c-format msgid "Otherwise, you might not need cascade at all. But if you think that you will often be working with the parent and children together in the same transaction, and you want to save yourself some typing, consider using cascade=\"persist,merge,save-update\"." msgstr "" #. Tag: para +#: session_api.xml:931 #, no-c-format msgid "Mapping an association (either a single valued association, or a collection) with cascade=\"all\" marks the association as a parent/child style relationship where save/update/delete of the parent results in save/update/delete of the child or children." msgstr "" #. Tag: para +#: session_api.xml:937 #, no-c-format -msgid "Furthermore, a mere reference to a child from a persistent parent will result in save/update of the child. This metaphor is incomplete, however. A child which becomes unreferenced by its parent is not automatically deleted, except in the case of a <one-to-many> association mapped with cascade=\"delete-orphan\". The precise semantics of cascading operations for a parent/child relationship are as follows:" +msgid "Furthermore, a mere reference to a child from a persistent parent will result in save/update of the child. This metaphor is incomplete, however. A child which becomes unreferenced by its parent is not automatically deleted, except in the case of a one-to-many association mapped with cascade=\"delete-orphan\". The precise semantics of cascading operations for a parent/child relationship are as follows:" msgstr "" #. Tag: para +#: session_api.xml:948 #, no-c-format msgid "If a parent is passed to persist(), all children are passed to persist()" msgstr "" #. Tag: para +#: session_api.xml:953 #, no-c-format msgid "If a parent is passed to merge(), all children are passed to merge()" msgstr "" #. Tag: para +#: session_api.xml:958 #, no-c-format msgid "If a parent is passed to save(), update() or saveOrUpdate(), all children are passed to saveOrUpdate()" msgstr "" #. Tag: para +#: session_api.xml:964 #, no-c-format msgid "If a transient or detached child becomes referenced by a persistent parent, it is passed to saveOrUpdate()" msgstr "" #. Tag: para +#: session_api.xml:970 #, no-c-format msgid "If a parent is deleted, all children are passed to delete()" msgstr "" #. Tag: para +#: session_api.xml:975 #, no-c-format msgid "If a child is dereferenced by a persistent parent, nothing special happens - the application should explicitly delete the child if necessary - unless cascade=\"delete-orphan\", in which case the \"orphaned\" child is deleted." msgstr "" #. Tag: para +#: session_api.xml:983 #, no-c-format msgid "Finally, note that cascading of operations can be applied to an object graph at call time or at flush time. All operations, if enabled, are cascaded to associated entities reachable when the operation is executed. However, save-update and delete-orphan are transitive for all associated entities reachable during flush of the Session." msgstr "" #. Tag: title +#: session_api.xml:993 #, no-c-format msgid "Using metadata" msgstr "" #. Tag: para +#: session_api.xml:995 #, no-c-format msgid "Hibernate requires a rich meta-level model of all entity and value types. This model can be useful to the application itself. For example, the application might use Hibernate's metadata to implement a \"smart\" deep-copy algorithm that understands which objects should be copied (eg. mutable value types) and which objects that should not (e.g. immutable value types and, possibly, associated entities)." msgstr "" #. Tag: para +#: session_api.xml:1002 #, no-c-format msgid "Hibernate exposes metadata via the ClassMetadata and CollectionMetadata interfaces and the Type hierarchy. Instances of the metadata interfaces can be obtained from the SessionFactory." msgstr "" +#. Tag: programlisting +#: session_api.xml:1007 +#, no-c-format +msgid "" + "Cat fritz = ......;\n" + "ClassMetadata catMeta = sessionfactory.getClassMetadata(Cat.class);\n" + "\n" + "Object[] propertyValues = catMeta.getPropertyValues(fritz);\n" + "String[] propertyNames = catMeta.getPropertyNames();\n" + "Type[] propertyTypes = catMeta.getPropertyTypes();\n" + "\n" + "// get a Map of all properties which are not collections or associations\n" + "Map namedValues = new HashMap();\n" + "for ( int i=0; i<propertyNames.length; i++ ) {\n" + " if ( !propertyTypes[i].isEntityType() && !propertyTypes[i].isCollectionType() ) {\n" + " namedValues.put( propertyNames[i], propertyValues[i] );\n" + " }\n" + "}" +msgstr "" + diff --git a/documentation/manual/src/main/docbook/pot/content/tutorial.pot b/documentation/manual/src/main/docbook/pot/content/tutorial.pot index 38f204fa76..5d833258d2 100644 --- a/documentation/manual/src/main/docbook/pot/content/tutorial.pot +++ b/documentation/manual/src/main/docbook/pot/content/tutorial.pot @@ -1,698 +1,1582 @@ -# -# AUTHOR , YEAR. +# SOME DESCRIPTIVE TITLE. +# FIRST AUTHOR , YEAR. # +#, fuzzy msgid "" msgstr "" -"Project-Id-Version: 0\n" -"POT-Creation-Date: 2010-02-11T05:38:16\n" -"PO-Revision-Date: 2010-02-11T05:38:16\n" -"Last-Translator: Automatically generated\n" -"Language-Team: None\n" +"Project-Id-Version: PACKAGE VERSION\n" +"Report-Msgid-Bugs-To: http://bugs.kde.org\n" +"POT-Creation-Date: 2010-07-20 21:02+0000\n" +"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" +"Last-Translator: FULL NAME \n" +"Language-Team: LANGUAGE \n" "MIME-Version: 1.0\n" -"Content-Type: application/x-publican; charset=UTF-8\n" +"Content-Type: application/x-xml2pot; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" #. Tag: title +#: tutorial.xml:34 #, no-c-format msgid "Tutorial" msgstr "" #. Tag: para +#: tutorial.xml:36 #, no-c-format msgid "Intended for new users, this chapter provides an step-by-step introduction to Hibernate, starting with a simple application using an in-memory database. The tutorial is based on an earlier tutorial developed by Michael Gloegl. All code is contained in the tutorials/web directory of the project source." msgstr "" #. Tag: para +#: tutorial.xml:45 #, no-c-format msgid "This tutorial expects the user have knowledge of both Java and SQL. If you have a limited knowledge of JAVA or SQL, it is advised that you start with a good introduction to that technology prior to attempting to learn Hibernate." msgstr "" #. Tag: para +#: tutorial.xml:54 #, no-c-format msgid "The distribution contains another example application under the tutorial/eg project source directory." msgstr "" #. Tag: title +#: tutorial.xml:62 #, no-c-format msgid "Part 1 - The first Hibernate Application" msgstr "" #. Tag: para +#: tutorial.xml:64 #, no-c-format msgid "For this example, we will set up a small database application that can store events we want to attend and information about the host(s) of these events." msgstr "" #. Tag: para +#: tutorial.xml:70 #, no-c-format msgid "Although you can use whatever database you feel comfortable using, we will use HSQLDB (an in-memory, Java database) to avoid describing installation/setup of any particular database servers." msgstr "" #. Tag: title +#: tutorial.xml:79 #, no-c-format msgid "Setup" msgstr "" #. Tag: para +#: tutorial.xml:81 #, no-c-format msgid "The first thing we need to do is to set up the development environment. We will be using the \"standard layout\" advocated by alot of build tools such as Maven. Maven, in particular, has a good resource describing this layout. As this tutorial is to be a web application, we will be creating and making use of src/main/java, src/main/resources and src/main/webapp directories." msgstr "" #. Tag: para +#: tutorial.xml:91 #, no-c-format msgid "We will be using Maven in this tutorial, taking advantage of its transitive dependency management capabilities as well as the ability of many IDEs to automatically set up a project for us based on the maven descriptor." msgstr "" -#. Tag: para +#. Tag: programlisting +#: tutorial.xml:97 #, no-c-format -msgid "It is not a requirement to use Maven. If you wish to use something else to build this tutoial (such as Ant), the layout will remain the same. The only change is that you will need to manually account for all the needed dependencies. If you use something like Ivy providing transitive dependency management you would still use the dependencies mentioned below. Otherwise, you'd need to grab all dependencies, both explicit and transitive, and add them to the project's classpath. If working from the Hibernate distribution bundle, this would mean hibernate3.jar, all artifacts in the lib/required directory and all files from either the lib/bytecode/cglib or lib/bytecode/javassist directory; additionally you will need both the servlet-api jar and one of the slf4j logging backends." +msgid "" + "\n" + "\n" + " 4.0.0\n" + "\n" + " org.hibernate.tutorials\n" + " hibernate-tutorial\n" + " 1.0.0-SNAPSHOT\n" + " First Hibernate Tutorial\n" + "\n" + " \n" + " \n" + " ${artifactId}\n" + " \n" + "\n" + " \n" + " \n" + " org.hibernate\n" + " hibernate-core\n" + " \n" + "\n" + " \n" + " \n" + " javax.servlet\n" + " servlet-api\n" + " \n" + "\n" + " \n" + " \n" + " org.slf4j\n" + " slf4j-simple\n" + " \n" + "\n" + " \n" + " \n" + " javassist\n" + " javassist\n" + " \n" + " \n" + "\n" + "]]>" msgstr "" #. Tag: para +#: tutorial.xml:100 +#, no-c-format +msgid "It is not a requirement to use Maven. If you wish to use something else to build this tutorial (such as Ant), the layout will remain the same. The only change is that you will need to manually account for all the needed dependencies. If you use something like Ivy providing transitive dependency management you would still use the dependencies mentioned below. Otherwise, you'd need to grab all dependencies, both explicit and transitive, and add them to the project's classpath. If working from the Hibernate distribution bundle, this would mean hibernate3.jar, all artifacts in the lib/required directory and all files from either the lib/bytecode/cglib or lib/bytecode/javassist directory; additionally you will need both the servlet-api jar and one of the slf4j logging backends." +msgstr "" + +#. Tag: para +#: tutorial.xml:117 #, no-c-format msgid "Save this file as pom.xml in the project root directory." msgstr "" #. Tag: title +#: tutorial.xml:124 #, no-c-format msgid "The first class" msgstr "" #. Tag: para +#: tutorial.xml:126 #, no-c-format msgid "Next, we create a class that represents the event we want to store in the database; it is a simple JavaBean class with some properties:" msgstr "" +#. Tag: programlisting +#: tutorial.xml:131 +#, no-c-format +msgid "" + "" +msgstr "" + #. Tag: para +#: tutorial.xml:133 #, no-c-format msgid "This class uses standard JavaBean naming conventions for property getter and setter methods, as well as private visibility for the fields. Although this is the recommended design, it is not required. Hibernate can also access fields directly, the benefit of accessor methods is robustness for refactoring." msgstr "" #. Tag: para +#: tutorial.xml:141 #, no-c-format msgid "The id property holds a unique identifier value for a particular event. All persistent entity classes (there are less important dependent classes as well) will need such an identifier property if we want to use the full feature set of Hibernate. In fact, most applications, especially web applications, need to distinguish objects by identifier, so you should consider this a feature rather than a limitation. However, we usually do not manipulate the identity of an object, hence the setter method should be private. Only Hibernate will assign identifiers when an object is saved. Hibernate can access public, private, and protected accessor methods, as well as public, private and protected fields directly. The choice is up to you and you can match it to fit your application design." msgstr "" #. Tag: para +#: tutorial.xml:156 #, no-c-format msgid "The no-argument constructor is a requirement for all persistent classes; Hibernate has to create objects for you, using Java Reflection. The constructor can be private, however package or public visibility is required for runtime proxy generation and efficient data retrieval without bytecode instrumentation." msgstr "" #. Tag: para +#: tutorial.xml:164 #, no-c-format msgid "Save this file to the src/main/java/org/hibernate/tutorial/domain directory." msgstr "" #. Tag: title +#: tutorial.xml:171 #, no-c-format msgid "The mapping file" msgstr "" #. Tag: para +#: tutorial.xml:173 #, no-c-format msgid "Hibernate needs to know how to load and store objects of the persistent class. This is where the Hibernate mapping file comes into play. The mapping file tells Hibernate what table in the database it has to access, and what columns in that table it should use." msgstr "" #. Tag: para +#: tutorial.xml:181 #, no-c-format msgid "The basic structure of a mapping file looks like this:" msgstr "" +#. Tag: programlisting +#: tutorial.xml:185 +#, no-c-format +msgid "" + "\n" + "\n" + "\n" + "\n" + "[...]\n" + "]]>" +msgstr "" + #. Tag: para +#: tutorial.xml:187 #, no-c-format msgid "Hibernate DTD is sophisticated. You can use it for auto-completion of XML mapping elements and attributes in your editor or IDE. Opening up the DTD file in your text editor is the easiest way to get an overview of all elements and attributes, and to view the defaults, as well as some comments. Hibernate will not load the DTD file from the web, but first look it up from the classpath of the application. The DTD file is included in hibernate-core.jar (it is also included in the hibernate3.jar, if using the distribution bundle)." msgstr "" #. Tag: para +#: tutorial.xml:200 #, no-c-format msgid "We will omit the DTD declaration in future examples to shorten the code. It is, of course, not optional." msgstr "" #. Tag: para +#: tutorial.xml:206 #, no-c-format msgid "Between the two hibernate-mapping tags, include a class element. All persistent entity classes (again, there might be dependent classes later on, which are not first-class entities) need a mapping to a table in the SQL database:" msgstr "" +#. Tag: programlisting +#: tutorial.xml:213 +#, no-c-format +msgid "" + "\n" + "\n" + " \n" + "\n" + " \n" + "\n" + "]]>" +msgstr "" + #. Tag: para +#: tutorial.xml:215 #, no-c-format msgid "So far we have told Hibernate how to persist and load object of class Event to the table EVENTS. Each instance is now represented by a row in that table. Now we can continue by mapping the unique identifier property to the tables primary key. As we do not want to care about handling this identifier, we configure Hibernate's identifier generation strategy for a surrogate primary key column:" msgstr "" +#. Tag: programlisting +#: tutorial.xml:225 +#, no-c-format +msgid "" + "\n" + "\n" + " \n" + " \n" + " \n" + " \n" + " \n" + "\n" + "]]>" +msgstr "" + #. Tag: para +#: tutorial.xml:227 #, no-c-format msgid "The id element is the declaration of the identifier property. The name=\"id\" mapping attribute declares the name of the JavaBean property and tells Hibernate to use the getId() and setId() methods to access the property. The column attribute tells Hibernate which column of the EVENTS table holds the primary key value." msgstr "" #. Tag: para +#: tutorial.xml:237 #, no-c-format msgid "The nested generator element specifies the identifier generation strategy (aka how are identifier values generated?). In this case we choose native, which offers a level of portability depending on the configured database dialect. Hibernate supports database generated, globally unique, as well as application assigned, identifiers. Identifier value generation is also one of Hibernate's many extension points and you can plugin in your own strategy." msgstr "" #. Tag: para +#: tutorial.xml:249 #, no-c-format -msgid "native is no longer consider the best strategy in terms of portability. for further discussion, see " +msgid "native is no longer consider the best strategy in terms of portability. for further discussion, see" msgstr "" #. Tag: para +#: tutorial.xml:255 #, no-c-format msgid "Lastly, we need to tell Hibernate about the remaining entity class properties. By default, no properties of the class are considered persistent:" msgstr "" +#. Tag: programlisting +#: tutorial.xml:261 +#, no-c-format +msgid "" + "\n" + "\n" + " \n" + " \n" + " \n" + " \n" + " \n" + " \n" + " \n" + "\n" + "]]>" +msgstr "" + #. Tag: para +#: tutorial.xml:263 #, no-c-format msgid "Similar to the id element, the name attribute of the property element tells Hibernate which getter and setter methods to use. In this case, Hibernate will search for getDate(), setDate(), getTitle() and setTitle() methods." msgstr "" #. Tag: para +#: tutorial.xml:274 #, no-c-format msgid "Why does the date property mapping include the column attribute, but the title does not? Without the column attribute, Hibernate by default uses the property name as the column name. This works for title, however, date is a reserved keyword in most databases so you will need to map it to a different name." msgstr "" #. Tag: para +#: tutorial.xml:284 #, no-c-format msgid "The title mapping also lacks a type attribute. The types declared and used in the mapping files are not Java data types; they are not SQL database types either. These types are called Hibernate mapping types, converters which can translate from Java to SQL data types and vice versa. Again, Hibernate will try to determine the correct conversion and mapping type itself if the type attribute is not present in the mapping. In some cases this automatic detection using Reflection on the Java class might not have the default you expect or need. This is the case with the date property. Hibernate cannot know if the property, which is of java.util.Date, should map to a SQL date, timestamp, or time column. Full date and time information is preserved by mapping the property with a timestamp converter." msgstr "" #. Tag: para +#: tutorial.xml:300 #, no-c-format msgid "Hibernate makes this mapping type determination using reflection when the mapping files are processed. This can take time and resources, so if startup performance is important you should consider explicitly defining the type to use." msgstr "" #. Tag: para +#: tutorial.xml:307 #, no-c-format msgid "Save this mapping file as src/main/resources/org/hibernate/tutorial/domain/Event.hbm.xml." msgstr "" #. Tag: title +#: tutorial.xml:315 #, no-c-format msgid "Hibernate configuration" msgstr "" #. Tag: para +#: tutorial.xml:317 #, no-c-format msgid "At this point, you should have the persistent class and its mapping file in place. It is now time to configure Hibernate. First let's set up HSQLDB to run in \"server mode\"" msgstr "" #. Tag: para +#: tutorial.xml:324 #, no-c-format msgid "We do this do that the data remains between runs." msgstr "" #. Tag: para +#: tutorial.xml:329 #, no-c-format msgid "We will utilize the Maven exec plugin to launch the HSQLDB server by running: mvn exec:java -Dexec.mainClass=\"org.hsqldb.Server\" -Dexec.args=\"-database.0 file:target/data/tutorial\" You will see it start up and bind to a TCP/IP socket; this is where our application will connect later. If you want to start with a fresh database during this tutorial, shutdown HSQLDB, delete all files in the target/data directory, and start HSQLDB again." msgstr "" #. Tag: para +#: tutorial.xml:340 #, no-c-format msgid "Hibernate will be connecting to the database on behalf of your application, so it needs to know how to obtain connections. For this tutorial we will be using a standalone connection pool (as opposed to a javax.sql.DataSource). Hibernate comes with support for two third-party open source JDBC connection pools: c3p0 and proxool. However, we will be using the Hibernate built-in connection pool for this tutorial." msgstr "" #. Tag: para +#: tutorial.xml:351 #, no-c-format msgid "The built-in Hibernate connection pool is in no way intended for production use. It lacks several features found on any decent connection pool." msgstr "" #. Tag: para +#: tutorial.xml:357 #, no-c-format msgid "For Hibernate's configuration, we can use a simple hibernate.properties file, a more sophisticated hibernate.cfg.xml file, or even complete programmatic setup. Most users prefer the XML configuration file:" msgstr "" +#. Tag: programlisting +#: tutorial.xml:363 +#, no-c-format +msgid "" + "\n" + "\n" + "\n" + "\n" + "\n" + " \n" + "\n" + " \n" + " org.hsqldb.jdbcDriver\n" + " jdbc:hsqldb:hsql://localhost\n" + " sa\n" + " \n" + "\n" + " \n" + " 1\n" + "\n" + " \n" + " org.hibernate.dialect.HSQLDialect\n" + "\n" + " \n" + " thread\n" + "\n" + " \n" + " org.hibernate.cache.NoCacheProvider\n" + "\n" + " \n" + " true\n" + "\n" + " \n" + " update\n" + "\n" + " \n" + "\n" + " \n" + "\n" + "]]>" +msgstr "" + #. Tag: para +#: tutorial.xml:366 #, no-c-format msgid "Notice that this configuration file specifies a different DTD" msgstr "" #. Tag: para +#: tutorial.xml:369 #, no-c-format msgid "You configure Hibernate's SessionFactory. SessionFactory is a global factory responsible for a particular database. If you have several databases, for easier startup you should use several <session-factory> configurations in several configuration files." msgstr "" #. Tag: para +#: tutorial.xml:376 #, no-c-format msgid "The first four property elements contain the necessary configuration for the JDBC connection. The dialect property element specifies the particular SQL variant Hibernate generates." msgstr "" #. Tag: para +#: tutorial.xml:383 #, no-c-format -msgid "In most cases, Hibernate is able to properly determine which dialect to use. See for more information." +msgid "In most cases, Hibernate is able to properly determine which dialect to use. See for more information." msgstr "" #. Tag: para +#: tutorial.xml:389 #, no-c-format msgid "Hibernate's automatic session management for persistence contexts is particularly useful in this context. The hbm2ddl.auto option turns on automatic generation of database schemas directly into the database. This can also be turned off by removing the configuration option, or redirected to a file with the help of the SchemaExport Ant task. Finally, add the mapping file(s) for persistent classes to the configuration." msgstr "" #. Tag: para +#: tutorial.xml:398 #, no-c-format msgid "Save this file as hibernate.cfg.xml into the src/main/resources directory." msgstr "" #. Tag: title +#: tutorial.xml:406 #, no-c-format msgid "Building with Maven" msgstr "" #. Tag: para +#: tutorial.xml:408 #, no-c-format msgid "We will now build the tutorial with Maven. You will need to have Maven installed; it is available from the Maven download page. Maven will read the /pom.xml file we created earlier and know how to perform some basic project tasks. First, lets run the compile goal to make sure we can compile everything so far:" msgstr "" +#. Tag: programlisting +#: tutorial.xml:418 +#, no-c-format +msgid "" + "" +msgstr "" + #. Tag: title +#: tutorial.xml:423 #, no-c-format msgid "Startup and helpers" msgstr "" #. Tag: para +#: tutorial.xml:425 #, no-c-format msgid "It is time to load and store some Event objects, but first you have to complete the setup with some infrastructure code. You have to startup Hibernate by building a global org.hibernate.SessionFactory object and storing it somewhere for easy access in application code. A org.hibernate.SessionFactory is used to obtain org.hibernate.Session instances. A org.hibernate.Session represents a single-threaded unit of work. The org.hibernate.SessionFactory is a thread-safe global object that is instantiated once." msgstr "" #. Tag: para +#: tutorial.xml:439 #, no-c-format msgid "We will create a HibernateUtil helper class that takes care of startup and makes accessing the org.hibernate.SessionFactory more convenient." msgstr "" +#. Tag: programlisting +#: tutorial.xml:445 +#, no-c-format +msgid "" + "" +msgstr "" + #. Tag: para +#: tutorial.xml:447 #, no-c-format msgid "Save this code as src/main/java/org/hibernate/tutorial/util/HibernateUtil.java" msgstr "" #. Tag: para +#: tutorial.xml:452 #, no-c-format msgid "This class not only produces the global org.hibernate.SessionFactory reference in its static initializer; it also hides the fact that it uses a static singleton. We might just as well have looked up the org.hibernate.SessionFactory reference from JNDI in an application server or any other location for that matter." msgstr "" #. Tag: para +#: tutorial.xml:461 #, no-c-format msgid "If you give the org.hibernate.SessionFactory a name in your configuration, Hibernate will try to bind it to JNDI under that name after it has been built. Another, better option is to use a JMX deployment and let the JMX-capable container instantiate and bind a HibernateService to JNDI. Such advanced options are discussed later." msgstr "" #. Tag: para +#: tutorial.xml:470 #, no-c-format msgid "You now need to configure a logging system. Hibernate uses commons logging and provides two choices: Log4j and JDK 1.4 logging. Most developers prefer Log4j: copy log4j.properties from the Hibernate distribution in the etc/ directory to your src directory, next to hibernate.cfg.xml. If you prefer to have more verbose output than that provided in the example configuration, you can change the settings. By default, only the Hibernate startup message is shown on stdout." msgstr "" #. Tag: para +#: tutorial.xml:480 #, no-c-format msgid "The tutorial infrastructure is complete and you are now ready to do some real work with Hibernate." msgstr "" #. Tag: title +#: tutorial.xml:488 #, no-c-format msgid "Loading and storing objects" msgstr "" #. Tag: para +#: tutorial.xml:490 #, no-c-format -msgid "We are now ready to start doing some real worjk with Hibernate. Let's start by writing an EventManager class with a main() method:" +msgid "We are now ready to start doing some real work with Hibernate. Let's start by writing an EventManager class with a main() method:" +msgstr "" + +#. Tag: programlisting +#: tutorial.xml:496 +#, no-c-format +msgid "" + "" msgstr "" #. Tag: para +#: tutorial.xml:498 #, no-c-format msgid "In createAndStoreEvent() we created a new Event object and handed it over to Hibernate. At that point, Hibernate takes care of the SQL and executes an INSERT on the database." msgstr "" #. Tag: para +#: tutorial.xml:505 #, no-c-format -msgid "A org.hibernate.Session is designed to represent a single unit of work (a single atmoic piece of work to be performed). For now we will keep things simple and assume a one-to-one granularity between a Hibernate org.hibernate.Session and a database transaction. To shield our code from the actual underlying transaction system we use the Hibernate org.hibernate.Transaction API. In this particular case we are using JDBC-based transactional semantics, but it could also run with JTA." +msgid "A org.hibernate.Session is designed to represent a single unit of work (a single atomic piece of work to be performed). For now we will keep things simple and assume a one-to-one granularity between a Hibernate org.hibernate.Session and a database transaction. To shield our code from the actual underlying transaction system we use the Hibernate org.hibernate.Transaction API. In this particular case we are using JDBC-based transactional semantics, but it could also run with JTA." msgstr "" #. Tag: para +#: tutorial.xml:518 #, no-c-format msgid "What does sessionFactory.getCurrentSession() do? First, you can call it as many times and anywhere you like once you get hold of your org.hibernate.SessionFactory. The getCurrentSession() method always returns the \"current\" unit of work. Remember that we switched the configuration option for this mechanism to \"thread\" in our src/main/resources/hibernate.cfg.xml? Due to that setting, the context of a current unit of work is bound to the current Java thread that executes the application." msgstr "" #. Tag: para +#: tutorial.xml:532 #, no-c-format msgid "Hibernate offers three methods of current session tracking. The \"thread\" based method is not intended for production use; it is merely useful for prototyping and tutorials such as this one. Current session tracking is discussed in more detail later on." msgstr "" #. Tag: para +#: tutorial.xml:541 #, no-c-format msgid "A org.hibernate.Session begins when the first call to getCurrentSession() is made for the current thread. It is then bound by Hibernate to the current thread. When the transaction ends, either through commit or rollback, Hibernate automatically unbinds the org.hibernate.Session from the thread and closes it for you. If you call getCurrentSession() again, you get a new org.hibernate.Session and can start a new unit of work." msgstr "" #. Tag: para +#: tutorial.xml:554 #, no-c-format msgid "Related to the unit of work scope, should the Hibernate org.hibernate.Session be used to execute one or several database operations? The above example uses one org.hibernate.Session for one operation. However this is pure coincidence; the example is just not complex enough to show any other approach. The scope of a Hibernate org.hibernate.Session is flexible but you should never design your application to use a new Hibernate org.hibernate.Session for every database operation. Even though it is used in the following examples, consider session-per-operation an anti-pattern. A real web application is shown later in the tutorial which will help illustrate this." msgstr "" #. Tag: para +#: tutorial.xml:571 #, no-c-format -msgid "See for more information about transaction handling and demarcation. The previous example also skipped any error handling and rollback." +msgid "See for more information about transaction handling and demarcation. The previous example also skipped any error handling and rollback." msgstr "" #. Tag: para +#: tutorial.xml:577 #, no-c-format msgid "To run this, we will make use of the Maven exec plugin to call our class with the necessary classpath setup: mvn exec:java -Dexec.mainClass=\"org.hibernate.tutorial.EventManager\" -Dexec.args=\"store\"" msgstr "" #. Tag: para +#: tutorial.xml:584 #, no-c-format msgid "You may need to perform mvn compile first." msgstr "" #. Tag: para +#: tutorial.xml:589 #, no-c-format msgid "You should see Hibernate starting up and, depending on your configuration, lots of log output. Towards the end, the following line will be displayed:" msgstr "" +#. Tag: programlisting +#: tutorial.xml:594 +#, no-c-format +msgid "" +msgstr "" + #. Tag: para +#: tutorial.xml:596 #, no-c-format msgid "This is the INSERT executed by Hibernate." msgstr "" #. Tag: para +#: tutorial.xml:600 #, no-c-format msgid "To list stored events an option is added to the main method:" msgstr "" +#. Tag: programlisting +#: tutorial.xml:604 +#, no-c-format +msgid "" + "" +msgstr "" + #. Tag: para +#: tutorial.xml:606 #, no-c-format msgid "A new listEvents() method is also added:" msgstr "" -#. Tag: para +#. Tag: programlisting +#: tutorial.xml:610 #, no-c-format -msgid "Here, we are using a Hibernate Query Language (HQL) query to load all existing Event objects from the database. Hibernate will generate the appropriate SQL, send it to the database and populate Event objects with the data. You can create more complex queries with HQL. See for more information." +msgid "" + "" msgstr "" #. Tag: para +#: tutorial.xml:612 +#, no-c-format +msgid "Here, we are using a Hibernate Query Language (HQL) query to load all existing Event objects from the database. Hibernate will generate the appropriate SQL, send it to the database and populate Event objects with the data. You can create more complex queries with HQL. See for more information." +msgstr "" + +#. Tag: para +#: tutorial.xml:620 #, no-c-format msgid "Now we can call our new functionality, again using the Maven exec plugin: mvn exec:java -Dexec.mainClass=\"org.hibernate.tutorial.EventManager\" -Dexec.args=\"list\"" msgstr "" #. Tag: title +#: tutorial.xml:630 #, no-c-format msgid "Part 2 - Mapping associations" msgstr "" #. Tag: para +#: tutorial.xml:632 #, no-c-format msgid "So far we have mapped a single persistent entity class to a table in isolation. Let's expand on that a bit and add some class associations. We will add people to the application and store a list of events in which they participate." msgstr "" #. Tag: title +#: tutorial.xml:640 #, no-c-format msgid "Mapping the Person class" msgstr "" #. Tag: para +#: tutorial.xml:642 #, no-c-format msgid "The first cut of the Person class looks like this:" msgstr "" +#. Tag: programlisting +#: tutorial.xml:646 +#, no-c-format +msgid "" + "" +msgstr "" + #. Tag: para +#: tutorial.xml:648 #, no-c-format msgid "Save this to a file named src/main/java/org/hibernate/tutorial/domain/Person.java" msgstr "" #. Tag: para +#: tutorial.xml:653 #, no-c-format msgid "Next, create the new mapping file as src/main/resources/org/hibernate/tutorial/domain/Person.hbm.xml" msgstr "" +#. Tag: programlisting +#: tutorial.xml:658 +#, no-c-format +msgid "" + "\n" + "\n" + " \n" + " \n" + " \n" + " \n" + " \n" + " \n" + " \n" + " \n" + "\n" + "]]>" +msgstr "" + #. Tag: para +#: tutorial.xml:660 #, no-c-format msgid "Finally, add the new mapping to Hibernate's configuration:" msgstr "" +#. Tag: programlisting +#: tutorial.xml:664 +#, no-c-format +msgid "" + "\n" + "]]>" +msgstr "" + #. Tag: para +#: tutorial.xml:666 #, no-c-format msgid "Create an association between these two entities. Persons can participate in events, and events have participants. The design questions you have to deal with are: directionality, multiplicity, and collection behavior." msgstr "" #. Tag: title +#: tutorial.xml:676 #, no-c-format msgid "A unidirectional Set-based association" msgstr "" #. Tag: para +#: tutorial.xml:678 #, no-c-format msgid "By adding a collection of events to the Person class, you can easily navigate to the events for a particular person, without executing an explicit query - by calling Person#getEvents. Multi-valued associations are represented in Hibernate by one of the Java Collection Framework contracts; here we choose a java.util.Set because the collection will not contain duplicate elements and the ordering is not relevant to our examples:" msgstr "" +#. Tag: programlisting +#: tutorial.xml:689 +#, no-c-format +msgid "" + "" +msgstr "" + #. Tag: para +#: tutorial.xml:691 #, no-c-format msgid "Before mapping this association, let's consider the other side. We could just keep this unidirectional or create another collection on the Event, if we wanted to be able to navigate it from both directions. This is not necessary, from a functional perspective. You can always execute an explicit query to retrieve the participants for a particular event. This is a design choice left to you, but what is clear from this discussion is the multiplicity of the association: \"many\" valued on both sides is called a many-to-many association. Hence, we use Hibernate's many-to-many mapping:" msgstr "" +#. Tag: programlisting +#: tutorial.xml:704 +#, no-c-format +msgid "" + "\n" + " \n" + " \n" + " \n" + " \n" + " \n" + " \n" + "\n" + " \n" + " \n" + " \n" + " \n" + "\n" + "]]>" +msgstr "" + #. Tag: para +#: tutorial.xml:706 #, no-c-format msgid "Hibernate supports a broad range of collection mappings, a set being most common. For a many-to-many association, or n:m entity relationship, an association table is required. Each row in this table represents a link between a person and an event. The table name is decalred using the table attribute of the set element. The identifier column name in the association, for the person side, is defined with the key element, the column name for the event's side with the column attribute of the many-to-many. You also have to tell Hibernate the class of the objects in your collection (the class on the other side of the collection of references)." msgstr "" #. Tag: para +#: tutorial.xml:722 #, no-c-format msgid "The database schema for this mapping is therefore:" msgstr "" +#. Tag: programlisting +#: tutorial.xml:726 +#, no-c-format +msgid "" + " | *EVENT_ID | | |\n" + " | EVENT_DATE | | *PERSON_ID | <--> | *PERSON_ID |\n" + " | TITLE | |__________________| | AGE |\n" + " |_____________| | FIRSTNAME |\n" + " | LASTNAME |\n" + " |_____________|\n" + " ]]>" +msgstr "" + #. Tag: title +#: tutorial.xml:731 #, no-c-format msgid "Working the association" msgstr "" #. Tag: para +#: tutorial.xml:733 #, no-c-format msgid "Now we will bring some people and events together in a new method in EventManager:" msgstr "" +#. Tag: programlisting +#: tutorial.xml:737 +#, no-c-format +msgid "" + "" +msgstr "" + #. Tag: para +#: tutorial.xml:739 #, no-c-format msgid "After loading a Person and an Event, simply modify the collection using the normal collection methods. There is no explicit call to update() or save(); Hibernate automatically detects that the collection has been modified and needs to be updated. This is called automatic dirty checking. You can also try it by modifying the name or the date property of any of your objects. As long as they are in persistent state, that is, bound to a particular Hibernate org.hibernate.Session, Hibernate monitors any changes and executes SQL in a write-behind fashion. The process of synchronizing the memory state with the database, usually only at the end of a unit of work, is called flushing. In our code, the unit of work ends with a commit, or rollback, of the database transaction." msgstr "" #. Tag: para +#: tutorial.xml:758 #, no-c-format msgid "You can load person and event in different units of work. Or you can modify an object outside of a org.hibernate.Session, when it is not in persistent state (if it was persistent before, this state is called detached). You can even modify a collection when it is detached:" msgstr "" +#. Tag: programlisting +#: tutorial.xml:767 +#, no-c-format +msgid "" + "" +msgstr "" + #. Tag: para +#: tutorial.xml:769 #, no-c-format msgid "The call to update makes a detached object persistent again by binding it to a new unit of work, so any modifications you made to it while detached can be saved to the database. This includes any modifications (additions/deletions) you made to a collection of that entity object." msgstr "" #. Tag: para +#: tutorial.xml:778 #, no-c-format msgid "This is not much use in our example, but it is an important concept you can incorporate into your own application. Complete this exercise by adding a new action to the main method of the EventManager and call it from the command line. If you need the identifiers of a person and an event - the save() method returns it (you might have to modify some of the previous methods to return that identifier):" msgstr "" +#. Tag: programlisting +#: tutorial.xml:786 +#, no-c-format +msgid "" + "" +msgstr "" + #. Tag: para +#: tutorial.xml:788 #, no-c-format msgid "This is an example of an association between two equally important classes : two entities. As mentioned earlier, there are other classes and types in a typical model, usually \"less important\". Some you have already seen, like an int or a java.lang.String. We call these classes value types, and their instances depend on a particular entity. Instances of these types do not have their own identity, nor are they shared between entities. Two persons do not reference the same firstname object, even if they have the same first name. Value types cannot only be found in the JDK , but you can also write dependent classes yourself such as an Address or MonetaryAmount class. In fact, in a Hibernate application all JDK classes are considered value types." msgstr "" #. Tag: para +#: tutorial.xml:806 #, no-c-format msgid "You can also design a collection of value types. This is conceptually different from a collection of references to other entities, but looks almost the same in Java." msgstr "" #. Tag: title +#: tutorial.xml:815 #, no-c-format msgid "Collection of values" msgstr "" #. Tag: para +#: tutorial.xml:817 #, no-c-format msgid "Let's add a collection of email addresses to the Person entity. This will be represented as a java.util.Set of java.lang.String instances:" msgstr "" +#. Tag: programlisting +#: tutorial.xml:823 +#, no-c-format +msgid "" + "" +msgstr "" + #. Tag: para +#: tutorial.xml:825 #, no-c-format msgid "The mapping of this Set is as follows:" msgstr "" +#. Tag: programlisting +#: tutorial.xml:829 +#, no-c-format +msgid "" + "\n" + " \n" + " \n" + " ]]>" +msgstr "" + #. Tag: para +#: tutorial.xml:831 #, no-c-format msgid "The difference compared with the earlier mapping is the use of the element part which tells Hibernate that the collection does not contain references to another entity, but is rather a collection whose elements are values types, here specifically of type string. The lowercase name tells you it is a Hibernate mapping type/converter. Again the table attribute of the set element determines the table name for the collection. The key element defines the foreign-key column name in the collection table. The column attribute in the element element defines the column name where the email address values will actually be stored." msgstr "" #. Tag: para +#: tutorial.xml:847 #, no-c-format msgid "Here is the updated schema:" msgstr "" +#. Tag: programlisting +#: tutorial.xml:851 +#, no-c-format +msgid "" + " | *EVENT_ID | | | |___________________|\n" + " | EVENT_DATE | | *PERSON_ID | <--> | *PERSON_ID | <--> | *PERSON_ID |\n" + " | TITLE | |__________________| | AGE | | *EMAIL_ADDR |\n" + " |_____________| | FIRSTNAME | |___________________|\n" + " | LASTNAME |\n" + " |_____________|\n" + " ]]>" +msgstr "" + #. Tag: para +#: tutorial.xml:853 #, no-c-format msgid "You can see that the primary key of the collection table is in fact a composite key that uses both columns. This also implies that there cannot be duplicate email addresses per person, which is exactly the semantics we need for a set in Java." msgstr "" #. Tag: para +#: tutorial.xml:859 #, no-c-format msgid "You can now try to add elements to this collection, just like we did before by linking persons and events. It is the same code in Java:" msgstr "" +#. Tag: programlisting +#: tutorial.xml:864 +#, no-c-format +msgid "" + "" +msgstr "" + #. Tag: para +#: tutorial.xml:866 #, no-c-format msgid "This time we did not use a fetch query to initialize the collection. Monitor the SQL log and try to optimize this with an eager fetch." msgstr "" #. Tag: title +#: tutorial.xml:875 #, no-c-format msgid "Bi-directional associations" msgstr "" #. Tag: para +#: tutorial.xml:877 #, no-c-format msgid "Next you will map a bi-directional association. You will make the association between person and event work from both sides in Java. The database schema does not change, so you will still have many-to-many multiplicity." msgstr "" #. Tag: para +#: tutorial.xml:885 #, no-c-format msgid "A relational database is more flexible than a network programming language, in that it does not need a navigation direction; data can be viewed and retrieved in any possible way." msgstr "" #. Tag: para +#: tutorial.xml:893 #, no-c-format msgid "First, add a collection of participants to the Event class:" msgstr "" +#. Tag: programlisting +#: tutorial.xml:898 +#, no-c-format +msgid "" + "" +msgstr "" + #. Tag: para +#: tutorial.xml:900 #, no-c-format msgid "Now map this side of the association in Event.hbm.xml." msgstr "" +#. Tag: programlisting +#: tutorial.xml:904 +#, no-c-format +msgid "" + "\n" + " \n" + " \n" + " ]]>" +msgstr "" + #. Tag: para +#: tutorial.xml:906 #, no-c-format msgid "These are normal set mappings in both mapping documents. Notice that the column names in key and many-to-many swap in both mapping documents. The most important addition here is the inverse=\"true\" attribute in the set element of the Event's collection mapping." msgstr "" #. Tag: para +#: tutorial.xml:914 #, no-c-format msgid "What this means is that Hibernate should take the other side, the Person class, when it needs to find out information about the link between the two. This will be a lot easier to understand once you see how the bi-directional link between our two entities is created." msgstr "" #. Tag: title +#: tutorial.xml:923 #, no-c-format msgid "Working bi-directional links" msgstr "" #. Tag: para +#: tutorial.xml:925 #, no-c-format msgid "First, keep in mind that Hibernate does not affect normal Java semantics. How did we create a link between a Person and an Event in the unidirectional example? You add an instance of Event to the collection of event references, of an instance of Person. If you want to make this link bi-directional, you have to do the same on the other side by adding a Person reference to the collection in an Event. This process of \"setting the link on both sides\" is absolutely necessary with bi-directional links." msgstr "" #. Tag: para +#: tutorial.xml:935 #, no-c-format msgid "Many developers program defensively and create link management methods to correctly set both sides (for example, in Person):" msgstr "" +#. Tag: programlisting +#: tutorial.xml:940 +#, no-c-format +msgid "" + "" +msgstr "" + #. Tag: para +#: tutorial.xml:942 #, no-c-format msgid "The get and set methods for the collection are now protected. This allows classes in the same package and subclasses to still access the methods, but prevents everybody else from altering the collections directly. Repeat the steps for the collection on the other side." msgstr "" #. Tag: para +#: tutorial.xml:949 #, no-c-format msgid "What about the inverse mapping attribute? For you, and for Java, a bi-directional link is simply a matter of setting the references on both sides correctly. Hibernate, however, does not have enough information to correctly arrange SQL INSERT and UPDATE statements (to avoid constraint violations). Making one side of the association inverse tells Hibernate to consider it a mirror of the other side. That is all that is necessary for Hibernate to resolve any issues that arise when transforming a directional navigation model to a SQL database schema. The rules are straightforward: all bi-directional associations need one side as inverse. In a one-to-many association it has to be the many-side, and in many-to-many association you can select either side." msgstr "" #. Tag: title +#: tutorial.xml:965 #, no-c-format msgid "Part 3 - The EventManager web application" msgstr "" #. Tag: para +#: tutorial.xml:967 #, no-c-format msgid "A Hibernate web application uses Session and Transaction almost like a standalone application. However, some common patterns are useful. You can now write an EventManagerServlet. This servlet can list all events stored in the database, and it provides an HTML form to enter new events." msgstr "" #. Tag: title +#: tutorial.xml:975 #, no-c-format msgid "Writing the basic servlet" msgstr "" #. Tag: para +#: tutorial.xml:977 #, no-c-format msgid "First we need create our basic processing servlet. Since our servlet only handles HTTP GET requests, we will only implement the doGet() method:" msgstr "" +#. Tag: programlisting +#: tutorial.xml:983 +#, no-c-format +msgid "" + "" +msgstr "" + #. Tag: para +#: tutorial.xml:985 #, no-c-format msgid "Save this servlet as src/main/java/org/hibernate/tutorial/web/EventManagerServlet.java" msgstr "" #. Tag: para +#: tutorial.xml:990 #, no-c-format msgid "The pattern applied here is called session-per-request. When a request hits the servlet, a new Hibernate Session is opened through the first call to getCurrentSession() on the SessionFactory. A database transaction is then started. All data access occurs inside a transaction irrespective of whether the data is read or written. Do not use the auto-commit mode in applications." msgstr "" #. Tag: para +#: tutorial.xml:999 #, no-c-format msgid "Do not use a new Hibernate Session for every database operation. Use one Hibernate Session that is scoped to the whole request. Use getCurrentSession(), so that it is automatically bound to the current Java thread." msgstr "" #. Tag: para +#: tutorial.xml:1006 #, no-c-format msgid "Next, the possible actions of the request are processed and the response HTML is rendered. We will get to that part soon." msgstr "" #. Tag: para +#: tutorial.xml:1011 #, no-c-format msgid "Finally, the unit of work ends when processing and rendering are complete. If any problems occurred during processing or rendering, an exception will be thrown and the database transaction rolled back. This completes the session-per-request pattern. Instead of the transaction demarcation code in every servlet, you could also write a servlet filter. See the Hibernate website and Wiki for more information about this pattern called Open Session in View. You will need it as soon as you consider rendering your view in JSP, not in a servlet." msgstr "" #. Tag: title +#: tutorial.xml:1025 #, no-c-format msgid "Processing and rendering" msgstr "" #. Tag: para +#: tutorial.xml:1027 #, no-c-format msgid "Now you can implement the processing of the request and the rendering of the page." msgstr "" +#. Tag: programlisting +#: tutorial.xml:1031 +#, no-c-format +msgid "" + "Event Manager\");\n" + "\n" + " // Handle actions\n" + " if ( \"store\".equals(request.getParameter(\"action\")) ) {\n" + "\n" + " String eventTitle = request.getParameter(\"eventTitle\");\n" + " String eventDate = request.getParameter(\"eventDate\");\n" + "\n" + " if ( \"\".equals(eventTitle) || \"\".equals(eventDate) ) {\n" + " out.println(\"Please enter event title and date.\");\n" + " }\n" + " else {\n" + " createAndStoreEvent(eventTitle, dateFormatter.parse(eventDate));\n" + " out.println(\"Added event.\");\n" + " }\n" + " }\n" + "\n" + " // Print page\n" + " printEventForm(out);\n" + " listEvents(out, dateFormatter);\n" + "\n" + " // Write HTML footer\n" + " out.println(\"\");\n" + " out.flush();\n" + " out.close();]]>" +msgstr "" + #. Tag: para +#: tutorial.xml:1033 #, no-c-format msgid "This coding style, with a mix of Java and HTML, would not scale in a more complex application—keep in mind that we are only illustrating basic Hibernate concepts in this tutorial. The code prints an HTML header and a footer. Inside this page, an HTML form for event entry and a list of all events in the database are printed. The first method is trivial and only outputs HTML:" msgstr "" +#. Tag: programlisting +#: tutorial.xml:1042 +#, no-c-format +msgid "" + "Add new event:\");\n" + " out.println(\"
\");\n" + " out.println(\"Title:
\");\n" + " out.println(\"Date (e.g. 24.12.2009):
\");\n" + " out.println(\"\");\n" + " out.println(\"
\");\n" + " }]]>" +msgstr "" + #. Tag: para +#: tutorial.xml:1044 #, no-c-format msgid "The listEvents() method uses the Hibernate Session bound to the current thread to execute a query:" msgstr "" +#. Tag: programlisting +#: tutorial.xml:1050 +#, no-c-format +msgid "" + " 0) {\n" + " out.println(\"

Events in database:

\");\n" + " out.println(\"\");\n" + " out.println(\"\");\n" + " out.println(\"\");\n" + " out.println(\"\");\n" + " out.println(\"\");\n" + " Iterator it = result.iterator();\n" + " while (it.hasNext()) {\n" + " Event event = (Event) it.next();\n" + " out.println(\"\");\n" + " out.println(\"\");\n" + " out.println(\"\");\n" + " out.println(\"\");\n" + " }\n" + " out.println(\"
Event titleEvent date
\" + event.getTitle() + \"\" + dateFormatter.format(event.getDate()) + \"
\");\n" + " }\n" + " }]]>" +msgstr "" + #. Tag: para +#: tutorial.xml:1052 #, no-c-format msgid "Finally, the store action is dispatched to the createAndStoreEvent() method, which also uses the Session of the current thread:" msgstr "" +#. Tag: programlisting +#: tutorial.xml:1058 +#, no-c-format +msgid "" + "" +msgstr "" + #. Tag: para +#: tutorial.xml:1060 #, no-c-format msgid "The servlet is now complete. A request to the servlet will be processed in a single Session and Transaction. As earlier in the standalone application, Hibernate can automatically bind these objects to the current thread of execution. This gives you the freedom to layer your code and access the SessionFactory in any way you like. Usually you would use a more sophisticated design and move the data access code into data access objects (the DAO pattern). See the Hibernate Wiki for more examples." msgstr "" #. Tag: title +#: tutorial.xml:1074 #, no-c-format msgid "Deploying and testing" msgstr "" #. Tag: para +#: tutorial.xml:1076 #, no-c-format msgid "To deploy this application for testing we must create a Web ARchive (WAR). First we must define the WAR descriptor as src/main/webapp/WEB-INF/web.xml" msgstr "" +#. Tag: programlisting +#: tutorial.xml:1082 +#, no-c-format +msgid "" + "\n" + "\n" + "\n" + " \n" + " Event Manager\n" + " org.hibernate.tutorial.web.EventManagerServlet\n" + " \n" + "\n" + " \n" + " Event Manager\n" + " /eventmanager\n" + " \n" + "]]>" +msgstr "" + #. Tag: para +#: tutorial.xml:1084 #, no-c-format msgid "To build and deploy call mvn package in your project directory and copy the hibernate-tutorial.war file into your Tomcat webapps directory." msgstr "" #. Tag: para +#: tutorial.xml:1091 #, no-c-format -msgid "If you do not have Tomcat installed, download it from and follow the installation instructions. Our application requires no changes to the standard Tomcat configuration." +msgid "If you do not have Tomcat installed, download it from and follow the installation instructions. Our application requires no changes to the standard Tomcat configuration." msgstr "" #. Tag: para +#: tutorial.xml:1099 #, no-c-format msgid "Once deployed and Tomcat is running, access the application at http://localhost:8080/hibernate-tutorial/eventmanager. Make sure you watch the Tomcat log to see Hibernate initialize when the first request hits your servlet (the static initializer in HibernateUtil is called) and to get the detailed output if any exceptions occurs." msgstr "" #. Tag: title +#: tutorial.xml:1112 #, no-c-format msgid "Summary" msgstr "" #. Tag: para +#: tutorial.xml:1114 #, no-c-format msgid "This tutorial covered the basics of writing a simple standalone Hibernate application and a small web application. More tutorials are available from the Hibernate website." msgstr "" diff --git a/documentation/manual/src/main/docbook/pt-BR/author_group.po b/documentation/manual/src/main/docbook/pt-BR/author_group.po index 4930a4b35b..0c92d04fac 100644 --- a/documentation/manual/src/main/docbook/pt-BR/author_group.po +++ b/documentation/manual/src/main/docbook/pt-BR/author_group.po @@ -6,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: author_group\n" "Report-Msgid-Bugs-To: http://bugs.kde.org\n" -"POT-Creation-Date: 2010-02-04T04:51:21\n" +"POT-Creation-Date: 2010-07-20 21:02+0000\n" "PO-Revision-Date: 2010-03-19 15:45+1000\n" "Last-Translator: \n" "Language-Team: \n" @@ -15,138 +15,296 @@ msgstr "" "Content-Transfer-Encoding: 8bit\n" "X-Generator: KBabel 1.11.4\n" -#. Tag: firstname +#. Tag: author +#: author_group.xml:28 #, no-c-format -msgid "Gavin" -msgstr "Gavin" +msgid "Gavin King" +msgstr "" -#. Tag: firstname +#. Tag: author +#: author_group.xml:32 #, no-c-format -msgid "Christian" -msgstr "Christian" +msgid "Christian Bauer" +msgstr "" -#. Tag: firstname +#. Tag: author +#: author_group.xml:36 #, no-c-format -msgid "Max" -msgstr "Max" +msgid "" +"Max Rydahl Andersen" +msgstr "" -#. Tag: firstname +#. Tag: author +#: author_group.xml:41 #, no-c-format -msgid "Emmanuel" -msgstr "Emmanuel" +msgid "" +"Emmanuel Bernard" +msgstr "" -#. Tag: firstname +#. Tag: author +#: author_group.xml:45 #, no-c-format -msgid "Steve" -msgstr "Steve" +msgid "Steve Ebersole" +msgstr "" -#. Tag: firstname +#. Tag: author +#: author_group.xml:49 #, no-c-format -msgid "James" -msgstr "James" +msgid "Hardy Ferentschik" +msgstr "" -#. Tag: firstname +#. Tag: othercredit +#: author_group.xml:54 #, no-c-format -msgid "Cheyenne" -msgstr "Cheyenne" +msgid "James Cobb" +msgstr "" -#. Tag: firstname +#. Tag: shortaffil +#: author_group.xml:58 author_group.xml:65 #, no-c-format -msgid "Vincent" -msgstr "Vincent" +msgid "Graphic Design" +msgstr "" -#. Tag: firstname +#. Tag: othercredit +#: author_group.xml:61 #, no-c-format -msgid "Sebastien" -msgstr "Sebastien" +msgid "Cheyenne Weaver" +msgstr "" -#. Tag: firstname +#. Tag: othercredit +#: author_group.xml:74 #, no-c-format -msgid "Michael" -msgstr "Michael" +msgid "" +" " +"kreimer@bbs.frc.utn.edu.ar" +msgstr "" -#. Tag: firstname +#. Tag: othercredit +#: author_group.xml:84 #, no-c-format -msgid "Baptiste" -msgstr "Baptiste" +msgid "Vincent Ricard" +msgstr "" -#. Tag: firstname +#. Tag: othercredit +#: author_group.xml:88 #, no-c-format -msgid "Anthony" -msgstr "Anthony" +msgid "Sebastien Cesbron" +msgstr "" -#. Tag: firstname +#. Tag: othercredit +#: author_group.xml:92 #, no-c-format -msgid "Alvaro" -msgstr "Alvaro" +msgid "Michael Courcy" +msgstr "" -#. Tag: firstname +#. Tag: othercredit +#: author_group.xml:96 #, no-c-format -msgid "Anderson" -msgstr "Anderson" +msgid "Vincent Giguère" +msgstr "" -#. Tag: firstname +#. Tag: othercredit +#: author_group.xml:100 #, no-c-format -msgid "Daniel Vieira" -msgstr "Daniel Vieira" +msgid "Baptiste Mathus" +msgstr "" -#. Tag: firstname +#. Tag: othercredit +#: author_group.xml:104 #, no-c-format -msgid "Francisco" -msgstr "Francisco" +msgid "" +"Emmanuel Bernard" +msgstr "" -#. Tag: firstname +#. Tag: othercredit +#: author_group.xml:108 #, no-c-format -msgid "Gamarra" -msgstr "Gamarra" +msgid "Anthony Patricio" +msgstr "" -#. Tag: firstname +#. Tag: othercredit +#: author_group.xml:118 #, no-c-format -msgid "Luiz Carlos" -msgstr "Luiz Carlos" +msgid "" +"Alvaro Netto " +"alvaronetto@cetip.com.br" +msgstr "" -#. Tag: firstname +#. Tag: othercredit +#: author_group.xml:123 #, no-c-format -msgid "Marcel" -msgstr "Marcel" +msgid "" +"Anderson Braulio " +"andersonbraulio@gmail.com" +msgstr "" -#. Tag: firstname +#. Tag: othercredit +#: author_group.xml:128 #, no-c-format -msgid "Paulo" -msgstr "Paulo" +msgid "" +"Daniel Vieira Costa " +"danielvc@gmail.com" +msgstr "" -#. Tag: firstname +#. Tag: othercredit +#: author_group.xml:133 #, no-c-format -msgid "Pablo L." -msgstr "Pablo L." +msgid "" +"Francisco gamarra francisco." +"gamarra@gmail.com" +msgstr "" -#. Tag: firstname +#. Tag: othercredit +#: author_group.xml:138 #, no-c-format -msgid "Renato" -msgstr "Renato" +msgid "" +"Gamarra mauricio.gamarra@gmail.com" +msgstr "" -#. Tag: firstname +#. Tag: othercredit +#: author_group.xml:142 #, no-c-format -msgid "Rogério" -msgstr "Rogério" +msgid "" +"Luiz Carlos Rodrigues " +"luizcarlos_rodrigues@yahoo.com.br" +msgstr "" -#. Tag: firstname +#. Tag: othercredit +#: author_group.xml:147 #, no-c-format -msgid "Wanderson" -msgstr "Wanderson" +msgid "" +"Marcel Castelo marcel." +"castelo@gmail.com" +msgstr "" -#. Tag: firstname +#. Tag: othercredit +#: author_group.xml:152 #, no-c-format -msgid "Cao" -msgstr "Cao" +msgid "" +"Paulo César paulocol@gmail." +"com" +msgstr "" -#. Tag: orgname +#. Tag: othercredit +#: author_group.xml:157 #, no-c-format -msgid "RedSaga" -msgstr "RedSaga" +msgid "" +"Pablo L. de Miranda " +"pablolmiranda@gmail.com" +msgstr "" -#. Tag: contrib +#. Tag: othercredit +#: author_group.xml:162 #, no-c-format -msgid "Translation Lead" -msgstr "Time de Tradução" +msgid "" +"Renato Deggau rdeggau@gmail." +"com" +msgstr "" +#. Tag: othercredit +#: author_group.xml:167 +#, no-c-format +msgid "" +"Rogério Araújo " +"rgildoaraujo@yahoo.com.br" +msgstr "" + +#. Tag: othercredit +#: author_group.xml:172 +#, no-c-format +msgid "" +"Wanderson Siqueira " +"wandersonxs@gmail.com" +msgstr "" + +#. Tag: othercredit +#: author_group.xml:183 +#, no-c-format +msgid "" +"Cao Xiaogang " +"RedSaga Translation Lead caoxg@yahoo.com" +msgstr "" + +#~ msgid "Gavin" +#~ msgstr "Gavin" + +#~ msgid "Christian" +#~ msgstr "Christian" + +#~ msgid "Max" +#~ msgstr "Max" + +#~ msgid "Emmanuel" +#~ msgstr "Emmanuel" + +#~ msgid "Steve" +#~ msgstr "Steve" + +#~ msgid "James" +#~ msgstr "James" + +#~ msgid "Cheyenne" +#~ msgstr "Cheyenne" + +#~ msgid "Vincent" +#~ msgstr "Vincent" + +#~ msgid "Sebastien" +#~ msgstr "Sebastien" + +#~ msgid "Michael" +#~ msgstr "Michael" + +#~ msgid "Baptiste" +#~ msgstr "Baptiste" + +#~ msgid "Anthony" +#~ msgstr "Anthony" + +#~ msgid "Alvaro" +#~ msgstr "Alvaro" + +#~ msgid "Anderson" +#~ msgstr "Anderson" + +#~ msgid "Daniel Vieira" +#~ msgstr "Daniel Vieira" + +#~ msgid "Francisco" +#~ msgstr "Francisco" + +#~ msgid "Gamarra" +#~ msgstr "Gamarra" + +#~ msgid "Luiz Carlos" +#~ msgstr "Luiz Carlos" + +#~ msgid "Marcel" +#~ msgstr "Marcel" + +#~ msgid "Paulo" +#~ msgstr "Paulo" + +#~ msgid "Pablo L." +#~ msgstr "Pablo L." + +#~ msgid "Renato" +#~ msgstr "Renato" + +#~ msgid "Rogério" +#~ msgstr "Rogério" + +#~ msgid "Wanderson" +#~ msgstr "Wanderson" + +#~ msgid "Cao" +#~ msgstr "Cao" + +#~ msgid "RedSaga" +#~ msgstr "RedSaga" + +#~ msgid "Translation Lead" +#~ msgstr "Time de Tradução" diff --git a/documentation/manual/src/main/docbook/pt-BR/content/basic_mapping.po b/documentation/manual/src/main/docbook/pt-BR/content/basic_mapping.po index 08c046cfc4..57485bf9f1 100644 --- a/documentation/manual/src/main/docbook/pt-BR/content/basic_mapping.po +++ b/documentation/manual/src/main/docbook/pt-BR/content/basic_mapping.po @@ -108,7 +108,7 @@ msgid "" msgstr "" "Project-Id-Version: basic_mapping\n" "Report-Msgid-Bugs-To: http://bugs.kde.org\n" -"POT-Creation-Date: 2010-02-11T05:38:15\n" +"POT-Creation-Date: 2010-07-20 21:02+0000\n" "PO-Revision-Date: 2010-03-18 10:20+1000\n" "Last-Translator: \n" "Language-Team: \n" @@ -118,22 +118,143 @@ msgstr "" "X-Generator: KBabel 1.11.4\n" #. Tag: title +#: basic_mapping.xml:31 #, no-c-format msgid "Basic O/R Mapping" msgstr "Mapeamento O/R Básico" #. Tag: title +#: basic_mapping.xml:34 #, no-c-format msgid "Mapping declaration" msgstr "Declaração de mapeamento" #. Tag: para +#: basic_mapping.xml:36 +#, no-c-format +msgid "Object/relational mappings can be defined in three approaches:" +msgstr "" + +#. Tag: para +#: basic_mapping.xml:41 +#, no-c-format +msgid "using Java 5 annotations (via the Java Persistence 2 annotations)" +msgstr "" + +#. Tag: para +#: basic_mapping.xml:46 +#, no-c-format +msgid "using JPA 2 XML deployment descriptors (described in chapter XXX)" +msgstr "" + +#. Tag: para +#: basic_mapping.xml:51 +#, no-c-format +msgid "using the Hibernate legacy XML files approach known as hbm.xml" +msgstr "" + +#. Tag: para +#: basic_mapping.xml:56 #, no-c-format msgid "" -"Object/relational mappings are usually defined in an XML document. The " -"mapping document is designed to be readable and hand-editable. The mapping " -"language is Java-centric, meaning that mappings are constructed around " -"persistent class declarations and not table declarations." +"Annotations are split in two categories, the logical mapping annotations " +"(describing the object model, the association between two entities etc.) and " +"the physical mapping annotations (describing the physical schema, tables, " +"columns, indexes, etc). We will mix annotations from both categories in the " +"following code examples." +msgstr "" + +#. Tag: para +#: basic_mapping.xml:62 +#, no-c-format +msgid "" +"JPA annotations are in the javax.persistence.* package. " +"Hibernate specific extensions are in org.hibernate.annotations.*. You favorite IDE can auto-complete annotations and their " +"attributes for you (even without a specific \"JPA\" plugin, since JPA " +"annotations are plain Java 5 annotations)." +msgstr "" + +#. Tag: para +#: basic_mapping.xml:69 +#, fuzzy, no-c-format +msgid "Here is an example of mapping" +msgstr "Vamos iniciar com um exemplo de mapeamento:" + +#. Tag: programlisting +#: basic_mapping.xml:71 +#, no-c-format +msgid "" +"package eg;\n" +"\n" +"@Entity \n" +"@Table(name=\"cats\") @Inheritance(strategy=SINGLE_TABLE)\n" +"@DiscriminatorValue(\"C\") @DiscriminatorColumn(name=\"subclass\", " +"discriminatorType=CHAR)\n" +"public class Cat {\n" +" \n" +" @Id @GeneratedValue\n" +" public Integer getId() { return id; }\n" +" public void setId(Integer id) { this.id = id; }\n" +" private Integer id;\n" +"\n" +" public BigDecimal getWeight() { return weight; }\n" +" public void setWeight(BigDecimal weight) { this.weight = weight; }\n" +" private BigDecimal weight;\n" +"\n" +" @Temporal(DATE) @NotNull @Column(updatable=false)\n" +" public Date getBirthdate() { return birthdate; }\n" +" public void setBirthdate(Date birthdate) { this.birthdate = birthdate; }\n" +" private Date birthdate;\n" +"\n" +" @org.hibernate.annotations.Type(type=\"eg.types.ColorUserType\")\n" +" @NotNull @Column(updatable=false)\n" +" public ColorType getColor() { return color; }\n" +" public void setColor(ColorType color) { this.color = color; }\n" +" private ColorType color;\n" +"\n" +" @NotNull @Column(updatable=false)\n" +" public String getSex() { return sex; }\n" +" public void setSex(String sex) { this.sex = sex; }\n" +" private String sex;\n" +"\n" +" @NotNull @Column(updatable=false)\n" +" public Integer getLitterId() { return litterId; }\n" +" public void setLitterId(Integer litterId) { this.litterId = litterId; }\n" +" private Integer litterId;\n" +"\n" +" @ManyToOne @JoinColumn(name=\"mother_id\", updatable=false)\n" +" public Cat getMother() { return mother; }\n" +" public void setMother(Cat mother) { this.mother = mother; }\n" +" private Cat mother;\n" +"\n" +" @OneToMany(mappedBy=\"mother\") @OrderBy(\"litterId\")\n" +" public Set<Cat> getKittens() { return kittens; }\n" +" public void setKittens(Set<Cat> kittens) { this.kittens = " +"kittens; }\n" +" private Set<Cat> kittens = new HashSet<Cat>();\n" +"}\n" +"\n" +"@Entity @DiscriminatorValue(\"D\")\n" +"public class DomesticCat extends Cat {\n" +"\n" +" public String getName() { return name; }\n" +" public void setName(String name) { this.name = name }\n" +" private String name;\n" +"}\n" +"\n" +"@Entity\n" +"public class Dog { ... }" +msgstr "" + +#. Tag: para +#: basic_mapping.xml:73 +#, fuzzy, no-c-format +msgid "" +"The legacy hbm.xml approach uses an XML schema designed to be readable and " +"hand-editable. The mapping language is Java-centric, meaning that mappings " +"are constructed around persistent class declarations and not table " +"declarations." msgstr "" "O mapeamento de objeto/relacional é geralmente definido em um documento XML. " "O documento de mapeamento é criado para ser de leitura e editável " @@ -142,6 +263,7 @@ msgstr "" "não de declarações de tabelas. " #. Tag: para +#: basic_mapping.xml:78 #, no-c-format msgid "" "Please note that even though many Hibernate users choose to write the XML by " @@ -153,18 +275,92 @@ msgstr "" "mapeamento, incluindo o XDoclet Middlegen e AndroMDA." #. Tag: para +#: basic_mapping.xml:82 #, no-c-format msgid "Here is an example mapping:" msgstr "Vamos iniciar com um exemplo de mapeamento:" -#. Tag: para +#. Tag: programlisting +#: basic_mapping.xml:84 #, no-c-format msgid "" -"We will now discuss the content of the mapping document. We will only " -"describe, however, the document elements and attributes that are used by " -"Hibernate at runtime. The mapping document also contains some extra optional " -"attributes and elements that affect the database schemas exported by the " -"schema export tool (for example, the not-null attribute)." +"<?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 name=\"Cat\"\n" +" table=\"cats\"\n" +" discriminator-value=\"C\">\n" +"\n" +" <id name=\"id\">\n" +" <generator class=\"native\"/>\n" +" </id>\n" +"\n" +" <discriminator column=\"subclass\"\n" +" type=\"character\"/>\n" +"\n" +" <property name=\"weight\"/>\n" +"\n" +" <property name=\"birthdate\"\n" +" type=\"date\"\n" +" not-null=\"true\"\n" +" update=\"false\"/>\n" +"\n" +" <property name=\"color\"\n" +" type=\"eg.types.ColorUserType\"\n" +" not-null=\"true\"\n" +" update=\"false\"/>\n" +"\n" +" <property name=\"sex\"\n" +" not-null=\"true\"\n" +" update=\"false\"/>\n" +"\n" +" <property name=\"litterId\"\n" +" column=\"litterId\"\n" +" update=\"false\"/>\n" +"\n" +" <many-to-one name=\"mother\"\n" +" column=\"mother_id\"\n" +" update=\"false\"/>\n" +"\n" +" <set name=\"kittens\"\n" +" inverse=\"true\"\n" +" order-by=\"litter_id\">\n" +" <key column=\"mother_id\"/>\n" +" <one-to-many class=\"Cat\"/>\n" +" </set>\n" +"\n" +" <subclass name=\"DomesticCat\"\n" +" discriminator-value=\"D\">\n" +"\n" +" <property name=\"name\"\n" +" type=\"string\"/>\n" +"\n" +" </subclass>\n" +"\n" +" </class>\n" +"\n" +" <class name=\"Dog\">\n" +" <!-- mapping for Dog could go here -->\n" +" </class>\n" +"\n" +"</hibernate-mapping>" +msgstr "" + +#. Tag: para +#: basic_mapping.xml:86 +#, fuzzy, no-c-format +msgid "" +"We will now discuss the concepts of the mapping documents (both annotations " +"and XML). We will only describe, however, the document elements and " +"attributes that are used by Hibernate at runtime. The mapping document also " +"contains some extra optional attributes and elements that affect the " +"database schemas exported by the schema export tool (for example, the " +" not-null attribute)." msgstr "" "Discutiremos agora o conteúdo deste documento de mapeamento. Iremos apenas " "descrever os elementos do documento e funções que são utilizadas pelo " @@ -174,232 +370,429 @@ msgstr "" "esquemas. (Por exemplo, o atributo not-null). " #. Tag: title -#, no-c-format -msgid "Doctype" -msgstr "Doctype" - -#. Tag: para -#, no-c-format -msgid "" -"All XML mappings should declare the doctype shown. The actual DTD can be " -"found at the URL above, in the directory hibernate-x.x.x/src/org/" -"hibernate , or in hibernate3.jar. Hibernate " -"will always look for the DTD in its classpath first. If you experience " -"lookups of the DTD using an Internet connection, check the DTD declaration " -"against the contents of your classpath." -msgstr "" -"Todos os mapeamentos de XML devem declarar o doctype exibido. O DTD atual " -"pode ser encontrado na URL abaixo, no diretório hibernate-x.x.x/src/" -"org/ hibernate ou no hibernate3.jar. O " -"Hibernate sempre irá procurar pelo DTD inicialmente no seu classpath. Se " -"você tentar localizar o DTD usando uma conexão de internet, compare a " -"declaração do seu DTD com o conteúdo do seu classpath." - -#. Tag: title -#, no-c-format -msgid "EntityResolver" +#: basic_mapping.xml:94 +#, fuzzy, no-c-format +msgid "Entity" msgstr "Solucionador de Entidade" #. Tag: para +#: basic_mapping.xml:96 #, no-c-format msgid "" -"Hibernate will first attempt to resolve DTDs in its classpath. It does this " -"is by registering a custom org.xml.sax.EntityResolver " -"implementation with the SAXReader it uses to read in the xml files. This " -"custom EntityResolver recognizes two different systemId " -"namespaces:" +"An entity is a regular Java object (aka POJO) which will be persisted by " +"Hibernate." msgstr "" -"O Hibernate irá primeiro tentar solucionar os DTDs em seus classpath. Isto é " -"feito, registrando uma implementação org.xml.sax.EntityResolver personalizada com o SAXReader que ele utiliza para ler os arquivos " -"xml. Este EntityResolver personalizado, reconhece dois " -"nomes de espaço de sistemas Id diferentes:" #. Tag: para +#: basic_mapping.xml:99 #, no-c-format msgid "" -"a hibernate namespace is recognized whenever the resolver " -"encounters a systemId starting with http://hibernate.sourceforge." -"net/. The resolver attempts to resolve these entities via the " -"classloader which loaded the Hibernate classes." +"To mark an object as an entity in annotations, use the @Entity annotation." msgstr "" -"Um hibernate namespace é reconhecido quando um " -"solucionador encontra um systema Id iniciando com http://hibernate." -"sourceforge.net/. O solucionador tenta solucionar estas entidades " -"através do carregador de classe que carregou as classes do Hibernate. " -#. Tag: para +#. Tag: programlisting +#: basic_mapping.xml:102 #, no-c-format msgid "" -"a user namespace is recognized whenever the resolver " -"encounters a systemId using a classpath:// URL protocol. " -"The resolver will attempt to resolve these entities via (1) the current " -"thread context classloader and (2) the classloader which loaded the " -"Hibernate classes." +"@Entity\n" +"public class Flight implements Serializable {\n" +" Long id;\n" +"\n" +" @Id\n" +" public Long getId() { return id; }\n" +"\n" +" public void setId(Long id) { this.id = id; }\n" +"}" msgstr "" -"Um user namespace é reconhecido quando um solucionador " -"encontra um sistema Id, utilizando um protocolo URL de classpath://" -". O solucionador tentará solucionar estas entidades através do " -"carregador de classe do contexto de thread atual (1) e o carregador de " -"classe (2) que carregou as classes do Hibernate. " - -#. Tag: para -#, no-c-format -msgid "The following is an example of utilizing user namespacing:" -msgstr "Um exemplo de utilização do espaço de nome do usuário:" #. Tag: para +#: basic_mapping.xml:104 #, no-c-format msgid "" -"Where types.xml is a resource in the your." -"domain package and contains a custom typedef." +"That's pretty much it, the rest is optional. There are however any options " +"to tweak your entity mapping, let's explore them." msgstr "" -"Onde types.xml é um recurso no pacote your." -"domain e contém um typedef " -"personalizado." - -#. Tag: title -#, no-c-format -msgid "Hibernate-mapping" -msgstr "Mapeamento do Hibernate" #. Tag: para +#: basic_mapping.xml:107 #, no-c-format msgid "" -"This element has several optional attributes. The schema " -"and catalog attributes specify that tables referred to in " -"this mapping belong to the named schema and/or catalog. If they are " -"specified, tablenames will be qualified by the given schema and catalog " -"names. If they are missing, tablenames will be unqualified. The " -"default-cascade attribute specifies what cascade style " -"should be assumed for properties and collections that do not specify a " -"cascade attribute. By default, the auto-import attribute allows you to use unqualified class names in the query " -"language." +"@Table lets you define the table the entity will be " +"persisted into. If undefined, the table name is the unqualified class name " +"of the entity. You can also optionally define the catalog, the schema as " +"well as unique constraints on the table." msgstr "" -"Este elemento possui diversos atributos opcionais. Os atributos " -"schema e catalog especificam que " -"tabelas referenciadas neste mapeamento pertencem ao esquema e/ou ao catálogo " -"nomeado. Se especificados, os nomes das tabelas serão qualificados no " -"esquema ou catálogo dado. Se não, os nomes das tabelas não serão " -"qualificados. O atributo default-cascade especifica qual " -"estilo de cascata será considerado pelas propriedades e coleções que não " -"especificarem uma função cascade. A função auto-" -"import nos deixa utilizar nomes de classes não qualificados na " -"linguagem de consulta, por padrão." -#. Tag: para -#, no-c-format -msgid "schema (optional): the name of a database schema." -msgstr "schema (opcional): O nome do esquema do banco de dados. " - -#. Tag: para -#, no-c-format -msgid "catalog (optional): the name of a database catalog." -msgstr "catalog (opcional): O nome do catálogo do banco de dados. " - -#. Tag: para +#. Tag: programlisting +#: basic_mapping.xml:112 #, no-c-format msgid "" -"default-cascade (optional - defaults to none): a default cascade style." +"@Entity\n" +"@Table(name=\"TBL_FLIGHT\", \n" +" schema=\"AIR_COMMAND\", \n" +" uniqueConstraints=\n" +" @UniqueConstraint(\n" +" name=\"flight_number\", \n" +" columnNames={\"comp_prefix\", \"flight_number\"} ) )\n" +"public class Flight implements Serializable {\n" +" @Column(name=\"comp_prefix\")\n" +" public String getCompagnyPrefix() { return companyPrefix; }\n" +"\n" +" @Column(name=\"flight_number\")\n" +" public String getNumber() { return number; }\n" +"}" msgstr "" -"default-cascade (opcional – o padrão é none): Um estilo cascata padrão." #. Tag: para +#: basic_mapping.xml:114 #, no-c-format msgid "" -"default-access (optional - defaults to property): the strategy Hibernate should use for accessing all properties. " -"It can be a custom implementation of PropertyAccessor." +"The constraint name is optional (generated if left undefined). The column " +"names composing the constraint correspond to the column names as defined " +"before the Hibernate NamingStrategy is applied." msgstr "" -"default-access (opcional – o padrão é property): A estratégia que o Hibernate deve utilizar para acessar todas as " -"propridades. Pode ser uma implementação personalizada de " -"PropertyAccessor." #. Tag: para +#: basic_mapping.xml:119 #, no-c-format msgid "" -"default-lazy (optional - defaults to true): the default value for unspecified lazy " -"attributes of class and collection mappings." +"@Entity.name lets you define the shortcut name of the " +"entity you can used in JP-QL and HQL queries. It defaults to the unqualified " +"class name of the class." msgstr "" -"default-lazy (opcional - o padrão é true): O valor padrão para atributos lazy não " -"especificados da classe e dos mapeamentos de coleções." #. Tag: para +#: basic_mapping.xml:123 #, no-c-format msgid "" -"auto-import (optional - defaults to true): specifies whether we can use unqualified class names of classes " -"in this mapping in the query language." +"Hibernate goes beyond the JPA specification and provide additional " +"configurations. Some of them are hosted on @org.hibernate." +"annotations.Entity:" msgstr "" -"auto-import (opcional - o padrão é true): Especifica se podemos usar nomes de classes não qualificados, das " -"classes deste mapeamento, na linguagem de consulta." #. Tag: para -#, no-c-format +#: basic_mapping.xml:129 +#, fuzzy, no-c-format msgid "" -"package (optional): specifies a package prefix to use for " -"unqualified class names in the mapping document." +"dynamicInsert / dynamicUpdate " +"(defaults to false): specifies that INSERT / " +"UPDATE SQL should be generated at runtime and contain " +"only the columns whose values are not null. The dynamic-update and dynamic-insert settings are not inherited by " +"subclasses. Although these settings can increase performance in some cases, " +"they can actually decrease performance in others." msgstr "" -"package (opcional): Especifica um prefixo do pacote a ser " -"considerado para nomes de classes não qualificadas no documento de " -"mapeamento. " +"Observe que as configurações dynamic-update e " +"dynamic-insert não são herdadas pelas subclasses e assim " +"podem também ser especificadas em elementos <subclass> ou <joined-subclass>. Estas configurações " +"podem incrementar o desempenho em alguns casos, mas podem realmente diminuir " +"o desempenho em outras. " #. Tag: para -#, no-c-format +#: basic_mapping.xml:140 +#, fuzzy, no-c-format msgid "" -"If you have two persistent classes with the same unqualified name, you " -"should set auto-import=\"false\". An exception will " -"result if you attempt to assign two classes to the same \"imported\" name." +"selectBeforeUpdate (defaults to false): specifies that " +"Hibernate should never perform an SQL UPDATE unless it is certain that an object is actually modified. Only when " +"a transient object has been associated with a new session using " +"update(), will Hibernate perform an extra SQL " +"SELECT to determine if an UPDATE is " +"actually required. Use of select-before-update will " +"usually decrease performance. It is useful to prevent a database update " +"trigger being called unnecessarily if you reattach a graph of detached " +"instances to a Session." msgstr "" -"Se você tem duas classes persistentes com o mesmo nome (não qualificadas), " -"você deve ajustar auto-import=\"false\". Caso você tentar " -"ajustar duas classes para o mesmo nome \"importado\", isto resultará numa " -"exceção." +"select-before-update (opcional, valor padrão " +"false): Especifica que o Hibernate nunca deve executar um SQL de UPDATE a não ser que " +"seja certo que um objeto está atualmente modificado. Em certos casos (na " +"verdade, apenas quando um objeto transiente foi associado a uma nova sessão " +"utilizando update()), isto significa que o Hibernate irá " +"executar uma instrução SQL de SELECT adicional para " +"determinar se um UPDATE é necessário nesse momento." #. Tag: para -#, no-c-format +#: basic_mapping.xml:154 +#, fuzzy, no-c-format msgid "" -"The hibernate-mapping element allows you to nest several " -"persistent <class> mappings, as shown above. It is, " -"however, good practice (and expected by some tools) to map only a single " -"persistent class, or a single class hierarchy, in one mapping file and name " -"it after the persistent superclass. For example, Cat.hbm.xml, Dog.hbm.xml, or if using inheritance, " -"Animal.hbm.xml." +"polymorphisms (defaults to IMPLICIT): " +"determines whether implicit or explicit query polymorphisms is used. " +"Implicit polymorphisms means that instances of the " +"class will be returned by a query that names any superclass or implemented " +"interface or class, and that instances of any subclass of the class will be " +"returned by a query that names the class itself. Explicit polymorphisms means that class instances will be returned only by " +"queries that explicitly name that class. Queries that name the class will " +"return only instances of subclasses mapped. For most purposes, the default " +"polymorphisms=IMPLICIT is appropriate. Explicit " +"polymorphisms is useful when two different classes are mapped to the same " +"table This allows a \"lightweight\" class that contains a subset of the " +"table columns." msgstr "" -"Observe que o elemento hibernate-mapping permite que você " -"aninhe diversos mapeamentos de <class> " -"persistentes, como mostrado abaixo. Entretanto, é uma boa prática (e " -"esperado por algumas ferramentas) o mapeamento de apenas uma classe " -"persistente simples (ou uma hierarquia de classes simples) em um arquivo de " -"mapeamento e nomeá-la após a superclasse persistente, por exemplo: " -"Cat.hbm.xml, Dog.hbm.xml, ou se " -"estiver usando herança, Animal.hbm.xml. " - -#. Tag: title -#, no-c-format -msgid "Class" -msgstr "Classe" +"Polimorfismo implícito significa que instâncias de uma " +"classe serão retornadas por uma consulta que dá nome a qualquer superclasse " +"ou interface e classe implementada, além das instâncias de qualquer " +"subclasse da classe serão retornadas por uma consulta que nomeia a classe " +"por si. Polimorfismo explícito significa que instâncias " +"da classe serão retornadas apenas por consultas que explicitamente nomeiam a " +"classe e que as consultas que nomeiam as classes irão retornar apenas " +"instâncias de subclasses mapeadas dentro da declaração <class>" +" como uma <subclass> ou <" +"joined-subclass>. Para a maioria dos casos, o valor padrão " +"polymorphism=\"implicit\", é apropriado. Polimorfismo " +"explicito é útil quando duas classes distintas estão mapeadas para a mesma " +"tabela. Isso aceita uma classe \"peso leve\" que contém um subconjunto de " +"colunas da tabela. " #. Tag: para +#: basic_mapping.xml:171 +#, fuzzy, no-c-format +msgid "" +"persister: specifies a custom ClassPersister. The persister attribute lets you customize the " +"persistence strategy used for the class. You can, for example, specify your " +"own subclass of org.hibernate.persister.EntityPersister, " +"or you can even provide a completely new implementation of the interface " +"org.hibernate.persister.ClassPersister that implements, " +"for example, persistence via stored procedure calls, serialization to flat " +"files or LDAP. See org.hibernate.test.CustomPersister for " +"a simple example of \"persistence\" to a Hashtable." +msgstr "" +"O atributo persister deixa você customizar a estratégia " +"de persistência utilizada para a classe. Você pode, por exemplo, especificar " +"sua própria subclasse do org.hibernate.persister.EntityPersister ou você pode criar uma implementação completamente nova da " +"interface org.hibernate.persister.ClassPersister que " +"implementa a persistência através de, por exemplo, chamadas a procedimentos " +"armazenados, serialização de arquivos planos ou LDAP. Veja org." +"hibernate.test.CustomPersister para um exemplo simples de " +"\"persistência\" para uma Hashtable." + +#. Tag: para +#: basic_mapping.xml:185 +#, fuzzy, no-c-format +msgid "" +"optimisticLock (defaults to VERSION): " +"determines the optimistic locking strategy. If you enable " +"dynamicUpdate, you will have a choice of optimistic " +"locking strategies:" +msgstr "" +"Se você ativar dynamic-update, você terá de escolher a " +"estratégia de bloqueio otimista:" + +#. Tag: para +#: basic_mapping.xml:192 +#, no-c-format +msgid "version: check the version/timestamp columns" +msgstr "version: verifica as colunas de versão/timestamp" + +#. Tag: para +#: basic_mapping.xml:197 +#, no-c-format +msgid "all: check all columns" +msgstr "all: verifica todas as colunas" + +#. Tag: para +#: basic_mapping.xml:201 #, no-c-format msgid "" -"You can declare a persistent class using the class " -"element. For example:" +"dirty: check the changed columns, allowing some " +"concurrent updates" +msgstr "" +"dirty: verifica as colunas modificadas, permitindo " +"algumas atualizações concorrentes" + +#. Tag: para +#: basic_mapping.xml:206 +#, no-c-format +msgid "none: do not use optimistic locking" +msgstr "none: não utiliza o bloqueio otimista" + +#. Tag: para +#: basic_mapping.xml:211 +#, no-c-format +msgid "" +"It is strongly recommended that you use version/" +"timestamp columns for optimistic locking with Hibernate. This strategy " +"optimizes performance and correctly handles modifications made to detached " +"instances (i.e. when Session.merge() is used)." +msgstr "" +"Nós realmente recomendamos que você utilize as colunas " +"de versão/timestamp para o bloqueio otimista com o Hibernate. Esta é a " +"melhor estratégia em relação ao desempenho e é a única estratégia que trata " +"corretamente as modificações efetuadas em instâncias desconectadas (por " +"exemplo, quando Session.merge() é utilizado)." + +#. Tag: para +#: basic_mapping.xml:220 +#, no-c-format +msgid "" +"Be sure to import @javax.persistence.Entity to mark a " +"class as an entity. It's a common mistake to import @org." +"hibernate.annotations.Entity by accident." +msgstr "" + +#. Tag: para +#: basic_mapping.xml:227 +#, fuzzy, no-c-format +msgid "" +"Some entities are not mutable. They cannot be updated or deleted by the " +"application. This allows Hibernate to make some minor performance " +"optimizations.. Use the @Immutable annotation." +msgstr "" +"Classes imutáveis, mutable=\"false\", não podem ser " +"modificadas ou excluídas pela aplicação. Isso permite que o Hibernate " +"aperfeiçoe o desempenho. " + +#. Tag: para +#: basic_mapping.xml:232 +#, fuzzy, no-c-format +msgid "" +"You can also alter how Hibernate deals with lazy initialization for this " +"class. On @Proxy, use lazy=false " +"to disable lazy fetching (not recommended). You can also specify an " +"interface to use for lazy initializing proxies (defaults to the class " +"itself): use proxyClass on @Proxy. " +"Hibernate will initially return proxies (Javassist or CGLIB) that implement " +"the named interface. The persistent object will load when a method of the " +"proxy is invoked. See \"Initializing collections and proxies\" below." +msgstr "" +"A função opcional proxy habilita a inicialização lazy das " +"instâncias persistentes da classe. O Hibernate irá retornar CGLIB proxies " +"como implementado na interface nomeada. O objeto persistente atual será " +"carregado quando um método do proxy for invocado. Veja \"Inicialização de " +"Coleções e Proxies\" abaixo. " + +#. Tag: para +#: basic_mapping.xml:243 +#, no-c-format +msgid "" +"@BatchSize specifies a \"batch size\" for fetching " +"instances of this class by identifier. Not yet loaded instances are loaded " +"batch-size at a time (default 1)." +msgstr "" + +#. Tag: para +#: basic_mapping.xml:247 +#, fuzzy, no-c-format +msgid "" +"You can specific an arbitrary SQL WHERE condition to be used when retrieving " +"objects of this class. Use @Where for that." +msgstr "" +"where (opicional): Especifica um comando SQL " +"WHERE arbitrário para ser usado quando da recuperação de " +"objetos desta classe." + +#. Tag: para +#: basic_mapping.xml:251 +#, fuzzy, no-c-format +msgid "" +"In the same vein, @Check lets you define an SQL " +"expression used to generate a multi-row check " +"constraint for automatic schema generation." +msgstr "" +"check (opcional): Uma expressão SQL utilizada para gerar " +"uma restrição de verificação de múltiplas linhas para a " +"geração automática do esquema. " + +#. Tag: para +#: basic_mapping.xml:255 +#, fuzzy, no-c-format +msgid "" +"There is no difference between a view and a base table for a Hibernate " +"mapping. This is transparent at the database level, although some DBMS do " +"not support views properly, especially with updates. Sometimes you want to " +"use a view, but you cannot create one in the database (i.e. with a legacy " +"schema). In this case, you can map an immutable and read-only entity to a " +"given SQL subselect expression using @org.hibernate.annotations." +"Subselect:" +msgstr "" +"Não há diferença entre uma visão e uma tabela para o mapeamento do " +"Hibernate, e como esperado isto é transparente no nível do banco de dados, " +"mesmo que alguns bancos de dados não suportam visões apropriadamente, " +"especialmente com atualizações. Algumas vezes, você quer utilizar uma visão, " +"mas não pode criá-la no banco de dados (por exemplo, com um esquema legado). " +"Neste caso, você pode mapear uma entidade imutável e de somente leitura, " +"para uma dada expressão de subseleção SQL: " + +#. Tag: programlisting +#: basic_mapping.xml:263 +#, no-c-format +msgid "" +"@Entity\n" +"@Subselect(\"select item.name, max(bid.amount), count(*) \"\n" +" + \"from item \"\n" +" + \"join bid on bid.item_id = item.id \"\n" +" + \"group by item.name\")\n" +"@Synchronize( {\"item\", \"bid\"} ) //tables impacted\n" +"public class Summary {\n" +" @Id\n" +" public String getId() { return id; }\n" +" ...\n" +"}" +msgstr "" + +#. Tag: para +#: basic_mapping.xml:265 +#, no-c-format +msgid "" +"Declare the tables to synchronize this entity with, ensuring that auto-flush " +"happens correctly and that queries against the derived entity do not return " +"stale data. The <subselect> is available both as an " +"attribute and a nested mapping element." +msgstr "" +"Declare as tabelas para sincronizar com esta entidade, garantindo que a auto-" +"liberação ocorra corretamente, e que as consultas para esta entidade " +"derivada não retornem dados desatualizados. O <subselect> está disponível tanto como um atributo como um elemento mapeado " +"aninhado." + +#. Tag: para +#: basic_mapping.xml:270 +#, fuzzy, no-c-format +msgid "" +"We will now explore the same options using the hbm.xml structure. You can " +"declare a persistent class using the class element. For " +"example:" msgstr "" "Você pode declarar uma classe persistente utilizando o elemento " "class. Por exemplo:" +#. Tag: programlisting +#: basic_mapping.xml:319 +#, no-c-format +msgid "" +"<class\n" +" name=\"ClassName\"\n" +" table=\"tableName\"\n" +" discriminator-value=\"discriminator_value\"\n" +" mutable=\"true|false\"\n" +" schema=\"owner\"\n" +" catalog=\"catalog\"\n" +" proxy=\"ProxyInterface\"\n" +" dynamic-update=\"true|false\"\n" +" dynamic-insert=\"true|false\"\n" +" select-before-update=\"true|false\"\n" +" polymorphism=\"implicit|explicit\"\n" +" where=\"arbitrary sql where condition\"\n" +" persister=\"PersisterClass\"\n" +" batch-size=\"N\"\n" +" optimistic-lock=\"none|version|dirty|all\"\n" +" lazy=\"true|false\"\n" +" entity-name=\"EntityName\"\n" +" check=\"arbitrary sql check condition\"\n" +" rowid=\"rowid\"\n" +" subselect=\"SQL expression\"\n" +" abstract=\"true|false\"\n" +" node=\"element-name\"\n" +"/>" +msgstr "" + #. Tag: para +#: basic_mapping.xml:323 #, no-c-format msgid "" "name (optional): the fully qualified Java class name of " @@ -411,6 +804,7 @@ msgstr "" "assume-se que o mapeamento é para entidades não-POJO. " #. Tag: para +#: basic_mapping.xml:330 #, no-c-format msgid "" "table (optional - defaults to the unqualified class " @@ -420,6 +814,7 @@ msgstr "" "qualificadas): O nome da sua tabela do banco de dados." #. Tag: para +#: basic_mapping.xml:335 #, no-c-format msgid "" "discriminator-value (optional - defaults to the class " @@ -433,6 +828,7 @@ msgstr "" "not null. " #. Tag: para +#: basic_mapping.xml:343 #, no-c-format msgid "" "mutable (optional - defaults to true): " @@ -442,6 +838,7 @@ msgstr "" "literal>): Especifica quais instâncias da classe são (ou não) mutáveis." #. Tag: para +#: basic_mapping.xml:349 basic_mapping.xml:2912 #, no-c-format msgid "" "schema (optional): overrides the schema name specified by " @@ -451,6 +848,7 @@ msgstr "" "especificado pelo elemento raíz <hibernate-mapping>." #. Tag: para +#: basic_mapping.xml:355 basic_mapping.xml:2918 #, no-c-format msgid "" "catalog (optional): overrides the catalog name specified " @@ -460,6 +858,7 @@ msgstr "" "especificado pelo elemento raíz <hibernate-mapping>." #. Tag: para +#: basic_mapping.xml:361 #, no-c-format msgid "" "proxy (optional): specifies an interface to use for lazy " @@ -470,6 +869,7 @@ msgstr "" "da própria classe. " #. Tag: para +#: basic_mapping.xml:367 #, no-c-format msgid "" "dynamic-update (optional - defaults to falsedynamic-insert (optional - defaults to falseselect-before-update (optional - defaults to " @@ -514,10 +916,11 @@ msgstr "" "determinar se um UPDATE é necessário nesse momento." #. Tag: para -#, no-c-format +#: basic_mapping.xml:393 +#, fuzzy, no-c-format msgid "" -"polymorphism (optional - defaults to implicit): determines whether implicit or explicit query polymorphism is " +"polymorphisms (optional - defaults to implicit): determines whether implicit or explicit query polymorphisms is " "used." msgstr "" "polymorphism (opcional, padrão para implicitwhere (optional): specifies an arbitrary SQL " @@ -536,6 +940,7 @@ msgstr "" "objetos desta classe." #. Tag: para +#: basic_mapping.xml:405 #, no-c-format msgid "" "persister (optional): specifies a custom " @@ -545,6 +950,7 @@ msgstr "" "ClassPersister customizada." #. Tag: para +#: basic_mapping.xml:410 #, no-c-format msgid "" "batch-size (optional - defaults to 1): " @@ -556,6 +962,7 @@ msgstr "" "classe pela identificação." #. Tag: para +#: basic_mapping.xml:416 #, no-c-format msgid "" "optimistic-lock (optional - defaults to version): Determina a estratégia de bloqueio." #. Tag: para +#: basic_mapping.xml:422 #, no-c-format msgid "" "lazy (optional): lazy fetching can be disabled by setting " @@ -574,14 +982,15 @@ msgstr "" "completamente desabilitada, ajustando lazy=\"false\"." #. Tag: para -#, no-c-format +#: basic_mapping.xml:427 +#, fuzzy, no-c-format msgid "" "entity-name (optional - defaults to the class name): " "Hibernate3 allows a class to be mapped multiple times, potentially to " "different tables. It also allows entity mappings that are represented by " "Maps or XML at the Java level. In these cases, you should provide an " "explicit arbitrary name for the entity. See and for more information." +"classes-dynamicmodels\"/> and for more information." msgstr "" "entity-name (opcional - padrão para o nome da classe): O " "Hibernate3 permite uma classe ser mapeada múltiplas vezes, potencialmente " @@ -592,6 +1001,7 @@ msgstr "" "para maiores informações." #. Tag: para +#: basic_mapping.xml:437 #, no-c-format msgid "" "check (optional): an SQL expression used to generate a " @@ -603,6 +1013,7 @@ msgstr "" "geração automática do esquema. " #. Tag: para +#: basic_mapping.xml:443 #, no-c-format msgid "" "rowid (optional): Hibernate can use ROWIDs on databases. " @@ -619,6 +1030,7 @@ msgstr "" "uma determinada tuple armazenada. " #. Tag: para +#: basic_mapping.xml:452 #, no-c-format msgid "" "subselect (optional): maps an immutable and read-only " @@ -631,6 +1043,7 @@ msgstr "" "informações. " #. Tag: para +#: basic_mapping.xml:459 #, no-c-format msgid "" "abstract (optional): is used to mark abstract " @@ -640,6 +1053,7 @@ msgstr "" "abstratas em hierarquias <union-subclass>. " #. Tag: para +#: basic_mapping.xml:466 #, no-c-format msgid "" "It is acceptable for the named persistent class to be an interface. You can " @@ -656,206 +1070,50 @@ msgstr "" "Foo$Bar. " #. Tag: para +#: basic_mapping.xml:472 +#, no-c-format +msgid "Here is how to do a virtual view (subselect) in XML:" +msgstr "" + +#. Tag: programlisting +#: basic_mapping.xml:474 #, no-c-format msgid "" -"Immutable classes, mutable=\"false\", cannot be updated " -"or deleted by the application. This allows Hibernate to make some minor " -"performance optimizations." +"<class name=\"Summary\">\n" +" <subselect>\n" +" select item.name, max(bid.amount), count(*)\n" +" from item\n" +" join bid on bid.item_id = item.id\n" +" group by item.name\n" +" </subselect>\n" +" <synchronize table=\"item\"/>\n" +" <synchronize table=\"bid\"/>\n" +" <id name=\"name\"/>\n" +" ...\n" +"</class>" msgstr "" -"Classes imutáveis, mutable=\"false\", não podem ser " -"modificadas ou excluídas pela aplicação. Isso permite que o Hibernate " -"aperfeiçoe o desempenho. " #. Tag: para +#: basic_mapping.xml:476 #, no-c-format msgid "" -"The optional proxy attribute enables lazy initialization " -"of persistent instances of the class. Hibernate will initially return CGLIB " -"proxies that implement the named interface. The persistent object will load " -"when a method of the proxy is invoked. See \"Initializing collections and " -"proxies\" below." +"The <subselect> is available both as an attribute " +"and a nested mapping element." msgstr "" -"A função opcional proxy habilita a inicialização lazy das " -"instâncias persistentes da classe. O Hibernate irá retornar CGLIB proxies " -"como implementado na interface nomeada. O objeto persistente atual será " -"carregado quando um método do proxy for invocado. Veja \"Inicialização de " -"Coleções e Proxies\" abaixo. " - -#. Tag: para -#, no-c-format -msgid "" -"Implicit polymorphism means that instances of the class " -"will be returned by a query that names any superclass or implemented " -"interface or class, and that instances of any subclass of the class will be " -"returned by a query that names the class itself. Explicit polymorphism means that class instances will be returned only by " -"queries that explicitly name that class. Queries that name the class will " -"return only instances of subclasses mapped inside this <class>" -" declaration as a <subclass> or " -"<joined-subclass>. For most purposes, the default " -"polymorphism=\"implicit\" is appropriate. Explicit " -"polymorphism is useful when two different classes are mapped to the same " -"table This allows a \"lightweight\" class that contains a subset of the " -"table columns." -msgstr "" -"Polimorfismo implícito significa que instâncias de uma " -"classe serão retornadas por uma consulta que dá nome a qualquer superclasse " -"ou interface e classe implementada, além das instâncias de qualquer " -"subclasse da classe serão retornadas por uma consulta que nomeia a classe " -"por si. Polimorfismo explícito significa que instâncias " -"da classe serão retornadas apenas por consultas que explicitamente nomeiam a " -"classe e que as consultas que nomeiam as classes irão retornar apenas " -"instâncias de subclasses mapeadas dentro da declaração <class>" -" como uma <subclass> ou <" -"joined-subclass>. Para a maioria dos casos, o valor padrão " -"polymorphism=\"implicit\", é apropriado. Polimorfismo " -"explicito é útil quando duas classes distintas estão mapeadas para a mesma " -"tabela. Isso aceita uma classe \"peso leve\" que contém um subconjunto de " -"colunas da tabela. " - -#. Tag: para -#, no-c-format -msgid "" -"The persister attribute lets you customize the " -"persistence strategy used for the class. You can, for example, specify your " -"own subclass of org.hibernate.persister.EntityPersister, " -"or you can even provide a completely new implementation of the interface " -"org.hibernate.persister.ClassPersister that implements, " -"for example, persistence via stored procedure calls, serialization to flat " -"files or LDAP. See org.hibernate.test.CustomPersister for " -"a simple example of \"persistence\" to a Hashtable." -msgstr "" -"O atributo persister deixa você customizar a estratégia " -"de persistência utilizada para a classe. Você pode, por exemplo, especificar " -"sua própria subclasse do org.hibernate.persister.EntityPersister ou você pode criar uma implementação completamente nova da " -"interface org.hibernate.persister.ClassPersister que " -"implementa a persistência através de, por exemplo, chamadas a procedimentos " -"armazenados, serialização de arquivos planos ou LDAP. Veja org." -"hibernate.test.CustomPersister para um exemplo simples de " -"\"persistência\" para uma Hashtable." - -#. Tag: para -#, no-c-format -msgid "" -"The dynamic-update and dynamic-insert " -"settings are not inherited by subclasses, so they can also be specified on " -"the <subclass> or <joined-subclass> elements. Although these settings can increase performance in some " -"cases, they can actually decrease performance in others." -msgstr "" -"Observe que as configurações dynamic-update e " -"dynamic-insert não são herdadas pelas subclasses e assim " -"podem também ser especificadas em elementos <subclass> ou <joined-subclass>. Estas configurações " -"podem incrementar o desempenho em alguns casos, mas podem realmente diminuir " -"o desempenho em outras. " - -#. Tag: para -#, no-c-format -msgid "" -"Use of select-before-update will usually decrease " -"performance. It is useful to prevent a database update trigger being called " -"unnecessarily if you reattach a graph of detached instances to a " -"Session." -msgstr "" -"O uso de select-before-update geralmente irá diminuir o " -"desempenho. Ela é muito útil para prevenir que um trigger de atualização no " -"banco de dados seja ativado desnecessariamente, se você reconectar um nó de " -"uma instância desconectada em uma Session." - -#. Tag: para -#, no-c-format -msgid "" -"If you enable dynamic-update, you will have a choice of " -"optimistic locking strategies:" -msgstr "" -"Se você ativar dynamic-update, você terá de escolher a " -"estratégia de bloqueio otimista:" - -#. Tag: para -#, no-c-format -msgid "version: check the version/timestamp columns" -msgstr "version: verifica as colunas de versão/timestamp" - -#. Tag: para -#, no-c-format -msgid "all: check all columns" -msgstr "all: verifica todas as colunas" - -#. Tag: para -#, no-c-format -msgid "" -"dirty: check the changed columns, allowing some " -"concurrent updates" -msgstr "" -"dirty: verifica as colunas modificadas, permitindo " -"algumas atualizações concorrentes" - -#. Tag: para -#, no-c-format -msgid "none: do not use optimistic locking" -msgstr "none: não utiliza o bloqueio otimista" - -#. Tag: para -#, no-c-format -msgid "" -"It is strongly recommended that you use version/" -"timestamp columns for optimistic locking with Hibernate. This strategy " -"optimizes performance and correctly handles modifications made to detached " -"instances (i.e. when Session.merge() is used)." -msgstr "" -"Nós realmente recomendamos que você utilize as colunas " -"de versão/timestamp para o bloqueio otimista com o Hibernate. Esta é a " -"melhor estratégia em relação ao desempenho e é a única estratégia que trata " -"corretamente as modificações efetuadas em instâncias desconectadas (por " -"exemplo, quando Session.merge() é utilizado)." - -#. Tag: para -#, no-c-format -msgid "" -"There is no difference between a view and a base table for a Hibernate " -"mapping. This is transparent at the database level, although some DBMS do " -"not support views properly, especially with updates. Sometimes you want to " -"use a view, but you cannot create one in the database (i.e. with a legacy " -"schema). In this case, you can map an immutable and read-only entity to a " -"given SQL subselect expression:" -msgstr "" -"Não há diferença entre uma visão e uma tabela para o mapeamento do " -"Hibernate, e como esperado isto é transparente no nível do banco de dados, " -"mesmo que alguns bancos de dados não suportam visões apropriadamente, " -"especialmente com atualizações. Algumas vezes, você quer utilizar uma visão, " -"mas não pode criá-la no banco de dados (por exemplo, com um esquema legado). " -"Neste caso, você pode mapear uma entidade imutável e de somente leitura, " -"para uma dada expressão de subseleção SQL: " - -#. Tag: para -#, no-c-format -msgid "" -"Declare the tables to synchronize this entity with, ensuring that auto-flush " -"happens correctly and that queries against the derived entity do not return " -"stale data. The <subselect> is available both as an " -"attribute and a nested mapping element." -msgstr "" -"Declare as tabelas para sincronizar com esta entidade, garantindo que a auto-" -"liberação ocorra corretamente, e que as consultas para esta entidade " -"derivada não retornem dados desatualizados. O <subselect> está disponível tanto como um atributo como um elemento mapeado " -"aninhado." #. Tag: title -#, no-c-format -msgid "id" -msgstr "id" +#: basic_mapping.xml:481 +#, fuzzy, no-c-format +msgid "Identifiers" +msgstr "Identificadores atribuídos" #. Tag: para -#, no-c-format +#: basic_mapping.xml:483 +#, fuzzy, no-c-format msgid "" "Mapped classes must declare the primary key column of " "the database table. Most classes will also have a JavaBeans-style property " -"holding the unique identifier of an instance. The <id> element defines the mapping from that property to the primary key " -"column." +"holding the unique identifier of an instance." msgstr "" "Classes mapeadas devem declarar a coluna de chave " "primária da tabela do banco de dados. Muitas classes irão também ter uma " @@ -864,16 +1122,66 @@ msgstr "" "desta propriedade para a chave primária." #. Tag: para +#: basic_mapping.xml:488 #, no-c-format -msgid "name (optional): the name of the identifier property." -msgstr "name (opcional): O nome da propriedade do identificador." +msgid "Mark the identifier property with @Id." +msgstr "" + +#. Tag: programlisting +#: basic_mapping.xml:491 +#, no-c-format +msgid "" +"@Entity\n" +"public class Person {\n" +" @Id Integer getId() { ... }\n" +" ...\n" +"}" +msgstr "" #. Tag: para +#: basic_mapping.xml:493 +#, fuzzy, no-c-format +msgid "" +"In hbm.xml, use the <id> element which defines the " +"mapping from that property to the primary key column." +msgstr "" +"Observe o uso da tag <column> para mapear uma " +"propriedade para colunas múltiplas." + +#. Tag: programlisting +#: basic_mapping.xml:509 #, no-c-format -msgid "type (optional): a name that indicates the Hibernate type." -msgstr "type (opcional): um nome que indica o tipo de Hibernate." +msgid "" +"<id\n" +" name=\"propertyName\"\n" +" type=\"typename\"\n" +" column=\"column_name\"\n" +" unsaved-value=\"null|any|none|undefined|id_value\"\n" +" access=\"field|property|ClassName\">\n" +" node=\"element-name|@attribute-name|element/@attribute|.\"\n" +"\n" +" <generator class=\"generatorClass\"/>\n" +"</id>" +msgstr "" #. Tag: para +#: basic_mapping.xml:513 +#, no-c-format +msgid "" +"name (optional): the name of the identifier property." +msgstr "" +"name (opcional): O nome da propriedade do identificador." + +#. Tag: para +#: basic_mapping.xml:518 basic_mapping.xml:2141 +#, no-c-format +msgid "" +"type (optional): a name that indicates the Hibernate type." +msgstr "" +"type (opcional): um nome que indica o tipo de Hibernate." + +#. Tag: para +#: basic_mapping.xml:523 #, no-c-format msgid "" "column (optional - defaults to the property name): the " @@ -883,6 +1191,7 @@ msgstr "" "nome coluna chave primária." #. Tag: para +#: basic_mapping.xml:528 #, no-c-format msgid "" "unsaved-value (optional - defaults to a \"sensible\" " @@ -896,6 +1205,7 @@ msgstr "" "que foram salvas ou carregadas em uma sessão anterior. " #. Tag: para +#: basic_mapping.xml:536 #, no-c-format msgid "" "access (optional - defaults to propertyname attribute is missing, it is assumed that the " @@ -916,38 +1227,1044 @@ msgstr "" "classe não tem a propriedade de identificação." #. Tag: para -#, no-c-format +#: basic_mapping.xml:546 +#, fuzzy, no-c-format msgid "" "The unsaved-value attribute is almost never needed in " -"Hibernate3." +"Hibernate3 and indeed has no corresponding element in annotations." msgstr "" "A função unsaved-value não é mais necessária no Hibernate " "3." #. Tag: para -#, no-c-format +#: basic_mapping.xml:550 +#, fuzzy, no-c-format msgid "" -"There is an alternative <composite-id> declaration " -"that allows access to legacy data with composite keys. Its use is strongly " -"discouraged for anything else." +"You can also declare the identifier as a composite identifier. This allows " +"access to legacy data with composite keys. Its use is strongly discouraged " +"for anything else." msgstr "" "Há uma declaração alternativa <composite-id> que " "permite o acesso à dados legados com chaves compostas. Nós realmente " "desencorajamos o uso deste para qualquer outra função." #. Tag: title -#, no-c-format -msgid "Generator" -msgstr "Gerador" +#: basic_mapping.xml:555 +#, fuzzy, no-c-format +msgid "Composite identifier" +msgstr "Identificadores atribuídos" #. Tag: para +#: basic_mapping.xml:557 +#, no-c-format +msgid "You can define a composite primary key through several syntaxes:" +msgstr "" + +#. Tag: para +#: basic_mapping.xml:562 #, no-c-format msgid "" -"The optional <generator> child element names a Java " -"class used to generate unique identifiers for instances of the persistent " -"class. If any parameters are required to configure or initialize the " -"generator instance, they are passed using the <param> element." +"use a component type to represent the identifier and map it as a property in " +"the entity: you then annotated the property as @EmbeddedId. The component type has to be Serializable." +msgstr "" + +#. Tag: para +#: basic_mapping.xml:569 +#, no-c-format +msgid "" +"map multiple properties as @Id properties: the " +"identifier type is then the entity class itself and needs to be " +"Serializable. This approach is unfortunately not " +"standard and only supported by Hibernate." +msgstr "" + +#. Tag: para +#: basic_mapping.xml:577 +#, no-c-format +msgid "" +"map multiple properties as @Id properties and declare " +"an external class to be the identifier type. This class, which needs to be " +"Serializable, is declared on the entity via the " +"@IdClass annotation. The identifier type must contain " +"the same properties as the identifier properties of the entity: each " +"property name must be the same, its type must be the same as well if the " +"entity property is of a basic type, its type must be the type of the primary " +"key of the associated entity if the entity property is an association " +"(either a @OneToOne or a @ManyToOne)." +msgstr "" + +#. Tag: para +#: basic_mapping.xml:592 +#, no-c-format +msgid "" +"As you can see the last case is far from obvious. It has been inherited from " +"the dark ages of EJB 2 for backward compatibilities and we recommend you not " +"to use it (for simplicity sake)." +msgstr "" + +#. Tag: para +#: basic_mapping.xml:596 +#, no-c-format +msgid "Let's explore all three cases using examples." +msgstr "" + +#. Tag: title +#: basic_mapping.xml:599 +#, no-c-format +msgid "id as a property using a component type" +msgstr "" + +#. Tag: para +#: basic_mapping.xml:601 +#, no-c-format +msgid "Here is a simple example of @EmbeddedId." +msgstr "" + +#. Tag: programlisting +#: basic_mapping.xml:604 +#, no-c-format +msgid "" +"@Entity\n" +"class User {\n" +" @EmbeddedId\n" +" @AttributeOverride(name=\"firstName\", column=@Column(name=\"fld_firstname" +"\")\n" +" UserId id;\n" +"\n" +" Integer age;\n" +"}\n" +"\n" +"@Embeddable\n" +"class UserId implements Serializable {\n" +" String firstName;\n" +" String lastName;\n" +"}" +msgstr "" + +#. Tag: para +#: basic_mapping.xml:606 +#, no-c-format +msgid "" +"You can notice that the UserId class is serializable. " +"To override the column mapping, use @AttributeOverride." +msgstr "" + +#. Tag: para +#: basic_mapping.xml:610 +#, no-c-format +msgid "" +"An embedded id can itself contains the primary key of an associated entity." +msgstr "" + +#. Tag: programlisting +#: basic_mapping.xml:613 +#, no-c-format +msgid "" +"@Entity\n" +"class Customer {\n" +" @EmbeddedId CustomerId id;\n" +" boolean preferredCustomer;\n" +"\n" +" @MapsId(\"userId\")\n" +" @JoinColumns({\n" +" @JoinColumn(name=\"userfirstname_fk\", referencedColumnName=\"firstName" +"\"),\n" +" @JoinColumn(name=\"userlastname_fk\", referencedColumnName=\"lastName" +"\")\n" +" })\n" +" @OneToOne User user;\n" +"}\n" +"\n" +"@Embeddable\n" +"class CustomerId implements Serializable {\n" +" UserId userId;\n" +" String customerNumber;\n" +"\n" +" //implements equals and hashCode\n" +"}\n" +"\n" +"@Entity \n" +"class User {\n" +" @EmbeddedId UserId id;\n" +" Integer age;\n" +"}\n" +"\n" +"@Embeddable\n" +"class UserId implements Serializable {\n" +" String firstName;\n" +" String lastName;\n" +"\n" +" //implements equals and hashCode\n" +"}" +msgstr "" + +#. Tag: para +#: basic_mapping.xml:615 +#, no-c-format +msgid "" +"In the embedded id object, the association is represented as the identifier " +"of the associated entity. But you can link its value to a regular " +"association in the entity via the @MapsId annotation. " +"The @MapsId value correspond to the property name of " +"the embedded id object containing the associated entity's identifier. In the " +"database, it means that the Customer.user and the " +"CustomerId.userId properties share the same underlying " +"column (user_fk in this case)." +msgstr "" + +#. Tag: para +#: basic_mapping.xml:627 +#, no-c-format +msgid "" +"The component type used as identifier must implement equals() and hashCode()." +msgstr "" + +#. Tag: para +#: basic_mapping.xml:632 +#, no-c-format +msgid "" +"In practice, your code only sets the Customer.user " +"property and the user id value is copied by Hibernate into the " +"CustomerId.userId property." +msgstr "" + +#. Tag: para +#: basic_mapping.xml:638 +#, no-c-format +msgid "" +"The id value can be copied as late as flush time, don't rely on it until " +"after flush time." +msgstr "" + +#. Tag: para +#: basic_mapping.xml:642 +#, no-c-format +msgid "" +"While not supported in JPA, Hibernate lets you place your association " +"directly in the embedded id component (instead of having to use the " +"@MapsId annotation)." +msgstr "" + +#. Tag: programlisting +#: basic_mapping.xml:646 +#, no-c-format +msgid "" +"@Entity\n" +"class Customer {\n" +" @EmbeddedId CustomerId id;\n" +" boolean preferredCustomer;\n" +"}\n" +"\n" +"@Embeddable\n" +"class CustomerId implements Serializable {\n" +" @OneToOne\n" +" @JoinColumns({\n" +" @JoinColumn(name=\"userfirstname_fk\", referencedColumnName=\"firstName" +"\"),\n" +" @JoinColumn(name=\"userlastname_fk\", referencedColumnName=\"lastName" +"\")\n" +" }) \n" +" User user;\n" +" String customerNumber;\n" +"\n" +" //implements equals and hashCode\n" +"}\n" +"\n" +"@Entity \n" +"class User {\n" +" @EmbeddedId UserId id;\n" +" Integer age;\n" +"}\n" +"\n" +"@Embeddable\n" +"class UserId implements Serializable {\n" +" String firstName;\n" +" String lastName;\n" +"\n" +"\n" +" //implements equals and hashCode\n" +"}" +msgstr "" + +#. Tag: para +#: basic_mapping.xml:648 +#, no-c-format +msgid "Let's now rewrite these examples using the hbm.xml syntax." +msgstr "" + +#. Tag: programlisting +#: basic_mapping.xml:651 +#, no-c-format +msgid "" +"<composite-id\n" +" name=\"propertyName\"\n" +" class=\"ClassName\"\n" +" mapped=\"true|false\"\n" +" access=\"field|property|ClassName\"\n" +" node=\"element-name|.\">\n" +"\n" +" <key-property name=\"propertyName\" type=\"typename\" column=" +"\"column_name\"/>\n" +" <key-many-to-one name=\"propertyName\" class=\"ClassName\" column=" +"\"column_name\"/>\n" +" ......\n" +"</composite-id>" +msgstr "" + +#. Tag: para +#: basic_mapping.xml:653 +#, no-c-format +msgid "First a simple example:" +msgstr "" + +#. Tag: programlisting +#: basic_mapping.xml:655 +#, no-c-format +msgid "" +"<class name=\"User\">\n" +" <composite-id name=\"id\" class=\"UserId\">\n" +" <key-property name=\"firstName\" column=\"fld_firstname\"/>\n" +" <key-property name=\"lastName\"/>\n" +" </composite-id>\n" +"</class>" +msgstr "" + +#. Tag: para +#: basic_mapping.xml:657 +#, no-c-format +msgid "Then an example showing how an association can be mapped." +msgstr "" + +#. Tag: programlisting +#: basic_mapping.xml:660 +#, no-c-format +msgid "" +"<class name=\"Customer\">\n" +" <composite-id name=\"id\" class=\"CustomerId\">\n" +" <key-property name=\"firstName\" column=\"userfirstname_fk\"/>\n" +" <key-property name=\"lastName\" column=\"userfirstname_fk\"/>\n" +" <key-property name=\"customerNumber\"/>\n" +" </composite-id>\n" +"\n" +" <property name=\"preferredCustomer\"/>\n" +"\n" +" <many-to-one name=\"user\">\n" +" <column name=\"userfirstname_fk\" updatable=\"false\" insertable=" +"\"false\"/>\n" +" <column name=\"userlastname_fk\" updatable=\"false\" insertable=" +"\"false\"/>\n" +" </many-to-one>\n" +"</class>\n" +"\n" +"<class name=\"User\">\n" +" <composite-id name=\"id\" class=\"UserId\">\n" +" <key-property name=\"firstName\"/>\n" +" <key-property name=\"lastName\"/>\n" +" </composite-id>\n" +"\n" +" <property name=\"age\"/>\n" +"</class>" +msgstr "" + +#. Tag: para +#: basic_mapping.xml:662 +#, no-c-format +msgid "Notice a few things in the previous example:" +msgstr "" + +#. Tag: para +#: basic_mapping.xml:666 +#, no-c-format +msgid "" +"the order of the properties (and column) matters. It must be the same " +"between the association and the primary key of the associated entity" +msgstr "" + +#. Tag: para +#: basic_mapping.xml:672 +#, no-c-format +msgid "" +"the many to one uses the same columns as the primary key and thus must be " +"marked as read only (insertable and updatable to false)." +msgstr "" + +#. Tag: para +#: basic_mapping.xml:679 +#, no-c-format +msgid "" +"unlike with @MapsId, the id value of the associated " +"entity is not transparently copied, check the foreign id " +"generator for more information." +msgstr "" + +#. Tag: para +#: basic_mapping.xml:686 +#, no-c-format +msgid "" +"The last example shows how to map association directly in the embedded id " +"component." +msgstr "" + +#. Tag: programlisting +#: basic_mapping.xml:689 +#, no-c-format +msgid "" +"<class name=\"Customer\">\n" +" <composite-id name=\"id\" class=\"CustomerId\">\n" +" <key-many-to-one name=\"user\">\n" +" <column name=\"userfirstname_fk\"/>\n" +" <column name=\"userlastname_fk\"/>\n" +" </key-many-to-one>\n" +" <key-property name=\"customerNumber\"/>\n" +" </composite-id>\n" +"\n" +" <property name=\"preferredCustomer\"/>\n" +"</class>\n" +"\n" +"<class name=\"User\">\n" +" <composite-id name=\"id\" class=\"UserId\">\n" +" <key-property name=\"firstName\"/>\n" +" <key-property name=\"lastName\"/>\n" +" </composite-id>\n" +"\n" +" <property name=\"age\"/>\n" +"</class>" +msgstr "" + +#. Tag: para +#: basic_mapping.xml:691 +#, no-c-format +msgid "" +"This is the recommended approach to map composite identifier. The following " +"options should not be considered unless some constraint are present." +msgstr "" + +#. Tag: title +#: basic_mapping.xml:697 +#, no-c-format +msgid "Multiple id properties without identifier type" +msgstr "" + +#. Tag: para +#: basic_mapping.xml:699 +#, no-c-format +msgid "" +"Another, arguably more natural, approach is to place @Id on multiple properties of your entity. This approach is only " +"supported by Hibernate (not JPA compliant) but does not require an extra " +"embeddable component." +msgstr "" + +#. Tag: programlisting +#: basic_mapping.xml:704 +#, no-c-format +msgid "" +"@Entity\n" +"class Customer implements Serializable {\n" +" @Id @OneToOne\n" +" @JoinColumns({\n" +" @JoinColumn(name=\"userfirstname_fk\", referencedColumnName=\"firstName" +"\"),\n" +" @JoinColumn(name=\"userlastname_fk\", referencedColumnName=\"lastName" +"\")\n" +" })\n" +" User user;\n" +" \n" +" @Id String customerNumber;\n" +"\n" +" boolean preferredCustomer;\n" +"\n" +" //implements equals and hashCode\n" +"}\n" +"\n" +"@Entity \n" +"class User {\n" +" @EmbeddedId UserId id;\n" +" Integer age;\n" +"}\n" +"\n" +"@Embeddable\n" +"class UserId implements Serializable {\n" +" String firstName;\n" +" String lastName;\n" +"\n" +" //implements equals and hashCode\n" +"}" +msgstr "" + +#. Tag: para +#: basic_mapping.xml:706 +#, no-c-format +msgid "" +"In this case Customer is its own identifier " +"representation: it must implement Serializable and " +"must implement equals() and hashCode()." +msgstr "" + +#. Tag: para +#: basic_mapping.xml:712 +#, no-c-format +msgid "In hbm.xml, the same mapping is:" +msgstr "" + +#. Tag: programlisting +#: basic_mapping.xml:714 +#, no-c-format +msgid "" +"<class name=\"Customer\">\n" +" <composite-id>\n" +" <key-many-to-one name=\"user\">\n" +" <column name=\"userfirstname_fk\"/>\n" +" <column name=\"userlastname_fk\"/>\n" +" </key-many-to-one>\n" +" <key-property name=\"customerNumber\"/>\n" +" </composite-id>\n" +"\n" +" <property name=\"preferredCustomer\"/>\n" +"</class>\n" +"\n" +"<class name=\"User\">\n" +" <composite-id name=\"id\" class=\"UserId\">\n" +" <key-property name=\"firstName\"/>\n" +" <key-property name=\"lastName\"/>\n" +" </composite-id>\n" +"\n" +" <property name=\"age\"/>\n" +"</class>" +msgstr "" + +#. Tag: title +#: basic_mapping.xml:718 +#, no-c-format +msgid "Multiple id properties with with a dedicated identifier type" +msgstr "" + +#. Tag: para +#: basic_mapping.xml:721 +#, no-c-format +msgid "" +"@IdClass on an entity points to the class (component) " +"representing the identifier of the class. The properties marked " +"@Id on the entity must have their corresponding " +"property on the @IdClass. The return type of search " +"twin property must be either identical for basic properties or must " +"correspond to the identifier class of the associated entity for an " +"association." +msgstr "" + +#. Tag: para +#: basic_mapping.xml:730 +#, no-c-format +msgid "" +"This approach is inherited from the EJB 2 days and we recommend against its " +"use. But, after all it's your application and Hibernate supports it." +msgstr "" + +#. Tag: programlisting +#: basic_mapping.xml:735 +#, no-c-format +msgid "" +"@Entity\n" +"@IdClass(CustomerId.class)\n" +"class Customer implements Serializable {\n" +" @Id @OneToOne\n" +" @JoinColumns({\n" +" @JoinColumn(name=\"userfirstname_fk\", referencedColumnName=\"firstName" +"\"),\n" +" @JoinColumn(name=\"userlastname_fk\", referencedColumnName=\"lastName" +"\")\n" +" }) \n" +" User user;\n" +" \n" +" @Id String customerNumber;\n" +"\n" +" boolean preferredCustomer;\n" +"}\n" +"\n" +"class CustomerId implements Serializable {\n" +" UserId user;\n" +" String customerNumber;\n" +"\n" +" //implements equals and hashCode\n" +"}\n" +"\n" +"@Entity \n" +"class User {\n" +" @EmbeddedId UserId id;\n" +" Integer age;\n" +"\n" +" //implements equals and hashCode\n" +"}\n" +"\n" +"@Embeddable\n" +"class UserId implements Serializable {\n" +" String firstName;\n" +" String lastName;\n" +"\n" +" //implements equals and hashCode\n" +"}" +msgstr "" + +#. Tag: para +#: basic_mapping.xml:737 +#, no-c-format +msgid "" +"Customer and CustomerId do " +"have the same properties customerNumber as well as " +"user. CustomerId must be " +"Serializable and implement equals() and hashCode()." +msgstr "" + +#. Tag: para +#: basic_mapping.xml:745 +#, no-c-format +msgid "" +"While not JPA standard, Hibernate let's you declare the vanilla associated " +"property in the @IdClass." +msgstr "" + +#. Tag: programlisting +#: basic_mapping.xml:749 +#, no-c-format +msgid "" +"@Entity\n" +"@IdClass(CustomerId.class)\n" +"class Customer implements Serializable {\n" +" @Id @OneToOne\n" +" @JoinColumns({\n" +" @JoinColumn(name=\"userfirstname_fk\", referencedColumnName=\"firstName" +"\"),\n" +" @JoinColumn(name=\"userlastname_fk\", referencedColumnName=\"lastName" +"\")\n" +" }) \n" +" User user;\n" +" \n" +" @Id String customerNumber;\n" +"\n" +" boolean preferredCustomer;\n" +"}\n" +"\n" +"class CustomerId implements Serializable {\n" +" @OneToOne User user;\n" +" String customerNumber;\n" +"\n" +" //implements equals and hashCode\n" +"}\n" +"\n" +"@Entity \n" +"class User {\n" +" @EmbeddedId UserId id;\n" +" Integer age;\n" +"\n" +" //implements equals and hashCode\n" +"}\n" +"\n" +"@Embeddable\n" +"class UserId implements Serializable {\n" +" String firstName;\n" +" String lastName;\n" +"}" +msgstr "" + +#. Tag: para +#: basic_mapping.xml:751 +#, no-c-format +msgid "" +"This feature is of limited interest though as you are likely to have chosen " +"the @IdClass approach to stay JPA compliant or you " +"have a quite twisted mind." +msgstr "" + +#. Tag: para +#: basic_mapping.xml:755 +#, no-c-format +msgid "Here are the equivalent on hbm.xml files:" +msgstr "" + +#. Tag: programlisting +#: basic_mapping.xml:757 +#, no-c-format +msgid "" +"<class name=\"Customer\">\n" +" <composite-id class=\"CustomerId\" mapped=\"true\">\n" +" <key-many-to-one name=\"user\">\n" +" <column name=\"userfirstname_fk\"/>\n" +" <column name=\"userlastname_fk\"/>\n" +" </key-many-to-one>\n" +" <key-property name=\"customerNumber\"/>\n" +" </composite-id>\n" +"\n" +" <property name=\"preferredCustomer\"/>\n" +"</class>\n" +"\n" +"<class name=\"User\">\n" +" <composite-id name=\"id\" class=\"UserId\">\n" +" <key-property name=\"firstName\"/>\n" +" <key-property name=\"lastName\"/>\n" +" </composite-id>\n" +"\n" +" <property name=\"age\"/>\n" +"</class>" +msgstr "" + +#. Tag: title +#: basic_mapping.xml:762 +#, fuzzy, no-c-format +msgid "Identifier generator" +msgstr "Aprimoração dos geradores de identificador" + +#. Tag: para +#: basic_mapping.xml:764 +#, no-c-format +msgid "" +"Hibernate can generate and populate identifier values for you automatically. " +"This is the recommended approach over \"business\" or \"natural\" id " +"(especially composite ids)." +msgstr "" + +#. Tag: para +#: basic_mapping.xml:768 +#, no-c-format +msgid "" +"Hibernate offers various generation strategies, let's explore the most " +"common ones first that happens to be standardized by JPA:" +msgstr "" + +#. Tag: para +#: basic_mapping.xml:774 +#, fuzzy, no-c-format +msgid "" +"IDENTITY: supports identity columns in DB2, MySQL, MS SQL Server, Sybase and " +"HypersonicSQL. The returned identifier is of type long, " +"short or int." +msgstr "" +"suporta colunas de identidade em DB2, MySQL, Servidor MS SQL, Sybase e " +"HypersonicSQL. O identificador retornado é do tipo long, " +"short ou int." + +#. Tag: para +#: basic_mapping.xml:781 +#, fuzzy, no-c-format +msgid "" +"SEQUENCE (called seqhilo in Hibernate): uses a hi/lo " +"algorithm to efficiently generate identifiers of type long, short or int, given a named " +"database sequence." +msgstr "" +"utiliza um algoritmo hi/lo para gerar de forma eficiente identificadores do " +"tipo long, short ou int, a partir de uma seqüência de banco de dados fornecida." + +#. Tag: para +#: basic_mapping.xml:788 +#, fuzzy, no-c-format +msgid "" +"TABLE (called MultipleHiLoPerTableGenerator in " +"Hibernate) : uses a hi/lo algorithm to efficiently generate identifiers of " +"type long, short or int, given a table and column as a source of hi values. The hi/lo " +"algorithm generates identifiers that are unique only for a particular " +"database." +msgstr "" +"utiliza um algoritmo hi/lo para gerar de forma eficiente identificadores do " +"tipo long, short ou int, a partir de uma tabela e coluna fornecida (por padrão " +"hibernate_unique_key e next_hi) como " +"fonte para os valores hi. O algoritmo hi/lo gera identificadores que são " +"únicos apenas para um banco de dados específico." + +#. Tag: para +#: basic_mapping.xml:798 +#, fuzzy, no-c-format +msgid "" +"AUTO: selects IDENTITY, SEQUENCE or " +"TABLE depending upon the capabilities of the underlying " +"database." +msgstr "" +"seleciona entre identity, sequenceou " +"hilo dependendo das capacidades do banco de dados " +"utilizado." + +#. Tag: para +#: basic_mapping.xml:805 +#, no-c-format +msgid "" +"We recommend all new projects to use the new enhanced identifier generators. " +"They are deactivated by default for entities using annotations but can be " +"activated using hibernate.id.new_generator_mappings=true. These " +"new generators are more efficient and closer to the JPA 2 specification " +"semantic." +msgstr "" + +#. Tag: para +#: basic_mapping.xml:812 +#, no-c-format +msgid "" +"However they are not backward compatible with existing Hibernate based " +"application (if a sequence or a table is used for id generation). See " +"XXXXXXX for more information on how " +"to activate them." +msgstr "" + +#. Tag: para +#: basic_mapping.xml:818 +#, no-c-format +msgid "" +"To mark an id property as generated, use the @GeneratedValue annotation. You can specify the strategy used (default to " +"AUTO) by setting strategy." +msgstr "" + +#. Tag: programlisting +#: basic_mapping.xml:823 +#, no-c-format +msgid "" +"@Entity\n" +"public class Customer {\n" +" @Id @GeneratedValue\n" +" Integer getId() { ... };\n" +"}\n" +"\n" +"@Entity \n" +"public class Invoice {\n" +" @Id @GeneratedValue(strategy=GenerationType.IDENTITY)\n" +" Integer getId() { ... };\n" +"}" +msgstr "" + +#. Tag: para +#: basic_mapping.xml:825 +#, no-c-format +msgid "" +"SEQUENCE and TABLE require additional " +"configurations that you can set using @SequenceGenerator and @TableGenerator:" +msgstr "" + +#. Tag: para +#: basic_mapping.xml:832 +#, fuzzy, no-c-format +msgid "name: name of the generator" +msgstr "name: O nome da propriedade. " + +#. Tag: para +#: basic_mapping.xml:836 +#, fuzzy, no-c-format +msgid "" +"table / sequenceName: name of the " +"table or the sequence (defaulting respectively to " +"hibernate_sequences and hibernate_sequence)" +msgstr "" +"sequence_name (opcional - valor padrão " +"hibernate_sequence) o nome da seqüência ou tabela a ser " +"usada." + +#. Tag: para +#: basic_mapping.xml:843 +#, fuzzy, no-c-format +msgid "catalog / schema:" +msgstr "serializable" + +#. Tag: para +#: basic_mapping.xml:848 +#, fuzzy, no-c-format +msgid "" +"initialValue: the value from which the id is to start " +"generating" +msgstr "table: O nome da tabela associada. " + +#. Tag: para +#: basic_mapping.xml:853 +#, no-c-format +msgid "" +"allocationSize: the amount to increment by when " +"allocating id numbers from the generator" +msgstr "" + +#. Tag: para +#: basic_mapping.xml:858 +#, no-c-format +msgid "" +"In addition, the TABLE strategy also let you " +"customize:" +msgstr "" + +#. Tag: para +#: basic_mapping.xml:863 +#, fuzzy, no-c-format +msgid "" +"pkColumnName: the column name containing the entity " +"identifier" +msgstr "name: O nome da propriedade. " + +#. Tag: para +#: basic_mapping.xml:868 +#, fuzzy, no-c-format +msgid "" +"valueColumnName: the column name containing the " +"identifier value" +msgstr "" +"name (opcional): O nome da propriedade do identificador." + +#. Tag: para +#: basic_mapping.xml:873 +#, fuzzy, no-c-format +msgid "pkColumnValue: the entity identifier" +msgstr "id-type: o tipo identificador." + +#. Tag: para +#: basic_mapping.xml:878 +#, no-c-format +msgid "" +"uniqueConstraints: any potential column constraint on the " +"table containing the ids" +msgstr "" + +#. Tag: para +#: basic_mapping.xml:883 +#, no-c-format +msgid "" +"To link a table or sequence generator definition with an actual generated " +"property, use the same name in both the definition name " +"and the generator value generator as shown below." +msgstr "" + +#. Tag: programlisting +#: basic_mapping.xml:888 +#, no-c-format +msgid "" +"@Id \n" +"@GeneratedValue(\n" +" strategy=GenerationType.SEQUENCE, \n" +" generator=\"SEQ_GEN\")\n" +"@javax.persistence.SequenceGenerator(\n" +" name=\"SEQ_GEN\",\n" +" sequenceName=\"my_sequence\",\n" +" allocationSize=20\n" +")\n" +"public Integer getId() { ... }" +msgstr "" + +#. Tag: para +#: basic_mapping.xml:890 +#, no-c-format +msgid "" +"The scope of a generator definition can be the application or the class. " +"Class-defined generators are not visible outside the class and can override " +"application level generators. Application level generators are defined in " +"JPA's XML deployment descriptors (see XXXXXX ):" +msgstr "" + +#. Tag: programlisting +#: basic_mapping.xml:896 +#, no-c-format +msgid "" +"<table-generator name=\"EMP_GEN\"\n" +" table=\"GENERATOR_TABLE\"\n" +" pk-column-name=\"key\"\n" +" value-column-name=\"hi\"\n" +" pk-column-value=\"EMP\"\n" +" allocation-size=\"20\"/>\n" +"\n" +"//and the annotation equivalent\n" +"\n" +"@javax.persistence.TableGenerator(\n" +" name=\"EMP_GEN\",\n" +" table=\"GENERATOR_TABLE\",\n" +" pkColumnName = \"key\",\n" +" valueColumnName = \"hi\"\n" +" pkColumnValue=\"EMP\",\n" +" allocationSize=20\n" +")\n" +"\n" +"<sequence-generator name=\"SEQ_GEN\" \n" +" sequence-name=\"my_sequence\"\n" +" allocation-size=\"20\"/>\n" +"\n" +"//and the annotation equivalent\n" +"\n" +"@javax.persistence.SequenceGenerator(\n" +" name=\"SEQ_GEN\",\n" +" sequenceName=\"my_sequence\",\n" +" allocationSize=20\n" +")" +msgstr "" + +#. Tag: para +#: basic_mapping.xml:898 +#, no-c-format +msgid "" +"If a JPA XML descriptor (like META-INF/orm.xml) is used " +"to define the generators, EMP_GEN and SEQ_GEN are application level generators." +msgstr "" + +#. Tag: para +#: basic_mapping.xml:904 +#, no-c-format +msgid "" +"Package level definition is not supported by the JPA specification. However, " +"you can use the @GenericGenerator at the package level " +"(see )." +msgstr "" + +#. Tag: para +#: basic_mapping.xml:910 +#, no-c-format +msgid "" +"These are the four standard JPA generators. Hibernate goes beyond that and " +"provide additional generators or additional options as we will see below. " +"You can also write your own custom identifier generator by implementing " +"org.hibernate.id.IdentifierGenerator." +msgstr "" + +#. Tag: para +#: basic_mapping.xml:916 +#, no-c-format +msgid "" +"To define a custom generator, use the @GenericGenerator annotation (and its plural counter part " +"@GenericGenerators) that describes the class of the " +"identifier generator or its short cut name (as described below) and a list " +"of key/value parameters. When using @GenericGenerator " +"and assigning it via @GeneratedValue.generator, the " +"@GeneratedValue.strategy is ignored: leave it blank." +msgstr "" + +#. Tag: programlisting +#: basic_mapping.xml:926 +#, no-c-format +msgid "" +"@Id @GeneratedValue(generator=\"system-uuid\")\n" +"@GenericGenerator(name=\"system-uuid\", strategy = \"uuid\")\n" +"public String getId() {\n" +"\n" +"@Id @GeneratedValue(generator=\"trigger-generated\")\n" +"@GenericGenerator(\n" +" name=\"trigger-generated\", \n" +" strategy = \"select\",\n" +" parameters = @Parameter(name=\"key\", value = \"socialSecurityNumber\")\n" +")\n" +"public String getId() {" +msgstr "" + +#. Tag: para +#: basic_mapping.xml:928 +#, fuzzy, no-c-format +msgid "" +"The hbm.xml approach uses the optional <generator> " +"child element inside <id>. If any parameters are " +"required to configure or initialize the generator instance, they are passed " +"using the <param> element." msgstr "" "O elemento filho opcional <generator> nomeia uma " "classe Java usada para gerar identificadores únicos para instâncias de uma " @@ -955,7 +2272,27 @@ msgstr "" "inicializar a instância geradora, eles são passados utilizando o elemento " "<param>." +#. Tag: programlisting +#: basic_mapping.xml:934 +#, no-c-format +msgid "" +"<id name=\"id\" type=\"long\" column=\"cat_id\">\n" +" <generator class=\"org.hibernate.id.TableHiLoGenerator\">\n" +" <param name=\"table\">uid_table</param>\n" +" <param name=\"column\">next_hi_value_column</" +"param>\n" +" </generator>\n" +"</id>" +msgstr "" + +#. Tag: title +#: basic_mapping.xml:937 +#, no-c-format +msgid "Various additional generators" +msgstr "" + #. Tag: para +#: basic_mapping.xml:939 #, no-c-format msgid "" "All generators implement the interface org.hibernate.id." @@ -971,12 +2308,14 @@ msgstr "" "internamente. Há nomes de atalhos para estes geradores internos, conforme " "segue abaixo: " -#. Tag: term +#. Tag: literal +#: basic_mapping.xml:946 #, no-c-format -msgid "increment" -msgstr "increment" +msgid "increment" +msgstr "" #. Tag: para +#: basic_mapping.xml:949 #, no-c-format msgid "" "generates identifiers of type long, shortNão utilize em " "ambientes de cluster." -#. Tag: term +#. Tag: literal +#: basic_mapping.xml:958 #, no-c-format -msgid "identity" -msgstr "identity" +msgid "identity" +msgstr "" #. Tag: para +#: basic_mapping.xml:961 #, no-c-format msgid "" "supports identity columns in DB2, MySQL, MS SQL Server, Sybase and " @@ -1005,12 +2346,14 @@ msgstr "" "HypersonicSQL. O identificador retornado é do tipo long, " "short ou int." -#. Tag: term +#. Tag: literal +#: basic_mapping.xml:969 #, no-c-format -msgid "sequence" -msgstr "sequence" +msgid "sequence" +msgstr "" #. Tag: para +#: basic_mapping.xml:972 #, no-c-format msgid "" "uses a sequence in DB2, PostgreSQL, Oracle, SAP DB, McKoi or a generator in " @@ -1021,12 +2364,14 @@ msgstr "" "gerador no Interbase. O identificador de retorno é do tipo long, short ou int." -#. Tag: term +#. Tag: literal +#: basic_mapping.xml:980 #, no-c-format -msgid "hilo" -msgstr "hilo" +msgid "hilo" +msgstr "" #. Tag: para +#: basic_mapping.xml:984 #, no-c-format msgid "" "uses a hi/lo algorithm to efficiently generate identifiers of type " @@ -1043,12 +2388,14 @@ msgstr "" "fonte para os valores hi. O algoritmo hi/lo gera identificadores que são " "únicos apenas para um banco de dados específico." -#. Tag: term +#. Tag: literal +#: basic_mapping.xml:996 #, no-c-format -msgid "seqhilo" -msgstr "seqhilo" +msgid "seqhilo" +msgstr "" #. Tag: para +#: basic_mapping.xml:999 #, no-c-format msgid "" "uses a hi/lo algorithm to efficiently generate identifiers of type " @@ -1059,38 +2406,122 @@ msgstr "" "tipo long, short ou int, a partir de uma seqüência de banco de dados fornecida." -#. Tag: term -#, no-c-format -msgid "uuid" -msgstr "uuid" +#. Tag: literal +#: basic_mapping.xml:1007 +#, fuzzy, no-c-format +msgid "uuid" +msgstr "id" #. Tag: para +#: basic_mapping.xml:1010 #, no-c-format msgid "" -"uses a 128-bit UUID algorithm to generate identifiers of type string that " -"are unique within a network (the IP address is used). The UUID is encoded as " -"a string of 32 hexadecimal digits in length." +"Generates a 128-bit UUID based on a custom algorithm. The value generated is " +"represented as a string of 32 hexidecimal digits. Users can also configure " +"it to use a separator (config parameter \"separator\") which separates the " +"hexidecimal digits into 8{sep}8{sep}4{sep}8{sep}4. Note specifically that " +"this is different than the IETF RFC 4122 representation of 8-4-4-4-12. If " +"you need RFC 4122 compliant UUIDs, consider using \"uuid2\" generator " +"discussed below." msgstr "" -"utiliza um algorítimo UUID de 128-bits para gerar identificadores do tipo " -"string, únicos em uma rede (o endereço IP é utilizado). O UUID é codificado " -"como um string de dígitos hexadecimais de tamanho 32." -#. Tag: term +#. Tag: literal +#: basic_mapping.xml:1023 #, no-c-format -msgid "guid" -msgstr "guid" +msgid "uuid2" +msgstr "" #. Tag: para +#: basic_mapping.xml:1026 +#, no-c-format +msgid "" +"Generates a IETF RFC 4122 compliant (variant 2) 128-bit UUID. The exact " +"\"version\" (the RFC term) generated depends on the pluggable \"generation " +"strategy\" used (see below). Capable of generating values as java." +"util.UUID, java.lang.String or as a byte " +"array of length 16 (byte[16]). The \"generation strategy" +"\" is defined by the interface org.hibernate.id." +"UUIDGenerationStrategy. The generator defines 2 " +"configuration parameters for defining which generation strategy to use:" +msgstr "" + +#. Tag: literal +#: basic_mapping.xml:1038 +#, no-c-format +msgid "uuid_gen_strategy_class" +msgstr "" + +#. Tag: para +#: basic_mapping.xml:1041 +#, no-c-format +msgid "Names the UUIDGenerationStrategy class to use" +msgstr "" + +#. Tag: literal +#: basic_mapping.xml:1047 +#, no-c-format +msgid "uuid_gen_strategy" +msgstr "" + +#. Tag: para +#: basic_mapping.xml:1050 +#, no-c-format +msgid "Names the UUIDGenerationStrategy instance to use" +msgstr "" + +#. Tag: para +#: basic_mapping.xml:1056 +#, no-c-format +msgid "Out of the box, comes with the following strategies:" +msgstr "" + +#. Tag: para +#: basic_mapping.xml:1059 +#, no-c-format +msgid "" +"org.hibernate.id.uuid.StandardRandomStrategy (the " +"default) - generates \"version 3\" (aka, \"random\") UUID values via the " +"randomUUID method of java.util.UUID" +msgstr "" + +#. Tag: para +#: basic_mapping.xml:1067 +#, no-c-format +msgid "" +"org.hibernate.id.uuid.CustomVersionOneStrategy - " +"generates \"version 1\" UUID values, using IP address since mac address not " +"available. If you need mac address to be used, consider leveraging one of " +"the existing third party UUID generators which sniff out mac address and " +"integrating it via the org.hibernate.id." +"UUIDGenerationStrategy contract. Two such libraries known at " +"time of this writing include http://johannburkard.de/software/uuid/ and http://commons.apache.org/" +"sandbox/id/uuid.html" +msgstr "" + +#. Tag: literal +#: basic_mapping.xml:1085 +#, fuzzy, no-c-format +msgid "guid" +msgstr "id" + +#. Tag: para +#: basic_mapping.xml:1088 #, no-c-format msgid "uses a database-generated GUID string on MS SQL Server and MySQL." -msgstr "utiliza um string GUID gerado pelo banco de dados no Servidor MS SQL e MySQL." +msgstr "" +"utiliza um string GUID gerado pelo banco de dados no Servidor MS SQL e MySQL." -#. Tag: term +#. Tag: literal +#: basic_mapping.xml:1094 #, no-c-format -msgid "native" -msgstr "native" +msgid "native" +msgstr "" #. Tag: para +#: basic_mapping.xml:1097 #, no-c-format msgid "" "selects identity, sequence or " @@ -1101,12 +2532,14 @@ msgstr "" "hilo dependendo das capacidades do banco de dados " "utilizado." -#. Tag: term +#. Tag: literal +#: basic_mapping.xml:1105 #, no-c-format -msgid "assigned" -msgstr "assigned" +msgid "assigned" +msgstr "" #. Tag: para +#: basic_mapping.xml:1108 #, no-c-format msgid "" "lets the application assign an identifier to the object before save" @@ -1117,12 +2550,14 @@ msgstr "" "save() seja chamado. Esta é a estratégia padrão caso " "nenhum elemento <generator> seja especificado. " -#. Tag: term +#. Tag: literal +#: basic_mapping.xml:1117 #, no-c-format -msgid "select" -msgstr "select" +msgid "select" +msgstr "" #. Tag: para +#: basic_mapping.xml:1120 #, no-c-format msgid "" "retrieves a primary key, assigned by a database trigger, by selecting the " @@ -1132,12 +2567,14 @@ msgstr "" "selecionando uma linha pela chave única e recuperando o valor da chave " "primária." -#. Tag: term +#. Tag: literal +#: basic_mapping.xml:1127 #, no-c-format -msgid "foreign" -msgstr "foreign" +msgid "foreign" +msgstr "" #. Tag: para +#: basic_mapping.xml:1130 #, no-c-format msgid "" "uses the identifier of another associated object. It is usually used in " @@ -1148,12 +2585,14 @@ msgstr "" "em conjunto com uma associação de chave primária do tipo <one-to-" "one>." -#. Tag: term -#, no-c-format -msgid "sequence-identity" +#. Tag: literal +#: basic_mapping.xml:1138 +#, fuzzy, no-c-format +msgid "sequence-identity" msgstr "sequence-identity" #. Tag: para +#: basic_mapping.xml:1141 #, no-c-format msgid "" "a specialized sequence generation strategy that utilizes a database sequence " @@ -1172,11 +2611,13 @@ msgstr "" "a um bug nos drivers da Oracle. " #. Tag: title +#: basic_mapping.xml:1155 #, no-c-format msgid "Hi/lo algorithm" msgstr "Algoritmo Hi/lo" #. Tag: para +#: basic_mapping.xml:1157 #, no-c-format msgid "" "The hilo and seqhilo generators " @@ -1192,7 +2633,33 @@ msgstr "" "\"hi\" disponível. A segunda utiliza uma seqüência do estilo Oracle (quando " "suportado)." +#. Tag: programlisting +#: basic_mapping.xml:1163 +#, no-c-format +msgid "" +"<id name=\"id\" type=\"long\" column=\"cat_id\">\n" +" <generator class=\"hilo\">\n" +" <param name=\"table\">hi_value</param>\n" +" <param name=\"column\">next_value</param>\n" +" <param name=\"max_lo\">100</param>\n" +" </generator>\n" +"</id>" +msgstr "" + +#. Tag: programlisting +#: basic_mapping.xml:1165 +#, no-c-format +msgid "" +"<id name=\"id\" type=\"long\" column=\"cat_id\">\n" +" <generator class=\"seqhilo\">\n" +" <param name=\"sequence\">hi_value</param>\n" +" <param name=\"max_lo\">100</param>\n" +" </generator>\n" +"</id>" +msgstr "" + #. Tag: para +#: basic_mapping.xml:1167 #, no-c-format msgid "" "Unfortunately, you cannot use hilo when supplying your " @@ -1209,11 +2676,13 @@ msgstr "" "literal>. " #. Tag: title +#: basic_mapping.xml:1175 #, no-c-format msgid "UUID algorithm" msgstr "Algoritmo UUID" #. Tag: para +#: basic_mapping.xml:1177 #, no-c-format msgid "" "The UUID contains: IP address, startup time of the JVM that is accurate to a " @@ -1227,11 +2696,13 @@ msgstr "" "código Java, portanto este é o melhor que pode ser feito sem utilizar JNI." #. Tag: title +#: basic_mapping.xml:1185 #, no-c-format msgid "Identity columns and sequences" msgstr "Colunas de identidade e seqüências" #. Tag: para +#: basic_mapping.xml:1187 #, no-c-format msgid "" "For databases that support identity columns (DB2, MySQL, Sybase, MS SQL), " @@ -1247,7 +2718,30 @@ msgstr "" "no estilo sequence. As duas estratégias requerem duas " "consultas SQL para inserir um novo objeto. " +#. Tag: programlisting +#: basic_mapping.xml:1195 +#, no-c-format +msgid "" +"<id name=\"id\" type=\"long\" column=\"person_id\">\n" +" <generator class=\"sequence\">\n" +" <param name=\"sequence\">person_id_sequence</" +"param>\n" +" </generator>\n" +"</id>" +msgstr "" + +#. Tag: programlisting +#: basic_mapping.xml:1197 +#, no-c-format +msgid "" +"<id name=\"id\" type=\"long\" column=\"person_id\" unsaved-value=\"0" +"\">\n" +" <generator class=\"identity\"/>\n" +"</id>" +msgstr "" + #. Tag: para +#: basic_mapping.xml:1199 #, no-c-format msgid "" "For cross-platform development, the native strategy will, " @@ -1261,20 +2755,22 @@ msgstr "" "capacidades do banco de dados utilizado." #. Tag: title +#: basic_mapping.xml:1207 #, no-c-format msgid "Assigned identifiers" msgstr "Identificadores atribuídos" #. Tag: para -#, no-c-format +#: basic_mapping.xml:1209 +#, fuzzy, no-c-format msgid "" "If you want the application to assign identifiers, as opposed to having " "Hibernate generate them, you can use the assigned " "generator. This special generator uses the identifier value already assigned " "to the object's identifier property. The generator is used when the primary " "key is a natural key instead of a surrogate key. This is the default " -"behavior if you do not specify a <generator> " -"element." +"behavior if you do not specify @GeneratedValue nor " +"<generator> elements." msgstr "" "Se você quiser que a aplicação especifique os identificadores, em vez do " "Hibernate gerá-los, você deve utilizar o gerador assigned<generator>. " #. Tag: para +#: basic_mapping.xml:1218 #, no-c-format msgid "" "The assigned generator makes Hibernate use " @@ -1300,16 +2797,32 @@ msgstr "" "de timestamp, ou que você definia Interceptor.isUnsaved()." #. Tag: title +#: basic_mapping.xml:1226 #, no-c-format msgid "Primary keys assigned by triggers" msgstr "Chaves primárias geradas por triggers" #. Tag: para +#: basic_mapping.xml:1228 #, no-c-format -msgid "Hibernate does not generate DDL with triggers. It is for legacy schemas only." +msgid "" +"Hibernate does not generate DDL with triggers. It is for legacy schemas only." msgstr "O Hibernate não gera DDL com triggers, apenas para sistemas legados." +#. Tag: programlisting +#: basic_mapping.xml:1231 +#, no-c-format +msgid "" +"<id name=\"id\" type=\"long\" column=\"person_id\">\n" +" <generator class=\"select\">\n" +" <param name=\"key\">socialSecurityNumber</" +"param>\n" +" </generator>\n" +"</id>" +msgstr "" + #. Tag: para +#: basic_mapping.xml:1233 #, no-c-format msgid "" "In the above example, there is a unique valued property named " @@ -1323,11 +2836,91 @@ msgstr "" "valor é gerado por um trigger." #. Tag: title +#: basic_mapping.xml:1241 +#, no-c-format +msgid "Identity copy (foreign generator)" +msgstr "" + +#. Tag: para +#: basic_mapping.xml:1243 +#, no-c-format +msgid "" +"Finally, you can ask Hibernate to copy the identifier from another " +"associated entity. In the Hibernate jargon, it is known as a foreign " +"generator but the JPA mapping reads better and is encouraged." +msgstr "" + +#. Tag: programlisting +#: basic_mapping.xml:1248 +#, no-c-format +msgid "" +"@Entity\n" +"class MedicalHistory implements Serializable {\n" +" @Id @OneToOne\n" +" @JoinColumn(name = \"person_id\")\n" +" Person patient;\n" +"}\n" +"\n" +"@Entity\n" +"public class Person implements Serializable {\n" +" @Id @GeneratedValue Integer id;\n" +"}" +msgstr "" + +#. Tag: para +#: basic_mapping.xml:1250 +#, fuzzy, no-c-format +msgid "Or alternatively" +msgstr "Alternativas de Metadados" + +#. Tag: programlisting +#: basic_mapping.xml:1252 +#, no-c-format +msgid "" +"@Entity\n" +"class MedicalHistory implements Serializable {\n" +" @Id Integer id;\n" +"\n" +" @MapsId @OneToOne\n" +" @JoinColumn(name = \"patient_id\")\n" +" Person patient;\n" +"}\n" +"\n" +"@Entity\n" +"class Person {\n" +" @Id @GeneratedValue Integer id;\n" +"}" +msgstr "" + +#. Tag: para +#: basic_mapping.xml:1254 +#, no-c-format +msgid "In hbm.xml use the following approach:" +msgstr "" + +#. Tag: programlisting +#: basic_mapping.xml:1256 +#, no-c-format +msgid "" +"<class name=\"MedicalHistory\">\n" +" <id name=\"id\">\n" +" <generator class=\"foreign\">\n" +" <param name=\"property\">patient</param>\n" +" </generator>\n" +" </id>\n" +" <one-to-one name=\"patient\" class=\"Person\" constrained=\"true\"/" +">\n" +"</class>" +msgstr "" + +#. Tag: title +#: basic_mapping.xml:1261 #, no-c-format msgid "Enhanced identifier generators" msgstr "Aprimoração dos geradores de identificador" #. Tag: para +#: basic_mapping.xml:1263 #, no-c-format msgid "" "Starting with release 3.2.3, there are 2 new generators which represent a re-" @@ -1348,6 +2941,7 @@ msgstr "" "incluídos nas liberações atuais e podem ser referenciados pelo FQN." #. Tag: para +#: basic_mapping.xml:1272 #, no-c-format msgid "" "The first of these new generators is org.hibernate.id.enhanced." @@ -1385,6 +2979,7 @@ msgstr "" "possui um número de parâmetros de configuração: " #. Tag: para +#: basic_mapping.xml:1291 #, no-c-format msgid "" "sequence_name (optional, defaults to " @@ -1396,6 +2991,7 @@ msgstr "" "usada." #. Tag: para +#: basic_mapping.xml:1297 #, no-c-format msgid "" "initial_value (optional, defaults to 1increment_size (optional - defaults to 1force_table_use (optional - defaults to falsevalue_column (optional - defaults to next_valoptimizer (optional - defaults to none): See " +"literal>): See" msgstr "" -"optimizer (opcional – padrão para none): Veja " +"cascade (opcional – valor padrão none): o estilo cascata." #. Tag: para +#: basic_mapping.xml:1332 #, no-c-format msgid "" "The second of these new generators is org.hibernate.id.enhanced." @@ -1480,6 +3079,7 @@ msgstr "" "configuração." #. Tag: para +#: basic_mapping.xml:1345 #, no-c-format msgid "" "table_name (optional - defaults to " @@ -1489,6 +3089,7 @@ msgstr "" "hibernate_sequences): O nome da tabela a ser usado." #. Tag: para +#: basic_mapping.xml:1351 #, no-c-format msgid "" "value_column_name (optional - defaults to " @@ -1500,6 +3101,7 @@ msgstr "" "manter o valor." #. Tag: para +#: basic_mapping.xml:1357 #, no-c-format msgid "" "segment_column_name (optional - defaults to " @@ -1513,6 +3115,7 @@ msgstr "" "valor de incremento a ser usado." #. Tag: para +#: basic_mapping.xml:1365 #, no-c-format msgid "" "segment_value (optional - defaults to defaultsegment_value_length (optional - defaults to " @@ -1535,6 +3139,7 @@ msgstr "" "coluna para criar esta coluna de chave de segmento." #. Tag: para +#: basic_mapping.xml:1378 #, no-c-format msgid "" "initial_value (optional - defaults to 1): O valor inicial a ser restaurado a partir da tabela." #. Tag: para +#: basic_mapping.xml:1384 #, no-c-format msgid "" "increment_size (optional - defaults to 1optimizer (optional - defaults to ): " -"See " +"optimizer (optional - defaults to ??): " +"See ." msgstr "" "optimizer (opcional – padrão para ): " "Consulte " #. Tag: title +#: basic_mapping.xml:1397 #, no-c-format msgid "Identifier generator optimization" msgstr "Otimização do Gerador de Identificação" #. Tag: para -#, no-c-format +#: basic_mapping.xml:1399 +#, fuzzy, no-c-format msgid "" "For identifier generators that store values in the database, it is " "inefficient for them to hit the database on each and every call to generate " "a new identifier value. Instead, you can group a bunch of them in memory and " "only hit the database when you have exhausted your in-memory value group. " "This is the role of the pluggable optimizers. Currently only the two " -"enhanced generators ( " +"enhanced generators ( " "support this operation." msgstr "" "Para os geradores de identificação que armazenam valores no banco de dados, " @@ -1587,6 +3196,7 @@ msgstr "" "linkend=\"mapping-declaration-id-enhanced\"/>)" #. Tag: para +#: basic_mapping.xml:1410 #, no-c-format msgid "" "none (generally this is the default if no optimizer was " @@ -1598,6 +3208,7 @@ msgstr "" "banco de dados para cada e toda solicitação." #. Tag: para +#: basic_mapping.xml:1417 #, no-c-format msgid "" "hilo: applies a hi/lo algorithm around the database " @@ -1615,6 +3226,7 @@ msgstr "" "valor em memória para definir um grupo \"hi value\"." #. Tag: para +#: basic_mapping.xml:1427 #, no-c-format msgid "" "pooled: as with the case of hilo, this " @@ -1633,391 +3245,91 @@ msgstr "" "partir do banco de dados." #. Tag: title -#, no-c-format -msgid "composite-id" -msgstr "Composição-id" +#: basic_mapping.xml:1441 +#, fuzzy, no-c-format +msgid "Partial identifier generation" +msgstr "Aprimoração dos geradores de identificador" #. Tag: para +#: basic_mapping.xml:1443 #, no-c-format msgid "" -"A table with a composite key can be mapped with multiple properties of the " -"class as identifier properties. The <composite-id> " -"element accepts <key-property> property mappings " -"and <key-many-to-one> mappings as child elements." +"Hibernate supports the automatic generation of some of the identifier " +"properties. Simply use the @GeneratedValue annotation " +"on one or several id properties." msgstr "" -"Uma tabela com uma chave composta, pode ser mapeada com múltiplas " -"propriedades da classe como propriedades de identificação. O elemento " -"<composite-id> aceita o mapeamento da propriedade " -"<key-property> e mapeamentos <key-many-" -"to-one>como elementos filhos." #. Tag: para +#: basic_mapping.xml:1449 #, no-c-format msgid "" -"The persistent class must override equals() and hashCode() to implement composite identifier " -"equality. It must also implement Serializable." +"The Hibernate team has always felt such a construct as fundamentally wrong. " +"Try hard to fix your data model before using this feature." msgstr "" -"A classe persistente precisa substituir equals" -"() e hashCode() para implementar " -"identificadores compostos igualmente. E precisa também implementar " -"Serializable." -#. Tag: para +#. Tag: programlisting +#: basic_mapping.xml:1454 #, no-c-format msgid "" -"Unfortunately, this approach means that a persistent object is its own " -"identifier. There is no convenient \"handle\" other than the object itself. " -"You must instantiate an instance of the persistent class itself and populate " -"its identifier properties before you can load() the " -"persistent state associated with a composite key. We call this approach an " -"embedded composite identifier, and discourage it for " -"serious applications." +"@Entity\n" +"public class CustomerInventory implements Serializable {\n" +" @Id\n" +" @TableGenerator(name = \"inventory\",\n" +" table = \"U_SEQUENCES\",\n" +" pkColumnName = \"S_ID\",\n" +" valueColumnName = \"S_NEXTNUM\",\n" +" pkColumnValue = \"inventory\",\n" +" allocationSize = 1000)\n" +" @GeneratedValue(strategy = GenerationType.TABLE, generator = \"inventory" +"\")\n" +" Integer id;\n" +"\n" +"\n" +" @Id @ManyToOne(cascade = CascadeType.MERGE)\n" +" Customer customer;\n" +"}\n" +"\n" +"@Entity\n" +"public class Customer implements Serializable {\n" +" @Id\n" +" private int id;\n" +"}" msgstr "" -"Infelizmente, esta solução para um identificador composto significa que um " -"objeto persistente é seu próprio identificador. Não há outro \"handle\" " -"conveniente a não ser o próprio objeto. Você mesmo precisa instanciar uma " -"instância de outra classe persistente e preencher suas propriedades de " -"identificação antes que você possa dar um load() para o " -"estado persistente associado com uma chave composta. Nós chamamos esta " -"solução de identificador composto incorporado e não " -"aconselhamos para aplicações sérias." #. Tag: para +#: basic_mapping.xml:1456 #, no-c-format msgid "" -"A second approach is what we call a mapped composite " -"identifier, where the identifier properties named inside the <" -"composite-id> element are duplicated on both the persistent " -"class and a separate identifier class." +"You can also generate properties inside an @EmbeddedId class." msgstr "" -"Uma segunda solução seria chamar de identificador composto mapped quando a propriedades de identificação nomeadas dentro do elemento " -"<composite-id> estão duplicadas tanto na classe " -"persistente como em uma classe de identificação separada." - -#. Tag: para -#, no-c-format -msgid "" -"In this example, both the composite identifier class, MedicareId, and the entity class itself have properties named " -"medicareNumber and dependent. The " -"identifier class must override equals() and " -"hashCode() and implement Serializable. " -"The main disadvantage of this approach is code duplication." -msgstr "" -"No exemplo, ambas as classes de identificadores compostas, " -"MedicareId, e a própria classe entidade possuem " -"propriedades nomeadas medicareNumber e " -"dependent. A classe identificadora precisa sobrepor " -"equals() e hashCode() e implementar " -"Serializable. A desvantagem desta solução é óbvia: " -"duplicação de código." - -#. Tag: para -#, no-c-format -msgid "The following attributes are used to specify a mapped composite identifier:" -msgstr "" -"As seguintes funções são utilizadas para especificar o mapeamento de um " -"identificador composto:" - -#. Tag: para -#, no-c-format -msgid "" -"mapped (optional - defaults to false): " -"indicates that a mapped composite identifier is used, and that the contained " -"property mappings refer to both the entity class and the composite " -"identifier class." -msgstr "" -"mapped (opcional, false por padrão): " -"Indica que um identificar composto mapeado é usado, e que as propriedades de " -"mapeamento contidas refere-se tanto à classe entidade quanto à classe de " -"identificação composta." - -#. Tag: para -#, no-c-format -msgid "" -"class (optional - but required for a mapped composite " -"identifier): the class used as a composite identifier." -msgstr "" -"class (opcional, mas requerida para um identificador " -"composto mapeado): A classe usada como um identificador composto. " - -#. Tag: para -#, no-c-format -msgid "" -"We will describe a third, even more convenient approach, where the composite " -"identifier is implemented as a component class in . The attributes described below apply only to this " -"alternative approach:" -msgstr "" -"Descreveremos uma abordagem terciária e até mais conveniente, onde o " -"identificador da composição é implementado como uma classe componente na " -". Os atributos descritos abaixo " -"aplicam-se apenas para esta abordagem: " - -#. Tag: para -#, no-c-format -msgid "" -"name (optional - required for this approach): a property " -"of component type that holds the composite identifier. Please see chapter 9 " -"for more information." -msgstr "" -"name (opcional, requerida para esta abordagem): Uma " -"propriedade do tipo componente que armazena o identificador composto. Para " -"maiores informações, por favor consulte o capítulo 9." - -#. Tag: para -#, no-c-format -msgid "" -"access (optional - defaults to property): the strategy Hibernate uses for accessing the property value." -msgstr "" -"access (opcional - padrão para property): A estratégia que o Hiberante deve utilizar para acessar o valor " -"da propriedade." - -#. Tag: para -#, no-c-format -msgid "" -"class (optional - defaults to the property type " -"determined by reflection): the component class used as a composite " -"identifier. Please see the next section for more information." -msgstr "" -"class (opcional - valor padrão para o tipo de propriedade " -"determinando por reflexão): A classe componente utilizada como um " -"identificador composto. Por favor consulte a próxima seção para maiores " -"informações." - -#. Tag: para -#, no-c-format -msgid "" -"The third approach, an identifier component, is " -"recommended for almost all applications." -msgstr "" -"Esta terceira abordagem, um componente identificador, é " -"a que nós recomendamos para a maioria das aplicações. " #. Tag: title +#: basic_mapping.xml:1462 #, no-c-format -msgid "Discriminator" -msgstr "Discriminador " +msgid "Optimistic locking properties (optional)" +msgstr "" #. Tag: para +#: basic_mapping.xml:1464 #, no-c-format msgid "" -"The <discriminator> element is required for " -"polymorphic persistence using the table-per-class-hierarchy mapping " -"strategy. It declares a discriminator column of the table. The discriminator " -"column contains marker values that tell the persistence layer what subclass " -"to instantiate for a particular row. A restricted set of types can be used: " -"string, character, integer, byte, short, " -"boolean, yes_no, true_false." +"When using long transactions or conversations that span several database " +"transactions, it is useful to store versioning data to ensure that if the " +"same entity is updated by two conversations, the last to commit changes will " +"be informed and not override the other conversation's work. It guarantees " +"some isolation while still allowing for good scalability and works " +"particularly well in read-often write-sometimes situations." msgstr "" -"O elemento <discriminator> é necessário para " -"persistência polimórfica utilizando a estratégia de mapeamento de tabela-por-" -"classe-hierárquica e declara uma coluna discriminadora da tabela. A coluna " -"discriminadora contém valores de marcação que informam à camada de " -"persistência qual subclasse instanciar para uma linha em específico. Um " -"restrito conjunto de tipos que podem ser utilizados: string, character, integer, " -"byte, short, boolean, yes_no, true_false." #. Tag: para +#: basic_mapping.xml:1472 #, no-c-format -msgid "" -"column (optional - defaults to class): " -"the name of the discriminator column." +msgid "You can use two approaches: a dedicated version number or a timestamp." msgstr "" -"column (opcional - padrão para class): " -"O nome da coluna discriminadora." - -#. Tag: para -#, no-c-format -msgid "" -"type (optional - defaults to string): " -"a name that indicates the Hibernate type" -msgstr "" -"type (opcional - padrão para string): " -"O nome que indica o tipo Hibernate." - -#. Tag: para -#, no-c-format -msgid "" -"force (optional - defaults to false): " -"\"forces\" Hibernate to specify the allowed discriminator values, even when " -"retrieving all instances of the root class." -msgstr "" -"force (opcional - valor padrão false): " -"\"Força\" o Hibernate a especificar valores discriminadores permitidos mesmo " -"quando recuperando todas as instâncias da classe raíz. " - -#. Tag: para -#, no-c-format -msgid "" -"insert (optional - defaults to true): " -"set this to false if your discriminator column is also " -"part of a mapped composite identifier. It tells Hibernate not to include the " -"column in SQL INSERTs." -msgstr "" -"insert (opcional - valor padrão para true) Ajuste para false se sua coluna discriminadora " -"também fizer parte do identificador composto mapeado. (Isto informa ao " -"Hibernate para não incluir a coluna em comandos SQL INSERTs)." - -#. Tag: para -#, no-c-format -msgid "" -"formula (optional): an arbitrary SQL expression that is " -"executed when a type has to be evaluated. It allows content-based " -"discrimination." -msgstr "" -"formula (opcional): Uma expressão SQL arbitrária que é " -"executada quando um tipo tem que ser avaliado. Permite discriminação baseada " -"em conteúdo. " - -#. Tag: para -#, no-c-format -msgid "" -"Actual values of the discriminator column are specified by the " -"discriminator-value attribute of the <" -"class> and <subclass> elements." -msgstr "" -"Valores atuais de uma coluna discriminada são especificados pela função " -"discriminator-value da <class> e " -"elementos da <subclass>." - -#. Tag: para -#, no-c-format -msgid "" -"The force attribute is only useful if the table contains " -"rows with \"extra\" discriminator values that are not mapped to a persistent " -"class. This will not usually be the case." -msgstr "" -"O atributo force é útil (apenas) em tabelas contendo " -"linhas com valores discriminadores \"extras\" que não estão mapeados para " -"uma classe persistente. Este não é geralmente o caso." - -#. Tag: para -#, no-c-format -msgid "" -"The formula attribute allows you to declare an arbitrary " -"SQL expression that will be used to evaluate the type of a row. For example:" -msgstr "" -"Usando o atributo formula você pode declarar uma " -"expressão SQL arbitrária que será utilizada para avaliar o tipo de uma " -"linha. Por exemplo:" - -#. Tag: title -#, no-c-format -msgid "Version (optional)" -msgstr "Versão (opcional) " - -#. Tag: para -#, no-c-format -msgid "" -"The <version> element is optional and indicates " -"that the table contains versioned data. This is particularly useful if you " -"plan to use long transactions. See below for more " -"information:" -msgstr "" -"O elemento <version> é opcional e indica que a " -"tabela possui dados versionados. Isto é particularmente útil se você planeja " -"utilizar transações longas. Veja abaixo maiores " -"informações: " - -#. Tag: para -#, no-c-format -msgid "" -"column (optional - defaults to the property name): the " -"name of the column holding the version number." -msgstr "" -"column (opcional - tem como padrão o nome da propriedade " -"name): O nome da coluna mantendo o número da versão." - -#. Tag: para -#, no-c-format -msgid "name: the name of a property of the persistent class." -msgstr "name: O nome da propriedade da classe persistente. " - -#. Tag: para -#, no-c-format -msgid "" -"type (optional - defaults to integer): " -"the type of the version number." -msgstr "" -"type (opcional - padrão para integer): " -"O tipo do número da versão." - -#. Tag: para -#, no-c-format -msgid "" -"access (optional - defaults to property): the strategy Hibernate uses to access the property value." -msgstr "" -"access (opcional - padrão para property): A estratégia que o Hiberante deve utilizar para acessar o valor " -"da propriedade." - -#. Tag: para -#, no-c-format -msgid "" -"unsaved-value (optional - defaults to undefined): a version property value that indicates that an instance is newly " -"instantiated (unsaved), distinguishing it from detached instances that were " -"saved or loaded in a previous session. Undefined " -"specifies that the identifier property value should be used." -msgstr "" -"unsaved-value (opcional – valor padrão para " -"undefined ): Um valor para a propriedade versão que " -"indica que uma instância foi instanciada recentemente (unsaved), " -"distinguindo de instâncias desconectadas que foram salvas ou carregadas em " -"sessões anteriores. (undefined especifica que o valor da " -"propriedade de identificação deve ser utilizado). " - -#. Tag: para -#, no-c-format -msgid "" -"generated (optional - defaults to never): specifies that this version property value is generated by the " -"database. See the discussion of generated properties for more information." -msgstr "" -"generated (opcional - valor padrão never): Especifica que este valor de propriedade da versão é na verdade " -"gerado pelo banco de dados. Veja o generated properties " -"para maiores informações. " - -#. Tag: para -#, no-c-format -msgid "" -"insert (optional - defaults to true): " -"specifies whether the version column should be included in SQL insert " -"statements. It can be set to false if the database column " -"is defined with a default value of 0." -msgstr "" -"insert (opcional - padrão para true): " -"Especifica se a coluna de versão deve ser incluída na instrução de inserção " -"do SQL. Pode ser configurado como false se a coluna do " -"banco de dados estiver definida com um valor padrão de 0." - -#. Tag: para -#, no-c-format -msgid "" -"Version numbers can be of Hibernate type long, " -"integer, short, timestamp or calendar." -msgstr "" -"Números de versão podem ser dos tipos Hibernate long, " -"integer, short, timestamp ou calendar. " #. Tag: para +#: basic_mapping.xml:1475 #, no-c-format msgid "" "A version or timestamp property should never be null for a detached " @@ -2038,17 +3350,189 @@ msgstr "" "chaves compostas." #. Tag: title +#: basic_mapping.xml:1485 #, no-c-format -msgid "Timestamp (optional)" +msgid "Version number" +msgstr "" + +#. Tag: para +#: basic_mapping.xml:1487 +#, no-c-format +msgid "" +"You can add optimistic locking capability to an entity using the " +"@Version annotation:" +msgstr "" + +#. Tag: programlisting +#: basic_mapping.xml:1490 +#, no-c-format +msgid "" +"@Entity\n" +"public class Flight implements Serializable {\n" +"...\n" +" @Version\n" +" @Column(name=\"OPTLOCK\")\n" +" public Integer getVersion() { ... }\n" +"}" +msgstr "" + +#. Tag: para +#: basic_mapping.xml:1492 +#, no-c-format +msgid "" +"The version property will be mapped to the OPTLOCK " +"column, and the entity manager will use it to detect conflicting updates " +"(preventing lost updates you might otherwise see with the last-commit-wins " +"strategy)." +msgstr "" + +#. Tag: para +#: basic_mapping.xml:1497 +#, no-c-format +msgid "" +"The version column may be a numeric. Hibernate supports any kind of type " +"provided that you define and implement the appropriate " +"UserVersionType." +msgstr "" + +#. Tag: para +#: basic_mapping.xml:1501 +#, no-c-format +msgid "" +"The application must not alter the version number set up by Hibernate in any " +"way. To artificially increase the version number, check in Hibernate Entity " +"Manager's reference documentation LockModeType." +"OPTIMISTIC_FORCE_INCREMENT or LockModeType." +"PESSIMISTIC_FORCE_INCREMENT." +msgstr "" + +#. Tag: para +#: basic_mapping.xml:1507 +#, no-c-format +msgid "" +"If the version number is generated by the database (via a trigger for " +"example), make sure to use @org.hibernate.annotations.Generated" +"(GenerationTime.ALWAYS)." +msgstr "" + +#. Tag: para +#: basic_mapping.xml:1511 +#, no-c-format +msgid "To declare a version property in hbm.xml, use:" +msgstr "" + +#. Tag: programlisting +#: basic_mapping.xml:1530 +#, no-c-format +msgid "" +"<version\n" +" column=\"version_column\"\n" +" name=\"propertyName\"\n" +" type=\"typename\"\n" +" access=\"field|property|ClassName\"\n" +" unsaved-value=\"null|negative|undefined\"\n" +" generated=\"never|always\"\n" +" insert=\"true|false\"\n" +" node=\"element-name|@attribute-name|element/@attribute|.\"\n" +"/>" +msgstr "" + +#. Tag: para +#: basic_mapping.xml:1534 +#, no-c-format +msgid "" +"column (optional - defaults to the property name): the " +"name of the column holding the version number." +msgstr "" +"column (opcional - tem como padrão o nome da propriedade " +"name): O nome da coluna mantendo o número da versão." + +#. Tag: para +#: basic_mapping.xml:1540 +#, no-c-format +msgid "" +"name: the name of a property of the persistent class." +msgstr "name: O nome da propriedade da classe persistente. " + +#. Tag: para +#: basic_mapping.xml:1545 +#, no-c-format +msgid "" +"type (optional - defaults to integer): " +"the type of the version number." +msgstr "" +"type (opcional - padrão para integer): " +"O tipo do número da versão." + +#. Tag: para +#: basic_mapping.xml:1551 +#, no-c-format +msgid "" +"access (optional - defaults to property): the strategy Hibernate uses to access the property value." +msgstr "" +"access (opcional - padrão para property): A estratégia que o Hiberante deve utilizar para acessar o valor " +"da propriedade." + +#. Tag: para +#: basic_mapping.xml:1557 +#, no-c-format +msgid "" +"unsaved-value (optional - defaults to undefined): a version property value that indicates that an instance is newly " +"instantiated (unsaved), distinguishing it from detached instances that were " +"saved or loaded in a previous session. Undefined " +"specifies that the identifier property value should be used." +msgstr "" +"unsaved-value (opcional – valor padrão para " +"undefined ): Um valor para a propriedade versão que " +"indica que uma instância foi instanciada recentemente (unsaved), " +"distinguindo de instâncias desconectadas que foram salvas ou carregadas em " +"sessões anteriores. (undefined especifica que o valor da " +"propriedade de identificação deve ser utilizado). " + +#. Tag: para +#: basic_mapping.xml:1567 +#, no-c-format +msgid "" +"generated (optional - defaults to never): specifies that this version property value is generated by the " +"database. See the discussion of generated properties for more information." +msgstr "" +"generated (opcional - valor padrão never): Especifica que este valor de propriedade da versão é na verdade " +"gerado pelo banco de dados. Veja o generated properties para maiores informações. " + +#. Tag: para +#: basic_mapping.xml:1575 +#, no-c-format +msgid "" +"insert (optional - defaults to true): " +"specifies whether the version column should be included in SQL insert " +"statements. It can be set to false if the database column " +"is defined with a default value of 0." +msgstr "" +"insert (opcional - padrão para true): " +"Especifica se a coluna de versão deve ser incluída na instrução de inserção " +"do SQL. Pode ser configurado como false se a coluna do " +"banco de dados estiver definida com um valor padrão de 0." + +#. Tag: title +#: basic_mapping.xml:1586 +#, fuzzy, no-c-format +msgid "Timestamp" msgstr "Timestamp (opcional) " #. Tag: para -#, no-c-format +#: basic_mapping.xml:1588 +#, fuzzy, no-c-format msgid "" -"The optional <timestamp> element indicates that the " -"table contains timestamped data. This provides an alternative to versioning. " -"Timestamps are a less safe implementation of optimistic locking. However, " -"sometimes the application might use the timestamps in other ways." +"Alternatively, you can use a timestamp. Timestamps are a less safe " +"implementation of optimistic locking. However, sometimes the application " +"might use the timestamps in other ways." msgstr "" "O elemento opcional <timestamp> indica que uma " "tabela contém dados em timestamp. Isso tem por objetivo dar uma alternativa " @@ -2057,6 +3541,59 @@ msgstr "" "timestamps em outros caminhos. " #. Tag: para +#: basic_mapping.xml:1592 +#, no-c-format +msgid "" +"Simply mark a property of type Date or " +"Calendar as @Version." +msgstr "" + +#. Tag: programlisting +#: basic_mapping.xml:1596 +#, no-c-format +msgid "" +"@Entity\n" +"public class Flight implements Serializable {\n" +"...\n" +" @Version\n" +" public Date getLastUpdate() { ... }\n" +"}" +msgstr "" + +#. Tag: para +#: basic_mapping.xml:1598 +#, no-c-format +msgid "" +"Like version numbers, the timestamp can be generated by the database instead " +"of Hibernate. To do that, use @org.hibernate.annotations.Generated" +"(GenerationTime.ALWAYS)." +msgstr "" + +#. Tag: para +#: basic_mapping.xml:1602 +#, fuzzy, no-c-format +msgid "In hbm.xml, use the <timestamp> element:" +msgstr "" +"Por exemplo, se temos o seguinte mapeamento de <properties>:" + +#. Tag: programlisting +#: basic_mapping.xml:1620 +#, no-c-format +msgid "" +"<timestamp\n" +" column=\"timestamp_column\"\n" +" name=\"propertyName\"\n" +" access=\"field|property|ClassName\"\n" +" unsaved-value=\"null|undefined\"\n" +" source=\"vm|db\"\n" +" generated=\"never|always\"\n" +" node=\"element-name|@attribute-name|element/@attribute|.\"\n" +"/>" +msgstr "" + +#. Tag: para +#: basic_mapping.xml:1624 #, no-c-format msgid "" "column (optional - defaults to the property name): the " @@ -2066,6 +3603,7 @@ msgstr "" "nome da coluna que mantém o timestamp." #. Tag: para +#: basic_mapping.xml:1630 #, no-c-format msgid "" "name: the name of a JavaBeans style property of Java type " @@ -2077,6 +3615,19 @@ msgstr "" "persistente." #. Tag: para +#: basic_mapping.xml:1636 basic_mapping.xml:2163 basic_mapping.xml:2380 +#: basic_mapping.xml:3226 basic_mapping.xml:3420 basic_mapping.xml:3593 +#, no-c-format +msgid "" +"access (optional - defaults to property): the strategy Hibernate uses for accessing the property value." +msgstr "" +"access (opcional - padrão para property): A estratégia que o Hiberante deve utilizar para acessar o valor " +"da propriedade." + +#. Tag: para +#: basic_mapping.xml:1642 #, no-c-format msgid "" "unsaved-value (optional - defaults to nullsource (optional - defaults to vm): " @@ -2115,6 +3667,7 @@ msgstr "" "por exemplo)." #. Tag: para +#: basic_mapping.xml:1665 #, no-c-format msgid "" "generated (optional - defaults to nevergenerated (opcional - padrão para never): Especifica que o valor da propriedade timestamp é gerado pelo " -"banco de dados. Veja a discussão do generated properties " -"para maiores informações. " +"banco de dados. Veja a discussão do generated properties para maiores informações. " #. Tag: title +#: basic_mapping.xml:1675 #, no-c-format msgid "Note" msgstr "Nota" #. Tag: para +#: basic_mapping.xml:1677 #, no-c-format msgid "" "<Timestamp> is equivalent to <version " @@ -2147,11 +3701,794 @@ msgstr "" "type=\"dbtimestamp\">." #. Tag: title +#: basic_mapping.xml:1686 #, no-c-format msgid "Property" msgstr "Propriedade " #. Tag: para +#: basic_mapping.xml:1688 +#, no-c-format +msgid "" +"You need to decide which property needs to be made persistent in a given " +"entity. This differs slightly between the annotation driven metadata and the " +"hbm.xml files." +msgstr "" + +#. Tag: title +#: basic_mapping.xml:1693 +#, no-c-format +msgid "Property mapping with annotations" +msgstr "" + +#. Tag: para +#: basic_mapping.xml:1695 +#, no-c-format +msgid "" +"In the annotations world, every non static non transient property (field or " +"method depending on the access type) of an entity is considered persistent, " +"unless you annotate it as @Transient. Not having an " +"annotation for your property is equivalent to the appropriate " +"@Basic annotation." +msgstr "" + +#. Tag: para +#: basic_mapping.xml:1702 +#, no-c-format +msgid "" +"The @Basic annotation allows you to declare the fetching " +"strategy for a property. If set to LAZY, specifies that " +"this property should be fetched lazily when the instance variable is first " +"accessed. It requires build-time bytecode instrumentation, if your classes " +"are not instrumented, property level lazy loading is silently ignored. The " +"default is EAGER. You can also mark a property as not " +"optional thanks to the @Basic.optional attribute. " +"This will ensure that the underlying column are not nullable (if possible). " +"Note that a better approach is to use the @NotNull " +"annotation of the Bean Validation specification." +msgstr "" + +#. Tag: para +#: basic_mapping.xml:1715 +#, no-c-format +msgid "Let's look at a few examples:" +msgstr "" + +#. Tag: programlisting +#: basic_mapping.xml:1717 +#, no-c-format +msgid "" +"public transient int counter; //transient property\n" +"\n" +"private String firstname; //persistent property\n" +"\n" +"@Transient\n" +"String getLengthInMeter() { ... } //transient property\n" +"\n" +"String getName() {... } // persistent property\n" +"\n" +"@Basic\n" +"int getLength() { ... } // persistent property\n" +"\n" +"@Basic(fetch = FetchType.LAZY)\n" +"String getDetailedComment() { ... } // persistent property\n" +"\n" +"@Temporal(TemporalType.TIME)\n" +"java.util.Date getDepartureTime() { ... } // persistent property \n" +"\n" +"@Enumerated(EnumType.STRING)\n" +"Starred getNote() { ... } //enum persisted as String in database" +msgstr "" + +#. Tag: para +#: basic_mapping.xml:1719 +#, no-c-format +msgid "" +"counter, a transient field, and lengthInMeter, a method annotated as @Transient, and will be " +"ignored by the Hibernate. name, length, and firstname properties are mapped persistent " +"and eagerly fetched (the default for simple properties). The " +"detailedComment property value will be lazily fetched " +"from the database once a lazy property of the entity is accessed for the " +"first time. Usually you don't need to lazy simple properties (not to be " +"confused with lazy association fetching). The recommended alternative is to " +"use the projection capability of JP-QL (Java Persistence Query Language) or " +"Criteria queries." +msgstr "" + +#. Tag: para +#: basic_mapping.xml:1732 +#, no-c-format +msgid "" +"JPA support property mapping of all basic types supported by Hibernate (all " +"basic Java types , their respective wrappers and serializable classes). " +"Hibernate Annotations supports out of the box enum type mapping either into " +"a ordinal column (saving the enum ordinal) or a string based column (saving " +"the enum string representation): the persistence representation, defaulted " +"to ordinal, can be overridden through the @Enumerated " +"annotation as shown in the note property example." +msgstr "" + +#. Tag: para +#: basic_mapping.xml:1742 +#, no-c-format +msgid "" +"In plain Java APIs, the temporal precision of time is not defined. When " +"dealing with temporal data you might want to describe the expected precision " +"in database. Temporal data can have DATE, TIME, or TIMESTAMP precision (ie the actual date, " +"only the time, or both). Use the @Temporal annotation to " +"fine tune that." +msgstr "" + +#. Tag: para +#: basic_mapping.xml:1750 +#, no-c-format +msgid "" +"@Lob indicates that the property should be persisted in a " +"Blob or a Clob depending on the property type: java.sql.Clob, Character[], char[] and java.lang.String will be persisted in " +"a Clob. java.sql.Blob, Byte[], " +"byte[] and Serializable type " +"will be persisted in a Blob." +msgstr "" + +#. Tag: programlisting +#: basic_mapping.xml:1759 +#, no-c-format +msgid "" +"@Lob\n" +"public String getFullText() {\n" +" return fullText;\n" +"}\n" +"\n" +"@Lob\n" +"public byte[] getFullCode() {\n" +" return fullCode;\n" +"}" +msgstr "" + +#. Tag: para +#: basic_mapping.xml:1761 +#, no-c-format +msgid "" +"If the property type implements java.io.Serializable " +"and is not a basic type, and if the property is not annotated with " +"@Lob, then the Hibernate serializable " +"type is used." +msgstr "" + +#. Tag: title +#: basic_mapping.xml:1768 +#, no-c-format +msgid "Type" +msgstr "" + +#. Tag: para +#: basic_mapping.xml:1770 +#, no-c-format +msgid "" +"You can also manually specify a type using the @org.hibernate." +"annotations.Type and some parameters if needed. @Type." +"type could be:" +msgstr "" + +#. Tag: para +#: basic_mapping.xml:1777 basic_mapping.xml:2209 +#, no-c-format +msgid "" +"The name of a Hibernate basic type: integer, string, character, " +"date, timestamp, float, binary, serializable, object, blob etc." +msgstr "" +"O nome de um tipo básico de Hibernate: integer, string, character, " +"date, timestamp, float, binary, serializable, object, blob, etc. " + +#. Tag: para +#: basic_mapping.xml:1783 basic_mapping.xml:2215 +#, no-c-format +msgid "" +"The name of a Java class with a default basic type: int, float, " +"char, java.lang.String, java.util.Date, java.lang.Integer, java.sql.Clob etc." +msgstr "" +"O nome da classe Java com um tipo básico padrão: int, float, char, " +"java.lang.String, java.util.Date, java.lang.Integer, java.sql.Clob, etc." + +#. Tag: para +#: basic_mapping.xml:1789 basic_mapping.xml:2221 +#, no-c-format +msgid "The name of a serializable Java class." +msgstr "O nome da classe Java serializável" + +#. Tag: para +#: basic_mapping.xml:1793 basic_mapping.xml:2225 +#, no-c-format +msgid "" +"The class name of a custom type: com.illflow.type.MyCustomType etc." +msgstr "" +"O nome da classe de um tipo customizado: com.illflow.type." +"MyCustomType, etc." + +#. Tag: para +#: basic_mapping.xml:1798 +#, fuzzy, no-c-format +msgid "" +"If you do not specify a type, Hibernate will use reflection upon the named " +"property and guess the correct Hibernate type. Hibernate will attempt to " +"interpret the name of the return class of the property getter using, in " +"order, rules 2, 3, and 4." +msgstr "" +"Se você não especificar um tipo, o Hibernate irá utilizar reflexão sobre a " +"propriedade nomeada para ter uma idéia do tipo de Hibernate correto. O " +"Hibernate tentará interpretar o nome da classe retornada, usando as regras " +"2, 3 e 4 nesta ordem. Em certos casos, você ainda precisará do atributo " +"type. Por exemplo, para distinguir entre " +"Hibernate.DATE e Hibernate.TIMESTAMP, " +"ou para especificar um tipo customizado." + +#. Tag: para +#: basic_mapping.xml:1803 +#, no-c-format +msgid "" +"@org.hibernate.annotations.TypeDef and @org." +"hibernate.annotations.TypeDefs allows you to declare type " +"definitions. These annotations can be placed at the class or package level. " +"Note that these definitions are global for the session factory (even when " +"defined at the class level). If the type is used on a single entity, you can " +"place the definition on the entity itself. Otherwise, it is recommended to " +"place the definition at the package level. In the example below, when " +"Hibernate encounters a property of class PhoneNumer, it " +"delegates the persistence strategy to the custom mapping type " +"PhoneNumberType. However, properties belonging to other " +"classes, too, can delegate their persistence strategy to " +"PhoneNumberType, by explicitly using the @Type annotation." +msgstr "" + +#. Tag: para +#: basic_mapping.xml:1819 +#, no-c-format +msgid "" +"Package level annotations are placed in a file named package-info." +"java in the appropriate package. Place your annotations before " +"the package declaration." +msgstr "" + +#. Tag: programlisting +#: basic_mapping.xml:1824 +#, no-c-format +msgid "" +"@TypeDef(\n" +" name = \"phoneNumber\",\n" +" defaultForType = PhoneNumber.class,\n" +" typeClass = PhoneNumberType.class\n" +")\n" +"\n" +"@Entity\n" +"public class ContactDetails {\n" +" [...]\n" +" private PhoneNumber localPhoneNumber;\n" +" @Type(type=\"phoneNumber\")\n" +" private OverseasPhoneNumber overseasPhoneNumber;\n" +" [...]\n" +"}" +msgstr "" + +#. Tag: para +#: basic_mapping.xml:1826 +#, no-c-format +msgid "" +"The following example shows the usage of the parameters " +"attribute to customize the TypeDef." +msgstr "" + +#. Tag: programlisting +#: basic_mapping.xml:1830 +#, no-c-format +msgid "" +"//in org/hibernate/test/annotations/entity/package-info.java\n" +"@TypeDefs(\n" +" {\n" +" @TypeDef(\n" +" name=\"caster\",\n" +" typeClass = CasterStringType.class,\n" +" parameters = {\n" +" @Parameter(name=\"cast\", value=\"lower\")\n" +" }\n" +" )\n" +" }\n" +")\n" +"package org.hibernate.test.annotations.entity;\n" +"\n" +"//in org/hibernate/test/annotations/entity/Forest.java\n" +"public class Forest {\n" +" @Type(type=\"caster\")\n" +" public String getSmallText() {\n" +" ...\n" +"}" +msgstr "" + +#. Tag: para +#: basic_mapping.xml:1832 +#, no-c-format +msgid "" +"When using composite user type, you will have to express column definitions. " +"The @Columns has been introduced for that purpose." +msgstr "" + +#. Tag: programlisting +#: basic_mapping.xml:1836 +#, no-c-format +msgid "" +"@Type(type=\"org.hibernate.test.annotations.entity.MonetaryAmountUserType" +"\")\n" +"@Columns(columns = {\n" +" @Column(name=\"r_amount\"),\n" +" @Column(name=\"r_currency\")\n" +"})\n" +"public MonetaryAmount getAmount() {\n" +" return amount;\n" +"}\n" +"\n" +"\n" +"public class MonetaryAmount implements Serializable {\n" +" private BigDecimal amount;\n" +" private Currency currency;\n" +" ...\n" +"}" +msgstr "" + +#. Tag: title +#: basic_mapping.xml:1840 +#, no-c-format +msgid "Access type" +msgstr "" + +#. Tag: para +#: basic_mapping.xml:1842 +#, no-c-format +msgid "" +"By default the access type of a class hierarchy is defined by the position " +"of the @Id or @EmbeddedId " +"annotations. If these annotations are on a field, then only fields are " +"considered for persistence and the state is accessed via the field. If there " +"annotations are on a getter, then only the getters are considered for " +"persistence and the state is accessed via the getter/setter. That works well " +"in practice and is the recommended approach." +msgstr "" + +#. Tag: para +#: basic_mapping.xml:1850 +#, no-c-format +msgid "" +"The placement of annotations within a class hierarchy has to be consistent " +"(either field or on property) to be able to determine the default access " +"type. It is recommended to stick to one single annotation placement strategy " +"throughout your whole application." +msgstr "" + +#. Tag: para +#: basic_mapping.xml:1857 +#, no-c-format +msgid "However in some situations, you need to:" +msgstr "" + +#. Tag: para +#: basic_mapping.xml:1861 +#, no-c-format +msgid "force the access type of the entity hierarchy" +msgstr "" + +#. Tag: para +#: basic_mapping.xml:1865 +#, no-c-format +msgid "override the access type of a specific entity in the class hierarchy" +msgstr "" + +#. Tag: para +#: basic_mapping.xml:1870 +#, no-c-format +msgid "override the access type of an embeddable type" +msgstr "" + +#. Tag: para +#: basic_mapping.xml:1874 +#, no-c-format +msgid "" +"The best use case is an embeddable class used by several entities that might " +"not use the same access type. In this case it is better to force the access " +"type at the embeddable class level." +msgstr "" + +#. Tag: para +#: basic_mapping.xml:1879 +#, no-c-format +msgid "" +"To force the access type on a given class, use the @Access annotation as showed below:" +msgstr "" + +#. Tag: programlisting +#: basic_mapping.xml:1882 +#, no-c-format +msgid "" +"@Entity\n" +"public class Order {\n" +" @Id private Long id;\n" +" public Long getId() { return id; }\n" +" public void setId(Long id) { this.id = id; }\n" +"\n" +" @Embedded private Address address;\n" +" public Address getAddress() { return address; }\n" +" public void setAddress() { this.address = address; }\n" +"}\n" +"\n" +"@Entity\n" +"public class User {\n" +" private Long id;\n" +" @Id public Long getId() { return id; }\n" +" public void setId(Long id) { this.id = id; }\n" +"\n" +" private Address address;\n" +" @Embedded public Address getAddress() { return address; }\n" +" public void setAddress() { this.address = address; }\n" +"}\n" +"\n" +"@Embeddable\n" +"@Access(AcessType.PROPERTY)\n" +"public class Address {\n" +" private String street1;\n" +" public String getStreet1() { return street1; }\n" +" public void setStreet1() { this.street1 = street1; }\n" +"\n" +" private hashCode; //not persistent\n" +"}" +msgstr "" + +#. Tag: para +#: basic_mapping.xml:1884 +#, no-c-format +msgid "" +"You can also override the access type of a single property while keeping the " +"other properties standard." +msgstr "" + +#. Tag: programlisting +#: basic_mapping.xml:1887 +#, no-c-format +msgid "" +"@Entity\n" +"public class Order {\n" +" @Id private Long id;\n" +" public Long getId() { return id; }\n" +" public void setId(Long id) { this.id = id; }\n" +" @Transient private String userId;\n" +" @Transient private String orderId;\n" +"\n" +" @Access(AccessType.PROPERTY)\n" +" public String getOrderNumber() { return userId + \":\" + orderId; }\n" +" public void setOrderNumber() { this.userId = ...; this.orderId = ...; }\n" +"}" +msgstr "" + +#. Tag: para +#: basic_mapping.xml:1889 +#, no-c-format +msgid "" +"In this example, the default access type is FIELD " +"except for the orderNumber property. Note that the " +"corresponding field, if any must be marked as @Transient or transient." +msgstr "" + +#. Tag: title +#: basic_mapping.xml:1896 +#, no-c-format +msgid "@org.hibernate.annotations.AccessType" +msgstr "" + +#. Tag: para +#: basic_mapping.xml:1898 +#, no-c-format +msgid "" +"The annotation @org.hibernate.annotations.AccessType " +"should be considered deprecated for FIELD and PROPERTY access. It is still " +"useful however if you need to use a custom access type." +msgstr "" + +#. Tag: title +#: basic_mapping.xml:1907 +#, no-c-format +msgid "Optimistic lock" +msgstr "" + +#. Tag: para +#: basic_mapping.xml:1909 +#, no-c-format +msgid "" +"It is sometimes useful to avoid increasing the version number even if a " +"given property is dirty (particularly collections). You can do that by " +"annotating the property (or collection) with @OptimisticLock" +"(excluded=true)." +msgstr "" + +#. Tag: para +#: basic_mapping.xml:1914 +#, no-c-format +msgid "" +"More formally, specifies that updates to this property do not require " +"acquisition of the optimistic lock." +msgstr "" + +#. Tag: title +#: basic_mapping.xml:1919 +#, no-c-format +msgid "Declaring column attributes" +msgstr "" + +#. Tag: para +#: basic_mapping.xml:1921 +#, no-c-format +msgid "" +"The column(s) used for a property mapping can be defined using the " +"@Column annotation. Use it to override default values " +"(see the JPA specification for more information on the defaults). You can " +"use this annotation at the property level for properties that are:" +msgstr "" + +#. Tag: para +#: basic_mapping.xml:1929 +#, no-c-format +msgid "not annotated at all" +msgstr "" + +#. Tag: para +#: basic_mapping.xml:1933 +#, fuzzy, no-c-format +msgid "annotated with @Basic" +msgstr "assigned" + +#. Tag: para +#: basic_mapping.xml:1937 +#, fuzzy, no-c-format +msgid "annotated with @Version" +msgstr "string" + +#. Tag: para +#: basic_mapping.xml:1941 +#, fuzzy, no-c-format +msgid "annotated with @Lob" +msgstr "hilo" + +#. Tag: para +#: basic_mapping.xml:1945 +#, fuzzy, no-c-format +msgid "annotated with @Temporal" +msgstr "serializable" + +#. Tag: programlisting +#: basic_mapping.xml:1949 +#, no-c-format +msgid "" +"@Entity\n" +"public class Flight implements Serializable {\n" +"...\n" +"@Column(updatable = false, name = \"flight_name\", nullable = false, " +"length=50)\n" +"public String getName() { ... }" +msgstr "" + +#. Tag: para +#: basic_mapping.xml:1951 +#, no-c-format +msgid "" +"The name property is mapped to the flight_name column, which is not nullable, has a length of 50 and is not " +"updatable (making the property immutable)." +msgstr "" + +#. Tag: para +#: basic_mapping.xml:1956 +#, no-c-format +msgid "" +"This annotation can be applied to regular properties as well as " +"@Id or @Version properties." +msgstr "" + +#. Tag: programlisting +#: basic_mapping.xml:1983 +#, no-c-format +msgid "" +"@Column(\n" +" name=\"columnName\";\n" +" boolean unique() default false;\n" +" boolean nullable() default true;\n" +" boolean insertable() default true;\n" +" boolean updatable() default true;\n" +" String columnDefinition() default \"\";\n" +" String table() default \"\";\n" +" int length() default 255;\n" +" int precision() default 0; // decimal precision\n" +" int scale() default 0; // decimal scale" +msgstr "" + +#. Tag: para +#: basic_mapping.xml:1987 +#, fuzzy, no-c-format +msgid "" +"name (optional): the column name (default to the property " +"name)" +msgstr "" +"name (opcional): O nome da propriedade do identificador." + +#. Tag: para +#: basic_mapping.xml:1992 +#, fuzzy, no-c-format +msgid "" +"unique (optional): set a unique constraint on this column " +"or not (default false)" +msgstr "" +"unique (opcional): Habilita a geração de DDL de uma única " +"restrição para as colunas. Da mesma forma, permita que isto seja o alvo de " +"uma property-ref. " + +#. Tag: para +#: basic_mapping.xml:1997 +#, fuzzy, no-c-format +msgid "" +"nullable (optional): set the column as nullable (default " +"true)." +msgstr "" +"name (opcional): O nome da propriedade do identificador." + +#. Tag: para +#: basic_mapping.xml:2002 +#, fuzzy, no-c-format +msgid "" +"insertable (optional): whether or not the column will be " +"part of the insert statement (default true)" +msgstr "" +"name (opcional): O nome da propriedade do identificador." + +#. Tag: para +#: basic_mapping.xml:2008 +#, fuzzy, no-c-format +msgid "" +"updatable (optional): whether or not the column will be " +"part of the update statement (default true)" +msgstr "" +"catalog (opcional): O nome do catálogo do banco de dados. " + +#. Tag: para +#: basic_mapping.xml:2014 +#, no-c-format +msgid "" +"columnDefinition (optional): override the sql DDL " +"fragment for this particular column (non portable)" +msgstr "" + +#. Tag: para +#: basic_mapping.xml:2020 +#, fuzzy, no-c-format +msgid "" +"table (optional): define the targeted table (default " +"primary table)" +msgstr "" +"catalog (opcional): O nome do catálogo do banco de dados. " + +#. Tag: para +#: basic_mapping.xml:2025 +#, no-c-format +msgid "" +"length (optional): column length " +"(default 255)" +msgstr "" + +#. Tag: para +#: basic_mapping.xml:2030 +#, no-c-format +msgid "" +"precision (optional): column decimal " +"precision (default 0)" +msgstr "" + +#. Tag: para +#: basic_mapping.xml:2035 +#, no-c-format +msgid "" +"scale (optional): column decimal scale " +"if useful (default 0)" +msgstr "" + +#. Tag: title +#: basic_mapping.xml:2043 +#, no-c-format +msgid "Formula" +msgstr "" + +#. Tag: para +#: basic_mapping.xml:2045 +#, no-c-format +msgid "" +"Sometimes, you want the Database to do some computation for you rather than " +"in the JVM, you might also create some kind of virtual column. You can use a " +"SQL fragment (aka formula) instead of mapping a property into a column. This " +"kind of property is read only (its value is calculated by your formula " +"fragment)." +msgstr "" + +#. Tag: programlisting +#: basic_mapping.xml:2051 +#, no-c-format +msgid "" +"@Formula(\"obj_length * obj_height * obj_width\")\n" +"public long getObjectVolume()" +msgstr "" + +#. Tag: para +#: basic_mapping.xml:2053 +#, no-c-format +msgid "" +"The SQL fragment can be as complex as you want and even include subselects." +msgstr "" + +#. Tag: title +#: basic_mapping.xml:2058 +#, no-c-format +msgid "Non-annotated property defaults" +msgstr "" + +#. Tag: para +#: basic_mapping.xml:2060 +#, no-c-format +msgid "If a property is not annotated, the following rules apply:" +msgstr "" + +#. Tag: para +#: basic_mapping.xml:2063 +#, no-c-format +msgid "If the property is of a single type, it is mapped as @Basic" +msgstr "" + +#. Tag: para +#: basic_mapping.xml:2068 +#, no-c-format +msgid "" +"Otherwise, if the type of the property is annotated as @Embeddable, it is " +"mapped as @Embedded" +msgstr "" + +#. Tag: para +#: basic_mapping.xml:2073 +#, no-c-format +msgid "" +"Otherwise, if the type of the property is Serializable, it is mapped as @Basic in a column " +"holding the object in its serialized version" +msgstr "" + +#. Tag: para +#: basic_mapping.xml:2080 +#, no-c-format +msgid "" +"Otherwise, if the type of the property is java.sql.Clob or java.sql.Blob, it is mapped as " +"@Lob with the appropriate LobType" +msgstr "" + +#. Tag: title +#: basic_mapping.xml:2091 +#, no-c-format +msgid "Property mapping with hbm.xml" +msgstr "" + +#. Tag: para +#: basic_mapping.xml:2093 #, no-c-format msgid "" "The <property> element declares a persistent " @@ -2160,7 +4497,34 @@ msgstr "" "O elemento <property> declara uma propriedade de " "estilo JavaBean de uma classe." +#. Tag: programlisting +#: basic_mapping.xml:2125 +#, no-c-format +msgid "" +"<property\n" +" name=\"propertyName\"\n" +" column=\"column_name\"\n" +" type=\"typename\"\n" +" update=\"true|false\"\n" +" insert=\"true|false\"\n" +" formula=\"arbitrary SQL expression\"\n" +" access=\"field|property|ClassName\"\n" +" lazy=\"true|false\"\n" +" unique=\"true|false\"\n" +" not-null=\"true|false\"\n" +" optimistic-lock=\"true|false\"\n" +" generated=\"never|insert|always\"\n" +" node=\"element-name|@attribute-name|element/@attribute|.\"\n" +" index=\"index_name\"\n" +" unique_key=\"unique_key_id\"\n" +" length=\"L\"\n" +" precision=\"P\"\n" +" scale=\"S\"\n" +"/>" +msgstr "" + #. Tag: para +#: basic_mapping.xml:2129 #, no-c-format msgid "" "name: the name of the property, with an initial lowercase " @@ -2170,6 +4534,7 @@ msgstr "" "minúscula." #. Tag: para +#: basic_mapping.xml:2134 #, no-c-format msgid "" "column (optional - defaults to the property name): the " @@ -2181,6 +4546,7 @@ msgstr "" "pelo(s) elemento(s) <column> aninhados." #. Tag: para +#: basic_mapping.xml:2146 #, no-c-format msgid "" "update, insert (optional - defaults to trueformula (optional): an SQL expression that defines the " @@ -2209,6 +4576,7 @@ msgstr "" "não possuem uma coluna de mapeamento para elas." #. Tag: para +#: basic_mapping.xml:2169 #, no-c-format msgid "" "lazy (optional - defaults to false): " @@ -2221,6 +4589,7 @@ msgstr "" "instrumentação bytecode em tempo de criação." #. Tag: para +#: basic_mapping.xml:2176 #, no-c-format msgid "" "unique (optional): enables the DDL generation of a unique " @@ -2232,6 +4601,7 @@ msgstr "" "uma property-ref. " #. Tag: para +#: basic_mapping.xml:2183 #, no-c-format msgid "" "not-null (optional): enables the DDL generation of a " @@ -2241,6 +4611,7 @@ msgstr "" "restrição de nulidade para as colunas. " #. Tag: para +#: basic_mapping.xml:2188 basic_mapping.xml:3246 #, no-c-format msgid "" "optimistic-lock (optional - defaults to truegenerated (optional - defaults to nevergenerated (opcional - padrão para never): Especifica que o valor da propriedade é na verdade gerado pelo " "banco de dados. Veja a discussão do generated properties " -"para maiores informações. " +"\">generated properties para maiores informações. " #. Tag: para +#: basic_mapping.xml:2205 #, no-c-format msgid "typename could be:" msgstr "typename pode ser:" #. Tag: para -#, no-c-format -msgid "" -"The name of a Hibernate basic type: integer, string, character, " -"date, timestamp, float, binary, serializable, object, blob etc." -msgstr "" -"O nome de um tipo básico de Hibernate: integer, string, character, " -"date, timestamp, float, binary, serializable, object, blob, etc. " - -#. Tag: para -#, no-c-format -msgid "" -"The name of a Java class with a default basic type: int, float, " -"char, java.lang.String, java.util.Date, java.lang.Integer, java.sql.Clob etc." -msgstr "" -"O nome da classe Java com um tipo básico padrão: int, float, char, " -"java.lang.String, java.util.Date, java.lang.Integer, java.sql.Clob, etc." - -#. Tag: para -#, no-c-format -msgid "The name of a serializable Java class." -msgstr "O nome da classe Java serializável" - -#. Tag: para -#, no-c-format -msgid "" -"The class name of a custom type: com.illflow.type.MyCustomType etc." -msgstr "" -"O nome da classe de um tipo customizado: com.illflow.type." -"MyCustomType, etc." - -#. Tag: para +#: basic_mapping.xml:2230 #, no-c-format msgid "" "If you do not specify a type, Hibernate will use reflection upon the named " @@ -2326,6 +4665,7 @@ msgstr "" "ou para especificar um tipo customizado." #. Tag: para +#: basic_mapping.xml:2239 #, no-c-format msgid "" "The access attribute allows you to control how Hibernate " @@ -2346,6 +4686,7 @@ msgstr "" "literal>." #. Tag: para +#: basic_mapping.xml:2248 #, no-c-format msgid "" "A powerful feature is derived properties. These properties are by definition " @@ -2359,7 +4700,20 @@ msgstr "" "SQL, que traduz para cláusula SELECT de uma subconsulta " "da consulta SQL que carrega a instância: " +#. Tag: programlisting +#: basic_mapping.xml:2254 +#, no-c-format +msgid "" +"<property name=\"totalPrice\"\n" +" formula=\"( SELECT SUM (li.quantity*p.price) FROM LineItem li, Product " +"p\n" +" WHERE li.productId = p.productId\n" +" AND li.customerId = customerId\n" +" AND li.orderNumber = orderNumber )\"/>" +msgstr "" + #. Tag: para +#: basic_mapping.xml:2256 #, no-c-format msgid "" "You can reference the entity table by not declaring an alias on a particular " @@ -2374,477 +4728,18 @@ msgstr "" "se você não gostar de usar o atributo. " #. Tag: title +#: basic_mapping.xml:2265 #, no-c-format -msgid "Many-to-one" -msgstr "Muitos-para-um " - -#. Tag: para -#, no-c-format -msgid "" -"An ordinary association to another persistent class is declared using a " -"many-to-one element. The relational model is a many-to-" -"one association; a foreign key in one table is referencing the primary key " -"column(s) of the target table." +msgid "Embedded objects (aka components)" msgstr "" -"Uma associação ordinária para outra classe persistente é declarada usando o " -"elemento many-to-one. O modelo relacional é uma " -"associação muitos para um: uma chave exterior de uma tabela referenciando as " -"colunas da chave primária da tabela destino." #. Tag: para -#, no-c-format -msgid "name: the name of the property." -msgstr "name: O nome da propriedade. " - -#. Tag: para -#, no-c-format +#: basic_mapping.xml:2267 +#, fuzzy, no-c-format msgid "" -"column (optional): the name of the foreign key column. " -"This can also be specified by nested <column> " -"element(s)." -msgstr "" -"column (opcional): O nome da coluna da chave exterior. " -"Isto pode também ser especificado através de elementos aninhados " -"<column>. " - -#. Tag: para -#, no-c-format -msgid "" -"class (optional - defaults to the property type " -"determined by reflection): the name of the associated class." -msgstr "" -"class (opcional – padrão para o tipo de propriedade " -"determinado pela reflexão): O nome da classe associada." - -#. Tag: para -#, no-c-format -msgid "" -"cascade (optional): specifies which operations should be " -"cascaded from the parent object to the associated object." -msgstr "" -"cascade (opcional): Especifica qual operação deve ser " -"cascateada do objeto pai para o objeto associado. " - -#. Tag: para -#, no-c-format -msgid "" -"fetch (optional - defaults to select): " -"chooses between outer-join fetching or sequential select fetching." -msgstr "" -"fetch (opcional - padrão para select): " -"Escolhe entre recuperação da união exterior ou recuperação seqüencial de " -"seleção." - -#. Tag: para -#, no-c-format -msgid "" -"update, insert (optional - defaults to true): specifies that the mapped columns should be included in SQL " -"UPDATE and/or INSERT statements. " -"Setting both to false allows a pure \"derived\" " -"association whose value is initialized from another property that maps to " -"the same column(s), or by a trigger or other application." -msgstr "" -"update, insert (opcional - valor padrão true): especifica que as colunas mapeadas devem ser incluídas em " -"instruções SQL de UPDATE e/ou INSERT. " -"Com o ajuste de ambas para false você permite uma " -"associação \"derivada\" pura cujos valores são inicializados de algumas " -"outras propriedades que mapeiam a(s) mesma(s) coluna(s) ou por um trigger ou " -"outra aplicação. " - -#. Tag: para -#, no-c-format -msgid "" -"property-ref (optional): the name of a property of the " -"associated class that is joined to this foreign key. If not specified, the " -"primary key of the associated class is used." -msgstr "" -"property-ref: (opcional) O nome de uma propriedade da " -"classe associada que esteja unida à esta chave exterior. Se não for " -"especificada, a chave primária da classe associada será utilizada. " - -#. Tag: para -#, no-c-format -msgid "" -"unique (optional): enables the DDL generation of a unique " -"constraint for the foreign-key column. By allowing this to be the target of " -"a property-ref, you can make the association multiplicity " -"one-to-one." -msgstr "" -"unique (opcional): Habilita a geração DDL de uma " -"restrição única para a coluna da chave exterior. Além disso, permite ser o " -"alvo de uma property-ref. Isso torna a multiplicidade da " -"associação efetivamente um para um. " - -#. Tag: para -#, no-c-format -msgid "" -"not-null (optional): enables the DDL generation of a " -"nullability constraint for the foreign key columns." -msgstr "" -"not-null (opcional): Habilita a geração DDL de uma " -"restrição de nulidade para as colunas de chaves exteriores." - -#. Tag: para -#, no-c-format -msgid "" -"lazy (optional - defaults to proxy): " -"by default, single point associations are proxied. lazy=\"no-proxy" -"\" specifies that the property should be fetched lazily when the " -"instance variable is first accessed. This requires build-time bytecode " -"instrumentation. lazy=\"false\" specifies that the " -"association will always be eagerly fetched." -msgstr "" -"lazy(opcional – padrão para proxy): " -"Por padrão, associações de ponto único são envoltas em um proxie. " -"lazy=\"no-proxy\" especifica que a propriedade deve ser " -"trazida de forma tardia quando a instância da variável é acessada pela " -"primeira vez. Isto requer instrumentação bytecode em tempo de criação. O " -"lazy=\"false\" especifica que a associação será sempre " -"procurada." - -#. Tag: para -#, no-c-format -msgid "" -"not-found (optional - defaults to exception): specifies how foreign keys that reference missing rows will be " -"handled. ignore will treat a missing row as a null " -"association." -msgstr "" -"not-found (opcional - padrão para exception): Especifica como as chaves exteriores que informam que linhas que " -"estejam faltando serão manuseadas. O ignore tratará a " -"linha faltante como uma associação nula." - -#. Tag: para -#, no-c-format -msgid "" -"entity-name (optional): the entity name of the associated " -"class." -msgstr "" -"entity-name (opcional): O nome da entidade da classe " -"associada. " - -#. Tag: para -#, no-c-format -msgid "" -"formula (optional): an SQL expression that defines the " -"value for a computed foreign key." -msgstr "" -"formula (optional): Uma instrução SQL que define um valor " -"para uma chave exterior computed." - -#. Tag: para -#, no-c-format -msgid "" -"Setting a value of the cascade attribute to any " -"meaningful value other than none will propagate certain " -"operations to the associated object. The meaningful values are divided into " -"three categories. First, basic operations, which include: persist, " -"merge, delete, save-update, evict, replicate, lock and refresh; " -"second, special values: delete-orphan; and third," -"all comma-separated combinations of operation names: " -"cascade=\"persist,merge,evict\" or cascade=\"all," -"delete-orphan\". See " -"for a full explanation. Note that single valued, many-to-one and one-to-one, " -"associations do not support orphan delete." -msgstr "" -"Ao ajustar o valor do atributo cascade para qualquer " -"valor diferente de none irá propagar certas operações ao " -"objeto associado. Os valores significativos são divididos em três " -"categorias. A primeira, operações básicas, que inclui: persist, " -"merge, delete, save-update, evict, replicate, lock and refresh. A " -"segunda, valores especiais: delete-orphan e a terceira " -"combinações de vírgula separada all dos nomes da " -"operação: cascade=\"persist,merge,evict\" ou " -"cascade=\"all,delete-orphan\". Veja para uma completa explicação. Perceba que as " -"associações de valores únicos, muitos-para-um e um-para-um, não suportam " -"delete órfão: " - -#. Tag: para -#, no-c-format -msgid "Here is an example of a typical many-to-one declaration:" -msgstr "" -"Segue abaixo uma amostra de uma típica declaração many-to-one:" - -#. Tag: para -#, no-c-format -msgid "" -"The property-ref attribute should only be used for " -"mapping legacy data where a foreign key refers to a unique key of the " -"associated table other than the primary key. This is a complicated and " -"confusing relational model. For example, if the Product " -"class had a unique serial number that is not the primary key. The " -"unique attribute controls Hibernate's DDL generation with " -"the SchemaExport tool." -msgstr "" -"O atributo property-ref deve apenas ser usado para mapear " -"dados legados onde uma chave exterior se refere à uma chave exclusiva da " -"tabela associada que não seja a chave primária. Este é um modelo relacional " -"desagradável. Por exemplo, suponha que a classe Product " -"tenha um número seqüencial exclusivo, que não seja a chave primária. O " -"atributo unique controla a geração de DDL do Hibernate " -"com a ferramenta SchemaExport." - -#. Tag: para -#, no-c-format -msgid "Then the mapping for OrderItem might use:" -msgstr "Então o mapeamento para OrderItem poderia usar:" - -#. Tag: para -#, no-c-format -msgid "This is not encouraged, however." -msgstr "No entanto, isto não é recomendável." - -#. Tag: para -#, no-c-format -msgid "" -"If the referenced unique key comprises multiple properties of the associated " -"entity, you should map the referenced properties inside a named <" -"properties> element." -msgstr "" -"Se a chave exclusiva referenciada engloba múltiplas propriedades da entidade " -"associada, você deve mapear as propriedades referenciadas dentro de um " -"elemento chamado <properties>" - -#. Tag: para -#, no-c-format -msgid "" -"If the referenced unique key is the property of a component, you can specify " -"a property path:" -msgstr "" -"Se a chave exclusiva referenciada é a propriedade de um componente, você " -"pode especificar um caminho para a propriedade:" - -#. Tag: title -#, no-c-format -msgid "One-to-one" -msgstr "Um-para-um " - -#. Tag: para -#, no-c-format -msgid "" -"A one-to-one association to another persistent class is declared using a " -"one-to-one element." -msgstr "" -"Uma associação um-pra-um para outra classe persistente é declarada usando um " -"elemento one-to-one ." - -#. Tag: para -#, no-c-format -msgid "" -"constrained (optional): specifies that a foreign key " -"constraint on the primary key of the mapped table and references the table " -"of the associated class. This option affects the order in which save" -"() and delete() are cascaded, and determines " -"whether the association can be proxied. It is also used by the schema export " -"tool." -msgstr "" -"constrained (opcional): Especifica que uma restrição de " -"chave exterior na chave primária da tabela mapeada referencia a tabela da " -"classe associada. Esta opção afeta a ordem em que save() " -"e delete() são cascateadas, e determina se a associação " -"pode sofrer o proxie. Isto também é usado pela ferramenta schema export. " - -#. Tag: para -#, no-c-format -msgid "" -"property-ref (optional): the name of a property of the " -"associated class that is joined to the primary key of this class. If not " -"specified, the primary key of the associated class is used." -msgstr "" -"property-ref(opcional): O nome da propriedade da classe " -"associada que é ligada à chave primária desta classe. Se não for " -"especificada, a chave primária da classe associada é utilizada. " - -#. Tag: para -#, no-c-format -msgid "" -"formula (optional): almost all one-to-one associations " -"map to the primary key of the owning entity. If this is not the case, you " -"can specify another column, columns or expression to join on using an SQL " -"formula. See org.hibernate.test.onetooneformula for an " -"example." -msgstr "" -"formula (opcional): Quase todas associações um-pra-um " -"mapeiam para a chave primária da entidade dona. Caso este não seja o caso, " -"você pode especificar uma outra coluna, colunas ou expressões para unir " -"utilizando uma fórmula SQL. Veja org.hibernate.test." -"onetooneformula para exemplo. " - -#. Tag: para -#, no-c-format -msgid "" -"lazy (optional - defaults to proxy): " -"by default, single point associations are proxied. lazy=\"no-proxy" -"\" specifies that the property should be fetched lazily when the " -"instance variable is first accessed. It requires build-time bytecode " -"instrumentation. lazy=\"false\" specifies that the " -"association will always be eagerly fetched. Note that if " -"constrained=\"false\", proxying is impossible and " -"Hibernate will eagerly fetch the association." -msgstr "" -"lazy (opcional – valor padrão proxy): " -"Por padrão, as associações de ponto único estão em proxy. lazy=\"no-" -"proxy\" especifica que a propriedade deve ser recuperada de forma " -"preguiçosa quando a variável da instância for acessada pela primeira vez. " -"Isto requer instrumentação de bytecode de tempo de construção. lazy=" -"\"false\" especifica que a associação terá sempre uma busca " -"antecipada (eager fetched). Note que se constrained=" -"\"false\", será impossível efetuar o proxing e o Hibernate irá " -"realizar uma busca antecipada na associação." - -#. Tag: para -#, no-c-format -msgid "There are two varieties of one-to-one associations:" -msgstr "Existem duas variedades de associações um-pra-um: " - -#. Tag: para -#, no-c-format -msgid "primary key associations" -msgstr "Associações de chave primária" - -#. Tag: para -#, no-c-format -msgid "unique foreign key associations" -msgstr "Associações de chave exterior exclusiva" - -#. Tag: para -#, no-c-format -msgid "" -"Primary key associations do not need an extra table column. If two rows are " -"related by the association, then the two table rows share the same primary " -"key value. To relate two objects by a primary key association, ensure that " -"they are assigned the same identifier value." -msgstr "" -"Associações de chave primária não necessitam de uma coluna extra de tabela. " -"Se duas linhas forem relacionadas pela associação, então as duas linhas da " -"tabela dividem o mesmo valor da chave primária. Assim, se você quiser que " -"dois objetos sejam relacionados por uma associação de chave primária, você " -"deve ter certeza que foram atribuídos com o mesmo valor identificador." - -#. Tag: para -#, no-c-format -msgid "" -"For a primary key association, add the following mappings to " -"Employee and Person respectively:" -msgstr "" -"Para uma associação de chave primária, adicione os seguintes mapeamentos em " -"Employee e Person, respectivamente:" - -#. Tag: para -#, no-c-format -msgid "" -"Ensure that the primary keys of the related rows in the PERSON and EMPLOYEE " -"tables are equal. You use a special Hibernate identifier generation strategy " -"called foreign:" -msgstr "" -"Agora devemos assegurar que as chaves primárias de linhas relacionadas nas " -"tabelas PERSON e EMPLOYEE são iguais. Nós usamos uma estratégia especial de " -"geração de identificador do Hibernate chamada foreign:" - -#. Tag: para -#, no-c-format -msgid "" -"A newly saved instance of Person is assigned the same " -"primary key value as the Employee instance referred with " -"the employee property of that Person." -msgstr "" -"Uma nova instância de Person é atribuída com o mesmo " -"valor da chave primária da instância de Employee " -"referenciada com a propriedade employee daquela " -"Person." - -#. Tag: para -#, no-c-format -msgid "" -"Alternatively, a foreign key with a unique constraint, from " -"Employee to Person, can be expressed " -"as:" -msgstr "" -"Alternativamente, uma chave exterior com uma restrição única, de " -"Employee para Person, pode ser " -"expressada como:" - -#. Tag: para -#, no-c-format -msgid "" -"This association can be made bidirectional by adding the following to the " -"Person mapping:" -msgstr "" -"Esta associação pode ser feita de forma bi-direcional adicionando o seguinte " -"no mapeamento de Person:" - -#. Tag: title -#, no-c-format -msgid "Natural-id" -msgstr "Id Natural" - -#. Tag: para -#, no-c-format -msgid "" -"Although we recommend the use of surrogate keys as primary keys, you should " -"try to identify natural keys for all entities. A natural key is a property " -"or combination of properties that is unique and non-null. It is also " -"immutable. Map the properties of the natural key inside the <" -"natural-id> element. Hibernate will generate the necessary " -"unique key and nullability constraints and, as a result, your mapping will " -"be more self-documenting." -msgstr "" -"Embora recomendemos o uso das chaves substitutas como chaves primárias, você " -"deve ainda identificar chaves naturais para todas as entidades. Uma chave " -"natural é uma propriedade ou combinação de propriedades que é exclusiva e " -"não nula. Mapeie as propriedades da chave natural dentro do elemento " -"<natural-id>. O Hibernate irá gerar a chave " -"exclusiva necessária e as restrições de anulabilidade, e seu mapeamento será " -"apropriadamente auto documentado." - -#. Tag: para -#, no-c-format -msgid "" -"It is recommended that you implement equals() and " -"hashCode() to compare the natural key properties of the " -"entity." -msgstr "" -"Nós recomendamos com ênfase que você implemente equals() " -"e hashCode() para comparar as propriedades da chave " -"natural da entidade. " - -#. Tag: para -#, no-c-format -msgid "" -"This mapping is not intended for use with entities that have natural primary " -"keys." -msgstr "" -"Este mapeamento não pretende ser utilizado com entidades com chaves naturais " -"primárias." - -#. Tag: para -#, no-c-format -msgid "" -"mutable (optional - defaults to false): by default, natural identifier properties are assumed to be " -"immutable (constant)." -msgstr "" -"mutable (opcional, padrão false): Por " -"padrão, propriedades naturais identificadoras são consideradas imutáveis " -"(constante)." - -#. Tag: title -#, no-c-format -msgid "Component and dynamic-component" -msgstr "Componente e componente dinâmico" - -#. Tag: para -#, no-c-format -msgid "" -"The <component> element maps properties of a child " -"object to columns of the table of a parent class. Components can, in turn, " -"declare their own properties, components or collections. See the \"Component" -"\" examples below:" +"Embeddable objects (or components) are objects whose properties are mapped " +"to the same table as the owning entity's table. Components can, in turn, " +"declare their own properties, components or collections" msgstr "" "O elemento <component> mapeia propriedades de um " "objeto filho para colunas da tabela de uma classe pai. Os componentes podem, " @@ -2852,6 +4747,193 @@ msgstr "" "coleções. Veja \"Components\" abaixo:" #. Tag: para +#: basic_mapping.xml:2272 +#, no-c-format +msgid "" +"It is possible to declare an embedded component inside an entity and even " +"override its column mapping. Component classes have to be annotated at the " +"class level with the @Embeddable annotation. It is " +"possible to override the column mapping of an embedded object for a " +"particular entity using the @Embedded and " +"@AttributeOverride annotation in the associated property:" +msgstr "" + +#. Tag: programlisting +#: basic_mapping.xml:2280 +#, no-c-format +msgid "" +"@Entity\n" +"public class Person implements Serializable {\n" +"\n" +" // Persistent component using defaults\n" +" Address homeAddress;\n" +"\n" +" @Embedded\n" +" @AttributeOverrides( {\n" +" @AttributeOverride(name=\"iso2\", column = @Column(name=" +"\"bornIso2\") ),\n" +" @AttributeOverride(name=\"name\", column = @Column(name=" +"\"bornCountryName\") )\n" +" } )\n" +" Country bornIn;\n" +" ...\n" +"}" +msgstr "" + +#. Tag: programlisting +#: basic_mapping.xml:2282 +#, no-c-format +msgid "" +"@Embeddable\n" +"public class Address implements Serializable {\n" +" String city;\n" +" Country nationality; //no overriding here\n" +"}" +msgstr "" + +#. Tag: programlisting +#: basic_mapping.xml:2284 +#, no-c-format +msgid "" +"@Embeddable\n" +"public class Country implements Serializable {\n" +" private String iso2;\n" +" @Column(name=\"countryName\") private String name;\n" +"\n" +" public String getIso2() { return iso2; }\n" +" public void setIso2(String iso2) { this.iso2 = iso2; }\n" +"\n" +" \n" +" public String getName() { return name; }\n" +" public void setName(String name) { this.name = name; }\n" +" ...\n" +"}" +msgstr "" + +#. Tag: para +#: basic_mapping.xml:2286 +#, no-c-format +msgid "" +"An embeddable object inherits the access type of its owning entity (note " +"that you can override that using the @Access annotation)." +msgstr "" + +#. Tag: para +#: basic_mapping.xml:2290 +#, no-c-format +msgid "" +"The Person entity has two component properties, " +"homeAddress and bornIn. " +"homeAddress property has not been annotated, but " +"Hibernate will guess that it is a persistent component by looking for the " +"@Embeddable annotation in the Address class. We also " +"override the mapping of a column name (to bornCountryName) with the @Embedded and " +"@AttributeOverride annotations for each mapped attribute " +"of Country. As you can see, Country is " +"also a nested component of Address, again using auto-" +"detection by Hibernate and JPA defaults. Overriding columns of embedded " +"objects of embedded objects is through dotted expressions." +msgstr "" + +#. Tag: programlisting +#: basic_mapping.xml:2305 +#, no-c-format +msgid "" +"@Embedded\n" +" @AttributeOverrides( {\n" +" @AttributeOverride(name=\"city\", column = @Column(name=" +"\"fld_city\") ),\n" +" @AttributeOverride(name=\"nationality.iso2\", column = @Column" +"(name=\"nat_Iso2\") ),\n" +" @AttributeOverride(name=\"nationality.name\", column = @Column" +"(name=\"nat_CountryName\") )\n" +" //nationality columns in homeAddress are overridden\n" +" } )\n" +" Address homeAddress;" +msgstr "" + +#. Tag: para +#: basic_mapping.xml:2307 +#, no-c-format +msgid "" +"Hibernate Annotations supports something that is not explicitly supported by " +"the JPA specification. You can annotate a embedded object with the " +"@MappedSuperclass annotation to make the superclass " +"properties persistent (see @MappedSuperclass for more " +"informations)." +msgstr "" + +#. Tag: para +#: basic_mapping.xml:2313 +#, no-c-format +msgid "" +"You can also use association annotations in an embeddable object (ie " +"@OneToOne, @ManyToOne, " +"@OneToMany or @ManyToMany). To " +"override the association columns you can use @AssociationOverride." +msgstr "" + +#. Tag: para +#: basic_mapping.xml:2319 +#, no-c-format +msgid "" +"If you want to have the same embeddable object type twice in the same " +"entity, the column name defaulting will not work as several embedded objects " +"would share the same set of columns. In plain JPA, you need to override at " +"least one set of columns. Hibernate, however, allows you to enhance the " +"default naming mechanism through the NamingStrategy " +"interface. You can write a strategy that prevent name clashing in such a " +"situation. DefaultComponentSafeNamingStrategy is an " +"example of this." +msgstr "" + +#. Tag: para +#: basic_mapping.xml:2329 +#, no-c-format +msgid "" +"If a property of the embedded object points back to the owning entity, " +"annotate it with the @Parent annotation. Hibernate " +"will make sure this property is properly loaded with the entity reference." +msgstr "" + +#. Tag: para +#: basic_mapping.xml:2334 +#, no-c-format +msgid "In XML, use the <component> element." +msgstr "" + +#. Tag: programlisting +#: basic_mapping.xml:2356 +#, no-c-format +msgid "" +"<component\n" +" name=\"propertyName\"\n" +" class=\"className\"\n" +" insert=\"true|false\"\n" +" update=\"true|false\"\n" +" access=\"field|property|ClassName\"\n" +" lazy=\"true|false\"\n" +" optimistic-lock=\"true|false\"\n" +" unique=\"true|false\"\n" +" node=\"element-name|.\"\n" +">\n" +"\n" +" <property ...../>\n" +" <many-to-one .... />\n" +" ........\n" +"</component>" +msgstr "" + +#. Tag: para +#: basic_mapping.xml:2360 basic_mapping.xml:3181 basic_mapping.xml:3381 +#, no-c-format +msgid "name: the name of the property." +msgstr "name: O nome da propriedade. " + +#. Tag: para +#: basic_mapping.xml:2364 #, no-c-format msgid "" "class (optional - defaults to the property type " @@ -2861,6 +4943,7 @@ msgstr "" "determinada por reflection): O nome da classe (filha) do componente." #. Tag: para +#: basic_mapping.xml:2370 basic_mapping.xml:3641 #, no-c-format msgid "" "insert: do the mapped columns appear in SQL " @@ -2870,6 +4953,7 @@ msgstr "" "INSERTs? " #. Tag: para +#: basic_mapping.xml:2375 basic_mapping.xml:3646 #, no-c-format msgid "" "update: do the mapped columns appear in SQL " @@ -2879,6 +4963,7 @@ msgstr "" "UPDATEs? " #. Tag: para +#: basic_mapping.xml:2386 #, no-c-format msgid "" "lazy (optional - defaults to false): " @@ -2891,6 +4976,7 @@ msgstr "" "construção." #. Tag: para +#: basic_mapping.xml:2393 #, no-c-format msgid "" "optimistic-lock (optional - defaults to trueunique (optional - defaults to false): " @@ -2915,6 +5002,7 @@ msgstr "" "mapeadas do componente. " #. Tag: para +#: basic_mapping.xml:2408 #, no-c-format msgid "" "The child <property> tags map properties of the " @@ -2924,6 +5012,7 @@ msgstr "" "mapeamento da classe filha para colunas de uma tabela." #. Tag: para +#: basic_mapping.xml:2411 #, no-c-format msgid "" "The <component> element allows a <" @@ -2935,12 +5024,13 @@ msgstr "" "componente como uma referencia de volta para a entidade que o contém." #. Tag: para -#, no-c-format +#: basic_mapping.xml:2415 +#, fuzzy, no-c-format msgid "" "The <dynamic-component> element allows a " "Map to be mapped as a component, where the property names " -"refer to keys of the map. See for " -"more information." +"refer to keys of the map. See for " +"more information. This feature is not supported in annotations." msgstr "" "O elemento <dynamic-component> permite que um " "Map possa ser mapeado como um componente onde os nomes " @@ -2948,101 +5038,138 @@ msgstr "" "\"components-dynamic\"/> para maiores informações." #. Tag: title +#: basic_mapping.xml:2423 #, no-c-format -msgid "Properties" -msgstr "Propriedades" +msgid "Inheritance strategy" +msgstr "" #. Tag: para +#: basic_mapping.xml:2425 #, no-c-format msgid "" -"The <properties> element allows the definition of a " -"named, logical grouping of the properties of a class. The most important use " -"of the construct is that it allows a combination of properties to be the " -"target of a property-ref. It is also a convenient way to " -"define a multi-column unique constraint. For example:" +"Java is a language supporting polymorphism: a class can inherit from " +"another. Several strategies are possible to persist a class hierarchy:" msgstr "" -"O elemento <properties> permite a definição de um " -"grupo com nome, lógico de propriedades de uma classe. A função mais " -"importante do construtor é que ele permite que a combinação de propriedades " -"seja o objetivo de uma property-ref. É também um modo " -"conveninente para definir uma restrição única de múltiplas colunas. Por " -"exemplo:" #. Tag: para +#: basic_mapping.xml:2431 #, no-c-format msgid "" -"name: the logical name of the grouping. It is " -"not an actual property name." +"Single table per class hierarchy strategy: a single table hosts all the " +"instances of a class hierarchy" msgstr "" -"name: O nome lógico do agrupamento. Isto não é o nome atual de propriedade." #. Tag: para +#: basic_mapping.xml:2436 #, no-c-format msgid "" -"optimistic-lock (optional - defaults to true): specifies that updates to these properties either do or do not " -"require acquisition of the optimistic lock. It determines if a version " -"increment should occur when these properties are dirty." +"Joined subclass strategy: one table per class and subclass is present and " +"each table persist the properties specific to a given subclass. The state of " +"the entity is then stored in its corresponding class table and all its " +"superclasses" msgstr "" -"optimistic-lock (opcional – padrão para true): Especifica que atualizações para estes componentes requerem ou " -"não aquisição de um bloqueio otimista. Em outras palavras, determina se uma " -"versão de incremento deve ocorrer quando estas propriedades estiverem sujas." #. Tag: para +#: basic_mapping.xml:2443 #, no-c-format msgid "" -"For example, if we have the following <properties> " -"mapping:" +"Table per class strategy: one table per concrete class and subclass is " +"present and each table persist the properties of the class and its " +"superclasses. The state of the entity is then stored entirely in the " +"dedicated table for its class." msgstr "" -"Por exemplo, se temos o seguinte mapeamento de <properties>:" - -#. Tag: para -#, no-c-format -msgid "" -"You might have some legacy data association that refers to this unique key " -"of the Person table, instead of to the primary key:" -msgstr "" -"Então podemos ter uma associação de dados legados que referem a esta chave " -"exclusiva da tabela Person, ao invés de se referirem a " -"chave primária:" - -#. Tag: para -#, no-c-format -msgid "" -"The use of this outside the context of mapping legacy data is not " -"recommended." -msgstr "" -"Nós não recomendamos o uso deste tipo de coisa fora do contexto de " -"mapeamento de dados legados." #. Tag: title +#: basic_mapping.xml:2451 #, no-c-format -msgid "Subclass" -msgstr "Subclass" +msgid "Single table per class hierarchy strategy" +msgstr "" #. Tag: para +#: basic_mapping.xml:2453 #, no-c-format msgid "" -"Polymorphic persistence requires the declaration of each subclass of the " -"root persistent class. For the table-per-class-hierarchy mapping strategy, " -"the <subclass> declaration is used. For example:" +"With this approach the properties of all the subclasses in a given mapped " +"class hierarchy are stored in a single table." +msgstr "" + +#. Tag: para +#: basic_mapping.xml:2456 +#, fuzzy, no-c-format +msgid "" +"Each subclass declares its own persistent properties and subclasses. Version " +"and id properties are assumed to be inherited from the root class. Each " +"subclass in a hierarchy must define a unique discriminator value. If this is " +"not specified, the fully qualified Java class name is used." +msgstr "" +"Cada subclasse deve declarar suas próprias propriedades persistentes e " +"subclasses. As propriedades <version> e " +"<id> são configuradas para serem herdadas da classe " +"raíz. Cada subclasse numa hierarquia deve definir um único " +"discriminator-value. Se nenhum for especificado, será " +"usado o nome da classe Java completamente qualificado." + +#. Tag: programlisting +#: basic_mapping.xml:2462 basic_mapping.xml:2540 +#, no-c-format +msgid "" +"@Entity\n" +"@Inheritance(strategy=InheritanceType.SINGLE_TABLE)\n" +"@DiscriminatorColumn(\n" +" name=\"planetype\",\n" +" discriminatorType=DiscriminatorType.STRING\n" +")\n" +"@DiscriminatorValue(\"Plane\")\n" +"public class Plane { ... }\n" +"\n" +"@Entity\n" +"@DiscriminatorValue(\"A320\")\n" +"public class A320 extends Plane { ... }" +msgstr "" + +#. Tag: para +#: basic_mapping.xml:2464 +#, fuzzy, no-c-format +msgid "" +"In hbm.xml, for the table-per-class-hierarchy mapping strategy, the " +"<subclass> declaration is used. For example:" msgstr "" "Finalmente, a persistência polimórfica requer a declaração de cada subclasse " "da classe raíz de persistência. Para a estratégia de mapeamento tabela-por-" "hierarquia-de-classe, deve-se utilizar a declaração <subclass>" ". Por exemplo:" -#. Tag: para +#. Tag: programlisting +#: basic_mapping.xml:2479 #, no-c-format -msgid "name: the fully qualified class name of the subclass." +msgid "" +"<subclass\n" +" name=\"ClassName\"\n" +" discriminator-value=\"discriminator_value\"\n" +" proxy=\"ProxyInterface\"\n" +" lazy=\"true|false\"\n" +" dynamic-update=\"true|false\"\n" +" dynamic-insert=\"true|false\"\n" +" entity-name=\"EntityName\"\n" +" node=\"element-name\"\n" +" extends=\"SuperclassName\">\n" +"\n" +" <property .... />\n" +" .....\n" +"</subclass>" +msgstr "" + +#. Tag: para +#: basic_mapping.xml:2483 basic_mapping.xml:2656 basic_mapping.xml:2720 +#, no-c-format +msgid "" +"name: the fully qualified class name of the subclass." msgstr "" "name: O nome de classe completamente qualificada da " "subclasse. " #. Tag: para +#: basic_mapping.xml:2488 #, no-c-format msgid "" "discriminator-value (optional - defaults to the class " @@ -3052,6 +5179,7 @@ msgstr "" "classe): Um valor que distingue subclasses individuais." #. Tag: para +#: basic_mapping.xml:2494 #, no-c-format msgid "" "proxy (optional): specifies a class or interface used for " @@ -3061,6 +5189,7 @@ msgstr "" "usará os proxies de inicialização lazy." #. Tag: para +#: basic_mapping.xml:2499 #, no-c-format msgid "" "lazy (optional - defaults to true): " @@ -3071,54 +5200,291 @@ msgstr "" "inicialização lazy." #. Tag: para -#, no-c-format +#: basic_mapping.xml:2507 basic_mapping.xml:2685 basic_mapping.xml:2746 +#, fuzzy, no-c-format msgid "" -"Each subclass declares its own persistent properties and subclasses. " -"<version> and <id> " -"properties are assumed to be inherited from the root class. Each subclass in " -"a hierarchy must define a unique discriminator-value. If " -"this is not specified, the fully qualified Java class name is used." -msgstr "" -"Cada subclasse deve declarar suas próprias propriedades persistentes e " -"subclasses. As propriedades <version> e " -"<id> são configuradas para serem herdadas da classe " -"raíz. Cada subclasse numa hierarquia deve definir um único " -"discriminator-value. Se nenhum for especificado, será " -"usado o nome da classe Java completamente qualificado." - -#. Tag: para -#, no-c-format -msgid "" -"For information about inheritance mappings see ." +"For information about inheritance mappings see ." msgstr "" "Para informações sobre mapeamento de heranças. Consulte o ." #. Tag: title +#: basic_mapping.xml:2511 #, no-c-format -msgid "Joined-subclass" +msgid "Discriminator" +msgstr "Discriminador " + +#. Tag: para +#: basic_mapping.xml:2513 +#, fuzzy, no-c-format +msgid "" +"Discriminators are required for polymorphic persistence using the table-per-" +"class-hierarchy mapping strategy. It declares a discriminator column of the " +"table. The discriminator column contains marker values that tell the " +"persistence layer what subclass to instantiate for a particular row. A " +"restricted set of types can be used: string, " +"character, integer, byte, short, boolean, " +"yes_no, true_false." +msgstr "" +"O elemento <discriminator> é necessário para " +"persistência polimórfica utilizando a estratégia de mapeamento de tabela-por-" +"classe-hierárquica e declara uma coluna discriminadora da tabela. A coluna " +"discriminadora contém valores de marcação que informam à camada de " +"persistência qual subclasse instanciar para uma linha em específico. Um " +"restrito conjunto de tipos que podem ser utilizados: string, character, integer, " +"byte, short, boolean, yes_no, true_false." + +#. Tag: para +#: basic_mapping.xml:2523 +#, no-c-format +msgid "" +"Use the @DiscriminatorColumn to define the " +"discriminator column as well as the discriminator type. Alternatively, you " +"can also use @DiscriminatorFormula to express in SQL " +"what would be in a virtual discriminator column. This is particularly handy " +"when the discriminator value can be extracted from one or more columns of " +"the table. Both @DiscriminatorColumn and " +"@DiscriminatorFormula are to be set on the root " +"entity (once per persisted hierarchy)." +msgstr "" + +#. Tag: para +#: basic_mapping.xml:2534 +#, no-c-format +msgid "" +"Finally, use @DiscriminatorValue on each class of the " +"hierarchy to specify the value stored in the discriminator column for a " +"given entity. If you do not set @DiscriminatorValue " +"on a class, the fully qualified class name is used." +msgstr "" + +#. Tag: para +#: basic_mapping.xml:2542 +#, no-c-format +msgid "" +"In hbm.xml, the <discriminator> element is used to " +"define the discriminator column or formula:" +msgstr "" + +#. Tag: programlisting +#: basic_mapping.xml:2559 +#, no-c-format +msgid "" +"<discriminator\n" +" column=\"discriminator_column\"\n" +" type=\"discriminator_type\"\n" +" force=\"true|false\"\n" +" insert=\"true|false\"\n" +" formula=\"arbitrary sql expression\"\n" +"/>" +msgstr "" + +#. Tag: para +#: basic_mapping.xml:2563 +#, no-c-format +msgid "" +"column (optional - defaults to class): " +"the name of the discriminator column." +msgstr "" +"column (opcional - padrão para class): " +"O nome da coluna discriminadora." + +#. Tag: para +#: basic_mapping.xml:2569 +#, no-c-format +msgid "" +"type (optional - defaults to string): " +"a name that indicates the Hibernate type" +msgstr "" +"type (opcional - padrão para string): " +"O nome que indica o tipo Hibernate." + +#. Tag: para +#: basic_mapping.xml:2575 +#, no-c-format +msgid "" +"force (optional - defaults to false): " +"\"forces\" Hibernate to specify the allowed discriminator values, even when " +"retrieving all instances of the root class." +msgstr "" +"force (opcional - valor padrão false): " +"\"Força\" o Hibernate a especificar valores discriminadores permitidos mesmo " +"quando recuperando todas as instâncias da classe raíz. " + +#. Tag: para +#: basic_mapping.xml:2582 +#, no-c-format +msgid "" +"insert (optional - defaults to true): " +"set this to false if your discriminator column is also " +"part of a mapped composite identifier. It tells Hibernate not to include the " +"column in SQL INSERTs." +msgstr "" +"insert (opcional - valor padrão para true) Ajuste para false se sua coluna discriminadora " +"também fizer parte do identificador composto mapeado. (Isto informa ao " +"Hibernate para não incluir a coluna em comandos SQL INSERTs)." + +#. Tag: para +#: basic_mapping.xml:2590 +#, no-c-format +msgid "" +"formula (optional): an arbitrary SQL expression that is " +"executed when a type has to be evaluated. It allows content-based " +"discrimination." +msgstr "" +"formula (opcional): Uma expressão SQL arbitrária que é " +"executada quando um tipo tem que ser avaliado. Permite discriminação baseada " +"em conteúdo. " + +#. Tag: para +#: basic_mapping.xml:2597 +#, no-c-format +msgid "" +"Actual values of the discriminator column are specified by the " +"discriminator-value attribute of the <" +"class> and <subclass> elements." +msgstr "" +"Valores atuais de uma coluna discriminada são especificados pela função " +"discriminator-value da <class> e " +"elementos da <subclass>." + +#. Tag: para +#: basic_mapping.xml:2602 +#, no-c-format +msgid "" +"The force attribute is only useful if the table contains " +"rows with \"extra\" discriminator values that are not mapped to a persistent " +"class. This will not usually be the case." +msgstr "" +"O atributo force é útil (apenas) em tabelas contendo " +"linhas com valores discriminadores \"extras\" que não estão mapeados para " +"uma classe persistente. Este não é geralmente o caso." + +#. Tag: para +#: basic_mapping.xml:2607 +#, no-c-format +msgid "" +"The formula attribute allows you to declare an arbitrary " +"SQL expression that will be used to evaluate the type of a row. For example:" +msgstr "" +"Usando o atributo formula você pode declarar uma " +"expressão SQL arbitrária que será utilizada para avaliar o tipo de uma " +"linha. Por exemplo:" + +#. Tag: programlisting +#: basic_mapping.xml:2611 +#, no-c-format +msgid "" +"<discriminator\n" +" formula=\"case when CLASS_TYPE in ('a', 'b', 'c') then 0 else 1 end\"\n" +" type=\"integer\"/>" +msgstr "" + +#. Tag: title +#: basic_mapping.xml:2616 +#, fuzzy, no-c-format +msgid "Joined subclass strategy" msgstr "Subclasses Unidas " #. Tag: para -#, no-c-format +#: basic_mapping.xml:2618 +#, fuzzy, no-c-format msgid "" "Each subclass can also be mapped to its own table. This is called the table-" "per-subclass mapping strategy. An inherited state is retrieved by joining " -"with the table of the superclass. To do this you use the <joined-" -"subclass> element. For example:" +"with the table of the superclass. A discriminator column is not required for " +"this mapping strategy. Each subclass must, however, declare a table column " +"holding the object identifier. The primary key of this table is also a " +"foreign key to the superclass table and described by the " +"@PrimaryKeyJoinColumns or the <key> element." msgstr "" "Alternativamente, cada subclasse pode ser mapeada para sua própria tabela. " "Isto é chamado estratégia de mapeamento de tabela-por-subclasse. O estado " "herdado é devolvido por associação com a tabela da superclasse. Nós usamos o " "elemento <joined-subclass>. Por exemplo:" +#. Tag: programlisting +#: basic_mapping.xml:2628 +#, no-c-format +msgid "" +"@Entity @Table(name=\"CATS\")\n" +"@Inheritance(strategy=InheritanceType.JOINED)\n" +"public class Cat implements Serializable { \n" +" @Id @GeneratedValue(generator=\"cat-uuid\") \n" +" @GenericGenerator(name=\"cat-uuid\", strategy=\"uuid\")\n" +" String getId() { return id; }\n" +"\n" +" ...\n" +"}\n" +"\n" +"@Entity @Table(name=\"DOMESTIC_CATS\")\n" +"@PrimaryKeyJoinColumn(name=\"CAT\")\n" +"public class DomesticCat extends Cat { \n" +" public String getName() { return name; }\n" +"}" +msgstr "" + #. Tag: para +#: basic_mapping.xml:2631 +#, no-c-format +msgid "" +"The table name still defaults to the non qualified class name. Also if " +"@PrimaryKeyJoinColumn is not set, the primary key / " +"foreign key columns are assumed to have the same names as the primary key " +"columns of the primary table of the superclass." +msgstr "" + +#. Tag: para +#: basic_mapping.xml:2638 +#, fuzzy, no-c-format +msgid "" +"In hbm.xml, use the <joined-subclass> element. For " +"example:" +msgstr "" +"Você pode declarar uma classe persistente utilizando o elemento " +"class. Por exemplo:" + +#. Tag: programlisting +#: basic_mapping.xml:2652 +#, no-c-format +msgid "" +"<joined-subclass\n" +" name=\"ClassName\"\n" +" table=\"tablename\"\n" +" proxy=\"ProxyInterface\"\n" +" lazy=\"true|false\"\n" +" dynamic-update=\"true|false\"\n" +" dynamic-insert=\"true|false\"\n" +" schema=\"schema\"\n" +" catalog=\"catalog\"\n" +" extends=\"SuperclassName\"\n" +" persister=\"ClassName\"\n" +" subselect=\"SQL expression\"\n" +" entity-name=\"EntityName\"\n" +" node=\"element-name\">\n" +"\n" +" <key .... >\n" +"\n" +" <property .... />\n" +" .....\n" +"</joined-subclass>" +msgstr "" + +#. Tag: para +#: basic_mapping.xml:2661 basic_mapping.xml:2725 #, no-c-format msgid "table: the name of the subclass table." msgstr "table: O nome da tabela da subclasse. " #. Tag: para +#: basic_mapping.xml:2666 basic_mapping.xml:2730 #, no-c-format msgid "" "proxy (optional): specifies a class or interface to use " @@ -3128,6 +5494,7 @@ msgstr "" "usará os proxies de inicialização lazy. " #. Tag: para +#: basic_mapping.xml:2671 basic_mapping.xml:2735 #, no-c-format msgid "" "lazy (optional, defaults to true): " @@ -3138,35 +5505,70 @@ msgstr "" "inicialização lazy." #. Tag: para +#: basic_mapping.xml:2679 #, no-c-format msgid "" -"A discriminator column is not required for this mapping strategy. Each " -"subclass must, however, declare a table column holding the object identifier " -"using the <key> element. The mapping at the start " -"of the chapter would then be re-written as:" +"Use the <key> element to declare the primary key / " +"foreign key column. The mapping at the start of the chapter would then be re-" +"written as:" +msgstr "" + +#. Tag: programlisting +#: basic_mapping.xml:2683 +#, no-c-format +msgid "" +"<?xml version=\"1.0\"?>\n" +"<!DOCTYPE hibernate-mapping PUBLIC\n" +" \"-//Hibernate/Hibernate Mapping DTD//EN\"\n" +" \"http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd\">\n" +"\n" +"<hibernate-mapping package=\"eg\">\n" +"\n" +" <class name=\"Cat\" table=\"CATS\">\n" +" <id name=\"id\" column=\"uid\" type=\"long\">\n" +" <generator class=\"hilo\"/>\n" +" </id>\n" +" <property name=\"birthdate\" type=\"date\"/>\n" +" <property name=\"color\" not-null=\"true\"/>\n" +" <property name=\"sex\" not-null=\"true\"/>\n" +" <property name=\"weight\"/>\n" +" <many-to-one name=\"mate\"/>\n" +" <set name=\"kittens\">\n" +" <key column=\"MOTHER\"/>\n" +" <one-to-many class=\"Cat\"/>\n" +" </set>\n" +" <joined-subclass name=\"DomesticCat\" table=" +"\"DOMESTIC_CATS\">\n" +" <key column=\"CAT\"/>\n" +" <property name=\"name\" type=\"string\"/>\n" +" </joined-subclass>\n" +" </class>\n" +"\n" +" <class name=\"eg.Dog\">\n" +" <!-- mapping for Dog could go here -->\n" +" </class>\n" +"\n" +"</hibernate-mapping>" msgstr "" -"A coluna discriminadora não é requerida para esta estratégia de mapeamento. " -"Cada subclasse deve declarar uma coluna de tabela com o identificador do " -"objeto usando o elemento <key>. O mapeamento no " -"início do capítulo poderia ser re-escrito assim: " #. Tag: title +#: basic_mapping.xml:2690 #, no-c-format -msgid "Union-subclass" -msgstr "Subclasse de União" +msgid "Table per class strategy" +msgstr "" #. Tag: para -#, no-c-format +#: basic_mapping.xml:2692 +#, fuzzy, no-c-format msgid "" "A third option is to map only the concrete classes of an inheritance " "hierarchy to tables. This is called the table-per-concrete-class strategy. " "Each table defines all persistent states of the class, including the " "inherited state. In Hibernate, it is not necessary to explicitly map such " -"inheritance hierarchies. You can map each class with a separate <" -"class> declaration. However, if you wish use polymorphic " -"associations (e.g. an association to the superclass of your hierarchy), you " -"need to use the <union-subclass> mapping. For " -"example:" +"inheritance hierarchies. You can map each class as a separate entity root. " +"However, if you wish use polymorphic associations (e.g. an association to " +"the superclass of your hierarchy), you need to use the union subclass " +"mapping." msgstr "" "Uma terceira opção é mapear apenas as classes concretas de uma hierarquia de " "heranças para tabelas. Isto é chamado estratégia table-per-concrete-class. " @@ -3178,33 +5580,438 @@ msgstr "" "associação para a superclasse de sua hierarquia), você precisa usar o " "mapeamento <union-subclass>. Por exemplo:" -#. Tag: para -#, no-c-format -msgid "No discriminator column or key column is required for this mapping strategy." -msgstr "A coluna discriminatória não é requerida para esta estratégia de mapeamento." - -#. Tag: title -#, no-c-format -msgid "Join" -msgstr "União " - -#. Tag: para +#. Tag: programlisting +#: basic_mapping.xml:2701 #, no-c-format msgid "" -"Using the <join> element, it is possible to map " -"properties of one class to several tables that have a one-to-one " -"relationship. For example:" +"@Entity\n" +"@Inheritance(strategy = InheritanceType.TABLE_PER_CLASS)\n" +"public class Flight implements Serializable { ... }" msgstr "" -"Usando o elemento <join>>, é possível mapear " -"propriedades de uma classe para várias tabelas que possuem uma relação um " -"por um. Por exemplo:" #. Tag: para +#: basic_mapping.xml:2703 +#, no-c-format +msgid "Or in hbm.xml:" +msgstr "" + +#. Tag: programlisting +#: basic_mapping.xml:2716 +#, no-c-format +msgid "" +"<union-subclass\n" +" name=\"ClassName\"\n" +" table=\"tablename\"\n" +" proxy=\"ProxyInterface\"\n" +" lazy=\"true|false\"\n" +" dynamic-update=\"true|false\"\n" +" dynamic-insert=\"true|false\"\n" +" schema=\"schema\"\n" +" catalog=\"catalog\"\n" +" extends=\"SuperclassName\"\n" +" abstract=\"true|false\"\n" +" persister=\"ClassName\"\n" +" subselect=\"SQL expression\"\n" +" entity-name=\"EntityName\"\n" +" node=\"element-name\">\n" +"\n" +" <property .... />\n" +" .....\n" +"</union-subclass>" +msgstr "" + +#. Tag: para +#: basic_mapping.xml:2743 +#, no-c-format +msgid "" +"No discriminator column or key column is required for this mapping strategy." +msgstr "" +"A coluna discriminatória não é requerida para esta estratégia de mapeamento." + +#. Tag: title +#: basic_mapping.xml:2751 +#, no-c-format +msgid "Inherit properties from superclasses" +msgstr "" + +#. Tag: para +#: basic_mapping.xml:2753 +#, no-c-format +msgid "" +"This is sometimes useful to share common properties through a technical or a " +"business superclass without including it as a regular mapped entity (ie no " +"specific table for this entity). For that purpose you can map them as " +"@MappedSuperclass." +msgstr "" + +#. Tag: programlisting +#: basic_mapping.xml:2758 +#, no-c-format +msgid "" +"@MappedSuperclass\n" +"public class BaseEntity {\n" +" @Basic\n" +" @Temporal(TemporalType.TIMESTAMP)\n" +" public Date getLastUpdate() { ... }\n" +" public String getLastUpdater() { ... }\n" +" ...\n" +"}\n" +"\n" +"@Entity class Order extends BaseEntity {\n" +" @Id public Integer getId() { ... }\n" +" ...\n" +"}" +msgstr "" + +#. Tag: para +#: basic_mapping.xml:2760 +#, no-c-format +msgid "" +"In database, this hierarchy will be represented as an Order table having the id, lastUpdate and lastUpdater columns. The embedded superclass " +"property mappings are copied into their entity subclasses. Remember that the " +"embeddable superclass is not the root of the hierarchy though." +msgstr "" + +#. Tag: para +#: basic_mapping.xml:2768 +#, no-c-format +msgid "" +"Properties from superclasses not mapped as @MappedSuperclass are ignored." +msgstr "" + +#. Tag: para +#: basic_mapping.xml:2773 +#, no-c-format +msgid "" +"The default access type (field or methods) is used, unless you use the " +"@Access annotation." +msgstr "" + +#. Tag: para +#: basic_mapping.xml:2778 +#, no-c-format +msgid "" +"The same notion can be applied to @Embeddable objects to " +"persist properties from their superclasses. You also need to use " +"@MappedSuperclass to do that (this should not be " +"considered as a standard EJB3 feature though)" +msgstr "" + +#. Tag: para +#: basic_mapping.xml:2786 +#, no-c-format +msgid "" +"It is allowed to mark a class as @MappedSuperclass in the " +"middle of the mapped inheritance hierarchy." +msgstr "" + +#. Tag: para +#: basic_mapping.xml:2792 +#, no-c-format +msgid "" +"Any class in the hierarchy non annotated with @MappedSuperclass nor @Entity will be ignored." +msgstr "" + +#. Tag: para +#: basic_mapping.xml:2797 +#, no-c-format +msgid "" +"You can override columns defined in entity superclasses at the root entity " +"level using the @AttributeOverride annotation." +msgstr "" + +#. Tag: programlisting +#: basic_mapping.xml:2801 +#, no-c-format +msgid "" +"@MappedSuperclass\n" +"public class FlyingObject implements Serializable {\n" +"\n" +" public int getAltitude() {\n" +" return altitude;\n" +" }\n" +"\n" +" @Transient\n" +" public int getMetricAltitude() {\n" +" return metricAltitude;\n" +" }\n" +"\n" +" @ManyToOne\n" +" public PropulsionType getPropulsion() {\n" +" return metricAltitude;\n" +" }\n" +" ...\n" +"}\n" +"\n" +"@Entity\n" +"@AttributeOverride( name=\"altitude\", column = @Column(name=\"fld_altitude" +"\") )\n" +"@AssociationOverride( \n" +" name=\"propulsion\", \n" +" joinColumns = @JoinColumn(name=\"fld_propulsion_fk\") \n" +")\n" +"public class Plane extends FlyingObject {\n" +" ...\n" +"}" +msgstr "" + +#. Tag: para +#: basic_mapping.xml:2803 +#, no-c-format +msgid "" +"The altitude property will be persisted in an " +"fld_altitude column of table Plane and " +"the propulsion association will be materialized in a " +"fld_propulsion_fk foreign key column." +msgstr "" + +#. Tag: para +#: basic_mapping.xml:2809 +#, no-c-format +msgid "" +"You can define @AttributeOverride(s) and " +"@AssociationOverride(s) on @Entity " +"classes, @MappedSuperclass classes and properties " +"pointing to an @Embeddable object." +msgstr "" + +#. Tag: para +#: basic_mapping.xml:2815 +#, no-c-format +msgid "" +"In hbm.xml, simply map the properties of the superclass in the <" +"class> element of the entity that needs to inherit them." +msgstr "" + +#. Tag: title +#: basic_mapping.xml:2821 +#, no-c-format +msgid "Mapping one entity to several tables" +msgstr "" + +#. Tag: para +#: basic_mapping.xml:2823 +#, no-c-format +msgid "" +"While not recommended for a fresh schema, some legacy databases force your " +"to map a single entity on several tables." +msgstr "" + +#. Tag: para +#: basic_mapping.xml:2826 +#, no-c-format +msgid "" +"Using the @SecondaryTable or @SecondaryTables class level annotations. To express that a column is in a " +"particular table, use the table parameter of " +"@Column or @JoinColumn." +msgstr "" + +#. Tag: programlisting +#: basic_mapping.xml:2832 +#, no-c-format +msgid "" +"@Entity\n" +"@Table(name=\"MainCat\")\n" +"@SecondaryTables({\n" +" @SecondaryTable(name=\"Cat1\", pkJoinColumns={\n" +" @PrimaryKeyJoinColumn(name=\"cat_id\", referencedColumnName=\"id\")\n" +" ),\n" +" @SecondaryTable(name=\"Cat2\", uniqueConstraints={@UniqueConstraint" +"(columnNames={\"storyPart2\"})})\n" +"})\n" +"public class Cat implements Serializable {\n" +"\n" +" private Integer id;\n" +" private String name;\n" +" private String storyPart1;\n" +" private String storyPart2;\n" +"\n" +" @Id @GeneratedValue\n" +" public Integer getId() {\n" +" return id;\n" +" }\n" +"\n" +" public String getName() {\n" +" return name;\n" +" }\n" +" \n" +" @Column(table=\"Cat1\")\n" +" public String getStoryPart1() {\n" +" return storyPart1;\n" +" }\n" +"\n" +" @Column(table=\"Cat2\")\n" +" public String getStoryPart2() {\n" +" return storyPart2;\n" +" }\n" +"}" +msgstr "" + +#. Tag: para +#: basic_mapping.xml:2834 +#, no-c-format +msgid "" +"In this example, name will be in MainCat. storyPart1 will be in Cat1 " +"and storyPart2 will be in Cat2. " +"Cat1 will be joined to MainCat using " +"the cat_id as a foreign key, and Cat2 " +"using id (ie the same column name, the MainCat id column has). Plus a unique constraint on storyPart2 has been set." +msgstr "" + +#. Tag: para +#: basic_mapping.xml:2844 +#, no-c-format +msgid "" +"There is also additional tuning accessible via the @org.hibernate." +"annotations.Table annotation:" +msgstr "" + +#. Tag: para +#: basic_mapping.xml:2850 +#, fuzzy, no-c-format +msgid "" +"fetch: If set to JOIN, the default, Hibernate will use an " +"inner join to retrieve a secondary table defined by a class or its " +"superclasses and an outer join for a secondary table defined by a subclass. " +"If set to SELECT then Hibernate will use a sequential " +"select for a secondary table defined on a subclass, which will be issued " +"only if a row turns out to represent an instance of the subclass. Inner " +"joins will still be used to retrieve a secondary defined by the class and " +"its superclasses." +msgstr "" +"fetch(opcional – valor padrão join): " +"Se ajustado para join, o padrão, o Hibernate irá usar uma " +"união interna para restaurar um join definido por uma " +"classe ou suas subclasses e uma união externa para um join definido por uma subclasse. Se ajustado para select, então o Hibernate irá usar uma seleção seqüencial para um " +"<join> definida numa subclasse, que será emitido " +"apenas se uma linha representar uma instância da subclasse. Uniões internas " +"ainda serão utilizadas para restaurar um <join> " +"definido pela classe e suas superclasses. " + +#. Tag: para +#: basic_mapping.xml:2862 +#, fuzzy, no-c-format +msgid "" +"inverse: If true, Hibernate will not try to insert or " +"update the properties defined by this join. Default to false." +msgstr "" +"inverse (opcional – padrão para false): Se habilitado, o Hibernate não tentará inserir ou atualizar as " +"propriedades definidas por esta união." + +#. Tag: para +#: basic_mapping.xml:2868 +#, fuzzy, no-c-format +msgid "" +"optional: If enabled (the default), Hibernate will insert " +"a row only if the properties defined by this join are non-null and will " +"always use an outer join to retrieve the properties." +msgstr "" +"optional (opcional – padrão para false): Se habilitado, o Hibernate irá inserir uma linha apenas se as " +"propriedades, definidas por esta junção, não forem nulas. Isto irá sempre " +"usar uma união externa para recuperar as propriedades." + +#. Tag: para +#: basic_mapping.xml:2875 +#, no-c-format +msgid "" +"foreignKey: defines the Foreign Key name of a secondary " +"table pointing back to the primary table." +msgstr "" + +#. Tag: para +#: basic_mapping.xml:2880 +#, no-c-format +msgid "" +"Make sure to use the secondary table name in the appliesto property" +msgstr "" + +#. Tag: programlisting +#: basic_mapping.xml:2883 +#, no-c-format +msgid "" +"@Entity\n" +"@Table(name=\"MainCat\")\n" +"@SecondaryTable(name=\"Cat1\")\n" +"@org.hibernate.annotations.Table(\n" +" appliesTo=\"Cat1\",\n" +" fetch=FetchMode.SELECT,\n" +" optional=true)\n" +"public class Cat implements Serializable {\n" +"\n" +" private Integer id;\n" +" private String name;\n" +" private String storyPart1;\n" +" private String storyPart2;\n" +"\n" +" @Id @GeneratedValue\n" +" public Integer getId() {\n" +" return id;\n" +" }\n" +"\n" +" public String getName() {\n" +" return name;\n" +" }\n" +" \n" +" @Column(table=\"Cat1\")\n" +" public String getStoryPart1() {\n" +" return storyPart1;\n" +" }\n" +"\n" +" @Column(table=\"Cat2\")\n" +" public String getStoryPart2() {\n" +" return storyPart2;\n" +" }\n" +"}" +msgstr "" + +#. Tag: para +#: basic_mapping.xml:2885 +#, fuzzy, no-c-format +msgid "In hbm.xml, use the <join> element." +msgstr "" +"Por exemplo, se temos o seguinte mapeamento de <properties>:" + +#. Tag: programlisting +#: basic_mapping.xml:2903 +#, no-c-format +msgid "" +"<join\n" +" table=\"tablename\"\n" +" schema=\"owner\"\n" +" catalog=\"catalog\"\n" +" fetch=\"join|select\"\n" +" inverse=\"true|false\"\n" +" optional=\"true|false\">\n" +"\n" +" <key ... />\n" +"\n" +" <property ... />\n" +" ...\n" +"</join>" +msgstr "" + +#. Tag: para +#: basic_mapping.xml:2907 #, no-c-format msgid "table: the name of the joined table." msgstr "table: O nome da tabela associada. " #. Tag: para +#: basic_mapping.xml:2924 #, no-c-format msgid "" "fetch (optional - defaults to join): " @@ -3229,6 +6036,7 @@ msgstr "" "definido pela classe e suas superclasses. " #. Tag: para +#: basic_mapping.xml:2939 #, no-c-format msgid "" "inverse (optional - defaults to falseoptional (optional - defaults to false<key> element has featured a few times within " +"To link one entity to an other, you need to map the association property as " +"a to one association. In the relational model, you can either use a foreign " +"key or an association table, or (a bit less common) share the same primary " +"key value between the two entities." +msgstr "" + +#. Tag: para +#: basic_mapping.xml:2974 +#, no-c-format +msgid "" +"To mark an association, use either @ManyToOne or " +"@OnetoOne." +msgstr "" + +#. Tag: para +#: basic_mapping.xml:2978 +#, no-c-format +msgid "" +"@ManyToOne and @OneToOne have a " +"parameter named targetEntity which describes the target " +"entity name. You usually don't need this parameter since the default value " +"(the type of the property that stores the association) is good in almost all " +"cases. However this is useful when you want to use interfaces as the return " +"type instead of the regular entity." +msgstr "" + +#. Tag: para +#: basic_mapping.xml:2985 +#, no-c-format +msgid "" +"Setting a value of the cascade attribute to any " +"meaningful value other than nothing will propagate certain operations to the " +"associated object. The meaningful values are divided into three categories." +msgstr "" + +#. Tag: para +#: basic_mapping.xml:2992 +#, no-c-format +msgid "" +"basic operations, which include: persist, merge, delete, save-" +"update, evict, replicate, lock and refresh;" +msgstr "" + +#. Tag: para +#: basic_mapping.xml:2998 +#, fuzzy, no-c-format +msgid "" +"special values: delete-orphan or all ;" +msgstr "" +"Note como as associações são agora especificadas utilizando o " +"entity-name ao invés da class. " + +#. Tag: para +#: basic_mapping.xml:3003 +#, no-c-format +msgid "" +"comma-separated combinations of operation names: cascade=\"persist," +"merge,evict\" or cascade=\"all,delete-orphan\". " +"See for a full explanation. Note " +"that single valued many-to-one associations do not support orphan delete." +msgstr "" + +#. Tag: para +#: basic_mapping.xml:3012 +#, no-c-format +msgid "" +"By default, single point associations are eagerly fetched in JPA 2. You can " +"mark it as lazily fetched by using @ManyToOne(fetch=FetchType." +"LAZY) in which case Hibernate will proxy the association and " +"load it when the state of the associated entity is reached. You can force " +"Hibernate not to use a proxy by using @LazyToOne(NO_PROXY). In this case, the property is fetched lazily when the instance " +"variable is first accessed. This requires build-time bytecode " +"instrumentation. lazy=\"false\" specifies that the association will always " +"be eagerly fetched." +msgstr "" + +#. Tag: para +#: basic_mapping.xml:3022 +#, no-c-format +msgid "" +"With the default JPA options, single-ended associations are loaded with a " +"subsequent select if set to LAZY, or a SQL JOIN is used " +"for EAGER associations. You can however adjust the " +"fetching strategy, ie how data is fetched by using @Fetch. FetchMode can be SELECT (a " +"select is triggered when the association needs to be loaded) or " +"JOIN (use a SQL JOIN to load the association while " +"loading the owner entity). JOIN overrides any lazy " +"attribute (an association loaded through a JOIN strategy " +"cannot be lazy)." +msgstr "" + +#. Tag: title +#: basic_mapping.xml:3034 +#, fuzzy, no-c-format +msgid "Using a foreign key or an association table" +msgstr "Associações de chave exterior exclusiva" + +#. Tag: para +#: basic_mapping.xml:3036 +#, fuzzy, no-c-format +msgid "An ordinary association to another persistent class is declared using a" +msgstr "" +"Uma associação um-pra-um para outra classe persistente é declarada usando um " +"elemento one-to-one ." + +#. Tag: para +#: basic_mapping.xml:3041 +#, no-c-format +msgid "" +"@ManyToOne if several entities can point to the the " +"target entity" +msgstr "" + +#. Tag: para +#: basic_mapping.xml:3046 +#, no-c-format +msgid "" +"@OneToOne if only a single entity can point to the " +"the target entity" +msgstr "" + +#. Tag: para +#: basic_mapping.xml:3051 +#, no-c-format +msgid "" +"and a foreign key in one table is referencing the primary key column(s) of " +"the target table." +msgstr "" + +#. Tag: programlisting +#: basic_mapping.xml:3054 +#, no-c-format +msgid "" +"@Entity\n" +"public class Flight implements Serializable {\n" +" @ManyToOne( cascade = {CascadeType.PERSIST, CascadeType.MERGE} )\n" +" @JoinColumn(name=\"COMP_ID\")\n" +" public Company getCompany() {\n" +" return company;\n" +" }\n" +" ...\n" +"}" +msgstr "" + +#. Tag: para +#: basic_mapping.xml:3056 +#, no-c-format +msgid "" +"The @JoinColumn attribute is optional, the default value" +"(s) is the concatenation of the name of the relationship in the owner side, " +"_ (underscore), and the name of the primary key column in " +"the owned side. In this example company_id because the " +"property name is company and the column id of Company is " +"id." +msgstr "" + +#. Tag: programlisting +#: basic_mapping.xml:3064 +#, no-c-format +msgid "" +"@Entity\n" +"public class Flight implements Serializable {\n" +" @ManyToOne( cascade = {CascadeType.PERSIST, CascadeType.MERGE}, " +"targetEntity=CompanyImpl.class )\n" +" @JoinColumn(name=\"COMP_ID\")\n" +" public Company getCompany() {\n" +" return company;\n" +" }\n" +" ...\n" +"}\n" +"\n" +"public interface Company {\n" +" ...\n" +"}" +msgstr "" + +#. Tag: para +#: basic_mapping.xml:3066 +#, no-c-format +msgid "" +"You can also map a to one association through an association table. This " +"association table described by the @JoinTable annotation " +"will contains a foreign key referencing back the entity table (through " +"@JoinTable.joinColumns) and a a foreign key referencing " +"the target entity table (through @JoinTable.inverseJoinColumns)." +msgstr "" + +#. Tag: programlisting +#: basic_mapping.xml:3074 +#, no-c-format +msgid "" +"@Entity\n" +"public class Flight implements Serializable {\n" +" @ManyToOne( cascade = {CascadeType.PERSIST, CascadeType.MERGE} )\n" +" @JoinTable(name=\"Flight_Company\",\n" +" joinColumns = @JoinColumn(name=\"FLIGHT_ID\"),\n" +" inverseJoinColumns = @JoinColumn(name=\"COMP_ID\")\n" +" )\n" +" public Company getCompany() {\n" +" return company;\n" +" }\n" +" ...\n" +"}" +msgstr "" + +#. Tag: para +#: basic_mapping.xml:3077 +#, no-c-format +msgid "" +"You can use a SQL fragment to simulate a physical join column using the " +"@JoinColumnOrFormula / " +"@JoinColumnOrformulas annotations (just like you can " +"use a SQL fragment to simulate a property column via the " +"@Formula annotation)." +msgstr "" + +#. Tag: programlisting +#: basic_mapping.xml:3083 +#, no-c-format +msgid "" +"@Entity\n" +"public class Ticket implements Serializable {\n" +" @ManyToOne\n" +" @JoinColumnOrFormula(formula=\"(firstname + ' ' + lastname)\")\n" +" public Person getOwner() {\n" +" return person;\n" +" }\n" +" ...\n" +"}" +msgstr "" + +#. Tag: para +#: basic_mapping.xml:3086 +#, no-c-format +msgid "" +"You can mark an association as mandatory by using the " +"optional=false attribute. We recommend to use Bean " +"Validation's @NotNull annotation as a better " +"alternative however. As a consequence, the foreign key column(s) will be " +"marked as not nullable (if possible)." +msgstr "" + +#. Tag: para +#: basic_mapping.xml:3092 +#, no-c-format +msgid "" +"When Hibernate cannot resolve the association because the expected " +"associated element is not in database (wrong id on the association column), " +"an exception is raised. This might be inconvenient for legacy and badly " +"maintained schemas. You can ask Hibernate to ignore such elements instead of " +"raising an exception using the @NotFound annotation." +msgstr "" + +#. Tag: title +#: basic_mapping.xml:3100 +#, no-c-format +msgid "@NotFound annotation" +msgstr "" + +#. Tag: programlisting +#: basic_mapping.xml:3102 +#, no-c-format +msgid "" +"@Entity\n" +"public class Child {\n" +" ...\n" +" @ManyToOne\n" +" @NotFound(action=NotFoundAction.IGNORE)\n" +" public Parent getParent() { ... }\n" +" ...\n" +"}" +msgstr "" + +#. Tag: para +#: basic_mapping.xml:3105 +#, no-c-format +msgid "" +"Sometimes you want to delegate to your database the deletion of cascade when " +"a given entity is deleted. In this case Hibernate generates a cascade delete " +"constraint at the database level." +msgstr "" + +#. Tag: title +#: basic_mapping.xml:3110 +#, no-c-format +msgid "@OnDelete annotation" +msgstr "" + +#. Tag: programlisting +#: basic_mapping.xml:3112 +#, no-c-format +msgid "" +"@Entity\n" +"public class Child {\n" +" ...\n" +" @ManyToOne\n" +" @OnDelete(action=OnDeleteAction.CASCADE)\n" +" public Parent getParent() { ... }\n" +" ...\n" +"}" +msgstr "" + +#. Tag: para +#: basic_mapping.xml:3115 +#, no-c-format +msgid "" +"Foreign key constraints, while generated by Hibernate, have a fairly " +"unreadable name. You can override the constraint name using " +"@ForeignKey." +msgstr "" + +#. Tag: title +#: basic_mapping.xml:3120 +#, fuzzy, no-c-format +msgid "@ForeignKey annotation" +msgstr "Associações de chave exterior exclusiva" + +#. Tag: programlisting +#: basic_mapping.xml:3122 +#, no-c-format +msgid "" +"@Entity\n" +"public class Child {\n" +" ...\n" +" @ManyToOne\n" +" @ForeignKey(name=\"FK_PARENT\")\n" +" public Parent getParent() { ... }\n" +" ...\n" +"}\n" +"\n" +"alter table Child add constraint FK_PARENT foreign key (parent_id) " +"references Parent" +msgstr "" + +#. Tag: para +#: basic_mapping.xml:3125 +#, no-c-format +msgid "" +"Sometimes, you want to link one entity to an other not by the target entity " +"primary key but by a different unique key. You can achieve that by " +"referencing the unique key column(s) in @JoinColumn." +"referenceColumnName." +msgstr "" + +#. Tag: programlisting +#: basic_mapping.xml:3130 basic_mapping.xml:3682 +#, no-c-format +msgid "" +"@Entity\n" +"class Person {\n" +" @Id Integer personNumber;\n" +" String firstName;\n" +" @Column(name=\"I\")\n" +" String initial;\n" +" String lastName;\n" +"}\n" +"\n" +"@Entity\n" +"class Home {\n" +" @ManyToOne\n" +" @JoinColumns({\n" +" @JoinColumn(name=\"first_name\", referencedColumnName=\"firstName\"),\n" +" @JoinColumn(name=\"init\", referencedColumnName=\"I\"),\n" +" @JoinColumn(name=\"last_name\", referencedColumnName=\"lastName\"),\n" +" })\n" +" Person owner\n" +"}" +msgstr "" + +#. Tag: para +#: basic_mapping.xml:3132 +#, no-c-format +msgid "" +"This is not encouraged however and should be reserved to legacy mappings." +msgstr "" + +#. Tag: para +#: basic_mapping.xml:3135 +#, no-c-format +msgid "" +"In hbm.xml, mapping an association is similar. The main difference is that a " +"@OneToOne is mapped as <many-to-one " +"unique=\"true\"/>, let's dive into the subject." +msgstr "" + +#. Tag: programlisting +#: basic_mapping.xml:3177 +#, no-c-format +msgid "" +"<many-to-one\n" +" name=\"propertyName\"\n" +" column=\"column_name\"\n" +" class=\"ClassName\"\n" +" cascade=\"cascade_style\"\n" +" fetch=\"join|select\"\n" +" update=\"true|false\"\n" +" insert=\"true|false\"\n" +" property-ref=\"propertyNameFromAssociatedClass\"\n" +" access=\"field|property|ClassName\"\n" +" unique=\"true|false\"\n" +" not-null=\"true|false\"\n" +" optimistic-lock=\"true|false\"\n" +" lazy=\"proxy|no-proxy|false\"\n" +" not-found=\"ignore|exception\"\n" +" entity-name=\"EntityName\"\n" +" formula=\"arbitrary SQL expression\"\n" +" node=\"element-name|@attribute-name|element/@attribute|.\"\n" +" embed-xml=\"true|false\"\n" +" index=\"index_name\"\n" +" unique_key=\"unique_key_id\"\n" +" foreign-key=\"foreign_key_name\"\n" +"/>" +msgstr "" + +#. Tag: para +#: basic_mapping.xml:3185 basic_mapping.xml:3868 +#, no-c-format +msgid "" +"column (optional): the name of the foreign key column. " +"This can also be specified by nested <column> " +"element(s)." +msgstr "" +"column (opcional): O nome da coluna da chave exterior. " +"Isto pode também ser especificado através de elementos aninhados " +"<column>. " + +#. Tag: para +#: basic_mapping.xml:3191 basic_mapping.xml:3385 +#, no-c-format +msgid "" +"class (optional - defaults to the property type " +"determined by reflection): the name of the associated class." +msgstr "" +"class (opcional – padrão para o tipo de propriedade " +"determinado pela reflexão): O nome da classe associada." + +#. Tag: para +#: basic_mapping.xml:3197 basic_mapping.xml:3391 +#, no-c-format +msgid "" +"cascade (optional): specifies which operations should be " +"cascaded from the parent object to the associated object." +msgstr "" +"cascade (opcional): Especifica qual operação deve ser " +"cascateada do objeto pai para o objeto associado. " + +#. Tag: para +#: basic_mapping.xml:3203 basic_mapping.xml:3407 +#, no-c-format +msgid "" +"fetch (optional - defaults to select): " +"chooses between outer-join fetching or sequential select fetching." +msgstr "" +"fetch (opcional - padrão para select): " +"Escolhe entre recuperação da união exterior ou recuperação seqüencial de " +"seleção." + +#. Tag: para +#: basic_mapping.xml:3209 +#, no-c-format +msgid "" +"update, insert (optional - defaults to true): specifies that the mapped columns should be included in SQL " +"UPDATE and/or INSERT statements. " +"Setting both to false allows a pure \"derived\" " +"association whose value is initialized from another property that maps to " +"the same column(s), or by a trigger or other application." +msgstr "" +"update, insert (opcional - valor padrão true): especifica que as colunas mapeadas devem ser incluídas em " +"instruções SQL de UPDATE e/ou INSERT. " +"Com o ajuste de ambas para false você permite uma " +"associação \"derivada\" pura cujos valores são inicializados de algumas " +"outras propriedades que mapeiam a(s) mesma(s) coluna(s) ou por um trigger ou " +"outra aplicação. " + +#. Tag: para +#: basic_mapping.xml:3219 +#, no-c-format +msgid "" +"property-ref (optional): the name of a property of the " +"associated class that is joined to this foreign key. If not specified, the " +"primary key of the associated class is used." +msgstr "" +"property-ref: (opcional) O nome de uma propriedade da " +"classe associada que esteja unida à esta chave exterior. Se não for " +"especificada, a chave primária da classe associada será utilizada. " + +#. Tag: para +#: basic_mapping.xml:3232 +#, no-c-format +msgid "" +"unique (optional): enables the DDL generation of a unique " +"constraint for the foreign-key column. By allowing this to be the target of " +"a property-ref, you can make the association multiplicity " +"one-to-one." +msgstr "" +"unique (opcional): Habilita a geração DDL de uma " +"restrição única para a coluna da chave exterior. Além disso, permite ser o " +"alvo de uma property-ref. Isso torna a multiplicidade da " +"associação efetivamente um para um. " + +#. Tag: para +#: basic_mapping.xml:3240 +#, no-c-format +msgid "" +"not-null (optional): enables the DDL generation of a " +"nullability constraint for the foreign key columns." +msgstr "" +"not-null (opcional): Habilita a geração DDL de uma " +"restrição de nulidade para as colunas de chaves exteriores." + +#. Tag: para +#: basic_mapping.xml:3254 +#, no-c-format +msgid "" +"lazy (optional - defaults to proxy): " +"by default, single point associations are proxied. lazy=\"no-proxy" +"\" specifies that the property should be fetched lazily when the " +"instance variable is first accessed. This requires build-time bytecode " +"instrumentation. lazy=\"false\" specifies that the " +"association will always be eagerly fetched." +msgstr "" +"lazy(opcional – padrão para proxy): " +"Por padrão, associações de ponto único são envoltas em um proxie. " +"lazy=\"no-proxy\" especifica que a propriedade deve ser " +"trazida de forma tardia quando a instância da variável é acessada pela " +"primeira vez. Isto requer instrumentação bytecode em tempo de criação. O " +"lazy=\"false\" especifica que a associação será sempre " +"procurada." + +#. Tag: para +#: basic_mapping.xml:3264 +#, no-c-format +msgid "" +"not-found (optional - defaults to exception): specifies how foreign keys that reference missing rows will be " +"handled. ignore will treat a missing row as a null " +"association." +msgstr "" +"not-found (opcional - padrão para exception): Especifica como as chaves exteriores que informam que linhas que " +"estejam faltando serão manuseadas. O ignore tratará a " +"linha faltante como uma associação nula." + +#. Tag: para +#: basic_mapping.xml:3272 basic_mapping.xml:3448 +#, no-c-format +msgid "" +"entity-name (optional): the entity name of the associated " +"class." +msgstr "" +"entity-name (opcional): O nome da entidade da classe " +"associada. " + +#. Tag: para +#: basic_mapping.xml:3277 +#, no-c-format +msgid "" +"formula (optional): an SQL expression that defines the " +"value for a computed foreign key." +msgstr "" +"formula (optional): Uma instrução SQL que define um valor " +"para uma chave exterior computed." + +#. Tag: para +#: basic_mapping.xml:3284 +#, fuzzy, no-c-format +msgid "" +"Setting a value of the cascade attribute to any " +"meaningful value other than none will propagate certain " +"operations to the associated object. The meaningful values are divided into " +"three categories. First, basic operations, which include: persist, " +"merge, delete, save-update, evict, replicate, lock and refresh; " +"second, special values: delete-orphan; and third," +"all comma-separated combinations of operation names: " +"cascade=\"persist,merge,evict\" or cascade=\"all," +"delete-orphan\". See " +"for a full explanation. Note that single valued, many-to-one and one-to-one, " +"associations do not support orphan delete." +msgstr "" +"Ao ajustar o valor do atributo cascade para qualquer " +"valor diferente de none irá propagar certas operações ao " +"objeto associado. Os valores significativos são divididos em três " +"categorias. A primeira, operações básicas, que inclui: persist, " +"merge, delete, save-update, evict, replicate, lock and refresh. A " +"segunda, valores especiais: delete-orphan e a terceira " +"combinações de vírgula separada all dos nomes da " +"operação: cascade=\"persist,merge,evict\" ou " +"cascade=\"all,delete-orphan\". Veja para uma completa explicação. Perceba que as " +"associações de valores únicos, muitos-para-um e um-para-um, não suportam " +"delete órfão: " + +#. Tag: para +#: basic_mapping.xml:3298 +#, no-c-format +msgid "" +"Here is an example of a typical many-to-one declaration:" +msgstr "" +"Segue abaixo uma amostra de uma típica declaração many-to-one:" + +#. Tag: programlisting +#: basic_mapping.xml:3301 +#, no-c-format +msgid "" +"<many-to-one name=\"product\" class=\"Product\" column=\"PRODUCT_ID\"/>" +msgstr "" + +#. Tag: para +#: basic_mapping.xml:3303 +#, no-c-format +msgid "" +"The property-ref attribute should only be used for " +"mapping legacy data where a foreign key refers to a unique key of the " +"associated table other than the primary key. This is a complicated and " +"confusing relational model. For example, if the Product " +"class had a unique serial number that is not the primary key. The " +"unique attribute controls Hibernate's DDL generation with " +"the SchemaExport tool." +msgstr "" +"O atributo property-ref deve apenas ser usado para mapear " +"dados legados onde uma chave exterior se refere à uma chave exclusiva da " +"tabela associada que não seja a chave primária. Este é um modelo relacional " +"desagradável. Por exemplo, suponha que a classe Product " +"tenha um número seqüencial exclusivo, que não seja a chave primária. O " +"atributo unique controla a geração de DDL do Hibernate " +"com a ferramenta SchemaExport." + +#. Tag: programlisting +#: basic_mapping.xml:3311 +#, no-c-format +msgid "" +"<property name=\"serialNumber\" unique=\"true\" type=\"string\" column=" +"\"SERIAL_NUMBER\"/>" +msgstr "" + +#. Tag: para +#: basic_mapping.xml:3313 +#, no-c-format +msgid "Then the mapping for OrderItem might use:" +msgstr "Então o mapeamento para OrderItem poderia usar:" + +#. Tag: programlisting +#: basic_mapping.xml:3316 +#, no-c-format +msgid "" +"<many-to-one name=\"product\" property-ref=\"serialNumber\" column=" +"\"PRODUCT_SERIAL_NUMBER\"/>" +msgstr "" + +#. Tag: para +#: basic_mapping.xml:3318 +#, no-c-format +msgid "This is not encouraged, however." +msgstr "No entanto, isto não é recomendável." + +#. Tag: para +#: basic_mapping.xml:3320 +#, no-c-format +msgid "" +"If the referenced unique key comprises multiple properties of the associated " +"entity, you should map the referenced properties inside a named <" +"properties> element." +msgstr "" +"Se a chave exclusiva referenciada engloba múltiplas propriedades da entidade " +"associada, você deve mapear as propriedades referenciadas dentro de um " +"elemento chamado <properties>" + +#. Tag: para +#: basic_mapping.xml:3324 +#, no-c-format +msgid "" +"If the referenced unique key is the property of a component, you can specify " +"a property path:" +msgstr "" +"Se a chave exclusiva referenciada é a propriedade de um componente, você " +"pode especificar um caminho para a propriedade:" + +#. Tag: programlisting +#: basic_mapping.xml:3327 +#, no-c-format +msgid "" +"<many-to-one name=\"owner\" property-ref=\"identity.ssn\" column=" +"\"OWNER_SSN\"/>" +msgstr "" + +#. Tag: title +#: basic_mapping.xml:3331 +#, no-c-format +msgid "Sharing the primary key with the associated entity" +msgstr "" + +#. Tag: para +#: basic_mapping.xml:3333 +#, no-c-format +msgid "" +"The second approach is to ensure an entity and its associated entity share " +"the same primary key. In this case the primary key column is also a foreign " +"key and there is no extra column. These associations are always one to one." +msgstr "" + +#. Tag: title +#: basic_mapping.xml:3339 +#, fuzzy, no-c-format +msgid "One to One association" +msgstr "Associações de chave exterior exclusiva" + +#. Tag: programlisting +#: basic_mapping.xml:3341 +#, no-c-format +msgid "" +"@Entity\n" +"public class Body {\n" +" @Id\n" +" public Long getId() { return id; }\n" +"\n" +" @OneToOne(cascade = CascadeType.ALL)\n" +" @MapsId\n" +" public Heart getHeart() {\n" +" return heart;\n" +" }\n" +" ...\n" +"} \n" +"\n" +"@Entity\n" +"public class Heart {\n" +" @Id\n" +" public Long getId() { ...}\n" +"}" +msgstr "" + +#. Tag: para +#: basic_mapping.xml:3345 +#, no-c-format +msgid "" +"Many people got confused by these primary key based one to one associations. " +"They can only be lazily loaded if Hibernate knows that the other side of the " +"association is always present. To indicate to Hibernate that it is the case, " +"use @OneToOne(optional=false)." +msgstr "" + +#. Tag: para +#: basic_mapping.xml:3352 +#, no-c-format +msgid "In hbm.xml, use the following mapping." +msgstr "" + +#. Tag: programlisting +#: basic_mapping.xml:3377 +#, no-c-format +msgid "" +"<one-to-one\n" +" name=\"propertyName\"\n" +" class=\"ClassName\"\n" +" cascade=\"cascade_style\"\n" +" constrained=\"true|false\"\n" +" fetch=\"join|select\"\n" +" property-ref=\"propertyNameFromAssociatedClass\"\n" +" access=\"field|property|ClassName\"\n" +" formula=\"any SQL expression\"\n" +" lazy=\"proxy|no-proxy|false\"\n" +" entity-name=\"EntityName\"\n" +" node=\"element-name|@attribute-name|element/@attribute|.\"\n" +" embed-xml=\"true|false\"\n" +" foreign-key=\"foreign_key_name\"\n" +"/>" +msgstr "" + +#. Tag: para +#: basic_mapping.xml:3397 +#, no-c-format +msgid "" +"constrained (optional): specifies that a foreign key " +"constraint on the primary key of the mapped table and references the table " +"of the associated class. This option affects the order in which save" +"() and delete() are cascaded, and determines " +"whether the association can be proxied. It is also used by the schema export " +"tool." +msgstr "" +"constrained (opcional): Especifica que uma restrição de " +"chave exterior na chave primária da tabela mapeada referencia a tabela da " +"classe associada. Esta opção afeta a ordem em que save() " +"e delete() são cascateadas, e determina se a associação " +"pode sofrer o proxie. Isto também é usado pela ferramenta schema export. " + +#. Tag: para +#: basic_mapping.xml:3413 +#, no-c-format +msgid "" +"property-ref (optional): the name of a property of the " +"associated class that is joined to the primary key of this class. If not " +"specified, the primary key of the associated class is used." +msgstr "" +"property-ref(opcional): O nome da propriedade da classe " +"associada que é ligada à chave primária desta classe. Se não for " +"especificada, a chave primária da classe associada é utilizada. " + +#. Tag: para +#: basic_mapping.xml:3426 +#, no-c-format +msgid "" +"formula (optional): almost all one-to-one associations " +"map to the primary key of the owning entity. If this is not the case, you " +"can specify another column, columns or expression to join on using an SQL " +"formula. See org.hibernate.test.onetooneformula for an " +"example." +msgstr "" +"formula (opcional): Quase todas associações um-pra-um " +"mapeiam para a chave primária da entidade dona. Caso este não seja o caso, " +"você pode especificar uma outra coluna, colunas ou expressões para unir " +"utilizando uma fórmula SQL. Veja org.hibernate.test." +"onetooneformula para exemplo. " + +#. Tag: para +#: basic_mapping.xml:3435 +#, no-c-format +msgid "" +"lazy (optional - defaults to proxy): " +"by default, single point associations are proxied. lazy=\"no-proxy" +"\" specifies that the property should be fetched lazily when the " +"instance variable is first accessed. It requires build-time bytecode " +"instrumentation. lazy=\"false\" specifies that the " +"association will always be eagerly fetched. Note that if " +"constrained=\"false\", proxying is impossible and " +"Hibernate will eagerly fetch the association." +msgstr "" +"lazy (opcional – valor padrão proxy): " +"Por padrão, as associações de ponto único estão em proxy. lazy=\"no-" +"proxy\" especifica que a propriedade deve ser recuperada de forma " +"preguiçosa quando a variável da instância for acessada pela primeira vez. " +"Isto requer instrumentação de bytecode de tempo de construção. lazy=" +"\"false\" especifica que a associação terá sempre uma busca " +"antecipada (eager fetched). Note que se constrained=" +"\"false\", será impossível efetuar o proxing e o Hibernate irá " +"realizar uma busca antecipada na associação." + +#. Tag: para +#: basic_mapping.xml:3454 +#, no-c-format +msgid "" +"Primary key associations do not need an extra table column. If two rows are " +"related by the association, then the two table rows share the same primary " +"key value. To relate two objects by a primary key association, ensure that " +"they are assigned the same identifier value." +msgstr "" +"Associações de chave primária não necessitam de uma coluna extra de tabela. " +"Se duas linhas forem relacionadas pela associação, então as duas linhas da " +"tabela dividem o mesmo valor da chave primária. Assim, se você quiser que " +"dois objetos sejam relacionados por uma associação de chave primária, você " +"deve ter certeza que foram atribuídos com o mesmo valor identificador." + +#. Tag: para +#: basic_mapping.xml:3460 +#, no-c-format +msgid "" +"For a primary key association, add the following mappings to " +"Employee and Person respectively:" +msgstr "" +"Para uma associação de chave primária, adicione os seguintes mapeamentos em " +"Employee e Person, respectivamente:" + +#. Tag: programlisting +#: basic_mapping.xml:3464 +#, no-c-format +msgid "<one-to-one name=\"person\" class=\"Person\"/>" +msgstr "" + +#. Tag: programlisting +#: basic_mapping.xml:3466 +#, no-c-format +msgid "" +"<one-to-one name=\"employee\" class=\"Employee\" constrained=\"true\"/>" +msgstr "" + +#. Tag: para +#: basic_mapping.xml:3468 +#, no-c-format +msgid "" +"Ensure that the primary keys of the related rows in the PERSON and EMPLOYEE " +"tables are equal. You use a special Hibernate identifier generation strategy " +"called foreign:" +msgstr "" +"Agora devemos assegurar que as chaves primárias de linhas relacionadas nas " +"tabelas PERSON e EMPLOYEE são iguais. Nós usamos uma estratégia especial de " +"geração de identificador do Hibernate chamada foreign:" + +#. Tag: programlisting +#: basic_mapping.xml:3472 +#, no-c-format +msgid "" +"<class name=\"person\" table=\"PERSON\">\n" +" <id name=\"id\" column=\"PERSON_ID\">\n" +" <generator class=\"foreign\">\n" +" <param name=\"property\">employee</param>\n" +" </generator>\n" +" </id>\n" +" ...\n" +" <one-to-one name=\"employee\"\n" +" class=\"Employee\"\n" +" constrained=\"true\"/>\n" +"</class>" +msgstr "" + +#. Tag: para +#: basic_mapping.xml:3474 +#, no-c-format +msgid "" +"A newly saved instance of Person is assigned the same " +"primary key value as the Employee instance referred with " +"the employee property of that Person." +msgstr "" +"Uma nova instância de Person é atribuída com o mesmo " +"valor da chave primária da instância de Employee " +"referenciada com a propriedade employee daquela " +"Person." + +#. Tag: title +#: basic_mapping.xml:3482 +#, no-c-format +msgid "Natural-id" +msgstr "Id Natural" + +#. Tag: para +#: basic_mapping.xml:3484 +#, fuzzy, no-c-format +msgid "" +"Although we recommend the use of surrogate keys as primary keys, you should " +"try to identify natural keys for all entities. A natural key is a property " +"or combination of properties that is unique and non-null. It is also " +"immutable. Map the properties of the natural key as @NaturalId or map them inside the <natural-id> " +"element. Hibernate will generate the necessary unique key and nullability " +"constraints and, as a result, your mapping will be more self-documenting." +msgstr "" +"Embora recomendemos o uso das chaves substitutas como chaves primárias, você " +"deve ainda identificar chaves naturais para todas as entidades. Uma chave " +"natural é uma propriedade ou combinação de propriedades que é exclusiva e " +"não nula. Mapeie as propriedades da chave natural dentro do elemento " +"<natural-id>. O Hibernate irá gerar a chave " +"exclusiva necessária e as restrições de anulabilidade, e seu mapeamento será " +"apropriadamente auto documentado." + +#. Tag: programlisting +#: basic_mapping.xml:3493 +#, no-c-format +msgid "" +"@Entity\n" +"public class Citizen {\n" +" @Id\n" +" @GeneratedValue\n" +" private Integer id;\n" +" private String firstname;\n" +" private String lastname;\n" +" \n" +" @NaturalId\n" +" @ManyToOne\n" +" private State state;\n" +"\n" +" @NaturalId\n" +" private String ssn;\n" +" ...\n" +"}\n" +"\n" +"\n" +"\n" +"//and later on query\n" +"List results = s.createCriteria( Citizen.class )\n" +" .add( Restrictions.naturalId().set( \"ssn\", \"1234\" ).set" +"( \"state\", ste ) )\n" +" .list();" +msgstr "" + +#. Tag: para +#: basic_mapping.xml:3495 +#, no-c-format +msgid "Or in XML," +msgstr "" + +#. Tag: programlisting +#: basic_mapping.xml:3497 +#, no-c-format +msgid "" +"<natural-id mutable=\"true|false\"/>\n" +" <property ... />\n" +" <many-to-one ... />\n" +" ......\n" +"</natural-id>" +msgstr "" + +#. Tag: para +#: basic_mapping.xml:3499 +#, no-c-format +msgid "" +"It is recommended that you implement equals() and " +"hashCode() to compare the natural key properties of the " +"entity." +msgstr "" +"Nós recomendamos com ênfase que você implemente equals() " +"e hashCode() para comparar as propriedades da chave " +"natural da entidade. " + +#. Tag: para +#: basic_mapping.xml:3503 +#, no-c-format +msgid "" +"This mapping is not intended for use with entities that have natural primary " +"keys." +msgstr "" +"Este mapeamento não pretende ser utilizado com entidades com chaves naturais " +"primárias." + +#. Tag: para +#: basic_mapping.xml:3508 +#, no-c-format +msgid "" +"mutable (optional - defaults to false): by default, natural identifier properties are assumed to be " +"immutable (constant)." +msgstr "" +"mutable (opcional, padrão false): Por " +"padrão, propriedades naturais identificadoras são consideradas imutáveis " +"(constante)." + +#. Tag: title +#: basic_mapping.xml:3516 +#, fuzzy, no-c-format +msgid "Any" +msgstr "binary" + +#. Tag: para +#: basic_mapping.xml:3518 +#, fuzzy, no-c-format +msgid "" +"There is one more type of property mapping. The @Any " +"mapping defines a polymorphic association to classes from multiple tables. " +"This type of mapping requires more than one column. The first column " +"contains the type of the associated entity. The remaining columns contain " +"the identifier. It is impossible to specify a foreign key constraint for " +"this kind of association. This is not the usual way of mapping polymorphic " +"associations and you should use this only in special cases. For example, for " +"audit logs, user session data, etc." +msgstr "" +"Existe mais um tipo de propriedade de mapeamento. O elemento de mapeamento " +"<any> define uma associação polimórfica para " +"classes de múltiplas tabelas. Este tipo de mapeamento sempre requer mais de " +"uma coluna. A primeira coluna possui o tipo da entidade associada. A outra " +"coluna restante possui o identificador. É impossível especificar uma " +"restrição de chave exterior para este tipo de associação, portanto isto " +"certamente não é visto como um caminho usual para associações (polimórficas) " +"de mapeamento. Você deve usar este mapeamento apenas em casos muito " +"especiais. Por exemplo: audit logs, dados de sessão do usuário, etc. " + +#. Tag: para +#: basic_mapping.xml:3528 +#, fuzzy, no-c-format +msgid "" +"The @Any annotation describes the column holding the " +"metadata information. To link the value of the metadata information and an " +"actual entity type, The @AnyDef and " +"@AnyDefs annotations are used. The metaType attribute allows the application to specify a custom type that maps " +"database column values to persistent classes that have identifier properties " +"of the type specified by idType. You must specify the " +"mapping from values of the metaType to class names." +msgstr "" +"A função meta-type permite que a aplicação especifique um " +"tipo adaptado que mapeia valores de colunas de banco de dados para classes " +"persistentes que possuem propriedades identificadoras do tipo especificado " +"através do id-type. Você deve especificar o mapeamento de " +"valores do meta-type para nome de classes. " + +#. Tag: programlisting +#: basic_mapping.xml:3538 +#, no-c-format +msgid "" +"@Any( metaColumn = @Column( name = \"property_type\" ), fetch=FetchType." +"EAGER )\n" +"@AnyMetaDef( \n" +" idType = \"integer\", \n" +" metaType = \"string\", \n" +" metaValues = {\n" +" @MetaValue( value = \"S\", targetEntity = StringProperty.class ),\n" +" @MetaValue( value = \"I\", targetEntity = IntegerProperty.class )\n" +" } )\n" +"@JoinColumn( name = \"property_id\" )\n" +"public Property getMainProperty() {\n" +" return mainProperty;\n" +"}" +msgstr "" + +#. Tag: para +#: basic_mapping.xml:3540 +#, no-c-format +msgid "" +"Note that @AnyDef can be mutualized and reused. It is " +"recommended to place it as a package metadata in this case." +msgstr "" + +#. Tag: programlisting +#: basic_mapping.xml:3544 +#, no-c-format +msgid "" +"//on a package\n" +"@AnyMetaDef( name=\"property\" \n" +" idType = \"integer\", \n" +" metaType = \"string\", \n" +" metaValues = {\n" +" @MetaValue( value = \"S\", targetEntity = StringProperty.class ),\n" +" @MetaValue( value = \"I\", targetEntity = IntegerProperty.class )\n" +" } )\n" +"package org.hibernate.test.annotations.any;\n" +"\n" +"\n" +"//in a class\n" +" @Any( metaDef=\"property\", metaColumn = @Column( name = \"property_type" +"\" ), fetch=FetchType.EAGER )\n" +" @JoinColumn( name = \"property_id\" )\n" +" public Property getMainProperty() {\n" +" return mainProperty;\n" +" }" +msgstr "" + +#. Tag: para +#: basic_mapping.xml:3546 +#, no-c-format +msgid "The hbm.xml equivalent is:" +msgstr "" + +#. Tag: programlisting +#: basic_mapping.xml:3548 +#, no-c-format +msgid "" +"<any name=\"being\" id-type=\"long\" meta-type=\"string\">\n" +" <meta-value value=\"TBL_ANIMAL\" class=\"Animal\"/>\n" +" <meta-value value=\"TBL_HUMAN\" class=\"Human\"/>\n" +" <meta-value value=\"TBL_ALIEN\" class=\"Alien\"/>\n" +" <column name=\"table_name\"/>\n" +" <column name=\"id\"/>\n" +"</any>" +msgstr "" + +#. Tag: para +#: basic_mapping.xml:3551 +#, no-c-format +msgid "You cannot mutualize the metadata in hbm.xml as you can in annotations." +msgstr "" + +#. Tag: programlisting +#: basic_mapping.xml:3570 +#, no-c-format +msgid "" +"<any\n" +" name=\"propertyName\"\n" +" id-type=\"idtypename\"\n" +" meta-type=\"metatypename\"\n" +" cascade=\"cascade_style\"\n" +" access=\"field|property|ClassName\"\n" +" optimistic-lock=\"true|false\"\n" +">\n" +" <meta-value ... />\n" +" <meta-value ... />\n" +" .....\n" +" <column .... />\n" +" <column .... />\n" +" .....\n" +"</any>" +msgstr "" + +#. Tag: para +#: basic_mapping.xml:3574 +#, no-c-format +msgid "name: the property name." +msgstr "name: o nome da propriedade." + +#. Tag: para +#: basic_mapping.xml:3578 +#, no-c-format +msgid "id-type: the identifier type." +msgstr "id-type: o tipo identificador." + +#. Tag: para +#: basic_mapping.xml:3582 +#, no-c-format +msgid "" +"meta-type (optional - defaults to string): any type that is allowed for a discriminator mapping." +msgstr "" +"meta-type (opcional – padrão para string): Qualquer tipo que é permitido para um mapeamento discriminador." + +#. Tag: para +#: basic_mapping.xml:3588 +#, no-c-format +msgid "" +"cascade (optional- defaults to none): " +"the cascade style." +msgstr "" +"cascade (opcional – valor padrão none): o estilo cascata." + +#. Tag: para +#: basic_mapping.xml:3599 +#, no-c-format +msgid "" +"optimistic-lock (optional - defaults to true): specifies that updates to this property either do or do not " +"require acquisition of the optimistic lock. It defines whether a version " +"increment should occur if this property is dirty." +msgstr "" +"optimistic-lock (opcional - valor padrãotrue): Especifica que as atualizações para esta propriedade requerem ou " +"não aquisição da bloqueio otimista. Em outras palavras, define se uma versão " +"de incremento deve ocorrer se esta propriedade for suja." + +#. Tag: title +#: basic_mapping.xml:3610 +#, no-c-format +msgid "Properties" +msgstr "Propriedades" + +#. Tag: para +#: basic_mapping.xml:3612 +#, no-c-format +msgid "" +"The <properties> element allows the definition of a " +"named, logical grouping of the properties of a class. The most important use " +"of the construct is that it allows a combination of properties to be the " +"target of a property-ref. It is also a convenient way to " +"define a multi-column unique constraint. For example:" +msgstr "" +"O elemento <properties> permite a definição de um " +"grupo com nome, lógico de propriedades de uma classe. A função mais " +"importante do construtor é que ele permite que a combinação de propriedades " +"seja o objetivo de uma property-ref. É também um modo " +"conveninente para definir uma restrição única de múltiplas colunas. Por " +"exemplo:" + +#. Tag: programlisting +#: basic_mapping.xml:3632 +#, no-c-format +msgid "" +"<properties\n" +" name=\"logicalName\"\n" +" insert=\"true|false\"\n" +" update=\"true|false\"\n" +" optimistic-lock=\"true|false\"\n" +" unique=\"true|false\"\n" +">\n" +"\n" +" <property ...../>\n" +" <many-to-one .... />\n" +" ........\n" +"</properties>" +msgstr "" + +#. Tag: para +#: basic_mapping.xml:3636 +#, no-c-format +msgid "" +"name: the logical name of the grouping. It is " +"not an actual property name." +msgstr "" +"name: O nome lógico do agrupamento. Isto não é o nome atual de propriedade." + +#. Tag: para +#: basic_mapping.xml:3651 +#, no-c-format +msgid "" +"optimistic-lock (optional - defaults to true): specifies that updates to these properties either do or do not " +"require acquisition of the optimistic lock. It determines if a version " +"increment should occur when these properties are dirty." +msgstr "" +"optimistic-lock (opcional – padrão para true): Especifica que atualizações para estes componentes requerem ou " +"não aquisição de um bloqueio otimista. Em outras palavras, determina se uma " +"versão de incremento deve ocorrer quando estas propriedades estiverem sujas." + +#. Tag: para +#: basic_mapping.xml:3666 +#, no-c-format +msgid "" +"For example, if we have the following <properties> " +"mapping:" +msgstr "" +"Por exemplo, se temos o seguinte mapeamento de <properties>:" + +#. Tag: programlisting +#: basic_mapping.xml:3669 +#, no-c-format +msgid "" +"<class name=\"Person\">\n" +" <id name=\"personNumber\"/>\n" +"\n" +" ...\n" +" <properties name=\"name\"\n" +" unique=\"true\" update=\"false\">\n" +" <property name=\"firstName\"/>\n" +" <property name=\"initial\"/>\n" +" <property name=\"lastName\"/>\n" +" </properties>\n" +"</class>" +msgstr "" + +#. Tag: para +#: basic_mapping.xml:3671 +#, no-c-format +msgid "" +"You might have some legacy data association that refers to this unique key " +"of the Person table, instead of to the primary key:" +msgstr "" +"Então podemos ter uma associação de dados legados que referem a esta chave " +"exclusiva da tabela Person, ao invés de se referirem a " +"chave primária:" + +#. Tag: programlisting +#: basic_mapping.xml:3675 +#, no-c-format +msgid "" +"<many-to-one name=\"owner\"\n" +" class=\"Person\" property-ref=\"name\">\n" +" <column name=\"firstName\"/>\n" +" <column name=\"initial\"/>\n" +" <column name=\"lastName\"/>\n" +"</many-to-one>" +msgstr "" + +#. Tag: para +#: basic_mapping.xml:3678 +#, no-c-format +msgid "" +"When using annotations as a mapping strategy, such construct is not " +"necessary as the binding between a column and its related column on the " +"associated table is done directly" +msgstr "" + +#. Tag: para +#: basic_mapping.xml:3685 +#, no-c-format +msgid "" +"The use of this outside the context of mapping legacy data is not " +"recommended." +msgstr "" +"Nós não recomendamos o uso deste tipo de coisa fora do contexto de " +"mapeamento de dados legados." + +#. Tag: title +#: basic_mapping.xml:3690 +#, no-c-format +msgid "Some hbm.xml specificities" +msgstr "" + +#. Tag: para +#: basic_mapping.xml:3692 +#, no-c-format +msgid "" +"The hbm.xml structure has some specificities naturally not present when " +"using annotations, let's describe them briefly." +msgstr "" + +#. Tag: title +#: basic_mapping.xml:3696 +#, no-c-format +msgid "Doctype" +msgstr "Doctype" + +#. Tag: para +#: basic_mapping.xml:3698 +#, no-c-format +msgid "" +"All XML mappings should declare the doctype shown. The actual DTD can be " +"found at the URL above, in the directory hibernate-x.x.x/src/org/" +"hibernate , or in hibernate3.jar. Hibernate " +"will always look for the DTD in its classpath first. If you experience " +"lookups of the DTD using an Internet connection, check the DTD declaration " +"against the contents of your classpath." +msgstr "" +"Todos os mapeamentos de XML devem declarar o doctype exibido. O DTD atual " +"pode ser encontrado na URL abaixo, no diretório hibernate-x.x.x/src/" +"org/ hibernate ou no hibernate3.jar. O " +"Hibernate sempre irá procurar pelo DTD inicialmente no seu classpath. Se " +"você tentar localizar o DTD usando uma conexão de internet, compare a " +"declaração do seu DTD com o conteúdo do seu classpath." + +#. Tag: title +#: basic_mapping.xml:3707 +#, no-c-format +msgid "EntityResolver" +msgstr "Solucionador de Entidade" + +#. Tag: para +#: basic_mapping.xml:3709 +#, no-c-format +msgid "" +"Hibernate will first attempt to resolve DTDs in its classpath. It does this " +"is by registering a custom org.xml.sax.EntityResolver " +"implementation with the SAXReader it uses to read in the xml files. This " +"custom EntityResolver recognizes two different systemId " +"namespaces:" +msgstr "" +"O Hibernate irá primeiro tentar solucionar os DTDs em seus classpath. Isto é " +"feito, registrando uma implementação org.xml.sax.EntityResolver personalizada com o SAXReader que ele utiliza para ler os arquivos " +"xml. Este EntityResolver personalizado, reconhece dois " +"nomes de espaço de sistemas Id diferentes:" + +#. Tag: para +#: basic_mapping.xml:3718 +#, no-c-format +msgid "" +"a hibernate namespace is recognized whenever the resolver " +"encounters a systemId starting with http://hibernate.sourceforge." +"net/. The resolver attempts to resolve these entities via the " +"classloader which loaded the Hibernate classes." +msgstr "" +"Um hibernate namespace é reconhecido quando um " +"solucionador encontra um systema Id iniciando com http://hibernate." +"sourceforge.net/. O solucionador tenta solucionar estas entidades " +"através do carregador de classe que carregou as classes do Hibernate. " + +#. Tag: para +#: basic_mapping.xml:3726 +#, no-c-format +msgid "" +"a user namespace is recognized whenever the resolver " +"encounters a systemId using a classpath:// URL protocol. " +"The resolver will attempt to resolve these entities via (1) the current " +"thread context classloader and (2) the classloader which loaded the " +"Hibernate classes." +msgstr "" +"Um user namespace é reconhecido quando um solucionador " +"encontra um sistema Id, utilizando um protocolo URL de classpath://" +". O solucionador tentará solucionar estas entidades através do " +"carregador de classe do contexto de thread atual (1) e o carregador de " +"classe (2) que carregou as classes do Hibernate. " + +#. Tag: para +#: basic_mapping.xml:3735 +#, no-c-format +msgid "The following is an example of utilizing user namespacing:" +msgstr "Um exemplo de utilização do espaço de nome do usuário:" + +#. Tag: programlisting +#: basic_mapping.xml:3738 +#, no-c-format +msgid "" +"" +msgstr "" + +#. Tag: para +#: basic_mapping.xml:3740 +#, no-c-format +msgid "" +"Where types.xml is a resource in the your." +"domain package and contains a custom typedef." +msgstr "" +"Onde types.xml é um recurso no pacote your." +"domain e contém um typedef personalizado." + +#. Tag: title +#: basic_mapping.xml:3747 +#, no-c-format +msgid "Hibernate-mapping" +msgstr "Mapeamento do Hibernate" + +#. Tag: para +#: basic_mapping.xml:3749 +#, no-c-format +msgid "" +"This element has several optional attributes. The schema " +"and catalog attributes specify that tables referred to in " +"this mapping belong to the named schema and/or catalog. If they are " +"specified, tablenames will be qualified by the given schema and catalog " +"names. If they are missing, tablenames will be unqualified. The " +"default-cascade attribute specifies what cascade style " +"should be assumed for properties and collections that do not specify a " +"cascade attribute. By default, the auto-import attribute allows you to use unqualified class names in the query " +"language." +msgstr "" +"Este elemento possui diversos atributos opcionais. Os atributos " +"schema e catalog especificam que " +"tabelas referenciadas neste mapeamento pertencem ao esquema e/ou ao catálogo " +"nomeado. Se especificados, os nomes das tabelas serão qualificados no " +"esquema ou catálogo dado. Se não, os nomes das tabelas não serão " +"qualificados. O atributo default-cascade especifica qual " +"estilo de cascata será considerado pelas propriedades e coleções que não " +"especificarem uma função cascade. A função auto-" +"import nos deixa utilizar nomes de classes não qualificados na " +"linguagem de consulta, por padrão." + +#. Tag: programlisting +#: basic_mapping.xml:3778 +#, no-c-format +msgid "" +"<hibernate-mapping\n" +" schema=\"schemaName\"\n" +" catalog=\"catalogName\"\n" +" default-cascade=\"cascade_style\"\n" +" default-access=\"field|property|ClassName\"\n" +" default-lazy=\"true|false\"\n" +" auto-import=\"true|false\"\n" +" package=\"package.name\"\n" +" />" +msgstr "" + +#. Tag: para +#: basic_mapping.xml:3782 +#, no-c-format +msgid "schema (optional): the name of a database schema." +msgstr "" +"schema (opcional): O nome do esquema do banco de dados. " + +#. Tag: para +#: basic_mapping.xml:3787 +#, no-c-format +msgid "catalog (optional): the name of a database catalog." +msgstr "" +"catalog (opcional): O nome do catálogo do banco de dados. " + +#. Tag: para +#: basic_mapping.xml:3792 +#, no-c-format +msgid "" +"default-cascade (optional - defaults to none): a default cascade style." +msgstr "" +"default-cascade (opcional – o padrão é none): Um estilo cascata padrão." + +#. Tag: para +#: basic_mapping.xml:3797 +#, no-c-format +msgid "" +"default-access (optional - defaults to property): the strategy Hibernate should use for accessing all properties. " +"It can be a custom implementation of PropertyAccessor." +msgstr "" +"default-access (opcional – o padrão é property): A estratégia que o Hibernate deve utilizar para acessar todas as " +"propridades. Pode ser uma implementação personalizada de " +"PropertyAccessor." + +#. Tag: para +#: basic_mapping.xml:3804 +#, no-c-format +msgid "" +"default-lazy (optional - defaults to true): the default value for unspecified lazy " +"attributes of class and collection mappings." +msgstr "" +"default-lazy (opcional - o padrão é true): O valor padrão para atributos lazy não " +"especificados da classe e dos mapeamentos de coleções." + +#. Tag: para +#: basic_mapping.xml:3811 +#, no-c-format +msgid "" +"auto-import (optional - defaults to true): specifies whether we can use unqualified class names of classes " +"in this mapping in the query language." +msgstr "" +"auto-import (opcional - o padrão é true): Especifica se podemos usar nomes de classes não qualificados, das " +"classes deste mapeamento, na linguagem de consulta." + +#. Tag: para +#: basic_mapping.xml:3818 +#, no-c-format +msgid "" +"package (optional): specifies a package prefix to use for " +"unqualified class names in the mapping document." +msgstr "" +"package (opcional): Especifica um prefixo do pacote a ser " +"considerado para nomes de classes não qualificadas no documento de " +"mapeamento. " + +#. Tag: para +#: basic_mapping.xml:3825 +#, no-c-format +msgid "" +"If you have two persistent classes with the same unqualified name, you " +"should set auto-import=\"false\". An exception will " +"result if you attempt to assign two classes to the same \"imported\" name." +msgstr "" +"Se você tem duas classes persistentes com o mesmo nome (não qualificadas), " +"você deve ajustar auto-import=\"false\". Caso você tentar " +"ajustar duas classes para o mesmo nome \"importado\", isto resultará numa " +"exceção." + +#. Tag: para +#: basic_mapping.xml:3830 +#, no-c-format +msgid "" +"The hibernate-mapping element allows you to nest several " +"persistent <class> mappings, as shown above. It is, " +"however, good practice (and expected by some tools) to map only a single " +"persistent class, or a single class hierarchy, in one mapping file and name " +"it after the persistent superclass. For example, Cat.hbm.xml, Dog.hbm.xml, or if using inheritance, " +"Animal.hbm.xml." +msgstr "" +"Observe que o elemento hibernate-mapping permite que você " +"aninhe diversos mapeamentos de <class> " +"persistentes, como mostrado abaixo. Entretanto, é uma boa prática (e " +"esperado por algumas ferramentas) o mapeamento de apenas uma classe " +"persistente simples (ou uma hierarquia de classes simples) em um arquivo de " +"mapeamento e nomeá-la após a superclasse persistente, por exemplo: " +"Cat.hbm.xml, Dog.hbm.xml, ou se " +"estiver usando herança, Animal.hbm.xml. " + +#. Tag: title +#: basic_mapping.xml:3841 +#, no-c-format +msgid "Key" +msgstr "" + +#. Tag: para +#: basic_mapping.xml:3843 +#, fuzzy, no-c-format +msgid "" +"The <key> element is featured a few times within " "this guide. It appears anywhere the parent mapping element defines a join to " "a new table that references the primary key of the original table. It also " "defines the foreign key in the joined table:" @@ -3293,7 +7756,22 @@ msgstr "" "junção para a nova tabela, e define a chave exterior para a tabela " "associada. Ele também referencia a chave primária da tabela original:" +#. Tag: programlisting +#: basic_mapping.xml:3864 +#, no-c-format +msgid "" +"<key\n" +" column=\"columnname\"\n" +" on-delete=\"noaction|cascade\"\n" +" property-ref=\"propertyName\"\n" +" not-null=\"true|false\"\n" +" update=\"true|false\"\n" +" unique=\"true|false\"\n" +"/>" +msgstr "" + #. Tag: para +#: basic_mapping.xml:3874 #, no-c-format msgid "" "on-delete (optional - defaults to noactionproperty-ref (optional): specifies that the foreign key " @@ -3316,6 +7795,7 @@ msgstr "" "os dados legados." #. Tag: para +#: basic_mapping.xml:3886 #, no-c-format msgid "" "not-null (optional): specifies that the foreign key " @@ -3327,6 +7807,7 @@ msgstr "" "a chave exterior também fizer parte da chave primária." #. Tag: para +#: basic_mapping.xml:3892 #, no-c-format msgid "" "update (optional): specifies that the foreign key should " @@ -3338,6 +7819,7 @@ msgstr "" "exterior também fizer parte da chave primária." #. Tag: para +#: basic_mapping.xml:3898 #, no-c-format msgid "" "unique (optional): specifies that the foreign key should " @@ -3349,6 +7831,7 @@ msgstr "" "exterior também fizer parte da chave primária." #. Tag: para +#: basic_mapping.xml:3905 #, no-c-format msgid "" "For systems where delete performance is important, we recommend that all " @@ -3366,6 +7849,7 @@ msgstr "" "da estratégia usual de bloqueio otimista do Hibernate para dados versionados." #. Tag: para +#: basic_mapping.xml:3913 #, no-c-format msgid "" "The not-null and update attributes are " @@ -3381,54 +7865,13 @@ msgstr "" "<key not-null=\"true\">." #. Tag: title -#, no-c-format -msgid "Column and formula elements" -msgstr "Elementos coluna e fórmula " - -#. Tag: para -#, no-c-format -msgid "" -"Mapping elements which accept a column attribute will " -"alternatively accept a <column> subelement. " -"Likewise, <formula> is an alternative to the " -"formula attribute. For example:" -msgstr "" -"Qualquer elemento de mapeamento que aceita uma função column irá aceitar alternativamente um sub-elemento <column>" -". Da mesma forma, <formula> é uma " -"alternativa para a função formula." - -#. Tag: para -#, no-c-format -msgid "" -"Most of the attributes on column provide a means of " -"tailoring the DDL during automatic schema generation. The read and write attributes allow you to specify custom " -"SQL that Hibernate will use to access the column's value. For more on this, " -"see the discussion of column " -"read and write expressions." -msgstr "" -"A maioria das funções no column fornecem um significado de junção do DDL durante a geração automática do esquema. As funções read e write permitem que você especifique o SQL personalizado, do qual o Hibernate usará para acessar o valor da coluna. Consulte a discussão da column " -"read and write expressions para maiores informações." - -#. Tag: para -#, no-c-format -msgid "" -"The column and formula elements can " -"even be combined within the same property or association mapping to express, " -"for example, exotic join conditions." -msgstr "" -"Os elementos column e formula podem até " -"ser combinados dentro da mesma propriedade ou associação mapeando para " -"expressar, por exemplo, condições de associações exóticas." - -#. Tag: title +#: basic_mapping.xml:3922 #, no-c-format msgid "Import" msgstr "Importar " #. Tag: para +#: basic_mapping.xml:3924 #, no-c-format msgid "" "If your application has two persistent classes with the same name, and you " @@ -3443,14 +7886,33 @@ msgstr "" "preferência contando com auto-import=\"true\". Você pode " "até importar classes e interfaces que não estão explicitamente mapeadas:" -#. Tag: para +#. Tag: programlisting +#: basic_mapping.xml:3930 #, no-c-format -msgid "class: the fully qualified class name of any Java class." +msgid "<import class=\"java.lang.Object\" rename=\"Universe\"/>" +msgstr "" + +#. Tag: programlisting +#: basic_mapping.xml:3939 +#, no-c-format +msgid "" +"<import\n" +" class=\"ClassName\"\n" +" rename=\"ShortName\"\n" +"/>" +msgstr "" + +#. Tag: para +#: basic_mapping.xml:3943 +#, no-c-format +msgid "" +"class: the fully qualified class name of any Java class." msgstr "" "class: O nome qualificado do pacote de qualquer classe " "Java." #. Tag: para +#: basic_mapping.xml:3948 #, no-c-format msgid "" "rename (optional - defaults to the unqualified class " @@ -3459,100 +7921,114 @@ msgstr "" "rename (opcional – padrão para o nome da classe não " "qualificada): Um nome que pode ser usado numa linguagem de consulta." -#. Tag: title -#, no-c-format -msgid "Any" -msgstr "Any" - #. Tag: para +#: basic_mapping.xml:3956 #, no-c-format -msgid "" -"There is one more type of property mapping. The <any> mapping element defines a polymorphic association to classes from " -"multiple tables. This type of mapping requires more than one column. The " -"first column contains the type of the associated entity. The remaining " -"columns contain the identifier. It is impossible to specify a foreign key " -"constraint for this kind of association. This is not the usual way of " -"mapping polymorphic associations and you should use this only in special " -"cases. For example, for audit logs, user session data, etc." +msgid "This feature is unique to hbm.xml and is not supported in annotations." msgstr "" -"Existe mais um tipo de propriedade de mapeamento. O elemento de mapeamento " -"<any> define uma associação polimórfica para " -"classes de múltiplas tabelas. Este tipo de mapeamento sempre requer mais de " -"uma coluna. A primeira coluna possui o tipo da entidade associada. A outra " -"coluna restante possui o identificador. É impossível especificar uma " -"restrição de chave exterior para este tipo de associação, portanto isto " -"certamente não é visto como um caminho usual para associações (polimórficas) " -"de mapeamento. Você deve usar este mapeamento apenas em casos muito " -"especiais. Por exemplo: audit logs, dados de sessão do usuário, etc. " - -#. Tag: para -#, no-c-format -msgid "" -"The meta-type attribute allows the application to specify " -"a custom type that maps database column values to persistent classes that " -"have identifier properties of the type specified by id-type. You must specify the mapping from values of the meta-type to class " -"names." -msgstr "" -"A função meta-type permite que a aplicação especifique um " -"tipo adaptado que mapeia valores de colunas de banco de dados para classes " -"persistentes que possuem propriedades identificadoras do tipo especificado " -"através do id-type. Você deve especificar o mapeamento de " -"valores do meta-type para nome de classes. " - -#. Tag: para -#, no-c-format -msgid "name: the property name." -msgstr "name: o nome da propriedade." - -#. Tag: para -#, no-c-format -msgid "id-type: the identifier type." -msgstr "id-type: o tipo identificador." - -#. Tag: para -#, no-c-format -msgid "" -"meta-type (optional - defaults to string): any type that is allowed for a discriminator mapping." -msgstr "" -"meta-type (opcional – padrão para string): Qualquer tipo que é permitido para um mapeamento discriminador." - -#. Tag: para -#, no-c-format -msgid "" -"cascade (optional- defaults to none): " -"the cascade style." -msgstr "" -"cascade (opcional – valor padrão none): o estilo cascata." - -#. Tag: para -#, no-c-format -msgid "" -"optimistic-lock (optional - defaults to true): specifies that updates to this property either do or do not " -"require acquisition of the optimistic lock. It defines whether a version " -"increment should occur if this property is dirty." -msgstr "" -"optimistic-lock (opcional - valor padrãotrue): Especifica que as atualizações para esta propriedade requerem ou " -"não aquisição da bloqueio otimista. Em outras palavras, define se uma versão " -"de incremento deve ocorrer se esta propriedade for suja." #. Tag: title +#: basic_mapping.xml:3962 +#, no-c-format +msgid "Column and formula elements" +msgstr "Elementos coluna e fórmula " + +#. Tag: para +#: basic_mapping.xml:3964 +#, no-c-format +msgid "" +"Mapping elements which accept a column attribute will " +"alternatively accept a <column> subelement. " +"Likewise, <formula> is an alternative to the " +"formula attribute. For example:" +msgstr "" +"Qualquer elemento de mapeamento que aceita uma função column irá aceitar alternativamente um sub-elemento <column>" +". Da mesma forma, <formula> é uma " +"alternativa para a função formula." + +#. Tag: programlisting +#: basic_mapping.xml:3970 +#, no-c-format +msgid "" +"<column\n" +" name=\"column_name\"\n" +" length=\"N\"\n" +" precision=\"N\"\n" +" scale=\"N\"\n" +" not-null=\"true|false\"\n" +" unique=\"true|false\"\n" +" unique-key=\"multicolumn_unique_key_name\"\n" +" index=\"index_name\"\n" +" sql-type=\"sql_type_name\"\n" +" check=\"SQL expression\"\n" +" default=\"SQL expression\"\n" +" read=\"SQL expression\"\n" +" write=\"SQL expression\"/>" +msgstr "" + +#. Tag: programlisting +#: basic_mapping.xml:3972 +#, no-c-format +msgid "<formula>SQL expression</formula>" +msgstr "" + +#. Tag: para +#: basic_mapping.xml:3974 +#, no-c-format +msgid "" +"Most of the attributes on column provide a means of " +"tailoring the DDL during automatic schema generation. The read and write attributes allow you to specify custom " +"SQL that Hibernate will use to access the column's value. For more on this, " +"see the discussion of column " +"read and write expressions." +msgstr "" +"A maioria das funções no column fornecem um significado " +"de junção do DDL durante a geração automática do esquema. As funções " +"read e write permitem que você " +"especifique o SQL personalizado, do qual o Hibernate usará para acessar o " +"valor da coluna. Consulte a discussão da column read and write expressions para maiores " +"informações." + +#. Tag: para +#: basic_mapping.xml:3982 +#, no-c-format +msgid "" +"The column and formula elements can " +"even be combined within the same property or association mapping to express, " +"for example, exotic join conditions." +msgstr "" +"Os elementos column e formula podem " +"até ser combinados dentro da mesma propriedade ou associação mapeando para " +"expressar, por exemplo, condições de associações exóticas." + +#. Tag: programlisting +#: basic_mapping.xml:3986 +#, no-c-format +msgid "" +"<many-to-one name=\"homeAddress\" class=\"Address\"\n" +" insert=\"false\" update=\"false\">\n" +" <column name=\"person_id\" not-null=\"true\" length=\"10\"/>\n" +" <formula>'MAILING'</formula>\n" +"</many-to-one>" +msgstr "" + +#. Tag: title +#: basic_mapping.xml:3992 #, no-c-format msgid "Hibernate types" msgstr "Tipos do Hibernate " #. Tag: title +#: basic_mapping.xml:3995 #, no-c-format msgid "Entities and values" msgstr "Entidades e valores" #. Tag: para +#: basic_mapping.xml:3997 #, no-c-format msgid "" "In relation to the persistence service, Java language-level objects are " @@ -3562,6 +8038,7 @@ msgstr "" "relação ao serviço de persistência:" #. Tag: para +#: basic_mapping.xml:4000 #, no-c-format msgid "" "An entity exists independently of any other objects " @@ -3586,6 +8063,7 @@ msgstr "" "podem ser versionados." #. Tag: para +#: basic_mapping.xml:4010 #, no-c-format msgid "" "An entity's persistent state consists of references to other entities and " @@ -3609,6 +8087,7 @@ msgstr "" "assim eles não podem ser comuns para duas entidades ou coleções." #. Tag: para +#: basic_mapping.xml:4020 #, no-c-format msgid "" "Until now, we have been using the term \"persistent class\" to refer to " @@ -3638,11 +8117,13 @@ msgstr "" "de valor." #. Tag: para +#: basic_mapping.xml:4033 #, no-c-format msgid "We will revisit both concepts throughout this reference guide." msgstr "Iremos rever ambos os conceitos durante todo o guia de referência." #. Tag: para +#: basic_mapping.xml:4036 #, no-c-format msgid "" "The challenge is to map the Java type system, and the developers' definition " @@ -3669,6 +8150,7 @@ msgstr "" "estratégia de conversão adaptada, como você." #. Tag: para +#: basic_mapping.xml:4049 #, no-c-format msgid "" "With the exception of collections, all built-in Hibernate types support null " @@ -3678,11 +8160,13 @@ msgstr "" "nulas com a exceção das coleções." #. Tag: title +#: basic_mapping.xml:4054 #, no-c-format msgid "Basic value types" msgstr "Valores de tipos básicos" #. Tag: para +#: basic_mapping.xml:4056 #, no-c-format msgid "" "The built-in basic mapping types can be roughly " @@ -3691,16 +8175,18 @@ msgstr "" "Os tipos de mapeamento básicos fazem parte da " "categorização do seguinte:" -#. Tag: term -#, no-c-format +#. Tag: literal +#: basic_mapping.xml:4059 +#, fuzzy, no-c-format msgid "" -"integer, long, short, float, double, character, byte, boolean, " -"yes_no, true_false" +"integer, long, short, float, double, character, byte, boolean, yes_no, " +"true_false" msgstr "" "integer, long, short, float, double, character, byte, boolean, " "yes_no, true_false" #. Tag: para +#: basic_mapping.xml:4063 #, no-c-format msgid "" "Type mappings from Java primitives or wrapper classes to appropriate (vendor-" @@ -3713,12 +8199,14 @@ msgstr "" "yes_no são todas codificações alternativas para um " "boolean ou java.lang.Boolean do Java." -#. Tag: term +#. Tag: literal +#: basic_mapping.xml:4073 #, no-c-format -msgid "string" -msgstr "string" +msgid "string" +msgstr "" #. Tag: para +#: basic_mapping.xml:4076 #, no-c-format msgid "" "A type mapping from java.lang.String to VARCHARjava.lang.String para " "VARCHAR (ou VARCHAR2 no Oracle)." -#. Tag: term -#, no-c-format -msgid "date, time, timestamp" +#. Tag: literal +#: basic_mapping.xml:4083 +#, fuzzy, no-c-format +msgid "date, time, timestamp" msgstr "date, time, timestamp" #. Tag: para +#: basic_mapping.xml:4086 #, no-c-format msgid "" "Type mappings from java.util.Date and its subclasses to " @@ -3743,12 +8233,14 @@ msgstr "" "para os tipos SQL DATE, TIME e " "TIMESTAMP (ou equivalente)." -#. Tag: term -#, no-c-format -msgid "calendar, calendar_date" +#. Tag: literal +#: basic_mapping.xml:4094 +#, fuzzy, no-c-format +msgid "calendar, calendar_date" msgstr "calendar, calendar_date" #. Tag: para +#: basic_mapping.xml:4097 #, no-c-format msgid "" "Type mappings from java.util.Calendar to SQL types " @@ -3757,12 +8249,14 @@ msgstr "" "Tipo de mapeamento de java.util.Calendar para os tipos " "SQL TIMESTAMP e DATE (ou equivalente)." -#. Tag: term -#, no-c-format -msgid "big_decimal, big_integer" +#. Tag: literal +#: basic_mapping.xml:4104 +#, fuzzy, no-c-format +msgid "big_decimal, big_integer" msgstr "big_decimal, big_integer" #. Tag: para +#: basic_mapping.xml:4107 #, no-c-format msgid "" "Type mappings from java.math.BigDecimal and java." @@ -3773,12 +8267,14 @@ msgstr "" "java.math.BigInteger para NUMERIC (ou " "NUMBER no Oracle)." -#. Tag: term -#, no-c-format -msgid "locale, timezone, currency" +#. Tag: literal +#: basic_mapping.xml:4115 +#, fuzzy, no-c-format +msgid "locale, timezone, currency" msgstr "locale, timezone, currency" #. Tag: para +#: basic_mapping.xml:4118 #, no-c-format msgid "" "Type mappings from java.util.Locale, java.util." @@ -3795,12 +8291,14 @@ msgstr "" "mapeados para seus códigos ISO. Instâncias de TimeZone " "são mapeados para seu ID." -#. Tag: term -#, no-c-format -msgid "class" -msgstr "class" +#. Tag: literal +#: basic_mapping.xml:4131 +#, fuzzy, no-c-format +msgid "class" +msgstr "Classe" #. Tag: para +#: basic_mapping.xml:4134 #, no-c-format msgid "" "A type mapping from java.lang.Class to VARCHARVARCHAR (ou VARCHAR2 no Oracle). Uma " "Class é mapeada pelo seu nome qualificado (completo)." -#. Tag: term +#. Tag: literal +#: basic_mapping.xml:4142 #, no-c-format -msgid "binary" -msgstr "binary" +msgid "binary" +msgstr "" #. Tag: para +#: basic_mapping.xml:4145 #, no-c-format msgid "Maps byte arrays to an appropriate SQL binary type." msgstr "Mapeia matrizes de bytes para um tipo binário de SQL apropriado." -#. Tag: term +#. Tag: literal +#: basic_mapping.xml:4150 #, no-c-format -msgid "text" -msgstr "text" +msgid "text" +msgstr "" #. Tag: para +#: basic_mapping.xml:4153 #, no-c-format msgid "" "Maps long Java strings to a SQL CLOB or TEXTCLOB ou " "TEXT. " -#. Tag: term +#. Tag: literal +#: basic_mapping.xml:4159 #, no-c-format -msgid "serializable" -msgstr "serializable" +msgid "serializable" +msgstr "" #. Tag: para +#: basic_mapping.xml:4162 #, no-c-format msgid "" "Maps serializable Java types to an appropriate SQL binary type. You can also " @@ -3852,12 +8356,14 @@ msgstr "" "o nome da classe ou interface Java serializável que não é padrão para um " "tipo básico. " -#. Tag: term +#. Tag: literal +#: basic_mapping.xml:4171 #, no-c-format -msgid "clob, blob" -msgstr "clob, blob" +msgid "clob, blob" +msgstr "" #. Tag: para +#: basic_mapping.xml:4174 #, no-c-format msgid "" "Type mappings for the JDBC classes java.sql.Clob and " @@ -3871,16 +8377,18 @@ msgstr "" "reusado fora de uma transação. Além disso, o suporte de driver é imcompleto " "e inconsistente." -#. Tag: term -#, no-c-format +#. Tag: literal +#: basic_mapping.xml:4184 +#, fuzzy, no-c-format msgid "" -"imm_date, imm_time, imm_timestamp, imm_calendar, imm_calendar_date, " -"imm_serializable, imm_binary" +"imm_date, imm_time, imm_timestamp, imm_calendar, imm_calendar_date, " +"imm_serializable, imm_binary" msgstr "" "imm_date, imm_time, imm_timestamp, imm_calendar, imm_calendar_date, " "imm_serializable, imm_binary" #. Tag: para +#: basic_mapping.xml:4188 #, no-c-format msgid "" "Type mappings for what are considered mutable Java types. This is where " @@ -3900,6 +8408,7 @@ msgstr "" "aplicação deve atribuir um novo objeto (nonidentical) à propriedade." #. Tag: para +#: basic_mapping.xml:4200 #, no-c-format msgid "" "Unique identifiers of entities and collections can be of any basic type " @@ -3913,6 +8422,7 @@ msgstr "" "Leia abaixo para maiores informações." #. Tag: para +#: basic_mapping.xml:4205 #, no-c-format msgid "" "The basic value types have corresponding Type constants " @@ -3926,11 +8436,13 @@ msgstr "" "string." #. Tag: title +#: basic_mapping.xml:4212 #, no-c-format msgid "Custom value types" msgstr "Tipos de valores personalizados" #. Tag: para +#: basic_mapping.xml:4214 #, no-c-format msgid "" "It is relatively easy for developers to create their own value types. For " @@ -3955,6 +8467,7 @@ msgstr "" "SURNAME. " #. Tag: para +#: basic_mapping.xml:4225 #, no-c-format msgid "" "To implement a custom type, implement either org.hibernate." @@ -3969,7 +8482,19 @@ msgstr "" "org.hibernate.test.DoubleStringType para outras " "funcionalidades. " +#. Tag: programlisting +#: basic_mapping.xml:4232 +#, no-c-format +msgid "" +"<property name=\"twoStrings\" type=\"org.hibernate.test.DoubleStringType" +"\">\n" +" <column name=\"first_string\"/>\n" +" <column name=\"second_string\"/>\n" +"</property>" +msgstr "" + #. Tag: para +#: basic_mapping.xml:4234 #, no-c-format msgid "" "Notice the use of <column> tags to map a property " @@ -3979,6 +8504,7 @@ msgstr "" "propriedade para colunas múltiplas." #. Tag: para +#: basic_mapping.xml:4237 #, no-c-format msgid "" "The CompositeUserType, EnhancedUserTypeUserType in the " @@ -4006,7 +8533,19 @@ msgstr "" "literal>. Para fornecer parâmetros a seu tipo personalizado, você pode usar " "o elemento <type> em seus arquivos de mapeamento. " +#. Tag: programlisting +#: basic_mapping.xml:4250 +#, no-c-format +msgid "" +"<property name=\"priority\">\n" +" <type name=\"com.mycompany.usertypes.DefaultValueIntegerType\">\n" +" <param name=\"default\">0</param>\n" +" </type>\n" +"</property>" +msgstr "" + #. Tag: para +#: basic_mapping.xml:4252 #, no-c-format msgid "" "The UserType can now retrieve the value for the parameter " @@ -4018,6 +8557,7 @@ msgstr "" "passado a ele." #. Tag: para +#: basic_mapping.xml:4256 #, no-c-format msgid "" "If you regularly use a certain UserType, it is useful to " @@ -4032,7 +8572,24 @@ msgstr "" "tipo personalizado, e pode também conter uma lista de valores de parâmetro " "padrão se o tipo for parametrizado." +#. Tag: programlisting +#: basic_mapping.xml:4262 +#, no-c-format +msgid "" +"<typedef class=\"com.mycompany.usertypes.DefaultValueIntegerType\" name=" +"\"default_zero\">\n" +" <param name=\"default\">0</param>\n" +"</typedef>" +msgstr "" + +#. Tag: programlisting +#: basic_mapping.xml:4264 +#, no-c-format +msgid "<property name=\"priority\" type=\"default_zero\"/>" +msgstr "" + #. Tag: para +#: basic_mapping.xml:4266 #, no-c-format msgid "" "It is also possible to override the parameters supplied in a typedef on a " @@ -4043,6 +8600,7 @@ msgstr "" "mapeamento da propriedade." #. Tag: para +#: basic_mapping.xml:4270 #, no-c-format msgid "" "Even though Hibernate's rich range of built-in types and support for " @@ -4065,11 +8623,13 @@ msgstr "" "contra mudanças possíveis na forma de representação de valores monetários. " #. Tag: title +#: basic_mapping.xml:4283 #, no-c-format msgid "Mapping a class more than once" msgstr "Mapeando uma classe mais de uma vez" #. Tag: para +#: basic_mapping.xml:4285 #, no-c-format msgid "" "It is possible to provide more than one mapping for a particular persistent " @@ -4087,7 +8647,31 @@ msgstr "" "com objetos persistentes, quando escrever consultas, ou ao mapear " "associações para a entidade nomeada. " +#. Tag: programlisting +#: basic_mapping.xml:4293 +#, no-c-format +msgid "" +"<class name=\"Contract\" table=\"Contracts\"\n" +" entity-name=\"CurrentContract\">\n" +" ...\n" +" <set name=\"history\" inverse=\"true\"\n" +" order-by=\"effectiveEndDate desc\">\n" +" <key column=\"currentContractId\"/>\n" +" <one-to-many entity-name=\"HistoricalContract\"/>\n" +" </set>\n" +"</class>\n" +"\n" +"<class name=\"Contract\" table=\"ContractHistory\"\n" +" entity-name=\"HistoricalContract\">\n" +" ...\n" +" <many-to-one name=\"currentContract\"\n" +" column=\"currentContractId\"\n" +" entity-name=\"CurrentContract\"/>\n" +"</class>" +msgstr "" + #. Tag: para +#: basic_mapping.xml:4295 #, no-c-format msgid "" "Associations are now specified using entity-name instead " @@ -4096,12 +8680,20 @@ msgstr "" "Note como as associações são agora especificadas utilizando o " "entity-name ao invés da class. " +#. Tag: para +#: basic_mapping.xml:4299 basic_mapping.xml:4379 basic_mapping.xml:4414 +#, no-c-format +msgid "This feature is not supported in Annotations" +msgstr "" + #. Tag: title +#: basic_mapping.xml:4304 #, no-c-format msgid "SQL quoted identifiers" msgstr "Identificadores quotados do SQL" #. Tag: para +#: basic_mapping.xml:4306 #, no-c-format msgid "" "You can force Hibernate to quote an identifier in the generated SQL by " @@ -4116,100 +8708,32 @@ msgstr "" "Dialect. Geralmente são quotas dúplas, mas parênteses " "para o Servidor SQL e backticks para MeuSQL." -#. Tag: title -#, no-c-format -msgid "Metadata alternatives" -msgstr "Alternativas de Metadados" - -#. Tag: para +#. Tag: programlisting +#: basic_mapping.xml:4312 #, no-c-format msgid "" -"XML does not suit all users so there are some alternative ways to define O/R " -"mapping metadata in Hibernate." +"@Entity @Table(name=\"`Line Item`\")\n" +"class LineItem {\n" +" @id @Column(name=\"`Item Id`\") Integer id;\n" +" @Column(name=\"`Item #`\") int itemNumber\n" +"}\n" +"\n" +"<class name=\"LineItem\" table=\"`Line Item`\">\n" +" <id name=\"id\" column=\"`Item Id`\"/><generator class=" +"\"assigned\"/></id>\n" +" <property name=\"itemNumber\" column=\"`Item #`\"/>\n" +" ...\n" +"</class>" msgstr "" -"O XML não é para todos, e portanto existem algumas formas alternativas de " -"defiinir o metadado de mapeamento no Hibernate. " - -#. Tag: title -#, no-c-format -msgid "Using XDoclet markup" -msgstr "Usando a marcação XDoclet." - -#. Tag: para -#, no-c-format -msgid "" -"Many Hibernate users prefer to embed mapping information directly in " -"sourcecode using XDoclet @hibernate.tags. We do not cover " -"this approach in this reference guide since it is considered part of " -"XDoclet. However, we include the following example of the Cat class with XDoclet mappings:" -msgstr "" -"Muitos usuários do Hibernate preferem encubar a informação de mapeamento " -"diretamente no código de fonte utilizando o XDoclet @hibernate." -"tags. Nós não falaremos sobre esta abordagem neste documento, uma " -"vez que é estritamente considerado parte de um XDoclet. No entanto, " -"incluímos os seguintes exemplos da classe Cat com os " -"mapeamentos de XDoclet:" - -#. Tag: para -#, no-c-format -msgid "See the Hibernate website for more examples of XDoclet and Hibernate." -msgstr "" -"Veja o web site do Hibernate para maiores detalhes sobre um XDoclet e " -"Hibernate. " - -#. Tag: title -#, no-c-format -msgid "Using JDK 5.0 Annotations" -msgstr "Usando as anotações JDK 5.0" - -#. Tag: para -#, no-c-format -msgid "" -"JDK 5.0 introduced XDoclet-style annotations at the language level that are " -"type-safe and checked at compile time. This mechanism is more powerful than " -"XDoclet annotations and better supported by tools and IDEs. IntelliJ IDEA, " -"for example, supports auto-completion and syntax highlighting of JDK 5.0 " -"annotations. The new revision of the EJB specification (JSR-220) uses JDK " -"5.0 annotations as the primary metadata mechanism for entity beans. " -"Hibernate3 implements the EntityManager of JSR-220 (the " -"persistence API). Support for mapping metadata is available via the " -"Hibernate Annotations package as a separate download. " -"Both EJB3 (JSR-220) and Hibernate3 metadata is supported." -msgstr "" -"O JDK 5.0 introduziu as anotações estilo XDoclet em nível de linguagem, tipo " -"seguro e checado em tempo de compilação. Este mecanismo é mais potente do " -"que as anotações XDoclet e melhor suportado pelas ferramentas e IDEs. O " -"IntelliJ IDEA por exemplo, suporta a auto complexão e destaque da sintaxe " -"das anotações JDK 5.0. A nova revisão da especificação EJB (JSR-220) usa as " -"anotações JDK 5.0 como mecanismos de metadados para beans de entidade. O " -"Hibernate3 implementa o EntityManager do JSR-220 (o API " -"de persistência). O suporte para mapear metadados está disponível através do " -"pacote Anotações do Hibernate, como um download " -"separado. Ambos os EJB3 (JSR-220) e o metadado Hibernate3 são suportados. " - -#. Tag: para -#, no-c-format -msgid "This is an example of a POJO class annotated as an EJB entity bean:" -msgstr "Este é um exemplo de uma classe POJO anotado como um bean de entidade EJB:" - -#. Tag: para -#, no-c-format -msgid "" -"Support for JDK 5.0 Annotations (and JSR-220) is currently under " -"development. Please refer to the Hibernate Annotations module for more " -"details." -msgstr "" -"Note que o suporte para Anotações JDK 5.0 (e JSR-220) ainda está em " -"construção. Consulte o módulo de Anotações do Hibernate para maiores " -"detalhes. " #. Tag: title +#: basic_mapping.xml:4316 #, no-c-format msgid "Generated properties" msgstr "Propriedades geradas " #. Tag: para +#: basic_mapping.xml:4318 #, no-c-format msgid "" "Generated properties are properties that have their values generated by the " @@ -4230,6 +8754,7 @@ msgstr "" "para recuperar os valores gerados." #. Tag: para +#: basic_mapping.xml:4327 #, no-c-format msgid "" "Properties marked as generated must additionally be non-insertable and non-" @@ -4239,11 +8764,13 @@ msgid "" "can be marked as generated." msgstr "" "As propriedades marcadas como geradas devem ser não-inseríveis e não-" -"atualizáveis. Somente versions, timestamps, " -"e simple properties podem ser marcadas como geradas." +"atualizáveis. Somente versions, timestamps, e simple properties podem ser marcadas como geradas." #. Tag: para +#: basic_mapping.xml:4334 #, no-c-format msgid "" "never (the default): the given property value is not " @@ -4253,6 +8780,7 @@ msgstr "" "dado não é gerado dentro do banco de dados. " #. Tag: para +#: basic_mapping.xml:4337 #, no-c-format msgid "" "insert: the given property value is generated on insert, " @@ -4265,12 +8793,13 @@ msgstr "" "insert: informa que o valor de propriedade dado é gerado " "ao inserir, mas não é novamente gerado nas próximas atualizações. " "Propriedades do tipo data criada, se encaixam nesta categoria. Note que " -"embora as propriedades version e timestamp podem ser marcadas como " -"geradas, esta opção não está disponível." +"embora as propriedades version e timestamp podem ser marcadas como geradas, esta opção não está " +"disponível." #. Tag: para +#: basic_mapping.xml:4344 #, no-c-format msgid "" "always: the property value is generated both on insert " @@ -4279,60 +8808,96 @@ msgstr "" "always - informa que o valor da propriedade é gerado " "tanto ao inserir quanto ao atualizar. " +#. Tag: para +#: basic_mapping.xml:4347 +#, no-c-format +msgid "To mark a property as generated, use @Generated." +msgstr "" + #. Tag: title +#: basic_mapping.xml:4352 #, no-c-format msgid "Column read and write expressions" msgstr "Coluna de expressöes de gravação e leitura" #. Tag: para -#, no-c-format +#: basic_mapping.xml:4354 +#, fuzzy, no-c-format msgid "" "Hibernate allows you to customize the SQL it uses to read and write the " "values of columns mapped to simple properties. For example, if your database provides a set of " "data encryption functions, you can invoke them for individual columns like " -"this: <property name=\"creditCardNumber" -"\"> <column name=\"credit_card_num\" read=\"decrypt(credit_card_num)\" " -"write=\"encrypt(?)\"/> </property>" +"this:" +msgstr "" +"O Hibernate permite você personalizar o SQL utilizado para ler e gravar os " +"valores da coluna mapeada ao simple properties. Por exemplo, caso o seu banco de dados fornecer " +"um conjunto de funçöes encriptonados de dados, você poderá invocá-las para " +"colunas individuais como: <property name=" +"\"creditCardNumber\"> <column name=\"credit_card_num\" read=\"decrypt" +"(credit_card_num)\" write=\"encrypt(?)\"/> </property>" + +#. Tag: programlisting +#: basic_mapping.xml:4359 +#, no-c-format +msgid "" +"<property name=\"creditCardNumber\">\n" +" <column \n" +" name=\"credit_card_num\"\n" +" read=\"decrypt(credit_card_num)\"\n" +" write=\"encrypt(?)\"/>\n" +"</property>" msgstr "" -"O Hibernate permite você personalizar o SQL utilizado para ler e gravar os valores da coluna mapeada ao simple properties. Por exemplo, caso o seu banco de dados fornecer um conjunto de funçöes encriptonados de dados, você poderá invocá-las para colunas individuais como: <property name=\"creditCardNumber" -"\"> <column name=\"credit_card_num\" read=\"decrypt(credit_card_num)\" " -"write=\"encrypt(?)\"/> </property>" #. Tag: para +#: basic_mapping.xml:4361 #, no-c-format msgid "" "Hibernate applies the custom expressions automatically whenever the property " "is referenced in a query. This functionality is similar to a derived-" "property formula with two differences:" -msgstr "O Hibernate aplica automaticamente as expressöes personalizadas a todo instante que a propriedade é referenciada numa consulta. Esta funcionalidade é parecida a uma formula de propriedade-derivada com duas diferenças:" +msgstr "" +"O Hibernate aplica automaticamente as expressöes personalizadas a todo " +"instante que a propriedade é referenciada numa consulta. Esta funcionalidade " +"é parecida a uma formula de propriedade-derivada com duas " +"diferenças:" #. Tag: para +#: basic_mapping.xml:4366 #, no-c-format msgid "" "The property is backed by one or more columns that are exported as part of " "automatic schema generation." -msgstr "Esta propriedade é suportada por uma ou mais colunas que são exportadas como parte da geração do esquema automático." +msgstr "" +"Esta propriedade é suportada por uma ou mais colunas que são exportadas como " +"parte da geração do esquema automático." #. Tag: para +#: basic_mapping.xml:4371 #, no-c-format msgid "The property is read-write, not read-only." msgstr "Esta propriedade é de gravação-leitura, e não de leitura apenas." #. Tag: para +#: basic_mapping.xml:4375 #, no-c-format msgid "" "The write expression, if specified, must contain exactly " "one '?' placeholder for the value." -msgstr "Caso a expressão writeseja especificada, deverá conter um '?' para o valor." +msgstr "" +"Caso a expressão writeseja especificada, deverá conter um " +"'?' para o valor." #. Tag: title +#: basic_mapping.xml:4384 #, no-c-format msgid "Auxiliary database objects" msgstr "Objetos de Banco de Dados Auxiliares " #. Tag: para +#: basic_mapping.xml:4386 #, no-c-format msgid "" "Auxiliary database objects allow for the CREATE and DROP of arbitrary " @@ -4354,6 +8919,7 @@ msgstr "" "módulos essenciais para definir objetos de banco de dados auxiliares:" #. Tag: para +#: basic_mapping.xml:4396 #, no-c-format msgid "" "The first mode is to explicitly list the CREATE and DROP commands in the " @@ -4362,7 +8928,21 @@ msgstr "" "O primeiro módulo é para listar explicitamente os comandos CREATE e DROP no " "arquivo de mapeamento: " +#. Tag: programlisting +#: basic_mapping.xml:4399 +#, no-c-format +msgid "" +"<hibernate-mapping>\n" +" ...\n" +" <database-object>\n" +" <create>CREATE TRIGGER my_trigger ...</create>\n" +" <drop>DROP TRIGGER my_trigger</drop>\n" +" </database-object>\n" +"</hibernate-mapping>" +msgstr "" + #. Tag: para +#: basic_mapping.xml:4401 #, no-c-format msgid "" "The second mode is to supply a custom class that constructs the CREATE and " @@ -4373,7 +8953,20 @@ msgstr "" "os comandos CREATE e DROP. Esta classe padrão deve implementar a interface " "org.hibernate.mapping.AuxiliaryDatabaseObject. " +#. Tag: programlisting +#: basic_mapping.xml:4406 +#, no-c-format +msgid "" +"<hibernate-mapping>\n" +" ...\n" +" <database-object>\n" +" <definition class=\"MyTriggerDefinition\"/>\n" +" </database-object>\n" +"</hibernate-mapping>" +msgstr "" + #. Tag: para +#: basic_mapping.xml:4408 #, no-c-format msgid "" "Additionally, these database objects can be optionally scoped so that they " @@ -4382,3 +8975,394 @@ msgstr "" "Além disso, estes objetos de banco de dados podem ter um escopo opcional que " "só será aplicado quando certos dialetos forem utilizados. " +#. Tag: programlisting +#: basic_mapping.xml:4411 +#, no-c-format +msgid "" +"<hibernate-mapping>\n" +" ...\n" +" <database-object>\n" +" <definition class=\"MyTriggerDefinition\"/>\n" +" <dialect-scope name=\"org.hibernate.dialect.Oracle9iDialect\"/" +">\n" +" <dialect-scope name=\"org.hibernate.dialect.Oracle10gDialect\"/" +">\n" +" </database-object>\n" +"</hibernate-mapping>" +msgstr "" + +#~ msgid "" +#~ "Use of select-before-update will usually decrease " +#~ "performance. It is useful to prevent a database update trigger being " +#~ "called unnecessarily if you reattach a graph of detached instances to a " +#~ "Session." +#~ msgstr "" +#~ "O uso de select-before-update geralmente irá diminuir " +#~ "o desempenho. Ela é muito útil para prevenir que um trigger de " +#~ "atualização no banco de dados seja ativado desnecessariamente, se você " +#~ "reconectar um nó de uma instância desconectada em uma Session." + +#~ msgid "Generator" +#~ msgstr "Gerador" + +#~ msgid "increment" +#~ msgstr "increment" + +#~ msgid "identity" +#~ msgstr "identity" + +#~ msgid "sequence" +#~ msgstr "sequence" + +#~ msgid "seqhilo" +#~ msgstr "seqhilo" + +#~ msgid "uuid" +#~ msgstr "uuid" + +#~ msgid "" +#~ "uses a 128-bit UUID algorithm to generate identifiers of type string that " +#~ "are unique within a network (the IP address is used). The UUID is encoded " +#~ "as a string of 32 hexadecimal digits in length." +#~ msgstr "" +#~ "utiliza um algorítimo UUID de 128-bits para gerar identificadores do tipo " +#~ "string, únicos em uma rede (o endereço IP é utilizado). O UUID é " +#~ "codificado como um string de dígitos hexadecimais de tamanho 32." + +#~ msgid "guid" +#~ msgstr "guid" + +#~ msgid "native" +#~ msgstr "native" + +#~ msgid "select" +#~ msgstr "select" + +#~ msgid "foreign" +#~ msgstr "foreign" + +#~ msgid "" +#~ "optimizer (optional - defaults to none): See " +#~ msgstr "" +#~ "optimizer (opcional – padrão para none): Veja " + +#~ msgid "composite-id" +#~ msgstr "Composição-id" + +#~ msgid "" +#~ "A table with a composite key can be mapped with multiple properties of " +#~ "the class as identifier properties. The <composite-id> element accepts <key-property> property " +#~ "mappings and <key-many-to-one> mappings as child " +#~ "elements." +#~ msgstr "" +#~ "Uma tabela com uma chave composta, pode ser mapeada com múltiplas " +#~ "propriedades da classe como propriedades de identificação. O elemento " +#~ "<composite-id> aceita o mapeamento da " +#~ "propriedade <key-property> e mapeamentos " +#~ "<key-many-to-one>como elementos filhos." + +#~ msgid "" +#~ "The persistent class must override equals()" +#~ " and hashCode() to implement composite " +#~ "identifier equality. It must also implement Serializable." +#~ msgstr "" +#~ "A classe persistente precisa substituir " +#~ "equals() e hashCode() para " +#~ "implementar identificadores compostos igualmente. E precisa também " +#~ "implementar Serializable." + +#~ msgid "" +#~ "Unfortunately, this approach means that a persistent object is its own " +#~ "identifier. There is no convenient \"handle\" other than the object " +#~ "itself. You must instantiate an instance of the persistent class itself " +#~ "and populate its identifier properties before you can load() the persistent state associated with a composite key. We call " +#~ "this approach an embedded composite identifier, and " +#~ "discourage it for serious applications." +#~ msgstr "" +#~ "Infelizmente, esta solução para um identificador composto significa que " +#~ "um objeto persistente é seu próprio identificador. Não há outro \"handle" +#~ "\" conveniente a não ser o próprio objeto. Você mesmo precisa instanciar " +#~ "uma instância de outra classe persistente e preencher suas propriedades " +#~ "de identificação antes que você possa dar um load() " +#~ "para o estado persistente associado com uma chave composta. Nós chamamos " +#~ "esta solução de identificador composto incorporado e " +#~ "não aconselhamos para aplicações sérias." + +#~ msgid "" +#~ "A second approach is what we call a mapped composite " +#~ "identifier, where the identifier properties named inside the <" +#~ "composite-id> element are duplicated on both the persistent " +#~ "class and a separate identifier class." +#~ msgstr "" +#~ "Uma segunda solução seria chamar de identificador composto " +#~ "mapped quando a propriedades de identificação " +#~ "nomeadas dentro do elemento <composite-id> estão " +#~ "duplicadas tanto na classe persistente como em uma classe de " +#~ "identificação separada." + +#~ msgid "" +#~ "In this example, both the composite identifier class, " +#~ "MedicareId, and the entity class itself have " +#~ "properties named medicareNumber and " +#~ "dependent. The identifier class must override " +#~ "equals() and hashCode() and " +#~ "implement Serializable. The main disadvantage of this " +#~ "approach is code duplication." +#~ msgstr "" +#~ "No exemplo, ambas as classes de identificadores compostas, " +#~ "MedicareId, e a própria classe entidade possuem " +#~ "propriedades nomeadas medicareNumber e " +#~ "dependent. A classe identificadora precisa sobrepor " +#~ "equals() e hashCode() e implementar " +#~ "Serializable. A desvantagem desta solução é óbvia: " +#~ "duplicação de código." + +#~ msgid "" +#~ "The following attributes are used to specify a mapped composite " +#~ "identifier:" +#~ msgstr "" +#~ "As seguintes funções são utilizadas para especificar o mapeamento de um " +#~ "identificador composto:" + +#~ msgid "" +#~ "mapped (optional - defaults to false): indicates that a mapped composite identifier is used, and that " +#~ "the contained property mappings refer to both the entity class and the " +#~ "composite identifier class." +#~ msgstr "" +#~ "mapped (opcional, false por " +#~ "padrão): Indica que um identificar composto mapeado é usado, e que as " +#~ "propriedades de mapeamento contidas refere-se tanto à classe entidade " +#~ "quanto à classe de identificação composta." + +#~ msgid "" +#~ "class (optional - but required for a mapped composite " +#~ "identifier): the class used as a composite identifier." +#~ msgstr "" +#~ "class (opcional, mas requerida para um identificador " +#~ "composto mapeado): A classe usada como um identificador composto. " + +#~ msgid "" +#~ "We will describe a third, even more convenient approach, where the " +#~ "composite identifier is implemented as a component class in . The attributes described below apply only " +#~ "to this alternative approach:" +#~ msgstr "" +#~ "Descreveremos uma abordagem terciária e até mais conveniente, onde o " +#~ "identificador da composição é implementado como uma classe componente na " +#~ ". Os atributos descritos abaixo " +#~ "aplicam-se apenas para esta abordagem: " + +#~ msgid "" +#~ "name (optional - required for this approach): a " +#~ "property of component type that holds the composite identifier. Please " +#~ "see chapter 9 for more information." +#~ msgstr "" +#~ "name (opcional, requerida para esta abordagem): Uma " +#~ "propriedade do tipo componente que armazena o identificador composto. " +#~ "Para maiores informações, por favor consulte o capítulo 9." + +#~ msgid "" +#~ "class (optional - defaults to the property type " +#~ "determined by reflection): the component class used as a composite " +#~ "identifier. Please see the next section for more information." +#~ msgstr "" +#~ "class (opcional - valor padrão para o tipo de " +#~ "propriedade determinando por reflexão): A classe componente utilizada " +#~ "como um identificador composto. Por favor consulte a próxima seção para " +#~ "maiores informações." + +#~ msgid "" +#~ "The third approach, an identifier component, is " +#~ "recommended for almost all applications." +#~ msgstr "" +#~ "Esta terceira abordagem, um componente identificador, é a que nós recomendamos para a maioria das aplicações. " + +#~ msgid "Version (optional)" +#~ msgstr "Versão (opcional) " + +#~ msgid "" +#~ "The <version> element is optional and indicates " +#~ "that the table contains versioned data. This is particularly useful if " +#~ "you plan to use long transactions. See below for " +#~ "more information:" +#~ msgstr "" +#~ "O elemento <version> é opcional e indica que a " +#~ "tabela possui dados versionados. Isto é particularmente útil se você " +#~ "planeja utilizar transações longas. Veja abaixo " +#~ "maiores informações: " + +#~ msgid "" +#~ "Version numbers can be of Hibernate type long, " +#~ "integer, short, timestamp or calendar." +#~ msgstr "" +#~ "Números de versão podem ser dos tipos Hibernate long, " +#~ "integer, short, timestamp ou calendar. " + +#~ msgid "Many-to-one" +#~ msgstr "Muitos-para-um " + +#~ msgid "" +#~ "An ordinary association to another persistent class is declared using a " +#~ "many-to-one element. The relational model is a many-to-" +#~ "one association; a foreign key in one table is referencing the primary " +#~ "key column(s) of the target table." +#~ msgstr "" +#~ "Uma associação ordinária para outra classe persistente é declarada usando " +#~ "o elemento many-to-one. O modelo relacional é uma " +#~ "associação muitos para um: uma chave exterior de uma tabela referenciando " +#~ "as colunas da chave primária da tabela destino." + +#~ msgid "One-to-one" +#~ msgstr "Um-para-um " + +#~ msgid "There are two varieties of one-to-one associations:" +#~ msgstr "Existem duas variedades de associações um-pra-um: " + +#~ msgid "primary key associations" +#~ msgstr "Associações de chave primária" + +#~ msgid "" +#~ "Alternatively, a foreign key with a unique constraint, from " +#~ "Employee to Person, can be " +#~ "expressed as:" +#~ msgstr "" +#~ "Alternativamente, uma chave exterior com uma restrição única, de " +#~ "Employee para Person, pode ser " +#~ "expressada como:" + +#~ msgid "" +#~ "This association can be made bidirectional by adding the following to the " +#~ "Person mapping:" +#~ msgstr "" +#~ "Esta associação pode ser feita de forma bi-direcional adicionando o " +#~ "seguinte no mapeamento de Person:" + +#~ msgid "Component and dynamic-component" +#~ msgstr "Componente e componente dinâmico" + +#~ msgid "Subclass" +#~ msgstr "Subclass" + +#~ msgid "" +#~ "A discriminator column is not required for this mapping strategy. Each " +#~ "subclass must, however, declare a table column holding the object " +#~ "identifier using the <key> element. The mapping " +#~ "at the start of the chapter would then be re-written as:" +#~ msgstr "" +#~ "A coluna discriminadora não é requerida para esta estratégia de " +#~ "mapeamento. Cada subclasse deve declarar uma coluna de tabela com o " +#~ "identificador do objeto usando o elemento <key>. " +#~ "O mapeamento no início do capítulo poderia ser re-escrito assim: " + +#~ msgid "Union-subclass" +#~ msgstr "Subclasse de União" + +#~ msgid "Join" +#~ msgstr "União " + +#~ msgid "" +#~ "Using the <join> element, it is possible to map " +#~ "properties of one class to several tables that have a one-to-one " +#~ "relationship. For example:" +#~ msgstr "" +#~ "Usando o elemento <join>>, é possível mapear " +#~ "propriedades de uma classe para várias tabelas que possuem uma relação um " +#~ "por um. Por exemplo:" + +#~ msgid "Key" +#~ msgstr "Key" + +#~ msgid "Any" +#~ msgstr "Any" + +#~ msgid "class" +#~ msgstr "class" + +#~ msgid "text" +#~ msgstr "text" + +#~ msgid "clob, blob" +#~ msgstr "clob, blob" + +#~ msgid "" +#~ "XML does not suit all users so there are some alternative ways to define " +#~ "O/R mapping metadata in Hibernate." +#~ msgstr "" +#~ "O XML não é para todos, e portanto existem algumas formas alternativas de " +#~ "defiinir o metadado de mapeamento no Hibernate. " + +#~ msgid "Using XDoclet markup" +#~ msgstr "Usando a marcação XDoclet." + +#~ msgid "" +#~ "Many Hibernate users prefer to embed mapping information directly in " +#~ "sourcecode using XDoclet @hibernate.tags. We do not " +#~ "cover this approach in this reference guide since it is considered part " +#~ "of XDoclet. However, we include the following example of the " +#~ "Cat class with XDoclet mappings:" +#~ msgstr "" +#~ "Muitos usuários do Hibernate preferem encubar a informação de mapeamento " +#~ "diretamente no código de fonte utilizando o XDoclet @hibernate." +#~ "tags. Nós não falaremos sobre esta abordagem neste documento, " +#~ "uma vez que é estritamente considerado parte de um XDoclet. No entanto, " +#~ "incluímos os seguintes exemplos da classe Cat com os " +#~ "mapeamentos de XDoclet:" + +#~ msgid "" +#~ "See the Hibernate website for more examples of XDoclet and Hibernate." +#~ msgstr "" +#~ "Veja o web site do Hibernate para maiores detalhes sobre um XDoclet e " +#~ "Hibernate. " + +#~ msgid "Using JDK 5.0 Annotations" +#~ msgstr "Usando as anotações JDK 5.0" + +#~ msgid "" +#~ "JDK 5.0 introduced XDoclet-style annotations at the language level that " +#~ "are type-safe and checked at compile time. This mechanism is more " +#~ "powerful than XDoclet annotations and better supported by tools and IDEs. " +#~ "IntelliJ IDEA, for example, supports auto-completion and syntax " +#~ "highlighting of JDK 5.0 annotations. The new revision of the EJB " +#~ "specification (JSR-220) uses JDK 5.0 annotations as the primary metadata " +#~ "mechanism for entity beans. Hibernate3 implements the " +#~ "EntityManager of JSR-220 (the persistence API). " +#~ "Support for mapping metadata is available via the Hibernate " +#~ "Annotations package as a separate download. Both EJB3 (JSR-" +#~ "220) and Hibernate3 metadata is supported." +#~ msgstr "" +#~ "O JDK 5.0 introduziu as anotações estilo XDoclet em nível de linguagem, " +#~ "tipo seguro e checado em tempo de compilação. Este mecanismo é mais " +#~ "potente do que as anotações XDoclet e melhor suportado pelas ferramentas " +#~ "e IDEs. O IntelliJ IDEA por exemplo, suporta a auto complexão e destaque " +#~ "da sintaxe das anotações JDK 5.0. A nova revisão da especificação EJB " +#~ "(JSR-220) usa as anotações JDK 5.0 como mecanismos de metadados para " +#~ "beans de entidade. O Hibernate3 implementa o EntityManager do JSR-220 (o API de persistência). O suporte para mapear " +#~ "metadados está disponível através do pacote Anotações do " +#~ "Hibernate, como um download separado. Ambos os EJB3 (JSR-220) " +#~ "e o metadado Hibernate3 são suportados. " + +#~ msgid "This is an example of a POJO class annotated as an EJB entity bean:" +#~ msgstr "" +#~ "Este é um exemplo de uma classe POJO anotado como um bean de entidade EJB:" + +#~ msgid "" +#~ "Support for JDK 5.0 Annotations (and JSR-220) is currently under " +#~ "development. Please refer to the Hibernate Annotations module for more " +#~ "details." +#~ msgstr "" +#~ "Note que o suporte para Anotações JDK 5.0 (e JSR-220) ainda está em " +#~ "construção. Consulte o módulo de Anotações do Hibernate para maiores " +#~ "detalhes. " diff --git a/documentation/manual/src/main/docbook/pt-BR/content/collection_mapping.po b/documentation/manual/src/main/docbook/pt-BR/content/collection_mapping.po index f7ef98c033..ec7cbc164e 100644 --- a/documentation/manual/src/main/docbook/pt-BR/content/collection_mapping.po +++ b/documentation/manual/src/main/docbook/pt-BR/content/collection_mapping.po @@ -108,7 +108,7 @@ msgid "" msgstr "" "Project-Id-Version: collection_mapping\n" "Report-Msgid-Bugs-To: http://bugs.kde.org\n" -"POT-Creation-Date: 2010-02-10T07:25:34\n" +"POT-Creation-Date: 2010-07-20 21:02+0000\n" "PO-Revision-Date: 2010-03-15 16:00+1000\n" "Last-Translator: \n" "Language-Team: \n" @@ -118,33 +118,52 @@ msgstr "" "X-Generator: KBabel 1.11.4\n" #. Tag: title +#: collection_mapping.xml:31 #, no-c-format msgid "Collection mapping" msgstr "Mapeamento de coleção " #. Tag: title +#: collection_mapping.xml:34 #, no-c-format msgid "Persistent collections" msgstr "Coleções persistentes" #. Tag: para -#, no-c-format +#: collection_mapping.xml:36 +#, fuzzy, no-c-format msgid "" -"Hibernate requires that persistent collection-valued fields be declared as " -"an interface type. For example:" +"Naturally Hibernate also allows to persist collections. These persistent " +"collections can contain almost any other Hibernate type, including: basic " +"types, custom types, components and references to other entities. The " +"distinction between value and reference semantics is in this context very " +"important. An object in a collection might be handled with \"value\" " +"semantics (its life cycle fully depends on the collection owner), or it " +"might be a reference to another entity with its own life cycle. In the " +"latter case, only the \"link\" between the two objects is considered to be a " +"state held by the collection." msgstr "" -"O Hibernate requer que os campos de coleções de valor persistente sejam " -"declarados como um tipo de interface. Por exemplo:" +"As coleções podem conter quase qualquer outro tipo de Hibernate, incluindo " +"todos os tipos básicos, tipos padronizados, e é claro, referências a outras " +"entidades. Isto é uma distinção importante: um objeto em uma coleção pode " +"ser manipulada com as semânticas \"valor\" (seu ciclo de vida depende " +"totalmente do proprietário da coleção), ou ele pode ser uma referência à " +"outra entidade, com seu próprio ciclo de vida. No último caso, somente o " +"\"link\" entre os dois objetos é considerado como estado seguro pela " +"coleção. " #. Tag: para -#, no-c-format +#: collection_mapping.xml:46 +#, fuzzy, no-c-format msgid "" -"The actual interface might be java.util.Set, " +"As a requirement persistent collection-valued fields must be declared as an " +"interface type (see ). The actual interface might be java.util.Set, " "java.util.Collection, java.util.List, " "java.util.Map, java.util.SortedSet, " "java.util.SortedMap or anything you like (\"anything you " "like\" means you will have to write an implementation of org." -"hibernate.usertype.UserCollectionType.)" +"hibernate.usertype.UserCollectionType)." msgstr "" "A interface atual pode ser java.util.Set, java." "util.Collection, java.util.List, java." @@ -154,15 +173,17 @@ msgstr "" "UserCollectionType.)" #. Tag: para -#, no-c-format +#: collection_mapping.xml:57 +#, fuzzy, no-c-format msgid "" -"Notice how the instance variable was initialized with an instance of " -"HashSet. This is the best way to initialize collection " +"Notice how in the " +"instance variable parts was initialized with an instance " +"of HashSet. This is the best way to initialize collection " "valued properties of newly instantiated (non-persistent) instances. When you " -"make the instance persistent, by calling persist() for " -"example, Hibernate will actually replace the HashSet with " -"an instance of Hibernate's own implementation of Set. Be " -"aware of the following errors:" +"make the instance persistent, by calling persist(), " +"Hibernate will actually replace the HashSet with an " +"instance of Hibernate's own implementation of Set. Be " +"aware of the following error:" msgstr "" "Observe como inicializamos a variável da instância com uma instância de " "HashSet. Esta é a melhor maneira de inicializar " @@ -172,7 +193,30 @@ msgstr "" "HashSet por uma instância da própria implementação do " "Hibernate do Set. Cuidado com erros como este:" +#. Tag: title +#: collection_mapping.xml:68 +#, no-c-format +msgid "Hibernate uses its own collection implementations" +msgstr "" + +#. Tag: programlisting +#: collection_mapping.xml:70 +#, no-c-format +msgid "" +"Cat cat = new DomesticCat();\n" +"Cat kitten = new DomesticCat();\n" +"....\n" +"Set kittens = new HashSet();\n" +"kittens.add(kitten);\n" +"cat.setKittens(kittens);\n" +"session.persist(cat);\n" +"\n" +"kittens = cat.getKittens(); // Okay, kittens collection is a Set\n" +"(HashSet) cat.getKittens(); // Error!" +msgstr "" + #. Tag: para +#: collection_mapping.xml:73 #, no-c-format msgid "" "The persistent collections injected by Hibernate behave like " @@ -186,6 +230,7 @@ msgstr "" "dependendo do tipo de interface." #. Tag: para +#: collection_mapping.xml:78 #, no-c-format msgid "" "Collections instances have the usual behavior of value types. They are " @@ -208,54 +253,297 @@ msgstr "" "coleção nula e uma coleção vazia. " #. Tag: para -#, no-c-format +#: collection_mapping.xml:89 +#, fuzzy, no-c-format msgid "" "Use persistent collections the same way you use ordinary Java collections. " -"However, please ensure you understand the semantics of bidirectional " -"associations (these are discussed later)." +"However, ensure you understand the semantics of bidirectional associations " +"(see )." msgstr "" "Use as coleções persistentes da mesma forma que usa coleções Java comuns. No " "entanto, somente tenha a certeza de entender as semânticas de associações " "bidirecionais (as quais serão discutidas mais tarde)." #. Tag: title -#, no-c-format -msgid "Collection mappings" -msgstr "Mapeamento de coleção" +#: collection_mapping.xml:97 +#, fuzzy, no-c-format +msgid "How to map collections" +msgstr "Coleções escolhidas" #. Tag: para +#: collection_mapping.xml:99 #, no-c-format msgid "" -"There are quite a range of mappings that can be generated for collections " -"that cover many common relational models. We suggest you experiment with the " -"schema generation tool so that you understand how various mapping " -"declarations translate to database tables." +"Using annotations you can map Collections, " +"Lists, Maps and " +"Sets of associated entities using @OneToMany and " +"@ManyToMany. For collections of a basic or embeddable type use " +"@ElementCollection. In the simplest case a collection mapping looks like " +"this:" msgstr "" -"Existem diversas variedades de mapeamento que podem ser gerados para as " -"coleções, cobrindo muitos modelos relacionais comuns. Sugerimos que você " -"faça o teste com a ferramenta de geração do esquema para obter uma idéia de " -"como diversas declarações de mapeamento traduzem as tabelas de banco de " -"dados. " -#. Tag: para +#. Tag: title +#: collection_mapping.xml:107 +#, no-c-format +msgid "Collection mapping using @OneToMany and @JoinColumn" +msgstr "" + +#. Tag: programlisting +#: collection_mapping.xml:109 #, no-c-format msgid "" -"The Hibernate mapping element used for mapping a collection depends upon the " -"type of interface. For example, a <set> element is " -"used for mapping properties of type Set." +"@Entity\n" +"public class Product {\n" +"\n" +" private String serialNumber;\n" +" private Set<Part> parts = new HashSet<Part>();\n" +"\n" +" @Id\n" +" public String getSerialNumber() { return serialNumber; }\n" +" void setSerialNumber(String sn) { serialNumber = sn; }\n" +" \n" +" @OneToMany\n" +" @JoinColumn(name=\"PART_ID\")\n" +" public Set<Part> getParts() { return parts; }\n" +" void setParts(Set parts) { this.parts = parts; }\n" +"}\n" +"\n" +"\n" +"@Entity\n" +"public class Part {\n" +" ...\n" +"}" +msgstr "" + +#. Tag: para +#: collection_mapping.xml:112 +#, no-c-format +msgid "" +"Product describes a unidirectional relationship with Part using the join " +"column PART_ID. In this unidirectional one to many scenario you can also use " +"a join table as seen in ." +msgstr "" + +#. Tag: title +#: collection_mapping.xml:118 +#, no-c-format +msgid "Collection mapping using @OneToMany and @JoinTable" +msgstr "" + +#. Tag: programlisting +#: collection_mapping.xml:121 +#, no-c-format +msgid "" +"@Entity\n" +"public class Product {\n" +"\n" +" private String serialNumber;\n" +" private Set<Part> parts = new HashSet<Part>();\n" +"\n" +" @Id\n" +" public String getSerialNumber() { return serialNumber; }\n" +" void setSerialNumber(String sn) { serialNumber = sn; }\n" +" \n" +" @OneToMany\n" +" @JoinTable(\n" +" name=\"PRODUCT_PARTS\",\n" +" joinColumns = @JoinColumn( name=\"PRODUCT_ID\"),\n" +" inverseJoinColumns = @JoinColumn( name=\"PART_ID\")\n" +" )\n" +" public Set<Part> getParts() { return parts; }\n" +" void setParts(Set parts) { this.parts = parts; }\n" +"}\n" +"\n" +"\n" +"@Entity\n" +"public class Part {\n" +" ...\n" +"}" +msgstr "" + +#. Tag: para +#: collection_mapping.xml:124 +#, no-c-format +msgid "" +"Without describing any physical mapping (no @JoinColumn or @JoinTable), a unidirectional one to " +"many with join table is used. The table name is the concatenation of the " +"owner table name, _, and the other side table name. The foreign key name(s) " +"referencing the owner table is the concatenation of the owner table, _, and " +"the owner primary key column(s) name. The foreign key name(s) referencing " +"the other side is the concatenation of the owner property name, _, and the " +"other side primary key column(s) name. A unique constraint is added to the " +"foreign key referencing the other side table to reflect the one to many." +msgstr "" + +#. Tag: para +#: collection_mapping.xml:135 +#, fuzzy, no-c-format +msgid "" +"Lets have a look now how collections are mapped using Hibernate mapping " +"files. In this case the first step is to chose the right mapping element. It " +"depends on the type of interface. For example, a <set> element is used for mapping properties of type Set." msgstr "" "O elemento do mapeamento do Hibernate, usado para mapear uma coleção, " "depende do tipo de interface. Por exemplo, um elemento <set> é usado para mapear propriedades do tipo Set. " -#. Tag: para +#. Tag: title +#: collection_mapping.xml:142 +#, no-c-format +msgid "Mapping a Set using <set>" +msgstr "" + +#. Tag: programlisting +#: collection_mapping.xml:144 #, no-c-format msgid "" -"Apart from <set>, there is also <" -"list>, <map>, <bag>, <array> and <primitive-" -"array> mapping elements. The <map> " -"element is representative:" +"<class name=\"Product\">\n" +" <id name=\"serialNumber\" column=\"productSerialNumber\"/>\n" +" <set name=\"parts\">\n" +" <key column=\"productSerialNumber\" not-null=\"true\"/>\n" +" <one-to-many class=\"Part\"/>\n" +" </set>\n" +"</class>" +msgstr "" + +#. Tag: para +#: collection_mapping.xml:147 +#, fuzzy, no-c-format +msgid "" +"In a one-to-many " +"association links the Product and " +"Part entities. This association requires the existence of " +"a foreign key column and possibly an index column to the Part table. This mapping loses certain semantics of normal Java " +"collections:" +msgstr "" +"Uma associação a partir do Produto até a Parte requer a existência de uma coluna de chave exterior e possivelmente " +"uma coluna de índice para a tabela Part Uma tag " +"<one-to-many> indica que esta é uma associação um " +"para muitos." + +#. Tag: para +#: collection_mapping.xml:156 +#, no-c-format +msgid "" +"An instance of the contained entity class cannot belong to more than one " +"instance of the collection." +msgstr "" +"Uma instância de classes entidades contidas, podem não pertencer à mais de " +"uma instância da coleção. " + +#. Tag: para +#: collection_mapping.xml:161 +#, no-c-format +msgid "" +"An instance of the contained entity class cannot appear at more than one " +"value of the collection index." +msgstr "" +"Uma instância da classe de entidade contida pode não aparecer em mais de um " +"valor do índice da coleção. " + +#. Tag: para +#: collection_mapping.xml:166 +#, no-c-format +msgid "" +"Looking closer at the used <one-to-many> tag we see " +"that it has the following options." +msgstr "" + +#. Tag: title +#: collection_mapping.xml:170 +#, no-c-format +msgid "options of <one-to-many> element" +msgstr "" + +#. Tag: programlisting +#: collection_mapping.xml:181 +#, no-c-format +msgid "" +"<one-to-many\n" +" class=\"ClassName\"\n" +" not-found=\"ignore|exception\"\n" +" entity-name=\"EntityName\"\n" +" node=\"element-name\"\n" +" embed-xml=\"true|false\"\n" +" />" +msgstr "" + +#. Tag: para +#: collection_mapping.xml:185 +#, no-c-format +msgid "class (required): the name of the associated class." +msgstr "class (requerido): O nome da classe associada. " + +#. Tag: para +#: collection_mapping.xml:190 +#, no-c-format +msgid "" +"not-found (optional - defaults to exception): specifies how cached identifiers that reference missing rows will " +"be handled. ignore will treat a missing row as a null " +"association." +msgstr "" +"not-found (opcional - padrão para exception): Especifica como os identificadores em cache que referenciam as " +"linhas faltantes serão tratadas: ignore tratará a linha " +"faltante como uma associação nula. " + +#. Tag: para +#: collection_mapping.xml:198 +#, no-c-format +msgid "" +"entity-name (optional): the entity name of the associated " +"class, as an alternative to class." +msgstr "" +"entity-name (opcional): O nome da entidade da classe " +"associada, como uma alternativa para a class. " + +#. Tag: para +#: collection_mapping.xml:206 +#, no-c-format +msgid "" +"The <one-to-many> element does not need to declare " +"any columns. Nor is it necessary to specify the table " +"name anywhere." +msgstr "" +"Note que o elemento <one-to-many> não precisa " +"declarar qualquer coluna. Nem é necessário especificar o nome da " +"table em qualquer lugar. " + +#. Tag: para +#: collection_mapping.xml:211 +#, fuzzy, no-c-format +msgid "" +"If the foreign key column of a <one-to-many> " +"association is declared NOT NULL, you must declare the " +"<key> mapping not-null=\"true\" " +"or use a bidirectional association with the collection " +"mapping marked inverse=\"true\". See ." +msgstr "" +"Se a coluna da chave exterior de uma associação <one-to-many>" +" for declarada como NOT NULL, você deve " +"declarar a <key> mapeando not-null=\"true" +"\" ou use uma associação bidirecional com o " +"mapeamento da coleção marcado como inverse=\"true\". Veja " +"a discussão das associações bidirecionais mais tarde neste mesmo capítulo." + +#. Tag: para +#: collection_mapping.xml:221 +#, fuzzy, no-c-format +msgid "" +"Apart from the <set> tag as shown in , there is also <list>, <map>, <bag>, " +"<array> and <primitive-array> mapping elements. The <map> element is " +"representative:" msgstr "" "Além do <set>, existe também os elementos de " "mapeamento <list>, <map>, " @@ -263,12 +551,49 @@ msgstr "" "<primitive-array>. O elemento <map> é de representação:" +#. Tag: title +#: collection_mapping.xml:229 +#, no-c-format +msgid "Elements of the <map> mapping" +msgstr "" + +#. Tag: programlisting +#: collection_mapping.xml:262 +#, no-c-format +msgid "" +"<map\n" +" name=\"propertyName\"\n" +" table=\"table_name\"\n" +" schema=\"schema_name\"\n" +" lazy=\"true|extra|false\"\n" +" inverse=\"true|false\"\n" +" cascade=\"all|none|save-update|delete|all-delete-orphan|delete-orphan\"\n" +" sort=\"unsorted|natural|comparatorClass\"\n" +" order-by=\"column_name asc|desc\"\n" +" where=\"arbitrary sql where condition\"\n" +" fetch=\"join|select|subselect\"\n" +" batch-size=\"N\"\n" +" access=\"field|property|ClassName\"\n" +" optimistic-lock=\"true|false\"\n" +" mutable=\"true|false\"\n" +" node=\"element-name|.\"\n" +" embed-xml=\"true|false\"\n" +">\n" +"\n" +" <key .... />\n" +" <map-key .... />\n" +" <element .... />\n" +"</map>" +msgstr "" + #. Tag: para +#: collection_mapping.xml:266 #, no-c-format msgid "name: the collection property name" msgstr "name: o nome da propriedade da coleção" #. Tag: para +#: collection_mapping.xml:270 #, no-c-format msgid "" "table (optional - defaults to property name): the name of " @@ -278,6 +603,7 @@ msgstr "" "nome da tabela de coleção. Isto não é usado para associações um-para-muitos." #. Tag: para +#: collection_mapping.xml:276 #, no-c-format msgid "" "schema (optional): the name of a table schema to override " @@ -287,6 +613,7 @@ msgstr "" "sobrescrever o esquema declarado no elemento raíz." #. Tag: para +#: collection_mapping.xml:281 #, no-c-format msgid "" "lazy (optional - defaults to true): " @@ -302,6 +629,7 @@ msgstr "" "para coleções bem grandes)." #. Tag: para +#: collection_mapping.xml:290 #, no-c-format msgid "" "inverse (optional - defaults to falsecascade (optional - defaults to none): " @@ -322,6 +651,7 @@ msgstr "" "habilita operações para cascata para entidades filho." #. Tag: para +#: collection_mapping.xml:302 #, no-c-format msgid "" "sort (optional): specifies a sorted collection with " @@ -331,12 +661,13 @@ msgstr "" "ordem de escolhanatural ou uma dada classe comparatória." #. Tag: para -#, no-c-format +#: collection_mapping.xml:308 +#, fuzzy, no-c-format msgid "" -"order-by (optional, JDK1.4 only): specifies a table " -"column or columns that define the iteration order of the Map, Set or bag, together with an optional " -"asc or desc." +"order-by (optional): specifies a table column or columns " +"that define the iteration order of the Map, Set or bag, together with an optional asc or " +"desc." msgstr "" "order-by (opcional, somente JDK1.4): especifica uma " "coluna da tabela (ou colunas) que define a ordem de iteração do " @@ -344,6 +675,7 @@ msgstr "" "asc ou desc opcional." #. Tag: para +#: collection_mapping.xml:316 #, no-c-format msgid "" "where (optional): specifies an arbitrary SQL " @@ -356,6 +688,7 @@ msgstr "" "Isto é útil se a coleção tiver somente um subconjunto dos dados disponíveis." #. Tag: para +#: collection_mapping.xml:324 #, no-c-format msgid "" "fetch (optional, defaults to select): " @@ -367,6 +700,7 @@ msgstr "" "por subseleção sequencial." #. Tag: para +#: collection_mapping.xml:331 #, no-c-format msgid "" "batch-size (optional, defaults to 1): " @@ -377,6 +711,7 @@ msgstr "" "coleção." #. Tag: para +#: collection_mapping.xml:337 #, no-c-format msgid "" "access (optional - defaults to propertyoptimistic-lock (optional - defaults to truemutable (optional - defaults to true): " @@ -413,19 +750,31 @@ msgstr "" "nunca mudam. Isto permite uma otimização mínima do desempenho em alguns " "casos." +#. Tag: para +#: collection_mapping.xml:360 +#, no-c-format +msgid "" +"After exploring the basic mapping of collections in the preceding paragraphs " +"we will now focus details like physical mapping considerations, indexed " +"collections and collections of value types." +msgstr "" + #. Tag: title +#: collection_mapping.xml:365 #, no-c-format msgid "Collection foreign keys" msgstr "Chaves Externas de Coleção" #. Tag: para -#, no-c-format +#: collection_mapping.xml:367 +#, fuzzy, no-c-format msgid "" -"Collection instances are distinguished in the database by the foreign key of " -"the entity that owns the collection. This foreign key is referred to as the " -"collection key column, or columns, of the collection " -"table. The collection key column is mapped by the <key> element." +"On the database level collection instances are distinguished by the foreign " +"key of the entity that owns the collection. This foreign key is referred to " +"as the collection key column, or columns, of the " +"collection table. The collection key column is mapped by the " +"@JoinColumn annotation respectively the <" +"key> XML element." msgstr "" "Instâncias de coleção são distinguidas no banco de dados pela chave exterior " "da entidade que possui a coleção. Esta chave exterior é referida como a " @@ -434,109 +783,279 @@ msgstr "" "key>." #. Tag: para -#, no-c-format +#: collection_mapping.xml:374 +#, fuzzy, no-c-format msgid "" "There can be a nullability constraint on the foreign key column. For most " "collections, this is implied. For unidirectional one-to-many associations, " -"the foreign key column is nullable by default, so you may need to specify " -"not-null=\"true\"." +"the foreign key column is nullable by default, so you may need to specify" msgstr "" "Pode existir uma restrição de nulabilidade na coluna da chave exterior. Para " "a maioria das coleções, isto está implícito. Para associações unidirecionais " "um-para-muitos, a coluna de chave estrangeira é anulável por padrão, " "portanto você pode precisar especificar not-null=\"true\"." -#. Tag: para +#. Tag: programlisting +#: collection_mapping.xml:379 #, no-c-format -msgid "The foreign key constraint can use ON DELETE CASCADE." -msgstr "A restrição da chave exterior pode usar ON DELETE CASCADE." +msgid "@JoinColumn(nullable=false)" +msgstr "" #. Tag: para +#: collection_mapping.xml:381 +#, no-c-format +msgid "or" +msgstr "" + +#. Tag: programlisting +#: collection_mapping.xml:383 +#, no-c-format +msgid "<key column=\"productSerialNumber\" not-null=\"true\"/>" +msgstr "" + +#. Tag: para +#: collection_mapping.xml:385 +#, fuzzy, no-c-format +msgid "" +"The foreign key constraint can use ON DELETE CASCADE. In " +"XML this can be expressed via:" +msgstr "" +"A restrição da chave exterior pode usar ON DELETE CASCADE." + +#. Tag: programlisting +#: collection_mapping.xml:388 +#, no-c-format +msgid "<key column=\"productSerialNumber\" on-delete=\"cascade\"/>" +msgstr "" + +#. Tag: para +#: collection_mapping.xml:390 #, no-c-format msgid "" -"See the previous chapter for a full definition of the <key> element." +"In annotations the Hibernate specific annotation @OnDelete has to be used." +msgstr "" + +#. Tag: programlisting +#: collection_mapping.xml:393 +#, no-c-format +msgid "@OnDelete(action=OnDeleteAction.CASCADE)" +msgstr "" + +#. Tag: para +#: collection_mapping.xml:395 +#, fuzzy, no-c-format +msgid "" +"See for more information about the " +"<key> element." msgstr "" "Veja nos capítulos anteriores para uma completa definição do " "elemento<key>." #. Tag: title -#, no-c-format -msgid "Collection elements" -msgstr "Elementos de coleção" - -#. Tag: para -#, no-c-format -msgid "" -"Collections can contain almost any other Hibernate type, including: basic " -"types, custom types, components and references to other entities. This is an " -"important distinction. An object in a collection might be handled with " -"\"value\" semantics (its life cycle fully depends on the collection owner), " -"or it might be a reference to another entity with its own life cycle. In the " -"latter case, only the \"link\" between the two objects is considered to be a " -"state held by the collection." -msgstr "" -"As coleções podem conter quase qualquer outro tipo de Hibernate, incluindo " -"todos os tipos básicos, tipos padronizados, e é claro, referências a outras " -"entidades. Isto é uma distinção importante: um objeto em uma coleção pode " -"ser manipulada com as semânticas \"valor\" (seu ciclo de vida depende " -"totalmente do proprietário da coleção), ou ele pode ser uma referência à " -"outra entidade, com seu próprio ciclo de vida. No último caso, somente o " -"\"link\" entre os dois objetos é considerado como estado seguro pela " -"coleção. " - -#. Tag: para -#, no-c-format -msgid "" -"The contained type is referred to as the collection element type. Collection elements are mapped by <element> or <composite-element>, or in the case of " -"entity references, with <one-to-many> or " -"<many-to-many>. The first two map elements with " -"value semantics, the next two are used to map entity associations." -msgstr "" -"O tipo contido é referido como tipo de elemento de coleção. Os elementos de coleção são mapeados pelo <element>" -" ou <composite-element>,ou no caso de " -"referências de entidade, com <one-to-many> " -"ou<many-to-many>. Os primeiros dois, mapeiam " -"elementos com semânticas de valor, os dois outros são usados para mapear " -"associações de entidade." - -#. Tag: title +#: collection_mapping.xml:400 #, no-c-format msgid "Indexed collections" msgstr "Coleções indexadas" #. Tag: para +#: collection_mapping.xml:402 #, no-c-format msgid "" -"All collection mappings, except those with set and bag semantics, need an " -"index column in the collection table. An index column " -"is a column that maps to an array index, or List index, " -"or Map key. The index of a Map may be " -"of any basic type, mapped with <map-key>. It can be " -"an entity reference mapped with <map-key-many-to-many>, or it can be a composite type mapped with <composite-" -"map-key>. The index of an array or list is always of type " -"integer and is mapped using the <list-" -"index> element. The mapped column contains sequential integers " -"that are numbered from zero by default." +"In the following paragraphs we have a closer at the indexed collections " +"List and Map how the their " +"index can be mapped in Hibernate." +msgstr "" + +#. Tag: title +#: collection_mapping.xml:407 +#, no-c-format +msgid "Lists" msgstr "" -"Todos os mapeamentos de coleção, exceto aqueles com semânticas de conjunto e " -"bag, precisam de uma coluna índice na tabela de " -"coleção, uma coluna que mapeia para um índice matriz ou índice " -"List ou chave de Map. O índice de um " -"Map pode ser de qualquer tipo, mapeado com <" -"map-key>, pode ser uma referência de entidade mapeada com " -"<map-key-many-to-many>, ou pode ser um tipo " -"composto, mapeado com <composite-map-key>. O índice " -"de uma matriz ou lista é sempre do tipo integer e é " -"mapeado usando o elemento <list-index>. As colunas " -"mapeadas contém inteiros sequenciais, dos quais são numerados a partir do " -"zero, por padrão. " #. Tag: para +#: collection_mapping.xml:409 +#, no-c-format +msgid "Lists can be mapped in two different ways:" +msgstr "" + +#. Tag: para +#: collection_mapping.xml:413 +#, no-c-format +msgid "as ordered lists, where the order is not materialized in the database" +msgstr "" + +#. Tag: para +#: collection_mapping.xml:418 +#, no-c-format +msgid "as indexed lists, where the order is materialized in the database" +msgstr "" + +#. Tag: para +#: collection_mapping.xml:423 +#, no-c-format +msgid "" +"To order lists in memory, add @javax.persistence.OrderBy " +"to your property. This annotation takes as parameter a list of comma " +"separated properties (of the target entity) and orders the collection " +"accordingly (eg firstname asc, age desc), if the string is " +"empty, the collection will be ordered by the primary key of the target " +"entity." +msgstr "" + +#. Tag: title +#: collection_mapping.xml:432 +#, no-c-format +msgid "Ordered lists using @OrderBy" +msgstr "" + +#. Tag: programlisting +#: collection_mapping.xml:434 +#, no-c-format +msgid "" +"@Entity\n" +"public class Customer {\n" +" @Id @GeneratedValue public Integer getId() { return id; }\n" +" public void setId(Integer id) { this.id = id; }\n" +" private Integer id;\n" +"\n" +" @OneToMany(mappedBy=\"customer\")\n" +" @OrderBy(\"number\")\n" +" public List<Order> getOrders() { return orders; }\n" +" public void setOrders(List<Order> orders) { this.orders = " +"orders; }\n" +" private List<Order> orders;\n" +"}\n" +"\n" +"@Entity\n" +"public class Order {\n" +" @Id @GeneratedValue public Integer getId() { return id; }\n" +" public void setId(Integer id) { this.id = id; }\n" +" private Integer id;\n" +"\n" +" public String getNumber() { return number; }\n" +" public void setNumber(String number) { this.number = number; }\n" +" private String number;\n" +"\n" +" @ManyToOne\n" +" public Customer getCustomer() { return customer; }\n" +" public void setCustomer(Customer customer) { this.customer = customer; }\n" +" private Customer number;\n" +"}\n" +"\n" +"-- Table schema\n" +"|-------------| |----------|\n" +"| Order | | Customer |\n" +"|-------------| |----------|\n" +"| id | | id |\n" +"| number | |----------| \n" +"| customer_id |\n" +"|-------------|" +msgstr "" + +#. Tag: para +#: collection_mapping.xml:437 +#, no-c-format +msgid "" +"To store the index value in a dedicated column, use the @javax." +"persistence.OrderColumn annotation on your property. This " +"annotations describes the column name and attributes of the column keeping " +"the index value. This column is hosted on the table containing the " +"association foreign key. If the column name is not specified, the default is " +"the name of the referencing property, followed by underscore, followed by " +"ORDER (in the following example, it would be " +"orders_ORDER)." +msgstr "" + +#. Tag: title +#: collection_mapping.xml:448 +#, no-c-format +msgid "Explicit index column using @OrderColumn" +msgstr "" + +#. Tag: programlisting +#: collection_mapping.xml:451 +#, no-c-format +msgid "" +"@Entity\n" +"public class Customer {\n" +" @Id @GeneratedValue public Integer getId() { return id; }\n" +" public void setId(Integer id) { this.id = id; }\n" +" private Integer id;\n" +"\n" +" @OneToMany(mappedBy=\"customer\")\n" +" @OrderColumn(name=\"orders_index\")\n" +" public List<Order> getOrders() { return orders; }\n" +" public void setOrders(List<Order> orders) { this.orders = " +"orders; }\n" +" private List<Order> orders;\n" +"}\n" +"\n" +"@Entity\n" +"public class Order {\n" +" @Id @GeneratedValue public Integer getId() { return id; }\n" +" public void setId(Integer id) { this.id = id; }\n" +" private Integer id;\n" +"\n" +" public String getNumber() { return number; }\n" +" public void setNumber(String number) { this.number = number; }\n" +" private String number;\n" +"\n" +" @ManyToOne\n" +" public Customer getCustomer() { return customer; }\n" +" public void setCustomer(Customer customer) { this.customer = customer; }\n" +" private Customer number;\n" +"}\n" +"\n" +"-- Table schema\n" +"|--------------| |----------|\n" +"| Order | | Customer |\n" +"|--------------| |----------|\n" +"| id | | id |\n" +"| number | |----------| \n" +"| customer_id |\n" +"| orders_order |\n" +"|--------------|" +msgstr "" + +#. Tag: para +#: collection_mapping.xml:455 +#, no-c-format +msgid "" +"We recommend you to convert the legacy @org.hibernate.annotations." +"IndexColumn usages to @OrderColumn unless " +"you are making use of the base property. The base " +"property lets you define the index value of the first element (aka as base " +"index). The usual value is 0 or 1. The " +"default is 0 like in Java." +msgstr "" + +#. Tag: para +#: collection_mapping.xml:464 +#, no-c-format +msgid "" +"Looking again at the Hibernate mapping file equivalent, the index of an " +"array or list is always of type integer and is mapped " +"using the <list-index> element. The mapped column " +"contains sequential integers that are numbered from zero by default." +msgstr "" + +#. Tag: title +#: collection_mapping.xml:471 +#, no-c-format +msgid "index-list element for indexed collections in xml mapping" +msgstr "" + +#. Tag: programlisting +#: collection_mapping.xml:481 +#, no-c-format +msgid "" +"<list-index\n" +" column=\"column_name\"\n" +" base=\"0|1|...\"/>" +msgstr "" + +#. Tag: para +#: collection_mapping.xml:485 #, no-c-format msgid "" "column_name (required): the name of the column holding " @@ -546,6 +1065,7 @@ msgstr "" "valores do índice da coleção." #. Tag: para +#: collection_mapping.xml:490 #, no-c-format msgid "" "base (optional - defaults to 0): the " @@ -557,54 +1077,7 @@ msgstr "" "matriz." #. Tag: para -#, no-c-format -msgid "" -"column (optional): the name of the column holding the " -"collection index values." -msgstr "" -"column(opcional): o nome da coluna que mnatém os valores " -"do índice de coleção." - -#. Tag: para -#, no-c-format -msgid "" -"formula (optional): a SQL formula used to evaluate the " -"key of the map." -msgstr "" -"formula (opcional): Uma fórmula SQL usada para avaliar a " -"chave ou o mapa." - -#. Tag: para -#, no-c-format -msgid "type (required): the type of the map keys." -msgstr "type (requerido): o tipo de chaves de mapa." - -#. Tag: para -#, no-c-format -msgid "" -"column (optional): the name of the foreign key column for " -"the collection index values." -msgstr "" -"column (opcional): o nome de uma coluna de chave exterior " -"para os valores do índice de coleção." - -#. Tag: para -#, no-c-format -msgid "" -"formula (optional): a SQ formula used to evaluate the " -"foreign key of the map key." -msgstr "" -"formula (opcional): uma fórmula SQ usada para avaliar a " -"chave exterior da chave do mapa." - -#. Tag: para -#, no-c-format -msgid "class (required): the entity class used as the map key." -msgstr "" -"class (requerido): a classe da entidade usada como chave " -"do mapa." - -#. Tag: para +#: collection_mapping.xml:498 #, no-c-format msgid "" "If your table does not have an index column, and you still wish to use " @@ -620,33 +1093,485 @@ msgstr "" "escolhida de forma opcional ou ordenada. " #. Tag: title +#: collection_mapping.xml:506 #, no-c-format -msgid "Collections of values and many-to-many associations" +msgid "Maps" +msgstr "" + +#. Tag: para +#: collection_mapping.xml:508 +#, no-c-format +msgid "" +"The question with Maps is where the key value is " +"stored. There are everal options. Maps can borrow their keys from one of the " +"associated entity properties or have dedicated columns to store an explicit " +"key." +msgstr "" + +#. Tag: para +#: collection_mapping.xml:513 +#, no-c-format +msgid "" +"To use one of the target entity property as a key of the map, use " +"@MapKey(name=\"myProperty\"), where myProperty is a property name in the target entity. When using " +"@MapKey without the name attribuate, the target entity " +"primary key is used. The map key uses the same column as the property " +"pointed out. There is no additional column defined to hold the map key, " +"because the map key represent a target property. Be aware that once loaded, " +"the key is no longer kept in sync with the property. In other words, if you " +"change the property value, the key will not change automatically in your " +"Java model." +msgstr "" + +#. Tag: title +#: collection_mapping.xml:525 +#, no-c-format +msgid "" +"Use of target entity property as map key via @MapKey" +msgstr "" + +#. Tag: programlisting +#: collection_mapping.xml:528 +#, no-c-format +msgid "" +"@Entity\n" +"public class Customer {\n" +" @Id @GeneratedValue public Integer getId() { return id; }\n" +" public void setId(Integer id) { this.id = id; }\n" +" private Integer id;\n" +"\n" +" @OneToMany(mappedBy=\"customer\")\n" +" @MapKey(name=\"number\")\n" +" public Map<String,Order> getOrders() { return orders; }\n" +" public void setOrders(Map<String,Order> order) { this.orders = " +"orders; }\n" +" private Map<String,Order> orders;\n" +"}\n" +"\n" +"@Entity\n" +"public class Order {\n" +" @Id @GeneratedValue public Integer getId() { return id; }\n" +" public void setId(Integer id) { this.id = id; }\n" +" private Integer id;\n" +"\n" +" public String getNumber() { return number; }\n" +" public void setNumber(String number) { this.number = number; }\n" +" private String number;\n" +"\n" +" @ManyToOne\n" +" public Customer getCustomer() { return customer; }\n" +" public void setCustomer(Customer customer) { this.customer = customer; }\n" +" private Customer number;\n" +"}\n" +"\n" +"-- Table schema\n" +"|-------------| |----------|\n" +"| Order | | Customer |\n" +"|-------------| |----------|\n" +"| id | | id |\n" +"| number | |----------| \n" +"| customer_id |\n" +"|-------------|" +msgstr "" + +#. Tag: para +#: collection_mapping.xml:531 +#, no-c-format +msgid "" +"Alternatively the map key is mapped to a dedicated column or columns. In " +"order to customize the mapping use one of the following annotations:" +msgstr "" + +#. Tag: para +#: collection_mapping.xml:537 +#, no-c-format +msgid "" +"@MapKeyColumn if the map key is a basic type. If you " +"don't specify the column name, the name of the property followed by " +"underscore followed by KEY is used (for example " +"orders_KEY)." +msgstr "" + +#. Tag: para +#: collection_mapping.xml:544 +#, no-c-format +msgid "" +"@MapKeyEnumerated / @MapKeyTemporal if the map key type is respectively an enum or a Date." +msgstr "" + +#. Tag: para +#: collection_mapping.xml:550 +#, no-c-format +msgid "" +"@MapKeyJoinColumn/@MapKeyJoinColumns if the map key type is another entity." +msgstr "" + +#. Tag: para +#: collection_mapping.xml:555 +#, no-c-format +msgid "" +"@AttributeOverride/@AttributeOverrides when the map key is a embeddable object. Use key. as a prefix for your embeddable object property names." +msgstr "" + +#. Tag: para +#: collection_mapping.xml:562 +#, no-c-format +msgid "" +"You can also use @MapKeyClass to define the type of " +"the key if you don't use generics." +msgstr "" + +#. Tag: title +#: collection_mapping.xml:566 +#, no-c-format +msgid "Map key as basic type using @MapKeyColumn" +msgstr "" + +#. Tag: programlisting +#: collection_mapping.xml:569 +#, no-c-format +msgid "" +"@Entity\n" +"public class Customer {\n" +" @Id @GeneratedValue public Integer getId() { return id; }\n" +" public void setId(Integer id) { this.id = id; }\n" +" private Integer id;\n" +"\n" +" @OneToMany @JoinTable(name=\"Cust_Order\")\n" +" @MapKeyColumn(name=\"orders_number\")\n" +" public Map<String,Order> getOrders() { return orders; }\n" +" public void setOrders(Map<String,Order> orders) { this.orders = " +"orders; }\n" +" private Map<String,Order> orders;\n" +"}\n" +"\n" +"@Entity\n" +"public class Order {\n" +" @Id @GeneratedValue public Integer getId() { return id; }\n" +" public void setId(Integer id) { this.id = id; }\n" +" private Integer id;\n" +"\n" +" public String getNumber() { return number; }\n" +" public void setNumber(String number) { this.number = number; }\n" +" private String number;\n" +"\n" +" @ManyToOne\n" +" public Customer getCustomer() { return customer; }\n" +" public void setCustomer(Customer customer) { this.customer = customer; }\n" +" private Customer number;\n" +"}\n" +"\n" +"-- Table schema\n" +"|-------------| |----------| |---------------|\n" +"| Order | | Customer | | Cust_Order |\n" +"|-------------| |----------| |---------------|\n" +"| id | | id | | customer_id |\n" +"| number | |----------| | order_id |\n" +"| customer_id | | orders_number |\n" +"|-------------| |---------------|" +msgstr "" + +#. Tag: para +#: collection_mapping.xml:573 +#, no-c-format +msgid "" +"We recommend you to migrate from @org.hibernate.annotations." +"MapKey / @org.hibernate.annotation.MapKeyManyToMany to the new standard approach described above" +msgstr "" + +#. Tag: para +#: collection_mapping.xml:579 +#, fuzzy, no-c-format +msgid "" +"Using Hibernate mapping files there exists equivalent concepts to the " +"descibed annotations. You have to use <map-key>, " +"<map-key-many-to-many> and <composite-" +"map-key>. <map-key> is used for any " +"basic type, <map-key-many-to-many> for an entity " +"reference and <composite-map-key> for a composite " +"type." +msgstr "" +"Além do <set>, existe também os elementos de " +"mapeamento <list>, <map>, " +"<bag>, <array> and " +"<primitive-array>. O elemento <map> é de representação:" + +#. Tag: title +#: collection_mapping.xml:590 +#, no-c-format +msgid "map-key xml mapping element" +msgstr "" + +#. Tag: programlisting +#: collection_mapping.xml:601 +#, no-c-format +msgid "" +"<map-key\n" +" column=\"column_name\"\n" +" formula=\"any SQL expression\"\n" +" type=\"type_name\"\n" +" node=\"@attribute-name\"\n" +" length=\"N\"/>" +msgstr "" + +#. Tag: para +#: collection_mapping.xml:605 +#, no-c-format +msgid "" +"column (optional): the name of the column holding the " +"collection index values." +msgstr "" +"column(opcional): o nome da coluna que mnatém os valores " +"do índice de coleção." + +#. Tag: para +#: collection_mapping.xml:610 +#, no-c-format +msgid "" +"formula (optional): a SQL formula used to evaluate the " +"key of the map." +msgstr "" +"formula (opcional): Uma fórmula SQL usada para avaliar a " +"chave ou o mapa." + +#. Tag: para +#: collection_mapping.xml:615 +#, no-c-format +msgid "type (required): the type of the map keys." +msgstr "type (requerido): o tipo de chaves de mapa." + +#. Tag: title +#: collection_mapping.xml:623 +#, fuzzy, no-c-format +msgid "map-key-many-to-many" +msgstr "Muitos-para-muitos" + +#. Tag: programlisting +#: collection_mapping.xml:634 +#, no-c-format +msgid "" +"<map-key-many-to-many\n" +" column=\"column_name\"\n" +" formula=\"any SQL expression\"\n" +" class=\"ClassName\"\n" +"/>" +msgstr "" + +#. Tag: para +#: collection_mapping.xml:638 +#, no-c-format +msgid "" +"column (optional): the name of the foreign key column for " +"the collection index values." +msgstr "" +"column (opcional): o nome de uma coluna de chave exterior " +"para os valores do índice de coleção." + +#. Tag: para +#: collection_mapping.xml:643 +#, no-c-format +msgid "" +"formula (optional): a SQ formula used to evaluate the " +"foreign key of the map key." +msgstr "" +"formula (opcional): uma fórmula SQ usada para avaliar a " +"chave exterior da chave do mapa." + +#. Tag: para +#: collection_mapping.xml:648 +#, no-c-format +msgid "" +"class (required): the entity class used as the map key." +msgstr "" +"class (requerido): a classe da entidade usada como chave " +"do mapa." + +#. Tag: title +#: collection_mapping.xml:658 +#, fuzzy, no-c-format +msgid "Collections of basic types and embeddable objects" msgstr "Coleções de valores e associações muitos-para-muitos" #. Tag: para +#: collection_mapping.xml:660 #, no-c-format msgid "" -"Any collection of values or many-to-many associations requires a dedicated " -"collection table with a foreign key column or columns, " -"collection element column or columns, and possibly an " -"index column or columns." +"In some situations you don't need to associate two entities but simply " +"create a collection of basic types or embeddable objects. Use the " +"@ElementCollection for this case." +msgstr "" + +#. Tag: title +#: collection_mapping.xml:665 +#, no-c-format +msgid "" +"Collection of basic types mapped via @ElementCollection" +msgstr "" + +#. Tag: programlisting +#: collection_mapping.xml:668 +#, no-c-format +msgid "" +"@Entity\n" +"public class User {\n" +" [...]\n" +" public String getLastname() { ...}\n" +"\n" +" @ElementCollection\n" +" @CollectionTable(name=\"Nicknames\", joinColumns=@JoinColumn(name=" +"\"user_id\"))\n" +" @Column(name=\"nickname\")\n" +" public Set<String> getNicknames() { ... } \n" +"}" msgstr "" -"Quaisquer valores de coleção ou associação muitos-para-muitos requerem uma " -"tabela de coleção dedicada, com uma coluna de chave " -"exterior ou colunas, collection element column ou " -"colunas e possivelmente uma coluna de índice ou colunas." #. Tag: para +#: collection_mapping.xml:671 #, no-c-format msgid "" -"For a collection of values use the <element> tag. " -"For example:" +"The collection table holding the collection data is set using the " +"@CollectionTable annotation. If omitted the " +"collection table name defaults to the concatenation of the name of the " +"containing entity and the name of the collection attribute, separated by an " +"underscore. In our example, it would be User_nicknames." +msgstr "" + +#. Tag: para +#: collection_mapping.xml:678 +#, no-c-format +msgid "" +"The column holding the basic type is set using the @Column annotation. If omitted, the column name defaults to the property " +"name: in our example, it would be nicknames." +msgstr "" + +#. Tag: para +#: collection_mapping.xml:683 +#, no-c-format +msgid "" +"But you are not limited to basic types, the collection type can be any " +"embeddable object. To override the columns of the embeddable object in the " +"collection table, use the @AttributeOverride " +"annotation." +msgstr "" + +#. Tag: title +#: collection_mapping.xml:689 +#, no-c-format +msgid "@ElementCollection for embeddable objects" +msgstr "" + +#. Tag: programlisting +#: collection_mapping.xml:691 +#, no-c-format +msgid "" +"@Entity\n" +"public class User {\n" +" [...]\n" +" public String getLastname() { ...}\n" +"\n" +" @ElementCollection\n" +" @CollectionTable(name=\"Addresses\", joinColumns=@JoinColumn(name=" +"\"user_id\"))\n" +" @AttributeOverrides({\n" +" @AttributeOverride(name=\"street1\", column=@Column(name=\"fld_street" +"\"))\n" +" })\n" +" public Set<Address> getAddresses() { ... } \n" +"}\n" +"\n" +"@Embeddable\n" +"public class Address {\n" +" public String getStreet1() {...}\n" +" [...]\n" +"}" +msgstr "" + +#. Tag: para +#: collection_mapping.xml:694 +#, no-c-format +msgid "Such an embeddable object cannot contains a collection itself." +msgstr "" + +#. Tag: para +#: collection_mapping.xml:698 +#, no-c-format +msgid "" +"in @AttributeOverride, you must use the " +"value. prefix to override properties of the embeddable " +"object used in the map value and the key. prefix to " +"override properties of the embeddable object used in the map key." +msgstr "" + +#. Tag: programlisting +#: collection_mapping.xml:704 +#, no-c-format +msgid "" +"@Entity\n" +"public class User {\n" +" @ElementCollection\n" +" @AttributeOverrides({\n" +" @AttributeOverride(name=\"key.street1\", column=@Column(name=" +"\"fld_street\")),\n" +" @AttributeOverride(name=\"value.stars\", column=@Column(name=\"fld_note" +"\"))\n" +" })\n" +" public Map<Address,Rating> getFavHomes() { ... }" +msgstr "" + +#. Tag: para +#: collection_mapping.xml:708 +#, no-c-format +msgid "" +"We recommend you to migrate from @org.hibernate.annotations." +"CollectionOfElements to the new @ElementCollection annotation." +msgstr "" + +#. Tag: para +#: collection_mapping.xml:714 +#, fuzzy, no-c-format +msgid "" +"Using the mapping file approach a collection of values is mapped using the " +"<element> tag. For example:" msgstr "" "Para uma coleção com valores, utilizamos a tag <element>. Por exemplo:" +#. Tag: title +#: collection_mapping.xml:718 +#, no-c-format +msgid "<element> tag for collection values using mapping files" +msgstr "" + +#. Tag: programlisting +#: collection_mapping.xml:730 +#, no-c-format +msgid "" +"<element\n" +" column=\"column_name\"\n" +" formula=\"any SQL expression\"\n" +" type=\"typename\"\n" +" length=\"L\"\n" +" precision=\"P\"\n" +" scale=\"S\"\n" +" not-null=\"true|false\"\n" +" unique=\"true|false\"\n" +" node=\"element-name\"\n" +"/>" +msgstr "" + #. Tag: para +#: collection_mapping.xml:734 #, no-c-format msgid "" "column (optional): the name of the column holding the " @@ -656,6 +1581,7 @@ msgstr "" "do elemento da coleção." #. Tag: para +#: collection_mapping.xml:739 #, no-c-format msgid "" "formula (optional): an SQL formula used to evaluate the " @@ -665,262 +1591,89 @@ msgstr "" "elemento." #. Tag: para +#: collection_mapping.xml:744 #, no-c-format msgid "type (required): the type of the collection element." msgstr "type (requerido): o tipo do elemento de coleção." -#. Tag: para -#, no-c-format -msgid "" -"A many-to-many association is specified using the " -"<many-to-many> element." -msgstr "" -"A associação muitos-para-muitos é especificada usando o " -"elemento <many-to-many>. " - -#. Tag: para -#, no-c-format -msgid "" -"column (optional): the name of the element foreign key " -"column." -msgstr "" -"column (opcional): o nome da coluna da chave exterior do " -"elemento." - -#. Tag: para -#, no-c-format -msgid "" -"formula (optional): an SQL formula used to evaluate the " -"element foreign key value." -msgstr "" -"formula (opcional): uma fórmula SQL usada para avaliar o " -"valor da chave exterior do elemento." - -#. Tag: para -#, no-c-format -msgid "class (required): the name of the associated class." -msgstr "class (requerido): O nome da classe associada. " - -#. Tag: para -#, no-c-format -msgid "" -"fetch (optional - defaults to join): " -"enables outer-join or sequential select fetching for this association. This " -"is a special case; for full eager fetching in a single SELECT of an entity and its many-to-many relationships to other entities, " -"you would enable join fetching,not only of the collection " -"itself, but also with this attribute on the <many-to-many> nested element." -msgstr "" -"fetch (opcional - padrão para join): " -"ativa a busca de seleção seqüencial ou união exterior para esta associação. " -"Isto é um caso especial; para uma busca completa num SELECT único de uma entidade e suas relações muitos-para-muitos com outras " -"entidades, você deverá ativar a busca join, não apenas a " -"própria coleção, mas também este atributo no elemento aninhado <" -"many-to-many>." - -#. Tag: para -#, no-c-format -msgid "" -"unique (optional): enables the DDL generation of a unique " -"constraint for the foreign-key column. This makes the association " -"multiplicity effectively one-to-many." -msgstr "" -"unique (opcional): ativa a geração DDl de uma restrição " -"única para a coluna de chave exterior. Isto realiza efetivamente a " -"multiplicidade da associação um-para-muitos." - -#. Tag: para -#, no-c-format -msgid "" -"not-found (optional - defaults to exception): specifies how foreign keys that reference missing rows will be " -"handled: ignore will treat a missing row as a null " -"association." -msgstr "" -"not-found (opcional - padrão para exception): especifica como os identificadores em cache que referenciam as " -"linhas faltantes serão tratadas: ignore tratará a linha " -"faltante como uma associação nula. " - -#. Tag: para -#, no-c-format -msgid "" -"entity-name (optional): the entity name of the associated " -"class, as an alternative to class." -msgstr "" -"entity-name (opcional): O nome da entidade da classe " -"associada, como uma alternativa para a class. " - -#. Tag: para -#, no-c-format -msgid "" -"property-ref (optional): the name of a property of the " -"associated class that is joined to this foreign key. If not specified, the " -"primary key of the associated class is used." -msgstr "" -"property-ref (opcional): o nome de uma propriedade de " -"classe associada que é unida a esta chave exterior. caso não especificada, a " -"chave primária da classe associada será usada." - -#. Tag: para -#, no-c-format -msgid "Here are some examples." -msgstr "Segue abaixo alguns exemplos." - -#. Tag: para -#, no-c-format -msgid "A set of strings:" -msgstr "Um conjunto de strings:" - -#. Tag: para -#, no-c-format -msgid "" -"A bag containing integers with an iteration order determined by the " -"order-by attribute:" -msgstr "" -"Uma bag contendo inteiros com uma ordem de iteração determinada pelo " -"atributo order-by):" - -#. Tag: para -#, no-c-format -msgid "An array of entities, in this case, a many-to-many association:" -msgstr "Uma matriz de entidades, neste caso, uma associação muitos-para-muitos: " - -#. Tag: para -#, no-c-format -msgid "A map from string indices to dates:" -msgstr "Um mapa desde índices de strigs até datas:" - -#. Tag: para -#, no-c-format -msgid "A list of components (this is discussed in the next chapter):" -msgstr "Uma lista de componentes (isto será discutido no próximo capítulo):" - -#. Tag: title -#, no-c-format -msgid "One-to-many associations" -msgstr "Associações um-para-muitos" - -#. Tag: para -#, no-c-format -msgid "" -"A one-to-many association links the tables of two " -"classes via a foreign key with no intervening collection table. This mapping " -"loses certain semantics of normal Java collections:" -msgstr "" -"Uma associação um para muitos liga as tabelas das duas " -"classes através de uma chave exterior, sem a intervenção da tabela de " -"coleção. Este mapeamento perde um pouco da semântica das coleções normais do " -"Java: " - -#. Tag: para -#, no-c-format -msgid "" -"An instance of the contained entity class cannot belong to more than one " -"instance of the collection." -msgstr "" -"Uma instância de classes entidades contidas, podem não pertencer à mais de " -"uma instância da coleção. " - -#. Tag: para -#, no-c-format -msgid "" -"An instance of the contained entity class cannot appear at more than one " -"value of the collection index." -msgstr "" -"Uma instância da classe de entidade contida pode não aparecer em mais de um " -"valor do índice da coleção. " - -#. Tag: para -#, no-c-format -msgid "" -"An association from Product to Part " -"requires the existence of a foreign key column and possibly an index column " -"to the Part table. A <one-to-many> tag indicates that this is a one-to-many association." -msgstr "" -"Uma associação a partir do Produto até a Parte requer a existência de uma coluna de chave exterior e possivelmente " -"uma coluna de índice para a tabela Part Uma tag " -"<one-to-many> indica que esta é uma associação um " -"para muitos." - -#. Tag: para -#, no-c-format -msgid "" -"not-found (optional - defaults to exception): specifies how cached identifiers that reference missing rows will " -"be handled. ignore will treat a missing row as a null " -"association." -msgstr "" -"not-found (opcional - padrão para exception): Especifica como os identificadores em cache que referenciam as " -"linhas faltantes serão tratadas: ignore tratará a linha " -"faltante como uma associação nula. " - -#. Tag: para -#, no-c-format -msgid "" -"The <one-to-many> element does not need to declare " -"any columns. Nor is it necessary to specify the table " -"name anywhere." -msgstr "" -"Note que o elemento <one-to-many> não precisa " -"declarar qualquer coluna. Nem é necessário especificar o nome da " -"table em qualquer lugar. " - -#. Tag: para -#, no-c-format -msgid "" -"If the foreign key column of a <one-to-many> " -"association is declared NOT NULL, you must declare the " -"<key> mapping not-null=\"true\" " -"or use a bidirectional association with the collection " -"mapping marked inverse=\"true\". See the discussion of " -"bidirectional associations later in this chapter for more information." -msgstr "" -"Se a coluna da chave exterior de uma associação <one-to-many>" -" for declarada como NOT NULL, você deve " -"declarar a <key> mapeando not-null=\"true" -"\" ou use uma associação bidirecional com o " -"mapeamento da coleção marcado como inverse=\"true\". Veja " -"a discussão das associações bidirecionais mais tarde neste mesmo capítulo." - -#. Tag: para -#, no-c-format -msgid "" -"The following example shows a map of Part entities by " -"name, where partName is a persistent property of " -"Part. Notice the use of a formula-based index:" -msgstr "" -"Este exemplo demonstra um mapa das entidades Part por " -"nome, onde partName é uma propriedade persistente de " -"Part. Note que o uso de um índice baseado em fórmula:" - #. Tag: title +#: collection_mapping.xml:754 #, no-c-format msgid "Advanced collection mappings" msgstr "Mapeamentos de coleção avançados." #. Tag: title +#: collection_mapping.xml:757 #, no-c-format msgid "Sorted collections" msgstr "Coleções escolhidas" #. Tag: para +#: collection_mapping.xml:759 #, no-c-format msgid "" "Hibernate supports collections implementing java.util.SortedMap and java.util.SortedSet. You must specify a " -"comparator in the mapping file:" +"literal> and java.util.SortedSet. With annotations you " +"declare a sort comparator using @Sort. You chose between " +"the comparator types unsorted, natural or custom. If you want to use your " +"own comparator implementation, you'll also have to specify the " +"implementation class using the comparator attribute. Note " +"that you need to use either a SortedSet or a " +"SortedMap interface." +msgstr "" + +#. Tag: title +#: collection_mapping.xml:770 +#, fuzzy, no-c-format +msgid "Sorted collection with @Sort" +msgstr "Coleções escolhidas" + +#. Tag: programlisting +#: collection_mapping.xml:772 +#, no-c-format +msgid "" +"@OneToMany(cascade=CascadeType.ALL, fetch=FetchType.EAGER)\n" +"@JoinColumn(name=\"CUST_ID\")\n" +"@Sort(type = SortType.COMPARATOR, comparator = TicketComparator.class)\n" +"public SortedSet<Ticket> getTickets() {\n" +" return tickets;\n" +"}" msgstr "" -"O Hibernate suporta a implementação de coleções java.util." -"SortedMap e java.util.SortedSet. Você deve " -"especificar um comparador no arquivo de mapeamento:" #. Tag: para +#: collection_mapping.xml:775 +#, no-c-format +msgid "" +"Using Hibernate mapping files you specify a comparator in the mapping file " +"with <sort>:" +msgstr "" + +#. Tag: title +#: collection_mapping.xml:779 +#, fuzzy, no-c-format +msgid "Sorted collection using xml mapping" +msgstr "Coleções escolhidas" + +#. Tag: programlisting +#: collection_mapping.xml:781 +#, no-c-format +msgid "" +"<set name=\"aliases\"\n" +" table=\"person_aliases\" \n" +" sort=\"natural\">\n" +" <key column=\"person\"/>\n" +" <element column=\"name\" type=\"string\"/>\n" +"</set>\n" +"\n" +"<map name=\"holidays\" sort=\"my.custom.HolidayComparator\">\n" +" <key column=\"year_id\"/>\n" +" <map-key column=\"hol_name\" type=\"string\"/>\n" +" <element column=\"hol_date\" type=\"date\"/>\n" +"</map>" +msgstr "" + +#. Tag: para +#: collection_mapping.xml:784 #, no-c-format msgid "" "Allowed values of the sort attribute are " @@ -932,6 +1685,7 @@ msgstr "" "java.util.Comparator." #. Tag: para +#: collection_mapping.xml:789 #, no-c-format msgid "" "Sorted collections actually behave like java.util.TreeSet " @@ -941,14 +1695,15 @@ msgstr "" "TreeSet ou java.util.TreeMap." #. Tag: para -#, no-c-format +#: collection_mapping.xml:794 +#, fuzzy, no-c-format msgid "" "If you want the database itself to order the collection elements, use the " "order-by attribute of set, " "bag or map mappings. This solution is " -"only available under JDK 1.4 or higher and is implemented using " -"LinkedHashSet or LinkedHashMap. This " -"performs the ordering in the SQL query and not in the memory." +"implemented using LinkedHashSet or " +"LinkedHashMap and performs the ordering in the SQL query " +"and not in the memory." msgstr "" "Se você quiser que o próprio banco de dados ordene os elementos da coleção " "use a função order-by do set, " @@ -958,11 +1713,36 @@ msgstr "" "literal>). Este desempenha a ordenação na consulta SQL, não em memória." #. Tag: title +#: collection_mapping.xml:802 +#, no-c-format +msgid "Sorting in database using order-by" +msgstr "" + +#. Tag: programlisting +#: collection_mapping.xml:804 +#, no-c-format +msgid "" +"<set name=\"aliases\" table=\"person_aliases\" order-by=\"lower(name) asc" +"\">\n" +" <key column=\"person\"/>\n" +" <element column=\"name\" type=\"string\"/>\n" +"</set>\n" +"\n" +"<map name=\"holidays\" order-by=\"hol_date, hol_name\">\n" +" <key column=\"year_id\"/>\n" +" <map-key column=\"hol_name\" type=\"string\"/>\n" +" <element column=\"hol_date type=\"date\"/>\n" +"</map>" +msgstr "" + +#. Tag: title +#: collection_mapping.xml:808 #, no-c-format msgid "Note" msgstr "Nota" #. Tag: para +#: collection_mapping.xml:810 #, no-c-format msgid "" "The value of the order-by attribute is an SQL ordering, " @@ -972,6 +1752,7 @@ msgstr "" "não uma ordenação." #. Tag: para +#: collection_mapping.xml:814 #, no-c-format msgid "" "Associations can even be sorted by arbitrary criteria at runtime using a " @@ -981,11 +1762,27 @@ msgstr "" "tempo de espera usando uma coleção filter():" #. Tag: title +#: collection_mapping.xml:818 +#, no-c-format +msgid "Sorting via a query filter" +msgstr "" + +#. Tag: programlisting +#: collection_mapping.xml:820 +#, no-c-format +msgid "" +"sortedUsers = s.createFilter( group.getUsers(), \"order by this.name\" ).list" +"();" +msgstr "" + +#. Tag: title +#: collection_mapping.xml:825 #, no-c-format msgid "Bidirectional associations" msgstr "Associações Bidirecionais" #. Tag: para +#: collection_mapping.xml:827 #, no-c-format msgid "" "A bidirectional association allows navigation from both " @@ -997,31 +1794,347 @@ msgstr "" "são suportados: " #. Tag: term +#: collection_mapping.xml:831 #, no-c-format msgid "one-to-many" msgstr "Um-para-muitos" #. Tag: para +#: collection_mapping.xml:834 #, no-c-format msgid "set or bag valued at one end and single-valued at the other" msgstr "conjunto ou bag de valor em um dos lados, valor único do outro " #. Tag: term +#: collection_mapping.xml:840 #, no-c-format msgid "many-to-many" msgstr "Muitos-para-muitos" #. Tag: para +#: collection_mapping.xml:843 #, no-c-format msgid "set or bag valued at both ends" msgstr "Conjunto ou bag com valor em ambos os lados" #. Tag: para +#: collection_mapping.xml:848 #, no-c-format msgid "" -"You can specify a bidirectional many-to-many association by mapping two many-" -"to-many associations to the same database table and declaring one end as " -"inverse. You cannot select an indexed collection." +"Often there exists a many to one association which is the owner side of a " +"bidirectional relationship. The corresponding one to many association is in " +"this case annotated by @OneToMany(mappedBy=...)" +msgstr "" + +#. Tag: title +#: collection_mapping.xml:854 +#, no-c-format +msgid "Bidirectional one to many with many to one side as association owner" +msgstr "" + +#. Tag: programlisting +#: collection_mapping.xml:857 +#, no-c-format +msgid "" +"@Entity\n" +"public class Troop {\n" +" @OneToMany(mappedBy=\"troop\")\n" +" public Set<Soldier> getSoldiers() {\n" +" ...\n" +"}\n" +"\n" +"@Entity\n" +"public class Soldier {\n" +" @ManyToOne\n" +" @JoinColumn(name=\"troop_fk\")\n" +" public Troop getTroop() {\n" +" ...\n" +"}" +msgstr "" + +#. Tag: para +#: collection_mapping.xml:860 +#, no-c-format +msgid "" +"Troop has a bidirectional one to many relationship " +"with Soldier through the troop " +"property. You don't have to (must not) define any physical mapping in the " +"mappedBy side." +msgstr "" + +#. Tag: para +#: collection_mapping.xml:865 +#, no-c-format +msgid "" +"To map a bidirectional one to many, with the one-to-many side as the owning " +"side, you have to remove the mappedBy element and set the " +"many to one @JoinColumn as insertable and updatable to " +"false. This solution is not optimized and will produce additional UPDATE " +"statements." +msgstr "" + +#. Tag: title +#: collection_mapping.xml:872 +#, fuzzy, no-c-format +msgid "Bidirectional associtaion with one to many side as owner" +msgstr "Associações bidirecionais com coleções indexadas" + +#. Tag: programlisting +#: collection_mapping.xml:875 +#, no-c-format +msgid "" +"@Entity\n" +"public class Troop {\n" +" @OneToMany\n" +" @JoinColumn(name=\"troop_fk\") //we need to duplicate the physical " +"information\n" +" public Set<Soldier> getSoldiers() {\n" +" ...\n" +"}\n" +"\n" +"@Entity\n" +"public class Soldier {\n" +" @ManyToOne\n" +" @JoinColumn(name=\"troop_fk\", insertable=false, updatable=false)\n" +" public Troop getTroop() {\n" +" ...\n" +"}" +msgstr "" + +#. Tag: para +#: collection_mapping.xml:878 +#, fuzzy, no-c-format +msgid "" +"How does the mappping of a bidirectional mapping look like in Hibernate " +"mapping xml? There you define a bidirectional one-to-many association by " +"mapping a one-to-many association to the same table column(s) as a many-to-" +"one association and declaring the many-valued end inverse=\"true\"." +msgstr "" +"Você pode definir uma associação bidirecional um para muitos através de uma " +"associação um-para-muitos indicando as mesmas colunas da tabela que à " +"associação muitos-para-um e declarando a propriedade inverse=\"true" +"\"." + +#. Tag: title +#: collection_mapping.xml:885 +#, no-c-format +msgid "Bidirectional one to many via Hibernate mapping files" +msgstr "" + +#. Tag: programlisting +#: collection_mapping.xml:887 +#, no-c-format +msgid "" +"<class name=\"Parent\">\n" +" <id name=\"id\" column=\"parent_id\"/>\n" +" ....\n" +" <set name=\"children\" inverse=\"true\">\n" +" <key column=\"parent_id\"/>\n" +" <one-to-many class=\"Child\"/>\n" +" </set>\n" +"</class>\n" +"\n" +"<class name=\"Child\">\n" +" <id name=\"id\" column=\"child_id\"/>\n" +" ....\n" +" <many-to-one name=\"parent\" \n" +" class=\"Parent\" \n" +" column=\"parent_id\"\n" +" not-null=\"true\"/>\n" +"</class>" +msgstr "" + +#. Tag: para +#: collection_mapping.xml:890 +#, no-c-format +msgid "" +"Mapping one end of an association with inverse=\"true\" " +"does not affect the operation of cascades as these are orthogonal concepts." +msgstr "" +"Mapear apenas uma das pontas da associação com inverse=\"true\" não afeta as operações em cascata, uma vez que isto é um conceito " +"ortogonal." + +#. Tag: para +#: collection_mapping.xml:894 +#, no-c-format +msgid "" +"A many-to-many association is defined logically using the " +"@ManyToMany annotation. You also have to describe the " +"association table and the join conditions using the @JoinTable annotation. If the association is bidirectional, one side has to be " +"the owner and one side has to be the inverse end (ie. it will be ignored " +"when updating the relationship values in the association table):" +msgstr "" + +#. Tag: title +#: collection_mapping.xml:903 +#, no-c-format +msgid "Many to many association via @ManyToMany" +msgstr "" + +#. Tag: programlisting +#: collection_mapping.xml:905 +#, no-c-format +msgid "" +"@Entity\n" +"public class Employer implements Serializable {\n" +" @ManyToMany(\n" +" targetEntity=org.hibernate.test.metadata.manytomany.Employee.class,\n" +" cascade={CascadeType.PERSIST, CascadeType.MERGE}\n" +" )\n" +" @JoinTable(\n" +" name=\"EMPLOYER_EMPLOYEE\",\n" +" joinColumns=@JoinColumn(name=\"EMPER_ID\"),\n" +" inverseJoinColumns=@JoinColumn(name=\"EMPEE_ID\")\n" +" )\n" +" public Collection getEmployees() {\n" +" return employees;\n" +" }\n" +" ...\n" +"}" +msgstr "" + +#. Tag: programlisting +#: collection_mapping.xml:907 +#, no-c-format +msgid "" +"@Entity\n" +"public class Employee implements Serializable {\n" +" @ManyToMany(\n" +" cascade = {CascadeType.PERSIST, CascadeType.MERGE},\n" +" mappedBy = \"employees\",\n" +" targetEntity = Employer.class\n" +" )\n" +" public Collection getEmployers() {\n" +" return employers;\n" +" }\n" +"}" +msgstr "" + +#. Tag: para +#: collection_mapping.xml:910 +#, no-c-format +msgid "" +"In this example @JoinTable defines a name, an array of join columns, and an array of inverse join columns. " +"The latter ones are the columns of the association table which refer to the " +"Employee primary key (the \"other side\"). As seen " +"previously, the other side don't have to (must not) describe the physical " +"mapping: a simple mappedBy argument containing the owner " +"side property name bind the two." +msgstr "" + +#. Tag: para +#: collection_mapping.xml:919 +#, no-c-format +msgid "" +"As any other annotations, most values are guessed in a many to many " +"relationship. Without describing any physical mapping in a unidirectional " +"many to many the following rules applied. The table name is the " +"concatenation of the owner table name, _ and the other side " +"table name. The foreign key name(s) referencing the owner table is the " +"concatenation of the owner table name, _ and the owner " +"primary key column(s). The foreign key name(s) referencing the other side is " +"the concatenation of the owner property name, _, and the " +"other side primary key column(s). These are the same rules used for a " +"unidirectional one to many relationship." +msgstr "" + +#. Tag: title +#: collection_mapping.xml:932 +#, no-c-format +msgid "Default values for @ManyToMany (uni-directional)" +msgstr "" + +#. Tag: programlisting +#: collection_mapping.xml:935 +#, no-c-format +msgid "" +"@Entity\n" +"public class Store {\n" +" @ManyToMany(cascade = CascadeType.PERSIST)\n" +" public Set<City> getImplantedIn() {\n" +" ...\n" +" }\n" +"}\n" +"\n" +"@Entity\n" +"public class City {\n" +" ... //no bidirectional relationship\n" +"}" +msgstr "" + +#. Tag: para +#: collection_mapping.xml:938 +#, no-c-format +msgid "" +"A Store_City is used as the join table. The " +"Store_id column is a foreign key to the Store table. The implantedIn_id column is a foreign " +"key to the City table." +msgstr "" + +#. Tag: para +#: collection_mapping.xml:943 +#, no-c-format +msgid "" +"Without describing any physical mapping in a bidirectional many to many the " +"following rules applied. The table name is the concatenation of the owner " +"table name, _ and the other side table name. The foreign " +"key name(s) referencing the owner table is the concatenation of the other " +"side property name, _, and the owner primary key column(s). " +"The foreign key name(s) referencing the other side is the concatenation of " +"the owner property name, _, and the other side primary key " +"column(s). These are the same rules used for a unidirectional one to many " +"relationship." +msgstr "" + +#. Tag: title +#: collection_mapping.xml:955 +#, no-c-format +msgid "Default values for @ManyToMany (bi-directional)" +msgstr "" + +#. Tag: programlisting +#: collection_mapping.xml:958 +#, no-c-format +msgid "" +"@Entity\n" +"public class Store {\n" +" @ManyToMany(cascade = {CascadeType.PERSIST, CascadeType.MERGE})\n" +" public Set<Customer> getCustomers() {\n" +" ...\n" +" }\n" +"}\n" +"\n" +"@Entity\n" +"public class Customer {\n" +" @ManyToMany(mappedBy=\"customers\")\n" +" public Set<Store> getStores() {\n" +" ...\n" +" }\n" +"}" +msgstr "" + +#. Tag: para +#: collection_mapping.xml:961 +#, no-c-format +msgid "" +"A Store_Customer is used as the join table. The " +"stores_id column is a foreign key to the Store table. The customers_id column is a foreign key " +"to the Customer table." +msgstr "" + +#. Tag: para +#: collection_mapping.xml:966 +#, fuzzy, no-c-format +msgid "" +"Using Hibernate mapping files you can map a bidirectional many-to-many " +"association by mapping two many-to-many associations to the same database " +"table and declaring one end as inverse." msgstr "" "Você deve especificar uma associação muitos-para-muitos bidirecional, " "simplesmente mapeando as duas associações muitos-para-muitos para alguma " @@ -1029,17 +2142,56 @@ msgstr "" "emphasis> Voce não poderá selecionar uma coleção indexada." #. Tag: para +#: collection_mapping.xml:970 #, no-c-format +msgid "You cannot select an indexed collection." +msgstr "" + +#. Tag: para +#: collection_mapping.xml:973 +#, fuzzy, no-c-format msgid "" -"Here is an example of a bidirectional many-to-many association that " -"illustrates how each category can have many items and each item can be in " -"many categories:" +"shows a bidirectional many-to-many association that illustrates how each " +"category can have many items and each item can be in many categories:" msgstr "" "Segue aqui um exemplo de uma associação muitos-para-muitos bidirecional. " "Cada categoria pode ter muitos ítens e cada ítem pode estar em várias " "categorias: " +#. Tag: title +#: collection_mapping.xml:979 +#, no-c-format +msgid "Many to many association using Hibernate mapping files" +msgstr "" + +#. Tag: programlisting +#: collection_mapping.xml:981 +#, no-c-format +msgid "" +"<class name=\"Category\">\n" +" <id name=\"id\" column=\"CATEGORY_ID\"/>\n" +" ...\n" +" <bag name=\"items\" table=\"CATEGORY_ITEM\">\n" +" <key column=\"CATEGORY_ID\"/>\n" +" <many-to-many class=\"Item\" column=\"ITEM_ID\"/>\n" +" </bag>\n" +"</class>\n" +"\n" +"<class name=\"Item\">\n" +" <id name=\"id\" column=\"ITEM_ID\"/>\n" +" ...\n" +"\n" +" <!-- inverse end -->\n" +" <bag name=\"categories\" table=\"CATEGORY_ITEM\" inverse=\"true" +"\">\n" +" <key column=\"ITEM_ID\"/>\n" +" <many-to-many class=\"Category\" column=\"CATEGORY_ID\"/>\n" +" </bag>\n" +"</class>" +msgstr "" + #. Tag: para +#: collection_mapping.xml:984 #, no-c-format msgid "" "Changes made only to the inverse end of the association are notinverse=\"true\"." msgstr "" -"Você pode definir uma associação bidirecional um para muitos através de uma " -"associação um-para-muitos indicando as mesmas colunas da tabela que à " -"associação muitos-para-um e declarando a propriedade inverse=\"true" -"\"." - -#. Tag: para -#, no-c-format -msgid "" -"Mapping one end of an association with inverse=\"true\" " -"does not affect the operation of cascades as these are orthogonal concepts." -msgstr "" -"Mapear apenas uma das pontas da associação com inverse=\"true\" não afeta as operações em cascata, uma vez que isto é um conceito " -"ortogonal." +"A outra ponta é usada para salvar a representação em memória à base de dados." #. Tag: title +#: collection_mapping.xml:1003 #, no-c-format msgid "Bidirectional associations with indexed collections" msgstr "Associações bidirecionais com coleções indexadas" #. Tag: para -#, no-c-format +#: collection_mapping.xml:1005 +#, fuzzy, no-c-format msgid "" -"A bidirectional association where one end is represented as a <" -"list> or <map>, requires special " -"consideration. If there is a property of the child class that maps to the " -"index column you can use inverse=\"true\" on the " -"collection mapping:" +"There are some additional considerations for bidirectional mappings with " +"indexed collections (where one end is represented as a <list>" +" or <map>) when using Hibernate mapping " +"files. If there is a property of the child class that maps to the index " +"column you can use inverse=\"true\" on the collection " +"mapping:" msgstr "" "Uma associação bidirecional onde um dos lados é representado por uma " "<list> ou <map> requer uma " @@ -1104,7 +2259,41 @@ msgstr "" "mapeamento da coluna do índice sem problemas, pode-se continuar usando " "inverse=\"true\" no mapeamento da coleção:" +#. Tag: title +#: collection_mapping.xml:1013 +#, fuzzy, no-c-format +msgid "Bidirectional association with indexed collection" +msgstr "Associações bidirecionais com coleções indexadas" + +#. Tag: programlisting +#: collection_mapping.xml:1015 +#, no-c-format +msgid "" +"<class name=\"Parent\">\n" +" <id name=\"id\" column=\"parent_id\"/>\n" +" ....\n" +" <map name=\"children\" inverse=\"true\">\n" +" <key column=\"parent_id\"/>\n" +" <map-key column=\"name\" \n" +" type=\"string\"/>\n" +" <one-to-many class=\"Child\"/>\n" +" </map>\n" +"</class>\n" +"\n" +"<class name=\"Child\">\n" +" <id name=\"id\" column=\"child_id\"/>\n" +" ....\n" +" <property name=\"name\" \n" +" not-null=\"true\"/>\n" +" <many-to-one name=\"parent\" \n" +" class=\"Parent\" \n" +" column=\"parent_id\"\n" +" not-null=\"true\"/>\n" +"</class>" +msgstr "" + #. Tag: para +#: collection_mapping.xml:1018 #, no-c-format msgid "" "If there is no such property on the child class, the association cannot be " @@ -1119,7 +2308,42 @@ msgstr "" "caso, nós não podemos mapear a coleção usando inverse=\"true\". Devemos usar o seguinte mapeamento: " +#. Tag: title +#: collection_mapping.xml:1026 +#, fuzzy, no-c-format +msgid "Bidirectional association with indexed collection, but no index column" +msgstr "Associações bidirecionais com coleções indexadas" + +#. Tag: programlisting +#: collection_mapping.xml:1029 +#, no-c-format +msgid "" +"<class name=\"Parent\">\n" +" <id name=\"id\" column=\"parent_id\"/>\n" +" ....\n" +" <map name=\"children\">\n" +" <key column=\"parent_id\"\n" +" not-null=\"true\"/>\n" +" <map-key column=\"name\" \n" +" type=\"string\"/>\n" +" <one-to-many class=\"Child\"/>\n" +" </map>\n" +"</class>\n" +"\n" +"<class name=\"Child\">\n" +" <id name=\"id\" column=\"child_id\"/>\n" +" ....\n" +" <many-to-one name=\"parent\" \n" +" class=\"Parent\" \n" +" column=\"parent_id\"\n" +" insert=\"false\"\n" +" update=\"false\"\n" +" not-null=\"true\"/>\n" +"</class>" +msgstr "" + #. Tag: para +#: collection_mapping.xml:1032 #, no-c-format msgid "" "Note that in this mapping, the collection-valued end of the association is " @@ -1129,11 +2353,13 @@ msgstr "" "responsável pela atualização da chave exterior. " #. Tag: title +#: collection_mapping.xml:1037 #, no-c-format msgid "Ternary associations" msgstr "Associações Ternárias" #. Tag: para +#: collection_mapping.xml:1039 #, no-c-format msgid "" "There are three possible approaches to mapping a ternary association. One " @@ -1142,40 +2368,64 @@ msgstr "" "Há três meios possíveis de se mapear uma associação ternária. Uma é usar um " "Map com uma associação como seu índice: " -#. Tag: para +#. Tag: title +#: collection_mapping.xml:1044 +#, fuzzy, no-c-format +msgid "Ternary association mapping" +msgstr "Associações Ternárias" + +#. Tag: programlisting +#: collection_mapping.xml:1046 #, no-c-format msgid "" +"@Entity\n" +"public class Company {\n" +" @Id \n" +" int id;\n" +" ...\n" +" @OneToMany // unidirectional\n" +" @MapKeyJoinColumn(name=\"employee_id\")\n" +" Map<Employee, Contract> contracts;\n" +"}\n" +"\n" +"// or\n" +"\n" +"<map name=\"contracts\">\n" +" <key column=\"employer_id\" not-null=\"true\"/>\n" +" <map-key-many-to-many column=\"employee_id\" class=\"Employee\"/>\n" +" <one-to-many class=\"Contract\"/>\n" +"</map>" +msgstr "" + +#. Tag: para +#: collection_mapping.xml:1049 +#, fuzzy, no-c-format +msgid "" "A second approach is to remodel the association as an entity class. This is " -"the most common approach." +"the most common approach. A final alternative is to use composite elements, " +"which will be discussed later." msgstr "" "A segunda maneira é simplesmente remodelar a associação das classes da " "entidade. Esta é a abordagem que utilizamos com mais freqüência. " -#. Tag: para -#, no-c-format -msgid "" -"A final alternative is to use composite elements, which will be discussed " -"later." -msgstr "" -"Uma alternativa final é usar os elementos compostos, que nós discutiremos " -"mais tarde. " - -#. Tag: title -#, no-c-format -msgid "Using an <idbag>" +#. Tag: literal +#: collection_mapping.xml:1055 +#, fuzzy, no-c-format +msgid "Using an <idbag>" msgstr "Using an <idbag>" #. Tag: para -#, no-c-format +#: collection_mapping.xml:1057 +#, fuzzy, no-c-format msgid "" "The majority of the many-to-many associations and collections of values " "shown previously all map to tables with composite keys, even though it has " -"been have suggested that entities should have synthetic identifiers " -"(surrogate keys). A pure association table does not seem to benefit much " -"from a surrogate key, although a collection of composite values " -"might. It is for this reason that Hibernate provides a " -"feature that allows you to map many-to-many associations and collections of " -"values to a table with a surrogate key." +"been suggested that entities should have synthetic identifiers (surrogate " +"keys). A pure association table does not seem to benefit much from a " +"surrogate key, although a collection of composite values might. For this reason Hibernate provides a feature that allows you to " +"map many-to-many associations and collections of values to a table with a " +"surrogate key." msgstr "" "A maioria das associações e coleções muitos para muitos de valores " "apresentados anteriormente mapeiam às tabelas com as chaves de composição, " @@ -1187,6 +2437,7 @@ msgstr "" "valores para uma tabela com uma chave substituta. " #. Tag: para +#: collection_mapping.xml:1066 #, no-c-format msgid "" "The <idbag> element lets you map a List (ou uma Collection) com uma semântica de bag. " "Por exemplo:" +#. Tag: programlisting +#: collection_mapping.xml:1070 +#, no-c-format +msgid "" +"<idbag name=\"lovers\" table=\"LOVERS\">\n" +" <collection-id column=\"ID\" type=\"long\">\n" +" <generator class=\"sequence\"/>\n" +" </collection-id>\n" +" <key column=\"PERSON1\"/>\n" +" <many-to-many column=\"PERSON2\" class=\"Person\" fetch=\"join\"/" +">\n" +"</idbag>" +msgstr "" + #. Tag: para +#: collection_mapping.xml:1072 #, no-c-format msgid "" "An <idbag> has a synthetic id generator, just like " @@ -1210,6 +2476,7 @@ msgstr "" "para descobrir qual a chave substituta de uma linha em particular." #. Tag: para +#: collection_mapping.xml:1077 #, no-c-format msgid "" "The update performance of an <idbag> supersedes a " @@ -1223,6 +2490,7 @@ msgstr "" "individualmente, como um list, map ou set." #. Tag: para +#: collection_mapping.xml:1082 #, no-c-format msgid "" "In the current implementation, the native identifier " @@ -1234,21 +2502,58 @@ msgstr "" "usando o <idbag>." #. Tag: title +#: collection_mapping.xml:1103 #, no-c-format msgid "Collection examples" msgstr "Exemplos de coleções" #. Tag: para +#: collection_mapping.xml:1105 #, no-c-format msgid "This section covers collection examples." msgstr "Esta sessão cobre os exemplos de coleções." #. Tag: para +#: collection_mapping.xml:1107 #, no-c-format -msgid "The following class has a collection of Child instances:" -msgstr "A seguinte classe possui uma coleção de instâncias Child:" +msgid "" +"The following class has a collection of Child instances:" +msgstr "" +"A seguinte classe possui uma coleção de instâncias Child:" + +#. Tag: title +#: collection_mapping.xml:1111 +#, no-c-format +msgid "" +"Example classes Parent and Child" +msgstr "" + +#. Tag: programlisting +#: collection_mapping.xml:1114 +#, no-c-format +msgid "" +"public class Parent {\n" +" private long id;\n" +" private Set<Child> children;\n" +"\n" +" // getter/setter\n" +" ...\n" +"}\n" +"\n" +"\n" +"public class Child {\n" +" private long id;\n" +" private String name\n" +"\n" +" \n" +" // getter/setter\n" +" ...\n" +"}" +msgstr "" #. Tag: para +#: collection_mapping.xml:1117 #, no-c-format msgid "" "If each child has, at most, one parent, the most natural mapping is a one-to-" @@ -1257,12 +2562,103 @@ msgstr "" "Se cada Filho tiver no máximo um Pai, o mapeamento natural é uma associação " "um para muitos:" +#. Tag: title +#: collection_mapping.xml:1121 +#, no-c-format +msgid "" +"One to many unidirectional Parent-Child relationship " +"using annotations" +msgstr "" + +#. Tag: programlisting +#: collection_mapping.xml:1124 +#, no-c-format +msgid "" +"public class Parent {\n" +" @Id\n" +" @GeneratedValue\n" +" private long id;\n" +"\n" +" @OneToMany\n" +" private Set<Child> children;\n" +"\n" +" // getter/setter\n" +" ...\n" +"}\n" +"\n" +"\n" +"public class Child {\n" +" @Id\n" +" @GeneratedValue\n" +" private long id;\n" +" private String name;\n" +"\n" +" \n" +" // getter/setter\n" +" ...\n" +"}" +msgstr "" + +#. Tag: title +#: collection_mapping.xml:1128 +#, no-c-format +msgid "" +"One to many unidirectional Parent-Child relationship " +"using mapping files" +msgstr "" + +#. Tag: programlisting +#: collection_mapping.xml:1131 +#, no-c-format +msgid "" +"<hibernate-mapping>\n" +"\n" +" <class name=\"Parent\">\n" +" <id name=\"id\">\n" +" <generator class=\"sequence\"/>\n" +" </id>\n" +" <set name=\"children\">\n" +" <key column=\"parent_id\"/>\n" +" <one-to-many class=\"Child\"/>\n" +" </set>\n" +" </class>\n" +"\n" +" <class name=\"Child\">\n" +" <id name=\"id\">\n" +" <generator class=\"sequence\"/>\n" +" </id>\n" +" <property name=\"name\"/>\n" +" </class>\n" +"\n" +"</hibernate-mapping>" +msgstr "" + #. Tag: para +#: collection_mapping.xml:1134 #, no-c-format msgid "This maps to the following table definitions:" msgstr "Esse mapeamento gera a seguinte definição de tabelas" +#. Tag: title +#: collection_mapping.xml:1137 +#, no-c-format +msgid "" +"Table definitions for unidirectional Parent-" +"Child relationship" +msgstr "" + +#. Tag: programlisting +#: collection_mapping.xml:1141 +#, no-c-format +msgid "" +"create table parent ( id bigint not null primary key )\n" +"create table child ( id bigint not null primary key, name varchar(255), " +"parent_id bigint )\n" +"alter table child add constraint childfk0 (parent_id) references parent" +msgstr "" + #. Tag: para +#: collection_mapping.xml:1144 #, no-c-format msgid "" "If the parent is required, use a bidirectional one-to-" @@ -1271,49 +2667,518 @@ msgstr "" "Se o pai for obrigatório, use uma associação " "bidirecional um para muitos:" +#. Tag: title +#: collection_mapping.xml:1148 +#, no-c-format +msgid "" +"One to many bidirectional Parent-Child relationship " +"using annotations" +msgstr "" + +#. Tag: programlisting +#: collection_mapping.xml:1151 +#, no-c-format +msgid "" +"public class Parent {\n" +" @Id\n" +" @GeneratedValue\n" +" private long id;\n" +"\n" +" @OneToMany(mappedBy=\"parent\")\n" +" private Set<Child> children;\n" +"\n" +" // getter/setter\n" +" ...\n" +"}\n" +"\n" +"\n" +"public class Child {\n" +" @Id\n" +" @GeneratedValue\n" +" private long id;\n" +"\n" +" private String name;\n" +" \n" +" @ManyToOne\n" +" private Parent parent;\n" +"\n" +" \n" +" // getter/setter\n" +" ...\n" +"}" +msgstr "" + +#. Tag: title +#: collection_mapping.xml:1155 +#, no-c-format +msgid "" +"One to many bidirectional Parent-Child relationship " +"using mapping files" +msgstr "" + +#. Tag: programlisting +#: collection_mapping.xml:1158 +#, no-c-format +msgid "" +"<hibernate-mapping>\n" +"\n" +" <class name=\"Parent\">\n" +" <id name=\"id\">\n" +" <generator class=\"sequence\"/>\n" +" </id>\n" +" <set name=\"children\" inverse=\"true\">\n" +" <key column=\"parent_id\"/>\n" +" <one-to-many class=\"Child\"/>\n" +" </set>\n" +" </class>\n" +"\n" +" <class name=\"Child\">\n" +" <id name=\"id\">\n" +" <generator class=\"sequence\"/>\n" +" </id>\n" +" <property name=\"name\"/>\n" +" <many-to-one name=\"parent\" class=\"Parent\" column=\"parent_id" +"\" not-null=\"true\"/>\n" +" </class>\n" +"\n" +"</hibernate-mapping>" +msgstr "" + #. Tag: para +#: collection_mapping.xml:1161 #, no-c-format msgid "Notice the NOT NULL constraint:" msgstr "Repare na restrição NOT NULL:" -#. Tag: para +#. Tag: title +#: collection_mapping.xml:1164 #, no-c-format msgid "" -"Alternatively, if this association must be unidirectional you can declare " -"the NOT NULL constraint on the <key> mapping:" +"Table definitions for bidirectional Parent-" +"Child relationship" +msgstr "" + +#. Tag: programlisting +#: collection_mapping.xml:1168 +#, no-c-format +msgid "" +"create table parent ( id bigint not null primary key )\n" +"create table child ( id bigint not null\n" +" primary key,\n" +" name varchar(255),\n" +" parent_id bigint not null )\n" +"alter table child add constraint childfk0 (parent_id) references parent" +msgstr "" + +#. Tag: para +#: collection_mapping.xml:1171 +#, fuzzy, no-c-format +msgid "" +"Alternatively, if this association must be unidirectional you can enforce " +"the NOT NULL constraint." msgstr "" "Uma outra alternativa, no caso de você insistir que esta associação deva ser " "unidirecional, você pode declarar a restrição como NOT NULL no mapeamento <key>:" -#. Tag: para +#. Tag: title +#: collection_mapping.xml:1175 #, no-c-format msgid "" +"Enforcing NOT NULL constraint in unidirectional relation using annotations" +msgstr "" + +#. Tag: programlisting +#: collection_mapping.xml:1178 +#, no-c-format +msgid "" +"public class Parent {\n" +" @Id\n" +" @GeneratedValue\n" +" private long id;\n" +"\n" +" @OneToMany(optional=false)\n" +" private Set<Child> children;\n" +"\n" +" // getter/setter\n" +" ...\n" +"}\n" +"\n" +"\n" +"public class Child {\n" +" @Id\n" +" @GeneratedValue\n" +" private long id;\n" +" private String name;\n" +"\n" +" \n" +" // getter/setter\n" +" ...\n" +"}" +msgstr "" + +#. Tag: title +#: collection_mapping.xml:1182 +#, no-c-format +msgid "" +"Enforcing NOT NULL constraint in unidirectional relation using mapping files" +msgstr "" + +#. Tag: programlisting +#: collection_mapping.xml:1185 +#, no-c-format +msgid "" +"<hibernate-mapping>\n" +"\n" +" <class name=\"Parent\">\n" +" <id name=\"id\">\n" +" <generator class=\"sequence\"/>\n" +" </id>\n" +" <set name=\"children\">\n" +" <key column=\"parent_id\" not-null=\"true\"/>\n" +" <one-to-many class=\"Child\"/>\n" +" </set>\n" +" </class>\n" +"\n" +" <class name=\"Child\">\n" +" <id name=\"id\">\n" +" <generator class=\"sequence\"/>\n" +" </id>\n" +" <property name=\"name\"/>\n" +" </class>\n" +"\n" +"</hibernate-mapping>" +msgstr "" + +#. Tag: para +#: collection_mapping.xml:1188 +#, fuzzy, no-c-format +msgid "" "On the other hand, if a child has multiple parents, a many-to-many " -"association is appropriate:" +"association is appropriate." msgstr "" "Por outro lado, se um filho puder ter os múltiplos pais, a associação " "apropriada será muitos-para-muitos: " +#. Tag: title +#: collection_mapping.xml:1192 +#, no-c-format +msgid "" +"Many to many Parent-Child relationship using " +"annotations" +msgstr "" + +#. Tag: programlisting +#: collection_mapping.xml:1195 +#, no-c-format +msgid "" +"public class Parent {\n" +" @Id\n" +" @GeneratedValue\n" +" private long id;\n" +"\n" +" @ManyToMany\n" +" private Set<Child> children;\n" +"\n" +" // getter/setter\n" +" ...\n" +"}\n" +"\n" +"\n" +"public class Child {\n" +" @Id\n" +" @GeneratedValue\n" +" private long id;\n" +"\n" +" private String name;\n" +"\n" +" \n" +" // getter/setter\n" +" ...\n" +"}" +msgstr "" + +#. Tag: title +#: collection_mapping.xml:1199 +#, no-c-format +msgid "" +"Many to many Parent-Child relationship using mapping " +"files" +msgstr "" + +#. Tag: programlisting +#: collection_mapping.xml:1202 +#, no-c-format +msgid "" +"<hibernate-mapping>\n" +"\n" +" <class name=\"Parent\">\n" +" <id name=\"id\">\n" +" <generator class=\"sequence\"/>\n" +" </id>\n" +" <set name=\"children\" table=\"childset\">\n" +" <key column=\"parent_id\"/>\n" +" <many-to-many class=\"Child\" column=\"child_id\"/>\n" +" </set>\n" +" </class>\n" +"\n" +" <class name=\"Child\">\n" +" <id name=\"id\">\n" +" <generator class=\"sequence\"/>\n" +" </id>\n" +" <property name=\"name\"/>\n" +" </class>\n" +"\n" +"</hibernate-mapping>" +msgstr "" + #. Tag: para +#: collection_mapping.xml:1205 #, no-c-format msgid "Table definitions:" msgstr "Definições das tabelas:" -#. Tag: para +#. Tag: title +#: collection_mapping.xml:1208 +#, no-c-format +msgid "Table definitions for many to many releationship" +msgstr "" + +#. Tag: programlisting +#: collection_mapping.xml:1210 #, no-c-format msgid "" +"create table parent ( id bigint not null primary key )\n" +"create table child ( id bigint not null primary key, name varchar(255) )\n" +"create table childset ( parent_id bigint not null,\n" +" child_id bigint not null,\n" +" primary key ( parent_id, child_id ) )\n" +"alter table childset add constraint childsetfk0 (parent_id) references " +"parent\n" +"alter table childset add constraint childsetfk1 (child_id) references child" +msgstr "" + +#. Tag: para +#: collection_mapping.xml:1213 +#, fuzzy, no-c-format +msgid "" "For more examples and a complete explanation of a parent/child relationship " -"mapping, see for more information." +"mapping, see for more information. " +"Even more complex association mappings are covered in the next chapter." msgstr "" "Para mais exemplos e um exemplo completo de mapeamento de relacionamento de " "mestre/detalhe, consulte ." -#. Tag: para -#, no-c-format -msgid "Even more complex association mappings are covered in the next chapter." -msgstr "" -"Até mesmo o mapeamento de associações mais complexos serão discutimos no " -"próximo capítulo." +#~ msgid "" +#~ "Hibernate requires that persistent collection-valued fields be declared " +#~ "as an interface type. For example:" +#~ msgstr "" +#~ "O Hibernate requer que os campos de coleções de valor persistente sejam " +#~ "declarados como um tipo de interface. Por exemplo:" +#~ msgid "Collection mappings" +#~ msgstr "Mapeamento de coleção" + +#~ msgid "" +#~ "There are quite a range of mappings that can be generated for collections " +#~ "that cover many common relational models. We suggest you experiment with " +#~ "the schema generation tool so that you understand how various mapping " +#~ "declarations translate to database tables." +#~ msgstr "" +#~ "Existem diversas variedades de mapeamento que podem ser gerados para as " +#~ "coleções, cobrindo muitos modelos relacionais comuns. Sugerimos que você " +#~ "faça o teste com a ferramenta de geração do esquema para obter uma idéia " +#~ "de como diversas declarações de mapeamento traduzem as tabelas de banco " +#~ "de dados. " + +#~ msgid "Collection elements" +#~ msgstr "Elementos de coleção" + +#~ msgid "" +#~ "The contained type is referred to as the collection element " +#~ "type. Collection elements are mapped by <" +#~ "element> or <composite-element>, or " +#~ "in the case of entity references, with <one-to-many> or <many-to-many>. The first two map " +#~ "elements with value semantics, the next two are used to map entity " +#~ "associations." +#~ msgstr "" +#~ "O tipo contido é referido como tipo de elemento de coleção. Os elementos de coleção são mapeados pelo <" +#~ "element> ou <composite-element>,ou " +#~ "no caso de referências de entidade, com <one-to-many> ou<many-to-many>. Os primeiros dois, " +#~ "mapeiam elementos com semânticas de valor, os dois outros são usados para " +#~ "mapear associações de entidade." + +#~ msgid "" +#~ "All collection mappings, except those with set and bag semantics, need an " +#~ "index column in the collection table. An index " +#~ "column is a column that maps to an array index, or List index, or Map key. The index of a " +#~ "Map may be of any basic type, mapped with <" +#~ "map-key>. It can be an entity reference mapped with " +#~ "<map-key-many-to-many>, or it can be a composite " +#~ "type mapped with <composite-map-key>. The index " +#~ "of an array or list is always of type integer and is " +#~ "mapped using the <list-index> element. The " +#~ "mapped column contains sequential integers that are numbered from zero by " +#~ "default." +#~ msgstr "" +#~ "Todos os mapeamentos de coleção, exceto aqueles com semânticas de " +#~ "conjunto e bag, precisam de uma coluna índice na " +#~ "tabela de coleção, uma coluna que mapeia para um índice matriz ou índice " +#~ "List ou chave de Map. O índice de " +#~ "um Map pode ser de qualquer tipo, mapeado com " +#~ "<map-key>, pode ser uma referência de entidade " +#~ "mapeada com <map-key-many-to-many>, ou pode ser " +#~ "um tipo composto, mapeado com <composite-map-key>. O índice de uma matriz ou lista é sempre do tipo " +#~ "integer e é mapeado usando o elemento <" +#~ "list-index>. As colunas mapeadas contém inteiros " +#~ "sequenciais, dos quais são numerados a partir do zero, por padrão. " + +#~ msgid "" +#~ "Any collection of values or many-to-many associations requires a " +#~ "dedicated collection table with a foreign key column " +#~ "or columns, collection element column or columns, " +#~ "and possibly an index column or columns." +#~ msgstr "" +#~ "Quaisquer valores de coleção ou associação muitos-para-muitos requerem " +#~ "uma tabela de coleção dedicada, com uma coluna de " +#~ "chave exterior ou colunas, collection element column " +#~ "ou colunas e possivelmente uma coluna de índice ou colunas." + +#~ msgid "" +#~ "A many-to-many association is specified using the " +#~ "<many-to-many> element." +#~ msgstr "" +#~ "A associação muitos-para-muitos é especificada " +#~ "usando o elemento <many-to-many>. " + +#~ msgid "" +#~ "column (optional): the name of the element foreign key " +#~ "column." +#~ msgstr "" +#~ "column (opcional): o nome da coluna da chave exterior " +#~ "do elemento." + +#~ msgid "" +#~ "formula (optional): an SQL formula used to evaluate " +#~ "the element foreign key value." +#~ msgstr "" +#~ "formula (opcional): uma fórmula SQL usada para avaliar " +#~ "o valor da chave exterior do elemento." + +#~ msgid "" +#~ "fetch (optional - defaults to join): enables outer-join or sequential select fetching for this " +#~ "association. This is a special case; for full eager fetching in a single " +#~ "SELECT of an entity and its many-to-many relationships " +#~ "to other entities, you would enable join fetching,not " +#~ "only of the collection itself, but also with this attribute on the " +#~ "<many-to-many> nested element." +#~ msgstr "" +#~ "fetch (opcional - padrão para join): ativa a busca de seleção seqüencial ou união exterior para " +#~ "esta associação. Isto é um caso especial; para uma busca completa num " +#~ "SELECT único de uma entidade e suas relações muitos-" +#~ "para-muitos com outras entidades, você deverá ativar a busca " +#~ "join, não apenas a própria coleção, mas também este " +#~ "atributo no elemento aninhado <many-to-many>." + +#~ msgid "" +#~ "unique (optional): enables the DDL generation of a " +#~ "unique constraint for the foreign-key column. This makes the association " +#~ "multiplicity effectively one-to-many." +#~ msgstr "" +#~ "unique (opcional): ativa a geração DDl de uma " +#~ "restrição única para a coluna de chave exterior. Isto realiza " +#~ "efetivamente a multiplicidade da associação um-para-muitos." + +#~ msgid "" +#~ "not-found (optional - defaults to exception): specifies how foreign keys that reference missing rows will be " +#~ "handled: ignore will treat a missing row as a null " +#~ "association." +#~ msgstr "" +#~ "not-found (opcional - padrão para exception): especifica como os identificadores em cache que referenciam as " +#~ "linhas faltantes serão tratadas: ignore tratará a " +#~ "linha faltante como uma associação nula. " + +#~ msgid "" +#~ "property-ref (optional): the name of a property of the " +#~ "associated class that is joined to this foreign key. If not specified, " +#~ "the primary key of the associated class is used." +#~ msgstr "" +#~ "property-ref (opcional): o nome de uma propriedade de " +#~ "classe associada que é unida a esta chave exterior. caso não " +#~ "especificada, a chave primária da classe associada será usada." + +#~ msgid "Here are some examples." +#~ msgstr "Segue abaixo alguns exemplos." + +#~ msgid "A set of strings:" +#~ msgstr "Um conjunto de strings:" + +#~ msgid "" +#~ "A bag containing integers with an iteration order determined by the " +#~ "order-by attribute:" +#~ msgstr "" +#~ "Uma bag contendo inteiros com uma ordem de iteração determinada pelo " +#~ "atributo order-by):" + +#~ msgid "An array of entities, in this case, a many-to-many association:" +#~ msgstr "" +#~ "Uma matriz de entidades, neste caso, uma associação muitos-para-muitos: " + +#~ msgid "A map from string indices to dates:" +#~ msgstr "Um mapa desde índices de strigs até datas:" + +#~ msgid "A list of components (this is discussed in the next chapter):" +#~ msgstr "Uma lista de componentes (isto será discutido no próximo capítulo):" + +#~ msgid "One-to-many associations" +#~ msgstr "Associações um-para-muitos" + +#~ msgid "" +#~ "A one-to-many association links the tables of two " +#~ "classes via a foreign key with no intervening collection table. This " +#~ "mapping loses certain semantics of normal Java collections:" +#~ msgstr "" +#~ "Uma associação um para muitos liga as tabelas das " +#~ "duas classes através de uma chave exterior, sem a intervenção da tabela " +#~ "de coleção. Este mapeamento perde um pouco da semântica das coleções " +#~ "normais do Java: " + +#~ msgid "" +#~ "The following example shows a map of Part entities by " +#~ "name, where partName is a persistent property of " +#~ "Part. Notice the use of a formula-based index:" +#~ msgstr "" +#~ "Este exemplo demonstra um mapa das entidades Part por " +#~ "nome, onde partName é uma propriedade persistente de " +#~ "Part. Note que o uso de um índice baseado em fórmula:" + +#~ msgid "" +#~ "Hibernate supports collections implementing java.util.SortedMap and java.util.SortedSet. You must specify a " +#~ "comparator in the mapping file:" +#~ msgstr "" +#~ "O Hibernate suporta a implementação de coleções java.util." +#~ "SortedMap e java.util.SortedSet. Você deve " +#~ "especificar um comparador no arquivo de mapeamento:" + +#~ msgid "" +#~ "A final alternative is to use composite elements, which will be discussed " +#~ "later." +#~ msgstr "" +#~ "Uma alternativa final é usar os elementos compostos, que nós discutiremos " +#~ "mais tarde. " + +#~ msgid "" +#~ "Even more complex association mappings are covered in the next chapter." +#~ msgstr "" +#~ "Até mesmo o mapeamento de associações mais complexos serão discutimos no " +#~ "próximo capítulo." diff --git a/documentation/manual/src/main/docbook/pt-BR/content/configuration.po b/documentation/manual/src/main/docbook/pt-BR/content/configuration.po index 0171e43aaa..40ef974843 100644 --- a/documentation/manual/src/main/docbook/pt-BR/content/configuration.po +++ b/documentation/manual/src/main/docbook/pt-BR/content/configuration.po @@ -108,7 +108,7 @@ msgid "" msgstr "" "Project-Id-Version: configuration\n" "Report-Msgid-Bugs-To: http://bugs.kde.org\n" -"POT-Creation-Date: 2010-02-11T05:38:15\n" +"POT-Creation-Date: 2010-07-20 21:02+0000\n" "PO-Revision-Date: 2010-03-17 14:39+1000\n" "Last-Translator: \n" "Language-Team: \n" @@ -118,11 +118,13 @@ msgstr "" "X-Generator: KBabel 1.11.4\n" #. Tag: title +#: configuration.xml:31 #, no-c-format msgid "Configuration" msgstr "Configuration" #. Tag: para +#: configuration.xml:33 #, no-c-format msgid "" "Hibernate is designed to operate in many different environments and, as " @@ -140,11 +142,13 @@ msgstr "" "de exemplo no seu classpath e personalize-o. " #. Tag: title +#: configuration.xml:41 #, no-c-format msgid "Programmatic configuration" msgstr "Configuração programática" #. Tag: para +#: configuration.xml:43 #, no-c-format msgid "" "An instance of org.hibernate.cfg.Configuration " @@ -161,6 +165,7 @@ msgstr "" "mapeamento XML. " #. Tag: para +#: configuration.xml:51 #, no-c-format msgid "" "You can obtain a org.hibernate.cfg.Configuration " @@ -173,7 +178,17 @@ msgstr "" "mapeamento XML. Se os arquivos de mapeamento estiverem no classpath, use " "addResource(). Por exemplo:" +#. Tag: programlisting +#: configuration.xml:57 +#, no-c-format +msgid "" +"Configuration cfg = new Configuration()\n" +" .addResource(\"Item.hbm.xml\")\n" +" .addResource(\"Bid.hbm.xml\");" +msgstr "" + #. Tag: para +#: configuration.xml:59 #, no-c-format msgid "" "An alternative way is to specify the mapped class and allow Hibernate to " @@ -182,7 +197,17 @@ msgstr "" "Uma alternativa é especificar a classe mapeada e permitir que o Hibernate " "encontre o documento de mapeamento para você:" +#. Tag: programlisting +#: configuration.xml:62 +#, no-c-format +msgid "" +"Configuration cfg = new Configuration()\n" +" .addClass(org.hibernate.auction.Item.class)\n" +" .addClass(org.hibernate.auction.Bid.class);" +msgstr "" + #. Tag: para +#: configuration.xml:64 #, no-c-format msgid "" "Hibernate will then search for mapping files named /org/hibernate/" @@ -196,6 +221,7 @@ msgstr "" "arquivo de difícil compreensão." #. Tag: para +#: configuration.xml:69 #, no-c-format msgid "" "A org.hibernate.cfg.Configuration also allows you to " @@ -204,7 +230,22 @@ msgstr "" "Uma Configuration também permite que você especifique " "propriedades de configuração específica. Por exemplo:" +#. Tag: programlisting +#: configuration.xml:72 +#, no-c-format +msgid "" +"Configuration cfg = new Configuration()\n" +" .addClass(org.hibernate.auction.Item.class)\n" +" .addClass(org.hibernate.auction.Bid.class)\n" +" .setProperty(\"hibernate.dialect\", \"org.hibernate.dialect." +"MySQLInnoDBDialect\")\n" +" .setProperty(\"hibernate.connection.datasource\", \"java:comp/env/jdbc/" +"test\")\n" +" .setProperty(\"hibernate.order_updates\", \"true\");" +msgstr "" + #. Tag: para +#: configuration.xml:74 #, no-c-format msgid "" "This is not the only way to pass configuration properties to Hibernate. Some " @@ -214,6 +255,7 @@ msgstr "" "Hibernate. As várias opções incluem: " #. Tag: para +#: configuration.xml:79 #, no-c-format msgid "" "Pass an instance of java.util.Properties to " @@ -223,6 +265,7 @@ msgstr "" "Configuration.setProperties(). " #. Tag: para +#: configuration.xml:84 #, no-c-format msgid "" "Place a file named hibernate.properties in a root " @@ -232,6 +275,7 @@ msgstr "" "diretório raíz do classpath." #. Tag: para +#: configuration.xml:89 #, no-c-format msgid "" "Set System properties using java -" @@ -241,6 +285,7 @@ msgstr "" "-Dproperty=value." #. Tag: para +#: configuration.xml:94 #, no-c-format msgid "" "Include <property> elements in hibernate." @@ -250,6 +295,7 @@ msgstr "" "cfg.xml (discutido mais tarde). " #. Tag: para +#: configuration.xml:99 #, no-c-format msgid "" "If you want to get started quicklyhibernate.properties " @@ -259,6 +305,7 @@ msgstr "" "filename> é a abordagem mais rápida." #. Tag: para +#: configuration.xml:103 #, no-c-format msgid "" "The org.hibernate.cfg.Configuration is intended as a " @@ -270,11 +317,13 @@ msgstr "" "SessionFactory for criado." #. Tag: title +#: configuration.xml:109 #, no-c-format msgid "Obtaining a SessionFactory" msgstr "Obtendo uma SessionFactory" #. Tag: para +#: configuration.xml:111 #, no-c-format msgid "" "When all mappings have been parsed by the org.hibernate.cfg." @@ -285,9 +334,17 @@ msgstr "" "Quando todos os mapeamentos forem analisados pelo org.hibernate." "cfg.Configuration, a aplicação deve obter uma factory para as " "instâncias do org.hibernate.Session. O " -"objetivo desta factory é ser compartilhado por todas as threads da aplicação: " +"objetivo desta factory é ser compartilhado por todas as threads da " +"aplicação: " + +#. Tag: programlisting +#: configuration.xml:117 +#, no-c-format +msgid "SessionFactory sessions = cfg.buildSessionFactory();" +msgstr "" #. Tag: para +#: configuration.xml:119 #, no-c-format msgid "" "Hibernate does allow your application to instantiate more than one " @@ -299,11 +356,13 @@ msgstr "" "se você estiver usando mais do que um banco de dados. " #. Tag: title +#: configuration.xml:125 #, no-c-format msgid "JDBC connections" msgstr "Conexões JDBC" #. Tag: para +#: configuration.xml:127 #, no-c-format msgid "" "It is advisable to have the org.hibernate.SessionFactoryorg.hibernate." "Session será tão simples quanto:" +#. Tag: programlisting +#: configuration.xml:133 +#, no-c-format +msgid "Session session = sessions.openSession(); // open a new Session" +msgstr "" + #. Tag: para +#: configuration.xml:135 #, no-c-format msgid "" "Once you start a task that requires access to the database, a JDBC " @@ -326,6 +392,7 @@ msgstr "" "conexão JDBC será obtida a partir do pool." #. Tag: para +#: configuration.xml:138 #, no-c-format msgid "" "Before you can do this, you first need to pass some JDBC connection " @@ -340,6 +407,7 @@ msgstr "" "Descreveremos agora as configurações mais importantes para a conexão JDBC. " #. Tag: para +#: configuration.xml:144 #, no-c-format msgid "" "Hibernate will obtain and pool connections using java.sql." @@ -349,71 +417,89 @@ msgstr "" "DriverManager se você determinar as seguintes propriedades: " #. Tag: title +#: configuration.xml:149 #, no-c-format msgid "Hibernate JDBC Properties" msgstr "Propriedades JDBC Hibernate" #. Tag: entry +#: configuration.xml:158 configuration.xml:236 configuration.xml:327 +#: configuration.xml:495 configuration.xml:657 configuration.xml:753 +#: configuration.xml:826 #, no-c-format msgid "Property name" msgstr "Nome da Propriedade" #. Tag: entry +#: configuration.xml:160 configuration.xml:238 configuration.xml:329 +#: configuration.xml:497 configuration.xml:659 configuration.xml:755 +#: configuration.xml:828 #, no-c-format msgid "Purpose" msgstr "Propósito" -#. Tag: entry -#, no-c-format -msgid "hibernate.connection.driver_class" +#. Tag: property +#: configuration.xml:166 +#, fuzzy, no-c-format +msgid "hibernate.connection.driver_class" msgstr "hibernate.connection.driver_class" -#. Tag: entry -#, no-c-format -msgid "JDBC driver class" +#. Tag: emphasis +#: configuration.xml:168 +#, fuzzy, no-c-format +msgid "JDBC driver class" msgstr "JDBC driver class" -#. Tag: entry -#, no-c-format -msgid "hibernate.connection.url" +#. Tag: property +#: configuration.xml:172 +#, fuzzy, no-c-format +msgid "hibernate.connection.url" msgstr "hibernate.connection.url" -#. Tag: entry +#. Tag: emphasis +#: configuration.xml:174 #, no-c-format -msgid "JDBC URL" -msgstr "JDBC URL" +msgid "JDBC URL" +msgstr "" -#. Tag: entry -#, no-c-format -msgid "hibernate.connection.username" +#. Tag: property +#: configuration.xml:178 configuration.xml:265 +#, fuzzy, no-c-format +msgid "hibernate.connection.username" msgstr "hibernate.connection.username" -#. Tag: entry +#. Tag: emphasis +#: configuration.xml:180 #, no-c-format -msgid "database user" -msgstr "usuário de banco de dados " +msgid "database user" +msgstr "" -#. Tag: entry -#, no-c-format -msgid "hibernate.connection.password" +#. Tag: property +#: configuration.xml:184 configuration.xml:271 +#, fuzzy, no-c-format +msgid "hibernate.connection.password" msgstr "hibernate.connection.password" -#. Tag: entry -#, no-c-format -msgid "database user password" +#. Tag: emphasis +#: configuration.xml:186 +#, fuzzy, no-c-format +msgid "database user password" msgstr "senha de usuário de banco de dados " -#. Tag: entry -#, no-c-format -msgid "hibernate.connection.pool_size" +#. Tag: property +#: configuration.xml:190 +#, fuzzy, no-c-format +msgid "hibernate.connection.pool_size" msgstr "hibernate.connection.pool_size" -#. Tag: entry -#, no-c-format -msgid "maximum number of pooled connections" +#. Tag: emphasis +#: configuration.xml:192 +#, fuzzy, no-c-format +msgid "maximum number of pooled connections" msgstr "número máximo de conexões em pool" #. Tag: para +#: configuration.xml:199 #, no-c-format msgid "" "Hibernate's own connection pooling algorithm is, however, quite rudimentary. " @@ -434,6 +520,7 @@ msgstr "" "usar C3P0. " #. Tag: para +#: configuration.xml:208 #, no-c-format msgid "" "C3P0 is an open source JDBC connection pool distributed along with Hibernate " @@ -453,6 +540,7 @@ msgstr "" "informações." #. Tag: para +#: configuration.xml:216 #, no-c-format msgid "" "The following is an example hibernate.properties file " @@ -461,7 +549,23 @@ msgstr "" "Este é um exemplo de arquivo hibernate.properties para " "c3p0:" +#. Tag: programlisting +#: configuration.xml:219 +#, no-c-format +msgid "" +"hibernate.connection.driver_class = org.postgresql.Driver\n" +"hibernate.connection.url = jdbc:postgresql://localhost/mydatabase\n" +"hibernate.connection.username = myuser\n" +"hibernate.connection.password = secret\n" +"hibernate.c3p0.min_size=5\n" +"hibernate.c3p0.max_size=20\n" +"hibernate.c3p0.timeout=1800\n" +"hibernate.c3p0.max_statements=50\n" +"hibernate.dialect = org.hibernate.dialect.PostgreSQLDialect" +msgstr "" + #. Tag: para +#: configuration.xml:221 #, no-c-format msgid "" "For use inside an application server, you should almost always configure " @@ -475,36 +579,43 @@ msgstr "" "precisará determinar pelo menos uma das seguintes propriedades:" #. Tag: title +#: configuration.xml:227 #, no-c-format msgid "Hibernate Datasource Properties" msgstr "Propriedades do Datasource do Hibernate" -#. Tag: entry -#, no-c-format -msgid "hibernate.connection.datasource" +#. Tag: property +#: configuration.xml:244 +#, fuzzy, no-c-format +msgid "hibernate.connection.datasource" msgstr "hibernate.connection.datasource" -#. Tag: entry -#, no-c-format -msgid "datasource JNDI name" +#. Tag: emphasis +#: configuration.xml:246 +#, fuzzy, no-c-format +msgid "datasource JNDI name" msgstr "nome JNDI de fonte de dados" -#. Tag: entry -#, no-c-format -msgid "hibernate.jndi.url" +#. Tag: property +#: configuration.xml:250 +#, fuzzy, no-c-format +msgid "hibernate.jndi.url" msgstr "hibernate.jndi.url" #. Tag: entry +#: configuration.xml:252 #, no-c-format msgid "URL of the JNDI provider (optional)" msgstr "URL do fornecedor JNDI (opcional)" -#. Tag: entry -#, no-c-format -msgid "hibernate.jndi.class" +#. Tag: property +#: configuration.xml:257 +#, fuzzy, no-c-format +msgid "hibernate.jndi.class" msgstr "hibernate.jndi.class" #. Tag: entry +#: configuration.xml:259 #, no-c-format msgid "" "class of the JNDI InitialContextFactorydatabase user (optional)" msgstr "usuário de banco de dados (opcional)" #. Tag: entry +#: configuration.xml:273 #, no-c-format msgid "database user password (optional)" msgstr "senha de usuário de banco de dados (opcional)" #. Tag: para +#: configuration.xml:280 #, no-c-format msgid "" "Here is an example hibernate.properties file for an " @@ -532,7 +646,20 @@ msgstr "" "Eis um exemplo de arquivo hibernate.properties para um " "servidor de aplicação fornecedor de fontes de dados JNDI:" +#. Tag: programlisting +#: configuration.xml:283 +#, no-c-format +msgid "" +"hibernate.connection.datasource = java:/comp/env/jdbc/test\n" +"hibernate.transaction.factory_class = \\\n" +" org.hibernate.transaction.JTATransactionFactory\n" +"hibernate.transaction.manager_lookup_class = \\\n" +" org.hibernate.transaction.JBossTransactionManagerLookup\n" +"hibernate.dialect = org.hibernate.dialect.PostgreSQLDialect" +msgstr "" + #. Tag: para +#: configuration.xml:285 #, no-c-format msgid "" "JDBC connections obtained from a JNDI datasource will automatically " @@ -542,6 +669,7 @@ msgstr "" "das transações gerenciadas pelo recipiente no servidor de aplicação." #. Tag: para +#: configuration.xml:289 #, no-c-format msgid "" "Arbitrary connection properties can be given by prepending " @@ -555,6 +683,7 @@ msgstr "" "literal> usando hibernate.connection.charSet." #. Tag: para +#: configuration.xml:294 #, no-c-format msgid "" "You can define your own plugin strategy for obtaining JDBC connections by " @@ -570,11 +699,13 @@ msgstr "" "literal>." #. Tag: title +#: configuration.xml:302 #, no-c-format msgid "Optional configuration properties" msgstr "Propriedades opcionais de configuração" #. Tag: para +#: configuration.xml:304 #, no-c-format msgid "" "There are a number of other properties that control the behavior of " @@ -585,6 +716,7 @@ msgstr "" "lógicos. " #. Tag: para +#: configuration.xml:309 #, no-c-format msgid "" "Some of these properties are \"system-level\" only. " @@ -592,23 +724,26 @@ msgid "" "literal> or hibernate.properties. They " "cannot be set by the other techniques described above." msgstr "" -"Algumas destas propriedades são somente em nível de sistema.. As propriedades " -"em nível de sistema podem ser determinadas somente via java -" -"Dproperty=value ou hibernate.properties. Elas " -"não podem ser configuradas por outras técnicas " -"descritas acima." +"Algumas destas propriedades são somente em nível de sistema.. As propriedades em nível de sistema podem ser determinadas " +"somente via java -Dproperty=value ou hibernate." +"properties. Elas não podem ser configuradas " +"por outras técnicas descritas acima." #. Tag: title +#: configuration.xml:318 #, no-c-format msgid "Hibernate Configuration Properties" msgstr "Propriedades de Configuração do Hibernate" -#. Tag: entry -#, no-c-format -msgid "hibernate.dialect" +#. Tag: property +#: configuration.xml:335 +#, fuzzy, no-c-format +msgid "hibernate.dialect" msgstr "hibernate.dialect" #. Tag: entry +#: configuration.xml:337 #, no-c-format msgid "" "The classname of a Hibernate org.hibernate.dialect.Dialecte.g. full.classname.of." @@ -629,6 +765,7 @@ msgstr "" "Dialect" #. Tag: para +#: configuration.xml:341 #, no-c-format msgid "" "In most cases Hibernate will actually be able to choose the correct " @@ -639,12 +776,14 @@ msgstr "" "implementação org.hibernate.dialect.Dialect correta " "baseada no JDBC metadata retornado pelo JDBC driver." -#. Tag: entry -#, no-c-format -msgid "hibernate.show_sql" +#. Tag: property +#: configuration.xml:349 +#, fuzzy, no-c-format +msgid "hibernate.show_sql" msgstr "hibernate.show_sql" #. Tag: entry +#: configuration.xml:351 #, no-c-format msgid "" "Write all SQL statements to console. This is an alternative to setting the " @@ -656,6 +795,11 @@ msgstr "" "debug." #. Tag: para +#: configuration.xml:353 configuration.xml:361 configuration.xml:426 +#: configuration.xml:435 configuration.xml:443 configuration.xml:453 +#: configuration.xml:468 configuration.xml:525 configuration.xml:545 +#: configuration.xml:555 configuration.xml:598 configuration.xml:797 +#: configuration.xml:808 configuration.xml:904 #, no-c-format msgid "" "e.g. true | " @@ -664,22 +808,26 @@ msgstr "" "e.g. true | " "false" -#. Tag: entry -#, no-c-format -msgid "hibernate.format_sql" +#. Tag: property +#: configuration.xml:359 +#, fuzzy, no-c-format +msgid "hibernate.format_sql" msgstr "hibernate.format_sql" #. Tag: entry +#: configuration.xml:361 #, no-c-format msgid "Pretty print the SQL in the log and console." msgstr "Imprime o SQL formatado no log e recipiente. " -#. Tag: entry -#, no-c-format -msgid "hibernate.default_schema" +#. Tag: property +#: configuration.xml:367 +#, fuzzy, no-c-format +msgid "hibernate.default_schema" msgstr "hibernate.default_schema" #. Tag: entry +#: configuration.xml:369 #, no-c-format msgid "" "Qualify unqualified table names with the given schema/tablespace in " @@ -689,33 +837,44 @@ msgstr "" "espaço da tabela dado." #. Tag: para +#: configuration.xml:370 #, no-c-format -msgid "e.g. SCHEMA_NAME" -msgstr "e.g. SCHEMA_NAME" +msgid "" +"e.g. SCHEMA_NAME" +msgstr "" +"e.g. SCHEMA_NAME" -#. Tag: entry -#, no-c-format -msgid "hibernate.default_catalog" +#. Tag: property +#: configuration.xml:376 +#, fuzzy, no-c-format +msgid "hibernate.default_catalog" msgstr "hibernate.default_catalog" #. Tag: entry +#: configuration.xml:378 #, no-c-format -msgid "Qualifies unqualified table names with the given catalog in generated SQL." +msgid "" +"Qualifies unqualified table names with the given catalog in generated SQL." msgstr "" "Qualifica no SQL gerado, os nome das tabelas desqualificadas com catálogo " "dado." #. Tag: para +#: configuration.xml:379 #, no-c-format -msgid "e.g. CATALOG_NAME" -msgstr "e.g. CATALOG_NAME" +msgid "" +"e.g. CATALOG_NAME" +msgstr "" +"e.g. CATALOG_NAME" -#. Tag: entry -#, no-c-format -msgid "hibernate.session_factory_name" +#. Tag: property +#: configuration.xml:384 +#, fuzzy, no-c-format +msgid "hibernate.session_factory_name" msgstr "hibernate.session_factory_name" #. Tag: entry +#: configuration.xml:386 #, no-c-format msgid "" "The org.hibernate.SessionFactory will be " @@ -725,6 +884,7 @@ msgstr "" "automaticamente se ligar a este nome no JNDI depois de ter sido criado. " #. Tag: para +#: configuration.xml:389 configuration.xml:776 #, no-c-format msgid "" "e.g. jndi/composite/namee.g. jndi/composite/name" -#. Tag: entry -#, no-c-format -msgid "hibernate.max_fetch_depth" +#. Tag: property +#: configuration.xml:394 +#, fuzzy, no-c-format +msgid "hibernate.max_fetch_depth" msgstr "hibernate.max_fetch_depth" #. Tag: entry +#: configuration.xml:396 #, no-c-format msgid "" "Sets a maximum \"depth\" for the outer join fetch tree for single-ended " @@ -750,6 +912,7 @@ msgstr "" "literal> desativa por padrão a busca de união externa. " #. Tag: para +#: configuration.xml:398 #, no-c-format msgid "" "e.g. recommended values between " @@ -758,17 +921,21 @@ msgstr "" "eg. valores recomendados " "entre0 e 3" -#. Tag: entry -#, no-c-format -msgid "hibernate.default_batch_fetch_size" +#. Tag: property +#: configuration.xml:404 +#, fuzzy, no-c-format +msgid "hibernate.default_batch_fetch_size" msgstr "hibernate.default_batch_fetch_size" #. Tag: entry +#: configuration.xml:406 #, no-c-format msgid "Sets a default size for Hibernate batch fetching of associations." -msgstr "Determina um tamanho padrão para busca de associações em lotes do Hibernate." +msgstr "" +"Determina um tamanho padrão para busca de associações em lotes do Hibernate." #. Tag: para +#: configuration.xml:407 #, no-c-format msgid "" "e.g. recommended values 4eg. valores recomendados 4, 8, 16" -#. Tag: entry -#, no-c-format -msgid "hibernate.default_entity_mode" +#. Tag: property +#: configuration.xml:413 +#, fuzzy, no-c-format +msgid "hibernate.default_entity_mode" msgstr "hibernate.default_entity_mode" #. Tag: entry +#: configuration.xml:415 #, no-c-format msgid "" "Sets a default mode for entity representation for all sessions opened from " @@ -792,6 +961,7 @@ msgstr "" "sessões abertas desta SessionFactory " #. Tag: para +#: configuration.xml:416 #, no-c-format msgid "" "dynamic-map, dom4j, pojodynamic-map, dom4j, pojo" -#. Tag: entry -#, no-c-format -msgid "hibernate.order_updates" +#. Tag: property +#: configuration.xml:422 +#, fuzzy, no-c-format +msgid "hibernate.order_updates" msgstr "hibernate.order_updates" #. Tag: entry +#: configuration.xml:424 #, no-c-format msgid "" "Forces Hibernate to order SQL updates by the primary key value of the items " @@ -816,24 +988,29 @@ msgstr "" "ítens a serem atualizados. Isto resultará em menos deadlocks nas transações " "em sistemas altamente concorrente. " -#. Tag: entry -#, no-c-format -msgid "hibernate.generate_statistics" -msgstr "hibernate.generate_statistics" +#. Tag: property +#: configuration.xml:432 +#, fuzzy, no-c-format +msgid "hibernate.generate_statistics" +msgstr "Estatísticas do Hibernate" #. Tag: entry +#: configuration.xml:434 #, no-c-format -msgid "If enabled, Hibernate will collect statistics useful for performance tuning." +msgid "" +"If enabled, Hibernate will collect statistics useful for performance tuning." msgstr "" "Se habilitado, o Hibernate coletará estatísticas úteis para o ajuste do " "desempenho. " -#. Tag: entry -#, no-c-format -msgid "hibernate.use_identifier_rollback" +#. Tag: property +#: configuration.xml:440 +#, fuzzy, no-c-format +msgid "hibernate.use_identifier_rollback" msgstr "hibernate.use_identifier_rollback" #. Tag: entry +#: configuration.xml:442 #, no-c-format msgid "" "If enabled, generated identifier properties will be reset to default values " @@ -842,12 +1019,14 @@ msgstr "" "Se habilitado, propriedades identificadoras geradas serão zeradas para os " "valores padrão quando os objetos forem apagados. " -#. Tag: entry -#, no-c-format -msgid "hibernate.use_sql_comments" +#. Tag: property +#: configuration.xml:449 +#, fuzzy, no-c-format +msgid "hibernate.use_sql_comments" msgstr "hibernate.use_sql_comments" #. Tag: entry +#: configuration.xml:451 #, no-c-format msgid "" "If turned on, Hibernate will generate comments inside the SQL, for easier " @@ -856,17 +1035,51 @@ msgstr "" "Se ligado, o Hibernate irá gerar comentários dentro do SQL, para facilitar a " "depuração, o valor padrão é false" +#. Tag: property +#: configuration.xml:458 +#, no-c-format +msgid "hibernate.id.new_generator_mappings" +msgstr "" + +#. Tag: entry +#: configuration.xml:460 +#, no-c-format +msgid "" +"Setting is relevant when using @GeneratedValue. It " +"indicates whether or not the new IdentifierGenerator " +"implementations are used for javax.persistence.GenerationType." +"AUTO, javax.persistence.GenerationType.TABLE and javax.persistence.GenerationType.SEQUENCE. Default to false to keep backward " +"compatibility." +msgstr "" + +#. Tag: para +#: configuration.xml:476 +#, no-c-format +msgid "" +"We recommend all new projects which make use of to use " +"@GeneratedValue to also set hibernate.id." +"new_generator_mappings=true as the new generators are more efficient " +"and closer to the JPA 2 specification semantic. However they are not " +"backward compatible with existing databases (if a sequence or a table is " +"used for id generation)." +msgstr "" + #. Tag: title +#: configuration.xml:485 #, no-c-format msgid "Hibernate JDBC and Connection Properties" msgstr "JDBC Hibernate e Propriedades de Conexão" -#. Tag: entry -#, no-c-format -msgid "hibernate.jdbc.fetch_size" +#. Tag: property +#: configuration.xml:503 +#, fuzzy, no-c-format +msgid "hibernate.jdbc.fetch_size" msgstr "hibernate.jdbc.fetch_size" #. Tag: entry +#: configuration.xml:505 #, no-c-format msgid "" "A non-zero value determines the JDBC fetch size (calls Statement." @@ -875,12 +1088,14 @@ msgstr "" "Um valor maior que zero determina o tamanho da buscado JDBC (chamadas " "Statement.setFetchSize())." -#. Tag: entry -#, no-c-format -msgid "hibernate.jdbc.batch_size" +#. Tag: property +#: configuration.xml:510 +#, fuzzy, no-c-format +msgid "hibernate.jdbc.batch_size" msgstr "hibernate.jdbc.batch_size" #. Tag: entry +#: configuration.xml:512 #, no-c-format msgid "A non-zero value enables use of JDBC2 batch updates by Hibernate." msgstr "" @@ -888,6 +1103,7 @@ msgstr "" "Hibernate. " #. Tag: para +#: configuration.xml:513 #, no-c-format msgid "" "e.g. recommended values between " @@ -896,16 +1112,18 @@ msgstr "" "ex. valores recomentados entre " "5 e 30" -#. Tag: entry -#, no-c-format -msgid "hibernate.jdbc.batch_versioned_data" +#. Tag: property +#: configuration.xml:519 +#, fuzzy, no-c-format +msgid "hibernate.jdbc.batch_versioned_data" msgstr "hibernate.jdbc.batch_versioned_data" #. Tag: entry -#, no-c-format +#: configuration.xml:521 +#, fuzzy, no-c-format msgid "" "Set this property to true if your JDBC driver returns " -"correct row counts from executeBatch(). Iit is usually " +"correct row counts from executeBatch(). It is usually " "safe to turn this option on. Hibernate will then use batched DML for " "automatically versioned data. Defaults to false." msgstr "" @@ -914,12 +1132,14 @@ msgstr "" "Geralmente é seguro ligar opção. O Hibernate então usará o DML em lotes para " "dados automaticamente vertidos. Padronizar para false." -#. Tag: entry -#, no-c-format -msgid "hibernate.jdbc.factory_class" +#. Tag: property +#: configuration.xml:531 +#, fuzzy, no-c-format +msgid "hibernate.jdbc.factory_class" msgstr "hibernate.jdbc.factory_class" #. Tag: entry +#: configuration.xml:533 #, no-c-format msgid "" "Select a custom org.hibernate.jdbc.Batcher. " @@ -929,6 +1149,7 @@ msgstr "" "Muitas aplicações não irão precisar desta propriedade de configuração." #. Tag: para +#: configuration.xml:535 #, no-c-format msgid "" "e.g. classname.of." @@ -937,12 +1158,14 @@ msgstr "" "exemplo classname.of." "BatcherFactory" -#. Tag: entry -#, no-c-format -msgid "hibernate.jdbc.use_scrollable_resultset" +#. Tag: property +#: configuration.xml:541 +#, fuzzy, no-c-format +msgid "hibernate.jdbc.use_scrollable_resultset" msgstr "hibernate.jdbc.use_scrollable_resultset" #. Tag: entry +#: configuration.xml:543 #, no-c-format msgid "" "Enables use of JDBC2 scrollable resultsets by Hibernate. This property is " @@ -953,12 +1176,14 @@ msgstr "" "Essa propriedade somente é necessária quando se usa Conexões JDBC providas " "pelo usuário. Do contrário, o Hibernate os os metadados da conexão. " -#. Tag: entry -#, no-c-format -msgid "hibernate.jdbc.use_streams_for_binary" +#. Tag: property +#: configuration.xml:551 +#, fuzzy, no-c-format +msgid "hibernate.jdbc.use_streams_for_binary" msgstr "hibernate.jdbc.use_streams_for_binary" #. Tag: entry +#: configuration.xml:553 #, no-c-format msgid "" "Use streams when writing/reading binary or " @@ -969,12 +1194,14 @@ msgstr "" "serializable para/do JDBC. *system-level " "property*" -#. Tag: entry -#, no-c-format -msgid "hibernate.jdbc.use_get_generated_keys" +#. Tag: property +#: configuration.xml:561 +#, fuzzy, no-c-format +msgid "hibernate.jdbc.use_get_generated_keys" msgstr "hibernate.jdbc.use_get_generated_keys" #. Tag: entry +#: configuration.xml:563 #, no-c-format msgid "" "Enables use of JDBC3 PreparedStatement.getGeneratedKeys() " @@ -990,16 +1217,21 @@ msgstr "" "determinar o driver capaz de usar metadados da conexão. " #. Tag: para +#: configuration.xml:569 configuration.xml:678 configuration.xml:687 +#: configuration.xml:696 configuration.xml:723 #, no-c-format msgid "e.g. true|false" -msgstr "exemplo true|false " +msgstr "" +"exemplo true|false " -#. Tag: entry -#, no-c-format -msgid "hibernate.connection.provider_class" +#. Tag: property +#: configuration.xml:574 +#, fuzzy, no-c-format +msgid "hibernate.connection.provider_class" msgstr "hibernate.connection.provider_class" #. Tag: entry +#: configuration.xml:576 #, no-c-format msgid "" "The classname of a custom org.hibernate.connection." @@ -1011,6 +1243,7 @@ msgstr "" "Hibernate. " #. Tag: para +#: configuration.xml:578 #, no-c-format msgid "" "e.g. classname.of." @@ -1019,12 +1252,14 @@ msgstr "" "exemploclassname.of." "ConnectionProvider " -#. Tag: entry -#, no-c-format -msgid "hibernate.connection.isolation" +#. Tag: property +#: configuration.xml:584 +#, fuzzy, no-c-format +msgid "hibernate.connection.isolation" msgstr "hibernate.connection.isolation" #. Tag: entry +#: configuration.xml:586 #, no-c-format msgid "" "Sets the JDBC transaction isolation level. Check java.sql." @@ -1038,26 +1273,32 @@ msgstr "" "não são padrões. " #. Tag: para +#: configuration.xml:589 #, no-c-format msgid "e.g. 1, 2, 4, 8" -msgstr "exemplo 1, 2, 4, 8" +msgstr "" +"exemplo 1, 2, 4, 8" -#. Tag: entry -#, no-c-format -msgid "hibernate.connection.autocommit" +#. Tag: property +#: configuration.xml:595 +#, fuzzy, no-c-format +msgid "hibernate.connection.autocommit" msgstr "hibernate.connection.autocommit" #. Tag: entry +#: configuration.xml:597 #, no-c-format msgid "Enables autocommit for JDBC pooled connections (it is not recommended)." msgstr "Habilita o auto-commit para conexões no pool JDBC (não recomendado). " -#. Tag: entry -#, no-c-format -msgid "hibernate.connection.release_mode" +#. Tag: property +#: configuration.xml:603 +#, fuzzy, no-c-format +msgid "hibernate.connection.release_mode" msgstr "hibernate.connection.release_mode" #. Tag: entry +#: configuration.xml:605 #, no-c-format msgid "" "Specifies when Hibernate should release JDBC connections. By default, a JDBC " @@ -1082,6 +1323,7 @@ msgstr "" "estratégias de transação JDBC." #. Tag: para +#: configuration.xml:615 #, no-c-format msgid "" "e.g. auto (default) " @@ -1093,15 +1335,15 @@ msgstr "" "literal> | after_statement " #. Tag: para -#, no-c-format +#: configuration.xml:618 +#, fuzzy, no-c-format msgid "" "This setting only affects Sessions returned from " "SessionFactory.openSession. For Sessions obtained through SessionFactory.getCurrentSession, the CurrentSessionContext implementation " "configured for use controls the connection release mode for those " -"Sessions. See " +"Sessions. See" msgstr "" "Note que esta configuração somente afeta as Sessions " "retornadas da SessionFactory.openSession. Para as " @@ -1112,6 +1354,7 @@ msgstr "" "current-session\" />" #. Tag: entry +#: configuration.xml:630 #, no-c-format msgid "" "hibernate.connection.<propertyName>" #. Tag: entry +#: configuration.xml:632 #, no-c-format msgid "" "Pass the JDBC property <propertyName> to " @@ -1130,11 +1374,15 @@ msgstr "" "DriverManager.getConnection()." #. Tag: entry +#: configuration.xml:638 #, no-c-format -msgid "hibernate.jndi.<propertyName>" -msgstr "hibernate.jndi.<propertyName>" +msgid "" +"hibernate.jndi.<propertyName>" +msgstr "" +"hibernate.jndi.<propertyName>" #. Tag: entry +#: configuration.xml:640 #, no-c-format msgid "" "Pass the property <propertyName> to the JNDI " @@ -1144,21 +1392,26 @@ msgstr "" "InitialContextFactory." #. Tag: title +#: configuration.xml:648 #, no-c-format msgid "Hibernate Cache Properties" msgstr "Propriedades de Cachê do Hibernate" -#. Tag: entry -#, no-c-format -msgid "hibernate.cache.provider_class" +#. Tag: literal +#: configuration.xml:665 +#, fuzzy, no-c-format +msgid "hibernate.cache.provider_class" msgstr "hibernate.cache.provider_class" #. Tag: entry +#: configuration.xml:667 #, no-c-format msgid "The classname of a custom CacheProvider." -msgstr "O nome da classe de um CacheProvider personalizado." +msgstr "" +"O nome da classe de um CacheProvider personalizado." #. Tag: para +#: configuration.xml:668 #, no-c-format msgid "" "e.g. classname.of." @@ -1167,12 +1420,14 @@ msgstr "" "exemplo classname.of." "CacheProvider " -#. Tag: entry -#, no-c-format -msgid "hibernate.cache.use_minimal_puts" +#. Tag: literal +#: configuration.xml:673 +#, fuzzy, no-c-format +msgid "hibernate.cache.use_minimal_puts" msgstr "hibernate.cache.use_minimal_puts" #. Tag: entry +#: configuration.xml:675 #, no-c-format msgid "" "Optimizes second-level cache operation to minimize writes, at the cost of " @@ -1184,24 +1439,29 @@ msgstr "" "em cluster e, no Hibernate3, é habilitado por padrão para implementações de " "cache em cluster. " -#. Tag: entry -#, no-c-format -msgid "hibernate.cache.use_query_cache" +#. Tag: literal +#: configuration.xml:684 +#, fuzzy, no-c-format +msgid "hibernate.cache.use_query_cache" msgstr "hibernate.cache.use_query_cache" #. Tag: entry +#: configuration.xml:686 #, no-c-format -msgid "Enables the query cache. Individual queries still have to be set cachable." +msgid "" +"Enables the query cache. Individual queries still have to be set cachable." msgstr "" "Habilita a cache de consultas. Mesmo assim, consultas individuais ainda têm " "que ser habilitadas para o cache." -#. Tag: entry -#, no-c-format -msgid "hibernate.cache.use_second_level_cache" +#. Tag: literal +#: configuration.xml:692 +#, fuzzy, no-c-format +msgid "hibernate.cache.use_second_level_cache" msgstr "hibernate.cache.use_second_level_cache" #. Tag: entry +#: configuration.xml:694 #, no-c-format msgid "" "Can be used to completely disable the second level cache, which is enabled " @@ -1212,12 +1472,14 @@ msgstr "" "o qual é habilitado por padrão para as classes que especificam um mapeamento " "<cache>." -#. Tag: entry -#, no-c-format -msgid "hibernate.cache.query_cache_factory" +#. Tag: literal +#: configuration.xml:702 +#, fuzzy, no-c-format +msgid "hibernate.cache.query_cache_factory" msgstr "hibernate.cache.query_cache_factory" #. Tag: entry +#: configuration.xml:704 #, no-c-format msgid "" "The classname of a custom QueryCache interface, defaults " @@ -1228,6 +1490,7 @@ msgstr "" "automaticamente. " #. Tag: para +#: configuration.xml:706 #, no-c-format msgid "" "e.g. classname.of.QueryCacheexemplo classname.of." "QueryCache" -#. Tag: entry -#, no-c-format -msgid "hibernate.cache.region_prefix" +#. Tag: literal +#: configuration.xml:712 +#, fuzzy, no-c-format +msgid "hibernate.cache.region_prefix" msgstr "hibernate.cache.region_prefix" #. Tag: entry +#: configuration.xml:714 #, no-c-format msgid "A prefix to use for second-level cache region names." msgstr "Um prefixo para usar em nomes regionais de cachê de segundo nível" #. Tag: para +#: configuration.xml:714 #, no-c-format msgid "e.g. prefix" -msgstr "exemplo prefix " +msgstr "" +"exemplo prefix " -#. Tag: entry -#, no-c-format -msgid "hibernate.cache.use_structured_entries" +#. Tag: literal +#: configuration.xml:720 +#, fuzzy, no-c-format +msgid "hibernate.cache.use_structured_entries" msgstr "hibernate.cache.use_structured_entries" #. Tag: entry +#: configuration.xml:722 #, no-c-format msgid "" "Forces Hibernate to store data in the second-level cache in a more human-" @@ -1265,17 +1534,36 @@ msgstr "" "Força o Hibernate a armazenar dados no cachê de segundo nível em um formato " "mais humanamente amigável." +#. Tag: literal +#: configuration.xml:729 +#, no-c-format +msgid "hibernate.cache.default_cache_concurrency_strategy" +msgstr "" + +#. Tag: entry +#: configuration.xml:731 +#, no-c-format +msgid "" +"Setting used to give the name of the default org.hibernate." +"annotations.CacheConcurrencyStrategy to use when either " +"@Cacheable or @Cache is used. " +"@Cache(strategy=\"..\") is used to override this default." +msgstr "" + #. Tag: title +#: configuration.xml:744 #, no-c-format msgid "Hibernate Transaction Properties" msgstr "Propriedades de Transação do Hibernate" -#. Tag: entry -#, no-c-format -msgid "hibernate.transaction.factory_class" +#. Tag: literal +#: configuration.xml:761 +#, fuzzy, no-c-format +msgid "hibernate.transaction.factory_class" msgstr "hibernate.transaction.factory_class" #. Tag: entry +#: configuration.xml:763 #, no-c-format msgid "" "The classname of a TransactionFactory to use with " @@ -1287,6 +1575,7 @@ msgstr "" "padrãoJDBCTransactionFactory ). " #. Tag: para +#: configuration.xml:765 #, no-c-format msgid "" "e.g. classname.of." @@ -1295,12 +1584,14 @@ msgstr "" "exemplo classname.of." "TransactionFactory " -#. Tag: entry -#, no-c-format -msgid "jta.UserTransaction" +#. Tag: literal +#: configuration.xml:771 +#, fuzzy, no-c-format +msgid "jta.UserTransaction" msgstr "jta.UserTransaction" #. Tag: entry +#: configuration.xml:773 #, no-c-format msgid "" "A JNDI name used by JTATransactionFactory to obtain the " @@ -1310,12 +1601,14 @@ msgstr "" "uma UserTransaction JTA a partir do servidor de " "aplicação. " -#. Tag: entry -#, no-c-format -msgid "hibernate.transaction.manager_lookup_class" +#. Tag: literal +#: configuration.xml:781 +#, fuzzy, no-c-format +msgid "hibernate.transaction.manager_lookup_class" msgstr "hibernate.transaction.manager_lookup_class" #. Tag: entry +#: configuration.xml:783 #, no-c-format msgid "" "The classname of a TransactionManagerLookup. It is " @@ -1327,6 +1620,7 @@ msgstr "" "estivermos usando um gerador hilo em um ambiente JTA. " #. Tag: para +#: configuration.xml:786 #, no-c-format msgid "" "e.g. classname.of." @@ -1335,34 +1629,38 @@ msgstr "" "exemplo classname.of." "TransactionManagerLookup " -#. Tag: entry -#, no-c-format -msgid "hibernate.transaction.flush_before_completion" +#. Tag: literal +#: configuration.xml:792 +#, fuzzy, no-c-format +msgid "hibernate.transaction.flush_before_completion" msgstr "hibernate.transaction.flush_before_completion" #. Tag: entry -#, no-c-format +#: configuration.xml:794 +#, fuzzy, no-c-format msgid "" "If enabled, the session will be automatically flushed during the before " "completion phase of the transaction. Built-in and automatic session context " -"management is preferred, see ." msgstr "" "Se habilitada, a sessão será automaticamente liberada antes da fase de " "conclusão da transação. Prefere-se o gerenciamento de contexto da sessão " "criada e automática, veja ." -#. Tag: entry -#, no-c-format -msgid "hibernate.transaction.auto_close_session" +#. Tag: literal +#: configuration.xml:803 +#, fuzzy, no-c-format +msgid "hibernate.transaction.auto_close_session" msgstr "hibernate.transaction.auto_close_session" #. Tag: entry -#, no-c-format +#: configuration.xml:805 +#, fuzzy, no-c-format msgid "" "If enabled, the session will be automatically closed during the after " "completion phase of the transaction. Built-in and automatic session context " -"management is preferred, see ." msgstr "" "Se habilitada, a sessão será automaticamente fechada após a fase de " @@ -1370,27 +1668,31 @@ msgstr "" "contexto da sessão, veja ." #. Tag: title +#: configuration.xml:817 #, no-c-format msgid "Miscellaneous Properties" msgstr "Propriedades Variadas" -#. Tag: entry -#, no-c-format -msgid "hibernate.current_session_context_class" +#. Tag: literal +#: configuration.xml:834 +#, fuzzy, no-c-format +msgid "hibernate.current_session_context_class" msgstr "hibernate.current_session_context_class" #. Tag: entry -#, no-c-format +#: configuration.xml:836 +#, fuzzy, no-c-format msgid "" "Supply a custom strategy for the scoping of the \"current\" " "Session. See for more information about the built-in strategies." +"\"/> for more information about the built-in strategies." msgstr "" "Fornece uma estratégia personalizada para extensão da Session\"atual\". Veja " "para mais informação sobre estratégias internas. " #. Tag: para +#: configuration.xml:839 #, no-c-format msgid "" "e.g. jta | " @@ -1401,17 +1703,20 @@ msgstr "" "thread | managed | custom." "Class" -#. Tag: entry -#, no-c-format -msgid "hibernate.query.factory_class" +#. Tag: literal +#: configuration.xml:846 +#, fuzzy, no-c-format +msgid "hibernate.query.factory_class" msgstr "hibernate.query.factory_class" #. Tag: entry +#: configuration.xml:848 #, no-c-format msgid "Chooses the HQL parser implementation." msgstr "Escolha a implementação de análise HQL. " #. Tag: para +#: configuration.xml:848 #, no-c-format msgid "" "e.g. org.hibernate.hql.ast." @@ -1422,12 +1727,14 @@ msgstr "" "ASTQueryTranslatorFactory ou org.hibernate.hql.classic. " "ClassicQueryTranslatorFactory" -#. Tag: entry -#, no-c-format -msgid "hibernate.query.substitutions" +#. Tag: literal +#: configuration.xml:857 +#, fuzzy, no-c-format +msgid "hibernate.query.substitutions" msgstr "hibernate.query.substitutions" #. Tag: entry +#: configuration.xml:859 #, no-c-format msgid "" "Is used to map from tokens in Hibernate queries to SQL tokens (tokens might " @@ -1437,6 +1744,7 @@ msgstr "" "SQL (símbolos devem ser por exemplo, funções ou nome literais). " #. Tag: para +#: configuration.xml:861 #, no-c-format msgid "" "e.g. hqlLiteral=SQL_LITERAL, " @@ -1445,12 +1753,14 @@ msgstr "" "exemplo " "hqlLiteral=SQL_LITERAL, hqlFunction=SQLFUNC " -#. Tag: entry -#, no-c-format -msgid "hibernate.hbm2ddl.auto" +#. Tag: literal +#: configuration.xml:867 +#, fuzzy, no-c-format +msgid "hibernate.hbm2ddl.auto" msgstr "hibernate.hbm2ddl.auto" #. Tag: entry +#: configuration.xml:869 #, no-c-format msgid "" "Automatically validates or exports schema DDL to the database when the " @@ -1464,6 +1774,7 @@ msgstr "" "SessionFactory for fechada explicitamente. " #. Tag: para +#: configuration.xml:873 #, no-c-format msgid "" "e.g. validate | " @@ -1474,12 +1785,49 @@ msgstr "" "update | create | create-" "drop " -#. Tag: entry +#. Tag: literal +#: configuration.xml:880 +#, fuzzy, no-c-format +msgid "hibernate.hbm2ddl.import_file" +msgstr "hibernate.hbm2ddl.auto" + +#. Tag: para +#: configuration.xml:882 #, no-c-format -msgid "hibernate.cglib.use_reflection_optimizer" +msgid "" +"Comma-separated names of the optional files containing SQL DML statements " +"executed during the SessionFactory creation. This is " +"useful for testing or demoing: by adding INSERT statements for example you " +"can populate your database with a minimal set of data when it is deployed." +msgstr "" + +#. Tag: para +#: configuration.xml:887 +#, no-c-format +msgid "" +"File order matters, the statements of a give file are executed before the " +"statements of the following files. These statements are only executed if the " +"schema is created ie if hibernate.hbm2ddl.auto is set to " +"create or create-drop." +msgstr "" + +#. Tag: para +#: configuration.xml:892 +#, fuzzy, no-c-format +msgid "" +"e.g. /humans.sql,/dogs.sql" +msgstr "" +"exemplo true|false " + +#. Tag: literal +#: configuration.xml:898 +#, fuzzy, no-c-format +msgid "hibernate.cglib.use_reflection_optimizer" msgstr "hibernate.cglib.use_reflection_optimizer" #. Tag: entry +#: configuration.xml:900 #, no-c-format msgid "" "Enables the use of CGLIB instead of runtime reflection (System-level " @@ -1494,11 +1842,13 @@ msgstr "" "propriedade no hibernate.cfg.xml." #. Tag: title +#: configuration.xml:913 #, no-c-format msgid "SQL Dialects" msgstr "Dialetos SQL" #. Tag: para +#: configuration.xml:915 #, no-c-format msgid "" "Always set the hibernate.dialect property to the correct " @@ -1514,256 +1864,307 @@ msgstr "" "listadas abaixo, reduzindo o esforço de especificá-los manualmente." #. Tag: title +#: configuration.xml:922 #, no-c-format msgid "Hibernate SQL Dialects (hibernate.dialect)" msgstr "Dialetos SQL do Hibernate (hibernate.dialect)" #. Tag: entry +#: configuration.xml:933 #, no-c-format msgid "RDBMS" msgstr "RDBMS" #. Tag: entry +#: configuration.xml:935 #, no-c-format msgid "Dialect" msgstr "Dialeto" #. Tag: entry +#: configuration.xml:941 #, no-c-format -msgid "DB2" -msgstr "DB2" +msgid "DB2" +msgstr "" -#. Tag: entry -#, no-c-format -msgid "org.hibernate.dialect.DB2Dialect" +#. Tag: literal +#: configuration.xml:943 +#, fuzzy, no-c-format +msgid "org.hibernate.dialect.DB2Dialect" msgstr "org.hibernate.dialect.DB2Dialect" #. Tag: entry +#: configuration.xml:947 #, no-c-format msgid "DB2 AS/400" msgstr "DB2 AS/400" -#. Tag: entry -#, no-c-format -msgid "org.hibernate.dialect.DB2400Dialect" +#. Tag: literal +#: configuration.xml:949 +#, fuzzy, no-c-format +msgid "org.hibernate.dialect.DB2400Dialect" msgstr "org.hibernate.dialect.DB2400Dialect" #. Tag: entry +#: configuration.xml:953 #, no-c-format msgid "DB2 OS390" msgstr "DB2 OS390" -#. Tag: entry -#, no-c-format -msgid "org.hibernate.dialect.DB2390Dialect" +#. Tag: literal +#: configuration.xml:955 +#, fuzzy, no-c-format +msgid "org.hibernate.dialect.DB2390Dialect" msgstr "org.hibernate.dialect.DB2390Dialect" #. Tag: entry +#: configuration.xml:959 #, no-c-format msgid "PostgreSQL" msgstr "PostgreSQL" -#. Tag: entry -#, no-c-format -msgid "org.hibernate.dialect.PostgreSQLDialect" +#. Tag: literal +#: configuration.xml:961 +#, fuzzy, no-c-format +msgid "org.hibernate.dialect.PostgreSQLDialect" msgstr "org.hibernate.dialect.PostgreSQLDialect" #. Tag: entry +#: configuration.xml:965 #, no-c-format msgid "MySQL" msgstr "Meu SQL" -#. Tag: entry -#, no-c-format -msgid "org.hibernate.dialect.MySQLDialect" +#. Tag: literal +#: configuration.xml:967 +#, fuzzy, no-c-format +msgid "org.hibernate.dialect.MySQLDialect" msgstr "org.hibernate.dialect.MySQLDialect" #. Tag: entry +#: configuration.xml:971 #, no-c-format msgid "MySQL with InnoDB" msgstr "MeuSQL com InnoDB" -#. Tag: entry -#, no-c-format -msgid "org.hibernate.dialect.MySQLInnoDBDialect" +#. Tag: literal +#: configuration.xml:973 +#, fuzzy, no-c-format +msgid "org.hibernate.dialect.MySQLInnoDBDialect" msgstr "org.hibernate.dialect.MySQLInnoDBDialect" #. Tag: entry +#: configuration.xml:977 #, no-c-format msgid "MySQL with MyISAM" msgstr "Meu SQL com MeuISAM" -#. Tag: entry -#, no-c-format -msgid "org.hibernate.dialect.MySQLMyISAMDialect" +#. Tag: literal +#: configuration.xml:979 +#, fuzzy, no-c-format +msgid "org.hibernate.dialect.MySQLMyISAMDialect" msgstr "org.hibernate.dialect.MySQLMyISAMDialect" #. Tag: entry +#: configuration.xml:983 #, no-c-format msgid "Oracle (any version)" msgstr "Oracle (qualquer versão)" -#. Tag: entry -#, no-c-format -msgid "org.hibernate.dialect.OracleDialect" +#. Tag: literal +#: configuration.xml:985 +#, fuzzy, no-c-format +msgid "org.hibernate.dialect.OracleDialect" msgstr "org.hibernate.dialect.OracleDialect" #. Tag: entry +#: configuration.xml:989 #, no-c-format msgid "Oracle 9i" msgstr "Oracle 9i" -#. Tag: entry -#, no-c-format -msgid "org.hibernate.dialect.Oracle9iDialect" +#. Tag: literal +#: configuration.xml:991 +#, fuzzy, no-c-format +msgid "org.hibernate.dialect.Oracle9iDialect" msgstr "org.hibernate.dialect.Oracle9iDialect" #. Tag: entry +#: configuration.xml:995 #, no-c-format msgid "Oracle 10g" msgstr "Oracle 10g" -#. Tag: entry -#, no-c-format -msgid "org.hibernate.dialect.Oracle10gDialect" +#. Tag: literal +#: configuration.xml:997 +#, fuzzy, no-c-format +msgid "org.hibernate.dialect.Oracle10gDialect" msgstr "org.hibernate.dialect.Oracle10gDialect" #. Tag: entry +#: configuration.xml:1001 #, no-c-format msgid "Sybase" msgstr "Sybase" -#. Tag: entry -#, no-c-format -msgid "org.hibernate.dialect.SybaseDialect" +#. Tag: literal +#: configuration.xml:1003 +#, fuzzy, no-c-format +msgid "org.hibernate.dialect.SybaseDialect" msgstr "org.hibernate.dialect.SybaseDialect" #. Tag: entry +#: configuration.xml:1007 #, no-c-format msgid "Sybase Anywhere" msgstr "Sybase Qualquer lugar" -#. Tag: entry -#, no-c-format -msgid "org.hibernate.dialect.SybaseAnywhereDialect" +#. Tag: literal +#: configuration.xml:1009 +#, fuzzy, no-c-format +msgid "org.hibernate.dialect.SybaseAnywhereDialect" msgstr "org.hibernate.dialect.SybaseAnywhereDialect" #. Tag: entry +#: configuration.xml:1013 #, no-c-format msgid "Microsoft SQL Server" msgstr "Servidor Microsoft SQL" -#. Tag: entry -#, no-c-format -msgid "org.hibernate.dialect.SQLServerDialect" +#. Tag: literal +#: configuration.xml:1015 +#, fuzzy, no-c-format +msgid "org.hibernate.dialect.SQLServerDialect" msgstr "org.hibernate.dialect.SQLServerDialect" #. Tag: entry +#: configuration.xml:1019 #, no-c-format msgid "SAP DB" msgstr "SAP DB" -#. Tag: entry -#, no-c-format -msgid "org.hibernate.dialect.SAPDBDialect" +#. Tag: literal +#: configuration.xml:1021 +#, fuzzy, no-c-format +msgid "org.hibernate.dialect.SAPDBDialect" msgstr "org.hibernate.dialect.SAPDBDialect" #. Tag: entry +#: configuration.xml:1025 #, no-c-format msgid "Informix" msgstr "Informix" -#. Tag: entry -#, no-c-format -msgid "org.hibernate.dialect.InformixDialect" +#. Tag: literal +#: configuration.xml:1027 +#, fuzzy, no-c-format +msgid "org.hibernate.dialect.InformixDialect" msgstr "org.hibernate.dialect.InformixDialect" #. Tag: entry +#: configuration.xml:1031 #, no-c-format msgid "HypersonicSQL" msgstr "HypersonicSQL" -#. Tag: entry -#, no-c-format -msgid "org.hibernate.dialect.HSQLDialect" +#. Tag: literal +#: configuration.xml:1033 +#, fuzzy, no-c-format +msgid "org.hibernate.dialect.HSQLDialect" msgstr "org.hibernate.dialect.HSQLDialect" #. Tag: entry +#: configuration.xml:1037 #, no-c-format msgid "Ingres" msgstr "Ingres" -#. Tag: entry -#, no-c-format -msgid "org.hibernate.dialect.IngresDialect" +#. Tag: literal +#: configuration.xml:1039 +#, fuzzy, no-c-format +msgid "org.hibernate.dialect.IngresDialect" msgstr "org.hibernate.dialect.IngresDialect" #. Tag: entry +#: configuration.xml:1043 #, no-c-format msgid "Progress" msgstr "Progresso" -#. Tag: entry -#, no-c-format -msgid "org.hibernate.dialect.ProgressDialect" +#. Tag: literal +#: configuration.xml:1045 +#, fuzzy, no-c-format +msgid "org.hibernate.dialect.ProgressDialect" msgstr "org.hibernate.dialect.ProgressDialect" #. Tag: entry +#: configuration.xml:1049 #, no-c-format msgid "Mckoi SQL" msgstr "Mckoi SQL" -#. Tag: entry -#, no-c-format -msgid "org.hibernate.dialect.MckoiDialect" +#. Tag: literal +#: configuration.xml:1051 +#, fuzzy, no-c-format +msgid "org.hibernate.dialect.MckoiDialect" msgstr "org.hibernate.dialect.MckoiDialect" #. Tag: entry +#: configuration.xml:1055 #, no-c-format msgid "Interbase" msgstr "Interbase" -#. Tag: entry -#, no-c-format -msgid "org.hibernate.dialect.InterbaseDialect" +#. Tag: literal +#: configuration.xml:1057 +#, fuzzy, no-c-format +msgid "org.hibernate.dialect.InterbaseDialect" msgstr "org.hibernate.dialect.InterbaseDialect" #. Tag: entry +#: configuration.xml:1061 #, no-c-format msgid "Pointbase" msgstr "Base Ponto" -#. Tag: entry -#, no-c-format -msgid "org.hibernate.dialect.PointbaseDialect" +#. Tag: literal +#: configuration.xml:1063 +#, fuzzy, no-c-format +msgid "org.hibernate.dialect.PointbaseDialect" msgstr "org.hibernate.dialect.PointbaseDialect" #. Tag: entry +#: configuration.xml:1067 #, no-c-format msgid "FrontBase" msgstr "Base Frontal" -#. Tag: entry -#, no-c-format -msgid "org.hibernate.dialect.FrontbaseDialect" +#. Tag: literal +#: configuration.xml:1069 +#, fuzzy, no-c-format +msgid "org.hibernate.dialect.FrontbaseDialect" msgstr "org.hibernate.dialect.FrontbaseDialect" #. Tag: entry +#: configuration.xml:1073 #, no-c-format msgid "Firebird" msgstr "Firebird" -#. Tag: entry -#, no-c-format -msgid "org.hibernate.dialect.FirebirdDialect" +#. Tag: literal +#: configuration.xml:1075 +#, fuzzy, no-c-format +msgid "org.hibernate.dialect.FirebirdDialect" msgstr "org.hibernate.dialect.FirebirdDialect" #. Tag: title +#: configuration.xml:1083 #, no-c-format msgid "Outer Join Fetching" msgstr "Busca por união externa (Outer Join Fetching)" #. Tag: para +#: configuration.xml:1085 #, no-c-format msgid "" "If your database supports ANSI, Oracle or Sybase style outer joins, " @@ -1785,6 +2186,7 @@ msgstr "" "literal>." #. Tag: para +#: configuration.xml:1094 #, no-c-format msgid "" "Outer join fetching can be disabled globally by setting " @@ -1800,16 +2202,19 @@ msgstr "" "um, cujos quais têm sido mapeados com fetch=\"join\"." #. Tag: para -#, no-c-format -msgid "See for more information." +#: configuration.xml:1100 +#, fuzzy, no-c-format +msgid "See for more information." msgstr "Veja para mais informações." #. Tag: title +#: configuration.xml:1105 #, no-c-format msgid "Binary Streams" msgstr "Fluxos Binários (Binary Streams)" #. Tag: para +#: configuration.xml:1107 #, no-c-format msgid "" "Oracle limits the size of byte arrays that can be passed " @@ -1826,16 +2231,18 @@ msgstr "" " " #. Tag: title +#: configuration.xml:1116 #, no-c-format msgid "Second-level and query cache" msgstr "Cachê de segundo nível e consulta" #. Tag: para -#, no-c-format +#: configuration.xml:1118 +#, fuzzy, no-c-format msgid "" "The properties prefixed by hibernate.cache allow you to " "use a process or cluster scoped second-level cache system with Hibernate. " -"See the for more information." +"See the for more information." msgstr "" "As propriedades pré-fixadas pelo hibernate.cache permitem " "que você use um sistema de cache de segundo nível em um processo executado " @@ -1843,11 +2250,13 @@ msgstr "" "maiores detalhes. " #. Tag: title +#: configuration.xml:1125 #, no-c-format msgid "Query Language Substitution" msgstr "Substituição na Linguagem de Consulta" #. Tag: para +#: configuration.xml:1127 #, no-c-format msgid "" "You can define new Hibernate query tokens using hibernate.query." @@ -1856,7 +2265,14 @@ msgstr "" "Você pode definir novos símbolos de consulta Hibernate usando " "hibernate.query.substitutions. Por exemplo: " +#. Tag: programlisting +#: configuration.xml:1130 +#, fuzzy, no-c-format +msgid "hibernate.query.substitutions true=1, false=0" +msgstr "hibernate.query.substitutions" + #. Tag: para +#: configuration.xml:1132 #, no-c-format msgid "" "This would cause the tokens true and falsetrue e false passasem a ser traduzidos para literais inteiros no SQL gerado." +#. Tag: programlisting +#: configuration.xml:1136 +#, fuzzy, no-c-format +msgid "hibernate.query.substitutions toLowercase=LOWER" +msgstr "hibernate.query.substitutions" + #. Tag: para +#: configuration.xml:1138 #, no-c-format -msgid "This would allow you to rename the SQL LOWER function." -msgstr "Isto permitirá que você renomeie a função LOWER no SQL." +msgid "" +"This would allow you to rename the SQL LOWER function." +msgstr "" +"Isto permitirá que você renomeie a função LOWER no SQL." #. Tag: title +#: configuration.xml:1143 #, no-c-format msgid "Hibernate statistics" msgstr "Estatísticas do Hibernate" #. Tag: para +#: configuration.xml:1145 #, no-c-format msgid "" "If you enable hibernate.generate_statistics, Hibernate " @@ -1891,11 +2318,13 @@ msgstr "" "interface org.hibernate.stats para mais informações." #. Tag: title +#: configuration.xml:1155 #, no-c-format msgid "Logging" msgstr "Logging" #. Tag: para +#: configuration.xml:1157 #, no-c-format msgid "" "Hibernate utilizes Simple Logging " @@ -1926,6 +2355,7 @@ msgstr "" "Hibernate no diretório src/. " #. Tag: para +#: configuration.xml:1171 #, no-c-format msgid "" "It is recommended that you familiarize yourself with Hibernate's log " @@ -1940,56 +2370,67 @@ msgstr "" "essencial. As categorias de log mais interessantes são as seguintes:" #. Tag: title +#: configuration.xml:1178 #, no-c-format msgid "Hibernate Log Categories" msgstr "Categorias de Log do Hibernate" #. Tag: entry +#: configuration.xml:1187 #, no-c-format msgid "Category" msgstr "Categoria" #. Tag: entry +#: configuration.xml:1189 #, no-c-format msgid "Function" msgstr "Função" -#. Tag: entry -#, no-c-format -msgid "org.hibernate.SQL" +#. Tag: literal +#: configuration.xml:1195 +#, fuzzy, no-c-format +msgid "org.hibernate.SQL" msgstr "org.hibernate.SQL" #. Tag: entry +#: configuration.xml:1197 #, no-c-format msgid "Log all SQL DML statements as they are executed" msgstr "Registra todas as instruções SQL DML a medida que elas são executadas" -#. Tag: entry -#, no-c-format -msgid "org.hibernate.type" +#. Tag: literal +#: configuration.xml:1201 +#, fuzzy, no-c-format +msgid "org.hibernate.type" msgstr "org.hibernate.type" #. Tag: entry +#: configuration.xml:1203 #, no-c-format msgid "Log all JDBC parameters" msgstr "Registra todos os parâmetros JDBC" -#. Tag: entry -#, no-c-format -msgid "org.hibernate.tool.hbm2ddl" +#. Tag: literal +#: configuration.xml:1207 +#, fuzzy, no-c-format +msgid "org.hibernate.tool.hbm2ddl" msgstr "org.hibernate.tool.hbm2ddl" #. Tag: entry +#: configuration.xml:1209 #, no-c-format msgid "Log all SQL DDL statements as they are executed" msgstr "Registra todas as instruções SQL DDL a medida que elas são executadas" -#. Tag: entry -#, no-c-format -msgid "org.hibernate.pretty" +#. Tag: literal +#: configuration.xml:1213 +#, fuzzy, no-c-format +msgid "org.hibernate.pretty" msgstr "org.hibernate.pretty" #. Tag: entry +#: configuration.xml:1215 #, no-c-format msgid "" "Log the state of all entities (max 20 entities) associated with the session " @@ -1998,62 +2439,74 @@ msgstr "" "Registra o estado de todas as entidades (máximo 20 entidades) associadas à " "sessão no momento da liberação (flush)." -#. Tag: entry -#, no-c-format -msgid "org.hibernate.cache" +#. Tag: literal +#: configuration.xml:1220 +#, fuzzy, no-c-format +msgid "org.hibernate.cache" msgstr "org.hibernate.cache" #. Tag: entry +#: configuration.xml:1222 #, no-c-format msgid "Log all second-level cache activity" msgstr "Registra todas as atividades de cachê de segundo nível" -#. Tag: entry -#, no-c-format -msgid "org.hibernate.transaction" +#. Tag: literal +#: configuration.xml:1226 +#, fuzzy, no-c-format +msgid "org.hibernate.transaction" msgstr "org.hibernate.transaction" #. Tag: entry +#: configuration.xml:1228 #, no-c-format msgid "Log transaction related activity" msgstr "Registra atividades relacionada à transação" -#. Tag: entry -#, no-c-format -msgid "org.hibernate.jdbc" +#. Tag: literal +#: configuration.xml:1232 +#, fuzzy, no-c-format +msgid "org.hibernate.jdbc" msgstr "org.hibernate.jdbc" #. Tag: entry +#: configuration.xml:1234 #, no-c-format msgid "Log all JDBC resource acquisition" msgstr "Registra todas as requisições de recursos JDBC" -#. Tag: entry -#, no-c-format -msgid "org.hibernate.hql.ast.AST" +#. Tag: literal +#: configuration.xml:1238 +#, fuzzy, no-c-format +msgid "org.hibernate.hql.ast.AST" msgstr "org.hibernate.hql.ast.AST" #. Tag: entry +#: configuration.xml:1240 #, no-c-format msgid "Log HQL and SQL ASTs during query parsing" msgstr "Registra instruções SQL e HQL durante a análise da consultas" -#. Tag: entry -#, no-c-format -msgid "org.hibernate.secure" +#. Tag: literal +#: configuration.xml:1244 +#, fuzzy, no-c-format +msgid "org.hibernate.secure" msgstr "org.hibernate.secure" #. Tag: entry +#: configuration.xml:1246 #, no-c-format msgid "Log all JAAS authorization requests" msgstr "Registra todas as requisições de autorização JAAS" -#. Tag: entry +#. Tag: literal +#: configuration.xml:1250 #, no-c-format -msgid "org.hibernate" -msgstr "org.hibernate" +msgid "org.hibernate" +msgstr "" #. Tag: entry +#: configuration.xml:1252 #, no-c-format msgid "" "Log everything. This is a lot of information but it is useful for " @@ -2063,6 +2516,7 @@ msgstr "" "de inicialização." #. Tag: para +#: configuration.xml:1259 #, no-c-format msgid "" "When developing applications with Hibernate, you should almost always work " @@ -2076,11 +2530,13 @@ msgstr "" "propriedade hibernate.show_sql habilitada." #. Tag: title +#: configuration.xml:1266 #, no-c-format msgid "Implementing a NamingStrategy" msgstr "Implementando um NamingStrategy" #. Tag: para +#: configuration.xml:1268 #, no-c-format msgid "" "The interface org.hibernate.cfg.NamingStrategy allows you " @@ -2091,6 +2547,7 @@ msgstr "" "elementos de esquema." #. Tag: para +#: configuration.xml:1272 #, no-c-format msgid "" "You can provide rules for automatically generating database identifiers from " @@ -2109,6 +2566,7 @@ msgstr "" "pelo Hibernate é bastante mínima. " #. Tag: para +#: configuration.xml:1279 #, no-c-format msgid "" "You can specify a different strategy by calling Configuration." @@ -2118,7 +2576,19 @@ msgstr "" "Configuration.setNamingStrategy() antes de adicionar os " "mapeamentos: " +#. Tag: programlisting +#: configuration.xml:1283 +#, no-c-format +msgid "" +"SessionFactory sf = new Configuration()\n" +" .setNamingStrategy(ImprovedNamingStrategy.INSTANCE)\n" +" .addFile(\"Item.hbm.xml\")\n" +" .addFile(\"Bid.hbm.xml\")\n" +" .buildSessionFactory();" +msgstr "" + #. Tag: para +#: configuration.xml:1285 #, no-c-format msgid "" "org.hibernate.cfg.ImprovedNamingStrategy is a built-in " @@ -2128,11 +2598,13 @@ msgstr "" "interna que pode ser um ponto inicial útil para algumas aplicações." #. Tag: title +#: configuration.xml:1291 #, no-c-format msgid "XML configuration file" msgstr "Arquivo de configuração XML" #. Tag: para +#: configuration.xml:1293 #, no-c-format msgid "" "An alternative approach to configuration is to specify a full configuration " @@ -2147,6 +2619,7 @@ msgstr "" "propriedades." #. Tag: para +#: configuration.xml:1299 #, no-c-format msgid "" "The XML configuration file is by default expected to be in the root of your " @@ -2155,7 +2628,53 @@ msgstr "" "O arquivo XML de configuração deve ser encontrado na raíz do seu " "CLASSPATH. Veja um exemplo: " +#. Tag: programlisting +#: configuration.xml:1302 +#, no-c-format +msgid "" +"<?xml version='1.0' encoding='utf-8'?>\n" +"<!DOCTYPE hibernate-configuration PUBLIC\n" +" \"-//Hibernate/Hibernate Configuration DTD//EN\"\n" +" \"http://hibernate.sourceforge.net/hibernate-configuration-3.0.dtd" +"\">\n" +"\n" +"<hibernate-configuration>\n" +"\n" +" <!-- a SessionFactory instance listed as /jndi/name -->\n" +" <session-factory\n" +" name=\"java:hibernate/SessionFactory\">\n" +"\n" +" <!-- properties -->\n" +" <property name=\"connection.datasource\">java:/comp/env/jdbc/" +"MyDB</property>\n" +" <property name=\"dialect\">org.hibernate.dialect." +"MySQLDialect</property>\n" +" <property name=\"show_sql\">false</property>\n" +" <property name=\"transaction.factory_class\">\n" +" org.hibernate.transaction.JTATransactionFactory\n" +" </property>\n" +" <property name=\"jta.UserTransaction\">java:comp/" +"UserTransaction</property>\n" +"\n" +" <!-- mapping files -->\n" +" <mapping resource=\"org/hibernate/auction/Item.hbm.xml\"/>\n" +" <mapping resource=\"org/hibernate/auction/Bid.hbm.xml\"/>\n" +"\n" +" <!-- cache settings -->\n" +" <class-cache class=\"org.hibernate.auction.Item\" usage=\"read-" +"write\"/>\n" +" <class-cache class=\"org.hibernate.auction.Bid\" usage=\"read-only" +"\"/>\n" +" <collection-cache collection=\"org.hibernate.auction.Item.bids\" " +"usage=\"read-write\"/>\n" +"\n" +" </session-factory>\n" +"\n" +"</hibernate-configuration>" +msgstr "" + #. Tag: para +#: configuration.xml:1304 #, no-c-format msgid "" "The advantage of this approach is the externalization of the mapping file " @@ -2173,21 +2692,43 @@ msgstr "" "exceto os acima mencionados de usar a sintaxe de XML. " #. Tag: para +#: configuration.xml:1311 #, no-c-format msgid "With the XML configuration, starting Hibernate is then as simple as:" -msgstr "Com a configuração do XML, iniciar o Hibernate é então tão simples quanto: " +msgstr "" +"Com a configuração do XML, iniciar o Hibernate é então tão simples quanto: " + +#. Tag: programlisting +#: configuration.xml:1314 +#, no-c-format +msgid "" +"SessionFactory sf = new Configuration().configure().buildSessionFactory();" +msgstr "" #. Tag: para +#: configuration.xml:1316 #, no-c-format msgid "You can select a different XML configuration file using:" -msgstr "Você poderá escolher um arquivo de configuração XML diferente, utilizando:" +msgstr "" +"Você poderá escolher um arquivo de configuração XML diferente, utilizando:" + +#. Tag: programlisting +#: configuration.xml:1318 +#, no-c-format +msgid "" +"SessionFactory sf = new Configuration()\n" +" .configure(\"catdb.cfg.xml\")\n" +" .buildSessionFactory();" +msgstr "" #. Tag: title +#: configuration.xml:1322 #, no-c-format msgid "J2EE Application Server integration" msgstr "Integração com servidores de aplicação J2EE" #. Tag: para +#: configuration.xml:1324 #, no-c-format msgid "Hibernate has the following integration points for J2EE infrastructure:" msgstr "" @@ -2195,6 +2736,7 @@ msgstr "" "J2EE:" #. Tag: para +#: configuration.xml:1329 #, no-c-format msgid "" "Container-managed datasources: Hibernate can use JDBC " @@ -2217,6 +2759,7 @@ msgstr "" "código portável. " #. Tag: para +#: configuration.xml:1343 #, no-c-format msgid "" "Automatic JNDI binding: Hibernate can bind its " @@ -2227,6 +2770,7 @@ msgstr "" "iniciado." #. Tag: para +#: configuration.xml:1350 #, no-c-format msgid "" "JTA Session binding: the Hibernate SessionJMX deployment: if you have a JMX capable application " @@ -2267,6 +2812,7 @@ msgstr "" "etc.). " #. Tag: para +#: configuration.xml:1373 #, no-c-format msgid "" "Depending on your environment, you might have to set the configuration " @@ -2279,11 +2825,13 @@ msgstr "" "de conexão\"." #. Tag: title +#: configuration.xml:1379 #, no-c-format msgid "Transaction strategy configuration" msgstr "Configuração de estratégia de transação" #. Tag: para +#: configuration.xml:1381 #, no-c-format msgid "" "The Hibernate Session API is independent of any " @@ -2302,6 +2850,7 @@ msgstr "" "necessário. " #. Tag: para +#: configuration.xml:1389 #, no-c-format msgid "" "To keep your code portable between these two (and other) environments we " @@ -2319,26 +2868,31 @@ msgstr "" "literal>." #. Tag: para +#: configuration.xml:1397 #, no-c-format msgid "There are three standard, or built-in, choices:" msgstr "Existem três escolhas, ou internas, padrões: " -#. Tag: term -#, no-c-format -msgid "org.hibernate.transaction.JDBCTransactionFactory" +#. Tag: literal +#: configuration.xml:1401 +#, fuzzy, no-c-format +msgid "org.hibernate.transaction.JDBCTransactionFactory" msgstr "org.hibernate.transaction.JDBCTransactionFactory" #. Tag: para +#: configuration.xml:1404 #, no-c-format msgid "delegates to database (JDBC) transactions (default)" msgstr "delega as transações (JDBC) para bases de dados (Padrão)" -#. Tag: term -#, no-c-format -msgid "org.hibernate.transaction.JTATransactionFactory" +#. Tag: literal +#: configuration.xml:1409 +#, fuzzy, no-c-format +msgid "org.hibernate.transaction.JTATransactionFactory" msgstr "org.hibernate.transaction.JTATransactionFactory" #. Tag: para +#: configuration.xml:1412 #, no-c-format msgid "" "delegates to container-managed transactions if an existing transaction is " @@ -2350,17 +2904,20 @@ msgstr "" "No entanto, uma nova transação será iniciada e serão usadas transações " "controladas por um bean." -#. Tag: term -#, no-c-format -msgid "org.hibernate.transaction.CMTTransactionFactory" +#. Tag: literal +#: configuration.xml:1420 +#, fuzzy, no-c-format +msgid "org.hibernate.transaction.CMTTransactionFactory" msgstr "org.hibernate.transaction.CMTTransactionFactory" #. Tag: para +#: configuration.xml:1423 #, no-c-format msgid "delegates to container-managed JTA transactions" msgstr "delega para um container gerenciador de transações JTA" #. Tag: para +#: configuration.xml:1428 #, no-c-format msgid "" "You can also define your own transaction strategies (for a CORBA transaction " @@ -2370,6 +2927,7 @@ msgstr "" "serviço de transação CORBA, por exemplo)." #. Tag: para +#: configuration.xml:1431 #, no-c-format msgid "" "Some features in Hibernate (i.e., the second level cache, Contextual " @@ -2387,134 +2945,163 @@ msgstr "" "padroniza um mecanismo simples:" #. Tag: title +#: configuration.xml:1439 #, no-c-format msgid "JTA TransactionManagers" msgstr "Gerenciadores de transações JTA" #. Tag: entry +#: configuration.xml:1448 #, no-c-format msgid "Transaction Factory" msgstr "Factory de Transação" #. Tag: entry +#: configuration.xml:1450 #, no-c-format msgid "Application Server" msgstr "Servidor de Aplicação" -#. Tag: entry -#, no-c-format -msgid "org.hibernate.transaction.JBossTransactionManagerLookup" -msgstr "org.hibernate.transaction.JBossTransactionManagerLookup" +#. Tag: literal +#: configuration.xml:1456 +#, fuzzy, no-c-format +msgid "org.hibernate.transaction.JBossTransactionManagerLookup" +msgstr "" +"org.hibernate.transaction.JBossTransactionManagerLookup" #. Tag: entry +#: configuration.xml:1458 #, no-c-format msgid "JBoss" msgstr "JBoss" -#. Tag: entry -#, no-c-format -msgid "org.hibernate.transaction.WeblogicTransactionManagerLookup" -msgstr "org.hibernate.transaction.WeblogicTransactionManagerLookup" +#. Tag: literal +#: configuration.xml:1462 +#, fuzzy, no-c-format +msgid "org.hibernate.transaction.WeblogicTransactionManagerLookup" +msgstr "" +"org.hibernate.transaction.WeblogicTransactionManagerLookup" #. Tag: entry +#: configuration.xml:1464 #, no-c-format msgid "Weblogic" msgstr "Weblogic" -#. Tag: entry -#, no-c-format -msgid "" -"org.hibernate.transaction.WebSphereTransactionManagerLookup" +#. Tag: literal +#: configuration.xml:1468 +#, fuzzy, no-c-format +msgid "org.hibernate.transaction.WebSphereTransactionManagerLookup" msgstr "" "org.hibernate.transaction.WebSphereTransactionManagerLookup" #. Tag: entry +#: configuration.xml:1470 #, no-c-format msgid "WebSphere" msgstr "WebSphere" -#. Tag: entry -#, no-c-format -msgid "" -"org.hibernate.transaction.WebSphereExtendedJTATransactionLookup" +#. Tag: literal +#: configuration.xml:1474 +#, fuzzy, no-c-format +msgid "org.hibernate.transaction.WebSphereExtendedJTATransactionLookup" msgstr "" "org.hibernate.transaction.WebSphereExtendedJTATransactionLookup" #. Tag: entry +#: configuration.xml:1476 #, no-c-format msgid "WebSphere 6" msgstr "WebSphere 6" -#. Tag: entry -#, no-c-format -msgid "org.hibernate.transaction.OrionTransactionManagerLookup" -msgstr "org.hibernate.transaction.OrionTransactionManagerLookup" +#. Tag: literal +#: configuration.xml:1480 +#, fuzzy, no-c-format +msgid "org.hibernate.transaction.OrionTransactionManagerLookup" +msgstr "" +"org.hibernate.transaction.OrionTransactionManagerLookup" #. Tag: entry +#: configuration.xml:1482 #, no-c-format msgid "Orion" msgstr "Orion" -#. Tag: entry -#, no-c-format -msgid "org.hibernate.transaction.ResinTransactionManagerLookup" -msgstr "org.hibernate.transaction.ResinTransactionManagerLookup" +#. Tag: literal +#: configuration.xml:1486 +#, fuzzy, no-c-format +msgid "org.hibernate.transaction.ResinTransactionManagerLookup" +msgstr "" +"org.hibernate.transaction.ResinTransactionManagerLookup" #. Tag: entry +#: configuration.xml:1488 #, no-c-format msgid "Resin" msgstr "Resin" -#. Tag: entry -#, no-c-format -msgid "org.hibernate.transaction.JOTMTransactionManagerLookup" -msgstr "org.hibernate.transaction.JOTMTransactionManagerLookup" +#. Tag: literal +#: configuration.xml:1492 +#, fuzzy, no-c-format +msgid "org.hibernate.transaction.JOTMTransactionManagerLookup" +msgstr "" +"org.hibernate.transaction.JOTMTransactionManagerLookup" #. Tag: entry +#: configuration.xml:1494 #, no-c-format msgid "JOTM" msgstr "JOTM" -#. Tag: entry -#, no-c-format -msgid "org.hibernate.transaction.JOnASTransactionManagerLookup" -msgstr "org.hibernate.transaction.JOnASTransactionManagerLookup" +#. Tag: literal +#: configuration.xml:1498 +#, fuzzy, no-c-format +msgid "org.hibernate.transaction.JOnASTransactionManagerLookup" +msgstr "" +"org.hibernate.transaction.JOnASTransactionManagerLookup" #. Tag: entry +#: configuration.xml:1500 #, no-c-format msgid "JOnAS" msgstr "JOnAS" -#. Tag: entry -#, no-c-format -msgid "org.hibernate.transaction.JRun4TransactionManagerLookup" -msgstr "org.hibernate.transaction.JRun4TransactionManagerLookup" +#. Tag: literal +#: configuration.xml:1504 +#, fuzzy, no-c-format +msgid "org.hibernate.transaction.JRun4TransactionManagerLookup" +msgstr "" +"org.hibernate.transaction.JRun4TransactionManagerLookup" #. Tag: entry +#: configuration.xml:1506 #, no-c-format msgid "JRun4" msgstr "JRun4" -#. Tag: entry -#, no-c-format -msgid "org.hibernate.transaction.BESTransactionManagerLookup" -msgstr "org.hibernate.transaction.BESTransactionManagerLookup" +#. Tag: literal +#: configuration.xml:1510 +#, fuzzy, no-c-format +msgid "org.hibernate.transaction.BESTransactionManagerLookup" +msgstr "" +"org.hibernate.transaction.BESTransactionManagerLookup" #. Tag: entry +#: configuration.xml:1512 #, no-c-format msgid "Borland ES" msgstr "Borland ES" #. Tag: title +#: configuration.xml:1520 #, no-c-format msgid "JNDI-bound SessionFactory" msgstr "SessionFactory vinculada à JNDI" #. Tag: para +#: configuration.xml:1522 #, no-c-format msgid "" "A JNDI-bound Hibernate SessionFactory can simplify the " @@ -2528,6 +3115,7 @@ msgstr "" "literal> ligado a JNDI, simplesmente ambos usam o mesmo registro." #. Tag: para +#: configuration.xml:1528 #, no-c-format msgid "" "If you wish to have the SessionFactory bound to a JNDI " @@ -2546,6 +3134,7 @@ msgstr "" "Tomcat)." #. Tag: para +#: configuration.xml:1536 #, no-c-format msgid "" "When binding the SessionFactory to JNDI, Hibernate will " @@ -2560,6 +3149,7 @@ msgstr "" "InitialContext." #. Tag: para +#: configuration.xml:1542 #, no-c-format msgid "" "Hibernate will automatically place the SessionFactory in " @@ -2577,6 +3167,7 @@ msgstr "" "mais tarde). " #. Tag: para +#: configuration.xml:1550 #, no-c-format msgid "" "If you use a JNDI SessionFactory, an EJB or any other " @@ -2588,7 +3179,8 @@ msgstr "" "localizador JNDI." #. Tag: para -#, no-c-format +#: configuration.xml:1554 +#, fuzzy, no-c-format msgid "" "It is recommended that you bind the SessionFactory to " "JNDI in a managed environment and use a static singleton " @@ -2596,7 +3188,7 @@ msgid "" "recommend to hide the actual lookup code for a SessionFactory in a helper class, such as HibernateUtil.getSessionFactory" "(). Note that such a class is also a convenient way to startup " -"Hibernate—see chapter 1." +"Hibernate—see chapter 1." msgstr "" "Recomendamos que você vincule a SessionFactory ao JNDI em " "um ambiente gerenciado e utilize um singleton static. " @@ -2607,22 +3199,24 @@ msgstr "" "bastante conveniente de inicializar o Hibernate— veja o capítulo 1." #. Tag: title +#: configuration.xml:1565 #, no-c-format msgid "Current Session context management with JTA" msgstr "Gerenciamento de contexto de Sessão atual com JTA" #. Tag: para -#, no-c-format +#: configuration.xml:1567 +#, fuzzy, no-c-format msgid "" "The easiest way to handle Sessions and transactions is " "Hibernate's automatic \"current\" Session management. For " "a discussion of contextual sessions see . Using the \"jta\" session context, if there " +"session\"/>. Using the \"jta\" session context, if there " "is no Hibernate Session associated with the current JTA " "transaction, one will be started and associated with that JTA transaction " "the first time you call sessionFactory.getCurrentSession(). The Sessions retrieved via " -"getCurrentSession() in the\"jta\" " +"getCurrentSession() in the \"jta\" " "context are set to automatically flush before the transaction completes, " "close after the transaction completes, and aggressively release JDBC " "connections after each statement. This allows the Sessioncfg.buildSessionFactory() still has to be " @@ -2676,6 +3272,7 @@ msgstr "" "serviço gerenciado." #. Tag: para +#: configuration.xml:1598 #, no-c-format msgid "" "Hibernate is distributed with org.hibernate.jmx.HibernateServicejboss-service.xml para o JBoss " "4.0.x:" +#. Tag: programlisting +#: configuration.xml:1604 +#, no-c-format +msgid "" +"<?xml version=\"1.0\"?>\n" +"<server>\n" +"\n" +"<mbean code=\"org.hibernate.jmx.HibernateService\"\n" +" name=\"jboss.jca:service=HibernateFactory,name=HibernateFactory\">\n" +"\n" +" <!-- Required services -->\n" +" <depends>jboss.jca:service=RARDeployer</depends>\n" +" <depends>jboss.jca:service=LocalTxCM,name=HsqlDS</depends>\n" +"\n" +" <!-- Bind the Hibernate service to JNDI -->\n" +" <attribute name=\"JndiName\">java:/hibernate/SessionFactory</" +"attribute>\n" +"\n" +" <!-- Datasource settings -->\n" +" <attribute name=\"Datasource\">java:HsqlDS</attribute>\n" +" <attribute name=\"Dialect\">org.hibernate.dialect.HSQLDialect</" +"attribute>\n" +"\n" +" <!-- Transaction integration -->\n" +" <attribute name=\"TransactionStrategy\">\n" +" org.hibernate.transaction.JTATransactionFactory</attribute>\n" +" <attribute name=\"TransactionManagerLookupStrategy\">\n" +" org.hibernate.transaction.JBossTransactionManagerLookup</" +"attribute>\n" +" <attribute name=\"FlushBeforeCompletionEnabled\">true</" +"attribute>\n" +" <attribute name=\"AutoCloseSessionEnabled\">true</" +"attribute>\n" +"\n" +" <!-- Fetching options -->\n" +" <attribute name=\"MaximumFetchDepth\">5</attribute>\n" +"\n" +" <!-- Second-level caching -->\n" +" <attribute name=\"SecondLevelCacheEnabled\">true</" +"attribute>\n" +" <attribute name=\"CacheProviderClass\">org.hibernate.cache." +"EhCacheProvider</attribute>\n" +" <attribute name=\"QueryCacheEnabled\">true</attribute>\n" +"\n" +" <!-- Logging -->\n" +" <attribute name=\"ShowSqlEnabled\">true</attribute>\n" +"\n" +" <!-- Mapping files -->\n" +" <attribute name=\"MapResources\">auction/Item.hbm.xml,auction/" +"Category.hbm.xml</attribute>\n" +"\n" +"</mbean>\n" +"\n" +"</server>" +msgstr "" + #. Tag: para +#: configuration.xml:1606 #, no-c-format msgid "" "This file is deployed in a directory called META-INF and " @@ -2713,3 +3367,17 @@ msgstr "" "Consulte a documentação do JBoss AS para maiores informações sobre o serviço " "JMX e implementação EJB. " +#~ msgid "JDBC URL" +#~ msgstr "JDBC URL" + +#~ msgid "database user" +#~ msgstr "usuário de banco de dados " + +#~ msgid "hibernate.generate_statistics" +#~ msgstr "hibernate.generate_statistics" + +#~ msgid "DB2" +#~ msgstr "DB2" + +#~ msgid "org.hibernate" +#~ msgstr "org.hibernate" diff --git a/documentation/manual/src/main/docbook/pt-BR/content/filters.po b/documentation/manual/src/main/docbook/pt-BR/content/filters.po index 428d36d741..d32fe534b0 100644 --- a/documentation/manual/src/main/docbook/pt-BR/content/filters.po +++ b/documentation/manual/src/main/docbook/pt-BR/content/filters.po @@ -108,7 +108,7 @@ msgid "" msgstr "" "Project-Id-Version: filters\n" "Report-Msgid-Bugs-To: http://bugs.kde.org\n" -"POT-Creation-Date: 2010-02-10T07:25:35\n" +"POT-Creation-Date: 2010-07-20 21:02+0000\n" "PO-Revision-Date: 2009-11-16 15:07+1000\n" "Last-Translator: \n" "Language-Team: \n" @@ -118,11 +118,13 @@ msgstr "" "X-Generator: KBabel 1.11.4\n" #. Tag: title +#: filters.xml:31 #, no-c-format msgid "Filtering data" msgstr "Filtrando dados" #. Tag: para +#: filters.xml:33 #, no-c-format msgid "" "Hibernate3 provides an innovative new approach to handling data with " @@ -136,11 +138,13 @@ msgstr "" "Sessão do Hibernate. " #. Tag: title +#: filters.xml:39 #, no-c-format msgid "Hibernate filters" msgstr "Filtros do Hibernate" #. Tag: para +#: filters.xml:41 #, no-c-format msgid "" "Hibernate3 has the ability to pre-define filter criteria and attach those " @@ -162,9 +166,95 @@ msgstr "" "usados como Views de bancos de dados, mas com parâmetros dentro da aplicação." #. Tag: para +#: filters.xml:50 #, no-c-format msgid "" -"In order to use filters, they must first be defined and then attached to the " +"Using annotatons filters are defined via @org.hibernate.annotations." +"FilterDef or @org.hibernate.annotations.FilterDefs. A filter definition has a name() and an " +"array of parameters(). A parameter will allow you to adjust the behavior of " +"the filter at runtime. Each parameter is defined by a @ParamDef which has a name and a type. You can also define a " +"defaultCondition() parameter for a given " +"@FilterDef to set the default condition to use when none " +"are defined in each individual @Filter. " +"@FilterDef(s) can be defined at the class or package " +"level." +msgstr "" + +#. Tag: para +#: filters.xml:63 +#, no-c-format +msgid "" +"We now need to define the SQL filter clause applied to either the entity " +"load or the collection load. @Filter is used and placed " +"either on the entity or the collection element. The connection between " +"@FilterName and @Filter is a " +"matching name." +msgstr "" + +#. Tag: title +#: filters.xml:70 +#, no-c-format +msgid "@FilterDef and @Filter annotations" +msgstr "" + +#. Tag: programlisting +#: filters.xml:72 +#, no-c-format +msgid "" +"@Entity\n" +"@FilterDef(name=\"minLength\", parameters=@ParamDef( name=\"minLength\", " +"type=\"integer\" ) )\n" +"@Filters( {\n" +" @Filter(name=\"betweenLength\", condition=\":minLength <= length and :" +"maxLength >= length\"),\n" +" @Filter(name=\"minLength\", condition=\":minLength <= length\")\n" +"} )\n" +"public class Forest { ... }" +msgstr "" + +#. Tag: para +#: filters.xml:75 +#, no-c-format +msgid "" +"When the collection use an association table as a relational representation, " +"you might want to apply the filter condition to the association table itself " +"or to the target entity table. To apply the constraint on the target entity, " +"use the regular @Filter annotation. However, if you want " +"to target the association table, use the @FilterJoinTable " +"annotation." +msgstr "" + +#. Tag: title +#: filters.xml:84 +#, no-c-format +msgid "" +"Using @FilterJoinTable for filterting on the " +"association table" +msgstr "" + +#. Tag: programlisting +#: filters.xml:87 +#, no-c-format +msgid "" +"@OneToMany\n" +" @JoinTable\n" +" //filter on the target entity table\n" +" @Filter(name=\"betweenLength\", condition=\":minLength <= length and :" +"maxLength >= length\")\n" +" //filter on the association table\n" +" @FilterJoinTable(name=\"security\", condition=\":userlevel >= " +"requredLevel\")\n" +" public Set<Forest> getForests() { ... }" +msgstr "" + +#. Tag: para +#: filters.xml:90 +#, fuzzy, no-c-format +msgid "" +"Using Hibernate mapping files for defining filters the situtation is very " +"similar. The filters must first be defined and then attached to the " "appropriate mapping elements. To define a filter, use the <" "filter-def/> element within a <hibernate-mapping/" "> element:" @@ -174,22 +264,58 @@ msgstr "" "elemento <filter-def/> dentro do elemento " "<hibernate-mapping/>:" -#. Tag: para +#. Tag: title +#: filters.xml:97 #, no-c-format -msgid "This filter can then be attached to a class:" -msgstr "Esse filtro pode ser acoplado à uma classe:" +msgid "Defining a filter definition via <filter-def>" +msgstr "" + +#. Tag: programlisting +#: filters.xml:100 +#, fuzzy, no-c-format +msgid "" +"<filter-def name=\"myFilter\">\n" +" <filter-param name=\"myFilterParam\" type=\"string\"/>\n" +"</filter-def>" +msgstr "" +"\n" +" \n" +"]]>" #. Tag: para -#, no-c-format -msgid "Or, to a collection:" -msgstr "Ou, à uma coleção:" - -#. Tag: para -#, no-c-format -msgid "Or, to both or multiples of each at the same time." +#: filters.xml:103 +#, fuzzy, no-c-format +msgid "" +"This filter can then be attached to a class or collection (or, to both or " +"multiples of each at the same time):" msgstr "Ou, mesmo para ambos (ou muitos de cada) ao mesmo tempo." +#. Tag: title +#: filters.xml:107 +#, no-c-format +msgid "" +"Attaching a filter to a class or collection using <filter>" +msgstr "" + +#. Tag: programlisting +#: filters.xml:110 +#, no-c-format +msgid "" +"<class name=\"myClass\" ...>\n" +" ...\n" +" <filter name=\"myFilter\" condition=\":myFilterParam = " +"MY_FILTERED_COLUMN\"/>\n" +"\n" +" <set ...>\n" +" <filter name=\"myFilter\" condition=\":myFilterParam = " +"MY_FILTERED_COLUMN\"/>\n" +" </set> \n" +"</class>" +msgstr "" + #. Tag: para +#: filters.xml:113 #, no-c-format msgid "" "The methods on Session are: enableFilter(String " @@ -210,7 +336,18 @@ msgstr "" "interface Filter. Usando o filtro simples definido acima, " "o código se pareceria com o seguinte: " +#. Tag: programlisting +#: filters.xml:123 +#, fuzzy, no-c-format +msgid "" +"session.enableFilter(\"myFilter\").setParameter(\"myFilterParam\", \"some-" +"value\");" +msgstr "" +"" + #. Tag: para +#: filters.xml:125 #, no-c-format msgid "" "Methods on the org.hibernate.Filter interface do allow the method-chaining " @@ -220,6 +357,7 @@ msgstr "" "do método, comum à maioria das funções do Hibernate. " #. Tag: para +#: filters.xml:128 #, no-c-format msgid "" "The following is a full example, using temporal data with an effective " @@ -228,7 +366,79 @@ msgstr "" "Um exemplo completo, usando dados temporais com um padrão de datas de " "registro efetivo:" +#. Tag: programlisting +#: filters.xml:131 +#, fuzzy, no-c-format +msgid "" +"<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 "" +"\n" +" \n" +"\n" +"\n" +"\n" +"...\n" +" \n" +" \n" +" \n" +"...\n" +" \n" +" \n" +"\n" +"\n" +"\n" +"...\n" +" \n" +" \n" +" \n" +" \n" +" \n" +"]]>" + #. Tag: para +#: filters.xml:133 #, no-c-format msgid "" "In order to ensure that you are provided with currently effective records, " @@ -237,7 +447,29 @@ msgstr "" "Para garantir que você sempre tenha registro efetivos, simplesmente habilite " "o filtro na sessão antes de recuperar os dados dos empregados: " +#. Tag: programlisting +#: filters.xml:137 +#, fuzzy, no-c-format +msgid "" +"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();" +msgstr "" +" :" +"targetSalary\")\n" +" .setLong(\"targetSalary\", new Long(1000000))\n" +" .list();\n" +"]]>" + #. Tag: para +#: filters.xml:139 #, no-c-format msgid "" "Even though a salary constraint was mentioned explicitly on the results in " @@ -250,6 +482,7 @@ msgstr "" "os funcionários ativos cujo salário é maior que um milhão de dólares. " #. Tag: para +#: filters.xml:144 #, no-c-format msgid "" "If you want to use filters with outer joining, either through HQL or load " @@ -263,6 +496,7 @@ msgstr "" "primeiro seguido pelo(s) nome(s) da coluna após o operador. " #. Tag: para +#: filters.xml:149 #, no-c-format msgid "" "After being defined, a filter might be attached to multiple entities and/or " @@ -276,7 +510,20 @@ msgstr "" "condições se repetem. Assim, usando o <filter-def/> " "permite denifir uma condição padrão, tanto como uma função quanto CDATA:" +#. Tag: programlisting +#: filters.xml:155 +#, fuzzy, no-c-format +msgid "" +"<filter-def name=\"myFilter\" condition=\"abc > xyz\">...</" +"filter-def>\n" +"<filter-def name=\"myOtherFilter\">abc=xyz</filter-def>" +msgstr "" +" xyz\">...\n" +"abc=xyz]]>" + #. Tag: para +#: filters.xml:157 #, no-c-format msgid "" "This default condition will be used whenever the filter is attached to " @@ -289,14 +536,11 @@ msgstr "" "dar uma condição específica como parte de um anexo de filtro que substitua a " "condição padrão neste caso em particular. " -#~ msgid "" -#~ "\n" -#~ " \n" -#~ "]]>" -#~ msgstr "" -#~ "\n" -#~ " \n" -#~ "]]>" +#~ msgid "This filter can then be attached to a class:" +#~ msgstr "Esse filtro pode ser acoplado à uma classe:" + +#~ msgid "Or, to a collection:" +#~ msgstr "Ou, à uma coleção:" #~ msgid "" #~ "\n" @@ -321,107 +565,3 @@ msgstr "" #~ " \n" #~ "]]>" - -#~ msgid "" -#~ "" -#~ msgstr "" -#~ "" - -#~ msgid "" -#~ "\n" -#~ " \n" -#~ "\n" -#~ "\n" -#~ "\n" -#~ "...\n" -#~ " \n" -#~ " \n" -#~ " \n" -#~ "...\n" -#~ " \n" -#~ " \n" -#~ "\n" -#~ "\n" -#~ "\n" -#~ "...\n" -#~ " \n" -#~ " \n" -#~ " \n" -#~ " \n" -#~ " \n" -#~ "]]>" -#~ msgstr "" -#~ "\n" -#~ " \n" -#~ "\n" -#~ "\n" -#~ "\n" -#~ "...\n" -#~ " \n" -#~ " \n" -#~ " \n" -#~ "...\n" -#~ " \n" -#~ " \n" -#~ "\n" -#~ "\n" -#~ "\n" -#~ "...\n" -#~ " \n" -#~ " \n" -#~ " \n" -#~ " \n" -#~ " \n" -#~ "]]>" - -#~ msgid "" -#~ " :" -#~ "targetSalary\")\n" -#~ " .setLong(\"targetSalary\", new Long(1000000))\n" -#~ " .list();\n" -#~ "]]>" -#~ msgstr "" -#~ " :" -#~ "targetSalary\")\n" -#~ " .setLong(\"targetSalary\", new Long(1000000))\n" -#~ " .list();\n" -#~ "]]>" - -#~ msgid "" -#~ " xyz\">...\n" -#~ "abc=xyz]]>" -#~ msgstr "" -#~ " xyz\">...\n" -#~ "abc=xyz]]>" diff --git a/documentation/manual/src/main/docbook/pt-BR/content/performance.po b/documentation/manual/src/main/docbook/pt-BR/content/performance.po index 2957083521..b027298550 100644 --- a/documentation/manual/src/main/docbook/pt-BR/content/performance.po +++ b/documentation/manual/src/main/docbook/pt-BR/content/performance.po @@ -108,7 +108,7 @@ msgid "" msgstr "" "Project-Id-Version: performance\n" "Report-Msgid-Bugs-To: http://bugs.kde.org\n" -"POT-Creation-Date: 2010-02-11T05:38:15\n" +"POT-Creation-Date: 2010-07-20 21:02+0000\n" "PO-Revision-Date: 2010-03-18 14:45+1000\n" "Last-Translator: \n" "Language-Team: \n" @@ -118,16 +118,19 @@ msgstr "" "X-Generator: KBabel 1.11.4\n" #. Tag: title +#: performance.xml:31 #, no-c-format msgid "Improving performance" msgstr "Aumentando o desempenho" #. Tag: title +#: performance.xml:34 #, no-c-format msgid "Fetching strategies" msgstr "Estratégias de Busca " #. Tag: para +#: performance.xml:36 #, no-c-format msgid "" "Hibernate uses a fetching strategy to retrieve " @@ -142,11 +145,13 @@ msgstr "" "Criteria. " #. Tag: para +#: performance.xml:42 #, no-c-format msgid "Hibernate3 defines the following fetching strategies:" msgstr "Hibernate3 define as seguintes estratégias de busca:" #. Tag: para +#: performance.xml:46 #, no-c-format msgid "" "Join fetching: Hibernate retrieves the associated " @@ -158,6 +163,7 @@ msgstr "" "literal>. " #. Tag: para +#: performance.xml:53 #, no-c-format msgid "" "Select fetching: a second SELECT is " @@ -171,6 +177,7 @@ msgstr "" "esse segundo SELECT será executado apenas quando você acessar a associação. " #. Tag: para +#: performance.xml:61 #, no-c-format msgid "" "Subselect fetching: a second SELECT " @@ -186,6 +193,7 @@ msgstr "" "esse segundo SELECT será executado apenas quando você acessar a associação. " #. Tag: para +#: performance.xml:70 #, no-c-format msgid "" "Batch fetching: an optimization strategy for select " @@ -199,11 +207,13 @@ msgstr "" "primárias ou chaves externas." #. Tag: para +#: performance.xml:77 #, no-c-format msgid "Hibernate also distinguishes between:" msgstr "O Hibernate distingue também entre:" #. Tag: para +#: performance.xml:81 #, no-c-format msgid "" "Immediate fetching: an association, collection or " @@ -213,6 +223,7 @@ msgstr "" "é imediatamente recuperada, quando o proprietário for carregado. " #. Tag: para +#: performance.xml:87 #, no-c-format msgid "" "Lazy collection fetching: a collection is fetched when " @@ -224,6 +235,7 @@ msgstr "" "para coleções." #. Tag: para +#: performance.xml:93 #, no-c-format msgid "" "\"Extra-lazy\" collection fetching: individual elements " @@ -238,6 +250,7 @@ msgstr "" "muito grandes." #. Tag: para +#: performance.xml:101 #, no-c-format msgid "" "Proxy fetching: a single-valued association is fetched " @@ -249,6 +262,7 @@ msgstr "" "objeto associado." #. Tag: para +#: performance.xml:107 #, no-c-format msgid "" "\"No-proxy\" fetching: a single-valued association is " @@ -266,6 +280,7 @@ msgstr "" "requer instrumentação de bytecodes em build-time e é raramente necessário." #. Tag: para +#: performance.xml:117 #, no-c-format msgid "" "Lazy attribute fetching: an attribute or single valued " @@ -277,6 +292,7 @@ msgstr "" "requer instrumentação de bytecodes em build-time e é raramente necessário." #. Tag: para +#: performance.xml:124 #, no-c-format msgid "" "We have two orthogonal notions here: when is the " @@ -294,11 +310,13 @@ msgstr "" "classe particular." #. Tag: title +#: performance.xml:132 #, no-c-format msgid "Working with lazy associations" msgstr "Trabalhando com associações preguiçosas (lazy)" #. Tag: para +#: performance.xml:134 #, no-c-format msgid "" "By default, Hibernate3 uses lazy select fetching for collections and lazy " @@ -310,6 +328,7 @@ msgstr "" "sentido para quase todas as associações em quase todas a aplicações. " #. Tag: para +#: performance.xml:138 #, no-c-format msgid "" "If you set hibernate.default_batch_fetch_size, Hibernate " @@ -321,6 +340,7 @@ msgstr "" "otimização pode ser também habilitada em um nível mais fino." #. Tag: para +#: performance.xml:142 #, no-c-format msgid "" "Please be aware that access to a lazy association outside of the context of " @@ -329,7 +349,25 @@ msgstr "" "Perceba que o acesso a associações preguiçosas fora do contexto de uma " "sessão aberta do Hibernate irá resultar numa exceção. Por exemplo:" +#. Tag: programlisting +#: performance.xml:146 +#, no-c-format +msgid "" +"s = sessions.openSession();\n" +"Transaction tx = s.beginTransaction();\n" +" \n" +"User u = (User) s.createQuery(\"from User u where u.name=:userName\")\n" +" .setString(\"userName\", userName).uniqueResult();\n" +"Map permissions = u.getPermissions();\n" +"\n" +"tx.commit();\n" +"s.close();\n" +"\n" +"Integer accessLevel = (Integer) permissions.get(\"accounts\"); // Error!" +msgstr "" + #. Tag: para +#: performance.xml:148 #, no-c-format msgid "" "Since the permissions collection was not initialized when the " @@ -345,6 +383,7 @@ msgstr "" "que carrega a coleção para logo antes da transação ser submetida. " #. Tag: para +#: performance.xml:155 #, no-c-format msgid "" "Alternatively, you can use a non-lazy collection or association, by " @@ -362,6 +401,7 @@ msgstr "" "precisar buscar no banco de dados inteiro da memória em cada transação." #. Tag: para +#: performance.xml:162 #, no-c-format msgid "" "On the other hand, you can use join fetching, which is non-lazy by nature, " @@ -377,11 +417,13 @@ msgstr "" "para as associações de valor único e para coleções." #. Tag: title +#: performance.xml:170 #, no-c-format msgid "Tuning fetch strategies" msgstr "Personalizando as estratégias de busca" #. Tag: para +#: performance.xml:172 #, no-c-format msgid "" "Select fetching (the default) is extremely vulnerable to N+1 selects " @@ -390,7 +432,25 @@ msgstr "" "O padrão selecionar busca, é extremamente vunerável aos problemas de seleção " "N+1, então habilitaremos a busca de união no documento de mapeamento:" +#. Tag: programlisting +#: performance.xml:176 +#, no-c-format +msgid "" +"<set name=\"permissions\"\n" +" fetch=\"join\">\n" +" <key column=\"userId\"/>\n" +" <one-to-many class=\"Permission\"/>\n" +"</set" +msgstr "" + +#. Tag: programlisting +#: performance.xml:178 +#, no-c-format +msgid "<many-to-one name=\"mother\" class=\"Cat\" fetch=\"join\"/>" +msgstr "" + #. Tag: para +#: performance.xml:180 #, no-c-format msgid "" "The fetch strategy defined in the mapping document " @@ -400,27 +460,32 @@ msgstr "" "afeta:" #. Tag: para +#: performance.xml:185 #, no-c-format msgid "retrieval via get() or load()" msgstr "recupera via get() ou load()" #. Tag: para +#: performance.xml:190 #, no-c-format msgid "retrieval that happens implicitly when an association is navigated" msgstr "" "Recuperações que acontecem implicitamente quando navegamos por uma associação" #. Tag: para +#: performance.xml:195 #, no-c-format msgid "Criteria queries" msgstr "consultas por Criteria " #. Tag: para +#: performance.xml:199 #, no-c-format msgid "HQL queries if subselect fetching is used" msgstr "consultas HQL se a busca por subselect for usada" #. Tag: para +#: performance.xml:204 #, no-c-format msgid "" "Irrespective of the fetching strategy you use, the defined non-lazy graph is " @@ -433,6 +498,7 @@ msgstr "" "HQL em particular." #. Tag: para +#: performance.xml:209 #, no-c-format msgid "" "Usually, the mapping document is not used to customize fetching. Instead, we " @@ -450,6 +516,7 @@ msgstr "" "literal>, você irá usar setFetchMode(FetchMode.JOIN)." #. Tag: para +#: performance.xml:216 #, no-c-format msgid "" "If you want to change the fetching strategy used by get() " @@ -460,7 +527,18 @@ msgstr "" "literal> ou load(), simplesmente use uma consulta por " "Criteria, por exemplo: " +#. Tag: programlisting +#: performance.xml:220 +#, no-c-format +msgid "" +"User user = (User) session.createCriteria(User.class)\n" +" .setFetchMode(\"permissions\", FetchMode.JOIN)\n" +" .add( Restrictions.idEq(userId) )\n" +" .uniqueResult();" +msgstr "" + #. Tag: para +#: performance.xml:222 #, no-c-format msgid "" "This is Hibernate's equivalent of what some ORM solutions call a \"fetch plan" @@ -470,6 +548,7 @@ msgstr "" "\"plano de busca\"." #. Tag: para +#: performance.xml:225 #, no-c-format msgid "" "A completely different approach to problems with N+1 selects is to use the " @@ -479,11 +558,13 @@ msgstr "" "cache de segundo nível. " #. Tag: title +#: performance.xml:230 #, no-c-format msgid "Single-ended association proxies" msgstr "Proxies de associação final único" #. Tag: para +#: performance.xml:232 #, no-c-format msgid "" "Lazy fetching for collections is implemented using Hibernate's own " @@ -502,6 +583,7 @@ msgstr "" "biblioteca CGLIB. " #. Tag: para +#: performance.xml:239 #, no-c-format msgid "" "At startup, Hibernate3 generates proxies by default for all persistent " @@ -513,6 +595,7 @@ msgstr "" "associações many-to-one e one-to-one. " #. Tag: para +#: performance.xml:244 #, no-c-format msgid "" "The mapping file may declare an interface to use as the proxy interface for " @@ -529,6 +612,7 @@ msgstr "" "todas as classes persistentes." #. Tag: para +#: performance.xml:251 #, no-c-format msgid "" "There are potential problems to note when extending this approach to " @@ -537,7 +621,20 @@ msgstr "" "Existe alguns truques que você deve saber quando estender esse comportamento " "para classes polimórficas. Por exemplo:" +#. Tag: programlisting +#: performance.xml:254 +#, no-c-format +msgid "" +"<class name=\"Cat\" proxy=\"Cat\">\n" +" ......\n" +" <subclass name=\"DomesticCat\">\n" +" .....\n" +" </subclass>\n" +"</class>" +msgstr "" + #. Tag: para +#: performance.xml:256 #, no-c-format msgid "" "Firstly, instances of Cat will never be castable to " @@ -548,12 +645,39 @@ msgstr "" "para DomesticCat, mesmo que a instância em questão seja " "uma instância de DomesticCat:" +#. Tag: programlisting +#: performance.xml:260 +#, no-c-format +msgid "" +"Cat cat = (Cat) session.load(Cat.class, id); // instantiate a proxy (does " +"not hit the db)\n" +"if ( cat.isDomesticCat() ) { // hit the db to initialize " +"the proxy\n" +" DomesticCat dc = (DomesticCat) cat; // Error!\n" +" ....\n" +"}" +msgstr "" + #. Tag: para +#: performance.xml:262 #, no-c-format msgid "Secondly, it is possible to break proxy ==:" msgstr "E, segundo, é possível quebrar o proxy ==:" +#. Tag: programlisting +#: performance.xml:265 +#, no-c-format +msgid "" +"Cat cat = (Cat) session.load(Cat.class, id); // instantiate a Cat " +"proxy\n" +"DomesticCat dc = \n" +" (DomesticCat) session.load(DomesticCat.class, id); // acquire new " +"DomesticCat proxy!\n" +"System.out.println(cat==dc); // false" +msgstr "" + #. Tag: para +#: performance.xml:267 #, no-c-format msgid "" "However, the situation is not quite as bad as it looks. Even though we now " @@ -564,7 +688,16 @@ msgstr "" "referências para objetos proxies diferentes, a instância adjacente será do " "mesmo objeto:" +#. Tag: programlisting +#: performance.xml:271 +#, no-c-format +msgid "" +"cat.setWeight(11.0); // hit the db to initialize the proxy\n" +"System.out.println( dc.getWeight() ); // 11.0" +msgstr "" + #. Tag: para +#: performance.xml:273 #, no-c-format msgid "" "Third, you cannot use a CGLIB proxy for a final class or " @@ -574,6 +707,7 @@ msgstr "" "final ou com quaisquer métodos final." #. Tag: para +#: performance.xml:276 #, no-c-format msgid "" "Finally, if your persistent object acquires any resources upon instantiation " @@ -587,6 +721,7 @@ msgstr "" "subclasse da classe persistente. " #. Tag: para +#: performance.xml:281 #, no-c-format msgid "" "These problems are all due to fundamental limitations in Java's single " @@ -605,7 +740,20 @@ msgstr "" "literal> e DomesticCatImpl implementa a interface " "DomesticCat. Por exemplo: " +#. Tag: programlisting +#: performance.xml:289 +#, no-c-format +msgid "" +"<class name=\"CatImpl\" proxy=\"Cat\">\n" +" ......\n" +" <subclass name=\"DomesticCatImpl\" proxy=\"DomesticCat\">\n" +" .....\n" +" </subclass>\n" +"</class>" +msgstr "" + #. Tag: para +#: performance.xml:291 #, no-c-format msgid "" "Then proxies for instances of Cat and " @@ -616,17 +764,30 @@ msgstr "" "DomesticCat podem ser retornadas pelo load() ou iterate()." +#. Tag: programlisting +#: performance.xml:295 +#, no-c-format +msgid "" +"Cat cat = (Cat) session.load(CatImpl.class, catid);\n" +"Iterator iter = session.createQuery(\"from CatImpl as cat where cat." +"name='fritz'\").iterate();\n" +"Cat fritz = (Cat) iter.next();" +msgstr "" + #. Tag: title +#: performance.xml:298 #, no-c-format msgid "Note" msgstr "Nota" #. Tag: para +#: performance.xml:300 #, no-c-format msgid "list() does not usually return proxies." msgstr "list() normalmente retorna proxies." #. Tag: para +#: performance.xml:304 #, no-c-format msgid "" "Relationships are also lazily initialized. This means you must declare any " @@ -638,6 +799,7 @@ msgstr "" "Cat, e não CatImpl." #. Tag: para +#: performance.xml:308 #, no-c-format msgid "" "Certain operations do not require proxy initialization:" @@ -645,6 +807,7 @@ msgstr "" "Algumas operações não requerem inicialização por proxy: " #. Tag: para +#: performance.xml:313 #, no-c-format msgid "" "equals(): if the persistent class does not override " @@ -654,6 +817,7 @@ msgstr "" "equals()" #. Tag: para +#: performance.xml:318 #, no-c-format msgid "" "hashCode(): if the persistent class does not override " @@ -663,11 +827,13 @@ msgstr "" "hashCode()" #. Tag: para +#: performance.xml:323 #, no-c-format msgid "The identifier getter method" msgstr "O método getter do identificador" #. Tag: para +#: performance.xml:327 #, no-c-format msgid "" "Hibernate will detect persistent classes that override equals()equals() ou hashCode()." #. Tag: para +#: performance.xml:330 #, no-c-format msgid "" "By choosing lazy=\"no-proxy\" instead of the default " @@ -691,11 +858,13 @@ msgstr "" "imediatas. " #. Tag: title +#: performance.xml:338 #, no-c-format msgid "Initializing collections and proxies" msgstr "Inicializando coleções e proxies" #. Tag: para +#: performance.xml:340 #, no-c-format msgid "" "A LazyInitializationException will be thrown by Hibernate " @@ -709,6 +878,7 @@ msgstr "" "ou que possua a referência ao proxy estiver no estado desanexado. " #. Tag: para +#: performance.xml:346 #, no-c-format msgid "" "Sometimes a proxy or collection needs to be initialized before closing the " @@ -724,6 +894,7 @@ msgstr "" "confuso para quem lê o código e não é conveniente para códigos genéricos. " #. Tag: para +#: performance.xml:353 #, no-c-format msgid "" "The static methods Hibernate.initialize() and " @@ -743,6 +914,7 @@ msgstr "" "literal> tem um efeito similar para a coleção de kittens. " #. Tag: para +#: performance.xml:362 #, no-c-format msgid "" "Another option is to keep the Session open until all " @@ -763,6 +935,7 @@ msgstr "" "problema: " #. Tag: para +#: performance.xml:372 #, no-c-format msgid "" "In a web-based application, a servlet filter can be used to close the " @@ -786,6 +959,7 @@ msgstr "" "View\"." #. Tag: para +#: performance.xml:385 #, no-c-format msgid "" "In an application with a separate business tier, the business logic must " @@ -814,6 +988,7 @@ msgstr "" "emphasis>. " #. Tag: para +#: performance.xml:401 #, no-c-format msgid "" "You can also attach a previously loaded object to a new SessioncreateFilter() method is also used to efficiently " @@ -857,12 +1043,22 @@ msgstr "" "algus dados de uma coleção eficientemente sem precisar inicializar a coleção " "inteira:" +#. Tag: programlisting +#: performance.xml:423 +#, no-c-format +msgid "" +"s.createFilter( lazyCollection, \"\").setFirstResult(0).setMaxResults(10)." +"list();" +msgstr "" + #. Tag: title +#: performance.xml:427 #, no-c-format msgid "Using batch fetching" msgstr "Usando busca em lote" #. Tag: para +#: performance.xml:429 #, no-c-format msgid "" "Using batch fetching, Hibernate can load several uninitialized proxies if " @@ -877,6 +1073,7 @@ msgstr "" "da classe ou no nível da coleção." #. Tag: para +#: performance.xml:434 #, no-c-format msgid "" "Batch fetching for classes/entities is easier to understand. Consider the " @@ -902,7 +1099,14 @@ msgstr "" "melhorar esse comportamento especificando um batch-size " "no mapeamento da classe Person: " +#. Tag: programlisting +#: performance.xml:447 +#, no-c-format +msgid "<class name=\"Person\" batch-size=\"10\">...</class>" +msgstr "" + #. Tag: para +#: performance.xml:449 #, no-c-format msgid "" "Hibernate will now execute only three queries: the pattern is 10, 10, 5." @@ -910,6 +1114,7 @@ msgstr "" "O Hibernate irá executar agora apenas três consultas; o padrão é 10, 10, 5." #. Tag: para +#: performance.xml:452 #, no-c-format msgid "" "You can also enable batch fetching of collections. For example, if each " @@ -929,7 +1134,19 @@ msgstr "" "mapeamento da classe Person, o Hibernate pode fazer uma " "pré carga das coleções:" +#. Tag: programlisting +#: performance.xml:461 +#, no-c-format +msgid "" +"<class name=\"Person\">\n" +" <set name=\"cats\" batch-size=\"3\">\n" +" ...\n" +" </set>\n" +"</class>" +msgstr "" + #. Tag: para +#: performance.xml:463 #, no-c-format msgid "" "With a batch-size of 3, Hibernate will load 3, 3, 3, 1 " @@ -943,6 +1160,7 @@ msgstr "" "Session." #. Tag: para +#: performance.xml:468 #, no-c-format msgid "" "Batch fetching of collections is particularly useful if you have a nested " @@ -957,11 +1175,13 @@ msgstr "" "leitura." #. Tag: title +#: performance.xml:475 #, no-c-format msgid "Using subselect fetching" msgstr "Usando busca de subseleção" #. Tag: para +#: performance.xml:477 #, no-c-format msgid "" "If one lazy collection or single-valued proxy has to be fetched, Hibernate " @@ -973,19 +1193,21 @@ msgstr "" "funciona da mesma maneira que busca em lote, sem carregar tanto." #. Tag: title +#: performance.xml:486 #, no-c-format msgid "Fetch profiles" msgstr "Perfis de Busca " #. Tag: para -#, no-c-format +#: performance.xml:488 +#, fuzzy, no-c-format msgid "" "Another way to affect the fetching strategy for loading associated objects " "is through something called a fetch profile, which is a named configuration " "associated with the org.hibernate.SessionFactory but enabled, by name, on the org.hibernate." "Session. Once enabled on a org.hibernate." -"Session, the fetch profile wull be in affect for that " +"Session, the fetch profile will be in affect for that " "org.hibernate.Session until it is explicitly " "disabled." msgstr "" @@ -999,16 +1221,109 @@ msgstr "" "completamente desativado." #. Tag: para -#, no-c-format +#: performance.xml:498 +#, fuzzy, no-c-format msgid "" -"So what does that mean? Well lets explain that by way of an example. Say we " -"have the following mappings:" +"So what does that mean? Well lets explain that by way of an example which " +"show the different available approaches to configure a fetch profile:" msgstr "" "O que isto significa? A explicação será através de um exemplo. Vamos dizer " "que nós temos os seguintes mapeamentos:" -#. Tag: para +#. Tag: title +#: performance.xml:503 #, no-c-format +msgid "Specifying a fetch profile using @FetchProfile" +msgstr "" + +#. Tag: programlisting +#: performance.xml:506 +#, no-c-format +msgid "" +"@Entity\n" +"@FetchProfile(name = \"customer-with-orders\", fetchOverrides = {\n" +" @FetchProfile.FetchOverride(entity = Customer.class, association = " +"\"orders\", mode = FetchMode.JOIN)\n" +"})\n" +"public class Customer {\n" +" @Id\n" +" @GeneratedValue\n" +" private long id;\n" +"\n" +" private String name;\n" +"\n" +" private long customerNumber;\n" +"\n" +" @OneToMany\n" +" private Set<Order> orders;\n" +"\n" +" // standard getter/setter\n" +" ...\n" +"}" +msgstr "" + +#. Tag: title +#: performance.xml:510 +#, no-c-format +msgid "" +"Specifying a fetch profile using <fetch-profile> " +"outside <class> node" +msgstr "" + +#. Tag: programlisting +#: performance.xml:514 +#, no-c-format +msgid "" +"<hibernate-mapping>\n" +" <class name=\"Customer\">\n" +" ...\n" +" <set name=\"orders\" inverse=\"true\">\n" +" <key column=\"cust_id\"/>\n" +" <one-to-many class=\"Order\"/>\n" +" </set>\n" +" </class>\n" +" <class name=\"Order\">\n" +" ...\n" +" </class>\n" +" <fetch-profile name=\"customer-with-orders\">\n" +" <fetch entity=\"Customer\" association=\"orders\" style=\"join\"/" +">\n" +" </fetch-profile>\n" +"</hibernate-mapping>" +msgstr "" + +#. Tag: title +#: performance.xml:518 +#, no-c-format +msgid "" +"Specifying a fetch profile using <fetch-profile> " +"inside <class> node" +msgstr "" + +#. Tag: programlisting +#: performance.xml:522 +#, no-c-format +msgid "" +"<hibernate-mapping>\n" +" <class name=\"Customer\">\n" +" ...\n" +" <set name=\"orders\" inverse=\"true\">\n" +" <key column=\"cust_id\"/>\n" +" <one-to-many class=\"Order\"/>\n" +" </set>\n" +" <fetch-profile name=\"customer-with-orders\">\n" +" <fetch association=\"orders\" style=\"join\"/>\n" +" </fetch-profile>\n" +" </class>\n" +" <class name=\"Order\">\n" +" ...\n" +" </class>\n" +"</hibernate-mapping>" +msgstr "" + +#. Tag: para +#: performance.xml:525 +#, fuzzy, no-c-format msgid "" "Now normally when you get a reference to a particular customer, that " "customer's set of orders will be lazy meaning we will not yet have loaded " @@ -1016,8 +1331,8 @@ msgid "" "that you have a certain use case where it is more efficient to load the " "customer and their orders together. One way certainly is to use \"dynamic " "fetching\" strategies via an HQL or criteria queries. But another option is " -"to use a fetch profile to achieve that. Just add the following to your " -"mapping:" +"to use a fetch profile to achieve that. The following code will load both " +"the customer andtheir orders:" msgstr "" "Normalmente, quando você recebe uma referência para um cliente em " "particular, o conjunto do cliente de pedidos será lento, significando que " @@ -1029,21 +1344,35 @@ msgstr "" "um perfil de busca para atingir o mesmo objeto. Apenas adicione o seguinte a " "seu mapeamento:" -#. Tag: para +#. Tag: title +#: performance.xml:536 #, no-c-format -msgid "or even:" -msgstr "ou ainda:" +msgid "Activating a fetch profile for a given Session" +msgstr "" -#. Tag: para +#. Tag: programlisting +#: performance.xml:539 #, no-c-format msgid "" -"Now the following code will actually load both the customer and " -"their orders:" +"Session session = ...;\n" +"session.enableFetchProfile( \"customer-with-orders\" ); // name matches " +"from mapping\n" +"Customer customer = (Customer) session.get( Customer.class, customerId );" msgstr "" -"Agora que o código seguinte irá carregar ambos cliente e outros " -"pedidos:" #. Tag: para +#: performance.xml:543 +#, no-c-format +msgid "" +"@FetchProfile definitions are global and it does not " +"matter on which class you place them. You can place the " +"@FetchProfile annotation either onto a class or " +"package (package-info.java). In order to define multiple fetch profiles for " +"the same class or package @FetchProfiles can be used." +msgstr "" + +#. Tag: para +#: performance.xml:551 #, no-c-format msgid "" "Currently only join style fetch profiles are supported, but they plan is to " @@ -1055,11 +1384,13 @@ msgstr "" "projects/hibernate/browse/HHH-3414\">HHH-3414 para maiores detalhes." #. Tag: title +#: performance.xml:558 #, no-c-format msgid "Using lazy property fetching" msgstr "Usando busca preguiçosa de propriedade" #. Tag: para +#: performance.xml:560 #, no-c-format msgid "" "Hibernate3 supports the lazy fetching of individual properties. This " @@ -1079,6 +1410,7 @@ msgstr "" "colunas e o modelo de dados não pode ser melhorado." #. Tag: para +#: performance.xml:568 #, no-c-format msgid "" "To enable lazy property loading, set the lazy attribute " @@ -1087,7 +1419,24 @@ msgstr "" "Para habilitar a carga de propriedade lazy, é preciso ajustar a função " "lazy no seu mapeamento de propriedade:" +#. Tag: programlisting +#: performance.xml:571 +#, no-c-format +msgid "" +"<class name=\"Document\">\n" +" <id name=\"id\">\n" +" <generator class=\"native\"/>\n" +" </id>\n" +" <property name=\"name\" not-null=\"true\" length=\"50\"/>\n" +" <property name=\"summary\" not-null=\"true\" length=\"200\" lazy=" +"\"true\"/>\n" +" <property name=\"text\" not-null=\"true\" length=\"2000\" lazy=\"true" +"\"/>\n" +"</class>" +msgstr "" + #. Tag: para +#: performance.xml:573 #, no-c-format msgid "" "Lazy property loading requires buildtime bytecode instrumentation. If your " @@ -1099,11 +1448,34 @@ msgstr "" "silenciosamente essa configuração e usará a busca imediata." #. Tag: para +#: performance.xml:577 #, no-c-format msgid "For bytecode instrumentation, use the following Ant task:" msgstr "Para instrumentação de bytecode, use a seguinte tarefa do Ant:" +#. Tag: programlisting +#: performance.xml:579 +#, no-c-format +msgid "" +"<target name=\"instrument\" depends=\"compile\">\n" +" <taskdef name=\"instrument\" classname=\"org.hibernate.tool." +"instrument.InstrumentTask\">\n" +" <classpath path=\"${jar.path}\"/>\n" +" <classpath path=\"${classes.dir}\"/>\n" +" <classpath refid=\"lib.class.path\"/>\n" +" </taskdef>\n" +"\n" +" <instrument verbose=\"true\">\n" +" <fileset dir=\"${testclasses.dir}/org/hibernate/auction/model" +"\">\n" +" <include name=\"*.class\"/>\n" +" </fileset>\n" +" </instrument>\n" +"</target>" +msgstr "" + #. Tag: para +#: performance.xml:581 #, no-c-format msgid "" "A different way of avoiding unnecessary column reads, at least for read-only " @@ -1117,6 +1489,7 @@ msgstr "" "bytecode em build-time e é certamente uma melhor solução." #. Tag: para +#: performance.xml:586 #, no-c-format msgid "" "You can force the usual eager fetching of properties using fetch " @@ -1126,11 +1499,13 @@ msgstr "" "buscar todas as propriedades no HQL." #. Tag: title +#: performance.xml:592 #, no-c-format msgid "The Second Level Cache" msgstr "O Cachê de Segundo Nível" #. Tag: para +#: performance.xml:594 #, no-c-format msgid "" "A Hibernate Session is a transaction-level cache of " @@ -1150,15 +1525,17 @@ msgstr "" "ser configurados para dados em cache vencido regularmente." #. Tag: para -#, no-c-format +#: performance.xml:602 +#, fuzzy, no-c-format msgid "" "You have the option to tell Hibernate which caching implementation to use by " "specifying the name of a class that implements org.hibernate.cache." "CacheProvider using the property hibernate.cache." "provider_class. Hibernate is bundled with a number of built-in " -"integrations with the open-source cache providers that are listed below. You " -"can also implement your own and plug it in as outlined above. Note that " -"versions prior to 3.2 use EhCache as the default cache provider." +"integrations with the open-source cache providers that are listed in . You can also implement your own and plug it in " +"as outlined above. Note that versions prior to Hibernate 3.2 use EhCache as " +"the default cache provider." msgstr "" "Você tem a opção de informar o Hibernate sobre qual implementação de cache " "utilizar, especificando o nome de uma classe que implementa org." @@ -1170,155 +1547,396 @@ msgstr "" "utilizam EhCache como provedor de cache padrão. " #. Tag: title +#: performance.xml:613 #, no-c-format msgid "Cache Providers" msgstr "Provedores de Cache " #. Tag: entry +#: performance.xml:628 performance.xml:976 #, no-c-format msgid "Cache" msgstr "Cache" #. Tag: entry +#: performance.xml:630 #, no-c-format msgid "Provider class" msgstr "Classe de provedor" #. Tag: entry +#: performance.xml:632 #, no-c-format msgid "Type" msgstr "Tipo" #. Tag: entry +#: performance.xml:634 #, no-c-format msgid "Cluster Safe" msgstr "Segurança de Cluster" #. Tag: entry +#: performance.xml:636 #, no-c-format msgid "Query Cache Supported" msgstr "Cache de Consulta Suportado" #. Tag: entry +#: performance.xml:642 performance.xml:990 #, no-c-format msgid "Hashtable (not intended for production use)" msgstr "Hashtable (não recomendado para uso de produção)" -#. Tag: entry -#, no-c-format -msgid "org.hibernate.cache.HashtableCacheProvider" +#. Tag: literal +#: performance.xml:644 +#, fuzzy, no-c-format +msgid "org.hibernate.cache.HashtableCacheProvider" msgstr "org.hibernate.cache.HashtableCacheProvider" #. Tag: entry +#: performance.xml:646 #, no-c-format msgid "memory" msgstr "memória" #. Tag: entry +#: performance.xml:650 performance.xml:662 performance.xml:674 +#: performance.xml:992 performance.xml:994 performance.xml:996 +#: performance.xml:1004 performance.xml:1006 performance.xml:1008 +#: performance.xml:1016 performance.xml:1018 performance.xml:1020 +#: performance.xml:1028 performance.xml:1030 performance.xml:1040 +#: performance.xml:1046 performance.xml:1052 performance.xml:1058 #, no-c-format -msgid "yes" -msgstr "sim" +msgid "yes" +msgstr "" #. Tag: entry +#: performance.xml:654 performance.xml:1002 #, no-c-format msgid "EHCache" msgstr "EHCache" -#. Tag: entry -#, no-c-format -msgid "org.hibernate.cache.EhCacheProvider" +#. Tag: literal +#: performance.xml:656 +#, fuzzy, no-c-format +msgid "org.hibernate.cache.EhCacheProvider" msgstr "org.hibernate.cache.EhCacheProvider" #. Tag: entry +#: performance.xml:658 performance.xml:670 #, no-c-format msgid "memory, disk" msgstr "memória, disco" #. Tag: entry +#: performance.xml:666 performance.xml:1014 #, no-c-format msgid "OSCache" msgstr "OSCache" -#. Tag: entry -#, no-c-format -msgid "org.hibernate.cache.OSCacheProvider" +#. Tag: literal +#: performance.xml:668 +#, fuzzy, no-c-format +msgid "org.hibernate.cache.OSCacheProvider" msgstr "org.hibernate.cache.OSCacheProvider" #. Tag: entry +#: performance.xml:678 performance.xml:1026 #, no-c-format msgid "SwarmCache" msgstr "SwarmCache" -#. Tag: entry -#, no-c-format -msgid "org.hibernate.cache.SwarmCacheProvider" +#. Tag: literal +#: performance.xml:680 +#, fuzzy, no-c-format +msgid "org.hibernate.cache.SwarmCacheProvider" msgstr "org.hibernate.cache.SwarmCacheProvider" #. Tag: entry +#: performance.xml:682 #, no-c-format msgid "clustered (ip multicast)" msgstr "clustered (ip multicast)" #. Tag: entry +#: performance.xml:684 #, no-c-format msgid "yes (clustered invalidation)" msgstr "sim (invalidação em cluster)" #. Tag: entry +#: performance.xml:690 performance.xml:1038 #, no-c-format msgid "JBoss Cache 1.x" msgstr "JBoss Cache 1.x" -#. Tag: entry -#, no-c-format -msgid "org.hibernate.cache.TreeCacheProvider" +#. Tag: literal +#: performance.xml:692 +#, fuzzy, no-c-format +msgid "org.hibernate.cache.TreeCacheProvider" msgstr "org.hibernate.cache.TreeCacheProvider" #. Tag: entry +#: performance.xml:694 performance.xml:706 #, no-c-format msgid "clustered (ip multicast), transactional" msgstr "(ip multicast) em cluster, transacional" #. Tag: entry +#: performance.xml:696 #, no-c-format msgid "yes (replication)" msgstr "sim (replicação)" #. Tag: entry +#: performance.xml:698 performance.xml:710 #, no-c-format msgid "yes (clock sync req.)" msgstr "sim (solicitação de sync. de relógio)" #. Tag: entry +#: performance.xml:702 performance.xml:1050 #, no-c-format msgid "JBoss Cache 2" msgstr "JBoss Cache 2" -#. Tag: entry -#, no-c-format -msgid "org.hibernate.cache.jbc.JBossCacheRegionFactory" +#. Tag: literal +#: performance.xml:704 +#, fuzzy, no-c-format +msgid "org.hibernate.cache.jbc.JBossCacheRegionFactory" msgstr "org.hibernate.cache.jbc.JBossCacheRegionFactory" #. Tag: entry +#: performance.xml:708 #, no-c-format msgid "yes (replication or invalidation)" msgstr "sim (invalidação ou replicação)" #. Tag: title +#: performance.xml:717 #, no-c-format msgid "Cache mappings" msgstr "Mapeamento de Cache" #. Tag: para +#: performance.xml:719 #, no-c-format msgid "" -"The <cache> element of a class or collection " -"mapping has the following form:" +"As we have done in previous chapters we are looking at the two different " +"possibiltites to configure caching. First configuration via annotations and " +"then via Hibernate mapping files." msgstr "" -"O elemento <cache> de uma classe ou mapeamento de " -"coleção possui a seguinte forma:" #. Tag: para +#: performance.xml:723 +#, no-c-format +msgid "" +"By default, entities are not part of the second level cache and we recommend " +"you to stick to this setting. However, you can override this by setting the " +"shared-cache-mode element in your persistence." +"xml file or by using the javax.persistence.sharedCache." +"mode property in your configuration. The following values are " +"possible:" +msgstr "" + +#. Tag: para +#: performance.xml:732 +#, no-c-format +msgid "" +"ENABLE_SELECTIVE (Default and recommended value): " +"entities are not cached unless explicitly marked as cacheable." +msgstr "" + +#. Tag: para +#: performance.xml:738 +#, no-c-format +msgid "" +"DISABLE_SELECTIVE: entities are cached unless explicitly " +"marked as not cacheable." +msgstr "" + +#. Tag: para +#: performance.xml:743 +#, no-c-format +msgid "" +"ALL: all entities are always cached even if marked as non " +"cacheable." +msgstr "" + +#. Tag: para +#: performance.xml:748 +#, no-c-format +msgid "" +"NONE: no entity are cached even if marked as cacheable. " +"This option can make sense to disable second-level cache altogether." +msgstr "" + +#. Tag: para +#: performance.xml:754 +#, no-c-format +msgid "" +"The cache concurrency strategy used by default can be set globaly via the " +"hibernate.cache.default_cache_concurrency_strategy " +"configuration property. The values for this property are:" +msgstr "" + +#. Tag: literal +#: performance.xml:761 +#, fuzzy, no-c-format +msgid "read-only" +msgstr "consultas por Criteria " + +#. Tag: literal +#: performance.xml:765 +#, fuzzy, no-c-format +msgid "read-write" +msgstr "consultas por Criteria " + +#. Tag: literal +#: performance.xml:769 +#, fuzzy, no-c-format +msgid "nonstrict-read-write" +msgstr "leitura-escrita não estrita" + +#. Tag: literal +#: performance.xml:773 +#, fuzzy, no-c-format +msgid "transactional" +msgstr "consultas por Criteria " + +#. Tag: para +#: performance.xml:778 +#, no-c-format +msgid "" +"It is recommended to define the cache concurrency strategy per entity rather " +"than using a global one. Use the @org.hibernate.annotations." +"Cache annotation for that." +msgstr "" + +#. Tag: title +#: performance.xml:785 +#, no-c-format +msgid "" +"Definition of cache concurrency strategy via @Cache" +msgstr "" + +#. Tag: programlisting +#: performance.xml:788 +#, no-c-format +msgid "" +"@Entity \n" +"@Cacheable\n" +"@Cache(usage = CacheConcurrencyStrategy.NONSTRICT_READ_WRITE)\n" +"public class Forest { ... }" +msgstr "" + +#. Tag: para +#: performance.xml:791 +#, no-c-format +msgid "" +"Hibernate also let's you cache the content of a collection or the " +"identifiers if the collection contains other entities. Use the " +"@Cache annotation on the collection property." +msgstr "" + +#. Tag: title +#: performance.xml:797 +#, fuzzy, no-c-format +msgid "Caching collections using annotations" +msgstr "Inicializando coleções e proxies" + +#. Tag: programlisting +#: performance.xml:799 +#, no-c-format +msgid "" +"@OneToMany(cascade=CascadeType.ALL, fetch=FetchType.EAGER)\n" +"@JoinColumn(name=\"CUST_ID\")\n" +"@Cache(usage = CacheConcurrencyStrategy.NONSTRICT_READ_WRITE)\n" +"public SortedSet<Ticket> getTickets() {\n" +" return tickets;\n" +"}" +msgstr "" + +#. Tag: para +#: performance.xml:802 +#, no-c-format +msgid "" +"shows the @org.hibernate.annotations.Cache annotations " +"with its attributes. It allows you to define the caching strategy and region " +"of a given second level cache." +msgstr "" + +#. Tag: title +#: performance.xml:808 +#, no-c-format +msgid "@Cache annotation with attributes" +msgstr "" + +#. Tag: programlisting +#: performance.xml:820 +#, no-c-format +msgid "" +"@Cache(\n" +" CacheConcurrencyStrategy usage();\n" +" String region() default \"\";\n" +" String include() default \"all\";\n" +")" +msgstr "" + +#. Tag: para +#: performance.xml:824 +#, no-c-format +msgid "" +"usage: the given cache concurrency strategy (NONE, READ_ONLY, " +"NONSTRICT_READ_WRITE, READ_WRITE, TRANSACTIONAL)" +msgstr "" + +#. Tag: para +#: performance.xml:830 +#, no-c-format +msgid "" +"region (optional): the cache region (default to the fqcn of the class or the " +"fq role name of the collection)" +msgstr "" + +#. Tag: para +#: performance.xml:835 +#, no-c-format +msgid "" +"include (optional): all to include all properties, non-" +"lazy to only include non lazy properties (default all)." +msgstr "" + +#. Tag: para +#: performance.xml:843 +#, no-c-format +msgid "" +"Let's now take a look at Hibernate mapping files. There the <" +"cache> element of a class or collection mapping is used to " +"configure the second level cache. Looking at the parallels to anotations is obvious." +msgstr "" + +#. Tag: title +#: performance.xml:850 +#, no-c-format +msgid "The Hibernate <cache> mapping element" +msgstr "" + +#. Tag: programlisting +#: performance.xml:862 +#, no-c-format +msgid "" +"<cache\n" +" usage=\"transactional|read-write|nonstrict-read-write|read-only\"\n" +" region=\"RegionName\"\n" +" include=\"all|non-lazy\"\n" +"/>" +msgstr "" + +#. Tag: para +#: performance.xml:866 #, no-c-format msgid "" "usage (required) specifies the caching strategy: " @@ -1331,6 +1949,7 @@ msgstr "" "literal>" #. Tag: para +#: performance.xml:874 #, no-c-format msgid "" "region (optional: defaults to the class or collection " @@ -1340,6 +1959,7 @@ msgstr "" "coleção): especifica o nome da região do cache de segundo nível" #. Tag: para +#: performance.xml:880 #, no-c-format msgid "" "include (optional: defaults to all) " @@ -1353,31 +1973,31 @@ msgstr "" "o nível da função busca lazy for habilitada" #. Tag: para -#, no-c-format +#: performance.xml:890 +#, fuzzy, no-c-format msgid "" -"Alternatively, you can specify <class-cache> and " -"<collection-cache> elements in hibernate." -"cfg.xml." +"Alternatively to <cache>, you can use <" +"class-cache> and <collection-cache> " +"elements in hibernate.cfg.xml." msgstr "" "De forma alternativa, você poderá especificar os elementos <" "class-cache> e <collection-cache> em " "hibernate.cfg.xml." #. Tag: para +#: performance.xml:895 #, no-c-format -msgid "" -"The usage attribute specifies a cache " -"concurrency strategy." +msgid "Let's now have a closer look at the different usage strategies" msgstr "" -"A função uso especifica uma estratégia de " -"concorrência de cache." #. Tag: title +#: performance.xml:900 #, no-c-format msgid "Strategy: read only" msgstr "Estratégia: somente leitura" #. Tag: para +#: performance.xml:902 #, no-c-format msgid "" "If your application needs to read, but not modify, instances of a persistent " @@ -1391,11 +2011,13 @@ msgstr "" "seguro para uso em um cluster." #. Tag: title +#: performance.xml:909 #, no-c-format msgid "Strategy: read/write" msgstr "Estratégia: leitura/escrita" #. Tag: para +#: performance.xml:911 #, no-c-format msgid "" "If the application needs to update data, a read-write " @@ -1424,11 +2046,13 @@ msgstr "" "o bloqueamento." #. Tag: title +#: performance.xml:927 #, no-c-format msgid "Strategy: nonstrict read/write" msgstr "Estratégia: leitura/escrita não estrita" #. Tag: para +#: performance.xml:929 #, no-c-format msgid "" "If the application only occasionally needs to update data (i.e. if it is " @@ -1451,11 +2075,13 @@ msgstr "" "literal> for chamada." #. Tag: title +#: performance.xml:941 #, no-c-format msgid "Strategy: transactional" msgstr "Estratégia: transacional" #. Tag: para +#: performance.xml:943 #, no-c-format msgid "" "The transactional cache strategy provides support for " @@ -1469,11 +2095,13 @@ msgstr "" "hibernate.transaction.manager_lookup_class." #. Tag: title +#: performance.xml:950 #, no-c-format msgid "Cache-provider/concurrency-strategy compatibility" msgstr "Compatibilidade de Estratégia de Concorrência de Cache Provedor" #. Tag: para +#: performance.xml:953 #, no-c-format msgid "" "None of the cache providers support all of the cache concurrency strategies." @@ -1482,6 +2110,7 @@ msgstr "" "cache. " #. Tag: para +#: performance.xml:957 #, no-c-format msgid "" "The following table shows which providers are compatible with which " @@ -1491,36 +2120,43 @@ msgstr "" "concorrência. " #. Tag: title +#: performance.xml:961 #, no-c-format msgid "Cache Concurrency Strategy Support" msgstr "Suporte de Estratégia de Concorrência de Cache" #. Tag: entry +#: performance.xml:978 #, no-c-format -msgid "read-only" -msgstr "somente leitura" +msgid "read-only" +msgstr "" #. Tag: entry -#, no-c-format -msgid "nonstrict-read-write" +#: performance.xml:980 +#, fuzzy, no-c-format +msgid "nonstrict-read-write" msgstr "leitura-escrita não estrita" #. Tag: entry +#: performance.xml:982 #, no-c-format -msgid "read-write" -msgstr "leitura-escrita" +msgid "read-write" +msgstr "" #. Tag: entry -#, no-c-format -msgid "transactional" +#: performance.xml:984 +#, fuzzy, no-c-format +msgid "transactional" msgstr "transacional" #. Tag: title +#: performance.xml:1067 #, no-c-format msgid "Managing the caches" msgstr "Gerenciando os caches" #. Tag: para +#: performance.xml:1069 #, no-c-format msgid "" "Whenever you pass an object to save(), update()Session." #. Tag: para +#: performance.xml:1076 #, no-c-format msgid "" "When flush() is subsequently called, the state of that " @@ -1553,7 +2190,29 @@ msgstr "" "método evict() pode ser usado para remover o objeto de " "suas coleções de cache de primeiro nível." +#. Tag: title +#: performance.xml:1084 +#, no-c-format +msgid "" +"Explcitly evicting a cached instance from the first level cache using " +"Session.evict()" +msgstr "" + +#. Tag: programlisting +#: performance.xml:1087 +#, no-c-format +msgid "" +"ScrollableResult cats = sess.createQuery(\"from Cat as cat\").scroll(); //a " +"huge result set\n" +"while ( cats.next() ) {\n" +" Cat cat = (Cat) cats.get(0);\n" +" doSomethingWithACat(cat);\n" +" sess.evict(cat);\n" +"}" +msgstr "" + #. Tag: para +#: performance.xml:1090 #, no-c-format msgid "" "The Session also provides a contains() " @@ -1563,6 +2222,7 @@ msgstr "" "literal> para determinar se uma instância pertence ao cache de sessão." #. Tag: para +#: performance.xml:1094 #, no-c-format msgid "" "To evict all objects from the session cache, call Session.clear()Session.clear()" #. Tag: para +#: performance.xml:1097 #, no-c-format msgid "" "For the second-level cache, there are methods defined on " @@ -1582,7 +2243,28 @@ msgstr "" "SessionFactory para despejar o estado de cache de uma " "instância, classe inteira, instância de coleção ou papel de coleção inteiro." +#. Tag: title +#: performance.xml:1103 +#, no-c-format +msgid "" +"Second-level cache eviction via SessionFactoty.evict() and SessionFacyory.evictCollection()" +msgstr "" + +#. Tag: programlisting +#: performance.xml:1107 +#, no-c-format +msgid "" +"sessionFactory.evict(Cat.class, catId); //evict a particular Cat\n" +"sessionFactory.evict(Cat.class); //evict all Cats\n" +"sessionFactory.evictCollection(\"Cat.kittens\", catId); //evict a particular " +"collection of kittens\n" +"sessionFactory.evictCollection(\"Cat.kittens\"); //evict all kitten " +"collections" +msgstr "" + #. Tag: para +#: performance.xml:1110 #, no-c-format msgid "" "The CacheMode controls how a particular session interacts " @@ -1592,6 +2274,7 @@ msgstr "" "interage com o cache de segundo nível:" #. Tag: para +#: performance.xml:1115 #, no-c-format msgid "" "CacheMode.NORMAL: will read items from and write items to " @@ -1601,6 +2284,7 @@ msgstr "" "nível." #. Tag: para +#: performance.xml:1120 #, no-c-format msgid "" "CacheMode.GET: will read items from the second-level " @@ -1610,6 +2294,7 @@ msgstr "" "nível. Não escreve ao cache de segundo nível, exceto quando atualizar dados." #. Tag: para +#: performance.xml:1126 #, no-c-format msgid "" "CacheMode.PUT: will write items to the second-level " @@ -1619,6 +2304,7 @@ msgstr "" "Não lê a partir do cache de segundo nível." #. Tag: para +#: performance.xml:1131 #, no-c-format msgid "" "CacheMode.REFRESH: will write items to the second-level " @@ -1633,6 +2319,7 @@ msgstr "" "do banco de dados. " #. Tag: para +#: performance.xml:1139 #, no-c-format msgid "" "To browse the contents of a second-level or query cache region, use the " @@ -1641,7 +2328,27 @@ msgstr "" "Para navegar o conteúdo do segundo nível ou região de cache de consulta, use " "oStatistics API:" +#. Tag: title +#: performance.xml:1143 +#, fuzzy, no-c-format +msgid "" +"Browsing the second-level cache entries via the Statistics API" +msgstr "" +"Para navegar o conteúdo do segundo nível ou região de cache de consulta, use " +"oStatistics API:" + +#. Tag: programlisting +#: performance.xml:1146 +#, no-c-format +msgid "" +"Map cacheEntries = sessionFactory.getStatistics()\n" +" .getSecondLevelCacheStatistics(regionName)\n" +" .getEntries();" +msgstr "" + #. Tag: para +#: performance.xml:1149 #, no-c-format msgid "" "You will need to enable statistics and, optionally, force Hibernate to keep " @@ -1651,11 +2358,27 @@ msgstr "" "manter as entradas de cache em um formato mais compreensível: " #. Tag: title +#: performance.xml:1153 +#, no-c-format +msgid "Enabling Hibernate statistics" +msgstr "" + +#. Tag: programlisting +#: performance.xml:1155 +#, no-c-format +msgid "" +"hibernate.generate_statistics true\n" +"hibernate.cache.use_structured_entries true" +msgstr "" + +#. Tag: title +#: performance.xml:1160 #, no-c-format msgid "The Query Cache" msgstr "O Cache de Consulta" #. Tag: para +#: performance.xml:1162 #, no-c-format msgid "" "Query result sets can also be cached. This is only useful for queries that " @@ -1666,11 +2389,13 @@ msgstr "" "parâmetros. " #. Tag: title +#: performance.xml:1166 #, no-c-format msgid "Enabling query caching" msgstr "Ativação do cache de consulta" #. Tag: para +#: performance.xml:1168 #, no-c-format msgid "" "Caching of query results introduces some overhead in terms of your " @@ -1692,12 +2417,20 @@ msgstr "" "o cache de resultados de consulta por padrão. Para uso do cache de consulta, " "você primeiro precisa ativar o cache de consulta:" +#. Tag: programlisting +#: performance.xml:1177 +#, no-c-format +msgid "hibernate.cache.use_query_cache true" +msgstr "" + #. Tag: para +#: performance.xml:1179 #, no-c-format msgid "This setting creates two new cache regions:" msgstr "Esta configuração cria duas novas regiões de cache:" #. Tag: para +#: performance.xml:1181 #, no-c-format msgid "" "org.hibernate.cache.StandardQueryCache, holding the " @@ -1707,6 +2440,7 @@ msgstr "" "resultados da consulta com cache." #. Tag: para +#: performance.xml:1186 #, no-c-format msgid "" "org.hibernate.cache.UpdateTimestampsCache, holding " @@ -1719,10 +2453,11 @@ msgstr "" "do cache de consulta." #. Tag: para +#: performance.xml:1194 #, fuzzy, no-c-format msgid "" "If you configure your underlying cache implementation to use expiry or " -"timeouts is is very important that the cache timeout of the underlying cache " +"timeouts is very important that the cache timeout of the underlying cache " "region for the UpdateTimestampsCache be set to a higher value than the " "timeouts of any of the query caches. In fact, we recommend that the the " "UpdateTimestampsCache region not be configured for expiry at all. Note, in " @@ -1736,6 +2471,7 @@ msgstr "" "expirar. Perceba que uma política expirar do cache LRU nunca será apropriada." #. Tag: para +#: performance.xml:1203 #, no-c-format msgid "" "As mentioned above, most queries do not benefit from caching or their " @@ -1754,6 +2490,7 @@ msgstr "" "quando for executado. " #. Tag: para +#: performance.xml:1211 #, no-c-format msgid "" "The query cache does not cache the state of the actual entities in the " @@ -1770,11 +2507,13 @@ msgstr "" "o cache de coleção)." #. Tag: title +#: performance.xml:1221 #, no-c-format msgid "Query cache regions" msgstr "Regiões de cache de consulta" #. Tag: para +#: performance.xml:1223 #, no-c-format msgid "" "If you require fine-grained control over query cache expiration policies, " @@ -1786,7 +2525,21 @@ msgstr "" "uma consulta em particular, chamando Query.setCacheRegion()." +#. Tag: programlisting +#: performance.xml:1227 +#, no-c-format +msgid "" +"List blogs = sess.createQuery(\"from Blog blog where blog.blogger = :blogger" +"\")\n" +" .setEntity(\"blogger\", blogger)\n" +" .setMaxResults(15)\n" +" .setCacheable(true)\n" +" .setCacheRegion(\"frontpages\")\n" +" .list();" +msgstr "" + #. Tag: para +#: performance.xml:1229 #, no-c-format msgid "" "If you want to force the query cache to refresh one of its regions " @@ -1811,11 +2564,13 @@ msgstr "" "SessionFactory.evictQueries()." #. Tag: title +#: performance.xml:1242 #, no-c-format msgid "Understanding Collection performance" msgstr "Entendendo o desempenho da Coleção" #. Tag: para +#: performance.xml:1244 #, no-c-format msgid "" "In the previous sections we have covered collections and their applications. " @@ -1827,31 +2582,37 @@ msgstr "" "execução." #. Tag: title +#: performance.xml:1249 #, no-c-format msgid "Taxonomy" msgstr "Taxonomia" #. Tag: para +#: performance.xml:1251 #, no-c-format msgid "Hibernate defines three basic kinds of collections:" msgstr "O Hibernate define três tipos básicos de coleções:" #. Tag: para +#: performance.xml:1255 #, no-c-format msgid "collections of values" msgstr "Coleções de valores" #. Tag: para +#: performance.xml:1259 #, no-c-format msgid "one-to-many associations" msgstr "Associações um-para-muitos " #. Tag: para +#: performance.xml:1263 #, no-c-format msgid "many-to-many associations" msgstr "Associações muitos-para-muitos " #. Tag: para +#: performance.xml:1267 #, no-c-format msgid "" "This classification distinguishes the various table and foreign key " @@ -1869,21 +2630,25 @@ msgstr "" "de coleções. Isto sugere a seguinte classificação:" #. Tag: para +#: performance.xml:1276 #, no-c-format msgid "indexed collections" msgstr "Coleções indexadas" #. Tag: para +#: performance.xml:1280 #, no-c-format msgid "sets" msgstr "conjuntos" #. Tag: para +#: performance.xml:1284 #, no-c-format msgid "bags" msgstr "Bags" #. Tag: para +#: performance.xml:1288 #, no-c-format msgid "" "All indexed collections (maps, lists, and arrays) have a primary key " @@ -1900,6 +2665,7 @@ msgstr "" "quando o Hibernate tentar atualizar ou deletá-la. " #. Tag: para +#: performance.xml:1295 #, no-c-format msgid "" "Sets have a primary key consisting of <key> and " @@ -1924,6 +2690,7 @@ msgstr "" "todas as colunas como not-null=\"true\"." #. Tag: para +#: performance.xml:1306 #, no-c-format msgid "" "<idbag> mappings define a surrogate key, so they " @@ -1934,6 +2701,7 @@ msgstr "" "verdade, este é o melhor caso. " #. Tag: para +#: performance.xml:1309 #, no-c-format msgid "" "Bags are the worst case since they permit duplicate element values and, as " @@ -1950,6 +2718,7 @@ msgstr "" "bastante ineficiente." #. Tag: para +#: performance.xml:1316 #, no-c-format msgid "" "For a one-to-many association, the \"primary key\" may not be the physical " @@ -1963,6 +2732,7 @@ msgstr "" "linhas individuais da coleção." #. Tag: title +#: performance.xml:1323 #, no-c-format msgid "" "Lists, maps, idbags and sets are the most efficient collections to update" @@ -1971,6 +2741,7 @@ msgstr "" "atualizar" #. Tag: para +#: performance.xml:1326 #, no-c-format msgid "" "From the discussion above, it should be clear that indexed collections and " @@ -1982,6 +2753,7 @@ msgstr "" "adição, remoção e atualização de elementos. " #. Tag: para +#: performance.xml:1330 #, no-c-format msgid "" "There is, arguably, one more advantage that indexed collections have over " @@ -2001,6 +2773,7 @@ msgstr "" "consideração não se aplica às associações um para muitos. " #. Tag: para +#: performance.xml:1338 #, no-c-format msgid "" "After observing that arrays cannot be lazy, you can conclude that lists, " @@ -2016,6 +2789,7 @@ msgstr "" "semânticas \"conjunto\" são mais naturais em modelos relacionais. " #. Tag: para +#: performance.xml:1344 #, no-c-format msgid "" "However, in well-designed Hibernate domain models, most collections are in " @@ -2032,11 +2806,13 @@ msgstr "" "aplicam a este caso. " #. Tag: title +#: performance.xml:1352 #, no-c-format msgid "Bags and lists are the most efficient inverse collections" msgstr "As Bags e listas são as coleções de inversão mais eficientes." #. Tag: para +#: performance.xml:1354 #, no-c-format msgid "" "There is a particular case, however, in which bags, and also lists, are much " @@ -2058,12 +2834,25 @@ msgstr "" "List. Isto pode fazer que o código comum seguinte seja " "muito mais rápido:" +#. Tag: programlisting +#: performance.xml:1365 +#, no-c-format +msgid "" +"Parent p = (Parent) sess.load(Parent.class, id);\n" +"Child c = new Child();\n" +"c.setParent(p);\n" +"p.getChildren().add(c); //no need to fetch the collection!\n" +"sess.flush();" +msgstr "" + #. Tag: title +#: performance.xml:1369 #, no-c-format msgid "One shot delete" msgstr "Deletar uma vez" #. Tag: para +#: performance.xml:1371 #, no-c-format msgid "" "Deleting collection elements one by one can sometimes be extremely " @@ -2078,6 +2867,7 @@ msgstr "" "Neste caso, o Hibernate irá editar um único DELETE." #. Tag: para +#: performance.xml:1377 #, no-c-format msgid "" "Suppose you added a single element to a collection of size twenty and then " @@ -2091,6 +2881,7 @@ msgstr "" "ser que a coleção seja uma bag. Isto é certamente desejável." #. Tag: para +#: performance.xml:1383 #, no-c-format msgid "" "However, suppose that we remove eighteen elements, leaving two and then add " @@ -2101,11 +2892,13 @@ msgstr "" "proceder:" #. Tag: para +#: performance.xml:1389 #, no-c-format msgid "delete eighteen rows one by one and then insert three rows" msgstr "delete dezoito linhas uma por uma e então insira três linhas" #. Tag: para +#: performance.xml:1394 #, no-c-format msgid "" "remove the whole collection in one SQL DELETE and insert " @@ -2115,6 +2908,7 @@ msgstr "" "cinco elementos atuais, um por um" #. Tag: para +#: performance.xml:1400 #, no-c-format msgid "" "Hibernate cannot know that the second option is probably quicker. It would " @@ -2126,6 +2920,7 @@ msgstr "" "deve confundir os triggers do banco de dados, etc." #. Tag: para +#: performance.xml:1404 #, no-c-format msgid "" "Fortunately, you can force this behavior (i.e. the second strategy) at any " @@ -2138,6 +2933,7 @@ msgstr "" "os elementos atuais. " #. Tag: para +#: performance.xml:1409 #, no-c-format msgid "" "One-shot-delete does not apply to collections mapped inverse=\"true" @@ -2147,11 +2943,13 @@ msgstr "" "inverse=\"true\"." #. Tag: title +#: performance.xml:1415 #, no-c-format msgid "Monitoring performance" msgstr "Monitorando desempenho" #. Tag: para +#: performance.xml:1417 #, no-c-format msgid "" "Optimization is not much use without monitoring and access to performance " @@ -2165,11 +2963,13 @@ msgstr "" "SessionFactory." #. Tag: title +#: performance.xml:1423 #, no-c-format msgid "Monitoring a SessionFactory" msgstr "Monitorando uma SessionFactory" #. Tag: para +#: performance.xml:1425 #, no-c-format msgid "" "You can access SessionFactory metrics in two ways. Your " @@ -2181,6 +2981,7 @@ msgstr "" " e ler ou dispôr as Estatísticas você mesmo." #. Tag: para +#: performance.xml:1430 #, no-c-format msgid "" "Hibernate can also use JMX to publish metrics if you enable the " @@ -2194,7 +2995,38 @@ msgstr "" "factory. Veja o seguinte código para exemplos de configurações " "minimalísticos: " +#. Tag: programlisting +#: performance.xml:1435 +#, no-c-format +msgid "" +"// MBean service registration for a specific SessionFactory\n" +"Hashtable tb = new Hashtable();\n" +"tb.put(\"type\", \"statistics\");\n" +"tb.put(\"sessionFactory\", \"myFinancialApp\");\n" +"ObjectName on = new ObjectName(\"hibernate\", tb); // MBean object name\n" +"\n" +"StatisticsService stats = new StatisticsService(); // MBean implementation\n" +"stats.setSessionFactory(sessionFactory); // Bind the stats to a " +"SessionFactory\n" +"server.registerMBean(stats, on); // Register the Mbean on the server" +msgstr "" + +#. Tag: programlisting +#: performance.xml:1437 +#, no-c-format +msgid "" +"// MBean service registration for all SessionFactory's\n" +"Hashtable tb = new Hashtable();\n" +"tb.put(\"type\", \"statistics\");\n" +"tb.put(\"sessionFactory\", \"all\");\n" +"ObjectName on = new ObjectName(\"hibernate\", tb); // MBean object name\n" +"\n" +"StatisticsService stats = new StatisticsService(); // MBean implementation\n" +"server.registerMBean(stats, on); // Register the MBean on the server" +msgstr "" + #. Tag: para +#: performance.xml:1439 #, no-c-format msgid "" "You can activate and deactivate the monitoring for a " @@ -2204,6 +3036,7 @@ msgstr "" "literal>:" #. Tag: para +#: performance.xml:1444 #, no-c-format msgid "" "at configuration time, set hibernate.generate_statistics " @@ -2213,6 +3046,7 @@ msgstr "" "literal> para falso" #. Tag: para +#: performance.xml:1452 #, no-c-format msgid "" "at runtime: sf.getStatistics().setStatisticsEnabled(true) " @@ -2222,6 +3056,7 @@ msgstr "" "literal> ou hibernateStatsBean.setStatisticsEnabled(true)" #. Tag: para +#: performance.xml:1458 #, no-c-format msgid "" "Statistics can be reset programmatically using the clear()logSummary(). " #. Tag: title +#: performance.xml:1464 #, no-c-format msgid "Metrics" msgstr "Métricas" #. Tag: para +#: performance.xml:1466 #, no-c-format msgid "" "Hibernate provides a number of metrics, from basic information to more " @@ -2251,6 +3088,7 @@ msgstr "" "literal>, em três categorias: " #. Tag: para +#: performance.xml:1473 #, no-c-format msgid "" "Metrics related to the general Session usage, such as " @@ -2260,6 +3098,7 @@ msgstr "" "número de sessões em aberto, conexões JDBC recuperadas, etc." #. Tag: para +#: performance.xml:1479 #, no-c-format msgid "" "Metrics related to the entities, collections, queries, and caches as a whole " @@ -2269,6 +3108,7 @@ msgstr "" "todo (mais conhecido como métricas globais). " #. Tag: para +#: performance.xml:1484 #, no-c-format msgid "" "Detailed metrics related to a particular entity, collection, query or cache " @@ -2278,6 +3118,7 @@ msgstr "" "consulta ou região de cache." #. Tag: para +#: performance.xml:1489 #, no-c-format msgid "" "For example, you can check the cache hit, miss, and put ratio of entities, " @@ -2293,6 +3134,7 @@ msgstr "" "algumas plataformas a precisão chega a ser de 10 segundos. " #. Tag: para +#: performance.xml:1495 #, no-c-format msgid "" "Simple getters are used to access the global metrics (i.e. not tied to a " @@ -2315,7 +3157,30 @@ msgstr "" "QueryStatistics para maiores informações. O seguinte " "código mostra um exemplo simples: " +#. Tag: programlisting +#: performance.xml:1506 +#, no-c-format +msgid "" +"Statistics stats = HibernateUtil.sessionFactory.getStatistics();\n" +"\n" +"double queryCacheHitCount = stats.getQueryCacheHitCount();\n" +"double queryCacheMissCount = stats.getQueryCacheMissCount();\n" +"double queryCacheHitRatio =\n" +" queryCacheHitCount / (queryCacheHitCount + queryCacheMissCount);\n" +"\n" +"log.info(\"Query Hit ratio:\" + queryCacheHitRatio);\n" +"\n" +"EntityStatistics entityStats =\n" +" stats.getEntityStatistics( Cat.class.getName() );\n" +"long changes =\n" +" entityStats.getInsertCount()\n" +" + entityStats.getUpdateCount()\n" +" + entityStats.getDeleteCount();\n" +"log.info(Cat.class.getName() + \" changed \" + changes + \"times\" );" +msgstr "" + #. Tag: para +#: performance.xml:1508 #, no-c-format msgid "" "You can work on all entities, collections, queries and region caches, by " @@ -2330,3 +3195,36 @@ msgstr "" ", getEntityNames(), " "getCollectionRoleNames(), e " "getSecondLevelCacheRegionNames(). " + +#~ msgid "or even:" +#~ msgstr "ou ainda:" + +#~ msgid "" +#~ "Now the following code will actually load both the customer and " +#~ "their orders:" +#~ msgstr "" +#~ "Agora que o código seguinte irá carregar ambos cliente e outros " +#~ "pedidos:" + +#~ msgid "yes" +#~ msgstr "sim" + +#~ msgid "" +#~ "The <cache> element of a class or collection " +#~ "mapping has the following form:" +#~ msgstr "" +#~ "O elemento <cache> de uma classe ou mapeamento " +#~ "de coleção possui a seguinte forma:" + +#~ msgid "" +#~ "The usage attribute specifies a cache " +#~ "concurrency strategy." +#~ msgstr "" +#~ "A função uso especifica uma estratégia de " +#~ "concorrência de cache." + +#~ msgid "read-only" +#~ msgstr "somente leitura" + +#~ msgid "read-write" +#~ msgstr "leitura-escrita" diff --git a/documentation/manual/src/main/docbook/pt-BR/content/persistent_classes.po b/documentation/manual/src/main/docbook/pt-BR/content/persistent_classes.po index fcda0ffb0f..fc07d4c367 100644 --- a/documentation/manual/src/main/docbook/pt-BR/content/persistent_classes.po +++ b/documentation/manual/src/main/docbook/pt-BR/content/persistent_classes.po @@ -108,7 +108,7 @@ msgid "" msgstr "" "Project-Id-Version: persistent_classes\n" "Report-Msgid-Bugs-To: http://bugs.kde.org\n" -"POT-Creation-Date: 2010-02-11T05:38:15\n" +"POT-Creation-Date: 2010-07-20 21:02+0000\n" "PO-Revision-Date: 2010-03-18 14:48+1000\n" "Last-Translator: \n" "Language-Team: \n" @@ -118,18 +118,20 @@ msgstr "" "X-Generator: KBabel 1.11.4\n" #. Tag: title +#: persistent_classes.xml:32 #, no-c-format msgid "Persistent Classes" msgstr "Classes Persistentes" #. Tag: para -#, no-c-format +#: persistent_classes.xml:34 +#, fuzzy, 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. For example, an instance can instead be transient " -"or detached." +"application). The term \"persistent\" here means that the classes are able " +"to be persisted, not that they are in the persistent state (see for discussion)." msgstr "" "As classes persistentes são classes dentro de um aplicativo que implementa " "as entidades de problemas de negócios (ex.: Cliente e Pedido em um " @@ -138,13 +140,15 @@ msgstr "" "transiente ou desanexada. " #. Tag: para -#, no-c-format +#: persistent_classes.xml:41 +#, fuzzy, 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 " +"these rules are hard requirements. Indeed, Hibernate assumes very little " "about the nature of your persistent objects. You can express a domain model " -"in other ways (using trees of Map instances, for example)." +"in other ways (using trees of java.util.Map " +"instances, for example)." msgstr "" "O Hibernate trabalha melhor se estas classes seguirem uma regra simples, " "também conhecida como modelo de programação Objeto de Java Antigo Simples " @@ -154,20 +158,103 @@ msgstr "" "exemplo: utilizando árvores de instâncias Map)." #. Tag: title +#: persistent_classes.xml:49 #, no-c-format msgid "A simple POJO example" msgstr "Um exemplo simples de POJO" -#. Tag: para +#. Tag: title +#: persistent_classes.xml:52 +#, no-c-format +msgid "Simple POJO representing a cat" +msgstr "" + +#. Tag: programlisting +#: persistent_classes.xml:53 #, no-c-format msgid "" -"Most Java applications require a persistent class representing felines. For " -"example:" +"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 "" -"A maior parte dos aplicativos Java requerem uma classe persistente que " -"representa os felinos. Por exemplo:" #. Tag: para +#: persistent_classes.xml:57 #, no-c-format msgid "" "The four main rules of persistent classes are explored in more detail in the " @@ -177,19 +264,21 @@ msgstr "" "maiores detalhes nas seguintes seções." #. Tag: title +#: persistent_classes.xml:62 #, no-c-format msgid "Implement a no-argument constructor" msgstr "Implemente um construtor de não argumento" #. Tag: para -#, no-c-format +#: persistent_classes.xml:64 +#, fuzzy, no-c-format msgid "" -"Cat has a no-argument constructor. All persistent classes " -"must have a default constructor (which can be non-public) so that Hibernate " -"can instantiate them using Constructor.newInstance(). It " -"is recommended that you have a default constructor with at least " -"package visibility for runtime proxy generation in " -"Hibernate." +"Cat has a no-argument constructor. All persistent " +"classes must have a default constructor (which can be non-public) so that " +"Hibernate can instantiate them using java.lang.reflect." +"Constructor.newInstance(). It is recommended that this " +"constructor be defined with at least package visibility " +"in order for runtime proxy generation to work properly." msgstr "" "Cat possui um construtor de não argumento. Todas as " "classes persistentes devem ter um construtor padrão (que não pode ser " @@ -199,70 +288,42 @@ msgstr "" "emphasis> para a geração de um proxy de tempo de espera no Hibernate. " #. Tag: title -#, no-c-format -msgid "Provide an identifier property (optional)" +#: persistent_classes.xml:74 +#, fuzzy, no-c-format +msgid "Provide an identifier property" msgstr "Providencie uma propriedade de identificador (opcional)" #. Tag: para +#: persistent_classes.xml:77 #, no-c-format msgid "" -"Cat has a property called id. 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, java.lang.String or " -"java.util.Date. If your legacy database table has " -"composite keys, you can use a user-defined class with properties of these " -"types (see the section on composite identifiers later in the chapter.)" +"Historically this was considered option. While still not (yet) enforced, " +"this should be considered a deprecated feature as it will be completely " +"required to provide a identifier property in an upcoming release." msgstr "" -"Cat possui uma propriedade chamada id. " -"Esta propriedade mapeia para a coluna de chave primária de uma tabela de " -"banco de dados. A propriedade pode ter sido chamada por qualquer nome e seu " -"tipo pode ter sido qualquer um primitivo, ou qualquer tipo \"wrapper\", " -"java.lang.String ou java.util.Date. Se " -"sua tabela de banco de dados de legacia possuir chaves compostas, você " -"também poderá usar uma classe de usuário definido, com propriedades destes " -"tipos (veja a seção de identificadores compostos mais adiante.)" #. 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." +"Cat has a property named id. This " +"property maps to the primary key column(s) of the underlying database table. " +"The type of the identifier property can be any \"basic\" type (see ). See for information on mapping composite (multi-column) identifiers." msgstr "" -"A propriedade de identificador é estritamente opcional. Você pode deixá-los " -"desligados e deixar que o Hibernate encontre os identificadores de objeto " -"internamente. No entanto, não recomendamos que faça isto." #. Tag: para +#: persistent_classes.xml:92 #, no-c-format msgid "" -"In fact, some functionality is available only to classes that declare an " -"identifier property:" +"Identifiers do not necessarily need to identify column(s) in the database " +"physically defined as a primary key. They should just identify columns that " +"can be used to uniquely identify rows in the underlying table." msgstr "" -"Na verdade, algumas funcionalidades estão disponíveis somente para classes " -"que declaram uma propriedade de identificador:" - -#. Tag: para -#, no-c-format -msgid "" -"Transitive reattachment for detached objects (cascade update or cascade " -"merge) - see " -msgstr "" -"Reconexão transitiva para objetos desanexados (atualização de cascata ou " -"mesclagem de cascata) - veja " - -#. Tag: para -#, no-c-format -msgid "Session.saveOrUpdate()" -msgstr "Session.saveOrUpdate()" - -#. Tag: para -#, no-c-format -msgid "Session.merge()" -msgstr "Session.merge()" #. Tag: para +#: persistent_classes.xml:99 #, no-c-format msgid "" "We recommend that you declare consistently-named identifier properties on " @@ -273,40 +334,100 @@ msgstr "" "(ou seja, não primitivo)." #. Tag: title -#, no-c-format -msgid "Prefer non-final classes (optional)" +#: persistent_classes.xml:107 +#, fuzzy, no-c-format +msgid "Prefer non-final classes (semi-optional)" msgstr "Prefira classes não finais (opcional)" #. Tag: para +#: persistent_classes.xml:109 #, no-c-format msgid "" -"A central feature of Hibernate, proxies, depends upon " -"the persistent class being either non-final, or the implementation of an " -"interface that declares all public methods." +"A central feature of Hibernate, proxies (lazy loading), " +"depends upon the persistent class being either non-final, or the " +"implementation of an interface that declares all public methods. You can " +"persist final classes that do not implement an interface " +"with Hibernate; you will not, however, be able to use proxies for lazy " +"association fetching which will ultimately limit your options for " +"performance tuning. To persist a final class which does " +"not implement a \"full\" interface you must disable proxy generation. See " +" and ." +msgstr "" + +#. Tag: title +#: persistent_classes.xml:121 +#, no-c-format +msgid "Disabling proxies in hbm.xml" +msgstr "" + +#. Tag: programlisting +#: persistent_classes.xml:122 +#, no-c-format +msgid "...]]>" +msgstr "" + +#. Tag: title +#: persistent_classes.xml:126 +#, no-c-format +msgid "Disabling proxies in annotations" +msgstr "" + +#. Tag: programlisting +#: persistent_classes.xml:127 +#, no-c-format +msgid "" msgstr "" -"Um recurso central do Hibernate, proxies, depende da " -"classe persistente ser tanto não final como uma implementação de uma " -"interface que declare todos os métodos públicos." #. Tag: para +#: persistent_classes.xml:130 #, no-c-format msgid "" -"You can persist final classes that do not implement an " -"interface with Hibernate. You will not, however, be able to use proxies for " -"lazy association fetching which will ultimately limit your options for " -"performance tuning." +"If the final class does implement a proper interface, you " +"could alternatively tell Hibernate to use the interface instead when " +"generating the proxies. See and ." +msgstr "" + +#. Tag: title +#: persistent_classes.xml:139 +#, no-c-format +msgid "Proxying an interface in hbm.xml" +msgstr "" + +#. Tag: programlisting +#: persistent_classes.xml:140 +#, no-c-format +msgid "...]]>" +msgstr "" + +#. Tag: title +#: persistent_classes.xml:144 +#, no-c-format +msgid "Proxying an interface in annotations" +msgstr "" + +#. Tag: programlisting +#: persistent_classes.xml:145 +#, no-c-format +msgid "" +"" msgstr "" -"Você pode persistir as classes final que não implementam " -"uma interface com o Hibernate, mas não poderá usar os proxies para busca por " -"associação lazy, que irá limitar suas opções para ajuste de desempenho. " #. Tag: para -#, no-c-format +#: persistent_classes.xml:148 +#, fuzzy, no-c-format msgid "" -"You should also avoid declaring public final methods on " -"the non-final classes. If you want to use a class with a public " -"final method, you must explicitly disable proxying by setting " -"lazy=\"false\"." +"You should also avoid declaring public final methods as " +"this will again limit the ability to generate proxies " +"from this class. If you want to use a class with public final methods, you must explicitly disable proxying. Again, see and " +"." msgstr "" "Você deve evitar declarar métodos public final em classes " "não finais. Se você desejar usar uma classe com um método public " @@ -314,14 +435,16 @@ msgstr "" "lazy=\"false\". " #. Tag: title +#: persistent_classes.xml:158 #, no-c-format msgid "Declare accessors and mutators for persistent fields (optional)" msgstr "Declare acessores e mutadores para campos persistentes (opcional)" #. Tag: para -#, no-c-format +#: persistent_classes.xml:160 +#, fuzzy, no-c-format msgid "" -"Cat declares accessor methods for all its persistent " +"Cat declares accessor methods for all its persistent " "fields. Many other ORM tools directly persist instance variables. It is " "better to provide an indirection between the relational schema and internal " "data structures of the class. By default, Hibernate persists JavaBeans style " @@ -339,22 +462,26 @@ msgstr "" "acesso ao campo para certas propriedades, caso seja necessário. " #. Tag: para -#, no-c-format +#: persistent_classes.xml:169 +#, fuzzy, no-c-format msgid "" -"Properties need not be declared public - Hibernate can " -"persist a property with a default, protected or " -"private get / set pair." +"Properties need not be declared public. Hibernate can " +"persist a property declared with package, " +"protected or private visibility as " +"well." msgstr "" "As propriedades precisam not ser declaradas como " "públicas. O Hibernate pode persistir uma propriedade com um par get/set " "padrão protegido ou privado." #. Tag: title +#: persistent_classes.xml:178 #, no-c-format msgid "Implementing inheritance" msgstr "Implementando herança" #. Tag: para +#: persistent_classes.xml:180 #, no-c-format msgid "" "A subclass must also observe the first and second rules. It inherits its " @@ -364,12 +491,34 @@ msgstr "" "sua propriedade de identificador a partir das superclasses, Cat. Por exemplo:" -#. Tag: title +#. Tag: programlisting +#: persistent_classes.xml:184 #, no-c-format -msgid "Implementing equals() and hashCode()" -msgstr "Implementando equals() e hashCode() " +msgid "" +"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:188 +#, no-c-format +msgid "" +"Implementing equals() and hashCode()" +msgstr "" +"Implementando equals() e hashCode() " #. Tag: para +#: persistent_classes.xml:191 #, no-c-format msgid "" "You have to override the equals() and hashCode()" @@ -379,6 +528,7 @@ msgstr "" "hashCode() se você:" #. Tag: para +#: persistent_classes.xml:196 #, no-c-format msgid "" "intend to put instances of persistent classes in a Set " @@ -390,11 +540,13 @@ msgstr "" "valores), e" #. Tag: para +#: persistent_classes.xml:202 #, no-c-format msgid "intend to use reattachment of detached instances" msgstr "pretender usar reconexão de instâncias desanexadas" #. Tag: para +#: persistent_classes.xml:206 #, no-c-format msgid "" "Hibernate guarantees equivalence of persistent identity (database row) and " @@ -411,6 +563,7 @@ msgstr "" "para os Sets. " #. Tag: para +#: persistent_classes.xml:212 #, no-c-format msgid "" "The most obvious way is to implement equals()/" @@ -446,6 +599,7 @@ msgstr "" "Hibernate, e sim semânticas naturais do Java de igualdade e identidade." #. Tag: para +#: persistent_classes.xml:228 #, no-c-format msgid "" "It is recommended that you implement equals() and " @@ -462,37 +616,72 @@ msgstr "" "nossa instância na realidade (uma chave de candidato natural): " -#. Tag: para +#. Tag: programlisting +#: persistent_classes.xml:235 #, no-c-format msgid "" +"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:237 +#, fuzzy, no-c-format +msgid "" "A business key does not have to be as solid as a database primary key " -"candidate (see ). Immutable " +"candidate (see ). Immutable " "or unique properties are usually good candidates for a business key." msgstr "" "Note que uma chave de negócios não tem que ser tão sólida quanto um " -"candidato de chave primária de base de dados (veja ). Propriedades imutáveis ou únicas são " +"candidato de chave primária de base de dados (veja ). Propriedades imutáveis ou únicas são " "bons candidatos para uma chave de negócios. " #. Tag: title +#: persistent_classes.xml:244 #, no-c-format msgid "Dynamic models" msgstr "Modelos dinâmicos" #. Tag: title +#: persistent_classes.xml:247 #, no-c-format msgid "Note" msgstr "Nota" -#. Tag: para -#, no-c-format +#. Tag: emphasis +#: persistent_classes.xml:249 +#, fuzzy, no-c-format msgid "" -"The following features are currently considered experimental and " -"may change in the near future." +"The following features are currently considered experimental and may change " +"in the near future." msgstr "" "Os recursos seguintes são considerados experimentais no momento e " "podem mudar no futuro. " #. Tag: para +#: persistent_classes.xml:253 #, no-c-format msgid "" "Persistent entities do not necessarily have to be represented as POJO " @@ -509,19 +698,22 @@ msgstr "" "mapeamentos. " #. Tag: para -#, no-c-format +#: persistent_classes.xml:259 +#, fuzzy, no-c-format msgid "" "By default, Hibernate works in normal POJO mode. You can set a default " "entity representation mode for a particular SessionFactory using the default_entity_mode configuration " -"option (see )." +"option (see )." msgstr "" "Por padrão, o Hibernate funciona em modo POJO normal. Você deve ajustar um " "modo de representação de entidade por padrão para uma certa " "SessionFactory usando a opção de configuração " -"default_entity_mode (veja ). " +"default_entity_mode (veja ). " #. Tag: para +#: persistent_classes.xml:265 #, no-c-format msgid "" "The following examples demonstrate the representation using Maps. Primeiro, no arquivo de mapeamento, um entity-name precisa ser declarado ao invés de (ou além de) um nome de classe:" +#. Tag: programlisting +#: persistent_classes.xml:270 +#, no-c-format +msgid "" +"<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:272 #, no-c-format msgid "" "Even though associations are declared using target class names, the target " @@ -543,6 +775,7 @@ msgstr "" "invés de um POJO. " #. Tag: para +#: persistent_classes.xml:276 #, no-c-format msgid "" "After setting the default entity mode to dynamic-map for " @@ -553,7 +786,34 @@ msgstr "" "para a SessionFactory, você poderá trabalhar com " "Maps de Maps no período de execução: " +#. Tag: programlisting +#: persistent_classes.xml:281 +#, no-c-format +msgid "" +"Session s = openSession();\n" +"Transaction tx = s.beginTransaction();\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:283 #, no-c-format msgid "" "One of the main advantages of dynamic mapping is quick turnaround time for " @@ -572,6 +832,7 @@ msgstr "" "modelo de domínio apropriado na camada do topo num futuro próximo. " #. Tag: para +#: persistent_classes.xml:290 #, no-c-format msgid "" "Entity representation modes can also be set on a per SessionSession:" +#. Tag: programlisting +#: persistent_classes.xml:293 +#, no-c-format +msgid "" +"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" +msgstr "" + #. Tag: para +#: persistent_classes.xml:295 #, no-c-format msgid "" "Please note that the call to getSession() using an " @@ -602,31 +881,35 @@ msgstr "" "manuseio da conexão para a unidade primária do trabalho. " #. Tag: para -#, no-c-format +#: persistent_classes.xml:304 +#, fuzzy, no-c-format msgid "" "More information about the XML representation capabilities can be found in " -"." +"." msgstr "" "Você poderá encontrar maiores informações sobre as atividades de " "representação XML em . " #. Tag: title +#: persistent_classes.xml:310 #, no-c-format msgid "Tuplizers" msgstr "Tuplizadores" #. Tag: para -#, no-c-format +#: persistent_classes.xml:312 +#, fuzzy, no-c-format msgid "" -"org.hibernate.tuple.Tuplizer, and its sub-interfaces, are " -"responsible for managing a particular representation of a piece of data " -"given that representation's org.hibernate.EntityMode. If " -"a given piece of data is thought of as a data structure, then a tuplizer is " -"the thing that 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 corresponding tuplizer knows how create the POJO " -"through its constructor. It also knows how to access the POJO properties " -"using the defined property accessors." +"org.hibernate.tuple.Tuplizer and its sub-" +"interfaces are responsible for managing a particular representation of a " +"piece of data given that representation's org.hibernate." +"EntityMode. If a given piece of data is thought of as a data " +"structure, then a tuplizer is the thing that knows how to create such a data " +"structure, how to extract values from such a data structure and how to " +"inject values into such a data structure. For example, for the POJO entity " +"mode, the corresponding tuplizer knows how create the POJO through its " +"constructor. It also knows how to access the POJO properties using the " +"defined property accessors." msgstr "" "org.hibernate.tuple.Tuplizer, e suas sub-interfaces, são " "responsáveis por gerenciar uma certa representação de uma parte de dado, " @@ -639,33 +922,44 @@ msgstr "" "propriedades definidas. " #. Tag: para +#: persistent_classes.xml:322 #, no-c-format -msgid "" -"There are two high-level types of Tuplizers, represented by the org." -"hibernate.tuple.entity.EntityTuplizer and org.hibernate." -"tuple.component.ComponentTuplizer interfaces. " -"EntityTuplizers are responsible for managing the above " -"mentioned contracts in regards to entities, while " -"ComponentTuplizers do the same for components." +msgid "There are two (high-level) types of Tuplizers:" msgstr "" -"Existem dois tipos de alto nível de Tuplizadores, representados pelas " -"interfaces org.hibernate.tuple.entity.EntityTuplizer e " -"org.hibernate.tuple.component.ComponentTuplizer. Os " -"EntityTuplizers são responsáveis pelo gerenciamento dos " -"contratos mencionados acima em relação às entidades, enquanto os " -"ComponentTuplizers realizam o mesmo para os componentes." #. Tag: para +#: persistent_classes.xml:326 #, no-c-format msgid "" -"Users can also plug in their own tuplizers. Perhaps you require that a " -"java.util.Map implementation other than java." -"util.HashMap 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. Tuplizer definitions are attached to the entity or component " -"mapping they are meant to manage. Going back to the example of our customer " -"entity:" +"org.hibernate.tuple.entity.EntityTuplizer " +"which is responsible for managing the above mentioned contracts in regards " +"to entities" +msgstr "" + +#. Tag: para +#: persistent_classes.xml:332 +#, no-c-format +msgid "" +"org.hibernate.tuple.component.ComponentTuplizer which does the same for components" +msgstr "" + +#. Tag: para +#: persistent_classes.xml:340 +#, fuzzy, no-c-format +msgid "" +"Users can also plug in their own tuplizers. Perhaps you require that " +"java.util.Map implementation other than " +"java.util.HashMap 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. Tuplizer definitions are attached to the " +"entity or component mapping they are meant to manage. Going back to the " +"example of our Customer entity, shows how to specify a custom " +"org.hibernate.tuple.entity.EntityTuplizer " +"using annotations while shows how to do the same in hbm.xml" msgstr "" "Os usuários podem também plugar seu próprio tuplizador. Talvez você queira " "usar uma implementação java.util.Map ao invés de uma " @@ -678,26 +972,83 @@ msgstr "" "nosso cliente:" #. Tag: title +#: persistent_classes.xml:353 +#, no-c-format +msgid "Specify custom tuplizers in annotations" +msgstr "" + +#. Tag: programlisting +#: persistent_classes.xml:354 +#, no-c-format +msgid "" +"@Entity\n" +"@Tuplizer(impl = DynamicEntityTuplizer.class)\n" +"public interface Cuisine {\n" +" @Id\n" +" @GeneratedValue\n" +" public Long getId();\n" +" public void setId(Long id);\n" +"\n" +" public String getName();\n" +" public void setName(String name);\n" +"\n" +" @Tuplizer(impl = DynamicComponentTuplizer.class)\n" +" public Country getCountry();\n" +" public void setCountry(Country country);\n" +"}" +msgstr "" + +#. Tag: title +#: persistent_classes.xml:357 +#, no-c-format +msgid "Specify custom tuplizers in hbm.xml" +msgstr "" + +#. Tag: programlisting +#: persistent_classes.xml:358 +#, no-c-format +msgid "" +"<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>" +msgstr "" + +#. Tag: title +#: persistent_classes.xml:363 #, no-c-format msgid "EntityNameResolvers" msgstr "EntityNameResolvers" #. Tag: para -#, no-c-format +#: persistent_classes.xml:365 +#, fuzzy, no-c-format msgid "" -"The org.hibernate.EntityNameResolver " -"interface is a contract for resolving the entity name of a given entity " -"instance. The interface defines a single method " -"resolveEntityName which is passed the entity " -"instance and is expected to return the appropriate entity name (null is " -"allowed and would indicate that the resolver does not know how to resolve " -"the entity name of the given entity instance). Generally speaking, an " -"org.hibernate.EntityNameResolver is going to " -"be most useful in the case of dynamic models. One example might be using " -"proxied interfaces as your domain model. The hibernate test suite has an " -"example of this exact style of usage under the org.hibernate.test." -"dynamicentity.tuplizer2. Here is some of the code from that " -"package for illustration." +"org.hibernate.EntityNameResolver is a " +"contract for resolving the entity name of a given entity instance. The " +"interface defines a single method resolveEntityName " +"which is passed the entity instance and is expected to return the " +"appropriate entity name (null is allowed and would indicate that the " +"resolver does not know how to resolve the entity name of the given entity " +"instance). Generally speaking, an org.hibernate." +"EntityNameResolver is going to be most useful in the case of " +"dynamic models. One example might be using proxied interfaces as your domain " +"model. The hibernate test suite has an example of this exact style of usage " +"under the org.hibernate.test.dynamicentity.tuplizer2. " +"Here is some of the code from that package for illustration." msgstr "" "A interface org.hibernate.EntityNameResolver " "é um contrato para resolver o nome da entidade de uma instância de entidade " @@ -713,7 +1064,138 @@ msgstr "" "package>. Segue abaixo parte do código a partir daquele pacote para " "ilustração." +#. Tag: programlisting +#: persistent_classes.xml:377 +#, no-c-format +msgid "" +"/**\n" +" * A very trivial JDK Proxy InvocationHandler implementation where we proxy " +"an\n" +" * interface as the domain model and simply store persistent state in an " +"internal\n" +" * Map. This is an extremely trivial example meant only for illustration.\n" +" */\n" +"public final class DataProxyHandler implements InvocationHandler {\n" +" private String entityName;\n" +" private HashMap data = new HashMap();\n" +"\n" +" public DataProxyHandler(String entityName, Serializable id) {\n" +" this.entityName = entityName;\n" +" data.put( \"Id\", id );\n" +" }\n" +"\n" +" public Object invoke(Object proxy, Method method, Object[] args) " +"throws Throwable {\n" +" String methodName = method.getName();\n" +" if ( methodName.startsWith( \"set\" ) ) {\n" +" String propertyName = methodName.substring( 3 );\n" +" data.put( propertyName, args[0] );\n" +" }\n" +" else if ( methodName.startsWith( \"get\" ) ) {\n" +" String propertyName = methodName.substring( 3 );\n" +" return data.get( propertyName );\n" +" }\n" +" else if ( \"toString\".equals( methodName ) ) {\n" +" return entityName + \"#\" + data.get( \"Id\" );\n" +" }\n" +" else if ( \"hashCode\".equals( methodName ) ) {\n" +" return new Integer( this.hashCode() );\n" +" }\n" +" return null;\n" +" }\n" +"\n" +" public String getEntityName() {\n" +" return entityName;\n" +" }\n" +"\n" +" public HashMap getData() {\n" +" return data;\n" +" }\n" +"}\n" +"\n" +"public class ProxyHelper {\n" +" public static String extractEntityName(Object object) {\n" +" // Our custom java.lang.reflect.Proxy instances actually bundle\n" +" // their appropriate entity name, so we simply extract it from " +"there\n" +" // if this represents one of our proxies; otherwise, we return null\n" +" if ( Proxy.isProxyClass( object.getClass() ) ) {\n" +" InvocationHandler handler = Proxy.getInvocationHandler" +"( object );\n" +" if ( DataProxyHandler.class.isAssignableFrom( handler.getClass" +"() ) ) {\n" +" DataProxyHandler myHandler = ( DataProxyHandler ) handler;\n" +" return myHandler.getEntityName();\n" +" }\n" +" }\n" +" return null;\n" +" }\n" +"\n" +" // various other utility methods ....\n" +"\n" +"}\n" +"\n" +"/**\n" +" * The EntityNameResolver implementation.\n" +" *\n" +" * IMPL NOTE : An EntityNameResolver really defines a strategy for how " +"entity names\n" +" * should be resolved. Since this particular impl can handle resolution for " +"all of our\n" +" * entities we want to take advantage of the fact that SessionFactoryImpl " +"keeps these\n" +" * in a Set so that we only ever have one instance registered. Why? Well, " +"when it\n" +" * comes time to resolve an entity name, Hibernate must iterate over all the " +"registered\n" +" * resolvers. So keeping that number down helps that process be as speedy " +"as possible.\n" +" * Hence the equals and hashCode implementations as is\n" +" */\n" +"public class MyEntityNameResolver implements EntityNameResolver {\n" +" public static final MyEntityNameResolver INSTANCE = new " +"MyEntityNameResolver();\n" +"\n" +" public String resolveEntityName(Object entity) {\n" +" return ProxyHelper.extractEntityName( entity );\n" +" }\n" +"\n" +" public boolean equals(Object obj) {\n" +" return getClass().equals( obj.getClass() );\n" +" }\n" +"\n" +" public int hashCode() {\n" +" return getClass().hashCode();\n" +" }\n" +"}\n" +"\n" +"public class MyEntityTuplizer extends PojoEntityTuplizer {\n" +" public MyEntityTuplizer(EntityMetamodel entityMetamodel, " +"PersistentClass mappedEntity) {\n" +" super( entityMetamodel, mappedEntity );\n" +" }\n" +"\n" +" public EntityNameResolver[] getEntityNameResolvers() {\n" +" return new EntityNameResolver[] { MyEntityNameResolver." +"INSTANCE };\n" +" }\n" +"\n" +" public String determineConcreteSubclassEntityName(Object entityInstance, " +"SessionFactoryImplementor factory) {\n" +" String entityName = ProxyHelper.extractEntityName" +"( entityInstance );\n" +" if ( entityName == null ) {\n" +" entityName = super.determineConcreteSubclassEntityName" +"( entityInstance, factory );\n" +" }\n" +" return entityName;\n" +" }\n" +"\n" +" ..." +msgstr "" + #. Tag: para +#: persistent_classes.xml:379 #, no-c-format msgid "" "In order to register an org.hibernate.EntityNameResolver, os usuários devem tanto:" #. Tag: para -#, no-c-format +#: persistent_classes.xml:383 +#, fuzzy, no-c-format msgid "" -"Implement a custom Tuplizer, implementing the getEntityNameResolvers " -"method." +"Implement a custom tuplizer (see ), implementing the getEntityNameResolvers " +"method" msgstr "" "Implementar um Tuplizer personalizado, implementando o método getEntityNameResolvers." +"link> personalizado, implementando o método " +"getEntityNameResolvers." #. Tag: para +#: persistent_classes.xml:389 #, no-c-format msgid "" "Register it with the org.hibernate.impl.SessionFactoryImpl) usando o método " "registerEntityNameResolver." +#~ msgid "" +#~ "Most Java applications require a persistent class representing felines. " +#~ "For example:" +#~ msgstr "" +#~ "A maior parte dos aplicativos Java requerem uma classe persistente que " +#~ "representa os felinos. Por exemplo:" + +#~ msgid "" +#~ "Cat has a property called id. 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, java.lang." +#~ "String or java.util.Date. If your legacy " +#~ "database table has composite keys, you can use a user-defined class with " +#~ "properties of these types (see the section on composite identifiers later " +#~ "in the chapter.)" +#~ msgstr "" +#~ "Cat possui uma propriedade chamada id. Esta propriedade mapeia para a coluna de chave primária de uma " +#~ "tabela de banco de dados. A propriedade pode ter sido chamada por " +#~ "qualquer nome e seu tipo pode ter sido qualquer um primitivo, ou qualquer " +#~ "tipo \"wrapper\", java.lang.String ou java." +#~ "util.Date. Se sua tabela de banco de dados de legacia possuir " +#~ "chaves compostas, você também poderá usar uma classe de usuário definido, " +#~ "com propriedades destes tipos (veja a seção de identificadores compostos " +#~ "mais adiante.)" + +#~ 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 "" +#~ "A propriedade de identificador é estritamente opcional. Você pode deixá-" +#~ "los desligados e deixar que o Hibernate encontre os identificadores de " +#~ "objeto internamente. No entanto, não recomendamos que faça isto." + +#~ msgid "" +#~ "In fact, some functionality is available only to classes that declare an " +#~ "identifier property:" +#~ msgstr "" +#~ "Na verdade, algumas funcionalidades estão disponíveis somente para " +#~ "classes que declaram uma propriedade de identificador:" + +#~ msgid "" +#~ "Transitive reattachment for detached objects (cascade update or cascade " +#~ "merge) - see " +#~ msgstr "" +#~ "Reconexão transitiva para objetos desanexados (atualização de cascata ou " +#~ "mesclagem de cascata) - veja " + +#~ msgid "Session.saveOrUpdate()" +#~ msgstr "Session.saveOrUpdate()" + +#~ msgid "Session.merge()" +#~ msgstr "Session.merge()" + +#~ msgid "" +#~ "A central feature of Hibernate, proxies, depends " +#~ "upon the persistent class being either non-final, or the implementation " +#~ "of an interface that declares all public methods." +#~ msgstr "" +#~ "Um recurso central do Hibernate, proxies, depende da " +#~ "classe persistente ser tanto não final como uma implementação de uma " +#~ "interface que declare todos os métodos públicos." + +#~ msgid "" +#~ "You can persist final classes that do not implement an " +#~ "interface with Hibernate. You will not, however, be able to use proxies " +#~ "for lazy association fetching which will ultimately limit your options " +#~ "for performance tuning." +#~ msgstr "" +#~ "Você pode persistir as classes final que não " +#~ "implementam uma interface com o Hibernate, mas não poderá usar os proxies " +#~ "para busca por associação lazy, que irá limitar suas opções para ajuste " +#~ "de desempenho. " + +#~ msgid "" +#~ "There are two high-level types of Tuplizers, represented by the " +#~ "org.hibernate.tuple.entity.EntityTuplizer and " +#~ "org.hibernate.tuple.component.ComponentTuplizer " +#~ "interfaces. EntityTuplizers are responsible for " +#~ "managing the above mentioned contracts in regards to entities, while " +#~ "ComponentTuplizers do the same for components." +#~ msgstr "" +#~ "Existem dois tipos de alto nível de Tuplizadores, representados pelas " +#~ "interfaces org.hibernate.tuple.entity.EntityTuplizer e " +#~ "org.hibernate.tuple.component.ComponentTuplizer. Os " +#~ "EntityTuplizers são responsáveis pelo gerenciamento " +#~ "dos contratos mencionados acima em relação às entidades, enquanto os " +#~ "ComponentTuplizers realizam o mesmo para os " +#~ "componentes." diff --git a/documentation/manual/src/main/docbook/pt-BR/content/preface.po b/documentation/manual/src/main/docbook/pt-BR/content/preface.po index 5d6439aa88..6d803caaa6 100644 --- a/documentation/manual/src/main/docbook/pt-BR/content/preface.po +++ b/documentation/manual/src/main/docbook/pt-BR/content/preface.po @@ -109,7 +109,7 @@ msgid "" msgstr "" "Project-Id-Version: preface\n" "Report-Msgid-Bugs-To: http://bugs.kde.org\n" -"POT-Creation-Date: 2010-02-11T05:38:15\n" +"POT-Creation-Date: 2010-07-20 21:02+0000\n" "PO-Revision-Date: 2010-03-18 15:24+1000\n" "Last-Translator: \n" "Language-Team: \n" @@ -119,19 +119,24 @@ msgstr "" "X-Generator: KBabel 1.11.4\n" #. Tag: title +#: preface.xml:33 #, no-c-format msgid "Preface" msgstr "Prefácio" #. Tag: para -#, no-c-format +#: preface.xml:35 +#, fuzzy, 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." +"Working with both Object-Oriented software and Relational Databases can be " +"cumbersome and time consuming. Development costs are significantly higher " +"due to a paradigm mismatch between how data is represented in objects versus " +"relational databases. Hibernate is an Object/Relational Mapping solution for " +"Java environments. The term Object/Relational Mapping refers to the " +"technique of mapping a data representation from an object model to a " +"relational data model with a SQL-based schema; see http://en.wikipedia.org/wiki/" +"Object-relational_mapping for a discussion." msgstr "" "O trabalho com o software objeto relacional e banco de dados relacionais, " "pode ser incômodo e desgastante atualmente num meio empresarial. Hibernate é " @@ -141,6 +146,30 @@ msgstr "" "um esquema baseado na SQL. " #. Tag: para +#: preface.xml:46 +#, no-c-format +msgid "" +"While having a strong background in SQL is not required to use Hibernate, " +"having a basic understanding of the concepts can greatly help you understand " +"Hibernate more fully and quickly. Probably the single best background is an " +"understanding of data modeling principles. You might want to consider these " +"resources as a good starting point:" +msgstr "" + +#. Tag: ulink +#: preface.xml:54 +#, no-c-format +msgid "http://www.agiledata.org/essays/dataModeling101.html" +msgstr "" + +#. Tag: ulink +#: preface.xml:59 +#, no-c-format +msgid "http://en.wikipedia.org/wiki/Data_modeling" +msgstr "" + +#. Tag: para +#: preface.xml:66 #, no-c-format msgid "" "Hibernate not only takes care of the mapping from Java classes to database " @@ -155,16 +184,28 @@ msgstr "" "contrário, consumido com o manual de dados executados em SQL e JDBC. " #. Tag: para +#: preface.xml:72 #, no-c-format msgid "" -"Hibernate's 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." +"Hibernate’s design goal is to relieve the developer from 95% of common data " +"persistence-related programming tasks by eliminating the need for manual, " +"hand-crafted data processing using SQL and JDBC. However, unlike many other " +"persistence solutions, Hibernate does not hide the power of SQL from you and " +"guarantees that your investment in relational technology and knowledge is as " +"valid as always." +msgstr "" + +#. Tag: para +#: preface.xml:79 +#, fuzzy, no-c-format +msgid "" +"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 "" "A meta de Hibernate é aliviar o desenvolvedor em 95% de dados comuns de " "persistência relacionados as tarefas de programação. O Hibernate talvez não " @@ -178,6 +219,7 @@ msgstr "" "gráfico de objetos." #. Tag: para +#: preface.xml:88 #, no-c-format msgid "" "If you are new to Hibernate and Object/Relational Mapping or even Java, " @@ -187,25 +229,29 @@ msgstr "" "Hibernate, Mapeamento Objeto/Relacional ou mesmo Java:" #. Tag: para -#, no-c-format +#: preface.xml:95 +#, fuzzy, no-c-format msgid "" -"Read for a tutorial with step-by-step " +"Read for a tutorial with step-by-step " "instructions. The source code for the tutorial is included in the " "distribution in the doc/reference/tutorial/ directory." msgstr "" -"Leia com passo-a-passo de instruções tutoriais. " -"O código de origem tutorial está incluído no diretório de distribuição doc/reference/tutorial/." +"Leia com passo-a-passo de instruções " +"tutoriais. O código de origem tutorial está incluído no diretório de " +"distribuição doc/reference/tutorial/." #. Tag: para -#, no-c-format +#: preface.xml:103 +#, fuzzy, no-c-format msgid "" -"Read to understand the environments where " +"Read to understand the environments where " "Hibernate can be used." msgstr "" "Leia para melhor entendimento dos meios " "onde Hibernate pode ser utilizado. " #. Tag: para +#: preface.xml:109 #, no-c-format msgid "" "View the eg/ directory in the Hibernate distribution. It " @@ -224,20 +270,25 @@ msgstr "" "literal>. " #. Tag: para -#, no-c-format +#: preface.xml:120 +#, fuzzy, no-c-format msgid "" "Use this reference documentation as your primary source of information. " "Consider reading if you need " "more help with application design, or if you prefer a step-by-step tutorial. " -"Also visit and download " -"the example application from ." +"Also visit and " +"download the example application from ." msgstr "" "Utilize esta documentação de referência como a sua primeira fonte de " -"informação. Considere a leitura , caso você precise de auxílio com a aplicação de design, ou tutorial com passo-a-passo, caso seja desejado. " -"Você pode também visitar e fazer o " -"download do exemplo de aplicação da ." +"informação. Considere a leitura , caso você precise de auxílio com a aplicação de design, ou " +"tutorial com passo-a-passo, caso seja desejado. Você pode também visitar " +" e fazer o download do " +"exemplo de aplicação da ." #. Tag: para +#: preface.xml:130 #, no-c-format msgid "FAQs are answered on the Hibernate website." msgstr "" @@ -245,6 +296,7 @@ msgstr "" "Hibernate. " #. Tag: para +#: preface.xml:135 #, no-c-format msgid "" "Links to third party demos, examples, and tutorials are maintained on the " @@ -254,6 +306,7 @@ msgstr "" "website Hibernate. " #. Tag: para +#: preface.xml:141 #, no-c-format msgid "" "The Community Area on the Hibernate website is a good resource for design " @@ -264,34 +317,93 @@ msgstr "" "design e várias soluções integradas. ( Tomcat, JBoss AS, Struts, EJB, etc. )" #. Tag: para +#: preface.xml:149 #, no-c-format msgid "" -"If you have questions, use the user forum linked on the Hibernate website. " -"We also provide a JIRA issue tracking 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." +"There are a number of ways to become involved in the Hibernate community, " +"including" msgstr "" -"Em caso de dúvidas, utilize o fórum do usuário encontrado no website " -"Hibernate. Nós também provemos o JIRA sistema de questão de rastreamento " -"para os relatórios de erros de programação e recursos solicitados. Se você " -"tem interesse no desenvolvimento do Hibernate, participe da lista de correio " -"eletrônico do desenvolvedor. Caso você tenha interesse em traduzir este " -"documento na sua própria língua, por favor entre em contato conosco através " -"da lista de correio eletrônico do desenvolvedor. " #. Tag: para +#: preface.xml:153 #, 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." +"Trying stuff out and reporting bugs. See http://hibernate.org/issuetracker.html details." msgstr "" -"O suporte do desenvolvimento comercial, suporte de produção e treinamento de " -"Hibernate está disponível através do JBoss Inc. ( see http://www.hibernate." -"org/SupportTraining/ ). Hibernate é um projeto de Fonte Aberta Profissional " -"e componente crítico do Sistema Jboss de Empreendimento e Middleware " -"( JEMS ) suíte de produtos. " +#. Tag: para +#: preface.xml:160 +#, no-c-format +msgid "" +"Trying your hand at fixing some bugs or implementing enhancements. Again, " +"see http://hibernate." +"org/issuetracker.html details." +msgstr "" + +#. Tag: para +#: preface.xml:167 +#, no-c-format +msgid "" +"http://hibernate.org/" +"community.html list a few ways to engage in the community." +msgstr "" + +#. Tag: para +#: preface.xml:172 +#, no-c-format +msgid "" +"There are forums for users to ask questions and receive help from the " +"community." +msgstr "" + +#. Tag: para +#: preface.xml:177 +#, no-c-format +msgid "" +"There are also IRC channels for both user and developer discussions." +msgstr "" + +#. Tag: para +#: preface.xml:186 +#, no-c-format +msgid "" +"Helping improve or translate this documentation. Contact us on the developer " +"mailing list if you have interest." +msgstr "" + +#. Tag: para +#: preface.xml:192 +#, no-c-format +msgid "Evangelizing Hibernate within your organization." +msgstr "" + +#~ msgid "" +#~ "If you have questions, use the user forum linked on the Hibernate " +#~ "website. We also provide a JIRA issue tracking 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 "" +#~ "Em caso de dúvidas, utilize o fórum do usuário encontrado no website " +#~ "Hibernate. Nós também provemos o JIRA sistema de questão de rastreamento " +#~ "para os relatórios de erros de programação e recursos solicitados. Se " +#~ "você tem interesse no desenvolvimento do Hibernate, participe da lista de " +#~ "correio eletrônico do desenvolvedor. Caso você tenha interesse em " +#~ "traduzir este documento na sua própria língua, por favor entre em contato " +#~ "conosco através da lista de correio eletrônico do desenvolvedor. " + +#~ 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 "" +#~ "O suporte do desenvolvimento comercial, suporte de produção e treinamento " +#~ "de Hibernate está disponível através do JBoss Inc. ( see http://www." +#~ "hibernate.org/SupportTraining/ ). Hibernate é um projeto de Fonte Aberta " +#~ "Profissional e componente crítico do Sistema Jboss de Empreendimento e " +#~ "Middleware ( JEMS ) suíte de produtos. " diff --git a/documentation/manual/src/main/docbook/pt-BR/content/query_sql.po b/documentation/manual/src/main/docbook/pt-BR/content/query_sql.po index 2236865a0c..9b3e9fae2e 100644 --- a/documentation/manual/src/main/docbook/pt-BR/content/query_sql.po +++ b/documentation/manual/src/main/docbook/pt-BR/content/query_sql.po @@ -108,7 +108,7 @@ msgid "" msgstr "" "Project-Id-Version: query_sql\n" "Report-Msgid-Bugs-To: http://bugs.kde.org\n" -"POT-Creation-Date: 2010-03-12T00:03:47\n" +"POT-Creation-Date: 2010-07-20 21:02+0000\n" "PO-Revision-Date: 2010-03-19 09:46+1000\n" "Last-Translator: \n" "Language-Team: \n" @@ -118,11 +118,13 @@ msgstr "" "X-Generator: KBabel 1.11.4\n" #. Tag: title +#: query_sql.xml:31 #, no-c-format msgid "Native SQL" msgstr "SQL Nativo" #. Tag: para +#: query_sql.xml:33 #, no-c-format msgid "" "You can also express queries in the native SQL dialect of your database. " @@ -138,6 +140,7 @@ msgstr "" "de uma aplicação baseada em SQL/JDBC direta até o Hibernate. " #. Tag: para +#: query_sql.xml:39 #, no-c-format msgid "" "Hibernate3 allows you to specify handwritten SQL, including stored " @@ -148,11 +151,13 @@ msgstr "" "deletar e carregar." #. Tag: title +#: query_sql.xml:43 #, no-c-format msgid "Using a SQLQuery" msgstr "Usando um SQLQuery" #. Tag: para +#: query_sql.xml:45 #, no-c-format msgid "" "Execution of native SQL queries is controlled via the SQLQueryResultSetMetadata, or " @@ -198,22 +215,36 @@ msgstr "" "para ser mais explícito em o quê é retornado, você poderá usar o " "addScalar():" +#. Tag: programlisting +#: query_sql.xml:67 +#, no-c-format +msgid "" +"sess.createSQLQuery(\"SELECT * FROM CATS\")\n" +" .addScalar(\"ID\", Hibernate.LONG)\n" +" .addScalar(\"NAME\", Hibernate.STRING)\n" +" .addScalar(\"BIRTHDATE\", Hibernate.DATE)" +msgstr "" + #. Tag: para +#: query_sql.xml:69 query_sql.xml:116 query_sql.xml:197 query_sql.xml:349 #, no-c-format msgid "This query specified:" msgstr "Esta consulta especificou:" #. Tag: para +#: query_sql.xml:73 query_sql.xml:120 query_sql.xml:353 #, no-c-format msgid "the SQL query string" msgstr "A string da consulta SQL" #. Tag: para +#: query_sql.xml:77 #, no-c-format msgid "the columns and types to return" msgstr "as colunas e tipos para retornar" #. Tag: para +#: query_sql.xml:81 #, no-c-format msgid "" "This will return Object arrays, but now it will not use " @@ -232,6 +263,7 @@ msgstr "" "colunas listadas. " #. Tag: para +#: query_sql.xml:89 #, no-c-format msgid "" "It is possible to leave out the type information for all or some of the " @@ -240,7 +272,18 @@ msgstr "" "É possível deixar de fora o tipo de informação para todos ou alguns dos " "escalares." +#. Tag: programlisting +#: query_sql.xml:92 +#, no-c-format +msgid "" +"sess.createSQLQuery(\"SELECT * FROM CATS\")\n" +" .addScalar(\"ID\", Hibernate.LONG)\n" +" .addScalar(\"NAME\")\n" +" .addScalar(\"BIRTHDATE\")" +msgstr "" + #. Tag: para +#: query_sql.xml:94 #, no-c-format msgid "" "This is essentially the same query as before, but now " @@ -252,6 +295,7 @@ msgstr "" "e DATA DE NASCIMENTO onde o tipo de ID é explicitamente especificado. " #. Tag: para +#: query_sql.xml:99 #, no-c-format msgid "" "How the java.sql.Types returned from ResultSetMetaData is mapped to " @@ -265,11 +309,13 @@ msgstr "" "chamadas para registerHibernateType no Dialeto. " #. Tag: title +#: query_sql.xml:107 #, no-c-format msgid "Entity queries" msgstr "Consultas de Entidade" #. Tag: para +#: query_sql.xml:109 #, no-c-format msgid "" "The above queries were all about returning scalar values, basically " @@ -282,12 +328,23 @@ msgstr "" "resultados. A seguir, mostramos como obter objetos de entidade da consulta " "sql nativa através do addEntity()." +#. Tag: programlisting +#: query_sql.xml:114 +#, no-c-format +msgid "" +"sess.createSQLQuery(\"SELECT * FROM CATS\").addEntity(Cat.class);\n" +"sess.createSQLQuery(\"SELECT ID, NAME, BIRTHDATE FROM CATS\").addEntity(Cat." +"class);" +msgstr "" + #. Tag: para +#: query_sql.xml:124 #, no-c-format msgid "the entity returned by the query" msgstr "A entidade retornada por uma consulta" #. Tag: para +#: query_sql.xml:128 #, no-c-format msgid "" "Assuming that Cat is mapped as a class with the columns ID, NAME and " @@ -299,6 +356,7 @@ msgstr "" "elemento é uma entidade de Cat." #. Tag: para +#: query_sql.xml:132 #, no-c-format msgid "" "If the entity is mapped with a many-to-one to another " @@ -315,17 +373,28 @@ msgstr "" "a anotação, mas preferimos ser explícitos como no seguinte exemplo para " "umamuitos-para-um para um Dog:" +#. Tag: programlisting +#: query_sql.xml:140 +#, no-c-format +msgid "" +"sess.createSQLQuery(\"SELECT ID, NAME, BIRTHDATE, DOG_ID FROM CATS\")." +"addEntity(Cat.class);" +msgstr "" + #. Tag: para +#: query_sql.xml:142 #, no-c-format msgid "This will allow cat.getDog() to function properly." msgstr "Isto irá permitir que o cat.getDog() funcione de forma apropriada" #. Tag: title +#: query_sql.xml:146 #, no-c-format msgid "Handling associations and collections" msgstr "Manuseio de associações e coleções" #. Tag: para +#: query_sql.xml:148 #, no-c-format msgid "" "It is possible to eagerly join in the Dog to avoid the " @@ -338,7 +407,18 @@ msgstr "" "método addJoin()que permite que você se una à associação " "ou coleção." +#. Tag: programlisting +#: query_sql.xml:153 +#, no-c-format +msgid "" +"sess.createSQLQuery(\"SELECT c.ID, NAME, BIRTHDATE, DOG_ID, D_ID, D_NAME " +"FROM CATS c, DOGS d WHERE c.DOG_ID = d.D_ID\")\n" +" .addEntity(\"cat\", Cat.class)\n" +" .addJoin(\"cat.dog\");" +msgstr "" + #. Tag: para +#: query_sql.xml:155 #, no-c-format msgid "" "In this example, the returned Cat's will have their " @@ -355,7 +435,18 @@ msgstr "" "união para coleções, ex.: se ao invés disso, o Cat " "tivesse um-para-muitos para Dog." +#. Tag: programlisting +#: query_sql.xml:163 +#, no-c-format +msgid "" +"sess.createSQLQuery(\"SELECT ID, NAME, BIRTHDATE, D_ID, D_NAME, CAT_ID FROM " +"CATS c, DOGS d WHERE c.ID = d.CAT_ID\")\n" +" .addEntity(\"cat\", Cat.class)\n" +" .addJoin(\"cat.dogs\");" +msgstr "" + #. Tag: para +#: query_sql.xml:165 #, no-c-format msgid "" "At this stage you are reaching the limits of what is possible with native " @@ -370,11 +461,13 @@ msgstr "" "suficientes. " #. Tag: title +#: query_sql.xml:173 #, no-c-format msgid "Returning multiple entities" msgstr "Retorno de entidades múltiplas" #. Tag: para +#: query_sql.xml:175 #, no-c-format msgid "" "Until now, the result set column names are assumed to be the same as the " @@ -389,6 +482,7 @@ msgstr "" "mais de uma tabela. " #. Tag: para +#: query_sql.xml:180 #, no-c-format msgid "" "Column alias injection is needed in the following query (which most likely " @@ -397,7 +491,18 @@ msgstr "" "É necessário uma injeção de alias de coluna na seguinte consulta (a qual é " "bem provável que falhe):" +#. Tag: programlisting +#: query_sql.xml:183 +#, no-c-format +msgid "" +"sess.createSQLQuery(\"SELECT c.*, m.* FROM CATS c, CATS m WHERE c.MOTHER_ID " +"= c.ID\")\n" +" .addEntity(\"cat\", Cat.class)\n" +" .addEntity(\"mother\", Cat.class)" +msgstr "" + #. Tag: para +#: query_sql.xml:185 #, no-c-format msgid "" "The query was intended to return two Cat instances per row: a cat and its " @@ -415,11 +520,23 @@ msgstr "" "mapeamento (\"ID\" e \"NOME\"). " #. Tag: para +#: query_sql.xml:192 #, no-c-format msgid "The following form is not vulnerable to column name duplication:" msgstr "A seguinte forma não é vulnerável à duplicação do nome de coluna:" +#. Tag: programlisting +#: query_sql.xml:195 +#, no-c-format +msgid "" +"sess.createSQLQuery(\"SELECT {cat.*}, {mother.*} FROM CATS c, CATS m WHERE " +"c.MOTHER_ID = c.ID\")\n" +" .addEntity(\"cat\", Cat.class)\n" +" .addEntity(\"mother\", Cat.class)" +msgstr "" + #. Tag: para +#: query_sql.xml:201 #, no-c-format msgid "" "the SQL query string, with placeholders for Hibernate to inject column " @@ -429,11 +546,13 @@ msgstr "" "aliases de coluna." #. Tag: para +#: query_sql.xml:206 #, no-c-format msgid "the entities returned by the query" msgstr "as entidades retornadas pela consulta" #. Tag: para +#: query_sql.xml:210 #, no-c-format msgid "" "The {cat.*} and {mother.*} notation used above is a shorthand for \"all " @@ -454,12 +573,28 @@ msgstr "" "Note que podemos até usar os aliases de propriedade na cláusula where se " "quisermos." +#. Tag: programlisting +#: query_sql.xml:219 +#, no-c-format +msgid "" +"String sql = \"SELECT ID as {c.id}, NAME as {c.name}, \" +\n" +" \"BIRTHDATE as {c.birthDate}, MOTHER_ID as {c.mother}, {mother.*} " +"\" +\n" +" \"FROM CAT_LOG c, CAT_LOG m WHERE {c.mother} = c.ID\";\n" +"\n" +"List loggedCats = sess.createSQLQuery(sql)\n" +" .addEntity(\"cat\", Cat.class)\n" +" .addEntity(\"mother\", Cat.class).list()" +msgstr "" + #. Tag: title +#: query_sql.xml:222 #, no-c-format msgid "Alias and property references" msgstr "Alias e referências de propriedades" #. Tag: para +#: query_sql.xml:224 #, no-c-format msgid "" "In most cases the above alias injection is needed. For queries relating to " @@ -473,6 +608,7 @@ msgstr "" "aliases específicos que permitem o Hibernate injetar os aliases apropriados." #. Tag: para +#: query_sql.xml:229 #, no-c-format msgid "" "The following table shows the different ways you can use the alias " @@ -485,180 +621,213 @@ msgstr "" "alias terá um nome único e provavelmente diferente quando usado." #. Tag: title +#: query_sql.xml:235 #, no-c-format msgid "Alias injection names" msgstr "Nomes de injeção de alias" #. Tag: entry +#: query_sql.xml:246 #, no-c-format msgid "Description" msgstr "Descrição" #. Tag: entry +#: query_sql.xml:248 #, no-c-format msgid "Syntax" msgstr "Sintáxe" #. Tag: entry +#: query_sql.xml:250 #, no-c-format msgid "Example" msgstr "Exemplo" #. Tag: entry +#: query_sql.xml:256 #, no-c-format msgid "A simple property" msgstr "Uma propriedade simples" -#. Tag: entry -#, no-c-format -msgid "{[aliasname].[propertyname]" +#. Tag: literal +#: query_sql.xml:258 +#, fuzzy, no-c-format +msgid "{[aliasname].[propertyname]" msgstr "{[aliasname].[propertyname]" -#. Tag: entry -#, no-c-format -msgid "A_NAME as {item.name}" +#. Tag: literal +#: query_sql.xml:260 +#, fuzzy, no-c-format +msgid "A_NAME as {item.name}" msgstr "A_NAME as {item.name}" #. Tag: entry +#: query_sql.xml:264 #, no-c-format msgid "A composite property" msgstr "Uma propriedade composta" -#. Tag: entry -#, no-c-format -msgid "{[aliasname].[componentname].[propertyname]}" +#. Tag: literal +#: query_sql.xml:266 +#, fuzzy, no-c-format +msgid "{[aliasname].[componentname].[propertyname]}" msgstr "{[aliasname].[componentname].[propertyname]}" -#. Tag: entry -#, no-c-format -msgid "" -"CURRENCY as {item.amount.currency}, VALUE as {item.amount.value}" +#. Tag: literal +#: query_sql.xml:268 +#, fuzzy, no-c-format +msgid "CURRENCY as {item.amount.currency}, VALUE as {item.amount.value}" msgstr "" "CURRENCY as {item.amount.currency}, VALUE as {item.amount.value}" #. Tag: entry +#: query_sql.xml:273 #, no-c-format msgid "Discriminator of an entity" msgstr "Discriminador de uma entidade" -#. Tag: entry -#, no-c-format -msgid "{[aliasname].class}" +#. Tag: literal +#: query_sql.xml:275 +#, fuzzy, no-c-format +msgid "{[aliasname].class}" msgstr "{[aliasname].class}" -#. Tag: entry -#, no-c-format -msgid "DISC as {item.class}" +#. Tag: literal +#: query_sql.xml:277 +#, fuzzy, no-c-format +msgid "DISC as {item.class}" msgstr "DISC as {item.class}" #. Tag: entry +#: query_sql.xml:281 #, no-c-format msgid "All properties of an entity" msgstr "Todas as propriedades de uma entidade" -#. Tag: entry -#, no-c-format -msgid "{[aliasname].*}" +#. Tag: literal +#: query_sql.xml:283 query_sql.xml:331 +#, fuzzy, no-c-format +msgid "{[aliasname].*}" msgstr "{[aliasname].*}" -#. Tag: entry +#. Tag: literal +#: query_sql.xml:285 #, no-c-format -msgid "{item.*}" -msgstr "{item.*}" +msgid "{item.*}" +msgstr "" #. Tag: entry +#: query_sql.xml:289 #, no-c-format msgid "A collection key" msgstr "Uma chave de coleção" -#. Tag: entry -#, no-c-format -msgid "{[aliasname].key}" +#. Tag: literal +#: query_sql.xml:291 +#, fuzzy, no-c-format +msgid "{[aliasname].key}" msgstr "{[aliasname].key}" -#. Tag: entry -#, no-c-format -msgid "ORGID as {coll.key}" +#. Tag: literal +#: query_sql.xml:293 +#, fuzzy, no-c-format +msgid "ORGID as {coll.key}" msgstr "ORGID as {coll.key}" #. Tag: entry +#: query_sql.xml:297 #, no-c-format msgid "The id of an collection" msgstr "O id de uma coleção" -#. Tag: entry -#, no-c-format -msgid "{[aliasname].id}" +#. Tag: literal +#: query_sql.xml:299 +#, fuzzy, no-c-format +msgid "{[aliasname].id}" msgstr "{[aliasname].id}" -#. Tag: entry -#, no-c-format -msgid "EMPID as {coll.id}" +#. Tag: literal +#: query_sql.xml:301 +#, fuzzy, no-c-format +msgid "EMPID as {coll.id}" msgstr "EMPID as {coll.id}" #. Tag: entry +#: query_sql.xml:305 #, no-c-format msgid "The element of an collection" msgstr "O elemento de uma coleção" -#. Tag: entry -#, no-c-format -msgid "{[aliasname].element}" +#. Tag: literal +#: query_sql.xml:307 +#, fuzzy, no-c-format +msgid "{[aliasname].element}" msgstr "{[aliasname].element}" -#. Tag: entry -#, no-c-format -msgid "XID as {coll.element}" +#. Tag: literal +#: query_sql.xml:309 +#, fuzzy, no-c-format +msgid "XID as {coll.element}" msgstr "XID as {coll.element}" #. Tag: entry +#: query_sql.xml:313 #, no-c-format msgid "property of the element in the collection" msgstr "propriedade de elemento na coleção " -#. Tag: entry -#, no-c-format -msgid "{[aliasname].element.[propertyname]}" +#. Tag: literal +#: query_sql.xml:315 +#, fuzzy, no-c-format +msgid "{[aliasname].element.[propertyname]}" msgstr "{[aliasname].element.[propertyname]}" -#. Tag: entry -#, no-c-format -msgid "NAME as {coll.element.name}" +#. Tag: literal +#: query_sql.xml:317 +#, fuzzy, no-c-format +msgid "NAME as {coll.element.name}" msgstr "NAME as {coll.element.name}" #. Tag: entry +#: query_sql.xml:321 #, no-c-format msgid "All properties of the element in the collection" msgstr "Todas as propriedades de elemento na coleção" -#. Tag: entry -#, no-c-format -msgid "{[aliasname].element.*}" +#. Tag: literal +#: query_sql.xml:323 +#, fuzzy, no-c-format +msgid "{[aliasname].element.*}" msgstr "{[aliasname].element.*}" -#. Tag: entry -#, no-c-format -msgid "{coll.element.*}" +#. Tag: literal +#: query_sql.xml:325 +#, fuzzy, no-c-format +msgid "{coll.element.*}" msgstr "{coll.element.*}" #. Tag: entry +#: query_sql.xml:329 #, no-c-format msgid "All properties of the collection" msgstr "Todas as propriedades da coleção " -#. Tag: entry +#. Tag: literal +#: query_sql.xml:333 #, no-c-format -msgid "{coll.*}" -msgstr "{coll.*}" +msgid "{coll.*}" +msgstr "" #. Tag: title +#: query_sql.xml:342 #, no-c-format msgid "Returning non-managed entities" msgstr "Retorno de entidades não gerenciadas" #. Tag: para +#: query_sql.xml:344 #, no-c-format msgid "" "It is possible to apply a ResultTransformer to native SQL queries, allowing " @@ -667,12 +836,22 @@ msgstr "" "É possível aplicar um ResultTransformer para consultas sql nativas, " "permitindo que o retorno de entidades não gerenciadas." +#. Tag: programlisting +#: query_sql.xml:347 +#, no-c-format +msgid "" +"sess.createSQLQuery(\"SELECT NAME, BIRTHDATE FROM CATS\")\n" +" .setResultTransformer(Transformers.aliasToBean(CatDTO.class))" +msgstr "" + #. Tag: para +#: query_sql.xml:357 #, no-c-format msgid "a result transformer" msgstr "um transformador de resultado" #. Tag: para +#: query_sql.xml:361 #, no-c-format msgid "" "The above query will return a list of CatDTO which has " @@ -684,11 +863,13 @@ msgstr "" "propriedades correspondentes ou campos." #. Tag: title +#: query_sql.xml:367 #, no-c-format msgid "Handling inheritance" msgstr "Manuseio de herança" #. Tag: para +#: query_sql.xml:369 #, no-c-format msgid "" "Native SQL queries which query for entities that are mapped as part of an " @@ -700,35 +881,90 @@ msgstr "" "as suas subclasses. " #. Tag: title +#: query_sql.xml:375 #, no-c-format msgid "Parameters" msgstr "Parâmetros" #. Tag: para +#: query_sql.xml:377 #, no-c-format msgid "Native SQL queries support positional as well as named parameters:" msgstr "" "Consultas sql Nativas suportam parâmetros posicionais assim como parâmetros " "nomeados:" +#. Tag: programlisting +#: query_sql.xml:380 +#, no-c-format +msgid "" +"Query query = sess.createSQLQuery(\"SELECT * FROM CATS WHERE NAME like ?\")." +"addEntity(Cat.class);\n" +"List pusList = query.setString(0, \"Pus%\").list();\n" +" \n" +"query = sess.createSQLQuery(\"SELECT * FROM CATS WHERE NAME like :name\")." +"addEntity(Cat.class);\n" +"List pusList = query.setString(\"name\", \"Pus%\").list();" +msgstr "" + #. Tag: title +#: query_sql.xml:385 #, no-c-format msgid "Named SQL queries" msgstr "Consultas SQL Nomeadas" #. Tag: para -#, no-c-format +#: query_sql.xml:387 +#, fuzzy, no-c-format msgid "" -"Named SQL queries can be defined in the mapping document and called in " -"exactly the same way as a named HQL query. In this case, you do " -"not need to call addEntity()." +"Named SQL queries can also be defined in the mapping document and called in " +"exactly the same way as a named HQL query (see ). In this case, you do not " +"need to call addEntity()." msgstr "" "Consultas SQL Nomeadas podem ser definidas no documento de mapeamento e " "chamadas exatamente da mesma forma que uma consulta HQL nomeada. Neste caso " "nós não precisamos chamar o addEntity()." +#. Tag: title +#: query_sql.xml:394 +#, no-c-format +msgid "Named sql query using the <sql-query> maping element" +msgstr "" + +#. Tag: programlisting +#: query_sql.xml:397 +#, no-c-format +msgid "" +"<sql-query name=\"persons\">\n" +" <return alias=\"person\" class=\"eg.Person\"/>\n" +" SELECT person.NAME AS {person.name},\n" +" person.AGE AS {person.age},\n" +" person.SEX AS {person.sex}\n" +" FROM PERSON person\n" +" WHERE person.NAME LIKE :namePattern\n" +"</sql-query>" +msgstr "" + +#. Tag: title +#: query_sql.xml:401 +#, no-c-format +msgid "Execution of a named query" +msgstr "" + +#. Tag: programlisting +#: query_sql.xml:403 +#, no-c-format +msgid "" +"List people = sess.getNamedQuery(\"persons\")\n" +" .setString(\"namePattern\", namePattern)\n" +" .setMaxResults(50)\n" +" .list();" +msgstr "" + #. Tag: para +#: query_sql.xml:406 #, no-c-format msgid "" "The <return-join> element is use to join " @@ -739,7 +975,36 @@ msgstr "" "collection> são usados para unir associações e definir " "consultas que inicializam coleções, " +#. Tag: title +#: query_sql.xml:411 +#, no-c-format +msgid "Named sql query with association" +msgstr "" + +#. Tag: programlisting +#: query_sql.xml:413 +#, no-c-format +msgid "" +"<sql-query name=\"personsWith\">\n" +" <return alias=\"person\" class=\"eg.Person\"/>\n" +" <return-join alias=\"address\" property=\"person.mailingAddress\"/" +">\n" +" SELECT person.NAME AS {person.name},\n" +" person.AGE AS {person.age},\n" +" person.SEX AS {person.sex},\n" +" address.STREET AS {address.street},\n" +" address.CITY AS {address.city},\n" +" address.STATE AS {address.state},\n" +" address.ZIP AS {address.zip}\n" +" FROM PERSON person\n" +" JOIN ADDRESS address\n" +" ON person.ID = address.PERSON_ID AND address.TYPE='MAILING'\n" +" WHERE person.NAME LIKE :namePattern\n" +"</sql-query>" +msgstr "" + #. Tag: para +#: query_sql.xml:416 #, no-c-format msgid "" "A named SQL query may return a scalar value. You must declare the column " @@ -750,7 +1015,27 @@ msgstr "" "um alias de coluna e um tipo Hibernate usando o elemento <return-" "scalar>:" +#. Tag: title +#: query_sql.xml:421 +#, no-c-format +msgid "Named query returning a scalar" +msgstr "" + +#. Tag: programlisting +#: query_sql.xml:423 +#, no-c-format +msgid "" +"<sql-query name=\"mySqlQuery\">\n" +" <return-scalar column=\"name\" type=\"string\"/>\n" +" <return-scalar column=\"age\" type=\"long\"/>\n" +" SELECT p.NAME AS name, \n" +" p.AGE AS age,\n" +" FROM PERSON p WHERE p.NAME LIKE 'Hiber%'\n" +"</sql-query>" +msgstr "" + #. Tag: para +#: query_sql.xml:426 #, no-c-format msgid "" "You can externalize the resultset mapping information in a <" @@ -763,7 +1048,39 @@ msgstr "" "diversas consultas nomeadas quanto através da API " "setResultSetMapping()." +#. Tag: title +#: query_sql.xml:432 +#, no-c-format +msgid "<resultset> mapping used to externalize mapping information" +msgstr "" + +#. Tag: programlisting +#: query_sql.xml:435 +#, no-c-format +msgid "" +"<resultset name=\"personAddress\">\n" +" <return alias=\"person\" class=\"eg.Person\"/>\n" +" <return-join alias=\"address\" property=\"person.mailingAddress\"/" +">\n" +"</resultset>\n" +"\n" +"<sql-query name=\"personsWith\" resultset-ref=\"personAddress\">\n" +" SELECT person.NAME AS {person.name},\n" +" person.AGE AS {person.age},\n" +" person.SEX AS {person.sex},\n" +" address.STREET AS {address.street},\n" +" address.CITY AS {address.city},\n" +" address.STATE AS {address.state},\n" +" address.ZIP AS {address.zip}\n" +" FROM PERSON person\n" +" JOIN ADDRESS address\n" +" ON person.ID = address.PERSON_ID AND address.TYPE='MAILING'\n" +" WHERE person.NAME LIKE :namePattern\n" +"</sql-query>" +msgstr "" + #. Tag: para +#: query_sql.xml:438 #, no-c-format msgid "" "You can, alternatively, use the resultset mapping information in your hbm " @@ -773,6 +1090,332 @@ msgstr "" "conjunto de resultado em seus arquivos hbm em código de java. " #. Tag: title +#: query_sql.xml:442 +#, no-c-format +msgid "Programmatically specifying the result mapping information" +msgstr "" + +#. Tag: programlisting +#: query_sql.xml:445 +#, no-c-format +msgid "" +"List cats = sess.createSQLQuery(\n" +" \"select {cat.*}, {kitten.*} from cats cat, cats kitten where kitten." +"mother = cat.id\"\n" +" )\n" +" .setResultSetMapping(\"catAndKitten\")\n" +" .list();" +msgstr "" + +#. Tag: para +#: query_sql.xml:448 +#, no-c-format +msgid "" +"So far we have only looked at externalizing SQL queries using Hibernate " +"mapping files. The same concept is also available with anntations and is " +"called named native queries. You can use @NamedNativeQuery (@NamedNativeQueries) in conjunction with " +"@SqlResultSetMapping (@SqlResultSetMappings). Like @NamedQuery, " +"@NamedNativeQuery and @SqlResultSetMapping can be defined at class level, but their scope is global to the " +"application. Lets look at a view examples." +msgstr "" + +#. Tag: para +#: query_sql.xml:460 +#, no-c-format +msgid "" +"shows how a resultSetMapping parameter is defined in " +"@NamedNativeQuery. It represents the name of a defined " +"@SqlResultSetMapping. The resultset mapping declares the " +"entities retrieved by this native query. Each field of the entity is bound " +"to an SQL alias (or column name). All fields of the entity including the " +"ones of subclasses and the foreign key columns of related entities have to " +"be present in the SQL query. Field definitions are optional provided that " +"they map to the same column name as the one declared on the class property. " +"In the example 2 entities, Night and Area, are returned and each property is declared and associated to a " +"column name, actually the column name retrieved by the query." +msgstr "" + +#. Tag: para +#: query_sql.xml:475 +#, no-c-format +msgid "" +"In the result set " +"mapping is implicit. We only describe the entity class of the result set " +"mapping. The property / column mappings is done using the entity mapping " +"values. In this case the model property is bound to the model_txt column." +msgstr "" + +#. Tag: para +#: query_sql.xml:481 +#, no-c-format +msgid "" +"Finally, if the association to a related entity involve a composite primary " +"key, a @FieldResult element should be used for each " +"foreign key column. The @FieldResult name is composed of " +"the property name for the relationship, followed by a dot (\".\"), followed " +"by the name or the field or property of the primary key. This can be seen in " +"." +msgstr "" + +#. Tag: title +#: query_sql.xml:490 +#, no-c-format +msgid "" +"Named SQL query using @NamedNativeQuery together with " +"@SqlResultSetMapping" +msgstr "" + +#. Tag: programlisting +#: query_sql.xml:493 +#, no-c-format +msgid "" +"@NamedNativeQuery(name=\"night&area\", query=\"select night.id nid, " +"night.night_duration, \"\n" +" + \" night.night_date, area.id aid, night.area_id, area.name \"\n" +" + \"from Night night, Area area where night.area_id = area.id\", \n" +" resultSetMapping=\"joinMapping\")\n" +"@SqlResultSetMapping(name=\"joinMapping\", entities={\n" +" @EntityResult(entityClass=Night.class, fields = {\n" +" @FieldResult(name=\"id\", column=\"nid\"),\n" +" @FieldResult(name=\"duration\", column=\"night_duration\"),\n" +" @FieldResult(name=\"date\", column=\"night_date\"),\n" +" @FieldResult(name=\"area\", column=\"area_id\"),\n" +" discriminatorColumn=\"disc\"\n" +" }),\n" +" @EntityResult(entityClass=org.hibernate.test.annotations.query.Area." +"class, fields = {\n" +" @FieldResult(name=\"id\", column=\"aid\"),\n" +" @FieldResult(name=\"name\", column=\"name\")\n" +" })\n" +" }\n" +")" +msgstr "" + +#. Tag: title +#: query_sql.xml:497 +#, no-c-format +msgid "Implicit result set mapping" +msgstr "" + +#. Tag: programlisting +#: query_sql.xml:499 +#, no-c-format +msgid "" +"@Entity\n" +"@SqlResultSetMapping(name=\"implicit\",\n" +" entities=@EntityResult(entityClass=SpaceShip.class))\n" +"@NamedNativeQuery(name=\"implicitSample\", \n" +" query=\"select * from SpaceShip\", \n" +" resultSetMapping=\"implicit\")\n" +"public class SpaceShip {\n" +" private String name;\n" +" private String model;\n" +" private double speed;\n" +"\n" +" @Id\n" +" public String getName() {\n" +" return name;\n" +" }\n" +"\n" +" public void setName(String name) {\n" +" this.name = name;\n" +" }\n" +"\n" +" @Column(name=\"model_txt\")\n" +" public String getModel() {\n" +" return model;\n" +" }\n" +"\n" +" public void setModel(String model) {\n" +" this.model = model;\n" +" }\n" +"\n" +" public double getSpeed() {\n" +" return speed;\n" +" }\n" +"\n" +" public void setSpeed(double speed) {\n" +" this.speed = speed;\n" +" }\n" +"}" +msgstr "" + +#. Tag: title +#: query_sql.xml:503 +#, no-c-format +msgid "Using dot notation in @FieldResult for specifying associations" +msgstr "" + +#. Tag: programlisting +#: query_sql.xml:506 +#, no-c-format +msgid "" +"@Entity\n" +"@SqlResultSetMapping(name=\"compositekey\",\n" +" entities=@EntityResult(entityClass=SpaceShip.class,\n" +" fields = {\n" +" @FieldResult(name=\"name\", column = \"name\"),\n" +" @FieldResult(name=\"model\", column = \"model\"),\n" +" @FieldResult(name=\"speed\", column = \"speed\"),\n" +" @FieldResult(name=\"captain.firstname\", column = " +"\"firstn\"),\n" +" @FieldResult(name=\"captain.lastname\", column = \"lastn" +"\"),\n" +" @FieldResult(name=\"dimensions.length\", column = " +"\"length\"),\n" +" @FieldResult(name=\"dimensions.width\", column = \"width" +"\")\n" +" }),\n" +" columns = { @ColumnResult(name = \"surface\"),\n" +" @ColumnResult(name = \"volume\") } )\n" +"\n" +"@NamedNativeQuery(name=\"compositekey\",\n" +" query=\"select name, model, speed, lname as lastn, fname as firstn, " +"length, width, length * width as surface from SpaceShip\", \n" +" resultSetMapping=\"compositekey\")\n" +"} )\n" +"public class SpaceShip {\n" +" private String name;\n" +" private String model;\n" +" private double speed;\n" +" private Captain captain;\n" +" private Dimensions dimensions;\n" +"\n" +" @Id\n" +" public String getName() {\n" +" return name;\n" +" }\n" +"\n" +" public void setName(String name) {\n" +" this.name = name;\n" +" }\n" +"\n" +" @ManyToOne(fetch= FetchType.LAZY)\n" +" @JoinColumns( {\n" +" @JoinColumn(name=\"fname\", referencedColumnName = \"firstname" +"\"),\n" +" @JoinColumn(name=\"lname\", referencedColumnName = \"lastname" +"\")\n" +" } )\n" +" public Captain getCaptain() {\n" +" return captain;\n" +" }\n" +"\n" +" public void setCaptain(Captain captain) {\n" +" this.captain = captain;\n" +" }\n" +"\n" +" public String getModel() {\n" +" return model;\n" +" }\n" +"\n" +" public void setModel(String model) {\n" +" this.model = model;\n" +" }\n" +"\n" +" public double getSpeed() {\n" +" return speed;\n" +" }\n" +"\n" +" public void setSpeed(double speed) {\n" +" this.speed = speed;\n" +" }\n" +"\n" +" public Dimensions getDimensions() {\n" +" return dimensions;\n" +" }\n" +"\n" +" public void setDimensions(Dimensions dimensions) {\n" +" this.dimensions = dimensions;\n" +" }\n" +"}\n" +"\n" +"@Entity\n" +"@IdClass(Identity.class)\n" +"public class Captain implements Serializable {\n" +" private String firstname;\n" +" private String lastname;\n" +"\n" +" @Id\n" +" public String getFirstname() {\n" +" return firstname;\n" +" }\n" +"\n" +" public void setFirstname(String firstname) {\n" +" this.firstname = firstname;\n" +" }\n" +"\n" +" @Id\n" +" public String getLastname() {\n" +" return lastname;\n" +" }\n" +"\n" +" public void setLastname(String lastname) {\n" +" this.lastname = lastname;\n" +" }\n" +"}" +msgstr "" + +#. Tag: para +#: query_sql.xml:510 +#, no-c-format +msgid "" +"If you retrieve a single entity using the default mapping, you can specify " +"the resultClass attribute instead of " +"resultSetMapping:" +msgstr "" + +#. Tag: programlisting +#: query_sql.xml:514 +#, no-c-format +msgid "" +"@NamedNativeQuery(name=\"implicitSample\", query=\"select * from SpaceShip" +"\", resultClass=SpaceShip.class)\n" +"public class SpaceShip {" +msgstr "" + +#. Tag: para +#: query_sql.xml:517 +#, no-c-format +msgid "" +"In some of your native queries, you'll have to return scalar values, for " +"example when building report queries. You can map them in the " +"@SqlResultsetMapping through @ColumnResult. You actually can even mix, entities and scalar returns in the same " +"native query (this is probably not that common though)." +msgstr "" + +#. Tag: title +#: query_sql.xml:525 +#, no-c-format +msgid "Scalar values via @ColumnResult" +msgstr "" + +#. Tag: programlisting +#: query_sql.xml:527 +#, no-c-format +msgid "" +"@SqlResultSetMapping(name=\"scalar\", columns=@ColumnResult(name=\"dimension" +"\"))\n" +"@NamedNativeQuery(name=\"scalar\", query=\"select length*width as dimension " +"from SpaceShip\", resultSetMapping=\"scalar\")" +msgstr "" + +#. Tag: para +#: query_sql.xml:530 +#, no-c-format +msgid "" +"An other query hint specific to native queries has been introduced: " +"org.hibernate.callable which can be true or false " +"depending on whether the query is a stored procedure or not." +msgstr "" + +#. Tag: title +#: query_sql.xml:535 #, no-c-format msgid "Using return-property to explicitly specify column/alias names" msgstr "" @@ -780,6 +1423,7 @@ msgstr "" "colunas/alias" #. Tag: para +#: query_sql.xml:538 #, no-c-format msgid "" "You can explicitly tell Hibernate what column aliases to use with " @@ -791,7 +1435,25 @@ msgstr "" "{} para deixar o Hibernate injetar seus próprios aliases. " "Por exemplo:" +#. Tag: programlisting +#: query_sql.xml:543 +#, no-c-format +msgid "" +"<sql-query name=\"mySqlQuery\">\n" +" <return alias=\"person\" class=\"eg.Person\">\n" +" <return-property name=\"name\" column=\"myName\"/>\n" +" <return-property name=\"age\" column=\"myAge\"/>\n" +" <return-property name=\"sex\" column=\"mySex\"/>\n" +" </return>\n" +" SELECT person.NAME AS myName,\n" +" person.AGE AS myAge,\n" +" person.SEX AS mySex,\n" +" FROM PERSON person WHERE person.NAME LIKE :name\n" +"</sql-query>" +msgstr "" + #. Tag: para +#: query_sql.xml:545 #, no-c-format msgid "" "<return-property> also works with multiple columns. " @@ -803,7 +1465,29 @@ msgstr "" "não pode permitir controle granulado fino de muitas propriedades de colunas " "múltiplas. " +#. Tag: programlisting +#: query_sql.xml:550 +#, no-c-format +msgid "" +"<sql-query name=\"organizationCurrentEmployments\">\n" +" <return alias=\"emp\" class=\"Employment\">\n" +" <return-property name=\"salary\">\n" +" <return-column name=\"VALUE\"/>\n" +" <return-column name=\"CURRENCY\"/>\n" +" </return-property>\n" +" <return-property name=\"endDate\" column=\"myEndDate\"/>\n" +" </return>\n" +" SELECT EMPLOYEE AS {emp.employee}, EMPLOYER AS {emp.employer},\n" +" STARTDATE AS {emp.startDate}, ENDDATE AS {emp.endDate},\n" +" REGIONCODE as {emp.regionCode}, EID AS {emp.id}, VALUE, CURRENCY\n" +" FROM EMPLOYMENT\n" +" WHERE EMPLOYER = :id AND ENDDATE IS NULL\n" +" ORDER BY STARTDATE ASC\n" +"</sql-query>" +msgstr "" + #. Tag: para +#: query_sql.xml:552 #, no-c-format msgid "" "In this example <return-property> was used in " @@ -816,6 +1500,7 @@ msgstr "" "propriedades. " #. Tag: para +#: query_sql.xml:557 #, no-c-format msgid "" "If your mapping has a discriminator you must use <return-" @@ -826,11 +1511,13 @@ msgstr "" "discriminador." #. Tag: title +#: query_sql.xml:563 #, no-c-format msgid "Using stored procedures for querying" msgstr "Usando procedimentos de armazenamento para consultas" #. Tag: para +#: query_sql.xml:565 #, no-c-format msgid "" "Hibernate3 provides support for queries via stored procedures and functions. " @@ -846,14 +1533,55 @@ msgstr "" "trabalhar com o Hibernate. Um exemplo disto é a função armazenada em Oracle " "9 e versões posteriores como se segue: " +#. Tag: programlisting +#: query_sql.xml:571 +#, no-c-format +msgid "" +"CREATE OR REPLACE FUNCTION selectAllEmployments\n" +" RETURN SYS_REFCURSOR\n" +"AS\n" +" st_cursor SYS_REFCURSOR;\n" +"BEGIN\n" +" OPEN st_cursor FOR\n" +" SELECT EMPLOYEE, EMPLOYER,\n" +" STARTDATE, ENDDATE,\n" +" REGIONCODE, EID, VALUE, CURRENCY\n" +" FROM EMPLOYMENT;\n" +" RETURN st_cursor;\n" +" END;" +msgstr "" + #. Tag: para +#: query_sql.xml:573 #, no-c-format msgid "To use this query in Hibernate you need to map it via a named query." msgstr "" "Para usar esta consulta no Hibernate você vai precisar mapeá-lo através de " "uma consulta nomeada" +#. Tag: programlisting +#: query_sql.xml:576 +#, no-c-format +msgid "" +"<sql-query name=\"selectAllEmployees_SP\" callable=\"true\">\n" +" <return alias=\"emp\" class=\"Employment\">\n" +" <return-property name=\"employee\" column=\"EMPLOYEE\"/>\n" +" <return-property name=\"employer\" column=\"EMPLOYER\"/>\n" +" <return-property name=\"startDate\" column=\"STARTDATE\"/>\n" +" <return-property name=\"endDate\" column=\"ENDDATE\"/>\n" +" <return-property name=\"regionCode\" column=\"REGIONCODE\"/>\n" +" <return-property name=\"id\" column=\"EID\"/>\n" +" <return-property name=\"salary\">\n" +" <return-column name=\"VALUE\"/>\n" +" <return-column name=\"CURRENCY\"/>\n" +" </return-property>\n" +" </return>\n" +" { ? = call selectAllEmployments() }\n" +"</sql-query>" +msgstr "" + #. Tag: para +#: query_sql.xml:578 #, no-c-format msgid "" "Stored procedures currently only return scalars and entities. <" @@ -865,11 +1593,13 @@ msgstr "" "collection> não são suportados." #. Tag: title +#: query_sql.xml:583 #, no-c-format msgid "Rules/limitations for using stored procedures" msgstr "Regras e limitações para utilizar procedimentos armazenados." #. Tag: para +#: query_sql.xml:585 #, no-c-format msgid "" "You cannot use stored procedures with Hibernate unless you follow some " @@ -887,6 +1617,7 @@ msgstr "" "os fabricantes possuem procedimentos de semânticas/sintáxe armazenados. " #. Tag: para +#: query_sql.xml:593 #, no-c-format msgid "" "Stored procedure queries cannot be paged with setFirstResult()/" @@ -896,6 +1627,7 @@ msgstr "" "setFirstResult()/setMaxResults(). " #. Tag: para +#: query_sql.xml:596 #, no-c-format msgid "" "The recommended call form is standard SQL92: { ? = call functionName" @@ -908,11 +1640,13 @@ msgstr "" "é suportada." #. Tag: para +#: query_sql.xml:601 #, no-c-format msgid "For Oracle the following rules apply:" msgstr "As seguintes regras se aplicam para Oracle:" #. Tag: para +#: query_sql.xml:605 #, no-c-format msgid "" "A function must return a result set. The first parameter of a procedure must " @@ -928,11 +1662,13 @@ msgstr "" "CURSOR, veja a documentação do Oracle. " #. Tag: para +#: query_sql.xml:614 #, no-c-format msgid "For Sybase or MS SQL server the following rules apply:" msgstr "Para servidores Sybase ou MS SQL aplicam-se as seguintes regras:" #. Tag: para +#: query_sql.xml:618 #, no-c-format msgid "" "The procedure must return a result set. Note that since these servers can " @@ -947,6 +1683,7 @@ msgstr "" "será descartado." #. Tag: para +#: query_sql.xml:626 #, no-c-format msgid "" "If you can enable SET NOCOUNT ON in your procedure it " @@ -956,74 +1693,178 @@ msgstr "" "provavelmente será mais eficiente. Mas, isto não é obrigatório" #. Tag: title +#: query_sql.xml:636 #, no-c-format msgid "Custom SQL for create, update and delete" msgstr "SQL padronizado para criar, atualizar e deletar" #. Tag: para -#, no-c-format +#: query_sql.xml:638 +#, fuzzy, no-c-format msgid "" "Hibernate3 can use custom SQL for create, update, and delete operations. The " "SQL can be overridden at the statement level or inidividual column level. " "This section describes statement overrides. For columns, see ." +"\"mapping-column-read-and-write\"/>. shows how to define custom SQL operatons using annotations." msgstr "" -"O Hibernate 3 pode usar um SQL personalizado para criar, atualizar e deletar operações. O SQL pode ser substituído com o nível de declaração oi nível de coluna individua. Esta seção descreve as substituições de declaração. Para colunas, consulte ." +"O Hibernate 3 pode usar um SQL personalizado para criar, atualizar e deletar " +"operações. O SQL pode ser substituído com o nível de declaração oi nível de " +"coluna individua. Esta seção descreve as substituições de declaração. Para " +"colunas, consulte ." -#. Tag: para +#. Tag: title +#: query_sql.xml:646 +#, no-c-format +msgid "Custom CRUD via annotations" +msgstr "" + +#. Tag: programlisting +#: query_sql.xml:648 #, no-c-format msgid "" -"The class and collection persisters in Hibernate already contain a set of " -"configuration time generated strings (insertsql, deletesql, updatesql etc.). " -"The mapping tags <sql-insert>, <sql-" -"delete>, and <sql-update> override " -"these strings:" +"@Entity\n" +"@Table(name=\"CHAOS\")\n" +"@SQLInsert( sql=\"INSERT INTO CHAOS(size, name, nickname, id) VALUES(?,upper" +"(?),?,?)\")\n" +"@SQLUpdate( sql=\"UPDATE CHAOS SET size = ?, name = upper(?), nickname = ? " +"WHERE id = ?\")\n" +"@SQLDelete( sql=\"DELETE CHAOS WHERE id = ?\")\n" +"@SQLDeleteAll( sql=\"DELETE CHAOS\")\n" +"@Loader(namedQuery = \"chaos\")\n" +"@NamedNativeQuery(name=\"chaos\", query=\"select id, size, name, lower" +"( nickname ) as nickname from CHAOS where id= ?\", resultClass = Chaos." +"class)\n" +"public class Chaos {\n" +" @Id\n" +" private Long id;\n" +" private Long size;\n" +" private String name;\n" +" private String nickname;" msgstr "" -"A persistência de classe e coleção no Hibernate já contém um " -"conjunto de strings gerados por tempo de configuração (insertsql, deletesql, " -"updatesql etc.). O mapeamento das tags <sql-insert>, <sql-delete>, e <sql-" -"update> sobrescreve essas strings:" #. Tag: para +#: query_sql.xml:651 #, no-c-format msgid "" -"The SQL is directly executed in your database, so you can use any dialect " -"you like. This will reduce the portability of your mapping if you use " -"database specific SQL." +"@SQLInsert, @SQLUpdate, " +"@SQLDelete, @SQLDeleteAll respectively " +"override the INSERT, UPDATE, DELETE, and DELETE all statement. The same can " +"be achieved using Hibernate mapping files and the <sql-insert>" +", <sql-update> and <sql-" +"delete> nodes. This can be seen in ." +msgstr "" + +#. Tag: title +#: query_sql.xml:661 +#, no-c-format +msgid "Custom CRUD XML" +msgstr "" + +#. Tag: programlisting +#: query_sql.xml:663 +#, no-c-format +msgid "" +"<class name=\"Person\">\n" +" <id name=\"id\">\n" +" <generator class=\"increment\"/>\n" +" </id>\n" +" <property name=\"name\" not-null=\"true\"/>\n" +" <sql-insert>INSERT INTO PERSON (NAME, ID) VALUES ( UPPER(?), ? )" +"</sql-insert>\n" +" <sql-update>UPDATE PERSON SET NAME=UPPER(?) WHERE ID=?</sql-" +"update>\n" +" <sql-delete>DELETE FROM PERSON WHERE ID=?</sql-delete>\n" +"</class>" msgstr "" -"O SQL é executado diretamente no seu banco de dados, então você pode usar " -"qualquer linguagem que quiser. Isto com certeza reduzirá a portabilidade do " -"seu mapeamento se você utilizar um SQL para um banco de dados específico." #. Tag: para +#: query_sql.xml:666 #, no-c-format msgid "" -"Stored procedures are supported if the callable attribute " -"is set:" +"If you expect to call a store procedure, be sure to set the " +"callable attribute to true. In " +"annotations as well as in xml." msgstr "" -"Os procedimentos armazenados são suportados se a função callable estiver ativada:" #. Tag: para +#: query_sql.xml:670 #, no-c-format msgid "" -"The order of the positional parameters is vital, as they must be in the same " -"sequence as Hibernate expects them." +"To check that the execution happens correctly, Hibernate allows you to " +"define one of those three strategies:" msgstr "" -"A ordem de posições dos parâmetros são vitais, pois eles devem estar na " -"mesma seqüência esperada pelo Hibernate. " #. Tag: para +#: query_sql.xml:675 #, no-c-format msgid "" -"You can view the expected order by enabling debug logging for the " -"org.hibernate.persister.entity level. With this level " -"enabled, Hibernate will print out the static SQL that is used to create, " -"update, delete etc. entities. To view the expected sequence, do not include " -"your custom SQL in the mapping files, as this will override the Hibernate " -"generated static SQL." +"none: no check is performed: the store procedure is expected to fail upon " +"issues" +msgstr "" + +#. Tag: para +#: query_sql.xml:680 +#, no-c-format +msgid "count: use of rowcount to check that the update is successful" +msgstr "" + +#. Tag: para +#: query_sql.xml:685 +#, no-c-format +msgid "" +"param: like COUNT but using an output parameter rather that the standard " +"mechanism" +msgstr "" + +#. Tag: para +#: query_sql.xml:690 +#, no-c-format +msgid "" +"To define the result check style, use the check parameter " +"which is again available in annoations as well as in xml." +msgstr "" + +#. Tag: para +#: query_sql.xml:693 +#, no-c-format +msgid "" +"You can use the exact same set of annotations respectively xml nodes to " +"override the collection related statements -see ." +msgstr "" + +#. Tag: title +#: query_sql.xml:698 +#, no-c-format +msgid "Overriding SQL statements for collections using annotations" +msgstr "" + +#. Tag: programlisting +#: query_sql.xml:701 +#, no-c-format +msgid "" +"@OneToMany\n" +"@JoinColumn(name=\"chaos_fk\")\n" +"@SQLInsert( sql=\"UPDATE CASIMIR_PARTICULE SET chaos_fk = ? where id = ?\")\n" +"@SQLDelete( sql=\"UPDATE CASIMIR_PARTICULE SET chaos_fk = null where id = ?" +"\")\n" +"private Set<CasimirParticle> particles = new HashSet<" +"CasimirParticle>();" +msgstr "" + +#. Tag: para +#: query_sql.xml:705 +#, fuzzy, no-c-format +msgid "" +"The parameter order is important and is defined by the order Hibernate " +"handles properties. You can see the expected order by enabling debug logging " +"for the org.hibernate.persister.entity level. With this " +"level enabled Hibernate will print out the static SQL that is used to " +"create, update, delete etc. entities. (To see the expected sequence, " +"remember to not include your custom SQL through annotations or mapping files " +"as that will override the Hibernate generated static sql)" msgstr "" "Você pode ver a ordem esperada ativando o debug logging no ní­vel " "org.hibernate.persister.entity. Com este ní­vel ativado, " @@ -1033,12 +1874,67 @@ msgstr "" "sobrescrever o SQL estático gerado pelo Hibernate." #. Tag: para +#: query_sql.xml:715 #, no-c-format msgid "" -"The stored procedures are in most cases required to return the number of " -"rows inserted, updated and deleted, as Hibernate has some runtime checks for " -"the success of the statement. Hibernate always registers the first statement " -"parameter as a numeric output parameter for the CUD operations:" +"Overriding SQL statements for secondary tables is also possible using " +"@org.hibernate.annotations.Table and either (or all) " +"attributes sqlInsert, sqlUpdate, " +"sqlDelete:" +msgstr "" + +#. Tag: title +#: query_sql.xml:721 +#, no-c-format +msgid "Overriding SQL statements for secondary tables" +msgstr "" + +#. Tag: programlisting +#: query_sql.xml:723 +#, no-c-format +msgid "" +"@Entity\n" +"@SecondaryTables({\n" +" @SecondaryTable(name = \"`Cat nbr1`\"),\n" +" @SecondaryTable(name = \"Cat2\"})\n" +"@org.hibernate.annotations.Tables( {\n" +" @Table(appliesTo = \"Cat\", comment = \"My cat table\" ),\n" +" @Table(appliesTo = \"Cat2\", foreignKey = @ForeignKey(name=\"FK_CAT2_CAT" +"\"), fetch = FetchMode.SELECT,\n" +" sqlInsert=@SQLInsert(sql=\"insert into Cat2(storyPart2, id) values" +"(upper(?), ?)\") )\n" +"} )\n" +"public class Cat implements Serializable {" +msgstr "" + +#. Tag: para +#: query_sql.xml:726 +#, no-c-format +msgid "" +"The previous example also shows that you can give a comment to a given table " +"(primary or secondary): This comment will be used for DDL generation." +msgstr "" + +#. Tag: para +#: query_sql.xml:731 +#, fuzzy, no-c-format +msgid "" +"The SQL is directly executed in your database, so you can use any dialect " +"you like. This will, however, reduce the portability of your mapping if you " +"use database specific SQL." +msgstr "" +"O SQL é executado diretamente no seu banco de dados, então você pode usar " +"qualquer linguagem que quiser. Isto com certeza reduzirá a portabilidade do " +"seu mapeamento se você utilizar um SQL para um banco de dados específico." + +#. Tag: para +#: query_sql.xml:736 +#, fuzzy, no-c-format +msgid "" +"Last but not least, stored procedures are in most cases required to return " +"the number of rows inserted, updated and deleted. Hibernate always registers " +"the first statement parameter as a numeric output parameter for the CUD " +"operations:" msgstr "" "Os procedimentos armazenados são na maioria dos casos requeridos para " "retornar o número de linhas inseridas/atualizadas/deletadas, uma vez que o " @@ -1047,23 +1943,67 @@ msgstr "" "como um parâmetro de saída numérica para as operações CUD:" #. Tag: title +#: query_sql.xml:742 +#, no-c-format +msgid "Stored procedures and their return value" +msgstr "" + +#. Tag: programlisting +#: query_sql.xml:744 +#, no-c-format +msgid "" +"CREATE OR REPLACE FUNCTION updatePerson (uid IN NUMBER, uname IN VARCHAR2)\n" +" RETURN NUMBER IS\n" +"BEGIN\n" +"\n" +" update PERSON\n" +" set\n" +" NAME = uname,\n" +" where\n" +" ID = uid;\n" +"\n" +" return SQL%ROWCOUNT;\n" +"\n" +"END updatePerson;" +msgstr "" + +#. Tag: title +#: query_sql.xml:749 #, no-c-format msgid "Custom SQL for loading" msgstr "SQL padronizado para carga" #. Tag: para -#, no-c-format +#: query_sql.xml:751 +#, fuzzy, no-c-format msgid "" "You can also declare your own SQL (or HQL) queries for entity loading. As " "with inserts, updates, and deletes, this can be done at the individual " -"column level as described in or at the statement level. Here is an example of a statement level " +"column level as described in or at the statement level. Here is an example of a statement level " "override:" msgstr "" -"Você pode declarar também a sua própria consulta SQL (or HQL) para carregamento de entidade. Assim como inserções, atualizações e deletações, isto pode ser feito no nível de coluna individual conforme descrito no ou no nível de declaração. Segue abaixo um exemplo de uma substituição no nível de declaração:" +"Você pode declarar também a sua própria consulta SQL (or HQL) para " +"carregamento de entidade. Assim como inserções, atualizações e deletações, " +"isto pode ser feito no nível de coluna individual conforme descrito no ou no nível de declaração. Segue " +"abaixo um exemplo de uma substituição no nível de declaração:" + +#. Tag: programlisting +#: query_sql.xml:757 +#, no-c-format +msgid "" +"<sql-query name=\"person\">\n" +" <return alias=\"pers\" class=\"Person\" lock-mode=\"upgrade\"/>\n" +" SELECT NAME AS {pers.name}, ID AS {pers.id}\n" +" FROM PERSON\n" +" WHERE ID=?\n" +" FOR UPDATE\n" +"</sql-query>" +msgstr "" #. Tag: para +#: query_sql.xml:759 #, no-c-format msgid "" "This is just a named query declaration, as discussed earlier. You can " @@ -1073,17 +2013,57 @@ msgstr "" "anteriormente. Você pode referenciar esta consulta nomeada em um mapeamento " "de classe:" +#. Tag: programlisting +#: query_sql.xml:762 +#, no-c-format +msgid "" +"<class name=\"Person\">\n" +" <id name=\"id\">\n" +" <generator class=\"increment\"/>\n" +" </id>\n" +" <property name=\"name\" not-null=\"true\"/>\n" +" <loader query-ref=\"person\"/>\n" +"</class>" +msgstr "" + #. Tag: para +#: query_sql.xml:764 #, no-c-format msgid "This even works with stored procedures." msgstr "Este também funciona com procedimentos armazenados." #. Tag: para +#: query_sql.xml:766 #, no-c-format msgid "You can even define a query for collection loading:" msgstr "Você pode também definir uma consulta para carregar uma coleção: " +#. Tag: programlisting +#: query_sql.xml:768 +#, no-c-format +msgid "" +"<set name=\"employments\" inverse=\"true\">\n" +" <key/>\n" +" <one-to-many class=\"Employment\"/>\n" +" <loader query-ref=\"employments\"/>\n" +"</set>" +msgstr "" + +#. Tag: programlisting +#: query_sql.xml:770 +#, no-c-format +msgid "" +"<sql-query name=\"employments\">\n" +" <load-collection alias=\"emp\" role=\"Person.employments\"/>\n" +" SELECT {emp.*}\n" +" FROM EMPLOYMENT emp\n" +" WHERE EMPLOYER = :id\n" +" ORDER BY STARTDATE ASC, EMPLOYEE ASC\n" +"</sql-query>" +msgstr "" + #. Tag: para +#: query_sql.xml:772 #, no-c-format msgid "" "You can also define an entity loader that loads a collection by join " @@ -1092,3 +2072,59 @@ msgstr "" "Você pode até definir um carregador de entidade que carregue uma coleção por " "busca de união: " +#. Tag: programlisting +#: query_sql.xml:775 +#, no-c-format +msgid "" +"<sql-query name=\"person\">\n" +" <return alias=\"pers\" class=\"Person\"/>\n" +" <return-join alias=\"emp\" property=\"pers.employments\"/>\n" +" SELECT NAME AS {pers.*}, {emp.*}\n" +" FROM PERSON pers\n" +" LEFT OUTER JOIN EMPLOYMENT emp\n" +" ON pers.ID = emp.PERSON_ID\n" +" WHERE ID=?\n" +"</sql-query>" +msgstr "" + +#. Tag: para +#: query_sql.xml:777 +#, no-c-format +msgid "" +"The annotation equivalent <loader> is the @Loader " +"annotation as seen in ." +msgstr "" + +#~ msgid "{item.*}" +#~ msgstr "{item.*}" + +#~ msgid "{coll.*}" +#~ msgstr "{coll.*}" + +#~ msgid "" +#~ "The class and collection persisters in Hibernate already contain a set of " +#~ "configuration time generated strings (insertsql, deletesql, updatesql " +#~ "etc.). The mapping tags <sql-insert>, " +#~ "<sql-delete>, and <sql-update> override these strings:" +#~ msgstr "" +#~ "A persistência de classe e coleção no Hibernate já contém um conjunto de " +#~ "strings gerados por tempo de configuração (insertsql, deletesql, " +#~ "updatesql etc.). O mapeamento das tags <sql-insert>, <sql-delete>, e <sql-" +#~ "update> sobrescreve essas strings:" + +#~ msgid "" +#~ "Stored procedures are supported if the callable " +#~ "attribute is set:" +#~ msgstr "" +#~ "Os procedimentos armazenados são suportados se a função " +#~ "callable estiver ativada:" + +#~ msgid "" +#~ "The order of the positional parameters is vital, as they must be in the " +#~ "same sequence as Hibernate expects them." +#~ msgstr "" +#~ "A ordem de posições dos parâmetros são vitais, pois eles devem estar na " +#~ "mesma seqüência esperada pelo Hibernate. " diff --git a/documentation/manual/src/main/docbook/pt-BR/content/session_api.po b/documentation/manual/src/main/docbook/pt-BR/content/session_api.po index 55d7535864..70626a4a95 100644 --- a/documentation/manual/src/main/docbook/pt-BR/content/session_api.po +++ b/documentation/manual/src/main/docbook/pt-BR/content/session_api.po @@ -108,7 +108,7 @@ msgid "" msgstr "" "Project-Id-Version: session_api\n" "Report-Msgid-Bugs-To: http://bugs.kde.org\n" -"POT-Creation-Date: 2010-03-12T00:03:48\n" +"POT-Creation-Date: 2010-07-20 21:02+0000\n" "PO-Revision-Date: 2010-03-19 10:25+1000\n" "Last-Translator: \n" "Language-Team: \n" @@ -118,11 +118,13 @@ msgstr "" "X-Generator: KBabel 1.11.4\n" #. Tag: title +#: session_api.xml:31 #, no-c-format msgid "Working with objects" msgstr "Trabalhando com objetos" #. Tag: para +#: session_api.xml:33 #, no-c-format msgid "" "Hibernate is a full object/relational mapping solution that not only shields " @@ -141,6 +143,7 @@ msgstr "" "a objetos em aplicações Java. " #. Tag: para +#: session_api.xml:40 #, no-c-format msgid "" "In other words, Hibernate application developers should always think about " @@ -156,16 +159,19 @@ msgstr "" "estão ajustando o desempenho do sistema." #. Tag: title +#: session_api.xml:47 #, no-c-format msgid "Hibernate object states" msgstr "Estado dos objetos no Hibernate" #. Tag: para +#: session_api.xml:49 #, no-c-format msgid "Hibernate defines and supports the following object states:" msgstr "O Hibernate define e suporta os seguintes estados de objetos:" #. Tag: para +#: session_api.xml:53 #, no-c-format msgid "" "Transient - an object is transient if it has just been " @@ -189,6 +195,7 @@ msgstr "" "transição)." #. Tag: para +#: session_api.xml:65 #, no-c-format msgid "" "Persistent - a persistent instance has a representation " @@ -210,6 +217,7 @@ msgstr "" "o objeto se tornar transiente. " #. Tag: para +#: session_api.xml:77 #, no-c-format msgid "" "Detached - a detached instance is an object that has " @@ -233,6 +241,7 @@ msgstr "" "trabalho do ponto de vista do usuário." #. Tag: para +#: session_api.xml:90 #, no-c-format msgid "" "We will now discuss the states and state transitions (and the Hibernate " @@ -242,11 +251,13 @@ msgstr "" "Hibernate que disparam uma transição) em mais detalhes." #. Tag: title +#: session_api.xml:95 #, no-c-format msgid "Making objects persistent" msgstr "Tornando os objetos persistentes" #. Tag: para +#: session_api.xml:97 #, no-c-format msgid "" "Newly instantiated instances of a persistent class are considered " @@ -258,7 +269,19 @@ msgstr "" "transformar uma instância transiente em persistente " "associando-a a uma sessão: " +#. Tag: programlisting +#: session_api.xml:102 +#, no-c-format +msgid "" +"DomesticCat fritz = new DomesticCat();\n" +"fritz.setColor(Color.GINGER);\n" +"fritz.setSex('M');\n" +"fritz.setName(\"Fritz\");\n" +"Long generatedId = (Long) sess.save(fritz);" +msgstr "" + #. Tag: para +#: session_api.xml:104 #, no-c-format msgid "" "If Cat has a generated identifier, the identifier is " @@ -280,6 +303,7 @@ msgstr "" "do EJB3. " #. Tag: para +#: session_api.xml:115 #, no-c-format msgid "" "persist() makes a transient instance persistent. However, " @@ -299,6 +323,7 @@ msgstr "" "execução com um contexto de Sessão/persistência estendido." #. Tag: para +#: session_api.xml:126 #, no-c-format msgid "" "save() does guarantee to return an identifier. If an " @@ -314,6 +339,7 @@ msgstr "" "de longa execução com um contexto de Sessão/persistência estendido." #. Tag: para +#: session_api.xml:135 #, no-c-format msgid "" "Alternatively, you can assign the identifier using an overloaded version of " @@ -322,7 +348,21 @@ msgstr "" "Alternativamente, pode-se atribuir o identificador usando uma versão " "sobrecarregada de save(). " +#. Tag: programlisting +#: session_api.xml:138 +#, no-c-format +msgid "" +"DomesticCat pk = new DomesticCat();\n" +"pk.setColor(Color.TABBY);\n" +"pk.setSex('F');\n" +"pk.setName(\"PK\");\n" +"pk.setKittens( new HashSet() );\n" +"pk.addKitten(fritz);\n" +"sess.save( pk, new Long(1234) );" +msgstr "" + #. Tag: para +#: session_api.xml:140 #, no-c-format msgid "" "If the object you make persistent has associated objects (e.g. the " @@ -342,6 +382,7 @@ msgstr "" "save() for usado nos objetos em uma ordem errada. " #. Tag: para +#: session_api.xml:148 #, no-c-format msgid "" "Usually you do not bother with this detail, as you will normally use " @@ -358,11 +399,13 @@ msgstr "" "adiante nesse mesmo capítulo. " #. Tag: title +#: session_api.xml:157 #, no-c-format msgid "Loading an object" msgstr "Carregando o objeto" #. Tag: para +#: session_api.xml:159 #, no-c-format msgid "" "The load() methods of Session provide " @@ -376,12 +419,39 @@ msgstr "" "do objeto e carregará o estado em uma instância mais recente dessa classe, " "em estado persistente." +#. Tag: programlisting +#: session_api.xml:165 +#, no-c-format +msgid "Cat fritz = (Cat) sess.load(Cat.class, generatedId);" +msgstr "" + +#. Tag: programlisting +#: session_api.xml:167 +#, no-c-format +msgid "" +"// you need to wrap primitive identifiers\n" +"long id = 1234;\n" +"DomesticCat pk = (DomesticCat) sess.load( DomesticCat.class, new Long(id) );" +msgstr "" + #. Tag: para +#: session_api.xml:169 #, no-c-format msgid "Alternatively, you can load state into a given instance:" msgstr "Alternativamente, pode-se carregar um estado em uma instância dada:" +#. Tag: programlisting +#: session_api.xml:171 +#, no-c-format +msgid "" +"Cat cat = new DomesticCat();\n" +"// load pk's state into cat\n" +"sess.load( cat, new Long(pkId) );\n" +"Set kittens = cat.getKittens();" +msgstr "" + #. Tag: para +#: session_api.xml:173 #, no-c-format msgid "" "Be aware that load() will throw an unrecoverable " @@ -404,6 +474,7 @@ msgstr "" "classe. " #. Tag: para +#: session_api.xml:182 #, no-c-format msgid "" "If you are not certain that a matching row exists, you should use the " @@ -414,7 +485,20 @@ msgstr "" "o método get(), que consulta o banco imediatamente e " "retorna um null se não existir o registro. " +#. Tag: programlisting +#: session_api.xml:186 +#, no-c-format +msgid "" +"Cat cat = (Cat) sess.get(Cat.class, id);\n" +"if (cat==null) {\n" +" cat = new Cat();\n" +" sess.save(cat, id);\n" +"}\n" +"return cat;" +msgstr "" + #. Tag: para +#: session_api.xml:188 #, no-c-format msgid "" "You can even load an object using an SQL SELECT ... FOR UPDATE, usando um LockMode. Veja a documentação da API " "para maiores informações. " +#. Tag: programlisting +#: session_api.xml:192 +#, no-c-format +msgid "Cat cat = (Cat) sess.get(Cat.class, id, LockMode.UPGRADE);" +msgstr "" + #. Tag: para +#: session_api.xml:194 #, no-c-format msgid "" "Any associated instances or contained collections will notall como um estilo cascata para a associação. " #. Tag: para +#: session_api.xml:199 #, no-c-format msgid "" "It is possible to re-load an object and all its collections at any time, " @@ -450,25 +542,36 @@ msgstr "" "os disparos do banco de dados são usados para inicializar algumas " "propriedades do objeto." -#. Tag: para +#. Tag: programlisting +#: session_api.xml:204 #, no-c-format msgid "" +"sess.save(cat);\n" +"sess.flush(); //force the SQL INSERT\n" +"sess.refresh(cat); //re-read the state (after the trigger executes)" +msgstr "" + +#. Tag: para +#: session_api.xml:206 +#, fuzzy, no-c-format +msgid "" "How much does Hibernate load from the database and how many SQL " "SELECTs will it use? This depends on the " "fetching strategy. This is explained in ." +"\"performance-fetching\"/>." msgstr "" "O quanto Hibernate carrega do banco de dados e quantos SQL SELECT ele irá usar? Isto depende da estratégia de " -"busca usada e explicada na ." +"literal> ele irá usar? Isto depende da estratégia de busca usada e explicada na ." #. Tag: title +#: session_api.xml:213 #, no-c-format msgid "Querying" msgstr "Consultando" #. Tag: para +#: session_api.xml:215 #, no-c-format msgid "" "If you do not know the identifiers of the objects you are looking for, you " @@ -487,11 +590,13 @@ msgstr "" "opcional do Hibernate para conversão do conjunto de resultados em objetos. " #. Tag: title +#: session_api.xml:224 #, no-c-format msgid "Executing queries" msgstr "Executando consultas" #. Tag: para +#: session_api.xml:226 #, no-c-format msgid "" "HQL and native SQL queries are represented with an instance of org." @@ -506,7 +611,38 @@ msgstr "" "execução de consultas reais. Você pode obter uma Query " "usando a Session atual:" +#. Tag: programlisting +#: session_api.xml:232 +#, no-c-format +msgid "" +"List cats = session.createQuery(\n" +" \"from Cat as cat where cat.birthdate < ?\")\n" +" .setDate(0, date)\n" +" .list();\n" +"\n" +"List mothers = session.createQuery(\n" +" \"select mother from Cat as cat join cat.mother as mother where cat.name " +"= ?\")\n" +" .setString(0, name)\n" +" .list();\n" +"\n" +"List kittens = session.createQuery(\n" +" \"from Cat as cat where cat.mother = ?\")\n" +" .setEntity(0, pk)\n" +" .list();\n" +"\n" +"Cat mother = (Cat) session.createQuery(\n" +" \"select cat.mother from Cat as cat where cat = ?\")\n" +" .setEntity(0, izi)\n" +" .uniqueResult();]]\n" +"\n" +"Query mothersWithKittens = (Cat) session.createQuery(\n" +" \"select mother from Cat as mother left join fetch mother.kittens\");\n" +"Set uniqueMothers = new HashSet(mothersWithKittens.list());" +msgstr "" + #. Tag: para +#: session_api.xml:234 #, no-c-format msgid "" "A query is usually executed by invoking list(). The " @@ -529,11 +665,13 @@ msgstr "" "simples Set." #. Tag: title +#: session_api.xml:244 #, no-c-format msgid "Iterating results" msgstr "Interagindo com resultados" #. Tag: para +#: session_api.xml:246 #, no-c-format msgid "" "Occasionally, you might be able to achieve better performance by executing " @@ -557,12 +695,33 @@ msgstr "" "n consultas adicionais para inicializar as instâncias " "reais. " +#. Tag: programlisting +#: session_api.xml:257 +#, no-c-format +msgid "" +"// fetch ids\n" +"Iterator iter = sess.createQuery(\"from eg.Qux q order by q.likeliness\")." +"iterate();\n" +"while ( iter.hasNext() ) {\n" +" Qux qux = (Qux) iter.next(); // fetch the object\n" +" // something we couldnt express in the query\n" +" if ( qux.calculateComplicatedAlgorithm() ) {\n" +" // delete the current instance\n" +" iter.remove();\n" +" // dont need to process the rest\n" +" break;\n" +" }\n" +"}" +msgstr "" + #. Tag: title +#: session_api.xml:261 #, no-c-format msgid "Queries that return tuples" msgstr "Consultas que retornam tuplas" #. Tag: para +#: session_api.xml:263 #, no-c-format msgid "" "Hibernate queries sometimes return tuples of objects. Each tuple is returned " @@ -571,12 +730,32 @@ msgstr "" "Algumas vezes as consultas do Hibernate retornam tuplas de objetos. Cada " "tupla é retornada como uma matriz:" +#. Tag: programlisting +#: session_api.xml:266 +#, no-c-format +msgid "" +"Iterator kittensAndMothers = sess.createQuery(\n" +" \"select kitten, mother from Cat kitten join kitten.mother mother" +"\")\n" +" .list()\n" +" .iterator();\n" +"\n" +"while ( kittensAndMothers.hasNext() ) {\n" +" Object[] tuple = (Object[]) kittensAndMothers.next();\n" +" Cat kitten = (Cat) tuple[0];\n" +" Cat mother = (Cat) tuple[1];\n" +" ....\n" +"}" +msgstr "" + #. Tag: title +#: session_api.xml:270 #, no-c-format msgid "Scalar results" msgstr "Resultados escalares" #. Tag: para +#: session_api.xml:272 #, no-c-format msgid "" "Queries can specify a property of a class in the select " @@ -588,12 +767,34 @@ msgstr "" "agregações. Propriedades ou agregações são consideradas resultados agregados " "e não entidades no estado persistente. " +#. Tag: programlisting +#: session_api.xml:277 +#, no-c-format +msgid "" +"Iterator results = sess.createQuery(\n" +" \"select cat.color, min(cat.birthdate), count(cat) from Cat cat \" " +"+\n" +" \"group by cat.color\")\n" +" .list()\n" +" .iterator();\n" +"\n" +"while ( results.hasNext() ) {\n" +" Object[] row = (Object[]) results.next();\n" +" Color type = (Color) row[0];\n" +" Date oldest = (Date) row[1];\n" +" Integer count = (Integer) row[2];\n" +" .....\n" +"}" +msgstr "" + #. Tag: title +#: session_api.xml:281 #, no-c-format msgid "Bind parameters" msgstr "Parâmetros de vínculo" #. Tag: para +#: session_api.xml:283 #, no-c-format msgid "" "Methods on Query are provided for binding values to named " @@ -610,28 +811,69 @@ msgstr "" "são: " #. Tag: para +#: session_api.xml:292 #, no-c-format -msgid "named parameters are insensitive to the order they occur in the query string" +msgid "" +"named parameters are insensitive to the order they occur in the query string" msgstr "" "Parâmetros nomeados são insensíveis à ordem que eles ocorrem na faixa de " "consulta" #. Tag: para +#: session_api.xml:297 #, no-c-format msgid "they can occur multiple times in the same query" msgstr "eles podem ocorrer em tempos múltiplos na mesma consulta " #. Tag: para +#: session_api.xml:301 #, no-c-format msgid "they are self-documenting" msgstr "eles são auto documentáveis" +#. Tag: programlisting +#: session_api.xml:305 +#, no-c-format +msgid "" +"//named parameter (preferred)\n" +"Query q = sess.createQuery(\"from DomesticCat cat where cat.name = :name" +"\");\n" +"q.setString(\"name\", \"Fritz\");\n" +"Iterator cats = q.iterate();" +msgstr "" + +#. Tag: programlisting +#: session_api.xml:307 +#, no-c-format +msgid "" +"//positional parameter\n" +"Query q = sess.createQuery(\"from DomesticCat cat where cat.name = ?\");\n" +"q.setString(0, \"Izi\");\n" +"Iterator cats = q.iterate();" +msgstr "" + +#. Tag: programlisting +#: session_api.xml:309 +#, no-c-format +msgid "" +"//named parameter list\n" +"List names = new ArrayList();\n" +"names.add(\"Izi\");\n" +"names.add(\"Fritz\");\n" +"Query q = sess.createQuery(\"from DomesticCat cat where cat.name in (:" +"namesList)\");\n" +"q.setParameterList(\"namesList\", names);\n" +"List cats = q.list();" +msgstr "" + #. Tag: title +#: session_api.xml:313 #, no-c-format msgid "Pagination" msgstr "Paginação" #. Tag: para +#: session_api.xml:315 #, no-c-format msgid "" "If you need to specify bounds upon your result set, that is, the maximum " @@ -642,7 +884,18 @@ msgstr "" "números por linha que quiser recuperar e/ou a primeira linha que quiser " "recuperar, você deve usar métodos de interface Consulta:" +#. Tag: programlisting +#: session_api.xml:320 +#, no-c-format +msgid "" +"Query q = sess.createQuery(\"from DomesticCat cat\");\n" +"q.setFirstResult(20);\n" +"q.setMaxResults(10);\n" +"List cats = q.list();" +msgstr "" + #. Tag: para +#: session_api.xml:322 #, no-c-format msgid "" "Hibernate knows how to translate this limit query into the native SQL of " @@ -652,11 +905,13 @@ msgstr "" "seu DBMS" #. Tag: title +#: session_api.xml:327 #, no-c-format msgid "Scrollable iteration" msgstr "Iteração rolável" #. Tag: para +#: session_api.xml:329 #, no-c-format msgid "" "If your JDBC driver supports scrollable ResultSets, the " @@ -669,7 +924,37 @@ msgstr "" "objeto de ScrollableResults, que permite uma navegação " "flexível dos resultados de consulta. " +#. Tag: programlisting +#: session_api.xml:334 +#, no-c-format +msgid "" +"Query q = sess.createQuery(\"select cat.name, cat from DomesticCat cat \" +\n" +" \"order by cat.name\");\n" +"ScrollableResults cats = q.scroll();\n" +"if ( cats.first() ) {\n" +"\n" +" // find the first name on each page of an alphabetical list of cats by " +"name\n" +" firstNamesOfPages = new ArrayList();\n" +" do {\n" +" String name = cats.getString(0);\n" +" firstNamesOfPages.add(name);\n" +" }\n" +" while ( cats.scroll(PAGE_SIZE) );\n" +"\n" +" // Now get the first page of cats\n" +" pageOfCats = new ArrayList();\n" +" cats.beforeFirst();\n" +" int i=0;\n" +" while( ( PAGE_SIZE > i++ ) && cats.next() ) pageOfCats.add" +"( cats.get(1) );\n" +"\n" +"}\n" +"cats.close()" +msgstr "" + #. Tag: para +#: session_api.xml:336 #, no-c-format msgid "" "Note that an open database connection and cursor is required for this " @@ -681,27 +966,106 @@ msgstr "" " se precisar da função de paginação offline. " #. Tag: title +#: session_api.xml:343 #, no-c-format msgid "Externalizing named queries" msgstr "Externando consultas nomeadas" #. Tag: para +#: session_api.xml:345 #, no-c-format msgid "" -"You can also define named queries in the mapping document. Remember to use a " -"CDATA section if your query contains characters that " -"could be interpreted as markup." +"Queries can also be configured as so called named queries using annotations " +"or Hibernate mapping documents. @NamedQuery and " +"@NamedQueries can be defined at the class level as seen " +"in . However their " +"definitions are global to the session factory/entity manager factory scope. " +"A named query is defined by its name and the actual query string." +msgstr "" + +#. Tag: title +#: session_api.xml:355 +#, no-c-format +msgid "Defining a named query using @NamedQuery" +msgstr "" + +#. Tag: programlisting +#: session_api.xml:358 +#, no-c-format +msgid "" +"@Entity\n" +"@NamedQuery(name=\"night.moreRecentThan\", query=\"select n from Night n " +"where n.date >= :date\")\n" +"public class Night {\n" +" ...\n" +"}\n" +"\n" +"public class MyDao {\n" +" doStuff() {\n" +" Query q = s.getNamedQuery(\"night.moreRecentThan\");\n" +" q.setDate( \"date\", aMonthAgo );\n" +" List results = q.list();\n" +" ...\n" +" }\n" +" ...\n" +"}" +msgstr "" + +#. Tag: para +#: session_api.xml:361 +#, fuzzy, no-c-format +msgid "" +"Using a mapping document can be configured using the <query> node. Remember to use a CDATA section if your " +"query contains characters that could be interpreted as markup." msgstr "" "Você pode também definir consultas nomeadas no documento de mapeamento. " "Lembre-se de usar uma seção CDATA se sua consulta " "contiver caracteres que possam ser interpretados como marcação." -#. Tag: para +#. Tag: title +#: session_api.xml:367 #, no-c-format -msgid "Parameter binding and executing is done programatically:" -msgstr "O vínculo e execução de parâmetro são feitos programaticamente :" +msgid "Defining a named query using <query>" +msgstr "" + +#. Tag: programlisting +#: session_api.xml:370 +#, no-c-format +msgid "" +"<query name=\"ByNameAndMaximumWeight\"><![CDATA[\n" +" from eg.DomesticCat as cat\n" +" where cat.name = ?\n" +" and cat.weight > ?\n" +"] ]></query>" +msgstr "" #. Tag: para +#: session_api.xml:373 +#, fuzzy, no-c-format +msgid "" +"Parameter binding and executing is done programatically as seen in ." +msgstr "O vínculo e execução de parâmetro são feitos programaticamente :" + +#. Tag: title +#: session_api.xml:377 +#, no-c-format +msgid "Parameter binding of a named query" +msgstr "" + +#. Tag: programlisting +#: session_api.xml:379 +#, no-c-format +msgid "" +"Query q = sess.getNamedQuery(\"ByNameAndMaximumWeight\");\n" +"q.setString(0, name);\n" +"q.setInt(1, minWeight);\n" +"List cats = q.list();" +msgstr "" + +#. Tag: para +#: session_api.xml:382 #, no-c-format msgid "" "The actual program code is independent of the query language that is used. " @@ -714,6 +1078,7 @@ msgstr "" "arquivos de mapeamento. " #. Tag: para +#: session_api.xml:387 #, no-c-format msgid "" "Also note that a query declaration inside a <hibernate-" @@ -730,11 +1095,13 @@ msgstr "" "Cat.ByNameAndMaximumWeight. " #. Tag: title +#: session_api.xml:397 #, no-c-format msgid "Filtering collections" msgstr "Filtrando coleções" #. Tag: para +#: session_api.xml:399 #, no-c-format msgid "" "A collection filter is a special type of query that can " @@ -746,7 +1113,20 @@ msgstr "" "consulta pode referir-se ao this, significando o elemento " "de coleção atual. " +#. Tag: programlisting +#: session_api.xml:404 +#, no-c-format +msgid "" +"Collection blackKittens = session.createFilter(\n" +" pk.getKittens(), \n" +" \"where this.color = ?\")\n" +" .setParameter( Color.BLACK, Hibernate.custom(ColorUserType.class) )\n" +" .list()\n" +");" +msgstr "" + #. Tag: para +#: session_api.xml:406 #, no-c-format msgid "" "The returned collection is considered a bag that is a copy of the given " @@ -758,6 +1138,7 @@ msgstr "" "\", mas é consistente com o comportamento esperado." #. Tag: para +#: session_api.xml:411 #, no-c-format msgid "" "Observe that filters do not require a from clause, " @@ -768,7 +1149,18 @@ msgstr "" "embora possam ter um, se requerido. Os filtros não são limitados a retornar " "aos elementos de coleção. " +#. Tag: programlisting +#: session_api.xml:415 +#, no-c-format +msgid "" +"Collection blackKittenMates = session.createFilter(\n" +" pk.getKittens(), \n" +" \"select this.mate where this.color = eg.Color.BLACK.intValue\")\n" +" .list();" +msgstr "" + #. Tag: para +#: session_api.xml:417 #, no-c-format msgid "" "Even an empty filter query is useful, e.g. to load a subset of elements in a " @@ -777,12 +1169,24 @@ msgstr "" "Até mesmo um filtro vazio é útil, ex.: para carregar um subconjunto em uma " "coleção enorme:" +#. Tag: programlisting +#: session_api.xml:420 +#, no-c-format +msgid "" +"Collection tenKittens = session.createFilter(\n" +" mother.getKittens(), \"\")\n" +" .setFirstResult(0).setMaxResults(10)\n" +" .list();" +msgstr "" + #. Tag: title +#: session_api.xml:424 #, no-c-format msgid "Criteria queries" msgstr "Consulta por critério" #. Tag: para +#: session_api.xml:426 #, no-c-format msgid "" "HQL is extremely powerful, but some developers prefer to build queries " @@ -795,23 +1199,35 @@ msgstr "" "construir faixas de consultas. O Hibernate oferece uma API de consulta de " "Critério intuitiva para estes casos: " -#. Tag: para +#. Tag: programlisting +#: session_api.xml:431 #, no-c-format msgid "" +"Criteria crit = session.createCriteria(Cat.class);\n" +"crit.add( Restrictions.eq( \"color\", eg.Color.BLACK ) );\n" +"crit.setMaxResults(10);\n" +"List cats = crit.list();" +msgstr "" + +#. Tag: para +#: session_api.xml:433 +#, fuzzy, no-c-format +msgid "" "The Criteria and the associated Example API are discussed in more detail in ." +"literal> API are discussed in more detail in ." msgstr "" "Um Criteria e API associado Example " -"serão discutidos em mais detalhes em ." +"serão discutidos em mais detalhes em ." #. Tag: title +#: session_api.xml:439 #, no-c-format msgid "Queries in native SQL" msgstr "Consultas em SQL nativa" #. Tag: para +#: session_api.xml:441 #, no-c-format msgid "" "You can express a query in SQL, using createSQLQuery() " @@ -827,23 +1243,49 @@ msgstr "" "literal> JDBC diretamente. Se você escolher utilizar a API Hibernate, você " "deve incluir as aliases SQL dentro de chaves: " -#. Tag: para +#. Tag: programlisting +#: session_api.xml:448 #, no-c-format msgid "" +"List cats = session.createSQLQuery(\"SELECT {cat.*} FROM CAT {cat} WHERE " +"ROWNUM<10\")\n" +" .addEntity(\"cat\", Cat.class)\n" +".list();" +msgstr "" + +#. Tag: programlisting +#: session_api.xml:450 +#, no-c-format +msgid "" +"List cats = session.createSQLQuery(\n" +" \"SELECT {cat}.ID AS {cat.id}, {cat}.SEX AS {cat.sex}, \" +\n" +" \"{cat}.MATE AS {cat.mate}, {cat}.SUBCLASS AS {cat.class}, ... \" " +"+\n" +" \"FROM CAT {cat} WHERE ROWNUM<10\")\n" +" .addEntity(\"cat\", Cat.class)\n" +".list()" +msgstr "" + +#. Tag: para +#: session_api.xml:452 +#, fuzzy, no-c-format +msgid "" "SQL queries can contain named and positional parameters, just like Hibernate " "queries. More information about native SQL queries in Hibernate can be found " -"in ." +"in ." msgstr "" "As consultas SQL podem conter parâmetros nomeados e posicionais, assim como " "as consultas Hibernate. Maiores informações sobre as consultas nativas SQL " "no Hibernate poderão ser encontradas em ." #. Tag: title +#: session_api.xml:459 #, no-c-format msgid "Modifying persistent objects" msgstr "Modificando objetos persistentes" #. Tag: para +#: session_api.xml:461 #, no-c-format msgid "" "Transactional persistent instances (i.e. objects " @@ -867,7 +1309,17 @@ msgstr "" "objeto é carregá-lo() e depois manipulá-lo diretamente, " "enquanto a Sessão estiver aberta:" +#. Tag: programlisting +#: session_api.xml:473 +#, no-c-format +msgid "" +"DomesticCat cat = (DomesticCat) sess.load( Cat.class, new Long(69) );\n" +"cat.setName(\"PK\");\n" +"sess.flush(); // changes to cat are automatically detected and persisted" +msgstr "" + #. Tag: para +#: session_api.xml:475 #, no-c-format msgid "" "Sometimes this programming model is inefficient, as it requires in the same " @@ -882,7 +1334,8 @@ msgstr "" "instâncias desanexadas." #. Tag: para -#, no-c-format +#: session_api.xml:481 +#, fuzzy, no-c-format msgid "" "Hibernate does not offer its own API for direct execution of " "UPDATE or DELETE statements. Hibernate " @@ -893,7 +1346,7 @@ msgid "" "the notion of mass operations conflicts with object/relational mapping for " "online transaction processing-oriented applications. Future versions of " "Hibernate can, however, provide special mass operation functions. See for some possible batch operation tricks." +"linkend=\"batch\"/> for some possible batch operation tricks." msgstr "" "Note que o Hibernate não oferece seu próprio API para execução direta de " "instruções UPDATE ou DELETE. O " @@ -905,14 +1358,17 @@ msgstr "" "massa conflitua com o mapeamento de objeto/relacional para aplicativos de " "transações online com processamento. No entanto, versões futuras do " "Hibernate poderão oferecer funções especiais de operação em massa. Veja " -" para alguns possíveis truques de operação em lote. " +" para alguns possíveis truques de operação em " +"lote. " #. Tag: title +#: session_api.xml:497 #, no-c-format msgid "Modifying detached objects" msgstr "Modificando objetos desacoplados" #. Tag: para +#: session_api.xml:499 #, no-c-format msgid "" "Many applications need to retrieve an object in one transaction, send it to " @@ -928,6 +1384,7 @@ msgstr "" "durante a \"longa\" unidade de trabalho." #. Tag: para +#: session_api.xml:505 #, no-c-format msgid "" "Hibernate supports this model by providing for reattachment of detached " @@ -938,7 +1395,25 @@ msgstr "" "usando os métodos Session.update() ouSession." "merge():" +#. Tag: programlisting +#: session_api.xml:509 +#, no-c-format +msgid "" +"// in the first session\n" +"Cat cat = (Cat) firstSession.load(Cat.class, catId);\n" +"Cat potentialMate = new Cat();\n" +"firstSession.save(potentialMate);\n" +"\n" +"// in a higher layer of the application\n" +"cat.setMate(potentialMate);\n" +"\n" +"// later, in a new session\n" +"secondSession.update(cat); // update cat\n" +"secondSession.update(mate); // update mate" +msgstr "" + #. Tag: para +#: session_api.xml:511 #, no-c-format msgid "" "If the Cat with identifier catId had " @@ -950,6 +1425,7 @@ msgstr "" "aplicação tentou re-acoplá-lo, teria surgido uma exceção." #. Tag: para +#: session_api.xml:516 #, no-c-format msgid "" "Use update() if you are certain that the session does not " @@ -969,22 +1445,24 @@ msgstr "" "executada. " #. Tag: para -#, no-c-format +#: session_api.xml:524 +#, fuzzy, no-c-format msgid "" "The application should individually update() detached " "instances that are reachable from the given detached instance " "only if it wants their state to be updated. This can be " "automated using transitive persistence. See for more information." +"linkend=\"objectstate-transitive\"/> for more information." msgstr "" "A aplicação deve update() instâncias desanexadas " "individualmente, ao alcance da atual instância desanexada, se e " "somente se, esta requerer uma atualização também de seu " -"estado. Esta ação pode ser automatizada utilizando " -"persistência transitiva. Consulte para maiores informações. " +"estado. Esta ação pode ser automatizada utilizando persistência " +"transitiva. Consulte " +"para maiores informações. " #. Tag: para +#: session_api.xml:530 #, no-c-format msgid "" "The lock() method also allows an application to " @@ -995,7 +1473,20 @@ msgstr "" "associe um objeto com uma nova sessão. No entanto, a instância desanexada " "não pode ser modificada." +#. Tag: programlisting +#: session_api.xml:534 +#, no-c-format +msgid "" +"//just reassociate:\n" +"sess.lock(fritz, LockMode.NONE);\n" +"//do a version check, then reassociate:\n" +"sess.lock(izi, LockMode.READ);\n" +"//do a version check, using SELECT ... FOR UPDATE, then reassociate:\n" +"sess.lock(pk, LockMode.UPGRADE);" +msgstr "" + #. Tag: para +#: session_api.xml:536 #, no-c-format msgid "" "Note that lock() can be used with various " @@ -1009,20 +1500,23 @@ msgstr "" "único caso de uso para lock(). " #. Tag: para -#, no-c-format +#: session_api.xml:541 +#, fuzzy, no-c-format msgid "" "Other models for long units of work are discussed in ." +"\"transactions-optimistic\"/>." msgstr "" -"Outros modelos para unidades longas de trabalho serão discutidas em ." +"Outros modelos para unidades longas de trabalho serão discutidas em ." #. Tag: title +#: session_api.xml:546 #, no-c-format msgid "Automatic state detection" msgstr "Detecção automática de estado" #. Tag: para +#: session_api.xml:548 #, no-c-format msgid "" "Hibernate users have requested a general purpose method that either saves a " @@ -1035,7 +1529,26 @@ msgstr "" "re-acoplar as instâncias desanexadas associadas ao seu identificador atual. " "O método saveOrUpdate() implementa esta funcionalidade." +#. Tag: programlisting +#: session_api.xml:554 +#, no-c-format +msgid "" +"// in the first session\n" +"Cat cat = (Cat) firstSession.load(Cat.class, catID);\n" +"\n" +"// in a higher tier of the application\n" +"Cat mate = new Cat();\n" +"cat.setMate(mate);\n" +"\n" +"// later, in a new session\n" +"secondSession.saveOrUpdate(cat); // update existing state (cat has a non-" +"null id)\n" +"secondSession.saveOrUpdate(mate); // save the new instance (mate has a null " +"id)" +msgstr "" + #. Tag: para +#: session_api.xml:556 #, no-c-format msgid "" "The usage and semantics of saveOrUpdate() seems to be " @@ -1053,6 +1566,7 @@ msgstr "" "métodos." #. Tag: para +#: session_api.xml:563 #, no-c-format msgid "" "Usually update() or saveOrUpdate() are " @@ -1062,26 +1576,31 @@ msgstr "" "literal>são utilizados nos seguintes cenários:" #. Tag: para +#: session_api.xml:569 #, no-c-format msgid "the application loads an object in the first session" msgstr "a aplicação carrega um objeto na primeira sessão" #. Tag: para +#: session_api.xml:573 #, no-c-format msgid "the object is passed up to the UI tier" msgstr "o objeto é passado para a camada UI" #. Tag: para +#: session_api.xml:577 #, no-c-format msgid "some modifications are made to the object" msgstr "algumas modificações são feitas ao objeto" #. Tag: para +#: session_api.xml:581 #, no-c-format msgid "the object is passed back down to the business logic tier" msgstr "o objeto é retornado à camada lógica de negócios" #. Tag: para +#: session_api.xml:585 #, no-c-format msgid "" "the application persists these modifications by calling update() em uma segunda sessão." #. Tag: para +#: session_api.xml:590 #, no-c-format msgid "saveOrUpdate() does the following:" msgstr "saveOrUpdate() faz o seguinte:" #. Tag: para +#: session_api.xml:594 #, no-c-format msgid "if the object is already persistent in this session, do nothing" msgstr "se o objeto já estiver persistente nesta sessão, não faça nada" #. Tag: para +#: session_api.xml:599 #, no-c-format msgid "" "if another object associated with the session has the same identifier, throw " @@ -1110,6 +1632,7 @@ msgstr "" "uma exceção" #. Tag: para +#: session_api.xml:604 #, no-c-format msgid "if the object has no identifier property, save() it" msgstr "" @@ -1117,6 +1640,7 @@ msgstr "" "literal> " #. Tag: para +#: session_api.xml:609 #, no-c-format msgid "" "if the object's identifier has the value assigned to a newly instantiated " @@ -1126,6 +1650,7 @@ msgstr "" "recentemente instanciado, salve-o() " #. Tag: para +#: session_api.xml:614 #, no-c-format msgid "" "if the object is versioned by a <version> or " @@ -1139,16 +1664,19 @@ msgstr "" " o mesmo" #. Tag: para +#: session_api.xml:622 #, no-c-format msgid "otherwise update() the object" msgstr "do contrário atualize() o objeto" #. Tag: para +#: session_api.xml:626 #, no-c-format msgid "and merge() is very different:" msgstr "e a mesclagem() é bastante diferente:" #. Tag: para +#: session_api.xml:630 #, no-c-format msgid "" "if there is a persistent instance with the same identifier currently " @@ -1160,6 +1688,7 @@ msgstr "" "persistente." #. Tag: para +#: session_api.xml:636 #, no-c-format msgid "" "if there is no persistent instance currently associated with the session, " @@ -1170,11 +1699,13 @@ msgstr "" "persistente" #. Tag: para +#: session_api.xml:642 #, no-c-format msgid "the persistent instance is returned" msgstr "a instância persistente é retornada" #. Tag: para +#: session_api.xml:646 #, no-c-format msgid "" "the given instance does not become associated with the session, it remains " @@ -1184,11 +1715,13 @@ msgstr "" "desanexada" #. Tag: title +#: session_api.xml:653 #, no-c-format msgid "Deleting persistent objects" msgstr "Apagando objetos persistentes" #. Tag: para +#: session_api.xml:655 #, no-c-format msgid "" "Session.delete() will remove an object's state from the " @@ -1201,7 +1734,14 @@ msgstr "" "objeto apagado. É melhor pensar em delete() como fazer " "uma instância persistente se tornar transiente. " +#. Tag: programlisting +#: session_api.xml:660 +#, no-c-format +msgid "sess.delete(cat);" +msgstr "" + #. Tag: para +#: session_api.xml:662 #, no-c-format msgid "" "You can delete objects in any order, without risk of foreign key constraint " @@ -1216,11 +1756,13 @@ msgstr "" "filho. " #. Tag: title +#: session_api.xml:670 #, no-c-format msgid "Replicating object between two different datastores" msgstr "Replicando objeto entre dois armazenamentos de dados diferentes." #. Tag: para +#: session_api.xml:672 #, no-c-format msgid "" "It is sometimes useful to be able to take a graph of persistent instances " @@ -1231,7 +1773,27 @@ msgstr "" "fazê-los persistentes em um armazenamento de dados diferente, sem gerar " "novamente valores de identificador. " +#. Tag: programlisting +#: session_api.xml:676 +#, no-c-format +msgid "" +"//retrieve a cat from one database\n" +"Session session1 = factory1.openSession();\n" +"Transaction tx1 = session1.beginTransaction();\n" +"Cat cat = session1.get(Cat.class, catId);\n" +"tx1.commit();\n" +"session1.close();\n" +"\n" +"//reconcile with a second database\n" +"Session session2 = factory2.openSession();\n" +"Transaction tx2 = session2.beginTransaction();\n" +"session2.replicate(cat, ReplicationMode.LATEST_VERSION);\n" +"tx2.commit();\n" +"session2.close();" +msgstr "" + #. Tag: para +#: session_api.xml:678 #, no-c-format msgid "" "The ReplicationMode determines how replicate() irá lidar com conflitos em linhas existentes no banco de dados: " #. Tag: para +#: session_api.xml:684 #, no-c-format msgid "" "ReplicationMode.IGNORE: ignores the object when there is " @@ -1250,6 +1813,7 @@ msgstr "" "linha de banco de dados existente com o mesmo identificador." #. Tag: para +#: session_api.xml:689 #, no-c-format msgid "" "ReplicationMode.OVERWRITE: overwrites any existing " @@ -1259,6 +1823,7 @@ msgstr "" "de dados existente com um mesmo identificador." #. Tag: para +#: session_api.xml:694 #, no-c-format msgid "" "ReplicationMode.EXCEPTION: throws an exception if there " @@ -1268,6 +1833,7 @@ msgstr "" "uma linha de banco de dados existente com o mesmo identificador. " #. Tag: para +#: session_api.xml:700 #, no-c-format msgid "" "ReplicationMode.LATEST_VERSION: overwrites the row if its " @@ -1279,6 +1845,7 @@ msgstr "" "ignore o objeto." #. Tag: para +#: session_api.xml:706 #, no-c-format msgid "" "Usecases for this feature include reconciling data entered into different " @@ -1292,11 +1859,13 @@ msgstr "" "durante transações não ACID entre outras funções." #. Tag: title +#: session_api.xml:713 #, no-c-format msgid "Flushing the Session" msgstr "Limpando a Sessão" #. Tag: para +#: session_api.xml:715 #, no-c-format msgid "" "Sometimes the Session will execute the SQL statements " @@ -1310,26 +1879,31 @@ msgstr "" "ocorre por padrão nos seguintes pontos: " #. Tag: para +#: session_api.xml:723 #, no-c-format msgid "before some query executions" msgstr "antes de algumas execuções de consultas" #. Tag: para +#: session_api.xml:727 #, no-c-format msgid "from org.hibernate.Transaction.commit()" msgstr "a partir deorg.hibernate.Transaction.commit()" #. Tag: para +#: session_api.xml:732 #, no-c-format msgid "from Session.flush()" msgstr "a partir de Session.flush()" #. Tag: para +#: session_api.xml:736 #, no-c-format msgid "The SQL statements are issued in the following order:" msgstr "As instruções SQL são editadas na seguinte ordem:" #. Tag: para +#: session_api.xml:740 #, no-c-format msgid "" "all entity insertions in the same order the corresponding objects were saved " @@ -1339,26 +1913,31 @@ msgstr "" "correspondentes foram salvos usando Session.save() " #. Tag: para +#: session_api.xml:745 #, no-c-format msgid "all entity updates" msgstr "todas as atualizações de entidades" #. Tag: para +#: session_api.xml:749 #, no-c-format msgid "all collection deletions" msgstr "todas as deleções de coleções" #. Tag: para +#: session_api.xml:753 #, no-c-format msgid "all collection element deletions, updates and insertions" msgstr "todas as deleções, atualizações e inserções de elementos de coleção." #. Tag: para +#: session_api.xml:757 #, no-c-format msgid "all collection insertions" msgstr "todas as inserções de coleção" #. Tag: para +#: session_api.xml:761 #, no-c-format msgid "" "all entity deletions in the same order the corresponding objects were " @@ -1368,6 +1947,7 @@ msgstr "" "foram deletados usando Session.delete() " #. Tag: para +#: session_api.xml:766 #, no-c-format msgid "" "An exception is that objects using native ID generation " @@ -1377,6 +1957,7 @@ msgstr "" "literal> é inserido quando salvo." #. Tag: para +#: session_api.xml:769 #, no-c-format msgid "" "Except when you explicitly flush(), there are absolutely " @@ -1393,7 +1974,8 @@ msgstr "" "retornará dados errados. " #. Tag: para -#, no-c-format +#: session_api.xml:776 +#, fuzzy, no-c-format msgid "" "It is possible to change the default behavior so that flush occurs less " "frequently. The FlushMode class defines three different " @@ -1402,7 +1984,7 @@ msgid "" "never flush unless flush() is called explicitly. The last " "mode is useful for long running units of work, where a Session is kept open and disconnected for a long time (see )." +"\"transactions-optimistic-longsession\"/>)." msgstr "" "É possível mudar o comportamento padrão para que a limpeza ocorra com menos " "freqüência. A classe FlushMode define três modos " @@ -1414,26 +1996,48 @@ msgstr "" "aberta e disconectada por um longo tempo (veja ). " -#. Tag: para +#. Tag: programlisting +#: session_api.xml:786 #, no-c-format msgid "" +"sess = sf.openSession();\n" +"Transaction tx = sess.beginTransaction();\n" +"sess.setFlushMode(FlushMode.COMMIT); // allow queries to return stale state\n" +"\n" +"Cat izi = (Cat) sess.load(Cat.class, id);\n" +"izi.setName(iznizi);\n" +"\n" +"// might return stale data\n" +"sess.find(\"from Cat as cat left outer join cat.kittens kitten\");\n" +"\n" +"// change to izi is not flushed!\n" +"...\n" +"tx.commit(); // flush occurs\n" +"sess.close();" +msgstr "" + +#. Tag: para +#: session_api.xml:788 +#, fuzzy, no-c-format +msgid "" "During flush, an exception might occur (e.g. if a DML operation violates a " "constraint). Since handling exceptions involves some understanding of " "Hibernate's transactional behavior, we discuss it in ." +"\"transactions\"/>." msgstr "" "Durante uma limpeza, pode ocorrer uma exceção (ex.: se uma operação DML " "violar uma restrição). Como o manuseio de exceções envolve algum " "entendimento do comportamento transacional do Hibernate, discutiremos sobre " -"isso em ." +"isso em ." #. Tag: title +#: session_api.xml:795 #, no-c-format msgid "Transitive persistence" msgstr "Persistência Transitiva" #. Tag: para +#: session_api.xml:797 #, no-c-format msgid "" "It is quite cumbersome to save, delete, or reattach individual objects, " @@ -1445,6 +2049,7 @@ msgstr "" "um relacionamento pai/filho. Considere o seguinte exemplo: " #. Tag: para +#: session_api.xml:802 #, no-c-format msgid "" "If the children in a parent/child relationship would be value typed (e.g. a " @@ -1466,6 +2071,7 @@ msgstr "" "deletar o filho do banco de dados. " #. Tag: para +#: session_api.xml:812 #, no-c-format msgid "" "Now consider the same scenario with parent and child objects being entities, " @@ -1485,6 +2091,7 @@ msgstr "" "persistência por alcance por padrão. " #. Tag: para +#: session_api.xml:820 #, no-c-format msgid "" "For each basic operation of the Hibernate session - including " @@ -1503,12 +2110,26 @@ msgstr "" "literal>. Se desejar uma operação em cascata junto a associação, você deverá " "indicar isto no documento de mapeamento. Por exemplo:" +#. Tag: programlisting +#: session_api.xml:828 +#, no-c-format +msgid "<one-to-one name=\"person\" cascade=\"persist\"/>" +msgstr "" + #. Tag: para +#: session_api.xml:830 #, no-c-format msgid "Cascade styles my be combined:" msgstr "Estilo cascata pode ser combinado:" +#. Tag: programlisting +#: session_api.xml:832 +#, no-c-format +msgid "<one-to-one name=\"person\" cascade=\"persist,delete,lock\"/>" +msgstr "" + #. Tag: para +#: session_api.xml:834 #, no-c-format msgid "" "You can even use cascade=\"all\" to specify that " @@ -1522,30 +2143,133 @@ msgstr "" "nenhuma operação deve estar em cascata. " #. Tag: para +#: session_api.xml:839 +#, no-c-format +msgid "" +"In case you are using annotatons you probably have noticed the " +"cascade attribute taking an array of " +"CascadeType as a value. The cascade concept in JPA is " +"very is similar to the transitive persistence and cascading of operations as " +"described above, but with slightly different semantics and cascading types:" +msgstr "" + +#. Tag: para +#: session_api.xml:848 +#, no-c-format +msgid "" +"CascadeType.PERSIST: cascades the persist (create) " +"operation to associated entities persist() is called or if the entity is " +"managed" +msgstr "" + +#. Tag: para +#: session_api.xml:854 +#, no-c-format +msgid "" +"CascadeType.MERGE: cascades the merge operation to " +"associated entities if merge() is called or if the entity is managed" +msgstr "" + +#. Tag: para +#: session_api.xml:860 +#, no-c-format +msgid "" +"CascadeType.REMOVE: cascades the remove operation to " +"associated entities if delete() is called" +msgstr "" + +#. Tag: para +#: session_api.xml:865 +#, no-c-format +msgid "" +"CascadeType.REFRESH: cascades the refresh operation to " +"associated entities if refresh() is called" +msgstr "" + +#. Tag: para +#: session_api.xml:870 +#, no-c-format +msgid "" +"CascadeType.DETACH: cascades the detach operation to " +"associated entities if detach() is called" +msgstr "" + +#. Tag: para +#: session_api.xml:875 +#, fuzzy, no-c-format +msgid "CascadeType.ALL: all of the above" +msgstr "saveOrUpdate() faz o seguinte:" + +#. Tag: para +#: session_api.xml:880 +#, no-c-format +msgid "" +"CascadeType.ALL also covers Hibernate specific operations like save-update, " +"lock etc..." +msgstr "" + +#. Tag: para +#: session_api.xml:884 #, no-c-format msgid "" "A special cascade style, delete-orphan, applies only to " "one-to-many associations, and indicates that the delete() " "operation should be applied to any child object that is removed from the " -"association." +"association. Using annotations there is no CascadeType.DELETE-" +"ORPHAN equivalent. Instead you can use the attribute " +"orphanRemoval as seen in . If an entity is removed from a " +"@OneToMany collection or an associated entity is " +"dereferenced from a @OneToOne association, this " +"associated entity can be marked for deletion if orphanRemoval is set to true." +msgstr "" + +#. Tag: title +#: session_api.xml:897 +#, no-c-format +msgid "@OneToMany with orphanRemoval" +msgstr "" + +#. Tag: programlisting +#: session_api.xml:900 +#, no-c-format +msgid "" +"@Entity \n" +"public class Customer {\n" +" private Set<Order> orders;\n" +"\n" +" @OneToMany(cascade=CascadeType.ALL, orphanRemoval=true) \n" +" public Set<Order> getOrders() { return orders; }\n" +"\n" +" public void setOrders(Set<Order> orders) { this.orders = orders; }\n" +"\n" +" [...]\n" +"}\n" +"\n" +"@Entity \n" +"public class Order { ... }\n" +"\n" +"Customer customer = em.find(Customer.class, 1l);\n" +"Order order = em.find(Order.class, 1l);\n" +"customer.getOrders().remove(order); //order will be deleted by cascade" msgstr "" -"Um estilo especial em cascata, delete-orphan, aplica " -"somente associações um-para-um, e indica que a operação delete() deve ser aplicada em qualquer objeto filho que seja removido da " -"associação." #. Tag: para +#: session_api.xml:903 #, no-c-format msgid "Recommendations:" msgstr "Recomendações:" #. Tag: para -#, no-c-format +#: session_api.xml:907 +#, fuzzy, no-c-format msgid "" -"It does not usually make sense to enable cascade on a <many-to-" -"one> or <many-to-many> association. " -"Cascade is often useful for <one-to-one> and " -"<one-to-many> associations." +"It does not usually make sense to enable cascade on a many-to-one or many-to-" +"many association. In fact the @ManyToOne and " +"@ManyToMany don't even offer a orphanRemoval attribute. Cascading is often useful for one-to-one and one-to-many " +"associations." msgstr "" "Não faz sentido habilitar a cascata em uma associação. <many-to-" "one> ou <many-to-many> A Cascata é " @@ -1553,17 +2277,20 @@ msgstr "" "<one-to-many>." #. Tag: para -#, no-c-format +#: session_api.xml:915 +#, fuzzy, no-c-format msgid "" "If the child object's lifespan is bounded by the lifespan of the parent " "object, make it a life cycle object by specifying " -"cascade=\"all,delete-orphan\"." +"cascade=\"all,delete-orphan\"(@OneToMany" +"(cascade=CascadeType.ALL, orphanRemoval=true))." msgstr "" "Se o tempo de vida do objeto filho estiver vinculado ao tempo de vida do " "objeto pai, faça disto um objeto de ciclo de vida " "especificando um cascade=\"all,delete-orphan\"." #. Tag: para +#: session_api.xml:923 #, no-c-format msgid "" "Otherwise, you might not need cascade at all. But if you think that you will " @@ -1577,6 +2304,7 @@ msgstr "" "\"persistir,mesclar,salvar-atualizar\"." #. Tag: para +#: session_api.xml:931 #, no-c-format msgid "" "Mapping an association (either a single valued association, or a collection) " @@ -1591,15 +2319,16 @@ msgstr "" "filho(s)." #. Tag: para -#, no-c-format +#: session_api.xml:937 +#, fuzzy, no-c-format msgid "" "Furthermore, a mere reference to a child from a persistent parent will " "result in save/update of the child. This metaphor is incomplete, however. A " "child which becomes unreferenced by its parent is not " -"automatically deleted, except in the case of a <one-to-many> association mapped with cascade=\"delete-orphan\". The precise semantics of cascading operations for a parent/child " -"relationship are as follows:" +"automatically deleted, except in the case of a one-to-many association " +"mapped with cascade=\"delete-orphan\". The precise " +"semantics of cascading operations for a parent/child relationship are as " +"follows:" msgstr "" "Além disso, uma mera referência ao filho de um pai persistente irá resultar " "em salvar/atualizar/ o filho. Entretanto, esta metáfora está incompleta. Um " @@ -1610,6 +2339,7 @@ msgstr "" "pai/filho, são como as que se seguem: " #. Tag: para +#: session_api.xml:948 #, no-c-format msgid "" "If a parent is passed to persist(), all children are " @@ -1619,6 +2349,7 @@ msgstr "" "passados para persist()" #. Tag: para +#: session_api.xml:953 #, no-c-format msgid "" "If a parent is passed to merge(), all children are passed " @@ -1628,6 +2359,7 @@ msgstr "" "passados para merge()" #. Tag: para +#: session_api.xml:958 #, no-c-format msgid "" "If a parent is passed to save(), update()saveOrUpdate()" #. Tag: para +#: session_api.xml:964 #, no-c-format msgid "" "If a transient or detached child becomes referenced by a persistent parent, " @@ -1648,6 +2381,7 @@ msgstr "" "persistente, ele será passado para saveOrUpdate()" #. Tag: para +#: session_api.xml:970 #, no-c-format msgid "" "If a parent is deleted, all children are passed to delete()" #. Tag: para +#: session_api.xml:975 #, no-c-format msgid "" "If a child is dereferenced by a persistent parent, nothing special " @@ -1670,6 +2405,7 @@ msgstr "" "literal>, nos quais casos o filho \"órfão\" é deletado." #. Tag: para +#: session_api.xml:983 #, no-c-format msgid "" "Finally, note that cascading of operations can be applied to an object graph " @@ -1688,11 +2424,13 @@ msgstr "" "associadas atingíveis durante a limpeza da Sessão. " #. Tag: title +#: session_api.xml:993 #, no-c-format msgid "Using metadata" msgstr "Usando metadados" #. Tag: para +#: session_api.xml:995 #, no-c-format msgid "" "Hibernate requires a rich meta-level model of all entity and value types. " @@ -1711,6 +2449,7 @@ msgstr "" "associadas). " #. Tag: para +#: session_api.xml:1002 #, no-c-format msgid "" "Hibernate exposes metadata via the ClassMetadata and " @@ -1723,3 +2462,34 @@ msgstr "" "Type. Instâncias das interfaces de metadados podem ser " "obtidas a partir do SessionFactory. " +#. Tag: programlisting +#: session_api.xml:1007 +#, no-c-format +msgid "" +"Cat fritz = ......;\n" +"ClassMetadata catMeta = sessionfactory.getClassMetadata(Cat.class);\n" +"\n" +"Object[] propertyValues = catMeta.getPropertyValues(fritz);\n" +"String[] propertyNames = catMeta.getPropertyNames();\n" +"Type[] propertyTypes = catMeta.getPropertyTypes();\n" +"\n" +"// get a Map of all properties which are not collections or associations\n" +"Map namedValues = new HashMap();\n" +"for ( int i=0; i<propertyNames.length; i++ ) {\n" +" if ( !propertyTypes[i].isEntityType() && !propertyTypes[i]." +"isCollectionType() ) {\n" +" namedValues.put( propertyNames[i], propertyValues[i] );\n" +" }\n" +"}" +msgstr "" + +#~ msgid "" +#~ "A special cascade style, delete-orphan, applies only " +#~ "to one-to-many associations, and indicates that the delete() operation should be applied to any child object that is removed " +#~ "from the association." +#~ msgstr "" +#~ "Um estilo especial em cascata, delete-orphan, aplica " +#~ "somente associações um-para-um, e indica que a operação delete()" +#~ " deve ser aplicada em qualquer objeto filho que seja removido " +#~ "da associação." diff --git a/documentation/manual/src/main/docbook/pt-BR/content/tutorial.po b/documentation/manual/src/main/docbook/pt-BR/content/tutorial.po index 81904e4006..72724cf0c6 100644 --- a/documentation/manual/src/main/docbook/pt-BR/content/tutorial.po +++ b/documentation/manual/src/main/docbook/pt-BR/content/tutorial.po @@ -108,7 +108,7 @@ msgid "" msgstr "" "Project-Id-Version: tutorial\n" "Report-Msgid-Bugs-To: http://bugs.kde.org\n" -"POT-Creation-Date: 2010-02-11T05:38:16\n" +"POT-Creation-Date: 2010-07-20 21:02+0000\n" "PO-Revision-Date: 2010-03-19 14:09+1000\n" "Last-Translator: \n" "Language-Team: \n" @@ -118,11 +118,13 @@ msgstr "" "X-Generator: KBabel 1.11.4\n" #. Tag: title +#: tutorial.xml:34 #, no-c-format msgid "Tutorial" msgstr "Tutorial" #. Tag: para +#: tutorial.xml:36 #, no-c-format msgid "" "Intended for new users, this chapter provides an step-by-step introduction " @@ -138,6 +140,7 @@ msgstr "" "tutorials/web da fonte do projeto." #. Tag: para +#: tutorial.xml:45 #, no-c-format msgid "" "This tutorial expects the user have knowledge of both Java and SQL. If you " @@ -150,6 +153,7 @@ msgstr "" "entender o Hibernate." #. Tag: para +#: tutorial.xml:54 #, no-c-format msgid "" "The distribution contains another example application under the " @@ -159,11 +163,13 @@ msgstr "" "fonte do projeto tutorial/eg." #. Tag: title +#: tutorial.xml:62 #, no-c-format msgid "Part 1 - The first Hibernate Application" msgstr "Parte 1 – A primeira aplicação Hibernate" #. Tag: para +#: tutorial.xml:64 #, no-c-format msgid "" "For this example, we will set up a small database application that can store " @@ -174,6 +180,7 @@ msgstr "" "sobre os hosts destes eventos. " #. Tag: para +#: tutorial.xml:70 #, no-c-format msgid "" "Although you can use whatever database you feel comfortable using, we will " @@ -187,11 +194,13 @@ msgstr "" "quaisquer servidores do banco de dados." #. Tag: title +#: tutorial.xml:79 #, no-c-format msgid "Setup" msgstr "Configuração" #. Tag: para +#: tutorial.xml:81 #, no-c-format msgid "" "The first thing we need to do is to set up the development environment. We " @@ -214,6 +223,7 @@ msgstr "" "e src/main/webapp." #. Tag: para +#: tutorial.xml:91 #, no-c-format msgid "" "We will be using Maven in this tutorial, taking advantage of its transitive " @@ -224,11 +234,65 @@ msgstr "" "dependência transitiva assim como a habilidade de muitos IDEs de configurar " "automaticamente um projeto baseado no descritor maven." -#. Tag: para +#. Tag: programlisting +#: tutorial.xml:97 #, no-c-format msgid "" +"\n" +"\n" +" 4.0.0\n" +"\n" +" org.hibernate.tutorials\n" +" hibernate-tutorial\n" +" 1.0.0-SNAPSHOT\n" +" First Hibernate Tutorial\n" +"\n" +" \n" +" \n" +" ${artifactId}\n" +" \n" +"\n" +" \n" +" \n" +" org.hibernate\n" +" hibernate-core\n" +" \n" +"\n" +" \n" +" \n" +" javax.servlet\n" +" servlet-api\n" +" \n" +"\n" +" \n" +" \n" +" org.slf4j\n" +" slf4j-simple\n" +" \n" +"\n" +" \n" +" \n" +" javassist\n" +" javassist\n" +" \n" +" \n" +"\n" +"]]>" +msgstr "" + +#. Tag: para +#: tutorial.xml:100 +#, fuzzy, no-c-format +msgid "" "It is not a requirement to use Maven. If you wish to use something else to " -"build this tutoial (such as Ant), the layout will remain the same. The only " +"build this tutorial (such as Ant), the layout will remain the same. The only " "change is that you will need to manually account for all the needed " "dependencies. If you use something like Ivy providing transitive dependency management you would " @@ -247,28 +311,32 @@ msgstr "" "dependências necessárias. Caso você utilize Ivy para fornecer um gerenciamento de dependência " "transitiva, você continuará a usar as dependências mencionadas abaixo. Do " -"contrário, você precisará encontrar todas as dependências, ambas explícitas " -"e transitivas, além de adicioná-las às classpath de projetos. Caso " -"trabalhando da vinculação de distribuição Hibernate, quer dizer " -"hibernate3.jar, todos os artefatos no diretório " -"lib/required e todos os arquivos a partir do diretório " -"lib/bytecode/cglib ou lib/bytecode/javassist. Adicionalmente, você precisará de ambos servlet-api jar e um dos " -"slf4j logging backends. " +"contrário, você precisará encontrar todas as " +"dependências, ambas explícitas e transitivas, além de adicioná-las às " +"classpath de projetos. Caso trabalhando da vinculação de distribuição " +"Hibernate, quer dizer hibernate3.jar, todos os " +"artefatos no diretório lib/required e todos os arquivos " +"a partir do diretório lib/bytecode/cglib ou " +"lib/bytecode/javassist. Adicionalmente, você precisará " +"de ambos servlet-api jar e um dos slf4j logging backends. " #. Tag: para +#: tutorial.xml:117 #, no-c-format -msgid "Save this file as pom.xml in the project root directory." +msgid "" +"Save this file as pom.xml in the project root directory." msgstr "" "Salve este arquivo como pom.xml no diretório raiz do " "projeto." #. Tag: title +#: tutorial.xml:124 #, no-c-format msgid "The first class" msgstr "A primeira Classe" #. Tag: para +#: tutorial.xml:126 #, no-c-format msgid "" "Next, we create a class that represents the event we want to store in the " @@ -278,7 +346,50 @@ msgstr "" "armazenar na base de dados. Isto é uma classe JavaBean simples com algumas " "propriedades:" +#. Tag: programlisting +#: tutorial.xml:131 +#, no-c-format +msgid "" +"" +msgstr "" + #. Tag: para +#: tutorial.xml:133 #, no-c-format msgid "" "This class uses standard JavaBean naming conventions for property getter and " @@ -294,6 +405,7 @@ msgstr "" "para os métodos de acesso é a robustez para o refactoring. " #. Tag: para +#: tutorial.xml:141 #, no-c-format msgid "" "The id property holds a unique identifier value for a " @@ -323,6 +435,7 @@ msgstr "" "pode adaptar seu projeto de aplicação." #. Tag: para +#: tutorial.xml:156 #, no-c-format msgid "" "The no-argument constructor is a requirement for all persistent classes; " @@ -338,6 +451,7 @@ msgstr "" "eficiente dos dados sem a instrumentação de bytecode." #. Tag: para +#: tutorial.xml:164 #, no-c-format msgid "" "Save this file to the src/main/java/org/hibernate/tutorial/domain." #. Tag: title +#: tutorial.xml:171 #, no-c-format msgid "The mapping file" msgstr "O mapeamento do arquivo" #. Tag: para +#: tutorial.xml:173 #, no-c-format msgid "" "Hibernate needs to know how to load and store objects of the persistent " @@ -365,11 +481,27 @@ msgstr "" "ele deverá acessar, e quais as colunas na tabela ele deverá usar." #. Tag: para +#: tutorial.xml:181 #, no-c-format msgid "The basic structure of a mapping file looks like this:" msgstr "A estrutura básica de um arquivo de mapeamento é parecida com:" +#. Tag: programlisting +#: tutorial.xml:185 +#, no-c-format +msgid "" +"\n" +"\n" +"\n" +"\n" +"[...]\n" +"]]>" +msgstr "" + #. Tag: para +#: tutorial.xml:187 #, no-c-format msgid "" "Hibernate DTD is sophisticated. You can use it for auto-completion of XML " @@ -392,6 +524,7 @@ msgstr "" "distribuição." #. Tag: para +#: tutorial.xml:200 #, no-c-format msgid "" "We will omit the DTD declaration in future examples to shorten the code. It " @@ -401,6 +534,7 @@ msgstr "" "código. Isto, é claro, não é opcional. " #. Tag: para +#: tutorial.xml:206 #, no-c-format msgid "" "Between the two hibernate-mapping tags, include a " @@ -414,7 +548,21 @@ msgstr "" "são classes-primárias de entidades) necessitam do tal mapeamento, para uma " "tabela na base de dados SQL:" +#. Tag: programlisting +#: tutorial.xml:213 +#, no-c-format +msgid "" +"\n" +"\n" +" \n" +"\n" +" \n" +"\n" +"]]>" +msgstr "" + #. Tag: para +#: tutorial.xml:215 #, no-c-format msgid "" "So far we have told Hibernate how to persist and load object of class " @@ -432,7 +580,23 @@ msgstr "" "em manipular este identificador, iremos configurar uma estratégia de geração " "de id’s do Hibernate para uma coluna de chave primária substituta: " +#. Tag: programlisting +#: tutorial.xml:225 +#, no-c-format +msgid "" +"\n" +"\n" +" \n" +" \n" +" \n" +" \n" +" \n" +"\n" +"]]>" +msgstr "" + #. Tag: para +#: tutorial.xml:227 #, no-c-format msgid "" "The id element is the declaration of the identifier " @@ -450,6 +614,7 @@ msgstr "" "da tabela EVENTS mantém o valor de chave primária." #. Tag: para +#: tutorial.xml:237 #, no-c-format msgid "" "The nested generator element specifies the identifier " @@ -470,17 +635,18 @@ msgstr "" "o plugin na sua própria estratégia." #. Tag: para -#, no-c-format +#: tutorial.xml:249 +#, fuzzy, no-c-format msgid "" "native is no longer consider the best strategy in terms " -"of portability. for further discussion, see " +"of portability. for further discussion, see" msgstr "" "native não é mais considerada a melhor estratégia em " -"termos de portabilidade. Para maiores informações, consulte " +"termos de portabilidade. Para maiores informações, consulte " #. Tag: para +#: tutorial.xml:255 #, no-c-format msgid "" "Lastly, we need to tell Hibernate about the remaining entity class " @@ -490,7 +656,26 @@ msgstr "" "classe no arquivo mapeado. Por padrão, nenhuma das propriedades da classe é " "considerada persistente:" +#. Tag: programlisting +#: tutorial.xml:261 +#, no-c-format +msgid "" +"\n" +"\n" +" \n" +" \n" +" \n" +" \n" +" \n" +" \n" +" \n" +"\n" +"]]>" +msgstr "" + #. Tag: para +#: tutorial.xml:263 #, no-c-format msgid "" "Similar to the id element, the name " @@ -506,6 +691,7 @@ msgstr "" "literal>, getTitle() e setTitle()." #. Tag: para +#: tutorial.xml:274 #, no-c-format msgid "" "Why does the date property mapping include the " @@ -524,6 +710,7 @@ msgstr "" "melhor mapeá-lo com um nome diferente. " #. Tag: para +#: tutorial.xml:284 #, no-c-format msgid "" "The title mapping also lacks a type " @@ -559,6 +746,7 @@ msgstr "" "pelo mapeamento da propriedade com um conversor timestamp." #. Tag: para +#: tutorial.xml:300 #, no-c-format msgid "" "Hibernate makes this mapping type determination using reflection when the " @@ -572,6 +760,7 @@ msgstr "" "que você considere claramente a definição do tipo para uso." #. Tag: para +#: tutorial.xml:307 #, no-c-format msgid "" "Save this mapping file as src/main/resources/org/hibernate/" @@ -581,11 +770,13 @@ msgstr "" "hibernate/tutorial/domain/Event.hbm.xml." #. Tag: title +#: tutorial.xml:315 #, no-c-format msgid "Hibernate configuration" msgstr "Configuração do Hibernate" #. Tag: para +#: tutorial.xml:317 #, no-c-format msgid "" "At this point, you should have the persistent class and its mapping file in " @@ -597,11 +788,14 @@ msgstr "" "configurar o HSQLDB para rodar no \"modo do servidor\"." #. Tag: para +#: tutorial.xml:324 #, no-c-format msgid "We do this do that the data remains between runs." -msgstr "Nós realizamos isto para que aqueles dados permaneçam entre as execuções. " +msgstr "" +"Nós realizamos isto para que aqueles dados permaneçam entre as execuções. " #. Tag: para +#: tutorial.xml:329 #, no-c-format msgid "" "We will utilize the Maven exec plugin to launch the HSQLDB server by " @@ -621,6 +815,7 @@ msgstr "" "diretório target/data, e inicie o HSQLBD novamente." #. Tag: para +#: tutorial.xml:340 #, no-c-format msgid "" "Hibernate will be connecting to the database on behalf of your application, " @@ -642,15 +837,18 @@ msgstr "" "do Hibernate para este tutorial." #. Tag: para +#: tutorial.xml:351 #, no-c-format msgid "" "The built-in Hibernate connection pool is in no way intended for production " "use. It lacks several features found on any decent connection pool." msgstr "" "O pool de conexão interna do Hibernate não é recomendado para uso de " -"produção. Ele possui deficiência em diversos recursos encontrados em qualquer pool de conexão apropriado." +"produção. Ele possui deficiência em diversos recursos encontrados em " +"qualquer pool de conexão apropriado." #. Tag: para +#: tutorial.xml:357 #, no-c-format msgid "" "For Hibernate's configuration, we can use a simple hibernate." @@ -664,12 +862,63 @@ msgstr "" "programática completa. A maioria dos usuários prefere utilizar o arquivo de " "configuração XML:" +#. Tag: programlisting +#: tutorial.xml:363 +#, no-c-format +msgid "" +"\n" +"\n" +"\n" +"\n" +"\n" +" \n" +"\n" +" \n" +" org.hsqldb.jdbcDriver\n" +" jdbc:hsqldb:hsql://localhost\n" +" sa\n" +" \n" +"\n" +" \n" +" 1\n" +"\n" +" \n" +" org.hibernate.dialect.HSQLDialect\n" +"\n" +" \n" +" thread\n" +"\n" +" \n" +" org.hibernate.cache." +"NoCacheProvider\n" +"\n" +" \n" +" true\n" +"\n" +" \n" +" update\n" +"\n" +" \n" +"\n" +" \n" +"\n" +"]]>" +msgstr "" + #. Tag: para +#: tutorial.xml:366 #, no-c-format msgid "Notice that this configuration file specifies a different DTD" msgstr "Perceba que este arquivo de configuração especifica um DTD diferente" #. Tag: para +#: tutorial.xml:369 #, no-c-format msgid "" "You configure Hibernate's SessionFactory. SessionFactory " @@ -684,6 +933,7 @@ msgstr "" "configuração, para uma inicialização mais fácil. " #. Tag: para +#: tutorial.xml:376 #, no-c-format msgid "" "The first four property elements contain the necessary " @@ -696,16 +946,18 @@ msgstr "" "gera." #. Tag: para -#, no-c-format +#: tutorial.xml:383 +#, fuzzy, no-c-format msgid "" "In most cases, Hibernate is able to properly determine which dialect to use. " -"See for more information." +"See for more information." msgstr "" "Na maioria dos casos, o Hibernate está apto a determinar corretamente qual " "dialeto em uso. Consulte " "para maiores informações. " #. Tag: para +#: tutorial.xml:389 #, no-c-format msgid "" "Hibernate's automatic session management for persistence contexts is " @@ -726,6 +978,7 @@ msgstr "" "configuração." #. Tag: para +#: tutorial.xml:398 #, no-c-format msgid "" "Save this file as hibernate.cfg.xml into the " @@ -735,11 +988,13 @@ msgstr "" "src/main/resources." #. Tag: title +#: tutorial.xml:406 #, no-c-format msgid "Building with Maven" msgstr "Construindo com o Maven" #. Tag: para +#: tutorial.xml:408 #, no-c-format msgid "" "We will now build the tutorial with Maven. You will need to have Maven " @@ -757,12 +1012,43 @@ msgstr "" "vamos rodar o objetivo compile para nos certificarmos de " "que tudo foi compilado até agora:" +#. Tag: programlisting +#: tutorial.xml:418 +#, no-c-format +msgid "" +"" +msgstr "" + #. Tag: title +#: tutorial.xml:423 #, no-c-format msgid "Startup and helpers" msgstr "Inicialização e Auxiliares " #. Tag: para +#: tutorial.xml:425 #, no-c-format msgid "" "It is time to load and store some Event objects, but " @@ -789,6 +1075,7 @@ msgstr "" "instanciado uma vez. " #. Tag: para +#: tutorial.xml:439 #, no-c-format msgid "" "We will create a HibernateUtil helper class that takes " @@ -799,7 +1086,42 @@ msgstr "" "inicialização e faz acesso a uma org.hibernate." "SessionFactory mais conveniente. " +#. Tag: programlisting +#: tutorial.xml:445 +#, no-c-format +msgid "" +"" +msgstr "" + #. Tag: para +#: tutorial.xml:447 #, no-c-format msgid "" "Save this code as src/main/java/org/hibernate/tutorial/util/" @@ -809,6 +1131,7 @@ msgstr "" "HibernateUtil.java" #. Tag: para +#: tutorial.xml:452 #, no-c-format msgid "" "This class not only produces the global org.hibernate." @@ -826,6 +1149,7 @@ msgstr "" "localização para este assunto." #. Tag: para +#: tutorial.xml:461 #, no-c-format msgid "" "If you give the org.hibernate.SessionFactory " @@ -844,6 +1168,7 @@ msgstr "" "serão discutidas mais tarde." #. Tag: para +#: tutorial.xml:470 #, no-c-format msgid "" "You now need to configure a logging system. Hibernate uses commons logging " @@ -866,6 +1191,7 @@ msgstr "" "mostradas no stdout." #. Tag: para +#: tutorial.xml:480 #, no-c-format msgid "" "The tutorial infrastructure is complete and you are now ready to do some " @@ -875,14 +1201,16 @@ msgstr "" "algum trabalho de verdade com o Hibernate. " #. Tag: title +#: tutorial.xml:488 #, no-c-format msgid "Loading and storing objects" msgstr "Carregando e salvando objetos" #. Tag: para -#, no-c-format +#: tutorial.xml:490 +#, fuzzy, no-c-format msgid "" -"We are now ready to start doing some real worjk with Hibernate. Let's start " +"We are now ready to start doing some real work with Hibernate. Let's start " "by writing an EventManager class with a main() method:" msgstr "" @@ -890,7 +1218,49 @@ msgstr "" "Vamos começar escrevendo uma classe EventManager com um " "método main():" +#. Tag: programlisting +#: tutorial.xml:496 +#, no-c-format +msgid "" +"" +msgstr "" + #. Tag: para +#: tutorial.xml:498 #, no-c-format msgid "" "In createAndStoreEvent() we created a new EventINSERTs no banco de dados. " #. Tag: para -#, no-c-format +#: tutorial.xml:505 +#, fuzzy, no-c-format msgid "" "A org.hibernate.Session is designed to represent a " -"single unit of work (a single atmoic piece of work to be performed). For now " +"single unit of work (a single atomic piece of work to be performed). For now " "we will keep things simple and assume a one-to-one granularity between a " "Hibernate org.hibernate.Session and a database " "transaction. To shield our code from the actual underlying transaction " @@ -925,6 +1296,7 @@ msgstr "" "mas isto pode rodar também com o JTA." #. Tag: para +#: tutorial.xml:518 #, no-c-format msgid "" "What does sessionFactory.getCurrentSession() do? First, " @@ -947,6 +1319,7 @@ msgstr "" "aplicação. " #. Tag: para +#: tutorial.xml:532 #, no-c-format msgid "" "Hibernate offers three methods of current session tracking. The \"thread\" " @@ -960,6 +1333,7 @@ msgstr "" "em mais detalhes mais tarde." #. Tag: para +#: tutorial.xml:541 #, no-c-format msgid "" "A org.hibernate.Session begins when the first call to " @@ -981,6 +1355,7 @@ msgstr "" "trabalho. " #. Tag: para +#: tutorial.xml:554 #, no-c-format msgid "" "Related to the unit of work scope, should the Hibernate org." @@ -1009,9 +1384,10 @@ msgstr "" "aplicativo da web real será demonstrado mais adiante neste tutorial." #. Tag: para -#, no-c-format +#: tutorial.xml:571 +#, fuzzy, no-c-format msgid "" -"See for more information about transaction " +"See for more information about transaction " "handling and demarcation. The previous example also skipped any error " "handling and rollback." msgstr "" @@ -1020,6 +1396,7 @@ msgstr "" "qualquer manipulação de erro e rollback no exemplo anterior. " #. Tag: para +#: tutorial.xml:577 #, no-c-format msgid "" "To run this, we will make use of the Maven exec plugin to call our class " @@ -1032,11 +1409,13 @@ msgstr "" "\"" #. Tag: para +#: tutorial.xml:584 #, no-c-format msgid "You may need to perform mvn compile first." msgstr "Você precisa executar o mvn compile primeiramente." #. Tag: para +#: tutorial.xml:589 #, no-c-format msgid "" "You should see Hibernate starting up and, depending on your configuration, " @@ -1046,33 +1425,78 @@ msgstr "" "dependendo da sua configuração, muito log de saída. No final, você verá a " "seguinte linha: " +#. Tag: programlisting +#: tutorial.xml:594 +#, no-c-format +msgid "" +"" +msgstr "" + #. Tag: para +#: tutorial.xml:596 #, no-c-format msgid "This is the INSERT executed by Hibernate." msgstr "Este é o INSERT executado pelo Hibernate." #. Tag: para +#: tutorial.xml:600 #, no-c-format msgid "To list stored events an option is added to the main method:" msgstr "" "Adicionamos uma opção para o método principal com o objetivo de listar os " "eventos arquivados: " +#. Tag: programlisting +#: tutorial.xml:604 +#, no-c-format +msgid "" +"" +msgstr "" + #. Tag: para +#: tutorial.xml:606 #, no-c-format msgid "A new listEvents() method is also added:" msgstr "" "Nos também adicionamos um novo listEvents() method is also added: " -#. Tag: para +#. Tag: programlisting +#: tutorial.xml:610 #, no-c-format msgid "" +"" +msgstr "" + +#. Tag: para +#: tutorial.xml:612 +#, fuzzy, no-c-format +msgid "" "Here, we are using a Hibernate Query Language (HQL) query to load all " "existing Event objects from the database. Hibernate will " "generate the appropriate SQL, send it to the database and populate " "Event objects with the data. You can create more complex " -"queries with HQL. See for more information." +"queries with HQL. See for more information." msgstr "" "Neste caso, nós usamos uma consulta Hibernate Query LanguageHQL (HQL), para " "carregar todos os objetos Event existentes no banco de " @@ -1082,6 +1506,7 @@ msgstr "" "maiores informações. " #. Tag: para +#: tutorial.xml:620 #, no-c-format msgid "" "Now we can call our new functionality, again using the Maven exec plugin: " @@ -1093,11 +1518,13 @@ msgstr "" "tutorial.EventManager\" -Dexec.args=\"list\"" #. Tag: title +#: tutorial.xml:630 #, no-c-format msgid "Part 2 - Mapping associations" msgstr "Parte 2 - Mapeando associações " #. Tag: para +#: tutorial.xml:632 #, no-c-format msgid "" "So far we have mapped a single persistent entity class to a table in " @@ -1111,16 +1538,40 @@ msgstr "" "participam. " #. Tag: title +#: tutorial.xml:640 #, no-c-format msgid "Mapping the Person class" msgstr "Mapeando a classe Person " #. Tag: para +#: tutorial.xml:642 #, no-c-format msgid "The first cut of the Person class looks like this:" -msgstr "O primeira parte da classe Person parece-se com isto: " +msgstr "" +"O primeira parte da classe Person parece-se com isto: " + +#. Tag: programlisting +#: tutorial.xml:646 +#, no-c-format +msgid "" +"" +msgstr "" #. Tag: para +#: tutorial.xml:648 #, no-c-format msgid "" "Save this to a file named src/main/java/org/hibernate/tutorial/" @@ -1130,6 +1581,7 @@ msgstr "" "domain/Person.java" #. Tag: para +#: tutorial.xml:653 #, no-c-format msgid "" "Next, create the new mapping file as src/main/resources/org/" @@ -1138,12 +1590,40 @@ msgstr "" "Após isto, crie um novo arquivo de mapeamento como src/main/" "resources/org/hibernate/tutorial/domain/Person.hbm.xml" +#. Tag: programlisting +#: tutorial.xml:658 +#, no-c-format +msgid "" +"\n" +"\n" +" \n" +" \n" +" \n" +" \n" +" \n" +" \n" +" \n" +" \n" +"\n" +"]]>" +msgstr "" + #. Tag: para +#: tutorial.xml:660 #, no-c-format msgid "Finally, add the new mapping to Hibernate's configuration:" msgstr "Finalmente, adicione o novo mapeamento à configuração do Hibernate: " +#. Tag: programlisting +#: tutorial.xml:664 +#, no-c-format +msgid "" +"\n" +"]]>" +msgstr "" + #. Tag: para +#: tutorial.xml:666 #, no-c-format msgid "" "Create an association between these two entities. Persons can participate in " @@ -1156,11 +1636,13 @@ msgstr "" "comportamento de coleção. " #. Tag: title +#: tutorial.xml:676 #, no-c-format msgid "A unidirectional Set-based association" msgstr "Uma associação unidirecional baseada em Configuração" #. Tag: para +#: tutorial.xml:678 #, no-c-format msgid "" "By adding a collection of events to the Person class, you " @@ -1180,7 +1662,26 @@ msgstr "" "interfacename>, uma vez que a coleção não conterá elementos duplicados e a " "ordem não é relevante em nossos exemplos:" +#. Tag: programlisting +#: tutorial.xml:689 +#, no-c-format +msgid "" +"" +msgstr "" + #. Tag: para +#: tutorial.xml:691 #, no-c-format msgid "" "Before mapping this association, let's consider the other side. We could " @@ -1204,7 +1705,28 @@ msgstr "" "muitos-para-muitos. Daqui pra frente, usaremos o " "mapeamento muitos-para-muitos do Hibernate: " +#. Tag: programlisting +#: tutorial.xml:704 +#, no-c-format +msgid "" +"\n" +" \n" +" \n" +" \n" +" \n" +" \n" +" \n" +"\n" +" \n" +" \n" +" \n" +" \n" +"\n" +"]]>" +msgstr "" + #. Tag: para +#: tutorial.xml:706 #, no-c-format msgid "" "Hibernate supports a broad range of collection mappings, a set | *EVENT_ID | | |\n" +" | EVENT_DATE | | *PERSON_ID | <--> | *PERSON_ID |\n" +" | TITLE | |__________________| | AGE |\n" +" |_____________| | FIRSTNAME |\n" +" | LASTNAME |\n" +" |_____________|\n" +" ]]>" +msgstr "" + #. Tag: title +#: tutorial.xml:731 #, no-c-format msgid "Working the association" msgstr "Trabalhando a associação " #. Tag: para +#: tutorial.xml:733 #, no-c-format msgid "" "Now we will bring some people and events together in a new method in " @@ -1250,7 +1794,25 @@ msgstr "" "Vamos reunir algumas pessoas e eventos em um novo método na classe " "EventManager:" +#. Tag: programlisting +#: tutorial.xml:737 +#, no-c-format +msgid "" +"" +msgstr "" + #. Tag: para +#: tutorial.xml:739 #, no-c-format msgid "" "After loading a Person and an Event, " @@ -1284,6 +1846,7 @@ msgstr "" "transação do banco de dados. " #. Tag: para +#: tutorial.xml:758 #, no-c-format msgid "" "You can load person and event in different units of work. Or you can modify " @@ -1299,7 +1862,43 @@ msgstr "" "detached). Você pode até mesmo modificar uma coleção " "quando esta se encontrar no estado detached:" +#. Tag: programlisting +#: tutorial.xml:767 +#, no-c-format +msgid "" +"" +msgstr "" + #. Tag: para +#: tutorial.xml:769 #, no-c-format msgid "" "The call to update makes a detached object persistent " @@ -1316,6 +1915,7 @@ msgstr "" "objeto. " #. Tag: para +#: tutorial.xml:778 #, no-c-format msgid "" "This is not much use in our example, but it is an important concept you can " @@ -1333,7 +1933,22 @@ msgstr "" "save() retornará estes identificadores (você poderá " "modificar alguns dos métodos anteriores para retornar aquele identificador): " +#. Tag: programlisting +#: tutorial.xml:786 +#, no-c-format +msgid "" +"" +msgstr "" + #. Tag: para +#: tutorial.xml:788 #, no-c-format msgid "" "This is an example of an association between two equally important classes : " @@ -1364,6 +1979,7 @@ msgstr "" "aplicativo Hibernate todas as classes JDK são consideradas tipos de valores." #. Tag: para +#: tutorial.xml:806 #, no-c-format msgid "" "You can also design a collection of value types. This is conceptually " @@ -1375,11 +1991,13 @@ msgstr "" "entidades, mas em Java parece ser quase a mesma coisa. " #. Tag: title +#: tutorial.xml:815 #, no-c-format msgid "Collection of values" msgstr "Coleção de valores " #. Tag: para +#: tutorial.xml:817 #, no-c-format msgid "" "Let's add a collection of email addresses to the Person " @@ -1391,12 +2009,39 @@ msgstr "" "java.util.Set das instâncias java." "lang.String:" +#. Tag: programlisting +#: tutorial.xml:823 +#, no-c-format +msgid "" +"" +msgstr "" + #. Tag: para +#: tutorial.xml:825 #, no-c-format msgid "The mapping of this Set is as follows:" msgstr "Segue abaixo o mapeamento deste Set: " +#. Tag: programlisting +#: tutorial.xml:829 +#, no-c-format +msgid "" +"\n" +" \n" +" \n" +" ]]>" +msgstr "" + #. Tag: para +#: tutorial.xml:831 #, no-c-format msgid "" "The difference compared with the earlier mapping is the use of the " @@ -1423,11 +2068,39 @@ msgstr "" "coluna onde os valores da String serão armazenados. " #. Tag: para +#: tutorial.xml:847 #, no-c-format msgid "Here is the updated schema:" msgstr "Segue abaixo o esquema atualizado: " +#. Tag: programlisting +#: tutorial.xml:851 +#, no-c-format +msgid "" +" | *EVENT_ID | | | |" +"___________________|\n" +" | EVENT_DATE | | *PERSON_ID | <--> | *PERSON_ID | <--> | " +"*PERSON_ID |\n" +" | TITLE | |__________________| | AGE | | " +"*EMAIL_ADDR |\n" +" |_____________| | FIRSTNAME | |" +"___________________|\n" +" | LASTNAME |\n" +" |_____________|\n" +" ]]>" +msgstr "" + #. Tag: para +#: tutorial.xml:853 #, no-c-format msgid "" "You can see that the primary key of the collection table is in fact a " @@ -1441,6 +2114,7 @@ msgstr "" "semântica que precisamos para um set em Java. " #. Tag: para +#: tutorial.xml:859 #, no-c-format msgid "" "You can now try to add elements to this collection, just like we did before " @@ -1449,7 +2123,27 @@ msgstr "" "Você pode agora tentar adicionar elementos à essa coleção, do mesmo modo que " "fizemos anteriormente ligando pessoas e eventos. É o mesmo código em Java: " +#. Tag: programlisting +#: tutorial.xml:864 +#, no-c-format +msgid "" +"" +msgstr "" + #. Tag: para +#: tutorial.xml:866 #, no-c-format msgid "" "This time we did not use a fetch query to initialize " @@ -1461,11 +2155,13 @@ msgstr "" "busca. " #. Tag: title +#: tutorial.xml:875 #, no-c-format msgid "Bi-directional associations" msgstr "Associações bidirecionais " #. Tag: para +#: tutorial.xml:877 #, no-c-format msgid "" "Next you will map a bi-directional association. You will make the " @@ -1479,6 +2175,7 @@ msgstr "" "multiplicidade muitos-para-muitos. " #. Tag: para +#: tutorial.xml:885 #, no-c-format msgid "" "A relational database is more flexible than a network programming language, " @@ -1490,6 +2187,7 @@ msgstr "" "dados podem ser visualizados e restaurados de qualquer maneira." #. Tag: para +#: tutorial.xml:893 #, no-c-format msgid "" "First, add a collection of participants to the Event " @@ -1498,12 +2196,42 @@ msgstr "" "Primeiramente, adicione uma coleção de participantes à classe " "Event: " -#. Tag: para +#. Tag: programlisting +#: tutorial.xml:898 #, no-c-format -msgid "Now map this side of the association in Event.hbm.xml." -msgstr "Agora mapeie este lado da associação em Event.hbm.xml. " +msgid "" +"" +msgstr "" #. Tag: para +#: tutorial.xml:900 +#, no-c-format +msgid "" +"Now map this side of the association in Event.hbm.xml." +msgstr "" +"Agora mapeie este lado da associação em Event.hbm.xml. " + +#. Tag: programlisting +#: tutorial.xml:904 +#, no-c-format +msgid "" +"\n" +" \n" +" \n" +" ]]>" +msgstr "" + +#. Tag: para +#: tutorial.xml:906 #, no-c-format msgid "" "These are normal set mappings in both mapping documents. " @@ -1521,6 +2249,7 @@ msgstr "" "literal> da coleção da classe Event. " #. Tag: para +#: tutorial.xml:914 #, no-c-format msgid "" "What this means is that Hibernate should take the other side, the " @@ -1535,11 +2264,13 @@ msgstr "" "criada. " #. Tag: title +#: tutorial.xml:923 #, no-c-format msgid "Working bi-directional links" msgstr "Trabalhando com links bidirecionais " #. Tag: para +#: tutorial.xml:925 #, no-c-format msgid "" "First, keep in mind that Hibernate does not affect normal Java semantics. " @@ -1563,6 +2294,7 @@ msgstr "" "os lados\" é absolutamente necessária e você nunca deve esquecer de fazê-la. " #. Tag: para +#: tutorial.xml:935 #, no-c-format msgid "" "Many developers program defensively and create link management methods to " @@ -1572,7 +2304,31 @@ msgstr "" "gerenciamento de um link que ajustam-se corretamente em ambos os lados (como " "por exemplo, em Person): " +#. Tag: programlisting +#: tutorial.xml:940 +#, no-c-format +msgid "" +"" +msgstr "" + #. Tag: para +#: tutorial.xml:942 #, no-c-format msgid "" "The get and set methods for the collection are now protected. This allows " @@ -1586,6 +2342,7 @@ msgstr "" "coleção diretamente. Repita os passos para a coleção do outro lado. " #. Tag: para +#: tutorial.xml:949 #, no-c-format msgid "" "What about the inverse mapping attribute? For you, and " @@ -1619,11 +2376,13 @@ msgstr "" "selecionar qualquer lado. " #. Tag: title +#: tutorial.xml:965 #, no-c-format msgid "Part 3 - The EventManager web application" msgstr "EventManager um aplicativo da web" #. Tag: para +#: tutorial.xml:967 #, no-c-format msgid "" "A Hibernate web application uses Session and " @@ -1640,11 +2399,13 @@ msgstr "" "novos eventos. " #. Tag: title +#: tutorial.xml:975 #, no-c-format msgid "Writing the basic servlet" msgstr "Criando um servlet básico " #. Tag: para +#: tutorial.xml:977 #, no-c-format msgid "" "First we need create our basic processing servlet. Since our servlet only " @@ -1655,7 +2416,52 @@ msgstr "" "Uma vez que o servlet manuseia somente requisições GET do " "HTTP, o método que iremos implementar é doGet(): " +#. Tag: programlisting +#: tutorial.xml:983 +#, no-c-format +msgid "" +"" +msgstr "" + #. Tag: para +#: tutorial.xml:985 #, no-c-format msgid "" "Save this servlet as src/main/java/org/hibernate/tutorial/web/" @@ -1665,6 +2471,7 @@ msgstr "" "EventManagerServlet.java" #. Tag: para +#: tutorial.xml:990 #, no-c-format msgid "" "The pattern applied here is called session-per-request. " @@ -1683,6 +2490,7 @@ msgstr "" "leitura ou escrita. Não se deve utilizar o modo auto-commit em aplicações. " #. Tag: para +#: tutorial.xml:999 #, no-c-format msgid "" "Do not use a new Hibernate Session " @@ -1697,6 +2505,7 @@ msgstr "" "vinculado automaticamente à thread atual de Java. " #. Tag: para +#: tutorial.xml:1006 #, no-c-format msgid "" "Next, the possible actions of the request are processed and the response " @@ -1706,6 +2515,7 @@ msgstr "" "resposta HTML será renderizada. Já chegaremos nesta parte. " #. Tag: para +#: tutorial.xml:1011 #, no-c-format msgid "" "Finally, the unit of work ends when processing and rendering are complete. " @@ -1728,18 +2538,58 @@ msgstr "" "considerar renderizar sua visualização no JSP, não apenas num servlet. " #. Tag: title +#: tutorial.xml:1025 #, no-c-format msgid "Processing and rendering" msgstr "Processando e renderizando" #. Tag: para +#: tutorial.xml:1027 #, no-c-format msgid "" "Now you can implement the processing of the request and the rendering of the " "page." -msgstr "Vamos implementar o processamento da solicitação e renderização da página. " +msgstr "" +"Vamos implementar o processamento da solicitação e renderização da página. " + +#. Tag: programlisting +#: tutorial.xml:1031 +#, no-c-format +msgid "" +"Event Manager" +"\");\n" +"\n" +" // Handle actions\n" +" if ( \"store\".equals(request.getParameter(\"action\")) ) {\n" +"\n" +" String eventTitle = request.getParameter(\"eventTitle\");\n" +" String eventDate = request.getParameter(\"eventDate\");\n" +"\n" +" if ( \"\".equals(eventTitle) || \"\".equals(eventDate) ) {\n" +" out.println(\"Please enter event title and date.\");\n" +" }\n" +" else {\n" +" createAndStoreEvent(eventTitle, dateFormatter.parse" +"(eventDate));\n" +" out.println(\"Added event.\");\n" +" }\n" +" }\n" +"\n" +" // Print page\n" +" printEventForm(out);\n" +" listEvents(out, dateFormatter);\n" +"\n" +" // Write HTML footer\n" +" out.println(\"\");\n" +" out.flush();\n" +" out.close();]]>" +msgstr "" #. Tag: para +#: tutorial.xml:1033 #, no-c-format msgid "" "This coding style, with a mix of Java and HTML, would not scale in a more " @@ -1756,7 +2606,25 @@ msgstr "" "para entrada de evento em HTML e uma lista de todos os evento no banco de " "dados. O primeiro método é trivial e somente produz um HTML:" +#. Tag: programlisting +#: tutorial.xml:1042 +#, no-c-format +msgid "" +"Add new event:\");\n" +" out.println(\"
\");\n" +" out.println(\"Title:
" +"\");\n" +" out.println(\"Date (e.g. 24.12.2009):
\");\n" +" out.println(\"" +"\");\n" +" out.println(\"
\");\n" +" }]]>" +msgstr "" + #. Tag: para +#: tutorial.xml:1044 #, no-c-format msgid "" "The listEvents() method uses the Hibernate " @@ -1765,7 +2633,38 @@ msgstr "" "O método listEvents() utiliza a Session do Hibernate, limitado ao thread atual para executar uma consulta: " +#. Tag: programlisting +#: tutorial.xml:1050 +#, no-c-format +msgid "" +" 0) {\n" +" out.println(\"

Events in database:

\");\n" +" out.println(\"\");\n" +" out.println(\"\");\n" +" out.println(\"\");\n" +" out.println(\"\");\n" +" out.println(\"\");\n" +" Iterator it = result.iterator();\n" +" while (it.hasNext()) {\n" +" Event event = (Event) it.next();\n" +" out.println(\"\");\n" +" out.println(\"\");\n" +" out.println(\"\");\n" +" out.println(\"\");\n" +" }\n" +" out.println(\"
Event titleEvent date
\" + event.getTitle() + \"\" + dateFormatter.format(event.getDate()) " +"+ \"
\");\n" +" }\n" +" }]]>" +msgstr "" + #. Tag: para +#: tutorial.xml:1052 #, no-c-format msgid "" "Finally, the store action is dispatched to the " @@ -1776,7 +2675,23 @@ msgstr "" "createAndStoreEvent(), que também utiliza a " "Session da thread atual:" +#. Tag: programlisting +#: tutorial.xml:1058 +#, no-c-format +msgid "" +"" +msgstr "" + #. Tag: para +#: tutorial.xml:1060 #, no-c-format msgid "" "The servlet is now complete. A request to the servlet will be processed in a " @@ -1798,11 +2713,13 @@ msgstr "" "(o modelo DAO). Veja o Hibernate Wiki para mais exemplos. " #. Tag: title +#: tutorial.xml:1074 #, no-c-format msgid "Deploying and testing" msgstr "Implementando e testando" #. Tag: para +#: tutorial.xml:1076 #, no-c-format msgid "" "To deploy this application for testing we must create a Web ARchive (WAR). " @@ -1813,7 +2730,32 @@ msgstr "" "Web (WAR). Primeiro, nós devemos definir o descritor WAR como src/" "main/webapp/WEB-INF/web.xml" +#. Tag: programlisting +#: tutorial.xml:1082 +#, no-c-format +msgid "" +"\n" +"\n" +"\n" +" \n" +" Event Manager\n" +" org.hibernate.tutorial.web.EventManagerServlet\n" +" \n" +"\n" +" \n" +" Event Manager\n" +" /eventmanager\n" +" \n" +"]]>" +msgstr "" + #. Tag: para +#: tutorial.xml:1084 #, no-c-format msgid "" "To build and deploy call mvn package in your project " @@ -1825,17 +2767,19 @@ msgstr "" "para seu diretório Tomcat webapp. " #. Tag: para -#, no-c-format +#: tutorial.xml:1091 +#, fuzzy, no-c-format msgid "" "If you do not have Tomcat installed, download it from and follow the installation instructions. Our " +"tomcat.apache.org/\"> and follow the installation instructions. Our " "application requires no changes to the standard Tomcat configuration." msgstr "" "Caso você não possua o Tomcat instalado, baixe isto do e siga as instruções de instalação. Nosso " -"aplicativo não solicita alterações à configuração Tomcat padrão. " +"tomcat.apache.org/\" /> e siga as instruções de instalação. Nosso aplicativo " +"não solicita alterações à configuração Tomcat padrão. " #. Tag: para +#: tutorial.xml:1099 #, no-c-format msgid "" "Once deployed and Tomcat is running, access the application at " @@ -1853,11 +2797,13 @@ msgstr "" "resultado detalhado caso exceções aconteçam. " #. Tag: title +#: tutorial.xml:1112 #, no-c-format msgid "Summary" msgstr "Sumário" #. Tag: para +#: tutorial.xml:1114 #, no-c-format msgid "" "This tutorial covered the basics of writing a simple standalone Hibernate " @@ -1868,4 +2814,3 @@ msgstr "" "autônomo simples e um aplicativo da web pequeno. A partir do Hibernate " "website você poderá encontrar " "mais tutoriais disponíveis." - diff --git a/documentation/manual/src/main/docbook/zh-CN/author_group.po b/documentation/manual/src/main/docbook/zh-CN/author_group.po index 1e111318e2..1514e872e4 100644 --- a/documentation/manual/src/main/docbook/zh-CN/author_group.po +++ b/documentation/manual/src/main/docbook/zh-CN/author_group.po @@ -5,7 +5,7 @@ msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: http://bugs.kde.org\n" -"POT-Creation-Date: 2010-02-04T04:51:21\n" +"POT-Creation-Date: 2010-07-20 21:02+0000\n" "PO-Revision-Date: 2010-03-15 08:43+1000\n" "Last-Translator: Xi HUANG \n" "Language-Team: none\n" @@ -13,138 +13,296 @@ msgstr "" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" -#. Tag: firstname +#. Tag: author +#: author_group.xml:28 #, no-c-format -msgid "Gavin" -msgstr "Gavin" +msgid "Gavin King" +msgstr "" -#. Tag: firstname +#. Tag: author +#: author_group.xml:32 #, no-c-format -msgid "Christian" -msgstr "Christian" +msgid "Christian Bauer" +msgstr "" -#. Tag: firstname +#. Tag: author +#: author_group.xml:36 #, no-c-format -msgid "Max" -msgstr "Max" +msgid "" +"Max Rydahl Andersen" +msgstr "" -#. Tag: firstname +#. Tag: author +#: author_group.xml:41 #, no-c-format -msgid "Emmanuel" -msgstr "Emmanuel" +msgid "" +"Emmanuel Bernard" +msgstr "" -#. Tag: firstname +#. Tag: author +#: author_group.xml:45 #, no-c-format -msgid "Steve" -msgstr "Steve" +msgid "Steve Ebersole" +msgstr "" -#. Tag: firstname +#. Tag: author +#: author_group.xml:49 #, no-c-format -msgid "James" -msgstr "James" +msgid "Hardy Ferentschik" +msgstr "" -#. Tag: firstname +#. Tag: othercredit +#: author_group.xml:54 #, no-c-format -msgid "Cheyenne" -msgstr "Cheyenne" +msgid "James Cobb" +msgstr "" -#. Tag: firstname +#. Tag: shortaffil +#: author_group.xml:58 author_group.xml:65 #, no-c-format -msgid "Vincent" -msgstr "Vincent" +msgid "Graphic Design" +msgstr "" -#. Tag: firstname +#. Tag: othercredit +#: author_group.xml:61 #, no-c-format -msgid "Sebastien" -msgstr "Sebastien" +msgid "Cheyenne Weaver" +msgstr "" -#. Tag: firstname +#. Tag: othercredit +#: author_group.xml:74 #, no-c-format -msgid "Michael" -msgstr "Michael" +msgid "" +" " +"kreimer@bbs.frc.utn.edu.ar" +msgstr "" -#. Tag: firstname +#. Tag: othercredit +#: author_group.xml:84 #, no-c-format -msgid "Baptiste" -msgstr "Baptiste" +msgid "Vincent Ricard" +msgstr "" -#. Tag: firstname +#. Tag: othercredit +#: author_group.xml:88 #, no-c-format -msgid "Anthony" -msgstr "Anthony" +msgid "Sebastien Cesbron" +msgstr "" -#. Tag: firstname +#. Tag: othercredit +#: author_group.xml:92 #, no-c-format -msgid "Alvaro" -msgstr "Alvaro" +msgid "Michael Courcy" +msgstr "" -#. Tag: firstname +#. Tag: othercredit +#: author_group.xml:96 #, no-c-format -msgid "Anderson" -msgstr "Anderson" +msgid "Vincent Giguère" +msgstr "" -#. Tag: firstname +#. Tag: othercredit +#: author_group.xml:100 #, no-c-format -msgid "Daniel Vieira" -msgstr "Daniel Vieira" +msgid "Baptiste Mathus" +msgstr "" -#. Tag: firstname +#. Tag: othercredit +#: author_group.xml:104 #, no-c-format -msgid "Francisco" -msgstr "Francisco" +msgid "" +"Emmanuel Bernard" +msgstr "" -#. Tag: firstname +#. Tag: othercredit +#: author_group.xml:108 #, no-c-format -msgid "Gamarra" -msgstr "Gamarra" +msgid "Anthony Patricio" +msgstr "" -#. Tag: firstname +#. Tag: othercredit +#: author_group.xml:118 #, no-c-format -msgid "Luiz Carlos" -msgstr "Luiz Carlos" +msgid "" +"Alvaro Netto " +"alvaronetto@cetip.com.br" +msgstr "" -#. Tag: firstname +#. Tag: othercredit +#: author_group.xml:123 #, no-c-format -msgid "Marcel" -msgstr "Marcel" +msgid "" +"Anderson Braulio " +"andersonbraulio@gmail.com" +msgstr "" -#. Tag: firstname +#. Tag: othercredit +#: author_group.xml:128 #, no-c-format -msgid "Paulo" -msgstr "Paulo" +msgid "" +"Daniel Vieira Costa " +"danielvc@gmail.com" +msgstr "" -#. Tag: firstname +#. Tag: othercredit +#: author_group.xml:133 #, no-c-format -msgid "Pablo L." -msgstr "Pablo L." +msgid "" +"Francisco gamarra francisco." +"gamarra@gmail.com" +msgstr "" -#. Tag: firstname +#. Tag: othercredit +#: author_group.xml:138 #, no-c-format -msgid "Renato" -msgstr "Renato" +msgid "" +"Gamarra mauricio.gamarra@gmail.com" +msgstr "" -#. Tag: firstname +#. Tag: othercredit +#: author_group.xml:142 #, no-c-format -msgid "Rogério" -msgstr "Rogério" +msgid "" +"Luiz Carlos Rodrigues " +"luizcarlos_rodrigues@yahoo.com.br" +msgstr "" -#. Tag: firstname +#. Tag: othercredit +#: author_group.xml:147 #, no-c-format -msgid "Wanderson" -msgstr "Wanderson" +msgid "" +"Marcel Castelo marcel." +"castelo@gmail.com" +msgstr "" -#. Tag: firstname +#. Tag: othercredit +#: author_group.xml:152 #, no-c-format -msgid "Cao" -msgstr "Cao" +msgid "" +"Paulo César paulocol@gmail." +"com" +msgstr "" -#. Tag: orgname +#. Tag: othercredit +#: author_group.xml:157 #, no-c-format -msgid "RedSaga" -msgstr "RedSaga" +msgid "" +"Pablo L. de Miranda " +"pablolmiranda@gmail.com" +msgstr "" -#. Tag: contrib +#. Tag: othercredit +#: author_group.xml:162 #, no-c-format -msgid "Translation Lead" -msgstr "Translation Lead" +msgid "" +"Renato Deggau rdeggau@gmail." +"com" +msgstr "" +#. Tag: othercredit +#: author_group.xml:167 +#, no-c-format +msgid "" +"Rogério Araújo " +"rgildoaraujo@yahoo.com.br" +msgstr "" + +#. Tag: othercredit +#: author_group.xml:172 +#, no-c-format +msgid "" +"Wanderson Siqueira " +"wandersonxs@gmail.com" +msgstr "" + +#. Tag: othercredit +#: author_group.xml:183 +#, no-c-format +msgid "" +"Cao Xiaogang " +"RedSaga Translation Lead caoxg@yahoo.com" +msgstr "" + +#~ msgid "Gavin" +#~ msgstr "Gavin" + +#~ msgid "Christian" +#~ msgstr "Christian" + +#~ msgid "Max" +#~ msgstr "Max" + +#~ msgid "Emmanuel" +#~ msgstr "Emmanuel" + +#~ msgid "Steve" +#~ msgstr "Steve" + +#~ msgid "James" +#~ msgstr "James" + +#~ msgid "Cheyenne" +#~ msgstr "Cheyenne" + +#~ msgid "Vincent" +#~ msgstr "Vincent" + +#~ msgid "Sebastien" +#~ msgstr "Sebastien" + +#~ msgid "Michael" +#~ msgstr "Michael" + +#~ msgid "Baptiste" +#~ msgstr "Baptiste" + +#~ msgid "Anthony" +#~ msgstr "Anthony" + +#~ msgid "Alvaro" +#~ msgstr "Alvaro" + +#~ msgid "Anderson" +#~ msgstr "Anderson" + +#~ msgid "Daniel Vieira" +#~ msgstr "Daniel Vieira" + +#~ msgid "Francisco" +#~ msgstr "Francisco" + +#~ msgid "Gamarra" +#~ msgstr "Gamarra" + +#~ msgid "Luiz Carlos" +#~ msgstr "Luiz Carlos" + +#~ msgid "Marcel" +#~ msgstr "Marcel" + +#~ msgid "Paulo" +#~ msgstr "Paulo" + +#~ msgid "Pablo L." +#~ msgstr "Pablo L." + +#~ msgid "Renato" +#~ msgstr "Renato" + +#~ msgid "Rogério" +#~ msgstr "Rogério" + +#~ msgid "Wanderson" +#~ msgstr "Wanderson" + +#~ msgid "Cao" +#~ msgstr "Cao" + +#~ msgid "RedSaga" +#~ msgstr "RedSaga" + +#~ msgid "Translation Lead" +#~ msgstr "Translation Lead" diff --git a/documentation/manual/src/main/docbook/zh-CN/content/basic_mapping.po b/documentation/manual/src/main/docbook/zh-CN/content/basic_mapping.po index 4db1336469..b86be782c4 100644 --- a/documentation/manual/src/main/docbook/zh-CN/content/basic_mapping.po +++ b/documentation/manual/src/main/docbook/zh-CN/content/basic_mapping.po @@ -6,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: basic_mapping\n" "Report-Msgid-Bugs-To: http://bugs.kde.org\n" -"POT-Creation-Date: 2010-02-11T05:38:15\n" +"POT-Creation-Date: 2010-07-20 21:02+0000\n" "PO-Revision-Date: 2010-03-15 08:56+1000\n" "Last-Translator: Xi HUANG \n" "Language-Team: \n" @@ -16,2082 +16,9424 @@ msgstr "" "X-Generator: KBabel 1.11.4\n" #. Tag: title +#: basic_mapping.xml:31 #, no-c-format msgid "Basic O/R Mapping" msgstr "对象/关系数据库映射基础(Basic O/R Mapping)" #. Tag: title +#: basic_mapping.xml:34 #, no-c-format msgid "Mapping declaration" msgstr "映射定义(Mapping declaration)" #. Tag: para +#: basic_mapping.xml:36 #, no-c-format -msgid "Object/relational mappings are usually defined in an XML document. The mapping document is designed to be readable and hand-editable. The mapping language is Java-centric, meaning that mappings are constructed around persistent class declarations and not table declarations." -msgstr "对象和关系数据库之间的映射通常是用一个 XML 文档来定义的。这个映射文档被设计为易读的,并且可以手工修改。映射语言是以 Java 为中心,这意味着映射文档是按照持久化类的定义来创建的,而非表的定义。 " +msgid "Object/relational mappings can be defined in three approaches:" +msgstr "" #. Tag: para +#: basic_mapping.xml:41 #, no-c-format -msgid "Please note that even though many Hibernate users choose to write the XML by hand, a number of tools exist to generate the mapping document. These include XDoclet, Middlegen and AndroMDA." -msgstr "请注意,虽然很多 Hibernate 用户选择手写 XML 映射文档,但也有一些工具可以用来生成映射文档,包括 XDoclet、Middlegen 和 AndroMDA。" +msgid "using Java 5 annotations (via the Java Persistence 2 annotations)" +msgstr "" #. Tag: para +#: basic_mapping.xml:46 +#, no-c-format +msgid "using JPA 2 XML deployment descriptors (described in chapter XXX)" +msgstr "" + +#. Tag: para +#: basic_mapping.xml:51 +#, no-c-format +msgid "using the Hibernate legacy XML files approach known as hbm.xml" +msgstr "" + +#. Tag: para +#: basic_mapping.xml:56 +#, no-c-format +msgid "" +"Annotations are split in two categories, the logical mapping annotations " +"(describing the object model, the association between two entities etc.) and " +"the physical mapping annotations (describing the physical schema, tables, " +"columns, indexes, etc). We will mix annotations from both categories in the " +"following code examples." +msgstr "" + +#. Tag: para +#: basic_mapping.xml:62 +#, no-c-format +msgid "" +"JPA annotations are in the javax.persistence.* package. " +"Hibernate specific extensions are in org.hibernate.annotations.*. You favorite IDE can auto-complete annotations and their " +"attributes for you (even without a specific \"JPA\" plugin, since JPA " +"annotations are plain Java 5 annotations)." +msgstr "" + +#. Tag: para +#: basic_mapping.xml:69 +#, fuzzy, no-c-format +msgid "Here is an example of mapping" +msgstr "下面是一个映射的例子:" + +#. Tag: programlisting +#: basic_mapping.xml:71 +#, no-c-format +msgid "" +"package eg;\n" +"\n" +"@Entity \n" +"@Table(name=\"cats\") @Inheritance(strategy=SINGLE_TABLE)\n" +"@DiscriminatorValue(\"C\") @DiscriminatorColumn(name=\"subclass\", " +"discriminatorType=CHAR)\n" +"public class Cat {\n" +" \n" +" @Id @GeneratedValue\n" +" public Integer getId() { return id; }\n" +" public void setId(Integer id) { this.id = id; }\n" +" private Integer id;\n" +"\n" +" public BigDecimal getWeight() { return weight; }\n" +" public void setWeight(BigDecimal weight) { this.weight = weight; }\n" +" private BigDecimal weight;\n" +"\n" +" @Temporal(DATE) @NotNull @Column(updatable=false)\n" +" public Date getBirthdate() { return birthdate; }\n" +" public void setBirthdate(Date birthdate) { this.birthdate = birthdate; }\n" +" private Date birthdate;\n" +"\n" +" @org.hibernate.annotations.Type(type=\"eg.types.ColorUserType\")\n" +" @NotNull @Column(updatable=false)\n" +" public ColorType getColor() { return color; }\n" +" public void setColor(ColorType color) { this.color = color; }\n" +" private ColorType color;\n" +"\n" +" @NotNull @Column(updatable=false)\n" +" public String getSex() { return sex; }\n" +" public void setSex(String sex) { this.sex = sex; }\n" +" private String sex;\n" +"\n" +" @NotNull @Column(updatable=false)\n" +" public Integer getLitterId() { return litterId; }\n" +" public void setLitterId(Integer litterId) { this.litterId = litterId; }\n" +" private Integer litterId;\n" +"\n" +" @ManyToOne @JoinColumn(name=\"mother_id\", updatable=false)\n" +" public Cat getMother() { return mother; }\n" +" public void setMother(Cat mother) { this.mother = mother; }\n" +" private Cat mother;\n" +"\n" +" @OneToMany(mappedBy=\"mother\") @OrderBy(\"litterId\")\n" +" public Set<Cat> getKittens() { return kittens; }\n" +" public void setKittens(Set<Cat> kittens) { this.kittens = " +"kittens; }\n" +" private Set<Cat> kittens = new HashSet<Cat>();\n" +"}\n" +"\n" +"@Entity @DiscriminatorValue(\"D\")\n" +"public class DomesticCat extends Cat {\n" +"\n" +" public String getName() { return name; }\n" +" public void setName(String name) { this.name = name }\n" +" private String name;\n" +"}\n" +"\n" +"@Entity\n" +"public class Dog { ... }" +msgstr "" + +#. Tag: para +#: basic_mapping.xml:73 +#, fuzzy, no-c-format +msgid "" +"The legacy hbm.xml approach uses an XML schema designed to be readable and " +"hand-editable. The mapping language is Java-centric, meaning that mappings " +"are constructed around persistent class declarations and not table " +"declarations." +msgstr "" +"对象和关系数据库之间的映射通常是用一个 XML 文档来定义的。这个映射文档被设计为" +"易读的,并且可以手工修改。映射语言是以 Java 为中心,这意味着映射文档是按照持" +"久化类的定义来创建的,而非表的定义。 " + +#. Tag: para +#: basic_mapping.xml:78 +#, no-c-format +msgid "" +"Please note that even though many Hibernate users choose to write the XML by " +"hand, a number of tools exist to generate the mapping document. These " +"include XDoclet, Middlegen and AndroMDA." +msgstr "" +"请注意,虽然很多 Hibernate 用户选择手写 XML 映射文档,但也有一些工具可以用来" +"生成映射文档,包括 XDoclet、Middlegen 和 AndroMDA。" + +#. Tag: para +#: basic_mapping.xml:82 #, no-c-format msgid "Here is an example mapping:" msgstr "下面是一个映射的例子:" +#. Tag: programlisting +#: basic_mapping.xml:84 +#, fuzzy, no-c-format +msgid "" +"<?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 name=\"Cat\"\n" +" table=\"cats\"\n" +" discriminator-value=\"C\">\n" +"\n" +" <id name=\"id\">\n" +" <generator class=\"native\"/>\n" +" </id>\n" +"\n" +" <discriminator column=\"subclass\"\n" +" type=\"character\"/>\n" +"\n" +" <property name=\"weight\"/>\n" +"\n" +" <property name=\"birthdate\"\n" +" type=\"date\"\n" +" not-null=\"true\"\n" +" update=\"false\"/>\n" +"\n" +" <property name=\"color\"\n" +" type=\"eg.types.ColorUserType\"\n" +" not-null=\"true\"\n" +" update=\"false\"/>\n" +"\n" +" <property name=\"sex\"\n" +" not-null=\"true\"\n" +" update=\"false\"/>\n" +"\n" +" <property name=\"litterId\"\n" +" column=\"litterId\"\n" +" update=\"false\"/>\n" +"\n" +" <many-to-one name=\"mother\"\n" +" column=\"mother_id\"\n" +" update=\"false\"/>\n" +"\n" +" <set name=\"kittens\"\n" +" inverse=\"true\"\n" +" order-by=\"litter_id\">\n" +" <key column=\"mother_id\"/>\n" +" <one-to-many class=\"Cat\"/>\n" +" </set>\n" +"\n" +" <subclass name=\"DomesticCat\"\n" +" discriminator-value=\"D\">\n" +"\n" +" <property name=\"name\"\n" +" type=\"string\"/>\n" +"\n" +" </subclass>\n" +"\n" +" </class>\n" +"\n" +" <class name=\"Dog\">\n" +" <!-- mapping for Dog could go here -->\n" +" </class>\n" +"\n" +"</hibernate-mapping>" +msgstr "" +"\n" +"\n" +"\n" +"\n" +"\n" +" \n" +"\n" +" \n" +" \n" +" \n" +"\n" +" \n" +"\n" +" \n" +"\n" +" \n" +"\n" +" \n" +"\n" +" \n" +"\n" +" \n" +"\n" +" \n" +"\n" +" \n" +" \n" +" \n" +" \n" +"\n" +" \n" +"\n" +" \n" +"\n" +" \n" +"\n" +" \n" +"\n" +" \n" +" \n" +" \n" +"\n" +"]]>" + #. Tag: para -#, no-c-format -msgid "We will now discuss the content of the mapping document. We will only describe, however, the document elements and attributes that are used by Hibernate at runtime. The mapping document also contains some extra optional attributes and elements that affect the database schemas exported by the schema export tool (for example, the not-null attribute)." -msgstr "我们现在开始讨论映射文档的内容。我们只描述 Hibernate 在运行时用到的文档元素和属性。映射文档还包括一些额外的可选属性和元素,它们在使用 schema 导出工具的时候会影响导出的数据库 schema 结果(比如,not-null 属性)。" +#: basic_mapping.xml:86 +#, fuzzy, no-c-format +msgid "" +"We will now discuss the concepts of the mapping documents (both annotations " +"and XML). We will only describe, however, the document elements and " +"attributes that are used by Hibernate at runtime. The mapping document also " +"contains some extra optional attributes and elements that affect the " +"database schemas exported by the schema export tool (for example, the " +" not-null attribute)." +msgstr "" +"我们现在开始讨论映射文档的内容。我们只描述 Hibernate 在运行时用到的文档元素和" +"属性。映射文档还包括一些额外的可选属性和元素,它们在使用 schema 导出工具的时" +"候会影响导出的数据库 schema 结果(比如,not-null 属性)。" #. Tag: title -#, no-c-format -msgid "Doctype" -msgstr "Doctype" +#: basic_mapping.xml:94 +#, fuzzy, no-c-format +msgid "Entity" +msgstr "identity" #. Tag: para +#: basic_mapping.xml:96 #, no-c-format -msgid "All XML mappings should declare the doctype shown. The actual DTD can be found at the URL above, in the directory hibernate-x.x.x/src/org/hibernate , or in hibernate3.jar. Hibernate will always look for the DTD in its classpath first. If you experience lookups of the DTD using an Internet connection, check the DTD declaration against the contents of your classpath." -msgstr "所有的 XML 映射都需要定义如上所示的 doctype。DTD 可以从上述 URL 中获取,也可以从 hibernate-x.x.x/src/org/hibernate 目录中、或 hibernate.jar 文件中找到。Hibernate 总是会首先在它的 classptah 中搜索 DTD 文件。如果你发现它是通过连接 Internet 查找 DTD 文件,就对照你的 classpath 目录检查 XML 文件里的 DTD 声明。" - -#. Tag: title -#, no-c-format -msgid "EntityResolver" -msgstr "EntityResolver" +msgid "" +"An entity is a regular Java object (aka POJO) which will be persisted by " +"Hibernate." +msgstr "" #. Tag: para +#: basic_mapping.xml:99 #, no-c-format -msgid "Hibernate will first attempt to resolve DTDs in its classpath. It does this is by registering a custom org.xml.sax.EntityResolver implementation with the SAXReader it uses to read in the xml files. This custom EntityResolver recognizes two different systemId namespaces:" -msgstr "Hibernate 首先试图在其 classpath 中解析 DTD。这是依靠在系统中注册的 org.xml.sax.EntityResolver 的一个具体实现,SAXReader 依靠它来读取 xml 文件。这个自定义的 EntityResolver 能辨认两种不同的 systenId 命名空间:" +msgid "" +"To mark an object as an entity in annotations, use the @Entity annotation." +msgstr "" + +#. Tag: programlisting +#: basic_mapping.xml:102 +#, no-c-format +msgid "" +"@Entity\n" +"public class Flight implements Serializable {\n" +" Long id;\n" +"\n" +" @Id\n" +" public Long getId() { return id; }\n" +"\n" +" public void setId(Long id) { this.id = id; }\n" +"}" +msgstr "" #. Tag: para +#: basic_mapping.xml:104 #, no-c-format -msgid "a hibernate namespace is recognized whenever the resolver encounters a systemId starting with http://hibernate.sourceforge.net/. The resolver attempts to resolve these entities via the classloader which loaded the Hibernate classes." -msgstr "若 resolver 遇到了一个以 http://hibernate.sourceforge.net/ 为开头的 systemId,它会辨认出是 hibernate namespace,resolver 就试图通过加载 Hibernate 类的 classloader 来查找这些实体。 " +msgid "" +"That's pretty much it, the rest is optional. There are however any options " +"to tweak your entity mapping, let's explore them." +msgstr "" #. Tag: para +#: basic_mapping.xml:107 #, no-c-format -msgid "a user namespace is recognized whenever the resolver encounters a systemId using a classpath:// URL protocol. The resolver will attempt to resolve these entities via (1) the current thread context classloader and (2) the classloader which loaded the Hibernate classes." -msgstr "若 resolver 遇到了一个使用 classpath:// URL 协议的 systemId,它会辨认出这是 user namespace,resolver 试图通过(1) 当前线程上下文的 classloader 和(2) 加载 Hibernate class 的 classloader 来查找这些实体。" +msgid "" +"@Table lets you define the table the entity will be " +"persisted into. If undefined, the table name is the unqualified class name " +"of the entity. You can also optionally define the catalog, the schema as " +"well as unique constraints on the table." +msgstr "" + +#. Tag: programlisting +#: basic_mapping.xml:112 +#, no-c-format +msgid "" +"@Entity\n" +"@Table(name=\"TBL_FLIGHT\", \n" +" schema=\"AIR_COMMAND\", \n" +" uniqueConstraints=\n" +" @UniqueConstraint(\n" +" name=\"flight_number\", \n" +" columnNames={\"comp_prefix\", \"flight_number\"} ) )\n" +"public class Flight implements Serializable {\n" +" @Column(name=\"comp_prefix\")\n" +" public String getCompagnyPrefix() { return companyPrefix; }\n" +"\n" +" @Column(name=\"flight_number\")\n" +" public String getNumber() { return number; }\n" +"}" +msgstr "" #. Tag: para +#: basic_mapping.xml:114 #, no-c-format -msgid "The following is an example of utilizing user namespacing:" -msgstr "下面是一个使用用户命名空间(user namespace)的例子:" +msgid "" +"The constraint name is optional (generated if left undefined). The column " +"names composing the constraint correspond to the column names as defined " +"before the Hibernate NamingStrategy is applied." +msgstr "" #. Tag: para +#: basic_mapping.xml:119 #, no-c-format -msgid "Where types.xml is a resource in the your.domain package and contains a custom typedef." -msgstr "这里的 types.xmlyour.domain 包中的一个资源,它包含了一个自定义的 typedef。 " - -#. Tag: title -#, no-c-format -msgid "Hibernate-mapping" -msgstr "Hibernate-mapping" +msgid "" +"@Entity.name lets you define the shortcut name of the " +"entity you can used in JP-QL and HQL queries. It defaults to the unqualified " +"class name of the class." +msgstr "" #. Tag: para +#: basic_mapping.xml:123 #, no-c-format -msgid "This element has several optional attributes. The schema and catalog attributes specify that tables referred to in this mapping belong to the named schema and/or catalog. If they are specified, tablenames will be qualified by the given schema and catalog names. If they are missing, tablenames will be unqualified. The default-cascade attribute specifies what cascade style should be assumed for properties and collections that do not specify a cascade attribute. By default, the auto-import attribute allows you to use unqualified class names in the query language." -msgstr "这个元素包括一些可选的属性。schemacatalog 属性, 指明了这个映射所连接(refer)的表所在的 schema 和/或 catalog 名称。假若指定了这个属性,表名会加上所指定的 schema 和 catalog 的名字扩展为全限定名。假若没有指定,表名就不会使用全限定名。default-cascade 指定了未明确注明 cascade 属性的 Java 属性和 集合类 Hibernate 会采取什么样的默认级联风格。auto-import 属性默认让我们在查询语言中可以使用非全限定名的类名。" +msgid "" +"Hibernate goes beyond the JPA specification and provide additional " +"configurations. Some of them are hosted on @org.hibernate." +"annotations.Entity:" +msgstr "" #. Tag: para -#, no-c-format -msgid "schema (optional): the name of a database schema." -msgstr "schema(可选):数据库 schema 的名称。" +#: basic_mapping.xml:129 +#, fuzzy, no-c-format +msgid "" +"dynamicInsert / dynamicUpdate " +"(defaults to false): specifies that INSERT / " +"UPDATE SQL should be generated at runtime and contain " +"only the columns whose values are not null. The dynamic-update and dynamic-insert settings are not inherited by " +"subclasses. Although these settings can increase performance in some cases, " +"they can actually decrease performance in others." +msgstr "" +"请注意 dynamic-updatedynamic-insert 的设置并不会继承到子类,所以在 <subclass> " +"或者 <joined-subclass> 元素中可能需要再次设置。这些" +"设置在某些情况下能够提高效率,而其他情况下则反而可能降低性能。" #. Tag: para -#, no-c-format -msgid "catalog (optional): the name of a database catalog." -msgstr "catalog(可选):数据库 catalog 的名称。 " +#: basic_mapping.xml:140 +#, fuzzy, no-c-format +msgid "" +"selectBeforeUpdate (defaults to false): specifies that " +"Hibernate should never perform an SQL UPDATE unless it is certain that an object is actually modified. Only when " +"a transient object has been associated with a new session using " +"update(), will Hibernate perform an extra SQL " +"SELECT to determine if an UPDATE is " +"actually required. Use of select-before-update will " +"usually decrease performance. It is useful to prevent a database update " +"trigger being called unnecessarily if you reattach a graph of detached " +"instances to a Session." +msgstr "" +"select-before-update(可选,默认为 false):指定 Hibernate 除非确定对象真正被修改了(如果该值为 true — 译" +"注),否则不会执行 SQL UPDATE 操作。" +"在特定场合(实际上,它只在一个瞬时对象(transient object)关联到一个新的 " +"session 中时执行的 update() 中生效),这说明 Hibernate 会在 UPDATE 之前执行一次额外的 SQL SELECT 操作来决定是否确实" +"需要执行 UPDATE。" #. Tag: para -#, no-c-format -msgid "default-cascade (optional - defaults to none): a default cascade style." -msgstr "default-cascade(可选 — 默认为 none):默认的级联风格。 " +#: basic_mapping.xml:154 +#, fuzzy, no-c-format +msgid "" +"polymorphisms (defaults to IMPLICIT): " +"determines whether implicit or explicit query polymorphisms is used. " +"Implicit polymorphisms means that instances of the " +"class will be returned by a query that names any superclass or implemented " +"interface or class, and that instances of any subclass of the class will be " +"returned by a query that names the class itself. Explicit polymorphisms means that class instances will be returned only by " +"queries that explicitly name that class. Queries that name the class will " +"return only instances of subclasses mapped. For most purposes, the default " +"polymorphisms=IMPLICIT is appropriate. Explicit " +"polymorphisms is useful when two different classes are mapped to the same " +"table This allows a \"lightweight\" class that contains a subset of the " +"table columns." +msgstr "" +"Implicit(隐式)的多态是指,如果查询时给出的是任何超类、" +"该类实现的接口或者该类的名字,都会返回这个类的实例;如果查询中给出的是子类的" +"名字,则会返回子类的实例。Explicit(显式)的多态是指,只" +"有在查询时给出明确的该类名字时才会返回这个类的实例; 同时只有在这个 " +"<class> 的定义中作为 <subclass> 或者 <joined-subclass> 出现的子类,才会可能" +"返回。在大多数情况下,默认的 polymorphism=\"implicit\" 都" +"是合适的。显式的多态在有两个不同的类映射到同一个表的时候很有用。(允许一个“轻" +"量级”的类,只包含部分表字段)。 " #. Tag: para -#, no-c-format -msgid "default-access (optional - defaults to property): the strategy Hibernate should use for accessing all properties. It can be a custom implementation of PropertyAccessor." -msgstr "default-access(可选 — 默认为 property):Hibernate 用来访问所有属性的策略。可以通过实现 PropertyAccessor 接口自定义。 " +#: basic_mapping.xml:171 +#, fuzzy, no-c-format +msgid "" +"persister: specifies a custom ClassPersister. The persister attribute lets you customize the " +"persistence strategy used for the class. You can, for example, specify your " +"own subclass of org.hibernate.persister.EntityPersister, " +"or you can even provide a completely new implementation of the interface " +"org.hibernate.persister.ClassPersister that implements, " +"for example, persistence via stored procedure calls, serialization to flat " +"files or LDAP. See org.hibernate.test.CustomPersister for " +"a simple example of \"persistence\" to a Hashtable." +msgstr "" +"persister 属性可以让你定制这个类使用的持久化策略。你可以指" +"定你自己实现 org.hibernate.persister.EntityPersister 的子" +"类,你甚至可以完全从头开始编写一个 org.hibernate.persister." +"ClassPersister 接口的实现,比如是用储存过程调用、序列化到文件或者 " +"LDAP 数据库来实现。参阅 org.hibernate.test.CustomPersister,这是持久化到 Hashtable 的一个简单例子。 " #. Tag: para -#, no-c-format -msgid "default-lazy (optional - defaults to true): the default value for unspecified lazy attributes of class and collection mappings." -msgstr "default-lazy(可选 — 默认为 true):指定了未明确注明 lazy 属性的 Java 属性和集合类,Hibernate 会采取什么样的默认加载风格。 " - -#. Tag: para -#, no-c-format -msgid "auto-import (optional - defaults to true): specifies whether we can use unqualified class names of classes in this mapping in the query language." -msgstr "auto-import(可选 — 默认为 true):指定我们是否可以在查询语言中使用非全限定的类名(仅限于本映射文件中的类)。 " - -#. Tag: para -#, no-c-format -msgid "package (optional): specifies a package prefix to use for unqualified class names in the mapping document." -msgstr "package(可选):指定一个包前缀,如果在映射文档中没有指定全限定的类名,就使用这个作为包名。 " - -#. Tag: para -#, no-c-format -msgid "If you have two persistent classes with the same unqualified name, you should set auto-import=\"false\". An exception will result if you attempt to assign two classes to the same \"imported\" name." -msgstr "假若你有两个持久化类,它们的非全限定名是一样的(就是两个类的名字一样,所在的包不一样 — 译者注),你应该设置 auto-import=\"false\"。如果你把一个“导入过”的名字同时对应两个类,Hibernate 会抛出一个异常。" - -#. Tag: para -#, no-c-format -msgid "The hibernate-mapping element allows you to nest several persistent <class> mappings, as shown above. It is, however, good practice (and expected by some tools) to map only a single persistent class, or a single class hierarchy, in one mapping file and name it after the persistent superclass. For example, Cat.hbm.xml, Dog.hbm.xml, or if using inheritance, Animal.hbm.xml." -msgstr "注意 hibernate-mapping 元素允许你嵌套多个如上所示的 <class> 映射。但是最好的做法(也许一些工具需要的)是一个持久化类(或一个类的继承层次)对应一个映射文件,并以持久化的超类名称命名,例如:Cat.hbm.xmlDog.hbm.xml,或者如果使用继承,Animal.hbm.xml。" - -#. Tag: title -#, no-c-format -msgid "Class" -msgstr "类" - -#. Tag: para -#, no-c-format -msgid "You can declare a persistent class using the class element. For example:" -msgstr "你可以使用 class 元素来定义一个持久化类。例如:" - -#. Tag: para -#, no-c-format -msgid "name (optional): the fully qualified Java class name of the persistent class or interface. If this attribute is missing, it is assumed that the mapping is for a non-POJO entity." -msgstr "name(可选):持久化类(或者接口)的 Java 全限定名。 如果这个属性不存在,Hibernate 将假定这是一个非 POJO 的实体映射。 " - -#. Tag: para -#, no-c-format -msgid "table (optional - defaults to the unqualified class name): the name of its database table." -msgstr "table(可选 — 默认是类的非全限定名):对应的数据库表名。 " - -#. Tag: para -#, no-c-format -msgid "discriminator-value (optional - defaults to the class name): a value that distinguishes individual subclasses that is used for polymorphic behavior. Acceptable values include null and not null." -msgstr "discriminator-value(可选 — 默认和类名一样):一个用于区分不同的子类的值,在多态行为时使用。它可以接受的值包括 nullnot null。 " - -#. Tag: para -#, no-c-format -msgid "mutable (optional - defaults to true): specifies that instances of the class are (not) mutable." -msgstr "mutable(可选,默认值为 true):表明该类的实例是可变的或者不可变的。 " - -#. Tag: para -#, no-c-format -msgid "schema (optional): overrides the schema name specified by the root <hibernate-mapping> element." -msgstr "schema(可选):覆盖在根 <hibernate-mapping> 元素中指定的 schema 名字。 " - -#. Tag: para -#, no-c-format -msgid "catalog (optional): overrides the catalog name specified by the root <hibernate-mapping> element." -msgstr "catalog(可选):覆盖在根 <hibernate-mapping> 元素中指定的 catalog 名字。 " - -#. Tag: para -#, no-c-format -msgid "proxy (optional): specifies an interface to use for lazy initializing proxies. You can specify the name of the class itself." -msgstr "proxy(可选):指定一个接口,在延迟装载时作为代理使用。你可以在这里使用该类自己的名字。 " - -#. Tag: para -#, no-c-format -msgid "dynamic-update (optional - defaults to false): specifies that UPDATE SQL should be generated at runtime and can contain only those columns whose values have changed." -msgstr "dynamic-update(可选,默认为 false):指定用于 UPDATE 的 SQL 将会在运行时动态生成,并且只更新那些改变过的字段。 " - -#. Tag: para -#, no-c-format -msgid "dynamic-insert (optional - defaults to false): specifies that INSERT SQL should be generated at runtime and contain only the columns whose values are not null." -msgstr "dynamic-insert(可选,默认为 false):指定用于 INSERT 的 SQL 将会在运行时动态生成,并且只包含那些非空值字段。 " - -#. Tag: para -#, no-c-format -msgid "select-before-update (optional - defaults to false): specifies that Hibernate should never perform an SQL UPDATE unless it is certain that an object is actually modified. Only when a transient object has been associated with a new session using update(), will Hibernate perform an extra SQL SELECT to determine if an UPDATE is actually required." -msgstr "select-before-update(可选,默认为 false):指定 Hibernate 除非确定对象真正被修改了(如果该值为 true — 译注),否则不会执行 SQL UPDATE 操作。在特定场合(实际上,它只在一个瞬时对象(transient object)关联到一个新的 session 中时执行的 update() 中生效),这说明 Hibernate 会在 UPDATE 之前执行一次额外的 SQL SELECT 操作来决定是否确实需要执行 UPDATE。" - -#. Tag: para -#, no-c-format -msgid "polymorphism (optional - defaults to implicit): determines whether implicit or explicit query polymorphism is used." -msgstr "polymorphism(多态)(可选,默认值为 implicit (隐式)):界定是隐式还是显式的使用多态查询(这只在 Hibernate 的具体表继承策略中用到 — 译注)。 " - -#. Tag: para -#, no-c-format -msgid "where (optional): specifies an arbitrary SQL WHERE condition to be used when retrieving objects of this class." -msgstr "where(可选)指定一个附加的 SQL WHERE 条件,在抓取这个类的对象时会一直增加这个条件。 " - -#. Tag: para -#, no-c-format -msgid "persister (optional): specifies a custom ClassPersister." -msgstr "persister(可选):指定一个定制的 ClassPersister。 " - -#. Tag: para -#, no-c-format -msgid "batch-size (optional - defaults to 1): specifies a \"batch size\" for fetching instances of this class by identifier." -msgstr "batch-size(可选,默认是 1)指定一个用于 根据标识符(identifier)抓取实例时使用的 \"batch size\"(批次抓取数量)。 " - -#. Tag: para -#, no-c-format -msgid "optimistic-lock (optional - defaults to version): determines the optimistic locking strategy." -msgstr "optimistic-lock(乐观锁定)(可选,默认是 version):决定乐观锁定的策略。 " - -#. Tag: para -#, no-c-format -msgid "lazy (optional): lazy fetching can be disabled by setting lazy=\"false\"." -msgstr "lazy(可选):通过设置 lazy=\"false\",所有的延迟加载(Lazy fetching)功能将被全部禁用(disabled)。" - -#. Tag: para -#, no-c-format -msgid "entity-name (optional - defaults to the class name): Hibernate3 allows a class to be mapped multiple times, potentially to different tables. It also allows entity mappings that are represented by Maps or XML at the Java level. In these cases, you should provide an explicit arbitrary name for the entity. See and for more information." -msgstr "entity-name(可选,默认为类名):Hibernate3 允许一个类进行多次映射(前提是映射到不同的表),并且允许使用 Maps 或 XML 代替 Java 层次的实体映射(也就是实现动态领域模型,不用写持久化类-译注)。更多信息请看 。 " - -#. Tag: para -#, no-c-format -msgid "check (optional): an SQL expression used to generate a multi-row check constraint for automatic schema generation." -msgstr "check(可选):这是一个 SQL 表达式, 用于为自动生成的 schema 添加多行(multi-row)约束检查。 " - -#. Tag: para -#, no-c-format -msgid "rowid (optional): Hibernate can use ROWIDs on databases. On Oracle, for example, Hibernate can use the rowid extra column for fast updates once this option has been set to rowid. A ROWID is an implementation detail and represents the physical location of a stored tuple." -msgstr "rowid(可选):Hibernate 可以使用数据库支持的所谓的 ROWIDs,例如:Oracle 数据库,如果你设置这个可选的 rowid,Hibernate 可以使用额外的字段 rowid 实现快速更新。ROWID 是这个功能实现的重点,它代表了一个存储元组(tuple)的物理位置。 " - -#. Tag: para -#, no-c-format -msgid "subselect (optional): maps an immutable and read-only entity to a database subselect. This is useful if you want to have a view instead of a base table. See below for more information." -msgstr "subselect(可选):它将一个不可变(immutable)并且只读的实体映射到一个数据库的子查询中。当你想用视图代替一张基本表的时候,这是有用的,但最好不要这样做。更多的介绍请看下面内容。 " - -#. Tag: para -#, no-c-format -msgid "abstract (optional): is used to mark abstract superclasses in <union-subclass> hierarchies." -msgstr "abstract(可选):用于在 <union-subclass> 的层次结构(hierarchies)中标识抽象超类。" - -#. Tag: para -#, no-c-format -msgid "It is acceptable for the named persistent class to be an interface. You can declare implementing classes of that interface using the <subclass> element. You can persist any static inner class. Specify the class name using the standard form i.e. e.g.Foo$Bar." -msgstr "若指明的持久化类实际上是一个接口,这也是完全可以接受的。之后你可以用元素 <subclass> 来指定该接口的实际实现类。你可以持久化任何 static(静态的)内部类。你应该使用标准的类名格式来指定类名,比如:Foo$Bar。" - -#. Tag: para -#, no-c-format -msgid "Immutable classes, mutable=\"false\", cannot be updated or deleted by the application. This allows Hibernate to make some minor performance optimizations." -msgstr "不可变类,mutable=\"false\" 不可以被应用程序更新或者删除。这允许 Hibernate 实现一些小小的性能优化。" - -#. Tag: para -#, no-c-format -msgid "The optional proxy attribute enables lazy initialization of persistent instances of the class. Hibernate will initially return CGLIB proxies that implement the named interface. The persistent object will load when a method of the proxy is invoked. See \"Initializing collections and proxies\" below." -msgstr "可选的 proxy 属性允许延迟加载类的持久化实例。Hibernate 开始会返回实现了这个命名接口的 CGLIB 代理。当代理的某个方法被实际调用的时候,真实的持久化对象才会被装载。参见下面的“用于延迟装载的代理”。 " - -#. Tag: para -#, no-c-format -msgid "Implicit polymorphism means that instances of the class will be returned by a query that names any superclass or implemented interface or class, and that instances of any subclass of the class will be returned by a query that names the class itself. Explicit polymorphism means that class instances will be returned only by queries that explicitly name that class. Queries that name the class will return only instances of subclasses mapped inside this <class> declaration as a <subclass> or <joined-subclass>. For most purposes, the default polymorphism=\"implicit\" is appropriate. Explicit polymorphism is useful when two different classes are mapped to the same table This allows a \"lightweight\" class that contains a subset of the table columns." -msgstr "Implicit(隐式)的多态是指,如果查询时给出的是任何超类、该类实现的接口或者该类的名字,都会返回这个类的实例;如果查询中给出的是子类的名字,则会返回子类的实例。Explicit(显式)的多态是指,只有在查询时给出明确的该类名字时才会返回这个类的实例; 同时只有在这个 <class> 的定义中作为 <subclass> 或者 <joined-subclass> 出现的子类,才会可能返回。在大多数情况下,默认的 polymorphism=\"implicit\" 都是合适的。显式的多态在有两个不同的类映射到同一个表的时候很有用。(允许一个“轻量级”的类,只包含部分表字段)。 " - -#. Tag: para -#, no-c-format -msgid "The persister attribute lets you customize the persistence strategy used for the class. You can, for example, specify your own subclass of org.hibernate.persister.EntityPersister, or you can even provide a completely new implementation of the interface org.hibernate.persister.ClassPersister that implements, for example, persistence via stored procedure calls, serialization to flat files or LDAP. See org.hibernate.test.CustomPersister for a simple example of \"persistence\" to a Hashtable." -msgstr "persister 属性可以让你定制这个类使用的持久化策略。你可以指定你自己实现 org.hibernate.persister.EntityPersister 的子类,你甚至可以完全从头开始编写一个 org.hibernate.persister.ClassPersister 接口的实现,比如是用储存过程调用、序列化到文件或者 LDAP 数据库来实现。参阅 org.hibernate.test.CustomPersister,这是持久化到 Hashtable 的一个简单例子。 " - -#. Tag: para -#, no-c-format -msgid "The dynamic-update and dynamic-insert settings are not inherited by subclasses, so they can also be specified on the <subclass> or <joined-subclass> elements. Although these settings can increase performance in some cases, they can actually decrease performance in others." -msgstr "请注意 dynamic-updatedynamic-insert 的设置并不会继承到子类,所以在 <subclass> 或者 <joined-subclass> 元素中可能需要再次设置。这些设置在某些情况下能够提高效率,而其他情况下则反而可能降低性能。" - -#. Tag: para -#, no-c-format -msgid "Use of select-before-update will usually decrease performance. It is useful to prevent a database update trigger being called unnecessarily if you reattach a graph of detached instances to a Session." -msgstr "使用 select-before-update 通常会降低性能。如果你重新连接一个脱管(detached)对象实例 到一个 Session 中时,它可以防止数据库不必要的触发 update。这就很有用了。" - -#. Tag: para -#, no-c-format -msgid "If you enable dynamic-update, you will have a choice of optimistic locking strategies:" -msgstr "如果你打开了dynamic-update,你可以选择几种乐观锁定的策略:" +#: basic_mapping.xml:185 +#, fuzzy, no-c-format +msgid "" +"optimisticLock (defaults to VERSION): " +"determines the optimistic locking strategy. If you enable " +"dynamicUpdate, you will have a choice of optimistic " +"locking strategies:" +msgstr "" +"如果你打开了dynamic-update,你可以选择几种乐观锁定的策略:" #. Tag: para +#: basic_mapping.xml:192 #, no-c-format msgid "version: check the version/timestamp columns" msgstr "version(版本检查):检查 version/timestamp 字段" #. Tag: para +#: basic_mapping.xml:197 #, no-c-format msgid "all: check all columns" msgstr "all(全部):检查全部字段" #. Tag: para +#: basic_mapping.xml:201 #, no-c-format -msgid "dirty: check the changed columns, allowing some concurrent updates" -msgstr "dirty(脏检查):只检察修改过的字段,允许某些并行更新" +msgid "" +"dirty: check the changed columns, allowing some " +"concurrent updates" +msgstr "" +"dirty(脏检查):只检察修改过的字段,允许某些并行更新" #. Tag: para +#: basic_mapping.xml:206 #, no-c-format msgid "none: do not use optimistic locking" msgstr "none(不检查):不使用乐观锁定" #. Tag: para +#: basic_mapping.xml:211 #, no-c-format -msgid "It is strongly recommended that you use version/timestamp columns for optimistic locking with Hibernate. This strategy optimizes performance and correctly handles modifications made to detached instances (i.e. when Session.merge() is used)." -msgstr "我们强烈建议你在 Hibernate 中使用 version/timestamp 字段来进行乐观锁定。这个选择可以优化性能,且能够处理对脱管实例的修改(例如:在使用 Session.merge() 的时候)。" +msgid "" +"It is strongly recommended that you use version/" +"timestamp columns for optimistic locking with Hibernate. This strategy " +"optimizes performance and correctly handles modifications made to detached " +"instances (i.e. when Session.merge() is used)." +msgstr "" +"我们强烈建议你在 Hibernate 中使用 version/timestamp 字段" +"来进行乐观锁定。这个选择可以优化性能,且能够处理对脱管实例的修改(例如:在使" +"用 Session.merge() 的时候)。" #. Tag: para +#: basic_mapping.xml:220 #, no-c-format -msgid "There is no difference between a view and a base table for a Hibernate mapping. This is transparent at the database level, although some DBMS do not support views properly, especially with updates. Sometimes you want to use a view, but you cannot create one in the database (i.e. with a legacy schema). In this case, you can map an immutable and read-only entity to a given SQL subselect expression:" -msgstr "对 Hibernate 映射来说视图和表是没有区别的,这是因为它们在数据层都是透明的( 注意:一些数据库不支持视图属性,特别是更新的时候)。有时你想使用视图,但却不能在数据库中创建它(例如:在遗留的 schema 中)。这样的话,你可以映射一个不可变的(immutable)并且是 只读的实体到一个给定的 SQL 子查询表达式: " +msgid "" +"Be sure to import @javax.persistence.Entity to mark a " +"class as an entity. It's a common mistake to import @org." +"hibernate.annotations.Entity by accident." +msgstr "" #. Tag: para +#: basic_mapping.xml:227 +#, fuzzy, no-c-format +msgid "" +"Some entities are not mutable. They cannot be updated or deleted by the " +"application. This allows Hibernate to make some minor performance " +"optimizations.. Use the @Immutable annotation." +msgstr "" +"不可变类,mutable=\"false\" 不可以被应用程序更新或者删除。" +"这允许 Hibernate 实现一些小小的性能优化。" + +#. Tag: para +#: basic_mapping.xml:232 +#, fuzzy, no-c-format +msgid "" +"You can also alter how Hibernate deals with lazy initialization for this " +"class. On @Proxy, use lazy=false " +"to disable lazy fetching (not recommended). You can also specify an " +"interface to use for lazy initializing proxies (defaults to the class " +"itself): use proxyClass on @Proxy. " +"Hibernate will initially return proxies (Javassist or CGLIB) that implement " +"the named interface. The persistent object will load when a method of the " +"proxy is invoked. See \"Initializing collections and proxies\" below." +msgstr "" +"可选的 proxy 属性允许延迟加载类的持久化实例。Hibernate 开" +"始会返回实现了这个命名接口的 CGLIB 代理。当代理的某个方法被实际调用的时候,真" +"实的持久化对象才会被装载。参见下面的“用于延迟装载的代理”。 " + +#. Tag: para +#: basic_mapping.xml:243 #, no-c-format -msgid "Declare the tables to synchronize this entity with, ensuring that auto-flush happens correctly and that queries against the derived entity do not return stale data. The <subselect> is available both as an attribute and a nested mapping element." -msgstr "定义这个实体用到的表为同步(synchronize),确保自动刷新(auto-flush)正确执行,并且依赖原实体的查询不会返回过期数据。在属性元素和嵌套映射元素中都可使用 <subselect>。" +msgid "" +"@BatchSize specifies a \"batch size\" for fetching " +"instances of this class by identifier. Not yet loaded instances are loaded " +"batch-size at a time (default 1)." +msgstr "" + +#. Tag: para +#: basic_mapping.xml:247 +#, fuzzy, no-c-format +msgid "" +"You can specific an arbitrary SQL WHERE condition to be used when retrieving " +"objects of this class. Use @Where for that." +msgstr "" +"where(可选)指定一个附加的 SQL WHERE " +"条件,在抓取这个类的对象时会一直增加这个条件。 " + +#. Tag: para +#: basic_mapping.xml:251 +#, fuzzy, no-c-format +msgid "" +"In the same vein, @Check lets you define an SQL " +"expression used to generate a multi-row check " +"constraint for automatic schema generation." +msgstr "" +"check(可选):这是一个 SQL 表达式, 用于为自动生成的 " +"schema 添加多行(multi-row)约束检查。 " + +#. Tag: para +#: basic_mapping.xml:255 +#, fuzzy, no-c-format +msgid "" +"There is no difference between a view and a base table for a Hibernate " +"mapping. This is transparent at the database level, although some DBMS do " +"not support views properly, especially with updates. Sometimes you want to " +"use a view, but you cannot create one in the database (i.e. with a legacy " +"schema). In this case, you can map an immutable and read-only entity to a " +"given SQL subselect expression using @org.hibernate.annotations." +"Subselect:" +msgstr "" +"对 Hibernate 映射来说视图和表是没有区别的,这是因为它们在数据层都是透明的" +"( 注意:一些数据库不支持视图属性,特别是更新的时候)。有时你想使用视图,但却" +"不能在数据库中创建它(例如:在遗留的 schema 中)。这样的话,你可以映射一个不" +"可变的(immutable)并且是 只读的实体到一个给定的 SQL 子查询表达式: " + +#. Tag: programlisting +#: basic_mapping.xml:263 +#, fuzzy, no-c-format +msgid "" +"@Entity\n" +"@Subselect(\"select item.name, max(bid.amount), count(*) \"\n" +" + \"from item \"\n" +" + \"join bid on bid.item_id = item.id \"\n" +" + \"group by item.name\")\n" +"@Synchronize( {\"item\", \"bid\"} ) //tables impacted\n" +"public class Summary {\n" +" @Id\n" +" public String getId() { return id; }\n" +" ...\n" +"}" +msgstr "" +"\n" +" \n" +" select item.name, max(bid.amount), count(*)\n" +" from item\n" +" join bid on bid.item_id = item.id\n" +" group by item.name\n" +" \n" +" \n" +" \n" +" \n" +" ...\n" +"]]>" + +#. Tag: para +#: basic_mapping.xml:265 +#, no-c-format +msgid "" +"Declare the tables to synchronize this entity with, ensuring that auto-flush " +"happens correctly and that queries against the derived entity do not return " +"stale data. The <subselect> is available both as an " +"attribute and a nested mapping element." +msgstr "" +"定义这个实体用到的表为同步(synchronize),确保自动刷新(auto-flush)正确执" +"行,并且依赖原实体的查询不会返回过期数据。在属性元素和嵌套映射元素中都可使用 " +"<subselect>。" + +#. Tag: para +#: basic_mapping.xml:270 +#, fuzzy, no-c-format +msgid "" +"We will now explore the same options using the hbm.xml structure. You can " +"declare a persistent class using the class element. For " +"example:" +msgstr "你可以使用 class 元素来定义一个持久化类。例如:" + +#. Tag: programlisting +#: basic_mapping.xml:319 +#, fuzzy, no-c-format +msgid "" +"<class\n" +" name=\"ClassName\"\n" +" table=\"tableName\"\n" +" discriminator-value=\"discriminator_value\"\n" +" mutable=\"true|false\"\n" +" schema=\"owner\"\n" +" catalog=\"catalog\"\n" +" proxy=\"ProxyInterface\"\n" +" dynamic-update=\"true|false\"\n" +" dynamic-insert=\"true|false\"\n" +" select-before-update=\"true|false\"\n" +" polymorphism=\"implicit|explicit\"\n" +" where=\"arbitrary sql where condition\"\n" +" persister=\"PersisterClass\"\n" +" batch-size=\"N\"\n" +" optimistic-lock=\"none|version|dirty|all\"\n" +" lazy=\"true|false\"\n" +" entity-name=\"EntityName\"\n" +" check=\"arbitrary sql check condition\"\n" +" rowid=\"rowid\"\n" +" subselect=\"SQL expression\"\n" +" abstract=\"true|false\"\n" +" node=\"element-name\"\n" +"/>" +msgstr "" +"]]>" + +#. Tag: para +#: basic_mapping.xml:323 +#, no-c-format +msgid "" +"name (optional): the fully qualified Java class name of " +"the persistent class or interface. If this attribute is missing, it is " +"assumed that the mapping is for a non-POJO entity." +msgstr "" +"name(可选):持久化类(或者接口)的 Java 全限定名。 如果" +"这个属性不存在,Hibernate 将假定这是一个非 POJO 的实体映射。 " + +#. Tag: para +#: basic_mapping.xml:330 +#, no-c-format +msgid "" +"table (optional - defaults to the unqualified class " +"name): the name of its database table." +msgstr "" +"table(可选 — 默认是类的非全限定名):对应的数据库表名。 " + +#. Tag: para +#: basic_mapping.xml:335 +#, no-c-format +msgid "" +"discriminator-value (optional - defaults to the class " +"name): a value that distinguishes individual subclasses that is used for " +"polymorphic behavior. Acceptable values include null and " +"not null." +msgstr "" +"discriminator-value(可选 — 默认和类名一样):一个用于区分" +"不同的子类的值,在多态行为时使用。它可以接受的值包括 null " +"和 not null。 " + +#. Tag: para +#: basic_mapping.xml:343 +#, no-c-format +msgid "" +"mutable (optional - defaults to true): " +"specifies that instances of the class are (not) mutable." +msgstr "" +"mutable(可选,默认值为 true):表明该" +"类的实例是可变的或者不可变的。 " + +#. Tag: para +#: basic_mapping.xml:349 basic_mapping.xml:2912 +#, no-c-format +msgid "" +"schema (optional): overrides the schema name specified by " +"the root <hibernate-mapping> element." +msgstr "" +"schema(可选):覆盖在根 <hibernate-" +"mapping> 元素中指定的 schema 名字。 " + +#. Tag: para +#: basic_mapping.xml:355 basic_mapping.xml:2918 +#, no-c-format +msgid "" +"catalog (optional): overrides the catalog name specified " +"by the root <hibernate-mapping> element." +msgstr "" +"catalog(可选):覆盖在根 <hibernate-" +"mapping> 元素中指定的 catalog 名字。 " + +#. Tag: para +#: basic_mapping.xml:361 +#, no-c-format +msgid "" +"proxy (optional): specifies an interface to use for lazy " +"initializing proxies. You can specify the name of the class itself." +msgstr "" +"proxy(可选):指定一个接口,在延迟装载时作为代理使用。你" +"可以在这里使用该类自己的名字。 " + +#. Tag: para +#: basic_mapping.xml:367 +#, no-c-format +msgid "" +"dynamic-update (optional - defaults to false): specifies that UPDATE SQL should be generated " +"at runtime and can contain only those columns whose values have changed." +msgstr "" +"dynamic-update(可选,默认为 false):" +"指定用于 UPDATE 的 SQL 将会在运行时动态生成,并且只更新那" +"些改变过的字段。 " + +#. Tag: para +#: basic_mapping.xml:374 +#, no-c-format +msgid "" +"dynamic-insert (optional - defaults to false): specifies that INSERT SQL should be generated " +"at runtime and contain only the columns whose values are not null." +msgstr "" +"dynamic-insert(可选,默认为 false):" +"指定用于 INSERT 的 SQL 将会在运行时动态生成,并且只包含那" +"些非空值字段。 " + +#. Tag: para +#: basic_mapping.xml:381 +#, no-c-format +msgid "" +"select-before-update (optional - defaults to " +"false): specifies that Hibernate should never perform an SQL UPDATE unless it is certain that " +"an object is actually modified. Only when a transient object has been " +"associated with a new session using update(), will " +"Hibernate perform an extra SQL SELECT to determine if an " +"UPDATE is actually required." +msgstr "" +"select-before-update(可选,默认为 false):指定 Hibernate 除非确定对象真正被修改了(如果该值为 true — 译" +"注),否则不会执行 SQL UPDATE 操作。" +"在特定场合(实际上,它只在一个瞬时对象(transient object)关联到一个新的 " +"session 中时执行的 update() 中生效),这说明 Hibernate 会在 UPDATE 之前执行一次额外的 SQL SELECT 操作来决定是否确实" +"需要执行 UPDATE。" + +#. Tag: para +#: basic_mapping.xml:393 +#, fuzzy, no-c-format +msgid "" +"polymorphisms (optional - defaults to implicit): determines whether implicit or explicit query polymorphisms is " +"used." +msgstr "" +"polymorphism(多态)(可选,默认值为 implicit " +"(隐式)):界定是隐式还是显式的使用多态查询(这只在 Hibernate 的具" +"体表继承策略中用到 — 译注)。 " + +#. Tag: para +#: basic_mapping.xml:399 +#, no-c-format +msgid "" +"where (optional): specifies an arbitrary SQL " +"WHERE condition to be used when retrieving objects of " +"this class." +msgstr "" +"where(可选)指定一个附加的 SQL WHERE " +"条件,在抓取这个类的对象时会一直增加这个条件。 " + +#. Tag: para +#: basic_mapping.xml:405 +#, no-c-format +msgid "" +"persister (optional): specifies a custom " +"ClassPersister." +msgstr "" +"persister(可选):指定一个定制的 " +"ClassPersister。 " + +#. Tag: para +#: basic_mapping.xml:410 +#, no-c-format +msgid "" +"batch-size (optional - defaults to 1): " +"specifies a \"batch size\" for fetching instances of this class by " +"identifier." +msgstr "" +"batch-size(可选,默认是 1)指定一个用" +"于 根据标识符(identifier)抓取实例时使用的 \"batch size\"(批次抓取数量)。 " + +#. Tag: para +#: basic_mapping.xml:416 +#, no-c-format +msgid "" +"optimistic-lock (optional - defaults to version): determines the optimistic locking strategy." +msgstr "" +"optimistic-lock(乐观锁定)(可选,默认是 " +"version):决定乐观锁定的策略。 " + +#. Tag: para +#: basic_mapping.xml:422 +#, no-c-format +msgid "" +"lazy (optional): lazy fetching can be disabled by setting " +"lazy=\"false\"." +msgstr "" +"lazy(可选):通过设置 lazy=\"false\"," +"所有的延迟加载(Lazy fetching)功能将被全部禁用(disabled)。" + +#. Tag: para +#: basic_mapping.xml:427 +#, fuzzy, no-c-format +msgid "" +"entity-name (optional - defaults to the class name): " +"Hibernate3 allows a class to be mapped multiple times, potentially to " +"different tables. It also allows entity mappings that are represented by " +"Maps or XML at the Java level. In these cases, you should provide an " +"explicit arbitrary name for the entity. See and for more information." +msgstr "" +"entity-name(可选,默认为类名):Hibernate3 允许一个类进行" +"多次映射(前提是映射到不同的表),并且允许使用 Maps 或 XML 代替 Java 层次的实" +"体映射(也就是实现动态领域模型,不用写持久化类-译注)。更多信息请看 。 " + +#. Tag: para +#: basic_mapping.xml:437 +#, no-c-format +msgid "" +"check (optional): an SQL expression used to generate a " +"multi-row check constraint for automatic schema " +"generation." +msgstr "" +"check(可选):这是一个 SQL 表达式, 用于为自动生成的 " +"schema 添加多行(multi-row)约束检查。 " + +#. Tag: para +#: basic_mapping.xml:443 +#, no-c-format +msgid "" +"rowid (optional): Hibernate can use ROWIDs on databases. " +"On Oracle, for example, Hibernate can use the rowid extra " +"column for fast updates once this option has been set to rowid. A ROWID is an implementation detail and represents the physical " +"location of a stored tuple." +msgstr "" +"rowid(可选):Hibernate 可以使用数据库支持的所谓的 " +"ROWIDs,例如:Oracle 数据库,如果你设置这个可选的 rowid," +"Hibernate 可以使用额外的字段 rowid 实现快速更新。ROWID 是" +"这个功能实现的重点,它代表了一个存储元组(tuple)的物理位置。 " + +#. Tag: para +#: basic_mapping.xml:452 +#, no-c-format +msgid "" +"subselect (optional): maps an immutable and read-only " +"entity to a database subselect. This is useful if you want to have a view " +"instead of a base table. See below for more information." +msgstr "" +"subselect(可选):它将一个不可变(immutable)并且只读的实" +"体映射到一个数据库的子查询中。当你想用视图代替一张基本表的时候,这是有用的," +"但最好不要这样做。更多的介绍请看下面内容。 " + +#. Tag: para +#: basic_mapping.xml:459 +#, no-c-format +msgid "" +"abstract (optional): is used to mark abstract " +"superclasses in <union-subclass> hierarchies." +msgstr "" +"abstract(可选):用于在 <union-subclass> 的层次结构(hierarchies)中标识抽象超类。" + +#. Tag: para +#: basic_mapping.xml:466 +#, no-c-format +msgid "" +"It is acceptable for the named persistent class to be an interface. You can " +"declare implementing classes of that interface using the <" +"subclass> element. You can persist any static inner class. Specify the class name using the standard form i.e. " +"e.g.Foo$Bar." +msgstr "" +"若指明的持久化类实际上是一个接口,这也是完全可以接受的。之后你可以用元素 " +"<subclass> 来指定该接口的实际实现类。你可以持久化任" +"何 static(静态的)内部类。你应该使用标准的类名格式来指" +"定类名,比如:Foo$Bar。" + +#. Tag: para +#: basic_mapping.xml:472 +#, no-c-format +msgid "Here is how to do a virtual view (subselect) in XML:" +msgstr "" + +#. Tag: programlisting +#: basic_mapping.xml:474 +#, fuzzy, no-c-format +msgid "" +"<class name=\"Summary\">\n" +" <subselect>\n" +" select item.name, max(bid.amount), count(*)\n" +" from item\n" +" join bid on bid.item_id = item.id\n" +" group by item.name\n" +" </subselect>\n" +" <synchronize table=\"item\"/>\n" +" <synchronize table=\"bid\"/>\n" +" <id name=\"name\"/>\n" +" ...\n" +"</class>" +msgstr "" +"\n" +" \n" +" select item.name, max(bid.amount), count(*)\n" +" from item\n" +" join bid on bid.item_id = item.id\n" +" group by item.name\n" +" \n" +" \n" +" \n" +" \n" +" ...\n" +"]]>" + +#. Tag: para +#: basic_mapping.xml:476 +#, no-c-format +msgid "" +"The <subselect> is available both as an attribute " +"and a nested mapping element." +msgstr "" #. Tag: title -#, no-c-format -msgid "id" -msgstr "id" +#: basic_mapping.xml:481 +#, fuzzy, no-c-format +msgid "Identifiers" +msgstr "程序分配的标识符(Assigned Identifiers)" #. Tag: para -#, no-c-format -msgid "Mapped classes must declare the primary key column of the database table. Most classes will also have a JavaBeans-style property holding the unique identifier of an instance. The <id> element defines the mapping from that property to the primary key column." -msgstr "被映射的类必须定义对应数据库表主键字段。大多数类有一个 JavaBeans 风格的属性, 为每一个实例包含唯一的标识。<id> 元素定义了该属性到数据库表主键字段的映射。" +#: basic_mapping.xml:483 +#, fuzzy, no-c-format +msgid "" +"Mapped classes must declare the primary key column of " +"the database table. Most classes will also have a JavaBeans-style property " +"holding the unique identifier of an instance." +msgstr "" +"被映射的类必须定义对应数据库表主键字段。大多数类有一个 " +"JavaBeans 风格的属性, 为每一个实例包含唯一的标识。<id> 元素定义了该属性到数据库表主键字段的映射。" #. Tag: para +#: basic_mapping.xml:488 #, no-c-format -msgid "name (optional): the name of the identifier property." +msgid "Mark the identifier property with @Id." +msgstr "" + +#. Tag: programlisting +#: basic_mapping.xml:491 +#, no-c-format +msgid "" +"@Entity\n" +"public class Person {\n" +" @Id Integer getId() { ... }\n" +" ...\n" +"}" +msgstr "" + +#. Tag: para +#: basic_mapping.xml:493 +#, fuzzy, no-c-format +msgid "" +"In hbm.xml, use the <id> element which defines the " +"mapping from that property to the primary key column." +msgstr "" +"注意使用 <column> 标签来把一个属性映射到多个字段的做" +"法。" + +#. Tag: programlisting +#: basic_mapping.xml:509 +#, fuzzy, no-c-format +msgid "" +"<id\n" +" name=\"propertyName\"\n" +" type=\"typename\"\n" +" column=\"column_name\"\n" +" unsaved-value=\"null|any|none|undefined|id_value\"\n" +" access=\"field|property|ClassName\">\n" +" node=\"element-name|@attribute-name|element/@attribute|.\"\n" +"\n" +" <generator class=\"generatorClass\"/>\n" +"</id>" +msgstr "" +"\n" +" node=\"element-name|@attribute-name|element/@attribute|.\"\n" +"\n" +" \n" +"]]>" + +#. Tag: para +#: basic_mapping.xml:513 +#, no-c-format +msgid "" +"name (optional): the name of the identifier property." msgstr "name(可选):标识属性的名字。 " #. Tag: para +#: basic_mapping.xml:518 basic_mapping.xml:2141 #, no-c-format -msgid "type (optional): a name that indicates the Hibernate type." +msgid "" +"type (optional): a name that indicates the Hibernate type." msgstr "type(可选):一个 Hibernate 类型的名字。" #. Tag: para +#: basic_mapping.xml:523 #, no-c-format -msgid "column (optional - defaults to the property name): the name of the primary key column." +msgid "" +"column (optional - defaults to the property name): the " +"name of the primary key column." msgstr "column(可选 — 默认为属性名):主键字段的名字。 " #. Tag: para +#: basic_mapping.xml:528 #, no-c-format -msgid "unsaved-value (optional - defaults to a \"sensible\" value): an identifier property value that indicates an instance is newly instantiated (unsaved), distinguishing it from detached instances that were saved or loaded in a previous session." -msgstr "unsaved-value(可选 — 默认为一个切合实际(sensible)的值):一个特定的标识属性值,用来标志该实例是刚刚创建的,尚未保存。这可以把这种实例和从以前的 session 中装载过(可能又做过修改--译者注)但未再次持久化的实例区分开来。 " +msgid "" +"unsaved-value (optional - defaults to a \"sensible\" " +"value): an identifier property value that indicates an instance is newly " +"instantiated (unsaved), distinguishing it from detached instances that were " +"saved or loaded in a previous session." +msgstr "" +"unsaved-value(可选 — 默认为一个切合实际(sensible)的" +"值):一个特定的标识属性值,用来标志该实例是刚刚创建的,尚未保存。这可以把这" +"种实例和从以前的 session 中装载过(可能又做过修改--译者注)但未再次持久化的实" +"例区分开来。 " #. Tag: para +#: basic_mapping.xml:536 #, no-c-format -msgid "access (optional - defaults to property): the strategy Hibernate should use for accessing the property value." -msgstr "access(可选 — 默认为 property):Hibernate 用来访问属性值的策略。 " +msgid "" +"access (optional - defaults to property): the strategy Hibernate should use for accessing the property " +"value." +msgstr "" +"access(可选 — 默认为 property):" +"Hibernate 用来访问属性值的策略。 " #. Tag: para +#: basic_mapping.xml:543 #, no-c-format -msgid "If the name attribute is missing, it is assumed that the class has no identifier property." +msgid "" +"If the name attribute is missing, it is assumed that the " +"class has no identifier property." msgstr "如果 name 属性不存在,会认为这个类没有标识属性。" #. Tag: para -#, no-c-format -msgid "The unsaved-value attribute is almost never needed in Hibernate3." +#: basic_mapping.xml:546 +#, fuzzy, no-c-format +msgid "" +"The unsaved-value attribute is almost never needed in " +"Hibernate3 and indeed has no corresponding element in annotations." msgstr "unsaved-value 属性在 Hibernate3 中几乎不再需要。" #. Tag: para -#, no-c-format -msgid "There is an alternative <composite-id> declaration that allows access to legacy data with composite keys. Its use is strongly discouraged for anything else." -msgstr "还有一个另外的 <composite-id> 定义可以访问旧式的多主键数据。我们非常不鼓励使用这种方式。" +#: basic_mapping.xml:550 +#, fuzzy, no-c-format +msgid "" +"You can also declare the identifier as a composite identifier. This allows " +"access to legacy data with composite keys. Its use is strongly discouraged " +"for anything else." +msgstr "" +"还有一个另外的 <composite-id> 定义可以访问旧式的多主" +"键数据。我们非常不鼓励使用这种方式。" #. Tag: title -#, no-c-format -msgid "Generator" -msgstr "Generator" +#: basic_mapping.xml:555 +#, fuzzy, no-c-format +msgid "Composite identifier" +msgstr "程序分配的标识符(Assigned Identifiers)" #. Tag: para +#: basic_mapping.xml:557 #, no-c-format -msgid "The optional <generator> child element names a Java class used to generate unique identifiers for instances of the persistent class. If any parameters are required to configure or initialize the generator instance, they are passed using the <param> element." -msgstr "可选的 <generator> 子元素是一个 Java 类的名字,用来为该持久化类的实例生成唯一的标识。如果这个生成器实例需要某些配置值或者初始化参数,用 <param> 元素来传递。" +msgid "You can define a composite primary key through several syntaxes:" +msgstr "" #. Tag: para +#: basic_mapping.xml:562 #, no-c-format -msgid "All generators implement the interface org.hibernate.id.IdentifierGenerator. This is a very simple interface. Some applications can choose to provide their own specialized implementations, however, Hibernate provides a range of built-in implementations. The shortcut names for the built-in generators are as follows:" -msgstr "所有的生成器都实现 org.hibernate.id.IdentifierGenerator 接口。这是一个非常简单的接口;某些应用程序可以选择提供他们自己特定的实现。当然,Hibernate 提供了很多内置的实现。下面是一些内置生成器的快捷名字: " - -#. Tag: term -#, no-c-format -msgid "increment" -msgstr "increment" +msgid "" +"use a component type to represent the identifier and map it as a property in " +"the entity: you then annotated the property as @EmbeddedId. The component type has to be Serializable." +msgstr "" #. Tag: para +#: basic_mapping.xml:569 #, no-c-format -msgid "generates identifiers of type long, short or int that are unique only when no other process is inserting data into the same table. Do not use in a cluster." -msgstr "用于为 long, short 或者 int 类型生成 唯一标识。只有在没有其他进程往同一张表中插入数据时才能使用。在集群下不要使用。" - -#. Tag: term -#, no-c-format -msgid "identity" -msgstr "identity" +msgid "" +"map multiple properties as @Id properties: the " +"identifier type is then the entity class itself and needs to be " +"Serializable. This approach is unfortunately not " +"standard and only supported by Hibernate." +msgstr "" #. Tag: para +#: basic_mapping.xml:577 #, no-c-format -msgid "supports identity columns in DB2, MySQL, MS SQL Server, Sybase and HypersonicSQL. The returned identifier is of type long, short or int." -msgstr "对 DB2,MySQL,MS SQL Server,Sybase 和 HypersonicSQL 的内置标识字段提供支持。返回的标识符是 longshort 或者 int 类型的。" - -#. Tag: term -#, no-c-format -msgid "sequence" -msgstr "sequence" +msgid "" +"map multiple properties as @Id properties and declare " +"an external class to be the identifier type. This class, which needs to be " +"Serializable, is declared on the entity via the " +"@IdClass annotation. The identifier type must contain " +"the same properties as the identifier properties of the entity: each " +"property name must be the same, its type must be the same as well if the " +"entity property is of a basic type, its type must be the type of the primary " +"key of the associated entity if the entity property is an association " +"(either a @OneToOne or a @ManyToOne)." +msgstr "" #. Tag: para +#: basic_mapping.xml:592 #, no-c-format -msgid "uses a sequence in DB2, PostgreSQL, Oracle, SAP DB, McKoi or a generator in Interbase. The returned identifier is of type long, short or int" -msgstr "在 DB2,PostgreSQL,Oracle,SAP DB,McKoi 中使用序列(sequence), 而在 Interbase 中使用生成器(generator)。返回的标识符是 longshort 或者 int 类型的。" - -#. Tag: term -#, no-c-format -msgid "hilo" -msgstr "hilo" +msgid "" +"As you can see the last case is far from obvious. It has been inherited from " +"the dark ages of EJB 2 for backward compatibilities and we recommend you not " +"to use it (for simplicity sake)." +msgstr "" #. Tag: para +#: basic_mapping.xml:596 #, no-c-format -msgid "uses a hi/lo algorithm to efficiently generate identifiers of type long, short or int, given a table and column (by default hibernate_unique_key and next_hi respectively) as a source of hi values. The hi/lo algorithm generates identifiers that are unique only for a particular database." -msgstr "使用一个高/低位算法高效的生成 longshort 或者 int 类型的标识符。给定一个表和字段(默认分别是 hibernate_unique_keynext_hi)作为高位值的来源。高/低位算法生成的标识符只在一个特定的数据库中是唯一的。" +msgid "Let's explore all three cases using examples." +msgstr "" -#. Tag: term +#. Tag: title +#: basic_mapping.xml:599 #, no-c-format -msgid "seqhilo" -msgstr "seqhilo" +msgid "id as a property using a component type" +msgstr "" #. Tag: para +#: basic_mapping.xml:601 #, no-c-format -msgid "uses a hi/lo algorithm to efficiently generate identifiers of type long, short or int, given a named database sequence." -msgstr "使用一个高/低位算法来高效的生成 longshort 或者 int 类型的标识符,给定一个数据库序列(sequence)的名字。" +msgid "Here is a simple example of @EmbeddedId." +msgstr "" -#. Tag: term +#. Tag: programlisting +#: basic_mapping.xml:604 #, no-c-format -msgid "uuid" -msgstr "uuid" +msgid "" +"@Entity\n" +"class User {\n" +" @EmbeddedId\n" +" @AttributeOverride(name=\"firstName\", column=@Column(name=\"fld_firstname" +"\")\n" +" UserId id;\n" +"\n" +" Integer age;\n" +"}\n" +"\n" +"@Embeddable\n" +"class UserId implements Serializable {\n" +" String firstName;\n" +" String lastName;\n" +"}" +msgstr "" #. Tag: para +#: basic_mapping.xml:606 #, no-c-format -msgid "uses a 128-bit UUID algorithm to generate identifiers of type string that are unique within a network (the IP address is used). The UUID is encoded as a string of 32 hexadecimal digits in length." -msgstr "用一个 128-bit 的 UUID 算法生成字符串类型的标识符,这在一个网络中是唯一的(使用了 IP 地址)。UUID 被编码为一个 32 位 16 进制数字的字符串。 " - -#. Tag: term -#, no-c-format -msgid "guid" -msgstr "guid" +msgid "" +"You can notice that the UserId class is serializable. " +"To override the column mapping, use @AttributeOverride." +msgstr "" #. Tag: para +#: basic_mapping.xml:610 +#, no-c-format +msgid "" +"An embedded id can itself contains the primary key of an associated entity." +msgstr "" + +#. Tag: programlisting +#: basic_mapping.xml:613 +#, no-c-format +msgid "" +"@Entity\n" +"class Customer {\n" +" @EmbeddedId CustomerId id;\n" +" boolean preferredCustomer;\n" +"\n" +" @MapsId(\"userId\")\n" +" @JoinColumns({\n" +" @JoinColumn(name=\"userfirstname_fk\", referencedColumnName=\"firstName" +"\"),\n" +" @JoinColumn(name=\"userlastname_fk\", referencedColumnName=\"lastName" +"\")\n" +" })\n" +" @OneToOne User user;\n" +"}\n" +"\n" +"@Embeddable\n" +"class CustomerId implements Serializable {\n" +" UserId userId;\n" +" String customerNumber;\n" +"\n" +" //implements equals and hashCode\n" +"}\n" +"\n" +"@Entity \n" +"class User {\n" +" @EmbeddedId UserId id;\n" +" Integer age;\n" +"}\n" +"\n" +"@Embeddable\n" +"class UserId implements Serializable {\n" +" String firstName;\n" +" String lastName;\n" +"\n" +" //implements equals and hashCode\n" +"}" +msgstr "" + +#. Tag: para +#: basic_mapping.xml:615 +#, no-c-format +msgid "" +"In the embedded id object, the association is represented as the identifier " +"of the associated entity. But you can link its value to a regular " +"association in the entity via the @MapsId annotation. " +"The @MapsId value correspond to the property name of " +"the embedded id object containing the associated entity's identifier. In the " +"database, it means that the Customer.user and the " +"CustomerId.userId properties share the same underlying " +"column (user_fk in this case)." +msgstr "" + +#. Tag: para +#: basic_mapping.xml:627 +#, no-c-format +msgid "" +"The component type used as identifier must implement equals() and hashCode()." +msgstr "" + +#. Tag: para +#: basic_mapping.xml:632 +#, no-c-format +msgid "" +"In practice, your code only sets the Customer.user " +"property and the user id value is copied by Hibernate into the " +"CustomerId.userId property." +msgstr "" + +#. Tag: para +#: basic_mapping.xml:638 +#, no-c-format +msgid "" +"The id value can be copied as late as flush time, don't rely on it until " +"after flush time." +msgstr "" + +#. Tag: para +#: basic_mapping.xml:642 +#, no-c-format +msgid "" +"While not supported in JPA, Hibernate lets you place your association " +"directly in the embedded id component (instead of having to use the " +"@MapsId annotation)." +msgstr "" + +#. Tag: programlisting +#: basic_mapping.xml:646 +#, no-c-format +msgid "" +"@Entity\n" +"class Customer {\n" +" @EmbeddedId CustomerId id;\n" +" boolean preferredCustomer;\n" +"}\n" +"\n" +"@Embeddable\n" +"class CustomerId implements Serializable {\n" +" @OneToOne\n" +" @JoinColumns({\n" +" @JoinColumn(name=\"userfirstname_fk\", referencedColumnName=\"firstName" +"\"),\n" +" @JoinColumn(name=\"userlastname_fk\", referencedColumnName=\"lastName" +"\")\n" +" }) \n" +" User user;\n" +" String customerNumber;\n" +"\n" +" //implements equals and hashCode\n" +"}\n" +"\n" +"@Entity \n" +"class User {\n" +" @EmbeddedId UserId id;\n" +" Integer age;\n" +"}\n" +"\n" +"@Embeddable\n" +"class UserId implements Serializable {\n" +" String firstName;\n" +" String lastName;\n" +"\n" +"\n" +" //implements equals and hashCode\n" +"}" +msgstr "" + +#. Tag: para +#: basic_mapping.xml:648 +#, no-c-format +msgid "Let's now rewrite these examples using the hbm.xml syntax." +msgstr "" + +#. Tag: programlisting +#: basic_mapping.xml:651 +#, fuzzy, no-c-format +msgid "" +"<composite-id\n" +" name=\"propertyName\"\n" +" class=\"ClassName\"\n" +" mapped=\"true|false\"\n" +" access=\"field|property|ClassName\"\n" +" node=\"element-name|.\">\n" +"\n" +" <key-property name=\"propertyName\" type=\"typename\" column=" +"\"column_name\"/>\n" +" <key-many-to-one name=\"propertyName\" class=\"ClassName\" column=" +"\"column_name\"/>\n" +" ......\n" +"</composite-id>" +msgstr "" +"\n" +" node=\"element-name|.\"\n" +"\n" +" \n" +" \n" +" ......\n" +"]]>" + +#. Tag: para +#: basic_mapping.xml:653 +#, no-c-format +msgid "First a simple example:" +msgstr "" + +#. Tag: programlisting +#: basic_mapping.xml:655 +#, no-c-format +msgid "" +"<class name=\"User\">\n" +" <composite-id name=\"id\" class=\"UserId\">\n" +" <key-property name=\"firstName\" column=\"fld_firstname\"/>\n" +" <key-property name=\"lastName\"/>\n" +" </composite-id>\n" +"</class>" +msgstr "" + +#. Tag: para +#: basic_mapping.xml:657 +#, no-c-format +msgid "Then an example showing how an association can be mapped." +msgstr "" + +#. Tag: programlisting +#: basic_mapping.xml:660 +#, no-c-format +msgid "" +"<class name=\"Customer\">\n" +" <composite-id name=\"id\" class=\"CustomerId\">\n" +" <key-property name=\"firstName\" column=\"userfirstname_fk\"/>\n" +" <key-property name=\"lastName\" column=\"userfirstname_fk\"/>\n" +" <key-property name=\"customerNumber\"/>\n" +" </composite-id>\n" +"\n" +" <property name=\"preferredCustomer\"/>\n" +"\n" +" <many-to-one name=\"user\">\n" +" <column name=\"userfirstname_fk\" updatable=\"false\" insertable=" +"\"false\"/>\n" +" <column name=\"userlastname_fk\" updatable=\"false\" insertable=" +"\"false\"/>\n" +" </many-to-one>\n" +"</class>\n" +"\n" +"<class name=\"User\">\n" +" <composite-id name=\"id\" class=\"UserId\">\n" +" <key-property name=\"firstName\"/>\n" +" <key-property name=\"lastName\"/>\n" +" </composite-id>\n" +"\n" +" <property name=\"age\"/>\n" +"</class>" +msgstr "" + +#. Tag: para +#: basic_mapping.xml:662 +#, no-c-format +msgid "Notice a few things in the previous example:" +msgstr "" + +#. Tag: para +#: basic_mapping.xml:666 +#, no-c-format +msgid "" +"the order of the properties (and column) matters. It must be the same " +"between the association and the primary key of the associated entity" +msgstr "" + +#. Tag: para +#: basic_mapping.xml:672 +#, no-c-format +msgid "" +"the many to one uses the same columns as the primary key and thus must be " +"marked as read only (insertable and updatable to false)." +msgstr "" + +#. Tag: para +#: basic_mapping.xml:679 +#, no-c-format +msgid "" +"unlike with @MapsId, the id value of the associated " +"entity is not transparently copied, check the foreign id " +"generator for more information." +msgstr "" + +#. Tag: para +#: basic_mapping.xml:686 +#, no-c-format +msgid "" +"The last example shows how to map association directly in the embedded id " +"component." +msgstr "" + +#. Tag: programlisting +#: basic_mapping.xml:689 +#, no-c-format +msgid "" +"<class name=\"Customer\">\n" +" <composite-id name=\"id\" class=\"CustomerId\">\n" +" <key-many-to-one name=\"user\">\n" +" <column name=\"userfirstname_fk\"/>\n" +" <column name=\"userlastname_fk\"/>\n" +" </key-many-to-one>\n" +" <key-property name=\"customerNumber\"/>\n" +" </composite-id>\n" +"\n" +" <property name=\"preferredCustomer\"/>\n" +"</class>\n" +"\n" +"<class name=\"User\">\n" +" <composite-id name=\"id\" class=\"UserId\">\n" +" <key-property name=\"firstName\"/>\n" +" <key-property name=\"lastName\"/>\n" +" </composite-id>\n" +"\n" +" <property name=\"age\"/>\n" +"</class>" +msgstr "" + +#. Tag: para +#: basic_mapping.xml:691 +#, no-c-format +msgid "" +"This is the recommended approach to map composite identifier. The following " +"options should not be considered unless some constraint are present." +msgstr "" + +#. Tag: title +#: basic_mapping.xml:697 +#, no-c-format +msgid "Multiple id properties without identifier type" +msgstr "" + +#. Tag: para +#: basic_mapping.xml:699 +#, no-c-format +msgid "" +"Another, arguably more natural, approach is to place @Id on multiple properties of your entity. This approach is only " +"supported by Hibernate (not JPA compliant) but does not require an extra " +"embeddable component." +msgstr "" + +#. Tag: programlisting +#: basic_mapping.xml:704 +#, no-c-format +msgid "" +"@Entity\n" +"class Customer implements Serializable {\n" +" @Id @OneToOne\n" +" @JoinColumns({\n" +" @JoinColumn(name=\"userfirstname_fk\", referencedColumnName=\"firstName" +"\"),\n" +" @JoinColumn(name=\"userlastname_fk\", referencedColumnName=\"lastName" +"\")\n" +" })\n" +" User user;\n" +" \n" +" @Id String customerNumber;\n" +"\n" +" boolean preferredCustomer;\n" +"\n" +" //implements equals and hashCode\n" +"}\n" +"\n" +"@Entity \n" +"class User {\n" +" @EmbeddedId UserId id;\n" +" Integer age;\n" +"}\n" +"\n" +"@Embeddable\n" +"class UserId implements Serializable {\n" +" String firstName;\n" +" String lastName;\n" +"\n" +" //implements equals and hashCode\n" +"}" +msgstr "" + +#. Tag: para +#: basic_mapping.xml:706 +#, no-c-format +msgid "" +"In this case Customer is its own identifier " +"representation: it must implement Serializable and " +"must implement equals() and hashCode()." +msgstr "" + +#. Tag: para +#: basic_mapping.xml:712 +#, no-c-format +msgid "In hbm.xml, the same mapping is:" +msgstr "" + +#. Tag: programlisting +#: basic_mapping.xml:714 +#, no-c-format +msgid "" +"<class name=\"Customer\">\n" +" <composite-id>\n" +" <key-many-to-one name=\"user\">\n" +" <column name=\"userfirstname_fk\"/>\n" +" <column name=\"userlastname_fk\"/>\n" +" </key-many-to-one>\n" +" <key-property name=\"customerNumber\"/>\n" +" </composite-id>\n" +"\n" +" <property name=\"preferredCustomer\"/>\n" +"</class>\n" +"\n" +"<class name=\"User\">\n" +" <composite-id name=\"id\" class=\"UserId\">\n" +" <key-property name=\"firstName\"/>\n" +" <key-property name=\"lastName\"/>\n" +" </composite-id>\n" +"\n" +" <property name=\"age\"/>\n" +"</class>" +msgstr "" + +#. Tag: title +#: basic_mapping.xml:718 +#, no-c-format +msgid "Multiple id properties with with a dedicated identifier type" +msgstr "" + +#. Tag: para +#: basic_mapping.xml:721 +#, no-c-format +msgid "" +"@IdClass on an entity points to the class (component) " +"representing the identifier of the class. The properties marked " +"@Id on the entity must have their corresponding " +"property on the @IdClass. The return type of search " +"twin property must be either identical for basic properties or must " +"correspond to the identifier class of the associated entity for an " +"association." +msgstr "" + +#. Tag: para +#: basic_mapping.xml:730 +#, no-c-format +msgid "" +"This approach is inherited from the EJB 2 days and we recommend against its " +"use. But, after all it's your application and Hibernate supports it." +msgstr "" + +#. Tag: programlisting +#: basic_mapping.xml:735 +#, no-c-format +msgid "" +"@Entity\n" +"@IdClass(CustomerId.class)\n" +"class Customer implements Serializable {\n" +" @Id @OneToOne\n" +" @JoinColumns({\n" +" @JoinColumn(name=\"userfirstname_fk\", referencedColumnName=\"firstName" +"\"),\n" +" @JoinColumn(name=\"userlastname_fk\", referencedColumnName=\"lastName" +"\")\n" +" }) \n" +" User user;\n" +" \n" +" @Id String customerNumber;\n" +"\n" +" boolean preferredCustomer;\n" +"}\n" +"\n" +"class CustomerId implements Serializable {\n" +" UserId user;\n" +" String customerNumber;\n" +"\n" +" //implements equals and hashCode\n" +"}\n" +"\n" +"@Entity \n" +"class User {\n" +" @EmbeddedId UserId id;\n" +" Integer age;\n" +"\n" +" //implements equals and hashCode\n" +"}\n" +"\n" +"@Embeddable\n" +"class UserId implements Serializable {\n" +" String firstName;\n" +" String lastName;\n" +"\n" +" //implements equals and hashCode\n" +"}" +msgstr "" + +#. Tag: para +#: basic_mapping.xml:737 +#, no-c-format +msgid "" +"Customer and CustomerId do " +"have the same properties customerNumber as well as " +"user. CustomerId must be " +"Serializable and implement equals() and hashCode()." +msgstr "" + +#. Tag: para +#: basic_mapping.xml:745 +#, no-c-format +msgid "" +"While not JPA standard, Hibernate let's you declare the vanilla associated " +"property in the @IdClass." +msgstr "" + +#. Tag: programlisting +#: basic_mapping.xml:749 +#, no-c-format +msgid "" +"@Entity\n" +"@IdClass(CustomerId.class)\n" +"class Customer implements Serializable {\n" +" @Id @OneToOne\n" +" @JoinColumns({\n" +" @JoinColumn(name=\"userfirstname_fk\", referencedColumnName=\"firstName" +"\"),\n" +" @JoinColumn(name=\"userlastname_fk\", referencedColumnName=\"lastName" +"\")\n" +" }) \n" +" User user;\n" +" \n" +" @Id String customerNumber;\n" +"\n" +" boolean preferredCustomer;\n" +"}\n" +"\n" +"class CustomerId implements Serializable {\n" +" @OneToOne User user;\n" +" String customerNumber;\n" +"\n" +" //implements equals and hashCode\n" +"}\n" +"\n" +"@Entity \n" +"class User {\n" +" @EmbeddedId UserId id;\n" +" Integer age;\n" +"\n" +" //implements equals and hashCode\n" +"}\n" +"\n" +"@Embeddable\n" +"class UserId implements Serializable {\n" +" String firstName;\n" +" String lastName;\n" +"}" +msgstr "" + +#. Tag: para +#: basic_mapping.xml:751 +#, no-c-format +msgid "" +"This feature is of limited interest though as you are likely to have chosen " +"the @IdClass approach to stay JPA compliant or you " +"have a quite twisted mind." +msgstr "" + +#. Tag: para +#: basic_mapping.xml:755 +#, no-c-format +msgid "Here are the equivalent on hbm.xml files:" +msgstr "" + +#. Tag: programlisting +#: basic_mapping.xml:757 +#, no-c-format +msgid "" +"<class name=\"Customer\">\n" +" <composite-id class=\"CustomerId\" mapped=\"true\">\n" +" <key-many-to-one name=\"user\">\n" +" <column name=\"userfirstname_fk\"/>\n" +" <column name=\"userlastname_fk\"/>\n" +" </key-many-to-one>\n" +" <key-property name=\"customerNumber\"/>\n" +" </composite-id>\n" +"\n" +" <property name=\"preferredCustomer\"/>\n" +"</class>\n" +"\n" +"<class name=\"User\">\n" +" <composite-id name=\"id\" class=\"UserId\">\n" +" <key-property name=\"firstName\"/>\n" +" <key-property name=\"lastName\"/>\n" +" </composite-id>\n" +"\n" +" <property name=\"age\"/>\n" +"</class>" +msgstr "" + +#. Tag: title +#: basic_mapping.xml:762 +#, fuzzy, no-c-format +msgid "Identifier generator" +msgstr "增强的标识符生成器" + +#. Tag: para +#: basic_mapping.xml:764 +#, no-c-format +msgid "" +"Hibernate can generate and populate identifier values for you automatically. " +"This is the recommended approach over \"business\" or \"natural\" id " +"(especially composite ids)." +msgstr "" + +#. Tag: para +#: basic_mapping.xml:768 +#, no-c-format +msgid "" +"Hibernate offers various generation strategies, let's explore the most " +"common ones first that happens to be standardized by JPA:" +msgstr "" + +#. Tag: para +#: basic_mapping.xml:774 +#, fuzzy, no-c-format +msgid "" +"IDENTITY: supports identity columns in DB2, MySQL, MS SQL Server, Sybase and " +"HypersonicSQL. The returned identifier is of type long, " +"short or int." +msgstr "" +"对 DB2,MySQL,MS SQL Server,Sybase 和 HypersonicSQL 的内置标识字段提供支" +"持。返回的标识符是 longshort 或者 " +"int 类型的。" + +#. Tag: para +#: basic_mapping.xml:781 +#, fuzzy, no-c-format +msgid "" +"SEQUENCE (called seqhilo in Hibernate): uses a hi/lo " +"algorithm to efficiently generate identifiers of type long, short or int, given a named " +"database sequence." +msgstr "" +"使用一个高/低位算法来高效的生成 longshort 或者 int 类型的标识符,给定一个数据库序列" +"(sequence)的名字。" + +#. Tag: para +#: basic_mapping.xml:788 +#, fuzzy, no-c-format +msgid "" +"TABLE (called MultipleHiLoPerTableGenerator in " +"Hibernate) : uses a hi/lo algorithm to efficiently generate identifiers of " +"type long, short or int, given a table and column as a source of hi values. The hi/lo " +"algorithm generates identifiers that are unique only for a particular " +"database." +msgstr "" +"使用一个高/低位算法高效的生成 longshort 或者 int 类型的标识符。给定一个表和字段(默认分别" +"是 hibernate_unique_keynext_hi)作" +"为高位值的来源。高/低位算法生成的标识符只在一个特定的数据库中是唯一的。" + +#. Tag: para +#: basic_mapping.xml:798 +#, fuzzy, no-c-format +msgid "" +"AUTO: selects IDENTITY, SEQUENCE or " +"TABLE depending upon the capabilities of the underlying " +"database." +msgstr "" +"根据底层数据库的能力选择 identitysequence 或者 hilo 中的一个。" + +#. Tag: para +#: basic_mapping.xml:805 +#, no-c-format +msgid "" +"We recommend all new projects to use the new enhanced identifier generators. " +"They are deactivated by default for entities using annotations but can be " +"activated using hibernate.id.new_generator_mappings=true. These " +"new generators are more efficient and closer to the JPA 2 specification " +"semantic." +msgstr "" + +#. Tag: para +#: basic_mapping.xml:812 +#, no-c-format +msgid "" +"However they are not backward compatible with existing Hibernate based " +"application (if a sequence or a table is used for id generation). See " +"XXXXXXX for more information on how " +"to activate them." +msgstr "" + +#. Tag: para +#: basic_mapping.xml:818 +#, no-c-format +msgid "" +"To mark an id property as generated, use the @GeneratedValue annotation. You can specify the strategy used (default to " +"AUTO) by setting strategy." +msgstr "" + +#. Tag: programlisting +#: basic_mapping.xml:823 +#, no-c-format +msgid "" +"@Entity\n" +"public class Customer {\n" +" @Id @GeneratedValue\n" +" Integer getId() { ... };\n" +"}\n" +"\n" +"@Entity \n" +"public class Invoice {\n" +" @Id @GeneratedValue(strategy=GenerationType.IDENTITY)\n" +" Integer getId() { ... };\n" +"}" +msgstr "" + +#. Tag: para +#: basic_mapping.xml:825 +#, no-c-format +msgid "" +"SEQUENCE and TABLE require additional " +"configurations that you can set using @SequenceGenerator and @TableGenerator:" +msgstr "" + +#. Tag: para +#: basic_mapping.xml:832 +#, fuzzy, no-c-format +msgid "name: name of the generator" +msgstr "name:属性名。" + +#. Tag: para +#: basic_mapping.xml:836 +#, fuzzy, no-c-format +msgid "" +"table / sequenceName: name of the " +"table or the sequence (defaulting respectively to " +"hibernate_sequences and hibernate_sequence)" +msgstr "" +"sequence_name(可选 — 默认为 hibernate_sequence):序列或表的名字" + +#. Tag: para +#: basic_mapping.xml:843 +#, fuzzy, no-c-format +msgid "catalog / schema:" +msgstr "serializable" + +#. Tag: para +#: basic_mapping.xml:848 +#, fuzzy, no-c-format +msgid "" +"initialValue: the value from which the id is to start " +"generating" +msgstr "table:被连接表的名称。 " + +#. Tag: para +#: basic_mapping.xml:853 +#, no-c-format +msgid "" +"allocationSize: the amount to increment by when " +"allocating id numbers from the generator" +msgstr "" + +#. Tag: para +#: basic_mapping.xml:858 +#, no-c-format +msgid "" +"In addition, the TABLE strategy also let you " +"customize:" +msgstr "" + +#. Tag: para +#: basic_mapping.xml:863 +#, fuzzy, no-c-format +msgid "" +"pkColumnName: the column name containing the entity " +"identifier" +msgstr "name:属性名。" + +#. Tag: para +#: basic_mapping.xml:868 +#, fuzzy, no-c-format +msgid "" +"valueColumnName: the column name containing the " +"identifier value" +msgstr "name(可选):标识属性的名字。 " + +#. Tag: para +#: basic_mapping.xml:873 +#, fuzzy, no-c-format +msgid "pkColumnValue: the entity identifier" +msgstr "id-type:标识符类型" + +#. Tag: para +#: basic_mapping.xml:878 +#, no-c-format +msgid "" +"uniqueConstraints: any potential column constraint on the " +"table containing the ids" +msgstr "" + +#. Tag: para +#: basic_mapping.xml:883 +#, no-c-format +msgid "" +"To link a table or sequence generator definition with an actual generated " +"property, use the same name in both the definition name " +"and the generator value generator as shown below." +msgstr "" + +#. Tag: programlisting +#: basic_mapping.xml:888 +#, no-c-format +msgid "" +"@Id \n" +"@GeneratedValue(\n" +" strategy=GenerationType.SEQUENCE, \n" +" generator=\"SEQ_GEN\")\n" +"@javax.persistence.SequenceGenerator(\n" +" name=\"SEQ_GEN\",\n" +" sequenceName=\"my_sequence\",\n" +" allocationSize=20\n" +")\n" +"public Integer getId() { ... }" +msgstr "" + +#. Tag: para +#: basic_mapping.xml:890 +#, no-c-format +msgid "" +"The scope of a generator definition can be the application or the class. " +"Class-defined generators are not visible outside the class and can override " +"application level generators. Application level generators are defined in " +"JPA's XML deployment descriptors (see XXXXXX ):" +msgstr "" + +#. Tag: programlisting +#: basic_mapping.xml:896 +#, no-c-format +msgid "" +"<table-generator name=\"EMP_GEN\"\n" +" table=\"GENERATOR_TABLE\"\n" +" pk-column-name=\"key\"\n" +" value-column-name=\"hi\"\n" +" pk-column-value=\"EMP\"\n" +" allocation-size=\"20\"/>\n" +"\n" +"//and the annotation equivalent\n" +"\n" +"@javax.persistence.TableGenerator(\n" +" name=\"EMP_GEN\",\n" +" table=\"GENERATOR_TABLE\",\n" +" pkColumnName = \"key\",\n" +" valueColumnName = \"hi\"\n" +" pkColumnValue=\"EMP\",\n" +" allocationSize=20\n" +")\n" +"\n" +"<sequence-generator name=\"SEQ_GEN\" \n" +" sequence-name=\"my_sequence\"\n" +" allocation-size=\"20\"/>\n" +"\n" +"//and the annotation equivalent\n" +"\n" +"@javax.persistence.SequenceGenerator(\n" +" name=\"SEQ_GEN\",\n" +" sequenceName=\"my_sequence\",\n" +" allocationSize=20\n" +")" +msgstr "" + +#. Tag: para +#: basic_mapping.xml:898 +#, no-c-format +msgid "" +"If a JPA XML descriptor (like META-INF/orm.xml) is used " +"to define the generators, EMP_GEN and SEQ_GEN are application level generators." +msgstr "" + +#. Tag: para +#: basic_mapping.xml:904 +#, no-c-format +msgid "" +"Package level definition is not supported by the JPA specification. However, " +"you can use the @GenericGenerator at the package level " +"(see )." +msgstr "" + +#. Tag: para +#: basic_mapping.xml:910 +#, no-c-format +msgid "" +"These are the four standard JPA generators. Hibernate goes beyond that and " +"provide additional generators or additional options as we will see below. " +"You can also write your own custom identifier generator by implementing " +"org.hibernate.id.IdentifierGenerator." +msgstr "" + +#. Tag: para +#: basic_mapping.xml:916 +#, no-c-format +msgid "" +"To define a custom generator, use the @GenericGenerator annotation (and its plural counter part " +"@GenericGenerators) that describes the class of the " +"identifier generator or its short cut name (as described below) and a list " +"of key/value parameters. When using @GenericGenerator " +"and assigning it via @GeneratedValue.generator, the " +"@GeneratedValue.strategy is ignored: leave it blank." +msgstr "" + +#. Tag: programlisting +#: basic_mapping.xml:926 +#, no-c-format +msgid "" +"@Id @GeneratedValue(generator=\"system-uuid\")\n" +"@GenericGenerator(name=\"system-uuid\", strategy = \"uuid\")\n" +"public String getId() {\n" +"\n" +"@Id @GeneratedValue(generator=\"trigger-generated\")\n" +"@GenericGenerator(\n" +" name=\"trigger-generated\", \n" +" strategy = \"select\",\n" +" parameters = @Parameter(name=\"key\", value = \"socialSecurityNumber\")\n" +")\n" +"public String getId() {" +msgstr "" + +#. Tag: para +#: basic_mapping.xml:928 +#, fuzzy, no-c-format +msgid "" +"The hbm.xml approach uses the optional <generator> " +"child element inside <id>. If any parameters are " +"required to configure or initialize the generator instance, they are passed " +"using the <param> element." +msgstr "" +"可选的 <generator> 子元素是一个 Java 类的名字,用来" +"为该持久化类的实例生成唯一的标识。如果这个生成器实例需要某些配置值或者初始化" +"参数,用 <param> 元素来传递。" + +#. Tag: programlisting +#: basic_mapping.xml:934 +#, fuzzy, no-c-format +msgid "" +"<id name=\"id\" type=\"long\" column=\"cat_id\">\n" +" <generator class=\"org.hibernate.id.TableHiLoGenerator\">\n" +" <param name=\"table\">uid_table</param>\n" +" <param name=\"column\">next_hi_value_column</" +"param>\n" +" </generator>\n" +"</id>" +msgstr "" +"\n" +" \n" +" uid_table\n" +" next_hi_value_column\n" +" \n" +"]]>" + +#. Tag: title +#: basic_mapping.xml:937 +#, no-c-format +msgid "Various additional generators" +msgstr "" + +#. Tag: para +#: basic_mapping.xml:939 +#, no-c-format +msgid "" +"All generators implement the interface org.hibernate.id." +"IdentifierGenerator. This is a very simple interface. Some " +"applications can choose to provide their own specialized implementations, " +"however, Hibernate provides a range of built-in implementations. The " +"shortcut names for the built-in generators are as follows:" +msgstr "" +"所有的生成器都实现 org.hibernate.id.IdentifierGenerator 接" +"口。这是一个非常简单的接口;某些应用程序可以选择提供他们自己特定的实现。当" +"然,Hibernate 提供了很多内置的实现。下面是一些内置生成器的快捷名字: " + +#. Tag: literal +#: basic_mapping.xml:946 +#, no-c-format +msgid "increment" +msgstr "increment" + +#. Tag: para +#: basic_mapping.xml:949 +#, no-c-format +msgid "" +"generates identifiers of type long, short or int that are unique only when no other " +"process is inserting data into the same table. Do not use in a " +"cluster." +msgstr "" +"用于为 long, short 或者 int 类型生成 唯一标识。只有在没有其他进程往同一张表中插入数据时才能使" +"用。在集群下不要使用。" + +#. Tag: literal +#: basic_mapping.xml:958 +#, no-c-format +msgid "identity" +msgstr "identity" + +#. Tag: para +#: basic_mapping.xml:961 +#, no-c-format +msgid "" +"supports identity columns in DB2, MySQL, MS SQL Server, Sybase and " +"HypersonicSQL. The returned identifier is of type long, " +"short or int." +msgstr "" +"对 DB2,MySQL,MS SQL Server,Sybase 和 HypersonicSQL 的内置标识字段提供支" +"持。返回的标识符是 longshort 或者 " +"int 类型的。" + +#. Tag: literal +#: basic_mapping.xml:969 +#, no-c-format +msgid "sequence" +msgstr "sequence" + +#. Tag: para +#: basic_mapping.xml:972 +#, no-c-format +msgid "" +"uses a sequence in DB2, PostgreSQL, Oracle, SAP DB, McKoi or a generator in " +"Interbase. The returned identifier is of type long, " +"short or int" +msgstr "" +"在 DB2,PostgreSQL,Oracle,SAP DB,McKoi 中使用序列(sequence), 而在 " +"Interbase 中使用生成器(generator)。返回的标识符是 long," +"short 或者 int 类型的。" + +#. Tag: literal +#: basic_mapping.xml:980 +#, no-c-format +msgid "hilo" +msgstr "hilo" + +#. Tag: para +#: basic_mapping.xml:984 +#, no-c-format +msgid "" +"uses a hi/lo algorithm to efficiently generate identifiers of type " +"long, short or int, " +"given a table and column (by default hibernate_unique_key " +"and next_hi respectively) as a source of hi values. The " +"hi/lo algorithm generates identifiers that are unique only for a particular " +"database." +msgstr "" +"使用一个高/低位算法高效的生成 longshort 或者 int 类型的标识符。给定一个表和字段(默认分别" +"是 hibernate_unique_keynext_hi)作" +"为高位值的来源。高/低位算法生成的标识符只在一个特定的数据库中是唯一的。" + +#. Tag: literal +#: basic_mapping.xml:996 +#, no-c-format +msgid "seqhilo" +msgstr "seqhilo" + +#. Tag: para +#: basic_mapping.xml:999 +#, no-c-format +msgid "" +"uses a hi/lo algorithm to efficiently generate identifiers of type " +"long, short or int, " +"given a named database sequence." +msgstr "" +"使用一个高/低位算法来高效的生成 longshort 或者 int 类型的标识符,给定一个数据库序列" +"(sequence)的名字。" + +#. Tag: literal +#: basic_mapping.xml:1007 +#, fuzzy, no-c-format +msgid "uuid" +msgstr "guid" + +#. Tag: para +#: basic_mapping.xml:1010 +#, no-c-format +msgid "" +"Generates a 128-bit UUID based on a custom algorithm. The value generated is " +"represented as a string of 32 hexidecimal digits. Users can also configure " +"it to use a separator (config parameter \"separator\") which separates the " +"hexidecimal digits into 8{sep}8{sep}4{sep}8{sep}4. Note specifically that " +"this is different than the IETF RFC 4122 representation of 8-4-4-4-12. If " +"you need RFC 4122 compliant UUIDs, consider using \"uuid2\" generator " +"discussed below." +msgstr "" + +#. Tag: literal +#: basic_mapping.xml:1023 +#, fuzzy, no-c-format +msgid "uuid2" +msgstr "guid" + +#. Tag: para +#: basic_mapping.xml:1026 +#, no-c-format +msgid "" +"Generates a IETF RFC 4122 compliant (variant 2) 128-bit UUID. The exact " +"\"version\" (the RFC term) generated depends on the pluggable \"generation " +"strategy\" used (see below). Capable of generating values as java." +"util.UUID, java.lang.String or as a byte " +"array of length 16 (byte[16]). The \"generation strategy" +"\" is defined by the interface org.hibernate.id." +"UUIDGenerationStrategy. The generator defines 2 " +"configuration parameters for defining which generation strategy to use:" +msgstr "" + +#. Tag: literal +#: basic_mapping.xml:1038 +#, no-c-format +msgid "uuid_gen_strategy_class" +msgstr "" + +#. Tag: para +#: basic_mapping.xml:1041 +#, no-c-format +msgid "Names the UUIDGenerationStrategy class to use" +msgstr "" + +#. Tag: literal +#: basic_mapping.xml:1047 +#, no-c-format +msgid "uuid_gen_strategy" +msgstr "" + +#. Tag: para +#: basic_mapping.xml:1050 +#, no-c-format +msgid "Names the UUIDGenerationStrategy instance to use" +msgstr "" + +#. Tag: para +#: basic_mapping.xml:1056 +#, no-c-format +msgid "Out of the box, comes with the following strategies:" +msgstr "" + +#. Tag: para +#: basic_mapping.xml:1059 +#, no-c-format +msgid "" +"org.hibernate.id.uuid.StandardRandomStrategy (the " +"default) - generates \"version 3\" (aka, \"random\") UUID values via the " +"randomUUID method of java.util.UUID" +msgstr "" + +#. Tag: para +#: basic_mapping.xml:1067 +#, no-c-format +msgid "" +"org.hibernate.id.uuid.CustomVersionOneStrategy - " +"generates \"version 1\" UUID values, using IP address since mac address not " +"available. If you need mac address to be used, consider leveraging one of " +"the existing third party UUID generators which sniff out mac address and " +"integrating it via the org.hibernate.id." +"UUIDGenerationStrategy contract. Two such libraries known at " +"time of this writing include http://johannburkard.de/software/uuid/ and http://commons.apache.org/" +"sandbox/id/uuid.html" +msgstr "" + +#. Tag: literal +#: basic_mapping.xml:1085 +#, no-c-format +msgid "guid" +msgstr "guid" + +#. Tag: para +#: basic_mapping.xml:1088 #, no-c-format msgid "uses a database-generated GUID string on MS SQL Server and MySQL." msgstr "在 MS SQL Server 和 MySQL 中使用数据库生成的 GUID 字符串。" -#. Tag: term +#. Tag: literal +#: basic_mapping.xml:1094 #, no-c-format -msgid "native" -msgstr "native" +msgid "native" +msgstr "native" #. Tag: para +#: basic_mapping.xml:1097 #, no-c-format -msgid "selects identity, sequence or hilo depending upon the capabilities of the underlying database." -msgstr "根据底层数据库的能力选择 identitysequence 或者 hilo 中的一个。" +msgid "" +"selects identity, sequence or " +"hilo depending upon the capabilities of the underlying " +"database." +msgstr "" +"根据底层数据库的能力选择 identitysequence 或者 hilo 中的一个。" -#. Tag: term +#. Tag: literal +#: basic_mapping.xml:1105 #, no-c-format -msgid "assigned" -msgstr "assigned" +msgid "assigned" +msgstr "assigned" #. Tag: para +#: basic_mapping.xml:1108 #, no-c-format -msgid "lets the application assign an identifier to the object before save() is called. This is the default strategy if no <generator> element is specified." -msgstr "让应用程序在调用 save() 之前为对象分配一个标识符。这是 <generator> 元素没有指定时的默认生成策略。" +msgid "" +"lets the application assign an identifier to the object before save" +"() is called. This is the default strategy if no <" +"generator> element is specified." +msgstr "" +"让应用程序在调用 save() 之前为对象分配一个标识符。这是 " +"<generator> 元素没有指定时的默认生成策略。" -#. Tag: term +#. Tag: literal +#: basic_mapping.xml:1117 #, no-c-format -msgid "select" -msgstr "select" +msgid "select" +msgstr "select" #. Tag: para +#: basic_mapping.xml:1120 #, no-c-format -msgid "retrieves a primary key, assigned by a database trigger, by selecting the row by some unique key and retrieving the primary key value." +msgid "" +"retrieves a primary key, assigned by a database trigger, by selecting the " +"row by some unique key and retrieving the primary key value." msgstr "通过数据库触发器选择一些唯一主键的行并返回主键值来分配一个主键。 " -#. Tag: term +#. Tag: literal +#: basic_mapping.xml:1127 #, no-c-format -msgid "foreign" -msgstr "foreign" +msgid "foreign" +msgstr "foreign" #. Tag: para +#: basic_mapping.xml:1130 #, no-c-format -msgid "uses the identifier of another associated object. It is usually used in conjunction with a <one-to-one> primary key association." -msgstr "使用另外一个相关联的对象的标识符。它通常和 <one-to-one> 联合起来使用。" +msgid "" +"uses the identifier of another associated object. It is usually used in " +"conjunction with a <one-to-one> primary key " +"association." +msgstr "" +"使用另外一个相关联的对象的标识符。它通常和 <one-to-one> 联合起来使用。" -#. Tag: term -#, no-c-format -msgid "sequence-identity" +#. Tag: literal +#: basic_mapping.xml:1138 +#, fuzzy, no-c-format +msgid "sequence-identity" msgstr "sequence-identity" #. Tag: para +#: basic_mapping.xml:1141 #, no-c-format -msgid "a specialized sequence generation strategy that utilizes a database sequence for the actual value generation, but combines this with JDBC3 getGeneratedKeys to return the generated identifier value as part of the insert statement execution. This strategy is only supported on Oracle 10g drivers targeted for JDK 1.4. Comments on these insert statements are disabled due to a bug in the Oracle drivers." -msgstr "一种特别的序列生成策略,它使用数据库序列来生成实际值,但将它和 JDBC3 的 getGeneratedKeys 结合在一起,使得在插入语句执行的时候就返回生成的值。目前为止只有面向 JDK 1.4 的 Oracle 10g 驱动支持这一策略。由于 Oracle 驱动程序的一个 bug,这些插入语句的注释被关闭了。" +msgid "" +"a specialized sequence generation strategy that utilizes a database sequence " +"for the actual value generation, but combines this with JDBC3 " +"getGeneratedKeys to return the generated identifier value as part of the " +"insert statement execution. This strategy is only supported on Oracle 10g " +"drivers targeted for JDK 1.4. Comments on these insert statements are " +"disabled due to a bug in the Oracle drivers." +msgstr "" +"一种特别的序列生成策略,它使用数据库序列来生成实际值,但将它和 JDBC3 的 " +"getGeneratedKeys 结合在一起,使得在插入语句执行的时候就返回生成的值。目前为止" +"只有面向 JDK 1.4 的 Oracle 10g 驱动支持这一策略。由于 Oracle 驱动程序的一个 " +"bug,这些插入语句的注释被关闭了。" #. Tag: title +#: basic_mapping.xml:1155 #, no-c-format msgid "Hi/lo algorithm" msgstr "高/低位算法(Hi/Lo Algorithm)" #. Tag: para +#: basic_mapping.xml:1157 #, no-c-format -msgid "The hilo and seqhilo generators provide two alternate implementations of the hi/lo algorithm. The first implementation requires a \"special\" database table to hold the next available \"hi\" value. Where supported, the second uses an Oracle-style sequence." -msgstr "hiloseqhilo 生成器给出了两种 hi/lo 算法的实现, 这是一种很令人满意的标识符生成算法。第一种实现需要一个“特殊”的数据库表来保存下一个可用的“hi”值。 第二种实现使用一个 Oracle 风格的序列(在被支持的情况下)。 " +msgid "" +"The hilo and seqhilo generators " +"provide two alternate implementations of the hi/lo algorithm. The first " +"implementation requires a \"special\" database table to hold the next " +"available \"hi\" value. Where supported, the second uses an Oracle-style " +"sequence." +msgstr "" +"hiloseqhilo 生成器给出了两种 hi/lo " +"算法的实现, 这是一种很令人满意的标识符生成算法。第一种实现需要一个“特殊”的数" +"据库表来保存下一个可用的“hi”值。 第二种实现使用一个 Oracle 风格的序列(在被支" +"持的情况下)。 " + +#. Tag: programlisting +#: basic_mapping.xml:1163 +#, fuzzy, no-c-format +msgid "" +"<id name=\"id\" type=\"long\" column=\"cat_id\">\n" +" <generator class=\"hilo\">\n" +" <param name=\"table\">hi_value</param>\n" +" <param name=\"column\">next_value</param>\n" +" <param name=\"max_lo\">100</param>\n" +" </generator>\n" +"</id>" +msgstr "" +"\n" +" \n" +" hi_value\n" +" next_value\n" +" 100\n" +" \n" +"]]>" + +#. Tag: programlisting +#: basic_mapping.xml:1165 +#, fuzzy, no-c-format +msgid "" +"<id name=\"id\" type=\"long\" column=\"cat_id\">\n" +" <generator class=\"seqhilo\">\n" +" <param name=\"sequence\">hi_value</param>\n" +" <param name=\"max_lo\">100</param>\n" +" </generator>\n" +"</id>" +msgstr "" +"\n" +" \n" +" hi_value\n" +" 100\n" +" \n" +"]]>" #. Tag: para +#: basic_mapping.xml:1167 #, no-c-format -msgid "Unfortunately, you cannot use hilo when supplying your own Connection to Hibernate. When Hibernate uses an application server datasource to obtain connections enlisted with JTA, you must configure the hibernate.transaction.manager_lookup_class." -msgstr "可惜的是,你在为 Hibernate 自行提供 Connection 时无法使用 hilo。 当 Hibernate 使用 JTA 获取应用服务器的数据源连接时,你必须正确地配置 hibernate.transaction.manager_lookup_class。" +msgid "" +"Unfortunately, you cannot use hilo when supplying your " +"own Connection to Hibernate. When Hibernate uses an " +"application server datasource to obtain connections enlisted with JTA, you " +"must configure the hibernate.transaction.manager_lookup_class." +msgstr "" +"可惜的是,你在为 Hibernate 自行提供 Connection 时无法使用 " +"hilo。 当 Hibernate 使用 JTA 获取应用服务器的数据源连接" +"时,你必须正确地配置 hibernate.transaction.manager_lookup_class。" #. Tag: title +#: basic_mapping.xml:1175 #, no-c-format msgid "UUID algorithm" msgstr "UUID 算法(UUID Algorithm )" #. Tag: para +#: basic_mapping.xml:1177 #, no-c-format -msgid "The UUID contains: IP address, startup time of the JVM that is accurate to a quarter second, system time and a counter value that is unique within the JVM. It is not possible to obtain a MAC address or memory address from Java code, so this is the best option without using JNI." -msgstr "UUID 包含:IP 地址、JVM 的启动时间(精确到 1/4 秒)、系统时间和一个计数器值(在 JVM 中唯一)。 在 Java 代码中不可能获得 MAC 地址或者内存地址,所以这已经是我们在不使用 JNI 的前提下的能做的最好实现了。" +msgid "" +"The UUID contains: IP address, startup time of the JVM that is accurate to a " +"quarter second, system time and a counter value that is unique within the " +"JVM. It is not possible to obtain a MAC address or memory address from Java " +"code, so this is the best option without using JNI." +msgstr "" +"UUID 包含:IP 地址、JVM 的启动时间(精确到 1/4 秒)、系统时间和一个计数器值" +"(在 JVM 中唯一)。 在 Java 代码中不可能获得 MAC 地址或者内存地址,所以这已经" +"是我们在不使用 JNI 的前提下的能做的最好实现了。" #. Tag: title +#: basic_mapping.xml:1185 #, no-c-format msgid "Identity columns and sequences" msgstr "标识字段和序列(Identity columns and Sequences)" #. Tag: para +#: basic_mapping.xml:1187 #, no-c-format -msgid "For databases that support identity columns (DB2, MySQL, Sybase, MS SQL), you can use identity key generation. For databases that support sequences (DB2, Oracle, PostgreSQL, Interbase, McKoi, SAP DB) you can use sequence style key generation. Both of these strategies require two SQL queries to insert a new object. For example:" -msgstr "对于内部支持标识字段的数据库(DB2、MySQL、Sybase 和 MS SQL),你可以使用 identity 关键字生成。对于内部支持序列的数据库(DB2、Oracle、PostgreSQL、Interbase、McKoi 和 SAP DB),你可以使用 sequence 风格的关键字生成。这两种方式对于插入一个新的对象都需要两次 SQL 查询。例如:" +msgid "" +"For databases that support identity columns (DB2, MySQL, Sybase, MS SQL), " +"you can use identity key generation. For databases that " +"support sequences (DB2, Oracle, PostgreSQL, Interbase, McKoi, SAP DB) you " +"can use sequence style key generation. Both of these " +"strategies require two SQL queries to insert a new object. For example:" +msgstr "" +"对于内部支持标识字段的数据库(DB2、MySQL、Sybase 和 MS SQL),你可以使用 " +"identity 关键字生成。对于内部支持序列的数据库(DB2、" +"Oracle、PostgreSQL、Interbase、McKoi 和 SAP DB),你可以使用 " +"sequence 风格的关键字生成。这两种方式对于插入一个新的对象" +"都需要两次 SQL 查询。例如:" + +#. Tag: programlisting +#: basic_mapping.xml:1195 +#, fuzzy, no-c-format +msgid "" +"<id name=\"id\" type=\"long\" column=\"person_id\">\n" +" <generator class=\"sequence\">\n" +" <param name=\"sequence\">person_id_sequence</" +"param>\n" +" </generator>\n" +"</id>" +msgstr "" +"\n" +" \n" +" person_id_sequence\n" +" \n" +"]]>" + +#. Tag: programlisting +#: basic_mapping.xml:1197 +#, fuzzy, no-c-format +msgid "" +"<id name=\"id\" type=\"long\" column=\"person_id\" unsaved-value=\"0" +"\">\n" +" <generator class=\"identity\"/>\n" +"</id>" +msgstr "" +"\n" +" \n" +"]]>" #. Tag: para +#: basic_mapping.xml:1199 #, no-c-format -msgid "For cross-platform development, the native strategy will, depending on the capabilities of the underlying database, choose from the identity, sequence and hilo strategies." -msgstr "对于跨平台开发,native 策略会从 identitysequencehilo 中进行选择,选择哪一个,这取决于底层数据库的支持能力。" +msgid "" +"For cross-platform development, the native strategy will, " +"depending on the capabilities of the underlying database, choose from the " +"identity, sequence and hilo strategies." +msgstr "" +"对于跨平台开发,native 策略会从 identitysequencehilo 中进行选择," +"选择哪一个,这取决于底层数据库的支持能力。" #. Tag: title +#: basic_mapping.xml:1207 #, no-c-format msgid "Assigned identifiers" msgstr "程序分配的标识符(Assigned Identifiers)" #. Tag: para -#, no-c-format -msgid "If you want the application to assign identifiers, as opposed to having Hibernate generate them, you can use the assigned generator. This special generator uses the identifier value already assigned to the object's identifier property. The generator is used when the primary key is a natural key instead of a surrogate key. This is the default behavior if you do not specify a <generator> element." -msgstr "如果你需要应用程序分配一个标示符(而非 Hibernate 来生成),你可以使用 assigned 生成器。这种特殊的生成器会使用已经分配给对象的标识符属性的标识符值。 这个生成器使用一个自然键(natural key,有商业意义的列-译注)作为主键,而不是使用一个代理键( surrogate key,没有商业意义的列-译注)。这是没有指定 <generator> 元素时的默认行为。" +#: basic_mapping.xml:1209 +#, fuzzy, no-c-format +msgid "" +"If you want the application to assign identifiers, as opposed to having " +"Hibernate generate them, you can use the assigned " +"generator. This special generator uses the identifier value already assigned " +"to the object's identifier property. The generator is used when the primary " +"key is a natural key instead of a surrogate key. This is the default " +"behavior if you do not specify @GeneratedValue nor " +"<generator> elements." +msgstr "" +"如果你需要应用程序分配一个标示符(而非 Hibernate 来生成),你可以使用 " +"assigned 生成器。这种特殊的生成器会使用已经分配给对象的标" +"识符属性的标识符值。 这个生成器使用一个自然键(natural key,有商业意义的列-" +"译注)作为主键,而不是使用一个代理键( surrogate key,没有商业意义的列-译" +"注)。这是没有指定 <generator> 元素时的默认行为。" #. Tag: para +#: basic_mapping.xml:1218 #, no-c-format -msgid "The assigned generator makes Hibernate use unsaved-value=\"undefined\". This forces Hibernate to go to the database to determine if an instance is transient or detached, unless there is a version or timestamp property, or you define Interceptor.isUnsaved()." -msgstr "当选择 assigned 生成器时,除非有一个 version 或 timestamp 属性,或者你定义了 Interceptor.isUnsaved(),否则需要让 Hiberante 使用 unsaved-value=\"undefined\",强制 Hibernatet 查询数据库来确定一个实例是瞬时的(transient) 还是脱管的(detached)。" +msgid "" +"The assigned generator makes Hibernate use " +"unsaved-value=\"undefined\". This forces Hibernate to go " +"to the database to determine if an instance is transient or detached, unless " +"there is a version or timestamp property, or you define Interceptor." +"isUnsaved()." +msgstr "" +"当选择 assigned 生成器时,除非有一个 version 或 timestamp " +"属性,或者你定义了 Interceptor.isUnsaved(),否则需要让 " +"Hiberante 使用 unsaved-value=\"undefined\",强制 " +"Hibernatet 查询数据库来确定一个实例是瞬时的(transient) 还是脱管的" +"(detached)。" #. Tag: title +#: basic_mapping.xml:1226 #, no-c-format msgid "Primary keys assigned by triggers" msgstr "触发器实现的主键生成器(Primary keys assigned by triggers)" #. Tag: para +#: basic_mapping.xml:1228 #, no-c-format -msgid "Hibernate does not generate DDL with triggers. It is for legacy schemas only." +msgid "" +"Hibernate does not generate DDL with triggers. It is for legacy schemas only." msgstr "仅仅用于遗留的 schema 中(Hibernate 不能用触发器生成 DDL)。" +#. Tag: programlisting +#: basic_mapping.xml:1231 +#, fuzzy, no-c-format +msgid "" +"<id name=\"id\" type=\"long\" column=\"person_id\">\n" +" <generator class=\"select\">\n" +" <param name=\"key\">socialSecurityNumber</" +"param>\n" +" </generator>\n" +"</id>" +msgstr "" +"\n" +" \n" +" socialSecurityNumber\n" +" \n" +"]]>" + #. Tag: para +#: basic_mapping.xml:1233 #, no-c-format -msgid "In the above example, there is a unique valued property named socialSecurityNumber. It is defined by the class, as a natural key and a surrogate key named person_id, whose value is generated by a trigger." -msgstr "在上面的例子中,类定义了一个命名为 socialSecurityNumber 的具有唯一值的属性,它是一个自然键(natural key),命名为 person_id 的代理键(surrogate key)的值由触发器生成。" +msgid "" +"In the above example, there is a unique valued property named " +"socialSecurityNumber. It is defined by the class, as a " +"natural key and a surrogate key named person_id, whose " +"value is generated by a trigger." +msgstr "" +"在上面的例子中,类定义了一个命名为 socialSecurityNumber 的" +"具有唯一值的属性,它是一个自然键(natural key),命名为 person_id 的代理键(surrogate key)的值由触发器生成。" #. Tag: title +#: basic_mapping.xml:1241 +#, no-c-format +msgid "Identity copy (foreign generator)" +msgstr "" + +#. Tag: para +#: basic_mapping.xml:1243 +#, no-c-format +msgid "" +"Finally, you can ask Hibernate to copy the identifier from another " +"associated entity. In the Hibernate jargon, it is known as a foreign " +"generator but the JPA mapping reads better and is encouraged." +msgstr "" + +#. Tag: programlisting +#: basic_mapping.xml:1248 +#, no-c-format +msgid "" +"@Entity\n" +"class MedicalHistory implements Serializable {\n" +" @Id @OneToOne\n" +" @JoinColumn(name = \"person_id\")\n" +" Person patient;\n" +"}\n" +"\n" +"@Entity\n" +"public class Person implements Serializable {\n" +" @Id @GeneratedValue Integer id;\n" +"}" +msgstr "" + +#. Tag: para +#: basic_mapping.xml:1250 +#, fuzzy, no-c-format +msgid "Or alternatively" +msgstr "其他元数据(Metadata)" + +#. Tag: programlisting +#: basic_mapping.xml:1252 +#, no-c-format +msgid "" +"@Entity\n" +"class MedicalHistory implements Serializable {\n" +" @Id Integer id;\n" +"\n" +" @MapsId @OneToOne\n" +" @JoinColumn(name = \"patient_id\")\n" +" Person patient;\n" +"}\n" +"\n" +"@Entity\n" +"class Person {\n" +" @Id @GeneratedValue Integer id;\n" +"}" +msgstr "" + +#. Tag: para +#: basic_mapping.xml:1254 +#, no-c-format +msgid "In hbm.xml use the following approach:" +msgstr "" + +#. Tag: programlisting +#: basic_mapping.xml:1256 +#, fuzzy, no-c-format +msgid "" +"<class name=\"MedicalHistory\">\n" +" <id name=\"id\">\n" +" <generator class=\"foreign\">\n" +" <param name=\"property\">patient</param>\n" +" </generator>\n" +" </id>\n" +" <one-to-one name=\"patient\" class=\"Person\" constrained=\"true\"/" +">\n" +"</class>" +msgstr "" +"<class name=\"person\" table=\"PERSON\">\n" +" <id name=\"id\" column=\"PERSON_ID\">\n" +" <generator class=\"foreign\">\n" +" <param name=\"property\">employee</param>\n" +" </generator>\n" +" </id>\n" +" ...\n" +" <one-to-one name=\"employee\"\n" +" class=\"Employee\"\n" +" constrained=\"true\"/>\n" +"</class>" + +#. Tag: title +#: basic_mapping.xml:1261 #, no-c-format msgid "Enhanced identifier generators" msgstr "增强的标识符生成器" #. Tag: para +#: basic_mapping.xml:1263 #, no-c-format -msgid "Starting with release 3.2.3, there are 2 new generators which represent a re-thinking of 2 different aspects of identifier generation. The first aspect is database portability; the second is optimization Optimization means that you do not have to query the database for every request for a new identifier value. These two new generators are intended to take the place of some of the named generators described above, starting in 3.3.x. However, they are included in the current releases and can be referenced by FQN." -msgstr "从 3.2.3 版本开始,有两个代表不同标识符生成概念的新的生成器。第一个概念是数据库移植性;第二个是优化。优化表示你不需对每个新标识符的请求都查询数据库。从 3.3.x 开始,这两个新的生成器都是用来取代上面所述的生成器的。然而,它们也包括在当前版本里且可以由 FQN 进行引用。" +msgid "" +"Starting with release 3.2.3, there are 2 new generators which represent a re-" +"thinking of 2 different aspects of identifier generation. The first aspect " +"is database portability; the second is optimization Optimization means that " +"you do not have to query the database for every request for a new identifier " +"value. These two new generators are intended to take the place of some of " +"the named generators described above, starting in 3.3.x. However, they are " +"included in the current releases and can be referenced by FQN." +msgstr "" +"从 3.2.3 版本开始,有两个代表不同标识符生成概念的新的生成器。第一个概念是数据" +"库移植性;第二个是优化。优化表示你不需对每个新标识符的请求都查询数据库。从 " +"3.3.x 开始,这两个新的生成器都是用来取代上面所述的生成器的。然而,它们也包括" +"在当前版本里且可以由 FQN 进行引用。" #. Tag: para +#: basic_mapping.xml:1272 #, no-c-format -msgid "The first of these new generators is org.hibernate.id.enhanced.SequenceStyleGenerator which is intended, firstly, as a replacement for the sequence generator and, secondly, as a better portability generator than native. This is because native generally chooses between identity and sequence which have largely different semantics that can cause subtle issues in applications eyeing portability. org.hibernate.id.enhanced.SequenceStyleGenerator, however, achieves portability in a different manner. It chooses between a table or a sequence in the database to store its incrementing values, depending on the capabilities of the dialect being used. The difference between this and native is that table-based and sequence-based storage have the same exact semantic. In fact, sequences are exactly what Hibernate tries to emulate with its table-based generators. This generator has a number of configuration parameters:" -msgstr "这些生成器的第一个是 org.hibernate.id.enhanced.SequenceStyleGenerator,首先,它是作为 sequence 生成器的替代物,其次,它是比 native 具有更好移植性的生成器。这是因为 native 通常在 identitysequence 之间选择,它有差别很大的 semantic,在移植时会导致潜在的问题。然而,org.hibernate.id.enhanced.SequenceStyleGenerator 以不同的方式实现移植性。它根据所使用的方言的能力,在数据库表或序列之间选择以存储其增量。这和 native 的区别是基于表或序列的存储具有恰好相同的 semantic。实际上,序列就是 Hibernate 试图用基于表的生成器来模拟的。这个生成器有如下的配置参数:" +msgid "" +"The first of these new generators is org.hibernate.id.enhanced." +"SequenceStyleGenerator which is intended, firstly, as a " +"replacement for the sequence generator and, secondly, as " +"a better portability generator than native. This is " +"because native generally chooses between " +"identity and sequence which have " +"largely different semantics that can cause subtle issues in applications " +"eyeing portability. org.hibernate.id.enhanced." +"SequenceStyleGenerator, however, achieves portability in a " +"different manner. It chooses between a table or a sequence in the database " +"to store its incrementing values, depending on the capabilities of the " +"dialect being used. The difference between this and native is that table-based and sequence-based storage have the same exact " +"semantic. In fact, sequences are exactly what Hibernate tries to emulate " +"with its table-based generators. This generator has a number of " +"configuration parameters:" +msgstr "" +"这些生成器的第一个是 org.hibernate.id.enhanced." +"SequenceStyleGenerator,首先,它是作为 sequence " +"生成器的替代物,其次,它是比 native 具有更好移植性的生成" +"器。这是因为 native 通常在 identity 和 " +"sequence 之间选择,它有差别很大的 semantic,在移植时会导致" +"潜在的问题。然而,org.hibernate.id.enhanced.SequenceStyleGenerator 以不同的方式实现移植性。它根据所使用的方言的能力,在数据库表或序列之" +"间选择以存储其增量。这和 native 的区别是基于表或序列的存储" +"具有恰好相同的 semantic。实际上,序列就是 Hibernate 试图用基于表的生成器来模" +"拟的。这个生成器有如下的配置参数:" #. Tag: para +#: basic_mapping.xml:1291 #, no-c-format -msgid "sequence_name (optional, defaults to hibernate_sequence): the name of the sequence or table to be used." -msgstr "sequence_name(可选 — 默认为 hibernate_sequence):序列或表的名字" +msgid "" +"sequence_name (optional, defaults to " +"hibernate_sequence): the name of the sequence or table to " +"be used." +msgstr "" +"sequence_name(可选 — 默认为 hibernate_sequence):序列或表的名字" #. Tag: para +#: basic_mapping.xml:1297 #, no-c-format -msgid "initial_value (optional, defaults to 1): the initial value to be retrieved from the sequence/table. In sequence creation terms, this is analogous to the clause typically named \"STARTS WITH\"." -msgstr "initial_value(可选,默认为 1):从序列/表里获取的初始值。按照序列创建的术语,这等同于子句 \"STARTS WITH\"。" +msgid "" +"initial_value (optional, defaults to 1): the initial value to be retrieved from the sequence/table. In " +"sequence creation terms, this is analogous to the clause typically named " +"\"STARTS WITH\"." +msgstr "" +"initial_value(可选,默认为 1):从序" +"列/表里获取的初始值。按照序列创建的术语,这等同于子句 \"STARTS WITH\"。" #. Tag: para +#: basic_mapping.xml:1304 #, no-c-format -msgid "increment_size (optional - defaults to 1): the value by which subsequent calls to the sequence/table should differ. In sequence creation terms, this is analogous to the clause typically named \"INCREMENT BY\"." -msgstr "increment_size(可选 - 缺省为 1):对序列/表的调用应该区分的值。按照序列创建的术语,这等同于子句 \"INCREMENT BY\"。" +msgid "" +"increment_size (optional - defaults to 1): the value by which subsequent calls to the sequence/table should " +"differ. In sequence creation terms, this is analogous to the clause " +"typically named \"INCREMENT BY\"." +msgstr "" +"increment_size(可选 - 缺省为 1):对序" +"列/表的调用应该区分的值。按照序列创建的术语,这等同于子句 \"INCREMENT BY\"。" #. Tag: para +#: basic_mapping.xml:1312 #, no-c-format -msgid "force_table_use (optional - defaults to false): should we force the use of a table as the backing structure even though the dialect might support sequence?" -msgstr "force_table_use(可选 - 缺省为 false):即使方言可能支持序列,是否也应该强制把表用作后台结构。" +msgid "" +"force_table_use (optional - defaults to false): should we force the use of a table as the backing structure even " +"though the dialect might support sequence?" +msgstr "" +"force_table_use(可选 - 缺省为 false):即使方言可能支持序列,是否也应该强制把表用作后台结构。" #. Tag: para +#: basic_mapping.xml:1319 #, no-c-format -msgid "value_column (optional - defaults to next_val): only relevant for table structures, it is the name of the column on the table which is used to hold the value." -msgstr "value_column(可选 - 缺省为 next_val):只和表结构相关,它是用于保存值的字段的名称。" +msgid "" +"value_column (optional - defaults to next_val): only relevant for table structures, it is the name of the column " +"on the table which is used to hold the value." +msgstr "" +"value_column(可选 - 缺省为 next_val):只和表结构相关,它是用于保存值的字段的名称。" #. Tag: para -#, no-c-format -msgid "optimizer (optional - defaults to none): See " -msgstr "optimizer(可选 — 默认是none):请参考 。" +#: basic_mapping.xml:1326 +#, fuzzy, no-c-format +msgid "" +"optimizer (optional - defaults to none): See" +msgstr "" +"cascade(可选 — 默认是none):级联的类" +"型。" #. Tag: para +#: basic_mapping.xml:1332 #, no-c-format -msgid "The second of these new generators is org.hibernate.id.enhanced.TableGenerator, which is intended, firstly, as a replacement for the table generator, even though it actually functions much more like org.hibernate.id.MultipleHiLoPerTableGenerator, and secondly, as a re-implementation of org.hibernate.id.MultipleHiLoPerTableGenerator that utilizes the notion of pluggable optimizers. Essentially this generator defines a table capable of holding a number of different increment values simultaneously by using multiple distinctly keyed rows. This generator has a number of configuration parameters:" -msgstr "新生成器的第二个是 org.hibernate.id.enhanced.TableGenerator,它的目的首先是替代 table 生成器,即使它实际上比 org.hibernate.id.MultipleHiLoPerTableGenerator 功能要强得多;其次,作为利用可插拔 optimizer 的 org.hibernate.id.MultipleHiLoPerTableGenerator 的替代品。基本上这个生成器定义了一个可以利用多个不同的键值记录存储大量不同增量值的表。这个生成器有如下的配置参数:" +msgid "" +"The second of these new generators is org.hibernate.id.enhanced." +"TableGenerator, which is intended, firstly, as a replacement for " +"the table generator, even though it actually functions " +"much more like org.hibernate.id.MultipleHiLoPerTableGenerator, and secondly, as a re-implementation of org.hibernate.id." +"MultipleHiLoPerTableGenerator that utilizes the notion of " +"pluggable optimizers. Essentially this generator defines a table capable of " +"holding a number of different increment values simultaneously by using " +"multiple distinctly keyed rows. This generator has a number of configuration " +"parameters:" +msgstr "" +"新生成器的第二个是 org.hibernate.id.enhanced.TableGenerator,它的目的首先是替代 table 生成器,即使它实际上比 " +"org.hibernate.id.MultipleHiLoPerTableGenerator 功能要强得" +"多;其次,作为利用可插拔 optimizer 的 org.hibernate.id." +"MultipleHiLoPerTableGenerator 的替代品。基本上这个生成器定义了一个" +"可以利用多个不同的键值记录存储大量不同增量值的表。这个生成器有如下的配置参" +"数:" #. Tag: para +#: basic_mapping.xml:1345 #, no-c-format -msgid "table_name (optional - defaults to hibernate_sequences): the name of the table to be used." -msgstr "table_name(可选 — 默认是 hibernate_sequences):所用的表的名称。" +msgid "" +"table_name (optional - defaults to " +"hibernate_sequences): the name of the table to be used." +msgstr "" +"table_name(可选 — 默认是 hibernate_sequences):所用的表的名称。" #. Tag: para +#: basic_mapping.xml:1351 #, no-c-format -msgid "value_column_name (optional - defaults to next_val): the name of the column on the table that is used to hold the value." -msgstr "value_column_name(可选 — 默认为 next_val):用于存储这些值的表的字段的名字。" +msgid "" +"value_column_name (optional - defaults to " +"next_val): the name of the column on the table that is " +"used to hold the value." +msgstr "" +"value_column_name(可选 — 默认为 next_val):用于存储这些值的表的字段的名字。" #. Tag: para +#: basic_mapping.xml:1357 #, no-c-format -msgid "segment_column_name (optional - defaults to sequence_name): the name of the column on the table that is used to hold the \"segment key\". This is the value which identifies which increment value to use." -msgstr "segment_column_name(可选,默认为 sequence_name):用于保存 \"segment key\" 的字段的名称。这是标识使用哪个增量值的值。" +msgid "" +"segment_column_name (optional - defaults to " +"sequence_name): the name of the column on the table that " +"is used to hold the \"segment key\". This is the value which identifies " +"which increment value to use." +msgstr "" +"segment_column_name(可选,默认为 sequence_name):用于保存 \"segment key\" 的字段的名称。这是标识使用哪个增量值的" +"值。" #. Tag: para +#: basic_mapping.xml:1365 #, no-c-format -msgid "segment_value (optional - defaults to default): The \"segment key\" value for the segment from which we want to pull increment values for this generator." -msgstr "segment_value(可选,默认为 default):我们为这个生成器获取增量值的 segment 的 \"segment key\"。" +msgid "" +"segment_value (optional - defaults to default): The \"segment key\" value for the segment from which we want to " +"pull increment values for this generator." +msgstr "" +"segment_value(可选,默认为 default):" +"我们为这个生成器获取增量值的 segment 的 \"segment key\"。" #. Tag: para +#: basic_mapping.xml:1372 #, no-c-format -msgid "segment_value_length (optional - defaults to 255): Used for schema generation; the column size to create this segment key column." -msgstr "segment_value_length(可选 — 默认为 255):用于 schema 生成;创建 Segment Key 字段的字段大小。" +msgid "" +"segment_value_length (optional - defaults to " +"255): Used for schema generation; the column size to " +"create this segment key column." +msgstr "" +"segment_value_length(可选 — 默认为 255):用于 schema 生成;创建 Segment Key 字段的字段大小。" #. Tag: para +#: basic_mapping.xml:1378 #, no-c-format -msgid "initial_value (optional - defaults to 1): The initial value to be retrieved from the table." -msgstr "initial_value(可选 — 默认是 1):从表里获取的初始值。" +msgid "" +"initial_value (optional - defaults to 1): The initial value to be retrieved from the table." +msgstr "" +"initial_value(可选 — 默认是 1):从表" +"里获取的初始值。" #. Tag: para +#: basic_mapping.xml:1384 #, no-c-format -msgid "increment_size (optional - defaults to 1): The value by which subsequent calls to the table should differ." -msgstr "increment_size(可选 — 默认是 1):对表随后的调用应该区分的值。" +msgid "" +"increment_size (optional - defaults to 1): The value by which subsequent calls to the table should differ." +msgstr "" +"increment_size(可选 — 默认是 1):对表" +"随后的调用应该区分的值。" #. Tag: para -#, no-c-format -msgid "optimizer (optional - defaults to ): See " -msgstr "optimizer(可选 — 默认是 ):请参考 。" +#: basic_mapping.xml:1390 +#, fuzzy, no-c-format +msgid "" +"optimizer (optional - defaults to ??): " +"See ." +msgstr "" +"optimizer(可选 — 默认是 ):请参考 " +"。" #. Tag: title +#: basic_mapping.xml:1397 #, no-c-format msgid "Identifier generator optimization" msgstr "标识符生成器的优化" #. Tag: para -#, no-c-format -msgid "For identifier generators that store values in the database, it is inefficient for them to hit the database on each and every call to generate a new identifier value. Instead, you can group a bunch of them in memory and only hit the database when you have exhausted your in-memory value group. This is the role of the pluggable optimizers. Currently only the two enhanced generators ( support this operation." -msgstr "对于在数据库里存储值的标识符生成器,生成新标识符时的每次调用都访问数据库是低效的。因此,你可以把它们在内存里分组并只有在快用光内存时才访问数据库。这是可插拔 optimizer 的任务。目前只有两个增强型的生成器支持这个操作()。 " +#: basic_mapping.xml:1399 +#, fuzzy, no-c-format +msgid "" +"For identifier generators that store values in the database, it is " +"inefficient for them to hit the database on each and every call to generate " +"a new identifier value. Instead, you can group a bunch of them in memory and " +"only hit the database when you have exhausted your in-memory value group. " +"This is the role of the pluggable optimizers. Currently only the two " +"enhanced generators ( " +"support this operation." +msgstr "" +"对于在数据库里存储值的标识符生成器,生成新标识符时的每次调用都访问数据库是低" +"效的。因此,你可以把它们在内存里分组并只有在快用光内存时才访问数据库。这是可" +"插拔 optimizer 的任务。目前只有两个增强型的生成器支持这个操作()。 " #. Tag: para +#: basic_mapping.xml:1410 #, no-c-format -msgid "none (generally this is the default if no optimizer was specified): this will not perform any optimizations and hit the database for each and every request." -msgstr "none(如果没有指定 optimizer,通常这是缺省配置):这不会执行任何优化,在每次请求时都访问数据库。" +msgid "" +"none (generally this is the default if no optimizer was " +"specified): this will not perform any optimizations and hit the database for " +"each and every request." +msgstr "" +"none(如果没有指定 optimizer,通常这是缺省配置):这不会执" +"行任何优化,在每次请求时都访问数据库。" #. Tag: para +#: basic_mapping.xml:1417 #, no-c-format -msgid "hilo: applies a hi/lo algorithm around the database retrieved values. The values from the database for this optimizer are expected to be sequential. The values retrieved from the database structure for this optimizer indicates the \"group number\". The increment_size is multiplied by that value in memory to define a group \"hi value\"." -msgstr "hilo:对从数据库获取的值应用 hi/lo 算法。用于这个 optimizer 的从数据库获取的值应该是有序的。它们表明“组编号”。increment_size 将乘以内存里的值来定义组的“hi 值”。" +msgid "" +"hilo: applies a hi/lo algorithm around the database " +"retrieved values. The values from the database for this optimizer are " +"expected to be sequential. The values retrieved from the database structure " +"for this optimizer indicates the \"group number\". The " +"increment_size is multiplied by that value in memory to " +"define a group \"hi value\"." +msgstr "" +"hilo:对从数据库获取的值应用 hi/lo 算法。用于这个 " +"optimizer 的从数据库获取的值应该是有序的。它们表明“组编号”。" +"increment_size 将乘以内存里的值来定义组的“hi 值”。" #. Tag: para +#: basic_mapping.xml:1427 #, no-c-format -msgid "pooled: as with the case of hilo, this optimizer attempts to minimize the number of hits to the database. Here, however, we simply store the starting value for the \"next group\" into the database structure rather than a sequential value in combination with an in-memory grouping algorithm. Here, increment_size refers to the values coming from the database." -msgstr "pooled:和 hilo 一样,这个 optimizer 试图最小化对数据库的访问。然而,我们只是简单地把“下一组”的起始值而不是把序列值和分组算法的组合存入到数据库结构里。在这里,increment_size 表示数据库里的值。" +msgid "" +"pooled: as with the case of hilo, this " +"optimizer attempts to minimize the number of hits to the database. Here, " +"however, we simply store the starting value for the \"next group\" into the " +"database structure rather than a sequential value in combination with an in-" +"memory grouping algorithm. Here, increment_size refers to " +"the values coming from the database." +msgstr "" +"pooled:和 hilo 一样,这个 optimizer 试" +"图最小化对数据库的访问。然而,我们只是简单地把“下一组”的起始值而不是把序列值" +"和分组算法的组合存入到数据库结构里。在这里,increment_size 表示数据库里的值。" #. Tag: title -#, no-c-format -msgid "composite-id" -msgstr "composite-id" +#: basic_mapping.xml:1441 +#, fuzzy, no-c-format +msgid "Partial identifier generation" +msgstr "增强的标识符生成器" #. Tag: para +#: basic_mapping.xml:1443 #, no-c-format -msgid "A table with a composite key can be mapped with multiple properties of the class as identifier properties. The <composite-id> element accepts <key-property> property mappings and <key-many-to-one> mappings as child elements." -msgstr "如果表使用联合主键,你可以映射类的多个属性为标识符属性。<composite-id> 元素接受 <key-property> 属性映射和 <key-many-to-one> 属性映射作为子元素。 " +msgid "" +"Hibernate supports the automatic generation of some of the identifier " +"properties. Simply use the @GeneratedValue annotation " +"on one or several id properties." +msgstr "" #. Tag: para +#: basic_mapping.xml:1449 #, no-c-format -msgid "The persistent class must override equals() and hashCode() to implement composite identifier equality. It must also implement Serializable." -msgstr "你的持久化类必须覆盖 equals()hashCode() 方法,来实现组合的标识符的相等判断。实现 Serializable 接口也是必须的。" +msgid "" +"The Hibernate team has always felt such a construct as fundamentally wrong. " +"Try hard to fix your data model before using this feature." +msgstr "" + +#. Tag: programlisting +#: basic_mapping.xml:1454 +#, no-c-format +msgid "" +"@Entity\n" +"public class CustomerInventory implements Serializable {\n" +" @Id\n" +" @TableGenerator(name = \"inventory\",\n" +" table = \"U_SEQUENCES\",\n" +" pkColumnName = \"S_ID\",\n" +" valueColumnName = \"S_NEXTNUM\",\n" +" pkColumnValue = \"inventory\",\n" +" allocationSize = 1000)\n" +" @GeneratedValue(strategy = GenerationType.TABLE, generator = \"inventory" +"\")\n" +" Integer id;\n" +"\n" +"\n" +" @Id @ManyToOne(cascade = CascadeType.MERGE)\n" +" Customer customer;\n" +"}\n" +"\n" +"@Entity\n" +"public class Customer implements Serializable {\n" +" @Id\n" +" private int id;\n" +"}" +msgstr "" #. Tag: para +#: basic_mapping.xml:1456 #, no-c-format -msgid "Unfortunately, this approach means that a persistent object is its own identifier. There is no convenient \"handle\" other than the object itself. You must instantiate an instance of the persistent class itself and populate its identifier properties before you can load() the persistent state associated with a composite key. We call this approach an embedded composite identifier, and discourage it for serious applications." -msgstr "不幸的是,这种组合关键字的方法意味着一个持久化类是它自己的标识。除了对象自己之外,没有什么方便的“把手”可用。你必须初始化持久化类的实例,填充它的标识符属性,再 load() 组合关键字关联的持久状态。我们把这种方法称为 embedded(嵌入式)的组合标识符,在重要的应用中不鼓励使用这种用法。 " - -#. Tag: para -#, no-c-format -msgid "A second approach is what we call a mapped composite identifier, where the identifier properties named inside the <composite-id> element are duplicated on both the persistent class and a separate identifier class." -msgstr "第二种方法我们称为 mapped(映射式)组合标识符(mapped composite identifier),<composite-id> 元素中列出的标识属性不但在持久化类出现,还形成一个独立的标识符类。" - -#. Tag: para -#, no-c-format -msgid "In this example, both the composite identifier class, MedicareId, and the entity class itself have properties named medicareNumber and dependent. The identifier class must override equals() and hashCode() and implement Serializable. The main disadvantage of this approach is code duplication." -msgstr "在这个例子中,组合标识符类 MedicareId 和实体类都含有 medicareNumberdependent 属性。标识符类必须重载 equals()hashCode() 并且实现 Serializable 接口。这种方法的缺点是出现了明显的代码重复。" - -#. Tag: para -#, no-c-format -msgid "The following attributes are used to specify a mapped composite identifier:" -msgstr "下面列出的属性是用来指定一个映射式组合标识符的:" - -#. Tag: para -#, no-c-format -msgid "mapped (optional - defaults to false): indicates that a mapped composite identifier is used, and that the contained property mappings refer to both the entity class and the composite identifier class." -msgstr "mapped(可选,默认为 false):指明使用一个映射式组合标识符,其包含的属性映射同时在实体类和组合标识符类中出现。 " - -#. Tag: para -#, no-c-format -msgid "class (optional - but required for a mapped composite identifier): the class used as a composite identifier." -msgstr "class(可选,但对映射式组合标识符必须指定):作为组合标识符类使用的类名。" - -#. Tag: para -#, no-c-format -msgid "We will describe a third, even more convenient approach, where the composite identifier is implemented as a component class in . The attributes described below apply only to this alternative approach:" -msgstr "在 一节中,我们会描述第三种方式,那就是把组合标识符实现为一个组件(component)类,这是更方便的方法。下面的属性仅对第三种方法有效: " - -#. Tag: para -#, no-c-format -msgid "name (optional - required for this approach): a property of component type that holds the composite identifier. Please see chapter 9 for more information." -msgstr "name(可选,但对这种方法而言必须):包含此组件标识符的组件类型的名字(参阅第 9 章)。" - -#. Tag: para -#, no-c-format -msgid "access (optional - defaults to property): the strategy Hibernate uses for accessing the property value." -msgstr "access(可选 — 默认为 property):Hibernate 用来访问属性值的策略。 " - -#. Tag: para -#, no-c-format -msgid "class (optional - defaults to the property type determined by reflection): the component class used as a composite identifier. Please see the next section for more information." -msgstr "class(可选 — 默认会用反射来自动判定属性类型 ):用来作为组合标识符的组件类的类名(参阅下一节)。 " - -#. Tag: para -#, no-c-format -msgid "The third approach, an identifier component, is recommended for almost all applications." -msgstr "第三种方式,被称为 identifier component(标识符组件)是我们对几乎所有应用都推荐使用的方式。 " +msgid "" +"You can also generate properties inside an @EmbeddedId class." +msgstr "" #. Tag: title +#: basic_mapping.xml:1462 #, no-c-format -msgid "Discriminator" -msgstr "鉴别器(discriminator) " +msgid "Optimistic locking properties (optional)" +msgstr "" #. Tag: para +#: basic_mapping.xml:1464 #, no-c-format -msgid "The <discriminator> element is required for polymorphic persistence using the table-per-class-hierarchy mapping strategy. It declares a discriminator column of the table. The discriminator column contains marker values that tell the persistence layer what subclass to instantiate for a particular row. A restricted set of types can be used: string, character, integer, byte, short, boolean, yes_no, true_false." -msgstr "在\"一棵对象继承树对应一个表\"的策略中,<discriminator> 元素是必需的,它定义了表的鉴别器字段。鉴别器字段包含标志值,用于告知持久化层应该为某个特定的行创建哪一个子类的实例。如下这些受到限制的类型可以使用:stringcharacterintegerbyteshortbooleanyes_notrue_false。" +msgid "" +"When using long transactions or conversations that span several database " +"transactions, it is useful to store versioning data to ensure that if the " +"same entity is updated by two conversations, the last to commit changes will " +"be informed and not override the other conversation's work. It guarantees " +"some isolation while still allowing for good scalability and works " +"particularly well in read-often write-sometimes situations." +msgstr "" #. Tag: para +#: basic_mapping.xml:1472 #, no-c-format -msgid "column (optional - defaults to class): the name of the discriminator column." -msgstr "column(可选 — 默认为 class)discriminator 器字段的名字。" +msgid "You can use two approaches: a dedicated version number or a timestamp." +msgstr "" #. Tag: para +#: basic_mapping.xml:1475 #, no-c-format -msgid "type (optional - defaults to string): a name that indicates the Hibernate type" -msgstr "type(可选 — 默认为 string)一个 Hibernate 字段类型的名字 " - -#. Tag: para -#, no-c-format -msgid "force (optional - defaults to false): \"forces\" Hibernate to specify the allowed discriminator values, even when retrieving all instances of the root class." -msgstr "force(强制)(可选 — 默认为 false)\"强制\" Hibernate 指定允许的鉴别器值,即使当取得的所有实例都是根类的。 " - -#. Tag: para -#, no-c-format -msgid "insert (optional - defaults to true): set this to false if your discriminator column is also part of a mapped composite identifier. It tells Hibernate not to include the column in SQL INSERTs." -msgstr "insert(可选 - 默认为true)如果你的鉴别器字段也是映射为复合标识(composite identifier)的一部分,则需将这个值设为 false。(告诉 Hibernate 在做 SQL INSERT 时不包含该列) " - -#. Tag: para -#, no-c-format -msgid "formula (optional): an arbitrary SQL expression that is executed when a type has to be evaluated. It allows content-based discrimination." -msgstr "formula(可选)一个 SQL 表达式,在类型判断(判断是父类还是具体子类 — 译注)时执行。可用于基于内容的鉴别器。 " - -#. Tag: para -#, no-c-format -msgid "Actual values of the discriminator column are specified by the discriminator-value attribute of the <class> and <subclass> elements." -msgstr "鉴别器字段的实际值是根据 <class><subclass> 元素中的 discriminator-value 属性得来的。" - -#. Tag: para -#, no-c-format -msgid "The force attribute is only useful if the table contains rows with \"extra\" discriminator values that are not mapped to a persistent class. This will not usually be the case." -msgstr "force 属性仅仅在这种情况下有用的:表中包含没有被映射到持久化类的附加辨别器值。这种情况不会经常遇到。 " - -#. Tag: para -#, no-c-format -msgid "The formula attribute allows you to declare an arbitrary SQL expression that will be used to evaluate the type of a row. For example:" -msgstr "使用 formula 属性你可以定义一个 SQL 表达式,用来判断一行数据的类型。" +msgid "" +"A version or timestamp property should never be null for a detached " +"instance. Hibernate will detect any instance with a null version or " +"timestamp as transient, irrespective of what other unsaved-value strategies are specified. Declaring a nullable version or " +"timestamp property is an easy way to avoid problems with transitive " +"reattachment in Hibernate. It is especially useful for people using assigned " +"identifiers or composite keys." +msgstr "" +"一个脱管(detached)实例的 version 或 timestamp 属性不能为空(null),因为 " +"Hibernate 不管 unsaved-value 被指定为何种策略,它将任何属" +"性为空的 version 或 timestamp 实例看作为瞬时(transient)实例。 避" +"免 Hibernate 中的传递重附(transitive reattachment)问题的一个简单方法是 定义" +"一个不能为空的 version 或 timestamp 属性,特别是在人们使用程序分配的标识符" +"(assigned identifiers) 或复合主键时非常有用。" #. Tag: title +#: basic_mapping.xml:1485 #, no-c-format -msgid "Version (optional)" -msgstr "版本(version)(可选) " +msgid "Version number" +msgstr "" #. Tag: para +#: basic_mapping.xml:1487 #, no-c-format -msgid "The <version> element is optional and indicates that the table contains versioned data. This is particularly useful if you plan to use long transactions. See below for more information:" -msgstr "<version> 元素是可选的,表明表中包含附带版本信息的数据。这在你准备使用 长事务(long transactions)的时候特别有用。下面是更多信息:" +msgid "" +"You can add optimistic locking capability to an entity using the " +"@Version annotation:" +msgstr "" + +#. Tag: programlisting +#: basic_mapping.xml:1490 +#, no-c-format +msgid "" +"@Entity\n" +"public class Flight implements Serializable {\n" +"...\n" +" @Version\n" +" @Column(name=\"OPTLOCK\")\n" +" public Integer getVersion() { ... }\n" +"}" +msgstr "" #. Tag: para +#: basic_mapping.xml:1492 #, no-c-format -msgid "column (optional - defaults to the property name): the name of the column holding the version number." -msgstr "column(可选 — 默认为属性名):指定持有版本号的字段名。 " +msgid "" +"The version property will be mapped to the OPTLOCK " +"column, and the entity manager will use it to detect conflicting updates " +"(preventing lost updates you might otherwise see with the last-commit-wins " +"strategy)." +msgstr "" #. Tag: para +#: basic_mapping.xml:1497 #, no-c-format -msgid "name: the name of a property of the persistent class." +msgid "" +"The version column may be a numeric. Hibernate supports any kind of type " +"provided that you define and implement the appropriate " +"UserVersionType." +msgstr "" + +#. Tag: para +#: basic_mapping.xml:1501 +#, no-c-format +msgid "" +"The application must not alter the version number set up by Hibernate in any " +"way. To artificially increase the version number, check in Hibernate Entity " +"Manager's reference documentation LockModeType." +"OPTIMISTIC_FORCE_INCREMENT or LockModeType." +"PESSIMISTIC_FORCE_INCREMENT." +msgstr "" + +#. Tag: para +#: basic_mapping.xml:1507 +#, no-c-format +msgid "" +"If the version number is generated by the database (via a trigger for " +"example), make sure to use @org.hibernate.annotations.Generated" +"(GenerationTime.ALWAYS)." +msgstr "" + +#. Tag: para +#: basic_mapping.xml:1511 +#, no-c-format +msgid "To declare a version property in hbm.xml, use:" +msgstr "" + +#. Tag: programlisting +#: basic_mapping.xml:1530 +#, fuzzy, no-c-format +msgid "" +"<version\n" +" column=\"version_column\"\n" +" name=\"propertyName\"\n" +" type=\"typename\"\n" +" access=\"field|property|ClassName\"\n" +" unsaved-value=\"null|negative|undefined\"\n" +" generated=\"never|always\"\n" +" insert=\"true|false\"\n" +" node=\"element-name|@attribute-name|element/@attribute|.\"\n" +"/>" +msgstr "" +"]]>" + +#. Tag: para +#: basic_mapping.xml:1534 +#, no-c-format +msgid "" +"column (optional - defaults to the property name): the " +"name of the column holding the version number." +msgstr "" +"column(可选 — 默认为属性名):指定持有版本号的字段名。 " + +#. Tag: para +#: basic_mapping.xml:1540 +#, no-c-format +msgid "" +"name: the name of a property of the persistent class." msgstr "name:持久化类的属性名。 " #. Tag: para +#: basic_mapping.xml:1545 #, no-c-format -msgid "type (optional - defaults to integer): the type of the version number." -msgstr "type(可选 — 默认是 integer):版本号的类型。 " +msgid "" +"type (optional - defaults to integer): " +"the type of the version number." +msgstr "" +"type(可选 — 默认是 integer):版本号的" +"类型。 " #. Tag: para +#: basic_mapping.xml:1551 #, no-c-format -msgid "access (optional - defaults to property): the strategy Hibernate uses to access the property value." -msgstr "access(可选 — 默认为 property):Hibernate 用来访问属性值的策略。 " +msgid "" +"access (optional - defaults to property): the strategy Hibernate uses to access the property value." +msgstr "" +"access(可选 — 默认为 property):" +"Hibernate 用来访问属性值的策略。 " #. Tag: para +#: basic_mapping.xml:1557 #, no-c-format -msgid "unsaved-value (optional - defaults to undefined): a version property value that indicates that an instance is newly instantiated (unsaved), distinguishing it from detached instances that were saved or loaded in a previous session. Undefined specifies that the identifier property value should be used." -msgstr "unsaved-value(可选 — 默认是 undefined):用于标明某个实例时刚刚被实例化的(尚未保存)版本属性值,依靠这个值就可以把这种情况 和已经在先前的 session 中保存或装载的脱管(detached)实例区分开来。(undefined 指明应被使用的标识属性值。) " +msgid "" +"unsaved-value (optional - defaults to undefined): a version property value that indicates that an instance is newly " +"instantiated (unsaved), distinguishing it from detached instances that were " +"saved or loaded in a previous session. Undefined " +"specifies that the identifier property value should be used." +msgstr "" +"unsaved-value(可选 — 默认是 undefined):用于标明某个实例时刚刚被实例化的(尚未保存)版本属性值,依靠这个" +"值就可以把这种情况 和已经在先前的 session 中保存或装载的脱管(detached)实例" +"区分开来。(undefined 指明应被使用的标识属性值。) " #. Tag: para +#: basic_mapping.xml:1567 #, no-c-format -msgid "generated (optional - defaults to never): specifies that this version property value is generated by the database. See the discussion of generated properties for more information." -msgstr "generated(可选 — 默认是 never):表明此版本属性值是否实际上是由数据库生成的。请参阅 generated properties 部分的讨论。 " +msgid "" +"generated (optional - defaults to never): specifies that this version property value is generated by the " +"database. See the discussion of generated properties for more information." +msgstr "" +"generated(可选 — 默认是 never):表明" +"此版本属性值是否实际上是由数据库生成的。请参阅 generated properties 部分的讨论。 " #. Tag: para +#: basic_mapping.xml:1575 #, no-c-format -msgid "insert (optional - defaults to true): specifies whether the version column should be included in SQL insert statements. It can be set to false if the database column is defined with a default value of 0." -msgstr "insert(可选 — 默认是 true):表明此版本列应该包含在 SQL 插入语句中。只有当数据库字段有默认值 0 的时候,才可以设置为 false。 " - -#. Tag: para -#, no-c-format -msgid "Version numbers can be of Hibernate type long, integer, short, timestamp or calendar." -msgstr "版本号必须是以下类型:longintegershorttimestamp 或者 calendar。" - -#. Tag: para -#, no-c-format -msgid "A version or timestamp property should never be null for a detached instance. Hibernate will detect any instance with a null version or timestamp as transient, irrespective of what other unsaved-value strategies are specified. Declaring a nullable version or timestamp property is an easy way to avoid problems with transitive reattachment in Hibernate. It is especially useful for people using assigned identifiers or composite keys." -msgstr "一个脱管(detached)实例的 version 或 timestamp 属性不能为空(null),因为 Hibernate 不管 unsaved-value 被指定为何种策略,它将任何属性为空的 version 或 timestamp 实例看作为瞬时(transient)实例。 避免 Hibernate 中的传递重附(transitive reattachment)问题的一个简单方法是 定义一个不能为空的 version 或 timestamp 属性,特别是在人们使用程序分配的标识符(assigned identifiers) 或复合主键时非常有用。" +msgid "" +"insert (optional - defaults to true): " +"specifies whether the version column should be included in SQL insert " +"statements. It can be set to false if the database column " +"is defined with a default value of 0." +msgstr "" +"insert(可选 — 默认是 true):表明此版" +"本列应该包含在 SQL 插入语句中。只有当数据库字段有默认值 0 " +"的时候,才可以设置为 false。 " #. Tag: title -#, no-c-format -msgid "Timestamp (optional)" +#: basic_mapping.xml:1586 +#, fuzzy, no-c-format +msgid "Timestamp" msgstr "timestamp(可选) " #. Tag: para -#, no-c-format -msgid "The optional <timestamp> element indicates that the table contains timestamped data. This provides an alternative to versioning. Timestamps are a less safe implementation of optimistic locking. However, sometimes the application might use the timestamps in other ways." -msgstr "可选的 <timestamp> 元素指明了表中包含时间戳数据。这用来作为版本的替代。时间戳本质上是一种对乐观锁定的一种不是特别安全的实现。当然,有时候应用程序可能在其他方面使用时间戳。 " +#: basic_mapping.xml:1588 +#, fuzzy, no-c-format +msgid "" +"Alternatively, you can use a timestamp. Timestamps are a less safe " +"implementation of optimistic locking. However, sometimes the application " +"might use the timestamps in other ways." +msgstr "" +"可选的 <timestamp> 元素指明了表中包含时间戳数据。这" +"用来作为版本的替代。时间戳本质上是一种对乐观锁定的一种不是特别安全的实现。当" +"然,有时候应用程序可能在其他方面使用时间戳。 " #. Tag: para +#: basic_mapping.xml:1592 #, no-c-format -msgid "column (optional - defaults to the property name): the name of a column holding the timestamp." -msgstr "column(可选 — 默认为属性名):存有时间戳的字段名。 " +msgid "" +"Simply mark a property of type Date or " +"Calendar as @Version." +msgstr "" + +#. Tag: programlisting +#: basic_mapping.xml:1596 +#, no-c-format +msgid "" +"@Entity\n" +"public class Flight implements Serializable {\n" +"...\n" +" @Version\n" +" public Date getLastUpdate() { ... }\n" +"}" +msgstr "" #. Tag: para +#: basic_mapping.xml:1598 #, no-c-format -msgid "name: the name of a JavaBeans style property of Java type Date or Timestamp of the persistent class." -msgstr "name:在持久化类中的 JavaBeans 风格的属性名,其 Java 类型是 Date 或者 Timestamp 的。 " +msgid "" +"Like version numbers, the timestamp can be generated by the database instead " +"of Hibernate. To do that, use @org.hibernate.annotations.Generated" +"(GenerationTime.ALWAYS)." +msgstr "" #. Tag: para -#, no-c-format -msgid "unsaved-value (optional - defaults to null): a version property value that indicates that an instance is newly instantiated (unsaved), distinguishing it from detached instances that were saved or loaded in a previous session. Undefined specifies that the identifier property value should be used." -msgstr "unsaved-value(可选 — 默认是 null):用于标明某个实例时刚刚被实例化的(尚未保存)版本属性值,依靠这个值就可以把这种情况和已经在先前的 session 中保存或装载的脱管(detached)实例区分开来。(undefined 指明使用标识属性值进行这种判断。) " +#: basic_mapping.xml:1602 +#, fuzzy, no-c-format +msgid "In hbm.xml, use the <timestamp> element:" +msgstr "例如,如果我们有如下的 <properties> 映射:" + +#. Tag: programlisting +#: basic_mapping.xml:1620 +#, fuzzy, no-c-format +msgid "" +"<timestamp\n" +" column=\"timestamp_column\"\n" +" name=\"propertyName\"\n" +" access=\"field|property|ClassName\"\n" +" unsaved-value=\"null|undefined\"\n" +" source=\"vm|db\"\n" +" generated=\"never|always\"\n" +" node=\"element-name|@attribute-name|element/@attribute|.\"\n" +"/>" +msgstr "" +"]]>" #. Tag: para +#: basic_mapping.xml:1624 #, no-c-format -msgid "source (optional - defaults to vm): Where should Hibernate retrieve the timestamp value from? From the database, or from the current JVM? Database-based timestamps incur an overhead because Hibernate must hit the database in order to determine the \"next value\". It is safer to use in clustered environments. Not all Dialects are known to support the retrieval of the database's current timestamp. Others may also be unsafe for usage in locking due to lack of precision (Oracle 8, for example)." -msgstr "source(可选 — 默认是 vm):Hibernate 如何才能获取到时间戳的值呢?从数据库,还是当前 JVM?从数据库获取会带来一些负担,因为 Hibernate 必须访问数据库来获得“下一个值”,但是在集群环境中会更安全些。还要注意,并不是所有的 Dialect(方言)都支持获得数据库的当前时间戳的,而支持的数据库中又有一部分因为精度不足,用于锁定是不安全的(例如 Oracle 8)。 " +msgid "" +"column (optional - defaults to the property name): the " +"name of a column holding the timestamp." +msgstr "" +"column(可选 — 默认为属性名):存有时间戳的字段名。 " #. Tag: para +#: basic_mapping.xml:1630 #, no-c-format -msgid "generated (optional - defaults to never): specifies that this timestamp property value is actually generated by the database. See the discussion of generated properties for more information." -msgstr "generated(可选 - 默认是 never):指出时间戳值是否实际上是由数据库生成的。请参阅 generated properties 的讨论。 " +msgid "" +"name: the name of a JavaBeans style property of Java type " +"Date or Timestamp of the persistent " +"class." +msgstr "" +"name:在持久化类中的 JavaBeans 风格的属性名,其 Java 类型" +"是 Date 或者 Timestamp 的。 " + +#. Tag: para +#: basic_mapping.xml:1636 basic_mapping.xml:2163 basic_mapping.xml:2380 +#: basic_mapping.xml:3226 basic_mapping.xml:3420 basic_mapping.xml:3593 +#, no-c-format +msgid "" +"access (optional - defaults to property): the strategy Hibernate uses for accessing the property value." +msgstr "" +"access(可选 — 默认为 property):" +"Hibernate 用来访问属性值的策略。 " + +#. Tag: para +#: basic_mapping.xml:1642 +#, no-c-format +msgid "" +"unsaved-value (optional - defaults to null): a version property value that indicates that an instance is newly " +"instantiated (unsaved), distinguishing it from detached instances that were " +"saved or loaded in a previous session. Undefined " +"specifies that the identifier property value should be used." +msgstr "" +"unsaved-value(可选 — 默认是 null):用" +"于标明某个实例时刚刚被实例化的(尚未保存)版本属性值,依靠这个值就可以把这种" +"情况和已经在先前的 session 中保存或装载的脱管(detached)实例区分开来。" +"(undefined 指明使用标识属性值进行这种判断。) " + +#. Tag: para +#: basic_mapping.xml:1652 +#, no-c-format +msgid "" +"source (optional - defaults to vm): " +"Where should Hibernate retrieve the timestamp value from? From the database, " +"or from the current JVM? Database-based timestamps incur an overhead because " +"Hibernate must hit the database in order to determine the \"next value\". It " +"is safer to use in clustered environments. Not all Dialects are known to support the retrieval of the database's current " +"timestamp. Others may also be unsafe for usage in locking due to lack of " +"precision (Oracle 8, for example)." +msgstr "" +"source(可选 — 默认是 vm):Hibernate " +"如何才能获取到时间戳的值呢?从数据库,还是当前 JVM?从数据库获取会带来一些负" +"担,因为 Hibernate 必须访问数据库来获得“下一个值”,但是在集群环境中会更安全" +"些。还要注意,并不是所有的 Dialect(方言)都支持获得数据库" +"的当前时间戳的,而支持的数据库中又有一部分因为精度不足,用于锁定是不安全的" +"(例如 Oracle 8)。 " + +#. Tag: para +#: basic_mapping.xml:1665 +#, no-c-format +msgid "" +"generated (optional - defaults to never): specifies that this timestamp property value is actually " +"generated by the database. See the discussion of generated properties for more information." +msgstr "" +"generated(可选 - 默认是 never):指出" +"时间戳值是否实际上是由数据库生成的。请参阅 generated properties 的讨论。 " #. Tag: title +#: basic_mapping.xml:1675 #, no-c-format msgid "Note" msgstr "注意" #. Tag: para +#: basic_mapping.xml:1677 #, no-c-format -msgid "<Timestamp> is equivalent to <version type=\"timestamp\">. And <timestamp source=\"db\"> is equivalent to <version type=\"dbtimestamp\">" -msgstr "注意,<timestamp><version type=\"timestamp\"> 是等价的。并且 <timestamp source=\"db\"><version type=\"dbtimestamp\"> 是等价的。 " +msgid "" +"<Timestamp> is equivalent to <version " +"type=\"timestamp\">. And <timestamp source=\"db" +"\"> is equivalent to <version type=\"dbtimestamp" +"\">" +msgstr "" +"注意,<timestamp><version type=" +"\"timestamp\"> 是等价的。并且 <timestamp source=\"db" +"\"><version type=\"dbtimestamp\"> " +"是等价的。 " #. Tag: title +#: basic_mapping.xml:1686 #, no-c-format msgid "Property" msgstr "Property" #. Tag: para +#: basic_mapping.xml:1688 #, no-c-format -msgid "The <property> element declares a persistent JavaBean style property of the class." -msgstr "<property> 元素为类定义了一个持久化的、JavaBean 风格的属性。 " +msgid "" +"You need to decide which property needs to be made persistent in a given " +"entity. This differs slightly between the annotation driven metadata and the " +"hbm.xml files." +msgstr "" + +#. Tag: title +#: basic_mapping.xml:1693 +#, no-c-format +msgid "Property mapping with annotations" +msgstr "" #. Tag: para +#: basic_mapping.xml:1695 #, no-c-format -msgid "name: the name of the property, with an initial lowercase letter." -msgstr "name:属性的名字,以小写字母开头。" +msgid "" +"In the annotations world, every non static non transient property (field or " +"method depending on the access type) of an entity is considered persistent, " +"unless you annotate it as @Transient. Not having an " +"annotation for your property is equivalent to the appropriate " +"@Basic annotation." +msgstr "" #. Tag: para +#: basic_mapping.xml:1702 #, no-c-format -msgid "column (optional - defaults to the property name): the name of the mapped database table column. This can also be specified by nested <column> element(s)." -msgstr "column(可选 — 默认为属性名字):对应的数据库字段名。 也可以通过嵌套的 <column> 元素指定。 " +msgid "" +"The @Basic annotation allows you to declare the fetching " +"strategy for a property. If set to LAZY, specifies that " +"this property should be fetched lazily when the instance variable is first " +"accessed. It requires build-time bytecode instrumentation, if your classes " +"are not instrumented, property level lazy loading is silently ignored. The " +"default is EAGER. You can also mark a property as not " +"optional thanks to the @Basic.optional attribute. " +"This will ensure that the underlying column are not nullable (if possible). " +"Note that a better approach is to use the @NotNull " +"annotation of the Bean Validation specification." +msgstr "" #. Tag: para +#: basic_mapping.xml:1715 #, no-c-format -msgid "update, insert (optional - defaults to true): specifies that the mapped columns should be included in SQL UPDATE and/or INSERT statements. Setting both to false allows a pure \"derived\" property whose value is initialized from some other property that maps to the same column(s), or by a trigger or other application." -msgstr "update, insert(可选 — 默认为 true): 表明用于 UPDATE 和/或 INSERT 的 SQL 语句中是否包含这个被映射了的字段。这二者如果都设置为 false 则表明这是一个“外源性(derived)”的属性,它的值来源于映射到同一个(或多个) 字段的某些其他属性,或者通过一个 trigger(触发器)或其他程序生成。 " +msgid "Let's look at a few examples:" +msgstr "" + +#. Tag: programlisting +#: basic_mapping.xml:1717 +#, no-c-format +msgid "" +"public transient int counter; //transient property\n" +"\n" +"private String firstname; //persistent property\n" +"\n" +"@Transient\n" +"String getLengthInMeter() { ... } //transient property\n" +"\n" +"String getName() {... } // persistent property\n" +"\n" +"@Basic\n" +"int getLength() { ... } // persistent property\n" +"\n" +"@Basic(fetch = FetchType.LAZY)\n" +"String getDetailedComment() { ... } // persistent property\n" +"\n" +"@Temporal(TemporalType.TIME)\n" +"java.util.Date getDepartureTime() { ... } // persistent property \n" +"\n" +"@Enumerated(EnumType.STRING)\n" +"Starred getNote() { ... } //enum persisted as String in database" +msgstr "" #. Tag: para +#: basic_mapping.xml:1719 #, no-c-format -msgid "formula (optional): an SQL expression that defines the value for a computed property. Computed properties do not have a column mapping of their own." -msgstr "formula(可选):一个 SQL 表达式,定义了这个计算 (computed) 属性的值。计算属性没有和它对应的数据库字段。" +msgid "" +"counter, a transient field, and lengthInMeter, a method annotated as @Transient, and will be " +"ignored by the Hibernate. name, length, and firstname properties are mapped persistent " +"and eagerly fetched (the default for simple properties). The " +"detailedComment property value will be lazily fetched " +"from the database once a lazy property of the entity is accessed for the " +"first time. Usually you don't need to lazy simple properties (not to be " +"confused with lazy association fetching). The recommended alternative is to " +"use the projection capability of JP-QL (Java Persistence Query Language) or " +"Criteria queries." +msgstr "" #. Tag: para +#: basic_mapping.xml:1732 #, no-c-format -msgid "lazy (optional - defaults to false): specifies that this property should be fetched lazily when the instance variable is first accessed. It requires build-time bytecode instrumentation." -msgstr "lazy(可选 — 默认为 false):指定 指定实例变量第一次被访问时,这个属性是否延迟抓取(fetched lazily)( 需要运行时字节码增强)。 " +msgid "" +"JPA support property mapping of all basic types supported by Hibernate (all " +"basic Java types , their respective wrappers and serializable classes). " +"Hibernate Annotations supports out of the box enum type mapping either into " +"a ordinal column (saving the enum ordinal) or a string based column (saving " +"the enum string representation): the persistence representation, defaulted " +"to ordinal, can be overridden through the @Enumerated " +"annotation as shown in the note property example." +msgstr "" #. Tag: para +#: basic_mapping.xml:1742 #, no-c-format -msgid "unique (optional): enables the DDL generation of a unique constraint for the columns. Also, allow this to be the target of a property-ref." -msgstr "unique(可选):使用 DDL 为该字段添加唯一的约束。同样,允许它作为 property-ref 引用的目标。 " +msgid "" +"In plain Java APIs, the temporal precision of time is not defined. When " +"dealing with temporal data you might want to describe the expected precision " +"in database. Temporal data can have DATE, TIME, or TIMESTAMP precision (ie the actual date, " +"only the time, or both). Use the @Temporal annotation to " +"fine tune that." +msgstr "" #. Tag: para +#: basic_mapping.xml:1750 #, no-c-format -msgid "not-null (optional): enables the DDL generation of a nullability constraint for the columns." -msgstr "not-null(可选):使用 DDL 为该字段添加可否为空(nullability)的约束。 " +msgid "" +"@Lob indicates that the property should be persisted in a " +"Blob or a Clob depending on the property type: java.sql.Clob, Character[], char[] and java.lang.String will be persisted in " +"a Clob. java.sql.Blob, Byte[], " +"byte[] and Serializable type " +"will be persisted in a Blob." +msgstr "" + +#. Tag: programlisting +#: basic_mapping.xml:1759 +#, no-c-format +msgid "" +"@Lob\n" +"public String getFullText() {\n" +" return fullText;\n" +"}\n" +"\n" +"@Lob\n" +"public byte[] getFullCode() {\n" +" return fullCode;\n" +"}" +msgstr "" #. Tag: para +#: basic_mapping.xml:1761 #, no-c-format -msgid "optimistic-lock (optional - defaults to true): specifies that updates to this property do or do not require acquisition of the optimistic lock. In other words, it determines if a version increment should occur when this property is dirty." -msgstr "optimistic-lock(可选 — 默认为 true):指定这个属性在做更新时是否需要获得乐观锁定(optimistic lock)。换句话说,它决定这个属性发生脏数据时版本(version)的值是否增长。 " +msgid "" +"If the property type implements java.io.Serializable " +"and is not a basic type, and if the property is not annotated with " +"@Lob, then the Hibernate serializable " +"type is used." +msgstr "" + +#. Tag: title +#: basic_mapping.xml:1768 +#, no-c-format +msgid "Type" +msgstr "" #. Tag: para +#: basic_mapping.xml:1770 #, no-c-format -msgid "generated (optional - defaults to never): specifies that this property value is actually generated by the database. See the discussion of generated properties for more information." -msgstr "generated(可选 — 默认为 never):表明此属性值是否实际上是由数据库生成的。请参阅 generated properties 的讨论。 " +msgid "" +"You can also manually specify a type using the @org.hibernate." +"annotations.Type and some parameters if needed. @Type." +"type could be:" +msgstr "" #. Tag: para +#: basic_mapping.xml:1777 basic_mapping.xml:2209 #, no-c-format -msgid "typename could be:" -msgstr "typename 可以是如下几种:" +msgid "" +"The name of a Hibernate basic type: integer, string, character, " +"date, timestamp, float, binary, serializable, object, blob etc." +msgstr "" +"Hibernate 基本类型名(比如:integer, string, character,date, " +"timestamp, float, binary, serializable, object, blob)。 " #. Tag: para +#: basic_mapping.xml:1783 basic_mapping.xml:2215 #, no-c-format -msgid "The name of a Hibernate basic type: integer, string, character, date, timestamp, float, binary, serializable, object, blob etc." -msgstr "Hibernate 基本类型名(比如:integer, string, character,date, timestamp, float, binary, serializable, object, blob)。 " - -#. Tag: para -#, no-c-format -msgid "The name of a Java class with a default basic type: int, float, char, java.lang.String, java.util.Date, java.lang.Integer, java.sql.Clob etc." -msgstr "一个 Java 类的名字,这个类属于一种默认基础类型(比如:int, float,char, java.lang.String, java.util.Date, java.lang.Integer, java.sql.Clob)。 " +msgid "" +"The name of a Java class with a default basic type: int, float, " +"char, java.lang.String, java.util.Date, java.lang.Integer, java.sql.Clob etc." +msgstr "" +"一个 Java 类的名字,这个类属于一种默认基础类型(比如:int, float," +"char, java.lang.String, java.util.Date, java.lang.Integer, java.sql.Clob)。 " #. Tag: para +#: basic_mapping.xml:1789 basic_mapping.xml:2221 #, no-c-format msgid "The name of a serializable Java class." msgstr "一个可以序列化的 Java 类的名字。" #. Tag: para +#: basic_mapping.xml:1793 basic_mapping.xml:2225 #, no-c-format -msgid "The class name of a custom type: com.illflow.type.MyCustomType etc." -msgstr "一个自定义类型的类的名字。(比如:com.illflow.type.MyCustomType)。 " +msgid "" +"The class name of a custom type: com.illflow.type.MyCustomType etc." +msgstr "" +"一个自定义类型的类的名字。(比如:com.illflow.type.MyCustomType)。 " #. Tag: para -#, no-c-format -msgid "If you do not specify a type, Hibernate will use reflection upon the named property and guess the correct Hibernate type. Hibernate will attempt to interpret the name of the return class of the property getter using, in order, rules 2, 3, and 4. In certain cases you will need the type attribute. For example, to distinguish between Hibernate.DATE and Hibernate.TIMESTAMP, or to specify a custom type." -msgstr "如果你没有指定类型,Hibernarte 会使用反射来得到这个名字的属性,以此来猜测正确的 Hibernate 类型。Hibernate 会按照规则 2,3,4 的顺序对属性读取器(getter方法)的返回类进行解释。然而,这还不够。 在某些情况下你仍然需要 type 属性。(比如,为了区别Hibernate.DATEHibernate.TIMESTAMP,或者为了指定一个自定义类型。) " +#: basic_mapping.xml:1798 +#, fuzzy, no-c-format +msgid "" +"If you do not specify a type, Hibernate will use reflection upon the named " +"property and guess the correct Hibernate type. Hibernate will attempt to " +"interpret the name of the return class of the property getter using, in " +"order, rules 2, 3, and 4." +msgstr "" +"如果你没有指定类型,Hibernarte 会使用反射来得到这个名字的属性,以此来猜测正确" +"的 Hibernate 类型。Hibernate 会按照规则 2,3,4 的顺序对属性读取器(getter方" +"法)的返回类进行解释。然而,这还不够。 在某些情况下你仍然需要 type 属性。(比如,为了区别Hibernate.DATE 和" +"Hibernate.TIMESTAMP,或者为了指定一个自定义类型。) " #. Tag: para +#: basic_mapping.xml:1803 #, no-c-format -msgid "The access attribute allows you to control how Hibernate accesses the property at runtime. By default, Hibernate will call the property get/set pair. If you specify access=\"field\", Hibernate will bypass the get/set pair and access the field directly using reflection. You can specify your own strategy for property access by naming a class that implements the interface org.hibernate.property.PropertyAccessor." -msgstr "access 属性用来让你控制 Hibernate 如何在运行时访问属性。在默认情况下,Hibernate 会使用属性的 get/set 方法对(pair)。如果你指明 access=\"field\",Hibernate 会忽略 get/set 方法对,直接使用反射来访问成员变量。你也可以指定你自己的策略,这就需要你自己实现 org.hibernate.property.PropertyAccessor 接口,再在 access 中设置你自定义策略类的名字。 " +msgid "" +"@org.hibernate.annotations.TypeDef and @org." +"hibernate.annotations.TypeDefs allows you to declare type " +"definitions. These annotations can be placed at the class or package level. " +"Note that these definitions are global for the session factory (even when " +"defined at the class level). If the type is used on a single entity, you can " +"place the definition on the entity itself. Otherwise, it is recommended to " +"place the definition at the package level. In the example below, when " +"Hibernate encounters a property of class PhoneNumer, it " +"delegates the persistence strategy to the custom mapping type " +"PhoneNumberType. However, properties belonging to other " +"classes, too, can delegate their persistence strategy to " +"PhoneNumberType, by explicitly using the @Type annotation." +msgstr "" #. Tag: para +#: basic_mapping.xml:1819 #, no-c-format -msgid "A powerful feature is derived properties. These properties are by definition read-only. The property value is computed at load time. You declare the computation as an SQL expression. This then translates to a SELECT clause subquery in the SQL query that loads an instance:" -msgstr "衍生属性(derive propertie)是一个特别强大的特征。这些属性应该定义为只读,属性值在装载时计算生成。 你用一个 SQL 表达式生成计算的结果,它会在这个实例转载时翻译成一个 SQL 查询的 SELECT 子查询语句。 " +msgid "" +"Package level annotations are placed in a file named package-info." +"java in the appropriate package. Place your annotations before " +"the package declaration." +msgstr "" + +#. Tag: programlisting +#: basic_mapping.xml:1824 +#, no-c-format +msgid "" +"@TypeDef(\n" +" name = \"phoneNumber\",\n" +" defaultForType = PhoneNumber.class,\n" +" typeClass = PhoneNumberType.class\n" +")\n" +"\n" +"@Entity\n" +"public class ContactDetails {\n" +" [...]\n" +" private PhoneNumber localPhoneNumber;\n" +" @Type(type=\"phoneNumber\")\n" +" private OverseasPhoneNumber overseasPhoneNumber;\n" +" [...]\n" +"}" +msgstr "" #. Tag: para +#: basic_mapping.xml:1826 #, no-c-format -msgid "You can reference the entity table by not declaring an alias on a particular column. This would be customerId in the given example. You can also use the nested <formula> mapping element if you do not want to use the attribute." -msgstr "注意,你可以使用实体自己的表,而不用为这个特别的列定义别名(上面例子中的 customerId)。同时注意,如果你不喜欢使用属性, 你可以使用嵌套的 <formula> 映射元素。 " +msgid "" +"The following example shows the usage of the parameters " +"attribute to customize the TypeDef." +msgstr "" + +#. Tag: programlisting +#: basic_mapping.xml:1830 +#, no-c-format +msgid "" +"//in org/hibernate/test/annotations/entity/package-info.java\n" +"@TypeDefs(\n" +" {\n" +" @TypeDef(\n" +" name=\"caster\",\n" +" typeClass = CasterStringType.class,\n" +" parameters = {\n" +" @Parameter(name=\"cast\", value=\"lower\")\n" +" }\n" +" )\n" +" }\n" +")\n" +"package org.hibernate.test.annotations.entity;\n" +"\n" +"//in org/hibernate/test/annotations/entity/Forest.java\n" +"public class Forest {\n" +" @Type(type=\"caster\")\n" +" public String getSmallText() {\n" +" ...\n" +"}" +msgstr "" + +#. Tag: para +#: basic_mapping.xml:1832 +#, no-c-format +msgid "" +"When using composite user type, you will have to express column definitions. " +"The @Columns has been introduced for that purpose." +msgstr "" + +#. Tag: programlisting +#: basic_mapping.xml:1836 +#, no-c-format +msgid "" +"@Type(type=\"org.hibernate.test.annotations.entity.MonetaryAmountUserType" +"\")\n" +"@Columns(columns = {\n" +" @Column(name=\"r_amount\"),\n" +" @Column(name=\"r_currency\")\n" +"})\n" +"public MonetaryAmount getAmount() {\n" +" return amount;\n" +"}\n" +"\n" +"\n" +"public class MonetaryAmount implements Serializable {\n" +" private BigDecimal amount;\n" +" private Currency currency;\n" +" ...\n" +"}" +msgstr "" #. Tag: title +#: basic_mapping.xml:1840 #, no-c-format -msgid "Many-to-one" -msgstr "多对一(many-to-one) " +msgid "Access type" +msgstr "" #. Tag: para +#: basic_mapping.xml:1842 #, no-c-format -msgid "An ordinary association to another persistent class is declared using a many-to-one element. The relational model is a many-to-one association; a foreign key in one table is referencing the primary key column(s) of the target table." -msgstr "通过 many-to-one 元素,可以定义一种常见的与另一个持久化类的关联。这种关系模型是多对一关联(实际上是一个对象引用-译注):这个表的一个外键引用目标表的主键字段。 " +msgid "" +"By default the access type of a class hierarchy is defined by the position " +"of the @Id or @EmbeddedId " +"annotations. If these annotations are on a field, then only fields are " +"considered for persistence and the state is accessed via the field. If there " +"annotations are on a getter, then only the getters are considered for " +"persistence and the state is accessed via the getter/setter. That works well " +"in practice and is the recommended approach." +msgstr "" #. Tag: para +#: basic_mapping.xml:1850 +#, no-c-format +msgid "" +"The placement of annotations within a class hierarchy has to be consistent " +"(either field or on property) to be able to determine the default access " +"type. It is recommended to stick to one single annotation placement strategy " +"throughout your whole application." +msgstr "" + +#. Tag: para +#: basic_mapping.xml:1857 +#, no-c-format +msgid "However in some situations, you need to:" +msgstr "" + +#. Tag: para +#: basic_mapping.xml:1861 +#, no-c-format +msgid "force the access type of the entity hierarchy" +msgstr "" + +#. Tag: para +#: basic_mapping.xml:1865 +#, no-c-format +msgid "override the access type of a specific entity in the class hierarchy" +msgstr "" + +#. Tag: para +#: basic_mapping.xml:1870 +#, no-c-format +msgid "override the access type of an embeddable type" +msgstr "" + +#. Tag: para +#: basic_mapping.xml:1874 +#, no-c-format +msgid "" +"The best use case is an embeddable class used by several entities that might " +"not use the same access type. In this case it is better to force the access " +"type at the embeddable class level." +msgstr "" + +#. Tag: para +#: basic_mapping.xml:1879 +#, no-c-format +msgid "" +"To force the access type on a given class, use the @Access annotation as showed below:" +msgstr "" + +#. Tag: programlisting +#: basic_mapping.xml:1882 +#, no-c-format +msgid "" +"@Entity\n" +"public class Order {\n" +" @Id private Long id;\n" +" public Long getId() { return id; }\n" +" public void setId(Long id) { this.id = id; }\n" +"\n" +" @Embedded private Address address;\n" +" public Address getAddress() { return address; }\n" +" public void setAddress() { this.address = address; }\n" +"}\n" +"\n" +"@Entity\n" +"public class User {\n" +" private Long id;\n" +" @Id public Long getId() { return id; }\n" +" public void setId(Long id) { this.id = id; }\n" +"\n" +" private Address address;\n" +" @Embedded public Address getAddress() { return address; }\n" +" public void setAddress() { this.address = address; }\n" +"}\n" +"\n" +"@Embeddable\n" +"@Access(AcessType.PROPERTY)\n" +"public class Address {\n" +" private String street1;\n" +" public String getStreet1() { return street1; }\n" +" public void setStreet1() { this.street1 = street1; }\n" +"\n" +" private hashCode; //not persistent\n" +"}" +msgstr "" + +#. Tag: para +#: basic_mapping.xml:1884 +#, no-c-format +msgid "" +"You can also override the access type of a single property while keeping the " +"other properties standard." +msgstr "" + +#. Tag: programlisting +#: basic_mapping.xml:1887 +#, no-c-format +msgid "" +"@Entity\n" +"public class Order {\n" +" @Id private Long id;\n" +" public Long getId() { return id; }\n" +" public void setId(Long id) { this.id = id; }\n" +" @Transient private String userId;\n" +" @Transient private String orderId;\n" +"\n" +" @Access(AccessType.PROPERTY)\n" +" public String getOrderNumber() { return userId + \":\" + orderId; }\n" +" public void setOrderNumber() { this.userId = ...; this.orderId = ...; }\n" +"}" +msgstr "" + +#. Tag: para +#: basic_mapping.xml:1889 +#, no-c-format +msgid "" +"In this example, the default access type is FIELD " +"except for the orderNumber property. Note that the " +"corresponding field, if any must be marked as @Transient or transient." +msgstr "" + +#. Tag: title +#: basic_mapping.xml:1896 +#, no-c-format +msgid "@org.hibernate.annotations.AccessType" +msgstr "" + +#. Tag: para +#: basic_mapping.xml:1898 +#, no-c-format +msgid "" +"The annotation @org.hibernate.annotations.AccessType " +"should be considered deprecated for FIELD and PROPERTY access. It is still " +"useful however if you need to use a custom access type." +msgstr "" + +#. Tag: title +#: basic_mapping.xml:1907 +#, no-c-format +msgid "Optimistic lock" +msgstr "" + +#. Tag: para +#: basic_mapping.xml:1909 +#, no-c-format +msgid "" +"It is sometimes useful to avoid increasing the version number even if a " +"given property is dirty (particularly collections). You can do that by " +"annotating the property (or collection) with @OptimisticLock" +"(excluded=true)." +msgstr "" + +#. Tag: para +#: basic_mapping.xml:1914 +#, no-c-format +msgid "" +"More formally, specifies that updates to this property do not require " +"acquisition of the optimistic lock." +msgstr "" + +#. Tag: title +#: basic_mapping.xml:1919 +#, no-c-format +msgid "Declaring column attributes" +msgstr "" + +#. Tag: para +#: basic_mapping.xml:1921 +#, no-c-format +msgid "" +"The column(s) used for a property mapping can be defined using the " +"@Column annotation. Use it to override default values " +"(see the JPA specification for more information on the defaults). You can " +"use this annotation at the property level for properties that are:" +msgstr "" + +#. Tag: para +#: basic_mapping.xml:1929 +#, no-c-format +msgid "not annotated at all" +msgstr "" + +#. Tag: para +#: basic_mapping.xml:1933 +#, fuzzy, no-c-format +msgid "annotated with @Basic" +msgstr "assigned" + +#. Tag: para +#: basic_mapping.xml:1937 +#, fuzzy, no-c-format +msgid "annotated with @Version" +msgstr "string" + +#. Tag: para +#: basic_mapping.xml:1941 +#, fuzzy, no-c-format +msgid "annotated with @Lob" +msgstr "hilo" + +#. Tag: para +#: basic_mapping.xml:1945 +#, fuzzy, no-c-format +msgid "annotated with @Temporal" +msgstr "serializable" + +#. Tag: programlisting +#: basic_mapping.xml:1949 +#, no-c-format +msgid "" +"@Entity\n" +"public class Flight implements Serializable {\n" +"...\n" +"@Column(updatable = false, name = \"flight_name\", nullable = false, " +"length=50)\n" +"public String getName() { ... }" +msgstr "" + +#. Tag: para +#: basic_mapping.xml:1951 +#, no-c-format +msgid "" +"The name property is mapped to the flight_name column, which is not nullable, has a length of 50 and is not " +"updatable (making the property immutable)." +msgstr "" + +#. Tag: para +#: basic_mapping.xml:1956 +#, no-c-format +msgid "" +"This annotation can be applied to regular properties as well as " +"@Id or @Version properties." +msgstr "" + +#. Tag: programlisting +#: basic_mapping.xml:1983 +#, no-c-format +msgid "" +"@Column(\n" +" name=\"columnName\";\n" +" boolean unique() default false;\n" +" boolean nullable() default true;\n" +" boolean insertable() default true;\n" +" boolean updatable() default true;\n" +" String columnDefinition() default \"\";\n" +" String table() default \"\";\n" +" int length() default 255;\n" +" int precision() default 0; // decimal precision\n" +" int scale() default 0; // decimal scale" +msgstr "" + +#. Tag: para +#: basic_mapping.xml:1987 +#, fuzzy, no-c-format +msgid "" +"name (optional): the column name (default to the property " +"name)" +msgstr "name(可选):标识属性的名字。 " + +#. Tag: para +#: basic_mapping.xml:1992 +#, fuzzy, no-c-format +msgid "" +"unique (optional): set a unique constraint on this column " +"or not (default false)" +msgstr "" +"unique(可选):使用 DDL 为该字段添加唯一的约束。同样,允" +"许它作为 property-ref 引用的目标。 " + +#. Tag: para +#: basic_mapping.xml:1997 +#, fuzzy, no-c-format +msgid "" +"nullable (optional): set the column as nullable (default " +"true)." +msgstr "name(可选):标识属性的名字。 " + +#. Tag: para +#: basic_mapping.xml:2002 +#, fuzzy, no-c-format +msgid "" +"insertable (optional): whether or not the column will be " +"part of the insert statement (default true)" +msgstr "name(可选):标识属性的名字。 " + +#. Tag: para +#: basic_mapping.xml:2008 +#, fuzzy, no-c-format +msgid "" +"updatable (optional): whether or not the column will be " +"part of the update statement (default true)" +msgstr "catalog(可选):数据库 catalog 的名称。 " + +#. Tag: para +#: basic_mapping.xml:2014 +#, no-c-format +msgid "" +"columnDefinition (optional): override the sql DDL " +"fragment for this particular column (non portable)" +msgstr "" + +#. Tag: para +#: basic_mapping.xml:2020 +#, fuzzy, no-c-format +msgid "" +"table (optional): define the targeted table (default " +"primary table)" +msgstr "catalog(可选):数据库 catalog 的名称。 " + +#. Tag: para +#: basic_mapping.xml:2025 +#, no-c-format +msgid "" +"length (optional): column length " +"(default 255)" +msgstr "" + +#. Tag: para +#: basic_mapping.xml:2030 +#, no-c-format +msgid "" +"precision (optional): column decimal " +"precision (default 0)" +msgstr "" + +#. Tag: para +#: basic_mapping.xml:2035 +#, no-c-format +msgid "" +"scale (optional): column decimal scale " +"if useful (default 0)" +msgstr "" + +#. Tag: title +#: basic_mapping.xml:2043 +#, no-c-format +msgid "Formula" +msgstr "" + +#. Tag: para +#: basic_mapping.xml:2045 +#, no-c-format +msgid "" +"Sometimes, you want the Database to do some computation for you rather than " +"in the JVM, you might also create some kind of virtual column. You can use a " +"SQL fragment (aka formula) instead of mapping a property into a column. This " +"kind of property is read only (its value is calculated by your formula " +"fragment)." +msgstr "" + +#. Tag: programlisting +#: basic_mapping.xml:2051 +#, no-c-format +msgid "" +"@Formula(\"obj_length * obj_height * obj_width\")\n" +"public long getObjectVolume()" +msgstr "" + +#. Tag: para +#: basic_mapping.xml:2053 +#, no-c-format +msgid "" +"The SQL fragment can be as complex as you want and even include subselects." +msgstr "" + +#. Tag: title +#: basic_mapping.xml:2058 +#, no-c-format +msgid "Non-annotated property defaults" +msgstr "" + +#. Tag: para +#: basic_mapping.xml:2060 +#, no-c-format +msgid "If a property is not annotated, the following rules apply:" +msgstr "" + +#. Tag: para +#: basic_mapping.xml:2063 +#, no-c-format +msgid "If the property is of a single type, it is mapped as @Basic" +msgstr "" + +#. Tag: para +#: basic_mapping.xml:2068 +#, no-c-format +msgid "" +"Otherwise, if the type of the property is annotated as @Embeddable, it is " +"mapped as @Embedded" +msgstr "" + +#. Tag: para +#: basic_mapping.xml:2073 +#, no-c-format +msgid "" +"Otherwise, if the type of the property is Serializable, it is mapped as @Basic in a column " +"holding the object in its serialized version" +msgstr "" + +#. Tag: para +#: basic_mapping.xml:2080 +#, no-c-format +msgid "" +"Otherwise, if the type of the property is java.sql.Clob or java.sql.Blob, it is mapped as " +"@Lob with the appropriate LobType" +msgstr "" + +#. Tag: title +#: basic_mapping.xml:2091 +#, no-c-format +msgid "Property mapping with hbm.xml" +msgstr "" + +#. Tag: para +#: basic_mapping.xml:2093 +#, no-c-format +msgid "" +"The <property> element declares a persistent " +"JavaBean style property of the class." +msgstr "" +"<property> 元素为类定义了一个持久化的、JavaBean 风格" +"的属性。 " + +#. Tag: programlisting +#: basic_mapping.xml:2125 +#, fuzzy, no-c-format +msgid "" +"<property\n" +" name=\"propertyName\"\n" +" column=\"column_name\"\n" +" type=\"typename\"\n" +" update=\"true|false\"\n" +" insert=\"true|false\"\n" +" formula=\"arbitrary SQL expression\"\n" +" access=\"field|property|ClassName\"\n" +" lazy=\"true|false\"\n" +" unique=\"true|false\"\n" +" not-null=\"true|false\"\n" +" optimistic-lock=\"true|false\"\n" +" generated=\"never|insert|always\"\n" +" node=\"element-name|@attribute-name|element/@attribute|.\"\n" +" index=\"index_name\"\n" +" unique_key=\"unique_key_id\"\n" +" length=\"L\"\n" +" precision=\"P\"\n" +" scale=\"S\"\n" +"/>" +msgstr "" +"]]>" + +#. Tag: para +#: basic_mapping.xml:2129 +#, no-c-format +msgid "" +"name: the name of the property, with an initial lowercase " +"letter." +msgstr "name:属性的名字,以小写字母开头。" + +#. Tag: para +#: basic_mapping.xml:2134 +#, no-c-format +msgid "" +"column (optional - defaults to the property name): the " +"name of the mapped database table column. This can also be specified by " +"nested <column> element(s)." +msgstr "" +"column(可选 — 默认为属性名字):对应的数据库字段名。 也可" +"以通过嵌套的 <column> 元素指定。 " + +#. Tag: para +#: basic_mapping.xml:2146 +#, no-c-format +msgid "" +"update, insert (optional - defaults to true): specifies that the mapped columns should be included in SQL " +"UPDATE and/or INSERT statements. " +"Setting both to false allows a pure \"derived\" property " +"whose value is initialized from some other property that maps to the same " +"column(s), or by a trigger or other application." +msgstr "" +"update, insert(可选 — 默认为 true): " +"表明用于 UPDATE 和/或 INSERT 的 SQL 语" +"句中是否包含这个被映射了的字段。这二者如果都设置为 false " +"则表明这是一个“外源性(derived)”的属性,它的值来源于映射到同一个(或多个) " +"字段的某些其他属性,或者通过一个 trigger(触发器)或其他程序生成。 " + +#. Tag: para +#: basic_mapping.xml:2156 +#, no-c-format +msgid "" +"formula (optional): an SQL expression that defines the " +"value for a computed property. Computed properties do " +"not have a column mapping of their own." +msgstr "" +"formula(可选):一个 SQL 表达式,定义了这个计" +"算 (computed) 属性的值。计算属性没有和它对应的数据库字段。" + +#. Tag: para +#: basic_mapping.xml:2169 +#, no-c-format +msgid "" +"lazy (optional - defaults to false): " +"specifies that this property should be fetched lazily when the instance " +"variable is first accessed. It requires build-time bytecode instrumentation." +msgstr "" +"lazy(可选 — 默认为 false):指定 指定" +"实例变量第一次被访问时,这个属性是否延迟抓取(fetched lazily)( 需要运行时字" +"节码增强)。 " + +#. Tag: para +#: basic_mapping.xml:2176 +#, no-c-format +msgid "" +"unique (optional): enables the DDL generation of a unique " +"constraint for the columns. Also, allow this to be the target of a " +"property-ref." +msgstr "" +"unique(可选):使用 DDL 为该字段添加唯一的约束。同样,允" +"许它作为 property-ref 引用的目标。 " + +#. Tag: para +#: basic_mapping.xml:2183 +#, no-c-format +msgid "" +"not-null (optional): enables the DDL generation of a " +"nullability constraint for the columns." +msgstr "" +"not-null(可选):使用 DDL 为该字段添加可否为空" +"(nullability)的约束。 " + +#. Tag: para +#: basic_mapping.xml:2188 basic_mapping.xml:3246 +#, no-c-format +msgid "" +"optimistic-lock (optional - defaults to true): specifies that updates to this property do or do not require " +"acquisition of the optimistic lock. In other words, it determines if a " +"version increment should occur when this property is dirty." +msgstr "" +"optimistic-lock(可选 — 默认为 true):" +"指定这个属性在做更新时是否需要获得乐观锁定(optimistic lock)。换句话说,它决" +"定这个属性发生脏数据时版本(version)的值是否增长。 " + +#. Tag: para +#: basic_mapping.xml:2196 +#, no-c-format +msgid "" +"generated (optional - defaults to never): specifies that this property value is actually generated by the " +"database. See the discussion of generated properties for more information." +msgstr "" +"generated(可选 — 默认为 never):表明" +"此属性值是否实际上是由数据库生成的。请参阅 generated properties 的讨论。 " + +#. Tag: para +#: basic_mapping.xml:2205 +#, no-c-format +msgid "typename could be:" +msgstr "typename 可以是如下几种:" + +#. Tag: para +#: basic_mapping.xml:2230 +#, no-c-format +msgid "" +"If you do not specify a type, Hibernate will use reflection upon the named " +"property and guess the correct Hibernate type. Hibernate will attempt to " +"interpret the name of the return class of the property getter using, in " +"order, rules 2, 3, and 4. In certain cases you will need the type attribute. For example, to distinguish between Hibernate." +"DATE and Hibernate.TIMESTAMP, or to specify a " +"custom type." +msgstr "" +"如果你没有指定类型,Hibernarte 会使用反射来得到这个名字的属性,以此来猜测正确" +"的 Hibernate 类型。Hibernate 会按照规则 2,3,4 的顺序对属性读取器(getter方" +"法)的返回类进行解释。然而,这还不够。 在某些情况下你仍然需要 type 属性。(比如,为了区别Hibernate.DATE 和" +"Hibernate.TIMESTAMP,或者为了指定一个自定义类型。) " + +#. Tag: para +#: basic_mapping.xml:2239 +#, no-c-format +msgid "" +"The access attribute allows you to control how Hibernate " +"accesses the property at runtime. By default, Hibernate will call the " +"property get/set pair. If you specify access=\"field\", " +"Hibernate will bypass the get/set pair and access the field directly using " +"reflection. You can specify your own strategy for property access by naming " +"a class that implements the interface org.hibernate.property." +"PropertyAccessor." +msgstr "" +"access 属性用来让你控制 Hibernate 如何在运行时访问属性。在" +"默认情况下,Hibernate 会使用属性的 get/set 方法对(pair)。如果你指明 " +"access=\"field\",Hibernate 会忽略 get/set 方法对,直接使" +"用反射来访问成员变量。你也可以指定你自己的策略,这就需要你自己实现 " +"org.hibernate.property.PropertyAccessor 接口,再在 access " +"中设置你自定义策略类的名字。 " + +#. Tag: para +#: basic_mapping.xml:2248 +#, no-c-format +msgid "" +"A powerful feature is derived properties. These properties are by definition " +"read-only. The property value is computed at load time. You declare the " +"computation as an SQL expression. This then translates to a SELECT clause subquery in the SQL query that loads an instance:" +msgstr "" +"衍生属性(derive propertie)是一个特别强大的特征。这些属性应该定义为只读,属" +"性值在装载时计算生成。 你用一个 SQL 表达式生成计算的结果,它会在这个实例转载" +"时翻译成一个 SQL 查询的 SELECT 子查询语句。 " + +#. Tag: programlisting +#: basic_mapping.xml:2254 +#, fuzzy, no-c-format +msgid "" +"<property name=\"totalPrice\"\n" +" formula=\"( SELECT SUM (li.quantity*p.price) FROM LineItem li, Product " +"p\n" +" WHERE li.productId = p.productId\n" +" AND li.customerId = customerId\n" +" AND li.orderNumber = orderNumber )\"/>" +msgstr "" +"<property name=\"totalPrice\"\n" +" formula=\"( SELECT SUM (li.quantity*p.price) FROM LineItem li, Product " +"p\n" +" WHERE li.productId = p.productId\n" +" AND li.customerId = customerId\n" +" AND li.orderNumber = orderNumber )\"/>" + +#. Tag: para +#: basic_mapping.xml:2256 +#, no-c-format +msgid "" +"You can reference the entity table by not declaring an alias on a particular " +"column. This would be customerId in the given example. " +"You can also use the nested <formula> mapping " +"element if you do not want to use the attribute." +msgstr "" +"注意,你可以使用实体自己的表,而不用为这个特别的列定义别名(上面例子中的 " +"customerId)。同时注意,如果你不喜欢使用属性, 你可以使用" +"嵌套的 <formula> 映射元素。 " + +#. Tag: title +#: basic_mapping.xml:2265 +#, no-c-format +msgid "Embedded objects (aka components)" +msgstr "" + +#. Tag: para +#: basic_mapping.xml:2267 +#, fuzzy, no-c-format +msgid "" +"Embeddable objects (or components) are objects whose properties are mapped " +"to the same table as the owning entity's table. Components can, in turn, " +"declare their own properties, components or collections" +msgstr "" +"<component> 元素把子对象的一些元素与父类对应的表的一" +"些字段映射起来。然后组件可以定义它们自己的属性、组件或者集合。参见后面" +"的“Components”一章。 " + +#. Tag: para +#: basic_mapping.xml:2272 +#, no-c-format +msgid "" +"It is possible to declare an embedded component inside an entity and even " +"override its column mapping. Component classes have to be annotated at the " +"class level with the @Embeddable annotation. It is " +"possible to override the column mapping of an embedded object for a " +"particular entity using the @Embedded and " +"@AttributeOverride annotation in the associated property:" +msgstr "" + +#. Tag: programlisting +#: basic_mapping.xml:2280 +#, no-c-format +msgid "" +"@Entity\n" +"public class Person implements Serializable {\n" +"\n" +" // Persistent component using defaults\n" +" Address homeAddress;\n" +"\n" +" @Embedded\n" +" @AttributeOverrides( {\n" +" @AttributeOverride(name=\"iso2\", column = @Column(name=" +"\"bornIso2\") ),\n" +" @AttributeOverride(name=\"name\", column = @Column(name=" +"\"bornCountryName\") )\n" +" } )\n" +" Country bornIn;\n" +" ...\n" +"}" +msgstr "" + +#. Tag: programlisting +#: basic_mapping.xml:2282 +#, no-c-format +msgid "" +"@Embeddable\n" +"public class Address implements Serializable {\n" +" String city;\n" +" Country nationality; //no overriding here\n" +"}" +msgstr "" + +#. Tag: programlisting +#: basic_mapping.xml:2284 +#, no-c-format +msgid "" +"@Embeddable\n" +"public class Country implements Serializable {\n" +" private String iso2;\n" +" @Column(name=\"countryName\") private String name;\n" +"\n" +" public String getIso2() { return iso2; }\n" +" public void setIso2(String iso2) { this.iso2 = iso2; }\n" +"\n" +" \n" +" public String getName() { return name; }\n" +" public void setName(String name) { this.name = name; }\n" +" ...\n" +"}" +msgstr "" + +#. Tag: para +#: basic_mapping.xml:2286 +#, no-c-format +msgid "" +"An embeddable object inherits the access type of its owning entity (note " +"that you can override that using the @Access annotation)." +msgstr "" + +#. Tag: para +#: basic_mapping.xml:2290 +#, no-c-format +msgid "" +"The Person entity has two component properties, " +"homeAddress and bornIn. " +"homeAddress property has not been annotated, but " +"Hibernate will guess that it is a persistent component by looking for the " +"@Embeddable annotation in the Address class. We also " +"override the mapping of a column name (to bornCountryName) with the @Embedded and " +"@AttributeOverride annotations for each mapped attribute " +"of Country. As you can see, Country is " +"also a nested component of Address, again using auto-" +"detection by Hibernate and JPA defaults. Overriding columns of embedded " +"objects of embedded objects is through dotted expressions." +msgstr "" + +#. Tag: programlisting +#: basic_mapping.xml:2305 +#, no-c-format +msgid "" +"@Embedded\n" +" @AttributeOverrides( {\n" +" @AttributeOverride(name=\"city\", column = @Column(name=" +"\"fld_city\") ),\n" +" @AttributeOverride(name=\"nationality.iso2\", column = @Column" +"(name=\"nat_Iso2\") ),\n" +" @AttributeOverride(name=\"nationality.name\", column = @Column" +"(name=\"nat_CountryName\") )\n" +" //nationality columns in homeAddress are overridden\n" +" } )\n" +" Address homeAddress;" +msgstr "" + +#. Tag: para +#: basic_mapping.xml:2307 +#, no-c-format +msgid "" +"Hibernate Annotations supports something that is not explicitly supported by " +"the JPA specification. You can annotate a embedded object with the " +"@MappedSuperclass annotation to make the superclass " +"properties persistent (see @MappedSuperclass for more " +"informations)." +msgstr "" + +#. Tag: para +#: basic_mapping.xml:2313 +#, no-c-format +msgid "" +"You can also use association annotations in an embeddable object (ie " +"@OneToOne, @ManyToOne, " +"@OneToMany or @ManyToMany). To " +"override the association columns you can use @AssociationOverride." +msgstr "" + +#. Tag: para +#: basic_mapping.xml:2319 +#, no-c-format +msgid "" +"If you want to have the same embeddable object type twice in the same " +"entity, the column name defaulting will not work as several embedded objects " +"would share the same set of columns. In plain JPA, you need to override at " +"least one set of columns. Hibernate, however, allows you to enhance the " +"default naming mechanism through the NamingStrategy " +"interface. You can write a strategy that prevent name clashing in such a " +"situation. DefaultComponentSafeNamingStrategy is an " +"example of this." +msgstr "" + +#. Tag: para +#: basic_mapping.xml:2329 +#, no-c-format +msgid "" +"If a property of the embedded object points back to the owning entity, " +"annotate it with the @Parent annotation. Hibernate " +"will make sure this property is properly loaded with the entity reference." +msgstr "" + +#. Tag: para +#: basic_mapping.xml:2334 +#, no-c-format +msgid "In XML, use the <component> element." +msgstr "" + +#. Tag: programlisting +#: basic_mapping.xml:2356 +#, fuzzy, no-c-format +msgid "" +"<component\n" +" name=\"propertyName\"\n" +" class=\"className\"\n" +" insert=\"true|false\"\n" +" update=\"true|false\"\n" +" access=\"field|property|ClassName\"\n" +" lazy=\"true|false\"\n" +" optimistic-lock=\"true|false\"\n" +" unique=\"true|false\"\n" +" node=\"element-name|.\"\n" +">\n" +"\n" +" <property ...../>\n" +" <many-to-one .... />\n" +" ........\n" +"</component>" +msgstr "" +"<component \n" +" name=\"propertyName\" \n" +" class=\"className\"\n" +" insert=\"true|false\"\n" +" update=\"true|false\"\n" +" access=\"field|property|ClassName\"\n" +" lazy=\"true|false\"\n" +" optimistic-lock=\"true|false\"\n" +" unique=\"true|false\"\n" +" node=\"element-name|.\"\n" +">\n" +" \n" +" <property ...../>\n" +" <many-to-one .... />\n" +" ........\n" +"</component>" + +#. Tag: para +#: basic_mapping.xml:2360 basic_mapping.xml:3181 basic_mapping.xml:3381 #, no-c-format msgid "name: the name of the property." msgstr "name:属性名。" #. Tag: para +#: basic_mapping.xml:2364 #, no-c-format -msgid "column (optional): the name of the foreign key column. This can also be specified by nested <column> element(s)." -msgstr "column(可选):外键字段的名称。也可以通过嵌套的 <column> 指定。 " +msgid "" +"class (optional - defaults to the property type " +"determined by reflection): the name of the component (child) class." +msgstr "" +"class(可选 — 默认为通过反射得到的属性类型):组件(子)类" +"的名字。 " #. Tag: para +#: basic_mapping.xml:2370 basic_mapping.xml:3641 #, no-c-format -msgid "class (optional - defaults to the property type determined by reflection): the name of the associated class." -msgstr "class(可选 — 默认是通过反射得到的属性类型):被关联的类的名字。 " +msgid "" +"insert: do the mapped columns appear in SQL " +"INSERTs?" +msgstr "" +"insert:被映射的字段是否出现在 SQL 的 INSERT 语句中? " #. Tag: para +#: basic_mapping.xml:2375 basic_mapping.xml:3646 #, no-c-format -msgid "cascade (optional): specifies which operations should be cascaded from the parent object to the associated object." -msgstr "cascade(级联)(可选)表明操作是否从父对象级联到被关联的对象。 " +msgid "" +"update: do the mapped columns appear in SQL " +"UPDATEs?" +msgstr "" +"update:被映射的字段是否出现在 SQL 的 UPDATE 语句中? " #. Tag: para +#: basic_mapping.xml:2386 #, no-c-format -msgid "fetch (optional - defaults to select): chooses between outer-join fetching or sequential select fetching." -msgstr "fetch(可选 — 默认为 select):在外连接抓取(outer-join fetching)和序列选择抓取(sequential select fetching)两者中选择其一。 " +msgid "" +"lazy (optional - defaults to false): " +"specifies that this component should be fetched lazily when the instance " +"variable is first accessed. It requires build-time bytecode instrumentation." +msgstr "" +"lazy(可选 — 默认是 false):表明此组件" +"应在实例变量第一次被访问的时候延迟加载(需要编译时字节码装置器)。" #. Tag: para +#: basic_mapping.xml:2393 #, no-c-format -msgid "update, insert (optional - defaults to true): specifies that the mapped columns should be included in SQL UPDATE and/or INSERT statements. Setting both to false allows a pure \"derived\" association whose value is initialized from another property that maps to the same column(s), or by a trigger or other application." -msgstr "update, insert(可选 — 默认为 true)指定对应的字段是否包含在用于 UPDATE 和/或 INSERT 的 SQL 语句中。如果二者都是false,则这是一个纯粹的 “外源性(derived)”关联,它的值是通过映射到同一个(或多个)字段的某些其他属性得到 或者通过 trigger(触发器)、或其他程序生成。 " +msgid "" +"optimistic-lock (optional - defaults to true): specifies that updates to this component either do or do not " +"require acquisition of the optimistic lock. It determines if a version " +"increment should occur when this property is dirty." +msgstr "" +"optimistic-lock(可选 — 默认是 true):" +"表明更新此组件是否需要获取乐观锁。换句话说,当这个属性变脏时,是否增加版本号" +"(Version)。" #. Tag: para +#: basic_mapping.xml:2401 basic_mapping.xml:3659 #, no-c-format -msgid "property-ref (optional): the name of a property of the associated class that is joined to this foreign key. If not specified, the primary key of the associated class is used." -msgstr "property-ref:(可选)被关联到此外键的类中的对应属性的名字。如果没有指定,被关联类的主键将被使用。 " +msgid "" +"unique (optional - defaults to false): " +"specifies that a unique constraint exists upon all mapped columns of the " +"component." +msgstr "" +"unique(可选 — 默认是 false):表明组件" +"映射的所有字段上都有唯一性约束。" #. Tag: para +#: basic_mapping.xml:2408 #, no-c-format -msgid "unique (optional): enables the DDL generation of a unique constraint for the foreign-key column. By allowing this to be the target of a property-ref, you can make the association multiplicity one-to-one." -msgstr "unique(可选):使用 DDL 为外键字段生成一个唯一约束。此外, 这也可以用作 property-ref 的目标属性。这使关联同时具有一对一的效果。 " +msgid "" +"The child <property> tags map properties of the " +"child class to table columns." +msgstr "" +"其 <property> 子标签为子类的一些属性与表字段之间建立" +"映射。" #. Tag: para +#: basic_mapping.xml:2411 #, no-c-format -msgid "not-null (optional): enables the DDL generation of a nullability constraint for the foreign key columns." -msgstr "not-null(可选):使用 DDL 为外键字段生成一个非空约束。 " +msgid "" +"The <component> element allows a <" +"parent> subelement that maps a property of the component class " +"as a reference back to the containing entity." +msgstr "" +"<component> 元素允许加入一个 <parent>" +" 子元素,在组件类内部就可以有一个指向其容器的实体的反向引用。" #. Tag: para -#, no-c-format -msgid "lazy (optional - defaults to proxy): by default, single point associations are proxied. lazy=\"no-proxy\" specifies that the property should be fetched lazily when the instance variable is first accessed. This requires build-time bytecode instrumentation. lazy=\"false\" specifies that the association will always be eagerly fetched." -msgstr "lazy(可选 — 默认为 proxy):默认情况下,单点关联是经过代理的。lazy=\"no-proxy\" 指定此属性应该在实例变量第一次被访问时应该延迟抓取(fetche lazily)(需要运行时字节码的增强)。lazy=\"false\" 指定此关联总是被预先抓取。 " - -#. Tag: para -#, no-c-format -msgid "not-found (optional - defaults to exception): specifies how foreign keys that reference missing rows will be handled. ignore will treat a missing row as a null association." -msgstr "not-found(可选 - 默认为exception):指定如何处理引用缺失行的外键:ignore 会把缺失的行作为一个空关联处理。 " - -#. Tag: para -#, no-c-format -msgid "entity-name (optional): the entity name of the associated class." -msgstr "entity-name(可选):被关联的类的实体名。 " - -#. Tag: para -#, no-c-format -msgid "formula (optional): an SQL expression that defines the value for a computed foreign key." -msgstr "formula(可选):SQL 表达式,用于定义 computed(计算出的)外键值。" - -#. Tag: para -#, no-c-format -msgid "Setting a value of the cascade attribute to any meaningful value other than none will propagate certain operations to the associated object. The meaningful values are divided into three categories. First, basic operations, which include: persist, merge, delete, save-update, evict, replicate, lock and refresh; second, special values: delete-orphan; and third,all comma-separated combinations of operation names: cascade=\"persist,merge,evict\" or cascade=\"all,delete-orphan\". See for a full explanation. Note that single valued, many-to-one and one-to-one, associations do not support orphan delete." -msgstr "cascade 属性设置为除了none 以外任何有意义的值,它将把特定的操作传递到关联对象中。这个值就代表着 Hibernate 基本操作的名称,persist, merge, delete, save-update, evict, replicate, lock, refresh,以及特别的值 delete-orphanall,并且可以用逗号分隔符来组合这些操作,例如,cascade=\"persist,merge,evict\"cascade=\"all,delete-orphan\"。更全面的解释请参考 。注意,单值关联(many-to-one 和 one-to-one 关联)不支持删除孤儿(orphan delete,删除不再被引用的值)。 " - -#. Tag: para -#, no-c-format -msgid "Here is an example of a typical many-to-one declaration:" -msgstr "一个典型的简单 many-to-one 定义例子: " - -#. Tag: para -#, no-c-format -msgid "The property-ref attribute should only be used for mapping legacy data where a foreign key refers to a unique key of the associated table other than the primary key. This is a complicated and confusing relational model. For example, if the Product class had a unique serial number that is not the primary key. The unique attribute controls Hibernate's DDL generation with the SchemaExport tool." -msgstr "property-ref 属性只应该用来对付遗留下来的数据库系统,可能有外键指向对方关联表的是个非主键字段(但是应该是一个惟一关键字)的情况下。这是一种十分丑陋的关系模型。比如说,假设 Product 类有一个惟一的序列号,它并不是主键。(unique 属性控制 Hibernate 通过 SchemaExport 工具进行的 DDL 生成。) " - -#. Tag: para -#, no-c-format -msgid "Then the mapping for OrderItem might use:" -msgstr "那么关于 OrderItem 的映射可能是:" - -#. Tag: para -#, no-c-format -msgid "This is not encouraged, however." -msgstr "当然,我们决不鼓励这种用法。 " - -#. Tag: para -#, no-c-format -msgid "If the referenced unique key comprises multiple properties of the associated entity, you should map the referenced properties inside a named <properties> element." -msgstr "如果被引用的唯一主键由关联实体的多个属性组成,你应该在名称为 <properties> 的元素 里面映射所有关联的属性。" - -#. Tag: para -#, no-c-format -msgid "If the referenced unique key is the property of a component, you can specify a property path:" -msgstr "假若被引用的唯一主键是组件的属性,你可以指定属性路径: " +#: basic_mapping.xml:2415 +#, fuzzy, no-c-format +msgid "" +"The <dynamic-component> element allows a " +"Map to be mapped as a component, where the property names " +"refer to keys of the map. See for " +"more information. This feature is not supported in annotations." +msgstr "" +"<dynamic-component> 元素允许把一个 Map 映射为组件,其属性名对应 map 的键值。参见 。 " #. Tag: title +#: basic_mapping.xml:2423 #, no-c-format -msgid "One-to-one" -msgstr "一对一 " +msgid "Inheritance strategy" +msgstr "" #. Tag: para +#: basic_mapping.xml:2425 #, no-c-format -msgid "A one-to-one association to another persistent class is declared using a one-to-one element." -msgstr "持久化对象之间一对一的关联关系是通过 one-to-one 元素定义的。" +msgid "" +"Java is a language supporting polymorphism: a class can inherit from " +"another. Several strategies are possible to persist a class hierarchy:" +msgstr "" #. Tag: para +#: basic_mapping.xml:2431 #, no-c-format -msgid "constrained (optional): specifies that a foreign key constraint on the primary key of the mapped table and references the table of the associated class. This option affects the order in which save() and delete() are cascaded, and determines whether the association can be proxied. It is also used by the schema export tool." -msgstr "constrained(约束)(可选)表明该类对应的表对应的数据库表,和被关联的对象所对应的数据库表之间,通过一个外键引用对主键进行约束。这个选项影响 save()delete() 在级联执行时的先后顺序以及决定该关联能否被委托(也在 schema export tool 中被使用)。 " +msgid "" +"Single table per class hierarchy strategy: a single table hosts all the " +"instances of a class hierarchy" +msgstr "" #. Tag: para +#: basic_mapping.xml:2436 #, no-c-format -msgid "property-ref (optional): the name of a property of the associated class that is joined to the primary key of this class. If not specified, the primary key of the associated class is used." -msgstr "property-ref:(可选)指定关联类的属性名,这个属性将会和本类的主键相对应。如果没有指定,会使用对方关联类的主键。 " +msgid "" +"Joined subclass strategy: one table per class and subclass is present and " +"each table persist the properties specific to a given subclass. The state of " +"the entity is then stored in its corresponding class table and all its " +"superclasses" +msgstr "" #. Tag: para +#: basic_mapping.xml:2443 #, no-c-format -msgid "formula (optional): almost all one-to-one associations map to the primary key of the owning entity. If this is not the case, you can specify another column, columns or expression to join on using an SQL formula. See org.hibernate.test.onetooneformula for an example." -msgstr "formula (可选):绝大多数一对一的关联都指向其实体的主键。在一些少见的情况中,你可能会指向其他的一个或多个字段,或者是一个表达式,这些情况下,你可以用一个 SQL 公式来表示。(可以在 org.hibernate.test.onetooneformula 找到例子) " - -#. Tag: para -#, no-c-format -msgid "lazy (optional - defaults to proxy): by default, single point associations are proxied. lazy=\"no-proxy\" specifies that the property should be fetched lazily when the instance variable is first accessed. It requires build-time bytecode instrumentation. lazy=\"false\" specifies that the association will always be eagerly fetched. Note that if constrained=\"false\", proxying is impossible and Hibernate will eagerly fetch the association." -msgstr "lazy(可选 — 默认为 proxy):默认情况下,单点关联是经过代理的。lazy=\"no-proxy\"指定此属性应该在实例变量第一次被访问时应该延迟抓取(fetche lazily)(需要运行时字节码的增强)。 lazy=\"false\"指定此关联总是被预先抓取。注意,如果constrained=\"false\", 不可能使用代理,Hibernate会采取预先抓取。" - -#. Tag: para -#, no-c-format -msgid "There are two varieties of one-to-one associations:" -msgstr "有两种不同的一对一关联: " - -#. Tag: para -#, no-c-format -msgid "primary key associations" -msgstr "主键关联" - -#. Tag: para -#, no-c-format -msgid "unique foreign key associations" -msgstr "惟一外键关联" - -#. Tag: para -#, no-c-format -msgid "Primary key associations do not need an extra table column. If two rows are related by the association, then the two table rows share the same primary key value. To relate two objects by a primary key association, ensure that they are assigned the same identifier value." -msgstr "主键关联不需要额外的表字段;如果两行是通过这种一对一关系相关联的,那么这两行就共享同样的主关键字值。所以如果你希望两个对象通过主键一对一关联,你必须确认它们被赋予同样的标识值。" - -#. Tag: para -#, no-c-format -msgid "For a primary key association, add the following mappings to Employee and Person respectively:" -msgstr "比如说,对下面的 EmployeePerson 进行主键一对一关联:" - -#. Tag: para -#, no-c-format -msgid "Ensure that the primary keys of the related rows in the PERSON and EMPLOYEE tables are equal. You use a special Hibernate identifier generation strategy called foreign:" -msgstr "现在我们必须确保 PERSON 和 EMPLOYEE 中相关的字段是相等的。我们使用一个被成为 foreign 的特殊的 hibernate 标识符生成策略: " - -#. Tag: para -#, no-c-format -msgid "A newly saved instance of Person is assigned the same primary key value as the Employee instance referred with the employee property of that Person." -msgstr "一个刚刚保存的 Person 实例被赋予和该 Personemployee 属性所指向的 Employee 实例同样的关键字值。 " - -#. Tag: para -#, no-c-format -msgid "Alternatively, a foreign key with a unique constraint, from Employee to Person, can be expressed as:" -msgstr "另一种方式是一个外键和一个惟一关键字对应,上面的 EmployeePerson 的例子,如果使用这种关联方式,可以表达成: " - -#. Tag: para -#, no-c-format -msgid "This association can be made bidirectional by adding the following to the Person mapping:" -msgstr "如果在 Person 的映射加入下面几句,这种关联就是双向的: " +msgid "" +"Table per class strategy: one table per concrete class and subclass is " +"present and each table persist the properties of the class and its " +"superclasses. The state of the entity is then stored entirely in the " +"dedicated table for its class." +msgstr "" #. Tag: title +#: basic_mapping.xml:2451 #, no-c-format -msgid "Natural-id" -msgstr "自然 ID(natural-id) " +msgid "Single table per class hierarchy strategy" +msgstr "" #. Tag: para +#: basic_mapping.xml:2453 #, no-c-format -msgid "Although we recommend the use of surrogate keys as primary keys, you should try to identify natural keys for all entities. A natural key is a property or combination of properties that is unique and non-null. It is also immutable. Map the properties of the natural key inside the <natural-id> element. Hibernate will generate the necessary unique key and nullability constraints and, as a result, your mapping will be more self-documenting." -msgstr "我们建议使用代用键(键值不具备实际意义)作为主键,我们仍然应该尝试为所有的实体采用自然的键值作为(附加——译者注)标示。自然键(natural key)是单个或组合属性,他们必须唯一且非空。如果它还是不可变的那就更理想了。在 <natural-id> 元素中列出自然键的属性。Hibernate 会帮你生成必须的唯一键值和非空约束,你的映射会更加的明显易懂(原文是 self-documenting,自我注解)。 " +msgid "" +"With this approach the properties of all the subclasses in a given mapped " +"class hierarchy are stored in a single table." +msgstr "" #. Tag: para +#: basic_mapping.xml:2456 +#, fuzzy, no-c-format +msgid "" +"Each subclass declares its own persistent properties and subclasses. Version " +"and id properties are assumed to be inherited from the root class. Each " +"subclass in a hierarchy must define a unique discriminator value. If this is " +"not specified, the fully qualified Java class name is used." +msgstr "" +"每个子类都应该定义它自己的持久化属性和子类。<version><id> 属性可以从根父类继承下来。在一棵继" +"承树上的每个子类都必须定义一个唯一的 discriminator-value。" +"如果没有指定,就会使用 Java 类的全限定名。 " + +#. Tag: programlisting +#: basic_mapping.xml:2462 basic_mapping.xml:2540 #, no-c-format -msgid "It is recommended that you implement equals() and hashCode() to compare the natural key properties of the entity." -msgstr "我们强烈建议你实现 equals()hashCode() 方法,来比较实体的自然键属性。 " +msgid "" +"@Entity\n" +"@Inheritance(strategy=InheritanceType.SINGLE_TABLE)\n" +"@DiscriminatorColumn(\n" +" name=\"planetype\",\n" +" discriminatorType=DiscriminatorType.STRING\n" +")\n" +"@DiscriminatorValue(\"Plane\")\n" +"public class Plane { ... }\n" +"\n" +"@Entity\n" +"@DiscriminatorValue(\"A320\")\n" +"public class A320 extends Plane { ... }" +msgstr "" #. Tag: para -#, no-c-format -msgid "This mapping is not intended for use with entities that have natural primary keys." -msgstr "这一映射不是为了把自然键作为主键而准备的。 " +#: basic_mapping.xml:2464 +#, fuzzy, no-c-format +msgid "" +"In hbm.xml, for the table-per-class-hierarchy mapping strategy, the " +"<subclass> declaration is used. For example:" +msgstr "" +"最后,多态持久化需要为父类的每个子类都进行定义。对于“每一棵类继承树对应一个" +"表”的策略来说,就需要使用 <subclass> 定义。 " + +#. Tag: programlisting +#: basic_mapping.xml:2479 +#, fuzzy, no-c-format +msgid "" +"<subclass\n" +" name=\"ClassName\"\n" +" discriminator-value=\"discriminator_value\"\n" +" proxy=\"ProxyInterface\"\n" +" lazy=\"true|false\"\n" +" dynamic-update=\"true|false\"\n" +" dynamic-insert=\"true|false\"\n" +" entity-name=\"EntityName\"\n" +" node=\"element-name\"\n" +" extends=\"SuperclassName\">\n" +"\n" +" <property .... />\n" +" .....\n" +"</subclass>" +msgstr "" +"<subclass\n" +" name=\"ClassName\"\n" +" discriminator-value=\"discriminator_value\"\n" +" proxy=\"ProxyInterface\"\n" +" lazy=\"true|false\"\n" +" dynamic-update=\"true|false\"\n" +" dynamic-insert=\"true|false\"\n" +" entity-name=\"EntityName\"\n" +" node=\"element-name\"\n" +" extends=\"SuperclassName\">\n" +"\n" +" <property .... />\n" +" .....\n" +"</subclass>" #. Tag: para +#: basic_mapping.xml:2483 basic_mapping.xml:2656 basic_mapping.xml:2720 #, no-c-format -msgid "mutable (optional - defaults to false): by default, natural identifier properties are assumed to be immutable (constant)." -msgstr "mutable(可选,默认为 false):默认情况下,自然标识属性被假定为不可变的(常量)。 " - -#. Tag: title -#, no-c-format -msgid "Component and dynamic-component" -msgstr "组件(component)和动态组件(dynamic-component) " - -#. Tag: para -#, no-c-format -msgid "The <component> element maps properties of a child object to columns of the table of a parent class. Components can, in turn, declare their own properties, components or collections. See the \"Component\" examples below:" -msgstr "<component> 元素把子对象的一些元素与父类对应的表的一些字段映射起来。然后组件可以定义它们自己的属性、组件或者集合。参见后面的“Components”一章。 " - -#. Tag: para -#, no-c-format -msgid "class (optional - defaults to the property type determined by reflection): the name of the component (child) class." -msgstr "class(可选 — 默认为通过反射得到的属性类型):组件(子)类的名字。 " - -#. Tag: para -#, no-c-format -msgid "insert: do the mapped columns appear in SQL INSERTs?" -msgstr "insert:被映射的字段是否出现在 SQL 的 INSERT 语句中? " - -#. Tag: para -#, no-c-format -msgid "update: do the mapped columns appear in SQL UPDATEs?" -msgstr "update:被映射的字段是否出现在 SQL 的 UPDATE 语句中? " - -#. Tag: para -#, no-c-format -msgid "lazy (optional - defaults to false): specifies that this component should be fetched lazily when the instance variable is first accessed. It requires build-time bytecode instrumentation." -msgstr "lazy(可选 — 默认是 false):表明此组件应在实例变量第一次被访问的时候延迟加载(需要编译时字节码装置器)。" - -#. Tag: para -#, no-c-format -msgid "optimistic-lock (optional - defaults to true): specifies that updates to this component either do or do not require acquisition of the optimistic lock. It determines if a version increment should occur when this property is dirty." -msgstr "optimistic-lock(可选 — 默认是 true):表明更新此组件是否需要获取乐观锁。换句话说,当这个属性变脏时,是否增加版本号(Version)。" - -#. Tag: para -#, no-c-format -msgid "unique (optional - defaults to false): specifies that a unique constraint exists upon all mapped columns of the component." -msgstr "unique(可选 — 默认是 false):表明组件映射的所有字段上都有唯一性约束。" - -#. Tag: para -#, no-c-format -msgid "The child <property> tags map properties of the child class to table columns." -msgstr "其 <property> 子标签为子类的一些属性与表字段之间建立映射。" - -#. Tag: para -#, no-c-format -msgid "The <component> element allows a <parent> subelement that maps a property of the component class as a reference back to the containing entity." -msgstr "<component> 元素允许加入一个 <parent> 子元素,在组件类内部就可以有一个指向其容器的实体的反向引用。" - -#. Tag: para -#, no-c-format -msgid "The <dynamic-component> element allows a Map to be mapped as a component, where the property names refer to keys of the map. See for more information." -msgstr "<dynamic-component> 元素允许把一个 Map 映射为组件,其属性名对应 map 的键值。参见 。 " - -#. Tag: title -#, no-c-format -msgid "Properties" -msgstr "属性(Properties)" - -#. Tag: para -#, no-c-format -msgid "The <properties> element allows the definition of a named, logical grouping of the properties of a class. The most important use of the construct is that it allows a combination of properties to be the target of a property-ref. It is also a convenient way to define a multi-column unique constraint. For example:" -msgstr "<properties> 元素允许定义一个命名的逻辑分组(grouping)包含一个类中的多个属性。这个元素最重要的用处是允许多个属性的组合作为 property-ref 的目标(target)。这也是定义多字段唯一约束的一种方便途径。例如:" - -#. Tag: para -#, no-c-format -msgid "name: the logical name of the grouping. It is not an actual property name." -msgstr "name:分组的逻辑名称 — 不是 实际属性的名称。 " - -#. Tag: para -#, no-c-format -msgid "optimistic-lock (optional - defaults to true): specifies that updates to these properties either do or do not require acquisition of the optimistic lock. It determines if a version increment should occur when these properties are dirty." -msgstr "optimistic-lock(可选 — 默认是 true):表明更新此组件是否需要获取乐观锁。换句话说,当这个属性变脏时,是否增加版本号(Version)。" - -#. Tag: para -#, no-c-format -msgid "For example, if we have the following <properties> mapping:" -msgstr "例如,如果我们有如下的 <properties> 映射:" - -#. Tag: para -#, no-c-format -msgid "You might have some legacy data association that refers to this unique key of the Person table, instead of to the primary key:" -msgstr "然后,我们可能有一些遗留的数据关联,引用 Person 表的这个唯一键,而不是主键:" - -#. Tag: para -#, no-c-format -msgid "The use of this outside the context of mapping legacy data is not recommended." -msgstr "我们并不推荐这样使用,除非在映射遗留数据的情况下。 " - -#. Tag: title -#, no-c-format -msgid "Subclass" -msgstr "子类(subclass) " - -#. Tag: para -#, no-c-format -msgid "Polymorphic persistence requires the declaration of each subclass of the root persistent class. For the table-per-class-hierarchy mapping strategy, the <subclass> declaration is used. For example:" -msgstr "最后,多态持久化需要为父类的每个子类都进行定义。对于“每一棵类继承树对应一个表”的策略来说,就需要使用 <subclass> 定义。 " - -#. Tag: para -#, no-c-format -msgid "name: the fully qualified class name of the subclass." +msgid "" +"name: the fully qualified class name of the subclass." msgstr "name:子类的全限定名。 " #. Tag: para +#: basic_mapping.xml:2488 #, no-c-format -msgid "discriminator-value (optional - defaults to the class name): a value that distinguishes individual subclasses." -msgstr "discriminator-value(辨别标志)(可选 — 默认为类名):一个用于区分每个独立的子类的值。 " +msgid "" +"discriminator-value (optional - defaults to the class " +"name): a value that distinguishes individual subclasses." +msgstr "" +"discriminator-value(辨别标志)(可选 — 默认为类名):一个" +"用于区分每个独立的子类的值。 " #. Tag: para +#: basic_mapping.xml:2494 #, no-c-format -msgid "proxy (optional): specifies a class or interface used for lazy initializing proxies." -msgstr "proxy(可选):指定一个类或者接口,在延迟装载时作为代理使用。 " +msgid "" +"proxy (optional): specifies a class or interface used for " +"lazy initializing proxies." +msgstr "" +"proxy(可选):指定一个类或者接口,在延迟装载时作为代理使" +"用。 " #. Tag: para +#: basic_mapping.xml:2499 #, no-c-format -msgid "lazy (optional - defaults to true): setting lazy=\"false\" disables the use of lazy fetching." -msgstr "lazy(可选,默认是 true):设置为 lazy=\"false\" 禁止使用延迟装载。 " +msgid "" +"lazy (optional - defaults to true): " +"setting lazy=\"false\" disables the use of lazy fetching." +msgstr "" +"lazy(可选,默认是 true):设置为 " +"lazy=\"false\" 禁止使用延迟装载。 " #. Tag: para -#, no-c-format -msgid "Each subclass declares its own persistent properties and subclasses. <version> and <id> properties are assumed to be inherited from the root class. Each subclass in a hierarchy must define a unique discriminator-value. If this is not specified, the fully qualified Java class name is used." -msgstr "每个子类都应该定义它自己的持久化属性和子类。<version><id> 属性可以从根父类继承下来。在一棵继承树上的每个子类都必须定义一个唯一的 discriminator-value。如果没有指定,就会使用 Java 类的全限定名。 " - -#. Tag: para -#, no-c-format -msgid "For information about inheritance mappings see ." +#: basic_mapping.xml:2507 basic_mapping.xml:2685 basic_mapping.xml:2746 +#, fuzzy, no-c-format +msgid "" +"For information about inheritance mappings see ." msgstr "更多关于继承映射的信息,参考 。 " #. Tag: title +#: basic_mapping.xml:2511 #, no-c-format -msgid "Joined-subclass" +msgid "Discriminator" +msgstr "鉴别器(discriminator) " + +#. Tag: para +#: basic_mapping.xml:2513 +#, fuzzy, no-c-format +msgid "" +"Discriminators are required for polymorphic persistence using the table-per-" +"class-hierarchy mapping strategy. It declares a discriminator column of the " +"table. The discriminator column contains marker values that tell the " +"persistence layer what subclass to instantiate for a particular row. A " +"restricted set of types can be used: string, " +"character, integer, byte, short, boolean, " +"yes_no, true_false." +msgstr "" +"在\"一棵对象继承树对应一个表\"的策略中,<discriminator> 元素是必需的,它定义了表的鉴别器字段。鉴别器字段包含标志值,用于告知" +"持久化层应该为某个特定的行创建哪一个子类的实例。如下这些受到限制的类型可以使" +"用:stringcharacter、" +"integerbyteshortbooleanyes_no、" +"true_false。" + +#. Tag: para +#: basic_mapping.xml:2523 +#, no-c-format +msgid "" +"Use the @DiscriminatorColumn to define the " +"discriminator column as well as the discriminator type. Alternatively, you " +"can also use @DiscriminatorFormula to express in SQL " +"what would be in a virtual discriminator column. This is particularly handy " +"when the discriminator value can be extracted from one or more columns of " +"the table. Both @DiscriminatorColumn and " +"@DiscriminatorFormula are to be set on the root " +"entity (once per persisted hierarchy)." +msgstr "" + +#. Tag: para +#: basic_mapping.xml:2534 +#, no-c-format +msgid "" +"Finally, use @DiscriminatorValue on each class of the " +"hierarchy to specify the value stored in the discriminator column for a " +"given entity. If you do not set @DiscriminatorValue " +"on a class, the fully qualified class name is used." +msgstr "" + +#. Tag: para +#: basic_mapping.xml:2542 +#, no-c-format +msgid "" +"In hbm.xml, the <discriminator> element is used to " +"define the discriminator column or formula:" +msgstr "" + +#. Tag: programlisting +#: basic_mapping.xml:2559 +#, fuzzy, no-c-format +msgid "" +"<discriminator\n" +" column=\"discriminator_column\"\n" +" type=\"discriminator_type\"\n" +" force=\"true|false\"\n" +" insert=\"true|false\"\n" +" formula=\"arbitrary sql expression\"\n" +"/>" +msgstr "" +"]]>" + +#. Tag: para +#: basic_mapping.xml:2563 +#, no-c-format +msgid "" +"column (optional - defaults to class): " +"the name of the discriminator column." +msgstr "" +"column(可选 — 默认为 class)" +"discriminator 器字段的名字。" + +#. Tag: para +#: basic_mapping.xml:2569 +#, no-c-format +msgid "" +"type (optional - defaults to string): " +"a name that indicates the Hibernate type" +msgstr "" +"type(可选 — 默认为 string)一个 " +"Hibernate 字段类型的名字 " + +#. Tag: para +#: basic_mapping.xml:2575 +#, no-c-format +msgid "" +"force (optional - defaults to false): " +"\"forces\" Hibernate to specify the allowed discriminator values, even when " +"retrieving all instances of the root class." +msgstr "" +"force(强制)(可选 — 默认为 false)\"强" +"制\" Hibernate 指定允许的鉴别器值,即使当取得的所有实例都是根类的。 " + +#. Tag: para +#: basic_mapping.xml:2582 +#, no-c-format +msgid "" +"insert (optional - defaults to true): " +"set this to false if your discriminator column is also " +"part of a mapped composite identifier. It tells Hibernate not to include the " +"column in SQL INSERTs." +msgstr "" +"insert(可选 - 默认为true)如果你的鉴别" +"器字段也是映射为复合标识(composite identifier)的一部分,则需将这个值设为 " +"false。(告诉 Hibernate 在做 SQL INSERT 时不包含该列) " + +#. Tag: para +#: basic_mapping.xml:2590 +#, no-c-format +msgid "" +"formula (optional): an arbitrary SQL expression that is " +"executed when a type has to be evaluated. It allows content-based " +"discrimination." +msgstr "" +"formula(可选)一个 SQL 表达式,在类型判断(判断是父类还是" +"具体子类 — 译注)时执行。可用于基于内容的鉴别器。 " + +#. Tag: para +#: basic_mapping.xml:2597 +#, no-c-format +msgid "" +"Actual values of the discriminator column are specified by the " +"discriminator-value attribute of the <" +"class> and <subclass> elements." +msgstr "" +"鉴别器字段的实际值是根据 <class><" +"subclass> 元素中的 discriminator-value 属性得" +"来的。" + +#. Tag: para +#: basic_mapping.xml:2602 +#, no-c-format +msgid "" +"The force attribute is only useful if the table contains " +"rows with \"extra\" discriminator values that are not mapped to a persistent " +"class. This will not usually be the case." +msgstr "" +"force 属性仅仅在这种情况下有用的:表中包含没有被映射到持久" +"化类的附加辨别器值。这种情况不会经常遇到。 " + +#. Tag: para +#: basic_mapping.xml:2607 +#, no-c-format +msgid "" +"The formula attribute allows you to declare an arbitrary " +"SQL expression that will be used to evaluate the type of a row. For example:" +msgstr "" +"使用 formula 属性你可以定义一个 SQL 表达式,用来判断一行数" +"据的类型。" + +#. Tag: programlisting +#: basic_mapping.xml:2611 +#, fuzzy, no-c-format +msgid "" +"<discriminator\n" +" formula=\"case when CLASS_TYPE in ('a', 'b', 'c') then 0 else 1 end\"\n" +" type=\"integer\"/>" +msgstr "" +"]]>" + +#. Tag: title +#: basic_mapping.xml:2616 +#, fuzzy, no-c-format +msgid "Joined subclass strategy" msgstr "连接的子类(joined-subclass) " #. Tag: para +#: basic_mapping.xml:2618 +#, fuzzy, no-c-format +msgid "" +"Each subclass can also be mapped to its own table. This is called the table-" +"per-subclass mapping strategy. An inherited state is retrieved by joining " +"with the table of the superclass. A discriminator column is not required for " +"this mapping strategy. Each subclass must, however, declare a table column " +"holding the object identifier. The primary key of this table is also a " +"foreign key to the superclass table and described by the " +"@PrimaryKeyJoinColumns or the <key> element." +msgstr "" +"此外,每个子类可能被映射到他自己的表中(每个子类一个表的策略)。被继承的状态" +"通过和超类的表关联得到。我们使用 <joined-subclass> " +"元素。 " + +#. Tag: programlisting +#: basic_mapping.xml:2628 #, no-c-format -msgid "Each subclass can also be mapped to its own table. This is called the table-per-subclass mapping strategy. An inherited state is retrieved by joining with the table of the superclass. To do this you use the <joined-subclass> element. For example:" -msgstr "此外,每个子类可能被映射到他自己的表中(每个子类一个表的策略)。被继承的状态通过和超类的表关联得到。我们使用 <joined-subclass> 元素。 " +msgid "" +"@Entity @Table(name=\"CATS\")\n" +"@Inheritance(strategy=InheritanceType.JOINED)\n" +"public class Cat implements Serializable { \n" +" @Id @GeneratedValue(generator=\"cat-uuid\") \n" +" @GenericGenerator(name=\"cat-uuid\", strategy=\"uuid\")\n" +" String getId() { return id; }\n" +"\n" +" ...\n" +"}\n" +"\n" +"@Entity @Table(name=\"DOMESTIC_CATS\")\n" +"@PrimaryKeyJoinColumn(name=\"CAT\")\n" +"public class DomesticCat extends Cat { \n" +" public String getName() { return name; }\n" +"}" +msgstr "" #. Tag: para +#: basic_mapping.xml:2631 +#, no-c-format +msgid "" +"The table name still defaults to the non qualified class name. Also if " +"@PrimaryKeyJoinColumn is not set, the primary key / " +"foreign key columns are assumed to have the same names as the primary key " +"columns of the primary table of the superclass." +msgstr "" + +#. Tag: para +#: basic_mapping.xml:2638 +#, fuzzy, no-c-format +msgid "" +"In hbm.xml, use the <joined-subclass> element. For " +"example:" +msgstr "你可以使用 class 元素来定义一个持久化类。例如:" + +#. Tag: programlisting +#: basic_mapping.xml:2652 +#, fuzzy, no-c-format +msgid "" +"<joined-subclass\n" +" name=\"ClassName\"\n" +" table=\"tablename\"\n" +" proxy=\"ProxyInterface\"\n" +" lazy=\"true|false\"\n" +" dynamic-update=\"true|false\"\n" +" dynamic-insert=\"true|false\"\n" +" schema=\"schema\"\n" +" catalog=\"catalog\"\n" +" extends=\"SuperclassName\"\n" +" persister=\"ClassName\"\n" +" subselect=\"SQL expression\"\n" +" entity-name=\"EntityName\"\n" +" node=\"element-name\">\n" +"\n" +" <key .... >\n" +"\n" +" <property .... />\n" +" .....\n" +"</joined-subclass>" +msgstr "" +"<joined-subclass\n" +" name=\"ClassName\"\n" +" table=\"tablename\"\n" +" proxy=\"ProxyInterface\"\n" +" lazy=\"true|false\"\n" +" dynamic-update=\"true|false\"\n" +" dynamic-insert=\"true|false\"\n" +" schema=\"schema\"\n" +" catalog=\"catalog\"\n" +" extends=\"SuperclassName\"\n" +" persister=\"ClassName\"\n" +" subselect=\"SQL expression\"\n" +" entity-name=\"EntityName\"\n" +" node=\"element-name\">\n" +"\n" +" <key .... >\n" +"\n" +" <property .... />\n" +" .....\n" +"</joined-subclass>" + +#. Tag: para +#: basic_mapping.xml:2661 basic_mapping.xml:2725 #, no-c-format msgid "table: the name of the subclass table." msgstr "table:子类的表名。" #. Tag: para +#: basic_mapping.xml:2666 basic_mapping.xml:2730 #, no-c-format -msgid "proxy (optional): specifies a class or interface to use for lazy initializing proxies." -msgstr "proxy(可选):指定一个类或者接口,在延迟装载时作为代理使用。 " +msgid "" +"proxy (optional): specifies a class or interface to use " +"for lazy initializing proxies." +msgstr "" +"proxy(可选):指定一个类或者接口,在延迟装载时作为代理使" +"用。 " #. Tag: para +#: basic_mapping.xml:2671 basic_mapping.xml:2735 #, no-c-format -msgid "lazy (optional, defaults to true): setting lazy=\"false\" disables the use of lazy fetching." -msgstr "lazy(可选,默认是 true):设置为 lazy=\"false\" 禁止使用延迟装载。 " +msgid "" +"lazy (optional, defaults to true): " +"setting lazy=\"false\" disables the use of lazy fetching." +msgstr "" +"lazy(可选,默认是 true):设置为 " +"lazy=\"false\" 禁止使用延迟装载。 " #. Tag: para +#: basic_mapping.xml:2679 #, no-c-format -msgid "A discriminator column is not required for this mapping strategy. Each subclass must, however, declare a table column holding the object identifier using the <key> element. The mapping at the start of the chapter would then be re-written as:" -msgstr "这种映射策略不需要指定辨别标志(discriminator)字段。但是,每一个子类都必须使用 <key> 元素指定一个表字段来持有对象的标识符。本章开始的映射可以被用如下方式重写: " +msgid "" +"Use the <key> element to declare the primary key / " +"foreign key column. The mapping at the start of the chapter would then be re-" +"written as:" +msgstr "" + +#. Tag: programlisting +#: basic_mapping.xml:2683 +#, fuzzy, no-c-format +msgid "" +"<?xml version=\"1.0\"?>\n" +"<!DOCTYPE hibernate-mapping PUBLIC\n" +" \"-//Hibernate/Hibernate Mapping DTD//EN\"\n" +" \"http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd\">\n" +"\n" +"<hibernate-mapping package=\"eg\">\n" +"\n" +" <class name=\"Cat\" table=\"CATS\">\n" +" <id name=\"id\" column=\"uid\" type=\"long\">\n" +" <generator class=\"hilo\"/>\n" +" </id>\n" +" <property name=\"birthdate\" type=\"date\"/>\n" +" <property name=\"color\" not-null=\"true\"/>\n" +" <property name=\"sex\" not-null=\"true\"/>\n" +" <property name=\"weight\"/>\n" +" <many-to-one name=\"mate\"/>\n" +" <set name=\"kittens\">\n" +" <key column=\"MOTHER\"/>\n" +" <one-to-many class=\"Cat\"/>\n" +" </set>\n" +" <joined-subclass name=\"DomesticCat\" table=" +"\"DOMESTIC_CATS\">\n" +" <key column=\"CAT\"/>\n" +" <property name=\"name\" type=\"string\"/>\n" +" </joined-subclass>\n" +" </class>\n" +"\n" +" <class name=\"eg.Dog\">\n" +" <!-- mapping for Dog could go here -->\n" +" </class>\n" +"\n" +"</hibernate-mapping>" +msgstr "" +"<?xml version=\"1.0\"?>\n" +"<!DOCTYPE hibernate-mapping PUBLIC\n" +" \"-//Hibernate/Hibernate Mapping DTD//EN\"\n" +" \"http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd\">\n" +"\n" +"<hibernate-mapping package=\"eg\">\n" +"\n" +" <class name=\"Cat\" table=\"CATS\">\n" +" <id name=\"id\" column=\"uid\" type=\"long\">\n" +" <generator class=\"hilo\"/>\n" +" </id>\n" +" <property name=\"birthdate\" type=\"date\"/>\n" +" <property name=\"color\" not-null=\"true\"/>\n" +" <property name=\"sex\" not-null=\"true\"/>\n" +" <property name=\"weight\"/>\n" +" <many-to-one name=\"mate\"/>\n" +" <set name=\"kittens\">\n" +" <key column=\"MOTHER\"/>\n" +" <one-to-many class=\"Cat\"/>\n" +" </set>\n" +" <joined-subclass name=\"DomesticCat\" table=" +"\"DOMESTIC_CATS\">\n" +" <key column=\"CAT\"/>\n" +" <property name=\"name\" type=\"string\"/>\n" +" </joined-subclass>\n" +" </class>\n" +"\n" +" <class name=\"eg.Dog\">\n" +" <!-- mapping for Dog could go here -->\n" +" </class>\n" +"\n" +"</hibernate-mapping>" #. Tag: title +#: basic_mapping.xml:2690 #, no-c-format -msgid "Union-subclass" -msgstr "联合子类(union-subclass) " +msgid "Table per class strategy" +msgstr "" #. Tag: para +#: basic_mapping.xml:2692 +#, fuzzy, no-c-format +msgid "" +"A third option is to map only the concrete classes of an inheritance " +"hierarchy to tables. This is called the table-per-concrete-class strategy. " +"Each table defines all persistent states of the class, including the " +"inherited state. In Hibernate, it is not necessary to explicitly map such " +"inheritance hierarchies. You can map each class as a separate entity root. " +"However, if you wish use polymorphic associations (e.g. an association to " +"the superclass of your hierarchy), you need to use the union subclass " +"mapping." +msgstr "" +"第三种选择是仅仅映射类继承树中具体类部分到表中(每个具体类一张表的策略)。其" +"中,每张表定义了类的所有持久化状态,包括继承的状态。在 Hibernate 中,并不需要" +"完全显式地映射这样的继承树。你可以简单地使用单独的 <class> 定义映射每个类。然而,如果你想使用多态关联(例如,一个对类继承树中超" +"类的关联),你需要使用 <union-subclass> 映射。 " + +#. Tag: programlisting +#: basic_mapping.xml:2701 #, no-c-format -msgid "A third option is to map only the concrete classes of an inheritance hierarchy to tables. This is called the table-per-concrete-class strategy. Each table defines all persistent states of the class, including the inherited state. In Hibernate, it is not necessary to explicitly map such inheritance hierarchies. You can map each class with a separate <class> declaration. However, if you wish use polymorphic associations (e.g. an association to the superclass of your hierarchy), you need to use the <union-subclass> mapping. For example:" -msgstr "第三种选择是仅仅映射类继承树中具体类部分到表中(每个具体类一张表的策略)。其中,每张表定义了类的所有持久化状态,包括继承的状态。在 Hibernate 中,并不需要完全显式地映射这样的继承树。你可以简单地使用单独的 <class> 定义映射每个类。然而,如果你想使用多态关联(例如,一个对类继承树中超类的关联),你需要使用 <union-subclass> 映射。 " +msgid "" +"@Entity\n" +"@Inheritance(strategy = InheritanceType.TABLE_PER_CLASS)\n" +"public class Flight implements Serializable { ... }" +msgstr "" #. Tag: para +#: basic_mapping.xml:2703 #, no-c-format -msgid "No discriminator column or key column is required for this mapping strategy." +msgid "Or in hbm.xml:" +msgstr "" + +#. Tag: programlisting +#: basic_mapping.xml:2716 +#, fuzzy, no-c-format +msgid "" +"<union-subclass\n" +" name=\"ClassName\"\n" +" table=\"tablename\"\n" +" proxy=\"ProxyInterface\"\n" +" lazy=\"true|false\"\n" +" dynamic-update=\"true|false\"\n" +" dynamic-insert=\"true|false\"\n" +" schema=\"schema\"\n" +" catalog=\"catalog\"\n" +" extends=\"SuperclassName\"\n" +" abstract=\"true|false\"\n" +" persister=\"ClassName\"\n" +" subselect=\"SQL expression\"\n" +" entity-name=\"EntityName\"\n" +" node=\"element-name\">\n" +"\n" +" <property .... />\n" +" .....\n" +"</union-subclass>" +msgstr "" +"<union-subclass\n" +" name=\"ClassName\"\n" +" table=\"tablename\"\n" +" proxy=\"ProxyInterface\"\n" +" lazy=\"true|false\"\n" +" dynamic-update=\"true|false\"\n" +" dynamic-insert=\"true|false\"\n" +" schema=\"schema\"\n" +" catalog=\"catalog\"\n" +" extends=\"SuperclassName\"\n" +" abstract=\"true|false\"\n" +" persister=\"ClassName\"\n" +" subselect=\"SQL expression\"\n" +" entity-name=\"EntityName\"\n" +" node=\"element-name\">\n" +"\n" +" <property .... />\n" +" .....\n" +"</union-subclass>" + +#. Tag: para +#: basic_mapping.xml:2743 +#, no-c-format +msgid "" +"No discriminator column or key column is required for this mapping strategy." msgstr "这种映射策略不需要指定辨别标志(discriminator)字段。" #. Tag: title +#: basic_mapping.xml:2751 #, no-c-format -msgid "Join" -msgstr "连接(join) " +msgid "Inherit properties from superclasses" +msgstr "" #. Tag: para +#: basic_mapping.xml:2753 #, no-c-format -msgid "Using the <join> element, it is possible to map properties of one class to several tables that have a one-to-one relationship. For example:" -msgstr "使用 <join> 元素,假若在表之间存在一对一关联,可以将一个类的属性映射到多张表中。 " +msgid "" +"This is sometimes useful to share common properties through a technical or a " +"business superclass without including it as a regular mapped entity (ie no " +"specific table for this entity). For that purpose you can map them as " +"@MappedSuperclass." +msgstr "" + +#. Tag: programlisting +#: basic_mapping.xml:2758 +#, no-c-format +msgid "" +"@MappedSuperclass\n" +"public class BaseEntity {\n" +" @Basic\n" +" @Temporal(TemporalType.TIMESTAMP)\n" +" public Date getLastUpdate() { ... }\n" +" public String getLastUpdater() { ... }\n" +" ...\n" +"}\n" +"\n" +"@Entity class Order extends BaseEntity {\n" +" @Id public Integer getId() { ... }\n" +" ...\n" +"}" +msgstr "" #. Tag: para +#: basic_mapping.xml:2760 +#, no-c-format +msgid "" +"In database, this hierarchy will be represented as an Order table having the id, lastUpdate and lastUpdater columns. The embedded superclass " +"property mappings are copied into their entity subclasses. Remember that the " +"embeddable superclass is not the root of the hierarchy though." +msgstr "" + +#. Tag: para +#: basic_mapping.xml:2768 +#, no-c-format +msgid "" +"Properties from superclasses not mapped as @MappedSuperclass are ignored." +msgstr "" + +#. Tag: para +#: basic_mapping.xml:2773 +#, no-c-format +msgid "" +"The default access type (field or methods) is used, unless you use the " +"@Access annotation." +msgstr "" + +#. Tag: para +#: basic_mapping.xml:2778 +#, no-c-format +msgid "" +"The same notion can be applied to @Embeddable objects to " +"persist properties from their superclasses. You also need to use " +"@MappedSuperclass to do that (this should not be " +"considered as a standard EJB3 feature though)" +msgstr "" + +#. Tag: para +#: basic_mapping.xml:2786 +#, no-c-format +msgid "" +"It is allowed to mark a class as @MappedSuperclass in the " +"middle of the mapped inheritance hierarchy." +msgstr "" + +#. Tag: para +#: basic_mapping.xml:2792 +#, no-c-format +msgid "" +"Any class in the hierarchy non annotated with @MappedSuperclass nor @Entity will be ignored." +msgstr "" + +#. Tag: para +#: basic_mapping.xml:2797 +#, no-c-format +msgid "" +"You can override columns defined in entity superclasses at the root entity " +"level using the @AttributeOverride annotation." +msgstr "" + +#. Tag: programlisting +#: basic_mapping.xml:2801 +#, no-c-format +msgid "" +"@MappedSuperclass\n" +"public class FlyingObject implements Serializable {\n" +"\n" +" public int getAltitude() {\n" +" return altitude;\n" +" }\n" +"\n" +" @Transient\n" +" public int getMetricAltitude() {\n" +" return metricAltitude;\n" +" }\n" +"\n" +" @ManyToOne\n" +" public PropulsionType getPropulsion() {\n" +" return metricAltitude;\n" +" }\n" +" ...\n" +"}\n" +"\n" +"@Entity\n" +"@AttributeOverride( name=\"altitude\", column = @Column(name=\"fld_altitude" +"\") )\n" +"@AssociationOverride( \n" +" name=\"propulsion\", \n" +" joinColumns = @JoinColumn(name=\"fld_propulsion_fk\") \n" +")\n" +"public class Plane extends FlyingObject {\n" +" ...\n" +"}" +msgstr "" + +#. Tag: para +#: basic_mapping.xml:2803 +#, no-c-format +msgid "" +"The altitude property will be persisted in an " +"fld_altitude column of table Plane and " +"the propulsion association will be materialized in a " +"fld_propulsion_fk foreign key column." +msgstr "" + +#. Tag: para +#: basic_mapping.xml:2809 +#, no-c-format +msgid "" +"You can define @AttributeOverride(s) and " +"@AssociationOverride(s) on @Entity " +"classes, @MappedSuperclass classes and properties " +"pointing to an @Embeddable object." +msgstr "" + +#. Tag: para +#: basic_mapping.xml:2815 +#, no-c-format +msgid "" +"In hbm.xml, simply map the properties of the superclass in the <" +"class> element of the entity that needs to inherit them." +msgstr "" + +#. Tag: title +#: basic_mapping.xml:2821 +#, no-c-format +msgid "Mapping one entity to several tables" +msgstr "" + +#. Tag: para +#: basic_mapping.xml:2823 +#, no-c-format +msgid "" +"While not recommended for a fresh schema, some legacy databases force your " +"to map a single entity on several tables." +msgstr "" + +#. Tag: para +#: basic_mapping.xml:2826 +#, no-c-format +msgid "" +"Using the @SecondaryTable or @SecondaryTables class level annotations. To express that a column is in a " +"particular table, use the table parameter of " +"@Column or @JoinColumn." +msgstr "" + +#. Tag: programlisting +#: basic_mapping.xml:2832 +#, no-c-format +msgid "" +"@Entity\n" +"@Table(name=\"MainCat\")\n" +"@SecondaryTables({\n" +" @SecondaryTable(name=\"Cat1\", pkJoinColumns={\n" +" @PrimaryKeyJoinColumn(name=\"cat_id\", referencedColumnName=\"id\")\n" +" ),\n" +" @SecondaryTable(name=\"Cat2\", uniqueConstraints={@UniqueConstraint" +"(columnNames={\"storyPart2\"})})\n" +"})\n" +"public class Cat implements Serializable {\n" +"\n" +" private Integer id;\n" +" private String name;\n" +" private String storyPart1;\n" +" private String storyPart2;\n" +"\n" +" @Id @GeneratedValue\n" +" public Integer getId() {\n" +" return id;\n" +" }\n" +"\n" +" public String getName() {\n" +" return name;\n" +" }\n" +" \n" +" @Column(table=\"Cat1\")\n" +" public String getStoryPart1() {\n" +" return storyPart1;\n" +" }\n" +"\n" +" @Column(table=\"Cat2\")\n" +" public String getStoryPart2() {\n" +" return storyPart2;\n" +" }\n" +"}" +msgstr "" + +#. Tag: para +#: basic_mapping.xml:2834 +#, no-c-format +msgid "" +"In this example, name will be in MainCat. storyPart1 will be in Cat1 " +"and storyPart2 will be in Cat2. " +"Cat1 will be joined to MainCat using " +"the cat_id as a foreign key, and Cat2 " +"using id (ie the same column name, the MainCat id column has). Plus a unique constraint on storyPart2 has been set." +msgstr "" + +#. Tag: para +#: basic_mapping.xml:2844 +#, no-c-format +msgid "" +"There is also additional tuning accessible via the @org.hibernate." +"annotations.Table annotation:" +msgstr "" + +#. Tag: para +#: basic_mapping.xml:2850 +#, fuzzy, no-c-format +msgid "" +"fetch: If set to JOIN, the default, Hibernate will use an " +"inner join to retrieve a secondary table defined by a class or its " +"superclasses and an outer join for a secondary table defined by a subclass. " +"If set to SELECT then Hibernate will use a sequential " +"select for a secondary table defined on a subclass, which will be issued " +"only if a row turns out to represent an instance of the subclass. Inner " +"joins will still be used to retrieve a secondary defined by the class and " +"its superclasses." +msgstr "" +"fetch(可选 — 默认是 join):如果设置为" +"默认值 join,Hibernate 将使用一个内连接来得到这个类或其超" +"类定义的 <join>,而使用一个外连接来得到其子类定义的 " +"<join>。如果设置为 select,则 " +"Hibernate 将为子类定义的 <join> 使用顺序选择。这仅在" +"一行数据表示一个子类的对象的时候才会发生。对这个类和其超类定义的 " +"<join>,依然会使用内连接得到。 " + +#. Tag: para +#: basic_mapping.xml:2862 +#, fuzzy, no-c-format +msgid "" +"inverse: If true, Hibernate will not try to insert or " +"update the properties defined by this join. Default to false." +msgstr "" +"inverse(可选 — 默认是 false):如果打" +"开,Hibernate 不会插入或者更新此连接定义的属性。 " + +#. Tag: para +#: basic_mapping.xml:2868 +#, fuzzy, no-c-format +msgid "" +"optional: If enabled (the default), Hibernate will insert " +"a row only if the properties defined by this join are non-null and will " +"always use an outer join to retrieve the properties." +msgstr "" +"optional(可选 — 默认是 false):如果打" +"开,Hibernate 只会在此连接定义的属性非空时插入一行数据,并且总是使用一个外连" +"接来得到这些属性。 " + +#. Tag: para +#: basic_mapping.xml:2875 +#, no-c-format +msgid "" +"foreignKey: defines the Foreign Key name of a secondary " +"table pointing back to the primary table." +msgstr "" + +#. Tag: para +#: basic_mapping.xml:2880 +#, no-c-format +msgid "" +"Make sure to use the secondary table name in the appliesto property" +msgstr "" + +#. Tag: programlisting +#: basic_mapping.xml:2883 +#, no-c-format +msgid "" +"@Entity\n" +"@Table(name=\"MainCat\")\n" +"@SecondaryTable(name=\"Cat1\")\n" +"@org.hibernate.annotations.Table(\n" +" appliesTo=\"Cat1\",\n" +" fetch=FetchMode.SELECT,\n" +" optional=true)\n" +"public class Cat implements Serializable {\n" +"\n" +" private Integer id;\n" +" private String name;\n" +" private String storyPart1;\n" +" private String storyPart2;\n" +"\n" +" @Id @GeneratedValue\n" +" public Integer getId() {\n" +" return id;\n" +" }\n" +"\n" +" public String getName() {\n" +" return name;\n" +" }\n" +" \n" +" @Column(table=\"Cat1\")\n" +" public String getStoryPart1() {\n" +" return storyPart1;\n" +" }\n" +"\n" +" @Column(table=\"Cat2\")\n" +" public String getStoryPart2() {\n" +" return storyPart2;\n" +" }\n" +"}" +msgstr "" + +#. Tag: para +#: basic_mapping.xml:2885 +#, fuzzy, no-c-format +msgid "In hbm.xml, use the <join> element." +msgstr "例如,如果我们有如下的 <properties> 映射:" + +#. Tag: programlisting +#: basic_mapping.xml:2903 +#, fuzzy, no-c-format +msgid "" +"<join\n" +" table=\"tablename\"\n" +" schema=\"owner\"\n" +" catalog=\"catalog\"\n" +" fetch=\"join|select\"\n" +" inverse=\"true|false\"\n" +" optional=\"true|false\">\n" +"\n" +" <key ... />\n" +"\n" +" <property ... />\n" +" ...\n" +"</join>" +msgstr "" +"<join\n" +" table=\"tablename\"\n" +" schema=\"owner\"\n" +" catalog=\"catalog\"\n" +" fetch=\"join|select\"\n" +" inverse=\"true|false\"\n" +" optional=\"true|false\">\n" +" \n" +" <key ... />\n" +" \n" +" <property ... />\n" +" ...\n" +"</join>" + +#. Tag: para +#: basic_mapping.xml:2907 #, no-c-format msgid "table: the name of the joined table." msgstr "table:被连接表的名称。 " #. Tag: para +#: basic_mapping.xml:2924 #, no-c-format -msgid "fetch (optional - defaults to join): if set to join, the default, Hibernate will use an inner join to retrieve a <join> defined by a class or its superclasses. It will use an outer join for a <join> defined by a subclass. If set to select then Hibernate will use a sequential select for a <join> defined on a subclass. This will be issued only if a row represents an instance of the subclass. Inner joins will still be used to retrieve a <join> defined by the class and its superclasses." -msgstr "fetch(可选 — 默认是 join):如果设置为默认值 join,Hibernate 将使用一个内连接来得到这个类或其超类定义的 <join>,而使用一个外连接来得到其子类定义的 <join>。如果设置为 select,则 Hibernate 将为子类定义的 <join> 使用顺序选择。这仅在一行数据表示一个子类的对象的时候才会发生。对这个类和其超类定义的 <join>,依然会使用内连接得到。 " +msgid "" +"fetch (optional - defaults to join): " +"if set to join, the default, Hibernate will use an inner " +"join to retrieve a <join> defined by a class or its " +"superclasses. It will use an outer join for a <join> defined by a subclass. If set to select then " +"Hibernate will use a sequential select for a <join> " +"defined on a subclass. This will be issued only if a row represents an " +"instance of the subclass. Inner joins will still be used to retrieve a " +"<join> defined by the class and its superclasses." +msgstr "" +"fetch(可选 — 默认是 join):如果设置为" +"默认值 join,Hibernate 将使用一个内连接来得到这个类或其超" +"类定义的 <join>,而使用一个外连接来得到其子类定义的 " +"<join>。如果设置为 select,则 " +"Hibernate 将为子类定义的 <join> 使用顺序选择。这仅在" +"一行数据表示一个子类的对象的时候才会发生。对这个类和其超类定义的 " +"<join>,依然会使用内连接得到。 " #. Tag: para +#: basic_mapping.xml:2939 #, no-c-format -msgid "inverse (optional - defaults to false): if enabled, Hibernate will not insert or update the properties defined by this join." -msgstr "inverse(可选 — 默认是 false):如果打开,Hibernate 不会插入或者更新此连接定义的属性。 " +msgid "" +"inverse (optional - defaults to false): if enabled, Hibernate will not insert or update the properties " +"defined by this join." +msgstr "" +"inverse(可选 — 默认是 false):如果打" +"开,Hibernate 不会插入或者更新此连接定义的属性。 " #. Tag: para +#: basic_mapping.xml:2945 #, no-c-format -msgid "optional (optional - defaults to false): if enabled, Hibernate will insert a row only if the properties defined by this join are non-null. It will always use an outer join to retrieve the properties." -msgstr "optional(可选 — 默认是 false):如果打开,Hibernate 只会在此连接定义的属性非空时插入一行数据,并且总是使用一个外连接来得到这些属性。 " +msgid "" +"optional (optional - defaults to false): if enabled, Hibernate will insert a row only if the properties " +"defined by this join are non-null. It will always use an outer join to " +"retrieve the properties." +msgstr "" +"optional(可选 — 默认是 false):如果打" +"开,Hibernate 只会在此连接定义的属性非空时插入一行数据,并且总是使用一个外连" +"接来得到这些属性。 " #. Tag: para +#: basic_mapping.xml:2953 #, no-c-format -msgid "For example, address information for a person can be mapped to a separate table while preserving value type semantics for all properties:" -msgstr "例如,一个人(person)的地址(address)信息可以被映射到单独的表中(并保留所有属性的值类型语义): " +msgid "" +"For example, address information for a person can be mapped to a separate " +"table while preserving value type semantics for all properties:" +msgstr "" +"例如,一个人(person)的地址(address)信息可以被映射到单独的表中(并保留所有" +"属性的值类型语义): " + +#. Tag: programlisting +#: basic_mapping.xml:2957 +#, fuzzy, no-c-format +msgid "" +"<class name=\"Person\"\n" +" table=\"PERSON\">\n" +"\n" +" <id name=\"id\" column=\"PERSON_ID\">...</id>\n" +"\n" +" <join table=\"ADDRESS\">\n" +" <key column=\"ADDRESS_ID\"/>\n" +" <property name=\"address\"/>\n" +" <property name=\"zip\"/>\n" +" <property name=\"country\"/>\n" +" </join>\n" +" ..." +msgstr "" +"<class name=\"Person\"\n" +" table=\"PERSON\">\n" +"\n" +" <id name=\"id\" column=\"PERSON_ID\">...</id>\n" +"\n" +" <join table=\"ADDRESS\">\n" +" <key column=\"ADDRESS_ID\"/>\n" +" <property name=\"address\"/>\n" +" <property name=\"zip\"/>\n" +" <property name=\"country\"/>\n" +" </join>\n" +" ..." #. Tag: para +#: basic_mapping.xml:2959 #, no-c-format -msgid "This feature is often only useful for legacy data models. We recommend fewer tables than classes and a fine-grained domain model. However, it is useful for switching between inheritance mapping strategies in a single hierarchy, as explained later." -msgstr "此特性常常对遗留数据模型有用,我们推荐表个数比类个数少,以及细粒度的领域模型。然而,在单独的继承树上切换继承映射策略是有用的,后面会解释这点。 " +msgid "" +"This feature is often only useful for legacy data models. We recommend fewer " +"tables than classes and a fine-grained domain model. However, it is useful " +"for switching between inheritance mapping strategies in a single hierarchy, " +"as explained later." +msgstr "" +"此特性常常对遗留数据模型有用,我们推荐表个数比类个数少,以及细粒度的领域模" +"型。然而,在单独的继承树上切换继承映射策略是有用的,后面会解释这点。 " #. Tag: title +#: basic_mapping.xml:2967 #, no-c-format -msgid "Key" -msgstr "Key" +msgid "Mapping one to one and one to many associations" +msgstr "" #. Tag: para +#: basic_mapping.xml:2969 #, no-c-format -msgid "The <key> element has featured a few times within this guide. It appears anywhere the parent mapping element defines a join to a new table that references the primary key of the original table. It also defines the foreign key in the joined table:" -msgstr "我们目前已经见到过 <key> 元素多次了。这个元素在父映射元素定义了对新表的连接,并且在被连接表中定义了一个外键引用原表的主键的情况下经常使用。 " +msgid "" +"To link one entity to an other, you need to map the association property as " +"a to one association. In the relational model, you can either use a foreign " +"key or an association table, or (a bit less common) share the same primary " +"key value between the two entities." +msgstr "" #. Tag: para +#: basic_mapping.xml:2974 #, no-c-format -msgid "on-delete (optional - defaults to noaction): specifies whether the foreign key constraint has database-level cascade delete enabled." -msgstr "on-delete(可选,默认是 noaction):表明外键关联是否打开数据库级别的级联删除。 " +msgid "" +"To mark an association, use either @ManyToOne or " +"@OnetoOne." +msgstr "" #. Tag: para +#: basic_mapping.xml:2978 #, no-c-format -msgid "property-ref (optional): specifies that the foreign key refers to columns that are not the primary key of the original table. It is provided for legacy data." -msgstr "property-ref(可选):表明外键引用的字段不是原表的主键(提供给遗留数据)。 " +msgid "" +"@ManyToOne and @OneToOne have a " +"parameter named targetEntity which describes the target " +"entity name. You usually don't need this parameter since the default value " +"(the type of the property that stores the association) is good in almost all " +"cases. However this is useful when you want to use interfaces as the return " +"type instead of the regular entity." +msgstr "" #. Tag: para +#: basic_mapping.xml:2985 #, no-c-format -msgid "not-null (optional): specifies that the foreign key columns are not nullable. This is implied whenever the foreign key is also part of the primary key." -msgstr "not-null(可选):表明外键的字段不可为空(这意味着无论何时外键都是主键的一部分)。 " +msgid "" +"Setting a value of the cascade attribute to any " +"meaningful value other than nothing will propagate certain operations to the " +"associated object. The meaningful values are divided into three categories." +msgstr "" #. Tag: para +#: basic_mapping.xml:2992 #, no-c-format -msgid "update (optional): specifies that the foreign key should never be updated. This is implied whenever the foreign key is also part of the primary key." -msgstr "update(可选):表明外键决不应该被更新(这意味着无论何时外键都是主键的一部分)。 " +msgid "" +"basic operations, which include: persist, merge, delete, save-" +"update, evict, replicate, lock and refresh;" +msgstr "" #. Tag: para -#, no-c-format -msgid "unique (optional): specifies that the foreign key should have a unique constraint. This is implied whenever the foreign key is also the primary key." -msgstr "unique(可选):表明外键应有唯一性约束(这意味着无论何时外键都是主键的一部分)。 " +#: basic_mapping.xml:2998 +#, fuzzy, no-c-format +msgid "" +"special values: delete-orphan or all ;" +msgstr "" +"注意这里关联是如何用 entity-name 来代替 class 的。 " #. Tag: para +#: basic_mapping.xml:3003 #, no-c-format -msgid "For systems where delete performance is important, we recommend that all keys should be defined on-delete=\"cascade\". Hibernate uses a database-level ON CASCADE DELETE constraint, instead of many individual DELETE statements. Be aware that this feature bypasses Hibernate's usual optimistic locking strategy for versioned data." -msgstr "对那些看重删除性能的系统,我们推荐所有的键都应该定义为 on-delete=\"cascade\",这样 Hibernate 将使用数据库级的 ON CASCADE DELETE 约束,而不是多个 DELETE 语句。注意,这个特性会绕过 Hibernate 通常对版本数据(versioned data)采用的乐观锁策略。 " +msgid "" +"comma-separated combinations of operation names: cascade=\"persist," +"merge,evict\" or cascade=\"all,delete-orphan\". " +"See for a full explanation. Note " +"that single valued many-to-one associations do not support orphan delete." +msgstr "" #. Tag: para +#: basic_mapping.xml:3012 #, no-c-format -msgid "The not-null and update attributes are useful when mapping a unidirectional one-to-many association. If you map a unidirectional one-to-many association to a non-nullable foreign key, you must declare the key column using <key not-null=\"true\">." -msgstr "not-nullupdate 属性在映射单向一对多关联的时候有用。如果你映射一个单向一对多关联到非空的(non-nullable)外键,你必须<key not-null=\"true\"> 定义此键字段。 " +msgid "" +"By default, single point associations are eagerly fetched in JPA 2. You can " +"mark it as lazily fetched by using @ManyToOne(fetch=FetchType." +"LAZY) in which case Hibernate will proxy the association and " +"load it when the state of the associated entity is reached. You can force " +"Hibernate not to use a proxy by using @LazyToOne(NO_PROXY). In this case, the property is fetched lazily when the instance " +"variable is first accessed. This requires build-time bytecode " +"instrumentation. lazy=\"false\" specifies that the association will always " +"be eagerly fetched." +msgstr "" + +#. Tag: para +#: basic_mapping.xml:3022 +#, no-c-format +msgid "" +"With the default JPA options, single-ended associations are loaded with a " +"subsequent select if set to LAZY, or a SQL JOIN is used " +"for EAGER associations. You can however adjust the " +"fetching strategy, ie how data is fetched by using @Fetch. FetchMode can be SELECT (a " +"select is triggered when the association needs to be loaded) or " +"JOIN (use a SQL JOIN to load the association while " +"loading the owner entity). JOIN overrides any lazy " +"attribute (an association loaded through a JOIN strategy " +"cannot be lazy)." +msgstr "" #. Tag: title -#, no-c-format -msgid "Column and formula elements" -msgstr "字段和规则元素(column and formula elements) " +#: basic_mapping.xml:3034 +#, fuzzy, no-c-format +msgid "Using a foreign key or an association table" +msgstr "惟一外键关联" #. Tag: para -#, no-c-format -msgid "Mapping elements which accept a column attribute will alternatively accept a <column> subelement. Likewise, <formula> is an alternative to the formula attribute. For example:" -msgstr "任何接受 column 属性的映射元素都可以选择接受 <column> 子元素。同样的,formula 子元素也可以替换 <formula> 属性。 " +#: basic_mapping.xml:3036 +#, fuzzy, no-c-format +msgid "An ordinary association to another persistent class is declared using a" +msgstr "" +"持久化对象之间一对一的关联关系是通过 one-to-one 元素定义" +"的。" #. Tag: para +#: basic_mapping.xml:3041 #, no-c-format -msgid "Most of the attributes on column provide a means of tailoring the DDL during automatic schema generation. The read and write attributes allow you to specify custom SQL that Hibernate will use to access the column's value. For more on this, see the discussion of column read and write expressions." -msgstr "column 上的大多数属性都提供了在自动模式生成过程中对 DDL 进行裁剪的方法。readwrite 属性允许你指定 Hibernate 用于访问字段值的自定义的 SQL。关于更多的内容,请参考 column read and write expressions。" +msgid "" +"@ManyToOne if several entities can point to the the " +"target entity" +msgstr "" #. Tag: para +#: basic_mapping.xml:3046 #, no-c-format -msgid "The column and formula elements can even be combined within the same property or association mapping to express, for example, exotic join conditions." -msgstr "columnformula 属性甚至可以在同一个属性或关联映射中被合并来表达,例如,一些奇异的连接条件。" +msgid "" +"@OneToOne if only a single entity can point to the " +"the target entity" +msgstr "" + +#. Tag: para +#: basic_mapping.xml:3051 +#, no-c-format +msgid "" +"and a foreign key in one table is referencing the primary key column(s) of " +"the target table." +msgstr "" + +#. Tag: programlisting +#: basic_mapping.xml:3054 +#, no-c-format +msgid "" +"@Entity\n" +"public class Flight implements Serializable {\n" +" @ManyToOne( cascade = {CascadeType.PERSIST, CascadeType.MERGE} )\n" +" @JoinColumn(name=\"COMP_ID\")\n" +" public Company getCompany() {\n" +" return company;\n" +" }\n" +" ...\n" +"}" +msgstr "" + +#. Tag: para +#: basic_mapping.xml:3056 +#, no-c-format +msgid "" +"The @JoinColumn attribute is optional, the default value" +"(s) is the concatenation of the name of the relationship in the owner side, " +"_ (underscore), and the name of the primary key column in " +"the owned side. In this example company_id because the " +"property name is company and the column id of Company is " +"id." +msgstr "" + +#. Tag: programlisting +#: basic_mapping.xml:3064 +#, no-c-format +msgid "" +"@Entity\n" +"public class Flight implements Serializable {\n" +" @ManyToOne( cascade = {CascadeType.PERSIST, CascadeType.MERGE}, " +"targetEntity=CompanyImpl.class )\n" +" @JoinColumn(name=\"COMP_ID\")\n" +" public Company getCompany() {\n" +" return company;\n" +" }\n" +" ...\n" +"}\n" +"\n" +"public interface Company {\n" +" ...\n" +"}" +msgstr "" + +#. Tag: para +#: basic_mapping.xml:3066 +#, no-c-format +msgid "" +"You can also map a to one association through an association table. This " +"association table described by the @JoinTable annotation " +"will contains a foreign key referencing back the entity table (through " +"@JoinTable.joinColumns) and a a foreign key referencing " +"the target entity table (through @JoinTable.inverseJoinColumns)." +msgstr "" + +#. Tag: programlisting +#: basic_mapping.xml:3074 +#, no-c-format +msgid "" +"@Entity\n" +"public class Flight implements Serializable {\n" +" @ManyToOne( cascade = {CascadeType.PERSIST, CascadeType.MERGE} )\n" +" @JoinTable(name=\"Flight_Company\",\n" +" joinColumns = @JoinColumn(name=\"FLIGHT_ID\"),\n" +" inverseJoinColumns = @JoinColumn(name=\"COMP_ID\")\n" +" )\n" +" public Company getCompany() {\n" +" return company;\n" +" }\n" +" ...\n" +"}" +msgstr "" + +#. Tag: para +#: basic_mapping.xml:3077 +#, no-c-format +msgid "" +"You can use a SQL fragment to simulate a physical join column using the " +"@JoinColumnOrFormula / " +"@JoinColumnOrformulas annotations (just like you can " +"use a SQL fragment to simulate a property column via the " +"@Formula annotation)." +msgstr "" + +#. Tag: programlisting +#: basic_mapping.xml:3083 +#, no-c-format +msgid "" +"@Entity\n" +"public class Ticket implements Serializable {\n" +" @ManyToOne\n" +" @JoinColumnOrFormula(formula=\"(firstname + ' ' + lastname)\")\n" +" public Person getOwner() {\n" +" return person;\n" +" }\n" +" ...\n" +"}" +msgstr "" + +#. Tag: para +#: basic_mapping.xml:3086 +#, no-c-format +msgid "" +"You can mark an association as mandatory by using the " +"optional=false attribute. We recommend to use Bean " +"Validation's @NotNull annotation as a better " +"alternative however. As a consequence, the foreign key column(s) will be " +"marked as not nullable (if possible)." +msgstr "" + +#. Tag: para +#: basic_mapping.xml:3092 +#, no-c-format +msgid "" +"When Hibernate cannot resolve the association because the expected " +"associated element is not in database (wrong id on the association column), " +"an exception is raised. This might be inconvenient for legacy and badly " +"maintained schemas. You can ask Hibernate to ignore such elements instead of " +"raising an exception using the @NotFound annotation." +msgstr "" #. Tag: title +#: basic_mapping.xml:3100 #, no-c-format -msgid "Import" -msgstr "引用(import) " +msgid "@NotFound annotation" +msgstr "" + +#. Tag: programlisting +#: basic_mapping.xml:3102 +#, no-c-format +msgid "" +"@Entity\n" +"public class Child {\n" +" ...\n" +" @ManyToOne\n" +" @NotFound(action=NotFoundAction.IGNORE)\n" +" public Parent getParent() { ... }\n" +" ...\n" +"}" +msgstr "" #. Tag: para +#: basic_mapping.xml:3105 #, no-c-format -msgid "If your application has two persistent classes with the same name, and you do not want to specify the fully qualified package name in Hibernate queries, classes can be \"imported\" explicitly, rather than relying upon auto-import=\"true\". You can also import classes and interfaces that are not explicitly mapped:" -msgstr "假设你的应用程序有两个同样名字的持久化类,但是你不想在 Hibernate 查询中使用他们的全限定名。除了依赖 auto-import=\"true\" 以外,类也可以被显式地“import(引用)”。你甚至可以引用没有被明确映射的类和接口。 " - -#. Tag: para -#, no-c-format -msgid "class: the fully qualified class name of any Java class." -msgstr "class:任何 Java 类的全限定名。 " - -#. Tag: para -#, no-c-format -msgid "rename (optional - defaults to the unqualified class name): a name that can be used in the query language." -msgstr "rename(可选 — 默认为类的全限定名):在查询语句中可以使用的名字。 " +msgid "" +"Sometimes you want to delegate to your database the deletion of cascade when " +"a given entity is deleted. In this case Hibernate generates a cascade delete " +"constraint at the database level." +msgstr "" #. Tag: title +#: basic_mapping.xml:3110 #, no-c-format -msgid "Any" -msgstr "Any" +msgid "@OnDelete annotation" +msgstr "" + +#. Tag: programlisting +#: basic_mapping.xml:3112 +#, no-c-format +msgid "" +"@Entity\n" +"public class Child {\n" +" ...\n" +" @ManyToOne\n" +" @OnDelete(action=OnDeleteAction.CASCADE)\n" +" public Parent getParent() { ... }\n" +" ...\n" +"}" +msgstr "" #. Tag: para +#: basic_mapping.xml:3115 #, no-c-format -msgid "There is one more type of property mapping. The <any> mapping element defines a polymorphic association to classes from multiple tables. This type of mapping requires more than one column. The first column contains the type of the associated entity. The remaining columns contain the identifier. It is impossible to specify a foreign key constraint for this kind of association. This is not the usual way of mapping polymorphic associations and you should use this only in special cases. For example, for audit logs, user session data, etc." -msgstr "这是属性映射的又一种类型。<any> 映射元素定义了一种从多个表到类的多态关联。这种类型的映射常常需要多于一个字段。第一个字段持有被关联实体的类型,其他的字段持有标识符。对这种类型的关联来说,不可能指定一个外键约束,所以这当然不是映射(多态)关联的通常的方式。你只应该在非常特殊的情况下使用它(比如,审计 log,用户会话数据等等)。 " +msgid "" +"Foreign key constraints, while generated by Hibernate, have a fairly " +"unreadable name. You can override the constraint name using " +"@ForeignKey." +msgstr "" + +#. Tag: title +#: basic_mapping.xml:3120 +#, fuzzy, no-c-format +msgid "@ForeignKey annotation" +msgstr "惟一外键关联" + +#. Tag: programlisting +#: basic_mapping.xml:3122 +#, no-c-format +msgid "" +"@Entity\n" +"public class Child {\n" +" ...\n" +" @ManyToOne\n" +" @ForeignKey(name=\"FK_PARENT\")\n" +" public Parent getParent() { ... }\n" +" ...\n" +"}\n" +"\n" +"alter table Child add constraint FK_PARENT foreign key (parent_id) " +"references Parent" +msgstr "" #. Tag: para +#: basic_mapping.xml:3125 #, no-c-format -msgid "The meta-type attribute allows the application to specify a custom type that maps database column values to persistent classes that have identifier properties of the type specified by id-type. You must specify the mapping from values of the meta-type to class names." -msgstr "meta-type 属性使得应用程序能指定一个将数据库字段的值映射到持久化类的自定义类型。这个持久化类包含有用 id-type 指定的标识符属性。你必须指定从 meta-type 的值到类名的映射。 " +msgid "" +"Sometimes, you want to link one entity to an other not by the target entity " +"primary key but by a different unique key. You can achieve that by " +"referencing the unique key column(s) in @JoinColumn." +"referenceColumnName." +msgstr "" + +#. Tag: programlisting +#: basic_mapping.xml:3130 basic_mapping.xml:3682 +#, no-c-format +msgid "" +"@Entity\n" +"class Person {\n" +" @Id Integer personNumber;\n" +" String firstName;\n" +" @Column(name=\"I\")\n" +" String initial;\n" +" String lastName;\n" +"}\n" +"\n" +"@Entity\n" +"class Home {\n" +" @ManyToOne\n" +" @JoinColumns({\n" +" @JoinColumn(name=\"first_name\", referencedColumnName=\"firstName\"),\n" +" @JoinColumn(name=\"init\", referencedColumnName=\"I\"),\n" +" @JoinColumn(name=\"last_name\", referencedColumnName=\"lastName\"),\n" +" })\n" +" Person owner\n" +"}" +msgstr "" #. Tag: para +#: basic_mapping.xml:3132 +#, no-c-format +msgid "" +"This is not encouraged however and should be reserved to legacy mappings." +msgstr "" + +#. Tag: para +#: basic_mapping.xml:3135 +#, no-c-format +msgid "" +"In hbm.xml, mapping an association is similar. The main difference is that a " +"@OneToOne is mapped as <many-to-one " +"unique=\"true\"/>, let's dive into the subject." +msgstr "" + +#. Tag: programlisting +#: basic_mapping.xml:3177 +#, fuzzy, no-c-format +msgid "" +"<many-to-one\n" +" name=\"propertyName\"\n" +" column=\"column_name\"\n" +" class=\"ClassName\"\n" +" cascade=\"cascade_style\"\n" +" fetch=\"join|select\"\n" +" update=\"true|false\"\n" +" insert=\"true|false\"\n" +" property-ref=\"propertyNameFromAssociatedClass\"\n" +" access=\"field|property|ClassName\"\n" +" unique=\"true|false\"\n" +" not-null=\"true|false\"\n" +" optimistic-lock=\"true|false\"\n" +" lazy=\"proxy|no-proxy|false\"\n" +" not-found=\"ignore|exception\"\n" +" entity-name=\"EntityName\"\n" +" formula=\"arbitrary SQL expression\"\n" +" node=\"element-name|@attribute-name|element/@attribute|.\"\n" +" embed-xml=\"true|false\"\n" +" index=\"index_name\"\n" +" unique_key=\"unique_key_id\"\n" +" foreign-key=\"foreign_key_name\"\n" +"/>" +msgstr "" +"<many-to-one\n" +" name=\"propertyName\"\n" +" column=\"column_name\"\n" +" class=\"ClassName\"\n" +" cascade=\"cascade_style\"\n" +" fetch=\"join|select\"\n" +" update=\"true|false\"\n" +" insert=\"true|false\"\n" +" property-ref=\"propertyNameFromAssociatedClass\"\n" +" access=\"field|property|ClassName\"\n" +" unique=\"true|false\"\n" +" not-null=\"true|false\"\n" +" optimistic-lock=\"true|false\"\n" +" lazy=\"proxy|no-proxy|false\"\n" +" not-found=\"ignore|exception\"\n" +" entity-name=\"EntityName\"\n" +" formula=\"arbitrary SQL expression\"\n" +" node=\"element-name|@attribute-name|element/@attribute|.\"\n" +" embed-xml=\"true|false\"\n" +" index=\"index_name\"\n" +" unique_key=\"unique_key_id\"\n" +" foreign-key=\"foreign_key_name\"\n" +"/>" + +#. Tag: para +#: basic_mapping.xml:3185 basic_mapping.xml:3868 +#, no-c-format +msgid "" +"column (optional): the name of the foreign key column. " +"This can also be specified by nested <column> " +"element(s)." +msgstr "" +"column(可选):外键字段的名称。也可以通过嵌套的 " +"<column> 指定。 " + +#. Tag: para +#: basic_mapping.xml:3191 basic_mapping.xml:3385 +#, no-c-format +msgid "" +"class (optional - defaults to the property type " +"determined by reflection): the name of the associated class." +msgstr "" +"class(可选 — 默认是通过反射得到的属性类型):被关联的类的" +"名字。 " + +#. Tag: para +#: basic_mapping.xml:3197 basic_mapping.xml:3391 +#, no-c-format +msgid "" +"cascade (optional): specifies which operations should be " +"cascaded from the parent object to the associated object." +msgstr "" +"cascade(级联)(可选)表明操作是否从父对象级联到被关联的" +"对象。 " + +#. Tag: para +#: basic_mapping.xml:3203 basic_mapping.xml:3407 +#, no-c-format +msgid "" +"fetch (optional - defaults to select): " +"chooses between outer-join fetching or sequential select fetching." +msgstr "" +"fetch(可选 — 默认为 select):在外连接" +"抓取(outer-join fetching)和序列选择抓取(sequential select fetching)两者中" +"选择其一。 " + +#. Tag: para +#: basic_mapping.xml:3209 +#, no-c-format +msgid "" +"update, insert (optional - defaults to true): specifies that the mapped columns should be included in SQL " +"UPDATE and/or INSERT statements. " +"Setting both to false allows a pure \"derived\" " +"association whose value is initialized from another property that maps to " +"the same column(s), or by a trigger or other application." +msgstr "" +"update, insert(可选 — 默认为 true)指" +"定对应的字段是否包含在用于 UPDATE 和/或 INSERT 的 SQL 语句中。如果二者都是false,则这是一个纯粹" +"的 “外源性(derived)”关联,它的值是通过映射到同一个(或多个)字段的某些其他" +"属性得到 或者通过 trigger(触发器)、或其他程序生成。 " + +#. Tag: para +#: basic_mapping.xml:3219 +#, no-c-format +msgid "" +"property-ref (optional): the name of a property of the " +"associated class that is joined to this foreign key. If not specified, the " +"primary key of the associated class is used." +msgstr "" +"property-ref:(可选)被关联到此外键的类中的对应属性的名" +"字。如果没有指定,被关联类的主键将被使用。 " + +#. Tag: para +#: basic_mapping.xml:3232 +#, no-c-format +msgid "" +"unique (optional): enables the DDL generation of a unique " +"constraint for the foreign-key column. By allowing this to be the target of " +"a property-ref, you can make the association multiplicity " +"one-to-one." +msgstr "" +"unique(可选):使用 DDL 为外键字段生成一个唯一约束。此" +"外, 这也可以用作 property-ref 的目标属性。这使关联同时具" +"有一对一的效果。 " + +#. Tag: para +#: basic_mapping.xml:3240 +#, no-c-format +msgid "" +"not-null (optional): enables the DDL generation of a " +"nullability constraint for the foreign key columns." +msgstr "" +"not-null(可选):使用 DDL 为外键字段生成一个非空约束。 " + +#. Tag: para +#: basic_mapping.xml:3254 +#, no-c-format +msgid "" +"lazy (optional - defaults to proxy): " +"by default, single point associations are proxied. lazy=\"no-proxy" +"\" specifies that the property should be fetched lazily when the " +"instance variable is first accessed. This requires build-time bytecode " +"instrumentation. lazy=\"false\" specifies that the " +"association will always be eagerly fetched." +msgstr "" +"lazy(可选 — 默认为 proxy):默认情况" +"下,单点关联是经过代理的。lazy=\"no-proxy\" 指定此属性应该" +"在实例变量第一次被访问时应该延迟抓取(fetche lazily)(需要运行时字节码的增" +"强)。lazy=\"false\" 指定此关联总是被预先抓取。 " + +#. Tag: para +#: basic_mapping.xml:3264 +#, no-c-format +msgid "" +"not-found (optional - defaults to exception): specifies how foreign keys that reference missing rows will be " +"handled. ignore will treat a missing row as a null " +"association." +msgstr "" +"not-found(可选 - 默认为exception):指" +"定如何处理引用缺失行的外键:ignore 会把缺失的行作为一个空" +"关联处理。 " + +#. Tag: para +#: basic_mapping.xml:3272 basic_mapping.xml:3448 +#, no-c-format +msgid "" +"entity-name (optional): the entity name of the associated " +"class." +msgstr "entity-name(可选):被关联的类的实体名。 " + +#. Tag: para +#: basic_mapping.xml:3277 +#, no-c-format +msgid "" +"formula (optional): an SQL expression that defines the " +"value for a computed foreign key." +msgstr "" +"formula(可选):SQL 表达式,用于定义 computed" +"(计算出的)外键值。" + +#. Tag: para +#: basic_mapping.xml:3284 +#, fuzzy, no-c-format +msgid "" +"Setting a value of the cascade attribute to any " +"meaningful value other than none will propagate certain " +"operations to the associated object. The meaningful values are divided into " +"three categories. First, basic operations, which include: persist, " +"merge, delete, save-update, evict, replicate, lock and refresh; " +"second, special values: delete-orphan; and third," +"all comma-separated combinations of operation names: " +"cascade=\"persist,merge,evict\" or cascade=\"all," +"delete-orphan\". See " +"for a full explanation. Note that single valued, many-to-one and one-to-one, " +"associations do not support orphan delete." +msgstr "" +"cascade 属性设置为除了none 以外任何有意" +"义的值,它将把特定的操作传递到关联对象中。这个值就代表着 Hibernate 基本操作的" +"名称,persist, merge, delete, save-update, evict, replicate, lock, " +"refresh,以及特别的值 delete-orphan 和 " +"all,并且可以用逗号分隔符来组合这些操作,例如," +"cascade=\"persist,merge,evict\"cascade=" +"\"all,delete-orphan\"。更全面的解释请参考 。注意,单值关联(many-to-one 和 one-to-one 关" +"联)不支持删除孤儿(orphan delete,删除不再被引用的值)。 " + +#. Tag: para +#: basic_mapping.xml:3298 +#, no-c-format +msgid "" +"Here is an example of a typical many-to-one declaration:" +msgstr "一个典型的简单 many-to-one 定义例子: " + +#. Tag: programlisting +#: basic_mapping.xml:3301 +#, fuzzy, no-c-format +msgid "" +"<many-to-one name=\"product\" class=\"Product\" column=\"PRODUCT_ID\"/>" +msgstr "" +"<many-to-one name=\"product\" class=\"Product\" column=\"PRODUCT_ID\"/>" + +#. Tag: para +#: basic_mapping.xml:3303 +#, no-c-format +msgid "" +"The property-ref attribute should only be used for " +"mapping legacy data where a foreign key refers to a unique key of the " +"associated table other than the primary key. This is a complicated and " +"confusing relational model. For example, if the Product " +"class had a unique serial number that is not the primary key. The " +"unique attribute controls Hibernate's DDL generation with " +"the SchemaExport tool." +msgstr "" +"property-ref 属性只应该用来对付遗留下来的数据库系统,可能" +"有外键指向对方关联表的是个非主键字段(但是应该是一个惟一关键字)的情况下。这" +"是一种十分丑陋的关系模型。比如说,假设 Product 类有一个惟" +"一的序列号,它并不是主键。(unique 属性控制 Hibernate 通" +"过 SchemaExport 工具进行的 DDL 生成。) " + +#. Tag: programlisting +#: basic_mapping.xml:3311 +#, fuzzy, no-c-format +msgid "" +"<property name=\"serialNumber\" unique=\"true\" type=\"string\" column=" +"\"SERIAL_NUMBER\"/>" +msgstr "" +"<property name=\"serialNumber\" unique=\"true\" type=\"string\" column=" +"\"SERIAL_NUMBER\"/>" + +#. Tag: para +#: basic_mapping.xml:3313 +#, no-c-format +msgid "Then the mapping for OrderItem might use:" +msgstr "那么关于 OrderItem 的映射可能是:" + +#. Tag: programlisting +#: basic_mapping.xml:3316 +#, fuzzy, no-c-format +msgid "" +"<many-to-one name=\"product\" property-ref=\"serialNumber\" column=" +"\"PRODUCT_SERIAL_NUMBER\"/>" +msgstr "" +"<many-to-one name=\"product\" property-ref=\"serialNumber\" column=" +"\"PRODUCT_SERIAL_NUMBER\"/>" + +#. Tag: para +#: basic_mapping.xml:3318 +#, no-c-format +msgid "This is not encouraged, however." +msgstr "当然,我们决不鼓励这种用法。 " + +#. Tag: para +#: basic_mapping.xml:3320 +#, no-c-format +msgid "" +"If the referenced unique key comprises multiple properties of the associated " +"entity, you should map the referenced properties inside a named <" +"properties> element." +msgstr "" +"如果被引用的唯一主键由关联实体的多个属性组成,你应该在名称为 <" +"properties> 的元素 里面映射所有关联的属性。" + +#. Tag: para +#: basic_mapping.xml:3324 +#, no-c-format +msgid "" +"If the referenced unique key is the property of a component, you can specify " +"a property path:" +msgstr "假若被引用的唯一主键是组件的属性,你可以指定属性路径: " + +#. Tag: programlisting +#: basic_mapping.xml:3327 +#, fuzzy, no-c-format +msgid "" +"<many-to-one name=\"owner\" property-ref=\"identity.ssn\" column=" +"\"OWNER_SSN\"/>" +msgstr "" +"<many-to-one name=\"owner\" property-ref=\"identity.ssn\" column=" +"\"OWNER_SSN\"/>" + +#. Tag: title +#: basic_mapping.xml:3331 +#, no-c-format +msgid "Sharing the primary key with the associated entity" +msgstr "" + +#. Tag: para +#: basic_mapping.xml:3333 +#, no-c-format +msgid "" +"The second approach is to ensure an entity and its associated entity share " +"the same primary key. In this case the primary key column is also a foreign " +"key and there is no extra column. These associations are always one to one." +msgstr "" + +#. Tag: title +#: basic_mapping.xml:3339 +#, fuzzy, no-c-format +msgid "One to One association" +msgstr "惟一外键关联" + +#. Tag: programlisting +#: basic_mapping.xml:3341 +#, no-c-format +msgid "" +"@Entity\n" +"public class Body {\n" +" @Id\n" +" public Long getId() { return id; }\n" +"\n" +" @OneToOne(cascade = CascadeType.ALL)\n" +" @MapsId\n" +" public Heart getHeart() {\n" +" return heart;\n" +" }\n" +" ...\n" +"} \n" +"\n" +"@Entity\n" +"public class Heart {\n" +" @Id\n" +" public Long getId() { ...}\n" +"}" +msgstr "" + +#. Tag: para +#: basic_mapping.xml:3345 +#, no-c-format +msgid "" +"Many people got confused by these primary key based one to one associations. " +"They can only be lazily loaded if Hibernate knows that the other side of the " +"association is always present. To indicate to Hibernate that it is the case, " +"use @OneToOne(optional=false)." +msgstr "" + +#. Tag: para +#: basic_mapping.xml:3352 +#, no-c-format +msgid "In hbm.xml, use the following mapping." +msgstr "" + +#. Tag: programlisting +#: basic_mapping.xml:3377 +#, fuzzy, no-c-format +msgid "" +"<one-to-one\n" +" name=\"propertyName\"\n" +" class=\"ClassName\"\n" +" cascade=\"cascade_style\"\n" +" constrained=\"true|false\"\n" +" fetch=\"join|select\"\n" +" property-ref=\"propertyNameFromAssociatedClass\"\n" +" access=\"field|property|ClassName\"\n" +" formula=\"any SQL expression\"\n" +" lazy=\"proxy|no-proxy|false\"\n" +" entity-name=\"EntityName\"\n" +" node=\"element-name|@attribute-name|element/@attribute|.\"\n" +" embed-xml=\"true|false\"\n" +" foreign-key=\"foreign_key_name\"\n" +"/>" +msgstr "" +"<one-to-one\n" +" name=\"propertyName\"\n" +" class=\"ClassName\"\n" +" cascade=\"cascade_style\"\n" +" constrained=\"true|false\"\n" +" fetch=\"join|select\"\n" +" property-ref=\"propertyNameFromAssociatedClass\"\n" +" access=\"field|property|ClassName\"\n" +" formula=\"any SQL expression\"\n" +" lazy=\"proxy|no-proxy|false\"\n" +" entity-name=\"EntityName\"\n" +" node=\"element-name|@attribute-name|element/@attribute|.\"\n" +" embed-xml=\"true|false\"\n" +" foreign-key=\"foreign_key_name\"\n" +"/>" + +#. Tag: para +#: basic_mapping.xml:3397 +#, no-c-format +msgid "" +"constrained (optional): specifies that a foreign key " +"constraint on the primary key of the mapped table and references the table " +"of the associated class. This option affects the order in which save" +"() and delete() are cascaded, and determines " +"whether the association can be proxied. It is also used by the schema export " +"tool." +msgstr "" +"constrained(约束)(可选)表明该类对应的表对应的数据库" +"表,和被关联的对象所对应的数据库表之间,通过一个外键引用对主键进行约束。这个" +"选项影响 save()delete() 在级联执行" +"时的先后顺序以及决定该关联能否被委托(也在 schema export tool 中被使用)。 " + +#. Tag: para +#: basic_mapping.xml:3413 +#, no-c-format +msgid "" +"property-ref (optional): the name of a property of the " +"associated class that is joined to the primary key of this class. If not " +"specified, the primary key of the associated class is used." +msgstr "" +"property-ref:(可选)指定关联类的属性名,这个属性将会和本" +"类的主键相对应。如果没有指定,会使用对方关联类的主键。 " + +#. Tag: para +#: basic_mapping.xml:3426 +#, no-c-format +msgid "" +"formula (optional): almost all one-to-one associations " +"map to the primary key of the owning entity. If this is not the case, you " +"can specify another column, columns or expression to join on using an SQL " +"formula. See org.hibernate.test.onetooneformula for an " +"example." +msgstr "" +"formula (可选):绝大多数一对一的关联都指向其实体的主键。" +"在一些少见的情况中,你可能会指向其他的一个或多个字段,或者是一个表达式,这些" +"情况下,你可以用一个 SQL 公式来表示。(可以在 org.hibernate.test." +"onetooneformula 找到例子) " + +#. Tag: para +#: basic_mapping.xml:3435 +#, no-c-format +msgid "" +"lazy (optional - defaults to proxy): " +"by default, single point associations are proxied. lazy=\"no-proxy" +"\" specifies that the property should be fetched lazily when the " +"instance variable is first accessed. It requires build-time bytecode " +"instrumentation. lazy=\"false\" specifies that the " +"association will always be eagerly fetched. Note that if " +"constrained=\"false\", proxying is impossible and " +"Hibernate will eagerly fetch the association." +msgstr "" +"lazy(可选 — 默认为 proxy):默认情况" +"下,单点关联是经过代理的。lazy=\"no-proxy\"指定此属性应该" +"在实例变量第一次被访问时应该延迟抓取(fetche lazily)(需要运行时字节码的增" +"强)。 lazy=\"false\"指定此关联总是被预先抓取。" +"注意,如果constrained=\"false\", 不可能使用代理,Hibernate" +"会采取预先抓取。" + +#. Tag: para +#: basic_mapping.xml:3454 +#, no-c-format +msgid "" +"Primary key associations do not need an extra table column. If two rows are " +"related by the association, then the two table rows share the same primary " +"key value. To relate two objects by a primary key association, ensure that " +"they are assigned the same identifier value." +msgstr "" +"主键关联不需要额外的表字段;如果两行是通过这种一对一关系相关联的,那么这两行" +"就共享同样的主关键字值。所以如果你希望两个对象通过主键一对一关联,你必须确认" +"它们被赋予同样的标识值。" + +#. Tag: para +#: basic_mapping.xml:3460 +#, no-c-format +msgid "" +"For a primary key association, add the following mappings to " +"Employee and Person respectively:" +msgstr "" +"比如说,对下面的 EmployeePerson 进" +"行主键一对一关联:" + +#. Tag: programlisting +#: basic_mapping.xml:3464 +#, fuzzy, no-c-format +msgid "<one-to-one name=\"person\" class=\"Person\"/>" +msgstr "<one-to-one name=\"person\" class=\"Person\"/>" + +#. Tag: programlisting +#: basic_mapping.xml:3466 +#, fuzzy, no-c-format +msgid "" +"<one-to-one name=\"employee\" class=\"Employee\" constrained=\"true\"/>" +msgstr "" +"<one-to-one name=\"employee\" class=\"Employee\" constrained=\"true\"/>" + +#. Tag: para +#: basic_mapping.xml:3468 +#, no-c-format +msgid "" +"Ensure that the primary keys of the related rows in the PERSON and EMPLOYEE " +"tables are equal. You use a special Hibernate identifier generation strategy " +"called foreign:" +msgstr "" +"现在我们必须确保 PERSON 和 EMPLOYEE 中相关的字段是相等的。我们使用一个被成为 " +"foreign 的特殊的 hibernate 标识符生成策略: " + +#. Tag: programlisting +#: basic_mapping.xml:3472 +#, fuzzy, no-c-format +msgid "" +"<class name=\"person\" table=\"PERSON\">\n" +" <id name=\"id\" column=\"PERSON_ID\">\n" +" <generator class=\"foreign\">\n" +" <param name=\"property\">employee</param>\n" +" </generator>\n" +" </id>\n" +" ...\n" +" <one-to-one name=\"employee\"\n" +" class=\"Employee\"\n" +" constrained=\"true\"/>\n" +"</class>" +msgstr "" +"<class name=\"person\" table=\"PERSON\">\n" +" <id name=\"id\" column=\"PERSON_ID\">\n" +" <generator class=\"foreign\">\n" +" <param name=\"property\">employee</param>\n" +" </generator>\n" +" </id>\n" +" ...\n" +" <one-to-one name=\"employee\"\n" +" class=\"Employee\"\n" +" constrained=\"true\"/>\n" +"</class>" + +#. Tag: para +#: basic_mapping.xml:3474 +#, no-c-format +msgid "" +"A newly saved instance of Person is assigned the same " +"primary key value as the Employee instance referred with " +"the employee property of that Person." +msgstr "" +"一个刚刚保存的 Person 实例被赋予和该 Personemployee 属性所指向的 Employee 实例同样的关键字值。 " + +#. Tag: title +#: basic_mapping.xml:3482 +#, no-c-format +msgid "Natural-id" +msgstr "自然 ID(natural-id) " + +#. Tag: para +#: basic_mapping.xml:3484 +#, fuzzy, no-c-format +msgid "" +"Although we recommend the use of surrogate keys as primary keys, you should " +"try to identify natural keys for all entities. A natural key is a property " +"or combination of properties that is unique and non-null. It is also " +"immutable. Map the properties of the natural key as @NaturalId or map them inside the <natural-id> " +"element. Hibernate will generate the necessary unique key and nullability " +"constraints and, as a result, your mapping will be more self-documenting." +msgstr "" +"我们建议使用代用键(键值不具备实际意义)作为主键,我们仍然应该尝试为所有的实" +"体采用自然的键值作为(附加——译者注)标示。自然键(natural key)是单个或组合属" +"性,他们必须唯一且非空。如果它还是不可变的那就更理想了。在 <" +"natural-id> 元素中列出自然键的属性。Hibernate 会帮你生成必须的唯" +"一键值和非空约束,你的映射会更加的明显易懂(原文是 self-documenting,自我注" +"解)。 " + +#. Tag: programlisting +#: basic_mapping.xml:3493 +#, no-c-format +msgid "" +"@Entity\n" +"public class Citizen {\n" +" @Id\n" +" @GeneratedValue\n" +" private Integer id;\n" +" private String firstname;\n" +" private String lastname;\n" +" \n" +" @NaturalId\n" +" @ManyToOne\n" +" private State state;\n" +"\n" +" @NaturalId\n" +" private String ssn;\n" +" ...\n" +"}\n" +"\n" +"\n" +"\n" +"//and later on query\n" +"List results = s.createCriteria( Citizen.class )\n" +" .add( Restrictions.naturalId().set( \"ssn\", \"1234\" ).set" +"( \"state\", ste ) )\n" +" .list();" +msgstr "" + +#. Tag: para +#: basic_mapping.xml:3495 +#, no-c-format +msgid "Or in XML," +msgstr "" + +#. Tag: programlisting +#: basic_mapping.xml:3497 +#, fuzzy, no-c-format +msgid "" +"<natural-id mutable=\"true|false\"/>\n" +" <property ... />\n" +" <many-to-one ... />\n" +" ......\n" +"</natural-id>" +msgstr "" +"<natural-id mutable=\"true|false\"/>\n" +" <property ... />\n" +" <many-to-one ... />\n" +" ......\n" +"</natural-id>" + +#. Tag: para +#: basic_mapping.xml:3499 +#, no-c-format +msgid "" +"It is recommended that you implement equals() and " +"hashCode() to compare the natural key properties of the " +"entity." +msgstr "" +"我们强烈建议你实现 equals()hashCode() 方法,来比较实体的自然键属性。 " + +#. Tag: para +#: basic_mapping.xml:3503 +#, no-c-format +msgid "" +"This mapping is not intended for use with entities that have natural primary " +"keys." +msgstr "这一映射不是为了把自然键作为主键而准备的。 " + +#. Tag: para +#: basic_mapping.xml:3508 +#, no-c-format +msgid "" +"mutable (optional - defaults to false): by default, natural identifier properties are assumed to be " +"immutable (constant)." +msgstr "" +"mutable(可选,默认为 false):默认情况" +"下,自然标识属性被假定为不可变的(常量)。 " + +#. Tag: title +#: basic_mapping.xml:3516 +#, fuzzy, no-c-format +msgid "Any" +msgstr "any" + +#. Tag: para +#: basic_mapping.xml:3518 +#, fuzzy, no-c-format +msgid "" +"There is one more type of property mapping. The @Any " +"mapping defines a polymorphic association to classes from multiple tables. " +"This type of mapping requires more than one column. The first column " +"contains the type of the associated entity. The remaining columns contain " +"the identifier. It is impossible to specify a foreign key constraint for " +"this kind of association. This is not the usual way of mapping polymorphic " +"associations and you should use this only in special cases. For example, for " +"audit logs, user session data, etc." +msgstr "" +"这是属性映射的又一种类型。<any> 映射元素定义了一种从" +"多个表到类的多态关联。这种类型的映射常常需要多于一个字段。第一个字段持有被关" +"联实体的类型,其他的字段持有标识符。对这种类型的关联来说,不可能指定一个外键" +"约束,所以这当然不是映射(多态)关联的通常的方式。你只应该在非常特殊的情况下" +"使用它(比如,审计 log,用户会话数据等等)。 " + +#. Tag: para +#: basic_mapping.xml:3528 +#, fuzzy, no-c-format +msgid "" +"The @Any annotation describes the column holding the " +"metadata information. To link the value of the metadata information and an " +"actual entity type, The @AnyDef and " +"@AnyDefs annotations are used. The metaType attribute allows the application to specify a custom type that maps " +"database column values to persistent classes that have identifier properties " +"of the type specified by idType. You must specify the " +"mapping from values of the metaType to class names." +msgstr "" +"meta-type 属性使得应用程序能指定一个将数据库字段的值映射到" +"持久化类的自定义类型。这个持久化类包含有用 id-type 指定的" +"标识符属性。你必须指定从 meta-type 的值到类名的映射。 " + +#. Tag: programlisting +#: basic_mapping.xml:3538 +#, no-c-format +msgid "" +"@Any( metaColumn = @Column( name = \"property_type\" ), fetch=FetchType." +"EAGER )\n" +"@AnyMetaDef( \n" +" idType = \"integer\", \n" +" metaType = \"string\", \n" +" metaValues = {\n" +" @MetaValue( value = \"S\", targetEntity = StringProperty.class ),\n" +" @MetaValue( value = \"I\", targetEntity = IntegerProperty.class )\n" +" } )\n" +"@JoinColumn( name = \"property_id\" )\n" +"public Property getMainProperty() {\n" +" return mainProperty;\n" +"}" +msgstr "" + +#. Tag: para +#: basic_mapping.xml:3540 +#, no-c-format +msgid "" +"Note that @AnyDef can be mutualized and reused. It is " +"recommended to place it as a package metadata in this case." +msgstr "" + +#. Tag: programlisting +#: basic_mapping.xml:3544 +#, no-c-format +msgid "" +"//on a package\n" +"@AnyMetaDef( name=\"property\" \n" +" idType = \"integer\", \n" +" metaType = \"string\", \n" +" metaValues = {\n" +" @MetaValue( value = \"S\", targetEntity = StringProperty.class ),\n" +" @MetaValue( value = \"I\", targetEntity = IntegerProperty.class )\n" +" } )\n" +"package org.hibernate.test.annotations.any;\n" +"\n" +"\n" +"//in a class\n" +" @Any( metaDef=\"property\", metaColumn = @Column( name = \"property_type" +"\" ), fetch=FetchType.EAGER )\n" +" @JoinColumn( name = \"property_id\" )\n" +" public Property getMainProperty() {\n" +" return mainProperty;\n" +" }" +msgstr "" + +#. Tag: para +#: basic_mapping.xml:3546 +#, no-c-format +msgid "The hbm.xml equivalent is:" +msgstr "" + +#. Tag: programlisting +#: basic_mapping.xml:3548 +#, fuzzy, no-c-format +msgid "" +"<any name=\"being\" id-type=\"long\" meta-type=\"string\">\n" +" <meta-value value=\"TBL_ANIMAL\" class=\"Animal\"/>\n" +" <meta-value value=\"TBL_HUMAN\" class=\"Human\"/>\n" +" <meta-value value=\"TBL_ALIEN\" class=\"Alien\"/>\n" +" <column name=\"table_name\"/>\n" +" <column name=\"id\"/>\n" +"</any>" +msgstr "" +"<any name=\"being\" id-type=\"long\" meta-type=\"string\">\n" +" <meta-value value=\"TBL_ANIMAL\" class=\"Animal\"/>\n" +" <meta-value value=\"TBL_HUMAN\" class=\"Human\"/>\n" +" <meta-value value=\"TBL_ALIEN\" class=\"Alien\"/>\n" +" <column name=\"table_name\"/>\n" +" <column name=\"id\"/>\n" +"</any>" + +#. Tag: para +#: basic_mapping.xml:3551 +#, no-c-format +msgid "You cannot mutualize the metadata in hbm.xml as you can in annotations." +msgstr "" + +#. Tag: programlisting +#: basic_mapping.xml:3570 +#, fuzzy, no-c-format +msgid "" +"<any\n" +" name=\"propertyName\"\n" +" id-type=\"idtypename\"\n" +" meta-type=\"metatypename\"\n" +" cascade=\"cascade_style\"\n" +" access=\"field|property|ClassName\"\n" +" optimistic-lock=\"true|false\"\n" +">\n" +" <meta-value ... />\n" +" <meta-value ... />\n" +" .....\n" +" <column .... />\n" +" <column .... />\n" +" .....\n" +"</any>" +msgstr "" +"<any\n" +" name=\"propertyName\"\n" +" id-type=\"idtypename\"\n" +" meta-type=\"metatypename\"\n" +" cascade=\"cascade_style\"\n" +" access=\"field|property|ClassName\"\n" +" optimistic-lock=\"true|false\"\n" +">\n" +" <meta-value ... />\n" +" <meta-value ... />\n" +" .....\n" +" <column .... />\n" +" <column .... />\n" +" .....\n" +"</any>" + +#. Tag: para +#: basic_mapping.xml:3574 #, no-c-format msgid "name: the property name." msgstr "name:属性名" #. Tag: para +#: basic_mapping.xml:3578 #, no-c-format msgid "id-type: the identifier type." msgstr "id-type:标识符类型" #. Tag: para +#: basic_mapping.xml:3582 #, no-c-format -msgid "meta-type (optional - defaults to string): any type that is allowed for a discriminator mapping." -msgstr "meta-type(可选 -默认是 string):允许辨别标志(discriminator)映射的任何类型。 " +msgid "" +"meta-type (optional - defaults to string): any type that is allowed for a discriminator mapping." +msgstr "" +"meta-type(可选 -默认是 string):允许" +"辨别标志(discriminator)映射的任何类型。 " #. Tag: para +#: basic_mapping.xml:3588 #, no-c-format -msgid "cascade (optional- defaults to none): the cascade style." -msgstr "cascade(可选 — 默认是none):级联的类型。" +msgid "" +"cascade (optional- defaults to none): " +"the cascade style." +msgstr "" +"cascade(可选 — 默认是none):级联的类" +"型。" #. Tag: para +#: basic_mapping.xml:3599 #, no-c-format -msgid "optimistic-lock (optional - defaults to true): specifies that updates to this property either do or do not require acquisition of the optimistic lock. It defines whether a version increment should occur if this property is dirty." -msgstr "optimistic-lock(可选 — 默认是 true):表明更新此组件是否需要获取乐观锁。换句话说,当这个属性变脏时,是否增加版本号(Version)。" +msgid "" +"optimistic-lock (optional - defaults to true): specifies that updates to this property either do or do not " +"require acquisition of the optimistic lock. It defines whether a version " +"increment should occur if this property is dirty." +msgstr "" +"optimistic-lock(可选 — 默认是 true):" +"表明更新此组件是否需要获取乐观锁。换句话说,当这个属性变脏时,是否增加版本号" +"(Version)。" #. Tag: title +#: basic_mapping.xml:3610 +#, no-c-format +msgid "Properties" +msgstr "属性(Properties)" + +#. Tag: para +#: basic_mapping.xml:3612 +#, no-c-format +msgid "" +"The <properties> element allows the definition of a " +"named, logical grouping of the properties of a class. The most important use " +"of the construct is that it allows a combination of properties to be the " +"target of a property-ref. It is also a convenient way to " +"define a multi-column unique constraint. For example:" +msgstr "" +"<properties> 元素允许定义一个命名的逻辑分组" +"(grouping)包含一个类中的多个属性。这个元素最重要的用处是允许多个属性的组合" +"作为 property-ref 的目标(target)。这也是定义多字段唯一约" +"束的一种方便途径。例如:" + +#. Tag: programlisting +#: basic_mapping.xml:3632 +#, fuzzy, no-c-format +msgid "" +"<properties\n" +" name=\"logicalName\"\n" +" insert=\"true|false\"\n" +" update=\"true|false\"\n" +" optimistic-lock=\"true|false\"\n" +" unique=\"true|false\"\n" +">\n" +"\n" +" <property ...../>\n" +" <many-to-one .... />\n" +" ........\n" +"</properties>" +msgstr "" +"<properties \n" +" name=\"logicalName\" \n" +" insert=\"true|false\"\n" +" update=\"true|false\"\n" +" optimistic-lock=\"true|false\"\n" +" unique=\"true|false\"\n" +">\n" +" \n" +" <property ...../>\n" +" <many-to-one .... />\n" +" ........\n" +"</properties>" + +#. Tag: para +#: basic_mapping.xml:3636 +#, no-c-format +msgid "" +"name: the logical name of the grouping. It is " +"not an actual property name." +msgstr "" +"name:分组的逻辑名称 — 不是 实际属性" +"的名称。 " + +#. Tag: para +#: basic_mapping.xml:3651 +#, no-c-format +msgid "" +"optimistic-lock (optional - defaults to true): specifies that updates to these properties either do or do not " +"require acquisition of the optimistic lock. It determines if a version " +"increment should occur when these properties are dirty." +msgstr "" +"optimistic-lock(可选 — 默认是 true):" +"表明更新此组件是否需要获取乐观锁。换句话说,当这个属性变脏时,是否增加版本号" +"(Version)。" + +#. Tag: para +#: basic_mapping.xml:3666 +#, no-c-format +msgid "" +"For example, if we have the following <properties> " +"mapping:" +msgstr "例如,如果我们有如下的 <properties> 映射:" + +#. Tag: programlisting +#: basic_mapping.xml:3669 +#, fuzzy, no-c-format +msgid "" +"<class name=\"Person\">\n" +" <id name=\"personNumber\"/>\n" +"\n" +" ...\n" +" <properties name=\"name\"\n" +" unique=\"true\" update=\"false\">\n" +" <property name=\"firstName\"/>\n" +" <property name=\"initial\"/>\n" +" <property name=\"lastName\"/>\n" +" </properties>\n" +"</class>" +msgstr "" +"<class name=\"Person\">\n" +" <id name=\"personNumber\"/>\n" +" ...\n" +" <properties name=\"name\" \n" +" unique=\"true\" update=\"false\">\n" +" <property name=\"firstName\"/>\n" +" <property name=\"initial\"/>\n" +" <property name=\"lastName\"/>\n" +" </properties>\n" +"</class>" + +#. Tag: para +#: basic_mapping.xml:3671 +#, no-c-format +msgid "" +"You might have some legacy data association that refers to this unique key " +"of the Person table, instead of to the primary key:" +msgstr "" +"然后,我们可能有一些遗留的数据关联,引用 Person 表的这个唯" +"一键,而不是主键:" + +#. Tag: programlisting +#: basic_mapping.xml:3675 +#, fuzzy, no-c-format +msgid "" +"<many-to-one name=\"owner\"\n" +" class=\"Person\" property-ref=\"name\">\n" +" <column name=\"firstName\"/>\n" +" <column name=\"initial\"/>\n" +" <column name=\"lastName\"/>\n" +"</many-to-one>" +msgstr "" +"<many-to-one name=\"person\" \n" +" class=\"Person\" property-ref=\"name\">\n" +" <column name=\"firstName\"/>\n" +" <column name=\"initial\"/>\n" +" <column name=\"lastName\"/>\n" +"</many-to-one>" + +#. Tag: para +#: basic_mapping.xml:3678 +#, no-c-format +msgid "" +"When using annotations as a mapping strategy, such construct is not " +"necessary as the binding between a column and its related column on the " +"associated table is done directly" +msgstr "" + +#. Tag: para +#: basic_mapping.xml:3685 +#, no-c-format +msgid "" +"The use of this outside the context of mapping legacy data is not " +"recommended." +msgstr "我们并不推荐这样使用,除非在映射遗留数据的情况下。 " + +#. Tag: title +#: basic_mapping.xml:3690 +#, no-c-format +msgid "Some hbm.xml specificities" +msgstr "" + +#. Tag: para +#: basic_mapping.xml:3692 +#, no-c-format +msgid "" +"The hbm.xml structure has some specificities naturally not present when " +"using annotations, let's describe them briefly." +msgstr "" + +#. Tag: title +#: basic_mapping.xml:3696 +#, no-c-format +msgid "Doctype" +msgstr "Doctype" + +#. Tag: para +#: basic_mapping.xml:3698 +#, no-c-format +msgid "" +"All XML mappings should declare the doctype shown. The actual DTD can be " +"found at the URL above, in the directory hibernate-x.x.x/src/org/" +"hibernate , or in hibernate3.jar. Hibernate " +"will always look for the DTD in its classpath first. If you experience " +"lookups of the DTD using an Internet connection, check the DTD declaration " +"against the contents of your classpath." +msgstr "" +"所有的 XML 映射都需要定义如上所示的 doctype。DTD 可以从上述 URL 中获取,也可" +"以从 hibernate-x.x.x/src/org/hibernate 目录中、或 " +"hibernate.jar 文件中找到。Hibernate 总是会首先在它的 " +"classptah 中搜索 DTD 文件。如果你发现它是通过连接 Internet 查找 DTD 文件,就" +"对照你的 classpath 目录检查 XML 文件里的 DTD 声明。" + +#. Tag: title +#: basic_mapping.xml:3707 +#, no-c-format +msgid "EntityResolver" +msgstr "EntityResolver" + +#. Tag: para +#: basic_mapping.xml:3709 +#, no-c-format +msgid "" +"Hibernate will first attempt to resolve DTDs in its classpath. It does this " +"is by registering a custom org.xml.sax.EntityResolver " +"implementation with the SAXReader it uses to read in the xml files. This " +"custom EntityResolver recognizes two different systemId " +"namespaces:" +msgstr "" +"Hibernate 首先试图在其 classpath 中解析 DTD。这是依靠在系统中注册的 " +"org.xml.sax.EntityResolver 的一个具体实现,SAXReader 依靠" +"它来读取 xml 文件。这个自定义的 EntityResolver 能辨认两种" +"不同的 systenId 命名空间:" + +#. Tag: para +#: basic_mapping.xml:3718 +#, no-c-format +msgid "" +"a hibernate namespace is recognized whenever the resolver " +"encounters a systemId starting with http://hibernate.sourceforge." +"net/. The resolver attempts to resolve these entities via the " +"classloader which loaded the Hibernate classes." +msgstr "" +"若 resolver 遇到了一个以 http://hibernate.sourceforge.net/ 为开头的 systemId,它会辨认出是 hibernate namespace,resolver 就试图通过加载 Hibernate 类的 classloader 来查找这些实" +"体。 " + +#. Tag: para +#: basic_mapping.xml:3726 +#, no-c-format +msgid "" +"a user namespace is recognized whenever the resolver " +"encounters a systemId using a classpath:// URL protocol. " +"The resolver will attempt to resolve these entities via (1) the current " +"thread context classloader and (2) the classloader which loaded the " +"Hibernate classes." +msgstr "" +"若 resolver 遇到了一个使用 classpath:// URL 协议的 " +"systemId,它会辨认出这是 user namespace,resolver 试图通过" +"(1) 当前线程上下文的 classloader 和(2) 加载 Hibernate class 的 classloader " +"来查找这些实体。" + +#. Tag: para +#: basic_mapping.xml:3735 +#, no-c-format +msgid "The following is an example of utilizing user namespacing:" +msgstr "下面是一个使用用户命名空间(user namespace)的例子:" + +#. Tag: programlisting +#: basic_mapping.xml:3738 +#, no-c-format +msgid "" +"" +msgstr "" + +#. Tag: para +#: basic_mapping.xml:3740 +#, no-c-format +msgid "" +"Where types.xml is a resource in the your." +"domain package and contains a custom typedef." +msgstr "" +"这里的 types.xmlyour.domain 包中的" +"一个资源,它包含了一个自定义的 typedef。 " + +#. Tag: title +#: basic_mapping.xml:3747 +#, no-c-format +msgid "Hibernate-mapping" +msgstr "Hibernate-mapping" + +#. Tag: para +#: basic_mapping.xml:3749 +#, no-c-format +msgid "" +"This element has several optional attributes. The schema " +"and catalog attributes specify that tables referred to in " +"this mapping belong to the named schema and/or catalog. If they are " +"specified, tablenames will be qualified by the given schema and catalog " +"names. If they are missing, tablenames will be unqualified. The " +"default-cascade attribute specifies what cascade style " +"should be assumed for properties and collections that do not specify a " +"cascade attribute. By default, the auto-import attribute allows you to use unqualified class names in the query " +"language." +msgstr "" +"这个元素包括一些可选的属性。schemacatalog 属性, 指明了这个映射所连接(refer)的表所在的 schema 和/或 catalog " +"名称。假若指定了这个属性,表名会加上所指定的 schema 和 catalog 的名字扩展为全" +"限定名。假若没有指定,表名就不会使用全限定名。default-cascade 指定了未明确注明 cascade 属性的 Java 属性和 集合" +"类 Hibernate 会采取什么样的默认级联风格。auto-import 属性" +"默认让我们在查询语言中可以使用非全限定名的类名。" + +#. Tag: programlisting +#: basic_mapping.xml:3778 +#, fuzzy, no-c-format +msgid "" +"<hibernate-mapping\n" +" schema=\"schemaName\"\n" +" catalog=\"catalogName\"\n" +" default-cascade=\"cascade_style\"\n" +" default-access=\"field|property|ClassName\"\n" +" default-lazy=\"true|false\"\n" +" auto-import=\"true|false\"\n" +" package=\"package.name\"\n" +" />" +msgstr "" +"]]>" + +#. Tag: para +#: basic_mapping.xml:3782 +#, no-c-format +msgid "schema (optional): the name of a database schema." +msgstr "schema(可选):数据库 schema 的名称。" + +#. Tag: para +#: basic_mapping.xml:3787 +#, no-c-format +msgid "catalog (optional): the name of a database catalog." +msgstr "catalog(可选):数据库 catalog 的名称。 " + +#. Tag: para +#: basic_mapping.xml:3792 +#, no-c-format +msgid "" +"default-cascade (optional - defaults to none): a default cascade style." +msgstr "" +"default-cascade(可选 — 默认为 none):" +"默认的级联风格。 " + +#. Tag: para +#: basic_mapping.xml:3797 +#, no-c-format +msgid "" +"default-access (optional - defaults to property): the strategy Hibernate should use for accessing all properties. " +"It can be a custom implementation of PropertyAccessor." +msgstr "" +"default-access(可选 — 默认为 property):Hibernate 用来访问所有属性的策略。可以通过实现 " +"PropertyAccessor 接口自定义。 " + +#. Tag: para +#: basic_mapping.xml:3804 +#, no-c-format +msgid "" +"default-lazy (optional - defaults to true): the default value for unspecified lazy " +"attributes of class and collection mappings." +msgstr "" +"default-lazy(可选 — 默认为 true):指" +"定了未明确注明 lazy 属性的 Java 属性和集合类,Hibernate 会" +"采取什么样的默认加载风格。 " + +#. Tag: para +#: basic_mapping.xml:3811 +#, no-c-format +msgid "" +"auto-import (optional - defaults to true): specifies whether we can use unqualified class names of classes " +"in this mapping in the query language." +msgstr "" +"auto-import(可选 — 默认为 true):指定" +"我们是否可以在查询语言中使用非全限定的类名(仅限于本映射文件中的类)。 " + +#. Tag: para +#: basic_mapping.xml:3818 +#, no-c-format +msgid "" +"package (optional): specifies a package prefix to use for " +"unqualified class names in the mapping document." +msgstr "" +"package(可选):指定一个包前缀,如果在映射文档中没有指定" +"全限定的类名,就使用这个作为包名。 " + +#. Tag: para +#: basic_mapping.xml:3825 +#, no-c-format +msgid "" +"If you have two persistent classes with the same unqualified name, you " +"should set auto-import=\"false\". An exception will " +"result if you attempt to assign two classes to the same \"imported\" name." +msgstr "" +"假若你有两个持久化类,它们的非全限定名是一样的(就是两个类的名字一样,所在的" +"包不一样 — 译者注),你应该设置 auto-import=\"false\"。如" +"果你把一个“导入过”的名字同时对应两个类,Hibernate 会抛出一个异常。" + +#. Tag: para +#: basic_mapping.xml:3830 +#, no-c-format +msgid "" +"The hibernate-mapping element allows you to nest several " +"persistent <class> mappings, as shown above. It is, " +"however, good practice (and expected by some tools) to map only a single " +"persistent class, or a single class hierarchy, in one mapping file and name " +"it after the persistent superclass. For example, Cat.hbm.xml, Dog.hbm.xml, or if using inheritance, " +"Animal.hbm.xml." +msgstr "" +"注意 hibernate-mapping 元素允许你嵌套多个如上所示的 " +"<class> 映射。但是最好的做法(也许一些工具需要的)是" +"一个持久化类(或一个类的继承层次)对应一个映射文件,并以持久化的超类名称命" +"名,例如:Cat.hbm.xmlDog.hbm.xml,或" +"者如果使用继承,Animal.hbm.xml。" + +#. Tag: title +#: basic_mapping.xml:3841 +#, fuzzy, no-c-format +msgid "Key" +msgstr "键(key)" + +#. Tag: para +#: basic_mapping.xml:3843 +#, fuzzy, no-c-format +msgid "" +"The <key> element is featured a few times within " +"this guide. It appears anywhere the parent mapping element defines a join to " +"a new table that references the primary key of the original table. It also " +"defines the foreign key in the joined table:" +msgstr "" +"我们目前已经见到过 <key> 元素多次了。这个元素在父映" +"射元素定义了对新表的连接,并且在被连接表中定义了一个外键引用原表的主键的情况" +"下经常使用。 " + +#. Tag: programlisting +#: basic_mapping.xml:3864 +#, fuzzy, no-c-format +msgid "" +"<key\n" +" column=\"columnname\"\n" +" on-delete=\"noaction|cascade\"\n" +" property-ref=\"propertyName\"\n" +" not-null=\"true|false\"\n" +" update=\"true|false\"\n" +" unique=\"true|false\"\n" +"/>" +msgstr "" +"<key\n" +" column=\"columnname\"\n" +" on-delete=\"noaction|cascade\"\n" +" property-ref=\"propertyName\"\n" +" not-null=\"true|false\"\n" +" update=\"true|false\"\n" +" unique=\"true|false\"\n" +"/>" + +#. Tag: para +#: basic_mapping.xml:3874 +#, no-c-format +msgid "" +"on-delete (optional - defaults to noaction): specifies whether the foreign key constraint has database-level " +"cascade delete enabled." +msgstr "" +"on-delete(可选,默认是 noaction):表" +"明外键关联是否打开数据库级别的级联删除。 " + +#. Tag: para +#: basic_mapping.xml:3880 +#, no-c-format +msgid "" +"property-ref (optional): specifies that the foreign key " +"refers to columns that are not the primary key of the original table. It is " +"provided for legacy data." +msgstr "" +"property-ref(可选):表明外键引用的字段不是原表的主键(提" +"供给遗留数据)。 " + +#. Tag: para +#: basic_mapping.xml:3886 +#, no-c-format +msgid "" +"not-null (optional): specifies that the foreign key " +"columns are not nullable. This is implied whenever the foreign key is also " +"part of the primary key." +msgstr "" +"not-null(可选):表明外键的字段不可为空(这意味着无论何时" +"外键都是主键的一部分)。 " + +#. Tag: para +#: basic_mapping.xml:3892 +#, no-c-format +msgid "" +"update (optional): specifies that the foreign key should " +"never be updated. This is implied whenever the foreign key is also part of " +"the primary key." +msgstr "" +"update(可选):表明外键决不应该被更新(这意味着无论何时外" +"键都是主键的一部分)。 " + +#. Tag: para +#: basic_mapping.xml:3898 +#, no-c-format +msgid "" +"unique (optional): specifies that the foreign key should " +"have a unique constraint. This is implied whenever the foreign key is also " +"the primary key." +msgstr "" +"unique(可选):表明外键应有唯一性约束(这意味着无论何时外" +"键都是主键的一部分)。 " + +#. Tag: para +#: basic_mapping.xml:3905 +#, no-c-format +msgid "" +"For systems where delete performance is important, we recommend that all " +"keys should be defined on-delete=\"cascade\". Hibernate " +"uses a database-level ON CASCADE DELETE constraint, " +"instead of many individual DELETE statements. Be aware " +"that this feature bypasses Hibernate's usual optimistic locking strategy for " +"versioned data." +msgstr "" +"对那些看重删除性能的系统,我们推荐所有的键都应该定义为 on-delete=" +"\"cascade\",这样 Hibernate 将使用数据库级的 ON CASCADE " +"DELETE 约束,而不是多个 DELETE 语句。注意,这个" +"特性会绕过 Hibernate 通常对版本数据(versioned data)采用的乐观锁策略。 " + +#. Tag: para +#: basic_mapping.xml:3913 +#, no-c-format +msgid "" +"The not-null and update attributes are " +"useful when mapping a unidirectional one-to-many association. If you map a " +"unidirectional one-to-many association to a non-nullable foreign key, you " +"must declare the key column using <key not-" +"null=\"true\">." +msgstr "" +"not-nullupdate 属性在映射单向一对多" +"关联的时候有用。如果你映射一个单向一对多关联到非空的(non-nullable)外键,你" +"必须<key not-null=\"true\"> 定义此键字段。 " + +#. Tag: title +#: basic_mapping.xml:3922 +#, no-c-format +msgid "Import" +msgstr "引用(import) " + +#. Tag: para +#: basic_mapping.xml:3924 +#, no-c-format +msgid "" +"If your application has two persistent classes with the same name, and you " +"do not want to specify the fully qualified package name in Hibernate " +"queries, classes can be \"imported\" explicitly, rather than relying upon " +"auto-import=\"true\". You can also import classes and " +"interfaces that are not explicitly mapped:" +msgstr "" +"假设你的应用程序有两个同样名字的持久化类,但是你不想在 Hibernate 查询中使用他" +"们的全限定名。除了依赖 auto-import=\"true\" 以外,类也可以" +"被显式地“import(引用)”。你甚至可以引用没有被明确映射的类和接口。 " + +#. Tag: programlisting +#: basic_mapping.xml:3930 +#, fuzzy, no-c-format +msgid "<import class=\"java.lang.Object\" rename=\"Universe\"/>" +msgstr "<import class=\"java.lang.Object\" rename=\"Universe\"/>" + +#. Tag: programlisting +#: basic_mapping.xml:3939 +#, fuzzy, no-c-format +msgid "" +"<import\n" +" class=\"ClassName\"\n" +" rename=\"ShortName\"\n" +"/>" +msgstr "" +"<import\n" +" class=\"ClassName\"\n" +" rename=\"ShortName\"\n" +"/>" + +#. Tag: para +#: basic_mapping.xml:3943 +#, no-c-format +msgid "" +"class: the fully qualified class name of any Java class." +msgstr "class:任何 Java 类的全限定名。 " + +#. Tag: para +#: basic_mapping.xml:3948 +#, no-c-format +msgid "" +"rename (optional - defaults to the unqualified class " +"name): a name that can be used in the query language." +msgstr "" +"rename(可选 — 默认为类的全限定名):在查询语句中可以使用" +"的名字。 " + +#. Tag: para +#: basic_mapping.xml:3956 +#, no-c-format +msgid "This feature is unique to hbm.xml and is not supported in annotations." +msgstr "" + +#. Tag: title +#: basic_mapping.xml:3962 +#, no-c-format +msgid "Column and formula elements" +msgstr "字段和规则元素(column and formula elements) " + +#. Tag: para +#: basic_mapping.xml:3964 +#, no-c-format +msgid "" +"Mapping elements which accept a column attribute will " +"alternatively accept a <column> subelement. " +"Likewise, <formula> is an alternative to the " +"formula attribute. For example:" +msgstr "" +"任何接受 column 属性的映射元素都可以选择接受 <" +"column> 子元素。同样的,formula 子元素也可以" +"替换 <formula> 属性。 " + +#. Tag: programlisting +#: basic_mapping.xml:3970 +#, fuzzy, no-c-format +msgid "" +"<column\n" +" name=\"column_name\"\n" +" length=\"N\"\n" +" precision=\"N\"\n" +" scale=\"N\"\n" +" not-null=\"true|false\"\n" +" unique=\"true|false\"\n" +" unique-key=\"multicolumn_unique_key_name\"\n" +" index=\"index_name\"\n" +" sql-type=\"sql_type_name\"\n" +" check=\"SQL expression\"\n" +" default=\"SQL expression\"\n" +" read=\"SQL expression\"\n" +" write=\"SQL expression\"/>" +msgstr "" +"<column\n" +" name=\"column_name\"\n" +" length=\"N\"\n" +" precision=\"N\"\n" +" scale=\"N\"\n" +" not-null=\"true|false\"\n" +" unique=\"true|false\"\n" +" unique-key=\"multicolumn_unique_key_name\"\n" +" index=\"index_name\"\n" +" sql-type=\"sql_type_name\"\n" +" check=\"SQL expression\"\n" +" default=\"SQL expression\"/>" + +#. Tag: programlisting +#: basic_mapping.xml:3972 +#, fuzzy, no-c-format +msgid "<formula>SQL expression</formula>" +msgstr "<formula>SQL expression</formula>" + +#. Tag: para +#: basic_mapping.xml:3974 +#, no-c-format +msgid "" +"Most of the attributes on column provide a means of " +"tailoring the DDL during automatic schema generation. The read and write attributes allow you to specify custom " +"SQL that Hibernate will use to access the column's value. For more on this, " +"see the discussion of column " +"read and write expressions." +msgstr "" +"column 上的大多数属性都提供了在自动模式生成过程中对 DDL 进" +"行裁剪的方法。readwrite 属性允许你" +"指定 Hibernate 用于访问字段值的自定义的 SQL。关于更多的内容,请参考 column read and write expressions。" + +#. Tag: para +#: basic_mapping.xml:3982 +#, no-c-format +msgid "" +"The column and formula elements can " +"even be combined within the same property or association mapping to express, " +"for example, exotic join conditions." +msgstr "" +"columnformula 属性甚至可以在同一个" +"属性或关联映射中被合并来表达,例如,一些奇异的连接条件。" + +#. Tag: programlisting +#: basic_mapping.xml:3986 +#, fuzzy, no-c-format +msgid "" +"<many-to-one name=\"homeAddress\" class=\"Address\"\n" +" insert=\"false\" update=\"false\">\n" +" <column name=\"person_id\" not-null=\"true\" length=\"10\"/>\n" +" <formula>'MAILING'</formula>\n" +"</many-to-one>" +msgstr "" +"<many-to-one name=\"homeAddress\" class=\"Address\"\n" +" insert=\"false\" update=\"false\">\n" +" <column name=\"person_id\" not-null=\"true\" length=\"10\"/>\n" +" <formula>'MAILING'</formula>\n" +"</many-to-one>" + +#. Tag: title +#: basic_mapping.xml:3992 #, no-c-format msgid "Hibernate types" msgstr "Hibernate 的类型 " #. Tag: title +#: basic_mapping.xml:3995 #, no-c-format msgid "Entities and values" msgstr "实体(Entities)和值(values)" #. Tag: para +#: basic_mapping.xml:3997 #, no-c-format -msgid "In relation to the persistence service, Java language-level objects are classified into two groups:" +msgid "" +"In relation to the persistence service, Java language-level objects are " +"classified into two groups:" msgstr "和持久化服务相比,Java 级别的对象分为两个组别:" #. Tag: para +#: basic_mapping.xml:4000 #, no-c-format -msgid "An entity exists independently of any other objects holding references to the entity. Contrast this with the usual Java model, where an unreferenced object is garbage collected. Entities must be explicitly saved and deleted. Saves and deletions, however, can be cascaded from a parent entity to its children. This is different from the ODMG model of object persistence by reachability and corresponds more closely to how application objects are usually used in large systems. Entities support circular and shared references. They can also be versioned." -msgstr "实体entity 独立于任何持有实体引用的对象。与通常的 Java 模型相比,不再被引用的对象会被当作垃圾收集掉。实体必须被显式的保存和删除(除非保存和删除是从父实体向子实体引发的级联)。这和 ODMG 模型中关于对象通过可触及保持持久性有一些不同 — 比较起来更加接近应用程序对象通常在一个大系统中的使用方法。实体支持循环引用和交叉引用,它们也可以加上版本信息。 " +msgid "" +"An entity exists independently of any other objects " +"holding references to the entity. Contrast this with the usual Java model, " +"where an unreferenced object is garbage collected. Entities must be " +"explicitly saved and deleted. Saves and deletions, however, can be " +"cascaded from a parent entity to its children. This is " +"different from the ODMG model of object persistence by reachability and " +"corresponds more closely to how application objects are usually used in " +"large systems. Entities support circular and shared references. They can " +"also be versioned." +msgstr "" +"实体entity 独立于任何持有实体引用的对象。与通常的 Java " +"模型相比,不再被引用的对象会被当作垃圾收集掉。实体必须被显式的保存和删除(除" +"非保存和删除是从父实体向子实体引发的级联)。这和 ODMG 模" +"型中关于对象通过可触及保持持久性有一些不同 — 比较起来更加接近应用程序对象通常" +"在一个大系统中的使用方法。实体支持循环引用和交叉引用,它们也可以加上版本信" +"息。 " #. Tag: para +#: basic_mapping.xml:4010 #, no-c-format -msgid "An entity's persistent state consists of references to other entities and instances of value types. Values are primitives: collections (not what is inside a collection), components and certain immutable objects. Unlike entities, values in particular collections and components, are persisted and deleted by reachability. Since value objects and primitives are persisted and deleted along with their containing entity, they cannot be independently versioned. Values have no independent identity, so they cannot be shared by two entities or collections." -msgstr "一个实体的持久状态包含指向其他实体和类型实例的引用。值可以是原始类型,集合(不是集合中的对象),组件或者特定的不可变对象。与实体不同,值(特别是集合和组件)是通过可触及性来进行持久化和删除的。因为值对象(和原始类型数据)是随着包含他们的实体而被持久化和删除的,他们不能被独立的加上版本信息。值没有独立的标识,所以他们不能被两个实体或者集合共享。 " +msgid "" +"An entity's persistent state consists of references to other entities and " +"instances of value types. Values are primitives: " +"collections (not what is inside a collection), components and certain " +"immutable objects. Unlike entities, values in particular collections and " +"components, are persisted and deleted by reachability. " +"Since value objects and primitives are persisted and deleted along with " +"their containing entity, they cannot be independently versioned. Values have " +"no independent identity, so they cannot be shared by two entities or " +"collections." +msgstr "" +"一个实体的持久状态包含指向其他实体和类型实例的引用。值" +"可以是原始类型,集合(不是集合中的对象),组件或者特定的不可变对象。与实体不" +"同,值(特别是集合和组件)是通过可触及性来进行持久化和删除的。因为值对象(和" +"原始类型数据)是随着包含他们的实体而被持久化和删除的,他们不能被独立的加上版" +"本信息。值没有独立的标识,所以他们不能被两个实体或者集合共享。 " #. Tag: para +#: basic_mapping.xml:4020 #, no-c-format -msgid "Until now, we have been using the term \"persistent class\" to refer to entities. We will continue to do that. Not all user-defined classes with a persistent state, however, are entities. A component is a user-defined class with value semantics. A Java property of type java.lang.String also has value semantics. Given this definition, all types (classes) provided by the JDK have value type semantics in Java, while user-defined types can be mapped with entity or value type semantics. This decision is up to the application developer. An entity class in a domain model will normally have shared references to a single instance of that class, while composition or aggregation usually translates to a value type." -msgstr "直到现在,我们都一直使用术语“持久类”(persistent class)来代表实体。我们仍然会这么做。然而严格说来,不是所有的用户自定义的,带有持久化状态的类都是实体。组件就是用户自定义类,却是值语义的。java.lang.String 类型的 java 属性也是值语义的。给了这个定义以后,我们可以说所有 JDK 提供的类型(类)都是值类型的语义,而用于自定义类型可能被映射为实体类型或值类型语义。采用哪种类型的语义取决于开发人员。在领域模型中,寻找实体类的一个好线索是共享引用指向这个类的单一实例,而组合或聚合通常被转化为值类型。 " +msgid "" +"Until now, we have been using the term \"persistent class\" to refer to " +"entities. We will continue to do that. Not all user-defined classes with a " +"persistent state, however, are entities. A component is " +"a user-defined class with value semantics. A Java property of type " +"java.lang.String also has value semantics. Given this " +"definition, all types (classes) provided by the JDK have value type " +"semantics in Java, while user-defined types can be mapped with entity or " +"value type semantics. This decision is up to the application developer. An " +"entity class in a domain model will normally have shared references to a " +"single instance of that class, while composition or aggregation usually " +"translates to a value type." +msgstr "" +"直到现在,我们都一直使用术语“持久类”(persistent class)来代表实体。我们仍然" +"会这么做。然而严格说来,不是所有的用户自定义的,带有持久化状态的类都是实体。" +"组件就是用户自定义类,却是值语义的。java.lang." +"String 类型的 java 属性也是值语义的。给了这个定义以后,我们可以说所" +"有 JDK 提供的类型(类)都是值类型的语义,而用于自定义类型可能被映射为实体类型" +"或值类型语义。采用哪种类型的语义取决于开发人员。在领域模型中,寻找实体类的一" +"个好线索是共享引用指向这个类的单一实例,而组合或聚合通常被转化为值类型。 " #. Tag: para +#: basic_mapping.xml:4033 #, no-c-format msgid "We will revisit both concepts throughout this reference guide." msgstr "我们会在本文档中重复碰到这两个概念。 " #. Tag: para +#: basic_mapping.xml:4036 #, no-c-format -msgid "The challenge is to map the Java type system, and the developers' definition of entities and value types, to the SQL/database type system. The bridge between both systems is provided by Hibernate. For entities, <class>, <subclass> and so on are used. For value types we use <property>, <component>etc., that usually have a type attribute. The value of this attribute is the name of a Hibernate mapping type. Hibernate provides a range of mappings for standard JDK value types out of the box. You can write your own mapping types and implement your own custom conversion strategies." -msgstr "挑战在于将 java 类型系统(和开发者定义的实体和值类型)映射到 SQL/数据库类型系统。Hibernate 提供了连接两个系统之间的桥梁:对于实体类型,我们使用 <class><subclass> 等等。对于值类型,我们使用 <property><component> 及其他,通常跟随着 type 属性。这个属性的值是Hibernate 的映射类型的名字。Hibernate 提供了许多现成的映射(标准的 JDK 值类型)。你也可以编写自己的映射类型并实现自定义的变换策略,随后我们会看到这点。 " +msgid "" +"The challenge is to map the Java type system, and the developers' definition " +"of entities and value types, to the SQL/database type system. The bridge " +"between both systems is provided by Hibernate. For entities, <" +"class>, <subclass> and so on are used. " +"For value types we use <property>, <" +"component>etc., that usually have a type " +"attribute. The value of this attribute is the name of a Hibernate " +"mapping type. Hibernate provides a range of mappings " +"for standard JDK value types out of the box. You can write your own mapping " +"types and implement your own custom conversion strategies." +msgstr "" +"挑战在于将 java 类型系统(和开发者定义的实体和值类型)映射到 SQL/数据库类型系" +"统。Hibernate 提供了连接两个系统之间的桥梁:对于实体类型,我们使用 " +"<class><subclass> 等等。" +"对于值类型,我们使用 <property><" +"component> 及其他,通常跟随着 type 属性。这个" +"属性的值是Hibernate 的映射类型的名字。Hibernate 提供了许" +"多现成的映射(标准的 JDK 值类型)。你也可以编写自己的映射类型并实现自定义的变" +"换策略,随后我们会看到这点。 " #. Tag: para +#: basic_mapping.xml:4049 #, no-c-format -msgid "With the exception of collections, all built-in Hibernate types support null semantics." -msgstr "所有的 Hibernate 内建类型,除了 collections 以外,都支持空(null)语义。 " +msgid "" +"With the exception of collections, all built-in Hibernate types support null " +"semantics." +msgstr "" +"所有的 Hibernate 内建类型,除了 collections 以外,都支持空(null)语义。 " #. Tag: title +#: basic_mapping.xml:4054 #, no-c-format msgid "Basic value types" msgstr "基本值类型" #. Tag: para +#: basic_mapping.xml:4056 #, no-c-format -msgid "The built-in basic mapping types can be roughly categorized into the following:" +msgid "" +"The built-in basic mapping types can be roughly " +"categorized into the following:" msgstr "内置的 basic mapping types 可以大致地分类为:" -#. Tag: term -#, no-c-format -msgid "integer, long, short, float, double, character, byte, boolean, yes_no, true_false" -msgstr "integer, long, short, float, double, character, byte, boolean, yes_no, true_false" +#. Tag: literal +#: basic_mapping.xml:4059 +#, fuzzy, no-c-format +msgid "" +"integer, long, short, float, double, character, byte, boolean, yes_no, " +"true_false" +msgstr "" +"integer, long, short, float, double, character, byte, boolean, " +"yes_no, true_false" #. Tag: para +#: basic_mapping.xml:4063 #, no-c-format -msgid "Type mappings from Java primitives or wrapper classes to appropriate (vendor-specific) SQL column types. boolean, yes_no and true_false are all alternative encodings for a Java boolean or java.lang.Boolean." -msgstr "这些类型都对应 Java 的原始类型或者其封装类,来符合(特定厂商的)SQL 字段类型。boolean, yes_notrue_false 都是 Java 中 boolean 或者 java.lang.Boolean 的另外说法。" +msgid "" +"Type mappings from Java primitives or wrapper classes to appropriate (vendor-" +"specific) SQL column types. boolean, yes_no and " +"true_false are all alternative encodings for a Java " +"boolean or java.lang.Boolean." +msgstr "" +"这些类型都对应 Java 的原始类型或者其封装类,来符合(特定厂商的)SQL 字段类" +"型。boolean, yes_notrue_false 都是 " +"Java 中 boolean 或者 java.lang.Boolean " +"的另外说法。" -#. Tag: term +#. Tag: literal +#: basic_mapping.xml:4073 #, no-c-format -msgid "string" -msgstr "string" +msgid "string" +msgstr "string" #. Tag: para +#: basic_mapping.xml:4076 #, no-c-format -msgid "A type mapping from java.lang.String to VARCHAR (or Oracle VARCHAR2)." -msgstr "从 java.lang.StringVARCHAR(或者 Oracle 的 VARCHAR2)的映射。" +msgid "" +"A type mapping from java.lang.String to VARCHAR (or Oracle VARCHAR2)." +msgstr "" +"从 java.lang.StringVARCHAR(或者 " +"Oracle 的 VARCHAR2)的映射。" -#. Tag: term -#, no-c-format -msgid "date, time, timestamp" +#. Tag: literal +#: basic_mapping.xml:4083 +#, fuzzy, no-c-format +msgid "date, time, timestamp" msgstr "date, time, timestamp" #. Tag: para +#: basic_mapping.xml:4086 #, no-c-format -msgid "Type mappings from java.util.Date and its subclasses to SQL types DATE, TIME and TIMESTAMP (or equivalent)." -msgstr "从 java.util.Date 和其子类到 SQL 类型 DATETIMETIMESTAMP(或等价类型)的映射。" +msgid "" +"Type mappings from java.util.Date and its subclasses to " +"SQL types DATE, TIME and " +"TIMESTAMP (or equivalent)." +msgstr "" +"从 java.util.Date 和其子类到 SQL 类型 DATETIMETIMESTAMP(或等价类" +"型)的映射。" -#. Tag: term -#, no-c-format -msgid "calendar, calendar_date" +#. Tag: literal +#: basic_mapping.xml:4094 +#, fuzzy, no-c-format +msgid "calendar, calendar_date" msgstr "calendar, calendar_date" #. Tag: para +#: basic_mapping.xml:4097 #, no-c-format -msgid "Type mappings from java.util.Calendar to SQL types TIMESTAMP and DATE (or equivalent)." -msgstr "从 java.util.Calendar 到 SQL 类型 TIMESTAMPDATE(或等价类型)的映射。" +msgid "" +"Type mappings from java.util.Calendar to SQL types " +"TIMESTAMP and DATE (or equivalent)." +msgstr "" +"从 java.util.Calendar 到 SQL 类型 TIMESTAMPDATE(或等价类型)的映射。" -#. Tag: term -#, no-c-format -msgid "big_decimal, big_integer" +#. Tag: literal +#: basic_mapping.xml:4104 +#, fuzzy, no-c-format +msgid "big_decimal, big_integer" msgstr "big_decimal, big_integer" #. Tag: para +#: basic_mapping.xml:4107 #, no-c-format -msgid "Type mappings from java.math.BigDecimal and java.math.BigInteger to NUMERIC (or Oracle NUMBER)." -msgstr "从 java.math.BigDecimaljava.math.BigIntegerNUMERIC(或者 Oracle 的 NUMBER类型)的映射。" +msgid "" +"Type mappings from java.math.BigDecimal and java." +"math.BigInteger to NUMERIC (or Oracle " +"NUMBER)." +msgstr "" +"从 java.math.BigDecimaljava.math.BigIntegerNUMERIC(或者 Oracle 的 NUMBER类型)的映射。" -#. Tag: term -#, no-c-format -msgid "locale, timezone, currency" +#. Tag: literal +#: basic_mapping.xml:4115 +#, fuzzy, no-c-format +msgid "locale, timezone, currency" msgstr "locale, timezone, currency" #. Tag: para +#: basic_mapping.xml:4118 #, no-c-format -msgid "Type mappings from java.util.Locale, java.util.TimeZone and java.util.Currency to VARCHAR (or Oracle VARCHAR2). Instances of Locale and Currency are mapped to their ISO codes. Instances of TimeZone are mapped to their ID." -msgstr "从 java.util.Localejava.util.TimeZonejava.util.CurrencyVARCHAR(或者 Oracle 的 VARCHAR2 类型)的映射。LocaleCurrency 的实例被映射为它们的 ISO 代码。TimeZone 的实例被影射为它的 ID。" +msgid "" +"Type mappings from java.util.Locale, java.util." +"TimeZone and java.util.Currency to " +"VARCHAR (or Oracle VARCHAR2). " +"Instances of Locale and Currency are " +"mapped to their ISO codes. Instances of TimeZone are " +"mapped to their ID." +msgstr "" +"从 java.util.Localejava.util.TimeZonejava.util.CurrencyVARCHAR(或者 Oracle 的 VARCHAR2 类型)的映射。" +"LocaleCurrency 的实例被映射为它们" +"的 ISO 代码。TimeZone 的实例被影射为它的 ID。" -#. Tag: term -#, no-c-format -msgid "class" -msgstr "class" +#. Tag: literal +#: basic_mapping.xml:4131 +#, fuzzy, no-c-format +msgid "class" +msgstr "子类(subclass)" #. Tag: para +#: basic_mapping.xml:4134 #, no-c-format -msgid "A type mapping from java.lang.Class to VARCHAR (or Oracle VARCHAR2). A Class is mapped to its fully qualified name." -msgstr "从 java.lang.ClassVARCHAR(或者 Oracle 的 VARCHAR2 类型)的映射。Class 被映射为它的全限定名。" +msgid "" +"A type mapping from java.lang.Class to VARCHAR (or Oracle VARCHAR2). A Class " +"is mapped to its fully qualified name." +msgstr "" +"从 java.lang.ClassVARCHAR(或者 " +"Oracle 的 VARCHAR2 类型)的映射。Class " +"被映射为它的全限定名。" -#. Tag: term +#. Tag: literal +#: basic_mapping.xml:4142 #, no-c-format -msgid "binary" -msgstr "binary" +msgid "binary" +msgstr "binary" #. Tag: para +#: basic_mapping.xml:4145 #, no-c-format msgid "Maps byte arrays to an appropriate SQL binary type." msgstr "把字节数组(byte arrays)映射为对应的 SQL 二进制类型。" -#. Tag: term +#. Tag: literal +#: basic_mapping.xml:4150 #, no-c-format -msgid "text" -msgstr "text" +msgid "text" +msgstr "text" #. Tag: para +#: basic_mapping.xml:4153 #, no-c-format -msgid "Maps long Java strings to a SQL CLOB or TEXT type." -msgstr "把长 Java 字符串映射为 SQL 的 CLOB 或者 TEXT 类型。" +msgid "" +"Maps long Java strings to a SQL CLOB or TEXT type." +msgstr "" +"把长 Java 字符串映射为 SQL 的 CLOB 或者 TEXT 类型。" -#. Tag: term +#. Tag: literal +#: basic_mapping.xml:4159 #, no-c-format -msgid "serializable" -msgstr "serializable" +msgid "serializable" +msgstr "serializable" #. Tag: para +#: basic_mapping.xml:4162 #, no-c-format -msgid "Maps serializable Java types to an appropriate SQL binary type. You can also indicate the Hibernate type serializable with the name of a serializable Java class or interface that does not default to a basic type." -msgstr "把可序列化的 Java 类型映射到对应的 SQL 二进制类型。你也可以为一个并非默认为基本类型的可序列化 Java 类或者接口指定 Hibernate 类型 serializable。 " +msgid "" +"Maps serializable Java types to an appropriate SQL binary type. You can also " +"indicate the Hibernate type serializable with the name of " +"a serializable Java class or interface that does not default to a basic type." +msgstr "" +"把可序列化的 Java 类型映射到对应的 SQL 二进制类型。你也可以为一个并非默认为基" +"本类型的可序列化 Java 类或者接口指定 Hibernate 类型 serializable。 " -#. Tag: term +#. Tag: literal +#: basic_mapping.xml:4171 #, no-c-format -msgid "clob, blob" -msgstr "clob, blob" +msgid "clob, blob" +msgstr "clob, blob" #. Tag: para +#: basic_mapping.xml:4174 #, no-c-format -msgid "Type mappings for the JDBC classes java.sql.Clob and java.sql.Blob. These types can be inconvenient for some applications, since the blob or clob object cannot be reused outside of a transaction. Driver support is patchy and inconsistent." -msgstr "JDBC 类 java.sql.Clobjava.sql.Blob的映射。某些程序可能不适合使用这个类型,因为 blob 和 clob 对象可能在一个事务之外是无法重用的。(而且, 驱动程序对这种类型的支持充满着补丁和前后矛盾。) " +msgid "" +"Type mappings for the JDBC classes java.sql.Clob and " +"java.sql.Blob. These types can be inconvenient for some " +"applications, since the blob or clob object cannot be reused outside of a " +"transaction. Driver support is patchy and inconsistent." +msgstr "" +"JDBC 类 java.sql.Clobjava.sql.Blob" +"的映射。某些程序可能不适合使用这个类型,因为 blob 和 clob 对象可能在一个事务" +"之外是无法重用的。(而且, 驱动程序对这种类型的支持充满着补丁和前后矛盾。) " -#. Tag: term -#, no-c-format -msgid "imm_date, imm_time, imm_timestamp, imm_calendar, imm_calendar_date, imm_serializable, imm_binary" -msgstr "imm_date, imm_time, imm_timestamp, imm_calendar, imm_calendar_date, imm_serializable, imm_binary" +#. Tag: literal +#: basic_mapping.xml:4184 +#, fuzzy, no-c-format +msgid "" +"imm_date, imm_time, imm_timestamp, imm_calendar, imm_calendar_date, " +"imm_serializable, imm_binary" +msgstr "" +"imm_date, imm_time, imm_timestamp, imm_calendar, imm_calendar_date, " +"imm_serializable, imm_binary" #. Tag: para +#: basic_mapping.xml:4188 #, no-c-format -msgid "Type mappings for what are considered mutable Java types. This is where Hibernate makes certain optimizations appropriate only for immutable Java types, and the application treats the object as immutable. For example, you should not call Date.setTime() for an instance mapped as imm_timestamp. To change the value of the property, and have that change made persistent, the application must assign a new, nonidentical, object to the property." -msgstr "一般来说,映射类型被假定为是可变的 Java 类型,只有对不可变 Java 类型,Hibernate 会采取特定的优化措施,应用程序会把这些对象作为不可变对象处理。比如,你不应该对作为 imm_timestamp 映射的 Date 执行 Date.setTime()。要改变属性的值,并且保存这一改变,应用程序必须对这一属性重新设置一个新的(不一样的)对象。 " +msgid "" +"Type mappings for what are considered mutable Java types. This is where " +"Hibernate makes certain optimizations appropriate only for immutable Java " +"types, and the application treats the object as immutable. For example, you " +"should not call Date.setTime() for an instance mapped as " +"imm_timestamp. To change the value of the property, and " +"have that change made persistent, the application must assign a new, " +"nonidentical, object to the property." +msgstr "" +"一般来说,映射类型被假定为是可变的 Java 类型,只有对不可变 Java 类型," +"Hibernate 会采取特定的优化措施,应用程序会把这些对象作为不可变对象处理。比" +"如,你不应该对作为 imm_timestamp 映射的 Date 执行 " +"Date.setTime()。要改变属性的值,并且保存这一改变,应用程序" +"必须对这一属性重新设置一个新的(不一样的)对象。 " #. Tag: para +#: basic_mapping.xml:4200 #, no-c-format -msgid "Unique identifiers of entities and collections can be of any basic type except binary, blob and clob. Composite identifiers are also allowed. See below for more information." -msgstr "实体及其集合的唯一标识可以是除了 binaryblobclob 之外的任何基础类型。(联合标识也是允许的,后面会说到。)" +msgid "" +"Unique identifiers of entities and collections can be of any basic type " +"except binary, blob and clob. Composite identifiers are also allowed. See below for more " +"information." +msgstr "" +"实体及其集合的唯一标识可以是除了 binaryblobclob 之外的任何基础类型。(联合标识也是允许" +"的,后面会说到。)" #. Tag: para +#: basic_mapping.xml:4205 #, no-c-format -msgid "The basic value types have corresponding Type constants defined on org.hibernate.Hibernate. For example, Hibernate.STRING represents the string type." -msgstr "在 org.hibernate.Hibernate 中,定义了基础类型对应的 Type 常量。比如,Hibernate.STRING 代表 string 类型。" +msgid "" +"The basic value types have corresponding Type constants " +"defined on org.hibernate.Hibernate. For example, " +"Hibernate.STRING represents the string " +"type." +msgstr "" +"在 org.hibernate.Hibernate 中,定义了基础类型对应的 " +"Type 常量。比如,Hibernate.STRING 代表 " +"string 类型。" #. Tag: title +#: basic_mapping.xml:4212 #, no-c-format msgid "Custom value types" msgstr "自定义值类型" #. Tag: para +#: basic_mapping.xml:4214 #, no-c-format -msgid "It is relatively easy for developers to create their own value types. For example, you might want to persist properties of type java.lang.BigInteger to VARCHAR columns. Hibernate does not provide a built-in type for this. Custom types are not limited to mapping a property, or collection element, to a single table column. So, for example, you might have a Java property getName()/setName() of type java.lang.String that is persisted to the columns FIRST_NAME, INITIAL, SURNAME." -msgstr "开发者创建属于他们自己的值类型也是很容易的。比如说,你可能希望持久化 java.lang.BigInteger 类型的属性,持久化成为 VARCHAR 字段。Hibernate没有内置这样一种类型。自定义类型能够映射一个属性(或集合元素)到不止一个数据库表字段。比如说,你可能有这样的 Java 属性:getName()/setName(),这是 java.lang.String 类型的,对应的持久化到三个字段:FIRST_NAMEINITIALSURNAME。 " +msgid "" +"It is relatively easy for developers to create their own value types. For " +"example, you might want to persist properties of type java.lang." +"BigInteger to VARCHAR columns. Hibernate does " +"not provide a built-in type for this. Custom types are not limited to " +"mapping a property, or collection element, to a single table column. So, for " +"example, you might have a Java property getName()/" +"setName() of type java.lang.String " +"that is persisted to the columns FIRST_NAME, " +"INITIAL, SURNAME." +msgstr "" +"开发者创建属于他们自己的值类型也是很容易的。比如说,你可能希望持久化 " +"java.lang.BigInteger 类型的属性,持久化成为 " +"VARCHAR 字段。Hibernate没有内置这样一种类型。自定义类型能" +"够映射一个属性(或集合元素)到不止一个数据库表字段。比如说,你可能有这样的 " +"Java 属性:getName()/setName(),这是 " +"java.lang.String 类型的,对应的持久化到三个字段:" +"FIRST_NAMEINITIALSURNAME。 " #. Tag: para +#: basic_mapping.xml:4225 #, no-c-format -msgid "To implement a custom type, implement either org.hibernate.UserType or org.hibernate.CompositeUserType and declare properties using the fully qualified classname of the type. View org.hibernate.test.DoubleStringType to see the kind of things that are possible." -msgstr "要实现一个自定义类型,可以实现 org.hibernate.UserTypeorg.hibernate.CompositeUserType 中的任一个,并且使用类型的 Java 全限定类名来定义属性。请查看 org.hibernate.test.DoubleStringType 这个例子,看看它是怎么做的。 " +msgid "" +"To implement a custom type, implement either org.hibernate." +"UserType or org.hibernate.CompositeUserType and " +"declare properties using the fully qualified classname of the type. View " +"org.hibernate.test.DoubleStringType to see the kind of " +"things that are possible." +msgstr "" +"要实现一个自定义类型,可以实现 org.hibernate.UserType 或 " +"org.hibernate.CompositeUserType 中的任一个,并且使用类型" +"的 Java 全限定类名来定义属性。请查看 org.hibernate.test." +"DoubleStringType 这个例子,看看它是怎么做的。 " + +#. Tag: programlisting +#: basic_mapping.xml:4232 +#, fuzzy, no-c-format +msgid "" +"<property name=\"twoStrings\" type=\"org.hibernate.test.DoubleStringType" +"\">\n" +" <column name=\"first_string\"/>\n" +" <column name=\"second_string\"/>\n" +"</property>" +msgstr "" +"<property name=\"twoStrings\" type=\"org.hibernate.test.DoubleStringType" +"\">\n" +" <column name=\"first_string\"/>\n" +" <column name=\"second_string\"/>\n" +"</property>" #. Tag: para +#: basic_mapping.xml:4234 #, no-c-format -msgid "Notice the use of <column> tags to map a property to multiple columns." -msgstr "注意使用 <column> 标签来把一个属性映射到多个字段的做法。" +msgid "" +"Notice the use of <column> tags to map a property " +"to multiple columns." +msgstr "" +"注意使用 <column> 标签来把一个属性映射到多个字段的做" +"法。" #. Tag: para +#: basic_mapping.xml:4237 #, no-c-format -msgid "The CompositeUserType, EnhancedUserType, UserCollectionType, and UserVersionType interfaces provide support for more specialized uses." -msgstr "CompositeUserTypeEnhancedUserTypeUserCollectionTypeUserVersionType 接口为更特殊的使用方式提供支持。" +msgid "" +"The CompositeUserType, EnhancedUserType, UserCollectionType, and " +"UserVersionType interfaces provide support for more " +"specialized uses." +msgstr "" +"CompositeUserTypeEnhancedUserType," +"UserCollectionTypeUserVersionType " +"接口为更特殊的使用方式提供支持。" #. Tag: para +#: basic_mapping.xml:4243 #, no-c-format -msgid "You can even supply parameters to a UserType in the mapping file. To do this, your UserType must implement the org.hibernate.usertype.ParameterizedType interface. To supply parameters to your custom type, you can use the <type> element in your mapping files." -msgstr "你甚至可以在一个映射文件中提供参数给一个 UserType。 为了这样做,你的 UserType 必须实现 org.hibernate.usertype.ParameterizedType 接口。为了给自定义类型提供参数,你可以在映射文件中使用 <type> 元素。 " +msgid "" +"You can even supply parameters to a UserType in the " +"mapping file. To do this, your UserType must implement " +"the org.hibernate.usertype.ParameterizedType interface. " +"To supply parameters to your custom type, you can use the <" +"type> element in your mapping files." +msgstr "" +"你甚至可以在一个映射文件中提供参数给一个 UserType。 为了这" +"样做,你的 UserType 必须实现 org.hibernate." +"usertype.ParameterizedType 接口。为了给自定义类型提供参数,你可以在" +"映射文件中使用 <type> 元素。 " + +#. Tag: programlisting +#: basic_mapping.xml:4250 +#, fuzzy, no-c-format +msgid "" +"<property name=\"priority\">\n" +" <type name=\"com.mycompany.usertypes.DefaultValueIntegerType\">\n" +" <param name=\"default\">0</param>\n" +" </type>\n" +"</property>" +msgstr "" +"<property name=\"priority\">\n" +" <type name=\"com.mycompany.usertypes.DefaultValueIntegerType\">\n" +" <param name=\"default\">0</param>\n" +" </type>\n" +"</property>" #. Tag: para +#: basic_mapping.xml:4252 #, no-c-format -msgid "The UserType can now retrieve the value for the parameter named default from the Properties object passed to it." -msgstr "现在,UserType 可以从传入的 Properties 对象中得到 default 参数的值。" +msgid "" +"The UserType can now retrieve the value for the parameter " +"named default from the Properties " +"object passed to it." +msgstr "" +"现在,UserType 可以从传入的 Properties " +"对象中得到 default 参数的值。" #. Tag: para +#: basic_mapping.xml:4256 #, no-c-format -msgid "If you regularly use a certain UserType, it is useful to define a shorter name for it. You can do this using the <typedef> element. Typedefs assign a name to a custom type, and can also contain a list of default parameter values if the type is parameterized." -msgstr "如果你非常频繁地使用某一 UserType,可以为他定义一个简称。这可以通过使用 <typedef> 元素来实现。Typedefs 为一自定义类型赋予一个名称,并且如果此类型是参数化的,还可以包含一系列默认的参数值。 " +msgid "" +"If you regularly use a certain UserType, it is useful to " +"define a shorter name for it. You can do this using the <" +"typedef> element. Typedefs assign a name to a custom type, and " +"can also contain a list of default parameter values if the type is " +"parameterized." +msgstr "" +"如果你非常频繁地使用某一 UserType,可以为他定义一个简称。" +"这可以通过使用 <typedef> 元素来实现。Typedefs 为一自" +"定义类型赋予一个名称,并且如果此类型是参数化的,还可以包含一系列默认的参数" +"值。 " + +#. Tag: programlisting +#: basic_mapping.xml:4262 +#, fuzzy, no-c-format +msgid "" +"<typedef class=\"com.mycompany.usertypes.DefaultValueIntegerType\" name=" +"\"default_zero\">\n" +" <param name=\"default\">0</param>\n" +"</typedef>" +msgstr "" +"<typedef class=\"com.mycompany.usertypes.DefaultValueIntegerType\" name=" +"\"default_zero\">\n" +" <param name=\"default\">0</param>\n" +"</typedef>" + +#. Tag: programlisting +#: basic_mapping.xml:4264 +#, fuzzy, no-c-format +msgid "<property name=\"priority\" type=\"default_zero\"/>" +msgstr "<property name=\"priority\" type=\"default_zero\"/>" #. Tag: para +#: basic_mapping.xml:4266 #, no-c-format -msgid "It is also possible to override the parameters supplied in a typedef on a case-by-case basis by using type parameters on the property mapping." -msgstr "也可以根据具体案例通过属性映射中的类型参数覆盖在 typedef 中提供的参数。" +msgid "" +"It is also possible to override the parameters supplied in a typedef on a " +"case-by-case basis by using type parameters on the property mapping." +msgstr "" +"也可以根据具体案例通过属性映射中的类型参数覆盖在 typedef 中提供的参数。" #. Tag: para +#: basic_mapping.xml:4270 #, no-c-format -msgid "Even though Hibernate's rich range of built-in types and support for components means you will rarely need to use a custom type, it is considered good practice to use custom types for non-entity classes that occur frequently in your application. For example, a MonetaryAmount class is a good candidate for a CompositeUserType, even though it could be mapped as a component. One reason for this is abstraction. With a custom type, your mapping documents would be protected against changes to the way monetary values are represented." -msgstr "尽管 Hibernate 内建的丰富的类型和对组件的支持意味着你可能很少 需要使用自定义类型。不过,为那些在你的应用中经常出现的(非实体)类使用自定义类型也是一个好方法。例如,一个 MonetaryAmount 类使用 CompositeUserType 来映射是不错的选择,虽然他可以很容易地被映射成组件。这样做的动机之一是抽象。使用自定义类型,以后假若你改变表示金额的方法时,它可以保证映射文件不需要修改。 " +msgid "" +"Even though Hibernate's rich range of built-in types and support for " +"components means you will rarely need to use a custom type, it is considered " +"good practice to use custom types for non-entity classes that occur " +"frequently in your application. For example, a MonetaryAmount class is a good candidate for a CompositeUserType, even though it could be mapped as a component. One reason for this " +"is abstraction. With a custom type, your mapping documents would be " +"protected against changes to the way monetary values are represented." +msgstr "" +"尽管 Hibernate 内建的丰富的类型和对组件的支持意味着你可能很少 需要" +"使用自定义类型。不过,为那些在你的应用中经常出现的(非实体)类使用自" +"定义类型也是一个好方法。例如,一个 MonetaryAmount 类使用 " +"CompositeUserType 来映射是不错的选择,虽然他可以很容易地被" +"映射成组件。这样做的动机之一是抽象。使用自定义类型,以后假若你改变表示金额的" +"方法时,它可以保证映射文件不需要修改。 " #. Tag: title +#: basic_mapping.xml:4283 #, no-c-format msgid "Mapping a class more than once" msgstr "多次映射同一个类" #. Tag: para +#: basic_mapping.xml:4285 #, no-c-format -msgid "It is possible to provide more than one mapping for a particular persistent class. In this case, you must specify an entity name to disambiguate between instances of the two mapped entities. By default, the entity name is the same as the class name. Hibernate lets you specify the entity name when working with persistent objects, when writing queries, or when mapping associations to the named entity." -msgstr "对特定的持久化类,映射多次是允许的。这种情形下,你必须指定 entity name 来区别不同映射实体的对象实例。(默认情况下,实体名字和类名是相同的。) Hibernate 在操作持久化对象、编写查询条件,或者把关联映射到指定实体时,允许你指定这个 entity name(实体名字)。 " +msgid "" +"It is possible to provide more than one mapping for a particular persistent " +"class. In this case, you must specify an entity name to " +"disambiguate between instances of the two mapped entities. By default, the " +"entity name is the same as the class name. Hibernate lets you specify the " +"entity name when working with persistent objects, when writing queries, or " +"when mapping associations to the named entity." +msgstr "" +"对特定的持久化类,映射多次是允许的。这种情形下,你必须指定 entity " +"name 来区别不同映射实体的对象实例。(默认情况下,实体名字和类名是" +"相同的。) Hibernate 在操作持久化对象、编写查询条件,或者把关联映射到指定实体" +"时,允许你指定这个 entity name(实体名字)。 " + +#. Tag: programlisting +#: basic_mapping.xml:4293 +#, fuzzy, no-c-format +msgid "" +"<class name=\"Contract\" table=\"Contracts\"\n" +" entity-name=\"CurrentContract\">\n" +" ...\n" +" <set name=\"history\" inverse=\"true\"\n" +" order-by=\"effectiveEndDate desc\">\n" +" <key column=\"currentContractId\"/>\n" +" <one-to-many entity-name=\"HistoricalContract\"/>\n" +" </set>\n" +"</class>\n" +"\n" +"<class name=\"Contract\" table=\"ContractHistory\"\n" +" entity-name=\"HistoricalContract\">\n" +" ...\n" +" <many-to-one name=\"currentContract\"\n" +" column=\"currentContractId\"\n" +" entity-name=\"CurrentContract\"/>\n" +"</class>" +msgstr "" +"<class name=\"Contract\" table=\"Contracts\" \n" +" entity-name=\"CurrentContract\">\n" +" ...\n" +" <set name=\"history\" inverse=\"true\" \n" +" order-by=\"effectiveEndDate desc\">\n" +" <key column=\"currentContractId\"/>\n" +" <one-to-many entity-name=\"HistoricalContract\"/>\n" +" </set>\n" +"</class>\n" +"\n" +"<class name=\"Contract\" table=\"ContractHistory\" \n" +" entity-name=\"HistoricalContract\">\n" +" ...\n" +" <many-to-one name=\"currentContract\" \n" +" column=\"currentContractId\" \n" +" entity-name=\"CurrentContract\"/>\n" +"</class>" #. Tag: para +#: basic_mapping.xml:4295 #, no-c-format -msgid "Associations are now specified using entity-name instead of class." -msgstr "注意这里关联是如何用 entity-name 来代替 class 的。 " +msgid "" +"Associations are now specified using entity-name instead " +"of class." +msgstr "" +"注意这里关联是如何用 entity-name 来代替 class 的。 " + +#. Tag: para +#: basic_mapping.xml:4299 basic_mapping.xml:4379 basic_mapping.xml:4414 +#, no-c-format +msgid "This feature is not supported in Annotations" +msgstr "" #. Tag: title +#: basic_mapping.xml:4304 #, no-c-format msgid "SQL quoted identifiers" msgstr "SQL 中引号包围的标识符" #. Tag: para +#: basic_mapping.xml:4306 #, no-c-format -msgid "You can force Hibernate to quote an identifier in the generated SQL by enclosing the table or column name in backticks in the mapping document. Hibernate will use the correct quotation style for the SQL Dialect. This is usually double quotes, but the SQL Server uses brackets and MySQL uses backticks." -msgstr "你可通过在映射文档中使用反向引号(`)把表名或者字段名包围起来,以强制 Hibernate 在生成的 SQL 中把标识符用引号包围起来。Hibernate 会使用相应的 SQLDialect(方言)来使用正确的引号风格(通常是双引号,但是在 SQL Server 中是括号,MySQL 中是反向引号)。 " - -#. Tag: title -#, no-c-format -msgid "Metadata alternatives" -msgstr "其他元数据(Metadata)" - -#. Tag: para -#, no-c-format -msgid "XML does not suit all users so there are some alternative ways to define O/R mapping metadata in Hibernate." -msgstr "XML 并不适用于所有人, 因此有其他定义 Hibernate O/R 映射元数据(metadata)的方法。 " - -#. Tag: title -#, no-c-format -msgid "Using XDoclet markup" -msgstr "使用 XDoclet 标记" - -#. Tag: para -#, no-c-format -msgid "Many Hibernate users prefer to embed mapping information directly in sourcecode using XDoclet @hibernate.tags. We do not cover this approach in this reference guide since it is considered part of XDoclet. However, we include the following example of the Cat class with XDoclet mappings:" -msgstr "很多 Hibernate 使用者更喜欢使用 XDoclet@hibernate.tags 将映射信息直接嵌入到源代码中。我们不会在本文档中涉及这个方法,因为严格说来,这属于 XDoclet 的一部分。然而,我们包含了如下使用 XDoclet 映射的 Cat 类的例子。 " - -#. Tag: para -#, no-c-format -msgid "See the Hibernate website for more examples of XDoclet and Hibernate." -msgstr "参考 Hibernate 网站更多的 Xdoclet 和 Hibernate 的例子。" - -#. Tag: title -#, no-c-format -msgid "Using JDK 5.0 Annotations" -msgstr "使用 JDK 5.0 的注解(Annotation)" - -#. Tag: para -#, no-c-format -msgid "JDK 5.0 introduced XDoclet-style annotations at the language level that are type-safe and checked at compile time. This mechanism is more powerful than XDoclet annotations and better supported by tools and IDEs. IntelliJ IDEA, for example, supports auto-completion and syntax highlighting of JDK 5.0 annotations. The new revision of the EJB specification (JSR-220) uses JDK 5.0 annotations as the primary metadata mechanism for entity beans. Hibernate3 implements the EntityManager of JSR-220 (the persistence API). Support for mapping metadata is available via the Hibernate Annotations package as a separate download. Both EJB3 (JSR-220) and Hibernate3 metadata is supported." -msgstr "JDK 5.0 在语言级别引入了 XDoclet 风格的标注,并且是类型安全的,在编译期进行检查。这一机制比 XDoclet 的注解更为强大,有更好的工具和 IDE 支持。例如,IntelliJ IDEA,支持 JDK 5.0 注解的自动完成和语法高亮 。EJB 规范的新修订版 (JSR-220) 使用 JDK 5.0 的注解作为entity beans的主要元数据(metadata)机制。Hibernate 3 实现了JSR-220(the persistence API) 的 EntityManager,支持通过 Hibernate Annotations 包定义映射元数据。这个包作为单独的部分下载,支持 EJB3(JSR-220) 和 Hibernate3 的元数据。 " - -#. Tag: para -#, no-c-format -msgid "This is an example of a POJO class annotated as an EJB entity bean:" -msgstr "这是一个被注解为 EJB entity bean 的 POJO 类的例子" - -#. Tag: para -#, no-c-format -msgid "Support for JDK 5.0 Annotations (and JSR-220) is currently under development. Please refer to the Hibernate Annotations module for more details." -msgstr "注意:对 JDK 5.0 注解(和 JSR-220)支持的工作仍然在进行中,并未完成。更多细节请参阅 Hibernate Annotations 模块。 " +msgid "" +"You can force Hibernate to quote an identifier in the generated SQL by " +"enclosing the table or column name in backticks in the mapping document. " +"Hibernate will use the correct quotation style for the SQL Dialect. This is usually double quotes, but the SQL Server uses brackets " +"and MySQL uses backticks." +msgstr "" +"你可通过在映射文档中使用反向引号(`)把表名或者字段名包围起来,以强制 " +"Hibernate 在生成的 SQL 中把标识符用引号包围起来。Hibernate 会使用相应的 " +"SQLDialect(方言)来使用正确的引号风格(通常是双引号,但是" +"在 SQL Server 中是括号,MySQL 中是反向引号)。 " + +#. Tag: programlisting +#: basic_mapping.xml:4312 +#, fuzzy, no-c-format +msgid "" +"@Entity @Table(name=\"`Line Item`\")\n" +"class LineItem {\n" +" @id @Column(name=\"`Item Id`\") Integer id;\n" +" @Column(name=\"`Item #`\") int itemNumber\n" +"}\n" +"\n" +"<class name=\"LineItem\" table=\"`Line Item`\">\n" +" <id name=\"id\" column=\"`Item Id`\"/><generator class=" +"\"assigned\"/></id>\n" +" <property name=\"itemNumber\" column=\"`Item #`\"/>\n" +" ...\n" +"</class>" +msgstr "" +"<class name=\"LineItem\" table=\"`Line Item`\">\n" +" <id name=\"id\" column=\"`Item Id`\"/><generator class=" +"\"assigned\"/></id>\n" +" <property name=\"itemNumber\" column=\"`Item #`\"/>\n" +" ...\n" +"</class>" #. Tag: title +#: basic_mapping.xml:4316 #, no-c-format msgid "Generated properties" msgstr "数据库生成属性(Generated Properties) " #. Tag: para +#: basic_mapping.xml:4318 #, no-c-format -msgid "Generated properties are properties that have their values generated by the database. Typically, Hibernate applications needed to refresh objects that contain any properties for which the database was generating values. Marking properties as generated, however, lets the application delegate this responsibility to Hibernate. When Hibernate issues an SQL INSERT or UPDATE for an entity that has defined generated properties, it immediately issues a select afterwards to retrieve the generated values." -msgstr "Generated properties 指的是其值由数据库生成的属性。一般来说,如果对象有任何属性由数据库生成值,Hibernate 应用程序需要进行刷新(refresh)。但如果把属性标明为 generated,就可以转由 Hibernate 来负责这个动作。实际上。对定义了 generated properties 的实体,每当 Hibernate 执行一条 SQL INSERT 或者 UPDATE 语句,会立刻执行一条 select 来获得生成的值。 " +msgid "" +"Generated properties are properties that have their values generated by the " +"database. Typically, Hibernate applications needed to refresh objects that contain any properties for which the database was " +"generating values. Marking properties as generated, however, lets the " +"application delegate this responsibility to Hibernate. When Hibernate issues " +"an SQL INSERT or UPDATE for an entity that has defined generated properties, " +"it immediately issues a select afterwards to retrieve the generated values." +msgstr "" +"Generated properties 指的是其值由数据库生成的属性。一般来说,如果对象有任何属" +"性由数据库生成值,Hibernate 应用程序需要进行刷新(refresh)。但如果把属性标明为 generated,就可以转由 Hibernate 来负责这个动作。" +"实际上。对定义了 generated properties 的实体,每当 Hibernate 执行一条 SQL " +"INSERT 或者 UPDATE 语句,会立刻执行一条 select 来获得生成的值。 " #. Tag: para +#: basic_mapping.xml:4327 #, no-c-format -msgid "Properties marked as generated must additionally be non-insertable and non-updateable. Only versions, timestamps, and simple properties, can be marked as generated." -msgstr "被标明为 generated 的属性还必须是 non-insertable 和 non-updateable 的。只有 versions、timestamps 和 simple properties 可以被标明为 generated。 " +msgid "" +"Properties marked as generated must additionally be non-insertable and non-" +"updateable. Only versions, timestamps, " +"and simple properties, " +"can be marked as generated." +msgstr "" +"被标明为 generated 的属性还必须是 non-insertable 和 non-updateable 的。只有 " +"versions、timestamps 和 simple properties 可以被标明为 " +"generated。 " #. Tag: para +#: basic_mapping.xml:4334 #, no-c-format -msgid "never (the default): the given property value is not generated within the database." +msgid "" +"never (the default): the given property value is not " +"generated within the database." msgstr "never(默认)标明此属性值不是从数据库中生成。 " #. Tag: para +#: basic_mapping.xml:4337 #, no-c-format -msgid "insert: the given property value is generated on insert, but is not regenerated on subsequent updates. Properties like created-date fall into this category. Even though version and timestamp properties can be marked as generated, this option is not available." -msgstr "insert — 标明此属性值在 insert 的时候生成,但是不会在随后的 update 时重新生成。比如说创建日期就归属于这类。注意虽然 version 和 timestamp 属性可以被标注为 generated,但是不适用这个选项。" +msgid "" +"insert: the given property value is generated on insert, " +"but is not regenerated on subsequent updates. Properties like created-date " +"fall into this category. Even though version and timestamp properties can be marked as generated, this option is " +"not available." +msgstr "" +"insert — 标明此属性值在 insert 的时候生成,但是不会在随后" +"的 update 时重新生成。比如说创建日期就归属于这类。注意虽然 version 和 timestamp 属性可以被标注为 generated,但是不适" +"用这个选项。" #. Tag: para +#: basic_mapping.xml:4344 #, no-c-format -msgid "always: the property value is generated both on insert and on update." -msgstr "always — 标明此属性值在 insert 和 update 时都会被生成。 " +msgid "" +"always: the property value is generated both on insert " +"and on update." +msgstr "" +"always — 标明此属性值在 insert 和 update 时都会被生成。 " + +#. Tag: para +#: basic_mapping.xml:4347 +#, no-c-format +msgid "To mark a property as generated, use @Generated." +msgstr "" #. Tag: title +#: basic_mapping.xml:4352 #, no-c-format msgid "Column read and write expressions" msgstr "字段的读写表达式" #. Tag: para +#: basic_mapping.xml:4354 +#, fuzzy, no-c-format +msgid "" +"Hibernate allows you to customize the SQL it uses to read and write the " +"values of columns mapped to simple properties. For example, if your database provides a set of " +"data encryption functions, you can invoke them for individual columns like " +"this:" +msgstr "" +"Hibernate 允许你自定义 SQL 以读写映射简单属性的字段值。例如,如果你的数据库提供了一套数据加密方" +"法,你可以在单个字段上调用它们:<property " +"name=\"creditCardNumber\"> <column name=\"credit_card_num\" read=" +"\"decrypt(credit_card_num)\" write=\"encrypt(?)\"/> </property>" + +#. Tag: programlisting +#: basic_mapping.xml:4359 #, no-c-format -msgid "Hibernate allows you to customize the SQL it uses to read and write the values of columns mapped to simple properties. For example, if your database provides a set of data encryption functions, you can invoke them for individual columns like this: <property name=\"creditCardNumber\"> <column name=\"credit_card_num\" read=\"decrypt(credit_card_num)\" write=\"encrypt(?)\"/> </property>" -msgstr "Hibernate 允许你自定义 SQL 以读写映射简单属性的字段值。例如,如果你的数据库提供了一套数据加密方法,你可以在单个字段上调用它们:<property name=\"creditCardNumber\"> <column name=\"credit_card_num\" read=\"decrypt(credit_card_num)\" write=\"encrypt(?)\"/> </property>" +msgid "" +"<property name=\"creditCardNumber\">\n" +" <column \n" +" name=\"credit_card_num\"\n" +" read=\"decrypt(credit_card_num)\"\n" +" write=\"encrypt(?)\"/>\n" +"</property>" +msgstr "" #. Tag: para +#: basic_mapping.xml:4361 #, no-c-format -msgid "Hibernate applies the custom expressions automatically whenever the property is referenced in a query. This functionality is similar to a derived-property formula with two differences:" -msgstr "每当属性在查询里被引用时,Hibernate 都自动应用自定义的表达式。这种功能和 derived-property formula 相似,但有两个不同的地方:" +msgid "" +"Hibernate applies the custom expressions automatically whenever the property " +"is referenced in a query. This functionality is similar to a derived-" +"property formula with two differences:" +msgstr "" +"每当属性在查询里被引用时,Hibernate 都自动应用自定义的表达式。这种功能和 " +"derived-property formula 相似,但有两个不同的地方:" #. Tag: para +#: basic_mapping.xml:4366 #, no-c-format -msgid "The property is backed by one or more columns that are exported as part of automatic schema generation." +msgid "" +"The property is backed by one or more columns that are exported as part of " +"automatic schema generation." msgstr "属性由一个或多个属性组成,它作为自动模式生成的一部分导出。" #. Tag: para +#: basic_mapping.xml:4371 #, no-c-format msgid "The property is read-write, not read-only." msgstr "属性是可读写的,非只读的。" #. Tag: para +#: basic_mapping.xml:4375 #, no-c-format -msgid "The write expression, if specified, must contain exactly one '?' placeholder for the value." -msgstr "如果指定了 write 表达式,它必须只包含一个“?”占位符。" +msgid "" +"The write expression, if specified, must contain exactly " +"one '?' placeholder for the value." +msgstr "" +"如果指定了 write 表达式,它必须只包含一个“?”占位符。" #. Tag: title +#: basic_mapping.xml:4384 #, no-c-format msgid "Auxiliary database objects" msgstr "辅助数据库对象(Auxiliary Database Objects) " #. Tag: para +#: basic_mapping.xml:4386 #, no-c-format -msgid "Auxiliary database objects allow for the CREATE and DROP of arbitrary database objects. In conjunction with Hibernate's schema evolution tools, they have the ability to fully define a user schema within the Hibernate mapping files. Although designed specifically for creating and dropping things like triggers or stored procedures, any SQL command that can be run via a java.sql.Statement.execute() method is valid (for example, ALTERs, INSERTS, etc.). There are essentially two modes for defining auxiliary database objects:" -msgstr "允许 CREATE 和 DROP 任意数据库对象,与 Hibernate 的 schema 交互工具组合起来,可以提供在 Hibernate 映射文件中完全定义用户 schema 的能力。虽然这是为创建和销毁 trigger(触发器)或stored procedure(存储过程)等特别设计的,实际上任何可以在 java.sql.Statement.execute() 方法中执行的 SQL 命令都可以在此使用(比如ALTER, INSERT,等等)。本质上有两种模式来定义辅助数据库对象... " +msgid "" +"Auxiliary database objects allow for the CREATE and DROP of arbitrary " +"database objects. In conjunction with Hibernate's schema evolution tools, " +"they have the ability to fully define a user schema within the Hibernate " +"mapping files. Although designed specifically for creating and dropping " +"things like triggers or stored procedures, any SQL command that can be run " +"via a java.sql.Statement.execute() method is valid (for " +"example, ALTERs, INSERTS, etc.). There are essentially two modes for " +"defining auxiliary database objects:" +msgstr "" +"允许 CREATE 和 DROP 任意数据库对象,与 Hibernate 的 schema 交互工具组合起来," +"可以提供在 Hibernate 映射文件中完全定义用户 schema 的能力。虽然这是为创建和销" +"毁 trigger(触发器)或stored procedure(存储过程)等特别设计的,实际上任何可" +"以在 java.sql.Statement.execute() 方法中执行的 SQL 命令都" +"可以在此使用(比如ALTER, INSERT,等等)。本质上有两种模式来定义辅助数据库对" +"象... " #. Tag: para +#: basic_mapping.xml:4396 #, no-c-format -msgid "The first mode is to explicitly list the CREATE and DROP commands in the mapping file:" +msgid "" +"The first mode is to explicitly list the CREATE and DROP commands in the " +"mapping file:" msgstr "第一种模式是在映射文件中显式声明 CREATE 和 DROP 命令: " -#. Tag: para -#, no-c-format -msgid "The second mode is to supply a custom class that constructs the CREATE and DROP commands. This custom class must implement the org.hibernate.mapping.AuxiliaryDatabaseObject interface." -msgstr "第二种模式是提供一个类,这个类知道如何组织 CREATE 和 DROP 命令。这个特别类必须实现 org.hibernate.mapping.AuxiliaryDatabaseObject 接口。 " +#. Tag: programlisting +#: basic_mapping.xml:4399 +#, fuzzy, no-c-format +msgid "" +"<hibernate-mapping>\n" +" ...\n" +" <database-object>\n" +" <create>CREATE TRIGGER my_trigger ...</create>\n" +" <drop>DROP TRIGGER my_trigger</drop>\n" +" </database-object>\n" +"</hibernate-mapping>" +msgstr "" +"<hibernate-mapping>\n" +" ...\n" +" <database-object>\n" +" <create>CREATE TRIGGER my_trigger ...</create>\n" +" <drop>DROP TRIGGER my_trigger</drop>\n" +" </database-object>\n" +"</hibernate-mapping>" #. Tag: para +#: basic_mapping.xml:4401 #, no-c-format -msgid "Additionally, these database objects can be optionally scoped so that they only apply when certain dialects are used." +msgid "" +"The second mode is to supply a custom class that constructs the CREATE and " +"DROP commands. This custom class must implement the org.hibernate." +"mapping.AuxiliaryDatabaseObject interface." +msgstr "" +"第二种模式是提供一个类,这个类知道如何组织 CREATE 和 DROP 命令。这个特别类必" +"须实现 org.hibernate.mapping.AuxiliaryDatabaseObject 接" +"口。 " + +#. Tag: programlisting +#: basic_mapping.xml:4406 +#, fuzzy, no-c-format +msgid "" +"<hibernate-mapping>\n" +" ...\n" +" <database-object>\n" +" <definition class=\"MyTriggerDefinition\"/>\n" +" </database-object>\n" +"</hibernate-mapping>" +msgstr "" +"<hibernate-mapping>\n" +" ...\n" +" <database-object>\n" +" <definition class=\"MyTriggerDefinition\"/>\n" +" </database-object>\n" +"</hibernate-mapping>" + +#. Tag: para +#: basic_mapping.xml:4408 +#, no-c-format +msgid "" +"Additionally, these database objects can be optionally scoped so that they " +"only apply when certain dialects are used." msgstr "还有,这些数据库对象可以特别指定为仅在特定的方言中才使用。 " +#. Tag: programlisting +#: basic_mapping.xml:4411 +#, fuzzy, no-c-format +msgid "" +"<hibernate-mapping>\n" +" ...\n" +" <database-object>\n" +" <definition class=\"MyTriggerDefinition\"/>\n" +" <dialect-scope name=\"org.hibernate.dialect.Oracle9iDialect\"/" +">\n" +" <dialect-scope name=\"org.hibernate.dialect.Oracle10gDialect\"/" +">\n" +" </database-object>\n" +"</hibernate-mapping>" +msgstr "" +"<hibernate-mapping>\n" +" ...\n" +" <database-object>\n" +" <definition class=\"MyTriggerDefinition\"/>\n" +" <dialect-scope name=\"org.hibernate.dialect.Oracle9Dialect\"/" +">\n" +" <dialect-scope name=\"org.hibernate.dialect.OracleDialect\"/>\n" +" </database-object>\n" +"</hibernate-mapping>" + +#~ msgid "Class" +#~ msgstr "类" + #~ msgid "" -#~ "\n" -#~ "\n" -#~ "\n" -#~ "\n" -#~ "\n" -#~ " \n" -#~ "\n" -#~ " \n" -#~ " \n" -#~ " \n" -#~ "\n" -#~ " \n" -#~ "\n" -#~ " \n" -#~ "\n" -#~ " \n" -#~ "\n" -#~ " \n" -#~ "\n" -#~ " \n" -#~ "\n" -#~ " \n" -#~ "\n" -#~ " \n" -#~ "\n" -#~ " \n" -#~ " \n" -#~ " \n" -#~ " \n" -#~ "\n" -#~ " \n" -#~ "\n" -#~ " \n" -#~ "\n" -#~ " \n" -#~ "\n" -#~ " \n" -#~ "\n" -#~ " \n" -#~ " \n" -#~ " \n" -#~ "\n" -#~ "]]>" +#~ "Use of select-before-update will usually decrease " +#~ "performance. It is useful to prevent a database update trigger being " +#~ "called unnecessarily if you reattach a graph of detached instances to a " +#~ "Session." #~ msgstr "" -#~ "\n" -#~ "\n" -#~ "\n" -#~ "\n" -#~ "\n" -#~ " \n" -#~ "\n" -#~ " \n" -#~ " \n" -#~ " \n" -#~ "\n" -#~ " \n" -#~ "\n" -#~ " \n" -#~ "\n" -#~ " \n" -#~ "\n" -#~ " \n" -#~ "\n" -#~ " \n" -#~ "\n" -#~ " \n" -#~ "\n" -#~ " \n" -#~ "\n" -#~ " \n" -#~ " \n" -#~ " \n" -#~ " \n" -#~ "\n" -#~ " \n" -#~ "\n" -#~ " \n" -#~ "\n" -#~ " \n" -#~ "\n" -#~ " \n" -#~ "\n" -#~ " \n" -#~ " \n" -#~ " \n" -#~ "\n" -#~ "]]>" +#~ "使用 select-before-update 通常会降低性能。如果你重新连" +#~ "接一个脱管(detached)对象实例 到一个 Session 中时,它" +#~ "可以防止数据库不必要的触发 update。这就很有用了。" + +#~ msgid "id" +#~ msgstr "id" + +#~ msgid "Generator" +#~ msgstr "Generator" + +#~ msgid "increment" +#~ msgstr "increment" + +#~ msgid "identity" +#~ msgstr "identity" + +#~ msgid "sequence" +#~ msgstr "sequence" + +#~ msgid "seqhilo" +#~ msgstr "seqhilo" + +#~ msgid "uuid" +#~ msgstr "uuid" + +#~ msgid "" +#~ "uses a 128-bit UUID algorithm to generate identifiers of type string that " +#~ "are unique within a network (the IP address is used). The UUID is encoded " +#~ "as a string of 32 hexadecimal digits in length." +#~ msgstr "" +#~ "用一个 128-bit 的 UUID 算法生成字符串类型的标识符,这在一个网络中是唯一的" +#~ "(使用了 IP 地址)。UUID 被编码为一个 32 位 16 进制数字的字符串。 " + +#~ msgid "guid" +#~ msgstr "guid" + +#~ msgid "native" +#~ msgstr "native" + +#~ msgid "select" +#~ msgstr "select" + +#~ msgid "foreign" +#~ msgstr "foreign" + +#~ msgid "" +#~ "optimizer (optional - defaults to none): See " +#~ msgstr "" +#~ "optimizer(可选 — 默认是none):请参" +#~ "考 。" + +#~ msgid "composite-id" +#~ msgstr "composite-id" + +#~ msgid "" +#~ "A table with a composite key can be mapped with multiple properties of " +#~ "the class as identifier properties. The <composite-id> element accepts <key-property> property " +#~ "mappings and <key-many-to-one> mappings as child " +#~ "elements." +#~ msgstr "" +#~ "如果表使用联合主键,你可以映射类的多个属性为标识符属性。<" +#~ "composite-id> 元素接受 <key-property> 属性映射和 <key-many-to-one> 属性映射作" +#~ "为子元素。 " + +#~ msgid "" +#~ "The persistent class must override equals()" +#~ " and hashCode() to implement composite " +#~ "identifier equality. It must also implement Serializable." +#~ msgstr "" +#~ "你的持久化类必须覆盖 equals() 和 " +#~ "hashCode() 方法,来实现组合的标识符的相等判断。实现 " +#~ "Serializable 接口也是必须的。" + +#~ msgid "" +#~ "Unfortunately, this approach means that a persistent object is its own " +#~ "identifier. There is no convenient \"handle\" other than the object " +#~ "itself. You must instantiate an instance of the persistent class itself " +#~ "and populate its identifier properties before you can load() the persistent state associated with a composite key. We call " +#~ "this approach an embedded composite identifier, and " +#~ "discourage it for serious applications." +#~ msgstr "" +#~ "不幸的是,这种组合关键字的方法意味着一个持久化类是它自己的标识。除了对象自" +#~ "己之外,没有什么方便的“把手”可用。你必须初始化持久化类的实例,填充它的标识" +#~ "符属性,再 load() 组合关键字关联的持久状态。我们把这种" +#~ "方法称为 embedded(嵌入式)的组合标识符,在重要的应用" +#~ "中不鼓励使用这种用法。 " + +#~ msgid "" +#~ "A second approach is what we call a mapped composite " +#~ "identifier, where the identifier properties named inside the <" +#~ "composite-id> element are duplicated on both the persistent " +#~ "class and a separate identifier class." +#~ msgstr "" +#~ "第二种方法我们称为 mapped(映射式)组合标识符" +#~ "(mapped composite identifier),<composite-id> " +#~ "元素中列出的标识属性不但在持久化类出现,还形成一个独立的标识符类。" + +#~ msgid "" +#~ "In this example, both the composite identifier class, " +#~ "MedicareId, and the entity class itself have " +#~ "properties named medicareNumber and " +#~ "dependent. The identifier class must override " +#~ "equals() and hashCode() and " +#~ "implement Serializable. The main disadvantage of this " +#~ "approach is code duplication." +#~ msgstr "" +#~ "在这个例子中,组合标识符类 MedicareId 和实体类都含有 " +#~ "medicareNumberdependent 属性。标" +#~ "识符类必须重载 equals()hashCode() 并且实现 Serializable 接口。这种方法的缺点是出" +#~ "现了明显的代码重复。" + +#~ msgid "" +#~ "The following attributes are used to specify a mapped composite " +#~ "identifier:" +#~ msgstr "下面列出的属性是用来指定一个映射式组合标识符的:" + +#~ msgid "" +#~ "mapped (optional - defaults to false): indicates that a mapped composite identifier is used, and that " +#~ "the contained property mappings refer to both the entity class and the " +#~ "composite identifier class." +#~ msgstr "" +#~ "mapped(可选,默认为 false):指明使" +#~ "用一个映射式组合标识符,其包含的属性映射同时在实体类和组合标识符类中出" +#~ "现。 " + +#~ msgid "" +#~ "class (optional - but required for a mapped composite " +#~ "identifier): the class used as a composite identifier." +#~ msgstr "" +#~ "class(可选,但对映射式组合标识符必须指定):作为组合标" +#~ "识符类使用的类名。" + +#~ msgid "" +#~ "We will describe a third, even more convenient approach, where the " +#~ "composite identifier is implemented as a component class in . The attributes described below apply only " +#~ "to this alternative approach:" +#~ msgstr "" +#~ "在 一节中,我们会描述第三种方式," +#~ "那就是把组合标识符实现为一个组件(component)类,这是更方便的方法。下面的属" +#~ "性仅对第三种方法有效: " + +#~ msgid "" +#~ "name (optional - required for this approach): a " +#~ "property of component type that holds the composite identifier. Please " +#~ "see chapter 9 for more information." +#~ msgstr "" +#~ "name(可选,但对这种方法而言必须):包含此组件标识符的组" +#~ "件类型的名字(参阅第 9 章)。" + +#~ msgid "" +#~ "class (optional - defaults to the property type " +#~ "determined by reflection): the component class used as a composite " +#~ "identifier. Please see the next section for more information." +#~ msgstr "" +#~ "class(可选 — 默认会用反射来自动判定属性类型 ):用来作" +#~ "为组合标识符的组件类的类名(参阅下一节)。 " + +#~ msgid "" +#~ "The third approach, an identifier component, is " +#~ "recommended for almost all applications." +#~ msgstr "" +#~ "第三种方式,被称为 identifier component(标识符组件)" +#~ "是我们对几乎所有应用都推荐使用的方式。 " + +#~ msgid "Version (optional)" +#~ msgstr "版本(version)(可选) " + +#~ msgid "" +#~ "The <version> element is optional and indicates " +#~ "that the table contains versioned data. This is particularly useful if " +#~ "you plan to use long transactions. See below for " +#~ "more information:" +#~ msgstr "" +#~ "<version> 元素是可选的,表明表中包含附带版本信息" +#~ "的数据。这在你准备使用 长事务(long transactions)的" +#~ "时候特别有用。下面是更多信息:" + +#~ msgid "" +#~ "Version numbers can be of Hibernate type long, " +#~ "integer, short, timestamp or calendar." +#~ msgstr "" +#~ "版本号必须是以下类型:longintegershorttimestamp 或者 " +#~ "calendar。" + +#~ msgid "Many-to-one" +#~ msgstr "多对一(many-to-one) " + +#~ msgid "" +#~ "An ordinary association to another persistent class is declared using a " +#~ "many-to-one element. The relational model is a many-to-" +#~ "one association; a foreign key in one table is referencing the primary " +#~ "key column(s) of the target table." +#~ msgstr "" +#~ "通过 many-to-one 元素,可以定义一种常见的与另一个持久化" +#~ "类的关联。这种关系模型是多对一关联(实际上是一个对象引用-译注):这个表的" +#~ "一个外键引用目标表的主键字段。 " + +#~ msgid "One-to-one" +#~ msgstr "一对一 " + +#~ msgid "There are two varieties of one-to-one associations:" +#~ msgstr "有两种不同的一对一关联: " + +#~ msgid "primary key associations" +#~ msgstr "主键关联" + +#~ msgid "" +#~ "Alternatively, a foreign key with a unique constraint, from " +#~ "Employee to Person, can be " +#~ "expressed as:" +#~ msgstr "" +#~ "另一种方式是一个外键和一个惟一关键字对应,上面的 EmployeePerson 的例子,如果使用这种关联方式,可以" +#~ "表达成: " + +#~ msgid "" +#~ "This association can be made bidirectional by adding the following to the " +#~ "Person mapping:" +#~ msgstr "" +#~ "如果在 Person 的映射加入下面几句,这种关联就是双向的: " + +#~ msgid "Component and dynamic-component" +#~ msgstr "组件(component)和动态组件(dynamic-component) " + +#~ msgid "Subclass" +#~ msgstr "子类(subclass) " + +#~ msgid "" +#~ "A discriminator column is not required for this mapping strategy. Each " +#~ "subclass must, however, declare a table column holding the object " +#~ "identifier using the <key> element. The mapping " +#~ "at the start of the chapter would then be re-written as:" +#~ msgstr "" +#~ "这种映射策略不需要指定辨别标志(discriminator)字段。但是,每一个子类都必" +#~ "须使用 <key> 元素指定一个表字段来持有对象的标识" +#~ "符。本章开始的映射可以被用如下方式重写: " + +#~ msgid "Union-subclass" +#~ msgstr "联合子类(union-subclass) " + +#~ msgid "Join" +#~ msgstr "连接(join) " + +#~ msgid "" +#~ "Using the <join> element, it is possible to map " +#~ "properties of one class to several tables that have a one-to-one " +#~ "relationship. For example:" +#~ msgstr "" +#~ "使用 <join> 元素,假若在表之间存在一对一关联,可以" +#~ "将一个类的属性映射到多张表中。 " + +#~ msgid "Key" +#~ msgstr "Key" + +#~ msgid "Any" +#~ msgstr "Any" + +#~ msgid "class" +#~ msgstr "class" + +#~ msgid "binary" +#~ msgstr "binary" + +#~ msgid "text" +#~ msgstr "text" + +#~ msgid "clob, blob" +#~ msgstr "clob, blob" + +#~ msgid "" +#~ "XML does not suit all users so there are some alternative ways to define " +#~ "O/R mapping metadata in Hibernate." +#~ msgstr "" +#~ "XML 并不适用于所有人, 因此有其他定义 Hibernate O/R 映射元数据(metadata)" +#~ "的方法。 " + +#~ msgid "Using XDoclet markup" +#~ msgstr "使用 XDoclet 标记" + +#~ msgid "" +#~ "Many Hibernate users prefer to embed mapping information directly in " +#~ "sourcecode using XDoclet @hibernate.tags. We do not " +#~ "cover this approach in this reference guide since it is considered part " +#~ "of XDoclet. However, we include the following example of the " +#~ "Cat class with XDoclet mappings:" +#~ msgstr "" +#~ "很多 Hibernate 使用者更喜欢使用 XDoclet@hibernate.tags " +#~ "将映射信息直接嵌入到源代码中。我们不会在本文档中涉及这个方法,因为严格说" +#~ "来,这属于 XDoclet 的一部分。然而,我们包含了如下使用 XDoclet 映射的 " +#~ "Cat 类的例子。 " + +#~ msgid "" +#~ "See the Hibernate website for more examples of XDoclet and Hibernate." +#~ msgstr "参考 Hibernate 网站更多的 Xdoclet 和 Hibernate 的例子。" + +#~ msgid "Using JDK 5.0 Annotations" +#~ msgstr "使用 JDK 5.0 的注解(Annotation)" + +#~ msgid "" +#~ "JDK 5.0 introduced XDoclet-style annotations at the language level that " +#~ "are type-safe and checked at compile time. This mechanism is more " +#~ "powerful than XDoclet annotations and better supported by tools and IDEs. " +#~ "IntelliJ IDEA, for example, supports auto-completion and syntax " +#~ "highlighting of JDK 5.0 annotations. The new revision of the EJB " +#~ "specification (JSR-220) uses JDK 5.0 annotations as the primary metadata " +#~ "mechanism for entity beans. Hibernate3 implements the " +#~ "EntityManager of JSR-220 (the persistence API). " +#~ "Support for mapping metadata is available via the Hibernate " +#~ "Annotations package as a separate download. Both EJB3 (JSR-" +#~ "220) and Hibernate3 metadata is supported." +#~ msgstr "" +#~ "JDK 5.0 在语言级别引入了 XDoclet 风格的标注,并且是类型安全的,在编译期进" +#~ "行检查。这一机制比 XDoclet 的注解更为强大,有更好的工具和 IDE 支持。例如," +#~ "IntelliJ IDEA,支持 JDK 5.0 注解的自动完成和语法高亮 。EJB 规范的新修订版 " +#~ "(JSR-220) 使用 JDK 5.0 的注解作为entity beans的主要元数据(metadata)机" +#~ "制。Hibernate 3 实现了JSR-220(the persistence API) 的 " +#~ "EntityManager,支持通过 Hibernate " +#~ "Annotations 包定义映射元数据。这个包作为单独的部分下载,支持 " +#~ "EJB3(JSR-220) 和 Hibernate3 的元数据。 " + +#~ msgid "This is an example of a POJO class annotated as an EJB entity bean:" +#~ msgstr "这是一个被注解为 EJB entity bean 的 POJO 类的例子" + +#~ msgid "" +#~ "Support for JDK 5.0 Annotations (and JSR-220) is currently under " +#~ "development. Please refer to the Hibernate Annotations module for more " +#~ "details." +#~ msgstr "" +#~ "注意:对 JDK 5.0 注解(和 JSR-220)支持的工作仍然在进行中,并未完成。更多细" +#~ "节请参阅 Hibernate Annotations 模块。 " #~ msgid "" #~ "\n" @@ -2126,271 +9468,6 @@ msgstr "还有,这些数据库对象可以特别指定为仅在特定的方言 #~ " &types;\n" #~ "]]>" -#~ msgid "" -#~ "]]>" -#~ msgstr "" -#~ "]]>" - -#~ msgid "" -#~ "]]>" -#~ msgstr "" -#~ "]]>" - -#~ msgid "" -#~ "\n" -#~ " \n" -#~ " select item.name, max(bid.amount), count(*)\n" -#~ " from item\n" -#~ " join bid on bid.item_id = item.id\n" -#~ " group by item.name\n" -#~ " \n" -#~ " \n" -#~ " \n" -#~ " \n" -#~ " ...\n" -#~ "]]>" -#~ msgstr "" -#~ "\n" -#~ " \n" -#~ " select item.name, max(bid.amount), count(*)\n" -#~ " from item\n" -#~ " join bid on bid.item_id = item.id\n" -#~ " group by item.name\n" -#~ " \n" -#~ " \n" -#~ " \n" -#~ " \n" -#~ " ...\n" -#~ "]]>" - -#~ msgid "" -#~ "\n" -#~ " node=\"element-name|@attribute-name|element/@attribute|.\"\n" -#~ "\n" -#~ " \n" -#~ "]]>" -#~ msgstr "" -#~ "\n" -#~ " node=\"element-name|@attribute-name|element/@attribute|.\"\n" -#~ "\n" -#~ " \n" -#~ "]]>" - -#~ msgid "" -#~ "\n" -#~ " \n" -#~ " uid_table\n" -#~ " next_hi_value_column\n" -#~ " \n" -#~ "]]>" -#~ msgstr "" -#~ "\n" -#~ " \n" -#~ " uid_table\n" -#~ " next_hi_value_column\n" -#~ " \n" -#~ "]]>" - -#~ msgid "increment" -#~ msgstr "increment" - -#~ msgid "identity" -#~ msgstr "identity" - -#~ msgid "sequence" -#~ msgstr "sequence" - -#~ msgid "hilo" -#~ msgstr "hilo" - -#~ msgid "seqhilo" -#~ msgstr "seqhilo" - -#~ msgid "guid" -#~ msgstr "guid" - -#~ msgid "native" -#~ msgstr "native" - -#~ msgid "assigned" -#~ msgstr "assigned" - -#~ msgid "select" -#~ msgstr "select" - -#~ msgid "foreign" -#~ msgstr "foreign" - -#~ msgid "" -#~ "\n" -#~ " \n" -#~ " hi_value\n" -#~ " next_value\n" -#~ " 100\n" -#~ " \n" -#~ "]]>" -#~ msgstr "" -#~ "\n" -#~ " \n" -#~ " hi_value\n" -#~ " next_value\n" -#~ " 100\n" -#~ " \n" -#~ "]]>" - -#~ msgid "" -#~ "\n" -#~ " \n" -#~ " hi_value\n" -#~ " 100\n" -#~ " \n" -#~ "]]>" -#~ msgstr "" -#~ "\n" -#~ " \n" -#~ " hi_value\n" -#~ " 100\n" -#~ " \n" -#~ "]]>" - -#~ msgid "" -#~ "\n" -#~ " \n" -#~ " person_id_sequence\n" -#~ " \n" -#~ "]]>" -#~ msgstr "" -#~ "\n" -#~ " \n" -#~ " person_id_sequence\n" -#~ " \n" -#~ "]]>" - -#~ msgid "" -#~ "\n" -#~ " \n" -#~ "]]>" -#~ msgstr "" -#~ "\n" -#~ " \n" -#~ "]]>" - -#~ msgid "" -#~ "\n" -#~ " \n" -#~ " socialSecurityNumber\n" -#~ " \n" -#~ "]]>" -#~ msgstr "" -#~ "\n" -#~ " \n" -#~ " socialSecurityNumber\n" -#~ " \n" -#~ "]]>" - -#~ msgid "" -#~ "\n" -#~ " node=\"element-name|.\"\n" -#~ "\n" -#~ " \n" -#~ " \n" -#~ " ......\n" -#~ "]]>" -#~ msgstr "" -#~ "\n" -#~ " node=\"element-name|.\"\n" -#~ "\n" -#~ " \n" -#~ " \n" -#~ " ......\n" -#~ "]]>" - #~ msgid "" #~ "\n" #~ " \n" @@ -2413,292 +9490,6 @@ msgstr "还有,这些数据库对象可以特别指定为仅在特定的方言 #~ " \n" #~ "]]>" -#~ msgid "" -#~ "]]>" -#~ msgstr "" -#~ "]]>" - -#~ msgid "" -#~ "]]>" -#~ msgstr "" -#~ "]]>" - -#~ msgid "" -#~ "]]>" -#~ msgstr "" -#~ "]]>" - -#~ msgid "" -#~ "]]>" -#~ msgstr "" -#~ "]]>" - -#~ msgid "" -#~ "]]>" -#~ msgstr "" -#~ "]]>" - -#, fuzzy -#~ msgid "" -#~ "]]>" -#~ msgstr "" -#~ "<property name=\"totalPrice\"\n" -#~ " formula=\"( SELECT SUM (li.quantity*p.price) FROM LineItem li, " -#~ "Product p\n" -#~ " WHERE li.productId = p.productId\n" -#~ " AND li.customerId = customerId\n" -#~ " AND li.orderNumber = orderNumber )\"/>" - -#, fuzzy -#~ msgid "" -#~ "]]>" -#~ msgstr "" -#~ "<many-to-one\n" -#~ " name=\"propertyName\"\n" -#~ " column=\"column_name\"\n" -#~ " class=\"ClassName\"\n" -#~ " cascade=\"cascade_style\"\n" -#~ " fetch=\"join|select\"\n" -#~ " update=\"true|false\"\n" -#~ " insert=\"true|false\"\n" -#~ " property-ref=\"propertyNameFromAssociatedClass\"\n" -#~ " access=\"field|property|ClassName\"\n" -#~ " unique=\"true|false\"\n" -#~ " not-null=\"true|false\"\n" -#~ " optimistic-lock=\"true|false\"\n" -#~ " lazy=\"proxy|no-proxy|false\"\n" -#~ " not-found=\"ignore|exception\"\n" -#~ " entity-name=\"EntityName\"\n" -#~ " formula=\"arbitrary SQL expression\"\n" -#~ " node=\"element-name|@attribute-name|element/@attribute|.\"\n" -#~ " embed-xml=\"true|false\"\n" -#~ " index=\"index_name\"\n" -#~ " unique_key=\"unique_key_id\"\n" -#~ " foreign-key=\"foreign_key_name\"\n" -#~ "/>" - -#, fuzzy -#~ msgid "" -#~ "]]>" -#~ msgstr "" -#~ "<many-to-one name=\"product\" class=\"Product\" column=\"PRODUCT_ID\"/" -#~ ">" - -#, fuzzy -#~ msgid "" -#~ "]]>" -#~ msgstr "" -#~ "<property name=\"serialNumber\" unique=\"true\" type=\"string\" column=" -#~ "\"SERIAL_NUMBER\"/>" - -#, fuzzy -#~ msgid "" -#~ "]]>" -#~ msgstr "" -#~ "<many-to-one name=\"product\" property-ref=\"serialNumber\" column=" -#~ "\"PRODUCT_SERIAL_NUMBER\"/>" - -#, fuzzy -#~ msgid "" -#~ "]]>" -#~ msgstr "" -#~ "<many-to-one name=\"owner\" property-ref=\"identity.ssn\" column=" -#~ "\"OWNER_SSN\"/>" - -#, fuzzy -#~ msgid "" -#~ "]]>" -#~ msgstr "" -#~ "<one-to-one\n" -#~ " name=\"propertyName\"\n" -#~ " class=\"ClassName\"\n" -#~ " cascade=\"cascade_style\"\n" -#~ " constrained=\"true|false\"\n" -#~ " fetch=\"join|select\"\n" -#~ " property-ref=\"propertyNameFromAssociatedClass\"\n" -#~ " access=\"field|property|ClassName\"\n" -#~ " formula=\"any SQL expression\"\n" -#~ " lazy=\"proxy|no-proxy|false\"\n" -#~ " entity-name=\"EntityName\"\n" -#~ " node=\"element-name|@attribute-name|element/@attribute|.\"\n" -#~ " embed-xml=\"true|false\"\n" -#~ " foreign-key=\"foreign_key_name\"\n" -#~ "/>" - -#, fuzzy -#~ msgid "]]>" -#~ msgstr "<one-to-one name=\"person\" class=\"Person\"/>" - -#, fuzzy -#~ msgid "" -#~ "]]>" -#~ msgstr "" -#~ "<one-to-one name=\"employee\" class=\"Employee\" constrained=\"true\"/" -#~ ">" - -#, fuzzy -#~ msgid "" -#~ "\n" -#~ " \n" -#~ " \n" -#~ " employee\n" -#~ " \n" -#~ " \n" -#~ " ...\n" -#~ " \n" -#~ "]]>" -#~ msgstr "" -#~ "<class name=\"person\" table=\"PERSON\">\n" -#~ " <id name=\"id\" column=\"PERSON_ID\">\n" -#~ " <generator class=\"foreign\">\n" -#~ " <param name=\"property\">employee</param>\n" -#~ " </generator>\n" -#~ " </id>\n" -#~ " ...\n" -#~ " <one-to-one name=\"employee\"\n" -#~ " class=\"Employee\"\n" -#~ " constrained=\"true\"/>\n" -#~ "</class>" - #, fuzzy #~ msgid "" #~ "\n" -#~ " \n" -#~ " \n" -#~ " ......\n" -#~ "]]>" -#~ msgstr "" -#~ "<natural-id mutable=\"true|false\"/>\n" -#~ " <property ... />\n" -#~ " <many-to-one ... />\n" -#~ " ......\n" -#~ "</natural-id>" - -#, fuzzy -#~ msgid "" -#~ "\n" -#~ "\n" -#~ " \n" -#~ " \n" -#~ " ........\n" -#~ "]]>" -#~ msgstr "" -#~ "<component \n" -#~ " name=\"propertyName\" \n" -#~ " class=\"className\"\n" -#~ " insert=\"true|false\"\n" -#~ " update=\"true|false\"\n" -#~ " access=\"field|property|ClassName\"\n" -#~ " lazy=\"true|false\"\n" -#~ " optimistic-lock=\"true|false\"\n" -#~ " unique=\"true|false\"\n" -#~ " node=\"element-name|.\"\n" -#~ ">\n" -#~ " \n" -#~ " <property ...../>\n" -#~ " <many-to-one .... />\n" -#~ " ........\n" -#~ "</component>" - -#, fuzzy -#~ msgid "" -#~ "\n" -#~ "\n" -#~ " \n" -#~ " \n" -#~ " ........\n" -#~ "]]>" -#~ msgstr "" -#~ "<properties \n" -#~ " name=\"logicalName\" \n" -#~ " insert=\"true|false\"\n" -#~ " update=\"true|false\"\n" -#~ " optimistic-lock=\"true|false\"\n" -#~ " unique=\"true|false\"\n" -#~ ">\n" -#~ " \n" -#~ " <property ...../>\n" -#~ " <many-to-one .... />\n" -#~ " ........\n" -#~ "</properties>" - -#, fuzzy -#~ msgid "" -#~ "\n" -#~ " \n" -#~ "\n" -#~ " ...\n" -#~ " \n" -#~ " \n" -#~ " \n" -#~ " \n" -#~ " \n" -#~ "]]>" -#~ msgstr "" -#~ "<class name=\"Person\">\n" -#~ " <id name=\"personNumber\"/>\n" -#~ " ...\n" -#~ " <properties name=\"name\" \n" -#~ " unique=\"true\" update=\"false\">\n" -#~ " <property name=\"firstName\"/>\n" -#~ " <property name=\"initial\"/>\n" -#~ " <property name=\"lastName\"/>\n" -#~ " </properties>\n" -#~ "</class>" - -#, fuzzy -#~ msgid "" -#~ "\n" -#~ " \n" -#~ " \n" -#~ " \n" -#~ "]]>" -#~ msgstr "" -#~ "<many-to-one name=\"person\" \n" -#~ " class=\"Person\" property-ref=\"name\">\n" -#~ " <column name=\"firstName\"/>\n" -#~ " <column name=\"initial\"/>\n" -#~ " <column name=\"lastName\"/>\n" -#~ "</many-to-one>" - -#, fuzzy -#~ msgid "" -#~ "\n" -#~ "\n" -#~ " \n" -#~ " .....\n" -#~ "]]>" -#~ msgstr "" -#~ "<subclass\n" -#~ " name=\"ClassName\"\n" -#~ " discriminator-value=\"discriminator_value\"\n" -#~ " proxy=\"ProxyInterface\"\n" -#~ " lazy=\"true|false\"\n" -#~ " dynamic-update=\"true|false\"\n" -#~ " dynamic-insert=\"true|false\"\n" -#~ " entity-name=\"EntityName\"\n" -#~ " node=\"element-name\"\n" -#~ " extends=\"SuperclassName\">\n" -#~ "\n" -#~ " <property .... />\n" -#~ " .....\n" -#~ "</subclass>" - -#, fuzzy -#~ msgid "" -#~ "\n" -#~ "\n" -#~ " \n" -#~ "\n" -#~ " \n" -#~ " .....\n" -#~ "]]>" -#~ msgstr "" -#~ "<joined-subclass\n" -#~ " name=\"ClassName\"\n" -#~ " table=\"tablename\"\n" -#~ " proxy=\"ProxyInterface\"\n" -#~ " lazy=\"true|false\"\n" -#~ " dynamic-update=\"true|false\"\n" -#~ " dynamic-insert=\"true|false\"\n" -#~ " schema=\"schema\"\n" -#~ " catalog=\"catalog\"\n" -#~ " extends=\"SuperclassName\"\n" -#~ " persister=\"ClassName\"\n" -#~ " subselect=\"SQL expression\"\n" -#~ " entity-name=\"EntityName\"\n" -#~ " node=\"element-name\">\n" -#~ "\n" -#~ " <key .... >\n" -#~ "\n" -#~ " <property .... />\n" -#~ " .....\n" -#~ "</joined-subclass>" - -#, fuzzy -#~ msgid "" -#~ "\n" -#~ "\n" -#~ "\n" -#~ "\n" -#~ "\n" -#~ " \n" -#~ " \n" -#~ " \n" -#~ " \n" -#~ " \n" -#~ " \n" -#~ " \n" -#~ " \n" -#~ " \n" -#~ " \n" -#~ " \n" -#~ " \n" -#~ " \n" -#~ " \n" -#~ " \n" -#~ " \n" -#~ " \n" -#~ " \n" -#~ "\n" -#~ " \n" -#~ " \n" -#~ " \n" -#~ "\n" -#~ "]]>" -#~ msgstr "" -#~ "<?xml version=\"1.0\"?>\n" -#~ "<!DOCTYPE hibernate-mapping PUBLIC\n" -#~ " \"-//Hibernate/Hibernate Mapping DTD//EN\"\n" -#~ " \"http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd" -#~ "\">\n" -#~ "\n" -#~ "<hibernate-mapping package=\"eg\">\n" -#~ "\n" -#~ " <class name=\"Cat\" table=\"CATS\">\n" -#~ " <id name=\"id\" column=\"uid\" type=\"long\">\n" -#~ " <generator class=\"hilo\"/>\n" -#~ " </id>\n" -#~ " <property name=\"birthdate\" type=\"date\"/>\n" -#~ " <property name=\"color\" not-null=\"true\"/>\n" -#~ " <property name=\"sex\" not-null=\"true\"/>\n" -#~ " <property name=\"weight\"/>\n" -#~ " <many-to-one name=\"mate\"/>\n" -#~ " <set name=\"kittens\">\n" -#~ " <key column=\"MOTHER\"/>\n" -#~ " <one-to-many class=\"Cat\"/>\n" -#~ " </set>\n" -#~ " <joined-subclass name=\"DomesticCat\" table=" -#~ "\"DOMESTIC_CATS\">\n" -#~ " <key column=\"CAT\"/>\n" -#~ " <property name=\"name\" type=\"string\"/>\n" -#~ " </joined-subclass>\n" -#~ " </class>\n" -#~ "\n" -#~ " <class name=\"eg.Dog\">\n" -#~ " <!-- mapping for Dog could go here -->\n" -#~ " </class>\n" -#~ "\n" -#~ "</hibernate-mapping>" - -#, fuzzy -#~ msgid "" -#~ "\n" -#~ "\n" -#~ " \n" -#~ " .....\n" -#~ "]]>" -#~ msgstr "" -#~ "<union-subclass\n" -#~ " name=\"ClassName\"\n" -#~ " table=\"tablename\"\n" -#~ " proxy=\"ProxyInterface\"\n" -#~ " lazy=\"true|false\"\n" -#~ " dynamic-update=\"true|false\"\n" -#~ " dynamic-insert=\"true|false\"\n" -#~ " schema=\"schema\"\n" -#~ " catalog=\"catalog\"\n" -#~ " extends=\"SuperclassName\"\n" -#~ " abstract=\"true|false\"\n" -#~ " persister=\"ClassName\"\n" -#~ " subselect=\"SQL expression\"\n" -#~ " entity-name=\"EntityName\"\n" -#~ " node=\"element-name\">\n" -#~ "\n" -#~ " <property .... />\n" -#~ " .....\n" -#~ "</union-subclass>" - -#, fuzzy -#~ msgid "" -#~ "\n" -#~ "\n" -#~ " \n" -#~ "\n" -#~ " \n" -#~ " ...\n" -#~ "]]>" -#~ msgstr "" -#~ "<join\n" -#~ " table=\"tablename\"\n" -#~ " schema=\"owner\"\n" -#~ " catalog=\"catalog\"\n" -#~ " fetch=\"join|select\"\n" -#~ " inverse=\"true|false\"\n" -#~ " optional=\"true|false\">\n" -#~ " \n" -#~ " <key ... />\n" -#~ " \n" -#~ " <property ... />\n" -#~ " ...\n" -#~ "</join>" - -#, fuzzy -#~ msgid "" -#~ "\n" -#~ "\n" -#~ " ...\n" -#~ "\n" -#~ " \n" -#~ " \n" -#~ " \n" -#~ " \n" -#~ " \n" -#~ " \n" -#~ " ...]]>" -#~ msgstr "" -#~ "<class name=\"Person\"\n" -#~ " table=\"PERSON\">\n" -#~ "\n" -#~ " <id name=\"id\" column=\"PERSON_ID\">...</id>\n" -#~ "\n" -#~ " <join table=\"ADDRESS\">\n" -#~ " <key column=\"ADDRESS_ID\"/>\n" -#~ " <property name=\"address\"/>\n" -#~ " <property name=\"zip\"/>\n" -#~ " <property name=\"country\"/>\n" -#~ " </join>\n" -#~ " ..." - -#, fuzzy -#~ msgid "Key" -#~ msgstr "键(key)" - -#, fuzzy -#~ msgid "" -#~ "]]>" -#~ msgstr "" -#~ "<key\n" -#~ " column=\"columnname\"\n" -#~ " on-delete=\"noaction|cascade\"\n" -#~ " property-ref=\"propertyName\"\n" -#~ " not-null=\"true|false\"\n" -#~ " update=\"true|false\"\n" -#~ " unique=\"true|false\"\n" -#~ "/>" - -#, fuzzy -#~ msgid "" -#~ "]]>" -#~ msgstr "" -#~ "<column\n" -#~ " name=\"column_name\"\n" -#~ " length=\"N\"\n" -#~ " precision=\"N\"\n" -#~ " scale=\"N\"\n" -#~ " not-null=\"true|false\"\n" -#~ " unique=\"true|false\"\n" -#~ " unique-key=\"multicolumn_unique_key_name\"\n" -#~ " index=\"index_name\"\n" -#~ " sql-type=\"sql_type_name\"\n" -#~ " check=\"SQL expression\"\n" -#~ " default=\"SQL expression\"/>" - -#, fuzzy -#~ msgid "SQL expression]]>" -#~ msgstr "<formula>SQL expression</formula>" - -#, fuzzy -#~ msgid "" -#~ "\n" -#~ " \n" -#~ " 'MAILING'\n" -#~ "]]>" -#~ msgstr "" -#~ "<many-to-one name=\"homeAddress\" class=\"Address\"\n" -#~ " insert=\"false\" update=\"false\">\n" -#~ " <column name=\"person_id\" not-null=\"true\" length=\"10\"/>\n" -#~ " <formula>'MAILING'</formula>\n" -#~ "</many-to-one>" - -#, fuzzy -#~ msgid "]]>" -#~ msgstr "<import class=\"java.lang.Object\" rename=\"Universe\"/>" - -#, fuzzy -#~ msgid "" -#~ "]]>" -#~ msgstr "" -#~ "<import\n" -#~ " class=\"ClassName\"\n" -#~ " rename=\"ShortName\"\n" -#~ "/>" - -#, fuzzy -#~ msgid "Any" -#~ msgstr "any" - -#, fuzzy -#~ msgid "" -#~ "\n" -#~ " \n" -#~ " \n" -#~ " \n" -#~ " \n" -#~ " \n" -#~ "]]>" -#~ msgstr "" -#~ "<any name=\"being\" id-type=\"long\" meta-type=\"string\">\n" -#~ " <meta-value value=\"TBL_ANIMAL\" class=\"Animal\"/>\n" -#~ " <meta-value value=\"TBL_HUMAN\" class=\"Human\"/>\n" -#~ " <meta-value value=\"TBL_ALIEN\" class=\"Alien\"/>\n" -#~ " <column name=\"table_name\"/>\n" -#~ " <column name=\"id\"/>\n" -#~ "</any>" - -#, fuzzy -#~ msgid "" -#~ "\n" -#~ " \n" -#~ " \n" -#~ " .....\n" -#~ " \n" -#~ " \n" -#~ " .....\n" -#~ "]]>" -#~ msgstr "" -#~ "<any\n" -#~ " name=\"propertyName\"\n" -#~ " id-type=\"idtypename\"\n" -#~ " meta-type=\"metatypename\"\n" -#~ " cascade=\"cascade_style\"\n" -#~ " access=\"field|property|ClassName\"\n" -#~ " optimistic-lock=\"true|false\"\n" -#~ ">\n" -#~ " <meta-value ... />\n" -#~ " <meta-value ... />\n" -#~ " .....\n" -#~ " <column .... />\n" -#~ " <column .... />\n" -#~ " .....\n" -#~ "</any>" - -#~ msgid "string" -#~ msgstr "string" - -#, fuzzy -#~ msgid "class" -#~ msgstr "子类(subclass)" - -#~ msgid "binary" -#~ msgstr "binary" - -#~ msgid "text" -#~ msgstr "text" - -#~ msgid "serializable" -#~ msgstr "serializable" - -#~ msgid "clob, blob" -#~ msgstr "clob, blob" - -#, fuzzy -#~ msgid "" -#~ "\n" -#~ " \n" -#~ " \n" -#~ "]]>" -#~ msgstr "" -#~ "<property name=\"twoStrings\" type=\"org.hibernate.test." -#~ "DoubleStringType\">\n" -#~ " <column name=\"first_string\"/>\n" -#~ " <column name=\"second_string\"/>\n" -#~ "</property>" - -#, fuzzy -#~ msgid "" -#~ "\n" -#~ " \n" -#~ " 0\n" -#~ " \n" -#~ "]]>" -#~ msgstr "" -#~ "<property name=\"priority\">\n" -#~ " <type name=\"com.mycompany.usertypes.DefaultValueIntegerType" -#~ "\">\n" -#~ " <param name=\"default\">0</param>\n" -#~ " </type>\n" -#~ "</property>" - -#, fuzzy -#~ msgid "" -#~ "\n" -#~ " 0\n" -#~ "]]>" -#~ msgstr "" -#~ "<typedef class=\"com.mycompany.usertypes.DefaultValueIntegerType\" " -#~ "name=\"default_zero\">\n" -#~ " <param name=\"default\">0</param>\n" -#~ "</typedef>" - -#, fuzzy -#~ msgid "]]>" -#~ msgstr "<property name=\"priority\" type=\"default_zero\"/>" - -#, fuzzy -#~ msgid "" -#~ "\n" -#~ " ...\n" -#~ " \n" -#~ " \n" -#~ " \n" -#~ " \n" -#~ "\n" -#~ "\n" -#~ "\n" -#~ " ...\n" -#~ " \n" -#~ "]]>" -#~ msgstr "" -#~ "<class name=\"Contract\" table=\"Contracts\" \n" -#~ " entity-name=\"CurrentContract\">\n" -#~ " ...\n" -#~ " <set name=\"history\" inverse=\"true\" \n" -#~ " order-by=\"effectiveEndDate desc\">\n" -#~ " <key column=\"currentContractId\"/>\n" -#~ " <one-to-many entity-name=\"HistoricalContract\"/>\n" -#~ " </set>\n" -#~ "</class>\n" -#~ "\n" -#~ "<class name=\"Contract\" table=\"ContractHistory\" \n" -#~ " entity-name=\"HistoricalContract\">\n" -#~ " ...\n" -#~ " <many-to-one name=\"currentContract\" \n" -#~ " column=\"currentContractId\" \n" -#~ " entity-name=\"CurrentContract\"/>\n" -#~ "</class>" - -#, fuzzy -#~ msgid "" -#~ "\n" -#~ " \n" -#~ " \n" -#~ " ...\n" -#~ "]]>" -#~ msgstr "" -#~ "<class name=\"LineItem\" table=\"`Line Item`\">\n" -#~ " <id name=\"id\" column=\"`Item Id`\"/><generator class=" -#~ "\"assigned\"/></id>\n" -#~ " <property name=\"itemNumber\" column=\"`Item #`\"/>\n" -#~ " ...\n" -#~ "</class>" - #, fuzzy #~ msgid "" #~ "\n" -#~ " ...\n" -#~ " \n" -#~ " CREATE TRIGGER my_trigger ...\n" -#~ " DROP TRIGGER my_trigger\n" -#~ " \n" -#~ "]]>" -#~ msgstr "" -#~ "<hibernate-mapping>\n" -#~ " ...\n" -#~ " <database-object>\n" -#~ " <create>CREATE TRIGGER my_trigger ...</create>\n" -#~ " <drop>DROP TRIGGER my_trigger</drop>\n" -#~ " </database-object>\n" -#~ "</hibernate-mapping>" - -#, fuzzy -#~ msgid "" -#~ "\n" -#~ " ...\n" -#~ " \n" -#~ " \n" -#~ " \n" -#~ "]]>" -#~ msgstr "" -#~ "<hibernate-mapping>\n" -#~ " ...\n" -#~ " <database-object>\n" -#~ " <definition class=\"MyTriggerDefinition\"/>\n" -#~ " </database-object>\n" -#~ "</hibernate-mapping>" - -#, fuzzy -#~ msgid "" -#~ "\n" -#~ " ...\n" -#~ " \n" -#~ " \n" -#~ " \n" -#~ " \n" -#~ " \n" -#~ "]]>" -#~ msgstr "" -#~ "<hibernate-mapping>\n" -#~ " ...\n" -#~ " <database-object>\n" -#~ " <definition class=\"MyTriggerDefinition\"/>\n" -#~ " <dialect-scope name=\"org.hibernate.dialect.Oracle9Dialect\"/" -#~ ">\n" -#~ " <dialect-scope name=\"org.hibernate.dialect.OracleDialect\"/" -#~ ">\n" -#~ " </database-object>\n" -#~ "</hibernate-mapping>" diff --git a/documentation/manual/src/main/docbook/zh-CN/content/collection_mapping.po b/documentation/manual/src/main/docbook/zh-CN/content/collection_mapping.po index bfb0305497..f4695e3af1 100644 --- a/documentation/manual/src/main/docbook/zh-CN/content/collection_mapping.po +++ b/documentation/manual/src/main/docbook/zh-CN/content/collection_mapping.po @@ -5,7 +5,7 @@ msgid "" msgstr "" "Project-Id-Version: Collection_Mapping\n" "Report-Msgid-Bugs-To: http://bugs.kde.org\n" -"POT-Creation-Date: 2010-02-10T07:25:34\n" +"POT-Creation-Date: 2010-07-20 21:02+0000\n" "PO-Revision-Date: 2010-03-15 08:59+1000\n" "Last-Translator: Xi HUANG \n" "Language-Team: \n" @@ -15,732 +15,3256 @@ msgstr "" "X-Generator: KBabel 1.11.4\n" #. Tag: title +#: collection_mapping.xml:31 #, no-c-format msgid "Collection mapping" msgstr "集合映射(Collection mappings)" #. Tag: title +#: collection_mapping.xml:34 #, no-c-format msgid "Persistent collections" msgstr "持久化集合类(Persistent collections)" #. Tag: para -#, no-c-format -msgid "Hibernate requires that persistent collection-valued fields be declared as an interface type. For example:" -msgstr "(译者注:在阅读本章的时候,以后整个手册的阅读过程中,我们都会面临一个名词方面的问题,那就是“集合”。\"Collections\" 和 \"Set\" 在中文里对应都被翻译为“集合”,但是他们的含义很不一样。Collections 是一个超集,Set 是其中的一种。大部分情况下,本译稿中泛指的未加英文注明的“集合”,都应当理解为“Collections”。在有些二者同时出现,可能造成混淆的地方,我们用“集合类”来特指“Collecions”,“集合(Set)”来指 \"Set\",一般都会在后面的括号中给出英文。希望大家在阅读时联系上下文理解,不要造成误解。 与此同时,“元素”一词对应的英文“element”,也有两个不同的含义。其一为集合的元素,是内存中的一个变量;另一含义则是 XML 文档中的一个标签所代表的元素。也请注意区别。本章中,特别是后半部分是需要反复阅读才能理解清楚的。如果遇到任何疑问,请记住,英文版本的 reference 是惟一标准的参考资料。) Hibernate 要求持久化集合值字段必须声明为接口,例如:" +#: collection_mapping.xml:36 +#, fuzzy, no-c-format +msgid "" +"Naturally Hibernate also allows to persist collections. These persistent " +"collections can contain almost any other Hibernate type, including: basic " +"types, custom types, components and references to other entities. The " +"distinction between value and reference semantics is in this context very " +"important. An object in a collection might be handled with \"value\" " +"semantics (its life cycle fully depends on the collection owner), or it " +"might be a reference to another entity with its own life cycle. In the " +"latter case, only the \"link\" between the two objects is considered to be a " +"state held by the collection." +msgstr "" +"集合几乎可以包含任何其他的 Hibernate 类型,包括所有的基本类型、自定义类型、组" +"件,当然还有对其他实体的引用。存在一个重要的区别:位于集合中的对象可能是根" +"据“值”语义来操作(其声明周期完全依赖于集合持有者),或者它可能是指向另一个实" +"体的引用,具有其自己的生命周期。在后者的情况下,被作为集合持有的状态考虑的," +"只有两个对象之间的“连接”。 " #. Tag: para -#, no-c-format -msgid "The actual interface might be java.util.Set, java.util.Collection, java.util.List, java.util.Map, java.util.SortedSet, java.util.SortedMap or anything you like (\"anything you like\" means you will have to write an implementation of org.hibernate.usertype.UserCollectionType.)" -msgstr "实际的接口可能是 java.util.Setjava.util.Collectionjava.util.Listjava.util.Mapjava.util.SortedSetjava.util.SortedMap 或者任何你喜欢的类型(\"任何你喜欢的类型\" 代表你需要编写 org.hibernate.usertype.UserCollectionType 的实现)。" +#: collection_mapping.xml:46 +#, fuzzy, no-c-format +msgid "" +"As a requirement persistent collection-valued fields must be declared as an " +"interface type (see ). The actual interface might be java.util.Set, " +"java.util.Collection, java.util.List, " +"java.util.Map, java.util.SortedSet, " +"java.util.SortedMap or anything you like (\"anything you " +"like\" means you will have to write an implementation of org." +"hibernate.usertype.UserCollectionType)." +msgstr "" +"实际的接口可能是 java.util.Setjava.util." +"Collectionjava.util.Listjava.util." +"Mapjava.util.SortedSetjava.util." +"SortedMap 或者任何你喜欢的类型(\"任何你喜欢的类型\" 代表你需要编" +"写 org.hibernate.usertype.UserCollectionType 的实现)。" #. Tag: para -#, no-c-format -msgid "Notice how the instance variable was initialized with an instance of HashSet. This is the best way to initialize collection valued properties of newly instantiated (non-persistent) instances. When you make the instance persistent, by calling persist() for example, Hibernate will actually replace the HashSet with an instance of Hibernate's own implementation of Set. Be aware of the following errors:" -msgstr "注意我们是如何用一个 HashSet 实例来初始化实例变量的。这是用于初始化新创建(尚未持久化)的类实例中集合值属性的最佳方法。当你持久化这个实例时 — 比如通过调用 persist() — Hibernate 会自动把 HashSet 替换为 Hibernate 自己的 Set 实现。注意下面的错误:" - -#. Tag: para -#, no-c-format -msgid "The persistent collections injected by Hibernate behave like HashMap, HashSet, TreeMap, TreeSet or ArrayList, depending on the interface type." -msgstr "根据不同的接口类型,被 Hibernate 注射的持久化集合类的表现类似 HashMapHashSetTreeMapTreeSetArrayList。" - -#. Tag: para -#, no-c-format -msgid "Collections instances have the usual behavior of value types. They are automatically persisted when referenced by a persistent object and are automatically deleted when unreferenced. If a collection is passed from one persistent object to another, its elements might be moved from one table to another. Two entities cannot share a reference to the same collection instance. Due to the underlying relational model, collection-valued properties do not support null value semantics. Hibernate does not distinguish between a null collection reference and an empty collection." -msgstr "集合类实例具有值类型的通常行为。当被持久化对象引用后,他们会自动被持久化,当不再被引用后,自动被删除。假若实例被从一个持久化对象传递到另一个,它的元素可能从一个表转移到另一个表。两个实体不能共享同一个集合类实例的引用。因为底层关系数据库模型的原因,集合值属性无法支持空值语义;Hibernate 对空的集合引用和空集合不加区别。 " - -#. Tag: para -#, no-c-format -msgid "Use persistent collections the same way you use ordinary Java collections. However, please ensure you understand the semantics of bidirectional associations (these are discussed later)." -msgstr "你不需要过多的为此担心。就如同你平时使用普通的 Java 集合类一样来使用持久化集合类。只是要确认你理解了双向关联的语义(后文将进行讨论)。" +#: collection_mapping.xml:57 +#, fuzzy, no-c-format +msgid "" +"Notice how in the " +"instance variable parts was initialized with an instance " +"of HashSet. This is the best way to initialize collection " +"valued properties of newly instantiated (non-persistent) instances. When you " +"make the instance persistent, by calling persist(), " +"Hibernate will actually replace the HashSet with an " +"instance of Hibernate's own implementation of Set. Be " +"aware of the following error:" +msgstr "" +"注意我们是如何用一个 HashSet 实例来初始化实例变量的。这是" +"用于初始化新创建(尚未持久化)的类实例中集合值属性的最佳方法。当你持久化这个" +"实例时 — 比如通过调用 persist() — Hibernate 会自动把 " +"HashSet 替换为 Hibernate 自己的 Set 实" +"现。注意下面的错误:" #. Tag: title +#: collection_mapping.xml:68 #, no-c-format -msgid "Collection mappings" -msgstr "集合映射( Collection mappings )" +msgid "Hibernate uses its own collection implementations" +msgstr "" + +#. Tag: programlisting +#: collection_mapping.xml:70 +#, fuzzy, no-c-format +msgid "" +"Cat cat = new DomesticCat();\n" +"Cat kitten = new DomesticCat();\n" +"....\n" +"Set kittens = new HashSet();\n" +"kittens.add(kitten);\n" +"cat.setKittens(kittens);\n" +"session.persist(cat);\n" +"\n" +"kittens = cat.getKittens(); // Okay, kittens collection is a Set\n" +"(HashSet) cat.getKittens(); // Error!" +msgstr "" +"" #. Tag: para +#: collection_mapping.xml:73 #, no-c-format -msgid "There are quite a range of mappings that can be generated for collections that cover many common relational models. We suggest you experiment with the schema generation tool so that you understand how various mapping declarations translate to database tables." -msgstr "从集合类可以产生很大一部分映射,覆盖了很多常见的关系模型。我们建议你试验 schema 生成工具,来体会一下不同的映射声明是如何被翻译为数据库表的。 " +msgid "" +"The persistent collections injected by Hibernate behave like " +"HashMap, HashSet, TreeMap, TreeSet or ArrayList, " +"depending on the interface type." +msgstr "" +"根据不同的接口类型,被 Hibernate 注射的持久化集合类的表现类似 " +"HashMapHashSetTreeMapTreeSetArrayList。" #. Tag: para +#: collection_mapping.xml:78 #, no-c-format -msgid "The Hibernate mapping element used for mapping a collection depends upon the type of interface. For example, a <set> element is used for mapping properties of type Set." -msgstr "用于映射集合类的 Hibernate 映射元素取决于接口的类型。比如,<set> 元素用来映射 Set 类型的属性。 " +msgid "" +"Collections instances have the usual behavior of value types. They are " +"automatically persisted when referenced by a persistent object and are " +"automatically deleted when unreferenced. If a collection is passed from one " +"persistent object to another, its elements might be moved from one table to " +"another. Two entities cannot share a reference to the same collection " +"instance. Due to the underlying relational model, collection-valued " +"properties do not support null value semantics. Hibernate does not " +"distinguish between a null collection reference and an empty collection." +msgstr "" +"集合类实例具有值类型的通常行为。当被持久化对象引用后,他们会自动被持久化,当" +"不再被引用后,自动被删除。假若实例被从一个持久化对象传递到另一个,它的元素可" +"能从一个表转移到另一个表。两个实体不能共享同一个集合类实例的引用。因为底层关" +"系数据库模型的原因,集合值属性无法支持空值语义;Hibernate 对空的集合引用和空" +"集合不加区别。 " #. Tag: para -#, no-c-format -msgid "Apart from <set>, there is also <list>, <map>, <bag>, <array> and <primitive-array> mapping elements. The <map> element is representative:" -msgstr "除了 <set>,还有<list><map><bag><array><primitive-array> 映射元素。<map> 具有代表性:" - -#. Tag: para -#, no-c-format -msgid "name: the collection property name" -msgstr "name:集合属性的名称" - -#. Tag: para -#, no-c-format -msgid "table (optional - defaults to property name): the name of the collection table. It is not used for one-to-many associations." -msgstr "table(可选——默认为属性的名称)这个集合表的名称(不能在一对多的关联关系中使用)。" - -#. Tag: para -#, no-c-format -msgid "schema (optional): the name of a table schema to override the schema declared on the root element" -msgstr "schema(可选):表的 schema 的名称,他将覆盖在根元素中定义的 schema" - -#. Tag: para -#, no-c-format -msgid "lazy (optional - defaults to true): disables lazy fetching and specifies that the association is always eagerly fetched. It can also be used to enable \"extra-lazy\" fetching where most operations do not initialize the collection. This is suitable for large collections." -msgstr "lazy(可选--默认为 true)可以用来关闭延迟加载(false):指定一直使用预先抓取,或者打开 \"extra-lazy\" 抓取,此时大多数操作不会初始化集合类(适用于非常大的集合)。" - -#. Tag: para -#, no-c-format -msgid "inverse (optional - defaults to false): marks this collection as the \"inverse\" end of a bidirectional association." -msgstr "inverse(可选 — 默认为 false)标记这个集合作为双向关联关系中的方向一端。 " - -#. Tag: para -#, no-c-format -msgid "cascade (optional - defaults to none): enables operations to cascade to child entities." -msgstr "cascade(可选 — 默认为 none)让操作级联到子实体。" - -#. Tag: para -#, no-c-format -msgid "sort (optional): specifies a sorted collection with natural sort order or a given comparator class." -msgstr "sort(可选)指定集合的排序顺序,其可以为自然的(natural)或者给定一个用来比较的类。 " - -#. Tag: para -#, no-c-format -msgid "order-by (optional, JDK1.4 only): specifies a table column or columns that define the iteration order of the Map, Set or bag, together with an optional asc or desc." -msgstr "order-by(可选,仅用于 jdk1.4):指定表的字段(一个或几个)再加上 asc 或者 desc(可选),定义 Map、Set 和 Bag 的迭代顺序。" - -#. Tag: para -#, no-c-format -msgid "where (optional): specifies an arbitrary SQL WHERE condition that is used when retrieving or removing the collection. This is useful if the collection needs to contain only a subset of the available data." -msgstr "where(可选):指定任意的 SQL where 条件,该条件将在重新载入或者删除这个集合时使用(当集合中的数据仅仅是所有可用数据的一个子集时这个条件非常有用)。" - -#. Tag: para -#, no-c-format -msgid "fetch (optional, defaults to select): chooses between outer-join fetching, fetching by sequential select, and fetching by sequential subselect." -msgstr "fetch(可选,默认为 select):用于在外连接抓取、通过后续 select 抓取和通过后续 subselect 抓取之间选择。" - -#. Tag: para -#, no-c-format -msgid "batch-size (optional, defaults to 1): specifies a \"batch size\" for lazily fetching instances of this collection." -msgstr "batch-size(可选,默认为 1):指定通过延迟加载取得集合实例的批处理块大小(\"batch size\")。" - -#. Tag: para -#, no-c-format -msgid "access (optional - defaults to property): the strategy Hibernate uses for accessing the collection property value." -msgstr "access(可选-默认为属性 property):Hibernate 取得集合属性值时使用的策略。" - -#. Tag: para -#, no-c-format -msgid "optimistic-lock (optional - defaults to true): specifies that changes to the state of the collection results in increments of the owning entity's version. For one-to-many associations you may want to disable this setting." -msgstr "乐观锁(可选 - 默认为 true):对集合的状态的改变会是否导致其所属的实体的版本增长(对一对多关联来说,关闭这个属性常常是有理的)。" - -#. Tag: para -#, no-c-format -msgid "mutable (optional - defaults to true): a value of false specifies that the elements of the collection never change. This allows for minor performance optimization in some cases." -msgstr "mutable(可变)(可选 — 默认为 true):若值为 false,表明集合中的元素不会改变(在某些情况下可以进行一些小的性能优化)。 " +#: collection_mapping.xml:89 +#, fuzzy, no-c-format +msgid "" +"Use persistent collections the same way you use ordinary Java collections. " +"However, ensure you understand the semantics of bidirectional associations " +"(see )." +msgstr "" +"你不需要过多的为此担心。就如同你平时使用普通的 Java 集合类一样来使用持久化集" +"合类。只是要确认你理解了双向关联的语义(后文将进行讨论)。" #. Tag: title -#, no-c-format -msgid "Collection foreign keys" -msgstr "集合外键(Collection foreign keys)" +#: collection_mapping.xml:97 +#, fuzzy, no-c-format +msgid "How to map collections" +msgstr "有序集合(Sorted collections)" #. Tag: para +#: collection_mapping.xml:99 #, no-c-format -msgid "Collection instances are distinguished in the database by the foreign key of the entity that owns the collection. This foreign key is referred to as the collection key column, or columns, of the collection table. The collection key column is mapped by the <key> element." -msgstr "集合实例在数据库中依靠持有集合的实体的外键加以辨别。此外键作为集合关键字段(collection key column)(或多个字段)加以引用。集合关键字段通过 <key> 元素映射。 " - -#. Tag: para -#, no-c-format -msgid "There can be a nullability constraint on the foreign key column. For most collections, this is implied. For unidirectional one-to-many associations, the foreign key column is nullable by default, so you may need to specify not-null=\"true\"." -msgstr "在外键字段上可能具有非空约束。对于大多数集合来说,这是隐含的。对单向一对多关联来说,外键字段默认是可以为空的,因此你可能需要指明 not-null=\"true\"。 " - -#. Tag: para -#, no-c-format -msgid "The foreign key constraint can use ON DELETE CASCADE." -msgstr "外键约束可以使用 ON DELETE CASCADE。 " - -#. Tag: para -#, no-c-format -msgid "See the previous chapter for a full definition of the <key> element." -msgstr "对 <key> 元素的完整定义,请参阅前面的章节。" +msgid "" +"Using annotations you can map Collections, " +"Lists, Maps and " +"Sets of associated entities using @OneToMany and " +"@ManyToMany. For collections of a basic or embeddable type use " +"@ElementCollection. In the simplest case a collection mapping looks like " +"this:" +msgstr "" #. Tag: title +#: collection_mapping.xml:107 #, no-c-format -msgid "Collection elements" -msgstr "集合元素(Collection elements)" +msgid "Collection mapping using @OneToMany and @JoinColumn" +msgstr "" + +#. Tag: programlisting +#: collection_mapping.xml:109 +#, fuzzy, no-c-format +msgid "" +"@Entity\n" +"public class Product {\n" +"\n" +" private String serialNumber;\n" +" private Set<Part> parts = new HashSet<Part>();\n" +"\n" +" @Id\n" +" public String getSerialNumber() { return serialNumber; }\n" +" void setSerialNumber(String sn) { serialNumber = sn; }\n" +" \n" +" @OneToMany\n" +" @JoinColumn(name=\"PART_ID\")\n" +" public Set<Part> getParts() { return parts; }\n" +" void setParts(Set parts) { this.parts = parts; }\n" +"}\n" +"\n" +"\n" +"@Entity\n" +"public class Part {\n" +" ...\n" +"}" +msgstr "" +"" #. Tag: para +#: collection_mapping.xml:112 #, no-c-format -msgid "Collections can contain almost any other Hibernate type, including: basic types, custom types, components and references to other entities. This is an important distinction. An object in a collection might be handled with \"value\" semantics (its life cycle fully depends on the collection owner), or it might be a reference to another entity with its own life cycle. In the latter case, only the \"link\" between the two objects is considered to be a state held by the collection." -msgstr "集合几乎可以包含任何其他的 Hibernate 类型,包括所有的基本类型、自定义类型、组件,当然还有对其他实体的引用。存在一个重要的区别:位于集合中的对象可能是根据“值”语义来操作(其声明周期完全依赖于集合持有者),或者它可能是指向另一个实体的引用,具有其自己的生命周期。在后者的情况下,被作为集合持有的状态考虑的,只有两个对象之间的“连接”。 " - -#. Tag: para -#, no-c-format -msgid "The contained type is referred to as the collection element type. Collection elements are mapped by <element> or <composite-element>, or in the case of entity references, with <one-to-many> or <many-to-many>. The first two map elements with value semantics, the next two are used to map entity associations." -msgstr "被包容的类型被称为集合元素类型(collection element type)。集合元素通过 <element><composite-element> 映射,或在其是实体引用的时候,通过 <one-to-many><many-to-many> 映射。前两种用于使用值语义映射元素,后两种用于映射实体关联。" +msgid "" +"Product describes a unidirectional relationship with Part using the join " +"column PART_ID. In this unidirectional one to many scenario you can also use " +"a join table as seen in ." +msgstr "" #. Tag: title +#: collection_mapping.xml:118 #, no-c-format -msgid "Indexed collections" -msgstr "索引集合类(Indexed collections)" +msgid "Collection mapping using @OneToMany and @JoinTable" +msgstr "" + +#. Tag: programlisting +#: collection_mapping.xml:121 +#, no-c-format +msgid "" +"@Entity\n" +"public class Product {\n" +"\n" +" private String serialNumber;\n" +" private Set<Part> parts = new HashSet<Part>();\n" +"\n" +" @Id\n" +" public String getSerialNumber() { return serialNumber; }\n" +" void setSerialNumber(String sn) { serialNumber = sn; }\n" +" \n" +" @OneToMany\n" +" @JoinTable(\n" +" name=\"PRODUCT_PARTS\",\n" +" joinColumns = @JoinColumn( name=\"PRODUCT_ID\"),\n" +" inverseJoinColumns = @JoinColumn( name=\"PART_ID\")\n" +" )\n" +" public Set<Part> getParts() { return parts; }\n" +" void setParts(Set parts) { this.parts = parts; }\n" +"}\n" +"\n" +"\n" +"@Entity\n" +"public class Part {\n" +" ...\n" +"}" +msgstr "" #. Tag: para +#: collection_mapping.xml:124 #, no-c-format -msgid "All collection mappings, except those with set and bag semantics, need an index column in the collection table. An index column is a column that maps to an array index, or List index, or Map key. The index of a Map may be of any basic type, mapped with <map-key>. It can be an entity reference mapped with <map-key-many-to-many>, or it can be a composite type mapped with <composite-map-key>. The index of an array or list is always of type integer and is mapped using the <list-index> element. The mapped column contains sequential integers that are numbered from zero by default." -msgstr "所有的集合映射,除了 set 和 bag 语义的以外,都需要指定一个集合表的索引字段(index column) — 用于对应到数组索引,或者 List 的索引,或者 Map 的关键字。通过 <map-key>Map 的索引可以是任何基础类型;若通过 <map-key-many-to-many>,它也可以是一个实体引用;若通过 <composite-map-key>,它还可以是一个组合类型。数组或列表的索引必须是 integer 类型,并且使用 <list-index> 元素定义映射。被映射的字段包含有顺序排列的整数(默认从 0 开始)。 " +msgid "" +"Without describing any physical mapping (no @JoinColumn or @JoinTable), a unidirectional one to " +"many with join table is used. The table name is the concatenation of the " +"owner table name, _, and the other side table name. The foreign key name(s) " +"referencing the owner table is the concatenation of the owner table, _, and " +"the owner primary key column(s) name. The foreign key name(s) referencing " +"the other side is the concatenation of the owner property name, _, and the " +"other side primary key column(s) name. A unique constraint is added to the " +"foreign key referencing the other side table to reflect the one to many." +msgstr "" #. Tag: para -#, no-c-format -msgid "column_name (required): the name of the column holding the collection index values." -msgstr "column_name(必需):持有集合索引值的字段的名称。 " - -#. Tag: para -#, no-c-format -msgid "base (optional - defaults to 0): the value of the index column that corresponds to the first element of the list or array." -msgstr "base(可选 — 默认为 0)对应列表或队列的第一个元素的索引字段的值。" - -#. Tag: para -#, no-c-format -msgid "column (optional): the name of the column holding the collection index values." -msgstr "column(可选):持有集合索引值的字段的名称。" - -#. Tag: para -#, no-c-format -msgid "formula (optional): a SQL formula used to evaluate the key of the map." -msgstr "formula(可选):用于对表键求值的 SQL 公式。" - -#. Tag: para -#, no-c-format -msgid "type (required): the type of the map keys." -msgstr "type(必需):映射键的类型。 " - -#. Tag: para -#, no-c-format -msgid "column (optional): the name of the foreign key column for the collection index values." -msgstr "column(可选):用于集合索引值的外键字段的名称。" - -#. Tag: para -#, no-c-format -msgid "formula (optional): a SQ formula used to evaluate the foreign key of the map key." -msgstr "formula(可选):用于对映射键的外键求值的 SQL 公式。" - -#. Tag: para -#, no-c-format -msgid "class (required): the entity class used as the map key." -msgstr "class(必需):用作映射键的实体类的名称。 " - -#. Tag: para -#, no-c-format -msgid "If your table does not have an index column, and you still wish to use List as the property type, you can map the property as a Hibernate <bag>. A bag does not retain its order when it is retrieved from the database, but it can be optionally sorted or ordered." -msgstr "假若你的表没有一个索引字段,当你仍然希望使用 List 作为属性类型,你应该把此属性映射为 Hibernate <bag>。从数据库中获取的时候,bag 不维护其顺序,但也可选择性的进行排序。 " +#: collection_mapping.xml:135 +#, fuzzy, no-c-format +msgid "" +"Lets have a look now how collections are mapped using Hibernate mapping " +"files. In this case the first step is to chose the right mapping element. It " +"depends on the type of interface. For example, a <set> element is used for mapping properties of type Set." +msgstr "" +"用于映射集合类的 Hibernate 映射元素取决于接口的类型。比如,<" +"set> 元素用来映射 Set 类型的属性。 " #. Tag: title +#: collection_mapping.xml:142 #, no-c-format -msgid "Collections of values and many-to-many associations" -msgstr "值集合于多对多关联(Collections of values and many-to-many associations)" +msgid "Mapping a Set using <set>" +msgstr "" + +#. Tag: programlisting +#: collection_mapping.xml:144 +#, fuzzy, no-c-format +msgid "" +"<class name=\"Product\">\n" +" <id name=\"serialNumber\" column=\"productSerialNumber\"/>\n" +" <set name=\"parts\">\n" +" <key column=\"productSerialNumber\" not-null=\"true\"/>\n" +" <one-to-many class=\"Part\"/>\n" +" </set>\n" +"</class>" +msgstr "" +"\n" +" \n" +" \n" +" \n" +" \n" +" \n" +"]]>" #. Tag: para -#, no-c-format -msgid "Any collection of values or many-to-many associations requires a dedicated collection table with a foreign key column or columns, collection element column or columns, and possibly an index column or columns." -msgstr "任何值集合或者多对多关联需要专用的具有一个或多个外键字段的 collection table、一个或多个 collection element column,以及还可能有一个或多个索引字段。 " +#: collection_mapping.xml:147 +#, fuzzy, no-c-format +msgid "" +"In a one-to-many " +"association links the Product and " +"Part entities. This association requires the existence of " +"a foreign key column and possibly an index column to the Part table. This mapping loses certain semantics of normal Java " +"collections:" +msgstr "" +"一个从 ProductPart 的关联需要关键字" +"字段,可能还有一个索引字段指向 Part 所对应的表。" +"<one-to-many> 标记指明了一个一对多的关联。 " #. Tag: para +#: collection_mapping.xml:156 #, no-c-format -msgid "For a collection of values use the <element> tag. For example:" -msgstr "对于一个值集合,我们使用 <element> 标签。例如:" +msgid "" +"An instance of the contained entity class cannot belong to more than one " +"instance of the collection." +msgstr "一个被包含的实体的实例只能被包含在一个集合的实例中。" #. Tag: para +#: collection_mapping.xml:161 #, no-c-format -msgid "column (optional): the name of the column holding the collection element values." -msgstr "column(可选):持有集合元素值的字段的名称。" +msgid "" +"An instance of the contained entity class cannot appear at more than one " +"value of the collection index." +msgstr "一个被包含的实体的实例只能对应于集合索引的一个值中。" #. Tag: para +#: collection_mapping.xml:166 #, no-c-format -msgid "formula (optional): an SQL formula used to evaluate the element." -msgstr "formula(可选):用于对元素求值的 SQL 公式。" - -#. Tag: para -#, no-c-format -msgid "type (required): the type of the collection element." -msgstr "type(必需):集合元素的类型。 " - -#. Tag: para -#, no-c-format -msgid "A many-to-many association is specified using the <many-to-many> element." -msgstr "用 <many-to-many> 元素指定 many-to-many association。" - -#. Tag: para -#, no-c-format -msgid "column (optional): the name of the element foreign key column." -msgstr "column(必需):元素外键字段的名称。 " - -#. Tag: para -#, no-c-format -msgid "formula (optional): an SQL formula used to evaluate the element foreign key value." -msgstr "formula(可选):用于对元素外键值求值的 SQL 公式。" +msgid "" +"Looking closer at the used <one-to-many> tag we see " +"that it has the following options." +msgstr "" + +#. Tag: title +#: collection_mapping.xml:170 +#, no-c-format +msgid "options of <one-to-many> element" +msgstr "" + +#. Tag: programlisting +#: collection_mapping.xml:181 +#, fuzzy, no-c-format +msgid "" +"<one-to-many\n" +" class=\"ClassName\"\n" +" not-found=\"ignore|exception\"\n" +" entity-name=\"EntityName\"\n" +" node=\"element-name\"\n" +" embed-xml=\"true|false\"\n" +" />" +msgstr "" +"]]>" #. Tag: para +#: collection_mapping.xml:185 #, no-c-format msgid "class (required): the name of the associated class." msgstr "class(必需):被关联类的名称。 " #. Tag: para +#: collection_mapping.xml:190 #, no-c-format -msgid "fetch (optional - defaults to join): enables outer-join or sequential select fetching for this association. This is a special case; for full eager fetching in a single SELECT of an entity and its many-to-many relationships to other entities, you would enable join fetching,not only of the collection itself, but also with this attribute on the <many-to-many> nested element." -msgstr "fetch(可选 - 缺省为 join): 为这个关联启用外连接或序列性选择抓取。这是一个特例。对于在单个 SELECT 里进行完全的 eager fetching 以及使 <many-to-many> n用多对多关联,你可以启用 join fetching,这不仅是对于集合本身,也对 <many-to-many> 嵌套元素的属性。" +msgid "" +"not-found (optional - defaults to exception): specifies how cached identifiers that reference missing rows will " +"be handled. ignore will treat a missing row as a null " +"association." +msgstr "" +"not-found(可选 - 默认为exception):指" +"明若缓存的标示值关联的行缺失,该如何处理:ignore 会把缺失" +"的行作为一个空关联处理。 " #. Tag: para +#: collection_mapping.xml:198 #, no-c-format -msgid "unique (optional): enables the DDL generation of a unique constraint for the foreign-key column. This makes the association multiplicity effectively one-to-many." -msgstr "unique(可选):未外键字段启用唯一约束的 DDL 生成。这使得关联一对多的多样性更为有效。" +msgid "" +"entity-name (optional): the entity name of the associated " +"class, as an alternative to class." +msgstr "" +"entity-name(可选):被关联的类的实体名,作为 " +"class 的替代。 " #. Tag: para +#: collection_mapping.xml:206 #, no-c-format -msgid "not-found (optional - defaults to exception): specifies how foreign keys that reference missing rows will be handled: ignore will treat a missing row as a null association." -msgstr "not-found(可选 - 默认为 exception):指明若缓存的标示值关联的行缺失,该如何处理:ignore 会把缺失的行作为一个空关联处理。 " +msgid "" +"The <one-to-many> element does not need to declare " +"any columns. Nor is it necessary to specify the table " +"name anywhere." +msgstr "" +"注意:<one-to-many> 元素不需要定义任何字段。也不需要" +"指定表名。 " #. Tag: para -#, no-c-format -msgid "entity-name (optional): the entity name of the associated class, as an alternative to class." -msgstr "entity-name(可选):被关联的类的实体名,作为 class 的替代。 " +#: collection_mapping.xml:211 +#, fuzzy, no-c-format +msgid "" +"If the foreign key column of a <one-to-many> " +"association is declared NOT NULL, you must declare the " +"<key> mapping not-null=\"true\" " +"or use a bidirectional association with the collection " +"mapping marked inverse=\"true\". See ." +msgstr "" +"重要提示:如果一对多关联中的外键字段" +"定义成 NOT NULL,你必须把 <key> " +"映射声明为 not-null=\"true\",或者使用双向关联,并且标明 inverse=\"true\"。参阅本章后面关于双向" +"关联的讨论。 " #. Tag: para -#, no-c-format -msgid "property-ref (optional): the name of a property of the associated class that is joined to this foreign key. If not specified, the primary key of the associated class is used." -msgstr "property-ref(可选):连接至这个外键的关联类的属性名称。如果未指定,关联类的主键将被使用。" - -#. Tag: para -#, no-c-format -msgid "Here are some examples." -msgstr "下面是一些例子:" - -#. Tag: para -#, no-c-format -msgid "A set of strings:" -msgstr "一系列字符串:" - -#. Tag: para -#, no-c-format -msgid "A bag containing integers with an iteration order determined by the order-by attribute:" -msgstr "包含一组整数的 bag(还设置了 order-by 参数指定了迭代的顺序): " - -#. Tag: para -#, no-c-format -msgid "An array of entities, in this case, a many-to-many association:" -msgstr "一个实体数组,在这个案例中是一个多对多的关联(注意这里的实体是自动管理生命周期的对象(lifecycle objects),cascade=\"all\"): " - -#. Tag: para -#, no-c-format -msgid "A map from string indices to dates:" -msgstr "一个 map,通过字符串的索引来指明日期:" - -#. Tag: para -#, no-c-format -msgid "A list of components (this is discussed in the next chapter):" -msgstr "一个组件的列表:(将在下一章讨论)" +#: collection_mapping.xml:221 +#, fuzzy, no-c-format +msgid "" +"Apart from the <set> tag as shown in , there is also <list>, <map>, <bag>, " +"<array> and <primitive-array> mapping elements. The <map> element is " +"representative:" +msgstr "" +"除了 <set>,还有<list>," +"<map><bag><" +"array><primitive-array> 映射元素。" +"<map> 具有代表性:" #. Tag: title +#: collection_mapping.xml:229 #, no-c-format -msgid "One-to-many associations" -msgstr "一对多关联(One-to-many Associations)" +msgid "Elements of the <map> mapping" +msgstr "" + +#. Tag: programlisting +#: collection_mapping.xml:262 +#, fuzzy, no-c-format +msgid "" +"<map\n" +" name=\"propertyName\"\n" +" table=\"table_name\"\n" +" schema=\"schema_name\"\n" +" lazy=\"true|extra|false\"\n" +" inverse=\"true|false\"\n" +" cascade=\"all|none|save-update|delete|all-delete-orphan|delete-orphan\"\n" +" sort=\"unsorted|natural|comparatorClass\"\n" +" order-by=\"column_name asc|desc\"\n" +" where=\"arbitrary sql where condition\"\n" +" fetch=\"join|select|subselect\"\n" +" batch-size=\"N\"\n" +" access=\"field|property|ClassName\"\n" +" optimistic-lock=\"true|false\"\n" +" mutable=\"true|false\"\n" +" node=\"element-name|.\"\n" +" embed-xml=\"true|false\"\n" +">\n" +"\n" +" <key .... />\n" +" <map-key .... />\n" +" <element .... />\n" +"</map>" +msgstr "" +"\n" +"\n" +" \n" +" \n" +" \n" +"]]>" #. Tag: para +#: collection_mapping.xml:266 #, no-c-format -msgid "A one-to-many association links the tables of two classes via a foreign key with no intervening collection table. This mapping loses certain semantics of normal Java collections:" -msgstr "一对多关联通过外键连接两个类对应的表,而没有中间集合表。 这个关系模型失去了一些 Java 集合的语义:" +msgid "name: the collection property name" +msgstr "name:集合属性的名称" #. Tag: para +#: collection_mapping.xml:270 #, no-c-format -msgid "An instance of the contained entity class cannot belong to more than one instance of the collection." -msgstr "一个被包含的实体的实例只能被包含在一个集合的实例中。" +msgid "" +"table (optional - defaults to property name): the name of " +"the collection table. It is not used for one-to-many associations." +msgstr "" +"table(可选——默认为属性的名称)这个集合表的名称(不能在一" +"对多的关联关系中使用)。" #. Tag: para +#: collection_mapping.xml:276 #, no-c-format -msgid "An instance of the contained entity class cannot appear at more than one value of the collection index." -msgstr "一个被包含的实体的实例只能对应于集合索引的一个值中。" +msgid "" +"schema (optional): the name of a table schema to override " +"the schema declared on the root element" +msgstr "" +"schema(可选):表的 schema 的名称,他将覆盖在根元素中定义" +"的 schema" #. Tag: para +#: collection_mapping.xml:281 #, no-c-format -msgid "An association from Product to Part requires the existence of a foreign key column and possibly an index column to the Part table. A <one-to-many> tag indicates that this is a one-to-many association." -msgstr "一个从 ProductPart 的关联需要关键字字段,可能还有一个索引字段指向 Part 所对应的表。<one-to-many> 标记指明了一个一对多的关联。 " +msgid "" +"lazy (optional - defaults to true): " +"disables lazy fetching and specifies that the association is always eagerly " +"fetched. It can also be used to enable \"extra-lazy\" fetching where most " +"operations do not initialize the collection. This is suitable for large " +"collections." +msgstr "" +"lazy(可选--默认为 true)可以用来关闭延迟加载(false):指" +"定一直使用预先抓取,或者打开 \"extra-lazy\" 抓取,此时大多数操作不会初始化集" +"合类(适用于非常大的集合)。" #. Tag: para +#: collection_mapping.xml:290 #, no-c-format -msgid "not-found (optional - defaults to exception): specifies how cached identifiers that reference missing rows will be handled. ignore will treat a missing row as a null association." -msgstr "not-found(可选 - 默认为exception):指明若缓存的标示值关联的行缺失,该如何处理:ignore 会把缺失的行作为一个空关联处理。 " +msgid "" +"inverse (optional - defaults to false): marks this collection as the \"inverse\" end of a bidirectional " +"association." +msgstr "" +"inverse(可选 — 默认为 false)标记这个" +"集合作为双向关联关系中的方向一端。 " #. Tag: para +#: collection_mapping.xml:296 #, no-c-format -msgid "The <one-to-many> element does not need to declare any columns. Nor is it necessary to specify the table name anywhere." -msgstr "注意:<one-to-many> 元素不需要定义任何字段。也不需要指定表名。 " +msgid "" +"cascade (optional - defaults to none): " +"enables operations to cascade to child entities." +msgstr "" +"cascade(可选 — 默认为 none)让操作级联" +"到子实体。" #. Tag: para +#: collection_mapping.xml:302 #, no-c-format -msgid "If the foreign key column of a <one-to-many> association is declared NOT NULL, you must declare the <key> mapping not-null=\"true\" or use a bidirectional association with the collection mapping marked inverse=\"true\". See the discussion of bidirectional associations later in this chapter for more information." -msgstr "重要提示:如果一对多关联中的外键字段定义成 NOT NULL,你必须把 <key> 映射声明为 not-null=\"true\",或者使用双向关联,并且标明 inverse=\"true\"。参阅本章后面关于双向关联的讨论。 " +msgid "" +"sort (optional): specifies a sorted collection with " +"natural sort order or a given comparator class." +msgstr "" +"sort(可选)指定集合的排序顺序,其可以为自然的" +"(natural)或者给定一个用来比较的类。 " #. Tag: para +#: collection_mapping.xml:308 +#, fuzzy, no-c-format +msgid "" +"order-by (optional): specifies a table column or columns " +"that define the iteration order of the Map, Set or bag, together with an optional asc or " +"desc." +msgstr "" +"order-by(可选,仅用于 jdk1.4):指定表的字段(一个或几" +"个)再加上 asc 或者 desc(可选),定义 Map、Set 和 Bag 的迭代顺序。" + +#. Tag: para +#: collection_mapping.xml:316 #, no-c-format -msgid "The following example shows a map of Part entities by name, where partName is a persistent property of Part. Notice the use of a formula-based index:" -msgstr "下面的例子展示一个 Part 实体的 map,把 name 作为关键字。( partNamePart 的持久化属性)。注意其中的基于公式的索引的用法。 " +msgid "" +"where (optional): specifies an arbitrary SQL " +"WHERE condition that is used when retrieving or removing " +"the collection. This is useful if the collection needs to contain only a " +"subset of the available data." +msgstr "" +"where(可选):指定任意的 SQL where 条件,该条件将在重新载" +"入或者删除这个集合时使用(当集合中的数据仅仅是所有可用数据的一个子集时这个条" +"件非常有用)。" + +#. Tag: para +#: collection_mapping.xml:324 +#, no-c-format +msgid "" +"fetch (optional, defaults to select): " +"chooses between outer-join fetching, fetching by sequential select, and " +"fetching by sequential subselect." +msgstr "" +"fetch(可选,默认为 select):用于在外" +"连接抓取、通过后续 select 抓取和通过后续 subselect 抓取之间选择。" + +#. Tag: para +#: collection_mapping.xml:331 +#, no-c-format +msgid "" +"batch-size (optional, defaults to 1): " +"specifies a \"batch size\" for lazily fetching instances of this collection." +msgstr "" +"batch-size(可选,默认为 1):指定通过" +"延迟加载取得集合实例的批处理块大小(\"batch size\")。" + +#. Tag: para +#: collection_mapping.xml:337 +#, no-c-format +msgid "" +"access (optional - defaults to property): the strategy Hibernate uses for accessing the collection property " +"value." +msgstr "" +"access(可选-默认为属性 property):Hibernate 取得集合属性" +"值时使用的策略。" + +#. Tag: para +#: collection_mapping.xml:343 +#, no-c-format +msgid "" +"optimistic-lock (optional - defaults to true): specifies that changes to the state of the collection results in " +"increments of the owning entity's version. For one-to-many associations you " +"may want to disable this setting." +msgstr "" +"乐观锁(可选 - 默认为 true):对集合的" +"状态的改变会是否导致其所属的实体的版本增长(对一对多关联来说,关闭这个属性常" +"常是有理的)。" + +#. Tag: para +#: collection_mapping.xml:351 +#, no-c-format +msgid "" +"mutable (optional - defaults to true): " +"a value of false specifies that the elements of the " +"collection never change. This allows for minor performance optimization in " +"some cases." +msgstr "" +"mutable(可变)(可选 — 默认为 true):" +"若值为 false,表明集合中的元素不会改变(在某些情况下可以进" +"行一些小的性能优化)。 " + +#. Tag: para +#: collection_mapping.xml:360 +#, no-c-format +msgid "" +"After exploring the basic mapping of collections in the preceding paragraphs " +"we will now focus details like physical mapping considerations, indexed " +"collections and collections of value types." +msgstr "" #. Tag: title +#: collection_mapping.xml:365 +#, no-c-format +msgid "Collection foreign keys" +msgstr "集合外键(Collection foreign keys)" + +#. Tag: para +#: collection_mapping.xml:367 +#, fuzzy, no-c-format +msgid "" +"On the database level collection instances are distinguished by the foreign " +"key of the entity that owns the collection. This foreign key is referred to " +"as the collection key column, or columns, of the " +"collection table. The collection key column is mapped by the " +"@JoinColumn annotation respectively the <" +"key> XML element." +msgstr "" +"集合实例在数据库中依靠持有集合的实体的外键加以辨别。此外键作为集合" +"关键字段(collection key column)(或多个字段)加以引用。集合关键" +"字段通过 <key> 元素映射。 " + +#. Tag: para +#: collection_mapping.xml:374 +#, fuzzy, no-c-format +msgid "" +"There can be a nullability constraint on the foreign key column. For most " +"collections, this is implied. For unidirectional one-to-many associations, " +"the foreign key column is nullable by default, so you may need to specify" +msgstr "" +"在外键字段上可能具有非空约束。对于大多数集合来说,这是隐含的。对单向一对多关" +"联来说,外键字段默认是可以为空的,因此你可能需要指明 not-null=\"true" +"\"。 " + +#. Tag: programlisting +#: collection_mapping.xml:379 +#, no-c-format +msgid "@JoinColumn(nullable=false)" +msgstr "" + +#. Tag: para +#: collection_mapping.xml:381 +#, no-c-format +msgid "or" +msgstr "" + +#. Tag: programlisting +#: collection_mapping.xml:383 +#, fuzzy, no-c-format +msgid "<key column=\"productSerialNumber\" not-null=\"true\"/>" +msgstr "]]>" + +#. Tag: para +#: collection_mapping.xml:385 +#, fuzzy, no-c-format +msgid "" +"The foreign key constraint can use ON DELETE CASCADE. In " +"XML this can be expressed via:" +msgstr "外键约束可以使用 ON DELETE CASCADE。 " + +#. Tag: programlisting +#: collection_mapping.xml:388 +#, fuzzy, no-c-format +msgid "<key column=\"productSerialNumber\" on-delete=\"cascade\"/>" +msgstr "" +"]]>" + +#. Tag: para +#: collection_mapping.xml:390 +#, no-c-format +msgid "" +"In annotations the Hibernate specific annotation @OnDelete has to be used." +msgstr "" + +#. Tag: programlisting +#: collection_mapping.xml:393 +#, no-c-format +msgid "@OnDelete(action=OnDeleteAction.CASCADE)" +msgstr "" + +#. Tag: para +#: collection_mapping.xml:395 +#, fuzzy, no-c-format +msgid "" +"See for more information about the " +"<key> element." +msgstr "对 <key> 元素的完整定义,请参阅前面的章节。" + +#. Tag: title +#: collection_mapping.xml:400 +#, no-c-format +msgid "Indexed collections" +msgstr "索引集合类(Indexed collections)" + +#. Tag: para +#: collection_mapping.xml:402 +#, no-c-format +msgid "" +"In the following paragraphs we have a closer at the indexed collections " +"List and Map how the their " +"index can be mapped in Hibernate." +msgstr "" + +#. Tag: title +#: collection_mapping.xml:407 +#, no-c-format +msgid "Lists" +msgstr "" + +#. Tag: para +#: collection_mapping.xml:409 +#, no-c-format +msgid "Lists can be mapped in two different ways:" +msgstr "" + +#. Tag: para +#: collection_mapping.xml:413 +#, no-c-format +msgid "as ordered lists, where the order is not materialized in the database" +msgstr "" + +#. Tag: para +#: collection_mapping.xml:418 +#, no-c-format +msgid "as indexed lists, where the order is materialized in the database" +msgstr "" + +#. Tag: para +#: collection_mapping.xml:423 +#, no-c-format +msgid "" +"To order lists in memory, add @javax.persistence.OrderBy " +"to your property. This annotation takes as parameter a list of comma " +"separated properties (of the target entity) and orders the collection " +"accordingly (eg firstname asc, age desc), if the string is " +"empty, the collection will be ordered by the primary key of the target " +"entity." +msgstr "" + +#. Tag: title +#: collection_mapping.xml:432 +#, no-c-format +msgid "Ordered lists using @OrderBy" +msgstr "" + +#. Tag: programlisting +#: collection_mapping.xml:434 +#, no-c-format +msgid "" +"@Entity\n" +"public class Customer {\n" +" @Id @GeneratedValue public Integer getId() { return id; }\n" +" public void setId(Integer id) { this.id = id; }\n" +" private Integer id;\n" +"\n" +" @OneToMany(mappedBy=\"customer\")\n" +" @OrderBy(\"number\")\n" +" public List<Order> getOrders() { return orders; }\n" +" public void setOrders(List<Order> orders) { this.orders = " +"orders; }\n" +" private List<Order> orders;\n" +"}\n" +"\n" +"@Entity\n" +"public class Order {\n" +" @Id @GeneratedValue public Integer getId() { return id; }\n" +" public void setId(Integer id) { this.id = id; }\n" +" private Integer id;\n" +"\n" +" public String getNumber() { return number; }\n" +" public void setNumber(String number) { this.number = number; }\n" +" private String number;\n" +"\n" +" @ManyToOne\n" +" public Customer getCustomer() { return customer; }\n" +" public void setCustomer(Customer customer) { this.customer = customer; }\n" +" private Customer number;\n" +"}\n" +"\n" +"-- Table schema\n" +"|-------------| |----------|\n" +"| Order | | Customer |\n" +"|-------------| |----------|\n" +"| id | | id |\n" +"| number | |----------| \n" +"| customer_id |\n" +"|-------------|" +msgstr "" + +#. Tag: para +#: collection_mapping.xml:437 +#, no-c-format +msgid "" +"To store the index value in a dedicated column, use the @javax." +"persistence.OrderColumn annotation on your property. This " +"annotations describes the column name and attributes of the column keeping " +"the index value. This column is hosted on the table containing the " +"association foreign key. If the column name is not specified, the default is " +"the name of the referencing property, followed by underscore, followed by " +"ORDER (in the following example, it would be " +"orders_ORDER)." +msgstr "" + +#. Tag: title +#: collection_mapping.xml:448 +#, no-c-format +msgid "Explicit index column using @OrderColumn" +msgstr "" + +#. Tag: programlisting +#: collection_mapping.xml:451 +#, no-c-format +msgid "" +"@Entity\n" +"public class Customer {\n" +" @Id @GeneratedValue public Integer getId() { return id; }\n" +" public void setId(Integer id) { this.id = id; }\n" +" private Integer id;\n" +"\n" +" @OneToMany(mappedBy=\"customer\")\n" +" @OrderColumn(name=\"orders_index\")\n" +" public List<Order> getOrders() { return orders; }\n" +" public void setOrders(List<Order> orders) { this.orders = " +"orders; }\n" +" private List<Order> orders;\n" +"}\n" +"\n" +"@Entity\n" +"public class Order {\n" +" @Id @GeneratedValue public Integer getId() { return id; }\n" +" public void setId(Integer id) { this.id = id; }\n" +" private Integer id;\n" +"\n" +" public String getNumber() { return number; }\n" +" public void setNumber(String number) { this.number = number; }\n" +" private String number;\n" +"\n" +" @ManyToOne\n" +" public Customer getCustomer() { return customer; }\n" +" public void setCustomer(Customer customer) { this.customer = customer; }\n" +" private Customer number;\n" +"}\n" +"\n" +"-- Table schema\n" +"|--------------| |----------|\n" +"| Order | | Customer |\n" +"|--------------| |----------|\n" +"| id | | id |\n" +"| number | |----------| \n" +"| customer_id |\n" +"| orders_order |\n" +"|--------------|" +msgstr "" + +#. Tag: para +#: collection_mapping.xml:455 +#, no-c-format +msgid "" +"We recommend you to convert the legacy @org.hibernate.annotations." +"IndexColumn usages to @OrderColumn unless " +"you are making use of the base property. The base " +"property lets you define the index value of the first element (aka as base " +"index). The usual value is 0 or 1. The " +"default is 0 like in Java." +msgstr "" + +#. Tag: para +#: collection_mapping.xml:464 +#, no-c-format +msgid "" +"Looking again at the Hibernate mapping file equivalent, the index of an " +"array or list is always of type integer and is mapped " +"using the <list-index> element. The mapped column " +"contains sequential integers that are numbered from zero by default." +msgstr "" + +#. Tag: title +#: collection_mapping.xml:471 +#, no-c-format +msgid "index-list element for indexed collections in xml mapping" +msgstr "" + +#. Tag: programlisting +#: collection_mapping.xml:481 +#, no-c-format +msgid "" +"<list-index\n" +" column=\"column_name\"\n" +" base=\"0|1|...\"/>" +msgstr "" + +#. Tag: para +#: collection_mapping.xml:485 +#, no-c-format +msgid "" +"column_name (required): the name of the column holding " +"the collection index values." +msgstr "column_name(必需):持有集合索引值的字段的名称。 " + +#. Tag: para +#: collection_mapping.xml:490 +#, no-c-format +msgid "" +"base (optional - defaults to 0): the " +"value of the index column that corresponds to the first element of the list " +"or array." +msgstr "" +"base(可选 — 默认为 0)对应列表或队列的" +"第一个元素的索引字段的值。" + +#. Tag: para +#: collection_mapping.xml:498 +#, no-c-format +msgid "" +"If your table does not have an index column, and you still wish to use " +"List as the property type, you can map the property as a " +"Hibernate <bag>. A bag does not retain its order " +"when it is retrieved from the database, but it can be optionally sorted or " +"ordered." +msgstr "" +"假若你的表没有一个索引字段,当你仍然希望使用 List 作为属性" +"类型,你应该把此属性映射为 Hibernate <bag>。从数据" +"库中获取的时候,bag 不维护其顺序,但也可选择性的进行排序。 " + +#. Tag: title +#: collection_mapping.xml:506 +#, no-c-format +msgid "Maps" +msgstr "" + +#. Tag: para +#: collection_mapping.xml:508 +#, no-c-format +msgid "" +"The question with Maps is where the key value is " +"stored. There are everal options. Maps can borrow their keys from one of the " +"associated entity properties or have dedicated columns to store an explicit " +"key." +msgstr "" + +#. Tag: para +#: collection_mapping.xml:513 +#, no-c-format +msgid "" +"To use one of the target entity property as a key of the map, use " +"@MapKey(name=\"myProperty\"), where myProperty is a property name in the target entity. When using " +"@MapKey without the name attribuate, the target entity " +"primary key is used. The map key uses the same column as the property " +"pointed out. There is no additional column defined to hold the map key, " +"because the map key represent a target property. Be aware that once loaded, " +"the key is no longer kept in sync with the property. In other words, if you " +"change the property value, the key will not change automatically in your " +"Java model." +msgstr "" + +#. Tag: title +#: collection_mapping.xml:525 +#, no-c-format +msgid "" +"Use of target entity property as map key via @MapKey" +msgstr "" + +#. Tag: programlisting +#: collection_mapping.xml:528 +#, no-c-format +msgid "" +"@Entity\n" +"public class Customer {\n" +" @Id @GeneratedValue public Integer getId() { return id; }\n" +" public void setId(Integer id) { this.id = id; }\n" +" private Integer id;\n" +"\n" +" @OneToMany(mappedBy=\"customer\")\n" +" @MapKey(name=\"number\")\n" +" public Map<String,Order> getOrders() { return orders; }\n" +" public void setOrders(Map<String,Order> order) { this.orders = " +"orders; }\n" +" private Map<String,Order> orders;\n" +"}\n" +"\n" +"@Entity\n" +"public class Order {\n" +" @Id @GeneratedValue public Integer getId() { return id; }\n" +" public void setId(Integer id) { this.id = id; }\n" +" private Integer id;\n" +"\n" +" public String getNumber() { return number; }\n" +" public void setNumber(String number) { this.number = number; }\n" +" private String number;\n" +"\n" +" @ManyToOne\n" +" public Customer getCustomer() { return customer; }\n" +" public void setCustomer(Customer customer) { this.customer = customer; }\n" +" private Customer number;\n" +"}\n" +"\n" +"-- Table schema\n" +"|-------------| |----------|\n" +"| Order | | Customer |\n" +"|-------------| |----------|\n" +"| id | | id |\n" +"| number | |----------| \n" +"| customer_id |\n" +"|-------------|" +msgstr "" + +#. Tag: para +#: collection_mapping.xml:531 +#, no-c-format +msgid "" +"Alternatively the map key is mapped to a dedicated column or columns. In " +"order to customize the mapping use one of the following annotations:" +msgstr "" + +#. Tag: para +#: collection_mapping.xml:537 +#, no-c-format +msgid "" +"@MapKeyColumn if the map key is a basic type. If you " +"don't specify the column name, the name of the property followed by " +"underscore followed by KEY is used (for example " +"orders_KEY)." +msgstr "" + +#. Tag: para +#: collection_mapping.xml:544 +#, no-c-format +msgid "" +"@MapKeyEnumerated / @MapKeyTemporal if the map key type is respectively an enum or a Date." +msgstr "" + +#. Tag: para +#: collection_mapping.xml:550 +#, no-c-format +msgid "" +"@MapKeyJoinColumn/@MapKeyJoinColumns if the map key type is another entity." +msgstr "" + +#. Tag: para +#: collection_mapping.xml:555 +#, no-c-format +msgid "" +"@AttributeOverride/@AttributeOverrides when the map key is a embeddable object. Use key. as a prefix for your embeddable object property names." +msgstr "" + +#. Tag: para +#: collection_mapping.xml:562 +#, no-c-format +msgid "" +"You can also use @MapKeyClass to define the type of " +"the key if you don't use generics." +msgstr "" + +#. Tag: title +#: collection_mapping.xml:566 +#, no-c-format +msgid "Map key as basic type using @MapKeyColumn" +msgstr "" + +#. Tag: programlisting +#: collection_mapping.xml:569 +#, no-c-format +msgid "" +"@Entity\n" +"public class Customer {\n" +" @Id @GeneratedValue public Integer getId() { return id; }\n" +" public void setId(Integer id) { this.id = id; }\n" +" private Integer id;\n" +"\n" +" @OneToMany @JoinTable(name=\"Cust_Order\")\n" +" @MapKeyColumn(name=\"orders_number\")\n" +" public Map<String,Order> getOrders() { return orders; }\n" +" public void setOrders(Map<String,Order> orders) { this.orders = " +"orders; }\n" +" private Map<String,Order> orders;\n" +"}\n" +"\n" +"@Entity\n" +"public class Order {\n" +" @Id @GeneratedValue public Integer getId() { return id; }\n" +" public void setId(Integer id) { this.id = id; }\n" +" private Integer id;\n" +"\n" +" public String getNumber() { return number; }\n" +" public void setNumber(String number) { this.number = number; }\n" +" private String number;\n" +"\n" +" @ManyToOne\n" +" public Customer getCustomer() { return customer; }\n" +" public void setCustomer(Customer customer) { this.customer = customer; }\n" +" private Customer number;\n" +"}\n" +"\n" +"-- Table schema\n" +"|-------------| |----------| |---------------|\n" +"| Order | | Customer | | Cust_Order |\n" +"|-------------| |----------| |---------------|\n" +"| id | | id | | customer_id |\n" +"| number | |----------| | order_id |\n" +"| customer_id | | orders_number |\n" +"|-------------| |---------------|" +msgstr "" + +#. Tag: para +#: collection_mapping.xml:573 +#, no-c-format +msgid "" +"We recommend you to migrate from @org.hibernate.annotations." +"MapKey / @org.hibernate.annotation.MapKeyManyToMany to the new standard approach described above" +msgstr "" + +#. Tag: para +#: collection_mapping.xml:579 +#, fuzzy, no-c-format +msgid "" +"Using Hibernate mapping files there exists equivalent concepts to the " +"descibed annotations. You have to use <map-key>, " +"<map-key-many-to-many> and <composite-" +"map-key>. <map-key> is used for any " +"basic type, <map-key-many-to-many> for an entity " +"reference and <composite-map-key> for a composite " +"type." +msgstr "" +"除了 <set>,还有<list>," +"<map><bag><" +"array><primitive-array> 映射元素。" +"<map> 具有代表性:" + +#. Tag: title +#: collection_mapping.xml:590 +#, no-c-format +msgid "map-key xml mapping element" +msgstr "" + +#. Tag: programlisting +#: collection_mapping.xml:601 +#, no-c-format +msgid "" +"<map-key\n" +" column=\"column_name\"\n" +" formula=\"any SQL expression\"\n" +" type=\"type_name\"\n" +" node=\"@attribute-name\"\n" +" length=\"N\"/>" +msgstr "" + +#. Tag: para +#: collection_mapping.xml:605 +#, no-c-format +msgid "" +"column (optional): the name of the column holding the " +"collection index values." +msgstr "column(可选):持有集合索引值的字段的名称。" + +#. Tag: para +#: collection_mapping.xml:610 +#, no-c-format +msgid "" +"formula (optional): a SQL formula used to evaluate the " +"key of the map." +msgstr "formula(可选):用于对表键求值的 SQL 公式。" + +#. Tag: para +#: collection_mapping.xml:615 +#, no-c-format +msgid "type (required): the type of the map keys." +msgstr "type(必需):映射键的类型。 " + +#. Tag: title +#: collection_mapping.xml:623 +#, fuzzy, no-c-format +msgid "map-key-many-to-many" +msgstr "多对多(many-to-many)" + +#. Tag: programlisting +#: collection_mapping.xml:634 +#, no-c-format +msgid "" +"<map-key-many-to-many\n" +" column=\"column_name\"\n" +" formula=\"any SQL expression\"\n" +" class=\"ClassName\"\n" +"/>" +msgstr "" + +#. Tag: para +#: collection_mapping.xml:638 +#, no-c-format +msgid "" +"column (optional): the name of the foreign key column for " +"the collection index values." +msgstr "column(可选):用于集合索引值的外键字段的名称。" + +#. Tag: para +#: collection_mapping.xml:643 +#, no-c-format +msgid "" +"formula (optional): a SQ formula used to evaluate the " +"foreign key of the map key." +msgstr "" +"formula(可选):用于对映射键的外键求值的 SQL 公式。" + +#. Tag: para +#: collection_mapping.xml:648 +#, no-c-format +msgid "" +"class (required): the entity class used as the map key." +msgstr "class(必需):用作映射键的实体类的名称。 " + +#. Tag: title +#: collection_mapping.xml:658 +#, fuzzy, no-c-format +msgid "Collections of basic types and embeddable objects" +msgstr "" +"值集合于多对多关联(Collections of values and many-to-many associations)" + +#. Tag: para +#: collection_mapping.xml:660 +#, no-c-format +msgid "" +"In some situations you don't need to associate two entities but simply " +"create a collection of basic types or embeddable objects. Use the " +"@ElementCollection for this case." +msgstr "" + +#. Tag: title +#: collection_mapping.xml:665 +#, no-c-format +msgid "" +"Collection of basic types mapped via @ElementCollection" +msgstr "" + +#. Tag: programlisting +#: collection_mapping.xml:668 +#, no-c-format +msgid "" +"@Entity\n" +"public class User {\n" +" [...]\n" +" public String getLastname() { ...}\n" +"\n" +" @ElementCollection\n" +" @CollectionTable(name=\"Nicknames\", joinColumns=@JoinColumn(name=" +"\"user_id\"))\n" +" @Column(name=\"nickname\")\n" +" public Set<String> getNicknames() { ... } \n" +"}" +msgstr "" + +#. Tag: para +#: collection_mapping.xml:671 +#, no-c-format +msgid "" +"The collection table holding the collection data is set using the " +"@CollectionTable annotation. If omitted the " +"collection table name defaults to the concatenation of the name of the " +"containing entity and the name of the collection attribute, separated by an " +"underscore. In our example, it would be User_nicknames." +msgstr "" + +#. Tag: para +#: collection_mapping.xml:678 +#, no-c-format +msgid "" +"The column holding the basic type is set using the @Column annotation. If omitted, the column name defaults to the property " +"name: in our example, it would be nicknames." +msgstr "" + +#. Tag: para +#: collection_mapping.xml:683 +#, no-c-format +msgid "" +"But you are not limited to basic types, the collection type can be any " +"embeddable object. To override the columns of the embeddable object in the " +"collection table, use the @AttributeOverride " +"annotation." +msgstr "" + +#. Tag: title +#: collection_mapping.xml:689 +#, no-c-format +msgid "@ElementCollection for embeddable objects" +msgstr "" + +#. Tag: programlisting +#: collection_mapping.xml:691 +#, no-c-format +msgid "" +"@Entity\n" +"public class User {\n" +" [...]\n" +" public String getLastname() { ...}\n" +"\n" +" @ElementCollection\n" +" @CollectionTable(name=\"Addresses\", joinColumns=@JoinColumn(name=" +"\"user_id\"))\n" +" @AttributeOverrides({\n" +" @AttributeOverride(name=\"street1\", column=@Column(name=\"fld_street" +"\"))\n" +" })\n" +" public Set<Address> getAddresses() { ... } \n" +"}\n" +"\n" +"@Embeddable\n" +"public class Address {\n" +" public String getStreet1() {...}\n" +" [...]\n" +"}" +msgstr "" + +#. Tag: para +#: collection_mapping.xml:694 +#, no-c-format +msgid "Such an embeddable object cannot contains a collection itself." +msgstr "" + +#. Tag: para +#: collection_mapping.xml:698 +#, no-c-format +msgid "" +"in @AttributeOverride, you must use the " +"value. prefix to override properties of the embeddable " +"object used in the map value and the key. prefix to " +"override properties of the embeddable object used in the map key." +msgstr "" + +#. Tag: programlisting +#: collection_mapping.xml:704 +#, no-c-format +msgid "" +"@Entity\n" +"public class User {\n" +" @ElementCollection\n" +" @AttributeOverrides({\n" +" @AttributeOverride(name=\"key.street1\", column=@Column(name=" +"\"fld_street\")),\n" +" @AttributeOverride(name=\"value.stars\", column=@Column(name=\"fld_note" +"\"))\n" +" })\n" +" public Map<Address,Rating> getFavHomes() { ... }" +msgstr "" + +#. Tag: para +#: collection_mapping.xml:708 +#, no-c-format +msgid "" +"We recommend you to migrate from @org.hibernate.annotations." +"CollectionOfElements to the new @ElementCollection annotation." +msgstr "" + +#. Tag: para +#: collection_mapping.xml:714 +#, fuzzy, no-c-format +msgid "" +"Using the mapping file approach a collection of values is mapped using the " +"<element> tag. For example:" +msgstr "" +"对于一个值集合,我们使用 <element> 标签。例如:" + +#. Tag: title +#: collection_mapping.xml:718 +#, no-c-format +msgid "<element> tag for collection values using mapping files" +msgstr "" + +#. Tag: programlisting +#: collection_mapping.xml:730 +#, no-c-format +msgid "" +"<element\n" +" column=\"column_name\"\n" +" formula=\"any SQL expression\"\n" +" type=\"typename\"\n" +" length=\"L\"\n" +" precision=\"P\"\n" +" scale=\"S\"\n" +" not-null=\"true|false\"\n" +" unique=\"true|false\"\n" +" node=\"element-name\"\n" +"/>" +msgstr "" + +#. Tag: para +#: collection_mapping.xml:734 +#, no-c-format +msgid "" +"column (optional): the name of the column holding the " +"collection element values." +msgstr "column(可选):持有集合元素值的字段的名称。" + +#. Tag: para +#: collection_mapping.xml:739 +#, no-c-format +msgid "" +"formula (optional): an SQL formula used to evaluate the " +"element." +msgstr "formula(可选):用于对元素求值的 SQL 公式。" + +#. Tag: para +#: collection_mapping.xml:744 +#, no-c-format +msgid "type (required): the type of the collection element." +msgstr "type(必需):集合元素的类型。 " + +#. Tag: title +#: collection_mapping.xml:754 #, no-c-format msgid "Advanced collection mappings" msgstr "高级集合映射(Advanced collection mappings)" #. Tag: title +#: collection_mapping.xml:757 #, no-c-format msgid "Sorted collections" msgstr "有序集合(Sorted collections)" #. Tag: para +#: collection_mapping.xml:759 #, no-c-format -msgid "Hibernate supports collections implementing java.util.SortedMap and java.util.SortedSet. You must specify a comparator in the mapping file:" -msgstr "Hibernate 支持实现 java.util.SortedMapjava.util.SortedSet 的集合。你必须在映射文件中指定一个比较器:" - -#. Tag: para -#, no-c-format -msgid "Allowed values of the sort attribute are unsorted, natural and the name of a class implementing java.util.Comparator." -msgstr "sort 属性中允许的值包括 unsortednatural 和某个实现了 java.util.Comparator 的类的名称。" - -#. Tag: para -#, no-c-format -msgid "Sorted collections actually behave like java.util.TreeSet or java.util.TreeMap." -msgstr "分类集合的行为事实上象 java.util.TreeSet 或者 java.util.TreeMap。" - -#. Tag: para -#, no-c-format -msgid "If you want the database itself to order the collection elements, use the order-by attribute of set, bag or map mappings. This solution is only available under JDK 1.4 or higher and is implemented using LinkedHashSet or LinkedHashMap. This performs the ordering in the SQL query and not in the memory." -msgstr "如果你希望数据库自己对集合元素排序,可以利用 setbag 或者 map 映射中的 order-by 属性。这个解决方案只能在 jdk1.4 或者更高的 jdk 版本中才可以实现(通过 LinkedHashSet 或者 LinkedHashMap 实现)。它是在 SQL 查询中完成排序,而不是在内存中。 " +msgid "" +"Hibernate supports collections implementing java.util.SortedMap and java.util.SortedSet. With annotations you " +"declare a sort comparator using @Sort. You chose between " +"the comparator types unsorted, natural or custom. If you want to use your " +"own comparator implementation, you'll also have to specify the " +"implementation class using the comparator attribute. Note " +"that you need to use either a SortedSet or a " +"SortedMap interface." +msgstr "" #. Tag: title +#: collection_mapping.xml:770 +#, fuzzy, no-c-format +msgid "Sorted collection with @Sort" +msgstr "有序集合(Sorted collections)" + +#. Tag: programlisting +#: collection_mapping.xml:772 +#, no-c-format +msgid "" +"@OneToMany(cascade=CascadeType.ALL, fetch=FetchType.EAGER)\n" +"@JoinColumn(name=\"CUST_ID\")\n" +"@Sort(type = SortType.COMPARATOR, comparator = TicketComparator.class)\n" +"public SortedSet<Ticket> getTickets() {\n" +" return tickets;\n" +"}" +msgstr "" + +#. Tag: para +#: collection_mapping.xml:775 +#, no-c-format +msgid "" +"Using Hibernate mapping files you specify a comparator in the mapping file " +"with <sort>:" +msgstr "" + +#. Tag: title +#: collection_mapping.xml:779 +#, fuzzy, no-c-format +msgid "Sorted collection using xml mapping" +msgstr "有序集合(Sorted collections)" + +#. Tag: programlisting +#: collection_mapping.xml:781 +#, fuzzy, no-c-format +msgid "" +"<set name=\"aliases\"\n" +" table=\"person_aliases\" \n" +" sort=\"natural\">\n" +" <key column=\"person\"/>\n" +" <element column=\"name\" type=\"string\"/>\n" +"</set>\n" +"\n" +"<map name=\"holidays\" sort=\"my.custom.HolidayComparator\">\n" +" <key column=\"year_id\"/>\n" +" <map-key column=\"hol_name\" type=\"string\"/>\n" +" <element column=\"hol_date\" type=\"date\"/>\n" +"</map>" +msgstr "" +"\n" +" \n" +" \n" +"\n" +"\n" +"\n" +" \n" +" \n" +" \n" +"]]>" + +#. Tag: para +#: collection_mapping.xml:784 +#, no-c-format +msgid "" +"Allowed values of the sort attribute are " +"unsorted, natural and the name of a " +"class implementing java.util.Comparator." +msgstr "" +"sort 属性中允许的值包括 unsorted," +"natural 和某个实现了 java.util.Comparator 的类的名称。" + +#. Tag: para +#: collection_mapping.xml:789 +#, no-c-format +msgid "" +"Sorted collections actually behave like java.util.TreeSet " +"or java.util.TreeMap." +msgstr "" +"分类集合的行为事实上象 java.util.TreeSet 或者 " +"java.util.TreeMap。" + +#. Tag: para +#: collection_mapping.xml:794 +#, fuzzy, no-c-format +msgid "" +"If you want the database itself to order the collection elements, use the " +"order-by attribute of set, " +"bag or map mappings. This solution is " +"implemented using LinkedHashSet or " +"LinkedHashMap and performs the ordering in the SQL query " +"and not in the memory." +msgstr "" +"如果你希望数据库自己对集合元素排序,可以利用 set," +"bag 或者 map 映射中的 order-" +"by 属性。这个解决方案只能在 jdk1.4 或者更高的 jdk 版本中才可以实现" +"(通过 LinkedHashSet 或者 LinkedHashMap 实现)。它是在 SQL 查询中完成排序,而" +"不是在内存中。 " + +#. Tag: title +#: collection_mapping.xml:802 +#, no-c-format +msgid "Sorting in database using order-by" +msgstr "" + +#. Tag: programlisting +#: collection_mapping.xml:804 +#, fuzzy, no-c-format +msgid "" +"<set name=\"aliases\" table=\"person_aliases\" order-by=\"lower(name) asc" +"\">\n" +" <key column=\"person\"/>\n" +" <element column=\"name\" type=\"string\"/>\n" +"</set>\n" +"\n" +"<map name=\"holidays\" order-by=\"hol_date, hol_name\">\n" +" <key column=\"year_id\"/>\n" +" <map-key column=\"hol_name\" type=\"string\"/>\n" +" <element column=\"hol_date type=\"date\"/>\n" +"</map>" +msgstr "" +"\n" +" \n" +" \n" +"\n" +"\n" +"\n" +" \n" +" \n" +" \n" +"]]>" + +#. Tag: title +#: collection_mapping.xml:808 #, no-c-format msgid "Note" msgstr "注意" #. Tag: para +#: collection_mapping.xml:810 #, no-c-format -msgid "The value of the order-by attribute is an SQL ordering, not an HQL ordering." -msgstr "注意:这个 order-by 属性的值是一个 SQL 排序子句而不是 HQL 的。" +msgid "" +"The value of the order-by attribute is an SQL ordering, " +"not an HQL ordering." +msgstr "" +"注意:这个 order-by 属性的值是一个 SQL 排序子句而不是 HQL " +"的。" #. Tag: para +#: collection_mapping.xml:814 #, no-c-format -msgid "Associations can even be sorted by arbitrary criteria at runtime using a collection filter():" -msgstr "关联还可以在运行时使用集合 filter() 根据任意的条件来排序:" +msgid "" +"Associations can even be sorted by arbitrary criteria at runtime using a " +"collection filter():" +msgstr "" +"关联还可以在运行时使用集合 filter() 根据任意的条件来排序:" #. Tag: title +#: collection_mapping.xml:818 +#, no-c-format +msgid "Sorting via a query filter" +msgstr "" + +#. Tag: programlisting +#: collection_mapping.xml:820 +#, fuzzy, no-c-format +msgid "" +"sortedUsers = s.createFilter( group.getUsers(), \"order by this.name\" ).list" +"();" +msgstr "" +"" + +#. Tag: title +#: collection_mapping.xml:825 #, no-c-format msgid "Bidirectional associations" msgstr "双向关联(Bidirectional associations)" #. Tag: para +#: collection_mapping.xml:827 #, no-c-format -msgid "A bidirectional association allows navigation from both \"ends\" of the association. Two kinds of bidirectional association are supported:" -msgstr "双向关联允许通过关联的任一端访问另外一端。在 Hibernate 中,支持两种类型的双向关联: " +msgid "" +"A bidirectional association allows navigation from both " +"\"ends\" of the association. Two kinds of bidirectional association are " +"supported:" +msgstr "" +"双向关联允许通过关联的任一端访问另外一端。在 Hibernate " +"中,支持两种类型的双向关联: " #. Tag: term +#: collection_mapping.xml:831 #, no-c-format msgid "one-to-many" msgstr "一对多(one-to-many)" #. Tag: para +#: collection_mapping.xml:834 #, no-c-format msgid "set or bag valued at one end and single-valued at the other" msgstr "Set 或者 bag 值在一端,单独值(非集合)在另外一端 " #. Tag: term +#: collection_mapping.xml:840 #, no-c-format msgid "many-to-many" msgstr "多对多(many-to-many)" #. Tag: para +#: collection_mapping.xml:843 #, no-c-format msgid "set or bag valued at both ends" msgstr "两端都是 set 或 bag 值" #. Tag: para +#: collection_mapping.xml:848 #, no-c-format -msgid "You can specify a bidirectional many-to-many association by mapping two many-to-many associations to the same database table and declaring one end as inverse. You cannot select an indexed collection." -msgstr "要建立一个双向的多对多关联,只需要映射两个 many-to-many 关联到同一个数据库表中,并再定义其中的一端为 inverse(使用哪一端要根据你的选择,但它不能是一个索引集合)。 " - -#. Tag: para -#, no-c-format -msgid "Here is an example of a bidirectional many-to-many association that illustrates how each category can have many items and each item can be in many categories:" -msgstr "这里有一个 many-to-many 的双向关联的例子;每一个 category 都可以有很多 items,每一个 items 可以属于很多 categories: " - -#. Tag: para -#, no-c-format -msgid "Changes made only to the inverse end of the association are not persisted. This means that Hibernate has two representations in memory for every bidirectional association: one link from A to B and another link from B to A. This is easier to understand if you think about the Java object model and how a many-to-many relationship in Javais created:" -msgstr "如果只对关联的反向端进行了改变,这个改变不会被持久化。 这表示 Hibernate 为每个双向关联在内存中存在两次表现,一个从 A 连接到 B,另一个从 B 连接到 A。如果你回想一下 Java 对象模型,我们是如何在 Java 中创建多对多关系的,这可以让你更容易理解: " - -#. Tag: para -#, no-c-format -msgid "The non-inverse side is used to save the in-memory representation to the database." -msgstr "非反向端用于把内存中的表示保存到数据库中。" - -#. Tag: para -#, no-c-format -msgid "You can define a bidirectional one-to-many association by mapping a one-to-many association to the same table column(s) as a many-to-one association and declaring the many-valued end inverse=\"true\"." -msgstr "要建立一个一对多的双向关联,你可以通过把一个一对多关联,作为一个多对一关联映射到到同一张表的字段上,并且在\"多\"的那一端定义 inverse=\"true\"。 " - -#. Tag: para -#, no-c-format -msgid "Mapping one end of an association with inverse=\"true\" does not affect the operation of cascades as these are orthogonal concepts." -msgstr "在“一”这一端定义 inverse=\"true\" 不会影响级联操作,二者是正交的概念。" +msgid "" +"Often there exists a many to one association which is the owner side of a " +"bidirectional relationship. The corresponding one to many association is in " +"this case annotated by @OneToMany(mappedBy=...)" +msgstr "" #. Tag: title +#: collection_mapping.xml:854 +#, no-c-format +msgid "Bidirectional one to many with many to one side as association owner" +msgstr "" + +#. Tag: programlisting +#: collection_mapping.xml:857 +#, no-c-format +msgid "" +"@Entity\n" +"public class Troop {\n" +" @OneToMany(mappedBy=\"troop\")\n" +" public Set<Soldier> getSoldiers() {\n" +" ...\n" +"}\n" +"\n" +"@Entity\n" +"public class Soldier {\n" +" @ManyToOne\n" +" @JoinColumn(name=\"troop_fk\")\n" +" public Troop getTroop() {\n" +" ...\n" +"}" +msgstr "" + +#. Tag: para +#: collection_mapping.xml:860 +#, no-c-format +msgid "" +"Troop has a bidirectional one to many relationship " +"with Soldier through the troop " +"property. You don't have to (must not) define any physical mapping in the " +"mappedBy side." +msgstr "" + +#. Tag: para +#: collection_mapping.xml:865 +#, no-c-format +msgid "" +"To map a bidirectional one to many, with the one-to-many side as the owning " +"side, you have to remove the mappedBy element and set the " +"many to one @JoinColumn as insertable and updatable to " +"false. This solution is not optimized and will produce additional UPDATE " +"statements." +msgstr "" + +#. Tag: title +#: collection_mapping.xml:872 +#, fuzzy, no-c-format +msgid "Bidirectional associtaion with one to many side as owner" +msgstr "双向关联,涉及有序集合类" + +#. Tag: programlisting +#: collection_mapping.xml:875 +#, no-c-format +msgid "" +"@Entity\n" +"public class Troop {\n" +" @OneToMany\n" +" @JoinColumn(name=\"troop_fk\") //we need to duplicate the physical " +"information\n" +" public Set<Soldier> getSoldiers() {\n" +" ...\n" +"}\n" +"\n" +"@Entity\n" +"public class Soldier {\n" +" @ManyToOne\n" +" @JoinColumn(name=\"troop_fk\", insertable=false, updatable=false)\n" +" public Troop getTroop() {\n" +" ...\n" +"}" +msgstr "" + +#. Tag: para +#: collection_mapping.xml:878 +#, fuzzy, no-c-format +msgid "" +"How does the mappping of a bidirectional mapping look like in Hibernate " +"mapping xml? There you define a bidirectional one-to-many association by " +"mapping a one-to-many association to the same table column(s) as a many-to-" +"one association and declaring the many-valued end inverse=\"true\"." +msgstr "" +"要建立一个一对多的双向关联,你可以通过把一个一对多关联,作为一个多对一关联映" +"射到到同一张表的字段上,并且在\"多\"的那一端定义 inverse=\"true\"。 " + +#. Tag: title +#: collection_mapping.xml:885 +#, no-c-format +msgid "Bidirectional one to many via Hibernate mapping files" +msgstr "" + +#. Tag: programlisting +#: collection_mapping.xml:887 +#, fuzzy, no-c-format +msgid "" +"<class name=\"Parent\">\n" +" <id name=\"id\" column=\"parent_id\"/>\n" +" ....\n" +" <set name=\"children\" inverse=\"true\">\n" +" <key column=\"parent_id\"/>\n" +" <one-to-many class=\"Child\"/>\n" +" </set>\n" +"</class>\n" +"\n" +"<class name=\"Child\">\n" +" <id name=\"id\" column=\"child_id\"/>\n" +" ....\n" +" <many-to-one name=\"parent\" \n" +" class=\"Parent\" \n" +" column=\"parent_id\"\n" +" not-null=\"true\"/>\n" +"</class>" +msgstr "" +"\n" +" \n" +" ....\n" +" \n" +" \n" +" \n" +" \n" +"\n" +"\n" +"\n" +" \n" +" ....\n" +" \n" +"]]>" + +#. Tag: para +#: collection_mapping.xml:890 +#, no-c-format +msgid "" +"Mapping one end of an association with inverse=\"true\" " +"does not affect the operation of cascades as these are orthogonal concepts." +msgstr "" +"在“一”这一端定义 inverse=\"true\" 不会影响级联操作,二者是" +"正交的概念。" + +#. Tag: para +#: collection_mapping.xml:894 +#, no-c-format +msgid "" +"A many-to-many association is defined logically using the " +"@ManyToMany annotation. You also have to describe the " +"association table and the join conditions using the @JoinTable annotation. If the association is bidirectional, one side has to be " +"the owner and one side has to be the inverse end (ie. it will be ignored " +"when updating the relationship values in the association table):" +msgstr "" + +#. Tag: title +#: collection_mapping.xml:903 +#, no-c-format +msgid "Many to many association via @ManyToMany" +msgstr "" + +#. Tag: programlisting +#: collection_mapping.xml:905 +#, no-c-format +msgid "" +"@Entity\n" +"public class Employer implements Serializable {\n" +" @ManyToMany(\n" +" targetEntity=org.hibernate.test.metadata.manytomany.Employee.class,\n" +" cascade={CascadeType.PERSIST, CascadeType.MERGE}\n" +" )\n" +" @JoinTable(\n" +" name=\"EMPLOYER_EMPLOYEE\",\n" +" joinColumns=@JoinColumn(name=\"EMPER_ID\"),\n" +" inverseJoinColumns=@JoinColumn(name=\"EMPEE_ID\")\n" +" )\n" +" public Collection getEmployees() {\n" +" return employees;\n" +" }\n" +" ...\n" +"}" +msgstr "" + +#. Tag: programlisting +#: collection_mapping.xml:907 +#, no-c-format +msgid "" +"@Entity\n" +"public class Employee implements Serializable {\n" +" @ManyToMany(\n" +" cascade = {CascadeType.PERSIST, CascadeType.MERGE},\n" +" mappedBy = \"employees\",\n" +" targetEntity = Employer.class\n" +" )\n" +" public Collection getEmployers() {\n" +" return employers;\n" +" }\n" +"}" +msgstr "" + +#. Tag: para +#: collection_mapping.xml:910 +#, no-c-format +msgid "" +"In this example @JoinTable defines a name, an array of join columns, and an array of inverse join columns. " +"The latter ones are the columns of the association table which refer to the " +"Employee primary key (the \"other side\"). As seen " +"previously, the other side don't have to (must not) describe the physical " +"mapping: a simple mappedBy argument containing the owner " +"side property name bind the two." +msgstr "" + +#. Tag: para +#: collection_mapping.xml:919 +#, no-c-format +msgid "" +"As any other annotations, most values are guessed in a many to many " +"relationship. Without describing any physical mapping in a unidirectional " +"many to many the following rules applied. The table name is the " +"concatenation of the owner table name, _ and the other side " +"table name. The foreign key name(s) referencing the owner table is the " +"concatenation of the owner table name, _ and the owner " +"primary key column(s). The foreign key name(s) referencing the other side is " +"the concatenation of the owner property name, _, and the " +"other side primary key column(s). These are the same rules used for a " +"unidirectional one to many relationship." +msgstr "" + +#. Tag: title +#: collection_mapping.xml:932 +#, no-c-format +msgid "Default values for @ManyToMany (uni-directional)" +msgstr "" + +#. Tag: programlisting +#: collection_mapping.xml:935 +#, no-c-format +msgid "" +"@Entity\n" +"public class Store {\n" +" @ManyToMany(cascade = CascadeType.PERSIST)\n" +" public Set<City> getImplantedIn() {\n" +" ...\n" +" }\n" +"}\n" +"\n" +"@Entity\n" +"public class City {\n" +" ... //no bidirectional relationship\n" +"}" +msgstr "" + +#. Tag: para +#: collection_mapping.xml:938 +#, no-c-format +msgid "" +"A Store_City is used as the join table. The " +"Store_id column is a foreign key to the Store table. The implantedIn_id column is a foreign " +"key to the City table." +msgstr "" + +#. Tag: para +#: collection_mapping.xml:943 +#, no-c-format +msgid "" +"Without describing any physical mapping in a bidirectional many to many the " +"following rules applied. The table name is the concatenation of the owner " +"table name, _ and the other side table name. The foreign " +"key name(s) referencing the owner table is the concatenation of the other " +"side property name, _, and the owner primary key column(s). " +"The foreign key name(s) referencing the other side is the concatenation of " +"the owner property name, _, and the other side primary key " +"column(s). These are the same rules used for a unidirectional one to many " +"relationship." +msgstr "" + +#. Tag: title +#: collection_mapping.xml:955 +#, no-c-format +msgid "Default values for @ManyToMany (bi-directional)" +msgstr "" + +#. Tag: programlisting +#: collection_mapping.xml:958 +#, no-c-format +msgid "" +"@Entity\n" +"public class Store {\n" +" @ManyToMany(cascade = {CascadeType.PERSIST, CascadeType.MERGE})\n" +" public Set<Customer> getCustomers() {\n" +" ...\n" +" }\n" +"}\n" +"\n" +"@Entity\n" +"public class Customer {\n" +" @ManyToMany(mappedBy=\"customers\")\n" +" public Set<Store> getStores() {\n" +" ...\n" +" }\n" +"}" +msgstr "" + +#. Tag: para +#: collection_mapping.xml:961 +#, no-c-format +msgid "" +"A Store_Customer is used as the join table. The " +"stores_id column is a foreign key to the Store table. The customers_id column is a foreign key " +"to the Customer table." +msgstr "" + +#. Tag: para +#: collection_mapping.xml:966 +#, fuzzy, no-c-format +msgid "" +"Using Hibernate mapping files you can map a bidirectional many-to-many " +"association by mapping two many-to-many associations to the same database " +"table and declaring one end as inverse." +msgstr "" +"要建立一个双向的多对多关联,只需要映射两个 many-to-many 关联到同一个数据库表" +"中,并再定义其中的一端为 inverse(使用哪一端要根据你的选" +"择,但它不能是一个索引集合)。 " + +#. Tag: para +#: collection_mapping.xml:970 +#, no-c-format +msgid "You cannot select an indexed collection." +msgstr "" + +#. Tag: para +#: collection_mapping.xml:973 +#, fuzzy, no-c-format +msgid "" +"shows a bidirectional many-to-many association that illustrates how each " +"category can have many items and each item can be in many categories:" +msgstr "" +"这里有一个 many-to-many 的双向关联的例子;每一个 category 都可以有很多 items," +"每一个 items 可以属于很多 categories: " + +#. Tag: title +#: collection_mapping.xml:979 +#, no-c-format +msgid "Many to many association using Hibernate mapping files" +msgstr "" + +#. Tag: programlisting +#: collection_mapping.xml:981 +#, fuzzy, no-c-format +msgid "" +"<class name=\"Category\">\n" +" <id name=\"id\" column=\"CATEGORY_ID\"/>\n" +" ...\n" +" <bag name=\"items\" table=\"CATEGORY_ITEM\">\n" +" <key column=\"CATEGORY_ID\"/>\n" +" <many-to-many class=\"Item\" column=\"ITEM_ID\"/>\n" +" </bag>\n" +"</class>\n" +"\n" +"<class name=\"Item\">\n" +" <id name=\"id\" column=\"ITEM_ID\"/>\n" +" ...\n" +"\n" +" <!-- inverse end -->\n" +" <bag name=\"categories\" table=\"CATEGORY_ITEM\" inverse=\"true" +"\">\n" +" <key column=\"ITEM_ID\"/>\n" +" <many-to-many class=\"Category\" column=\"CATEGORY_ID\"/>\n" +" </bag>\n" +"</class>" +msgstr "" +"\n" +" \n" +" ...\n" +" \n" +" \n" +" \n" +" \n" +"\n" +"\n" +"\n" +" \n" +" ...\n" +"\n" +" \n" +" \n" +" \n" +" \n" +" \n" +"]]>" + +#. Tag: para +#: collection_mapping.xml:984 +#, no-c-format +msgid "" +"Changes made only to the inverse end of the association are not persisted. This means that Hibernate has two representations in " +"memory for every bidirectional association: one link from A to B and another " +"link from B to A. This is easier to understand if you think about the Java " +"object model and how a many-to-many relationship in Javais created:" +msgstr "" +"如果只对关联的反向端进行了改变,这个改变不会被持久化。 " +"这表示 Hibernate 为每个双向关联在内存中存在两次表现,一个从 A 连接到 B,另一" +"个从 B 连接到 A。如果你回想一下 Java 对象模型,我们是如何在 Java 中创建多对多" +"关系的,这可以让你更容易理解: " + +#. Tag: title +#: collection_mapping.xml:992 +#, fuzzy, no-c-format +msgid "Effect of inverse vs. non-inverse side of many to many associations" +msgstr "" +"值集合于多对多关联(Collections of values and many-to-many associations)" + +#. Tag: programlisting +#: collection_mapping.xml:995 +#, fuzzy, no-c-format +msgid "" +"category.getItems().add(item); // The category now \"knows\" about " +"the relationship\n" +"item.getCategories().add(category); // The item now \"knows\" about the " +"relationship\n" +"\n" +"session.persist(item); // The relationship won't be " +"saved!\n" +"session.persist(category); // The relationship will be saved" +msgstr "" +"" + +#. Tag: para +#: collection_mapping.xml:998 +#, no-c-format +msgid "" +"The non-inverse side is used to save the in-memory representation to the " +"database." +msgstr "非反向端用于把内存中的表示保存到数据库中。" + +#. Tag: title +#: collection_mapping.xml:1003 #, no-c-format msgid "Bidirectional associations with indexed collections" msgstr "双向关联,涉及有序集合类" #. Tag: para -#, no-c-format -msgid "A bidirectional association where one end is represented as a <list> or <map>, requires special consideration. If there is a property of the child class that maps to the index column you can use inverse=\"true\" on the collection mapping:" -msgstr "对于有一端是 <list> 或者 <map> 的双向关联,需要加以特别考虑。假若子类中的一个属性映射到索引字段,没问题,我们仍然可以在集合类映射上使用 inverse=\"true\": " +#: collection_mapping.xml:1005 +#, fuzzy, no-c-format +msgid "" +"There are some additional considerations for bidirectional mappings with " +"indexed collections (where one end is represented as a <list>" +" or <map>) when using Hibernate mapping " +"files. If there is a property of the child class that maps to the index " +"column you can use inverse=\"true\" on the collection " +"mapping:" +msgstr "" +"对于有一端是 <list> 或者 <map> 的双向关联,需要加以特别考虑。假若子类中的一个属性映射到索引字段,没" +"问题,我们仍然可以在集合类映射上使用 inverse=\"true\": " + +#. Tag: title +#: collection_mapping.xml:1013 +#, fuzzy, no-c-format +msgid "Bidirectional association with indexed collection" +msgstr "双向关联,涉及有序集合类" + +#. Tag: programlisting +#: collection_mapping.xml:1015 +#, fuzzy, no-c-format +msgid "" +"<class name=\"Parent\">\n" +" <id name=\"id\" column=\"parent_id\"/>\n" +" ....\n" +" <map name=\"children\" inverse=\"true\">\n" +" <key column=\"parent_id\"/>\n" +" <map-key column=\"name\" \n" +" type=\"string\"/>\n" +" <one-to-many class=\"Child\"/>\n" +" </map>\n" +"</class>\n" +"\n" +"<class name=\"Child\">\n" +" <id name=\"id\" column=\"child_id\"/>\n" +" ....\n" +" <property name=\"name\" \n" +" not-null=\"true\"/>\n" +" <many-to-one name=\"parent\" \n" +" class=\"Parent\" \n" +" column=\"parent_id\"\n" +" not-null=\"true\"/>\n" +"</class>" +msgstr "" +"\n" +" \n" +" ....\n" +" \n" +" \n" +" \n" +" \n" +" \n" +"\n" +"\n" +"\n" +" \n" +" ....\n" +" \n" +" \n" +"]]>" #. Tag: para +#: collection_mapping.xml:1018 #, no-c-format -msgid "If there is no such property on the child class, the association cannot be considered truly bidirectional. That is, there is information available at one end of the association that is not available at the other end. In this case, you cannot map the collection inverse=\"true\". Instead, you could use the following mapping:" -msgstr "但是,假若子类中没有这样的属性存在,我们不能认为这个关联是真正的双向关联(信息不对称,在关联的一端有一些另外一端没有的信息)。在这种情况下,我们不能使用 inverse=\"true\"。我们需要这样用: " +msgid "" +"If there is no such property on the child class, the association cannot be " +"considered truly bidirectional. That is, there is information available at " +"one end of the association that is not available at the other end. In this " +"case, you cannot map the collection inverse=\"true\". " +"Instead, you could use the following mapping:" +msgstr "" +"但是,假若子类中没有这样的属性存在,我们不能认为这个关联是真正的双向关联(信" +"息不对称,在关联的一端有一些另外一端没有的信息)。在这种情况下,我们不能使用 " +"inverse=\"true\"。我们需要这样用: " + +#. Tag: title +#: collection_mapping.xml:1026 +#, fuzzy, no-c-format +msgid "Bidirectional association with indexed collection, but no index column" +msgstr "双向关联,涉及有序集合类" + +#. Tag: programlisting +#: collection_mapping.xml:1029 +#, fuzzy, no-c-format +msgid "" +"<class name=\"Parent\">\n" +" <id name=\"id\" column=\"parent_id\"/>\n" +" ....\n" +" <map name=\"children\">\n" +" <key column=\"parent_id\"\n" +" not-null=\"true\"/>\n" +" <map-key column=\"name\" \n" +" type=\"string\"/>\n" +" <one-to-many class=\"Child\"/>\n" +" </map>\n" +"</class>\n" +"\n" +"<class name=\"Child\">\n" +" <id name=\"id\" column=\"child_id\"/>\n" +" ....\n" +" <many-to-one name=\"parent\" \n" +" class=\"Parent\" \n" +" column=\"parent_id\"\n" +" insert=\"false\"\n" +" update=\"false\"\n" +" not-null=\"true\"/>\n" +"</class>" +msgstr "" +"\n" +" \n" +" ....\n" +" \n" +" \n" +" \n" +" \n" +" \n" +"\n" +"\n" +"\n" +" \n" +" ....\n" +" \n" +"]]>" #. Tag: para +#: collection_mapping.xml:1032 #, no-c-format -msgid "Note that in this mapping, the collection-valued end of the association is responsible for updates to the foreign key." +msgid "" +"Note that in this mapping, the collection-valued end of the association is " +"responsible for updates to the foreign key." msgstr "注意在这个映射中,关联中集合类\"值\"一端负责来更新外键。" #. Tag: title +#: collection_mapping.xml:1037 #, no-c-format msgid "Ternary associations" msgstr "三重关联(Ternary associations)" #. Tag: para +#: collection_mapping.xml:1039 #, no-c-format -msgid "There are three possible approaches to mapping a ternary association. One approach is to use a Map with an association as its index:" -msgstr "有三种可能的途径来映射一个三重关联。第一种是使用一个 Map,把一个关联作为其索引: " - -#. Tag: para -#, no-c-format -msgid "A second approach is to remodel the association as an entity class. This is the most common approach." -msgstr "第二种方法是简单的把关联重新建模为一个实体类。这使我们最经常使用的方法。 " - -#. Tag: para -#, no-c-format -msgid "A final alternative is to use composite elements, which will be discussed later." -msgstr "最后一种选择是使用复合元素,我们会在后面讨论。" +msgid "" +"There are three possible approaches to mapping a ternary association. One " +"approach is to use a Map with an association as its index:" +msgstr "" +"有三种可能的途径来映射一个三重关联。第一种是使用一个 Map," +"把一个关联作为其索引: " #. Tag: title +#: collection_mapping.xml:1044 +#, fuzzy, no-c-format +msgid "Ternary association mapping" +msgstr "三重关联(Ternary associations)" + +#. Tag: programlisting +#: collection_mapping.xml:1046 #, no-c-format -msgid "Using an <idbag>" +msgid "" +"@Entity\n" +"public class Company {\n" +" @Id \n" +" int id;\n" +" ...\n" +" @OneToMany // unidirectional\n" +" @MapKeyJoinColumn(name=\"employee_id\")\n" +" Map<Employee, Contract> contracts;\n" +"}\n" +"\n" +"// or\n" +"\n" +"<map name=\"contracts\">\n" +" <key column=\"employer_id\" not-null=\"true\"/>\n" +" <map-key-many-to-many column=\"employee_id\" class=\"Employee\"/>\n" +" <one-to-many class=\"Contract\"/>\n" +"</map>" +msgstr "" + +#. Tag: para +#: collection_mapping.xml:1049 +#, fuzzy, no-c-format +msgid "" +"A second approach is to remodel the association as an entity class. This is " +"the most common approach. A final alternative is to use composite elements, " +"which will be discussed later." +msgstr "" +"第二种方法是简单的把关联重新建模为一个实体类。这使我们最经常使用的方法。 " + +#. Tag: literal +#: collection_mapping.xml:1055 +#, fuzzy, no-c-format +msgid "Using an <idbag>" msgstr "使用 an <idbag> " #. Tag: para -#, no-c-format -msgid "The majority of the many-to-many associations and collections of values shown previously all map to tables with composite keys, even though it has been have suggested that entities should have synthetic identifiers (surrogate keys). A pure association table does not seem to benefit much from a surrogate key, although a collection of composite values might. It is for this reason that Hibernate provides a feature that allows you to map many-to-many associations and collections of values to a table with a surrogate key." -msgstr "如果你完全信奉我们对于“联合主键(composite keys)是个坏东西”,和“实体应该使用(无机的)自己生成的代用标识符(surrogate keys)”的观点,也许你会感到有一些奇怪,我们目前为止展示的多对多关联和值集合都是映射成为带有联合主键的表的!现在,这一点非常值得争辩;看上去一个单纯的关联表并不能从代用标识符中获得什么好处(虽然使用组合值的集合可能会获得一点好处)。不过,Hibernate 提供了一个(一点点试验性质的)功能,让你把多对多关联和值集合应得到一个使用代用标识符的表去。 " +#: collection_mapping.xml:1057 +#, fuzzy, no-c-format +msgid "" +"The majority of the many-to-many associations and collections of values " +"shown previously all map to tables with composite keys, even though it has " +"been suggested that entities should have synthetic identifiers (surrogate " +"keys). A pure association table does not seem to benefit much from a " +"surrogate key, although a collection of composite values might. For this reason Hibernate provides a feature that allows you to " +"map many-to-many associations and collections of values to a table with a " +"surrogate key." +msgstr "" +"如果你完全信奉我们对于“联合主键(composite keys)是个坏东西”,和“实体应该使用" +"(无机的)自己生成的代用标识符(surrogate keys)”的观点,也许你会感到有一些奇" +"怪,我们目前为止展示的多对多关联和值集合都是映射成为带有联合主键的表的!现" +"在,这一点非常值得争辩;看上去一个单纯的关联表并不能从代用标识符中获得什么好" +"处(虽然使用组合值的集合可能会获得一点好处)。不过," +"Hibernate 提供了一个(一点点试验性质的)功能,让你把多对多关联和值集合应得到" +"一个使用代用标识符的表去。 " #. Tag: para +#: collection_mapping.xml:1066 #, no-c-format -msgid "The <idbag> element lets you map a List (or Collection) with bag semantics. For example:" -msgstr "<idbag> 属性让你使用 bag 语义来映射一个 List (或 Collection)。 " +msgid "" +"The <idbag> element lets you map a List (or Collection) with bag semantics. For example:" +msgstr "" +"<idbag> 属性让你使用 bag 语义来映射一个 " +"List (或 Collection)。 " + +#. Tag: programlisting +#: collection_mapping.xml:1070 +#, fuzzy, no-c-format +msgid "" +"<idbag name=\"lovers\" table=\"LOVERS\">\n" +" <collection-id column=\"ID\" type=\"long\">\n" +" <generator class=\"sequence\"/>\n" +" </collection-id>\n" +" <key column=\"PERSON1\"/>\n" +" <many-to-many column=\"PERSON2\" class=\"Person\" fetch=\"join\"/" +">\n" +"</idbag>" +msgstr "" +"\n" +" \n" +" \n" +" \n" +" \n" +" \n" +"]]>" #. Tag: para +#: collection_mapping.xml:1072 #, no-c-format -msgid "An <idbag> has a synthetic id generator, just like an entity class. A different surrogate key is assigned to each collection row. Hibernate does not, however, provide any mechanism for discovering the surrogate key value of a particular row." -msgstr "你可以理解,<idbag> 人工的 id 生成器,就好像是实体类一样!集合的每一行都有一个不同的人造关键字。但是,Hibernate 没有提供任何机制来让你取得某个特定行的人造关键字。 " +msgid "" +"An <idbag> has a synthetic id generator, just like " +"an entity class. A different surrogate key is assigned to each collection " +"row. Hibernate does not, however, provide any mechanism for discovering the " +"surrogate key value of a particular row." +msgstr "" +"你可以理解,<idbag> 人工的 id 生成器,就好像是实体类" +"一样!集合的每一行都有一个不同的人造关键字。但是,Hibernate 没有提供任何机制" +"来让你取得某个特定行的人造关键字。 " #. Tag: para +#: collection_mapping.xml:1077 #, no-c-format -msgid "The update performance of an <idbag> supersedes a regular <bag>. Hibernate can locate individual rows efficiently and update or delete them individually, similar to a list, map or set." -msgstr "注意 <idbag> 的更新性能要比普通的 <bag> 高得多!Hibernate 可以有效的定位到不同的行,分别进行更新或删除工作,就如同处理一个 list,map 或者 set 一样。 " +msgid "" +"The update performance of an <idbag> supersedes a " +"regular <bag>. Hibernate can locate individual rows " +"efficiently and update or delete them individually, similar to a list, map " +"or set." +msgstr "" +"注意 <idbag> 的更新性能要比普通的 <" +"bag> 高得多!Hibernate 可以有效的定位到不同的行,分别进行更新或" +"删除工作,就如同处理一个 list,map 或者 set 一样。 " #. Tag: para +#: collection_mapping.xml:1082 #, no-c-format -msgid "In the current implementation, the native identifier generation strategy is not supported for <idbag> collection identifiers." -msgstr "在目前的实现中,还不支持使用 identity 标识符生成器策略来生成 <idbag> 集合的标识符。" +msgid "" +"In the current implementation, the native identifier " +"generation strategy is not supported for <idbag> " +"collection identifiers." +msgstr "" +"在目前的实现中,还不支持使用 identity 标识符生成器策略来生" +"成 <idbag> 集合的标识符。" #. Tag: title +#: collection_mapping.xml:1103 #, no-c-format msgid "Collection examples" msgstr "集合例子(Collection example)" #. Tag: para +#: collection_mapping.xml:1105 #, no-c-format msgid "This section covers collection examples." msgstr "集合例子(Collection example)。" #. Tag: para +#: collection_mapping.xml:1107 #, no-c-format -msgid "The following class has a collection of Child instances:" +msgid "" +"The following class has a collection of Child instances:" msgstr "下面的代码是用来添加一个新的 Child:" -#. Tag: para +#. Tag: title +#: collection_mapping.xml:1111 #, no-c-format -msgid "If each child has, at most, one parent, the most natural mapping is a one-to-many association:" -msgstr "这个类有一个 Child 的实例集合。如果每一个子实例至多有一个父实例,那么最自然的映射是一个 one-to-many 的关联关系: " +msgid "" +"Example classes Parent and Child" +msgstr "" + +#. Tag: programlisting +#: collection_mapping.xml:1114 +#, no-c-format +msgid "" +"public class Parent {\n" +" private long id;\n" +" private Set<Child> children;\n" +"\n" +" // getter/setter\n" +" ...\n" +"}\n" +"\n" +"\n" +"public class Child {\n" +" private long id;\n" +" private String name\n" +"\n" +" \n" +" // getter/setter\n" +" ...\n" +"}" +msgstr "" #. Tag: para +#: collection_mapping.xml:1117 +#, no-c-format +msgid "" +"If each child has, at most, one parent, the most natural mapping is a one-to-" +"many association:" +msgstr "" +"这个类有一个 Child 的实例集合。如果每一个子实例至多有一个" +"父实例,那么最自然的映射是一个 one-to-many 的关联关系: " + +#. Tag: title +#: collection_mapping.xml:1121 +#, no-c-format +msgid "" +"One to many unidirectional Parent-Child relationship " +"using annotations" +msgstr "" + +#. Tag: programlisting +#: collection_mapping.xml:1124 +#, no-c-format +msgid "" +"public class Parent {\n" +" @Id\n" +" @GeneratedValue\n" +" private long id;\n" +"\n" +" @OneToMany\n" +" private Set<Child> children;\n" +"\n" +" // getter/setter\n" +" ...\n" +"}\n" +"\n" +"\n" +"public class Child {\n" +" @Id\n" +" @GeneratedValue\n" +" private long id;\n" +" private String name;\n" +"\n" +" \n" +" // getter/setter\n" +" ...\n" +"}" +msgstr "" + +#. Tag: title +#: collection_mapping.xml:1128 +#, no-c-format +msgid "" +"One to many unidirectional Parent-Child relationship " +"using mapping files" +msgstr "" + +#. Tag: programlisting +#: collection_mapping.xml:1131 +#, fuzzy, no-c-format +msgid "" +"<hibernate-mapping>\n" +"\n" +" <class name=\"Parent\">\n" +" <id name=\"id\">\n" +" <generator class=\"sequence\"/>\n" +" </id>\n" +" <set name=\"children\">\n" +" <key column=\"parent_id\"/>\n" +" <one-to-many class=\"Child\"/>\n" +" </set>\n" +" </class>\n" +"\n" +" <class name=\"Child\">\n" +" <id name=\"id\">\n" +" <generator class=\"sequence\"/>\n" +" </id>\n" +" <property name=\"name\"/>\n" +" </class>\n" +"\n" +"</hibernate-mapping>" +msgstr "" +"\n" +"\n" +" \n" +" \n" +" \n" +" \n" +" \n" +" \n" +" \n" +" \n" +" \n" +"\n" +" \n" +" \n" +" \n" +" \n" +" \n" +" \n" +"\n" +"]]>" + +#. Tag: para +#: collection_mapping.xml:1134 #, no-c-format msgid "This maps to the following table definitions:" msgstr "在以下的表定义中反应了这个映射关系:" -#. Tag: para +#. Tag: title +#: collection_mapping.xml:1137 #, no-c-format -msgid "If the parent is required, use a bidirectional one-to-many association:" -msgstr "如果父亲是必须的,那么就可以使用双向 one-to-many 的关联了:" +msgid "" +"Table definitions for unidirectional Parent-" +"Child relationship" +msgstr "" + +#. Tag: programlisting +#: collection_mapping.xml:1141 +#, fuzzy, no-c-format +msgid "" +"create table parent ( id bigint not null primary key )\n" +"create table child ( id bigint not null primary key, name varchar(255), " +"parent_id bigint )\n" +"alter table child add constraint childfk0 (parent_id) references parent" +msgstr "" +"" #. Tag: para +#: collection_mapping.xml:1144 +#, no-c-format +msgid "" +"If the parent is required, use a bidirectional one-to-" +"many association:" +msgstr "" +"如果父亲是必须的,那么就可以使用双向 one-to-many 的关联" +"了:" + +#. Tag: title +#: collection_mapping.xml:1148 +#, no-c-format +msgid "" +"One to many bidirectional Parent-Child relationship " +"using annotations" +msgstr "" + +#. Tag: programlisting +#: collection_mapping.xml:1151 +#, no-c-format +msgid "" +"public class Parent {\n" +" @Id\n" +" @GeneratedValue\n" +" private long id;\n" +"\n" +" @OneToMany(mappedBy=\"parent\")\n" +" private Set<Child> children;\n" +"\n" +" // getter/setter\n" +" ...\n" +"}\n" +"\n" +"\n" +"public class Child {\n" +" @Id\n" +" @GeneratedValue\n" +" private long id;\n" +"\n" +" private String name;\n" +" \n" +" @ManyToOne\n" +" private Parent parent;\n" +"\n" +" \n" +" // getter/setter\n" +" ...\n" +"}" +msgstr "" + +#. Tag: title +#: collection_mapping.xml:1155 +#, no-c-format +msgid "" +"One to many bidirectional Parent-Child relationship " +"using mapping files" +msgstr "" + +#. Tag: programlisting +#: collection_mapping.xml:1158 +#, fuzzy, no-c-format +msgid "" +"<hibernate-mapping>\n" +"\n" +" <class name=\"Parent\">\n" +" <id name=\"id\">\n" +" <generator class=\"sequence\"/>\n" +" </id>\n" +" <set name=\"children\" inverse=\"true\">\n" +" <key column=\"parent_id\"/>\n" +" <one-to-many class=\"Child\"/>\n" +" </set>\n" +" </class>\n" +"\n" +" <class name=\"Child\">\n" +" <id name=\"id\">\n" +" <generator class=\"sequence\"/>\n" +" </id>\n" +" <property name=\"name\"/>\n" +" <many-to-one name=\"parent\" class=\"Parent\" column=\"parent_id" +"\" not-null=\"true\"/>\n" +" </class>\n" +"\n" +"</hibernate-mapping>" +msgstr "" +"\n" +"\n" +" \n" +" \n" +" \n" +" \n" +" \n" +" \n" +" \n" +" \n" +" \n" +"\n" +" \n" +" \n" +" \n" +" \n" +" \n" +" \n" +" \n" +"\n" +"]]>" + +#. Tag: para +#: collection_mapping.xml:1161 #, no-c-format msgid "Notice the NOT NULL constraint:" msgstr "请注意 NOT NULL 的约束:" -#. Tag: para +#. Tag: title +#: collection_mapping.xml:1164 #, no-c-format -msgid "Alternatively, if this association must be unidirectional you can declare the NOT NULL constraint on the <key> mapping:" -msgstr "另外,如果你绝对坚持这个关联应该是单向的,你可以对 <key> 映射声明 NOT NULL 约束: " +msgid "" +"Table definitions for bidirectional Parent-" +"Child relationship" +msgstr "" + +#. Tag: programlisting +#: collection_mapping.xml:1168 +#, fuzzy, no-c-format +msgid "" +"create table parent ( id bigint not null primary key )\n" +"create table child ( id bigint not null\n" +" primary key,\n" +" name varchar(255),\n" +" parent_id bigint not null )\n" +"alter table child add constraint childfk0 (parent_id) references parent" +msgstr "" +"" #. Tag: para +#: collection_mapping.xml:1171 +#, fuzzy, no-c-format +msgid "" +"Alternatively, if this association must be unidirectional you can enforce " +"the NOT NULL constraint." +msgstr "" +"另外,如果你绝对坚持这个关联应该是单向的,你可以对 <key> 映射声明 NOT NULL 约束: " + +#. Tag: title +#: collection_mapping.xml:1175 #, no-c-format -msgid "On the other hand, if a child has multiple parents, a many-to-many association is appropriate:" -msgstr "另外一方面,如果一个子实例可能有多个父实例,那么就应该使用 many-to-many 关联: " +msgid "" +"Enforcing NOT NULL constraint in unidirectional relation using annotations" +msgstr "" + +#. Tag: programlisting +#: collection_mapping.xml:1178 +#, no-c-format +msgid "" +"public class Parent {\n" +" @Id\n" +" @GeneratedValue\n" +" private long id;\n" +"\n" +" @OneToMany(optional=false)\n" +" private Set<Child> children;\n" +"\n" +" // getter/setter\n" +" ...\n" +"}\n" +"\n" +"\n" +"public class Child {\n" +" @Id\n" +" @GeneratedValue\n" +" private long id;\n" +" private String name;\n" +"\n" +" \n" +" // getter/setter\n" +" ...\n" +"}" +msgstr "" + +#. Tag: title +#: collection_mapping.xml:1182 +#, no-c-format +msgid "" +"Enforcing NOT NULL constraint in unidirectional relation using mapping files" +msgstr "" + +#. Tag: programlisting +#: collection_mapping.xml:1185 +#, fuzzy, no-c-format +msgid "" +"<hibernate-mapping>\n" +"\n" +" <class name=\"Parent\">\n" +" <id name=\"id\">\n" +" <generator class=\"sequence\"/>\n" +" </id>\n" +" <set name=\"children\">\n" +" <key column=\"parent_id\" not-null=\"true\"/>\n" +" <one-to-many class=\"Child\"/>\n" +" </set>\n" +" </class>\n" +"\n" +" <class name=\"Child\">\n" +" <id name=\"id\">\n" +" <generator class=\"sequence\"/>\n" +" </id>\n" +" <property name=\"name\"/>\n" +" </class>\n" +"\n" +"</hibernate-mapping>" +msgstr "" +"\n" +"\n" +" \n" +" \n" +" \n" +" \n" +" \n" +" \n" +" \n" +" \n" +" \n" +"\n" +" \n" +" \n" +" \n" +" \n" +" \n" +" \n" +"\n" +"]]>" #. Tag: para +#: collection_mapping.xml:1188 +#, fuzzy, no-c-format +msgid "" +"On the other hand, if a child has multiple parents, a many-to-many " +"association is appropriate." +msgstr "" +"另外一方面,如果一个子实例可能有多个父实例,那么就应该使用 many-to-many 关" +"联: " + +#. Tag: title +#: collection_mapping.xml:1192 +#, no-c-format +msgid "" +"Many to many Parent-Child relationship using " +"annotations" +msgstr "" + +#. Tag: programlisting +#: collection_mapping.xml:1195 +#, no-c-format +msgid "" +"public class Parent {\n" +" @Id\n" +" @GeneratedValue\n" +" private long id;\n" +"\n" +" @ManyToMany\n" +" private Set<Child> children;\n" +"\n" +" // getter/setter\n" +" ...\n" +"}\n" +"\n" +"\n" +"public class Child {\n" +" @Id\n" +" @GeneratedValue\n" +" private long id;\n" +"\n" +" private String name;\n" +"\n" +" \n" +" // getter/setter\n" +" ...\n" +"}" +msgstr "" + +#. Tag: title +#: collection_mapping.xml:1199 +#, no-c-format +msgid "" +"Many to many Parent-Child relationship using mapping " +"files" +msgstr "" + +#. Tag: programlisting +#: collection_mapping.xml:1202 +#, fuzzy, no-c-format +msgid "" +"<hibernate-mapping>\n" +"\n" +" <class name=\"Parent\">\n" +" <id name=\"id\">\n" +" <generator class=\"sequence\"/>\n" +" </id>\n" +" <set name=\"children\" table=\"childset\">\n" +" <key column=\"parent_id\"/>\n" +" <many-to-many class=\"Child\" column=\"child_id\"/>\n" +" </set>\n" +" </class>\n" +"\n" +" <class name=\"Child\">\n" +" <id name=\"id\">\n" +" <generator class=\"sequence\"/>\n" +" </id>\n" +" <property name=\"name\"/>\n" +" </class>\n" +"\n" +"</hibernate-mapping>" +msgstr "" +"\n" +"\n" +" \n" +" \n" +" \n" +" \n" +" \n" +" \n" +" \n" +" \n" +" \n" +"\n" +" \n" +" \n" +" \n" +" \n" +" \n" +" \n" +"\n" +"]]>" + +#. Tag: para +#: collection_mapping.xml:1205 #, no-c-format msgid "Table definitions:" msgstr "表定义:" -#. Tag: para +#. Tag: title +#: collection_mapping.xml:1208 #, no-c-format -msgid "For more examples and a complete explanation of a parent/child relationship mapping, see for more information." -msgstr "更多的例子,以及一个完整的父/子关系映射的排练,请参阅 。 " +msgid "Table definitions for many to many releationship" +msgstr "" + +#. Tag: programlisting +#: collection_mapping.xml:1210 +#, fuzzy, no-c-format +msgid "" +"create table parent ( id bigint not null primary key )\n" +"create table child ( id bigint not null primary key, name varchar(255) )\n" +"create table childset ( parent_id bigint not null,\n" +" child_id bigint not null,\n" +" primary key ( parent_id, child_id ) )\n" +"alter table childset add constraint childsetfk0 (parent_id) references " +"parent\n" +"alter table childset add constraint childsetfk1 (child_id) references child" +msgstr "" +"" #. Tag: para -#, no-c-format -msgid "Even more complex association mappings are covered in the next chapter." -msgstr "甚至可能出现更加复杂的关联映射,我们会在下一章中列出所有可能性。 " +#: collection_mapping.xml:1213 +#, fuzzy, no-c-format +msgid "" +"For more examples and a complete explanation of a parent/child relationship " +"mapping, see for more information. " +"Even more complex association mappings are covered in the next chapter." +msgstr "" +"更多的例子,以及一个完整的父/子关系映射的排练,请参阅 。 " #~ msgid "" -#~ "" +#~ "Hibernate requires that persistent collection-valued fields be declared " +#~ "as an interface type. For example:" #~ msgstr "" -#~ "" +#~ "(译者注:在阅读本章的时候,以后整个手册的阅读过程中,我们都会面临一个名词" +#~ "方面的问题,那就是“集合”。\"Collections\" 和 \"Set\" 在中文里对应都被翻译" +#~ "为“集合”,但是他们的含义很不一样。Collections 是一个超集,Set 是其中的一" +#~ "种。大部分情况下,本译稿中泛指的未加英文注明的“集合”,都应当理解" +#~ "为“Collections”。在有些二者同时出现,可能造成混淆的地方,我们用“集合类”来" +#~ "特指“Collecions”,“集合(Set)”来指 \"Set\",一般都会在后面的括号中给出英" +#~ "文。希望大家在阅读时联系上下文理解,不要造成误解。 与此同时,“元素”一词对" +#~ "应的英文“element”,也有两个不同的含义。其一为集合的元素,是内存中的一个变" +#~ "量;另一含义则是 XML 文档中的一个标签所代表的元素。也请注意区别。本章中," +#~ "特别是后半部分是需要反复阅读才能理解清楚的。如果遇到任何疑问,请记住,英文" +#~ "版本的 reference 是惟一标准的参考资料。) Hibernate 要求持久化集合值字段必" +#~ "须声明为接口,例如:" + +#~ msgid "Collection mappings" +#~ msgstr "集合映射( Collection mappings )" #~ msgid "" -#~ "" +#~ "There are quite a range of mappings that can be generated for collections " +#~ "that cover many common relational models. We suggest you experiment with " +#~ "the schema generation tool so that you understand how various mapping " +#~ "declarations translate to database tables." #~ msgstr "" -#~ "" +#~ "从集合类可以产生很大一部分映射,覆盖了很多常见的关系模型。我们建议你试验 " +#~ "schema 生成工具,来体会一下不同的映射声明是如何被翻译为数据库表的。 " + +#~ msgid "Collection elements" +#~ msgstr "集合元素(Collection elements)" #~ msgid "" -#~ "\n" -#~ " \n" -#~ " \n" -#~ " \n" -#~ " \n" -#~ " \n" -#~ "]]>" +#~ "The contained type is referred to as the collection element " +#~ "type. Collection elements are mapped by <" +#~ "element> or <composite-element>, or " +#~ "in the case of entity references, with <one-to-many> or <many-to-many>. The first two map " +#~ "elements with value semantics, the next two are used to map entity " +#~ "associations." #~ msgstr "" -#~ "\n" -#~ " \n" -#~ " \n" -#~ " \n" -#~ " \n" -#~ " \n" -#~ "]]>" +#~ "被包容的类型被称为集合元素类型(collection element type)。集合元素通过 <element> 或 " +#~ "<composite-element> 映射,或在其是实体引用的时" +#~ "候,通过 <one-to-many><many-to-" +#~ "many> 映射。前两种用于使用值语义映射元素,后两种用于映射实体" +#~ "关联。" #~ msgid "" -#~ "\n" -#~ "\n" -#~ " \n" -#~ " \n" -#~ " \n" -#~ "]]>" +#~ "All collection mappings, except those with set and bag semantics, need an " +#~ "index column in the collection table. An index " +#~ "column is a column that maps to an array index, or List index, or Map key. The index of a " +#~ "Map may be of any basic type, mapped with <" +#~ "map-key>. It can be an entity reference mapped with " +#~ "<map-key-many-to-many>, or it can be a composite " +#~ "type mapped with <composite-map-key>. The index " +#~ "of an array or list is always of type integer and is " +#~ "mapped using the <list-index> element. The " +#~ "mapped column contains sequential integers that are numbered from zero by " +#~ "default." #~ msgstr "" -#~ "\n" -#~ "\n" -#~ " \n" -#~ " \n" -#~ " \n" -#~ "]]>" - -#~ msgid "]]>" -#~ msgstr "]]>" +#~ "所有的集合映射,除了 set 和 bag 语义的以外,都需要指定一个集合表的" +#~ "索引字段(index column) — 用于对应到数组索引,或者 " +#~ "List 的索引,或者 Map 的关键字。通" +#~ "过 <map-key>Map 的索引可以是" +#~ "任何基础类型;若通过 <map-key-many-to-many>,它也" +#~ "可以是一个实体引用;若通过 <composite-map-key>," +#~ "它还可以是一个组合类型。数组或列表的索引必须是 integer " +#~ "类型,并且使用 <list-index> 元素定义映射。被映射" +#~ "的字段包含有顺序排列的整数(默认从 0 开始)。 " #~ msgid "" -#~ "]]>" +#~ "Any collection of values or many-to-many associations requires a " +#~ "dedicated collection table with a foreign key column " +#~ "or columns, collection element column or columns, " +#~ "and possibly an index column or columns." #~ msgstr "" -#~ "]]>" +#~ "任何值集合或者多对多关联需要专用的具有一个或多个外键字段的 " +#~ "collection table、一个或多个 collection " +#~ "element column,以及还可能有一个或多个索引字段。 " + +#~ msgid "" +#~ "A many-to-many association is specified using the " +#~ "<many-to-many> element." +#~ msgstr "" +#~ "用 <many-to-many> 元素指定 many-to-" +#~ "many association。" + +#~ msgid "" +#~ "column (optional): the name of the element foreign key " +#~ "column." +#~ msgstr "column(必需):元素外键字段的名称。 " + +#~ msgid "" +#~ "formula (optional): an SQL formula used to evaluate " +#~ "the element foreign key value." +#~ msgstr "" +#~ "formula(可选):用于对元素外键值求值的 SQL 公式。" + +#~ msgid "" +#~ "fetch (optional - defaults to join): enables outer-join or sequential select fetching for this " +#~ "association. This is a special case; for full eager fetching in a single " +#~ "SELECT of an entity and its many-to-many relationships " +#~ "to other entities, you would enable join fetching,not " +#~ "only of the collection itself, but also with this attribute on the " +#~ "<many-to-many> nested element." +#~ msgstr "" +#~ "fetch(可选 - 缺省为 join): 为这个" +#~ "关联启用外连接或序列性选择抓取。这是一个特例。对于在单个 SELECT 里进行完全的 eager fetching 以及使 <many-to-many>" +#~ " n用多对多关联,你可以启用 join fetching,这" +#~ "不仅是对于集合本身,也对 <many-to-many> 嵌套元素" +#~ "的属性。" + +#~ msgid "" +#~ "unique (optional): enables the DDL generation of a " +#~ "unique constraint for the foreign-key column. This makes the association " +#~ "multiplicity effectively one-to-many." +#~ msgstr "" +#~ "unique(可选):未外键字段启用唯一约束的 DDL 生成。这使" +#~ "得关联一对多的多样性更为有效。" + +#~ msgid "" +#~ "not-found (optional - defaults to exception): specifies how foreign keys that reference missing rows will be " +#~ "handled: ignore will treat a missing row as a null " +#~ "association." +#~ msgstr "" +#~ "not-found(可选 - 默认为 exception):指明若缓存的标示值关联的行缺失,该如何处理:ignore 会把缺失的行作为一个空关联处理。 " + +#~ msgid "" +#~ "property-ref (optional): the name of a property of the " +#~ "associated class that is joined to this foreign key. If not specified, " +#~ "the primary key of the associated class is used." +#~ msgstr "" +#~ "property-ref(可选):连接至这个外键的关联类的属性名" +#~ "称。如果未指定,关联类的主键将被使用。" + +#~ msgid "Here are some examples." +#~ msgstr "下面是一些例子:" + +#~ msgid "A set of strings:" +#~ msgstr "一系列字符串:" + +#~ msgid "" +#~ "A bag containing integers with an iteration order determined by the " +#~ "order-by attribute:" +#~ msgstr "" +#~ "包含一组整数的 bag(还设置了 order-by 参数指定了迭代的" +#~ "顺序): " + +#~ msgid "An array of entities, in this case, a many-to-many association:" +#~ msgstr "" +#~ "一个实体数组,在这个案例中是一个多对多的关联(注意这里的实体是自动管理生命" +#~ "周期的对象(lifecycle objects),cascade=\"all\"): " + +#~ msgid "A map from string indices to dates:" +#~ msgstr "一个 map,通过字符串的索引来指明日期:" + +#~ msgid "A list of components (this is discussed in the next chapter):" +#~ msgstr "一个组件的列表:(将在下一章讨论)" + +#~ msgid "One-to-many associations" +#~ msgstr "一对多关联(One-to-many Associations)" + +#~ msgid "" +#~ "A one-to-many association links the tables of two " +#~ "classes via a foreign key with no intervening collection table. This " +#~ "mapping loses certain semantics of normal Java collections:" +#~ msgstr "" +#~ "一对多关联通过外键连接两个类对应" +#~ "的表,而没有中间集合表。 这个关系模型失去了一些 Java 集合的语义:" + +#~ msgid "" +#~ "The following example shows a map of Part entities by " +#~ "name, where partName is a persistent property of " +#~ "Part. Notice the use of a formula-based index:" +#~ msgstr "" +#~ "下面的例子展示一个 Part 实体的 map,把 name 作为关键" +#~ "字。( partNamePart 的持久化属" +#~ "性)。注意其中的基于公式的索引的用法。 " + +#~ msgid "" +#~ "Hibernate supports collections implementing java.util.SortedMap and java.util.SortedSet. You must specify a " +#~ "comparator in the mapping file:" +#~ msgstr "" +#~ "Hibernate 支持实现 java.util.SortedMap 和 " +#~ "java.util.SortedSet 的集合。你必须在映射文件中指定一个" +#~ "比较器:" + +#~ msgid "" +#~ "A final alternative is to use composite elements, which will be discussed " +#~ "later." +#~ msgstr "最后一种选择是使用复合元素,我们会在后面讨论。" + +#~ msgid "" +#~ "Even more complex association mappings are covered in the next chapter." +#~ msgstr "甚至可能出现更加复杂的关联映射,我们会在下一章中列出所有可能性。 " #~ msgid "" #~ " \n" #~ "]]>" -#~ msgid "" -#~ "]]>" -#~ msgstr "" -#~ "]]>" - #~ msgid "" #~ "\n" @@ -1077,258 +3584,6 @@ msgstr "甚至可能出现更加复杂的关联映射,我们会在下一章中 #~ " \n" #~ "]]>" -#~ msgid "" -#~ "\n" -#~ " \n" -#~ " \n" -#~ "\n" -#~ "\n" -#~ "\n" -#~ " \n" -#~ " \n" -#~ " \n" -#~ "]]>" -#~ msgstr "" -#~ "\n" -#~ " \n" -#~ " \n" -#~ "\n" -#~ "\n" -#~ "\n" -#~ " \n" -#~ " \n" -#~ " \n" -#~ "]]>" - -#~ msgid "" -#~ "\n" -#~ " \n" -#~ " \n" -#~ "\n" -#~ "\n" -#~ "\n" -#~ " \n" -#~ " \n" -#~ " \n" -#~ "]]>" -#~ msgstr "" -#~ "\n" -#~ " \n" -#~ " \n" -#~ "\n" -#~ "\n" -#~ "\n" -#~ " \n" -#~ " \n" -#~ " \n" -#~ "]]>" - -#~ msgid "" -#~ "" -#~ msgstr "" -#~ "" - -#~ msgid "" -#~ "\n" -#~ " \n" -#~ " ...\n" -#~ " \n" -#~ " \n" -#~ " \n" -#~ " \n" -#~ "\n" -#~ "\n" -#~ "\n" -#~ " \n" -#~ " ...\n" -#~ "\n" -#~ " \n" -#~ " \n" -#~ " \n" -#~ " \n" -#~ " \n" -#~ "]]>" -#~ msgstr "" -#~ "\n" -#~ " \n" -#~ " ...\n" -#~ " \n" -#~ " \n" -#~ " \n" -#~ " \n" -#~ "\n" -#~ "\n" -#~ "\n" -#~ " \n" -#~ " ...\n" -#~ "\n" -#~ " \n" -#~ " \n" -#~ " \n" -#~ " \n" -#~ " \n" -#~ "]]>" - -#~ msgid "" -#~ "" -#~ msgstr "" -#~ "" - -#~ msgid "" -#~ "\n" -#~ " \n" -#~ " ....\n" -#~ " \n" -#~ " \n" -#~ " \n" -#~ " \n" -#~ "\n" -#~ "\n" -#~ "\n" -#~ " \n" -#~ " ....\n" -#~ " \n" -#~ "]]>" -#~ msgstr "" -#~ "\n" -#~ " \n" -#~ " ....\n" -#~ " \n" -#~ " \n" -#~ " \n" -#~ " \n" -#~ "\n" -#~ "\n" -#~ "\n" -#~ " \n" -#~ " ....\n" -#~ " \n" -#~ "]]>" - -#~ msgid "" -#~ "\n" -#~ " \n" -#~ " ....\n" -#~ " \n" -#~ " \n" -#~ " \n" -#~ " \n" -#~ " \n" -#~ "\n" -#~ "\n" -#~ "\n" -#~ " \n" -#~ " ....\n" -#~ " \n" -#~ " \n" -#~ "]]>" -#~ msgstr "" -#~ "\n" -#~ " \n" -#~ " ....\n" -#~ " \n" -#~ " \n" -#~ " \n" -#~ " \n" -#~ " \n" -#~ "\n" -#~ "\n" -#~ "\n" -#~ " \n" -#~ " ....\n" -#~ " \n" -#~ " \n" -#~ "]]>" - -#~ msgid "" -#~ "\n" -#~ " \n" -#~ " ....\n" -#~ " \n" -#~ " \n" -#~ " \n" -#~ " \n" -#~ " \n" -#~ "\n" -#~ "\n" -#~ "\n" -#~ " \n" -#~ " ....\n" -#~ " \n" -#~ "]]>" -#~ msgstr "" -#~ "\n" -#~ " \n" -#~ " ....\n" -#~ " \n" -#~ " \n" -#~ " \n" -#~ " \n" -#~ " \n" -#~ "\n" -#~ "\n" -#~ "\n" -#~ " \n" -#~ " ....\n" -#~ " \n" -#~ "]]>" - #~ msgid "" #~ "\n" #~ " \n" @@ -1355,23 +3610,6 @@ msgstr "甚至可能出现更加复杂的关联映射,我们会在下一章中 #~ " \n" #~ "]]>" -#~ msgid "" -#~ "\n" -#~ " \n" -#~ " \n" -#~ " \n" -#~ " \n" -#~ " \n" -#~ "]]>" -#~ msgstr "" -#~ "\n" -#~ " \n" -#~ " \n" -#~ " \n" -#~ " \n" -#~ " \n" -#~ "]]>" - #~ msgid "" #~ "" - -#~ msgid "" -#~ "\n" -#~ "\n" -#~ " \n" -#~ " \n" -#~ " \n" -#~ " \n" -#~ " \n" -#~ " \n" -#~ " \n" -#~ " \n" -#~ " \n" -#~ "\n" -#~ " \n" -#~ " \n" -#~ " \n" -#~ " \n" -#~ " \n" -#~ " \n" -#~ "\n" -#~ "]]>" -#~ msgstr "" -#~ "\n" -#~ "\n" -#~ " \n" -#~ " \n" -#~ " \n" -#~ " \n" -#~ " \n" -#~ " \n" -#~ " \n" -#~ " \n" -#~ " \n" -#~ "\n" -#~ " \n" -#~ " \n" -#~ " \n" -#~ " \n" -#~ " \n" -#~ " \n" -#~ "\n" -#~ "]]>" - -#~ msgid "" -#~ "" -#~ msgstr "" -#~ "" - -#~ msgid "" -#~ "\n" -#~ "\n" -#~ " \n" -#~ " \n" -#~ " \n" -#~ " \n" -#~ " \n" -#~ " \n" -#~ " \n" -#~ " \n" -#~ " \n" -#~ "\n" -#~ " \n" -#~ " \n" -#~ " \n" -#~ " \n" -#~ " \n" -#~ " \n" -#~ " \n" -#~ "\n" -#~ "]]>" -#~ msgstr "" -#~ "\n" -#~ "\n" -#~ " \n" -#~ " \n" -#~ " \n" -#~ " \n" -#~ " \n" -#~ " \n" -#~ " \n" -#~ " \n" -#~ " \n" -#~ "\n" -#~ " \n" -#~ " \n" -#~ " \n" -#~ " \n" -#~ " \n" -#~ " \n" -#~ " \n" -#~ "\n" -#~ "]]>" - -#~ msgid "" -#~ "" -#~ msgstr "" -#~ "" - -#~ msgid "" -#~ "\n" -#~ "\n" -#~ " \n" -#~ " \n" -#~ " \n" -#~ " \n" -#~ " \n" -#~ " \n" -#~ " \n" -#~ " \n" -#~ " \n" -#~ "\n" -#~ " \n" -#~ " \n" -#~ " \n" -#~ " \n" -#~ " \n" -#~ " \n" -#~ "\n" -#~ "]]>" -#~ msgstr "" -#~ "\n" -#~ "\n" -#~ " \n" -#~ " \n" -#~ " \n" -#~ " \n" -#~ " \n" -#~ " \n" -#~ " \n" -#~ " \n" -#~ " \n" -#~ "\n" -#~ " \n" -#~ " \n" -#~ " \n" -#~ " \n" -#~ " \n" -#~ " \n" -#~ "\n" -#~ "]]>" - -#~ msgid "" -#~ "\n" -#~ "\n" -#~ " \n" -#~ " \n" -#~ " \n" -#~ " \n" -#~ " \n" -#~ " \n" -#~ " \n" -#~ " \n" -#~ " \n" -#~ "\n" -#~ " \n" -#~ " \n" -#~ " \n" -#~ " \n" -#~ " \n" -#~ " \n" -#~ "\n" -#~ "]]>" -#~ msgstr "" -#~ "\n" -#~ "\n" -#~ " \n" -#~ " \n" -#~ " \n" -#~ " \n" -#~ " \n" -#~ " \n" -#~ " \n" -#~ " \n" -#~ " \n" -#~ "\n" -#~ " \n" -#~ " \n" -#~ " \n" -#~ " \n" -#~ " \n" -#~ " \n" -#~ "\n" -#~ "]]>" - -#~ msgid "" -#~ "" -#~ msgstr "" -#~ "" diff --git a/documentation/manual/src/main/docbook/zh-CN/content/configuration.po b/documentation/manual/src/main/docbook/zh-CN/content/configuration.po index 873be48f96..5c910476a8 100644 --- a/documentation/manual/src/main/docbook/zh-CN/content/configuration.po +++ b/documentation/manual/src/main/docbook/zh-CN/content/configuration.po @@ -5,7 +5,7 @@ msgid "" msgstr "" "Project-Id-Version: Collection_Mapping\n" "Report-Msgid-Bugs-To: http://bugs.kde.org\n" -"POT-Creation-Date: 2010-02-11T05:38:15\n" +"POT-Creation-Date: 2010-07-20 21:02+0000\n" "PO-Revision-Date: 2010-03-15 09:03+1000\n" "Last-Translator: Xi HUANG \n" "Language-Team: \n" @@ -15,1965 +15,3282 @@ msgstr "" "X-Generator: KBabel 1.11.4\n" #. Tag: title +#: configuration.xml:31 #, no-c-format msgid "Configuration" msgstr "配置" #. Tag: para +#: configuration.xml:33 #, no-c-format -msgid "Hibernate is designed to operate in many different environments and, as such, there is a broad range of configuration parameters. Fortunately, most have sensible default values and Hibernate is distributed with an example hibernate.properties file in etc/ that displays the various options. Simply put the example file in your classpath and customize it to suit your needs." -msgstr "由于 Hibernate 是为了能在各种不同环境下工作而设计的,因此存在着大量的配置参数。幸运的是多数配置参数都有比较直观的默认值,并有随 Hibernate 一同分发的配置样例 hibernate.properties(位于 etc/)来展示各种配置选项。所需做的仅仅是将这个样例文件复制到类路径(classpath)下并进行定制。" +msgid "" +"Hibernate is designed to operate in many different environments and, as " +"such, there is a broad range of configuration parameters. Fortunately, most " +"have sensible default values and Hibernate is distributed with an example " +"hibernate.properties file in etc/ that " +"displays the various options. Simply put the example file in your classpath " +"and customize it to suit your needs." +msgstr "" +"由于 Hibernate 是为了能在各种不同环境下工作而设计的,因此存在着大量的配置参" +"数。幸运的是多数配置参数都有比较直观的默认值,并有随 Hibernate 一同分发的配置" +"样例 hibernate.properties(位于 etc/)" +"来展示各种配置选项。所需做的仅仅是将这个样例文件复制到类路径(classpath)下并" +"进行定制。" #. Tag: title +#: configuration.xml:41 #, no-c-format msgid "Programmatic configuration" msgstr "可编程的配置方式" #. Tag: para +#: configuration.xml:43 #, no-c-format -msgid "An instance of org.hibernate.cfg.Configuration represents an entire set of mappings of an application's Java types to an SQL database. The org.hibernate.cfg.Configuration is used to build an immutable org.hibernate.SessionFactory. The mappings are compiled from various XML mapping files." -msgstr "org.hibernate.cfg.Configuration 实例代表了一个应用程序中 Java 类型到SQL数据库映射的完整集合。org.hibernate.cfg.Configuration 被用来构建一个(不可变的(immutable))org.hibernate.SessionFactory。映射定义则由不同的 XML 映射定义文件编译而来。" +msgid "" +"An instance of org.hibernate.cfg.Configuration " +"represents an entire set of mappings of an application's Java types to an " +"SQL database. The org.hibernate.cfg.Configuration is " +"used to build an immutable org.hibernate.SessionFactory. The mappings are compiled from various XML mapping files." +msgstr "" +"org.hibernate.cfg.Configuration 实例代表了一个应用程序中 " +"Java 类型到SQL数据库映射的完整集合。org.hibernate.cfg." +"Configuration 被用来构建一个(不可变的(immutable))" +"org.hibernate.SessionFactory。映射定义则由不同" +"的 XML 映射定义文件编译而来。" #. Tag: para +#: configuration.xml:51 #, no-c-format -msgid "You can obtain a org.hibernate.cfg.Configuration instance by instantiating it directly and specifying XML mapping documents. If the mapping files are in the classpath, use addResource(). For example:" -msgstr "你可以直接实例化 org.hibernate.cfg.Configuration 来获取一个实例,并为它指定 XML 映射定义文件。如果映射定义文件在类路径(classpath)中,请使用 addResource()。例如:" +msgid "" +"You can obtain a org.hibernate.cfg.Configuration " +"instance by instantiating it directly and specifying XML mapping documents. " +"If the mapping files are in the classpath, use addResource(). For example:" +msgstr "" +"你可以直接实例化 org.hibernate.cfg.Configuration 来获" +"取一个实例,并为它指定 XML 映射定义文件。如果映射定义文件在类路径" +"(classpath)中,请使用 addResource()。例如:" + +#. Tag: programlisting +#: configuration.xml:57 +#, fuzzy, no-c-format +msgid "" +"Configuration cfg = new Configuration()\n" +" .addResource(\"Item.hbm.xml\")\n" +" .addResource(\"Bid.hbm.xml\");" +msgstr "" +"" #. Tag: para +#: configuration.xml:59 #, no-c-format -msgid "An alternative way is to specify the mapped class and allow Hibernate to find the mapping document for you:" -msgstr "一个替代方法(有时是更好的选择)是,指定被映射的类,让 Hibernate 帮你寻找映射定义文件: " +msgid "" +"An alternative way is to specify the mapped class and allow Hibernate to " +"find the mapping document for you:" +msgstr "" +"一个替代方法(有时是更好的选择)是,指定被映射的类,让 Hibernate 帮你寻找映射" +"定义文件: " + +#. Tag: programlisting +#: configuration.xml:62 +#, fuzzy, no-c-format +msgid "" +"Configuration cfg = new Configuration()\n" +" .addClass(org.hibernate.auction.Item.class)\n" +" .addClass(org.hibernate.auction.Bid.class);" +msgstr "" +"" #. Tag: para +#: configuration.xml:64 #, no-c-format -msgid "Hibernate will then search for mapping files named /org/hibernate/auction/Item.hbm.xml and /org/hibernate/auction/Bid.hbm.xml in the classpath. This approach eliminates any hardcoded filenames." -msgstr "Hibernate 将会在类路径(classpath)中寻找名字为 /org/hibernate/auction/Item.hbm.xml/org/hibernate/auction/Bid.hbm.xml 映射定义文件。这种方式消除了任何对文件名的硬编码(hardcoded)。" +msgid "" +"Hibernate will then search for mapping files named /org/hibernate/" +"auction/Item.hbm.xml and /org/hibernate/auction/Bid.hbm." +"xml in the classpath. This approach eliminates any hardcoded " +"filenames." +msgstr "" +"Hibernate 将会在类路径(classpath)中寻找名字为 /org/hibernate/" +"auction/Item.hbm.xml/org/hibernate/auction/Bid.hbm." +"xml 映射定义文件。这种方式消除了任何对文件名的硬编码" +"(hardcoded)。" #. Tag: para +#: configuration.xml:69 #, no-c-format -msgid "A org.hibernate.cfg.Configuration also allows you to specify configuration properties. For example:" -msgstr "org.hibernate.cfg.Configuration> 也允许你指定配置属性。例如:" +msgid "" +"A org.hibernate.cfg.Configuration also allows you to " +"specify configuration properties. For example:" +msgstr "" +"org.hibernate.cfg.Configuration> 也允许你指定配置属" +"性。例如:" + +#. Tag: programlisting +#: configuration.xml:72 +#, fuzzy, no-c-format +msgid "" +"Configuration cfg = new Configuration()\n" +" .addClass(org.hibernate.auction.Item.class)\n" +" .addClass(org.hibernate.auction.Bid.class)\n" +" .setProperty(\"hibernate.dialect\", \"org.hibernate.dialect." +"MySQLInnoDBDialect\")\n" +" .setProperty(\"hibernate.connection.datasource\", \"java:comp/env/jdbc/" +"test\")\n" +" .setProperty(\"hibernate.order_updates\", \"true\");" +msgstr "" +"" #. Tag: para +#: configuration.xml:74 #, no-c-format -msgid "This is not the only way to pass configuration properties to Hibernate. Some alternative options include:" +msgid "" +"This is not the only way to pass configuration properties to Hibernate. Some " +"alternative options include:" msgstr "当然这不是唯一的传递 Hibernate 配置属性的方式,其他可选方式还包括: " #. Tag: para +#: configuration.xml:79 #, no-c-format -msgid "Pass an instance of java.util.Properties to Configuration.setProperties()." -msgstr "传一个 java.util.Properties 实例给 Configuration.setProperties()。" +msgid "" +"Pass an instance of java.util.Properties to " +"Configuration.setProperties()." +msgstr "" +"传一个 java.util.Properties 实例给 " +"Configuration.setProperties()。" #. Tag: para +#: configuration.xml:84 #, no-c-format -msgid "Place a file named hibernate.properties in a root directory of the classpath." -msgstr "将 hibernate.properties 放置在类路径(classpath)的根目录下(root directory)。" +msgid "" +"Place a file named hibernate.properties in a root " +"directory of the classpath." +msgstr "" +"将 hibernate.properties 放置在类路径(classpath)的根目" +"录下(root directory)。" #. Tag: para +#: configuration.xml:89 #, no-c-format -msgid "Set System properties using java -Dproperty=value." -msgstr "通过 java -Dproperty=value 来设置系统(System)属性。" +msgid "" +"Set System properties using java -" +"Dproperty=value." +msgstr "" +"通过 java -Dproperty=value 来设置系统(System)属性。" #. Tag: para +#: configuration.xml:94 #, no-c-format -msgid "Include <property> elements in hibernate.cfg.xml (this is discussed later)." -msgstr "在 hibernate.cfg.xml 中加入元素 <property>(稍后讨论)。 " +msgid "" +"Include <property> elements in hibernate." +"cfg.xml (this is discussed later)." +msgstr "" +"在 hibernate.cfg.xml 中加入元素 <property>" +"(稍后讨论)。 " #. Tag: para +#: configuration.xml:99 #, no-c-format -msgid "If you want to get started quicklyhibernate.properties is the easiest approach." -msgstr "如果你想快速上路,hibernate.properties 就是最容易的途径。" +msgid "" +"If you want to get started quicklyhibernate.properties " +"is the easiest approach." +msgstr "" +"如果你想快速上路,hibernate.properties 就是最容易的途" +"径。" #. Tag: para +#: configuration.xml:103 #, no-c-format -msgid "The org.hibernate.cfg.Configuration is intended as a startup-time object that will be discarded once a SessionFactory is created." -msgstr "org.hibernate.cfg.Configuration 实例被设计成启动期间(startup-time)对象,一旦 SessionFactory 创建完成它就被丢弃了。" +msgid "" +"The org.hibernate.cfg.Configuration is intended as a " +"startup-time object that will be discarded once a SessionFactory is created." +msgstr "" +"org.hibernate.cfg.Configuration 实例被设计成启动期间" +"(startup-time)对象,一旦 SessionFactory 创建完成它就被丢" +"弃了。" #. Tag: title +#: configuration.xml:109 #, no-c-format msgid "Obtaining a SessionFactory" msgstr "获得 SessionFactory" #. Tag: para +#: configuration.xml:111 #, no-c-format -msgid "When all mappings have been parsed by the org.hibernate.cfg.Configuration, the application must obtain a factory for org.hibernate.Session instances. This factory is intended to be shared by all application threads:" -msgstr "当所有映射定义被 org.hibernate.cfg.Configuration 解析后,应用程序必须获得一个用于构造 org.hibernate.Session 实例的工厂。这个工厂将被应用程序的所有线程共享:" +msgid "" +"When all mappings have been parsed by the org.hibernate.cfg." +"Configuration, the application must obtain a factory for " +"org.hibernate.Session instances. This factory " +"is intended to be shared by all application threads:" +msgstr "" +"当所有映射定义被 org.hibernate.cfg.Configuration 解析" +"后,应用程序必须获得一个用于构造 org.hibernate.Session 实例的工厂。这个工厂将被应用程序的所有线程共享:" + +#. Tag: programlisting +#: configuration.xml:117 +#, fuzzy, no-c-format +msgid "SessionFactory sessions = cfg.buildSessionFactory();" +msgstr "" #. Tag: para +#: configuration.xml:119 #, no-c-format -msgid "Hibernate does allow your application to instantiate more than one org.hibernate.SessionFactory. This is useful if you are using more than one database." -msgstr "Hibernate 允许你的应用程序创建多个 org.hibernate.SessionFactory 实例。这对 使用多个数据库的应用来说很有用。" +msgid "" +"Hibernate does allow your application to instantiate more than one " +"org.hibernate.SessionFactory. This is useful " +"if you are using more than one database." +msgstr "" +"Hibernate 允许你的应用程序创建多个 org.hibernate." +"SessionFactory 实例。这对 使用多个数据库的应用来说很有用。" #. Tag: title +#: configuration.xml:125 #, no-c-format msgid "JDBC connections" msgstr "JDBC 连接" #. Tag: para +#: configuration.xml:127 #, no-c-format -msgid "It is advisable to have the org.hibernate.SessionFactory create and pool JDBC connections for you. If you take this approach, opening a org.hibernate.Session is as simple as:" -msgstr "通常你希望 org.hibernate.SessionFactory 来为你创建和缓存(pool)JDBC 连接。如果你采用这种方式,只需要如下例所示那样,打开一个 org.hibernate.Session:" +msgid "" +"It is advisable to have the org.hibernate.SessionFactory create and pool JDBC connections for you. If you take this " +"approach, opening a org.hibernate.Session is " +"as simple as:" +msgstr "" +"通常你希望 org.hibernate.SessionFactory 来为" +"你创建和缓存(pool)JDBC 连接。如果你采用这种方式,只需要如下例所示那样,打开" +"一个 org.hibernate.Session:" + +#. Tag: programlisting +#: configuration.xml:133 +#, fuzzy, no-c-format +msgid "Session session = sessions.openSession(); // open a new Session" +msgstr "" +"" #. Tag: para +#: configuration.xml:135 #, no-c-format -msgid "Once you start a task that requires access to the database, a JDBC connection will be obtained from the pool." -msgstr "一旦你需要进行数据访问时,就会从连接池(connection pool)获得一个 JDBC 连接。 " +msgid "" +"Once you start a task that requires access to the database, a JDBC " +"connection will be obtained from the pool." +msgstr "" +"一旦你需要进行数据访问时,就会从连接池(connection pool)获得一个 JDBC 连" +"接。 " #. Tag: para +#: configuration.xml:138 #, no-c-format -msgid "Before you can do this, you first need to pass some JDBC connection properties to Hibernate. All Hibernate property names and semantics are defined on the class org.hibernate.cfg.Environment. The most important settings for JDBC connection configuration are outlined below." -msgstr "为了使这种方式工作起来,我们需要向 Hibernate 传递一些 JDBC 连接的属性。所有 Hibernate 属性的名字和语义都在 org.hibernate.cfg.Environment 中定义。我们现在将描述 JDBC 连接配置中最重要的设置。" +msgid "" +"Before you can do this, you first need to pass some JDBC connection " +"properties to Hibernate. All Hibernate property names and semantics are " +"defined on the class org.hibernate.cfg.Environment. " +"The most important settings for JDBC connection configuration are outlined " +"below." +msgstr "" +"为了使这种方式工作起来,我们需要向 Hibernate 传递一些 JDBC 连接的属性。所有 " +"Hibernate 属性的名字和语义都在 org.hibernate.cfg.Environment 中定义。我们现在将描述 JDBC 连接配置中最重要的设置。" #. Tag: para +#: configuration.xml:144 #, no-c-format -msgid "Hibernate will obtain and pool connections using java.sql.DriverManager if you set the following properties:" -msgstr "如果你设置如下属性,Hibernate 将使用 java.sql.DriverManager 来获得(和缓存)JDBC 连接:" +msgid "" +"Hibernate will obtain and pool connections using java.sql." +"DriverManager if you set the following properties:" +msgstr "" +"如果你设置如下属性,Hibernate 将使用 java.sql.DriverManager 来获得(和缓存)JDBC 连接:" #. Tag: title +#: configuration.xml:149 #, no-c-format msgid "Hibernate JDBC Properties" msgstr "Hibernate JDBC 属性" #. Tag: entry +#: configuration.xml:158 configuration.xml:236 configuration.xml:327 +#: configuration.xml:495 configuration.xml:657 configuration.xml:753 +#: configuration.xml:826 #, no-c-format msgid "Property name" msgstr "属性名" #. Tag: entry +#: configuration.xml:160 configuration.xml:238 configuration.xml:329 +#: configuration.xml:497 configuration.xml:659 configuration.xml:755 +#: configuration.xml:828 #, no-c-format msgid "Purpose" msgstr "用途" -#. Tag: entry -#, no-c-format -msgid "hibernate.connection.driver_class" +#. Tag: property +#: configuration.xml:166 +#, fuzzy, no-c-format +msgid "hibernate.connection.driver_class" msgstr "hibernate.connection.driver_class" -#. Tag: entry -#, no-c-format -msgid "JDBC driver class" +#. Tag: emphasis +#: configuration.xml:168 +#, fuzzy, no-c-format +msgid "JDBC driver class" msgstr "JDBC 驱动类" -#. Tag: entry -#, no-c-format -msgid "hibernate.connection.url" +#. Tag: property +#: configuration.xml:172 +#, fuzzy, no-c-format +msgid "hibernate.connection.url" msgstr "hibernate.connection.url" -#. Tag: entry +#. Tag: emphasis +#: configuration.xml:174 #, no-c-format -msgid "JDBC URL" -msgstr "JDBC URL" +msgid "JDBC URL" +msgstr "JDBC URL" -#. Tag: entry -#, no-c-format -msgid "hibernate.connection.username" +#. Tag: property +#: configuration.xml:178 configuration.xml:265 +#, fuzzy, no-c-format +msgid "hibernate.connection.username" msgstr "hibernate.connection.username" -#. Tag: entry +#. Tag: emphasis +#: configuration.xml:180 #, no-c-format -msgid "database user" -msgstr "数据库用户(可选) " +msgid "database user" +msgstr "database user" -#. Tag: entry -#, no-c-format -msgid "hibernate.connection.password" +#. Tag: property +#: configuration.xml:184 configuration.xml:271 +#, fuzzy, no-c-format +msgid "hibernate.connection.password" msgstr "hibernate.connection.password" -#. Tag: entry +#. Tag: emphasis +#: configuration.xml:186 #, no-c-format -msgid "database user password" -msgstr "数据库密码(可选) " +msgid "database user password" +msgstr "数据库用户密码" -#. Tag: entry -#, no-c-format -msgid "hibernate.connection.pool_size" +#. Tag: property +#: configuration.xml:190 +#, fuzzy, no-c-format +msgid "hibernate.connection.pool_size" msgstr "hibernate.connection.pool_size" -#. Tag: entry -#, no-c-format -msgid "maximum number of pooled connections" +#. Tag: emphasis +#: configuration.xml:192 +#, fuzzy, no-c-format +msgid "maximum number of pooled connections" msgstr "连接池容量上限数目" #. Tag: para +#: configuration.xml:199 #, no-c-format -msgid "Hibernate's own connection pooling algorithm is, however, quite rudimentary. It is intended to help you get started and is not intended for use in a production system, or even for performance testing. You should use a third party pool for best performance and stability. Just replace the hibernate.connection.pool_size property with connection pool specific settings. This will turn off Hibernate's internal pool. For example, you might like to use c3p0." -msgstr "但 Hibernate 自带的连接池算法相当不成熟。它只是为了让你快些上手,并不适合用于产品系统或性能测试中。 出于最佳性能和稳定性考虑你应该使用第三方的连接池。只需要用特定连接池的设置替换 hibernate.connection.pool_size 即可。这将关闭 Hibernate 自带的连接池。例如,你可能会想用 C3P0。 " +msgid "" +"Hibernate's own connection pooling algorithm is, however, quite rudimentary. " +"It is intended to help you get started and is not intended for use " +"in a production system, or even for performance testing. You " +"should use a third party pool for best performance and stability. Just " +"replace the hibernate.connection.pool_size property " +"with connection pool specific settings. This will turn off Hibernate's " +"internal pool. For example, you might like to use c3p0." +msgstr "" +"但 Hibernate 自带的连接池算法相当不成熟。它只是为了让你快些上手,并" +"不适合用于产品系统或性能测试中。 出于最佳性能和稳定性考虑你应该使" +"用第三方的连接池。只需要用特定连接池的设置替换 hibernate.connection." +"pool_size 即可。这将关闭 Hibernate 自带的连接池。例如,你可能会想" +"用 C3P0。 " #. Tag: para +#: configuration.xml:208 #, no-c-format -msgid "C3P0 is an open source JDBC connection pool distributed along with Hibernate in the lib directory. Hibernate will use its org.hibernate.connection.C3P0ConnectionProvider for connection pooling if you set hibernate.c3p0.* properties. If you would like to use Proxool, refer to the packaged hibernate.properties and the Hibernate web site for more information." -msgstr "C3P0 是一个随 Hibernate 一同分发的开源的 JDBC 连接池,它位于 lib目录下。 如果你设置了 hibernate.c3p0.* 相关的属性,Hibernate将使用 C3P0ConnectionProvider 来缓存 JDBC 连接。如果你更原意使用 Proxool,请参考发行包中的 hibernate.properties 并到 Hibernate 网站获取更多的信息。 " +msgid "" +"C3P0 is an open source JDBC connection pool distributed along with Hibernate " +"in the lib directory. Hibernate will use its " +"org.hibernate.connection.C3P0ConnectionProvider for " +"connection pooling if you set hibernate.c3p0.* " +"properties. If you would like to use Proxool, refer to the packaged " +"hibernate.properties and the Hibernate web site for " +"more information." +msgstr "" +"C3P0 是一个随 Hibernate 一同分发的开源的 JDBC 连接池,它位于 lib目录下。 如果你设置了 hibernate.c3p0.* 相关的属" +"性,Hibernate将使用 C3P0ConnectionProvider 来缓存 JDBC 连" +"接。如果你更原意使用 Proxool,请参考发行包中的 hibernate." +"properties 并到 Hibernate 网站获取更多的信息。 " #. Tag: para +#: configuration.xml:216 #, no-c-format -msgid "The following is an example hibernate.properties file for c3p0:" -msgstr "这是一个使用 C3P0 的 hibernate.properties 样例文件: " +msgid "" +"The following is an example hibernate.properties file " +"for c3p0:" +msgstr "" +"这是一个使用 C3P0 的 hibernate.properties 样例文件: " + +#. Tag: programlisting +#: configuration.xml:219 +#, fuzzy, no-c-format +msgid "" +"hibernate.connection.driver_class = org.postgresql.Driver\n" +"hibernate.connection.url = jdbc:postgresql://localhost/mydatabase\n" +"hibernate.connection.username = myuser\n" +"hibernate.connection.password = secret\n" +"hibernate.c3p0.min_size=5\n" +"hibernate.c3p0.max_size=20\n" +"hibernate.c3p0.timeout=1800\n" +"hibernate.c3p0.max_statements=50\n" +"hibernate.dialect = org.hibernate.dialect.PostgreSQLDialect" +msgstr "" +"" #. Tag: para +#: configuration.xml:221 #, no-c-format -msgid "For use inside an application server, you should almost always configure Hibernate to obtain connections from an application server javax.sql.Datasource registered in JNDI. You will need to set at least one of the following properties:" -msgstr "为了能在应用程序服务器(application server)中使用 Hibernate,应当总是将 Hibernate 配置成从注册在 JNDI 中的 Datasource 处获得连接,你至少需要设置下列属性中的一个: " +msgid "" +"For use inside an application server, you should almost always configure " +"Hibernate to obtain connections from an application server " +"javax.sql.Datasource registered in JNDI. You " +"will need to set at least one of the following properties:" +msgstr "" +"为了能在应用程序服务器(application server)中使用 Hibernate,应当总是将 " +"Hibernate 配置成从注册在 JNDI 中的 Datasource 处获得连接," +"你至少需要设置下列属性中的一个: " #. Tag: title +#: configuration.xml:227 #, no-c-format msgid "Hibernate Datasource Properties" msgstr "Hibernate 数据源属性" -#. Tag: entry -#, no-c-format -msgid "hibernate.connection.datasource" +#. Tag: property +#: configuration.xml:244 +#, fuzzy, no-c-format +msgid "hibernate.connection.datasource" msgstr "hibernate.connection.datasource" -#. Tag: entry +#. Tag: emphasis +#: configuration.xml:246 #, no-c-format -msgid "datasource JNDI name" -msgstr "数据库用户(可选) " +msgid "datasource JNDI name" +msgstr "数据源 JNDI 名字" -#. Tag: entry -#, no-c-format -msgid "hibernate.jndi.url" +#. Tag: property +#: configuration.xml:250 +#, fuzzy, no-c-format +msgid "hibernate.jndi.url" msgstr "hibernate.jndi.url" #. Tag: entry +#: configuration.xml:252 #, no-c-format msgid "URL of the JNDI provider (optional)" msgstr "JNDI 提供者的 URL(可选)" -#. Tag: entry -#, no-c-format -msgid "hibernate.jndi.class" +#. Tag: property +#: configuration.xml:257 +#, fuzzy, no-c-format +msgid "hibernate.jndi.class" msgstr "hibernate.jndi.class" #. Tag: entry +#: configuration.xml:259 #, no-c-format -msgid "class of the JNDI InitialContextFactory (optional)" -msgstr "JNDI InitialContextFactory(可选)" +msgid "" +"class of the JNDI InitialContextFactory (optional)" +msgstr "" +"JNDI InitialContextFactory(可选)" #. Tag: entry +#: configuration.xml:267 #, no-c-format msgid "database user (optional)" msgstr "数据库用户(可选)" #. Tag: entry +#: configuration.xml:273 #, no-c-format msgid "database user password (optional)" msgstr "数据库密码(可选)" #. Tag: para +#: configuration.xml:280 #, no-c-format -msgid "Here is an example hibernate.properties file for an application server provided JNDI datasource:" -msgstr "这是一个使用应用程序服务器提供的 JNDI 数据源的 hibernate.properties 样例文件: " +msgid "" +"Here is an example hibernate.properties file for an " +"application server provided JNDI datasource:" +msgstr "" +"这是一个使用应用程序服务器提供的 JNDI 数据源的 hibernate." +"properties 样例文件: " + +#. Tag: programlisting +#: configuration.xml:283 +#, fuzzy, no-c-format +msgid "" +"hibernate.connection.datasource = java:/comp/env/jdbc/test\n" +"hibernate.transaction.factory_class = \\\n" +" org.hibernate.transaction.JTATransactionFactory\n" +"hibernate.transaction.manager_lookup_class = \\\n" +" org.hibernate.transaction.JBossTransactionManagerLookup\n" +"hibernate.dialect = org.hibernate.dialect.PostgreSQLDialect" +msgstr "" +"" #. Tag: para +#: configuration.xml:285 #, no-c-format -msgid "JDBC connections obtained from a JNDI datasource will automatically participate in the container-managed transactions of the application server." -msgstr "从 JNDI 数据源获得的 JDBC 连接将自动参与到应用程序服务器中容器管理的事务(container-managed transactions)中去。" +msgid "" +"JDBC connections obtained from a JNDI datasource will automatically " +"participate in the container-managed transactions of the application server." +msgstr "" +"从 JNDI 数据源获得的 JDBC 连接将自动参与到应用程序服务器中容器管理的事务" +"(container-managed transactions)中去。" #. Tag: para +#: configuration.xml:289 #, no-c-format -msgid "Arbitrary connection properties can be given by prepending \"hibernate.connection\" to the connection property name. For example, you can specify a charSet connection property using hibernate.connection.charSet." -msgstr "任何连接(connection)属性的属性名都要以 \"hibernate.connnection\" 开头。例如,你可能会使用 hibernate.connection.charSet 来指定 charSet 连接属性。 " +msgid "" +"Arbitrary connection properties can be given by prepending " +"\"hibernate.connection\" to the connection property name. " +"For example, you can specify a charSet connection " +"property using hibernate.connection.charSet." +msgstr "" +"任何连接(connection)属性的属性名都要以 \"hibernate.connnection\" 开头。例如,你可能会使用 hibernate.connection.charSet 来指定 charSet 连接属性。 " #. Tag: para +#: configuration.xml:294 #, no-c-format -msgid "You can define your own plugin strategy for obtaining JDBC connections by implementing the interface org.hibernate.connection.ConnectionProvider, and specifying your custom implementation via the hibernate.connection.provider_class property." -msgstr "通过实现 org.hibernate.connection.ConnectionProvider 接口,你可以定义属于你自己的获得JDBC连接的插件策略。通过设置hibernate.connection.provider_class,你可以选择一个自定义的实现。 " +msgid "" +"You can define your own plugin strategy for obtaining JDBC connections by " +"implementing the interface org.hibernate.connection." +"ConnectionProvider, and specifying your custom " +"implementation via the hibernate.connection.provider_class property." +msgstr "" +"通过实现 org.hibernate.connection.ConnectionProvider 接" +"口,你可以定义属于你自己的获得JDBC连接的插件策略。通过设置hibernate." +"connection.provider_class,你可以选择一个自定义的实现。 " #. Tag: title +#: configuration.xml:302 #, no-c-format msgid "Optional configuration properties" msgstr "可选的配置属性" #. Tag: para +#: configuration.xml:304 #, no-c-format -msgid "There are a number of other properties that control the behavior of Hibernate at runtime. All are optional and have reasonable default values." -msgstr "有大量属性能用来控制 Hibernate 在运行期的行为。它们都是可选的,并拥有适当的默认值。 " +msgid "" +"There are a number of other properties that control the behavior of " +"Hibernate at runtime. All are optional and have reasonable default values." +msgstr "" +"有大量属性能用来控制 Hibernate 在运行期的行为。它们都是可选的,并拥有适当的默" +"认值。 " #. Tag: para +#: configuration.xml:309 #, no-c-format -msgid "Some of these properties are \"system-level\" only. System-level properties can be set only via java -Dproperty=value or hibernate.properties. They cannot be set by the other techniques described above." -msgstr "其中一些属性是\"系统级(system-level)的\"。系统级属性只能通过java -Dproperty=valuehibernate.properties 来设置,而不能用上面描述的其他方法来设置。" +msgid "" +"Some of these properties are \"system-level\" only. " +"System-level properties can be set only via java -Dproperty=value or hibernate.properties. They " +"cannot be set by the other techniques described above." +msgstr "" +"其中一些属性是\"系统级(system-level)的\"。系统级属性只" +"能通过java -Dproperty=valuehibernate." +"properties 来设置,而不能用上面描述的其他方法" +"来设置。" #. Tag: title +#: configuration.xml:318 #, no-c-format msgid "Hibernate Configuration Properties" msgstr "Hibernate 配置属性" -#. Tag: entry -#, no-c-format -msgid "hibernate.dialect" +#. Tag: property +#: configuration.xml:335 +#, fuzzy, no-c-format +msgid "hibernate.dialect" msgstr "hibernate.dialect" #. Tag: entry +#: configuration.xml:337 #, no-c-format -msgid "The classname of a Hibernate org.hibernate.dialect.Dialect which allows Hibernate to generate SQL optimized for a particular relational database." -msgstr "允许 Hibernate 针对特定的关系数据库生成优化的 SQL 的 org.hibernate.dialect.Dialect 的类名。" +msgid "" +"The classname of a Hibernate org.hibernate.dialect.Dialect which allows Hibernate to generate SQL optimized for a particular " +"relational database." +msgstr "" +"允许 Hibernate 针对特定的关系数据库生成优化的 SQL 的 org." +"hibernate.dialect.Dialect 的类名。" #. Tag: para +#: configuration.xml:340 #, no-c-format -msgid "e.g. full.classname.of.Dialect" -msgstr "例如:full.classname.of.Dialect " +msgid "" +"e.g. full.classname.of." +"Dialect" +msgstr "" +"例如:full.classname.of." +"Dialect " #. Tag: para +#: configuration.xml:341 #, no-c-format -msgid "In most cases Hibernate will actually be able to choose the correct org.hibernate.dialect.Dialect implementation based on the JDBC metadata returned by the JDBC driver." -msgstr "在大多数情况下,Hibernate 可以根据 JDBC 驱动返回的 JDBC metadata 选择正确的 org.hibernate.dialect.Dialect 实现。" +msgid "" +"In most cases Hibernate will actually be able to choose the correct " +"org.hibernate.dialect.Dialect implementation based on " +"the JDBC metadata returned by the JDBC driver." +msgstr "" +"在大多数情况下,Hibernate 可以根据 JDBC 驱动返回的 JDBC metadata 选择正确的 org.hibernate.dialect.Dialect 实" +"现。" -#. Tag: entry -#, no-c-format -msgid "hibernate.show_sql" +#. Tag: property +#: configuration.xml:349 +#, fuzzy, no-c-format +msgid "hibernate.show_sql" msgstr "hibernate.show_sql" #. Tag: entry +#: configuration.xml:351 #, no-c-format -msgid "Write all SQL statements to console. This is an alternative to setting the log category org.hibernate.SQL to debug." -msgstr "输出所有 SQL 语句到控制台。有一个另外的选择是把 org.hibernate.SQL 这个 log category设为 debug。" +msgid "" +"Write all SQL statements to console. This is an alternative to setting the " +"log category org.hibernate.SQL to debug." +msgstr "" +"输出所有 SQL 语句到控制台。有一个另外的选择是把 org.hibernate.SQL 这个 log category设为 debug。" #. Tag: para +#: configuration.xml:353 configuration.xml:361 configuration.xml:426 +#: configuration.xml:435 configuration.xml:443 configuration.xml:453 +#: configuration.xml:468 configuration.xml:525 configuration.xml:545 +#: configuration.xml:555 configuration.xml:598 configuration.xml:797 +#: configuration.xml:808 configuration.xml:904 #, no-c-format -msgid "e.g. true | false" -msgstr "例如:true | false " +msgid "" +"e.g. true | " +"false" +msgstr "" +"例如:true | " +"false " -#. Tag: entry -#, no-c-format -msgid "hibernate.format_sql" +#. Tag: property +#: configuration.xml:359 +#, fuzzy, no-c-format +msgid "hibernate.format_sql" msgstr "hibernate.format_sql" #. Tag: entry +#: configuration.xml:361 #, no-c-format msgid "Pretty print the SQL in the log and console." msgstr "在 log 和 console 中打印出更漂亮的 SQL。" -#. Tag: entry -#, no-c-format -msgid "hibernate.default_schema" +#. Tag: property +#: configuration.xml:367 +#, fuzzy, no-c-format +msgid "hibernate.default_schema" msgstr "hibernate.default_schema" #. Tag: entry +#: configuration.xml:369 #, no-c-format -msgid "Qualify unqualified table names with the given schema/tablespace in generated SQL." -msgstr "在生成的 SQL 中,将给定的 schema/tablespace 附加于非全限定名的表名上。 " +msgid "" +"Qualify unqualified table names with the given schema/tablespace in " +"generated SQL." +msgstr "" +"在生成的 SQL 中,将给定的 schema/tablespace 附加于非全限定名的表名上。 " #. Tag: para +#: configuration.xml:370 #, no-c-format -msgid "e.g. SCHEMA_NAME" -msgstr "例如:SCHEMA_NAME " +msgid "" +"e.g. SCHEMA_NAME" +msgstr "" +"例如:SCHEMA_NAME " -#. Tag: entry -#, no-c-format -msgid "hibernate.default_catalog" +#. Tag: property +#: configuration.xml:376 +#, fuzzy, no-c-format +msgid "hibernate.default_catalog" msgstr "hibernate.default_catalog" #. Tag: entry +#: configuration.xml:378 #, no-c-format -msgid "Qualifies unqualified table names with the given catalog in generated SQL." +msgid "" +"Qualifies unqualified table names with the given catalog in generated SQL." msgstr "在生成的 SQL 中,将给定的 catalog 附加于非全限定名的表名上。 " #. Tag: para +#: configuration.xml:379 #, no-c-format -msgid "e.g. CATALOG_NAME" -msgstr "例如:CATALOG_NAME " +msgid "" +"e.g. CATALOG_NAME" +msgstr "" +"例如:CATALOG_NAME " -#. Tag: entry -#, no-c-format -msgid "hibernate.session_factory_name" +#. Tag: property +#: configuration.xml:384 +#, fuzzy, no-c-format +msgid "hibernate.session_factory_name" msgstr "hibernate.session_factory_name" #. Tag: entry +#: configuration.xml:386 #, no-c-format -msgid "The org.hibernate.SessionFactory will be automatically bound to this name in JNDI after it has been created." -msgstr "org.hibernate.SessionFactory 创建后,将自动使用这个名字绑定到 JNDI 中。" +msgid "" +"The org.hibernate.SessionFactory will be " +"automatically bound to this name in JNDI after it has been created." +msgstr "" +"org.hibernate.SessionFactory 创建后,将自动使" +"用这个名字绑定到 JNDI 中。" #. Tag: para +#: configuration.xml:389 configuration.xml:776 #, no-c-format -msgid "e.g. jndi/composite/name" -msgstr "例如:jndi/composite/name " +msgid "" +"e.g. jndi/composite/name" +msgstr "" +"例如:jndi/composite/name " -#. Tag: entry -#, no-c-format -msgid "hibernate.max_fetch_depth" +#. Tag: property +#: configuration.xml:394 +#, fuzzy, no-c-format +msgid "hibernate.max_fetch_depth" msgstr "hibernate.max_fetch_depth" #. Tag: entry +#: configuration.xml:396 #, no-c-format -msgid "Sets a maximum \"depth\" for the outer join fetch tree for single-ended associations (one-to-one, many-to-one). A 0 disables default outer join fetching." -msgstr "为单向关联(一对一,多对一)的外连接抓取(outer join fetch)树设置最大深度。值为 0 意味着将关闭默认的外连接抓取。 " +msgid "" +"Sets a maximum \"depth\" for the outer join fetch tree for single-ended " +"associations (one-to-one, many-to-one). A 0 disables " +"default outer join fetching." +msgstr "" +"为单向关联(一对一,多对一)的外连接抓取(outer join fetch)树设置最大深度。" +"值为 0 意味着将关闭默认的外连接抓取。 " #. Tag: para +#: configuration.xml:398 #, no-c-format -msgid "e.g. recommended values between 0 and 3" -msgstr "例如: 建议在 03 之间取值 " +msgid "" +"e.g. recommended values between " +"0 and 3" +msgstr "" +"例如: 建议在 0 到 " +"3 之间取值 " -#. Tag: entry -#, no-c-format -msgid "hibernate.default_batch_fetch_size" +#. Tag: property +#: configuration.xml:404 +#, fuzzy, no-c-format +msgid "hibernate.default_batch_fetch_size" msgstr "hibernate.default_batch_fetch_size" #. Tag: entry +#: configuration.xml:406 #, no-c-format msgid "Sets a default size for Hibernate batch fetching of associations." msgstr "为 Hibernate 关联的批量抓取设置默认数量。 " #. Tag: para +#: configuration.xml:407 #, no-c-format -msgid "e.g. recommended values 4, 8, 16" -msgstr "例如:建议的取值为 48,和 16 " +msgid "" +"e.g. recommended values 4, 8, 16" +msgstr "" +"例如:建议的取值为 48,和 16 " -#. Tag: entry -#, no-c-format -msgid "hibernate.default_entity_mode" +#. Tag: property +#: configuration.xml:413 +#, fuzzy, no-c-format +msgid "hibernate.default_entity_mode" msgstr "hibernate.default_entity_mode" #. Tag: entry +#: configuration.xml:415 #, no-c-format -msgid "Sets a default mode for entity representation for all sessions opened from this SessionFactory" -msgstr "为由这个 SessionFactory 打开的所有 Session 指定默认的实体表现模式。 " +msgid "" +"Sets a default mode for entity representation for all sessions opened from " +"this SessionFactory" +msgstr "" +"为由这个 SessionFactory 打开的所有 Session 指定默认的实体" +"表现模式。 " #. Tag: para +#: configuration.xml:416 #, no-c-format -msgid "dynamic-map, dom4j, pojo" -msgstr "取值dynamic-mapdom4jpojo" +msgid "" +"dynamic-map, dom4j, pojo" +msgstr "" +"取值dynamic-map," +"dom4jpojo" -#. Tag: entry -#, no-c-format -msgid "hibernate.order_updates" +#. Tag: property +#: configuration.xml:422 +#, fuzzy, no-c-format +msgid "hibernate.order_updates" msgstr "hibernate.order_updates" #. Tag: entry +#: configuration.xml:424 #, no-c-format -msgid "Forces Hibernate to order SQL updates by the primary key value of the items being updated. This will result in fewer transaction deadlocks in highly concurrent systems." -msgstr "强制 Hibernate 按照被更新数据的主键,为 SQL 更新排序。这么做将减少在高并发系统中事务的死锁。" +msgid "" +"Forces Hibernate to order SQL updates by the primary key value of the items " +"being updated. This will result in fewer transaction deadlocks in highly " +"concurrent systems." +msgstr "" +"强制 Hibernate 按照被更新数据的主键,为 SQL 更新排序。这么做将减少在高并发系" +"统中事务的死锁。" + +#. Tag: property +#: configuration.xml:432 +#, fuzzy, no-c-format +msgid "hibernate.generate_statistics" +msgstr "Hibernate 的统计(statistics)机制" #. Tag: entry +#: configuration.xml:434 #, no-c-format -msgid "hibernate.generate_statistics" -msgstr "hibernate.generate_statistics" - -#. Tag: entry -#, no-c-format -msgid "If enabled, Hibernate will collect statistics useful for performance tuning." +msgid "" +"If enabled, Hibernate will collect statistics useful for performance tuning." msgstr "如果开启,Hibernate 将收集有助于性能调节的统计数据。" -#. Tag: entry -#, no-c-format -msgid "hibernate.use_identifier_rollback" +#. Tag: property +#: configuration.xml:440 +#, fuzzy, no-c-format +msgid "hibernate.use_identifier_rollback" msgstr "hibernate.use_identifier_rollback" #. Tag: entry +#: configuration.xml:442 #, no-c-format -msgid "If enabled, generated identifier properties will be reset to default values when objects are deleted." +msgid "" +"If enabled, generated identifier properties will be reset to default values " +"when objects are deleted." msgstr "如果开启,在对象被删除时生成的标识属性将被重设为默认值。" -#. Tag: entry -#, no-c-format -msgid "hibernate.use_sql_comments" +#. Tag: property +#: configuration.xml:449 +#, fuzzy, no-c-format +msgid "hibernate.use_sql_comments" msgstr "hibernate.use_sql_comments" #. Tag: entry +#: configuration.xml:451 #, no-c-format -msgid "If turned on, Hibernate will generate comments inside the SQL, for easier debugging, defaults to false." -msgstr "如果开启,Hibernate 将在 SQL 中生成有助于调试的注释信息,默认值为 false。" +msgid "" +"If turned on, Hibernate will generate comments inside the SQL, for easier " +"debugging, defaults to false." +msgstr "" +"如果开启,Hibernate 将在 SQL 中生成有助于调试的注释信息,默认值为 " +"false。" + +#. Tag: property +#: configuration.xml:458 +#, no-c-format +msgid "hibernate.id.new_generator_mappings" +msgstr "" + +#. Tag: entry +#: configuration.xml:460 +#, no-c-format +msgid "" +"Setting is relevant when using @GeneratedValue. It " +"indicates whether or not the new IdentifierGenerator " +"implementations are used for javax.persistence.GenerationType." +"AUTO, javax.persistence.GenerationType.TABLE and javax.persistence.GenerationType.SEQUENCE. Default to false to keep backward " +"compatibility." +msgstr "" + +#. Tag: para +#: configuration.xml:476 +#, no-c-format +msgid "" +"We recommend all new projects which make use of to use " +"@GeneratedValue to also set hibernate.id." +"new_generator_mappings=true as the new generators are more efficient " +"and closer to the JPA 2 specification semantic. However they are not " +"backward compatible with existing databases (if a sequence or a table is " +"used for id generation)." +msgstr "" #. Tag: title +#: configuration.xml:485 #, no-c-format msgid "Hibernate JDBC and Connection Properties" msgstr "Hibernate JDBC 和连接(connection)属性" -#. Tag: entry -#, no-c-format -msgid "hibernate.jdbc.fetch_size" +#. Tag: property +#: configuration.xml:503 +#, fuzzy, no-c-format +msgid "hibernate.jdbc.fetch_size" msgstr "hibernate.jdbc.fetch_size" #. Tag: entry +#: configuration.xml:505 #, no-c-format -msgid "A non-zero value determines the JDBC fetch size (calls Statement.setFetchSize())." -msgstr "非零值,指定 JDBC 抓取数量的大小(调用 Statement.setFetchSize())。" +msgid "" +"A non-zero value determines the JDBC fetch size (calls Statement." +"setFetchSize())." +msgstr "" +"非零值,指定 JDBC 抓取数量的大小(调用 Statement.setFetchSize())。" -#. Tag: entry -#, no-c-format -msgid "hibernate.jdbc.batch_size" +#. Tag: property +#: configuration.xml:510 +#, fuzzy, no-c-format +msgid "hibernate.jdbc.batch_size" msgstr "hibernate.jdbc.batch_size" #. Tag: entry +#: configuration.xml:512 #, no-c-format msgid "A non-zero value enables use of JDBC2 batch updates by Hibernate." msgstr "非零值,允许 Hibernate 使用 JDBC2 的批量更新。" #. Tag: para +#: configuration.xml:513 #, no-c-format -msgid "e.g. recommended values between 5 and 30" -msgstr "例如:建议取 530 之间的值 " +msgid "" +"e.g. recommended values between " +"5 and 30" +msgstr "" +"例如:建议取 5 到 " +"30 之间的值 " -#. Tag: entry -#, no-c-format -msgid "hibernate.jdbc.batch_versioned_data" +#. Tag: property +#: configuration.xml:519 +#, fuzzy, no-c-format +msgid "hibernate.jdbc.batch_versioned_data" msgstr "hibernate.jdbc.batch_versioned_data" #. Tag: entry -#, no-c-format -msgid "Set this property to true if your JDBC driver returns correct row counts from executeBatch(). Iit is usually safe to turn this option on. Hibernate will then use batched DML for automatically versioned data. Defaults to false." -msgstr "如果你想让你的 JDBC 驱动从 true 返回正确的行计数 ,那么将此属性设为 executeBatch()(开启这个选项通常是安全的)。同时,Hibernate 将为自动版本化的数据使用批量 DML。默认值为 false。 " +#: configuration.xml:521 +#, fuzzy, no-c-format +msgid "" +"Set this property to true if your JDBC driver returns " +"correct row counts from executeBatch(). It is usually " +"safe to turn this option on. Hibernate will then use batched DML for " +"automatically versioned data. Defaults to false." +msgstr "" +"如果你想让你的 JDBC 驱动从 true 返回正确的行计数 ,那么将" +"此属性设为 executeBatch()(开启这个选项通常是安全的)。同" +"时,Hibernate 将为自动版本化的数据使用批量 DML。默认值为 false。 " -#. Tag: entry -#, no-c-format -msgid "hibernate.jdbc.factory_class" +#. Tag: property +#: configuration.xml:531 +#, fuzzy, no-c-format +msgid "hibernate.jdbc.factory_class" msgstr "hibernate.jdbc.factory_class" #. Tag: entry +#: configuration.xml:533 #, no-c-format -msgid "Select a custom org.hibernate.jdbc.Batcher. Most applications will not need this configuration property." -msgstr "选择一个自定义的 Batcher。多数应用程序不需要这个配置属性。 " +msgid "" +"Select a custom org.hibernate.jdbc.Batcher. " +"Most applications will not need this configuration property." +msgstr "" +"选择一个自定义的 Batcher。多数应用程序不需要这个配置属" +"性。 " #. Tag: para +#: configuration.xml:535 #, no-c-format -msgid "e.g. classname.of.BatcherFactory" -msgstr "例如:classname.of.Batcher " +msgid "" +"e.g. classname.of." +"BatcherFactory" +msgstr "" +"例如:classname.of.Batcher " -#. Tag: entry -#, no-c-format -msgid "hibernate.jdbc.use_scrollable_resultset" +#. Tag: property +#: configuration.xml:541 +#, fuzzy, no-c-format +msgid "hibernate.jdbc.use_scrollable_resultset" msgstr "hibernate.jdbc.use_scrollable_resultset" #. Tag: entry +#: configuration.xml:543 #, no-c-format -msgid "Enables use of JDBC2 scrollable resultsets by Hibernate. This property is only necessary when using user-supplied JDBC connections. Hibernate uses connection metadata otherwise." -msgstr "允许 Hibernate 使用 JDBC2 的可滚动结果集。只有在使用用户提供的 JDBC 连接时,这个选项才是必要的,否则 Hibernate 会使用连接的元数据。 " +msgid "" +"Enables use of JDBC2 scrollable resultsets by Hibernate. This property is " +"only necessary when using user-supplied JDBC connections. Hibernate uses " +"connection metadata otherwise." +msgstr "" +"允许 Hibernate 使用 JDBC2 的可滚动结果集。只有在使用用户提供的 JDBC 连接时," +"这个选项才是必要的,否则 Hibernate 会使用连接的元数据。 " -#. Tag: entry -#, no-c-format -msgid "hibernate.jdbc.use_streams_for_binary" +#. Tag: property +#: configuration.xml:551 +#, fuzzy, no-c-format +msgid "hibernate.jdbc.use_streams_for_binary" msgstr "hibernate.jdbc.use_streams_for_binary" #. Tag: entry +#: configuration.xml:553 #, no-c-format -msgid "Use streams when writing/reading binary or serializable types to/from JDBC. *system-level property*" -msgstr "在 JDBC 读写 binaryserializable 的类型时使用流(stream)(系统级属性)。 " +msgid "" +"Use streams when writing/reading binary or " +"serializable types to/from JDBC. *system-level " +"property*" +msgstr "" +"在 JDBC 读写 binaryserializable 的" +"类型时使用流(stream)(系统级属性)。 " -#. Tag: entry -#, no-c-format -msgid "hibernate.jdbc.use_get_generated_keys" +#. Tag: property +#: configuration.xml:561 +#, fuzzy, no-c-format +msgid "hibernate.jdbc.use_get_generated_keys" msgstr "hibernate.jdbc.use_get_generated_keys" #. Tag: entry +#: configuration.xml:563 #, no-c-format -msgid "Enables use of JDBC3 PreparedStatement.getGeneratedKeys() to retrieve natively generated keys after insert. Requires JDBC3+ driver and JRE1.4+, set to false if your driver has problems with the Hibernate identifier generators. By default, it tries to determine the driver capabilities using connection metadata." -msgstr "在数据插入数据库之后,允许使用 JDBC3 PreparedStatement.getGeneratedKeys() 来获取数据库生成的 key(键)。需要 JDBC3+ 驱动和 JRE1.4+,如果你的数据库驱动在使用 Hibernate 的标识生成器时遇到问题,请将此值设为 false。默认情况下将使用连接的元数据来判定驱动的能力。 " +msgid "" +"Enables use of JDBC3 PreparedStatement.getGeneratedKeys() " +"to retrieve natively generated keys after insert. Requires JDBC3+ driver and " +"JRE1.4+, set to false if your driver has problems with the Hibernate " +"identifier generators. By default, it tries to determine the driver " +"capabilities using connection metadata." +msgstr "" +"在数据插入数据库之后,允许使用 JDBC3 PreparedStatement." +"getGeneratedKeys() 来获取数据库生成的 key(键)。需要 JDBC3+ 驱动" +"和 JRE1.4+,如果你的数据库驱动在使用 Hibernate 的标识生成器时遇到问题,请将此" +"值设为 false。默认情况下将使用连接的元数据来判定驱动的能力。 " #. Tag: para +#: configuration.xml:569 configuration.xml:678 configuration.xml:687 +#: configuration.xml:696 configuration.xml:723 #, no-c-format msgid "e.g. true|false" -msgstr "例如:true | false " +msgstr "" +"例如:true | false " -#. Tag: entry -#, no-c-format -msgid "hibernate.connection.provider_class" +#. Tag: property +#: configuration.xml:574 +#, fuzzy, no-c-format +msgid "hibernate.connection.provider_class" msgstr "hibernate.connection.provider_class" #. Tag: entry +#: configuration.xml:576 #, no-c-format -msgid "The classname of a custom org.hibernate.connection.ConnectionProvider which provides JDBC connections to Hibernate." -msgstr "自定义 ConnectionProvider 的类名,此类用来向 Hibernate 提供 JDBC 连接。 " +msgid "" +"The classname of a custom org.hibernate.connection." +"ConnectionProvider which provides JDBC connections to " +"Hibernate." +msgstr "" +"自定义 ConnectionProvider 的类名,此类用来向 Hibernate 提" +"供 JDBC 连接。 " #. Tag: para +#: configuration.xml:578 #, no-c-format -msgid "e.g. classname.of.ConnectionProvider" -msgstr "例如:classname.of.ConnectionProvider " +msgid "" +"e.g. classname.of." +"ConnectionProvider" +msgstr "" +"例如:classname.of." +"ConnectionProvider " -#. Tag: entry -#, no-c-format -msgid "hibernate.connection.isolation" +#. Tag: property +#: configuration.xml:584 +#, fuzzy, no-c-format +msgid "hibernate.connection.isolation" msgstr "hibernate.connection.isolation" #. Tag: entry +#: configuration.xml:586 #, no-c-format -msgid "Sets the JDBC transaction isolation level. Check java.sql.Connection for meaningful values, but note that most databases do not support all isolation levels and some define additional, non-standard isolations." -msgstr "设置 JDBC 事务隔离级别。查看 java.sql.Connection 来了解各个值的具体意义,但请注意多数数据库都不支持所有的隔离级别。 " +msgid "" +"Sets the JDBC transaction isolation level. Check java.sql." +"Connection for meaningful values, but note that most " +"databases do not support all isolation levels and some define additional, " +"non-standard isolations." +msgstr "" +"设置 JDBC 事务隔离级别。查看 java.sql.Connection 来了解各" +"个值的具体意义,但请注意多数数据库都不支持所有的隔离级别。 " #. Tag: para +#: configuration.xml:589 #, no-c-format msgid "e.g. 1, 2, 4, 8" -msgstr "例如:1, 2, 4, 8 " +msgstr "" +"例如:1, 2, 4, 8 " -#. Tag: entry -#, no-c-format -msgid "hibernate.connection.autocommit" +#. Tag: property +#: configuration.xml:595 +#, fuzzy, no-c-format +msgid "hibernate.connection.autocommit" msgstr "hibernate.connection.autocommit" #. Tag: entry +#: configuration.xml:597 #, no-c-format msgid "Enables autocommit for JDBC pooled connections (it is not recommended)." msgstr "允许被缓存的 JDBC 连接开启自动提交(autocommit)(不推荐)。" -#. Tag: entry -#, no-c-format -msgid "hibernate.connection.release_mode" +#. Tag: property +#: configuration.xml:603 +#, fuzzy, no-c-format +msgid "hibernate.connection.release_mode" msgstr "hibernate.connection.release_mode" #. Tag: entry +#: configuration.xml:605 #, no-c-format -msgid "Specifies when Hibernate should release JDBC connections. By default, a JDBC connection is held until the session is explicitly closed or disconnected. For an application server JTA datasource, use after_statement to aggressively release connections after every JDBC call. For a non-JTA connection, it often makes sense to release the connection at the end of each transaction, by using after_transaction. auto will choose after_statement for the JTA and CMT transaction strategies and after_transaction for the JDBC transaction strategy." -msgstr "指定 Hibernate 在何时释放 JDBC 连接。默认情况下,直到 Session 被显式关闭或被断开连接时,才会释放 JDBC 连接。对于应用程序服务器的 JTA 数据源,你应当使用 after_statement,这样在每次 JDBC 调用后,都会主动的释放连接。对于非 JTA 的连接,使用 after_transaction 在每个事务结束时释放连接是合理的。auto 将为 JTA 和 CMT 事务策略选择 after_statement,为JDBC事务策略选择 after_transaction。" +msgid "" +"Specifies when Hibernate should release JDBC connections. By default, a JDBC " +"connection is held until the session is explicitly closed or disconnected. " +"For an application server JTA datasource, use after_statement to aggressively release connections after every JDBC call. For a " +"non-JTA connection, it often makes sense to release the connection at the " +"end of each transaction, by using after_transaction. " +"auto will choose after_statement for " +"the JTA and CMT transaction strategies and after_transaction for the JDBC transaction strategy." +msgstr "" +"指定 Hibernate 在何时释放 JDBC 连接。默认情况下,直到 Session 被显式关闭或被断" +"开连接时,才会释放 JDBC 连接。对于应用程序服务器的 JTA 数据源,你应当使用 " +"after_statement,这样在每次 JDBC 调用后,都会主动的释放连" +"接。对于非 JTA 的连接,使用 after_transaction 在每个事务结" +"束时释放连接是合理的。auto 将为 JTA 和 CMT 事务策略选择 " +"after_statement,为JDBC事务策略选择 " +"after_transaction。" #. Tag: para +#: configuration.xml:615 #, no-c-format -msgid "e.g. auto (default) | on_close | after_transaction | after_statement" -msgstr "例如:auto (默认) | on_close | after_transaction | after_statement " +msgid "" +"e.g. auto (default) " +"| on_close | after_transaction | " +"after_statement" +msgstr "" +"例如:auto (默认) | " +"on_close | after_transaction | " +"after_statement " #. Tag: para -#, no-c-format -msgid "This setting only affects Sessions returned from SessionFactory.openSession. For Sessions obtained through SessionFactory.getCurrentSession, the CurrentSessionContext implementation configured for use controls the connection release mode for those Sessions. See " -msgstr "注意,这些设置仅对通过 SessionFactory.openSession 得到的 Session 起作用。对于通过 SessionFactory.getCurrentSession 得到的 Session,所配置的 CurrentSessionContext 实现控制这些 Session 的连接释放模式。请参阅 。" +#: configuration.xml:618 +#, fuzzy, no-c-format +msgid "" +"This setting only affects Sessions returned from " +"SessionFactory.openSession. For Sessions obtained through SessionFactory.getCurrentSession, the CurrentSessionContext implementation " +"configured for use controls the connection release mode for those " +"Sessions. See" +msgstr "" +"注意,这些设置仅对通过 SessionFactory.openSession 得到的 " +"Session 起作用。对于通过 SessionFactory." +"getCurrentSession 得到的 Session,所配置的 " +"CurrentSessionContext 实现控制这些 Session 的连接释放模式。请参阅 。" #. Tag: entry +#: configuration.xml:630 #, no-c-format -msgid "hibernate.connection.<propertyName>" -msgstr "hibernate.connection.<propertyName>" +msgid "" +"hibernate.connection.<propertyName>" +msgstr "" +"hibernate.connection.<propertyName>" #. Tag: entry +#: configuration.xml:632 #, no-c-format -msgid "Pass the JDBC property <propertyName> to DriverManager.getConnection()." -msgstr "把 JDBC 属性 <propertyName> 传递给 DriverManager.getConnection()。" +msgid "" +"Pass the JDBC property <propertyName> to " +"DriverManager.getConnection()." +msgstr "" +"把 JDBC 属性 <propertyName> 传递给 " +"DriverManager.getConnection()。" #. Tag: entry +#: configuration.xml:638 #, no-c-format -msgid "hibernate.jndi.<propertyName>" -msgstr "hibernate.jndi.<propertyName>" +msgid "" +"hibernate.jndi.<propertyName>" +msgstr "" +"hibernate.jndi.<propertyName>" #. Tag: entry +#: configuration.xml:640 #, no-c-format -msgid "Pass the property <propertyName> to the JNDI InitialContextFactory." -msgstr "把 <propertyName> 属性传递给 JNDI InitialContextFactory。" +msgid "" +"Pass the property <propertyName> to the JNDI " +"InitialContextFactory." +msgstr "" +"把 <propertyName> 属性传递给 JNDI " +"InitialContextFactory。" #. Tag: title +#: configuration.xml:648 #, no-c-format msgid "Hibernate Cache Properties" msgstr "Hibernate 缓存属性" -#. Tag: entry -#, no-c-format -msgid "hibernate.cache.provider_class" +#. Tag: literal +#: configuration.xml:665 +#, fuzzy, no-c-format +msgid "hibernate.cache.provider_class" msgstr "hibernate.cache.provider_class" #. Tag: entry +#: configuration.xml:667 #, no-c-format msgid "The classname of a custom CacheProvider." msgstr "自定义的 CacheProvider 的类名。" #. Tag: para +#: configuration.xml:668 #, no-c-format -msgid "e.g. classname.of.CacheProvider" -msgstr "例如:classname.of.CacheProvider " +msgid "" +"e.g. classname.of." +"CacheProvider" +msgstr "" +"例如:classname.of." +"CacheProvider " -#. Tag: entry -#, no-c-format -msgid "hibernate.cache.use_minimal_puts" +#. Tag: literal +#: configuration.xml:673 +#, fuzzy, no-c-format +msgid "hibernate.cache.use_minimal_puts" msgstr "hibernate.cache.use_minimal_puts" #. Tag: entry +#: configuration.xml:675 #, no-c-format -msgid "Optimizes second-level cache operation to minimize writes, at the cost of more frequent reads. This setting is most useful for clustered caches and, in Hibernate3, is enabled by default for clustered cache implementations." -msgstr "以频繁的读操作为代价,优化二级缓存来最小化写操作。在 Hibernate3 中,这个设置对的集群缓存非常有用,对集群缓存的实现而言,默认是开启的。 " +msgid "" +"Optimizes second-level cache operation to minimize writes, at the cost of " +"more frequent reads. This setting is most useful for clustered caches and, " +"in Hibernate3, is enabled by default for clustered cache implementations." +msgstr "" +"以频繁的读操作为代价,优化二级缓存来最小化写操作。在 Hibernate3 中,这个设置" +"对的集群缓存非常有用,对集群缓存的实现而言,默认是开启的。 " -#. Tag: entry -#, no-c-format -msgid "hibernate.cache.use_query_cache" +#. Tag: literal +#: configuration.xml:684 +#, fuzzy, no-c-format +msgid "hibernate.cache.use_query_cache" msgstr "hibernate.cache.use_query_cache" #. Tag: entry +#: configuration.xml:686 #, no-c-format -msgid "Enables the query cache. Individual queries still have to be set cachable." +msgid "" +"Enables the query cache. Individual queries still have to be set cachable." msgstr "允许查询缓存,个别查询仍然需要被设置为可缓存的。 " -#. Tag: entry -#, no-c-format -msgid "hibernate.cache.use_second_level_cache" +#. Tag: literal +#: configuration.xml:692 +#, fuzzy, no-c-format +msgid "hibernate.cache.use_second_level_cache" msgstr "hibernate.cache.use_second_level_cache" #. Tag: entry +#: configuration.xml:694 #, no-c-format -msgid "Can be used to completely disable the second level cache, which is enabled by default for classes which specify a <cache> mapping." -msgstr "能用来完全禁止使用二级缓存。对那些在类的映射定义中指定 <cache> 的类,会默认开启二级缓存。 " +msgid "" +"Can be used to completely disable the second level cache, which is enabled " +"by default for classes which specify a <cache> " +"mapping." +msgstr "" +"能用来完全禁止使用二级缓存。对那些在类的映射定义中指定 <cache>" +" 的类,会默认开启二级缓存。 " -#. Tag: entry -#, no-c-format -msgid "hibernate.cache.query_cache_factory" +#. Tag: literal +#: configuration.xml:702 +#, fuzzy, no-c-format +msgid "hibernate.cache.query_cache_factory" msgstr "hibernate.cache.query_cache_factory" #. Tag: entry +#: configuration.xml:704 #, no-c-format -msgid "The classname of a custom QueryCache interface, defaults to the built-in StandardQueryCache." -msgstr "自定义实现 QueryCache 接口的类名,默认为内建的 StandardQueryCache。" +msgid "" +"The classname of a custom QueryCache interface, defaults " +"to the built-in StandardQueryCache." +msgstr "" +"自定义实现 QueryCache 接口的类名,默认为内建的 " +"StandardQueryCache。" #. Tag: para +#: configuration.xml:706 #, no-c-format -msgid "e.g. classname.of.QueryCache" -msgstr "例如:classname.of.QueryCache " +msgid "" +"e.g. classname.of.QueryCache" +msgstr "" +"例如:classname.of.QueryCache " -#. Tag: entry -#, no-c-format -msgid "hibernate.cache.region_prefix" +#. Tag: literal +#: configuration.xml:712 +#, fuzzy, no-c-format +msgid "hibernate.cache.region_prefix" msgstr "hibernate.cache.region_prefix" #. Tag: entry +#: configuration.xml:714 #, no-c-format msgid "A prefix to use for second-level cache region names." msgstr "二级缓存区域名的前缀。" #. Tag: para +#: configuration.xml:714 #, no-c-format msgid "e.g. prefix" msgstr "例如:prefix " -#. Tag: entry -#, no-c-format -msgid "hibernate.cache.use_structured_entries" +#. Tag: literal +#: configuration.xml:720 +#, fuzzy, no-c-format +msgid "hibernate.cache.use_structured_entries" msgstr "hibernate.cache.use_structured_entries" #. Tag: entry +#: configuration.xml:722 #, no-c-format -msgid "Forces Hibernate to store data in the second-level cache in a more human-friendly format." +msgid "" +"Forces Hibernate to store data in the second-level cache in a more human-" +"friendly format." msgstr "强制 Hibernate 以更人性化的格式将数据存入二级缓存。" +#. Tag: literal +#: configuration.xml:729 +#, no-c-format +msgid "hibernate.cache.default_cache_concurrency_strategy" +msgstr "" + +#. Tag: entry +#: configuration.xml:731 +#, no-c-format +msgid "" +"Setting used to give the name of the default org.hibernate." +"annotations.CacheConcurrencyStrategy to use when either " +"@Cacheable or @Cache is used. " +"@Cache(strategy=\"..\") is used to override this default." +msgstr "" + #. Tag: title +#: configuration.xml:744 #, no-c-format msgid "Hibernate Transaction Properties" msgstr "Hibernate 事务属性" -#. Tag: entry -#, no-c-format -msgid "hibernate.transaction.factory_class" +#. Tag: literal +#: configuration.xml:761 +#, fuzzy, no-c-format +msgid "hibernate.transaction.factory_class" msgstr "hibernate.transaction.factory_class" #. Tag: entry +#: configuration.xml:763 #, no-c-format -msgid "The classname of a TransactionFactory to use with Hibernate Transaction API (defaults to JDBCTransactionFactory)." -msgstr "一个 TransactionFactory 的类名,用于 Hibernate Transaction API(默认为 JDBCTransactionFactory)。" +msgid "" +"The classname of a TransactionFactory to use with " +"Hibernate Transaction API (defaults to " +"JDBCTransactionFactory)." +msgstr "" +"一个 TransactionFactory 的类名,用于 Hibernate " +"Transaction API(默认为 JDBCTransactionFactory)。" #. Tag: para +#: configuration.xml:765 #, no-c-format -msgid "e.g. classname.of.TransactionFactory" -msgstr "例如:classname.of.TransactionFactory " +msgid "" +"e.g. classname.of." +"TransactionFactory" +msgstr "" +"例如:classname.of." +"TransactionFactory " -#. Tag: entry -#, no-c-format -msgid "jta.UserTransaction" +#. Tag: literal +#: configuration.xml:771 +#, fuzzy, no-c-format +msgid "jta.UserTransaction" msgstr "jta.UserTransaction" #. Tag: entry +#: configuration.xml:773 #, no-c-format -msgid "A JNDI name used by JTATransactionFactory to obtain the JTA UserTransaction from the application server." -msgstr "一个 JNDI 名字,被 JTATransactionFactory 用来从应用服务器获取 JTA UserTransaction。" +msgid "" +"A JNDI name used by JTATransactionFactory to obtain the " +"JTA UserTransaction from the application server." +msgstr "" +"一个 JNDI 名字,被 JTATransactionFactory 用来从应用服务器" +"获取 JTA UserTransaction。" -#. Tag: entry -#, no-c-format -msgid "hibernate.transaction.manager_lookup_class" +#. Tag: literal +#: configuration.xml:781 +#, fuzzy, no-c-format +msgid "hibernate.transaction.manager_lookup_class" msgstr "hibernate.transaction.manager_lookup_class" #. Tag: entry +#: configuration.xml:783 #, no-c-format -msgid "The classname of a TransactionManagerLookup. It is required when JVM-level caching is enabled or when using hilo generator in a JTA environment." -msgstr "一个 TransactionManagerLookup 的类名 — 当使用 JVM 级缓存,或在 JTA 环境中使用 hilo 生成器的时候需要该类。 " +msgid "" +"The classname of a TransactionManagerLookup. It is " +"required when JVM-level caching is enabled or when using hilo generator in a " +"JTA environment." +msgstr "" +"一个 TransactionManagerLookup 的类名 — 当使用 JVM 级缓存," +"或在 JTA 环境中使用 hilo 生成器的时候需要该类。 " #. Tag: para +#: configuration.xml:786 #, no-c-format -msgid "e.g. classname.of.TransactionManagerLookup" -msgstr "例如:classname.of.TransactionManagerLookup " +msgid "" +"e.g. classname.of." +"TransactionManagerLookup" +msgstr "" +"例如:classname.of." +"TransactionManagerLookup " -#. Tag: entry -#, no-c-format -msgid "hibernate.transaction.flush_before_completion" +#. Tag: literal +#: configuration.xml:792 +#, fuzzy, no-c-format +msgid "hibernate.transaction.flush_before_completion" msgstr "hibernate.transaction.flush_before_completion" #. Tag: entry -#, no-c-format -msgid "If enabled, the session will be automatically flushed during the before completion phase of the transaction. Built-in and automatic session context management is preferred, see ." -msgstr "如果开启,session 在事务完成后将被自动清洗(flush)。现在更好的方法是使用自动 session 上下文管理。请参见 。 " +#: configuration.xml:794 +#, fuzzy, no-c-format +msgid "" +"If enabled, the session will be automatically flushed during the before " +"completion phase of the transaction. Built-in and automatic session context " +"management is preferred, see ." +msgstr "" +"如果开启,session 在事务完成后将被自动清洗(flush)。现在更好的方法是使用自" +"动 session 上下文管理。请参见 。 " -#. Tag: entry -#, no-c-format -msgid "hibernate.transaction.auto_close_session" +#. Tag: literal +#: configuration.xml:803 +#, fuzzy, no-c-format +msgid "hibernate.transaction.auto_close_session" msgstr "hibernate.transaction.auto_close_session" #. Tag: entry -#, no-c-format -msgid "If enabled, the session will be automatically closed during the after completion phase of the transaction. Built-in and automatic session context management is preferred, see ." -msgstr "如果开启,session 在事务完成后将被自动关闭。 现在更好的方法是使用自动 session 上下文管理。请参见 。 " +#: configuration.xml:805 +#, fuzzy, no-c-format +msgid "" +"If enabled, the session will be automatically closed during the after " +"completion phase of the transaction. Built-in and automatic session context " +"management is preferred, see ." +msgstr "" +"如果开启,session 在事务完成后将被自动关闭。 现在更好的方法是使用自动 " +"session 上下文管理。请参见 。 " #. Tag: title +#: configuration.xml:817 #, no-c-format msgid "Miscellaneous Properties" msgstr "其他属性" -#. Tag: entry -#, no-c-format -msgid "hibernate.current_session_context_class" +#. Tag: literal +#: configuration.xml:834 +#, fuzzy, no-c-format +msgid "hibernate.current_session_context_class" msgstr "hibernate.current_session_context_class" #. Tag: entry -#, no-c-format -msgid "Supply a custom strategy for the scoping of the \"current\" Session. See for more information about the built-in strategies." -msgstr "为\"当前\" Session 指定一个(自定义的)策略。关于内置策略的详情,请参见 。 " +#: configuration.xml:836 +#, fuzzy, no-c-format +msgid "" +"Supply a custom strategy for the scoping of the \"current\" " +"Session. See for more information about the built-in strategies." +msgstr "" +"为\"当前\" Session 指定一个(自定义的)策略。关于内置策略" +"的详情,请参见 。 " #. Tag: para +#: configuration.xml:839 #, no-c-format -msgid "e.g. jta | thread | managed | custom.Class" -msgstr "例如:jta | thread | managed | custom.Class " +msgid "" +"e.g. jta | " +"thread | managed | custom." +"Class" +msgstr "" +"例如:jta | " +"thread | managed | custom." +"Class " -#. Tag: entry -#, no-c-format -msgid "hibernate.query.factory_class" +#. Tag: literal +#: configuration.xml:846 +#, fuzzy, no-c-format +msgid "hibernate.query.factory_class" msgstr "hibernate.query.factory_class" #. Tag: entry +#: configuration.xml:848 #, no-c-format msgid "Chooses the HQL parser implementation." msgstr "选择 HQL 解析器的实现。" #. Tag: para +#: configuration.xml:848 #, no-c-format -msgid "e.g. org.hibernate.hql.ast.ASTQueryTranslatorFactory or org.hibernate.hql.classic.ClassicQueryTranslatorFactory" -msgstr "例如:org.hibernate.hql.ast.ASTQueryTranslatorFactoryorg.hibernate.hql.classic.ClassicQueryTranslatorFactory " +msgid "" +"e.g. org.hibernate.hql.ast." +"ASTQueryTranslatorFactory or org.hibernate.hql.classic." +"ClassicQueryTranslatorFactory" +msgstr "" +"例如:org.hibernate.hql.ast." +"ASTQueryTranslatorFactoryorg.hibernate.hql.classic." +"ClassicQueryTranslatorFactory " + +#. Tag: literal +#: configuration.xml:857 +#, fuzzy, no-c-format +msgid "hibernate.query.substitutions" +msgstr "hibernate.query.substitutions true=1,false=0" #. Tag: entry +#: configuration.xml:859 #, no-c-format -msgid "hibernate.query.substitutions" -msgstr "hibernate.query.substitutions" - -#. Tag: entry -#, no-c-format -msgid "Is used to map from tokens in Hibernate queries to SQL tokens (tokens might be function or literal names, for example)." -msgstr "将 Hibernate 查询中的符号映射到 SQL 查询中的符号(符号可能是函数名或常量名字)。 " +msgid "" +"Is used to map from tokens in Hibernate queries to SQL tokens (tokens might " +"be function or literal names, for example)." +msgstr "" +"将 Hibernate 查询中的符号映射到 SQL 查询中的符号(符号可能是函数名或常量名" +"字)。 " #. Tag: para +#: configuration.xml:861 #, no-c-format -msgid "e.g. hqlLiteral=SQL_LITERAL, hqlFunction=SQLFUNC" -msgstr "例如:hqlLiteral=SQL_LITERAL, hqlFunction=SQLFUNC " +msgid "" +"e.g. hqlLiteral=SQL_LITERAL, " +"hqlFunction=SQLFUNC" +msgstr "" +"例如:hqlLiteral=SQL_LITERAL, " +"hqlFunction=SQLFUNC " -#. Tag: entry -#, no-c-format -msgid "hibernate.hbm2ddl.auto" +#. Tag: literal +#: configuration.xml:867 +#, fuzzy, no-c-format +msgid "hibernate.hbm2ddl.auto" msgstr "hibernate.hbm2ddl.auto" #. Tag: entry +#: configuration.xml:869 #, no-c-format -msgid "Automatically validates or exports schema DDL to the database when the SessionFactory is created. With create-drop, the database schema will be dropped when the SessionFactory is closed explicitly." -msgstr "在 SessionFactory 创建时,自动检查数据库结构,或者将数据库 schema 的 DDL 导出到数据库。使用 create-drop 时,在显式关闭 SessionFactory 时,将删除掉数据库 schema。 " +msgid "" +"Automatically validates or exports schema DDL to the database when the " +"SessionFactory is created. With create-drop, the database schema will be dropped when the " +"SessionFactory is closed explicitly." +msgstr "" +"在 SessionFactory 创建时,自动检查数据库结构,或者将数据" +"库 schema 的 DDL 导出到数据库。使用 create-drop 时,在显式" +"关闭 SessionFactory 时,将删除掉数据库 schema。 " #. Tag: para +#: configuration.xml:873 #, no-c-format -msgid "e.g. validate | update | create | create-drop" -msgstr "例如:validate | update | create | create-drop " +msgid "" +"e.g. validate | " +"update | create | create-" +"drop" +msgstr "" +"例如:validate | " +"update | create | create-" +"drop " -#. Tag: entry +#. Tag: literal +#: configuration.xml:880 +#, fuzzy, no-c-format +msgid "hibernate.hbm2ddl.import_file" +msgstr "hibernate.hbm2ddl.auto" + +#. Tag: para +#: configuration.xml:882 #, no-c-format -msgid "hibernate.cglib.use_reflection_optimizer" +msgid "" +"Comma-separated names of the optional files containing SQL DML statements " +"executed during the SessionFactory creation. This is " +"useful for testing or demoing: by adding INSERT statements for example you " +"can populate your database with a minimal set of data when it is deployed." +msgstr "" + +#. Tag: para +#: configuration.xml:887 +#, no-c-format +msgid "" +"File order matters, the statements of a give file are executed before the " +"statements of the following files. These statements are only executed if the " +"schema is created ie if hibernate.hbm2ddl.auto is set to " +"create or create-drop." +msgstr "" + +#. Tag: para +#: configuration.xml:892 +#, fuzzy, no-c-format +msgid "" +"e.g. /humans.sql,/dogs.sql" +msgstr "" +"例如:true | false " + +#. Tag: literal +#: configuration.xml:898 +#, fuzzy, no-c-format +msgid "hibernate.cglib.use_reflection_optimizer" msgstr "hibernate.cglib.use_reflection_optimizer" #. Tag: entry +#: configuration.xml:900 #, no-c-format -msgid "Enables the use of CGLIB instead of runtime reflection (System-level property). Reflection can sometimes be useful when troubleshooting. Hibernate always requires CGLIB even if you turn off the optimizer. You cannot set this property in hibernate.cfg.xml." -msgstr "开启 CGLIB 来替代运行时反射机制(系统级属性)。反射机制有时在除错时比较有用。注意即使关闭这个优化,Hibernate 还是需要 CGLIB。你不能在 hibernate.cfg.xml 中设置此属性。 " +msgid "" +"Enables the use of CGLIB instead of runtime reflection (System-level " +"property). Reflection can sometimes be useful when troubleshooting. " +"Hibernate always requires CGLIB even if you turn off the optimizer. You " +"cannot set this property in hibernate.cfg.xml." +msgstr "" +"开启 CGLIB 来替代运行时反射机制(系统级属性)。反射机制有时在除错时比较有用。" +"注意即使关闭这个优化,Hibernate 还是需要 CGLIB。你不能在 hibernate." +"cfg.xml 中设置此属性。 " #. Tag: title +#: configuration.xml:913 #, no-c-format msgid "SQL Dialects" msgstr "SQL 方言" #. Tag: para +#: configuration.xml:915 #, no-c-format -msgid "Always set the hibernate.dialect property to the correct org.hibernate.dialect.Dialect subclass for your database. If you specify a dialect, Hibernate will use sensible defaults for some of the other properties listed above. This means that you will not have to specify them manually." -msgstr "你应当总是为你的数据库将 hibernate.dialect 属性设置成正确的 org.hibernate.dialect.Dialect 子类。如果你指定一种方言,Hibernate 将为上面列出的一些属性使用合理的默认值,这样你就不用手工指定它们。" +msgid "" +"Always set the hibernate.dialect property to the correct " +"org.hibernate.dialect.Dialect subclass for your database. " +"If you specify a dialect, Hibernate will use sensible defaults for some of " +"the other properties listed above. This means that you will not have to " +"specify them manually." +msgstr "" +"你应当总是为你的数据库将 hibernate.dialect 属性设置成正确" +"的 org.hibernate.dialect.Dialect 子类。如果你指定一种方" +"言,Hibernate 将为上面列出的一些属性使用合理的默认值,这样你就不用手工指定它" +"们。" #. Tag: title +#: configuration.xml:922 #, no-c-format msgid "Hibernate SQL Dialects (hibernate.dialect)" msgstr "Hibernate SQL 方言(hibernate.dialect)" #. Tag: entry +#: configuration.xml:933 #, no-c-format msgid "RDBMS" msgstr "RDBMS" #. Tag: entry +#: configuration.xml:935 #, no-c-format msgid "Dialect" msgstr "Dialect" #. Tag: entry +#: configuration.xml:941 #, no-c-format -msgid "DB2" -msgstr "DB2" +msgid "DB2" +msgstr "DB2" -#. Tag: entry -#, no-c-format -msgid "org.hibernate.dialect.DB2Dialect" +#. Tag: literal +#: configuration.xml:943 +#, fuzzy, no-c-format +msgid "org.hibernate.dialect.DB2Dialect" msgstr "org.hibernate.dialect.DB2Dialect" #. Tag: entry +#: configuration.xml:947 #, no-c-format msgid "DB2 AS/400" msgstr "DB2 AS/400" -#. Tag: entry -#, no-c-format -msgid "org.hibernate.dialect.DB2400Dialect" +#. Tag: literal +#: configuration.xml:949 +#, fuzzy, no-c-format +msgid "org.hibernate.dialect.DB2400Dialect" msgstr "org.hibernate.dialect.DB2400Dialect" #. Tag: entry +#: configuration.xml:953 #, no-c-format msgid "DB2 OS390" msgstr "DB2 OS390" -#. Tag: entry -#, no-c-format -msgid "org.hibernate.dialect.DB2390Dialect" +#. Tag: literal +#: configuration.xml:955 +#, fuzzy, no-c-format +msgid "org.hibernate.dialect.DB2390Dialect" msgstr "org.hibernate.dialect.DB2390Dialect" #. Tag: entry +#: configuration.xml:959 #, no-c-format msgid "PostgreSQL" msgstr "PostgreSQL" -#. Tag: entry -#, no-c-format -msgid "org.hibernate.dialect.PostgreSQLDialect" +#. Tag: literal +#: configuration.xml:961 +#, fuzzy, no-c-format +msgid "org.hibernate.dialect.PostgreSQLDialect" msgstr "org.hibernate.dialect.PostgreSQLDialect" #. Tag: entry +#: configuration.xml:965 #, no-c-format msgid "MySQL" msgstr "MySQL" -#. Tag: entry -#, no-c-format -msgid "org.hibernate.dialect.MySQLDialect" +#. Tag: literal +#: configuration.xml:967 +#, fuzzy, no-c-format +msgid "org.hibernate.dialect.MySQLDialect" msgstr "org.hibernate.dialect.MySQLDialect" #. Tag: entry +#: configuration.xml:971 #, no-c-format msgid "MySQL with InnoDB" msgstr "MySQL with InnoDB" -#. Tag: entry -#, no-c-format -msgid "org.hibernate.dialect.MySQLInnoDBDialect" +#. Tag: literal +#: configuration.xml:973 +#, fuzzy, no-c-format +msgid "org.hibernate.dialect.MySQLInnoDBDialect" msgstr "org.hibernate.dialect.MySQLInnoDBDialect" #. Tag: entry +#: configuration.xml:977 #, no-c-format msgid "MySQL with MyISAM" msgstr "MySQL with MyISAM" -#. Tag: entry -#, no-c-format -msgid "org.hibernate.dialect.MySQLMyISAMDialect" +#. Tag: literal +#: configuration.xml:979 +#, fuzzy, no-c-format +msgid "org.hibernate.dialect.MySQLMyISAMDialect" msgstr "org.hibernate.dialect.MySQLMyISAMDialect" #. Tag: entry +#: configuration.xml:983 #, no-c-format msgid "Oracle (any version)" msgstr "Oracle(any version)" -#. Tag: entry -#, no-c-format -msgid "org.hibernate.dialect.OracleDialect" +#. Tag: literal +#: configuration.xml:985 +#, fuzzy, no-c-format +msgid "org.hibernate.dialect.OracleDialect" msgstr "org.hibernate.dialect.OracleDialect" #. Tag: entry +#: configuration.xml:989 #, no-c-format msgid "Oracle 9i" msgstr "Oracle 9i" -#. Tag: entry -#, no-c-format -msgid "org.hibernate.dialect.Oracle9iDialect" +#. Tag: literal +#: configuration.xml:991 +#, fuzzy, no-c-format +msgid "org.hibernate.dialect.Oracle9iDialect" msgstr "org.hibernate.dialect.Oracle9iDialect" #. Tag: entry +#: configuration.xml:995 #, no-c-format msgid "Oracle 10g" msgstr "Oracle 10g" -#. Tag: entry -#, no-c-format -msgid "org.hibernate.dialect.Oracle10gDialect" +#. Tag: literal +#: configuration.xml:997 +#, fuzzy, no-c-format +msgid "org.hibernate.dialect.Oracle10gDialect" msgstr "org.hibernate.dialect.Oracle10gDialect" #. Tag: entry +#: configuration.xml:1001 #, no-c-format msgid "Sybase" msgstr "Sybase" -#. Tag: entry -#, no-c-format -msgid "org.hibernate.dialect.SybaseDialect" +#. Tag: literal +#: configuration.xml:1003 +#, fuzzy, no-c-format +msgid "org.hibernate.dialect.SybaseDialect" msgstr "org.hibernate.dialect.SybaseDialect" #. Tag: entry +#: configuration.xml:1007 #, no-c-format msgid "Sybase Anywhere" msgstr "Sybase Anywhere" -#. Tag: entry -#, no-c-format -msgid "org.hibernate.dialect.SybaseAnywhereDialect" +#. Tag: literal +#: configuration.xml:1009 +#, fuzzy, no-c-format +msgid "org.hibernate.dialect.SybaseAnywhereDialect" msgstr "org.hibernate.dialect.SybaseAnywhereDialect" #. Tag: entry +#: configuration.xml:1013 #, no-c-format msgid "Microsoft SQL Server" msgstr "Microsoft SQL Server" -#. Tag: entry -#, no-c-format -msgid "org.hibernate.dialect.SQLServerDialect" +#. Tag: literal +#: configuration.xml:1015 +#, fuzzy, no-c-format +msgid "org.hibernate.dialect.SQLServerDialect" msgstr "org.hibernate.dialect.SQLServerDialect" #. Tag: entry +#: configuration.xml:1019 #, no-c-format msgid "SAP DB" msgstr "SAP DB" -#. Tag: entry -#, no-c-format -msgid "org.hibernate.dialect.SAPDBDialect" +#. Tag: literal +#: configuration.xml:1021 +#, fuzzy, no-c-format +msgid "org.hibernate.dialect.SAPDBDialect" msgstr "org.hibernate.dialect.SAPDBDialect" #. Tag: entry +#: configuration.xml:1025 #, no-c-format msgid "Informix" msgstr "Informix" -#. Tag: entry -#, no-c-format -msgid "org.hibernate.dialect.InformixDialect" +#. Tag: literal +#: configuration.xml:1027 +#, fuzzy, no-c-format +msgid "org.hibernate.dialect.InformixDialect" msgstr "org.hibernate.dialect.InformixDialect" #. Tag: entry +#: configuration.xml:1031 #, no-c-format msgid "HypersonicSQL" msgstr "HypersonicSQL" -#. Tag: entry -#, no-c-format -msgid "org.hibernate.dialect.HSQLDialect" +#. Tag: literal +#: configuration.xml:1033 +#, fuzzy, no-c-format +msgid "org.hibernate.dialect.HSQLDialect" msgstr "org.hibernate.dialect.HSQLDialect" #. Tag: entry +#: configuration.xml:1037 #, no-c-format msgid "Ingres" msgstr "Ingres" -#. Tag: entry -#, no-c-format -msgid "org.hibernate.dialect.IngresDialect" +#. Tag: literal +#: configuration.xml:1039 +#, fuzzy, no-c-format +msgid "org.hibernate.dialect.IngresDialect" msgstr "org.hibernate.dialect.IngresDialect" #. Tag: entry +#: configuration.xml:1043 #, no-c-format msgid "Progress" msgstr "Progress" -#. Tag: entry -#, no-c-format -msgid "org.hibernate.dialect.ProgressDialect" +#. Tag: literal +#: configuration.xml:1045 +#, fuzzy, no-c-format +msgid "org.hibernate.dialect.ProgressDialect" msgstr "org.hibernate.dialect.ProgressDialect" #. Tag: entry +#: configuration.xml:1049 #, no-c-format msgid "Mckoi SQL" msgstr "Mckoi SQL" -#. Tag: entry -#, no-c-format -msgid "org.hibernate.dialect.MckoiDialect" +#. Tag: literal +#: configuration.xml:1051 +#, fuzzy, no-c-format +msgid "org.hibernate.dialect.MckoiDialect" msgstr "org.hibernate.dialect.MckoiDialect" #. Tag: entry +#: configuration.xml:1055 #, no-c-format msgid "Interbase" msgstr "Interbase" -#. Tag: entry -#, no-c-format -msgid "org.hibernate.dialect.InterbaseDialect" +#. Tag: literal +#: configuration.xml:1057 +#, fuzzy, no-c-format +msgid "org.hibernate.dialect.InterbaseDialect" msgstr "org.hibernate.dialect.InterbaseDialect" #. Tag: entry +#: configuration.xml:1061 #, no-c-format msgid "Pointbase" msgstr "Pointbase" -#. Tag: entry -#, no-c-format -msgid "org.hibernate.dialect.PointbaseDialect" +#. Tag: literal +#: configuration.xml:1063 +#, fuzzy, no-c-format +msgid "org.hibernate.dialect.PointbaseDialect" msgstr "org.hibernate.dialect.PointbaseDialect" #. Tag: entry +#: configuration.xml:1067 #, no-c-format msgid "FrontBase" msgstr "FrontBase" -#. Tag: entry -#, no-c-format -msgid "org.hibernate.dialect.FrontbaseDialect" +#. Tag: literal +#: configuration.xml:1069 +#, fuzzy, no-c-format +msgid "org.hibernate.dialect.FrontbaseDialect" msgstr "org.hibernate.dialect.FrontbaseDialect" #. Tag: entry +#: configuration.xml:1073 #, no-c-format msgid "Firebird" msgstr "Firebird" -#. Tag: entry -#, no-c-format -msgid "org.hibernate.dialect.FirebirdDialect" +#. Tag: literal +#: configuration.xml:1075 +#, fuzzy, no-c-format +msgid "org.hibernate.dialect.FirebirdDialect" msgstr "org.hibernate.dialect.FirebirdDialect" #. Tag: title +#: configuration.xml:1083 #, no-c-format msgid "Outer Join Fetching" msgstr "外连接抓取(Outer Join Fetching)" #. Tag: para +#: configuration.xml:1085 #, no-c-format -msgid "If your database supports ANSI, Oracle or Sybase style outer joins, outer join fetching will often increase performance by limiting the number of round trips to and from the database. This is, however, at the cost of possibly more work performed by the database itself. Outer join fetching allows a whole graph of objects connected by many-to-one, one-to-many, many-to-many and one-to-one associations to be retrieved in a single SQL SELECT." -msgstr "如果你的数据库支持 ANSI、Oracle 或 Sybase 风格的外连接,外连接抓取通常能通过限制往返数据库次数(更多的工作交由数据库自己来完成)来提高效率。外连接抓取允许在单个 SELECT SQL 语句中, 通过 many-to-one、one-to-many、many-to-many 和 one-to-one 关联获取连接对象的整个对象图。" +msgid "" +"If your database supports ANSI, Oracle or Sybase style outer joins, " +"outer join fetching will often increase performance by " +"limiting the number of round trips to and from the database. This is, " +"however, at the cost of possibly more work performed by the database itself. " +"Outer join fetching allows a whole graph of objects connected by many-to-" +"one, one-to-many, many-to-many and one-to-one associations to be retrieved " +"in a single SQL SELECT." +msgstr "" +"如果你的数据库支持 ANSI、Oracle 或 Sybase 风格的外连接,外连接抓取" +"通常能通过限制往返数据库次数(更多的工作交由数据库自己来完成)来提" +"高效率。外连接抓取允许在单个 SELECT SQL 语句中, 通过 " +"many-to-one、one-to-many、many-to-many 和 one-to-one 关联获取连接对象的整个对" +"象图。" #. Tag: para +#: configuration.xml:1094 #, no-c-format -msgid "Outer join fetching can be disabled globally by setting the property hibernate.max_fetch_depth to 0. A setting of 1 or higher enables outer join fetching for one-to-one and many-to-one associations that have been mapped with fetch=\"join\"." -msgstr "将 hibernate.max_fetch_depth 设为 0 能在全局 范围内禁止外连接抓取。设为 1 或更高值能启用 one-to-one 和 many-to-oneouter 关联的外连接抓取,它们通过 fetch=\"join\" 来映射。 " +msgid "" +"Outer join fetching can be disabled globally by setting " +"the property hibernate.max_fetch_depth to 0. A setting of 1 or higher enables outer join " +"fetching for one-to-one and many-to-one associations that have been mapped " +"with fetch=\"join\"." +msgstr "" +"将 hibernate.max_fetch_depth 设为 0 能" +"在全局 范围内禁止外连接抓取。设为 1 " +"或更高值能启用 one-to-one 和 many-to-oneouter 关联的外连接抓取,它们通过 " +"fetch=\"join\" 来映射。 " #. Tag: para -#, no-c-format -msgid "See for more information." +#: configuration.xml:1100 +#, fuzzy, no-c-format +msgid "See for more information." msgstr "参见 获得更多信息。 " #. Tag: title +#: configuration.xml:1105 #, no-c-format msgid "Binary Streams" msgstr "二进制流(Binary Streams)" #. Tag: para +#: configuration.xml:1107 #, no-c-format -msgid "Oracle limits the size of byte arrays that can be passed to and/or from its JDBC driver. If you wish to use large instances of binary or serializable type, you should enable hibernate.jdbc.use_streams_for_binary. This is a system-level setting only." -msgstr "Oracle 限制那些通过 JDBC 驱动传输的字节数组的数目。如果你希望使用二进值(binary)可序列化的(serializable)类型的大对象,你应该开启 hibernate.jdbc.use_streams_for_binary 属性。这是系统级属性。 " +msgid "" +"Oracle limits the size of byte arrays that can be passed " +"to and/or from its JDBC driver. If you wish to use large instances of " +"binary or serializable type, you " +"should enable hibernate.jdbc.use_streams_for_binary. " +"This is a system-level setting only." +msgstr "" +"Oracle 限制那些通过 JDBC 驱动传输的字节数组的数目。如果你" +"希望使用二进值(binary)可序列化的" +"(serializable)类型的大对象,你应该开启 hibernate.jdbc." +"use_streams_for_binary 属性。这是系统级属性。 " #. Tag: title +#: configuration.xml:1116 #, no-c-format msgid "Second-level and query cache" msgstr "二级缓存与查询缓存" #. Tag: para -#, no-c-format -msgid "The properties prefixed by hibernate.cache allow you to use a process or cluster scoped second-level cache system with Hibernate. See the for more information." -msgstr "以 hibernate.cache 为前缀的属性允许你在 Hibernate 中,使用进程或群集范围内的二级缓存系统。参见 获取更多的详情。" +#: configuration.xml:1118 +#, fuzzy, no-c-format +msgid "" +"The properties prefixed by hibernate.cache allow you to " +"use a process or cluster scoped second-level cache system with Hibernate. " +"See the for more information." +msgstr "" +"以 hibernate.cache 为前缀的属性允许你在 Hibernate 中,使用" +"进程或群集范围内的二级缓存系统。参见 获" +"取更多的详情。" #. Tag: title +#: configuration.xml:1125 #, no-c-format msgid "Query Language Substitution" msgstr "查询语言中的替换" #. Tag: para +#: configuration.xml:1127 #, no-c-format -msgid "You can define new Hibernate query tokens using hibernate.query.substitutions. For example:" -msgstr "你可以使用 hibernate.query.substitutions 在 Hibernate 中定义新的查询符号。例如: " +msgid "" +"You can define new Hibernate query tokens using hibernate.query." +"substitutions. For example:" +msgstr "" +"你可以使用 hibernate.query.substitutions 在 Hibernate 中定" +"义新的查询符号。例如: " + +#. Tag: programlisting +#: configuration.xml:1130 +#, no-c-format +msgid "hibernate.query.substitutions true=1, false=0" +msgstr "hibernate.query.substitutions true=1,false=0" #. Tag: para +#: configuration.xml:1132 #, no-c-format -msgid "This would cause the tokens true and false to be translated to integer literals in the generated SQL." -msgstr "将导致符号 truefalse 在生成的 SQL 中被翻译成整数常量。" +msgid "" +"This would cause the tokens true and false to be translated to integer literals in the generated SQL." +msgstr "" +"将导致符号 truefalse 在生成的 SQL " +"中被翻译成整数常量。" + +#. Tag: programlisting +#: configuration.xml:1136 +#, no-c-format +msgid "hibernate.query.substitutions toLowercase=LOWER" +msgstr "hibernate.query.substitutions toLowercase=LOWER" #. Tag: para +#: configuration.xml:1138 #, no-c-format -msgid "This would allow you to rename the SQL LOWER function." +msgid "" +"This would allow you to rename the SQL LOWER function." msgstr "将允许你重命名 SQL 中的 LOWER 函数。" #. Tag: title +#: configuration.xml:1143 #, no-c-format msgid "Hibernate statistics" msgstr "Hibernate 的统计(statistics)机制" #. Tag: para +#: configuration.xml:1145 #, no-c-format -msgid "If you enable hibernate.generate_statistics, Hibernate exposes a number of metrics that are useful when tuning a running system via SessionFactory.getStatistics(). Hibernate can even be configured to expose these statistics via JMX. Read the Javadoc of the interfaces in org.hibernate.stats for more information." -msgstr "如果你开启 hibernate.generate_statistics,那么当你通过 SessionFactory.getStatistics() 调整正在运行的系统时,Hibernate 将导出大量有用的数据。Hibernate 甚至能被配置成通过 JMX 导出这些统计信息。参考 org.hibernate.stats 中接口的 Javadoc,以获得更多信息。 " +msgid "" +"If you enable hibernate.generate_statistics, Hibernate " +"exposes a number of metrics that are useful when tuning a running system via " +"SessionFactory.getStatistics(). Hibernate can even be " +"configured to expose these statistics via JMX. Read the Javadoc of the " +"interfaces in org.hibernate.stats for more information." +msgstr "" +"如果你开启 hibernate.generate_statistics,那么当你通过 " +"SessionFactory.getStatistics() 调整正在运行的系统时," +"Hibernate 将导出大量有用的数据。Hibernate 甚至能被配置成通过 JMX 导出这些统计" +"信息。参考 org.hibernate.stats 中接口的 Javadoc,以获得更" +"多信息。 " #. Tag: title +#: configuration.xml:1155 #, no-c-format msgid "Logging" msgstr "日志" #. Tag: para +#: configuration.xml:1157 #, no-c-format -msgid "Hibernate utilizes Simple Logging Facade for Java (SLF4J) in order to log various system events. SLF4J can direct your logging output to several logging frameworks (NOP, Simple, log4j version 1.2, JDK 1.4 logging, JCL or logback) depending on your chosen binding. In order to setup logging you will need slf4j-api.jar in your classpath together with the jar file for your preferred binding - slf4j-log4j12.jar in the case of Log4J. See the SLF4J documentation for more detail. To use Log4j you will also need to place a log4j.properties file in your classpath. An example properties file is distributed with Hibernate in the src/ directory." -msgstr "Hibernate 利用 Simple Logging Facade for Java (SLF4J) 来记录不同系统事件的日志。SLF4J 可以根据你选择的绑定把日志输出到几个日志框架(NOP、Simple、log4j version 1.2、JDK 1.4 logging、JCL 或 logback)上。为了设置日志,你需要在 classpath 里加入 slf4j-api.jar 和你选择的绑定的 JAR 文件(使用 Log4J 时加入 slf4j-log4j12.jar)。更多的细节请参考 SLF4J 文档。要使用 Log4j,你也需要在 classpath 里加入 log4j.properties 文件。Hibernate 里的 src/ 目录里带有一个属性文件的例子。" +msgid "" +"Hibernate utilizes Simple Logging " +"Facade for Java (SLF4J) in order to log various system events. SLF4J " +"can direct your logging output to several logging frameworks (NOP, Simple, " +"log4j version 1.2, JDK 1.4 logging, JCL or logback) depending on your chosen " +"binding. In order to setup logging you will need slf4j-api.jar in your classpath together with the jar file for your preferred " +"binding - slf4j-log4j12.jar in the case of Log4J. See " +"the SLF4J documentation for more detail. To use Log4j you will also need to place a " +"log4j.properties file in your classpath. An example " +"properties file is distributed with Hibernate in the src/ " +"directory." +msgstr "" +"Hibernate 利用 Simple Logging Facade " +"for Java (SLF4J) 来记录不同系统事件的日志。SLF4J 可以根据你选择的绑定" +"把日志输出到几个日志框架(NOP、Simple、log4j version 1.2、JDK 1.4 logging、" +"JCL 或 logback)上。为了设置日志,你需要在 classpath 里加入 slf4j-" +"api.jar 和你选择的绑定的 JAR 文件(使用 Log4J 时加入 " +"slf4j-log4j12.jar)。更多的细节请参考 SLF4J 文档。要使用 Log4j,你也需要在 " +"classpath 里加入 log4j.properties 文件。Hibernate 里的 " +"src/ 目录里带有一个属性文件的例子。" #. Tag: para +#: configuration.xml:1171 #, no-c-format -msgid "It is recommended that you familiarize yourself with Hibernate's log messages. A lot of work has been put into making the Hibernate log as detailed as possible, without making it unreadable. It is an essential troubleshooting device. The most interesting log categories are the following:" -msgstr "我们强烈建议你熟悉一下 Hibernate 的日志消息。在不失可读性的前提下,我们做了很多工作,使 Hibernate 的日志可能地详细。这是必要的查错利器。最令人感兴趣的日志分类有如下这些:" +msgid "" +"It is recommended that you familiarize yourself with Hibernate's log " +"messages. A lot of work has been put into making the Hibernate log as " +"detailed as possible, without making it unreadable. It is an essential " +"troubleshooting device. The most interesting log categories are the " +"following:" +msgstr "" +"我们强烈建议你熟悉一下 Hibernate 的日志消息。在不失可读性的前提下,我们做了很" +"多工作,使 Hibernate 的日志可能地详细。这是必要的查错利器。最令人感兴趣的日志" +"分类有如下这些:" #. Tag: title +#: configuration.xml:1178 #, no-c-format msgid "Hibernate Log Categories" msgstr "Hibernate 日志类别" #. Tag: entry +#: configuration.xml:1187 #, no-c-format msgid "Category" msgstr "类别" #. Tag: entry +#: configuration.xml:1189 #, no-c-format msgid "Function" msgstr "功能" -#. Tag: entry -#, no-c-format -msgid "org.hibernate.SQL" -msgstr "org.hibernate.SQL" +#. Tag: literal +#: configuration.xml:1195 +#, fuzzy, no-c-format +msgid "org.hibernate.SQL" +msgstr "org.hibernate" #. Tag: entry +#: configuration.xml:1197 #, no-c-format msgid "Log all SQL DML statements as they are executed" msgstr "在所有 SQL DML 语句被执行时为它们记录日志" -#. Tag: entry -#, no-c-format -msgid "org.hibernate.type" -msgstr "org.hibernate.type" +#. Tag: literal +#: configuration.xml:1201 +#, fuzzy, no-c-format +msgid "org.hibernate.type" +msgstr "org.hibernate" #. Tag: entry +#: configuration.xml:1203 #, no-c-format msgid "Log all JDBC parameters" msgstr "为所有 JDBC 参数记录日志" -#. Tag: entry -#, no-c-format -msgid "org.hibernate.tool.hbm2ddl" +#. Tag: literal +#: configuration.xml:1207 +#, fuzzy, no-c-format +msgid "org.hibernate.tool.hbm2ddl" msgstr "org.hibernate.tool.hbm2ddl" #. Tag: entry +#: configuration.xml:1209 #, no-c-format msgid "Log all SQL DDL statements as they are executed" msgstr "在所有 SQL DDL 语句执行时为它们记录日志" -#. Tag: entry -#, no-c-format -msgid "org.hibernate.pretty" -msgstr "org.hibernate.pretty" +#. Tag: literal +#: configuration.xml:1213 +#, fuzzy, no-c-format +msgid "org.hibernate.pretty" +msgstr "org.hibernate" #. Tag: entry +#: configuration.xml:1215 #, no-c-format -msgid "Log the state of all entities (max 20 entities) associated with the session at flush time" -msgstr "在 session 清洗(flush)时,为所有与其关联的实体(最多 20 个)的状态记录日志" - -#. Tag: entry -#, no-c-format -msgid "org.hibernate.cache" -msgstr "org.hibernate.cache" +msgid "" +"Log the state of all entities (max 20 entities) associated with the session " +"at flush time" +msgstr "" +"在 session 清洗(flush)时,为所有与其关联的实体(最多 20 个)的状态记录日志" + +#. Tag: literal +#: configuration.xml:1220 +#, fuzzy, no-c-format +msgid "org.hibernate.cache" +msgstr "org.hibernate" #. Tag: entry +#: configuration.xml:1222 #, no-c-format msgid "Log all second-level cache activity" msgstr "为所有二级缓存的活动记录日志" -#. Tag: entry -#, no-c-format -msgid "org.hibernate.transaction" +#. Tag: literal +#: configuration.xml:1226 +#, fuzzy, no-c-format +msgid "org.hibernate.transaction" msgstr "org.hibernate.transaction" #. Tag: entry +#: configuration.xml:1228 #, no-c-format msgid "Log transaction related activity" msgstr "为事务相关的活动记录日志" -#. Tag: entry -#, no-c-format -msgid "org.hibernate.jdbc" -msgstr "org.hibernate.jdbc" +#. Tag: literal +#: configuration.xml:1232 +#, fuzzy, no-c-format +msgid "org.hibernate.jdbc" +msgstr "org.hibernate" #. Tag: entry +#: configuration.xml:1234 #, no-c-format msgid "Log all JDBC resource acquisition" msgstr "为所有 JDBC 资源的获取记录日志" -#. Tag: entry -#, no-c-format -msgid "org.hibernate.hql.ast.AST" +#. Tag: literal +#: configuration.xml:1238 +#, fuzzy, no-c-format +msgid "org.hibernate.hql.ast.AST" msgstr "org.hibernate.hql.ast.AST" #. Tag: entry +#: configuration.xml:1240 #, no-c-format msgid "Log HQL and SQL ASTs during query parsing" msgstr "在解析查询的时候,记录 HQL 和 SQL 的 AST 分析日志" -#. Tag: entry -#, no-c-format -msgid "org.hibernate.secure" -msgstr "org.hibernate.secure" +#. Tag: literal +#: configuration.xml:1244 +#, fuzzy, no-c-format +msgid "org.hibernate.secure" +msgstr "org.hibernate" #. Tag: entry +#: configuration.xml:1246 #, no-c-format msgid "Log all JAAS authorization requests" msgstr "为 JAAS 认证请求做日志" -#. Tag: entry +#. Tag: literal +#: configuration.xml:1250 #, no-c-format -msgid "org.hibernate" -msgstr "org.hibernate" +msgid "org.hibernate" +msgstr "org.hibernate" #. Tag: entry +#: configuration.xml:1252 #, no-c-format -msgid "Log everything. This is a lot of information but it is useful for troubleshooting" +msgid "" +"Log everything. This is a lot of information but it is useful for " +"troubleshooting" msgstr "为任何 Hibernate 相关信息记录日志(信息量较大,但对查错非常有帮助)" #. Tag: para +#: configuration.xml:1259 #, no-c-format -msgid "When developing applications with Hibernate, you should almost always work with debug enabled for the category org.hibernate.SQL, or, alternatively, the property hibernate.show_sql enabled." -msgstr "在使用 Hibernate 开发应用程序时,你应当总是为 org.hibernate.SQL 开启 debug 级别的日志记录,或者开启 hibernate.show_sql 属性。" +msgid "" +"When developing applications with Hibernate, you should almost always work " +"with debug enabled for the category org." +"hibernate.SQL, or, alternatively, the property hibernate." +"show_sql enabled." +msgstr "" +"在使用 Hibernate 开发应用程序时,你应当总是为 org.hibernate.SQL 开启 debug 级别的日志记录,或者开启 " +"hibernate.show_sql 属性。" #. Tag: title +#: configuration.xml:1266 #, no-c-format msgid "Implementing a NamingStrategy" msgstr "实现 NamingStrategy" #. Tag: para +#: configuration.xml:1268 #, no-c-format -msgid "The interface org.hibernate.cfg.NamingStrategy allows you to specify a \"naming standard\" for database objects and schema elements." -msgstr "org.hibernate.cfg.NamingStrategy 接口允许你为数据库中的对象和 schema 元素指定一个“命名标准”。" +msgid "" +"The interface org.hibernate.cfg.NamingStrategy allows you " +"to specify a \"naming standard\" for database objects and schema elements." +msgstr "" +"org.hibernate.cfg.NamingStrategy 接口允许你为数据库中的对" +"象和 schema 元素指定一个“命名标准”。" #. Tag: para +#: configuration.xml:1272 #, no-c-format -msgid "You can provide rules for automatically generating database identifiers from Java identifiers or for processing \"logical\" column and table names given in the mapping file into \"physical\" table and column names. This feature helps reduce the verbosity of the mapping document, eliminating repetitive noise (TBL_ prefixes, for example). The default strategy used by Hibernate is quite minimal." -msgstr "你可能会提供一些通过 Java 标识生成数据库标识或将映射定义文件中\"逻辑\"表/列名处理成\"物理\"表/列名的规则。这个特性有助于减少冗长的映射定义文件,消除重复内容(如 TBL_ 前缀)。Hibernate 使用的缺省策略是相当精简的。" +msgid "" +"You can provide rules for automatically generating database identifiers from " +"Java identifiers or for processing \"logical\" column and table names given " +"in the mapping file into \"physical\" table and column names. This feature " +"helps reduce the verbosity of the mapping document, eliminating repetitive " +"noise (TBL_ prefixes, for example). The default strategy " +"used by Hibernate is quite minimal." +msgstr "" +"你可能会提供一些通过 Java 标识生成数据库标识或将映射定义文件中\"逻辑\"表/列名" +"处理成\"物理\"表/列名的规则。这个特性有助于减少冗长的映射定义文件,消除重复内" +"容(如 TBL_ 前缀)。Hibernate 使用的缺省策略是相当精简的。" #. Tag: para +#: configuration.xml:1279 #, no-c-format -msgid "You can specify a different strategy by calling Configuration.setNamingStrategy() before adding mappings:" -msgstr "在加入映射定义前,你可以调用 Configuration.setNamingStrategy() 指定一个不同的命名策略: " +msgid "" +"You can specify a different strategy by calling Configuration." +"setNamingStrategy() before adding mappings:" +msgstr "" +"在加入映射定义前,你可以调用 Configuration.setNamingStrategy() 指定一个不同的命名策略: " + +#. Tag: programlisting +#: configuration.xml:1283 +#, fuzzy, no-c-format +msgid "" +"SessionFactory sf = new Configuration()\n" +" .setNamingStrategy(ImprovedNamingStrategy.INSTANCE)\n" +" .addFile(\"Item.hbm.xml\")\n" +" .addFile(\"Bid.hbm.xml\")\n" +" .buildSessionFactory();" +msgstr "" +"" #. Tag: para +#: configuration.xml:1285 #, no-c-format -msgid "org.hibernate.cfg.ImprovedNamingStrategy is a built-in strategy that might be a useful starting point for some applications." -msgstr "org.hibernate.cfg.ImprovedNamingStrategy 是一个内建的命名策略,对一些应用程序而言,可能是非常有用的起点。" +msgid "" +"org.hibernate.cfg.ImprovedNamingStrategy is a built-in " +"strategy that might be a useful starting point for some applications." +msgstr "" +"org.hibernate.cfg.ImprovedNamingStrategy 是一个内建的命名" +"策略,对一些应用程序而言,可能是非常有用的起点。" #. Tag: title +#: configuration.xml:1291 #, no-c-format msgid "XML configuration file" msgstr "XML 配置文件" #. Tag: para +#: configuration.xml:1293 #, no-c-format -msgid "An alternative approach to configuration is to specify a full configuration in a file named hibernate.cfg.xml. This file can be used as a replacement for the hibernate.properties file or, if both are present, to override properties." -msgstr "另一个配置方法是在 hibernate.cfg.xml 文件中指定一套完整的配置。这个文件可以当成 hibernate.properties 的替代。若两个文件同时存在,它将覆盖前者的属性。" +msgid "" +"An alternative approach to configuration is to specify a full configuration " +"in a file named hibernate.cfg.xml. This file can be used " +"as a replacement for the hibernate.properties file or, if " +"both are present, to override properties." +msgstr "" +"另一个配置方法是在 hibernate.cfg.xml 文件中指定一套完整的" +"配置。这个文件可以当成 hibernate.properties 的替代。若两个" +"文件同时存在,它将覆盖前者的属性。" #. Tag: para +#: configuration.xml:1299 #, no-c-format -msgid "The XML configuration file is by default expected to be in the root of your CLASSPATH. Here is an example:" -msgstr "XML 配置文件被默认是放在 CLASSPATH 的根目录下。下面是一个例子: " +msgid "" +"The XML configuration file is by default expected to be in the root of your " +"CLASSPATH. Here is an example:" +msgstr "" +"XML 配置文件被默认是放在 CLASSPATH 的根目录下。下面是一个" +"例子: " + +#. Tag: programlisting +#: configuration.xml:1302 +#, fuzzy, no-c-format +msgid "" +"<?xml version='1.0' encoding='utf-8'?>\n" +"<!DOCTYPE hibernate-configuration PUBLIC\n" +" \"-//Hibernate/Hibernate Configuration DTD//EN\"\n" +" \"http://hibernate.sourceforge.net/hibernate-configuration-3.0.dtd" +"\">\n" +"\n" +"<hibernate-configuration>\n" +"\n" +" <!-- a SessionFactory instance listed as /jndi/name -->\n" +" <session-factory\n" +" name=\"java:hibernate/SessionFactory\">\n" +"\n" +" <!-- properties -->\n" +" <property name=\"connection.datasource\">java:/comp/env/jdbc/" +"MyDB</property>\n" +" <property name=\"dialect\">org.hibernate.dialect." +"MySQLDialect</property>\n" +" <property name=\"show_sql\">false</property>\n" +" <property name=\"transaction.factory_class\">\n" +" org.hibernate.transaction.JTATransactionFactory\n" +" </property>\n" +" <property name=\"jta.UserTransaction\">java:comp/" +"UserTransaction</property>\n" +"\n" +" <!-- mapping files -->\n" +" <mapping resource=\"org/hibernate/auction/Item.hbm.xml\"/>\n" +" <mapping resource=\"org/hibernate/auction/Bid.hbm.xml\"/>\n" +"\n" +" <!-- cache settings -->\n" +" <class-cache class=\"org.hibernate.auction.Item\" usage=\"read-" +"write\"/>\n" +" <class-cache class=\"org.hibernate.auction.Bid\" usage=\"read-only" +"\"/>\n" +" <collection-cache collection=\"org.hibernate.auction.Item.bids\" " +"usage=\"read-write\"/>\n" +"\n" +" </session-factory>\n" +"\n" +"</hibernate-configuration>" +msgstr "" +"\n" +"\n" +"\n" +"\n" +"\n" +" \n" +" \n" +"\n" +" \n" +" java:/comp/env/jdbc/MyDB\n" +" org.hibernate.dialect.MySQLDialect\n" +" false\n" +" \n" +" org.hibernate.transaction.JTATransactionFactory\n" +" \n" +" java:comp/UserTransaction\n" +"\n" +" \n" +" \n" +" \n" +"\n" +" \n" +" \n" +" \n" +" \n" +"\n" +" \n" +"\n" +"]]>" #. Tag: para +#: configuration.xml:1304 #, no-c-format -msgid "The advantage of this approach is the externalization of the mapping file names to configuration. The hibernate.cfg.xml is also more convenient once you have to tune the Hibernate cache. It is your choice to use either hibernate.properties or hibernate.cfg.xml. Both are equivalent, except for the above mentioned benefits of using the XML syntax." -msgstr "如你所见,这个方法优势在于,在配置文件中指出了映射定义文件的名字。一旦你需要调整 Hibernate 的缓存,hibernate.cfg.xml 也是更方便。注意,使用 hibernate.properties 还是 hibernate.cfg.xml 完全是由你来决定,除了上面提到的 XML 语法的优势之外,两者是等价的。 " +msgid "" +"The advantage of this approach is the externalization of the mapping file " +"names to configuration. The hibernate.cfg.xml is also " +"more convenient once you have to tune the Hibernate cache. It is your choice " +"to use either hibernate.properties or hibernate." +"cfg.xml. Both are equivalent, except for the above mentioned " +"benefits of using the XML syntax." +msgstr "" +"如你所见,这个方法优势在于,在配置文件中指出了映射定义文件的名字。一旦你需要" +"调整 Hibernate 的缓存,hibernate.cfg.xml 也是更方便。注" +"意,使用 hibernate.properties 还是 hibernate.cfg." +"xml 完全是由你来决定,除了上面提到的 XML 语法的优势之外,两者是等价" +"的。 " #. Tag: para +#: configuration.xml:1311 #, no-c-format msgid "With the XML configuration, starting Hibernate is then as simple as:" msgstr "使用 XML 配置,使得启动 Hibernate 变的异常简单:" +#. Tag: programlisting +#: configuration.xml:1314 +#, fuzzy, no-c-format +msgid "" +"SessionFactory sf = new Configuration().configure().buildSessionFactory();" +msgstr "" +"" + #. Tag: para +#: configuration.xml:1316 #, no-c-format msgid "You can select a different XML configuration file using:" msgstr "你可以使用如下代码来添加一个不同的 XML 配置文件:" +#. Tag: programlisting +#: configuration.xml:1318 +#, fuzzy, no-c-format +msgid "" +"SessionFactory sf = new Configuration()\n" +" .configure(\"catdb.cfg.xml\")\n" +" .buildSessionFactory();" +msgstr "" +"" + #. Tag: title +#: configuration.xml:1322 #, no-c-format msgid "J2EE Application Server integration" msgstr "J2EE 应用程序服务器的集成" #. Tag: para +#: configuration.xml:1324 #, no-c-format msgid "Hibernate has the following integration points for J2EE infrastructure:" msgstr "针对 J2EE 体系,Hibernate 有如下几个集成的方面:" #. Tag: para +#: configuration.xml:1329 #, no-c-format -msgid "Container-managed datasources: Hibernate can use JDBC connections managed by the container and provided through JNDI. Usually, a JTA compatible TransactionManager and a ResourceManager take care of transaction management (CMT), especially distributed transaction handling across several datasources. You can also demarcate transaction boundaries programmatically (BMT), or you might want to use the optional Hibernate Transaction API for this to keep your code portable." -msgstr "容器管理的数据源(Container-managed datasources): Hibernate 能使用通过容器管理,并由 JNDI 提供的 JDBC 连接。通常,特别是当处理多个数据源的分布式事务的时候,由一个 JTA 兼容的 TransactionManager 和一个 ResourceManager 来处理事务管理(CMT,容器管理的事务)。当然你可以通过 编程方式来划分事务边界(BMT,Bean 管理的事务)。或者为了代码的可移植性,你也也许会想使用可选的 Hibernate Transaction API。 " +msgid "" +"Container-managed datasources: Hibernate can use JDBC " +"connections managed by the container and provided through JNDI. Usually, a " +"JTA compatible TransactionManager and a " +"ResourceManager take care of transaction management " +"(CMT), especially distributed transaction handling across several " +"datasources. You can also demarcate transaction boundaries programmatically " +"(BMT), or you might want to use the optional Hibernate Transaction API for this to keep your code portable." +msgstr "" +"容器管理的数据源(Container-managed datasources): " +"Hibernate 能使用通过容器管理,并由 JNDI 提供的 JDBC 连接。通常,特别是当处理" +"多个数据源的分布式事务的时候,由一个 JTA 兼容的 TransactionManager 和一个 ResourceManager 来处理事务管理(CMT,容器" +"管理的事务)。当然你可以通过 编程方式来划分事务边界(BMT,Bean 管理的事务)。" +"或者为了代码的可移植性,你也也许会想使用可选的 Hibernate " +"Transaction API。 " #. Tag: para +#: configuration.xml:1343 #, no-c-format -msgid "Automatic JNDI binding: Hibernate can bind its SessionFactory to JNDI after startup." -msgstr "自动 JNDI 绑定:Hibernate 可以在启动后将 SessionFactory 绑定到 JNDI。" +msgid "" +"Automatic JNDI binding: Hibernate can bind its " +"SessionFactory to JNDI after startup." +msgstr "" +"自动 JNDI 绑定:Hibernate 可以在启动后将 " +"SessionFactory 绑定到 JNDI。" #. Tag: para +#: configuration.xml:1350 #, no-c-format -msgid "JTA Session binding: the Hibernate Session can be automatically bound to the scope of JTA transactions. Simply lookup the SessionFactory from JNDI and get the current Session. Let Hibernate manage flushing and closing the Session when your JTA transaction completes. Transaction demarcation is either declarative (CMT) or programmatic (BMT/UserTransaction)." -msgstr "JTA Session 绑定: Hibernate Session 可以自动绑定到 JTA 事务作用的范围。只需简单地从 JNDI 查找 SessionFactory 并获得当前的 Session。当 JTA 事务完成时,让 Hibernate来处理 Session 的清洗(flush)与关闭。事务的划分可以是声明式的(CMT),也可以是编程式的(BMT/UserTransaction)。 " +msgid "" +"JTA Session binding: the Hibernate Session can be automatically bound to the scope of JTA transactions. Simply " +"lookup the SessionFactory from JNDI and get the current " +"Session. Let Hibernate manage flushing and closing the " +"Session when your JTA transaction completes. Transaction " +"demarcation is either declarative (CMT) or programmatic (BMT/" +"UserTransaction)." +msgstr "" +"JTA Session 绑定: Hibernate Session " +"可以自动绑定到 JTA 事务作用的范围。只需简单地从 JNDI 查找 " +"SessionFactory 并获得当前的 Session。" +"当 JTA 事务完成时,让 Hibernate来处理 Session 的清洗" +"(flush)与关闭。事务的划分可以是声明式的(CMT),也可以是编程式的(BMT/" +"UserTransaction)。 " #. Tag: para +#: configuration.xml:1362 #, no-c-format -msgid "JMX deployment: if you have a JMX capable application server (e.g. JBoss AS), you can choose to deploy Hibernate as a managed MBean. This saves you the one line startup code to build your SessionFactory from a Configuration. The container will startup your HibernateService and also take care of service dependencies (datasource has to be available before Hibernate starts, etc)." -msgstr "JMX 部署: 如果你使用支持 JMX 应用程序服务器(如,JBoss AS),那么你可以选择将 Hibernate 部署成托管 MBean。这将为你省去一行从Configuration 构建 SessionFactory 的启动代码。容器将启动你的 HibernateService,并完美地处理好服务间的依赖关系(在 Hibernate 启动前,数据源必须是可用的,等等)。 " +msgid "" +"JMX deployment: if you have a JMX capable application " +"server (e.g. JBoss AS), you can choose to deploy Hibernate as a managed " +"MBean. This saves you the one line startup code to build your " +"SessionFactory from a Configuration. " +"The container will startup your HibernateService and also " +"take care of service dependencies (datasource has to be available before " +"Hibernate starts, etc)." +msgstr "" +"JMX 部署: 如果你使用支持 JMX 应用程序服务器(如,JBoss " +"AS),那么你可以选择将 Hibernate 部署成托管 MBean。这将为你省去一行从" +"Configuration 构建 SessionFactory 的启" +"动代码。容器将启动你的 HibernateService,并完美地处理好服" +"务间的依赖关系(在 Hibernate 启动前,数据源必须是可用的,等等)。 " #. Tag: para +#: configuration.xml:1373 #, no-c-format -msgid "Depending on your environment, you might have to set the configuration option hibernate.connection.aggressive_release to true if your application server shows \"connection containment\" exceptions." -msgstr "如果应用程序服务器抛出 \"connection containment\" 异常,根据你的环境,也许该将配置属性 hibernate.connection.release_mode 设为 after_statement。" +msgid "" +"Depending on your environment, you might have to set the configuration " +"option hibernate.connection.aggressive_release to true if " +"your application server shows \"connection containment\" exceptions." +msgstr "" +"如果应用程序服务器抛出 \"connection containment\" 异常,根据你的环境,也许该" +"将配置属性 hibernate.connection.release_mode 设为 " +"after_statement。" #. Tag: title +#: configuration.xml:1379 #, no-c-format msgid "Transaction strategy configuration" msgstr "事务策略配置" #. Tag: para +#: configuration.xml:1381 #, no-c-format -msgid "The Hibernate Session API is independent of any transaction demarcation system in your architecture. If you let Hibernate use JDBC directly through a connection pool, you can begin and end your transactions by calling the JDBC API. If you run in a J2EE application server, you might want to use bean-managed transactions and call the JTA API and UserTransaction when needed." -msgstr "在你的架构中,Hibernate 的 Session API 是独立于任何事务分界系统的。如果你让 Hibernate 通过连接池直接使用 JDBC,你需要调用 JDBC API 来打开和关闭你的事务。如果你运行在 J2EE 应用程序服务器中,你也许想用 Bean 管理的事务并在需要的时候调用 JTA API 和 UserTransaction。 " +msgid "" +"The Hibernate Session API is independent of any " +"transaction demarcation system in your architecture. If you let Hibernate " +"use JDBC directly through a connection pool, you can begin and end your " +"transactions by calling the JDBC API. If you run in a J2EE application " +"server, you might want to use bean-managed transactions and call the JTA API " +"and UserTransaction when needed." +msgstr "" +"在你的架构中,Hibernate 的 Session API 是独立于任何事务分" +"界系统的。如果你让 Hibernate 通过连接池直接使用 JDBC,你需要调用 JDBC API 来" +"打开和关闭你的事务。如果你运行在 J2EE 应用程序服务器中,你也许想用 Bean 管理" +"的事务并在需要的时候调用 JTA API 和 UserTransaction。 " #. Tag: para +#: configuration.xml:1389 #, no-c-format -msgid "To keep your code portable between these two (and other) environments we recommend the optional Hibernate Transaction API, which wraps and hides the underlying system. You have to specify a factory class for Transaction instances by setting the Hibernate configuration property hibernate.transaction.factory_class." -msgstr "为了让你的代码在两种(或其他)环境中可以移植,我们建议使用可选的 Hibernate Transaction API,它包装并隐藏了底层系统。你必须通过设置 Hibernate 配置属性 hibernate.transaction.factory_class 来指定一个 Transaction 实例的工厂类。" +msgid "" +"To keep your code portable between these two (and other) environments we " +"recommend the optional Hibernate Transaction API, which " +"wraps and hides the underlying system. You have to specify a factory class " +"for Transaction instances by setting the Hibernate " +"configuration property hibernate.transaction.factory_class." +msgstr "" +"为了让你的代码在两种(或其他)环境中可以移植,我们建议使用可选的 Hibernate " +"Transaction API,它包装并隐藏了底层系统。你必须通过设置 " +"Hibernate 配置属性 hibernate.transaction.factory_class 来" +"指定一个 Transaction 实例的工厂类。" #. Tag: para +#: configuration.xml:1397 #, no-c-format msgid "There are three standard, or built-in, choices:" msgstr "有三个标准(内建)的选择: " -#. Tag: term -#, no-c-format -msgid "org.hibernate.transaction.JDBCTransactionFactory" +#. Tag: literal +#: configuration.xml:1401 +#, fuzzy, no-c-format +msgid "org.hibernate.transaction.JDBCTransactionFactory" msgstr "org.hibernate.transaction.JDBCTransactionFactory" #. Tag: para +#: configuration.xml:1404 #, no-c-format msgid "delegates to database (JDBC) transactions (default)" msgstr "委托给数据库(JDBC)事务(默认)" -#. Tag: term -#, no-c-format -msgid "org.hibernate.transaction.JTATransactionFactory" +#. Tag: literal +#: configuration.xml:1409 +#, fuzzy, no-c-format +msgid "org.hibernate.transaction.JTATransactionFactory" msgstr "org.hibernate.transaction.JTATransactionFactory" #. Tag: para +#: configuration.xml:1412 #, no-c-format -msgid "delegates to container-managed transactions if an existing transaction is underway in this context (for example, EJB session bean method). Otherwise, a new transaction is started and bean-managed transactions are used." -msgstr "如果在上下文环境中存在运行着的事务(如,EJB 会话 Bean 的方法),则委托给容器管理的事务。否则,将启动一个新的事务,并使用 Bean 管理的事务。" +msgid "" +"delegates to container-managed transactions if an existing transaction is " +"underway in this context (for example, EJB session bean method). Otherwise, " +"a new transaction is started and bean-managed transactions are used." +msgstr "" +"如果在上下文环境中存在运行着的事务(如,EJB 会话 Bean 的方法),则委托给容器" +"管理的事务。否则,将启动一个新的事务,并使用 Bean 管理的事务。" -#. Tag: term -#, no-c-format -msgid "org.hibernate.transaction.CMTTransactionFactory" +#. Tag: literal +#: configuration.xml:1420 +#, fuzzy, no-c-format +msgid "org.hibernate.transaction.CMTTransactionFactory" msgstr "org.hibernate.transaction.CMTTransactionFactory" #. Tag: para +#: configuration.xml:1423 #, no-c-format msgid "delegates to container-managed JTA transactions" msgstr "委托给容器管理的 JTA 事务" #. Tag: para +#: configuration.xml:1428 #, no-c-format -msgid "You can also define your own transaction strategies (for a CORBA transaction service, for example)." +msgid "" +"You can also define your own transaction strategies (for a CORBA transaction " +"service, for example)." msgstr "你也可以定义属于你自己的事务策略(如,针对 CORBA 的事务服务)。" #. Tag: para +#: configuration.xml:1431 #, no-c-format -msgid "Some features in Hibernate (i.e., the second level cache, Contextual Sessions with JTA, etc.) require access to the JTA TransactionManager in a managed environment. In an application server, since J2EE does not standardize a single mechanism, you have to specify how Hibernate should obtain a reference to the TransactionManager:" -msgstr "Hibernate 的一些特性(比如二级缓存,Contextual Sessions with JTA 等等)需要访问在托管环境中的 JTA TransactionManager。由于 J2EE 没有标准化一个单一的机制,Hibernate 在应用程序服务器中,你必须指定 Hibernate 如何获得 TransactionManager 的引用: " +msgid "" +"Some features in Hibernate (i.e., the second level cache, Contextual " +"Sessions with JTA, etc.) require access to the JTA " +"TransactionManager in a managed environment. In an " +"application server, since J2EE does not standardize a single mechanism, you " +"have to specify how Hibernate should obtain a reference to the " +"TransactionManager:" +msgstr "" +"Hibernate 的一些特性(比如二级缓存,Contextual Sessions with JTA 等等)需要访" +"问在托管环境中的 JTA TransactionManager。由于 J2EE 没有标" +"准化一个单一的机制,Hibernate 在应用程序服务器中,你必须指定 Hibernate 如何获" +"得 TransactionManager 的引用: " #. Tag: title +#: configuration.xml:1439 #, no-c-format msgid "JTA TransactionManagers" msgstr "JTA TransactionManagers" #. Tag: entry +#: configuration.xml:1448 #, no-c-format msgid "Transaction Factory" msgstr "Transaction 工厂类" #. Tag: entry +#: configuration.xml:1450 #, no-c-format msgid "Application Server" msgstr "应用程序服务器" -#. Tag: entry -#, no-c-format -msgid "org.hibernate.transaction.JBossTransactionManagerLookup" -msgstr "org.hibernate.transaction.JBossTransactionManagerLookup" +#. Tag: literal +#: configuration.xml:1456 +#, fuzzy, no-c-format +msgid "org.hibernate.transaction.JBossTransactionManagerLookup" +msgstr "" +"org.hibernate.transaction.JBossTransactionManagerLookup" #. Tag: entry +#: configuration.xml:1458 #, no-c-format msgid "JBoss" msgstr "JBoss" -#. Tag: entry -#, no-c-format -msgid "org.hibernate.transaction.WeblogicTransactionManagerLookup" -msgstr "org.hibernate.transaction.WeblogicTransactionManagerLookup" +#. Tag: literal +#: configuration.xml:1462 +#, fuzzy, no-c-format +msgid "org.hibernate.transaction.WeblogicTransactionManagerLookup" +msgstr "" +"org.hibernate.transaction.WeblogicTransactionManagerLookup" #. Tag: entry +#: configuration.xml:1464 #, no-c-format msgid "Weblogic" msgstr "Weblogic" -#. Tag: entry -#, no-c-format -msgid "org.hibernate.transaction.WebSphereTransactionManagerLookup" -msgstr "org.hibernate.transaction.WebSphereTransactionManagerLookup" +#. Tag: literal +#: configuration.xml:1468 +#, fuzzy, no-c-format +msgid "org.hibernate.transaction.WebSphereTransactionManagerLookup" +msgstr "" +"org.hibernate.transaction.WebSphereTransactionManagerLookup" #. Tag: entry +#: configuration.xml:1470 #, no-c-format msgid "WebSphere" msgstr "WebSphere" -#. Tag: entry -#, no-c-format -msgid "org.hibernate.transaction.WebSphereExtendedJTATransactionLookup" -msgstr "org.hibernate.transaction.WebSphereExtendedJTATransactionLookup" +#. Tag: literal +#: configuration.xml:1474 +#, fuzzy, no-c-format +msgid "org.hibernate.transaction.WebSphereExtendedJTATransactionLookup" +msgstr "" +"org.hibernate.transaction.WebSphereExtendedJTATransactionLookup" #. Tag: entry +#: configuration.xml:1476 #, no-c-format msgid "WebSphere 6" msgstr "WebSphere 6" -#. Tag: entry -#, no-c-format -msgid "org.hibernate.transaction.OrionTransactionManagerLookup" -msgstr "org.hibernate.transaction.OrionTransactionManagerLookup" +#. Tag: literal +#: configuration.xml:1480 +#, fuzzy, no-c-format +msgid "org.hibernate.transaction.OrionTransactionManagerLookup" +msgstr "" +"org.hibernate.transaction.OrionTransactionManagerLookup" #. Tag: entry +#: configuration.xml:1482 #, no-c-format msgid "Orion" msgstr "Orion" -#. Tag: entry -#, no-c-format -msgid "org.hibernate.transaction.ResinTransactionManagerLookup" -msgstr "org.hibernate.transaction.ResinTransactionManagerLookup" +#. Tag: literal +#: configuration.xml:1486 +#, fuzzy, no-c-format +msgid "org.hibernate.transaction.ResinTransactionManagerLookup" +msgstr "" +"org.hibernate.transaction.ResinTransactionManagerLookup" #. Tag: entry +#: configuration.xml:1488 #, no-c-format msgid "Resin" msgstr "Resin" -#. Tag: entry -#, no-c-format -msgid "org.hibernate.transaction.JOTMTransactionManagerLookup" -msgstr "org.hibernate.transaction.JOTMTransactionManagerLookup" +#. Tag: literal +#: configuration.xml:1492 +#, fuzzy, no-c-format +msgid "org.hibernate.transaction.JOTMTransactionManagerLookup" +msgstr "" +"org.hibernate.transaction.JOTMTransactionManagerLookup" #. Tag: entry +#: configuration.xml:1494 #, no-c-format msgid "JOTM" msgstr "JOTM" -#. Tag: entry -#, no-c-format -msgid "org.hibernate.transaction.JOnASTransactionManagerLookup" -msgstr "org.hibernate.transaction.JOnASTransactionManagerLookup" +#. Tag: literal +#: configuration.xml:1498 +#, fuzzy, no-c-format +msgid "org.hibernate.transaction.JOnASTransactionManagerLookup" +msgstr "" +"org.hibernate.transaction.JOnASTransactionManagerLookup" #. Tag: entry +#: configuration.xml:1500 #, no-c-format msgid "JOnAS" msgstr "JOnAS" -#. Tag: entry -#, no-c-format -msgid "org.hibernate.transaction.JRun4TransactionManagerLookup" -msgstr "org.hibernate.transaction.JRun4TransactionManagerLookup" +#. Tag: literal +#: configuration.xml:1504 +#, fuzzy, no-c-format +msgid "org.hibernate.transaction.JRun4TransactionManagerLookup" +msgstr "" +"org.hibernate.transaction.JRun4TransactionManagerLookup" #. Tag: entry +#: configuration.xml:1506 #, no-c-format msgid "JRun4" msgstr "JRun4" -#. Tag: entry -#, no-c-format -msgid "org.hibernate.transaction.BESTransactionManagerLookup" -msgstr "org.hibernate.transaction.BESTransactionManagerLookup" +#. Tag: literal +#: configuration.xml:1510 +#, fuzzy, no-c-format +msgid "org.hibernate.transaction.BESTransactionManagerLookup" +msgstr "" +"org.hibernate.transaction.BESTransactionManagerLookup" #. Tag: entry +#: configuration.xml:1512 #, no-c-format msgid "Borland ES" msgstr "Borland ES" #. Tag: title +#: configuration.xml:1520 #, no-c-format msgid "JNDI-bound SessionFactory" msgstr "JNDI 绑定的 SessionFactory" #. Tag: para +#: configuration.xml:1522 #, no-c-format -msgid "A JNDI-bound Hibernate SessionFactory can simplify the lookup function of the factory and create new Sessions. This is not, however, related to a JNDI bound Datasource; both simply use the same registry." -msgstr "与 JNDI 绑定的 Hibernate 的 SessionFactory 能简化工厂的查询,简化创建新的 Session。需要注意的是这与 JNDI 绑定 Datasource 没有关系,它们只是恰巧用了相同的注册表。" +msgid "" +"A JNDI-bound Hibernate SessionFactory can simplify the " +"lookup function of the factory and create new Sessions. " +"This is not, however, related to a JNDI bound Datasource; " +"both simply use the same registry." +msgstr "" +"与 JNDI 绑定的 Hibernate 的 SessionFactory 能简化工厂的查" +"询,简化创建新的 Session。需要注意的是这与 JNDI 绑定 " +"Datasource 没有关系,它们只是恰巧用了相同的注册表。" #. Tag: para +#: configuration.xml:1528 #, no-c-format -msgid "If you wish to have the SessionFactory bound to a JNDI namespace, specify a name (e.g. java:hibernate/SessionFactory) using the property hibernate.session_factory_name. If this property is omitted, the SessionFactory will not be bound to JNDI. This is especially useful in environments with a read-only JNDI default implementation (in Tomcat, for example)." -msgstr "如果你希望将 SessionFactory 绑定到一个 JNDI 的名字空间,用属性 hibernate.session_factory_name 指定一个名字(如,java:hibernate/SessionFactory)。如果不设置这个属性,SessionFactory 将不会被绑定到 JNDI 中(在以只读 JNDI 为默认实现的环境中,这个设置尤其有用,如 Tomcat)。" +msgid "" +"If you wish to have the SessionFactory bound to a JNDI " +"namespace, specify a name (e.g. java:hibernate/SessionFactory) using the property hibernate.session_factory_name. If this property is omitted, the SessionFactory " +"will not be bound to JNDI. This is especially useful in environments with a " +"read-only JNDI default implementation (in Tomcat, for example)." +msgstr "" +"如果你希望将 SessionFactory 绑定到一个 JNDI 的名字空间,用" +"属性 hibernate.session_factory_name 指定一个名字(如," +"java:hibernate/SessionFactory)。如果不设置这个属性," +"SessionFactory 将不会被绑定到 JNDI 中(在以只读 JNDI 为默" +"认实现的环境中,这个设置尤其有用,如 Tomcat)。" #. Tag: para +#: configuration.xml:1536 #, no-c-format -msgid "When binding the SessionFactory to JNDI, Hibernate will use the values of hibernate.jndi.url, hibernate.jndi.class to instantiate an initial context. If they are not specified, the default InitialContext will be used." -msgstr "在将 SessionFactory 绑定至 JNDI 时,Hibernate 将使用 hibernate.jndi.url,和 hibernate.jndi.class 的值来实例化初始环境(initial context)。如果它们没有被指定,将使用默认的 InitialContext。" +msgid "" +"When binding the SessionFactory to JNDI, Hibernate will " +"use the values of hibernate.jndi.url, hibernate." +"jndi.class to instantiate an initial context. If they are not " +"specified, the default InitialContext will be used." +msgstr "" +"在将 SessionFactory 绑定至 JNDI 时,Hibernate 将使用 " +"hibernate.jndi.url,和 hibernate.jndi.class 的值来实例化初始环境(initial context)。如果它们没有被指定,将使用" +"默认的 InitialContext。" #. Tag: para +#: configuration.xml:1542 #, no-c-format -msgid "Hibernate will automatically place the SessionFactory in JNDI after you call cfg.buildSessionFactory(). This means you will have this call in some startup code, or utility class in your application, unless you use JMX deployment with the HibernateService (this is discussed later in greater detail)." -msgstr "在你调用 cfg.buildSessionFactory()后,Hibernate 会自动将 SessionFactory 注册到 JNDI。这意味这你至少需要在你应用程序的启动代码(或工具类)中完成这个调用,除非你使用 HibernateService 来做 JMX 部署(见后面讨论)。" +msgid "" +"Hibernate will automatically place the SessionFactory in " +"JNDI after you call cfg.buildSessionFactory(). This means " +"you will have this call in some startup code, or utility class in your " +"application, unless you use JMX deployment with the " +"HibernateService (this is discussed later in greater " +"detail)." +msgstr "" +"在你调用 cfg.buildSessionFactory()后,Hibernate 会自动将 " +"SessionFactory 注册到 JNDI。这意味这你至少需要在你应用程序" +"的启动代码(或工具类)中完成这个调用,除非你使用 HibernateService 来做 JMX 部署(见后面讨论)。" #. Tag: para +#: configuration.xml:1550 #, no-c-format -msgid "If you use a JNDI SessionFactory, an EJB or any other class, you can obtain the SessionFactory using a JNDI lookup." -msgstr "假若你使用 JNDI SessionFactory,EJB 或者任何其它类都可以从 JNDI 中找到此 SessionFactory。 " +msgid "" +"If you use a JNDI SessionFactory, an EJB or any other " +"class, you can obtain the SessionFactory using a JNDI " +"lookup." +msgstr "" +"假若你使用 JNDI SessionFactory,EJB 或者任何其它类都可以" +"从 JNDI 中找到此 SessionFactory。 " #. Tag: para -#, no-c-format -msgid "It is recommended that you bind the SessionFactory to JNDI in a managed environment and use a static singleton otherwise. To shield your application code from these details, we also recommend to hide the actual lookup code for a SessionFactory in a helper class, such as HibernateUtil.getSessionFactory(). Note that such a class is also a convenient way to startup Hibernate—see chapter 1." -msgstr "我们建议,在受管理的环境中,把 SessionFactory 绑定到 JNDI,在其它情况下,使用一个 static(静态的)singleton。为了在你的应用程序代码中隐藏这些细节,我们还建议你用一个 helper 类把实际查找 SessionFactory 的代码隐藏起来,比如 HibernateUtil.getSessionFactory()。注意,这个类也就可以方便地启动 Hibernate,参见第一章。 " +#: configuration.xml:1554 +#, fuzzy, no-c-format +msgid "" +"It is recommended that you bind the SessionFactory to " +"JNDI in a managed environment and use a static singleton " +"otherwise. To shield your application code from these details, we also " +"recommend to hide the actual lookup code for a SessionFactory in a helper class, such as HibernateUtil.getSessionFactory" +"(). Note that such a class is also a convenient way to startup " +"Hibernate—see chapter 1." +msgstr "" +"我们建议,在受管理的环境中,把 SessionFactory 绑定到 " +"JNDI,在其它情况下,使用一个 static(静态的)singleton。为" +"了在你的应用程序代码中隐藏这些细节,我们还建议你用一个 helper 类把实际查找 " +"SessionFactory 的代码隐藏起来,比如 " +"HibernateUtil.getSessionFactory()。注意,这个类也就可以方" +"便地启动 Hibernate,参见第一章。 " #. Tag: title +#: configuration.xml:1565 #, no-c-format msgid "Current Session context management with JTA" msgstr "在 JTA 环境下使用 Current Session context(当前 session 上下文)管理" #. Tag: para -#, no-c-format -msgid "The easiest way to handle Sessions and transactions is Hibernate's automatic \"current\" Session management. For a discussion of contextual sessions see . Using the \"jta\" session context, if there is no Hibernate Session associated with the current JTA transaction, one will be started and associated with that JTA transaction the first time you call sessionFactory.getCurrentSession(). The Sessions retrieved via getCurrentSession() in the\"jta\" context are set to automatically flush before the transaction completes, close after the transaction completes, and aggressively release JDBC connections after each statement. This allows the Sessions to be managed by the life cycle of the JTA transaction to which it is associated, keeping user code clean of such management concerns. Your code can either use JTA programmatically through UserTransaction, or (recommended for portable code) use the Hibernate Transaction API to set transaction boundaries. If you run in an EJB container, declarative transaction demarcation with CMT is preferred." -msgstr "在 Hibernate 中,管理 Session 和 transaction 最好的方法是自动的\"当前\"Session 管理。请参见 一节的讨论。使用 \"jta\" session 上下文,假若在当前 JTA 事务中还没有 HibernateSession 关联,第一次 sessionFactory.getCurrentSession() 调用会启动一个 Session,并关联到当前的 JTA 事务。在 \"jta\" 上下文中调用 getCurrentSession() 获得的 Session,会被设置为在 transaction 关闭的时候自动 flush(清洗)、在 transaction 关闭之后自动关闭,每句语句之后主动释放 JDBC 连接。这就可以根据 JTA 事务的生命周期来管理与之关联的 Session,用户代码中就可以不再考虑这些管理。你的代码也可以通过 UserTransaction用编程方式使用 JTA,或者(我们建议,为了便于移植代码)使用 Hibernate 的 Transaction API 来设置 transaction 边界。如果你的代码运行在 EJB 容器中,我们建议对 CMT 使用声明式事务声明。 " +#: configuration.xml:1567 +#, fuzzy, no-c-format +msgid "" +"The easiest way to handle Sessions and transactions is " +"Hibernate's automatic \"current\" Session management. For " +"a discussion of contextual sessions see . Using the \"jta\" session context, if there " +"is no Hibernate Session associated with the current JTA " +"transaction, one will be started and associated with that JTA transaction " +"the first time you call sessionFactory.getCurrentSession(). The Sessions retrieved via " +"getCurrentSession() in the \"jta\" " +"context are set to automatically flush before the transaction completes, " +"close after the transaction completes, and aggressively release JDBC " +"connections after each statement. This allows the Sessions to be managed by the life cycle of the JTA transaction to which it " +"is associated, keeping user code clean of such management concerns. Your " +"code can either use JTA programmatically through UserTransaction, or (recommended for portable code) use the Hibernate " +"Transaction API to set transaction boundaries. If you run " +"in an EJB container, declarative transaction demarcation with CMT is " +"preferred." +msgstr "" +"在 Hibernate 中,管理 Session 和 transaction 最好的方法是" +"自动的\"当前\"Session 管理。请参见 一节的讨论。使用 \"jta\" session 上下文,假若在当前 JTA 事务中还没有 " +"HibernateSession 关联,第一次 sessionFactory." +"getCurrentSession() 调用会启动一个 Session,并关联到当前的 JTA 事" +"务。在 \"jta\" 上下文中调用 getCurrentSession() 获得的 Session,会被设置为在 transaction 关闭的时" +"候自动 flush(清洗)、在 transaction 关闭之后自动关闭,每句语句之后主动释放 " +"JDBC 连接。这就可以根据 JTA 事务的生命周期来管理与之关联的 Session,用户代码中就可以不再考虑这些管理。你的代码也可以通过 " +"UserTransaction用编程方式使用 JTA,或者(我们建议,为了便" +"于移植代码)使用 Hibernate 的 Transaction API 来设置 " +"transaction 边界。如果你的代码运行在 EJB 容器中,我们建议对 CMT 使用声明式事" +"务声明。 " #. Tag: title +#: configuration.xml:1590 #, no-c-format msgid "JMX deployment" msgstr "JMX 部署" #. Tag: para +#: configuration.xml:1592 #, no-c-format -msgid "The line cfg.buildSessionFactory() still has to be executed somewhere to get a SessionFactory into JNDI. You can do this either in a static initializer block, like the one in HibernateUtil, or you can deploy Hibernate as a managed service." -msgstr "为了将 SessionFactory 注册到 JNDI 中,cfg.buildSessionFactory() 这行代码仍需在某处被执行。你可在一个 static 初始化块(像 HibernateUtil 中的那样)中执行它或将 Hibernate 部署为一个托管的服务。 " +msgid "" +"The line cfg.buildSessionFactory() still has to be " +"executed somewhere to get a SessionFactory into JNDI. You " +"can do this either in a static initializer block, like " +"the one in HibernateUtil, or you can deploy Hibernate as " +"a managed service." +msgstr "" +"为了将 SessionFactory 注册到 JNDI 中,cfg." +"buildSessionFactory() 这行代码仍需在某处被执行。你可在一个 " +"static 初始化块(像 HibernateUtil 中的" +"那样)中执行它或将 Hibernate 部署为一个托管的服务。 " #. Tag: para +#: configuration.xml:1598 #, no-c-format -msgid "Hibernate is distributed with org.hibernate.jmx.HibernateService for deployment on an application server with JMX capabilities, such as JBoss AS. The actual deployment and configuration is vendor-specific. Here is an example jboss-service.xml for JBoss 4.0.x:" -msgstr "为了部署在一个支持 JMX 的应用程序服务器上,Hibernate 和 org.hibernate.jmx.HibernateService 一同分发,如 Jboss AS。 实际的部署和配置是由应用程序服务器提供者指定的。这里是 JBoss 4.0.x 的 jboss-service.xml 样例: " +msgid "" +"Hibernate is distributed with org.hibernate.jmx.HibernateService for deployment on an application server with JMX capabilities, such " +"as JBoss AS. The actual deployment and configuration is vendor-specific. " +"Here is an example jboss-service.xml for JBoss 4.0.x:" +msgstr "" +"为了部署在一个支持 JMX 的应用程序服务器上,Hibernate 和 org." +"hibernate.jmx.HibernateService 一同分发,如 Jboss AS。 实际的部署和" +"配置是由应用程序服务器提供者指定的。这里是 JBoss 4.0.x 的 jboss-" +"service.xml 样例: " + +#. Tag: programlisting +#: configuration.xml:1604 +#, fuzzy, no-c-format +msgid "" +"<?xml version=\"1.0\"?>\n" +"<server>\n" +"\n" +"<mbean code=\"org.hibernate.jmx.HibernateService\"\n" +" name=\"jboss.jca:service=HibernateFactory,name=HibernateFactory\">\n" +"\n" +" <!-- Required services -->\n" +" <depends>jboss.jca:service=RARDeployer</depends>\n" +" <depends>jboss.jca:service=LocalTxCM,name=HsqlDS</depends>\n" +"\n" +" <!-- Bind the Hibernate service to JNDI -->\n" +" <attribute name=\"JndiName\">java:/hibernate/SessionFactory</" +"attribute>\n" +"\n" +" <!-- Datasource settings -->\n" +" <attribute name=\"Datasource\">java:HsqlDS</attribute>\n" +" <attribute name=\"Dialect\">org.hibernate.dialect.HSQLDialect</" +"attribute>\n" +"\n" +" <!-- Transaction integration -->\n" +" <attribute name=\"TransactionStrategy\">\n" +" org.hibernate.transaction.JTATransactionFactory</attribute>\n" +" <attribute name=\"TransactionManagerLookupStrategy\">\n" +" org.hibernate.transaction.JBossTransactionManagerLookup</" +"attribute>\n" +" <attribute name=\"FlushBeforeCompletionEnabled\">true</" +"attribute>\n" +" <attribute name=\"AutoCloseSessionEnabled\">true</" +"attribute>\n" +"\n" +" <!-- Fetching options -->\n" +" <attribute name=\"MaximumFetchDepth\">5</attribute>\n" +"\n" +" <!-- Second-level caching -->\n" +" <attribute name=\"SecondLevelCacheEnabled\">true</" +"attribute>\n" +" <attribute name=\"CacheProviderClass\">org.hibernate.cache." +"EhCacheProvider</attribute>\n" +" <attribute name=\"QueryCacheEnabled\">true</attribute>\n" +"\n" +" <!-- Logging -->\n" +" <attribute name=\"ShowSqlEnabled\">true</attribute>\n" +"\n" +" <!-- Mapping files -->\n" +" <attribute name=\"MapResources\">auction/Item.hbm.xml,auction/" +"Category.hbm.xml</attribute>\n" +"\n" +"</mbean>\n" +"\n" +"</server>" +msgstr "" +"\n" +"\n" +"\n" +"\n" +"\n" +" \n" +" jboss.jca:service=RARDeployer\n" +" jboss.jca:service=LocalTxCM,name=HsqlDS\n" +"\n" +" \n" +" java:/hibernate/SessionFactory\n" +"\n" +" \n" +" java:HsqlDS\n" +" org.hibernate.dialect.HSQLDialect\n" +"\n" +" \n" +" \n" +" org.hibernate.transaction.JTATransactionFactory\n" +" \n" +" org.hibernate.transaction.JBossTransactionManagerLookup\n" +" true\n" +" true\n" +"\n" +" \n" +" 5\n" +"\n" +" \n" +" true\n" +" org.hibernate.cache." +"EhCacheProvider\n" +" true\n" +"\n" +" \n" +" true\n" +"\n" +" \n" +" auction/Item.hbm.xml,auction/Category." +"hbm.xml\n" +"\n" +"\n" +"\n" +"]]>" #. Tag: para +#: configuration.xml:1606 #, no-c-format -msgid "This file is deployed in a directory called META-INF and packaged in a JAR file with the extension .sar (service archive). You also need to package Hibernate, its required third-party libraries, your compiled persistent classes, as well as your mapping files in the same archive. Your enterprise beans (usually session beans) can be kept in their own JAR file, but you can include this EJB JAR file in the main service archive to get a single (hot-)deployable unit. Consult the JBoss AS documentation for more information about JMX service and EJB deployment." -msgstr "这个文件是部署在 META-INF 目录下的,并会被打包到以 .sar(service archive)为扩展名的 JAR 文件中。同时,你需要将 Hibernate、它所需要的第三方库、你编译好的持久化类以及你的映射定义文件打包进同一个文档。你的企业 Bean(一般为会话 Bean)可能会被打包成它们自己的 JAR 文件,但你也许会将 EJB JAR 文件一同包含进能独立(热)部署的主服务文档。参考 JBoss AS 文档以了解更多的 JMX服务与 EJB 部署的信息。 " +msgid "" +"This file is deployed in a directory called META-INF and " +"packaged in a JAR file with the extension .sar (service " +"archive). You also need to package Hibernate, its required third-party " +"libraries, your compiled persistent classes, as well as your mapping files " +"in the same archive. Your enterprise beans (usually session beans) can be " +"kept in their own JAR file, but you can include this EJB JAR file in the " +"main service archive to get a single (hot-)deployable unit. Consult the " +"JBoss AS documentation for more information about JMX service and EJB " +"deployment." +msgstr "" +"这个文件是部署在 META-INF 目录下的,并会被打包到以 " +".sar(service archive)为扩展名的 JAR 文件中。同时,你需要" +"将 Hibernate、它所需要的第三方库、你编译好的持久化类以及你的映射定义文件打包" +"进同一个文档。你的企业 Bean(一般为会话 Bean)可能会被打包成它们自己的 JAR 文" +"件,但你也许会将 EJB JAR 文件一同包含进能独立(热)部署的主服务文档。参考 " +"JBoss AS 文档以了解更多的 JMX服务与 EJB 部署的信息。 " -#~ msgid "" -#~ "" -#~ msgstr "" -#~ "" +#~ msgid "JDBC URL" +#~ msgstr "JDBC URL" -#~ msgid "" -#~ "" -#~ msgstr "" -#~ "" +#~ msgid "database user" +#~ msgstr "数据库用户(可选) " -#~ msgid "" -#~ "" -#~ msgstr "" -#~ "" +#~ msgid "database user password" +#~ msgstr "数据库密码(可选) " -#~ msgid "" -#~ msgstr "" +#~ msgid "datasource JNDI name" +#~ msgstr "数据库用户(可选) " -#~ msgid "" -#~ "" -#~ msgstr "" -#~ "" +#~ msgid "hibernate.generate_statistics" +#~ msgstr "hibernate.generate_statistics" -#~ msgid "JDBC URL" -#~ msgstr "JDBC URL" +#~ msgid "hibernate.query.substitutions" +#~ msgstr "hibernate.query.substitutions" -#~ msgid "database user" -#~ msgstr "database user" +#~ msgid "DB2" +#~ msgstr "DB2" -#~ msgid "database user password" -#~ msgstr "数据库用户密码" +#~ msgid "org.hibernate.SQL" +#~ msgstr "org.hibernate.SQL" -#~ msgid "" -#~ "" -#~ msgstr "" -#~ "" +#~ msgid "org.hibernate.type" +#~ msgstr "org.hibernate.type" -#~ msgid "datasource JNDI name" -#~ msgstr "数据源 JNDI 名字" +#~ msgid "org.hibernate.pretty" +#~ msgstr "org.hibernate.pretty" -#~ msgid "" -#~ "" -#~ msgstr "" -#~ "" +#~ msgid "org.hibernate.cache" +#~ msgstr "org.hibernate.cache" -#~ msgid "DB2" -#~ msgstr "DB2" +#~ msgid "org.hibernate.jdbc" +#~ msgstr "org.hibernate.jdbc" -#~ msgid "hibernate.query.substitutions true=1, false=0" -#~ msgstr "hibernate.query.substitutions true=1,false=0" +#~ msgid "org.hibernate.secure" +#~ msgstr "org.hibernate.secure" -#~ msgid "hibernate.query.substitutions toLowercase=LOWER" -#~ msgstr "hibernate.query.substitutions toLowercase=LOWER" - -#~ msgid "org.hibernate" -#~ msgstr "org.hibernate" - -#~ msgid "" -#~ "" -#~ msgstr "" -#~ "" - -#~ msgid "" -#~ "\n" -#~ "\n" -#~ "\n" -#~ "\n" -#~ "\n" -#~ " \n" -#~ " \n" -#~ "\n" -#~ " \n" -#~ " java:/comp/env/jdbc/" -#~ "MyDB\n" -#~ " org.hibernate.dialect.MySQLDialect\n" -#~ " false\n" -#~ " \n" -#~ " org.hibernate.transaction.JTATransactionFactory\n" -#~ " \n" -#~ " java:comp/UserTransaction\n" -#~ "\n" -#~ " \n" -#~ " \n" -#~ " \n" -#~ "\n" -#~ " \n" -#~ " \n" -#~ " \n" -#~ " \n" -#~ "\n" -#~ " \n" -#~ "\n" -#~ "]]>" -#~ msgstr "" -#~ "\n" -#~ "\n" -#~ "\n" -#~ "\n" -#~ "\n" -#~ " \n" -#~ " \n" -#~ "\n" -#~ " \n" -#~ " java:/comp/env/jdbc/" -#~ "MyDB\n" -#~ " org.hibernate.dialect.MySQLDialect\n" -#~ " false\n" -#~ " \n" -#~ " org.hibernate.transaction.JTATransactionFactory\n" -#~ " \n" -#~ " java:comp/UserTransaction\n" -#~ "\n" -#~ " \n" -#~ " \n" -#~ " \n" -#~ "\n" -#~ " \n" -#~ " \n" -#~ " \n" -#~ " \n" -#~ "\n" -#~ " \n" -#~ "\n" -#~ "]]>" - -#~ msgid "" -#~ "" -#~ msgstr "" -#~ "" - -#~ msgid "" -#~ "" -#~ msgstr "" -#~ "" - -#~ msgid "" -#~ "\n" -#~ "\n" -#~ "\n" -#~ "\n" -#~ "\n" -#~ " \n" -#~ " jboss.jca:service=RARDeployer\n" -#~ " jboss.jca:service=LocalTxCM,name=HsqlDS\n" -#~ "\n" -#~ " \n" -#~ " java:/hibernate/SessionFactory\n" -#~ "\n" -#~ " \n" -#~ " java:HsqlDS\n" -#~ " org.hibernate.dialect.HSQLDialect\n" -#~ "\n" -#~ " \n" -#~ " \n" -#~ " org.hibernate.transaction.JTATransactionFactory\n" -#~ " \n" -#~ " org.hibernate.transaction.JBossTransactionManagerLookup\n" -#~ " true\n" -#~ " true\n" -#~ "\n" -#~ " \n" -#~ " 5\n" -#~ "\n" -#~ " \n" -#~ " true\n" -#~ " org.hibernate.cache." -#~ "EhCacheProvider\n" -#~ " true\n" -#~ "\n" -#~ " \n" -#~ " true\n" -#~ "\n" -#~ " \n" -#~ " auction/Item.hbm.xml,auction/" -#~ "Category.hbm.xml\n" -#~ "\n" -#~ "\n" -#~ "\n" -#~ "]]>" -#~ msgstr "" -#~ "\n" -#~ "\n" -#~ "\n" -#~ "\n" -#~ "\n" -#~ " \n" -#~ " jboss.jca:service=RARDeployer\n" -#~ " jboss.jca:service=LocalTxCM,name=HsqlDS\n" -#~ "\n" -#~ " \n" -#~ " java:/hibernate/SessionFactory\n" -#~ "\n" -#~ " \n" -#~ " java:HsqlDS\n" -#~ " org.hibernate.dialect.HSQLDialect\n" -#~ "\n" -#~ " \n" -#~ " \n" -#~ " org.hibernate.transaction.JTATransactionFactory\n" -#~ " \n" -#~ " org.hibernate.transaction.JBossTransactionManagerLookup\n" -#~ " true\n" -#~ " true\n" -#~ "\n" -#~ " \n" -#~ " 5\n" -#~ "\n" -#~ " \n" -#~ " true\n" -#~ " org.hibernate.cache." -#~ "EhCacheProvider\n" -#~ " true\n" -#~ "\n" -#~ " \n" -#~ " true\n" -#~ "\n" -#~ " \n" -#~ " auction/Item.hbm.xml,auction/" -#~ "Category.hbm.xml\n" -#~ "\n" -#~ "\n" -#~ "\n" -#~ "]]>" +#~ msgid "org.hibernate" +#~ msgstr "org.hibernate" diff --git a/documentation/manual/src/main/docbook/zh-CN/content/filters.po b/documentation/manual/src/main/docbook/zh-CN/content/filters.po index cd2dfe48b6..5483562057 100644 --- a/documentation/manual/src/main/docbook/zh-CN/content/filters.po +++ b/documentation/manual/src/main/docbook/zh-CN/content/filters.po @@ -5,7 +5,7 @@ msgid "" msgstr "" "Project-Id-Version: Collection_Mapping\n" "Report-Msgid-Bugs-To: http://bugs.kde.org\n" -"POT-Creation-Date: 2010-02-10T07:25:35\n" +"POT-Creation-Date: 2010-07-20 21:02+0000\n" "PO-Revision-Date: 2009-11-27 13:53+1000\n" "Last-Translator: Xi HUANG \n" "Language-Team: \n" @@ -15,11 +15,13 @@ msgstr "" "X-Generator: KBabel 1.11.4\n" #. Tag: title +#: filters.xml:31 #, no-c-format msgid "Filtering data" msgstr "过滤数据" #. Tag: para +#: filters.xml:33 #, no-c-format msgid "" "Hibernate3 provides an innovative new approach to handling data with " @@ -33,11 +35,13 @@ msgstr "" "Hibernate session 您可以选择是否启用(或禁用)某个过滤器。" #. Tag: title +#: filters.xml:39 #, no-c-format msgid "Hibernate filters" msgstr "Hibernate 过滤器(filters)" #. Tag: para +#: filters.xml:41 #, no-c-format msgid "" "Hibernate3 has the ability to pre-define filter criteria and attach those " @@ -56,9 +60,95 @@ msgstr "" "确定使用什么样的参数的。 " #. Tag: para +#: filters.xml:50 #, no-c-format msgid "" -"In order to use filters, they must first be defined and then attached to the " +"Using annotatons filters are defined via @org.hibernate.annotations." +"FilterDef or @org.hibernate.annotations.FilterDefs. A filter definition has a name() and an " +"array of parameters(). A parameter will allow you to adjust the behavior of " +"the filter at runtime. Each parameter is defined by a @ParamDef which has a name and a type. You can also define a " +"defaultCondition() parameter for a given " +"@FilterDef to set the default condition to use when none " +"are defined in each individual @Filter. " +"@FilterDef(s) can be defined at the class or package " +"level." +msgstr "" + +#. Tag: para +#: filters.xml:63 +#, no-c-format +msgid "" +"We now need to define the SQL filter clause applied to either the entity " +"load or the collection load. @Filter is used and placed " +"either on the entity or the collection element. The connection between " +"@FilterName and @Filter is a " +"matching name." +msgstr "" + +#. Tag: title +#: filters.xml:70 +#, no-c-format +msgid "@FilterDef and @Filter annotations" +msgstr "" + +#. Tag: programlisting +#: filters.xml:72 +#, no-c-format +msgid "" +"@Entity\n" +"@FilterDef(name=\"minLength\", parameters=@ParamDef( name=\"minLength\", " +"type=\"integer\" ) )\n" +"@Filters( {\n" +" @Filter(name=\"betweenLength\", condition=\":minLength <= length and :" +"maxLength >= length\"),\n" +" @Filter(name=\"minLength\", condition=\":minLength <= length\")\n" +"} )\n" +"public class Forest { ... }" +msgstr "" + +#. Tag: para +#: filters.xml:75 +#, no-c-format +msgid "" +"When the collection use an association table as a relational representation, " +"you might want to apply the filter condition to the association table itself " +"or to the target entity table. To apply the constraint on the target entity, " +"use the regular @Filter annotation. However, if you want " +"to target the association table, use the @FilterJoinTable " +"annotation." +msgstr "" + +#. Tag: title +#: filters.xml:84 +#, no-c-format +msgid "" +"Using @FilterJoinTable for filterting on the " +"association table" +msgstr "" + +#. Tag: programlisting +#: filters.xml:87 +#, no-c-format +msgid "" +"@OneToMany\n" +" @JoinTable\n" +" //filter on the target entity table\n" +" @Filter(name=\"betweenLength\", condition=\":minLength <= length and :" +"maxLength >= length\")\n" +" //filter on the association table\n" +" @FilterJoinTable(name=\"security\", condition=\":userlevel >= " +"requredLevel\")\n" +" public Set<Forest> getForests() { ... }" +msgstr "" + +#. Tag: para +#: filters.xml:90 +#, fuzzy, no-c-format +msgid "" +"Using Hibernate mapping files for defining filters the situtation is very " +"similar. The filters must first be defined and then attached to the " "appropriate mapping elements. To define a filter, use the <" "filter-def/> element within a <hibernate-mapping/" "> element:" @@ -67,22 +157,58 @@ msgstr "" "<hibernate-mapping/> 节点之内的 <filter-" "def/> 节点:" -#. Tag: para +#. Tag: title +#: filters.xml:97 #, no-c-format -msgid "This filter can then be attached to a class:" -msgstr "定义好之后,就可以在某个类中使用这个过滤器: " +msgid "Defining a filter definition via <filter-def>" +msgstr "" + +#. Tag: programlisting +#: filters.xml:100 +#, fuzzy, no-c-format +msgid "" +"<filter-def name=\"myFilter\">\n" +" <filter-param name=\"myFilterParam\" type=\"string\"/>\n" +"</filter-def>" +msgstr "" +"\n" +" \n" +"]]>" #. Tag: para -#, no-c-format -msgid "Or, to a collection:" -msgstr "或者也可以在某个集合使用它:" - -#. Tag: para -#, no-c-format -msgid "Or, to both or multiples of each at the same time." +#: filters.xml:103 +#, fuzzy, no-c-format +msgid "" +"This filter can then be attached to a class or collection (or, to both or " +"multiples of each at the same time):" msgstr "或者在同时可以使用多个过滤器。" +#. Tag: title +#: filters.xml:107 +#, no-c-format +msgid "" +"Attaching a filter to a class or collection using <filter>" +msgstr "" + +#. Tag: programlisting +#: filters.xml:110 +#, no-c-format +msgid "" +"<class name=\"myClass\" ...>\n" +" ...\n" +" <filter name=\"myFilter\" condition=\":myFilterParam = " +"MY_FILTERED_COLUMN\"/>\n" +"\n" +" <set ...>\n" +" <filter name=\"myFilter\" condition=\":myFilterParam = " +"MY_FILTERED_COLUMN\"/>\n" +" </set> \n" +"</class>" +msgstr "" + #. Tag: para +#: filters.xml:113 #, no-c-format msgid "" "The methods on Session are: enableFilter(String " @@ -101,7 +227,18 @@ msgstr "" "enabledFilter() 方法显式的启用。该方法返回被启用的 " "Filter 的实例。以上文定义的过滤器为例:" +#. Tag: programlisting +#: filters.xml:123 +#, fuzzy, no-c-format +msgid "" +"session.enableFilter(\"myFilter\").setParameter(\"myFilterParam\", \"some-" +"value\");" +msgstr "" +"" + #. Tag: para +#: filters.xml:125 #, no-c-format msgid "" "Methods on the org.hibernate.Filter interface do allow the method-chaining " @@ -112,13 +249,86 @@ msgstr "" "性。 " #. Tag: para +#: filters.xml:128 #, no-c-format msgid "" "The following is a full example, using temporal data with an effective " "record date pattern:" msgstr "下面是一个比较完整的例子,使用了记录生效日期模式过滤有时效的数据: " +#. Tag: programlisting +#: filters.xml:131 +#, fuzzy, no-c-format +msgid "" +"<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 "" +"\n" +" \n" +"\n" +"\n" +"\n" +"...\n" +" \n" +" \n" +" \n" +"...\n" +" \n" +" \n" +"\n" +"\n" +"\n" +"...\n" +" \n" +" \n" +" \n" +" \n" +" \n" +"]]>" + #. Tag: para +#: filters.xml:133 #, no-c-format msgid "" "In order to ensure that you are provided with currently effective records, " @@ -127,7 +337,29 @@ msgstr "" "定义好后,如果想要保证取回的都是目前处于生效期的记录,只需在获取雇员数据的操" "作之前先开启过滤器即可: " +#. Tag: programlisting +#: filters.xml:137 +#, fuzzy, no-c-format +msgid "" +"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();" +msgstr "" +" :" +"targetSalary\")\n" +" .setLong(\"targetSalary\", new Long(1000000))\n" +" .list();\n" +"]]>" + #. Tag: para +#: filters.xml:139 #, no-c-format msgid "" "Even though a salary constraint was mentioned explicitly on the results in " @@ -139,6 +371,7 @@ msgstr "" "询将仅返回那些目前雇用关系处于生效期的,并且薪水高于一百万美元的雇员的数据。 " #. Tag: para +#: filters.xml:144 #, no-c-format msgid "" "If you want to use filters with outer joining, either through HQL or load " @@ -151,6 +384,7 @@ msgstr "" "outer joining)。并且通常来说,先写参数,然后是操作符,最后写数据库字段名。" #. Tag: para +#: filters.xml:149 #, no-c-format msgid "" "After being defined, a filter might be attached to multiple entities and/or " @@ -163,7 +397,20 @@ msgstr "" "这些条件都是一样的,每次都要定义就显得很繁琐。因此,<filter-def/" "> 被用来定义一个默认条件,它可能作为属性或者 CDATA 出现: " +#. Tag: programlisting +#: filters.xml:155 +#, fuzzy, no-c-format +msgid "" +"<filter-def name=\"myFilter\" condition=\"abc > xyz\">...</" +"filter-def>\n" +"<filter-def name=\"myOtherFilter\">abc=xyz</filter-def>" +msgstr "" +" xyz\">...\n" +"abc=xyz]]>" + #. Tag: para +#: filters.xml:157 #, no-c-format msgid "" "This default condition will be used whenever the filter is attached to " @@ -174,14 +421,11 @@ msgstr "" "当这个 filter 被附加到任何目的地,而又没有指明条件时,这个缺省条件就会被使" "用。注意,换句话说,你可以通过给 filter 附加特别的条件来重载默认条件。" -#~ msgid "" -#~ "\n" -#~ " \n" -#~ "]]>" -#~ msgstr "" -#~ "\n" -#~ " \n" -#~ "]]>" +#~ msgid "This filter can then be attached to a class:" +#~ msgstr "定义好之后,就可以在某个类中使用这个过滤器: " + +#~ msgid "Or, to a collection:" +#~ msgstr "或者也可以在某个集合使用它:" #~ msgid "" #~ "\n" @@ -206,107 +450,3 @@ msgstr "" #~ " \n" #~ "]]>" - -#~ msgid "" -#~ "" -#~ msgstr "" -#~ "" - -#~ msgid "" -#~ "\n" -#~ " \n" -#~ "\n" -#~ "\n" -#~ "\n" -#~ "...\n" -#~ " \n" -#~ " \n" -#~ " \n" -#~ "...\n" -#~ " \n" -#~ " \n" -#~ "\n" -#~ "\n" -#~ "\n" -#~ "...\n" -#~ " \n" -#~ " \n" -#~ " \n" -#~ " \n" -#~ " \n" -#~ "]]>" -#~ msgstr "" -#~ "\n" -#~ " \n" -#~ "\n" -#~ "\n" -#~ "\n" -#~ "...\n" -#~ " \n" -#~ " \n" -#~ " \n" -#~ "...\n" -#~ " \n" -#~ " \n" -#~ "\n" -#~ "\n" -#~ "\n" -#~ "...\n" -#~ " \n" -#~ " \n" -#~ " \n" -#~ " \n" -#~ " \n" -#~ "]]>" - -#~ msgid "" -#~ " :" -#~ "targetSalary\")\n" -#~ " .setLong(\"targetSalary\", new Long(1000000))\n" -#~ " .list();\n" -#~ "]]>" -#~ msgstr "" -#~ " :" -#~ "targetSalary\")\n" -#~ " .setLong(\"targetSalary\", new Long(1000000))\n" -#~ " .list();\n" -#~ "]]>" - -#~ msgid "" -#~ " xyz\">...\n" -#~ "abc=xyz]]>" -#~ msgstr "" -#~ " xyz\">...\n" -#~ "abc=xyz]]>" diff --git a/documentation/manual/src/main/docbook/zh-CN/content/performance.po b/documentation/manual/src/main/docbook/zh-CN/content/performance.po index 4bbe8a0322..faf469eac9 100644 --- a/documentation/manual/src/main/docbook/zh-CN/content/performance.po +++ b/documentation/manual/src/main/docbook/zh-CN/content/performance.po @@ -6,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: performance\n" "Report-Msgid-Bugs-To: http://bugs.kde.org\n" -"POT-Creation-Date: 2010-02-11T05:38:15\n" +"POT-Creation-Date: 2010-07-20 21:02+0000\n" "PO-Revision-Date: 2010-03-15 15:27+1000\n" "Last-Translator: Xi HUANG \n" "Language-Team: \n" @@ -16,16 +16,19 @@ msgstr "" "X-Generator: KBabel 1.11.4\n" #. Tag: title +#: performance.xml:31 #, no-c-format msgid "Improving performance" msgstr "提升性能" #. Tag: title +#: performance.xml:34 #, no-c-format msgid "Fetching strategies" msgstr "抓取策略(Fetching strategies)" #. Tag: para +#: performance.xml:36 #, no-c-format msgid "" "Hibernate uses a fetching strategy to retrieve " @@ -39,11 +42,13 @@ msgstr "" "(Criteria Query)中重载声明。" #. Tag: para +#: performance.xml:42 #, no-c-format msgid "Hibernate3 defines the following fetching strategies:" msgstr "Hibernate3 定义了如下几种抓取策略:" #. Tag: para +#: performance.xml:46 #, no-c-format msgid "" "Join fetching: Hibernate retrieves the associated " @@ -55,6 +60,7 @@ msgstr "" "获得对象的关联实例或者关联集合。 " #. Tag: para +#: performance.xml:53 #, no-c-format msgid "" "Select fetching: a second SELECT is " @@ -68,6 +74,7 @@ msgstr "" "你真正访问关联关系的时候,才会执行第二条 select 语句。" #. Tag: para +#: performance.xml:61 #, no-c-format msgid "" "Subselect fetching: a second SELECT " @@ -83,6 +90,7 @@ msgstr "" "语句。" #. Tag: para +#: performance.xml:70 #, no-c-format msgid "" "Batch fetching: an optimization strategy for select " @@ -95,11 +103,13 @@ msgstr "" "批对象实例或集合。" #. Tag: para +#: performance.xml:77 #, no-c-format msgid "Hibernate also distinguishes between:" msgstr "Hibernate 会区分下列各种情况:" #. Tag: para +#: performance.xml:81 #, no-c-format msgid "" "Immediate fetching: an association, collection or " @@ -109,6 +119,7 @@ msgstr "" "或属性被立即抓取。" #. Tag: para +#: performance.xml:87 #, no-c-format msgid "" "Lazy collection fetching: a collection is fetched when " @@ -119,6 +130,7 @@ msgstr "" "合进行了一次操作时,集合才被抓取(对集合而言这是默认行为)。" #. Tag: para +#: performance.xml:93 #, no-c-format msgid "" "\"Extra-lazy\" collection fetching: individual elements " @@ -131,6 +143,7 @@ msgstr "" "要,Hibernate 不会试图去把整个集合都抓取到内存里来(适用于非常大的集合)。" #. Tag: para +#: performance.xml:101 #, no-c-format msgid "" "Proxy fetching: a single-valued association is fetched " @@ -141,6 +154,7 @@ msgstr "" "方法被调用,而非对其关键字进行 get 操作时才抓取。" #. Tag: para +#: performance.xml:107 #, no-c-format msgid "" "\"No-proxy\" fetching: a single-valued association is " @@ -157,6 +171,7 @@ msgstr "" "到。" #. Tag: para +#: performance.xml:117 #, no-c-format msgid "" "Lazy attribute fetching: an attribute or single valued " @@ -168,6 +183,7 @@ msgstr "" "方法很少是必要的。" #. Tag: para +#: performance.xml:124 #, no-c-format msgid "" "We have two orthogonal notions here: when is the " @@ -183,11 +199,13 @@ msgstr "" "契约,对某特定类的某个脱管的实例,知道有哪些数据是可以使用的。" #. Tag: title +#: performance.xml:132 #, no-c-format msgid "Working with lazy associations" msgstr "操作延迟加载的关联" #. Tag: para +#: performance.xml:134 #, no-c-format msgid "" "By default, Hibernate3 uses lazy select fetching for collections and lazy " @@ -198,6 +216,7 @@ msgstr "" "代理抓取。对几乎是所有的应用而言,其绝大多数的关联,这种策略都是有效的。" #. Tag: para +#: performance.xml:138 #, no-c-format msgid "" "If you set hibernate.default_batch_fetch_size, Hibernate " @@ -209,6 +228,7 @@ msgstr "" "开)。" #. Tag: para +#: performance.xml:142 #, no-c-format msgid "" "Please be aware that access to a lazy association outside of the context of " @@ -217,7 +237,36 @@ msgstr "" "然而,你必须了解延迟抓取带来的一个问题。在一个打开的 Hibernate session 上下文" "之外调用延迟集合会导致一次意外。比如: " +#. Tag: programlisting +#: performance.xml:146 +#, fuzzy, no-c-format +msgid "" +"s = sessions.openSession();\n" +"Transaction tx = s.beginTransaction();\n" +" \n" +"User u = (User) s.createQuery(\"from User u where u.name=:userName\")\n" +" .setString(\"userName\", userName).uniqueResult();\n" +"Map permissions = u.getPermissions();\n" +"\n" +"tx.commit();\n" +"s.close();\n" +"\n" +"Integer accessLevel = (Integer) permissions.get(\"accounts\"); // Error!" +msgstr "" +"" + #. Tag: para +#: performance.xml:148 #, no-c-format msgid "" "Since the permissions collection was not initialized when the " @@ -231,6 +280,7 @@ msgstr "" "emphasis>。这里的修改方法是将 permissions 读取数据的代码移到事务提交之前。" #. Tag: para +#: performance.xml:155 #, no-c-format msgid "" "Alternatively, you can use a non-lazy collection or association, by " @@ -246,6 +296,7 @@ msgstr "" "中载入整个数据库到内存中。" #. Tag: para +#: performance.xml:162 #, no-c-format msgid "" "On the other hand, you can use join fetching, which is non-lazy by nature, " @@ -260,11 +311,13 @@ msgstr "" "集合关联相一致的。 " #. Tag: title +#: performance.xml:170 #, no-c-format msgid "Tuning fetch strategies" msgstr "调整抓取策略(Tuning fetch strategies)" #. Tag: para +#: performance.xml:172 #, no-c-format msgid "" "Select fetching (the default) is extremely vulnerable to N+1 selects " @@ -273,7 +326,31 @@ msgstr "" "查询抓取(默认的)在 N+1 查询的情况下是极其脆弱的,因此我们可能会要求在映射文" "档中定义使用连接抓取:" +#. Tag: programlisting +#: performance.xml:176 +#, fuzzy, no-c-format +msgid "" +"<set name=\"permissions\"\n" +" fetch=\"join\">\n" +" <key column=\"userId\"/>\n" +" <one-to-many class=\"Permission\"/>\n" +"</set" +msgstr "" +"\n" +" \n" +" \n" +"" + +#. Tag: programlisting +#: performance.xml:178 +#, fuzzy, no-c-format +msgid "<many-to-one name=\"mother\" class=\"Cat\" fetch=\"join\"/>" +msgstr "" +"]]>" + #. Tag: para +#: performance.xml:180 #, no-c-format msgid "" "The fetch strategy defined in the mapping document " @@ -282,27 +359,32 @@ msgstr "" "在映射文档中定义的抓取策略将会对以下列表条目产生影响:" #. Tag: para +#: performance.xml:185 #, no-c-format msgid "retrieval via get() or load()" msgstr "" "通过 get()load() 方法取得数据。" #. Tag: para +#: performance.xml:190 #, no-c-format msgid "retrieval that happens implicitly when an association is navigated" msgstr "只有在关联之间进行导航时,才会隐式的取得数据。" #. Tag: para +#: performance.xml:195 #, no-c-format msgid "Criteria queries" msgstr "条件查询" #. Tag: para +#: performance.xml:199 #, no-c-format msgid "HQL queries if subselect fetching is used" msgstr "使用了 subselect 抓取的 HQL 查询" #. Tag: para +#: performance.xml:204 #, no-c-format msgid "" "Irrespective of the fetching strategy you use, the defined non-lazy graph is " @@ -313,6 +395,7 @@ msgstr "" "意味着在一条 HQL 查询后紧跟着一系列的查询。 " #. Tag: para +#: performance.xml:209 #, no-c-format msgid "" "Usually, the mapping document is not used to customize fetching. Instead, we " @@ -329,6 +412,7 @@ msgstr "" "setFetchMode(FetchMode.JOIN)语句。 " #. Tag: para +#: performance.xml:216 #, no-c-format msgid "" "If you want to change the fetching strategy used by get() " @@ -338,7 +422,22 @@ msgstr "" "也许你喜欢仅仅通过条件查询,就可以改变 get() 或 " "load() 语句中的数据抓取策略。例如: " +#. Tag: programlisting +#: performance.xml:220 +#, fuzzy, no-c-format +msgid "" +"User user = (User) session.createCriteria(User.class)\n" +" .setFetchMode(\"permissions\", FetchMode.JOIN)\n" +" .add( Restrictions.idEq(userId) )\n" +" .uniqueResult();" +msgstr "" +"" + #. Tag: para +#: performance.xml:222 #, no-c-format msgid "" "This is Hibernate's equivalent of what some ORM solutions call a \"fetch plan" @@ -347,6 +446,7 @@ msgstr "" "这就是其他 ORM 解决方案的“抓取计划(fetch plan)”在 Hibernate 中的等价物。" #. Tag: para +#: performance.xml:225 #, no-c-format msgid "" "A completely different approach to problems with N+1 selects is to use the " @@ -354,11 +454,13 @@ msgid "" msgstr "截然不同的一种避免 N+1 次查询的方法是,使用二级缓存。 " #. Tag: title +#: performance.xml:230 #, no-c-format msgid "Single-ended association proxies" msgstr "单端关联代理(Single-ended association proxies)" #. Tag: para +#: performance.xml:232 #, no-c-format msgid "" "Lazy fetching for collections is implemented using Hibernate's own " @@ -374,6 +476,7 @@ msgstr "" "代理。 " #. Tag: para +#: performance.xml:239 #, no-c-format msgid "" "At startup, Hibernate3 generates proxies by default for all persistent " @@ -385,6 +488,7 @@ msgstr "" "one) 关联的延迟抓取。 " #. Tag: para +#: performance.xml:244 #, no-c-format msgid "" "The mapping file may declare an interface to use as the proxy interface for " @@ -399,13 +503,33 @@ msgstr "" "拥有这样的构造函数。" #. Tag: para +#: performance.xml:251 #, no-c-format msgid "" "There are potential problems to note when extending this approach to " "polymorphic classes.For example:" msgstr "在如此方式定义一个多态类的时候,有许多值得注意的常见性的问题,例如: " +#. Tag: programlisting +#: performance.xml:254 +#, fuzzy, no-c-format +msgid "" +"<class name=\"Cat\" proxy=\"Cat\">\n" +" ......\n" +" <subclass name=\"DomesticCat\">\n" +" .....\n" +" </subclass>\n" +"</class>" +msgstr "" +"\n" +" ......\n" +" \n" +" .....\n" +" \n" +"]]>" + #. Tag: para +#: performance.xml:256 #, no-c-format msgid "" "Firstly, instances of Cat will never be castable to " @@ -416,12 +540,52 @@ msgstr "" "DomesticCat,即使它本身就是 DomesticCat 实例。" +#. Tag: programlisting +#: performance.xml:260 +#, fuzzy, no-c-format +msgid "" +"Cat cat = (Cat) session.load(Cat.class, id); // instantiate a proxy (does " +"not hit the db)\n" +"if ( cat.isDomesticCat() ) { // hit the db to initialize " +"the proxy\n" +" DomesticCat dc = (DomesticCat) cat; // Error!\n" +" ....\n" +"}" +msgstr "" +"" + #. Tag: para +#: performance.xml:262 #, no-c-format msgid "Secondly, it is possible to break proxy ==:" msgstr "其次,代理的“==”可能不再成立。 " +#. Tag: programlisting +#: performance.xml:265 +#, fuzzy, no-c-format +msgid "" +"Cat cat = (Cat) session.load(Cat.class, id); // instantiate a Cat " +"proxy\n" +"DomesticCat dc = \n" +" (DomesticCat) session.load(DomesticCat.class, id); // acquire new " +"DomesticCat proxy!\n" +"System.out.println(cat==dc); // false" +msgstr "" +"" + #. Tag: para +#: performance.xml:267 #, no-c-format msgid "" "However, the situation is not quite as bad as it looks. Even though we now " @@ -431,7 +595,18 @@ msgstr "" "虽然如此,但实际情况并没有看上去那么糟糕。虽然我们现在有两个不同的引用,分别" "指向这两个不同的代理对象,但实际上,其底层应该是同一个实例对象:" +#. Tag: programlisting +#: performance.xml:271 +#, fuzzy, no-c-format +msgid "" +"cat.setWeight(11.0); // hit the db to initialize the proxy\n" +"System.out.println( dc.getWeight() ); // 11.0" +msgstr "" +"" + #. Tag: para +#: performance.xml:273 #, no-c-format msgid "" "Third, you cannot use a CGLIB proxy for a final class or " @@ -441,6 +616,7 @@ msgstr "" "法的类使用 CGLIB 代理。" #. Tag: para +#: performance.xml:276 #, no-c-format msgid "" "Finally, if your persistent object acquires any resources upon instantiation " @@ -453,6 +629,7 @@ msgstr "" "类。" #. Tag: para +#: performance.xml:281 #, no-c-format msgid "" "These problems are all due to fundamental limitations in Java's single " @@ -469,7 +646,26 @@ msgstr "" "literal> 而 DomesticCatImpl 实现 DomesticCat 接口。例如:" +#. Tag: programlisting +#: performance.xml:289 +#, fuzzy, no-c-format +msgid "" +"<class name=\"CatImpl\" proxy=\"Cat\">\n" +" ......\n" +" <subclass name=\"DomesticCatImpl\" proxy=\"DomesticCat\">\n" +" .....\n" +" </subclass>\n" +"</class>" +msgstr "" +"\n" +" ......\n" +" \n" +" .....\n" +" \n" +"]]>" + #. Tag: para +#: performance.xml:291 #, no-c-format msgid "" "Then proxies for instances of Cat and " @@ -479,17 +675,34 @@ msgstr "" "然后,load()iterate() 永远也不会返" "回 CatDomesticCat 实例的代理。" +#. Tag: programlisting +#: performance.xml:295 +#, fuzzy, no-c-format +msgid "" +"Cat cat = (Cat) session.load(CatImpl.class, catid);\n" +"Iterator iter = session.createQuery(\"from CatImpl as cat where cat." +"name='fritz'\").iterate();\n" +"Cat fritz = (Cat) iter.next();" +msgstr "" +"" + #. Tag: title +#: performance.xml:298 #, no-c-format msgid "Note" msgstr "注意" #. Tag: para +#: performance.xml:300 #, no-c-format msgid "list() does not usually return proxies." msgstr "list() 通常不返回代理。" #. Tag: para +#: performance.xml:304 #, no-c-format msgid "" "Relationships are also lazily initialized. This means you must declare any " @@ -500,12 +713,14 @@ msgstr "" "Cat,而不是 CatImpl。" #. Tag: para +#: performance.xml:308 #, no-c-format msgid "" "Certain operations do not require proxy initialization:" msgstr "有些方法中是需要代理初始化的:" #. Tag: para +#: performance.xml:313 #, no-c-format msgid "" "equals(): if the persistent class does not override " @@ -515,6 +730,7 @@ msgstr "" "literal> 方法。" #. Tag: para +#: performance.xml:318 #, no-c-format msgid "" "hashCode(): if the persistent class does not override " @@ -524,11 +740,13 @@ msgstr "" "literal> 方法。" #. Tag: para +#: performance.xml:323 #, no-c-format msgid "The identifier getter method" msgstr "标志符的 getter 方法。" #. Tag: para +#: performance.xml:327 #, no-c-format msgid "" "Hibernate will detect persistent classes that override equals()hashCode() 方法的持久化类。" #. Tag: para +#: performance.xml:330 #, no-c-format msgid "" "By choosing lazy=\"no-proxy\" instead of the default " @@ -550,11 +769,13 @@ msgstr "" "码增强,并且所有的操作都会导致立刻进行代理初始化。 " #. Tag: title +#: performance.xml:338 #, no-c-format msgid "Initializing collections and proxies" msgstr "实例化集合和代理(Initializing collections and proxies)" #. Tag: para +#: performance.xml:340 #, no-c-format msgid "" "A LazyInitializationException will be thrown by Hibernate " @@ -567,6 +788,7 @@ msgstr "" "状态下,访问一个实体所拥有的集合,或者访问其指向代理的属性时,会引发此异常。 " #. Tag: para +#: performance.xml:346 #, no-c-format msgid "" "Sometimes a proxy or collection needs to be initialized before closing the " @@ -581,6 +803,7 @@ msgstr "" "者的疑惑,也不符合通常的代码规范。 " #. Tag: para +#: performance.xml:353 #, no-c-format msgid "" "The static methods Hibernate.initialize() and " @@ -598,6 +821,7 @@ msgstr "" "合具有同样的功能。 " #. Tag: para +#: performance.xml:362 #, no-c-format msgid "" "Another option is to keep the Session open until all " @@ -615,6 +839,7 @@ msgstr "" "open 状态经常会是一个问题。有两种方法可以解决此问题: " #. Tag: para +#: performance.xml:372 #, no-c-format msgid "" "In a web-based application, a servlet filter can be used to close the " @@ -636,6 +861,7 @@ msgstr "" "Session in View\" 模式,你可以找到示例。 " #. Tag: para +#: performance.xml:385 #, no-c-format msgid "" "In an application with a separate business tier, the business logic must " @@ -660,6 +886,7 @@ msgstr "" "emphasis>,那么这项任务将会变得简单的多。 " #. Tag: para +#: performance.xml:401 #, no-c-format msgid "" "You can also attach a previously loaded object to a new Session自动完成这些任务,因为这将引入一个特殊的事务语义。 " #. Tag: para +#: performance.xml:410 #, no-c-format msgid "" "Sometimes you do not want to initialize a large collection, but still need " @@ -684,13 +912,25 @@ msgstr "" "小)、或者集合的部分内容。 " #. Tag: para +#: performance.xml:414 #, no-c-format msgid "" "You can use a collection filter to get the size of a collection without " "initializing it:" msgstr "你可以使用集合过滤器得到其集合的大小,而不必实例化整个集合:" +#. Tag: programlisting +#: performance.xml:417 +#, fuzzy, no-c-format +msgid "" +"( (Integer) s.createFilter( collection, \"select count(*)\" ).list().get" +"(0) ).intValue()" +msgstr "" +"" + #. Tag: para +#: performance.xml:419 #, no-c-format msgid "" "The createFilter() method is also used to efficiently " @@ -700,12 +940,24 @@ msgstr "" "这里的 createFilter() 方法也可以被用来有效的抓取集合的部分" "内容,而无需实例化整个集合:" +#. Tag: programlisting +#: performance.xml:423 +#, fuzzy, no-c-format +msgid "" +"s.createFilter( lazyCollection, \"\").setFirstResult(0).setMaxResults(10)." +"list();" +msgstr "" +"" + #. Tag: title +#: performance.xml:427 #, no-c-format msgid "Using batch fetching" msgstr "使用批量抓取(Using batch fetching)" #. Tag: para +#: performance.xml:429 #, no-c-format msgid "" "Using batch fetching, Hibernate can load several uninitialized proxies if " @@ -718,6 +970,7 @@ msgstr "" "方案,你可以在两种批量抓取方案之间进行选择:在类级别和集合级别。 " #. Tag: para +#: performance.xml:434 #, no-c-format msgid "" "Batch fetching for classes/entities is easier to understand. Consider the " @@ -741,13 +994,21 @@ msgstr "" "映射文件的 Person 属性,显式声明 batch-size,改变其行为: " +#. Tag: programlisting +#: performance.xml:447 +#, fuzzy, no-c-format +msgid "<class name=\"Person\" batch-size=\"10\">...</class>" +msgstr "...]]>" + #. Tag: para +#: performance.xml:449 #, no-c-format msgid "" "Hibernate will now execute only three queries: the pattern is 10, 10, 5." msgstr "随之,Hibernate 将只需要执行三次查询,分别为 10、10、 5。 " #. Tag: para +#: performance.xml:452 #, no-c-format msgid "" "You can also enable batch fetching of collections. For example, if each " @@ -766,7 +1027,24 @@ msgstr "" "cats 批量抓取,那么,Hibernate 将可以预先抓取整个集合。请" "看例子: " +#. Tag: programlisting +#: performance.xml:461 +#, fuzzy, no-c-format +msgid "" +"<class name=\"Person\">\n" +" <set name=\"cats\" batch-size=\"3\">\n" +" ...\n" +" </set>\n" +"</class>" +msgstr "" +"\n" +" \n" +" ...\n" +" \n" +"]]>" + #. Tag: para +#: performance.xml:463 #, no-c-format msgid "" "With a batch-size of 3, Hibernate will load 3, 3, 3, 1 " @@ -780,6 +1058,7 @@ msgstr "" "数。 " #. Tag: para +#: performance.xml:468 #, no-c-format msgid "" "Batch fetching of collections is particularly useful if you have a nested " @@ -793,11 +1072,13 @@ msgstr "" "(materialized path)可能是更好的解决方法。)" #. Tag: title +#: performance.xml:475 #, no-c-format msgid "Using subselect fetching" msgstr "使用子查询抓取(Using subselect fetching)" #. Tag: para +#: performance.xml:477 #, no-c-format msgid "" "If one lazy collection or single-valued proxy has to be fetched, Hibernate " @@ -809,19 +1090,21 @@ msgstr "" "加载。 " #. Tag: title +#: performance.xml:486 #, no-c-format msgid "Fetch profiles" msgstr "Fetch profile(抓取策略)" #. Tag: para -#, no-c-format +#: performance.xml:488 +#, fuzzy, no-c-format msgid "" "Another way to affect the fetching strategy for loading associated objects " "is through something called a fetch profile, which is a named configuration " "associated with the org.hibernate.SessionFactory but enabled, by name, on the org.hibernate." "Session. Once enabled on a org.hibernate." -"Session, the fetch profile wull be in affect for that " +"Session, the fetch profile will be in affect for that " "org.hibernate.Session until it is explicitly " "disabled." msgstr "" @@ -833,14 +1116,107 @@ msgstr "" "用。" #. Tag: para -#, no-c-format +#: performance.xml:498 +#, fuzzy, no-c-format msgid "" -"So what does that mean? Well lets explain that by way of an example. Say we " -"have the following mappings:" +"So what does that mean? Well lets explain that by way of an example which " +"show the different available approaches to configure a fetch profile:" msgstr "这是什么意思呢?让我们通过一个例子进行解释。假设我们有下列映射:" -#. Tag: para +#. Tag: title +#: performance.xml:503 #, no-c-format +msgid "Specifying a fetch profile using @FetchProfile" +msgstr "" + +#. Tag: programlisting +#: performance.xml:506 +#, no-c-format +msgid "" +"@Entity\n" +"@FetchProfile(name = \"customer-with-orders\", fetchOverrides = {\n" +" @FetchProfile.FetchOverride(entity = Customer.class, association = " +"\"orders\", mode = FetchMode.JOIN)\n" +"})\n" +"public class Customer {\n" +" @Id\n" +" @GeneratedValue\n" +" private long id;\n" +"\n" +" private String name;\n" +"\n" +" private long customerNumber;\n" +"\n" +" @OneToMany\n" +" private Set<Order> orders;\n" +"\n" +" // standard getter/setter\n" +" ...\n" +"}" +msgstr "" + +#. Tag: title +#: performance.xml:510 +#, no-c-format +msgid "" +"Specifying a fetch profile using <fetch-profile> " +"outside <class> node" +msgstr "" + +#. Tag: programlisting +#: performance.xml:514 +#, no-c-format +msgid "" +"<hibernate-mapping>\n" +" <class name=\"Customer\">\n" +" ...\n" +" <set name=\"orders\" inverse=\"true\">\n" +" <key column=\"cust_id\"/>\n" +" <one-to-many class=\"Order\"/>\n" +" </set>\n" +" </class>\n" +" <class name=\"Order\">\n" +" ...\n" +" </class>\n" +" <fetch-profile name=\"customer-with-orders\">\n" +" <fetch entity=\"Customer\" association=\"orders\" style=\"join\"/" +">\n" +" </fetch-profile>\n" +"</hibernate-mapping>" +msgstr "" + +#. Tag: title +#: performance.xml:518 +#, no-c-format +msgid "" +"Specifying a fetch profile using <fetch-profile> " +"inside <class> node" +msgstr "" + +#. Tag: programlisting +#: performance.xml:522 +#, no-c-format +msgid "" +"<hibernate-mapping>\n" +" <class name=\"Customer\">\n" +" ...\n" +" <set name=\"orders\" inverse=\"true\">\n" +" <key column=\"cust_id\"/>\n" +" <one-to-many class=\"Order\"/>\n" +" </set>\n" +" <fetch-profile name=\"customer-with-orders\">\n" +" <fetch association=\"orders\" style=\"join\"/>\n" +" </fetch-profile>\n" +" </class>\n" +" <class name=\"Order\">\n" +" ...\n" +" </class>\n" +"</hibernate-mapping>" +msgstr "" + +#. Tag: para +#: performance.xml:525 +#, fuzzy, no-c-format msgid "" "Now normally when you get a reference to a particular customer, that " "customer's set of orders will be lazy meaning we will not yet have loaded " @@ -848,8 +1224,8 @@ msgid "" "that you have a certain use case where it is more efficient to load the " "customer and their orders together. One way certainly is to use \"dynamic " "fetching\" strategies via an HQL or criteria queries. But another option is " -"to use a fetch profile to achieve that. Just add the following to your " -"mapping:" +"to use a fetch profile to achieve that. The following code will load both " +"the customer andtheir orders:" msgstr "" "现在,当你获得某个特定客户的引用时,这个客户的订单将处于 lazy 状态,表示我们" "暂不会从数据库里加载这些订单。这样通常没有问题。假设在某种情况下,加载客户及" @@ -857,19 +1233,35 @@ msgstr "" "略。另外一个方法就是使用抓取配置(Fetch Profile)。你可以在映射里加入下面的内" "容:" -#. Tag: para +#. Tag: title +#: performance.xml:536 #, no-c-format -msgid "or even:" -msgstr "甚至:" +msgid "Activating a fetch profile for a given Session" +msgstr "" -#. Tag: para +#. Tag: programlisting +#: performance.xml:539 #, no-c-format msgid "" -"Now the following code will actually load both the customer and " -"their orders:" -msgstr "下面的代码将实际上加载客户以及订单:" +"Session session = ...;\n" +"session.enableFetchProfile( \"customer-with-orders\" ); // name matches " +"from mapping\n" +"Customer customer = (Customer) session.get( Customer.class, customerId );" +msgstr "" #. Tag: para +#: performance.xml:543 +#, no-c-format +msgid "" +"@FetchProfile definitions are global and it does not " +"matter on which class you place them. You can place the " +"@FetchProfile annotation either onto a class or " +"package (package-info.java). In order to define multiple fetch profiles for " +"the same class or package @FetchProfiles can be used." +msgstr "" + +#. Tag: para +#: performance.xml:551 #, no-c-format msgid "" "Currently only join style fetch profiles are supported, but they plan is to " @@ -881,11 +1273,13 @@ msgstr "" "3414\">HHH-3414。" #. Tag: title +#: performance.xml:558 #, no-c-format msgid "Using lazy property fetching" msgstr "使用延迟属性抓取(Using lazy property fetching)" #. Tag: para +#: performance.xml:560 #, no-c-format msgid "" "Hibernate3 supports the lazy fetching of individual properties. This " @@ -902,6 +1296,7 @@ msgstr "" "有用,例如在原有表中拥有几百列数据、数据模型无法改动的情况下。 " #. Tag: para +#: performance.xml:568 #, no-c-format msgid "" "To enable lazy property loading, set the lazy attribute " @@ -910,7 +1305,34 @@ msgstr "" "可以在映射文件中对特定的属性设置 lazy,定义该属性为延迟载" "入。" +#. Tag: programlisting +#: performance.xml:571 +#, fuzzy, no-c-format +msgid "" +"<class name=\"Document\">\n" +" <id name=\"id\">\n" +" <generator class=\"native\"/>\n" +" </id>\n" +" <property name=\"name\" not-null=\"true\" length=\"50\"/>\n" +" <property name=\"summary\" not-null=\"true\" length=\"200\" lazy=" +"\"true\"/>\n" +" <property name=\"text\" not-null=\"true\" length=\"2000\" lazy=\"true" +"\"/>\n" +"</class>" +msgstr "" +"\n" +" \n" +" \n" +" \n" +" \n" +" \n" +" \n" +"]]>" + #. Tag: para +#: performance.xml:573 #, no-c-format msgid "" "Lazy property loading requires buildtime bytecode instrumentation. If your " @@ -922,11 +1344,48 @@ msgstr "" "些属性的延迟设置,仍然将其直接载入。 " #. Tag: para +#: performance.xml:577 #, no-c-format msgid "For bytecode instrumentation, use the following Ant task:" msgstr "你可以在 Ant 的 Task 中,进行如下定义,对持久类代码加入“二进制指令。”" +#. Tag: programlisting +#: performance.xml:579 +#, fuzzy, no-c-format +msgid "" +"<target name=\"instrument\" depends=\"compile\">\n" +" <taskdef name=\"instrument\" classname=\"org.hibernate.tool." +"instrument.InstrumentTask\">\n" +" <classpath path=\"${jar.path}\"/>\n" +" <classpath path=\"${classes.dir}\"/>\n" +" <classpath refid=\"lib.class.path\"/>\n" +" </taskdef>\n" +"\n" +" <instrument verbose=\"true\">\n" +" <fileset dir=\"${testclasses.dir}/org/hibernate/auction/model" +"\">\n" +" <include name=\"*.class\"/>\n" +" </fileset>\n" +" </instrument>\n" +"</target>" +msgstr "" +"\n" +" \n" +" \n" +" \n" +" \n" +" \n" +"\n" +" \n" +" \n" +" \n" +" \n" +" \n" +"]]>" + #. Tag: para +#: performance.xml:581 #, no-c-format msgid "" "A different way of avoiding unnecessary column reads, at least for read-only " @@ -939,6 +1398,7 @@ msgstr "" "制指令”处理,因此是一个更加值得选择的解决方法。 " #. Tag: para +#: performance.xml:586 #, no-c-format msgid "" "You can force the usual eager fetching of properties using fetch " @@ -947,11 +1407,13 @@ msgstr "" "有时你需要在 HQL 中通过抓取所有属性,强行抓取所有内容。 " #. Tag: title +#: performance.xml:592 #, no-c-format msgid "The Second Level Cache" msgstr "二级缓存(The Second Level Cache)" #. Tag: para +#: performance.xml:594 #, no-c-format msgid "" "A Hibernate Session is a transaction-level cache of " @@ -969,15 +1431,17 @@ msgstr "" "(即使可以将缓存数据设定为定期失效)。 " #. Tag: para -#, no-c-format +#: performance.xml:602 +#, fuzzy, no-c-format msgid "" "You have the option to tell Hibernate which caching implementation to use by " "specifying the name of a class that implements org.hibernate.cache." "CacheProvider using the property hibernate.cache." "provider_class. Hibernate is bundled with a number of built-in " -"integrations with the open-source cache providers that are listed below. You " -"can also implement your own and plug it in as outlined above. Note that " -"versions prior to 3.2 use EhCache as the default cache provider." +"integrations with the open-source cache providers that are listed in . You can also implement your own and plug it in " +"as outlined above. Note that versions prior to Hibernate 3.2 use EhCache as " +"the default cache provider." msgstr "" "通过在 hibernate.cache.provider_class 属性中指定 " "org.hibernate.cache.CacheProvider 的某个实现的类名,你可以" @@ -987,154 +1451,401 @@ msgstr "" "样了。 " #. Tag: title +#: performance.xml:613 #, no-c-format msgid "Cache Providers" msgstr "缓存策略提供商(Cache Providers)" #. Tag: entry +#: performance.xml:628 performance.xml:976 #, no-c-format msgid "Cache" msgstr "Cache" #. Tag: entry +#: performance.xml:630 #, no-c-format msgid "Provider class" msgstr "Provider class" #. Tag: entry +#: performance.xml:632 #, no-c-format msgid "Type" msgstr "Type" #. Tag: entry +#: performance.xml:634 #, no-c-format msgid "Cluster Safe" msgstr "Cluster Safe" #. Tag: entry +#: performance.xml:636 #, no-c-format msgid "Query Cache Supported" msgstr "Query Cache Supported" #. Tag: entry +#: performance.xml:642 performance.xml:990 #, no-c-format msgid "Hashtable (not intended for production use)" msgstr "Hashtable (not intended for production use)" -#. Tag: entry -#, no-c-format -msgid "org.hibernate.cache.HashtableCacheProvider" +#. Tag: literal +#: performance.xml:644 +#, fuzzy, no-c-format +msgid "org.hibernate.cache.HashtableCacheProvider" msgstr "org.hibernate.cache.HashtableCacheProvider " #. Tag: entry +#: performance.xml:646 #, no-c-format msgid "memory" msgstr "memory" #. Tag: entry +#: performance.xml:650 performance.xml:662 performance.xml:674 +#: performance.xml:992 performance.xml:994 performance.xml:996 +#: performance.xml:1004 performance.xml:1006 performance.xml:1008 +#: performance.xml:1016 performance.xml:1018 performance.xml:1020 +#: performance.xml:1028 performance.xml:1030 performance.xml:1040 +#: performance.xml:1046 performance.xml:1052 performance.xml:1058 #, no-c-format -msgid "yes" -msgstr "yes" +msgid "yes" +msgstr "yes" #. Tag: entry +#: performance.xml:654 performance.xml:1002 #, no-c-format msgid "EHCache" msgstr "EHCache" -#. Tag: entry -#, no-c-format -msgid "org.hibernate.cache.EhCacheProvider" +#. Tag: literal +#: performance.xml:656 +#, fuzzy, no-c-format +msgid "org.hibernate.cache.EhCacheProvider" msgstr "org.hibernate.cache.EhCacheProvider " #. Tag: entry +#: performance.xml:658 performance.xml:670 #, no-c-format msgid "memory, disk" msgstr "memory,disk" #. Tag: entry +#: performance.xml:666 performance.xml:1014 #, no-c-format msgid "OSCache" msgstr "OSCache" -#. Tag: entry -#, no-c-format -msgid "org.hibernate.cache.OSCacheProvider" +#. Tag: literal +#: performance.xml:668 +#, fuzzy, no-c-format +msgid "org.hibernate.cache.OSCacheProvider" msgstr "org.hibernate.cache.OSCacheProvider " #. Tag: entry +#: performance.xml:678 performance.xml:1026 #, no-c-format msgid "SwarmCache" msgstr "SwarmCache" -#. Tag: entry -#, no-c-format -msgid "org.hibernate.cache.SwarmCacheProvider" +#. Tag: literal +#: performance.xml:680 +#, fuzzy, no-c-format +msgid "org.hibernate.cache.SwarmCacheProvider" msgstr "org.hibernate.cache.SwarmCacheProvider" #. Tag: entry +#: performance.xml:682 #, no-c-format msgid "clustered (ip multicast)" msgstr "clustered (ip multicast)" #. Tag: entry +#: performance.xml:684 #, no-c-format msgid "yes (clustered invalidation)" msgstr "yes (clustered invalidation)" #. Tag: entry +#: performance.xml:690 performance.xml:1038 #, no-c-format msgid "JBoss Cache 1.x" msgstr "JBoss Cache 1.x" -#. Tag: entry -#, no-c-format -msgid "org.hibernate.cache.TreeCacheProvider" +#. Tag: literal +#: performance.xml:692 +#, fuzzy, no-c-format +msgid "org.hibernate.cache.TreeCacheProvider" msgstr "org.hibernate.cache.TreeCacheProvider " #. Tag: entry +#: performance.xml:694 performance.xml:706 #, no-c-format msgid "clustered (ip multicast), transactional" msgstr "clustered (ip multicast), transactional" #. Tag: entry +#: performance.xml:696 #, no-c-format msgid "yes (replication)" msgstr "yes (replication)" #. Tag: entry +#: performance.xml:698 performance.xml:710 #, no-c-format msgid "yes (clock sync req.)" msgstr "yes (clock sync req.)" #. Tag: entry +#: performance.xml:702 performance.xml:1050 #, no-c-format msgid "JBoss Cache 2" msgstr "JBoss Cache 2" -#. Tag: entry -#, no-c-format -msgid "org.hibernate.cache.jbc.JBossCacheRegionFactory" +#. Tag: literal +#: performance.xml:704 +#, fuzzy, no-c-format +msgid "org.hibernate.cache.jbc.JBossCacheRegionFactory" msgstr "org.hibernate.cache.jbc.JBossCacheRegionFactory" #. Tag: entry +#: performance.xml:708 #, no-c-format msgid "yes (replication or invalidation)" msgstr "yes (replication or invalidation)" #. Tag: title +#: performance.xml:717 #, no-c-format msgid "Cache mappings" msgstr "缓存映射(Cache mappings)" #. Tag: para +#: performance.xml:719 #, no-c-format msgid "" -"The <cache> element of a class or collection " -"mapping has the following form:" +"As we have done in previous chapters we are looking at the two different " +"possibiltites to configure caching. First configuration via annotations and " +"then via Hibernate mapping files." msgstr "" -"类或者集合映射的“<cache> 元素”可以有下列形式:" #. Tag: para +#: performance.xml:723 +#, no-c-format +msgid "" +"By default, entities are not part of the second level cache and we recommend " +"you to stick to this setting. However, you can override this by setting the " +"shared-cache-mode element in your persistence." +"xml file or by using the javax.persistence.sharedCache." +"mode property in your configuration. The following values are " +"possible:" +msgstr "" + +#. Tag: para +#: performance.xml:732 +#, no-c-format +msgid "" +"ENABLE_SELECTIVE (Default and recommended value): " +"entities are not cached unless explicitly marked as cacheable." +msgstr "" + +#. Tag: para +#: performance.xml:738 +#, no-c-format +msgid "" +"DISABLE_SELECTIVE: entities are cached unless explicitly " +"marked as not cacheable." +msgstr "" + +#. Tag: para +#: performance.xml:743 +#, no-c-format +msgid "" +"ALL: all entities are always cached even if marked as non " +"cacheable." +msgstr "" + +#. Tag: para +#: performance.xml:748 +#, no-c-format +msgid "" +"NONE: no entity are cached even if marked as cacheable. " +"This option can make sense to disable second-level cache altogether." +msgstr "" + +#. Tag: para +#: performance.xml:754 +#, no-c-format +msgid "" +"The cache concurrency strategy used by default can be set globaly via the " +"hibernate.cache.default_cache_concurrency_strategy " +"configuration property. The values for this property are:" +msgstr "" + +#. Tag: literal +#: performance.xml:761 +#, fuzzy, no-c-format +msgid "read-only" +msgstr "条件查询" + +#. Tag: literal +#: performance.xml:765 +#, fuzzy, no-c-format +msgid "read-write" +msgstr "条件查询" + +#. Tag: literal +#: performance.xml:769 +#, fuzzy, no-c-format +msgid "nonstrict-read-write" +msgstr "nonstrict-read-write" + +#. Tag: literal +#: performance.xml:773 +#, fuzzy, no-c-format +msgid "transactional" +msgstr "条件查询" + +#. Tag: para +#: performance.xml:778 +#, no-c-format +msgid "" +"It is recommended to define the cache concurrency strategy per entity rather " +"than using a global one. Use the @org.hibernate.annotations." +"Cache annotation for that." +msgstr "" + +#. Tag: title +#: performance.xml:785 +#, no-c-format +msgid "" +"Definition of cache concurrency strategy via @Cache" +msgstr "" + +#. Tag: programlisting +#: performance.xml:788 +#, no-c-format +msgid "" +"@Entity \n" +"@Cacheable\n" +"@Cache(usage = CacheConcurrencyStrategy.NONSTRICT_READ_WRITE)\n" +"public class Forest { ... }" +msgstr "" + +#. Tag: para +#: performance.xml:791 +#, no-c-format +msgid "" +"Hibernate also let's you cache the content of a collection or the " +"identifiers if the collection contains other entities. Use the " +"@Cache annotation on the collection property." +msgstr "" + +#. Tag: title +#: performance.xml:797 +#, fuzzy, no-c-format +msgid "Caching collections using annotations" +msgstr "实例化集合和代理(Initializing collections and proxies)" + +#. Tag: programlisting +#: performance.xml:799 +#, no-c-format +msgid "" +"@OneToMany(cascade=CascadeType.ALL, fetch=FetchType.EAGER)\n" +"@JoinColumn(name=\"CUST_ID\")\n" +"@Cache(usage = CacheConcurrencyStrategy.NONSTRICT_READ_WRITE)\n" +"public SortedSet<Ticket> getTickets() {\n" +" return tickets;\n" +"}" +msgstr "" + +#. Tag: para +#: performance.xml:802 +#, no-c-format +msgid "" +"shows the @org.hibernate.annotations.Cache annotations " +"with its attributes. It allows you to define the caching strategy and region " +"of a given second level cache." +msgstr "" + +#. Tag: title +#: performance.xml:808 +#, no-c-format +msgid "@Cache annotation with attributes" +msgstr "" + +#. Tag: programlisting +#: performance.xml:820 +#, no-c-format +msgid "" +"@Cache(\n" +" CacheConcurrencyStrategy usage();\n" +" String region() default \"\";\n" +" String include() default \"all\";\n" +")" +msgstr "" + +#. Tag: para +#: performance.xml:824 +#, no-c-format +msgid "" +"usage: the given cache concurrency strategy (NONE, READ_ONLY, " +"NONSTRICT_READ_WRITE, READ_WRITE, TRANSACTIONAL)" +msgstr "" + +#. Tag: para +#: performance.xml:830 +#, no-c-format +msgid "" +"region (optional): the cache region (default to the fqcn of the class or the " +"fq role name of the collection)" +msgstr "" + +#. Tag: para +#: performance.xml:835 +#, no-c-format +msgid "" +"include (optional): all to include all properties, non-" +"lazy to only include non lazy properties (default all)." +msgstr "" + +#. Tag: para +#: performance.xml:843 +#, no-c-format +msgid "" +"Let's now take a look at Hibernate mapping files. There the <" +"cache> element of a class or collection mapping is used to " +"configure the second level cache. Looking at the parallels to anotations is obvious." +msgstr "" + +#. Tag: title +#: performance.xml:850 +#, no-c-format +msgid "The Hibernate <cache> mapping element" +msgstr "" + +#. Tag: programlisting +#: performance.xml:862 +#, fuzzy, no-c-format +msgid "" +"<cache\n" +" usage=\"transactional|read-write|nonstrict-read-write|read-only\"\n" +" region=\"RegionName\"\n" +" include=\"all|non-lazy\"\n" +"/>" +msgstr "" +"]]>" + +#. Tag: para +#: performance.xml:866 #, no-c-format msgid "" "usage (required) specifies the caching strategy: " @@ -1146,6 +1857,7 @@ msgstr "" "literal> 或 read-only。" #. Tag: para +#: performance.xml:874 #, no-c-format msgid "" "region (optional: defaults to the class or collection " @@ -1156,6 +1868,7 @@ msgstr "" "cache region) " #. Tag: para +#: performance.xml:880 #, no-c-format msgid "" "include (optional: defaults to all) " @@ -1168,31 +1881,31 @@ msgstr "" "\"true\" 的实体的属性可能无法被缓存 " #. Tag: para -#, no-c-format +#: performance.xml:890 +#, fuzzy, no-c-format msgid "" -"Alternatively, you can specify <class-cache> and " -"<collection-cache> elements in hibernate." -"cfg.xml." +"Alternatively to <cache>, you can use <" +"class-cache> and <collection-cache> " +"elements in hibernate.cfg.xml." msgstr "" "另外(首选?),你可以在hibernate.cfg.xml 中指定 " "<class-cache><collection-cache> 元素。" #. Tag: para +#: performance.xml:895 #, no-c-format -msgid "" -"The usage attribute specifies a cache " -"concurrency strategy." +msgid "Let's now have a closer look at the different usage strategies" msgstr "" -"这里的 usage 属性指明了缓存并发策略(cache " -"concurrency strategy)。" #. Tag: title +#: performance.xml:900 #, no-c-format msgid "Strategy: read only" msgstr "策略:只读缓存(Strategy:read only)" #. Tag: para +#: performance.xml:902 #, no-c-format msgid "" "If your application needs to read, but not modify, instances of a persistent " @@ -1205,11 +1918,13 @@ msgstr "" "中,它也能完美地运作。 " #. Tag: title +#: performance.xml:909 #, no-c-format msgid "Strategy: read/write" msgstr "策略:读写/缓存(Strategy:read/write)" #. Tag: para +#: performance.xml:911 #, no-c-format msgid "" "If the application needs to update data, a read-write " @@ -1235,11 +1950,13 @@ msgstr "" "(locking)。Hibernate 内置的缓存策略并不支持锁定功能。 " #. Tag: title +#: performance.xml:927 #, no-c-format msgid "Strategy: nonstrict read/write" msgstr "策略:非严格读/写缓存(Strategy:nonstrict read/write)" #. Tag: para +#: performance.xml:929 #, no-c-format msgid "" "If the application only occasionally needs to update data (i.e. if it is " @@ -1259,11 +1976,13 @@ msgstr "" "Session.disconnect() 调用前,整个事务已经结束。 " #. Tag: title +#: performance.xml:941 #, no-c-format msgid "Strategy: transactional" msgstr "策略:事务缓存(transactional)" #. Tag: para +#: performance.xml:943 #, no-c-format msgid "" "The transactional cache strategy provides support for " @@ -1276,11 +1995,13 @@ msgstr "" "hibernate.transaction.manager_lookup_class 属性。 " #. Tag: title +#: performance.xml:950 #, no-c-format msgid "Cache-provider/concurrency-strategy compatibility" msgstr "各种缓存提供商/缓存并发策略的兼容性" #. Tag: para +#: performance.xml:953 #, no-c-format msgid "" "None of the cache providers support all of the cache concurrency strategies." @@ -1289,6 +2010,7 @@ msgstr "" "其各自适用的并发策略。 " #. Tag: para +#: performance.xml:957 #, no-c-format msgid "" "The following table shows which providers are compatible with which " @@ -1298,37 +2020,44 @@ msgstr "" "其各自适用的并发策略。 " #. Tag: title +#: performance.xml:961 #, no-c-format msgid "Cache Concurrency Strategy Support" msgstr "" "各种缓存提供商对缓存并发策略的支持情况(Cache Concurrency Strategy Support)" #. Tag: entry -#, no-c-format -msgid "read-only" -msgstr "read-only" +#: performance.xml:978 +#, fuzzy, no-c-format +msgid "read-only" +msgstr "yes" #. Tag: entry -#, no-c-format -msgid "nonstrict-read-write" +#: performance.xml:980 +#, fuzzy, no-c-format +msgid "nonstrict-read-write" msgstr "nonstrict-read-write" #. Tag: entry -#, no-c-format -msgid "read-write" -msgstr "read-write" +#: performance.xml:982 +#, fuzzy, no-c-format +msgid "read-write" +msgstr "yes" #. Tag: entry -#, no-c-format -msgid "transactional" -msgstr "transactional" +#: performance.xml:984 +#, fuzzy, no-c-format +msgid "transactional" +msgstr "yes" #. Tag: title +#: performance.xml:1067 #, no-c-format msgid "Managing the caches" msgstr "管理缓存(Managing the caches)" #. Tag: para +#: performance.xml:1069 #, no-c-format msgid "" "Whenever you pass an object to save(), update()Session 的内部缓存中。 " #. Tag: para +#: performance.xml:1076 #, no-c-format msgid "" "When flush() is subsequently called, the state of that " @@ -1358,7 +2088,36 @@ msgstr "" "操作发生,或者你正处理大量对象、需要对有效管理内存时,你可以调用 " "evict() 方法,从一级缓存中去掉这些对象及其集合。 " +#. Tag: title +#: performance.xml:1084 +#, no-c-format +msgid "" +"Explcitly evicting a cached instance from the first level cache using " +"Session.evict()" +msgstr "" + +#. Tag: programlisting +#: performance.xml:1087 +#, fuzzy, no-c-format +msgid "" +"ScrollableResult cats = sess.createQuery(\"from Cat as cat\").scroll(); //a " +"huge result set\n" +"while ( cats.next() ) {\n" +" Cat cat = (Cat) cats.get(0);\n" +" doSomethingWithACat(cat);\n" +" sess.evict(cat);\n" +"}" +msgstr "" +"" + #. Tag: para +#: performance.xml:1090 #, no-c-format msgid "" "The Session also provides a contains() " @@ -1368,6 +2127,7 @@ msgstr "" "处于当前 session 的缓存中。" #. Tag: para +#: performance.xml:1094 #, no-c-format msgid "" "To evict all objects from the session cache, call Session.clear()。 " #. Tag: para +#: performance.xml:1097 #, no-c-format msgid "" "For the second-level cache, there are methods defined on " @@ -1386,7 +2147,34 @@ msgstr "" "对于二级缓存来说,在 SessionFactory 中定义了许多方法,清除" "缓存中实例、整个类、集合实例或者整个集合。" +#. Tag: title +#: performance.xml:1103 +#, no-c-format +msgid "" +"Second-level cache eviction via SessionFactoty.evict() and SessionFacyory.evictCollection()" +msgstr "" + +#. Tag: programlisting +#: performance.xml:1107 +#, fuzzy, no-c-format +msgid "" +"sessionFactory.evict(Cat.class, catId); //evict a particular Cat\n" +"sessionFactory.evict(Cat.class); //evict all Cats\n" +"sessionFactory.evictCollection(\"Cat.kittens\", catId); //evict a particular " +"collection of kittens\n" +"sessionFactory.evictCollection(\"Cat.kittens\"); //evict all kitten " +"collections" +msgstr "" +"" + #. Tag: para +#: performance.xml:1110 #, no-c-format msgid "" "The CacheMode controls how a particular session interacts " @@ -1396,6 +2184,7 @@ msgstr "" "互。 " #. Tag: para +#: performance.xml:1115 #, no-c-format msgid "" "CacheMode.NORMAL: will read items from and write items to " @@ -1403,6 +2192,7 @@ msgid "" msgstr "CacheMode.NORMAL:从二级缓存中读、写数据。" #. Tag: para +#: performance.xml:1120 #, no-c-format msgid "" "CacheMode.GET: will read items from the second-level " @@ -1412,6 +2202,7 @@ msgstr "" "缓存写数据。" #. Tag: para +#: performance.xml:1126 #, no-c-format msgid "" "CacheMode.PUT: will write items to the second-level " @@ -1421,6 +2212,7 @@ msgstr "" "据。" #. Tag: para +#: performance.xml:1131 #, no-c-format msgid "" "CacheMode.REFRESH: will write items to the second-level " @@ -1433,6 +2225,7 @@ msgstr "" "级缓存从数据库中读取数据,刷新缓存内容。" #. Tag: para +#: performance.xml:1139 #, no-c-format msgid "" "To browse the contents of a second-level or query cache region, use the " @@ -1441,7 +2234,30 @@ msgstr "" "如若需要查看二级缓存或查询缓存区域的内容,你可以使用统计" "(Statistics) API。" +#. Tag: title +#: performance.xml:1143 +#, fuzzy, no-c-format +msgid "" +"Browsing the second-level cache entries via the Statistics API" +msgstr "" +"如若需要查看二级缓存或查询缓存区域的内容,你可以使用统计" +"(Statistics) API。" + +#. Tag: programlisting +#: performance.xml:1146 +#, fuzzy, no-c-format +msgid "" +"Map cacheEntries = sessionFactory.getStatistics()\n" +" .getSecondLevelCacheStatistics(regionName)\n" +" .getEntries();" +msgstr "" +"" + #. Tag: para +#: performance.xml:1149 #, no-c-format msgid "" "You will need to enable statistics and, optionally, force Hibernate to keep " @@ -1451,11 +2267,29 @@ msgstr "" "缓存内容。 " #. Tag: title +#: performance.xml:1153 +#, no-c-format +msgid "Enabling Hibernate statistics" +msgstr "" + +#. Tag: programlisting +#: performance.xml:1155 +#, fuzzy, no-c-format +msgid "" +"hibernate.generate_statistics true\n" +"hibernate.cache.use_structured_entries true" +msgstr "" +"" + +#. Tag: title +#: performance.xml:1160 #, no-c-format msgid "The Query Cache" msgstr "查询缓存(The Query Cache)" #. Tag: para +#: performance.xml:1162 #, no-c-format msgid "" "Query result sets can also be cached. This is only useful for queries that " @@ -1465,11 +2299,13 @@ msgstr "" "处。" #. Tag: title +#: performance.xml:1166 #, no-c-format msgid "Enabling query caching" msgstr "启用查询缓存" #. Tag: para +#: performance.xml:1168 #, no-c-format msgid "" "Caching of query results introduces some overhead in terms of your " @@ -1486,12 +2322,20 @@ msgstr "" "么时候失效。因为大多数应用程序不会从缓存查询结果中受益,所以 Hibernate 在缺省" "情况下将禁用缓存。要使用查询缓存,你首先需要启用查询缓存:" +#. Tag: programlisting +#: performance.xml:1177 +#, fuzzy, no-c-format +msgid "hibernate.cache.use_query_cache true" +msgstr "" + #. Tag: para +#: performance.xml:1179 #, no-c-format msgid "This setting creates two new cache regions:" msgstr "这个设置创建了两个新的缓存 region:" #. Tag: para +#: performance.xml:1181 #, no-c-format msgid "" "org.hibernate.cache.StandardQueryCache, holding the " @@ -1501,6 +2345,7 @@ msgstr "" "结果" #. Tag: para +#: performance.xml:1186 #, no-c-format msgid "" "org.hibernate.cache.UpdateTimestampsCache, holding " @@ -1511,10 +2356,11 @@ msgstr "" "询表的最近更新的时间戳。它们用于检验查询结果。" #. Tag: para +#: performance.xml:1194 #, fuzzy, no-c-format msgid "" "If you configure your underlying cache implementation to use expiry or " -"timeouts is is very important that the cache timeout of the underlying cache " +"timeouts is very important that the cache timeout of the underlying cache " "region for the UpdateTimestampsCache be set to a higher value than the " "timeouts of any of the query caches. In fact, we recommend that the the " "UpdateTimestampsCache region not be configured for expiry at all. Note, in " @@ -1526,6 +2372,7 @@ msgstr "" "region 用于 expiry。请注意,特别是 LRU 缓存 expiry 策略总是不合适的。" #. Tag: para +#: performance.xml:1203 #, no-c-format msgid "" "As mentioned above, most queries do not benefit from caching or their " @@ -1541,6 +2388,7 @@ msgstr "" "查找结果,并将自己的结果集放到缓存中去。 " #. Tag: para +#: performance.xml:1211 #, no-c-format msgid "" "The query cache does not cache the state of the actual entities in the " @@ -1554,11 +2402,13 @@ msgstr "" "询缓存应该和二级缓存一起使用。" #. Tag: title +#: performance.xml:1221 #, no-c-format msgid "Query cache regions" msgstr "查询缓存区" #. Tag: para +#: performance.xml:1223 #, no-c-format msgid "" "If you require fine-grained control over query cache expiration policies, " @@ -1568,7 +2418,28 @@ msgstr "" "如果你要对查询缓存的失效政策进行精确的控制,你必须调用 Query." "setCacheRegion() 方法,为每个查询指定其命名的缓存区域。 " +#. Tag: programlisting +#: performance.xml:1227 +#, fuzzy, no-c-format +msgid "" +"List blogs = sess.createQuery(\"from Blog blog where blog.blogger = :blogger" +"\")\n" +" .setEntity(\"blogger\", blogger)\n" +" .setMaxResults(15)\n" +" .setCacheable(true)\n" +" .setCacheRegion(\"frontpages\")\n" +" .list();" +msgstr "" +"" + #. Tag: para +#: performance.xml:1229 #, no-c-format msgid "" "If you want to force the query cache to refresh one of its regions " @@ -1588,11 +2459,13 @@ msgstr "" " 的更为有效的替代方案,同样可以清除查询缓存区域。" #. Tag: title +#: performance.xml:1242 #, no-c-format msgid "Understanding Collection performance" msgstr "理解集合性能(Understanding Collection performance)" #. Tag: para +#: performance.xml:1244 #, no-c-format msgid "" "In the previous sections we have covered collections and their applications. " @@ -1603,31 +2476,37 @@ msgstr "" "更多问题。" #. Tag: title +#: performance.xml:1249 #, no-c-format msgid "Taxonomy" msgstr "分类(Taxonomy)" #. Tag: para +#: performance.xml:1251 #, no-c-format msgid "Hibernate defines three basic kinds of collections:" msgstr "Hibernate 定义了三种基本类型的集合:" #. Tag: para +#: performance.xml:1255 #, no-c-format msgid "collections of values" msgstr "值数据集合" #. Tag: para +#: performance.xml:1259 #, no-c-format msgid "one-to-many associations" msgstr "一对多关联(One-to-many Associations) " #. Tag: para +#: performance.xml:1263 #, no-c-format msgid "many-to-many associations" msgstr "多对多关联 " #. Tag: para +#: performance.xml:1267 #, no-c-format msgid "" "This classification distinguishes the various table and foreign key " @@ -1642,21 +2521,25 @@ msgstr "" "或删除集合行数据的主键的结构”。因此得到了如下的分类:" #. Tag: para +#: performance.xml:1276 #, no-c-format msgid "indexed collections" msgstr "有序集合类" #. Tag: para +#: performance.xml:1280 #, no-c-format msgid "sets" msgstr "集合(sets)" #. Tag: para +#: performance.xml:1284 #, no-c-format msgid "bags" msgstr "包(bags)" #. Tag: para +#: performance.xml:1288 #, no-c-format msgid "" "All indexed collections (maps, lists, and arrays) have a primary key " @@ -1671,6 +2554,7 @@ msgstr "" "时,可以迅速找到该行数据。 " #. Tag: para +#: performance.xml:1295 #, no-c-format msgid "" "Sets have a primary key consisting of <key> and " @@ -1691,6 +2575,7 @@ msgstr "" "键,你必须把所有的字段都声明为 not-null=\"true\"。) " #. Tag: para +#: performance.xml:1306 #, no-c-format msgid "" "<idbag> mappings define a surrogate key, so they " @@ -1700,6 +2585,7 @@ msgstr "" "新。事实上,<idbag> 拥有着最好的性能表现。 " #. Tag: para +#: performance.xml:1309 #, no-c-format msgid "" "Bags are the worst case since they permit duplicate element values and, as " @@ -1714,6 +2600,7 @@ msgstr "" "新创建整个集合。因此 Bag 是非常低效的。 " #. Tag: para +#: performance.xml:1316 #, no-c-format msgid "" "For a one-to-many association, the \"primary key\" may not be the physical " @@ -1726,12 +2613,14 @@ msgstr "" "如何进行“定位”的。) " #. Tag: title +#: performance.xml:1323 #, no-c-format msgid "" "Lists, maps, idbags and sets are the most efficient collections to update" msgstr "Lists,maps 和 sets 用于更新效率最高" #. Tag: para +#: performance.xml:1326 #, no-c-format msgid "" "From the discussion above, it should be clear that indexed collections and " @@ -1742,6 +2631,7 @@ msgstr "" "中拥有最好的性能。 " #. Tag: para +#: performance.xml:1330 #, no-c-format msgid "" "There is, arguably, one more advantage that indexed collections have over " @@ -1759,6 +2649,7 @@ msgstr "" "作时“改变”才有效。再次强调:这段讨论对“一对多关联”并不适用。 " #. Tag: para +#: performance.xml:1338 #, no-c-format msgid "" "After observing that arrays cannot be lazy, you can conclude that lists, " @@ -1772,6 +2663,7 @@ msgstr "" "型,这时因为“set”的语义在关系模型中是最自然的。 " #. Tag: para +#: performance.xml:1344 #, no-c-format msgid "" "However, in well-designed Hibernate domain models, most collections are in " @@ -1785,11 +2677,13 @@ msgstr "" "作将会在多对一的这一端进行处理。因此对于此类情况,无需考虑其集合的更新性能。 " #. Tag: title +#: performance.xml:1352 #, no-c-format msgid "Bags and lists are the most efficient inverse collections" msgstr "Bag 和 list 是反向集合类中效率最高的" #. Tag: para +#: performance.xml:1354 #, no-c-format msgid "" "There is a particular case, however, in which bags, and also lists, are much " @@ -1808,12 +2702,30 @@ msgstr "" "Collection.addAll() 方法对 bag 或者 List 总是返回 true(这" "点与与 Set 不同)。因此对于下面的相同代码来说,速度会快得多。 " +#. Tag: programlisting +#: performance.xml:1365 +#, fuzzy, no-c-format +msgid "" +"Parent p = (Parent) sess.load(Parent.class, id);\n" +"Child c = new Child();\n" +"c.setParent(p);\n" +"p.getChildren().add(c); //no need to fetch the collection!\n" +"sess.flush();" +msgstr "" +"" + #. Tag: title +#: performance.xml:1369 #, no-c-format msgid "One shot delete" msgstr "一次性删除(One shot delete)" #. Tag: para +#: performance.xml:1371 #, no-c-format msgid "" "Deleting collection elements one by one can sometimes be extremely " @@ -1826,6 +2738,7 @@ msgstr "" "定了。 " #. Tag: para +#: performance.xml:1377 #, no-c-format msgid "" "Suppose you added a single element to a collection of size twenty and then " @@ -1838,6 +2751,7 @@ msgstr "" "句(除非集合类是一个 bag)。这当然是令人满意的。 " #. Tag: para +#: performance.xml:1383 #, no-c-format msgid "" "However, suppose that we remove eighteen elements, leaving two and then add " @@ -1847,11 +2761,13 @@ msgstr "" "式:" #. Tag: para +#: performance.xml:1389 #, no-c-format msgid "delete eighteen rows one by one and then insert three rows" msgstr "逐一的删除这 18 个数据,再新增三个;" #. Tag: para +#: performance.xml:1394 #, no-c-format msgid "" "remove the whole collection in one SQL DELETE and insert " @@ -1859,6 +2775,7 @@ msgid "" msgstr "删除整个集合类(只用一句 DELETE 语句),然后逐一添加 5 个数据。" #. Tag: para +#: performance.xml:1400 #, no-c-format msgid "" "Hibernate cannot know that the second option is probably quicker. It would " @@ -1869,6 +2786,7 @@ msgstr "" "聪明也是好事,否则可能会引发意外的“数据库触发器”之类的问题。)" #. Tag: para +#: performance.xml:1404 #, no-c-format msgid "" "Fortunately, you can force this behavior (i.e. the second strategy) at any " @@ -1880,6 +2798,7 @@ msgstr "" "用的。 " #. Tag: para +#: performance.xml:1409 #, no-c-format msgid "" "One-shot-delete does not apply to collections mapped inverse=\"true" @@ -1889,11 +2808,13 @@ msgstr "" "合。 " #. Tag: title +#: performance.xml:1415 #, no-c-format msgid "Monitoring performance" msgstr "监测性能(Monitoring performance)" #. Tag: para +#: performance.xml:1417 #, no-c-format msgid "" "Optimization is not much use without monitoring and access to performance " @@ -1905,11 +2826,13 @@ msgstr "" "的示意图,因此可以从 每个 SessionFactory 抓取其统计数据。" #. Tag: title +#: performance.xml:1423 #, no-c-format msgid "Monitoring a SessionFactory" msgstr "监测 SessionFactory" #. Tag: para +#: performance.xml:1425 #, no-c-format msgid "" "You can access SessionFactory metrics in two ways. Your " @@ -1921,6 +2844,7 @@ msgstr "" "统计数据。" #. Tag: para +#: performance.xml:1430 #, no-c-format msgid "" "Hibernate can also use JMX to publish metrics if you enable the " @@ -1933,7 +2857,56 @@ msgstr "" "SessionFactory 同时共享一个 MBean,也可以每个 " "SessionFactory 分配一个 MBean。下面的代码即是其演示代码: " +#. Tag: programlisting +#: performance.xml:1435 +#, fuzzy, no-c-format +msgid "" +"// MBean service registration for a specific SessionFactory\n" +"Hashtable tb = new Hashtable();\n" +"tb.put(\"type\", \"statistics\");\n" +"tb.put(\"sessionFactory\", \"myFinancialApp\");\n" +"ObjectName on = new ObjectName(\"hibernate\", tb); // MBean object name\n" +"\n" +"StatisticsService stats = new StatisticsService(); // MBean implementation\n" +"stats.setSessionFactory(sessionFactory); // Bind the stats to a " +"SessionFactory\n" +"server.registerMBean(stats, on); // Register the Mbean on the server" +msgstr "" +"" + +#. Tag: programlisting +#: performance.xml:1437 +#, fuzzy, no-c-format +msgid "" +"// MBean service registration for all SessionFactory's\n" +"Hashtable tb = new Hashtable();\n" +"tb.put(\"type\", \"statistics\");\n" +"tb.put(\"sessionFactory\", \"all\");\n" +"ObjectName on = new ObjectName(\"hibernate\", tb); // MBean object name\n" +"\n" +"StatisticsService stats = new StatisticsService(); // MBean implementation\n" +"server.registerMBean(stats, on); // Register the MBean on the server" +msgstr "" +"" + #. Tag: para +#: performance.xml:1439 #, no-c-format msgid "" "You can activate and deactivate the monitoring for a " @@ -1942,6 +2915,7 @@ msgstr "" "你可以通过以下方法打开或关闭 SessionFactory 的监测功能: " #. Tag: para +#: performance.xml:1444 #, no-c-format msgid "" "at configuration time, set hibernate.generate_statistics " @@ -1951,6 +2925,7 @@ msgstr "" "truefalse;" #. Tag: para +#: performance.xml:1452 #, no-c-format msgid "" "at runtime: sf.getStatistics().setStatisticsEnabled(true) " @@ -1961,6 +2936,7 @@ msgstr "" "literal>" #. Tag: para +#: performance.xml:1458 #, no-c-format msgid "" "Statistics can be reset programmatically using the clear()logSummary() 在日志中记录(info 级别)其总结。 " #. Tag: title +#: performance.xml:1464 #, no-c-format msgid "Metrics" msgstr "数据记录(Metrics)" #. Tag: para +#: performance.xml:1466 #, no-c-format msgid "" "Hibernate provides a number of metrics, from basic information to more " @@ -1988,6 +2966,7 @@ msgstr "" "问,主要分为三类:" #. Tag: para +#: performance.xml:1473 #, no-c-format msgid "" "Metrics related to the general Session usage, such as " @@ -1997,6 +2976,7 @@ msgstr "" "得的 JDBC 的连接数等;" #. Tag: para +#: performance.xml:1479 #, no-c-format msgid "" "Metrics related to the entities, collections, queries, and caches as a whole " @@ -2004,6 +2984,7 @@ msgid "" msgstr "实体、集合、查询、缓存等内容的统一数据记录。" #. Tag: para +#: performance.xml:1484 #, no-c-format msgid "" "Detailed metrics related to a particular entity, collection, query or cache " @@ -2011,6 +2992,7 @@ msgid "" msgstr "和具体实体、集合、查询、缓存相关的详细数据记录" #. Tag: para +#: performance.xml:1489 #, no-c-format msgid "" "For example, you can check the cache hit, miss, and put ratio of entities, " @@ -2024,6 +3006,7 @@ msgstr "" "据精度和具体的 JVM 有关,在有些平台上其精度甚至只能精确到 10 秒。 " #. Tag: para +#: performance.xml:1495 #, no-c-format msgid "" "Simple getters are used to access the global metrics (i.e. not tied to a " @@ -2043,7 +3026,46 @@ msgstr "" "SecondLevelCacheStatisticsQueryStatistics 的 API 文档以抓取更多信息。下面的代码则是个简单的例子: " +#. Tag: programlisting +#: performance.xml:1506 +#, fuzzy, no-c-format +msgid "" +"Statistics stats = HibernateUtil.sessionFactory.getStatistics();\n" +"\n" +"double queryCacheHitCount = stats.getQueryCacheHitCount();\n" +"double queryCacheMissCount = stats.getQueryCacheMissCount();\n" +"double queryCacheHitRatio =\n" +" queryCacheHitCount / (queryCacheHitCount + queryCacheMissCount);\n" +"\n" +"log.info(\"Query Hit ratio:\" + queryCacheHitRatio);\n" +"\n" +"EntityStatistics entityStats =\n" +" stats.getEntityStatistics( Cat.class.getName() );\n" +"long changes =\n" +" entityStats.getInsertCount()\n" +" + entityStats.getUpdateCount()\n" +" + entityStats.getDeleteCount();\n" +"log.info(Cat.class.getName() + \" changed \" + changes + \"times\" );" +msgstr "" +"" + #. Tag: para +#: performance.xml:1508 #, no-c-format msgid "" "You can work on all entities, collections, queries and region caches, by " @@ -2057,6 +3079,39 @@ msgstr "" "getEntityNames()getCollectionRoleNames()getSecondLevelCacheRegionNames()。" +#~ msgid "or even:" +#~ msgstr "甚至:" + +#~ msgid "" +#~ "Now the following code will actually load both the customer and " +#~ "their orders:" +#~ msgstr "下面的代码将实际上加载客户以及订单:" + +#~ msgid "yes" +#~ msgstr "yes" + +#~ msgid "" +#~ "The <cache> element of a class or collection " +#~ "mapping has the following form:" +#~ msgstr "" +#~ "类或者集合映射的“<cache> 元素”可以有下列形式:" + +#~ msgid "" +#~ "The usage attribute specifies a cache " +#~ "concurrency strategy." +#~ msgstr "" +#~ "这里的 usage 属性指明了缓存并发策略(cache " +#~ "concurrency strategy)。" + +#~ msgid "read-only" +#~ msgstr "read-only" + +#~ msgid "read-write" +#~ msgstr "read-write" + +#~ msgid "transactional" +#~ msgstr "transactional" + #~ msgid "" #~ "This setting creates two new cache regions: one holding cached query " #~ "result sets (org.hibernate.cache.StandardQueryCache), " @@ -2074,242 +3129,6 @@ msgstr "" #~ "态;它只缓存这些实体的标识符属性的值、以及各值类型的结果。所以查询缓存通常" #~ "会和二级缓存一起使用。 " -#~ msgid "" -#~ "" -#~ msgstr "" -#~ "" - -#~ msgid "" -#~ "\n" -#~ " \n" -#~ " \n" -#~ "" -#~ msgstr "" -#~ "\n" -#~ " \n" -#~ " \n" -#~ "" - -#~ msgid "" -#~ "]]>" -#~ msgstr "" -#~ "]]>" - -#~ msgid "" -#~ "" -#~ msgstr "" -#~ "" - -#~ msgid "" -#~ "\n" -#~ " ......\n" -#~ " \n" -#~ " .....\n" -#~ " \n" -#~ "]]>" -#~ msgstr "" -#~ "\n" -#~ " ......\n" -#~ " \n" -#~ " .....\n" -#~ " \n" -#~ "]]>" - -#~ msgid "" -#~ "" -#~ msgstr "" -#~ "" - -#~ msgid "" -#~ "" -#~ msgstr "" -#~ "" - -#~ msgid "" -#~ "" -#~ msgstr "" -#~ "" - -#~ msgid "" -#~ "\n" -#~ " ......\n" -#~ " \n" -#~ " .....\n" -#~ " \n" -#~ "]]>" -#~ msgstr "" -#~ "\n" -#~ " ......\n" -#~ " \n" -#~ " .....\n" -#~ " \n" -#~ "]]>" - -#~ msgid "" -#~ "" -#~ msgstr "" -#~ "" - -#~ msgid "" -#~ "" -#~ msgstr "" -#~ "" - -#~ msgid "" -#~ "" -#~ msgstr "" -#~ "" - -#~ msgid "...]]>" -#~ msgstr "...]]>" - -#~ msgid "" -#~ "\n" -#~ " \n" -#~ " ...\n" -#~ " \n" -#~ "]]>" -#~ msgstr "" -#~ "\n" -#~ " \n" -#~ " ...\n" -#~ " \n" -#~ "]]>" - -#~ msgid "" -#~ "\n" -#~ " \n" -#~ " \n" -#~ " \n" -#~ " \n" -#~ " \n" -#~ " \n" -#~ "]]>" -#~ msgstr "" -#~ "\n" -#~ " \n" -#~ " \n" -#~ " \n" -#~ " \n" -#~ " \n" -#~ " \n" -#~ "]]>" - -#~ msgid "" -#~ "\n" -#~ " \n" -#~ " \n" -#~ " \n" -#~ " \n" -#~ " \n" -#~ "\n" -#~ " \n" -#~ " \n" -#~ " \n" -#~ " \n" -#~ " \n" -#~ "]]>" -#~ msgstr "" -#~ "\n" -#~ " \n" -#~ " \n" -#~ " \n" -#~ " \n" -#~ " \n" -#~ "\n" -#~ " \n" -#~ " \n" -#~ " \n" -#~ " \n" -#~ " \n" -#~ "]]>" - -#~ msgid "yes" -#~ msgstr "yes" - -#~ msgid "" -#~ "]]>" -#~ msgstr "" -#~ "]]>" - #~ msgid "" #~ "\n" #~ " \n" @@ -2339,169 +3158,3 @@ msgstr "" #~ " ....\n" #~ " \n" #~ "]]>" - -#~ msgid "" -#~ "" -#~ msgstr "" -#~ "" - -#~ msgid "" -#~ "" -#~ msgstr "" -#~ "" - -#~ msgid "" -#~ "" -#~ msgstr "" -#~ "" - -#~ msgid "" -#~ "" -#~ msgstr "" -#~ "" - -#~ msgid "" -#~ msgstr "" - -#~ msgid "" -#~ "" -#~ msgstr "" -#~ "" - -#~ msgid "" -#~ "" -#~ msgstr "" -#~ "" - -#~ msgid "" -#~ "" -#~ msgstr "" -#~ "" - -#~ msgid "" -#~ "" -#~ msgstr "" -#~ "" - -#~ msgid "" -#~ "" -#~ msgstr "" -#~ "" diff --git a/documentation/manual/src/main/docbook/zh-CN/content/persistent_classes.po b/documentation/manual/src/main/docbook/zh-CN/content/persistent_classes.po index 809cb58b93..26aad8412d 100644 --- a/documentation/manual/src/main/docbook/zh-CN/content/persistent_classes.po +++ b/documentation/manual/src/main/docbook/zh-CN/content/persistent_classes.po @@ -6,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: persistent_classes\n" "Report-Msgid-Bugs-To: http://bugs.kde.org\n" -"POT-Creation-Date: 2010-02-11T05:38:15\n" +"POT-Creation-Date: 2010-07-20 21:02+0000\n" "PO-Revision-Date: 2010-03-16 10:00+1000\n" "Last-Translator: Xi HUANG \n" "Language-Team: \n" @@ -16,647 +16,1457 @@ msgstr "" "X-Generator: KBabel 1.11.4\n" #. Tag: title +#: persistent_classes.xml:32 #, no-c-format msgid "Persistent Classes" msgstr "持久化类(Persistent Classes)" #. Tag: para -#, 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. For example, an instance can instead be transient or detached." -msgstr "在应用程序中,用来实现业务问题实体的(如,在电子商务应用程序中的 Customer 和 Order)类就是持久化类。不能认为所有的持久化类的实例都是持久的状态 - 一个实例的状态也可能是瞬时的或脱管的。" +#: persistent_classes.xml:34 +#, fuzzy, 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). The term \"persistent\" here means that the classes are able " +"to be persisted, not that they are in the persistent state (see for discussion)." +msgstr "" +"在应用程序中,用来实现业务问题实体的(如,在电子商务应用程序中的 Customer 和 " +"Order)类就是持久化类。不能认为所有的持久化类的实例都是持久的状态 - 一个实例" +"的状态也可能是瞬时的或脱管的。" #. Tag: para -#, 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 can express a domain model in other ways (using trees of Map instances, for example)." -msgstr "如果这些持久化类遵循一些简单的规则,Hibernate 能够工作得更好,这些规则也被称作简单传统 Java 对象(POJO:Plain Old Java Object)编程模型。但是这些规则并不是必需的。 实际上,Hibernate3 对于你的持久化类几乎不做任何设想。你可以用其他的方法来表达领域模型:比如,使用 Map 实例的树型结构。" +#: persistent_classes.xml:41 +#, fuzzy, 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, Hibernate assumes very little " +"about the nature of your persistent objects. You can express a domain model " +"in other ways (using trees of java.util.Map " +"instances, for example)." +msgstr "" +"如果这些持久化类遵循一些简单的规则,Hibernate 能够工作得更好,这些规则也被称" +"作简单传统 Java 对象(POJO:Plain Old Java Object)编程模型。但是这些规则并不" +"是必需的。 实际上,Hibernate3 对于你的持久化类几乎不做任何设想。你可以用其他" +"的方法来表达领域模型:比如,使用 Map 实例的树型结构。" #. Tag: title +#: persistent_classes.xml:49 #, no-c-format msgid "A simple POJO example" msgstr "一个简单的 POJO 例子" -#. Tag: para +#. Tag: title +#: persistent_classes.xml:52 #, no-c-format -msgid "Most Java applications require a persistent class representing felines. For example:" -msgstr "大多数 Java 程序需要用一个持久化类来表示猫科动物。例如:" +msgid "Simple POJO representing a cat" +msgstr "" + +#. Tag: programlisting +#: persistent_classes.xml:53 +#, fuzzy, no-c-format +msgid "" +"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:57 #, no-c-format -msgid "The four main rules of persistent classes are explored in more detail in the following sections." +msgid "" +"The four main rules of persistent classes are explored in more detail in the " +"following sections." msgstr "在后续的章节里我们将介绍持久性类的 4 个主要规则的更多细节。" #. Tag: title +#: persistent_classes.xml:62 #, no-c-format msgid "Implement a no-argument constructor" msgstr "实现一个默认的(即无参数的)构造方法(constructor)" #. Tag: para -#, no-c-format -msgid "Cat has a no-argument constructor. All persistent classes must have a default constructor (which can be non-public) so that Hibernate can instantiate them using Constructor.newInstance(). It is recommended that you have a default constructor with at least package visibility for runtime proxy generation in Hibernate." -msgstr "Cat 有一个无参数的构造方法。所有的持久化类都必须有一个默认的构造方法(可以不是 public 的),这样的话 Hibernate 就可以使用 Constructor.newInstance()来实例化它们。 我们强烈建议,在 Hibernate 中,为了运行期代理的生成,构造方法至少是包(package)内可见的。" +#: persistent_classes.xml:64 +#, fuzzy, no-c-format +msgid "" +"Cat has a no-argument constructor. All persistent " +"classes must have a default constructor (which can be non-public) so that " +"Hibernate can instantiate them using java.lang.reflect." +"Constructor.newInstance(). It is recommended that this " +"constructor be defined with at least package visibility " +"in order for runtime proxy generation to work properly." +msgstr "" +"Cat 有一个无参数的构造方法。所有的持久化类都必须有一个默认" +"的构造方法(可以不是 public 的),这样的话 Hibernate 就可以使用 " +"Constructor.newInstance()来实例化它们。 我们强烈建议,在 " +"Hibernate 中,为了运行期代理的生成,构造方法至少是包(package)内可见的。" #. Tag: title -#, no-c-format -msgid "Provide an identifier property (optional)" +#: persistent_classes.xml:74 +#, fuzzy, no-c-format +msgid "Provide an identifier property" msgstr "提供一个标识属性(identifier property)(可选)" #. Tag: para +#: persistent_classes.xml:77 #, no-c-format -msgid "Cat has a property called id. 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, java.lang.String or java.util.Date. If your legacy database table has composite keys, you can use a user-defined class with properties of these types (see the section on composite identifiers later in the chapter.)" -msgstr "Cat 有一个属性叫做 id。这个属性映射数据库表的主 键字段。这个属性可以叫任何名字,其类型可以是任何的原始类型、原始类型的包装类型、 java.lang.String 或者是 java.util.Date。(如果你的遗留数据库表有联合主键,你甚至可以用一个用户自定义的类,该类拥有这些类型的属性。参见后面的关于联合标识符的章节。)" +msgid "" +"Historically this was considered option. While still not (yet) enforced, " +"this should be considered a deprecated feature as it will be completely " +"required to provide a identifier property in an upcoming release." +msgstr "" #. 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 "标识符属性是可选的。可以不用管它,让 Hibernate 内部来追踪对象的识别。 但是我们并不推荐这样做。" +msgid "" +"Cat has a property named id. This " +"property maps to the primary key column(s) of the underlying database table. " +"The type of the identifier property can be any \"basic\" type (see ). See for information on mapping composite (multi-column) identifiers." +msgstr "" #. Tag: para +#: persistent_classes.xml:92 #, no-c-format -msgid "In fact, some functionality is available only to classes that declare an identifier property:" -msgstr "实际上,一些功能只对那些声明了标识符属性的类起作用: " +msgid "" +"Identifiers do not necessarily need to identify column(s) in the database " +"physically defined as a primary key. They should just identify columns that " +"can be used to uniquely identify rows in the underlying table." +msgstr "" #. Tag: para +#: persistent_classes.xml:99 #, no-c-format -msgid "Transitive reattachment for detached objects (cascade update or cascade merge) - see " -msgstr "托管对象的传播性再连接(级联更新或级联合并)- 参阅 " - -#. Tag: para -#, no-c-format -msgid "Session.saveOrUpdate()" -msgstr "Session.saveOrUpdate() " - -#. Tag: para -#, no-c-format -msgid "Session.merge()" -msgstr "Session.merge() " - -#. Tag: para -#, no-c-format -msgid "We recommend that you declare consistently-named identifier properties on persistent classes and that you use a nullable (i.e., non-primitive) type." -msgstr "我们建议你对持久化类声明命名一致的标识属性。我们还建议你使用一个可以为空(也就是说,不是原始类型)的类型。 " +msgid "" +"We recommend that you declare consistently-named identifier properties on " +"persistent classes and that you use a nullable (i.e., non-primitive) type." +msgstr "" +"我们建议你对持久化类声明命名一致的标识属性。我们还建议你使用一个可以为空(也" +"就是说,不是原始类型)的类型。 " #. Tag: title -#, no-c-format -msgid "Prefer non-final classes (optional)" +#: persistent_classes.xml:107 +#, fuzzy, no-c-format +msgid "Prefer non-final classes (semi-optional)" msgstr "使用非final的类(可选)" #. Tag: para +#: persistent_classes.xml:109 #, no-c-format -msgid "A central feature of Hibernate, proxies, depends upon the persistent class being either non-final, or the implementation of an interface that declares all public methods." -msgstr "代理(proxies)是 Hibernate 的一个重要的功能,它依赖的条件是,持久化类或者是非 final 的,或者是实现了一个所有方法都声明为 public 的接口。" - -#. Tag: para -#, no-c-format -msgid "You can persist final classes that do not implement an interface with Hibernate. You will not, however, be able to use proxies for lazy association fetching which will ultimately limit your options for performance tuning." -msgstr "你可以用 Hibernate 持久化一个没有实现任何接口的 final 类,但是你不能使用代理来延迟关联加载,这会限制你进行性能优化的选择。 " - -#. Tag: para -#, no-c-format -msgid "You should also avoid declaring public final methods on the non-final classes. If you want to use a class with a public final method, you must explicitly disable proxying by setting lazy=\"false\"." -msgstr "你也应该避免在非 final 类中声明 public final 的方法。如果你想使用一个有 public final 方法的类,你必须通过设置 lazy=\"false\" 来明确地禁用代理。 " +msgid "" +"A central feature of Hibernate, proxies (lazy loading), " +"depends upon the persistent class being either non-final, or the " +"implementation of an interface that declares all public methods. You can " +"persist final classes that do not implement an interface " +"with Hibernate; you will not, however, be able to use proxies for lazy " +"association fetching which will ultimately limit your options for " +"performance tuning. To persist a final class which does " +"not implement a \"full\" interface you must disable proxy generation. See " +" and ." +msgstr "" #. Tag: title +#: persistent_classes.xml:121 +#, no-c-format +msgid "Disabling proxies in hbm.xml" +msgstr "" + +#. Tag: programlisting +#: persistent_classes.xml:122 +#, no-c-format +msgid "...]]>" +msgstr "" + +#. Tag: title +#: persistent_classes.xml:126 +#, no-c-format +msgid "Disabling proxies in annotations" +msgstr "" + +#. Tag: programlisting +#: persistent_classes.xml:127 +#, no-c-format +msgid "" +msgstr "" + +#. Tag: para +#: persistent_classes.xml:130 +#, no-c-format +msgid "" +"If the final class does implement a proper interface, you " +"could alternatively tell Hibernate to use the interface instead when " +"generating the proxies. See and ." +msgstr "" + +#. Tag: title +#: persistent_classes.xml:139 +#, no-c-format +msgid "Proxying an interface in hbm.xml" +msgstr "" + +#. Tag: programlisting +#: persistent_classes.xml:140 +#, no-c-format +msgid "...]]>" +msgstr "" + +#. Tag: title +#: persistent_classes.xml:144 +#, no-c-format +msgid "Proxying an interface in annotations" +msgstr "" + +#. Tag: programlisting +#: persistent_classes.xml:145 +#, no-c-format +msgid "" +"" +msgstr "" + +#. Tag: para +#: persistent_classes.xml:148 +#, fuzzy, no-c-format +msgid "" +"You should also avoid declaring public final methods as " +"this will again limit the ability to generate proxies " +"from this class. If you want to use a class with public final methods, you must explicitly disable proxying. Again, see and " +"." +msgstr "" +"你也应该避免在非 final 类中声明 public final 的方法。如果" +"你想使用一个有 public final 方法的类,你必须通过设置 " +"lazy=\"false\" 来明确地禁用代理。 " + +#. Tag: title +#: persistent_classes.xml:158 #, no-c-format msgid "Declare accessors and mutators for persistent fields (optional)" -msgstr "为持久化字段声明访问器(accessors)和是否可变的标志(mutators)(可选)" +msgstr "" +"为持久化字段声明访问器(accessors)和是否可变的标志(mutators)(可选)" #. Tag: para -#, no-c-format -msgid "Cat declares accessor methods for all its persistent fields. Many other ORM tools directly persist instance variables. 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 getFoo, isFoo and setFoo. If required, you can switch to direct field access for particular properties." -msgstr "Cat 为它的所有持久化字段声明了访问方法。很多其他 ORM 工具直接对实例变量进行持久化。我们相信,在关系数据库 schema 和类的内部数据结构之间引入间接层(原文为\"非直接\",indirection)会好一些。默认情况下 Hibernate 持久化 JavaBeans 风格的属性,认可 getFooisFoosetFoo 这种形式的方法名。如果需要,你可以对某些特定属性实行直接字段访问。 " +#: persistent_classes.xml:160 +#, fuzzy, no-c-format +msgid "" +"Cat declares accessor methods for all its persistent " +"fields. Many other ORM tools directly persist instance variables. 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 getFoo, isFoo and setFoo. If " +"required, you can switch to direct field access for particular properties." +msgstr "" +"Cat 为它的所有持久化字段声明了访问方法。很多其他 ORM 工具" +"直接对实例变量进行持久化。我们相信,在关系数据库 schema 和类的内部数据结构之" +"间引入间接层(原文为\"非直接\",indirection)会好一些。默认情况下 Hibernate " +"持久化 JavaBeans 风格的属性,认可 getFoo," +"isFoosetFoo 这种形式的方法名。如果" +"需要,你可以对某些特定属性实行直接字段访问。 " #. Tag: para -#, no-c-format -msgid "Properties need not be declared public - Hibernate can persist a property with a default, protected or private get / set pair." -msgstr "属性不需要要声明为 public 的。Hibernate 可以持久化一个有 defaultprotectedprivate 的 get/set 方法对的属性进行持久化。" +#: persistent_classes.xml:169 +#, fuzzy, no-c-format +msgid "" +"Properties need not be declared public. Hibernate can " +"persist a property declared with package, " +"protected or private visibility as " +"well." +msgstr "" +"属性不需要要声明为 public 的。Hibernate 可以持久化一个" +"有 defaultprotected 或 " +"private 的 get/set 方法对的属性进行持久化。" #. Tag: title +#: persistent_classes.xml:178 #, no-c-format msgid "Implementing inheritance" msgstr "实现继承(Inheritance)" #. Tag: para +#: persistent_classes.xml:180 #, no-c-format -msgid "A subclass must also observe the first and second rules. It inherits its identifier property from the superclass, Cat. For example:" -msgstr "子类也必须遵守第一条和第二条规则。它从超类 Cat 继承了标识属性。例如:" +msgid "" +"A subclass must also observe the first and second rules. It inherits its " +"identifier property from the superclass, Cat. For example:" +msgstr "" +"子类也必须遵守第一条和第二条规则。它从超类 Cat 继承了标识" +"属性。例如:" + +#. Tag: programlisting +#: persistent_classes.xml:184 +#, fuzzy, no-c-format +msgid "" +"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:188 #, no-c-format -msgid "Implementing equals() and hashCode()" -msgstr "实现 equals()hashCode() 方法:" +msgid "" +"Implementing equals() and hashCode()" +msgstr "" +"实现 equals()hashCode() 方法:" #. Tag: para +#: persistent_classes.xml:191 #, no-c-format -msgid "You have to override the equals() and hashCode() methods if you:" -msgstr "如果你有如下需求,你必须重载 equals()hashCode() 方法: " +msgid "" +"You have to override the equals() and hashCode()" +" methods if you:" +msgstr "" +"如果你有如下需求,你必须重载 equals()hashCode" +"() 方法: " #. Tag: para +#: persistent_classes.xml:196 #, no-c-format -msgid "intend to put instances of persistent classes in a Set (the recommended way to represent many-valued associations); and" -msgstr "想把持久类的实例放入 Set 中(当表示多值关联时,推荐这么做),而且" +msgid "" +"intend to put instances of persistent classes in a Set " +"(the recommended way to represent many-valued associations); and" +msgstr "" +"想把持久类的实例放入 Set 中(当表示多值关联时,推荐这么" +"做),而且" #. Tag: para +#: persistent_classes.xml:202 #, no-c-format msgid "intend to use reattachment of detached instances" msgstr "想重用脱管实例" #. Tag: para +#: persistent_classes.xml:206 #, no-c-format -msgid "Hibernate guarantees equivalence of persistent identity (database row) and Java identity only inside a particular session scope. When you mix instances retrieved in different sessions, you must implement equals() and hashCode() if you wish to have meaningful semantics for Sets." -msgstr "Hibernate 保证,仅在特定会话范围内,持久化标识(数据库的行)和 Java 标识是等价的。因此,一旦我们混合了从不同会话中获取的实例,如果希望 Set 有明确的语义,就必须实现 equals()hashCode()。 " +msgid "" +"Hibernate guarantees equivalence of persistent identity (database row) and " +"Java identity only inside a particular session scope. When you mix instances " +"retrieved in different sessions, you must implement equals() and hashCode() if you wish to have meaningful " +"semantics for Sets." +msgstr "" +"Hibernate 保证,仅在特定会话范围内,持久化标识(数据库的行)和 Java 标识是等" +"价的。因此,一旦我们混合了从不同会话中获取的实例,如果希望 Set 有明确的语义,就必须实现 equals() 和 " +"hashCode()。 " #. Tag: para +#: persistent_classes.xml:212 #, no-c-format -msgid "The most obvious way is to implement equals()/hashCode() by comparing the identifier value of both objects. If the value is the same, both must be the same database row, because they are equal. If both are added to a Set, you will only have one element in the Set). Unfortunately, you cannot 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 Set, saving it will assign an identifier value to the object. If equals() and hashCode() are based on the identifier value, the hash code would change, breaking the contract of the Set. See the Hibernate website for a full discussion of this problem. This is not a Hibernate issue, but normal Java semantics of object identity and equality." -msgstr "实现 equals()/hashCode() 最显而易见的方法是比较两个对象 标识符的值。如果值相同,则两个对象对应于数据库的同一行,因此它们是相等的(如果都被添加到 Set,则在 Set 中只有一个元素)。不幸的是,对生成的标识不能 使用这种方法。Hibernate 仅对那些持久化对象赋标识值,一个新创建的实例将不会有任何标识值。此外, 如果一个实例没有被保存(unsaved),并且它当前正在一个 Set 中,保存它将会给这个对象赋一个标识值。如果 equals()hashCode() 是基于标识值 实现的,则其哈希码将会改变,这违反了 Set 的契约。建议去 Hibernate 的站点阅读关于这个问题的全部讨论。注意,这不是 Hibernate 的问题,而是一般的 Java 对象标识和 Java 对象等价的语义问题。 " +msgid "" +"The most obvious way is to implement equals()/" +"hashCode() by comparing the identifier value of both " +"objects. If the value is the same, both must be the same database row, " +"because they are equal. If both are added to a Set, you " +"will only have one element in the Set). Unfortunately, " +"you cannot 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 Set, saving it will assign an " +"identifier value to the object. If equals() and " +"hashCode() are based on the identifier value, the hash " +"code would change, breaking the contract of the Set. See " +"the Hibernate website for a full discussion of this problem. This is not a " +"Hibernate issue, but normal Java semantics of object identity and equality." +msgstr "" +"实现 equals()/hashCode() 最显而易见的方" +"法是比较两个对象 标识符的值。如果值相同,则两个对象对应于数据库的同一行,因此" +"它们是相等的(如果都被添加到 Set,则在 Set 中只有一个元素)。不幸的是,对生成的标识不能 使用这种方法。" +"Hibernate 仅对那些持久化对象赋标识值,一个新创建的实例将不会有任何标识值。此" +"外, 如果一个实例没有被保存(unsaved),并且它当前正在一个 Set 中,保存它将会给这个对象赋一个标识值。如果 equals()hashCode() 是基于标识值 实现的,则其哈希码将会" +"改变,这违反了 Set 的契约。建议去 Hibernate 的站点阅读关于" +"这个问题的全部讨论。注意,这不是 Hibernate 的问题,而是一般的 Java 对象标识" +"和 Java 对象等价的语义问题。 " #. Tag: para +#: persistent_classes.xml:228 #, no-c-format -msgid "It is recommended that you implement equals() and hashCode() using Business key equality. Business key equality means that the equals() method compares only the properties that form the business key. It is a key that would identify our instance in the real world (a natural candidate key):" -msgstr "我们建议使用业务键值相等(Business key equality)来实现 equals()hashCode()。业务键值相等的意思是,equals() 方法仅仅比较形成业务键的属性,它能在现实世界里标识我们的实例(是一个自然的候选码)。" +msgid "" +"It is recommended that you implement equals() and " +"hashCode() using Business key equality. Business key equality means that the equals() " +"method compares only the properties that form the business key. It is a key " +"that would identify our instance in the real world (a natural candidate key):" +msgstr "" +"我们建议使用业务键值相等(Business key equality)来实现 " +"equals()hashCode()。业务键值相等的" +"意思是,equals() 方法仅仅比较形成业务键的属性,它能在现实" +"世界里标识我们的实例(是一个自然的候选码)。" + +#. Tag: programlisting +#: persistent_classes.xml:235 +#, fuzzy, no-c-format +msgid "" +"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 -#, no-c-format -msgid "A business key does not have to be as solid as a database primary key candidate (see ). Immutable or unique properties are usually good candidates for a business key." -msgstr "注意,业务键不必像数据库的主键那样固定不变(参见 )。对业务键而言,不可变或唯一的属性是不错的选择。" +#: persistent_classes.xml:237 +#, fuzzy, no-c-format +msgid "" +"A business key does not have to be as solid as a database primary key " +"candidate (see ). Immutable " +"or unique properties are usually good candidates for a business key." +msgstr "" +"注意,业务键不必像数据库的主键那样固定不变(参见 )。对业务键而言,不可变或唯一的属性是不错" +"的选择。" #. Tag: title +#: persistent_classes.xml:244 #, no-c-format msgid "Dynamic models" msgstr "动态模型(Dynamic models)" #. Tag: title +#: persistent_classes.xml:247 #, no-c-format msgid "Note" msgstr "注意" -#. Tag: para -#, no-c-format -msgid "The following features are currently considered experimental and may change in the near future." -msgstr "注意,以下特性在当前处于试验阶段,将来可能会有变化。 " +#. Tag: emphasis +#: persistent_classes.xml:249 +#, fuzzy, no-c-format +msgid "" +"The following features are currently considered experimental and may change " +"in the near future." +msgstr "" +"注意,以下特性在当前处于试验阶段,将来可能会有变化。 " #. Tag: para +#: persistent_classes.xml:253 #, no-c-format -msgid "Persistent entities do not necessarily have to be represented as POJO classes or as JavaBean objects at runtime. Hibernate also supports dynamic models (using Maps of Maps at runtime) and the representation of entities as DOM4J trees. With this approach, you do not write persistent classes, only mapping files." -msgstr "运行期的持久化实体没有必要一定表示为像 POJO 类或 JavaBean 对象那样的形式。Hibernate 也支持动态模型 (在运行期使用 MapMap)和象 DOM4J 的树模型那样的实体表示。使用这种方法,你不用写持久化类,只写映射文件就行了。 " +msgid "" +"Persistent entities do not necessarily have to be represented as POJO " +"classes or as JavaBean objects at runtime. Hibernate also supports dynamic " +"models (using Maps of Maps at runtime) " +"and the representation of entities as DOM4J trees. With this approach, you " +"do not write persistent classes, only mapping files." +msgstr "" +"运行期的持久化实体没有必要一定表示为像 POJO 类或 JavaBean 对象那样的形式。" +"Hibernate 也支持动态模型 (在运行期使用 Map 的 " +"Map)和象 DOM4J 的树模型那样的实体表示。使用这种方法,你不" +"用写持久化类,只写映射文件就行了。 " #. Tag: para -#, no-c-format -msgid "By default, Hibernate works in normal POJO mode. You can set a default entity representation mode for a particular SessionFactory using the default_entity_mode configuration option (see )." -msgstr "Hibernate 默认工作在普通 POJO 模式。你可以使用配置选项 default_entity_mode, 对特定的 SessionFactory,设置一个默认的实体表示模式。(参见 )。" +#: persistent_classes.xml:259 +#, fuzzy, no-c-format +msgid "" +"By default, Hibernate works in normal POJO mode. You can set a default " +"entity representation mode for a particular SessionFactory using the default_entity_mode configuration " +"option (see )." +msgstr "" +"Hibernate 默认工作在普通 POJO 模式。你可以使用配置选项 " +"default_entity_mode, 对特定的 SessionFactory,设置一个默认的实体表示模式。(参见 )。" #. Tag: para +#: persistent_classes.xml:265 #, no-c-format -msgid "The following examples demonstrate the representation using Maps. First, in the mapping file an entity-name has to be declared instead of, or in addition to, a class name:" -msgstr "下面是用 Map 来表示的例子。首先,在映射文件中,要声明 entity-name 来代替一个类名(或作为一种附属)。 " +msgid "" +"The following examples demonstrate the representation using Maps. First, in the mapping file an entity-name has " +"to be declared instead of, or in addition to, a class name:" +msgstr "" +"下面是用 Map 来表示的例子。首先,在映射文件中,要声明 " +"entity-name 来代替一个类名(或作为一种附属)。 " + +#. Tag: programlisting +#: persistent_classes.xml:270 +#, fuzzy, no-c-format +msgid "" +"<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 "" +"\n" +"\n" +" \n" +"\n" +" \n" +" \n" +" \n" +"\n" +" \n" +"\n" +" \n" +"\n" +" \n" +"\n" +" \n" +" \n" +" \n" +" \n" +"\n" +" \n" +" \n" +"]]>" #. Tag: para +#: persistent_classes.xml:272 #, no-c-format -msgid "Even though associations are declared using target class names, the target type of associations can also be a dynamic entity instead of a POJO." -msgstr "注意,虽然是用目标类名来声明关联的,但是关联的目标类型除了是 POJO 之外,也可以是一个动态的实体。 " +msgid "" +"Even though associations are declared using target class names, the target " +"type of associations can also be a dynamic entity instead of a POJO." +msgstr "" +"注意,虽然是用目标类名来声明关联的,但是关联的目标类型除了是 POJO 之外,也可" +"以是一个动态的实体。 " #. Tag: para +#: persistent_classes.xml:276 #, no-c-format -msgid "After setting the default entity mode to dynamic-map for the SessionFactory, you can, at runtime, work with Maps of Maps:" -msgstr "在使用 dynamic-mapSessionFactory 设置了默认的实体模式之后,可以在运行期使用 MapMap:" +msgid "" +"After setting the default entity mode to dynamic-map for " +"the SessionFactory, you can, at runtime, work with " +"Maps of Maps:" +msgstr "" +"在使用 dynamic-mapSessionFactory 设" +"置了默认的实体模式之后,可以在运行期使用 Map 的 " +"Map:" + +#. Tag: programlisting +#: persistent_classes.xml:281 +#, fuzzy, no-c-format +msgid "" +"Session s = openSession();\n" +"Transaction tx = s.beginTransaction();\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:283 #, no-c-format -msgid "One of the main advantages of dynamic mapping is quick turnaround time for prototyping, without the need for entity class implementation. However, you lose compile-time type checking and will likely deal with many exceptions at runtime. As a result of 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 "动态映射的好处是,变化所需要的时间少了,因为原型不需要实现实体类。然而,你无法进行编译期的类型检查,并可能由此会处理很多的运行期异常。幸亏有了 Hibernate 映射,它使得数据库的 schema 能容易的规格化和合理化,并允许稍后在此之上添加合适的领域模型实现。 " +msgid "" +"One of the main advantages of dynamic mapping is quick turnaround time for " +"prototyping, without the need for entity class implementation. However, you " +"lose compile-time type checking and will likely deal with many exceptions at " +"runtime. As a result of 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 "" +"动态映射的好处是,变化所需要的时间少了,因为原型不需要实现实体类。然而,你无" +"法进行编译期的类型检查,并可能由此会处理很多的运行期异常。幸亏有了 Hibernate " +"映射,它使得数据库的 schema 能容易的规格化和合理化,并允许稍后在此之上添加合" +"适的领域模型实现。 " #. Tag: para +#: persistent_classes.xml:290 #, no-c-format -msgid "Entity representation modes can also be set on a per Session basis:" +msgid "" +"Entity representation modes can also be set on a per Session basis:" msgstr "实体表示模式也能在每个 Session 的基础上设置:" -#. Tag: para -#, no-c-format -msgid "Please note that the call to getSession() using an EntityMode is on the Session API, not the SessionFactory. That way, the new Session shares the underlying JDBC connection, transaction, and other context information. This means you do not have to call flush() and close() on the secondary Session, and also leave the transaction and connection handling to the primary unit of work." -msgstr "请注意,用 EntityMode 调用 getSession() 是在 Session 的 API 中,而不是 SessionFactory。 这样,新的 Session 共享底层的 JDBC 连接,事务,和其他的上下文信息。这意味着,你不需要在第二个 Session 中调用 flush()close(),同样的,把事务和连接的处理交给原来的工作单元。 " +#. Tag: programlisting +#: persistent_classes.xml:293 +#, fuzzy, no-c-format +msgid "" +"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" +msgstr "" +"" #. Tag: para +#: persistent_classes.xml:295 #, no-c-format -msgid "More information about the XML representation capabilities can be found in ." +msgid "" +"Please note that the call to getSession() using an " +"EntityMode is on the Session API, not " +"the SessionFactory. That way, the new Session shares the underlying JDBC connection, transaction, and other " +"context information. This means you do not have to call flush() and close() on the secondary Session, and also leave the transaction and connection handling to the " +"primary unit of work." +msgstr "" +"请注意,用 EntityMode 调用 getSession() 是在 Session 的 API 中,而不是 " +"SessionFactory。 这样,新的 Session 共" +"享底层的 JDBC 连接,事务,和其他的上下文信息。这意味着,你不需要在第二个 " +"Session 中调用 flush() 和 " +"close(),同样的,把事务和连接的处理交给原来的工作单元。 " + +#. Tag: para +#: persistent_classes.xml:304 +#, fuzzy, no-c-format +msgid "" +"More information about the XML representation capabilities can be found in " +"." msgstr "关于 XML 表示能力的更多信息可以在 中找到。" #. Tag: title +#: persistent_classes.xml:310 #, no-c-format msgid "Tuplizers" msgstr "元组片断映射(Tuplizers)" #. Tag: para -#, no-c-format -msgid "org.hibernate.tuple.Tuplizer, and its sub-interfaces, are responsible for managing a particular representation of a piece of data given that representation's org.hibernate.EntityMode. If a given piece of data is thought of as a data structure, then a tuplizer is the thing that 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 corresponding tuplizer knows how create the POJO through its constructor. It also knows how to access the POJO properties using the defined property accessors." -msgstr "org.hibernate.tuple.Tuplizer,以及其子接口,负责根据给定的org.hibernate.EntityMode,来复现片断数据。如果给定的片断数据被认为其是一种数据结构,\"tuplizer\" 就是一个知道如何创建这样的数据结构,以及如何给这个数据结构赋值的东西。比如说,对于 POJO 这种 Entity Mode,对应的 tuplizer 知道通过其构造方法来创建一个 POJO,再通过其属性访问器来访问 POJO 属性。有两大类高层 Tuplizer,分别是org.hibernate.tuple.entity.EntityTuplizerorg.hibernate.tuple.entity.ComponentTuplizer 接口。EntityTuplizer 负责管理上面提到的实体的契约,而 ComponentTuplizer 则是针对组件的。 " +#: persistent_classes.xml:312 +#, fuzzy, no-c-format +msgid "" +"org.hibernate.tuple.Tuplizer and its sub-" +"interfaces are responsible for managing a particular representation of a " +"piece of data given that representation's org.hibernate." +"EntityMode. If a given piece of data is thought of as a data " +"structure, then a tuplizer is the thing that knows how to create such a data " +"structure, how to extract values from such a data structure and how to " +"inject values into such a data structure. For example, for the POJO entity " +"mode, the corresponding tuplizer knows how create the POJO through its " +"constructor. It also knows how to access the POJO properties using the " +"defined property accessors." +msgstr "" +"org.hibernate.tuple.Tuplizer,以及其子接口,负责根据给定的" +"org.hibernate.EntityMode,来复现片断数据。如果给定的片断数" +"据被认为其是一种数据结构,\"tuplizer\" 就是一个知道如何创建这样的数据结构,以" +"及如何给这个数据结构赋值的东西。比如说,对于 POJO 这种 Entity Mode,对应的 " +"tuplizer 知道通过其构造方法来创建一个 POJO,再通过其属性访问器来访问 POJO 属" +"性。有两大类高层 Tuplizer,分别是org.hibernate.tuple.entity." +"EntityTuplizerorg.hibernate.tuple.entity." +"ComponentTuplizer 接口。EntityTuplizer 负责管理" +"上面提到的实体的契约,而 ComponentTuplizer 则是针对组件" +"的。 " #. Tag: para +#: persistent_classes.xml:322 #, no-c-format -msgid "There are two high-level types of Tuplizers, represented by the org.hibernate.tuple.entity.EntityTuplizer and org.hibernate.tuple.component.ComponentTuplizer interfaces. EntityTuplizers are responsible for managing the above mentioned contracts in regards to entities, while ComponentTuplizers do the same for components." -msgstr "有两种高层类型的 Tuplizer,分别由 org.hibernate.tuple.entity.EntityTuplizerorg.hibernate.tuple.component.ComponentTuplizer 接口代表。EntityTuplizer 负责管理和实体相关的上述合约,而ComponentTuplizer 则负责组件。" +msgid "There are two (high-level) types of Tuplizers:" +msgstr "" #. Tag: para +#: persistent_classes.xml:326 #, no-c-format -msgid "Users can also plug in their own tuplizers. Perhaps you require that a java.util.Map implementation other than java.util.HashMap 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. Tuplizer definitions are attached to the entity or component mapping they are meant to manage. Going back to the example of our customer entity:" -msgstr "用户也可以插入其自定义的 tuplizer。或许您需要一种不同于 dynamic-map entity-mode 中使用的 java.util.HashMapjava.util.Map 实现;或许您需要与默认策略不同的代理生成策略(proxy generation strategy)。通过自定义 tuplizer 实现,这两个目标您都可以达到。Tuplizer 定义被附加到它们期望管理的 entity 或者 component 映射中。回到我们的 customer entity 例子: " +msgid "" +"org.hibernate.tuple.entity.EntityTuplizer " +"which is responsible for managing the above mentioned contracts in regards " +"to entities" +msgstr "" + +#. Tag: para +#: persistent_classes.xml:332 +#, no-c-format +msgid "" +"org.hibernate.tuple.component.ComponentTuplizer which does the same for components" +msgstr "" + +#. Tag: para +#: persistent_classes.xml:340 +#, fuzzy, no-c-format +msgid "" +"Users can also plug in their own tuplizers. Perhaps you require that " +"java.util.Map implementation other than " +"java.util.HashMap 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. Tuplizer definitions are attached to the " +"entity or component mapping they are meant to manage. Going back to the " +"example of our Customer entity, shows how to specify a custom " +"org.hibernate.tuple.entity.EntityTuplizer " +"using annotations while shows how to do the same in hbm.xml" +msgstr "" +"用户也可以插入其自定义的 tuplizer。或许您需要一种不同于 dynamic-map entity-" +"mode 中使用的 java.util.HashMapjava.util." +"Map 实现;或许您需要与默认策略不同的代理生成策略(proxy generation " +"strategy)。通过自定义 tuplizer 实现,这两个目标您都可以达到。Tuplizer 定义被" +"附加到它们期望管理的 entity 或者 component 映射中。回到我们的 customer " +"entity 例子: " #. Tag: title +#: persistent_classes.xml:353 +#, no-c-format +msgid "Specify custom tuplizers in annotations" +msgstr "" + +#. Tag: programlisting +#: persistent_classes.xml:354 +#, no-c-format +msgid "" +"@Entity\n" +"@Tuplizer(impl = DynamicEntityTuplizer.class)\n" +"public interface Cuisine {\n" +" @Id\n" +" @GeneratedValue\n" +" public Long getId();\n" +" public void setId(Long id);\n" +"\n" +" public String getName();\n" +" public void setName(String name);\n" +"\n" +" @Tuplizer(impl = DynamicComponentTuplizer.class)\n" +" public Country getCountry();\n" +" public void setCountry(Country country);\n" +"}" +msgstr "" + +#. Tag: title +#: persistent_classes.xml:357 +#, no-c-format +msgid "Specify custom tuplizers in hbm.xml" +msgstr "" + +#. Tag: programlisting +#: persistent_classes.xml:358 +#, no-c-format +msgid "" +"<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>" +msgstr "" + +#. Tag: title +#: persistent_classes.xml:363 #, no-c-format msgid "EntityNameResolvers" msgstr "EntityNameResolvers" #. Tag: para -#, no-c-format -msgid "The org.hibernate.EntityNameResolver interface is a contract for resolving the entity name of a given entity instance. The interface defines a single method resolveEntityName which is passed the entity instance and is expected to return the appropriate entity name (null is allowed and would indicate that the resolver does not know how to resolve the entity name of the given entity instance). Generally speaking, an org.hibernate.EntityNameResolver is going to be most useful in the case of dynamic models. One example might be using proxied interfaces as your domain model. The hibernate test suite has an example of this exact style of usage under the org.hibernate.test.dynamicentity.tuplizer2. Here is some of the code from that package for illustration." -msgstr "org.hibernate.EntityNameResolver 接口是一个解析给定实体实例的实体名称的合约。这个接口定义了一个单一的方法 resolveEntityName,它传递实体实例并预期返回合适的实体名称(null 指明解析器不知道如何解析给定实体实例的实体名称)。一般说来,org.hibernate.EntityNameResolver 在动态模型里最为有用。其中的例子是把代理接口用作你的域模型。Hibernate Test Suite 在 org.hibernate.test.dynamicentity.tuplizer2 下有具有完全相同风格的例子。下面是该包里的一些代码:" +#: persistent_classes.xml:365 +#, fuzzy, no-c-format +msgid "" +"org.hibernate.EntityNameResolver is a " +"contract for resolving the entity name of a given entity instance. The " +"interface defines a single method resolveEntityName " +"which is passed the entity instance and is expected to return the " +"appropriate entity name (null is allowed and would indicate that the " +"resolver does not know how to resolve the entity name of the given entity " +"instance). Generally speaking, an org.hibernate." +"EntityNameResolver is going to be most useful in the case of " +"dynamic models. One example might be using proxied interfaces as your domain " +"model. The hibernate test suite has an example of this exact style of usage " +"under the org.hibernate.test.dynamicentity.tuplizer2. " +"Here is some of the code from that package for illustration." +msgstr "" +"org.hibernate.EntityNameResolver 接口是一个解" +"析给定实体实例的实体名称的合约。这个接口定义了一个单一的方法 " +"resolveEntityName,它传递实体实例并预期返回合适的实" +"体名称(null 指明解析器不知道如何解析给定实体实例的实体名称)。一般说来," +"org.hibernate.EntityNameResolver 在动态模型里" +"最为有用。其中的例子是把代理接口用作你的域模型。Hibernate Test Suite 在 " +"org.hibernate.test.dynamicentity.tuplizer2 下有具有完全相" +"同风格的例子。下面是该包里的一些代码:" + +#. Tag: programlisting +#: persistent_classes.xml:377 +#, fuzzy, no-c-format +msgid "" +"/**\n" +" * A very trivial JDK Proxy InvocationHandler implementation where we proxy " +"an\n" +" * interface as the domain model and simply store persistent state in an " +"internal\n" +" * Map. This is an extremely trivial example meant only for illustration.\n" +" */\n" +"public final class DataProxyHandler implements InvocationHandler {\n" +" private String entityName;\n" +" private HashMap data = new HashMap();\n" +"\n" +" public DataProxyHandler(String entityName, Serializable id) {\n" +" this.entityName = entityName;\n" +" data.put( \"Id\", id );\n" +" }\n" +"\n" +" public Object invoke(Object proxy, Method method, Object[] args) " +"throws Throwable {\n" +" String methodName = method.getName();\n" +" if ( methodName.startsWith( \"set\" ) ) {\n" +" String propertyName = methodName.substring( 3 );\n" +" data.put( propertyName, args[0] );\n" +" }\n" +" else if ( methodName.startsWith( \"get\" ) ) {\n" +" String propertyName = methodName.substring( 3 );\n" +" return data.get( propertyName );\n" +" }\n" +" else if ( \"toString\".equals( methodName ) ) {\n" +" return entityName + \"#\" + data.get( \"Id\" );\n" +" }\n" +" else if ( \"hashCode\".equals( methodName ) ) {\n" +" return new Integer( this.hashCode() );\n" +" }\n" +" return null;\n" +" }\n" +"\n" +" public String getEntityName() {\n" +" return entityName;\n" +" }\n" +"\n" +" public HashMap getData() {\n" +" return data;\n" +" }\n" +"}\n" +"\n" +"public class ProxyHelper {\n" +" public static String extractEntityName(Object object) {\n" +" // Our custom java.lang.reflect.Proxy instances actually bundle\n" +" // their appropriate entity name, so we simply extract it from " +"there\n" +" // if this represents one of our proxies; otherwise, we return null\n" +" if ( Proxy.isProxyClass( object.getClass() ) ) {\n" +" InvocationHandler handler = Proxy.getInvocationHandler" +"( object );\n" +" if ( DataProxyHandler.class.isAssignableFrom( handler.getClass" +"() ) ) {\n" +" DataProxyHandler myHandler = ( DataProxyHandler ) handler;\n" +" return myHandler.getEntityName();\n" +" }\n" +" }\n" +" return null;\n" +" }\n" +"\n" +" // various other utility methods ....\n" +"\n" +"}\n" +"\n" +"/**\n" +" * The EntityNameResolver implementation.\n" +" *\n" +" * IMPL NOTE : An EntityNameResolver really defines a strategy for how " +"entity names\n" +" * should be resolved. Since this particular impl can handle resolution for " +"all of our\n" +" * entities we want to take advantage of the fact that SessionFactoryImpl " +"keeps these\n" +" * in a Set so that we only ever have one instance registered. Why? Well, " +"when it\n" +" * comes time to resolve an entity name, Hibernate must iterate over all the " +"registered\n" +" * resolvers. So keeping that number down helps that process be as speedy " +"as possible.\n" +" * Hence the equals and hashCode implementations as is\n" +" */\n" +"public class MyEntityNameResolver implements EntityNameResolver {\n" +" public static final MyEntityNameResolver INSTANCE = new " +"MyEntityNameResolver();\n" +"\n" +" public String resolveEntityName(Object entity) {\n" +" return ProxyHelper.extractEntityName( entity );\n" +" }\n" +"\n" +" public boolean equals(Object obj) {\n" +" return getClass().equals( obj.getClass() );\n" +" }\n" +"\n" +" public int hashCode() {\n" +" return getClass().hashCode();\n" +" }\n" +"}\n" +"\n" +"public class MyEntityTuplizer extends PojoEntityTuplizer {\n" +" public MyEntityTuplizer(EntityMetamodel entityMetamodel, " +"PersistentClass mappedEntity) {\n" +" super( entityMetamodel, mappedEntity );\n" +" }\n" +"\n" +" public EntityNameResolver[] getEntityNameResolvers() {\n" +" return new EntityNameResolver[] { MyEntityNameResolver." +"INSTANCE };\n" +" }\n" +"\n" +" public String determineConcreteSubclassEntityName(Object entityInstance, " +"SessionFactoryImplementor factory) {\n" +" String entityName = ProxyHelper.extractEntityName" +"( entityInstance );\n" +" if ( entityName == null ) {\n" +" entityName = super.determineConcreteSubclassEntityName" +"( entityInstance, factory );\n" +" }\n" +" return entityName;\n" +" }\n" +"\n" +" ..." +msgstr "" +"/**\n" +" * A very trivial JDK Proxy InvocationHandler implementation where we proxy " +"an interface as\n" +" * the domain model and simply store persistent state in an internal Map. " +"This is an extremely\n" +" * trivial example meant only for illustration.\n" +" */\n" +"public final class DataProxyHandler implements InvocationHandler {\n" +" private String entityName;\n" +" private HashMap data = new HashMap();\n" +"\n" +" public DataProxyHandler(String entityName, Serializable id) {\n" +" this.entityName = entityName;\n" +" data.put( \"Id\", id );\n" +" }\n" +"\n" +" public Object invoke(Object proxy, Method method, Object[] args) " +"throws Throwable {\n" +" String methodName = method.getName();\n" +" if ( methodName.startsWith( \"set\" ) ) {\n" +" String propertyName = methodName.substring( 3 );\n" +" data.put( propertyName, args[0] );\n" +" }\n" +" else if ( methodName.startsWith( \"get\" ) ) {\n" +" String propertyName = methodName.substring( 3 );\n" +" return data.get( propertyName );\n" +" }\n" +" else if ( \"toString\".equals( methodName ) ) {\n" +" return entityName + \"#\" + data.get( \"Id\" );\n" +" }\n" +" else if ( \"hashCode\".equals( methodName ) ) {\n" +" return new Integer( this.hashCode() );\n" +" }\n" +" return null;\n" +" }\n" +"\n" +" public String getEntityName() {\n" +" return entityName;\n" +" }\n" +"\n" +" public HashMap getData() {\n" +" return data;\n" +" }\n" +"}\n" +"\n" +"/**\n" +" *\n" +" */\n" +"public class ProxyHelper {\n" +" public static String extractEntityName(Object object) {\n" +" // Our custom java.lang.reflect.Proxy instances actually bundle\n" +" // their appropriate entity name, so we simply extract it from " +"there\n" +" // if this represents one of our proxies; otherwise, we return null\n" +" if ( Proxy.isProxyClass( object.getClass() ) ) {\n" +" InvocationHandler handler = Proxy.getInvocationHandler" +"( object );\n" +" if ( DataProxyHandler.class.isAssignableFrom( handler.getClass" +"() ) ) {\n" +" DataProxyHandler myHandler = ( DataProxyHandler ) handler;\n" +" return myHandler.getEntityName();\n" +" }\n" +" }\n" +" return null;\n" +" }\n" +"\n" +" // various other utility methods ....\n" +"\n" +"}\n" +"\n" +"/**\n" +" * The EntityNameResolver implementation.\n" +" * IMPL NOTE : An EntityNameResolver really defines a strategy for how " +"entity names should be\n" +" * resolved. Since this particular impl can handle resolution for all of " +"our entities we want to\n" +" * take advantage of the fact that SessionFactoryImpl keeps these in a Set " +"so that we only ever\n" +" * have one instance registered. Why? Well, when it comes time to resolve " +"an entity name,\n" +" * Hibernate must iterate over all the registered resolvers. So keeping " +"that number down\n" +" * helps that process be as speedy as possible. Hence the equals and " +"hashCode impls\n" +" */\n" +"public class MyEntityNameResolver implements EntityNameResolver {\n" +" public static final MyEntityNameResolver INSTANCE = new " +"MyEntityNameResolver();\n" +"\n" +" public String resolveEntityName(Object entity) {\n" +" return ProxyHelper.extractEntityName( entity );\n" +" }\n" +"\n" +" public boolean equals(Object obj) {\n" +" return getClass().equals( obj.getClass() );\n" +" }\n" +"\n" +" public int hashCode() {\n" +" return getClass().hashCode();\n" +" }\n" +"}\n" +"\n" +"public class MyEntityTuplizer extends PojoEntityTuplizer {\n" +" public MyEntityTuplizer(EntityMetamodel entityMetamodel, " +"PersistentClass mappedEntity) {\n" +" super( entityMetamodel, mappedEntity );\n" +" }\n" +"\n" +" public EntityNameResolver[] getEntityNameResolvers() {\n" +" return new EntityNameResolver[] { MyEntityNameResolver." +"INSTANCE };\n" +" }\n" +"\n" +" public String determineConcreteSubclassEntityName(Object entityInstance, " +"SessionFactoryImplementor factory) {\n" +" String entityName = ProxyHelper.extractEntityName" +"( entityInstance );\n" +" if ( entityName == null ) {\n" +" entityName = super.determineConcreteSubclassEntityName" +"( entityInstance, factory );\n" +" }\n" +" return entityName;\n" +" }\n" +"\n" +" ...\n" +"}" #. Tag: para +#: persistent_classes.xml:379 #, no-c-format -msgid "In order to register an org.hibernate.EntityNameResolver users must either:" -msgstr "为了注册 org.hibernate.EntityNameResolver,用户必须:" +msgid "" +"In order to register an org.hibernate.EntityNameResolver users must either:" +msgstr "" +"为了注册 org.hibernate.EntityNameResolver,用" +"户必须:" #. Tag: para -#, no-c-format -msgid "Implement a custom Tuplizer, implementing the getEntityNameResolvers method." -msgstr "实现自定义的 Tuplizer 并实现 getEntityNameResolvers 方法。" +#: persistent_classes.xml:383 +#, fuzzy, no-c-format +msgid "" +"Implement a custom tuplizer (see ), implementing the getEntityNameResolvers " +"method" +msgstr "" +"实现自定义的 Tuplizer " +"并实现 getEntityNameResolvers 方法。" #. Tag: para +#: persistent_classes.xml:389 #, no-c-format -msgid "Register it with the org.hibernate.impl.SessionFactoryImpl (which is the implementation class for org.hibernate.SessionFactory) using the registerEntityNameResolver method." -msgstr "用 registerEntityNameResolver 方法注册到 org.hibernate.impl.SessionFactoryImpl(它是 org.hibernate.SessionFactory 的实现类)。" +msgid "" +"Register it with the org.hibernate.impl.SessionFactoryImpl (which is the implementation class for org." +"hibernate.SessionFactory) using the " +"registerEntityNameResolver method." +msgstr "" +"用 registerEntityNameResolver 方法注册到 " +"org.hibernate.impl.SessionFactoryImpl(它是 " +"org.hibernate.SessionFactory 的实现类)。" #~ msgid "" -#~ "" -#~ msgstr "" -#~ "" +#~ "Most Java applications require a persistent class representing felines. " +#~ "For example:" +#~ msgstr "大多数 Java 程序需要用一个持久化类来表示猫科动物。例如:" + #~ msgid "" -#~ "" +#~ "Cat has a property called id. 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, java.lang." +#~ "String or java.util.Date. If your legacy " +#~ "database table has composite keys, you can use a user-defined class with " +#~ "properties of these types (see the section on composite identifiers later " +#~ "in the chapter.)" #~ msgstr "" -#~ "" +#~ "Cat 有一个属性叫做 id。这个属性映射" +#~ "数据库表的主 键字段。这个属性可以叫任何名字,其类型可以是任何的原始类型、" +#~ "原始类型的包装类型、 java.lang.String 或者是 " +#~ "java.util.Date。(如果你的遗留数据库表有联合主键,你甚" +#~ "至可以用一个用户自定义的类,该类拥有这些类型的属性。参见后面的关于联合标识" +#~ "符的章节。)" + #~ 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 "" -#~ "" +#~ "标识符属性是可选的。可以不用管它,让 Hibernate 内部来追踪对象的识别。 但是" +#~ "我们并不推荐这样做。" + #~ msgid "" -#~ "\n" -#~ "\n" -#~ " \n" -#~ "\n" -#~ " \n" -#~ " \n" -#~ " \n" -#~ "\n" -#~ " \n" -#~ "\n" -#~ " \n" -#~ "\n" -#~ " \n" -#~ "\n" -#~ " \n" -#~ " \n" -#~ " \n" -#~ " \n" -#~ "\n" -#~ " \n" -#~ " \n" -#~ "]]>" -#~ msgstr "" -#~ "\n" -#~ "\n" -#~ " \n" -#~ "\n" -#~ " \n" -#~ " \n" -#~ " \n" -#~ "\n" -#~ " \n" -#~ "\n" -#~ " \n" -#~ "\n" -#~ " \n" -#~ "\n" -#~ " \n" -#~ " \n" -#~ " \n" -#~ " \n" -#~ "\n" -#~ " \n" -#~ " \n" -#~ "]]>" +#~ "In fact, some functionality is available only to classes that declare an " +#~ "identifier property:" +#~ msgstr "实际上,一些功能只对那些声明了标识符属性的类起作用: " + #~ msgid "" -#~ "" +#~ "Transitive reattachment for detached objects (cascade update or cascade " +#~ "merge) - see " #~ msgstr "" -#~ "" +#~ "托管对象的传播性再连接(级联更新或级联合并)- 参阅 " + +#~ msgid "Session.saveOrUpdate()" +#~ msgstr "Session.saveOrUpdate() " + +#~ msgid "Session.merge()" +#~ msgstr "Session.merge() " + #~ msgid "" -#~ "" +#~ "A central feature of Hibernate, proxies, depends " +#~ "upon the persistent class being either non-final, or the implementation " +#~ "of an interface that declares all public methods." #~ msgstr "" -#~ "" +#~ "代理(proxies)是 Hibernate 的一个重要的功能,它依赖" +#~ "的条件是,持久化类或者是非 final 的,或者是实现了一个所有方法都声明为 " +#~ "public 的接口。" + +#~ msgid "" +#~ "You can persist final classes that do not implement an " +#~ "interface with Hibernate. You will not, however, be able to use proxies " +#~ "for lazy association fetching which will ultimately limit your options " +#~ "for performance tuning." +#~ msgstr "" +#~ "你可以用 Hibernate 持久化一个没有实现任何接口的 final " +#~ "类,但是你不能使用代理来延迟关联加载,这会限制你进行性能优化的选择。 " + +#~ msgid "" +#~ "There are two high-level types of Tuplizers, represented by the " +#~ "org.hibernate.tuple.entity.EntityTuplizer and " +#~ "org.hibernate.tuple.component.ComponentTuplizer " +#~ "interfaces. EntityTuplizers are responsible for " +#~ "managing the above mentioned contracts in regards to entities, while " +#~ "ComponentTuplizers do the same for components." +#~ msgstr "" +#~ "有两种高层类型的 Tuplizer,分别由 org.hibernate.tuple.entity." +#~ "EntityTuplizerorg.hibernate.tuple.component." +#~ "ComponentTuplizer 接口代表。EntityTuplizer 负" +#~ "责管理和实体相关的上述合约,而ComponentTuplizer 则负责" +#~ "组件。" + #~ msgid "" #~ "\n" #~ " \n" @@ -731,262 +1541,3 @@ msgstr "用 registerEntityNameResolver 方法注册到 #~ " }\n" #~ " }\n" #~ "}]]>" -#~ msgid "" -#~ "/**\n" -#~ " * A very trivial JDK Proxy InvocationHandler implementation where we " -#~ "proxy an interface as\n" -#~ " * the domain model and simply store persistent state in an internal " -#~ "Map. This is an extremely\n" -#~ " * trivial example meant only for illustration.\n" -#~ " */\n" -#~ "public final class DataProxyHandler implements InvocationHandler {\n" -#~ " private String entityName;\n" -#~ " private HashMap data = new HashMap();\n" -#~ "\n" -#~ " public DataProxyHandler(String entityName, Serializable id) {\n" -#~ " this.entityName = entityName;\n" -#~ " data.put( \"Id\", id );\n" -#~ " }\n" -#~ "\n" -#~ " public Object invoke(Object proxy, Method method, Object[] args) " -#~ "throws Throwable {\n" -#~ " String methodName = method.getName();\n" -#~ " if ( methodName.startsWith( \"set\" ) ) {\n" -#~ " String propertyName = methodName.substring( 3 );\n" -#~ " data.put( propertyName, args[0] );\n" -#~ " }\n" -#~ " else if ( methodName.startsWith( \"get\" ) ) {\n" -#~ " String propertyName = methodName.substring( 3 );\n" -#~ " return data.get( propertyName );\n" -#~ " }\n" -#~ " else if ( \"toString\".equals( methodName ) ) {\n" -#~ " return entityName + \"#\" + data.get( \"Id\" );\n" -#~ " }\n" -#~ " else if ( \"hashCode\".equals( methodName ) ) {\n" -#~ " return new Integer( this.hashCode() );\n" -#~ " }\n" -#~ " return null;\n" -#~ " }\n" -#~ "\n" -#~ " public String getEntityName() {\n" -#~ " return entityName;\n" -#~ " }\n" -#~ "\n" -#~ " public HashMap getData() {\n" -#~ " return data;\n" -#~ " }\n" -#~ "}\n" -#~ "\n" -#~ "/**\n" -#~ " *\n" -#~ " */\n" -#~ "public class ProxyHelper {\n" -#~ " public static String extractEntityName(Object object) {\n" -#~ " // Our custom java.lang.reflect.Proxy instances actually bundle\n" -#~ " // their appropriate entity name, so we simply extract it from " -#~ "there\n" -#~ " // if this represents one of our proxies; otherwise, we return " -#~ "null\n" -#~ " if ( Proxy.isProxyClass( object.getClass() ) ) {\n" -#~ " InvocationHandler handler = Proxy.getInvocationHandler" -#~ "( object );\n" -#~ " if ( DataProxyHandler.class.isAssignableFrom( handler.getClass" -#~ "() ) ) {\n" -#~ " DataProxyHandler myHandler = ( DataProxyHandler ) " -#~ "handler;\n" -#~ " return myHandler.getEntityName();\n" -#~ " }\n" -#~ " }\n" -#~ " return null;\n" -#~ " }\n" -#~ "\n" -#~ " // various other utility methods ....\n" -#~ "\n" -#~ "}\n" -#~ "\n" -#~ "/**\n" -#~ " * The EntityNameResolver implementation.\n" -#~ " * IMPL NOTE : An EntityNameResolver really defines a strategy for how " -#~ "entity names should be\n" -#~ " * resolved. Since this particular impl can handle resolution for all of " -#~ "our entities we want to\n" -#~ " * take advantage of the fact that SessionFactoryImpl keeps these in a " -#~ "Set so that we only ever\n" -#~ " * have one instance registered. Why? Well, when it comes time to " -#~ "resolve an entity name,\n" -#~ " * Hibernate must iterate over all the registered resolvers. So keeping " -#~ "that number down\n" -#~ " * helps that process be as speedy as possible. Hence the equals and " -#~ "hashCode impls\n" -#~ " */\n" -#~ "public class MyEntityNameResolver implements EntityNameResolver {\n" -#~ " public static final MyEntityNameResolver INSTANCE = new " -#~ "MyEntityNameResolver();\n" -#~ "\n" -#~ " public String resolveEntityName(Object entity) {\n" -#~ " return ProxyHelper.extractEntityName( entity );\n" -#~ " }\n" -#~ "\n" -#~ " public boolean equals(Object obj) {\n" -#~ " return getClass().equals( obj.getClass() );\n" -#~ " }\n" -#~ "\n" -#~ " public int hashCode() {\n" -#~ " return getClass().hashCode();\n" -#~ " }\n" -#~ "}\n" -#~ "\n" -#~ "public class MyEntityTuplizer extends PojoEntityTuplizer {\n" -#~ " public MyEntityTuplizer(EntityMetamodel entityMetamodel, " -#~ "PersistentClass mappedEntity) {\n" -#~ " super( entityMetamodel, mappedEntity );\n" -#~ " }\n" -#~ "\n" -#~ " public EntityNameResolver[] getEntityNameResolvers() {\n" -#~ " return new EntityNameResolver[] { MyEntityNameResolver." -#~ "INSTANCE };\n" -#~ " }\n" -#~ "\n" -#~ " public String determineConcreteSubclassEntityName(Object " -#~ "entityInstance, SessionFactoryImplementor factory) {\n" -#~ " String entityName = ProxyHelper.extractEntityName" -#~ "( entityInstance );\n" -#~ " if ( entityName == null ) {\n" -#~ " entityName = super.determineConcreteSubclassEntityName" -#~ "( entityInstance, factory );\n" -#~ " }\n" -#~ " return entityName;\n" -#~ " }\n" -#~ "\n" -#~ " ...\n" -#~ "}" -#~ msgstr "" -#~ "/**\n" -#~ " * A very trivial JDK Proxy InvocationHandler implementation where we " -#~ "proxy an interface as\n" -#~ " * the domain model and simply store persistent state in an internal " -#~ "Map. This is an extremely\n" -#~ " * trivial example meant only for illustration.\n" -#~ " */\n" -#~ "public final class DataProxyHandler implements InvocationHandler {\n" -#~ " private String entityName;\n" -#~ " private HashMap data = new HashMap();\n" -#~ "\n" -#~ " public DataProxyHandler(String entityName, Serializable id) {\n" -#~ " this.entityName = entityName;\n" -#~ " data.put( \"Id\", id );\n" -#~ " }\n" -#~ "\n" -#~ " public Object invoke(Object proxy, Method method, Object[] args) " -#~ "throws Throwable {\n" -#~ " String methodName = method.getName();\n" -#~ " if ( methodName.startsWith( \"set\" ) ) {\n" -#~ " String propertyName = methodName.substring( 3 );\n" -#~ " data.put( propertyName, args[0] );\n" -#~ " }\n" -#~ " else if ( methodName.startsWith( \"get\" ) ) {\n" -#~ " String propertyName = methodName.substring( 3 );\n" -#~ " return data.get( propertyName );\n" -#~ " }\n" -#~ " else if ( \"toString\".equals( methodName ) ) {\n" -#~ " return entityName + \"#\" + data.get( \"Id\" );\n" -#~ " }\n" -#~ " else if ( \"hashCode\".equals( methodName ) ) {\n" -#~ " return new Integer( this.hashCode() );\n" -#~ " }\n" -#~ " return null;\n" -#~ " }\n" -#~ "\n" -#~ " public String getEntityName() {\n" -#~ " return entityName;\n" -#~ " }\n" -#~ "\n" -#~ " public HashMap getData() {\n" -#~ " return data;\n" -#~ " }\n" -#~ "}\n" -#~ "\n" -#~ "/**\n" -#~ " *\n" -#~ " */\n" -#~ "public class ProxyHelper {\n" -#~ " public static String extractEntityName(Object object) {\n" -#~ " // Our custom java.lang.reflect.Proxy instances actually bundle\n" -#~ " // their appropriate entity name, so we simply extract it from " -#~ "there\n" -#~ " // if this represents one of our proxies; otherwise, we return " -#~ "null\n" -#~ " if ( Proxy.isProxyClass( object.getClass() ) ) {\n" -#~ " InvocationHandler handler = Proxy.getInvocationHandler" -#~ "( object );\n" -#~ " if ( DataProxyHandler.class.isAssignableFrom( handler.getClass" -#~ "() ) ) {\n" -#~ " DataProxyHandler myHandler = ( DataProxyHandler ) " -#~ "handler;\n" -#~ " return myHandler.getEntityName();\n" -#~ " }\n" -#~ " }\n" -#~ " return null;\n" -#~ " }\n" -#~ "\n" -#~ " // various other utility methods ....\n" -#~ "\n" -#~ "}\n" -#~ "\n" -#~ "/**\n" -#~ " * The EntityNameResolver implementation.\n" -#~ " * IMPL NOTE : An EntityNameResolver really defines a strategy for how " -#~ "entity names should be\n" -#~ " * resolved. Since this particular impl can handle resolution for all of " -#~ "our entities we want to\n" -#~ " * take advantage of the fact that SessionFactoryImpl keeps these in a " -#~ "Set so that we only ever\n" -#~ " * have one instance registered. Why? Well, when it comes time to " -#~ "resolve an entity name,\n" -#~ " * Hibernate must iterate over all the registered resolvers. So keeping " -#~ "that number down\n" -#~ " * helps that process be as speedy as possible. Hence the equals and " -#~ "hashCode impls\n" -#~ " */\n" -#~ "public class MyEntityNameResolver implements EntityNameResolver {\n" -#~ " public static final MyEntityNameResolver INSTANCE = new " -#~ "MyEntityNameResolver();\n" -#~ "\n" -#~ " public String resolveEntityName(Object entity) {\n" -#~ " return ProxyHelper.extractEntityName( entity );\n" -#~ " }\n" -#~ "\n" -#~ " public boolean equals(Object obj) {\n" -#~ " return getClass().equals( obj.getClass() );\n" -#~ " }\n" -#~ "\n" -#~ " public int hashCode() {\n" -#~ " return getClass().hashCode();\n" -#~ " }\n" -#~ "}\n" -#~ "\n" -#~ "public class MyEntityTuplizer extends PojoEntityTuplizer {\n" -#~ " public MyEntityTuplizer(EntityMetamodel entityMetamodel, " -#~ "PersistentClass mappedEntity) {\n" -#~ " super( entityMetamodel, mappedEntity );\n" -#~ " }\n" -#~ "\n" -#~ " public EntityNameResolver[] getEntityNameResolvers() {\n" -#~ " return new EntityNameResolver[] { MyEntityNameResolver." -#~ "INSTANCE };\n" -#~ " }\n" -#~ "\n" -#~ " public String determineConcreteSubclassEntityName(Object " -#~ "entityInstance, SessionFactoryImplementor factory) {\n" -#~ " String entityName = ProxyHelper.extractEntityName" -#~ "( entityInstance );\n" -#~ " if ( entityName == null ) {\n" -#~ " entityName = super.determineConcreteSubclassEntityName" -#~ "( entityInstance, factory );\n" -#~ " }\n" -#~ " return entityName;\n" -#~ " }\n" -#~ "\n" -#~ " ...\n" -#~ "}" - diff --git a/documentation/manual/src/main/docbook/zh-CN/content/preface.po b/documentation/manual/src/main/docbook/zh-CN/content/preface.po index 10fe77cfde..40e9af10d6 100644 --- a/documentation/manual/src/main/docbook/zh-CN/content/preface.po +++ b/documentation/manual/src/main/docbook/zh-CN/content/preface.po @@ -5,7 +5,7 @@ msgid "" msgstr "" "Project-Id-Version: Collection_Mapping\n" "Report-Msgid-Bugs-To: http://bugs.kde.org\n" -"POT-Creation-Date: 2010-02-11T05:38:15\n" +"POT-Creation-Date: 2010-07-20 21:02+0000\n" "PO-Revision-Date: 2010-03-16 10:12+1000\n" "Last-Translator: Xi HUANG \n" "Language-Team: \n" @@ -15,77 +15,277 @@ msgstr "" "X-Generator: KBabel 1.11.4\n" #. Tag: title +#: preface.xml:33 #, no-c-format msgid "Preface" msgstr "前言" #. Tag: para -#, 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 "在今日的企业环境中,把面向对象的软件和关系型数据库一起使用可能是相当麻烦和浪费时间的。Hibernate 是一个面向 Java 环境的对象/关系型数据库映射工具。对象/关系型数据库映射(object/relational mapping,ORM)这个术语表示一种技术,用来把对象模型表示的对象映射到基于 SQL 的关系模型数据结构中去。 " +#: preface.xml:35 +#, fuzzy, no-c-format +msgid "" +"Working with both Object-Oriented software and Relational Databases can be " +"cumbersome and time consuming. Development costs are significantly higher " +"due to a paradigm mismatch between how data is represented in objects versus " +"relational databases. Hibernate is an Object/Relational Mapping solution for " +"Java environments. The term Object/Relational Mapping refers to the " +"technique of mapping a data representation from an object model to a " +"relational data model with a SQL-based schema; see http://en.wikipedia.org/wiki/" +"Object-relational_mapping for a discussion." +msgstr "" +"在今日的企业环境中,把面向对象的软件和关系型数据库一起使用可能是相当麻烦和浪" +"费时间的。Hibernate 是一个面向 Java 环境的对象/关系型数据库映射工具。对象/关" +"系型数据库映射(object/relational mapping,ORM)这个术语表示一种技术,用来把" +"对象模型表示的对象映射到基于 SQL 的关系模型数据结构中去。 " #. Tag: para +#: preface.xml:46 #, 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. It can also significantly reduce development time otherwise spent with manual data handling in SQL and JDBC." -msgstr "Hibernate 不仅管理 Java 类到数据库表的映射(包括 Java 数据类型到 SQL 数据类型的映射),还提供数据查询和获取数据的方法,可以大幅度减少开发时对人工使用 SQL 和 JDBC 处理数据的时间。 " +msgid "" +"While having a strong background in SQL is not required to use Hibernate, " +"having a basic understanding of the concepts can greatly help you understand " +"Hibernate more fully and quickly. Probably the single best background is an " +"understanding of data modeling principles. You might want to consider these " +"resources as a good starting point:" +msgstr "" + +#. Tag: ulink +#: preface.xml:54 +#, no-c-format +msgid "http://www.agiledata.org/essays/dataModeling101.html" +msgstr "" + +#. Tag: ulink +#: preface.xml:59 +#, no-c-format +msgid "http://en.wikipedia.org/wiki/Data_modeling" +msgstr "" #. Tag: para +#: preface.xml:66 #, no-c-format -msgid "Hibernate's 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 "Hibernate 的目标是对于开发者通常的数据持久化相关的编程任务,解放其中的 95%。对于以数据为中心的程序来说,它们往往只在数据库中使用存储过程来实现商业逻辑,Hibernate 可能不是最好的解决方案;对于那些在基于 Java 的中间层应用中,它们实现面向对象的业务模型和商业逻辑的应用,Hibernate 是最有用的。不管怎样,Hibernate 一定可以帮助你消除或者包装那些针对特定厂商的 SQL 代码,而且帮助你结果集从表格式的表示形式转换到一系列的对象中去。 " +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. It can also significantly reduce development " +"time otherwise spent with manual data handling in SQL and JDBC." +msgstr "" +"Hibernate 不仅管理 Java 类到数据库表的映射(包括 Java 数据类型到 SQL 数据类型" +"的映射),还提供数据查询和获取数据的方法,可以大幅度减少开发时对人工使用 SQL " +"和 JDBC 处理数据的时间。 " #. Tag: para +#: preface.xml:72 #, no-c-format -msgid "If you are new to Hibernate and Object/Relational Mapping or even Java, please follow these steps:" -msgstr "如果你对 Hibernate 和对象/关系型数据库映射还是个新手,甚至对 Java 也不熟悉,请按照下面的步骤来学习。" +msgid "" +"Hibernate’s design goal is to relieve the developer from 95% of common data " +"persistence-related programming tasks by eliminating the need for manual, " +"hand-crafted data processing using SQL and JDBC. However, unlike many other " +"persistence solutions, Hibernate does not hide the power of SQL from you and " +"guarantees that your investment in relational technology and knowledge is as " +"valid as always." +msgstr "" #. Tag: para -#, no-c-format -msgid "Read for a tutorial with step-by-step instructions. The source code for the tutorial is included in the distribution in the doc/reference/tutorial/ directory." -msgstr "阅读 ,这是一篇包含详细的逐步知道的指南。本指南的源代码包含在发行包里,你可以在 doc/reference/tutorial/ 目录下找到。" +#: preface.xml:79 +#, fuzzy, no-c-format +msgid "" +"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 "" +"Hibernate 的目标是对于开发者通常的数据持久化相关的编程任务,解放其中的 95%。" +"对于以数据为中心的程序来说,它们往往只在数据库中使用存储过程来实现商业逻辑," +"Hibernate 可能不是最好的解决方案;对于那些在基于 Java 的中间层应用中,它们实" +"现面向对象的业务模型和商业逻辑的应用,Hibernate 是最有用的。不管怎样," +"Hibernate 一定可以帮助你消除或者包装那些针对特定厂商的 SQL 代码,而且帮助你结" +"果集从表格式的表示形式转换到一系列的对象中去。 " #. Tag: para +#: preface.xml:88 #, no-c-format -msgid "Read to understand the environments where Hibernate can be used." -msgstr "阅读 来理解 Hibernate 可以使用的环境。" +msgid "" +"If you are new to Hibernate and Object/Relational Mapping or even Java, " +"please follow these steps:" +msgstr "" +"如果你对 Hibernate 和对象/关系型数据库映射还是个新手,甚至对 Java 也不熟悉," +"请按照下面的步骤来学习。" #. Tag: para -#, no-c-format -msgid "View the eg/ directory in the Hibernate distribution. It contains a simple standalone application. Copy your JDBC driver to the lib/ directory and edit etc/hibernate.properties, specifying correct values for your database. From a command prompt in the distribution directory, type ant eg (using Ant), or under Windows, type build eg." -msgstr "查看 Hibernate 发行包中的 eg/ 目录,里面有个一简单的独立运行的程序。把你的 JDBC 驱动复制到 lib/ 目录并修改一下 etc/hibernate.properties,指定数据库的信息。然后进入命令行,切换到发行包的目录,输入 ant eg(使用 Ant),或者在 Windows 系统下使用 build eg。 " +#: preface.xml:95 +#, fuzzy, no-c-format +msgid "" +"Read for a tutorial with step-by-step " +"instructions. The source code for the tutorial is included in the " +"distribution in the doc/reference/tutorial/ directory." +msgstr "" +"阅读 ,这是一篇包含详细的逐步知道的指南。本指南的" +"源代码包含在发行包里,你可以在 doc/reference/tutorial/ 目" +"录下找到。" #. Tag: para -#, no-c-format -msgid "Use this reference documentation as your primary source of information. Consider reading if you need more help with application design, or if you prefer a step-by-step tutorial. Also visit and download the example application from ." -msgstr "把这份文档作为你学习的主要信息来源。如果你需要应用程序设计方面的帮助或者你希望有一个按部就班的指南,你可以考虑阅读 。你也可以访问 并从 下载示例程序。" +#: preface.xml:103 +#, fuzzy, no-c-format +msgid "" +"Read to understand the environments where " +"Hibernate can be used." +msgstr "" +"阅读 来理解 Hibernate 可以使用的环境。" #. Tag: para +#: preface.xml:109 +#, no-c-format +msgid "" +"View the eg/ directory in the Hibernate distribution. It " +"contains a simple standalone application. Copy your JDBC driver to the " +"lib/ directory and edit etc/hibernate." +"properties, specifying correct values for your database. From a " +"command prompt in the distribution directory, type ant eg " +"(using Ant), or under Windows, type build eg." +msgstr "" +"查看 Hibernate 发行包中的 eg/ 目录,里面有个一简单的独立运" +"行的程序。把你的 JDBC 驱动复制到 lib/ 目录并修改一下 " +"etc/hibernate.properties,指定数据库的信息。然后进入命令" +"行,切换到发行包的目录,输入 ant eg(使用 Ant),或者在 " +"Windows 系统下使用 build eg。 " + +#. Tag: para +#: preface.xml:120 +#, fuzzy, no-c-format +msgid "" +"Use this reference documentation as your primary source of information. " +"Consider reading if you need " +"more help with application design, or if you prefer a step-by-step tutorial. " +"Also visit and " +"download the example application from ." +msgstr "" +"把这份文档作为你学习的主要信息来源。如果你需要应用程序设计方面的帮助或者你希" +"望有一个按部就班的指南,你可以考虑阅读 。你也可以访问 并从 下载示例程序。" + +#. Tag: para +#: preface.xml:130 #, no-c-format msgid "FAQs are answered on the Hibernate website." msgstr "在 Hibernate 网站上可以找到问题和解答(FAQ)。" #. Tag: para +#: preface.xml:135 #, no-c-format -msgid "Links to third party demos, examples, and tutorials are maintained on the Hibernate website." +msgid "" +"Links to third party demos, examples, and tutorials are maintained on the " +"Hibernate website." msgstr "在 Hibernate 网站上还有第三方的演示、示例和教程的链接。 " #. Tag: para +#: preface.xml:141 #, 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 "Hibernate 网站的社区是讨论关于设计模式以及很多整合方案(Tomcat、JBoss AS、Struts、EJB 等)的好地方。" +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 "" +"Hibernate 网站的社区是讨论关于设计模式以及很多整合方案(Tomcat、JBoss AS、" +"Struts、EJB 等)的好地方。" #. Tag: para +#: preface.xml:149 #, no-c-format -msgid "If you have questions, use the user forum linked on the Hibernate website. We also provide a JIRA issue tracking 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 "如果你有任何问题,请使用 Hibernate 网站上链接的用户论坛。我们也提供一个 JIRA 问题追踪系统,来搜集 bug 报告和新的功能请求。如果对开发 Hibernate 有兴趣,请加入开发者的邮件列表。如果你对翻译本文档感兴趣,请通过开发者的邮件列表来联系我们。 " +msgid "" +"There are a number of ways to become involved in the Hibernate community, " +"including" +msgstr "" #. Tag: para +#: preface.xml:153 #, 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 "商业开发、产品支持和 Hibernate 培训可以通过 JBoss Inc. 获得(请查阅: http://www.hibernate.org/SupportTraining/)。Hibernate 是一个专业的开源项目,也是 JBoss 企业级中间件系统(JBoss Enterprise Middleware System,JEMS)里的一个核心组件。 " +msgid "" +"Trying stuff out and reporting bugs. See http://hibernate.org/issuetracker.html details." +msgstr "" + +#. Tag: para +#: preface.xml:160 +#, no-c-format +msgid "" +"Trying your hand at fixing some bugs or implementing enhancements. Again, " +"see http://hibernate." +"org/issuetracker.html details." +msgstr "" + +#. Tag: para +#: preface.xml:167 +#, no-c-format +msgid "" +"http://hibernate.org/" +"community.html list a few ways to engage in the community." +msgstr "" + +#. Tag: para +#: preface.xml:172 +#, no-c-format +msgid "" +"There are forums for users to ask questions and receive help from the " +"community." +msgstr "" + +#. Tag: para +#: preface.xml:177 +#, no-c-format +msgid "" +"There are also IRC channels for both user and developer discussions." +msgstr "" + +#. Tag: para +#: preface.xml:186 +#, no-c-format +msgid "" +"Helping improve or translate this documentation. Contact us on the developer " +"mailing list if you have interest." +msgstr "" + +#. Tag: para +#: preface.xml:192 +#, no-c-format +msgid "Evangelizing Hibernate within your organization." +msgstr "" + +#~ msgid "" +#~ "If you have questions, use the user forum linked on the Hibernate " +#~ "website. We also provide a JIRA issue tracking 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 "" +#~ "如果你有任何问题,请使用 Hibernate 网站上链接的用户论坛。我们也提供一个 " +#~ "JIRA 问题追踪系统,来搜集 bug 报告和新的功能请求。如果对开发 Hibernate 有" +#~ "兴趣,请加入开发者的邮件列表。如果你对翻译本文档感兴趣,请通过开发者的邮件" +#~ "列表来联系我们。 " + +#~ 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 "" +#~ "商业开发、产品支持和 Hibernate 培训可以通过 JBoss Inc. 获得(请查阅: " +#~ "http://www.hibernate.org/SupportTraining/)。Hibernate 是一个专业的开源项" +#~ "目,也是 JBoss 企业级中间件系统(JBoss Enterprise Middleware System," +#~ "JEMS)里的一个核心组件。 " #~ msgid "Feedback" #~ msgstr "反馈" + #~ msgid "" #~ "Use Hibernate JIRA to report errors or request enhacements to this " @@ -93,4 +293,3 @@ msgstr "商业开发、产品支持和 Hibernate 培训可以通过 JBoss Inc. #~ msgstr "" #~ "用 Hibernate JIRA 来报告错误或改进本文档。" - diff --git a/documentation/manual/src/main/docbook/zh-CN/content/query_sql.po b/documentation/manual/src/main/docbook/zh-CN/content/query_sql.po index 978d713d42..23b6f584bd 100644 --- a/documentation/manual/src/main/docbook/zh-CN/content/query_sql.po +++ b/documentation/manual/src/main/docbook/zh-CN/content/query_sql.po @@ -5,7 +5,7 @@ msgid "" msgstr "" "Project-Id-Version: Collection_Mapping\n" "Report-Msgid-Bugs-To: http://bugs.kde.org\n" -"POT-Creation-Date: 2010-03-12T00:03:47\n" +"POT-Creation-Date: 2010-07-20 21:02+0000\n" "PO-Revision-Date: 2010-03-16 10:16+1000\n" "Last-Translator: Xi HUANG \n" "Language-Team: \n" @@ -15,1093 +15,2203 @@ msgstr "" "X-Generator: KBabel 1.11.4\n" #. Tag: title +#: query_sql.xml:31 #, no-c-format msgid "Native SQL" msgstr "Native SQL 查询" #. Tag: para +#: query_sql.xml:33 #, no-c-format -msgid "You can also express queries in the native SQL dialect of your database. This is useful if you want to utilize database-specific features such as query hints or the CONNECT keyword in Oracle. It also provides a clean migration path from a direct SQL/JDBC based application to Hibernate." -msgstr "你也可以使用你的数据库的 Native SQL 语言来查询数据。这对你在要使用数据库的某些特性的时候(比如说在查询提示或者 Oracle 中的 CONNECT 关键字),这是非常有用的。这就能够扫清你把原来直接使用 SQL/JDBC 的程序迁移到基于 Hibernate 应用的道路上的障碍。 " +msgid "" +"You can also express queries in the native SQL dialect of your database. " +"This is useful if you want to utilize database-specific features such as " +"query hints or the CONNECT keyword in Oracle. It also " +"provides a clean migration path from a direct SQL/JDBC based application to " +"Hibernate." +msgstr "" +"你也可以使用你的数据库的 Native SQL 语言来查询数据。这对你在要使用数据库的某" +"些特性的时候(比如说在查询提示或者 Oracle 中的 CONNECT 关" +"键字),这是非常有用的。这就能够扫清你把原来直接使用 SQL/JDBC 的程序迁移到基" +"于 Hibernate 应用的道路上的障碍。 " #. Tag: para +#: query_sql.xml:39 #, no-c-format -msgid "Hibernate3 allows you to specify handwritten SQL, including stored procedures, for all create, update, delete, and load operations." -msgstr "Hibernate3 允许你使用手写的 sql 来完成所有的 create、update、delete 和 load 操作(包括存储过程) " +msgid "" +"Hibernate3 allows you to specify handwritten SQL, including stored " +"procedures, for all create, update, delete, and load operations." +msgstr "" +"Hibernate3 允许你使用手写的 sql 来完成所有的 create、update、delete 和 load " +"操作(包括存储过程) " #. Tag: title +#: query_sql.xml:43 #, no-c-format msgid "Using a SQLQuery" msgstr "使用 SQLQuery" #. Tag: para +#: query_sql.xml:45 #, no-c-format -msgid "Execution of native SQL queries is controlled via the SQLQuery interface, which is obtained by calling Session.createSQLQuery(). The following sections describe how to use this API for querying." -msgstr "对原生 SQL 查询执行的控制是通过 SQLQuery 接口进行的,通过执行Session.createSQLQuery()获取这个接口。下面来描述如何使用这个 API 进行查询。 " +msgid "" +"Execution of native SQL queries is controlled via the SQLQuery interface, which is obtained by calling Session." +"createSQLQuery(). The following sections describe how to use this " +"API for querying." +msgstr "" +"对原生 SQL 查询执行的控制是通过 SQLQuery 接口进行的,通过" +"执行Session.createSQLQuery()获取这个接口。下面来描述如何使" +"用这个 API 进行查询。 " #. Tag: title +#: query_sql.xml:51 #, no-c-format msgid "Scalar queries" msgstr "标量查询(Scalar queries)" #. Tag: para +#: query_sql.xml:53 #, no-c-format msgid "The most basic SQL query is to get a list of scalars (values)." msgstr "最基本的 SQL 查询就是获得一个标量(数值)的列表。" -#. Tag: para -#, no-c-format -msgid "These will return a List of Object arrays (Object[]) with scalar values for each column in the CATS table. Hibernate will use ResultSetMetadata to deduce the actual order and types of the returned scalar values." -msgstr "它们都将返回一个 Object 数组(Object[])组成的 List,数组每个元素都是 CATS 表的一个字段值。Hibernate 会使用 ResultSetMetadata 来判定返回的标量值的实际顺序和类型。 " +#. Tag: programlisting +#: query_sql.xml:56 +#, fuzzy, no-c-format +msgid "" +"sess.createSQLQuery(\"SELECT * FROM CATS\").list();\n" +"sess.createSQLQuery(\"SELECT ID, NAME, BIRTHDATE FROM CATS\").list();" +msgstr "" +"sess.createSQLQuery(\"SELECT * FROM CATS\").list();\n" +"sess.createSQLQuery(\"SELECT ID, NAME, BIRTHDATE FROM CATS\").list();" #. Tag: para +#: query_sql.xml:58 #, no-c-format -msgid "To avoid the overhead of using ResultSetMetadata, or simply to be more explicit in what is returned, one can use addScalar():" -msgstr "如果要避免过多的使用 ResultSetMetadata,或者只是为了更加明确的指名返回值,可以使用 addScalar(): " +msgid "" +"These will return a List of Object arrays (Object[]) with scalar values for " +"each column in the CATS table. Hibernate will use ResultSetMetadata to " +"deduce the actual order and types of the returned scalar values." +msgstr "" +"它们都将返回一个 Object 数组(Object[])组成的 List,数组每个元素都是 CATS 表" +"的一个字段值。Hibernate 会使用 ResultSetMetadata 来判定返回的标量值的实际顺序" +"和类型。 " #. Tag: para +#: query_sql.xml:63 +#, no-c-format +msgid "" +"To avoid the overhead of using ResultSetMetadata, or " +"simply to be more explicit in what is returned, one can use " +"addScalar():" +msgstr "" +"如果要避免过多的使用 ResultSetMetadata,或者只是为了更加明" +"确的指名返回值,可以使用 addScalar(): " + +#. Tag: programlisting +#: query_sql.xml:67 +#, fuzzy, no-c-format +msgid "" +"sess.createSQLQuery(\"SELECT * FROM CATS\")\n" +" .addScalar(\"ID\", Hibernate.LONG)\n" +" .addScalar(\"NAME\", Hibernate.STRING)\n" +" .addScalar(\"BIRTHDATE\", Hibernate.DATE)" +msgstr "" +"sess.createSQLQuery(\"SELECT * FROM CATS\")\n" +" .addScalar(\"ID\", Hibernate.LONG)\n" +" .addScalar(\"NAME\", Hibernate.STRING)\n" +" .addScalar(\"BIRTHDATE\", Hibernate.DATE)" + +#. Tag: para +#: query_sql.xml:69 query_sql.xml:116 query_sql.xml:197 query_sql.xml:349 #, no-c-format msgid "This query specified:" msgstr "这个查询指定:" #. Tag: para +#: query_sql.xml:73 query_sql.xml:120 query_sql.xml:353 #, no-c-format msgid "the SQL query string" msgstr "SQL 查询字符串" #. Tag: para +#: query_sql.xml:77 #, no-c-format msgid "the columns and types to return" msgstr "要返回的字段和类型" #. Tag: para +#: query_sql.xml:81 #, no-c-format -msgid "This will return Object arrays, but now it will not use ResultSetMetadata but will instead explicitly get the ID, NAME and BIRTHDATE column as respectively a Long, String and a Short from the underlying resultset. This also means that only these three columns will be returned, even though the query is using * and could return more than the three listed columns." -msgstr "它仍然会返回 Object 数组,但是此时不再使用 ResultSetMetdata,而是明确的将 ID,NAME 和 BIRTHDATE 按照 Long,String 和 Short 类型从 resultset 中取出。同时,也指明了就算 query 是使用 * 来查询的,可能获得超过列出的这三个字段,也仅仅会返回这三个字段。 " +msgid "" +"This will return Object arrays, but now it will not use " +"ResultSetMetadata but will instead explicitly get the ID, " +"NAME and BIRTHDATE column as respectively a Long, String and a Short from " +"the underlying resultset. This also means that only these three columns will " +"be returned, even though the query is using * and could " +"return more than the three listed columns." +msgstr "" +"它仍然会返回 Object 数组,但是此时不再使用 ResultSetMetdata,而是明确的将 ID,NAME 和 BIRTHDATE 按照 Long,String 和 Short 类型" +"从 resultset 中取出。同时,也指明了就算 query 是使用 * 来" +"查询的,可能获得超过列出的这三个字段,也仅仅会返回这三个字段。 " #. Tag: para +#: query_sql.xml:89 #, no-c-format -msgid "It is possible to leave out the type information for all or some of the scalars." +msgid "" +"It is possible to leave out the type information for all or some of the " +"scalars." msgstr "对全部或者部分的标量值不设置类型信息也是可以的。" -#. Tag: para -#, no-c-format -msgid "This is essentially the same query as before, but now ResultSetMetaData is used to determine the type of NAME and BIRTHDATE, where as the type of ID is explicitly specified." -msgstr "基本上这和前面一个查询相同,只是此时使用 ResultSetMetaData 来决定 NAME 和 BIRTHDATE 的类型,而 ID 的类型是明确指出的。 " +#. Tag: programlisting +#: query_sql.xml:92 +#, fuzzy, no-c-format +msgid "" +"sess.createSQLQuery(\"SELECT * FROM CATS\")\n" +" .addScalar(\"ID\", Hibernate.LONG)\n" +" .addScalar(\"NAME\")\n" +" .addScalar(\"BIRTHDATE\")" +msgstr "" +"sess.createSQLQuery(\"SELECT * FROM CATS\")\n" +" .addScalar(\"ID\", Hibernate.LONG)\n" +" .addScalar(\"NAME\")\n" +" .addScalar(\"BIRTHDATE\")" #. Tag: para +#: query_sql.xml:94 #, no-c-format -msgid "How the java.sql.Types returned from ResultSetMetaData is mapped to Hibernate types is controlled by the Dialect. If a specific type is not mapped, or does not result in the expected type, it is possible to customize it via calls to registerHibernateType in the Dialect." -msgstr "关于从 ResultSetMetaData 返回的 java.sql.Types 是如何映射到 Hibernate 类型,是由方言(Dialect)控制的。假若某个指定的类型没有被映射,或者不是你所预期的类型,你可以通过 Dialet 的 registerHibernateType 调用自行定义。 " +msgid "" +"This is essentially the same query as before, but now " +"ResultSetMetaData is used to determine the type of NAME " +"and BIRTHDATE, where as the type of ID is explicitly specified." +msgstr "" +"基本上这和前面一个查询相同,只是此时使用 ResultSetMetaData " +"来决定 NAME 和 BIRTHDATE 的类型,而 ID 的类型是明确指出的。 " + +#. Tag: para +#: query_sql.xml:99 +#, no-c-format +msgid "" +"How the java.sql.Types returned from ResultSetMetaData is mapped to " +"Hibernate types is controlled by the Dialect. If a specific type is not " +"mapped, or does not result in the expected type, it is possible to customize " +"it via calls to registerHibernateType in the Dialect." +msgstr "" +"关于从 ResultSetMetaData 返回的 java.sql.Types 是如何映射到 Hibernate 类型," +"是由方言(Dialect)控制的。假若某个指定的类型没有被映射,或者不是你所预期的类" +"型,你可以通过 Dialet 的 registerHibernateType 调用自行定" +"义。 " #. Tag: title +#: query_sql.xml:107 #, no-c-format msgid "Entity queries" msgstr "实体查询(Entity queries)" #. Tag: para +#: query_sql.xml:109 #, no-c-format -msgid "The above queries were all about returning scalar values, basically returning the \"raw\" values from the resultset. The following shows how to get entity objects from a native sql query via addEntity()." -msgstr "上面的查询都是返回标量值的,也就是从 resultset 中返回的“裸”数据。下面展示如何通过 addEntity() 让原生查询返回实体对象。" +msgid "" +"The above queries were all about returning scalar values, basically " +"returning the \"raw\" values from the resultset. The following shows how to " +"get entity objects from a native sql query via addEntity()." +msgstr "" +"上面的查询都是返回标量值的,也就是从 resultset 中返回的“裸”数据。下面展示如何" +"通过 addEntity() 让原生查询返回实体对象。" + +#. Tag: programlisting +#: query_sql.xml:114 +#, fuzzy, no-c-format +msgid "" +"sess.createSQLQuery(\"SELECT * FROM CATS\").addEntity(Cat.class);\n" +"sess.createSQLQuery(\"SELECT ID, NAME, BIRTHDATE FROM CATS\").addEntity(Cat." +"class);" +msgstr "" +"sess.createSQLQuery(\"SELECT * FROM CATS\").addEntity(Cat.class);\n" +"sess.createSQLQuery(\"SELECT ID, NAME, BIRTHDATE FROM CATS\").addEntity(Cat." +"class);" #. Tag: para +#: query_sql.xml:124 #, no-c-format msgid "the entity returned by the query" msgstr "要返回的实体" #. Tag: para +#: query_sql.xml:128 #, no-c-format -msgid "Assuming that Cat is mapped as a class with the columns ID, NAME and BIRTHDATE the above queries will both return a List where each element is a Cat entity." -msgstr "假设 Cat 被映射为拥有 ID,NAME 和 BIRTHDATE 三个字段的类,以上的两个查询都返回一个 List,每个元素都是一个 Cat 实体。" +msgid "" +"Assuming that Cat is mapped as a class with the columns ID, NAME and " +"BIRTHDATE the above queries will both return a List where each element is a " +"Cat entity." +msgstr "" +"假设 Cat 被映射为拥有 ID,NAME 和 BIRTHDATE 三个字段的类,以上的两个查询都返" +"回一个 List,每个元素都是一个 Cat 实体。" #. Tag: para +#: query_sql.xml:132 #, no-c-format -msgid "If the entity is mapped with a many-to-one to another entity it is required to also return this when performing the native query, otherwise a database specific \"column not found\" error will occur. The additional columns will automatically be returned when using the * notation, but we prefer to be explicit as in the following example for a many-to-one to a Dog:" -msgstr "假若实体在映射时有一个 many-to-one 的关联指向另外一个实体,在查询时必须也返回那个实体,否则会导致发生一个 \"column not found\" 的数据库错误。这些附加的字段可以使用 * 标注来自动返回,但我们希望还是明确指明,看下面这个具有指向 Dogmany-to-one 的例子:" +msgid "" +"If the entity is mapped with a many-to-one to another " +"entity it is required to also return this when performing the native query, " +"otherwise a database specific \"column not found\" error will occur. The " +"additional columns will automatically be returned when using the * notation, " +"but we prefer to be explicit as in the following example for a many-" +"to-one to a Dog:" +msgstr "" +"假若实体在映射时有一个 many-to-one 的关联指向另外一个实" +"体,在查询时必须也返回那个实体,否则会导致发生一个 \"column not found\" 的数" +"据库错误。这些附加的字段可以使用 * 标注来自动返回,但我们希望还是明确指明,看" +"下面这个具有指向 Dogmany-to-one 的" +"例子:" + +#. Tag: programlisting +#: query_sql.xml:140 +#, fuzzy, no-c-format +msgid "" +"sess.createSQLQuery(\"SELECT ID, NAME, BIRTHDATE, DOG_ID FROM CATS\")." +"addEntity(Cat.class);" +msgstr "" +"sess.createSQLQuery(\"SELECT ID, NAME, BIRTHDATE, DOG_ID FROM CATS\")." +"addEntity(Cat.class);" #. Tag: para +#: query_sql.xml:142 #, no-c-format msgid "This will allow cat.getDog() to function properly." msgstr "这样 cat.getDog() 就能正常运作。" #. Tag: title +#: query_sql.xml:146 #, no-c-format msgid "Handling associations and collections" msgstr "处理关联和集合类(Handling associations and collections)" #. Tag: para +#: query_sql.xml:148 #, no-c-format -msgid "It is possible to eagerly join in the Dog to avoid the possible extra roundtrip for initializing the proxy. This is done via the addJoin() method, which allows you to join in an association or collection." -msgstr "通过提前抓取将 Dog 连接获得,而避免初始化 proxy 带来的额外开销也是可能的。这是通过 addJoin() 方法进行的,这个方法可以让你将关联或集合连接进来。" +msgid "" +"It is possible to eagerly join in the Dog to avoid the " +"possible extra roundtrip for initializing the proxy. This is done via the " +"addJoin() method, which allows you to join in an " +"association or collection." +msgstr "" +"通过提前抓取将 Dog 连接获得,而避免初始化 proxy 带来的额外" +"开销也是可能的。这是通过 addJoin() 方法进行的,这个方法可" +"以让你将关联或集合连接进来。" + +#. Tag: programlisting +#: query_sql.xml:153 +#, fuzzy, no-c-format +msgid "" +"sess.createSQLQuery(\"SELECT c.ID, NAME, BIRTHDATE, DOG_ID, D_ID, D_NAME " +"FROM CATS c, DOGS d WHERE c.DOG_ID = d.D_ID\")\n" +" .addEntity(\"cat\", Cat.class)\n" +" .addJoin(\"cat.dog\");" +msgstr "" +"sess.createSQLQuery(\"SELECT c.ID, NAME, BIRTHDATE, DOG_ID, D_ID, D_NAME " +"FROM CATS c, DOGS d \n" +" WHERE c.DOG_ID = d.D_ID\")\n" +" .addEntity(\"cat\", Cat.class)\n" +" .addJoin(\"cat.dog\");" #. Tag: para +#: query_sql.xml:155 #, no-c-format -msgid "In this example, the returned Cat's will have their dog property fully initialized without any extra roundtrip to the database. Notice that you added an alias name (\"cat\") to be able to specify the target property path of the join. It is possible to do the same eager joining for collections, e.g. if the Cat had a one-to-many to Dog instead." -msgstr "上面这个例子中,返回的 Cat 对象,其 dog 属性被完全初始化了,不再需要数据库的额外操作。注意,我们加了一个别名(\"cat\"),以便指明 join 的目标属性路径。通过同样的提前连接也可以作用于集合类,例如,假若 Cat 有一个指向 Dog 的一对多关联。 " +msgid "" +"In this example, the returned Cat's will have their " +"dog property fully initialized without any extra " +"roundtrip to the database. Notice that you added an alias name (\"cat\") to " +"be able to specify the target property path of the join. It is possible to " +"do the same eager joining for collections, e.g. if the Cat had a one-to-many to Dog instead." +msgstr "" +"上面这个例子中,返回的 Cat 对象,其 dog 属性被完全初始化了,不再需要数据库的额外操作。注意,我们加了一个别名" +"(\"cat\"),以便指明 join 的目标属性路径。通过同样的提前连接也可以作用于集合" +"类,例如,假若 Cat 有一个指向 Dog 的一" +"对多关联。 " + +#. Tag: programlisting +#: query_sql.xml:163 +#, fuzzy, no-c-format +msgid "" +"sess.createSQLQuery(\"SELECT ID, NAME, BIRTHDATE, D_ID, D_NAME, CAT_ID FROM " +"CATS c, DOGS d WHERE c.ID = d.CAT_ID\")\n" +" .addEntity(\"cat\", Cat.class)\n" +" .addJoin(\"cat.dogs\");" +msgstr "" +"sess.createSQLQuery(\"SELECT ID, NAME, BIRTHDATE, D_ID, D_NAME, CAT_ID FROM " +"CATS c, DOGS d\n" +" WHERE c.ID = d.CAT_ID\")\n" +" .addEntity(\"cat\", Cat.class)\n" +" .addJoin(\"cat.dogs\");" #. Tag: para +#: query_sql.xml:165 #, no-c-format -msgid "At this stage you are reaching the limits of what is possible with native queries, without starting to enhance the sql queries to make them usable in Hibernate. Problems can arise when returning multiple entities of the same type or when the default alias/column names are not enough." -msgstr "到此为止,我们碰到了天花板:若不对 SQL 查询进行增强,这些已经是在 Hibernate 中使用原生 SQL 查询所能做到的最大可能了。下面的问题即将出现:返回多个同样类型的实体怎么办?或者默认的别名/字段不够又怎么办? " +msgid "" +"At this stage you are reaching the limits of what is possible with native " +"queries, without starting to enhance the sql queries to make them usable in " +"Hibernate. Problems can arise when returning multiple entities of the same " +"type or when the default alias/column names are not enough." +msgstr "" +"到此为止,我们碰到了天花板:若不对 SQL 查询进行增强,这些已经是在 Hibernate " +"中使用原生 SQL 查询所能做到的最大可能了。下面的问题即将出现:返回多个同样类型" +"的实体怎么办?或者默认的别名/字段不够又怎么办? " #. Tag: title +#: query_sql.xml:173 #, no-c-format msgid "Returning multiple entities" msgstr "返回多个实体(Returning multiple entities)" #. Tag: para +#: query_sql.xml:175 #, no-c-format -msgid "Until now, the result set column names are assumed to be the same as the column names specified in the mapping document. This can be problematic for SQL queries that join multiple tables, since the same column names can appear in more than one table." -msgstr "到目前为止,结果集字段名被假定为和映射文件中指定的的字段名是一致的。假若 SQL 查询连接了多个表,同一个字段名可能在多个表中出现多次,这就会造成问题。 " +msgid "" +"Until now, the result set column names are assumed to be the same as the " +"column names specified in the mapping document. This can be problematic for " +"SQL queries that join multiple tables, since the same column names can " +"appear in more than one table." +msgstr "" +"到目前为止,结果集字段名被假定为和映射文件中指定的的字段名是一致的。假若 SQL " +"查询连接了多个表,同一个字段名可能在多个表中出现多次,这就会造成问题。 " #. Tag: para +#: query_sql.xml:180 #, no-c-format -msgid "Column alias injection is needed in the following query (which most likely will fail):" +msgid "" +"Column alias injection is needed in the following query (which most likely " +"will fail):" msgstr "下面的查询中需要使用字段别名注射(这个例子本身会失败):" -#. Tag: para -#, no-c-format -msgid "The query was intended to return two Cat instances per row: a cat and its mother. The query will, however, fail because there is a conflict of names; the instances are mapped to the same column names. Also, on some databases the returned column aliases will most likely be on the form \"c.ID\", \"c.NAME\", etc. which are not equal to the columns specified in the mappings (\"ID\" and \"NAME\")." -msgstr "这个查询的本意是希望每行返回两个 Cat 实例,一个是 cat,另一个是它的妈妈。但是因为它们的字段名被映射为相同的,而且在某些数据库中,返回的字段别名是“c.ID”,\"c.NAME\" 这样的形式,而它们和在映射文件中的名字(\"ID\" 和 \"NAME\")不匹配,这就会造成失败。 " +#. Tag: programlisting +#: query_sql.xml:183 +#, fuzzy, no-c-format +msgid "" +"sess.createSQLQuery(\"SELECT c.*, m.* FROM CATS c, CATS m WHERE c.MOTHER_ID " +"= c.ID\")\n" +" .addEntity(\"cat\", Cat.class)\n" +" .addEntity(\"mother\", Cat.class)" +msgstr "" +"sess.createSQLQuery(\"SELECT c.*, m.* FROM CATS c, CATS m WHERE c.MOTHER_ID " +"= c.ID\")\n" +" .addEntity(\"cat\", Cat.class)\n" +" .addEntity(\"mother\", Cat.class)" #. Tag: para +#: query_sql.xml:185 +#, no-c-format +msgid "" +"The query was intended to return two Cat instances per row: a cat and its " +"mother. The query will, however, fail because there is a conflict of names; " +"the instances are mapped to the same column names. Also, on some databases " +"the returned column aliases will most likely be on the form \"c.ID\", \"c." +"NAME\", etc. which are not equal to the columns specified in the mappings " +"(\"ID\" and \"NAME\")." +msgstr "" +"这个查询的本意是希望每行返回两个 Cat 实例,一个是 cat,另一个是它的妈妈。但是" +"因为它们的字段名被映射为相同的,而且在某些数据库中,返回的字段别名是“c.ID”," +"\"c.NAME\" 这样的形式,而它们和在映射文件中的名字(\"ID\" 和 \"NAME\")不匹" +"配,这就会造成失败。 " + +#. Tag: para +#: query_sql.xml:192 #, no-c-format msgid "The following form is not vulnerable to column name duplication:" msgstr "下面的形式可以解决字段名重复:" +#. Tag: programlisting +#: query_sql.xml:195 +#, fuzzy, no-c-format +msgid "" +"sess.createSQLQuery(\"SELECT {cat.*}, {mother.*} FROM CATS c, CATS m WHERE " +"c.MOTHER_ID = c.ID\")\n" +" .addEntity(\"cat\", Cat.class)\n" +" .addEntity(\"mother\", Cat.class)" +msgstr "" +"sess.createSQLQuery(\"SELECT {cat.*}, {mother.*} FROM CATS c, CATS m WHERE " +"c.MOTHER_ID = c.ID\")\n" +" .addEntity(\"cat\", Cat.class)\n" +" .addEntity(\"mother\", Cat.class)" + #. Tag: para +#: query_sql.xml:201 #, no-c-format -msgid "the SQL query string, with placeholders for Hibernate to inject column aliases" +msgid "" +"the SQL query string, with placeholders for Hibernate to inject column " +"aliases" msgstr "SQL 查询语句,其中包含占位附来让 Hibernate 注射字段别名" #. Tag: para +#: query_sql.xml:206 #, no-c-format msgid "the entities returned by the query" msgstr "查询返回的实体" #. Tag: para +#: query_sql.xml:210 #, no-c-format -msgid "The {cat.*} and {mother.*} notation used above is a shorthand for \"all properties\". Alternatively, you can list the columns explicitly, but even in this case Hibernate injects the SQL column aliases for each property. The placeholder for a column alias is just the property name qualified by the table alias. In the following example, you retrieve Cats and their mothers from a different table (cat_log) to the one declared in the mapping metadata. You can even use the property aliases in the where clause." -msgstr "上面使用的 {cat.*} 和 {mother.*} 标记是作为“所有属性”的简写形式出现的。当然你也可以明确地罗列出字段名,但在这个例子里面我们让 Hibernate 来为每个属性注射 SQL 字段别名。字段别名的占位符是属性名加上表别名的前缀。在下面的例子中,我们从另外一个表(cat_log)中通过映射元数据中的指定获取 Cat 和它的妈妈。注意,要是我们愿意,我们甚至可以在 where 子句中使用属性别名。 " +msgid "" +"The {cat.*} and {mother.*} notation used above is a shorthand for \"all " +"properties\". Alternatively, you can list the columns explicitly, but even " +"in this case Hibernate injects the SQL column aliases for each property. The " +"placeholder for a column alias is just the property name qualified by the " +"table alias. In the following example, you retrieve Cats and their mothers " +"from a different table (cat_log) to the one declared in the mapping " +"metadata. You can even use the property aliases in the where clause." +msgstr "" +"上面使用的 {cat.*} 和 {mother.*} 标记是作为“所有属性”的简写形式出现的。当然你" +"也可以明确地罗列出字段名,但在这个例子里面我们让 Hibernate 来为每个属性注射 " +"SQL 字段别名。字段别名的占位符是属性名加上表别名的前缀。在下面的例子中,我们" +"从另外一个表(cat_log)中通过映射元数据中的指定获取 Cat 和它的妈妈。注意,要" +"是我们愿意,我们甚至可以在 where 子句中使用属性别名。 " + +#. Tag: programlisting +#: query_sql.xml:219 +#, fuzzy, no-c-format +msgid "" +"String sql = \"SELECT ID as {c.id}, NAME as {c.name}, \" +\n" +" \"BIRTHDATE as {c.birthDate}, MOTHER_ID as {c.mother}, {mother.*} " +"\" +\n" +" \"FROM CAT_LOG c, CAT_LOG m WHERE {c.mother} = c.ID\";\n" +"\n" +"List loggedCats = sess.createSQLQuery(sql)\n" +" .addEntity(\"cat\", Cat.class)\n" +" .addEntity(\"mother\", Cat.class).list()" +msgstr "" +"String sql = \"SELECT ID as {c.id}, NAME as {c.name}, \" + \n" +" \"BIRTHDATE as {c.birthDate}, MOTHER_ID as {c.mother}, {mother.*} " +"\" +\n" +" \"FROM CAT_LOG c, CAT_LOG m WHERE {c.mother} = c.ID\";\n" +"\n" +"List loggedCats = sess.createSQLQuery(sql)\n" +" .addEntity(\"cat\", Cat.class)\n" +" .addEntity(\"mother\", Cat.class).list()" #. Tag: title +#: query_sql.xml:222 #, no-c-format msgid "Alias and property references" msgstr "别名和属性引用(Alias and property references)" #. Tag: para +#: query_sql.xml:224 #, no-c-format -msgid "In most cases the above alias injection is needed. For queries relating to more complex mappings, like composite properties, inheritance discriminators, collections etc., you can use specific aliases that allow Hibernate to inject the proper aliases." -msgstr "大多数情况下,都需要上面的属性注射,但在使用更加复杂的映射,比如复合属性、通过标识符构造继承树,以及集合类等等情况下,也有一些特别的别名,来允许 Hibernate 注入合适的别名。 " +msgid "" +"In most cases the above alias injection is needed. For queries relating to " +"more complex mappings, like composite properties, inheritance " +"discriminators, collections etc., you can use specific aliases that allow " +"Hibernate to inject the proper aliases." +msgstr "" +"大多数情况下,都需要上面的属性注射,但在使用更加复杂的映射,比如复合属性、通" +"过标识符构造继承树,以及集合类等等情况下,也有一些特别的别名,来允许 " +"Hibernate 注入合适的别名。 " #. Tag: para +#: query_sql.xml:229 #, no-c-format -msgid "The following table shows the different ways you can use the alias injection. Please note that the alias names in the result are simply examples; each alias will have a unique and probably different name when used." -msgstr "下表列出了使用别名注射参数的不同可能性。注意:下面结果中的别名只是示例,实用时每个别名需要唯一并且不同的名字。 " +msgid "" +"The following table shows the different ways you can use the alias " +"injection. Please note that the alias names in the result are simply " +"examples; each alias will have a unique and probably different name when " +"used." +msgstr "" +"下表列出了使用别名注射参数的不同可能性。注意:下面结果中的别名只是示例,实用" +"时每个别名需要唯一并且不同的名字。 " #. Tag: title +#: query_sql.xml:235 #, no-c-format msgid "Alias injection names" msgstr "别名注射(alias injection names)" #. Tag: entry +#: query_sql.xml:246 #, no-c-format msgid "Description" msgstr "描述" #. Tag: entry +#: query_sql.xml:248 #, no-c-format msgid "Syntax" msgstr "语法" #. Tag: entry +#: query_sql.xml:250 #, no-c-format msgid "Example" msgstr "示例" #. Tag: entry +#: query_sql.xml:256 #, no-c-format msgid "A simple property" msgstr "简单属性" -#. Tag: entry -#, no-c-format -msgid "{[aliasname].[propertyname]" +#. Tag: literal +#: query_sql.xml:258 +#, fuzzy, no-c-format +msgid "{[aliasname].[propertyname]" msgstr "{[aliasname].[propertyname] " -#. Tag: entry -#, no-c-format -msgid "A_NAME as {item.name}" +#. Tag: literal +#: query_sql.xml:260 +#, fuzzy, no-c-format +msgid "A_NAME as {item.name}" msgstr "A_NAME as {item.name}" #. Tag: entry +#: query_sql.xml:264 #, no-c-format msgid "A composite property" msgstr "复合属性" -#. Tag: entry -#, no-c-format -msgid "{[aliasname].[componentname].[propertyname]}" +#. Tag: literal +#: query_sql.xml:266 +#, fuzzy, no-c-format +msgid "{[aliasname].[componentname].[propertyname]}" msgstr "{[aliasname].[componentname].[propertyname]} " -#. Tag: entry -#, no-c-format -msgid "CURRENCY as {item.amount.currency}, VALUE as {item.amount.value}" -msgstr "CURRENCY as {item.amount.currency}, VALUE as {item.amount.value} " +#. Tag: literal +#: query_sql.xml:268 +#, fuzzy, no-c-format +msgid "CURRENCY as {item.amount.currency}, VALUE as {item.amount.value}" +msgstr "" +"CURRENCY as {item.amount.currency}, VALUE as {item.amount.value} " #. Tag: entry +#: query_sql.xml:273 #, no-c-format msgid "Discriminator of an entity" msgstr "实体辨别器(Discriminator of an entity)" -#. Tag: entry -#, no-c-format -msgid "{[aliasname].class}" +#. Tag: literal +#: query_sql.xml:275 +#, fuzzy, no-c-format +msgid "{[aliasname].class}" msgstr "{[aliasname].class}" -#. Tag: entry -#, no-c-format -msgid "DISC as {item.class}" +#. Tag: literal +#: query_sql.xml:277 +#, fuzzy, no-c-format +msgid "DISC as {item.class}" msgstr "DISC as {item.class}" #. Tag: entry +#: query_sql.xml:281 #, no-c-format msgid "All properties of an entity" msgstr "实体的所有属性" -#. Tag: entry -#, no-c-format -msgid "{[aliasname].*}" +#. Tag: literal +#: query_sql.xml:283 query_sql.xml:331 +#, fuzzy, no-c-format +msgid "{[aliasname].*}" msgstr "{[aliasname].*}" -#. Tag: entry +#. Tag: literal +#: query_sql.xml:285 #, no-c-format -msgid "{item.*}" -msgstr "{item.*}" +msgid "{item.*}" +msgstr "{item.*}" #. Tag: entry +#: query_sql.xml:289 #, no-c-format msgid "A collection key" msgstr "集合键(collection key)" -#. Tag: entry -#, no-c-format -msgid "{[aliasname].key}" +#. Tag: literal +#: query_sql.xml:291 +#, fuzzy, no-c-format +msgid "{[aliasname].key}" msgstr "{[aliasname].key}" -#. Tag: entry -#, no-c-format -msgid "ORGID as {coll.key}" +#. Tag: literal +#: query_sql.xml:293 +#, fuzzy, no-c-format +msgid "ORGID as {coll.key}" msgstr "ORGID as {coll.key}" #. Tag: entry +#: query_sql.xml:297 #, no-c-format msgid "The id of an collection" msgstr "集合 id" -#. Tag: entry -#, no-c-format -msgid "{[aliasname].id}" +#. Tag: literal +#: query_sql.xml:299 +#, fuzzy, no-c-format +msgid "{[aliasname].id}" msgstr "{[aliasname].id}" -#. Tag: entry -#, no-c-format -msgid "EMPID as {coll.id}" +#. Tag: literal +#: query_sql.xml:301 +#, fuzzy, no-c-format +msgid "EMPID as {coll.id}" msgstr "EMPID as {coll.id}" #. Tag: entry +#: query_sql.xml:305 #, no-c-format msgid "The element of an collection" msgstr "集合元素" -#. Tag: entry -#, no-c-format -msgid "{[aliasname].element}" +#. Tag: literal +#: query_sql.xml:307 +#, fuzzy, no-c-format +msgid "{[aliasname].element}" msgstr "{[aliasname].element}" -#. Tag: entry -#, no-c-format -msgid "XID as {coll.element}" +#. Tag: literal +#: query_sql.xml:309 +#, fuzzy, no-c-format +msgid "XID as {coll.element}" msgstr "XID as {coll.element}" #. Tag: entry +#: query_sql.xml:313 #, no-c-format msgid "property of the element in the collection" msgstr "集合元素的属性 " -#. Tag: entry -#, no-c-format -msgid "{[aliasname].element.[propertyname]}" +#. Tag: literal +#: query_sql.xml:315 +#, fuzzy, no-c-format +msgid "{[aliasname].element.[propertyname]}" msgstr "{[aliasname].element.[propertyname]} " -#. Tag: entry -#, no-c-format -msgid "NAME as {coll.element.name}" +#. Tag: literal +#: query_sql.xml:317 +#, fuzzy, no-c-format +msgid "NAME as {coll.element.name}" msgstr "NAME as {coll.element.name}" #. Tag: entry +#: query_sql.xml:321 #, no-c-format msgid "All properties of the element in the collection" msgstr "集合元素的所有属性" -#. Tag: entry -#, no-c-format -msgid "{[aliasname].element.*}" +#. Tag: literal +#: query_sql.xml:323 +#, fuzzy, no-c-format +msgid "{[aliasname].element.*}" msgstr "{[aliasname].element.*}" -#. Tag: entry -#, no-c-format -msgid "{coll.element.*}" -msgstr "{coll.element.*}" +#. Tag: literal +#: query_sql.xml:325 +#, fuzzy, no-c-format +msgid "{coll.element.*}" +msgstr "{coll.*}" #. Tag: entry +#: query_sql.xml:329 #, no-c-format msgid "All properties of the collection" msgstr "集合的所有属性 " -#. Tag: entry +#. Tag: literal +#: query_sql.xml:333 #, no-c-format -msgid "{coll.*}" -msgstr "{coll.*}" +msgid "{coll.*}" +msgstr "{coll.*}" #. Tag: title +#: query_sql.xml:342 #, no-c-format msgid "Returning non-managed entities" msgstr "返回非受管实体(Returning non-managed entities)" #. Tag: para +#: query_sql.xml:344 #, no-c-format -msgid "It is possible to apply a ResultTransformer to native SQL queries, allowing it to return non-managed entities." -msgstr "可以对原生 sql 查询使用 ResultTransformer。这会返回不受 Hibernate 管理的实体。 " +msgid "" +"It is possible to apply a ResultTransformer to native SQL queries, allowing " +"it to return non-managed entities." +msgstr "" +"可以对原生 sql 查询使用 ResultTransformer。这会返回不受 Hibernate 管理的实" +"体。 " + +#. Tag: programlisting +#: query_sql.xml:347 +#, fuzzy, no-c-format +msgid "" +"sess.createSQLQuery(\"SELECT NAME, BIRTHDATE FROM CATS\")\n" +" .setResultTransformer(Transformers.aliasToBean(CatDTO.class))" +msgstr "" +"sess.createSQLQuery(\"SELECT NAME, BIRTHDATE FROM CATS\")\n" +" .setResultTransformer(Transformers.aliasToBean(CatDTO.class))" #. Tag: para +#: query_sql.xml:357 #, no-c-format msgid "a result transformer" msgstr "结果转换器(result transformer)" #. Tag: para +#: query_sql.xml:361 #, no-c-format -msgid "The above query will return a list of CatDTO which has been instantiated and injected the values of NAME and BIRTHNAME into its corresponding properties or fields." -msgstr "上面的查询将会返回 CatDTO 的列表,它将被实例化并且将 NAME 和 BIRTHDAY 的值注射入对应的属性或者字段。" +msgid "" +"The above query will return a list of CatDTO which has " +"been instantiated and injected the values of NAME and BIRTHNAME into its " +"corresponding properties or fields." +msgstr "" +"上面的查询将会返回 CatDTO 的列表,它将被实例化并且将 NAME " +"和 BIRTHDAY 的值注射入对应的属性或者字段。" #. Tag: title +#: query_sql.xml:367 #, no-c-format msgid "Handling inheritance" msgstr "处理继承(Handling inheritance)" #. Tag: para +#: query_sql.xml:369 #, no-c-format -msgid "Native SQL queries which query for entities that are mapped as part of an inheritance must include all properties for the baseclass and all its subclasses." -msgstr "原生 SQL 查询假若其查询结果实体是继承树中的一部分,它必须包含基类和所有子类的所有属性。 " +msgid "" +"Native SQL queries which query for entities that are mapped as part of an " +"inheritance must include all properties for the baseclass and all its " +"subclasses." +msgstr "" +"原生 SQL 查询假若其查询结果实体是继承树中的一部分,它必须包含基类和所有子类的" +"所有属性。 " #. Tag: title +#: query_sql.xml:375 #, no-c-format msgid "Parameters" msgstr "参数(Parameters)" #. Tag: para +#: query_sql.xml:377 #, no-c-format msgid "Native SQL queries support positional as well as named parameters:" msgstr "原生查询支持位置参数和命名参数: " +#. Tag: programlisting +#: query_sql.xml:380 +#, fuzzy, no-c-format +msgid "" +"Query query = sess.createSQLQuery(\"SELECT * FROM CATS WHERE NAME like ?\")." +"addEntity(Cat.class);\n" +"List pusList = query.setString(0, \"Pus%\").list();\n" +" \n" +"query = sess.createSQLQuery(\"SELECT * FROM CATS WHERE NAME like :name\")." +"addEntity(Cat.class);\n" +"List pusList = query.setString(\"name\", \"Pus%\").list();" +msgstr "" +"Query query = sess.createSQLQuery(\"SELECT * FROM CATS WHERE NAME like ?\")." +"addEntity(Cat.class);\n" +"List pusList = query.setString(0, \"Pus%\").list();\n" +" \n" +"query = sess.createSQLQuery(\"SELECT * FROM CATS WHERE NAME like :name\")." +"addEntity(Cat.class);\n" +"List pusList = query.setString(\"name\", \"Pus%\").list();" + #. Tag: title +#: query_sql.xml:385 #, no-c-format msgid "Named SQL queries" msgstr "命名 SQL 查询" #. Tag: para +#: query_sql.xml:387 +#, fuzzy, no-c-format +msgid "" +"Named SQL queries can also be defined in the mapping document and called in " +"exactly the same way as a named HQL query (see ). In this case, you do not " +"need to call addEntity()." +msgstr "" +"可以在映射文档中定义查询的名字,然后就可以象调用一个命名的 HQL 查询一样直接调" +"用命名 SQL 查询.在这种情况下,我们 需要调用 " +"addEntity() 方法。 " + +#. Tag: title +#: query_sql.xml:394 #, no-c-format -msgid "Named SQL queries can be defined in the mapping document and called in exactly the same way as a named HQL query. In this case, you do not need to call addEntity()." -msgstr "可以在映射文档中定义查询的名字,然后就可以象调用一个命名的 HQL 查询一样直接调用命名 SQL 查询.在这种情况下,我们 需要调用 addEntity() 方法。 " +msgid "Named sql query using the <sql-query> maping element" +msgstr "" + +#. Tag: programlisting +#: query_sql.xml:397 +#, fuzzy, no-c-format +msgid "" +"<sql-query name=\"persons\">\n" +" <return alias=\"person\" class=\"eg.Person\"/>\n" +" SELECT person.NAME AS {person.name},\n" +" person.AGE AS {person.age},\n" +" person.SEX AS {person.sex}\n" +" FROM PERSON person\n" +" WHERE person.NAME LIKE :namePattern\n" +"</sql-query>" +msgstr "" +"<sql-query name=\"persons\">\n" +" <return alias=\"person\" class=\"eg.Person\"/>\n" +" SELECT person.NAME AS {person.name},\n" +" person.AGE AS {person.age},\n" +" person.SEX AS {person.sex}\n" +" FROM PERSON person\n" +" WHERE person.NAME LIKE :namePattern\n" +"</sql-query>" + +#. Tag: title +#: query_sql.xml:401 +#, no-c-format +msgid "Execution of a named query" +msgstr "" + +#. Tag: programlisting +#: query_sql.xml:403 +#, fuzzy, no-c-format +msgid "" +"List people = sess.getNamedQuery(\"persons\")\n" +" .setString(\"namePattern\", namePattern)\n" +" .setMaxResults(50)\n" +" .list();" +msgstr "" +"List people = sess.getNamedQuery(\"persons\")\n" +" .setString(\"namePattern\", namePattern)\n" +" .setMaxResults(50)\n" +" .list();" #. Tag: para +#: query_sql.xml:406 #, no-c-format -msgid "The <return-join> element is use to join associations and the <load-collection> element is used to define queries which initialize collections," -msgstr "<return-join><load-collection> 元素是用来连接关联以及将查询定义为预先初始化各个集合的。 " +msgid "" +"The <return-join> element is use to join " +"associations and the <load-collection> element is " +"used to define queries which initialize collections," +msgstr "" +"<return-join><load-collection> 元素是用来连接关联以及将查询定义为预先初始化各个集合的。 " + +#. Tag: title +#: query_sql.xml:411 +#, no-c-format +msgid "Named sql query with association" +msgstr "" + +#. Tag: programlisting +#: query_sql.xml:413 +#, fuzzy, no-c-format +msgid "" +"<sql-query name=\"personsWith\">\n" +" <return alias=\"person\" class=\"eg.Person\"/>\n" +" <return-join alias=\"address\" property=\"person.mailingAddress\"/" +">\n" +" SELECT person.NAME AS {person.name},\n" +" person.AGE AS {person.age},\n" +" person.SEX AS {person.sex},\n" +" address.STREET AS {address.street},\n" +" address.CITY AS {address.city},\n" +" address.STATE AS {address.state},\n" +" address.ZIP AS {address.zip}\n" +" FROM PERSON person\n" +" JOIN ADDRESS address\n" +" ON person.ID = address.PERSON_ID AND address.TYPE='MAILING'\n" +" WHERE person.NAME LIKE :namePattern\n" +"</sql-query>" +msgstr "" +"<sql-query name=\"personsWith\">\n" +" <return alias=\"person\" class=\"eg.Person\"/>\n" +" <return-join alias=\"address\" property=\"person.mailingAddress\"/" +">\n" +" SELECT person.NAME AS {person.name},\n" +" person.AGE AS {person.age},\n" +" person.SEX AS {person.sex},\n" +" adddress.STREET AS {address.street},\n" +" adddress.CITY AS {address.city},\n" +" adddress.STATE AS {address.state},\n" +" adddress.ZIP AS {address.zip}\n" +" FROM PERSON person\n" +" JOIN ADDRESS adddress\n" +" ON person.ID = address.PERSON_ID AND address.TYPE='MAILING'\n" +" WHERE person.NAME LIKE :namePattern\n" +"</sql-query>" #. Tag: para +#: query_sql.xml:416 #, no-c-format -msgid "A named SQL query may return a scalar value. You must declare the column alias and Hibernate type using the <return-scalar> element:" -msgstr "一个命名查询可能会返回一个标量值。你必须使用 <return-scalar> 元素来指定字段的别名和 Hibernate 类型:" +msgid "" +"A named SQL query may return a scalar value. You must declare the column " +"alias and Hibernate type using the <return-scalar> " +"element:" +msgstr "" +"一个命名查询可能会返回一个标量值。你必须使用 <return-scalar> 元素来指定字段的别名和 Hibernate 类型:" + +#. Tag: title +#: query_sql.xml:421 +#, no-c-format +msgid "Named query returning a scalar" +msgstr "" + +#. Tag: programlisting +#: query_sql.xml:423 +#, fuzzy, no-c-format +msgid "" +"<sql-query name=\"mySqlQuery\">\n" +" <return-scalar column=\"name\" type=\"string\"/>\n" +" <return-scalar column=\"age\" type=\"long\"/>\n" +" SELECT p.NAME AS name, \n" +" p.AGE AS age,\n" +" FROM PERSON p WHERE p.NAME LIKE 'Hiber%'\n" +"</sql-query>" +msgstr "" +"<sql-query name=\"mySqlQuery\">\n" +" <return-scalar column=\"name\" type=\"string\"/>\n" +" <return-scalar column=\"age\" type=\"long\"/>\n" +" SELECT p.NAME AS name,\n" +" p.AGE AS age,\n" +" FROM PERSON p WHERE p.NAME LIKE 'Hiber%'\n" +"</sql-query>" #. Tag: para +#: query_sql.xml:426 #, no-c-format -msgid "You can externalize the resultset mapping information in a <resultset> element which will allow you to either reuse them across several named queries or through the setResultSetMapping() API." -msgstr "你可以把结果集映射的信息放在外部的 <resultset> 元素中,这样就可以在多个命名查询间,或者通过 setResultSetMapping() API 来访问。 " +msgid "" +"You can externalize the resultset mapping information in a <" +"resultset> element which will allow you to either reuse them " +"across several named queries or through the setResultSetMapping() API." +msgstr "" +"你可以把结果集映射的信息放在外部的 <resultset> 元素" +"中,这样就可以在多个命名查询间,或者通过 setResultSetMapping() API 来访问。 " + +#. Tag: title +#: query_sql.xml:432 +#, no-c-format +msgid "<resultset> mapping used to externalize mapping information" +msgstr "" + +#. Tag: programlisting +#: query_sql.xml:435 +#, fuzzy, no-c-format +msgid "" +"<resultset name=\"personAddress\">\n" +" <return alias=\"person\" class=\"eg.Person\"/>\n" +" <return-join alias=\"address\" property=\"person.mailingAddress\"/" +">\n" +"</resultset>\n" +"\n" +"<sql-query name=\"personsWith\" resultset-ref=\"personAddress\">\n" +" SELECT person.NAME AS {person.name},\n" +" person.AGE AS {person.age},\n" +" person.SEX AS {person.sex},\n" +" address.STREET AS {address.street},\n" +" address.CITY AS {address.city},\n" +" address.STATE AS {address.state},\n" +" address.ZIP AS {address.zip}\n" +" FROM PERSON person\n" +" JOIN ADDRESS address\n" +" ON person.ID = address.PERSON_ID AND address.TYPE='MAILING'\n" +" WHERE person.NAME LIKE :namePattern\n" +"</sql-query>" +msgstr "" +"<resultset name=\"personAddress\">\n" +" <return alias=\"person\" class=\"eg.Person\"/>\n" +" <return-join alias=\"address\" property=\"person.mailingAddress\"/" +">\n" +"</resultset>\n" +"\n" +"<sql-query name=\"personsWith\" resultset-ref=\"personAddress\">\n" +" SELECT person.NAME AS {person.name},\n" +" person.AGE AS {person.age},\n" +" person.SEX AS {person.sex},\n" +" adddress.STREET AS {address.street},\n" +" adddress.CITY AS {address.city},\n" +" adddress.STATE AS {address.state},\n" +" adddress.ZIP AS {address.zip}\n" +" FROM PERSON person\n" +" JOIN ADDRESS adddress\n" +" ON person.ID = address.PERSON_ID AND address.TYPE='MAILING'\n" +" WHERE person.NAME LIKE :namePattern\n" +"</sql-query>" #. Tag: para +#: query_sql.xml:438 #, no-c-format -msgid "You can, alternatively, use the resultset mapping information in your hbm files directly in java code." +msgid "" +"You can, alternatively, use the resultset mapping information in your hbm " +"files directly in java code." msgstr "另外,你可以在 java 代码中直接使用 hbm 文件中的结果集定义信息。 " #. Tag: title +#: query_sql.xml:442 +#, no-c-format +msgid "Programmatically specifying the result mapping information" +msgstr "" + +#. Tag: programlisting +#: query_sql.xml:445 +#, fuzzy, no-c-format +msgid "" +"List cats = sess.createSQLQuery(\n" +" \"select {cat.*}, {kitten.*} from cats cat, cats kitten where kitten." +"mother = cat.id\"\n" +" )\n" +" .setResultSetMapping(\"catAndKitten\")\n" +" .list();" +msgstr "" +"List cats = sess.createSQLQuery(\n" +" \"select {cat.*}, {kitten.*} from cats cat, cats kitten where kitten." +"mother = cat.id\"\n" +" )\n" +" .setResultSetMapping(\"catAndKitten\")\n" +" .list();" + +#. Tag: para +#: query_sql.xml:448 +#, no-c-format +msgid "" +"So far we have only looked at externalizing SQL queries using Hibernate " +"mapping files. The same concept is also available with anntations and is " +"called named native queries. You can use @NamedNativeQuery (@NamedNativeQueries) in conjunction with " +"@SqlResultSetMapping (@SqlResultSetMappings). Like @NamedQuery, " +"@NamedNativeQuery and @SqlResultSetMapping can be defined at class level, but their scope is global to the " +"application. Lets look at a view examples." +msgstr "" + +#. Tag: para +#: query_sql.xml:460 +#, no-c-format +msgid "" +"shows how a resultSetMapping parameter is defined in " +"@NamedNativeQuery. It represents the name of a defined " +"@SqlResultSetMapping. The resultset mapping declares the " +"entities retrieved by this native query. Each field of the entity is bound " +"to an SQL alias (or column name). All fields of the entity including the " +"ones of subclasses and the foreign key columns of related entities have to " +"be present in the SQL query. Field definitions are optional provided that " +"they map to the same column name as the one declared on the class property. " +"In the example 2 entities, Night and Area, are returned and each property is declared and associated to a " +"column name, actually the column name retrieved by the query." +msgstr "" + +#. Tag: para +#: query_sql.xml:475 +#, no-c-format +msgid "" +"In the result set " +"mapping is implicit. We only describe the entity class of the result set " +"mapping. The property / column mappings is done using the entity mapping " +"values. In this case the model property is bound to the model_txt column." +msgstr "" + +#. Tag: para +#: query_sql.xml:481 +#, no-c-format +msgid "" +"Finally, if the association to a related entity involve a composite primary " +"key, a @FieldResult element should be used for each " +"foreign key column. The @FieldResult name is composed of " +"the property name for the relationship, followed by a dot (\".\"), followed " +"by the name or the field or property of the primary key. This can be seen in " +"." +msgstr "" + +#. Tag: title +#: query_sql.xml:490 +#, no-c-format +msgid "" +"Named SQL query using @NamedNativeQuery together with " +"@SqlResultSetMapping" +msgstr "" + +#. Tag: programlisting +#: query_sql.xml:493 +#, no-c-format +msgid "" +"@NamedNativeQuery(name=\"night&area\", query=\"select night.id nid, " +"night.night_duration, \"\n" +" + \" night.night_date, area.id aid, night.area_id, area.name \"\n" +" + \"from Night night, Area area where night.area_id = area.id\", \n" +" resultSetMapping=\"joinMapping\")\n" +"@SqlResultSetMapping(name=\"joinMapping\", entities={\n" +" @EntityResult(entityClass=Night.class, fields = {\n" +" @FieldResult(name=\"id\", column=\"nid\"),\n" +" @FieldResult(name=\"duration\", column=\"night_duration\"),\n" +" @FieldResult(name=\"date\", column=\"night_date\"),\n" +" @FieldResult(name=\"area\", column=\"area_id\"),\n" +" discriminatorColumn=\"disc\"\n" +" }),\n" +" @EntityResult(entityClass=org.hibernate.test.annotations.query.Area." +"class, fields = {\n" +" @FieldResult(name=\"id\", column=\"aid\"),\n" +" @FieldResult(name=\"name\", column=\"name\")\n" +" })\n" +" }\n" +")" +msgstr "" + +#. Tag: title +#: query_sql.xml:497 +#, no-c-format +msgid "Implicit result set mapping" +msgstr "" + +#. Tag: programlisting +#: query_sql.xml:499 +#, no-c-format +msgid "" +"@Entity\n" +"@SqlResultSetMapping(name=\"implicit\",\n" +" entities=@EntityResult(entityClass=SpaceShip.class))\n" +"@NamedNativeQuery(name=\"implicitSample\", \n" +" query=\"select * from SpaceShip\", \n" +" resultSetMapping=\"implicit\")\n" +"public class SpaceShip {\n" +" private String name;\n" +" private String model;\n" +" private double speed;\n" +"\n" +" @Id\n" +" public String getName() {\n" +" return name;\n" +" }\n" +"\n" +" public void setName(String name) {\n" +" this.name = name;\n" +" }\n" +"\n" +" @Column(name=\"model_txt\")\n" +" public String getModel() {\n" +" return model;\n" +" }\n" +"\n" +" public void setModel(String model) {\n" +" this.model = model;\n" +" }\n" +"\n" +" public double getSpeed() {\n" +" return speed;\n" +" }\n" +"\n" +" public void setSpeed(double speed) {\n" +" this.speed = speed;\n" +" }\n" +"}" +msgstr "" + +#. Tag: title +#: query_sql.xml:503 +#, no-c-format +msgid "Using dot notation in @FieldResult for specifying associations" +msgstr "" + +#. Tag: programlisting +#: query_sql.xml:506 +#, no-c-format +msgid "" +"@Entity\n" +"@SqlResultSetMapping(name=\"compositekey\",\n" +" entities=@EntityResult(entityClass=SpaceShip.class,\n" +" fields = {\n" +" @FieldResult(name=\"name\", column = \"name\"),\n" +" @FieldResult(name=\"model\", column = \"model\"),\n" +" @FieldResult(name=\"speed\", column = \"speed\"),\n" +" @FieldResult(name=\"captain.firstname\", column = " +"\"firstn\"),\n" +" @FieldResult(name=\"captain.lastname\", column = \"lastn" +"\"),\n" +" @FieldResult(name=\"dimensions.length\", column = " +"\"length\"),\n" +" @FieldResult(name=\"dimensions.width\", column = \"width" +"\")\n" +" }),\n" +" columns = { @ColumnResult(name = \"surface\"),\n" +" @ColumnResult(name = \"volume\") } )\n" +"\n" +"@NamedNativeQuery(name=\"compositekey\",\n" +" query=\"select name, model, speed, lname as lastn, fname as firstn, " +"length, width, length * width as surface from SpaceShip\", \n" +" resultSetMapping=\"compositekey\")\n" +"} )\n" +"public class SpaceShip {\n" +" private String name;\n" +" private String model;\n" +" private double speed;\n" +" private Captain captain;\n" +" private Dimensions dimensions;\n" +"\n" +" @Id\n" +" public String getName() {\n" +" return name;\n" +" }\n" +"\n" +" public void setName(String name) {\n" +" this.name = name;\n" +" }\n" +"\n" +" @ManyToOne(fetch= FetchType.LAZY)\n" +" @JoinColumns( {\n" +" @JoinColumn(name=\"fname\", referencedColumnName = \"firstname" +"\"),\n" +" @JoinColumn(name=\"lname\", referencedColumnName = \"lastname" +"\")\n" +" } )\n" +" public Captain getCaptain() {\n" +" return captain;\n" +" }\n" +"\n" +" public void setCaptain(Captain captain) {\n" +" this.captain = captain;\n" +" }\n" +"\n" +" public String getModel() {\n" +" return model;\n" +" }\n" +"\n" +" public void setModel(String model) {\n" +" this.model = model;\n" +" }\n" +"\n" +" public double getSpeed() {\n" +" return speed;\n" +" }\n" +"\n" +" public void setSpeed(double speed) {\n" +" this.speed = speed;\n" +" }\n" +"\n" +" public Dimensions getDimensions() {\n" +" return dimensions;\n" +" }\n" +"\n" +" public void setDimensions(Dimensions dimensions) {\n" +" this.dimensions = dimensions;\n" +" }\n" +"}\n" +"\n" +"@Entity\n" +"@IdClass(Identity.class)\n" +"public class Captain implements Serializable {\n" +" private String firstname;\n" +" private String lastname;\n" +"\n" +" @Id\n" +" public String getFirstname() {\n" +" return firstname;\n" +" }\n" +"\n" +" public void setFirstname(String firstname) {\n" +" this.firstname = firstname;\n" +" }\n" +"\n" +" @Id\n" +" public String getLastname() {\n" +" return lastname;\n" +" }\n" +"\n" +" public void setLastname(String lastname) {\n" +" this.lastname = lastname;\n" +" }\n" +"}" +msgstr "" + +#. Tag: para +#: query_sql.xml:510 +#, no-c-format +msgid "" +"If you retrieve a single entity using the default mapping, you can specify " +"the resultClass attribute instead of " +"resultSetMapping:" +msgstr "" + +#. Tag: programlisting +#: query_sql.xml:514 +#, no-c-format +msgid "" +"@NamedNativeQuery(name=\"implicitSample\", query=\"select * from SpaceShip" +"\", resultClass=SpaceShip.class)\n" +"public class SpaceShip {" +msgstr "" + +#. Tag: para +#: query_sql.xml:517 +#, no-c-format +msgid "" +"In some of your native queries, you'll have to return scalar values, for " +"example when building report queries. You can map them in the " +"@SqlResultsetMapping through @ColumnResult. You actually can even mix, entities and scalar returns in the same " +"native query (this is probably not that common though)." +msgstr "" + +#. Tag: title +#: query_sql.xml:525 +#, no-c-format +msgid "Scalar values via @ColumnResult" +msgstr "" + +#. Tag: programlisting +#: query_sql.xml:527 +#, no-c-format +msgid "" +"@SqlResultSetMapping(name=\"scalar\", columns=@ColumnResult(name=\"dimension" +"\"))\n" +"@NamedNativeQuery(name=\"scalar\", query=\"select length*width as dimension " +"from SpaceShip\", resultSetMapping=\"scalar\")" +msgstr "" + +#. Tag: para +#: query_sql.xml:530 +#, no-c-format +msgid "" +"An other query hint specific to native queries has been introduced: " +"org.hibernate.callable which can be true or false " +"depending on whether the query is a stored procedure or not." +msgstr "" + +#. Tag: title +#: query_sql.xml:535 #, no-c-format msgid "Using return-property to explicitly specify column/alias names" msgstr "使用 return-property 来明确地指定字段/别名" #. Tag: para +#: query_sql.xml:538 #, no-c-format -msgid "You can explicitly tell Hibernate what column aliases to use with <return-property>, instead of using the {}-syntax to let Hibernate inject its own aliases.For example:" -msgstr "使用 <return-property> 你可以明确的告诉 Hibernate 使用哪些字段别名,这取代了使用 {}-语法 来让 Hibernate 注入它自己的别名。例如:" +msgid "" +"You can explicitly tell Hibernate what column aliases to use with " +"<return-property>, instead of using the {}" +"-syntax to let Hibernate inject its own aliases.For example:" +msgstr "" +"使用 <return-property> 你可以明确的告诉 Hibernate 使" +"用哪些字段别名,这取代了使用 {}-语法 来让 Hibernate 注入它" +"自己的别名。例如:" + +#. Tag: programlisting +#: query_sql.xml:543 +#, fuzzy, no-c-format +msgid "" +"<sql-query name=\"mySqlQuery\">\n" +" <return alias=\"person\" class=\"eg.Person\">\n" +" <return-property name=\"name\" column=\"myName\"/>\n" +" <return-property name=\"age\" column=\"myAge\"/>\n" +" <return-property name=\"sex\" column=\"mySex\"/>\n" +" </return>\n" +" SELECT person.NAME AS myName,\n" +" person.AGE AS myAge,\n" +" person.SEX AS mySex,\n" +" FROM PERSON person WHERE person.NAME LIKE :name\n" +"</sql-query>" +msgstr "" +"<sql-query name=\"mySqlQuery\">\n" +" <return alias=\"person\" class=\"eg.Person\">\n" +" <return-property name=\"name\" column=\"myName\"/>\n" +" <return-property name=\"age\" column=\"myAge\"/>\n" +" <return-property name=\"sex\" column=\"mySex\"/>\n" +" </return>\n" +" SELECT person.NAME AS myName,\n" +" person.AGE AS myAge,\n" +" person.SEX AS mySex,\n" +" FROM PERSON person WHERE person.NAME LIKE :name\n" +"</sql-query>" #. Tag: para +#: query_sql.xml:545 #, no-c-format -msgid "<return-property> also works with multiple columns. This solves a limitation with the {}-syntax which cannot allow fine grained control of multi-column properties." -msgstr "<return-property> 也可用于多个字段,它解决了使用 {}-语法不能细粒度控制多个字段的限制。 " +msgid "" +"<return-property> also works with multiple columns. " +"This solves a limitation with the {}-syntax which cannot " +"allow fine grained control of multi-column properties." +msgstr "" +"<return-property> 也可用于多个字段,它解决了使用 " +"{}-语法不能细粒度控制多个字段的限制。 " + +#. Tag: programlisting +#: query_sql.xml:550 +#, fuzzy, no-c-format +msgid "" +"<sql-query name=\"organizationCurrentEmployments\">\n" +" <return alias=\"emp\" class=\"Employment\">\n" +" <return-property name=\"salary\">\n" +" <return-column name=\"VALUE\"/>\n" +" <return-column name=\"CURRENCY\"/>\n" +" </return-property>\n" +" <return-property name=\"endDate\" column=\"myEndDate\"/>\n" +" </return>\n" +" SELECT EMPLOYEE AS {emp.employee}, EMPLOYER AS {emp.employer},\n" +" STARTDATE AS {emp.startDate}, ENDDATE AS {emp.endDate},\n" +" REGIONCODE as {emp.regionCode}, EID AS {emp.id}, VALUE, CURRENCY\n" +" FROM EMPLOYMENT\n" +" WHERE EMPLOYER = :id AND ENDDATE IS NULL\n" +" ORDER BY STARTDATE ASC\n" +"</sql-query>" +msgstr "" +"<sql-query name=\"organizationCurrentEmployments\">\n" +" <return alias=\"emp\" class=\"Employment\">\n" +" <return-property name=\"salary\">\n" +" <return-column name=\"VALUE\"/>\n" +" <return-column name=\"CURRENCY\"/>\n" +" </return-property>\n" +" <return-property name=\"endDate\" column=\"myEndDate\"/>\n" +" </return>\n" +" SELECT EMPLOYEE AS {emp.employee}, EMPLOYER AS {emp.employer},\n" +" STARTDATE AS {emp.startDate}, ENDDATE AS {emp.endDate},\n" +" REGIONCODE as {emp.regionCode}, EID AS {emp.id}, VALUE, CURRENCY\n" +" FROM EMPLOYMENT\n" +" WHERE EMPLOYER = :id AND ENDDATE IS NULL\n" +" ORDER BY STARTDATE ASC\n" +"</sql-query>" #. Tag: para +#: query_sql.xml:552 #, no-c-format -msgid "In this example <return-property> was used in combination with the {}-syntax for injection. This allows users to choose how they want to refer column and properties." -msgstr "注意在这个例子中,我们使用了 <return-property> 结合 {} 的注入语法。允许用户来选择如何引用字段以及属性。 " +msgid "" +"In this example <return-property> was used in " +"combination with the {}-syntax for injection. This allows " +"users to choose how they want to refer column and properties." +msgstr "" +"注意在这个例子中,我们使用了 <return-property> 结合 " +"{} 的注入语法。允许用户来选择如何引用字段以及属性。 " #. Tag: para +#: query_sql.xml:557 #, no-c-format -msgid "If your mapping has a discriminator you must use <return-discriminator> to specify the discriminator column." -msgstr "如果你映射一个识别器(discriminator),你必须使用 <return-discriminator> 来指定识别器字段。" +msgid "" +"If your mapping has a discriminator you must use <return-" +"discriminator> to specify the discriminator column." +msgstr "" +"如果你映射一个识别器(discriminator),你必须使用 <return-" +"discriminator> 来指定识别器字段。" #. Tag: title +#: query_sql.xml:563 #, no-c-format msgid "Using stored procedures for querying" msgstr "使用存储过程来查询" #. Tag: para +#: query_sql.xml:565 #, no-c-format -msgid "Hibernate3 provides support for queries via stored procedures and functions. Most of the following documentation is equivalent for both. The stored procedure/function must return a resultset as the first out-parameter to be able to work with Hibernate. An example of such a stored function in Oracle 9 and higher is as follows:" -msgstr "Hibernate 3 引入了对存储过程查询(stored procedure)和函数(function)的支持。以下的说明中,这二者一般都适用。存储过程/函数必须返回一个结果集,作为 Hibernate 能够使用的第一个外部参数。下面是一个 Oracle9 和更高版本的存储过程例子。 " +msgid "" +"Hibernate3 provides support for queries via stored procedures and functions. " +"Most of the following documentation is equivalent for both. The stored " +"procedure/function must return a resultset as the first out-parameter to be " +"able to work with Hibernate. An example of such a stored function in Oracle " +"9 and higher is as follows:" +msgstr "" +"Hibernate 3 引入了对存储过程查询(stored procedure)和函数(function)的支" +"持。以下的说明中,这二者一般都适用。存储过程/函数必须返回一个结果集,作为 " +"Hibernate 能够使用的第一个外部参数。下面是一个 Oracle9 和更高版本的存储过程例" +"子。 " + +#. Tag: programlisting +#: query_sql.xml:571 +#, fuzzy, no-c-format +msgid "" +"CREATE OR REPLACE FUNCTION selectAllEmployments\n" +" RETURN SYS_REFCURSOR\n" +"AS\n" +" st_cursor SYS_REFCURSOR;\n" +"BEGIN\n" +" OPEN st_cursor FOR\n" +" SELECT EMPLOYEE, EMPLOYER,\n" +" STARTDATE, ENDDATE,\n" +" REGIONCODE, EID, VALUE, CURRENCY\n" +" FROM EMPLOYMENT;\n" +" RETURN st_cursor;\n" +" END;" +msgstr "" +"CREATE OR REPLACE FUNCTION selectAllEmployments\n" +" RETURN SYS_REFCURSOR\n" +"AS\n" +" st_cursor SYS_REFCURSOR;\n" +"BEGIN\n" +" OPEN st_cursor FOR\n" +" SELECT EMPLOYEE, EMPLOYER,\n" +" STARTDATE, ENDDATE,\n" +" REGIONCODE, EID, VALUE, CURRENCY\n" +" FROM EMPLOYMENT;\n" +" RETURN st_cursor;\n" +" END;" #. Tag: para +#: query_sql.xml:573 #, no-c-format msgid "To use this query in Hibernate you need to map it via a named query." msgstr "在 Hibernate 里要要使用这个查询,你需要通过命名查询来映射它。" +#. Tag: programlisting +#: query_sql.xml:576 +#, fuzzy, no-c-format +msgid "" +"<sql-query name=\"selectAllEmployees_SP\" callable=\"true\">\n" +" <return alias=\"emp\" class=\"Employment\">\n" +" <return-property name=\"employee\" column=\"EMPLOYEE\"/>\n" +" <return-property name=\"employer\" column=\"EMPLOYER\"/>\n" +" <return-property name=\"startDate\" column=\"STARTDATE\"/>\n" +" <return-property name=\"endDate\" column=\"ENDDATE\"/>\n" +" <return-property name=\"regionCode\" column=\"REGIONCODE\"/>\n" +" <return-property name=\"id\" column=\"EID\"/>\n" +" <return-property name=\"salary\">\n" +" <return-column name=\"VALUE\"/>\n" +" <return-column name=\"CURRENCY\"/>\n" +" </return-property>\n" +" </return>\n" +" { ? = call selectAllEmployments() }\n" +"</sql-query>" +msgstr "" +"<sql-query name=\"selectAllEmployees_SP\" callable=\"true\">\n" +" <return alias=\"emp\" class=\"Employment\">\n" +" <return-property name=\"employee\" column=\"EMPLOYEE\"/>\n" +" <return-property name=\"employer\" column=\"EMPLOYER\"/>\n" +" <return-property name=\"startDate\" column=\"STARTDATE\"/>\n" +" <return-property name=\"endDate\" column=\"ENDDATE\"/>\n" +" <return-property name=\"regionCode\" column=\"REGIONCODE\"/>\n" +" <return-property name=\"id\" column=\"EID\"/>\n" +" <return-property name=\"salary\">\n" +" <return-column name=\"VALUE\"/>\n" +" <return-column name=\"CURRENCY\"/>\n" +" </return-property>\n" +" </return>\n" +" { ? = call selectAllEmployments() }\n" +"</sql-query>" + #. Tag: para +#: query_sql.xml:578 #, no-c-format -msgid "Stored procedures currently only return scalars and entities. <return-join> and <load-collection> are not supported." -msgstr "注意存储过程当前仅仅返回标量和实体现在。不支持 <return-join><load-collection>。 " +msgid "" +"Stored procedures currently only return scalars and entities. <" +"return-join> and <load-collection> are " +"not supported." +msgstr "" +"注意存储过程当前仅仅返回标量和实体现在。不支持 <return-join><load-collection>。 " #. Tag: title +#: query_sql.xml:583 #, no-c-format msgid "Rules/limitations for using stored procedures" msgstr "使用存储过程的规则和限制" #. Tag: para +#: query_sql.xml:585 #, no-c-format -msgid "You cannot use stored procedures with Hibernate unless you follow some procedure/function rules. If they do not follow those rules they are not usable with Hibernate. If you still want to use these procedures you have to execute them via session.connection(). The rules are different for each database, since database vendors have different stored procedure semantics/syntax." -msgstr "为了在 Hibernate 中使用存储过程,你必须遵循一些规则。不遵循这些规则的存储过程将不可用。如果你仍然想使用他们,你必须通过 session.connection() 来执行他们。这些规则针对于不同的数据库。因为数据库提供商有各种不同的存储过程语法和语义。 " +msgid "" +"You cannot use stored procedures with Hibernate unless you follow some " +"procedure/function rules. If they do not follow those rules they are not " +"usable with Hibernate. If you still want to use these procedures you have to " +"execute them via session.connection(). The rules are " +"different for each database, since database vendors have different stored " +"procedure semantics/syntax." +msgstr "" +"为了在 Hibernate 中使用存储过程,你必须遵循一些规则。不遵循这些规则的存储过程" +"将不可用。如果你仍然想使用他们,你必须通过 session.connection() 来执行他们。这些规则针对于不同的数据库。因为数据库提供商有各种不同的" +"存储过程语法和语义。 " #. Tag: para +#: query_sql.xml:593 #, no-c-format -msgid "Stored procedure queries cannot be paged with setFirstResult()/setMaxResults()." -msgstr "对存储过程进行的查询无法使用 setFirstResult()/setMaxResults() 进行分页。 " +msgid "" +"Stored procedure queries cannot be paged with setFirstResult()/" +"setMaxResults()." +msgstr "" +"对存储过程进行的查询无法使用 setFirstResult()/setMaxResults() 进行分页。 " #. Tag: para +#: query_sql.xml:596 #, no-c-format -msgid "The recommended call form is standard SQL92: { ? = call functionName(<parameters>) } or { ? = call procedureName(<parameters>}. Native call syntax is not supported." -msgstr "建议采用的调用方式是标准 SQL92: { ? = call functionName(<parameters>) } 或者 { ? = call procedureName(<parameters>) }。原生调用语法不被支持。 " +msgid "" +"The recommended call form is standard SQL92: { ? = call functionName" +"(<parameters>) } or { ? = call procedureName(<" +"parameters>}. Native call syntax is not supported." +msgstr "" +"建议采用的调用方式是标准 SQL92: { ? = call functionName(<" +"parameters>) } 或者 { ? = call procedureName(<" +"parameters>) }。原生调用语法不被支持。 " #. Tag: para +#: query_sql.xml:601 #, no-c-format msgid "For Oracle the following rules apply:" msgstr "对于 Oracle 有如下规则:" #. Tag: para +#: query_sql.xml:605 #, no-c-format -msgid "A function must return a result set. The first parameter of a procedure must be an OUT that returns a result set. This is done by using a SYS_REFCURSOR type in Oracle 9 or 10. In Oracle you need to define a REF CURSOR type. See Oracle literature for further information." -msgstr "函数必须返回一个结果集。存储过程的第一个参数必须是 OUT,它返回一个结果集。这是通过 Oracle 9 或 10 的 SYS_REFCURSOR 类型来完成的。在 Oracle 中你需要定义一个 REF CURSOR 类型,参见 Oracle 的手册。 " +msgid "" +"A function must return a result set. The first parameter of a procedure must " +"be an OUT that returns a result set. This is done by " +"using a SYS_REFCURSOR type in Oracle 9 or 10. In Oracle " +"you need to define a REF CURSOR type. See Oracle " +"literature for further information." +msgstr "" +"函数必须返回一个结果集。存储过程的第一个参数必须是 OUT,它" +"返回一个结果集。这是通过 Oracle 9 或 10 的 SYS_REFCURSOR " +"类型来完成的。在 Oracle 中你需要定义一个 REF CURSOR 类型," +"参见 Oracle 的手册。 " #. Tag: para +#: query_sql.xml:614 #, no-c-format msgid "For Sybase or MS SQL server the following rules apply:" msgstr "对于 Sybase 或者 MS SQL server 有如下规则:" #. Tag: para +#: query_sql.xml:618 #, no-c-format -msgid "The procedure must return a result set. Note that since these servers can return multiple result sets and update counts, Hibernate will iterate the results and take the first result that is a result set as its return value. Everything else will be discarded." -msgstr "存储过程必须返回一个结果集。注意这些 servers 可能返回多个结果集以及更新的数目。Hibernate 将取出第一条结果集作为它的返回值,其他将被丢弃。 " +msgid "" +"The procedure must return a result set. Note that since these servers can " +"return multiple result sets and update counts, Hibernate will iterate the " +"results and take the first result that is a result set as its return value. " +"Everything else will be discarded." +msgstr "" +"存储过程必须返回一个结果集。注意这些 servers 可能返回多个结果集以及更新的数" +"目。Hibernate 将取出第一条结果集作为它的返回值,其他将被丢弃。 " #. Tag: para +#: query_sql.xml:626 #, no-c-format -msgid "If you can enable SET NOCOUNT ON in your procedure it will probably be more efficient, but this is not a requirement." -msgstr "如果你能够在存储过程里设定 SET NOCOUNT ON,这可能会效率更高,但这不是必需的。" +msgid "" +"If you can enable SET NOCOUNT ON in your procedure it " +"will probably be more efficient, but this is not a requirement." +msgstr "" +"如果你能够在存储过程里设定 SET NOCOUNT ON,这可能会效率更" +"高,但这不是必需的。" #. Tag: title +#: query_sql.xml:636 #, no-c-format msgid "Custom SQL for create, update and delete" msgstr "定制 SQL 用来 create,update 和 delete" #. Tag: para -#, no-c-format -msgid "Hibernate3 can use custom SQL for create, update, and delete operations. The SQL can be overridden at the statement level or inidividual column level. This section describes statement overrides. For columns, see ." -msgstr "Hibernate3 可以自定义 create、update 和 delete 操作。SQL 可以在语句或单个字段级别进行覆盖。本节描述了语句覆盖。对于字段覆盖,请参考 。" - -#. Tag: para -#, no-c-format -msgid "The class and collection persisters in Hibernate already contain a set of configuration time generated strings (insertsql, deletesql, updatesql etc.). The mapping tags <sql-insert>, <sql-delete>, and <sql-update> override these strings:" -msgstr "Hibernate3 能够使用定制的 SQL 语句来执行 create,update 和 delete 操作。在 Hibernate 中,持久化的类和集合已经包含了一套配置期产生的语句(insertsql,deletesql,updatesql 等等),这些映射标记 <sql-insert><sql-delete><sql-update> 重载了这些语句。 " - -#. Tag: para -#, no-c-format -msgid "The SQL is directly executed in your database, so you can use any dialect you like. This will reduce the portability of your mapping if you use database specific SQL." -msgstr "这些 SQL 直接在你的数据库里执行,所以你可以自由的使用你喜欢的任意语法。但如果你使用数据库特定的语法,这当然会降低你映射的可移植性。 " - -#. Tag: para -#, no-c-format -msgid "Stored procedures are supported if the callable attribute is set:" -msgstr "如果设定 callable,则能够支持存储过程了。" - -#. Tag: para -#, no-c-format -msgid "The order of the positional parameters is vital, as they must be in the same sequence as Hibernate expects them." -msgstr "参数的位置顺序是非常重要的,他们必须和 Hibernate 所期待的顺序相同。 " - -#. Tag: para -#, no-c-format -msgid "You can view the expected order by enabling debug logging for the org.hibernate.persister.entity level. With this level enabled, Hibernate will print out the static SQL that is used to create, update, delete etc. entities. To view the expected sequence, do not include your custom SQL in the mapping files, as this will override the Hibernate generated static SQL." -msgstr "你能够通过设定日志调试级别为 org.hiberante.persister.entity 来查看 Hibernate 所期待的顺序。在这个级别下,Hibernate 将会打印出create,update 和 delete 实体的静态 SQL。(如果想看到预计的顺序。记得不要将定制 SQL 包含在映射文件里,因为他们会重载 Hibernate 生成的静态 SQL。) " - -#. Tag: para -#, no-c-format -msgid "The stored procedures are in most cases required to return the number of rows inserted, updated and deleted, as Hibernate has some runtime checks for the success of the statement. Hibernate always registers the first statement parameter as a numeric output parameter for the CUD operations:" -msgstr "在大多数情况下(最好这么做),存储过程需要返回插入/更新/删除的行数,因为 Hibernate 对语句的成功执行有些运行时的检查。Hibernate 常会把进行 CUD 操作的语句的第一个参数注册为一个数值型输出参数。 " +#: query_sql.xml:638 +#, fuzzy, no-c-format +msgid "" +"Hibernate3 can use custom SQL for create, update, and delete operations. The " +"SQL can be overridden at the statement level or inidividual column level. " +"This section describes statement overrides. For columns, see . shows how to define custom SQL operatons using annotations." +msgstr "" +"Hibernate3 可以自定义 create、update 和 delete 操作。SQL 可以在语句或单个字段" +"级别进行覆盖。本节描述了语句覆盖。对于字段覆盖,请参考 。" #. Tag: title +#: query_sql.xml:646 +#, no-c-format +msgid "Custom CRUD via annotations" +msgstr "" + +#. Tag: programlisting +#: query_sql.xml:648 +#, no-c-format +msgid "" +"@Entity\n" +"@Table(name=\"CHAOS\")\n" +"@SQLInsert( sql=\"INSERT INTO CHAOS(size, name, nickname, id) VALUES(?,upper" +"(?),?,?)\")\n" +"@SQLUpdate( sql=\"UPDATE CHAOS SET size = ?, name = upper(?), nickname = ? " +"WHERE id = ?\")\n" +"@SQLDelete( sql=\"DELETE CHAOS WHERE id = ?\")\n" +"@SQLDeleteAll( sql=\"DELETE CHAOS\")\n" +"@Loader(namedQuery = \"chaos\")\n" +"@NamedNativeQuery(name=\"chaos\", query=\"select id, size, name, lower" +"( nickname ) as nickname from CHAOS where id= ?\", resultClass = Chaos." +"class)\n" +"public class Chaos {\n" +" @Id\n" +" private Long id;\n" +" private Long size;\n" +" private String name;\n" +" private String nickname;" +msgstr "" + +#. Tag: para +#: query_sql.xml:651 +#, no-c-format +msgid "" +"@SQLInsert, @SQLUpdate, " +"@SQLDelete, @SQLDeleteAll respectively " +"override the INSERT, UPDATE, DELETE, and DELETE all statement. The same can " +"be achieved using Hibernate mapping files and the <sql-insert>" +", <sql-update> and <sql-" +"delete> nodes. This can be seen in ." +msgstr "" + +#. Tag: title +#: query_sql.xml:661 +#, no-c-format +msgid "Custom CRUD XML" +msgstr "" + +#. Tag: programlisting +#: query_sql.xml:663 +#, fuzzy, no-c-format +msgid "" +"<class name=\"Person\">\n" +" <id name=\"id\">\n" +" <generator class=\"increment\"/>\n" +" </id>\n" +" <property name=\"name\" not-null=\"true\"/>\n" +" <sql-insert>INSERT INTO PERSON (NAME, ID) VALUES ( UPPER(?), ? )" +"</sql-insert>\n" +" <sql-update>UPDATE PERSON SET NAME=UPPER(?) WHERE ID=?</sql-" +"update>\n" +" <sql-delete>DELETE FROM PERSON WHERE ID=?</sql-delete>\n" +"</class>" +msgstr "" +"<class name=\"Person\">\n" +" <id name=\"id\">\n" +" <generator class=\"increment\"/>\n" +" </id>\n" +" <property name=\"name\" not-null=\"true\"/>\n" +" <sql-insert>INSERT INTO PERSON (NAME, ID) VALUES ( UPPER(?), ? )" +"</sql-insert>\n" +" <sql-update>UPDATE PERSON SET NAME=UPPER(?) WHERE ID=?</sql-" +"update>\n" +" <sql-delete>DELETE FROM PERSON WHERE ID=?</sql-delete>\n" +"</class>" + +#. Tag: para +#: query_sql.xml:666 +#, no-c-format +msgid "" +"If you expect to call a store procedure, be sure to set the " +"callable attribute to true. In " +"annotations as well as in xml." +msgstr "" + +#. Tag: para +#: query_sql.xml:670 +#, no-c-format +msgid "" +"To check that the execution happens correctly, Hibernate allows you to " +"define one of those three strategies:" +msgstr "" + +#. Tag: para +#: query_sql.xml:675 +#, no-c-format +msgid "" +"none: no check is performed: the store procedure is expected to fail upon " +"issues" +msgstr "" + +#. Tag: para +#: query_sql.xml:680 +#, no-c-format +msgid "count: use of rowcount to check that the update is successful" +msgstr "" + +#. Tag: para +#: query_sql.xml:685 +#, no-c-format +msgid "" +"param: like COUNT but using an output parameter rather that the standard " +"mechanism" +msgstr "" + +#. Tag: para +#: query_sql.xml:690 +#, no-c-format +msgid "" +"To define the result check style, use the check parameter " +"which is again available in annoations as well as in xml." +msgstr "" + +#. Tag: para +#: query_sql.xml:693 +#, no-c-format +msgid "" +"You can use the exact same set of annotations respectively xml nodes to " +"override the collection related statements -see ." +msgstr "" + +#. Tag: title +#: query_sql.xml:698 +#, no-c-format +msgid "Overriding SQL statements for collections using annotations" +msgstr "" + +#. Tag: programlisting +#: query_sql.xml:701 +#, no-c-format +msgid "" +"@OneToMany\n" +"@JoinColumn(name=\"chaos_fk\")\n" +"@SQLInsert( sql=\"UPDATE CASIMIR_PARTICULE SET chaos_fk = ? where id = ?\")\n" +"@SQLDelete( sql=\"UPDATE CASIMIR_PARTICULE SET chaos_fk = null where id = ?" +"\")\n" +"private Set<CasimirParticle> particles = new HashSet<" +"CasimirParticle>();" +msgstr "" + +#. Tag: para +#: query_sql.xml:705 +#, fuzzy, no-c-format +msgid "" +"The parameter order is important and is defined by the order Hibernate " +"handles properties. You can see the expected order by enabling debug logging " +"for the org.hibernate.persister.entity level. With this " +"level enabled Hibernate will print out the static SQL that is used to " +"create, update, delete etc. entities. (To see the expected sequence, " +"remember to not include your custom SQL through annotations or mapping files " +"as that will override the Hibernate generated static sql)" +msgstr "" +"你能够通过设定日志调试级别为 org.hiberante.persister.entity 来查看 Hibernate 所期待的顺序。在这个级别下,Hibernate 将会打印出" +"create,update 和 delete 实体的静态 SQL。(如果想看到预计的顺序。记得不要将定" +"制 SQL 包含在映射文件里,因为他们会重载 Hibernate 生成的静态 SQL。) " + +#. Tag: para +#: query_sql.xml:715 +#, no-c-format +msgid "" +"Overriding SQL statements for secondary tables is also possible using " +"@org.hibernate.annotations.Table and either (or all) " +"attributes sqlInsert, sqlUpdate, " +"sqlDelete:" +msgstr "" + +#. Tag: title +#: query_sql.xml:721 +#, no-c-format +msgid "Overriding SQL statements for secondary tables" +msgstr "" + +#. Tag: programlisting +#: query_sql.xml:723 +#, no-c-format +msgid "" +"@Entity\n" +"@SecondaryTables({\n" +" @SecondaryTable(name = \"`Cat nbr1`\"),\n" +" @SecondaryTable(name = \"Cat2\"})\n" +"@org.hibernate.annotations.Tables( {\n" +" @Table(appliesTo = \"Cat\", comment = \"My cat table\" ),\n" +" @Table(appliesTo = \"Cat2\", foreignKey = @ForeignKey(name=\"FK_CAT2_CAT" +"\"), fetch = FetchMode.SELECT,\n" +" sqlInsert=@SQLInsert(sql=\"insert into Cat2(storyPart2, id) values" +"(upper(?), ?)\") )\n" +"} )\n" +"public class Cat implements Serializable {" +msgstr "" + +#. Tag: para +#: query_sql.xml:726 +#, no-c-format +msgid "" +"The previous example also shows that you can give a comment to a given table " +"(primary or secondary): This comment will be used for DDL generation." +msgstr "" + +#. Tag: para +#: query_sql.xml:731 +#, fuzzy, no-c-format +msgid "" +"The SQL is directly executed in your database, so you can use any dialect " +"you like. This will, however, reduce the portability of your mapping if you " +"use database specific SQL." +msgstr "" +"这些 SQL 直接在你的数据库里执行,所以你可以自由的使用你喜欢的任意语法。但如果" +"你使用数据库特定的语法,这当然会降低你映射的可移植性。 " + +#. Tag: para +#: query_sql.xml:736 +#, fuzzy, no-c-format +msgid "" +"Last but not least, stored procedures are in most cases required to return " +"the number of rows inserted, updated and deleted. Hibernate always registers " +"the first statement parameter as a numeric output parameter for the CUD " +"operations:" +msgstr "" +"在大多数情况下(最好这么做),存储过程需要返回插入/更新/删除的行数,因为 " +"Hibernate 对语句的成功执行有些运行时的检查。Hibernate 常会把进行 CUD 操作的语" +"句的第一个参数注册为一个数值型输出参数。 " + +#. Tag: title +#: query_sql.xml:742 +#, no-c-format +msgid "Stored procedures and their return value" +msgstr "" + +#. Tag: programlisting +#: query_sql.xml:744 +#, fuzzy, no-c-format +msgid "" +"CREATE OR REPLACE FUNCTION updatePerson (uid IN NUMBER, uname IN VARCHAR2)\n" +" RETURN NUMBER IS\n" +"BEGIN\n" +"\n" +" update PERSON\n" +" set\n" +" NAME = uname,\n" +" where\n" +" ID = uid;\n" +"\n" +" return SQL%ROWCOUNT;\n" +"\n" +"END updatePerson;" +msgstr "" +"CREATE OR REPLACE FUNCTION updatePerson (uid IN NUMBER, uname IN VARCHAR2)\n" +" RETURN NUMBER IS\n" +"BEGIN\n" +"\n" +" update PERSON\n" +" set\n" +" NAME = uname,\n" +" where\n" +" ID = uid;\n" +"\n" +" return SQL%ROWCOUNT;\n" +"\n" +"END updatePerson;" + +#. Tag: title +#: query_sql.xml:749 #, no-c-format msgid "Custom SQL for loading" msgstr "定制装载 SQL" #. Tag: para -#, no-c-format -msgid "You can also declare your own SQL (or HQL) queries for entity loading. As with inserts, updates, and deletes, this can be done at the individual column level as described in or at the statement level. Here is an example of a statement level override:" -msgstr "你也可以为实体加载声明自己的 SQL(或 HQL)。如 所描述的,inserts、updates 和 deletes 可以在字段级别或语句级别来完成。下面是一个语句覆盖的例子:" +#: query_sql.xml:751 +#, fuzzy, no-c-format +msgid "" +"You can also declare your own SQL (or HQL) queries for entity loading. As " +"with inserts, updates, and deletes, this can be done at the individual " +"column level as described in or at the statement level. Here is an example of a statement level " +"override:" +msgstr "" +"你也可以为实体加载声明自己的 SQL(或 HQL)。如 所描述的,inserts、updates 和 deletes 可以在字段级" +"别或语句级别来完成。下面是一个语句覆盖的例子:" + +#. Tag: programlisting +#: query_sql.xml:757 +#, fuzzy, no-c-format +msgid "" +"<sql-query name=\"person\">\n" +" <return alias=\"pers\" class=\"Person\" lock-mode=\"upgrade\"/>\n" +" SELECT NAME AS {pers.name}, ID AS {pers.id}\n" +" FROM PERSON\n" +" WHERE ID=?\n" +" FOR UPDATE\n" +"</sql-query>" +msgstr "" +"<sql-query name=\"person\">\n" +" <return alias=\"pers\" class=\"Person\" lock-mode=\"upgrade\"/>\n" +" SELECT NAME AS {pers.name}, ID AS {pers.id}\n" +" FROM PERSON\n" +" WHERE ID=?\n" +" FOR UPDATE\n" +"</sql-query>" #. Tag: para +#: query_sql.xml:759 #, no-c-format -msgid "This is just a named query declaration, as discussed earlier. You can reference this named query in a class mapping:" -msgstr "这只是一个前面讨论过的命名查询声明,你可以在类映射里引用这个命名查询。 " +msgid "" +"This is just a named query declaration, as discussed earlier. You can " +"reference this named query in a class mapping:" +msgstr "" +"这只是一个前面讨论过的命名查询声明,你可以在类映射里引用这个命名查询。 " + +#. Tag: programlisting +#: query_sql.xml:762 +#, fuzzy, no-c-format +msgid "" +"<class name=\"Person\">\n" +" <id name=\"id\">\n" +" <generator class=\"increment\"/>\n" +" </id>\n" +" <property name=\"name\" not-null=\"true\"/>\n" +" <loader query-ref=\"person\"/>\n" +"</class>" +msgstr "" +"<class name=\"Person\">\n" +" <id name=\"id\">\n" +" <generator class=\"increment\"/>\n" +" </id>\n" +" <property name=\"name\" not-null=\"true\"/>\n" +" <loader query-ref=\"person\"/>\n" +"</class>" #. Tag: para +#: query_sql.xml:764 #, no-c-format msgid "This even works with stored procedures." msgstr "这也可以用于存储过程" #. Tag: para +#: query_sql.xml:766 #, no-c-format msgid "You can even define a query for collection loading:" msgstr "你甚至可以定一个用于集合装载的查询: " +#. Tag: programlisting +#: query_sql.xml:768 +#, fuzzy, no-c-format +msgid "" +"<set name=\"employments\" inverse=\"true\">\n" +" <key/>\n" +" <one-to-many class=\"Employment\"/>\n" +" <loader query-ref=\"employments\"/>\n" +"</set>" +msgstr "" +"<set name=\"employments\" inverse=\"true\">\n" +" <key/>\n" +" <one-to-many class=\"Employment\"/>\n" +" <loader query-ref=\"employments\"/>\n" +"</set>" + +#. Tag: programlisting +#: query_sql.xml:770 +#, fuzzy, no-c-format +msgid "" +"<sql-query name=\"employments\">\n" +" <load-collection alias=\"emp\" role=\"Person.employments\"/>\n" +" SELECT {emp.*}\n" +" FROM EMPLOYMENT emp\n" +" WHERE EMPLOYER = :id\n" +" ORDER BY STARTDATE ASC, EMPLOYEE ASC\n" +"</sql-query>" +msgstr "" +"<sql-query name=\"employments\">\n" +" <load-collection alias=\"emp\" role=\"Person.employments\"/>\n" +" SELECT {emp.*}\n" +" FROM EMPLOYMENT emp\n" +" WHERE EMPLOYER = :id\n" +" ORDER BY STARTDATE ASC, EMPLOYEE ASC\n" +"</sql-query>" + #. Tag: para +#: query_sql.xml:772 #, no-c-format -msgid "You can also define an entity loader that loads a collection by join fetching:" +msgid "" +"You can also define an entity loader that loads a collection by join " +"fetching:" msgstr "你甚至还可以定义一个实体装载器,它通过连接抓取装载一个集合: " +#. Tag: programlisting +#: query_sql.xml:775 +#, fuzzy, no-c-format +msgid "" +"<sql-query name=\"person\">\n" +" <return alias=\"pers\" class=\"Person\"/>\n" +" <return-join alias=\"emp\" property=\"pers.employments\"/>\n" +" SELECT NAME AS {pers.*}, {emp.*}\n" +" FROM PERSON pers\n" +" LEFT OUTER JOIN EMPLOYMENT emp\n" +" ON pers.ID = emp.PERSON_ID\n" +" WHERE ID=?\n" +"</sql-query>" +msgstr "" +"<sql-query name=\"person\">\n" +" <return alias=\"pers\" class=\"Person\"/>\n" +" <return-join alias=\"emp\" property=\"pers.employments\"/>\n" +" SELECT NAME AS {pers.*}, {emp.*}\n" +" FROM PERSON pers\n" +" LEFT OUTER JOIN EMPLOYMENT emp\n" +" ON pers.ID = emp.PERSON_ID\n" +" WHERE ID=?\n" +"</sql-query>" + +#. Tag: para +#: query_sql.xml:777 +#, no-c-format +msgid "" +"The annotation equivalent <loader> is the @Loader " +"annotation as seen in ." +msgstr "" + +#~ msgid "A_NAME as {item.name}" +#~ msgstr "A_NAME as {item.name}" + +#~ msgid "{[aliasname].class}" +#~ msgstr "{[aliasname].class}" + +#~ msgid "DISC as {item.class}" +#~ msgstr "DISC as {item.class}" + +#~ msgid "{[aliasname].*}" +#~ msgstr "{[aliasname].*}" + +#~ msgid "{item.*}" +#~ msgstr "{item.*}" + +#~ msgid "{[aliasname].key}" +#~ msgstr "{[aliasname].key}" + +#~ msgid "ORGID as {coll.key}" +#~ msgstr "ORGID as {coll.key}" + +#~ msgid "{[aliasname].id}" +#~ msgstr "{[aliasname].id}" + +#~ msgid "EMPID as {coll.id}" +#~ msgstr "EMPID as {coll.id}" + +#~ msgid "{[aliasname].element}" +#~ msgstr "{[aliasname].element}" + +#~ msgid "XID as {coll.element}" +#~ msgstr "XID as {coll.element}" + +#~ msgid "NAME as {coll.element.name}" +#~ msgstr "NAME as {coll.element.name}" + +#~ msgid "{[aliasname].element.*}" +#~ msgstr "{[aliasname].element.*}" + +#~ msgid "{coll.element.*}" +#~ msgstr "{coll.element.*}" + +#~ msgid "{coll.*}" +#~ msgstr "{coll.*}" + +#~ msgid "" +#~ "The class and collection persisters in Hibernate already contain a set of " +#~ "configuration time generated strings (insertsql, deletesql, updatesql " +#~ "etc.). The mapping tags <sql-insert>, " +#~ "<sql-delete>, and <sql-update> override these strings:" +#~ msgstr "" +#~ "Hibernate3 能够使用定制的 SQL 语句来执行 create,update 和 delete 操作。" +#~ "在 Hibernate 中,持久化的类和集合已经包含了一套配置期产生的语句" +#~ "(insertsql,deletesql,updatesql 等等),这些映射标记 <sql-" +#~ "insert><sql-delete> 和 " +#~ "<sql-update> 重载了这些语句。 " + +#~ msgid "" +#~ "Stored procedures are supported if the callable " +#~ "attribute is set:" +#~ msgstr "如果设定 callable,则能够支持存储过程了。" + +#~ msgid "" +#~ "The order of the positional parameters is vital, as they must be in the " +#~ "same sequence as Hibernate expects them." +#~ msgstr "" +#~ "参数的位置顺序是非常重要的,他们必须和 Hibernate 所期待的顺序相同。 " + #~ msgid "" #~ "You can also declare your own SQL (or HQL) queries for entity loading:" #~ msgstr "你可能需要声明你自己的 SQL(或 HQL)来装载实体:" -#, fuzzy -#~ msgid "" -#~ "" -#~ msgstr "" -#~ "sess.createSQLQuery(\"SELECT * FROM CATS\").list();\n" -#~ "sess.createSQLQuery(\"SELECT ID, NAME, BIRTHDATE FROM CATS\").list();" - -#, fuzzy -#~ msgid "" -#~ "" -#~ msgstr "" -#~ "sess.createSQLQuery(\"SELECT * FROM CATS\")\n" -#~ " .addScalar(\"ID\", Hibernate.LONG)\n" -#~ " .addScalar(\"NAME\", Hibernate.STRING)\n" -#~ " .addScalar(\"BIRTHDATE\", Hibernate.DATE)" - -#, fuzzy -#~ msgid "" -#~ "" -#~ msgstr "" -#~ "sess.createSQLQuery(\"SELECT * FROM CATS\")\n" -#~ " .addScalar(\"ID\", Hibernate.LONG)\n" -#~ " .addScalar(\"NAME\")\n" -#~ " .addScalar(\"BIRTHDATE\")" - -#, fuzzy -#~ msgid "" -#~ "" -#~ msgstr "" -#~ "sess.createSQLQuery(\"SELECT * FROM CATS\").addEntity(Cat.class);\n" -#~ "sess.createSQLQuery(\"SELECT ID, NAME, BIRTHDATE FROM CATS\").addEntity" -#~ "(Cat.class);" - -#, fuzzy -#~ msgid "" -#~ "" -#~ msgstr "" -#~ "sess.createSQLQuery(\"SELECT ID, NAME, BIRTHDATE, DOG_ID FROM CATS\")." -#~ "addEntity(Cat.class);" - -#, fuzzy -#~ msgid "" -#~ "" -#~ msgstr "" -#~ "sess.createSQLQuery(\"SELECT c.ID, NAME, BIRTHDATE, DOG_ID, D_ID, D_NAME " -#~ "FROM CATS c, DOGS d \n" -#~ " WHERE c.DOG_ID = d.D_ID\")\n" -#~ " .addEntity(\"cat\", Cat.class)\n" -#~ " .addJoin(\"cat.dog\");" - -#, fuzzy -#~ msgid "" -#~ "" -#~ msgstr "" -#~ "sess.createSQLQuery(\"SELECT ID, NAME, BIRTHDATE, D_ID, D_NAME, CAT_ID " -#~ "FROM CATS c, DOGS d\n" -#~ " WHERE c.ID = d.CAT_ID\")\n" -#~ " .addEntity(\"cat\", Cat.class)\n" -#~ " .addJoin(\"cat.dogs\");" - -#, fuzzy -#~ msgid "" -#~ "" -#~ msgstr "" -#~ "sess.createSQLQuery(\"SELECT c.*, m.* FROM CATS c, CATS m WHERE c." -#~ "MOTHER_ID = c.ID\")\n" -#~ " .addEntity(\"cat\", Cat.class)\n" -#~ " .addEntity(\"mother\", Cat.class)" - -#, fuzzy -#~ msgid "" -#~ "" -#~ msgstr "" -#~ "sess.createSQLQuery(\"SELECT {cat.*}, {mother.*} FROM CATS c, CATS m " -#~ "WHERE c.MOTHER_ID = c.ID\")\n" -#~ " .addEntity(\"cat\", Cat.class)\n" -#~ " .addEntity(\"mother\", Cat.class)" - -#, fuzzy -#~ msgid "" -#~ "" -#~ msgstr "" -#~ "String sql = \"SELECT ID as {c.id}, NAME as {c.name}, \" + \n" -#~ " \"BIRTHDATE as {c.birthDate}, MOTHER_ID as {c.mother}, {mother." -#~ "*} \" +\n" -#~ " \"FROM CAT_LOG c, CAT_LOG m WHERE {c.mother} = c.ID\";\n" -#~ "\n" -#~ "List loggedCats = sess.createSQLQuery(sql)\n" -#~ " .addEntity(\"cat\", Cat.class)\n" -#~ " .addEntity(\"mother\", Cat.class).list()" - -#, fuzzy -#~ msgid "A_NAME as {item.name}" -#~ msgstr "A_NAME as {item.name}" - -#, fuzzy -#~ msgid "{[aliasname].class}" -#~ msgstr "{[aliasname].class}" - -#, fuzzy -#~ msgid "DISC as {item.class}" -#~ msgstr "DISC as {item.class}" - -#, fuzzy -#~ msgid "{[aliasname].*}" -#~ msgstr "{[aliasname].*}" -#~ msgid "{item.*}" -#~ msgstr "{item.*}" - -#, fuzzy -#~ msgid "{[aliasname].key}" -#~ msgstr "{[aliasname].key}" - -#, fuzzy -#~ msgid "ORGID as {coll.key}" -#~ msgstr "ORGID as {coll.key}" - -#, fuzzy -#~ msgid "{[aliasname].id}" -#~ msgstr "{[aliasname].id}" - -#, fuzzy -#~ msgid "EMPID as {coll.id}" -#~ msgstr "EMPID as {coll.id}" - -#, fuzzy -#~ msgid "{[aliasname].element}" -#~ msgstr "{[aliasname].element}" - -#, fuzzy -#~ msgid "XID as {coll.element}" -#~ msgstr "XID as {coll.element}" - -#, fuzzy -#~ msgid "NAME as {coll.element.name}" -#~ msgstr "NAME as {coll.element.name}" - -#, fuzzy -#~ msgid "{[aliasname].element.*}" -#~ msgstr "{[aliasname].element.*}" - -#, fuzzy -#~ msgid "{coll.element.*}" -#~ msgstr "{coll.*}" -#~ msgid "{coll.*}" -#~ msgstr "{coll.*}" - -#, fuzzy -#~ msgid "" -#~ "" -#~ msgstr "" -#~ "sess.createSQLQuery(\"SELECT NAME, BIRTHDATE FROM CATS\")\n" -#~ " .setResultTransformer(Transformers.aliasToBean(CatDTO.class))" - -#, fuzzy -#~ msgid "" -#~ "" -#~ msgstr "" -#~ "Query query = sess.createSQLQuery(\"SELECT * FROM CATS WHERE NAME like ?" -#~ "\").addEntity(Cat.class);\n" -#~ "List pusList = query.setString(0, \"Pus%\").list();\n" -#~ " \n" -#~ "query = sess.createSQLQuery(\"SELECT * FROM CATS WHERE NAME like :name\")." -#~ "addEntity(Cat.class);\n" -#~ "List pusList = query.setString(\"name\", \"Pus%\").list();" - -#, fuzzy -#~ msgid "" -#~ "\n" -#~ " \n" -#~ " SELECT person.NAME AS {person.name},\n" -#~ " person.AGE AS {person.age},\n" -#~ " person.SEX AS {person.sex}\n" -#~ " FROM PERSON person\n" -#~ " WHERE person.NAME LIKE :namePattern\n" -#~ "]]>" -#~ msgstr "" -#~ "<sql-query name=\"persons\">\n" -#~ " <return alias=\"person\" class=\"eg.Person\"/>\n" -#~ " SELECT person.NAME AS {person.name},\n" -#~ " person.AGE AS {person.age},\n" -#~ " person.SEX AS {person.sex}\n" -#~ " FROM PERSON person\n" -#~ " WHERE person.NAME LIKE :namePattern\n" -#~ "</sql-query>" - -#, fuzzy -#~ msgid "" -#~ "" -#~ msgstr "" -#~ "List people = sess.getNamedQuery(\"persons\")\n" -#~ " .setString(\"namePattern\", namePattern)\n" -#~ " .setMaxResults(50)\n" -#~ " .list();" - -#, fuzzy -#~ msgid "" -#~ "\n" -#~ " \n" -#~ " \n" -#~ " SELECT person.NAME AS {person.name},\n" -#~ " person.AGE AS {person.age},\n" -#~ " person.SEX AS {person.sex},\n" -#~ " address.STREET AS {address.street},\n" -#~ " address.CITY AS {address.city},\n" -#~ " address.STATE AS {address.state},\n" -#~ " address.ZIP AS {address.zip}\n" -#~ " FROM PERSON person\n" -#~ " JOIN ADDRESS address\n" -#~ " ON person.ID = address.PERSON_ID AND address.TYPE='MAILING'\n" -#~ " WHERE person.NAME LIKE :namePattern\n" -#~ "]]>" -#~ msgstr "" -#~ "<sql-query name=\"personsWith\">\n" -#~ " <return alias=\"person\" class=\"eg.Person\"/>\n" -#~ " <return-join alias=\"address\" property=\"person.mailingAddress\"/" -#~ ">\n" -#~ " SELECT person.NAME AS {person.name},\n" -#~ " person.AGE AS {person.age},\n" -#~ " person.SEX AS {person.sex},\n" -#~ " adddress.STREET AS {address.street},\n" -#~ " adddress.CITY AS {address.city},\n" -#~ " adddress.STATE AS {address.state},\n" -#~ " adddress.ZIP AS {address.zip}\n" -#~ " FROM PERSON person\n" -#~ " JOIN ADDRESS adddress\n" -#~ " ON person.ID = address.PERSON_ID AND address.TYPE='MAILING'\n" -#~ " WHERE person.NAME LIKE :namePattern\n" -#~ "</sql-query>" - -#, fuzzy -#~ msgid "" -#~ "\n" -#~ " \n" -#~ " \n" -#~ " SELECT p.NAME AS name,\n" -#~ " p.AGE AS age,\n" -#~ " FROM PERSON p WHERE p.NAME LIKE 'Hiber%'\n" -#~ "]]>" -#~ msgstr "" -#~ "<sql-query name=\"mySqlQuery\">\n" -#~ " <return-scalar column=\"name\" type=\"string\"/>\n" -#~ " <return-scalar column=\"age\" type=\"long\"/>\n" -#~ " SELECT p.NAME AS name,\n" -#~ " p.AGE AS age,\n" -#~ " FROM PERSON p WHERE p.NAME LIKE 'Hiber%'\n" -#~ "</sql-query>" - -#, fuzzy -#~ msgid "" -#~ "\n" -#~ " \n" -#~ " \n" -#~ "\n" -#~ "\n" -#~ "\n" -#~ " SELECT person.NAME AS {person.name},\n" -#~ " person.AGE AS {person.age},\n" -#~ " person.SEX AS {person.sex},\n" -#~ " address.STREET AS {address.street},\n" -#~ " address.CITY AS {address.city},\n" -#~ " address.STATE AS {address.state},\n" -#~ " address.ZIP AS {address.zip}\n" -#~ " FROM PERSON person\n" -#~ " JOIN ADDRESS address\n" -#~ " ON person.ID = address.PERSON_ID AND address.TYPE='MAILING'\n" -#~ " WHERE person.NAME LIKE :namePattern\n" -#~ "]]>" -#~ msgstr "" -#~ "<resultset name=\"personAddress\">\n" -#~ " <return alias=\"person\" class=\"eg.Person\"/>\n" -#~ " <return-join alias=\"address\" property=\"person.mailingAddress\"/" -#~ ">\n" -#~ "</resultset>\n" -#~ "\n" -#~ "<sql-query name=\"personsWith\" resultset-ref=\"personAddress\">\n" -#~ " SELECT person.NAME AS {person.name},\n" -#~ " person.AGE AS {person.age},\n" -#~ " person.SEX AS {person.sex},\n" -#~ " adddress.STREET AS {address.street},\n" -#~ " adddress.CITY AS {address.city},\n" -#~ " adddress.STATE AS {address.state},\n" -#~ " adddress.ZIP AS {address.zip}\n" -#~ " FROM PERSON person\n" -#~ " JOIN ADDRESS adddress\n" -#~ " ON person.ID = address.PERSON_ID AND address.TYPE='MAILING'\n" -#~ " WHERE person.NAME LIKE :namePattern\n" -#~ "</sql-query>" - -#, fuzzy -#~ msgid "" -#~ "" -#~ msgstr "" -#~ "List cats = sess.createSQLQuery(\n" -#~ " \"select {cat.*}, {kitten.*} from cats cat, cats kitten where " -#~ "kitten.mother = cat.id\"\n" -#~ " )\n" -#~ " .setResultSetMapping(\"catAndKitten\")\n" -#~ " .list();" - -#, fuzzy -#~ msgid "" -#~ "\n" -#~ " \n" -#~ " \n" -#~ " \n" -#~ " \n" -#~ " \n" -#~ " SELECT person.NAME AS myName,\n" -#~ " person.AGE AS myAge,\n" -#~ " person.SEX AS mySex,\n" -#~ " FROM PERSON person WHERE person.NAME LIKE :name\n" -#~ "\n" -#~ "]]>" -#~ msgstr "" -#~ "<sql-query name=\"mySqlQuery\">\n" -#~ " <return alias=\"person\" class=\"eg.Person\">\n" -#~ " <return-property name=\"name\" column=\"myName\"/>\n" -#~ " <return-property name=\"age\" column=\"myAge\"/>\n" -#~ " <return-property name=\"sex\" column=\"mySex\"/>\n" -#~ " </return>\n" -#~ " SELECT person.NAME AS myName,\n" -#~ " person.AGE AS myAge,\n" -#~ " person.SEX AS mySex,\n" -#~ " FROM PERSON person WHERE person.NAME LIKE :name\n" -#~ "</sql-query>" - -#, fuzzy -#~ msgid "" -#~ "\n" -#~ " \n" -#~ " \n" -#~ " \n" -#~ " \n" -#~ " \n" -#~ " \n" -#~ " \n" -#~ " SELECT EMPLOYEE AS {emp.employee}, EMPLOYER AS {emp.employer},\n" -#~ " STARTDATE AS {emp.startDate}, ENDDATE AS {emp.endDate},\n" -#~ " REGIONCODE as {emp.regionCode}, EID AS {emp.id}, VALUE, CURRENCY\n" -#~ " FROM EMPLOYMENT\n" -#~ " WHERE EMPLOYER = :id AND ENDDATE IS NULL\n" -#~ " ORDER BY STARTDATE ASC\n" -#~ "]]>" -#~ msgstr "" -#~ "<sql-query name=\"organizationCurrentEmployments\">\n" -#~ " <return alias=\"emp\" class=\"Employment\">\n" -#~ " <return-property name=\"salary\">\n" -#~ " <return-column name=\"VALUE\"/>\n" -#~ " <return-column name=\"CURRENCY\"/>\n" -#~ " </return-property>\n" -#~ " <return-property name=\"endDate\" column=\"myEndDate\"/>\n" -#~ " </return>\n" -#~ " SELECT EMPLOYEE AS {emp.employee}, EMPLOYER AS {emp.employer},\n" -#~ " STARTDATE AS {emp.startDate}, ENDDATE AS {emp.endDate},\n" -#~ " REGIONCODE as {emp.regionCode}, EID AS {emp.id}, VALUE, CURRENCY\n" -#~ " FROM EMPLOYMENT\n" -#~ " WHERE EMPLOYER = :id AND ENDDATE IS NULL\n" -#~ " ORDER BY STARTDATE ASC\n" -#~ "</sql-query>" - -#, fuzzy -#~ msgid "" -#~ "" -#~ msgstr "" -#~ "CREATE OR REPLACE FUNCTION selectAllEmployments\n" -#~ " RETURN SYS_REFCURSOR\n" -#~ "AS\n" -#~ " st_cursor SYS_REFCURSOR;\n" -#~ "BEGIN\n" -#~ " OPEN st_cursor FOR\n" -#~ " SELECT EMPLOYEE, EMPLOYER,\n" -#~ " STARTDATE, ENDDATE,\n" -#~ " REGIONCODE, EID, VALUE, CURRENCY\n" -#~ " FROM EMPLOYMENT;\n" -#~ " RETURN st_cursor;\n" -#~ " END;" - -#, fuzzy -#~ msgid "" -#~ "\n" -#~ " \n" -#~ " \n" -#~ " \n" -#~ " \n" -#~ " \n" -#~ " \n" -#~ " \n" -#~ " \n" -#~ " \n" -#~ " \n" -#~ " \n" -#~ " \n" -#~ " { ? = call selectAllEmployments() }\n" -#~ "]]>" -#~ msgstr "" -#~ "<sql-query name=\"selectAllEmployees_SP\" callable=\"true\">\n" -#~ " <return alias=\"emp\" class=\"Employment\">\n" -#~ " <return-property name=\"employee\" column=\"EMPLOYEE\"/>\n" -#~ " <return-property name=\"employer\" column=\"EMPLOYER\"/>\n" -#~ " <return-property name=\"startDate\" column=\"STARTDATE\"/>\n" -#~ " <return-property name=\"endDate\" column=\"ENDDATE\"/>\n" -#~ " <return-property name=\"regionCode\" column=\"REGIONCODE\"/" -#~ ">\n" -#~ " <return-property name=\"id\" column=\"EID\"/>\n" -#~ " <return-property name=\"salary\">\n" -#~ " <return-column name=\"VALUE\"/>\n" -#~ " <return-column name=\"CURRENCY\"/>\n" -#~ " </return-property>\n" -#~ " </return>\n" -#~ " { ? = call selectAllEmployments() }\n" -#~ "</sql-query>" - -#, fuzzy -#~ msgid "" -#~ "\n" -#~ " \n" -#~ " \n" -#~ " \n" -#~ " \n" -#~ " INSERT INTO PERSON (NAME, ID) VALUES ( UPPER(?), ? )\n" -#~ " UPDATE PERSON SET NAME=UPPER(?) WHERE ID=?\n" -#~ " DELETE FROM PERSON WHERE ID=?\n" -#~ "]]>" -#~ msgstr "" -#~ "<class name=\"Person\">\n" -#~ " <id name=\"id\">\n" -#~ " <generator class=\"increment\"/>\n" -#~ " </id>\n" -#~ " <property name=\"name\" not-null=\"true\"/>\n" -#~ " <sql-insert>INSERT INTO PERSON (NAME, ID) VALUES ( UPPER(?), ? )" -#~ "</sql-insert>\n" -#~ " <sql-update>UPDATE PERSON SET NAME=UPPER(?) WHERE ID=?</sql-" -#~ "update>\n" -#~ " <sql-delete>DELETE FROM PERSON WHERE ID=?</sql-delete>\n" -#~ "</class>" - #, fuzzy #~ msgid "" #~ "\n" @@ -1129,127 +2239,3 @@ msgstr "你甚至还可以定义一个实体装载器,它通过连接抓取装 #~ " <sql-update callable=\"true\">{? = call updatePerson (?, ?)}" #~ "</sql-update>\n" #~ "</class>" - -#, fuzzy -#~ msgid "" -#~ "" -#~ msgstr "" -#~ "CREATE OR REPLACE FUNCTION updatePerson (uid IN NUMBER, uname IN " -#~ "VARCHAR2)\n" -#~ " RETURN NUMBER IS\n" -#~ "BEGIN\n" -#~ "\n" -#~ " update PERSON\n" -#~ " set\n" -#~ " NAME = uname,\n" -#~ " where\n" -#~ " ID = uid;\n" -#~ "\n" -#~ " return SQL%ROWCOUNT;\n" -#~ "\n" -#~ "END updatePerson;" - -#, fuzzy -#~ msgid "" -#~ "\n" -#~ " \n" -#~ " SELECT NAME AS {pers.name}, ID AS {pers.id}\n" -#~ " FROM PERSON\n" -#~ " WHERE ID=?\n" -#~ " FOR UPDATE\n" -#~ "]]>" -#~ msgstr "" -#~ "<sql-query name=\"person\">\n" -#~ " <return alias=\"pers\" class=\"Person\" lock-mode=\"upgrade\"/" -#~ ">\n" -#~ " SELECT NAME AS {pers.name}, ID AS {pers.id}\n" -#~ " FROM PERSON\n" -#~ " WHERE ID=?\n" -#~ " FOR UPDATE\n" -#~ "</sql-query>" - -#, fuzzy -#~ msgid "" -#~ "\n" -#~ " \n" -#~ " \n" -#~ " \n" -#~ " \n" -#~ " \n" -#~ "]]>" -#~ msgstr "" -#~ "<class name=\"Person\">\n" -#~ " <id name=\"id\">\n" -#~ " <generator class=\"increment\"/>\n" -#~ " </id>\n" -#~ " <property name=\"name\" not-null=\"true\"/>\n" -#~ " <loader query-ref=\"person\"/>\n" -#~ "</class>" - -#, fuzzy -#~ msgid "" -#~ "\n" -#~ " \n" -#~ " \n" -#~ " \n" -#~ "]]>" -#~ msgstr "" -#~ "<set name=\"employments\" inverse=\"true\">\n" -#~ " <key/>\n" -#~ " <one-to-many class=\"Employment\"/>\n" -#~ " <loader query-ref=\"employments\"/>\n" -#~ "</set>" - -#, fuzzy -#~ msgid "" -#~ "\n" -#~ " \n" -#~ " SELECT {emp.*}\n" -#~ " FROM EMPLOYMENT emp\n" -#~ " WHERE EMPLOYER = :id\n" -#~ " ORDER BY STARTDATE ASC, EMPLOYEE ASC\n" -#~ "]]>" -#~ msgstr "" -#~ "<sql-query name=\"employments\">\n" -#~ " <load-collection alias=\"emp\" role=\"Person.employments\"/>\n" -#~ " SELECT {emp.*}\n" -#~ " FROM EMPLOYMENT emp\n" -#~ " WHERE EMPLOYER = :id\n" -#~ " ORDER BY STARTDATE ASC, EMPLOYEE ASC\n" -#~ "</sql-query>" - -#, fuzzy -#~ msgid "" -#~ "\n" -#~ " \n" -#~ " \n" -#~ " SELECT NAME AS {pers.*}, {emp.*}\n" -#~ " FROM PERSON pers\n" -#~ " LEFT OUTER JOIN EMPLOYMENT emp\n" -#~ " ON pers.ID = emp.PERSON_ID\n" -#~ " WHERE ID=?\n" -#~ "]]>" -#~ msgstr "" -#~ "<sql-query name=\"person\">\n" -#~ " <return alias=\"pers\" class=\"Person\"/>\n" -#~ " <return-join alias=\"emp\" property=\"pers.employments\"/>\n" -#~ " SELECT NAME AS {pers.*}, {emp.*}\n" -#~ " FROM PERSON pers\n" -#~ " LEFT OUTER JOIN EMPLOYMENT emp\n" -#~ " ON pers.ID = emp.PERSON_ID\n" -#~ " WHERE ID=?\n" -#~ "</sql-query>" - diff --git a/documentation/manual/src/main/docbook/zh-CN/content/session_api.po b/documentation/manual/src/main/docbook/zh-CN/content/session_api.po index 0fe357d2d0..cdcd9e7cb2 100644 --- a/documentation/manual/src/main/docbook/zh-CN/content/session_api.po +++ b/documentation/manual/src/main/docbook/zh-CN/content/session_api.po @@ -6,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: session_api\n" "Report-Msgid-Bugs-To: http://bugs.kde.org\n" -"POT-Creation-Date: 2010-03-12T00:03:48\n" +"POT-Creation-Date: 2010-07-20 21:02+0000\n" "PO-Revision-Date: 2010-03-16 09:58+1000\n" "Last-Translator: Xi HUANG \n" "Language-Team: \n" @@ -16,1328 +16,2528 @@ msgstr "" "X-Generator: KBabel 1.11.4\n" #. Tag: title +#: session_api.xml:31 #, no-c-format msgid "Working with objects" msgstr "与对象共事" #. Tag: para +#: session_api.xml:33 #, no-c-format -msgid "Hibernate is a full object/relational mapping solution that not only shields the developer from the details of the underlying database management system, but also offers state management of objects. This is, contrary to the management of SQL statements in common JDBC/SQL persistence layers, a natural object-oriented view of persistence in Java applications." -msgstr "Hibernate 是完整的对象/关系映射解决方案,它提供了对象状态管理(state management)的功能,使开发者不再需要理会底层数据库系统的细节。也就是说,相对于常见的 JDBC/SQL 持久层方案中需要管理 SQL 语句,Hibernate 采用了更自然的面向对象的视角来持久化 Java 应用中的数据。 " +msgid "" +"Hibernate is a full object/relational mapping solution that not only shields " +"the developer from the details of the underlying database management system, " +"but also offers state management of objects. This is, " +"contrary to the management of SQL statements in common " +"JDBC/SQL persistence layers, a natural object-oriented view of persistence " +"in Java applications." +msgstr "" +"Hibernate 是完整的对象/关系映射解决方案,它提供了对象状态管理" +"(state management)的功能,使开发者不再需要理会底层数据库系统的细" +"节。也就是说,相对于常见的 JDBC/SQL 持久层方案中需要管理 SQL 语句,Hibernate 采用了更自然的面向对象的视角来持久化 Java 应用中的数据。 " #. Tag: para +#: session_api.xml:40 #, no-c-format -msgid "In other words, Hibernate application developers should always think about the state of their objects, and not necessarily about the execution of SQL statements. This part is taken care of by Hibernate and is only relevant for the application developer when tuning the performance of the system." -msgstr "换句话说,使用 Hibernate 的开发者应该总是关注对象的状态(state),不必考虑 SQL 语句的执行。这部分细节已经由 Hibernate 掌管妥当,只有开发者在进行系统性能调优的时候才需要进行了解。" +msgid "" +"In other words, Hibernate application developers should always think about " +"the state of their objects, and not necessarily about " +"the execution of SQL statements. This part is taken care of by Hibernate and " +"is only relevant for the application developer when tuning the performance " +"of the system." +msgstr "" +"换句话说,使用 Hibernate 的开发者应该总是关注对象的状态(state),不必考虑 SQL 语句的执行。这部分细节已经由 Hibernate 掌管妥当,只有" +"开发者在进行系统性能调优的时候才需要进行了解。" #. Tag: title +#: session_api.xml:47 #, no-c-format msgid "Hibernate object states" msgstr "Hibernate 对象状态(object states)" #. Tag: para +#: session_api.xml:49 #, no-c-format msgid "Hibernate defines and supports the following object states:" msgstr "Hibernate 定义并支持下列对象状态(state):" #. Tag: para +#: session_api.xml:53 #, no-c-format -msgid "Transient - an object is transient if it has just been instantiated using the new operator, and it is not associated with a Hibernate Session. It has no persistent representation in the database and no identifier value has been assigned. Transient instances will be destroyed by the garbage collector if the application does not hold a reference anymore. Use the Hibernate Session to make an object persistent (and let Hibernate take care of the SQL statements that need to be executed for this transition)." -msgstr "瞬时(Transient) — 由 new 操作符创建,且尚未与Hibernate Session 关联的对象被认定为瞬时(Transient)的。瞬时(Transient)对象不会被持久化到数据库中,也不会被赋予持久化标识(identifier)。 如果瞬时(Transient)对象在程序中没有被引用,它会被垃圾回收器(garbage collector)销毁。 使用 Hibernate Session可以将其变为持久(Persistent)状态。(Hibernate会自动执行必要的SQL语句) " +msgid "" +"Transient - an object is transient if it has just been " +"instantiated using the new operator, and it is not " +"associated with a Hibernate Session. It has no persistent " +"representation in the database and no identifier value has been assigned. " +"Transient instances will be destroyed by the garbage collector if the " +"application does not hold a reference anymore. Use the Hibernate " +"Session to make an object persistent (and let Hibernate " +"take care of the SQL statements that need to be executed for this " +"transition)." +msgstr "" +"瞬时(Transient) — 由 new 操作符创" +"建,且尚未与Hibernate Session 关联的对象被认定为瞬时" +"(Transient)的。瞬时(Transient)对象不会被持久化到数据库中,也不会被赋予持" +"久化标识(identifier)。 如果瞬时(Transient)对象在程序中没有被引用,它会被" +"垃圾回收器(garbage collector)销毁。 使用 Hibernate Session可以将其变为持久(Persistent)状态。(Hibernate会自动执行必要的SQL语" +"句) " #. Tag: para +#: session_api.xml:65 #, no-c-format -msgid "Persistent - a persistent instance has a representation in the database and an identifier value. It might just have been saved or loaded, however, it is by definition in the scope of a Session. Hibernate will detect any changes made to an object in persistent state and synchronize the state with the database when the unit of work completes. Developers do not execute manual UPDATE statements, or DELETE statements when an object should be made transient." -msgstr "持久(Persistent) — 持久(Persistent)的实例在数据库中有对应的记录,并拥有一个持久化标识(identifier)。 持久(Persistent)的实例可能是刚被保存的,或刚被加载的,无论哪一种,按定义,它存在于相关联的Session作用范围内。 Hibernate会检测到处于持久(Persistent)状态的对象的任何改动,在当前操作单元(unit of work)执行完毕时将对象数据(state)与数据库同步(synchronize)。 开发者不需要手动执行UPDATE。将对象从持久(Persistent)状态变成瞬时(Transient)状态同样也不需要手动执行 DELETE 语句。 " +msgid "" +"Persistent - a persistent instance has a representation " +"in the database and an identifier value. It might just have been saved or " +"loaded, however, it is by definition in the scope of a Session. Hibernate will detect any changes made to an object in persistent " +"state and synchronize the state with the database when the unit of work " +"completes. Developers do not execute manual UPDATE " +"statements, or DELETE statements when an object should be " +"made transient." +msgstr "" +"持久(Persistent) — 持久(Persistent)的实例在数据库中" +"有对应的记录,并拥有一个持久化标识(identifier)。 持久(Persistent)的实例可" +"能是刚被保存的,或刚被加载的,无论哪一种,按定义,它存在于相关联的" +"Session作用范围内。 Hibernate会检测到处于持久" +"(Persistent)状态的对象的任何改动,在当前操作单元(unit of work)执行完毕时" +"将对象数据(state)与数据库同步(synchronize)。 开发者不需要手动执行" +"UPDATE。将对象从持久(Persistent)状态变成瞬时" +"(Transient)状态同样也不需要手动执行 DELETE 语句。 " #. Tag: para +#: session_api.xml:77 #, no-c-format -msgid "Detached - a detached instance is an object that has been persistent, but its Session has been closed. The reference to the object is still valid, of course, and the detached instance might even be modified in this state. A detached instance can be reattached to a new Session at a later point in time, making it (and all the modifications) persistent again. This feature enables a programming model for long running units of work that require user think-time. We call them application transactions, i.e., a unit of work from the point of view of the user." -msgstr "脱管(Detached) — 与持久(Persistent)对象关联的Session被关闭后,对象就变为脱管(Detached)的。对脱管(Detached)对象的引用依然有效,对象可继续被修改。脱管(Detached)对象如果重新关联到某个新的 Session 上, 会再次转变为持久(Persistent)的(在Detached其间的改动将被持久化到数据库)。 这个功能使得一种编程模型,即中间会给用户思考时间(user think-time)的长时间运行的操作单元(unit of work)的编程模型成为可能。我们称之为应用程序事务,即从用户观点看是一个操作单元(unit of work)。 " +msgid "" +"Detached - a detached instance is an object that has " +"been persistent, but its Session has been closed. The " +"reference to the object is still valid, of course, and the detached instance " +"might even be modified in this state. A detached instance can be reattached " +"to a new Session at a later point in time, making it (and " +"all the modifications) persistent again. This feature enables a programming " +"model for long running units of work that require user think-time. We call " +"them application transactions, i.e., a unit of work " +"from the point of view of the user." +msgstr "" +"脱管(Detached) — 与持久(Persistent)对象关联的" +"Session被关闭后,对象就变为脱管(Detached)的。对脱管" +"(Detached)对象的引用依然有效,对象可继续被修改。脱管(Detached)对象如果重" +"新关联到某个新的 Session 上, 会再次转变为持久" +"(Persistent)的(在Detached其间的改动将被持久化到数据库)。 这个功能使得一种" +"编程模型,即中间会给用户思考时间(user think-time)的长时间运行的操作单元" +"(unit of work)的编程模型成为可能。我们称之为应用程序事务,即从用户观点看是一个操作单元(unit of work)。 " #. Tag: para +#: session_api.xml:90 #, no-c-format -msgid "We will now discuss the states and state transitions (and the Hibernate methods that trigger a transition) in more detail." -msgstr "接下来我们来细致地讨论下状态(states)及状态间的转换(state transitions)(以及触发状态转换的 Hibernate 方法)。 " +msgid "" +"We will now discuss the states and state transitions (and the Hibernate " +"methods that trigger a transition) in more detail." +msgstr "" +"接下来我们来细致地讨论下状态(states)及状态间的转换(state transitions)(以" +"及触发状态转换的 Hibernate 方法)。 " #. Tag: title +#: session_api.xml:95 #, no-c-format msgid "Making objects persistent" msgstr "使对象持久化" #. Tag: para +#: session_api.xml:97 #, no-c-format -msgid "Newly instantiated instances of a persistent class are considered transient by Hibernate. We can make a transient instance persistent by associating it with a session:" -msgstr "Hibernate 认为持久化类(persistent class)新实例化的对象是瞬时(Transient)的。我们可通过将瞬时(Transient)对象与 session 关联而把它变为持久的(Persistent)。" +msgid "" +"Newly instantiated instances of a persistent class are considered " +"transient by Hibernate. We can make a transient " +"instance persistent by associating it with a session:" +msgstr "" +"Hibernate 认为持久化类(persistent class)新实例化的对象是瞬时" +"(Transient)的。我们可通过将瞬时(Transient)对象与 session 关联" +"而把它变为持久的(Persistent)。" + +#. Tag: programlisting +#: session_api.xml:102 +#, fuzzy, no-c-format +msgid "" +"DomesticCat fritz = new DomesticCat();\n" +"fritz.setColor(Color.GINGER);\n" +"fritz.setSex('M');\n" +"fritz.setName(\"Fritz\");\n" +"Long generatedId = (Long) sess.save(fritz);" +msgstr "" +"" #. Tag: para +#: session_api.xml:104 #, no-c-format -msgid "If Cat has a generated identifier, the identifier is generated and assigned to the cat when save() is called. If Cat has an assigned identifier, or a composite key, the identifier should be assigned to the cat instance before calling save(). You can also use persist() instead of save(), with the semantics defined in the EJB3 early draft." -msgstr "如果 Cat 的持久化标识(identifier)是 generated 类型的, 那么该标识(identifier)会自动在 save() 被调用时产生并分配给 cat。如果 Cat 的持久化标识(identifier)是assigned类型的,或是一个复合主键(composite key),那么该标识(identifier)应当在调用 save() 之前手动赋予给 cat。你也可以按照 EJB3 early draft 中定义的语义,使用 persist() 替代save()。 " +msgid "" +"If Cat has a generated identifier, the identifier is " +"generated and assigned to the cat when save() is called. If Cat has an assigned identifier, or a composite key, the identifier should be assigned " +"to the cat instance before calling save(). You can also use persist() instead of " +"save(), with the semantics defined in the EJB3 early " +"draft." +msgstr "" +"如果 Cat 的持久化标识(identifier)是 generated 类型的, 那么该标识(identifier)会自动在 save() " +"被调用时产生并分配给 cat。如果 Cat 的持" +"久化标识(identifier)是assigned类型的,或是一个复合主键" +"(composite key),那么该标识(identifier)应当在调用 save() 之前手动赋予给 cat。你也可以按照 EJB3 early " +"draft 中定义的语义,使用 persist() 替代save()。 " #. Tag: para +#: session_api.xml:115 #, no-c-format -msgid "persist() makes a transient instance persistent. However, it does not guarantee that the identifier value will be assigned to the persistent instance immediately, the assignment might happen at flush time. persist() also guarantees that it will not execute an INSERT statement if it is called outside of transaction boundaries. This is useful in long-running conversations with an extended Session/persistence context." -msgstr "persist() 使一个临时实例持久化。然而,它不保证立即把标识符值分配给持久性实例,这会发生在冲刷(flush)的时候。persist() 也保证它在事务边界外调用时不会执行 INSERT 语句。这对于长期运行的带有扩展会话/持久化上下文的会话是很有用的。" +msgid "" +"persist() makes a transient instance persistent. However, " +"it does not guarantee that the identifier value will be assigned to the " +"persistent instance immediately, the assignment might happen at flush time. " +"persist() also guarantees that it will not execute an " +"INSERT statement if it is called outside of transaction " +"boundaries. This is useful in long-running conversations with an extended " +"Session/persistence context." +msgstr "" +"persist() 使一个临时实例持久化。然而,它不保证立即把标识符" +"值分配给持久性实例,这会发生在冲刷(flush)的时候。persist() 也保证它在事务边界外调用时不会执行 INSERT 语句。" +"这对于长期运行的带有扩展会话/持久化上下文的会话是很有用的。" #. Tag: para +#: session_api.xml:126 #, no-c-format -msgid "save() does guarantee to return an identifier. If an INSERT has to be executed to get the identifier ( e.g. \"identity\" generator, not \"sequence\"), this INSERT happens immediately, no matter if you are inside or outside of a transaction. This is problematic in a long-running conversation with an extended Session/persistence context." -msgstr "save() 保证返回一个标识符。如果需要运行 INSERT 来获取标识符(如 \"identity\" 而非 \"sequence\" 生成器),这个 INSERT 将立即执行,不管你是否在事务内部还是外部。这对于长期运行的带有扩展会话/持久化上下文的会话来说会出现问题。" +msgid "" +"save() does guarantee to return an identifier. If an " +"INSERT has to be executed to get the identifier ( e.g. \"identity\" " +"generator, not \"sequence\"), this INSERT happens immediately, no matter if " +"you are inside or outside of a transaction. This is problematic in a long-" +"running conversation with an extended Session/persistence context." +msgstr "" +"save() 保证返回一个标识符。如果需要运行 INSERT 来获取标识" +"符(如 \"identity\" 而非 \"sequence\" 生成器),这个 INSERT 将立即执行,不管" +"你是否在事务内部还是外部。这对于长期运行的带有扩展会话/持久化上下文的会话来说" +"会出现问题。" #. Tag: para +#: session_api.xml:135 #, no-c-format -msgid "Alternatively, you can assign the identifier using an overloaded version of save()." +msgid "" +"Alternatively, you can assign the identifier using an overloaded version of " +"save()." msgstr "此外,你可以用一个重载版本的 save() 方法。 " -#. Tag: para -#, no-c-format -msgid "If the object you make persistent has associated objects (e.g. the kittens collection in the previous example), these objects can be made persistent in any order you like unless you have a NOT NULL constraint upon a foreign key column. There is never a risk of violating foreign key constraints. However, you might violate a NOT NULL constraint if you save() the objects in the wrong order." -msgstr "如果你持久化的对象有关联的对象(associated objects)(例如上例中的 kittens 集合) 那么对这些对象(译注:pk 和 kittens)进行持久化的顺序是任意的(也就是说可以先对 kittens 进行持久化也可以先对 pk 进行持久化), 除非你在外键列上有 NOT NULL 约束。 Hibernate 不会违反外键约束,但是如果你用错误的顺序持久化对象(译注:在 pk 持久化之前持久化kitten),那么可能会违反 NOT NULL 约束。 " +#. Tag: programlisting +#: session_api.xml:138 +#, fuzzy, no-c-format +msgid "" +"DomesticCat pk = new DomesticCat();\n" +"pk.setColor(Color.TABBY);\n" +"pk.setSex('F');\n" +"pk.setName(\"PK\");\n" +"pk.setKittens( new HashSet() );\n" +"pk.addKitten(fritz);\n" +"sess.save( pk, new Long(1234) );" +msgstr "" +"" #. Tag: para +#: session_api.xml:140 #, no-c-format -msgid "Usually you do not bother with this detail, as you will normally use Hibernate's transitive persistence feature to save the associated objects automatically. Then, even NOT NULL constraint violations do not occur - Hibernate will take care of everything. Transitive persistence is discussed later in this chapter." -msgstr "通常你不会为这些细节烦心,因为你很可能会使用 Hibernate 的传播性持久化(transitive persistence)功能自动保存相关联那些对象。这样连违反 NOT NULL 约束的情况都不会出现了 — Hibernate 会管好所有的事情。传播性持久化(transitive persistence)将在本章稍后讨论。" +msgid "" +"If the object you make persistent has associated objects (e.g. the " +"kittens collection in the previous example), these " +"objects can be made persistent in any order you like unless you have a " +"NOT NULL constraint upon a foreign key column. There is " +"never a risk of violating foreign key constraints. However, you might " +"violate a NOT NULL constraint if you save() the objects in the wrong order." +msgstr "" +"如果你持久化的对象有关联的对象(associated objects)(例如上例中的 " +"kittens 集合) 那么对这些对象(译注:pk 和 kittens)进行持" +"久化的顺序是任意的(也就是说可以先对 kittens 进行持久化也可以先对 pk 进行持久" +"化), 除非你在外键列上有 NOT NULL 约束。 Hibernate 不会违" +"反外键约束,但是如果你用错误的顺序持久化对象(译注:在 pk 持久化之前持久化" +"kitten),那么可能会违反 NOT NULL 约束。 " + +#. Tag: para +#: session_api.xml:148 +#, no-c-format +msgid "" +"Usually you do not bother with this detail, as you will normally use " +"Hibernate's transitive persistence feature to save the " +"associated objects automatically. Then, even NOT NULL " +"constraint violations do not occur - Hibernate will take care of everything. " +"Transitive persistence is discussed later in this chapter." +msgstr "" +"通常你不会为这些细节烦心,因为你很可能会使用 Hibernate 的传播性持久" +"化(transitive persistence)功能自动保存相关联那些对象。这样连违" +"反 NOT NULL 约束的情况都不会出现了 — Hibernate 会管好所有" +"的事情。传播性持久化(transitive persistence)将在本章稍后讨论。" #. Tag: title +#: session_api.xml:157 #, no-c-format msgid "Loading an object" msgstr "装载对象" #. Tag: para +#: session_api.xml:159 #, no-c-format -msgid "The load() methods of Session provide a way of retrieving a persistent instance if you know its identifier. load() takes a class object and loads the state into a newly instantiated instance of that class in a persistent state." -msgstr "如果你知道某个实例的持久化标识(identifier),你就可以使用 Sessionload() 方法来获取它。load() 的另一个参数是指定类的对象。本方法会创建指定类的持久化实例,并从数据库加载其数据(state)。 " +msgid "" +"The load() methods of Session provide " +"a way of retrieving a persistent instance if you know its identifier. " +"load() takes a class object and loads the state into a " +"newly instantiated instance of that class in a persistent state." +msgstr "" +"如果你知道某个实例的持久化标识(identifier),你就可以使用 Sessionload() 方法来获取它。load() 的另一个参数是指定类的对象。本方法会创建指定类的持久化实例,并从数据" +"库加载其数据(state)。 " + +#. Tag: programlisting +#: session_api.xml:165 +#, fuzzy, no-c-format +msgid "Cat fritz = (Cat) sess.load(Cat.class, generatedId);" +msgstr "" + +#. Tag: programlisting +#: session_api.xml:167 +#, fuzzy, no-c-format +msgid "" +"// you need to wrap primitive identifiers\n" +"long id = 1234;\n" +"DomesticCat pk = (DomesticCat) sess.load( DomesticCat.class, new Long(id) );" +msgstr "" +"" #. Tag: para +#: session_api.xml:169 #, no-c-format msgid "Alternatively, you can load state into a given instance:" -msgstr "此外,你可以把数据(state)加载到指定的对象实例上(覆盖掉该实例原来的数据)。" +msgstr "" +"此外,你可以把数据(state)加载到指定的对象实例上(覆盖掉该实例原来的数据)。" + +#. Tag: programlisting +#: session_api.xml:171 +#, fuzzy, no-c-format +msgid "" +"Cat cat = new DomesticCat();\n" +"// load pk's state into cat\n" +"sess.load( cat, new Long(pkId) );\n" +"Set kittens = cat.getKittens();" +msgstr "" +"" #. Tag: para +#: session_api.xml:173 #, no-c-format -msgid "Be aware that load() will throw an unrecoverable exception if there is no matching database row. If the class is mapped with a proxy, load() just returns an uninitialized proxy and does not actually hit the database until you invoke a method of the proxy. This is useful if you wish to create an association to an object without actually loading it from the database. It also allows multiple instances to be loaded as a batch if batch-size is defined for the class mapping." -msgstr "请注意如果没有匹配的数据库记录,load() 方法可能抛出无法恢复的异常(unrecoverable exception)。如果类的映射使用了代理(proxy),load() 方法会返回一个未初始化的代理,直到你调用该代理的某方法时才会去访问数据库。 若你希望在某对象中创建一个指向另一个对象的关联,又不想在从数据库中装载该对象时同时装载相关联的那个对象,那么这种操作方式就用得上的了。如果为相应类映射关系设置了 batch-size,那么使用这种操作方式允许多个对象被一批装载(因为返回的是代理,无需从数据库中抓取所有对象的数据)。 " +msgid "" +"Be aware that load() will throw an unrecoverable " +"exception if there is no matching database row. If the class is mapped with " +"a proxy, load() just returns an uninitialized proxy and " +"does not actually hit the database until you invoke a method of the proxy. " +"This is useful if you wish to create an association to an object without " +"actually loading it from the database. It also allows multiple instances to " +"be loaded as a batch if batch-size is defined for the " +"class mapping." +msgstr "" +"请注意如果没有匹配的数据库记录,load() 方法可能抛出无法恢" +"复的异常(unrecoverable exception)。如果类的映射使用了代理(proxy)," +"load() 方法会返回一个未初始化的代理,直到你调用该代理的某" +"方法时才会去访问数据库。 若你希望在某对象中创建一个指向另一个对象的关联,又不" +"想在从数据库中装载该对象时同时装载相关联的那个对象,那么这种操作方式就用得上" +"的了。如果为相应类映射关系设置了 batch-size,那么使用这种" +"操作方式允许多个对象被一批装载(因为返回的是代理,无需从数据库中抓取所有对象" +"的数据)。 " #. Tag: para +#: session_api.xml:182 #, no-c-format -msgid "If you are not certain that a matching row exists, you should use the get() method which hits the database immediately and returns null if there is no matching row." -msgstr "如果你不确定是否有匹配的行存在,应该使用 get() 方法,它会立刻访问数据库,如果没有对应的记录,会返回 null。 " +msgid "" +"If you are not certain that a matching row exists, you should use the " +"get() method which hits the database immediately and " +"returns null if there is no matching row." +msgstr "" +"如果你不确定是否有匹配的行存在,应该使用 get() 方法,它会" +"立刻访问数据库,如果没有对应的记录,会返回 null。 " + +#. Tag: programlisting +#: session_api.xml:186 +#, fuzzy, no-c-format +msgid "" +"Cat cat = (Cat) sess.get(Cat.class, id);\n" +"if (cat==null) {\n" +" cat = new Cat();\n" +" sess.save(cat, id);\n" +"}\n" +"return cat;" +msgstr "" +"" #. Tag: para +#: session_api.xml:188 #, no-c-format -msgid "You can even load an object using an SQL SELECT ... FOR UPDATE, using a LockMode. See the API documentation for more information." -msgstr "你甚至可以选用某个 LockMode,用 SQL 的 SELECT ... FOR UPDATE 装载对象。 请查阅 API 文档以获取更多信息。 " +msgid "" +"You can even load an object using an SQL SELECT ... FOR UPDATE, using a LockMode. See the API documentation for " +"more information." +msgstr "" +"你甚至可以选用某个 LockMode,用 SQL 的 " +"SELECT ... FOR UPDATE 装载对象。 请查阅 API 文档以获取更多" +"信息。 " + +#. Tag: programlisting +#: session_api.xml:192 +#, fuzzy, no-c-format +msgid "Cat cat = (Cat) sess.get(Cat.class, id, LockMode.UPGRADE);" +msgstr "" #. Tag: para +#: session_api.xml:194 #, no-c-format -msgid "Any associated instances or contained collections will not be selected FOR UPDATE, unless you decide to specify lock or all as a cascade style for the association." -msgstr "注意,任何关联的对象或者包含的集合都不会被以 FOR UPDATE 方式返回, 除非你指定了 lock 或者 all 作为关联(association)的级联风格(cascade style)。 " +msgid "" +"Any associated instances or contained collections will not be selected FOR UPDATE, unless you decide to " +"specify lock or all as a cascade style " +"for the association." +msgstr "" +"注意,任何关联的对象或者包含的集合都不会被以 " +"FOR UPDATE 方式返回, 除非你指定了 lock 或者 all 作为关联(association)的级联风格" +"(cascade style)。 " #. Tag: para +#: session_api.xml:199 #, no-c-format -msgid "It is possible to re-load an object and all its collections at any time, using the refresh() method. This is useful when database triggers are used to initialize some of the properties of the object." -msgstr "任何时候都可以使用 refresh() 方法强迫装载对象和它的集合。如果你使用数据库触发器功能来处理对象的某些属性,这个方法就很有用了。" +msgid "" +"It is possible to re-load an object and all its collections at any time, " +"using the refresh() method. This is useful when database " +"triggers are used to initialize some of the properties of the object." +msgstr "" +"任何时候都可以使用 refresh() 方法强迫装载对象和它的集合。" +"如果你使用数据库触发器功能来处理对象的某些属性,这个方法就很有用了。" + +#. Tag: programlisting +#: session_api.xml:204 +#, fuzzy, no-c-format +msgid "" +"sess.save(cat);\n" +"sess.flush(); //force the SQL INSERT\n" +"sess.refresh(cat); //re-read the state (after the trigger executes)" +msgstr "" +"" #. Tag: para -#, no-c-format -msgid "How much does Hibernate load from the database and how many SQL SELECTs will it use? This depends on the fetching strategy. This is explained in ." -msgstr "此处通常会出现一个重要问题: Hibernate 会从数据库中装载多少东西?会执行多少条相应的 SQLSELECT 语句?这取决于抓取策略(fetching strategy),我们会在 中解释。 " +#: session_api.xml:206 +#, fuzzy, no-c-format +msgid "" +"How much does Hibernate load from the database and how many SQL " +"SELECTs will it use? This depends on the " +"fetching strategy. This is explained in ." +msgstr "" +"此处通常会出现一个重要问题: Hibernate 会从数据库中装载多少东西?会执行多少条" +"相应的 SQLSELECT 语句?这取决于抓取策略" +"(fetching strategy),我们会在 中解释。 " #. Tag: title +#: session_api.xml:213 #, no-c-format msgid "Querying" msgstr "查询" #. Tag: para +#: session_api.xml:215 #, no-c-format -msgid "If you do not know the identifiers of the objects you are looking for, you need a query. Hibernate supports an easy-to-use but powerful object oriented query language (HQL). For programmatic query creation, Hibernate supports a sophisticated Criteria and Example query feature (QBC and QBE). You can also express your query in the native SQL of your database, with optional support from Hibernate for result set conversion into objects." -msgstr "如果不知道所要寻找的对象的持久化标识,那么你需要使用查询。Hibernate 支持强大且易于使用的面向对象查询语言(HQL)。如果希望通过编程的方式创建查询,Hibernate 提供了完善的按条件(Query By Criteria,QBC)以及按样例(Query By Example,QBE)进行查询的功能。你也可以用原生 SQL(native SQL)描述查询,Hibernate 额外提供了将结果集(result set)转化为对象的支持。 " +msgid "" +"If you do not know the identifiers of the objects you are looking for, you " +"need a query. Hibernate supports an easy-to-use but powerful object oriented " +"query language (HQL). For programmatic query creation, Hibernate supports a " +"sophisticated Criteria and Example query feature (QBC and QBE). You can also " +"express your query in the native SQL of your database, with optional support " +"from Hibernate for result set conversion into objects." +msgstr "" +"如果不知道所要寻找的对象的持久化标识,那么你需要使用查询。Hibernate 支持强大" +"且易于使用的面向对象查询语言(HQL)。如果希望通过编程的方式创建查询," +"Hibernate 提供了完善的按条件(Query By Criteria,QBC)以及按样例(Query By " +"Example,QBE)进行查询的功能。你也可以用原生 SQL(native SQL)描述查询," +"Hibernate 额外提供了将结果集(result set)转化为对象的支持。 " #. Tag: title +#: session_api.xml:224 #, no-c-format msgid "Executing queries" msgstr "执行查询" #. Tag: para +#: session_api.xml:226 #, no-c-format -msgid "HQL and native SQL queries are represented with an instance of org.hibernate.Query. This interface offers methods for parameter binding, result set handling, and for the execution of the actual query. You always obtain a Query using the current Session:" -msgstr "HQL 和原生 SQL(native SQL)查询要通过为 org.hibernate.Query 的实例来表达。 这个接口提供了参数绑定、结果集处理以及运行实际查询的方法。你总是可以通过当前 Session 获取一个 Query 对象:" +msgid "" +"HQL and native SQL queries are represented with an instance of org." +"hibernate.Query. This interface offers methods for parameter " +"binding, result set handling, and for the execution of the actual query. You " +"always obtain a Query using the current Session:" +msgstr "" +"HQL 和原生 SQL(native SQL)查询要通过为 org.hibernate.Query 的实例来表达。 这个接口提供了参数绑定、结果集处理以及运行实际查询的" +"方法。你总是可以通过当前 Session 获取一个 Query 对象:" + +#. Tag: programlisting +#: session_api.xml:232 +#, fuzzy, no-c-format +msgid "" +"List cats = session.createQuery(\n" +" \"from Cat as cat where cat.birthdate < ?\")\n" +" .setDate(0, date)\n" +" .list();\n" +"\n" +"List mothers = session.createQuery(\n" +" \"select mother from Cat as cat join cat.mother as mother where cat.name " +"= ?\")\n" +" .setString(0, name)\n" +" .list();\n" +"\n" +"List kittens = session.createQuery(\n" +" \"from Cat as cat where cat.mother = ?\")\n" +" .setEntity(0, pk)\n" +" .list();\n" +"\n" +"Cat mother = (Cat) session.createQuery(\n" +" \"select cat.mother from Cat as cat where cat = ?\")\n" +" .setEntity(0, izi)\n" +" .uniqueResult();]]\n" +"\n" +"Query mothersWithKittens = (Cat) session.createQuery(\n" +" \"select mother from Cat as mother left join fetch mother.kittens\");\n" +"Set uniqueMothers = new HashSet(mothersWithKittens.list());" +msgstr "" +"" #. Tag: para +#: session_api.xml:234 #, no-c-format -msgid "A query is usually executed by invoking list(). The result of the query will be loaded completely into a collection in memory. Entity instances retrieved by a query are in a persistent state. The uniqueResult() method offers a shortcut if you know your query will only return a single object. Queries that make use of eager fetching of collections usually return duplicates of the root objects, but with their collections initialized. You can filter these duplicates through a Set." -msgstr "一个查询通常在调用 list() 时被执行,执行结果会完全装载进内存中的一个集合(collection)。查询返回的对象处于持久(persistent)状态。如果你知道的查询只会返回一个对象,可使用 list() 的快捷方式 uniqueResult()。注意,使用集合预先抓取的查询往往会返回多次根对象(他们的集合类都被初始化了)。你可以通过一个集合(Set)来过滤这些重复对象。" +msgid "" +"A query is usually executed by invoking list(). The " +"result of the query will be loaded completely into a collection in memory. " +"Entity instances retrieved by a query are in a persistent state. The " +"uniqueResult() method offers a shortcut if you know your " +"query will only return a single object. Queries that make use of eager " +"fetching of collections usually return duplicates of the root objects, but " +"with their collections initialized. You can filter these duplicates through " +"a Set." +msgstr "" +"一个查询通常在调用 list() 时被执行,执行结果会完全装载进内" +"存中的一个集合(collection)。查询返回的对象处于持久(persistent)状态。如果" +"你知道的查询只会返回一个对象,可使用 list() 的快捷方式 " +"uniqueResult()。注意,使用集合预先抓取的查询往往会返回多次" +"根对象(他们的集合类都被初始化了)。你可以通过一个集合(Set)来过滤这些重复对象。" #. Tag: title +#: session_api.xml:244 #, no-c-format msgid "Iterating results" msgstr "迭代式获取结果(Iterating results)" #. Tag: para +#: session_api.xml:246 #, no-c-format -msgid "Occasionally, you might be able to achieve better performance by executing the query using the iterate() method. This will usually be the case if you expect that the actual entity instances returned by the query will already be in the session or second-level cache. If they are not already cached, iterate() will be slower than list() and might require many database hits for a simple query, usually 1 for the initial select which only returns identifiers, and n additional selects to initialize the actual instances." -msgstr "某些情况下,你可以使用 iterate() 方法得到更好的性能。 这通常是你预期返回的结果在 session,或二级缓存(second-level cache)中已经存在时的情况。如若不然,iterate() 会比 list() 慢,而且可能简单查询也需要进行多次数据库访问:iterate() 会首先使用 1 条语句得到所有对象的持久化标识(identifiers),再根据持久化标识执行 n 条附加的 select 语句实例化实际的对象。 " +msgid "" +"Occasionally, you might be able to achieve better performance by executing " +"the query using the iterate() method. This will usually " +"be the case if you expect that the actual entity instances returned by the " +"query will already be in the session or second-level cache. If they are not " +"already cached, iterate() will be slower than " +"list() and might require many database hits for a simple " +"query, usually 1 for the initial select which only " +"returns identifiers, and n additional selects to " +"initialize the actual instances." +msgstr "" +"某些情况下,你可以使用 iterate() 方法得到更好的性能。 这通" +"常是你预期返回的结果在 session,或二级缓存(second-level cache)中已经存在时" +"的情况。如若不然,iterate() 会比 list() 慢,而且可能简单查询也需要进行多次数据库访问:iterate() 会首先使用 1 条语句得到所有对象的持久化标识" +"(identifiers),再根据持久化标识执行 n 条附加的 select " +"语句实例化实际的对象。 " + +#. Tag: programlisting +#: session_api.xml:257 +#, fuzzy, no-c-format +msgid "" +"// fetch ids\n" +"Iterator iter = sess.createQuery(\"from eg.Qux q order by q.likeliness\")." +"iterate();\n" +"while ( iter.hasNext() ) {\n" +" Qux qux = (Qux) iter.next(); // fetch the object\n" +" // something we couldnt express in the query\n" +" if ( qux.calculateComplicatedAlgorithm() ) {\n" +" // delete the current instance\n" +" iter.remove();\n" +" // dont need to process the rest\n" +" break;\n" +" }\n" +"}" +msgstr "" +"" #. Tag: title +#: session_api.xml:261 #, no-c-format msgid "Queries that return tuples" msgstr "返回元组(tuples)的查询" #. Tag: para +#: session_api.xml:263 #, no-c-format -msgid "Hibernate queries sometimes return tuples of objects. Each tuple is returned as an array:" -msgstr "(译注:元组(tuples)指一条结果行包含多个对象) Hibernate 查询有时返回元组(tuples),每个元组(tuples)以数组的形式返回: " +msgid "" +"Hibernate queries sometimes return tuples of objects. Each tuple is returned " +"as an array:" +msgstr "" +"(译注:元组(tuples)指一条结果行包含多个对象) Hibernate 查询有时返回元组" +"(tuples),每个元组(tuples)以数组的形式返回: " + +#. Tag: programlisting +#: session_api.xml:266 +#, fuzzy, no-c-format +msgid "" +"Iterator kittensAndMothers = sess.createQuery(\n" +" \"select kitten, mother from Cat kitten join kitten.mother mother" +"\")\n" +" .list()\n" +" .iterator();\n" +"\n" +"while ( kittensAndMothers.hasNext() ) {\n" +" Object[] tuple = (Object[]) kittensAndMothers.next();\n" +" Cat kitten = (Cat) tuple[0];\n" +" Cat mother = (Cat) tuple[1];\n" +" ....\n" +"}" +msgstr "" +"" #. Tag: title +#: session_api.xml:270 #, no-c-format msgid "Scalar results" msgstr "标量(Scalar)结果" #. Tag: para +#: session_api.xml:272 #, no-c-format -msgid "Queries can specify a property of a class in the select clause. They can even call SQL aggregate functions. Properties or aggregates are considered \"scalar\" results and not entities in persistent state." -msgstr "查询可在 select 从句中指定类的属性,甚至可以调用 SQL 统计(aggregate)函数。属性或统计结果被认定为\"标量(Scalar)\"的结果(而不是持久(persistent state)的实体)。 " +msgid "" +"Queries can specify a property of a class in the select " +"clause. They can even call SQL aggregate functions. Properties or aggregates " +"are considered \"scalar\" results and not entities in persistent state." +msgstr "" +"查询可在 select 从句中指定类的属性,甚至可以调用 SQL 统计" +"(aggregate)函数。属性或统计结果被认定为\"标量(Scalar)\"的结果(而不是持久" +"(persistent state)的实体)。 " + +#. Tag: programlisting +#: session_api.xml:277 +#, fuzzy, no-c-format +msgid "" +"Iterator results = sess.createQuery(\n" +" \"select cat.color, min(cat.birthdate), count(cat) from Cat cat \" " +"+\n" +" \"group by cat.color\")\n" +" .list()\n" +" .iterator();\n" +"\n" +"while ( results.hasNext() ) {\n" +" Object[] row = (Object[]) results.next();\n" +" Color type = (Color) row[0];\n" +" Date oldest = (Date) row[1];\n" +" Integer count = (Integer) row[2];\n" +" .....\n" +"}" +msgstr "" +"" #. Tag: title +#: session_api.xml:281 #, no-c-format msgid "Bind parameters" msgstr "绑定参数" #. Tag: para +#: session_api.xml:283 #, no-c-format -msgid "Methods on Query are provided for binding values to named parameters or JDBC-style ? parameters. Contrary to JDBC, Hibernate numbers parameters from zero. Named parameters are identifiers of the form :name in the query string. The advantages of named parameters are as follows:" -msgstr "接口 Query 提供了对命名参数(named parameters)、JDBC 风格的问号(?)参数进行绑定的方法。不同于 JDBC,Hibernate 对参数从 0 开始计数。 命名参数(named parameters)在查询字符串中是形如 :name 的标识符。命名参数(named parameters)的优点是: " +msgid "" +"Methods on Query are provided for binding values to named " +"parameters or JDBC-style ? parameters. Contrary " +"to JDBC, Hibernate numbers parameters from zero. Named parameters " +"are identifiers of the form :name in the query string. " +"The advantages of named parameters are as follows:" +msgstr "" +"接口 Query 提供了对命名参数(named parameters)、JDBC 风格" +"的问号(?)参数进行绑定的方法。不同于 JDBC," +"Hibernate 对参数从 0 开始计数。 命名参数(named parameters)在查询" +"字符串中是形如 :name 的标识符。命名参数(named " +"parameters)的优点是: " #. Tag: para +#: session_api.xml:292 #, no-c-format -msgid "named parameters are insensitive to the order they occur in the query string" +msgid "" +"named parameters are insensitive to the order they occur in the query string" msgstr "命名参数(named parameters)与其在查询串中出现的顺序无关" #. Tag: para +#: session_api.xml:297 #, no-c-format msgid "they can occur multiple times in the same query" msgstr "它们可在同一查询串中多次出现 " #. Tag: para +#: session_api.xml:301 #, no-c-format msgid "they are self-documenting" msgstr "它们本身是自我说明的" +#. Tag: programlisting +#: session_api.xml:305 +#, fuzzy, no-c-format +msgid "" +"//named parameter (preferred)\n" +"Query q = sess.createQuery(\"from DomesticCat cat where cat.name = :name" +"\");\n" +"q.setString(\"name\", \"Fritz\");\n" +"Iterator cats = q.iterate();" +msgstr "" +"" + +#. Tag: programlisting +#: session_api.xml:307 +#, fuzzy, no-c-format +msgid "" +"//positional parameter\n" +"Query q = sess.createQuery(\"from DomesticCat cat where cat.name = ?\");\n" +"q.setString(0, \"Izi\");\n" +"Iterator cats = q.iterate();" +msgstr "" +"" + +#. Tag: programlisting +#: session_api.xml:309 +#, fuzzy, no-c-format +msgid "" +"//named parameter list\n" +"List names = new ArrayList();\n" +"names.add(\"Izi\");\n" +"names.add(\"Fritz\");\n" +"Query q = sess.createQuery(\"from DomesticCat cat where cat.name in (:" +"namesList)\");\n" +"q.setParameterList(\"namesList\", names);\n" +"List cats = q.list();" +msgstr "" +"" + #. Tag: title +#: session_api.xml:313 #, no-c-format msgid "Pagination" msgstr "分页" #. Tag: para +#: session_api.xml:315 #, no-c-format -msgid "If you need to specify bounds upon your result set, that is, the maximum number of rows you want to retrieve and/or the first row you want to retrieve, you can use methods of the Query interface:" -msgstr "如果你需要指定结果集的范围(希望返回的最大行数/或开始的行数),应该使用 Query 接口提供的方法: " +msgid "" +"If you need to specify bounds upon your result set, that is, the maximum " +"number of rows you want to retrieve and/or the first row you want to " +"retrieve, you can use methods of the Query interface:" +msgstr "" +"如果你需要指定结果集的范围(希望返回的最大行数/或开始的行数),应该使用 " +"Query 接口提供的方法: " + +#. Tag: programlisting +#: session_api.xml:320 +#, fuzzy, no-c-format +msgid "" +"Query q = sess.createQuery(\"from DomesticCat cat\");\n" +"q.setFirstResult(20);\n" +"q.setMaxResults(10);\n" +"List cats = q.list();" +msgstr "" +"" #. Tag: para +#: session_api.xml:322 #, no-c-format -msgid "Hibernate knows how to translate this limit query into the native SQL of your DBMS." -msgstr "Hibernate 知道如何将这个有限定条件的查询转换成你的数据库的原生 SQL(native SQL)。" +msgid "" +"Hibernate knows how to translate this limit query into the native SQL of " +"your DBMS." +msgstr "" +"Hibernate 知道如何将这个有限定条件的查询转换成你的数据库的原生 SQL(native " +"SQL)。" #. Tag: title +#: session_api.xml:327 #, no-c-format msgid "Scrollable iteration" msgstr "可滚动遍历(Scrollable iteration)" #. Tag: para +#: session_api.xml:329 #, no-c-format -msgid "If your JDBC driver supports scrollable ResultSets, the Query interface can be used to obtain a ScrollableResults object that allows flexible navigation of the query results." -msgstr "如果你的 JDBC 驱动支持可滚动的 ResuleSetQuery 接口可以使用 ScrollableResults,允许你在查询结果中灵活游走。 " +msgid "" +"If your JDBC driver supports scrollable ResultSets, the " +"Query interface can be used to obtain a " +"ScrollableResults object that allows flexible navigation " +"of the query results." +msgstr "" +"如果你的 JDBC 驱动支持可滚动的 ResuleSetQuery 接口可以使用 ScrollableResults,允许你在查询结果" +"中灵活游走。 " + +#. Tag: programlisting +#: session_api.xml:334 +#, fuzzy, no-c-format +msgid "" +"Query q = sess.createQuery(\"select cat.name, cat from DomesticCat cat \" +\n" +" \"order by cat.name\");\n" +"ScrollableResults cats = q.scroll();\n" +"if ( cats.first() ) {\n" +"\n" +" // find the first name on each page of an alphabetical list of cats by " +"name\n" +" firstNamesOfPages = new ArrayList();\n" +" do {\n" +" String name = cats.getString(0);\n" +" firstNamesOfPages.add(name);\n" +" }\n" +" while ( cats.scroll(PAGE_SIZE) );\n" +"\n" +" // Now get the first page of cats\n" +" pageOfCats = new ArrayList();\n" +" cats.beforeFirst();\n" +" int i=0;\n" +" while( ( PAGE_SIZE > i++ ) && cats.next() ) pageOfCats.add" +"( cats.get(1) );\n" +"\n" +"}\n" +"cats.close()" +msgstr "" +" i++ ) && cats.next() ) pageOfCats.add( cats.get" +"(1) );\n" +"\n" +"}\n" +"cats.close()]]>" #. Tag: para +#: session_api.xml:336 #, no-c-format -msgid "Note that an open database connection and cursor is required for this functionality. Use setMaxResult()/setFirstResult() if you need offline pagination functionality." -msgstr "请注意,使用此功能需要保持数据库连接(以及游标(cursor))处于一直打开状态。如果你需要断开连接使用分页功能,请使用 setMaxResult()/setFirstResult()。 " +msgid "" +"Note that an open database connection and cursor is required for this " +"functionality. Use setMaxResult()/setFirstResult" +"() if you need offline pagination functionality." +msgstr "" +"请注意,使用此功能需要保持数据库连接(以及游标(cursor))处于一直打开状态。" +"如果你需要断开连接使用分页功能,请使用 setMaxResult()/" +"setFirstResult()。 " #. Tag: title +#: session_api.xml:343 #, no-c-format msgid "Externalizing named queries" msgstr "外置命名查询(Externalizing named queries)" #. Tag: para +#: session_api.xml:345 #, no-c-format -msgid "You can also define named queries in the mapping document. Remember to use a CDATA section if your query contains characters that could be interpreted as markup." -msgstr "你可以在映射文件中定义命名查询(named queries)。如果你的查询串中包含可能被解释为 XML 标记(markup)的字符,别忘了用CDATA包裹起来。" - -#. Tag: para -#, no-c-format -msgid "Parameter binding and executing is done programatically:" -msgstr "参数绑定及执行以编程方式(programatically)完成:" - -#. Tag: para -#, no-c-format -msgid "The actual program code is independent of the query language that is used. You can also define native SQL queries in metadata, or migrate existing queries to Hibernate by placing them in mapping files." -msgstr "请注意实际的程序代码与所用的查询语言无关,你也可在元数据中定义原生 SQL(native SQL)查询,或将原有的其他的查询语句放在配置文件中,这样就可以让 Hibernate 统一管理,达到迁移的目的。 " - -#. Tag: para -#, no-c-format -msgid "Also note that a query declaration inside a <hibernate-mapping> element requires a global unique name for the query, while a query declaration inside a <class> element is made unique automatically by prepending the fully qualified name of the class. For example eg.Cat.ByNameAndMaximumWeight." -msgstr "也请注意在 <hibernate-mapping> 元素中声明的查询必须有一个全局唯一的名字,而在 <class> 元素中声明的查询自动具有全局名,是通过类的全名加以限定的。比如 eg.Cat.ByNameAndMaximumWeight。 " +msgid "" +"Queries can also be configured as so called named queries using annotations " +"or Hibernate mapping documents. @NamedQuery and " +"@NamedQueries can be defined at the class level as seen " +"in . However their " +"definitions are global to the session factory/entity manager factory scope. " +"A named query is defined by its name and the actual query string." +msgstr "" #. Tag: title +#: session_api.xml:355 +#, no-c-format +msgid "Defining a named query using @NamedQuery" +msgstr "" + +#. Tag: programlisting +#: session_api.xml:358 +#, no-c-format +msgid "" +"@Entity\n" +"@NamedQuery(name=\"night.moreRecentThan\", query=\"select n from Night n " +"where n.date >= :date\")\n" +"public class Night {\n" +" ...\n" +"}\n" +"\n" +"public class MyDao {\n" +" doStuff() {\n" +" Query q = s.getNamedQuery(\"night.moreRecentThan\");\n" +" q.setDate( \"date\", aMonthAgo );\n" +" List results = q.list();\n" +" ...\n" +" }\n" +" ...\n" +"}" +msgstr "" + +#. Tag: para +#: session_api.xml:361 +#, fuzzy, no-c-format +msgid "" +"Using a mapping document can be configured using the <query> node. Remember to use a CDATA section if your " +"query contains characters that could be interpreted as markup." +msgstr "" +"你可以在映射文件中定义命名查询(named queries)。如果你的查询串中包含可能被解" +"释为 XML 标记(markup)的字符,别忘了用CDATA包裹起来。" + +#. Tag: title +#: session_api.xml:367 +#, no-c-format +msgid "Defining a named query using <query>" +msgstr "" + +#. Tag: programlisting +#: session_api.xml:370 +#, fuzzy, no-c-format +msgid "" +"<query name=\"ByNameAndMaximumWeight\"><![CDATA[\n" +" from eg.DomesticCat as cat\n" +" where cat.name = ?\n" +" and cat.weight > ?\n" +"] ]></query>" +msgstr "" +" ?\n" +"] ]>]]>" + +#. Tag: para +#: session_api.xml:373 +#, fuzzy, no-c-format +msgid "" +"Parameter binding and executing is done programatically as seen in ." +msgstr "参数绑定及执行以编程方式(programatically)完成:" + +#. Tag: title +#: session_api.xml:377 +#, no-c-format +msgid "Parameter binding of a named query" +msgstr "" + +#. Tag: programlisting +#: session_api.xml:379 +#, fuzzy, no-c-format +msgid "" +"Query q = sess.getNamedQuery(\"ByNameAndMaximumWeight\");\n" +"q.setString(0, name);\n" +"q.setInt(1, minWeight);\n" +"List cats = q.list();" +msgstr "" +"" + +#. Tag: para +#: session_api.xml:382 +#, no-c-format +msgid "" +"The actual program code is independent of the query language that is used. " +"You can also define native SQL queries in metadata, or migrate existing " +"queries to Hibernate by placing them in mapping files." +msgstr "" +"请注意实际的程序代码与所用的查询语言无关,你也可在元数据中定义原生 SQL" +"(native SQL)查询,或将原有的其他的查询语句放在配置文件中,这样就可以让 " +"Hibernate 统一管理,达到迁移的目的。 " + +#. Tag: para +#: session_api.xml:387 +#, no-c-format +msgid "" +"Also note that a query declaration inside a <hibernate-" +"mapping> element requires a global unique name for the query, " +"while a query declaration inside a <class> element " +"is made unique automatically by prepending the fully qualified name of the " +"class. For example eg.Cat.ByNameAndMaximumWeight." +msgstr "" +"也请注意在 <hibernate-mapping> 元素中声明的查询必须" +"有一个全局唯一的名字,而在 <class> 元素中声明的查询自" +"动具有全局名,是通过类的全名加以限定的。比如 eg.Cat." +"ByNameAndMaximumWeight。 " + +#. Tag: title +#: session_api.xml:397 #, no-c-format msgid "Filtering collections" msgstr "过滤集合" #. Tag: para +#: session_api.xml:399 #, no-c-format -msgid "A collection filter is a special type of query that can be applied to a persistent collection or array. The query string can refer to this, meaning the current collection element." -msgstr "集合过滤器(filter)是一种用于一个持久化集合或者数组的特殊的查询。查询字符串中可以使用 \"this\" 来引用集合中的当前元素。 " +msgid "" +"A collection filter is a special type of query that can " +"be applied to a persistent collection or array. The query string can refer " +"to this, meaning the current collection element." +msgstr "" +"集合过滤器(filter)是一种用于一个持久化集合或者数组的特" +"殊的查询。查询字符串中可以使用 \"this\" 来引用集合中的当前" +"元素。 " + +#. Tag: programlisting +#: session_api.xml:404 +#, fuzzy, no-c-format +msgid "" +"Collection blackKittens = session.createFilter(\n" +" pk.getKittens(), \n" +" \"where this.color = ?\")\n" +" .setParameter( Color.BLACK, Hibernate.custom(ColorUserType.class) )\n" +" .list()\n" +");" +msgstr "" +"" #. Tag: para +#: session_api.xml:406 #, no-c-format -msgid "The returned collection is considered a bag that is a copy of the given collection. The original collection is not modified. This is contrary to the implication of the name \"filter\", but consistent with expected behavior." -msgstr "返回的集合可以被认为是一个包(bag,无顺序可重复的集合(collection)),它是所给集合的副本。 原来的集合不会被改动(这与“过滤器(filter)”的隐含的含义不符,不过与我们期待的行为一致)。 " +msgid "" +"The returned collection is considered a bag that is a copy of the given " +"collection. The original collection is not modified. This is contrary to the " +"implication of the name \"filter\", but consistent with expected behavior." +msgstr "" +"返回的集合可以被认为是一个包(bag,无顺序可重复的集合(collection)),它是所" +"给集合的副本。 原来的集合不会被改动(这与“过滤器(filter)”的隐含的含义不符," +"不过与我们期待的行为一致)。 " #. Tag: para +#: session_api.xml:411 #, no-c-format -msgid "Observe that filters do not require a from clause, although they can have one if required. Filters are not limited to returning the collection elements themselves." -msgstr "请注意过滤器(filter)并不需要 from 子句(当然需要的话它们也可以加上)。过滤器(filter)不限定于只能返回集合元素本身。 " +msgid "" +"Observe that filters do not require a from clause, " +"although they can have one if required. Filters are not limited to returning " +"the collection elements themselves." +msgstr "" +"请注意过滤器(filter)并不需要 from 子句(当然需要的话它们" +"也可以加上)。过滤器(filter)不限定于只能返回集合元素本身。 " + +#. Tag: programlisting +#: session_api.xml:415 +#, fuzzy, no-c-format +msgid "" +"Collection blackKittenMates = session.createFilter(\n" +" pk.getKittens(), \n" +" \"select this.mate where this.color = eg.Color.BLACK.intValue\")\n" +" .list();" +msgstr "" +"" #. Tag: para +#: session_api.xml:417 #, no-c-format -msgid "Even an empty filter query is useful, e.g. to load a subset of elements in a large collection:" -msgstr "即使无条件的过滤器(filter)也是有意义的。例如,用于加载一个大集合的子集: " +msgid "" +"Even an empty filter query is useful, e.g. to load a subset of elements in a " +"large collection:" +msgstr "" +"即使无条件的过滤器(filter)也是有意义的。例如,用于加载一个大集合的子集: " + +#. Tag: programlisting +#: session_api.xml:420 +#, fuzzy, no-c-format +msgid "" +"Collection tenKittens = session.createFilter(\n" +" mother.getKittens(), \"\")\n" +" .setFirstResult(0).setMaxResults(10)\n" +" .list();" +msgstr "" +"" #. Tag: title +#: session_api.xml:424 #, no-c-format msgid "Criteria queries" msgstr "条件查询(Criteria queries)" #. Tag: para +#: session_api.xml:426 #, no-c-format -msgid "HQL is extremely powerful, but some developers prefer to build queries dynamically using an object-oriented API, rather than building query strings. Hibernate provides an intuitive Criteria query API for these cases:" -msgstr "HQL 极为强大,但是有些人希望能够动态的使用一种面向对象 API 创建查询,而非在他们的 Java 代码中嵌入字符串。对于那部分人来说,Hibernate 提供了直观的 Criteria 查询 API。 " +msgid "" +"HQL is extremely powerful, but some developers prefer to build queries " +"dynamically using an object-oriented API, rather than building query " +"strings. Hibernate provides an intuitive Criteria query " +"API for these cases:" +msgstr "" +"HQL 极为强大,但是有些人希望能够动态的使用一种面向对象 API 创建查询,而非在他" +"们的 Java 代码中嵌入字符串。对于那部分人来说,Hibernate 提供了直观的 " +"Criteria 查询 API。 " + +#. Tag: programlisting +#: session_api.xml:431 +#, fuzzy, no-c-format +msgid "" +"Criteria crit = session.createCriteria(Cat.class);\n" +"crit.add( Restrictions.eq( \"color\", eg.Color.BLACK ) );\n" +"crit.setMaxResults(10);\n" +"List cats = crit.list();" +msgstr "" +"" #. Tag: para -#, no-c-format -msgid "The Criteria and the associated Example API are discussed in more detail in ." -msgstr "Criteria 以及相关的样例(Example)API 将会在 中详细讨论。" +#: session_api.xml:433 +#, fuzzy, no-c-format +msgid "" +"The Criteria and the associated Example API are discussed in more detail in ." +msgstr "" +"Criteria 以及相关的样例(Example)API " +"将会在 中详细讨论。" #. Tag: title +#: session_api.xml:439 #, no-c-format msgid "Queries in native SQL" msgstr "使用原生 SQL 的查询" #. Tag: para +#: session_api.xml:441 #, no-c-format -msgid "You can express a query in SQL, using createSQLQuery() and let Hibernate manage the mapping from result sets to objects. You can at any time call session.connection() and use the JDBC Connection directly. If you choose to use the Hibernate API, you must enclose SQL aliases in braces:" -msgstr "你可以使用 createSQLQuery() 方法,用 SQL 来描述查询,并由 Hibernate 将结果集转换成对象。请注意,你可以在任何时候调用 session.connection() 来获得并使用 JDBC Connection 对象。 如果你选择使用 Hibernate 的 API,你必须把 SQL 别名用大括号包围起来: " +msgid "" +"You can express a query in SQL, using createSQLQuery() " +"and let Hibernate manage the mapping from result sets to objects. You can at " +"any time call session.connection() and use the JDBC " +"Connection directly. If you choose to use the Hibernate " +"API, you must enclose SQL aliases in braces:" +msgstr "" +"你可以使用 createSQLQuery() 方法,用 SQL 来描述查询,并由 " +"Hibernate 将结果集转换成对象。请注意,你可以在任何时候调用 session." +"connection() 来获得并使用 JDBC Connection 对" +"象。 如果你选择使用 Hibernate 的 API,你必须把 SQL 别名用大括号包围起来: " + +#. Tag: programlisting +#: session_api.xml:448 +#, fuzzy, no-c-format +msgid "" +"List cats = session.createSQLQuery(\"SELECT {cat.*} FROM CAT {cat} WHERE " +"ROWNUM<10\")\n" +" .addEntity(\"cat\", Cat.class)\n" +".list();" +msgstr "" +"" + +#. Tag: programlisting +#: session_api.xml:450 +#, fuzzy, no-c-format +msgid "" +"List cats = session.createSQLQuery(\n" +" \"SELECT {cat}.ID AS {cat.id}, {cat}.SEX AS {cat.sex}, \" +\n" +" \"{cat}.MATE AS {cat.mate}, {cat}.SUBCLASS AS {cat.class}, ... \" " +"+\n" +" \"FROM CAT {cat} WHERE ROWNUM<10\")\n" +" .addEntity(\"cat\", Cat.class)\n" +".list()" +msgstr "" +"" #. Tag: para -#, no-c-format -msgid "SQL queries can contain named and positional parameters, just like Hibernate queries. More information about native SQL queries in Hibernate can be found in ." -msgstr "和 Hibernate 查询一样,SQL 查询也可以包含命名参数和占位参数。可以在 找到更多关于 Hibernate 中原生 SQL(native SQL)的信息。" +#: session_api.xml:452 +#, fuzzy, no-c-format +msgid "" +"SQL queries can contain named and positional parameters, just like Hibernate " +"queries. More information about native SQL queries in Hibernate can be found " +"in ." +msgstr "" +"和 Hibernate 查询一样,SQL 查询也可以包含命名参数和占位参数。可以在 找到更多关于 Hibernate 中原生 SQL(native SQL)的信" +"息。" #. Tag: title +#: session_api.xml:459 #, no-c-format msgid "Modifying persistent objects" msgstr "修改持久对象" #. Tag: para +#: session_api.xml:461 #, no-c-format -msgid "Transactional persistent instances (i.e. objects loaded, saved, created or queried by the Session) can be manipulated by the application, and any changes to persistent state will be persisted when the Session is flushed. This is discussed later in this chapter. There is no need to call a particular method (like update(), which has a different purpose) to make your modifications persistent. The most straightforward way to update the state of an object is to load() it and then manipulate it directly while the Session is open:" -msgstr "事务中的持久实例(就是通过 session 装载、保存、创建或者查询出的对象) 被应用程序操作所造成的任何修改都会在 Session刷出(flushed)的时候被持久化(本章后面会详细讨论)。这里不需要调用某个特定的方法(比如 update(),设计它的目的是不同的)将你的修改持久化。所以最直接的更新一个对象的方法就是在 Session 处于打开状态时 load() 它,然后直接修改即可: " +msgid "" +"Transactional persistent instances (i.e. objects " +"loaded, saved, created or queried by the Session) can be " +"manipulated by the application, and any changes to persistent state will be " +"persisted when the Session is flushed. This is discussed later in this chapter. There is no need to call " +"a particular method (like update(), which has a different " +"purpose) to make your modifications persistent. The most straightforward way " +"to update the state of an object is to load() it and then " +"manipulate it directly while the Session is open:" +msgstr "" +"事务中的持久实例(就是通过 session 装" +"载、保存、创建或者查询出的对象) 被应用程序操作所造成的任何修改都会在 " +"Session刷出(flushed)的时候被持久" +"化(本章后面会详细讨论)。这里不需要调用某个特定的方法(比如 update" +"(),设计它的目的是不同的)将你的修改持久化。所以最直接的更新一个对" +"象的方法就是在 Session 处于打开状态时 load() 它,然后直接修改即可: " + +#. Tag: programlisting +#: session_api.xml:473 +#, fuzzy, no-c-format +msgid "" +"DomesticCat cat = (DomesticCat) sess.load( Cat.class, new Long(69) );\n" +"cat.setName(\"PK\");\n" +"sess.flush(); // changes to cat are automatically detected and persisted" +msgstr "" +"" #. Tag: para +#: session_api.xml:475 #, no-c-format -msgid "Sometimes this programming model is inefficient, as it requires in the same session both an SQL SELECT to load an object and an SQL UPDATE to persist its updated state. Hibernate offers an alternate approach by using detached instances." -msgstr "有时这种程序模型效率低下,因为它在同一 Session 里需要一条 SQL SELECT 语句(用于加载对象) 以及一条 SQL UPDATE 语句(持久化更新的状态)。为此 Hibernate 提供了另一种途径,使用脱管(detached)实例。 " +msgid "" +"Sometimes this programming model is inefficient, as it requires in the same " +"session both an SQL SELECT to load an object and an SQL " +"UPDATE to persist its updated state. Hibernate offers an " +"alternate approach by using detached instances." +msgstr "" +"有时这种程序模型效率低下,因为它在同一 Session 里需要一条 SQL " +"SELECT 语句(用于加载对象) 以及一条 SQL UPDATE 语句(持久化更新的状态)。为此 Hibernate 提供了另一种途径,使用脱管" +"(detached)实例。 " #. Tag: para -#, no-c-format -msgid "Hibernate does not offer its own API for direct execution of UPDATE or DELETE statements. Hibernate is a state management service, you do not have to think in statements to use it. JDBC is a perfect API for executing SQL statements, you can get a JDBC Connection at any time by calling session.connection(). Furthermore, the notion of mass operations conflicts with object/relational mapping for online transaction processing-oriented applications. Future versions of Hibernate can, however, provide special mass operation functions. See for some possible batch operation tricks." -msgstr "请注意 Hibernate 本身不提供直接执行 UPDATEDELETE 语句的 API。Hibernate 提供的是 state management 服务,你不必考虑要使用的 statements。JDBC 是出色的执行 SQL 语句的 API,任何时候调用 session.connection() 你都可以得到一个 Connection 对象。 此外,在联机事务处理(OLTP)程序中,大量操作(mass operations)与对象/关系映射的观点是相冲突的。Hibernate 的将来版本可能会提供专门的进行大量操作(mass operation)的功能。参考 ,寻找一些可用的批量(batch)操作技巧。" +#: session_api.xml:481 +#, fuzzy, no-c-format +msgid "" +"Hibernate does not offer its own API for direct execution of " +"UPDATE or DELETE statements. Hibernate " +"is a state management service, you do not have to think " +"in statements to use it. JDBC is a perfect API for " +"executing SQL statements, you can get a JDBC Connection " +"at any time by calling session.connection(). Furthermore, " +"the notion of mass operations conflicts with object/relational mapping for " +"online transaction processing-oriented applications. Future versions of " +"Hibernate can, however, provide special mass operation functions. See for some possible batch operation tricks." +msgstr "" +"请注意 Hibernate 本身不提供直接执行 UPDATE 或 " +"DELETE 语句的 API。Hibernate 提供的是 state " +"management 服务,你不必考虑要使用的 statements。JDBC 是出色的执行 SQL 语句的 API,任何时候调用 session." +"connection() 你都可以得到一个 Connection 对象。 " +"此外,在联机事务处理(OLTP)程序中,大量操作(mass operations)与对象/关系映" +"射的观点是相冲突的。Hibernate 的将来版本可能会提供专门的进行大量操作(mass " +"operation)的功能。参考 ,寻找一些可用的批量" +"(batch)操作技巧。" #. Tag: title +#: session_api.xml:497 #, no-c-format msgid "Modifying detached objects" msgstr "修改脱管(Detached)对象" #. Tag: para +#: session_api.xml:499 #, no-c-format -msgid "Many applications need to retrieve an object in one transaction, send it to the UI layer for manipulation, then save the changes in a new transaction. Applications that use this kind of approach in a high-concurrency environment usually use versioned data to ensure isolation for the \"long\" unit of work." -msgstr "很多程序需要在某个事务中获取对象,然后将对象发送到界面层去操作,最后在一个新的事务保存所做的修改。在高并发访问的环境中使用这种方式,通常使用附带版本信息的数据来保证这些“长“工作单元之间的隔离。" +msgid "" +"Many applications need to retrieve an object in one transaction, send it to " +"the UI layer for manipulation, then save the changes in a new transaction. " +"Applications that use this kind of approach in a high-concurrency " +"environment usually use versioned data to ensure isolation for the \"long\" " +"unit of work." +msgstr "" +"很多程序需要在某个事务中获取对象,然后将对象发送到界面层去操作,最后在一个新" +"的事务保存所做的修改。在高并发访问的环境中使用这种方式,通常使用附带版本信息" +"的数据来保证这些“长“工作单元之间的隔离。" #. Tag: para +#: session_api.xml:505 #, no-c-format -msgid "Hibernate supports this model by providing for reattachment of detached instances using the Session.update() or Session.merge() methods:" -msgstr "Hibernate 通过提供 Session.update()Session.merge() 重新关联脱管实例的办法来支持这种模型。" +msgid "" +"Hibernate supports this model by providing for reattachment of detached " +"instances using the Session.update() or Session." +"merge() methods:" +msgstr "" +"Hibernate 通过提供 Session.update()Session." +"merge() 重新关联脱管实例的办法来支持这种模型。" + +#. Tag: programlisting +#: session_api.xml:509 +#, fuzzy, no-c-format +msgid "" +"// in the first session\n" +"Cat cat = (Cat) firstSession.load(Cat.class, catId);\n" +"Cat potentialMate = new Cat();\n" +"firstSession.save(potentialMate);\n" +"\n" +"// in a higher layer of the application\n" +"cat.setMate(potentialMate);\n" +"\n" +"// later, in a new session\n" +"secondSession.update(cat); // update cat\n" +"secondSession.update(mate); // update mate" +msgstr "" +"" #. Tag: para +#: session_api.xml:511 #, no-c-format -msgid "If the Cat with identifier catId had already been loaded by secondSession when the application tried to reattach it, an exception would have been thrown." -msgstr "如果具有 catId 持久化标识的 Cat 之前已经被另一Session(secondSession)装载了, 应用程序进行重关联操作(reattach)的时候会抛出一个异常。" +msgid "" +"If the Cat with identifier catId had " +"already been loaded by secondSession when the application " +"tried to reattach it, an exception would have been thrown." +msgstr "" +"如果具有 catId 持久化标识的 Cat 之前已" +"经被另一Session(secondSession)装载了, 应用程序进行重关" +"联操作(reattach)的时候会抛出一个异常。" #. Tag: para +#: session_api.xml:516 #, no-c-format -msgid "Use update() if you are certain that the session does not contain an already persistent instance with the same identifier. Use merge() if you want to merge your modifications at any time without consideration of the state of the session. In other words, update() is usually the first method you would call in a fresh session, ensuring that the reattachment of your detached instances is the first operation that is executed." -msgstr "如果你确定当前 session 没有包含与之具有相同持久化标识的持久实例,使用 update()。如果想随时合并你的的改动而不考虑 session 的状态,使用 merge()。换句话说,在一个新 session 中通常第一个调用的是 update() 方法,以便保证重新关联脱管(detached)对象的操作首先被执行。 " +msgid "" +"Use update() if you are certain that the session does not " +"contain an already persistent instance with the same identifier. Use " +"merge() if you want to merge your modifications at any " +"time without consideration of the state of the session. In other words, " +"update() is usually the first method you would call in a " +"fresh session, ensuring that the reattachment of your detached instances is " +"the first operation that is executed." +msgstr "" +"如果你确定当前 session 没有包含与之具有相同持久化标识的持久实例,使用 " +"update()。如果想随时合并你的的改动而不考虑 session 的状" +"态,使用 merge()。换句话说,在一个新 session 中通常第一个" +"调用的是 update() 方法,以便保证重新关联脱管(detached)对" +"象的操作首先被执行。 " #. Tag: para -#, no-c-format -msgid "The application should individually update() detached instances that are reachable from the given detached instance only if it wants their state to be updated. This can be automated using transitive persistence. See for more information." -msgstr "如果希望相关联的脱管对象(通过引用“可到达”的脱管对象)的数据也要更新到数据库时(并且也仅仅在这种情况),可以对该相关联的脱管对象单独调用 update() 当然这些可以自动完成,即通过使用传播性持久化(transitive persistence),请看 。" +#: session_api.xml:524 +#, fuzzy, no-c-format +msgid "" +"The application should individually update() detached " +"instances that are reachable from the given detached instance " +"only if it wants their state to be updated. This can be " +"automated using transitive persistence. See for more information." +msgstr "" +"如果希望相关联的脱管对象(通过引用“可到达”的脱管对象)的数据也要更新到数据库" +"时(并且也仅仅在这种情况),可以对该相关联的脱管对象单独" +"调用 update() 当然这些可以自动完成,即通过使用传" +"播性持久化(transitive persistence),请看 。" #. Tag: para +#: session_api.xml:530 #, no-c-format -msgid "The lock() method also allows an application to reassociate an object with a new session. However, the detached instance has to be unmodified." -msgstr "lock() 方法也允许程序重新关联某个对象到一个新 session 上。不过,该脱管(detached)的对象必须是没有修改过的。" +msgid "" +"The lock() method also allows an application to " +"reassociate an object with a new session. However, the detached instance has " +"to be unmodified." +msgstr "" +"lock() 方法也允许程序重新关联某个对象到一个新 session 上。" +"不过,该脱管(detached)的对象必须是没有修改过的。" + +#. Tag: programlisting +#: session_api.xml:534 +#, fuzzy, no-c-format +msgid "" +"//just reassociate:\n" +"sess.lock(fritz, LockMode.NONE);\n" +"//do a version check, then reassociate:\n" +"sess.lock(izi, LockMode.READ);\n" +"//do a version check, using SELECT ... FOR UPDATE, then reassociate:\n" +"sess.lock(pk, LockMode.UPGRADE);" +msgstr "" +"" #. Tag: para +#: session_api.xml:536 #, no-c-format -msgid "Note that lock() can be used with various LockModes. See the API documentation and the chapter on transaction handling for more information. Reattachment is not the only usecase for lock()." -msgstr "请注意,lock() 可以搭配多种 LockMode,更多信息请阅读 API 文档以及关于事务处理(transaction handling)的章节。重新关联不是 lock() 的唯一用途。 " +msgid "" +"Note that lock() can be used with various " +"LockModes. See the API documentation and the chapter on " +"transaction handling for more information. Reattachment is not the only " +"usecase for lock()." +msgstr "" +"请注意,lock() 可以搭配多种 LockMode," +"更多信息请阅读 API 文档以及关于事务处理(transaction handling)的章节。重新关" +"联不是 lock() 的唯一用途。 " #. Tag: para -#, no-c-format -msgid "Other models for long units of work are discussed in ." -msgstr "其他用于长时间工作单元的模型会在 中讨论。" +#: session_api.xml:541 +#, fuzzy, no-c-format +msgid "" +"Other models for long units of work are discussed in ." +msgstr "" +"其他用于长时间工作单元的模型会在 " +"中讨论。" #. Tag: title +#: session_api.xml:546 #, no-c-format msgid "Automatic state detection" msgstr "自动状态检测" #. Tag: para +#: session_api.xml:548 #, no-c-format -msgid "Hibernate users have requested a general purpose method that either saves a transient instance by generating a new identifier or updates/reattaches the detached instances associated with its current identifier. The saveOrUpdate() method implements this functionality." -msgstr "Hibernate 的用户曾要求一个既可自动分配新持久化标识(identifier)保存瞬时(transient)对象,又可更新/重新关联脱管(detached)实例的通用方法。saveOrUpdate() 方法实现了这个功能。" +msgid "" +"Hibernate users have requested a general purpose method that either saves a " +"transient instance by generating a new identifier or updates/reattaches the " +"detached instances associated with its current identifier. The " +"saveOrUpdate() method implements this functionality." +msgstr "" +"Hibernate 的用户曾要求一个既可自动分配新持久化标识(identifier)保存瞬时" +"(transient)对象,又可更新/重新关联脱管(detached)实例的通用方法。" +"saveOrUpdate() 方法实现了这个功能。" + +#. Tag: programlisting +#: session_api.xml:554 +#, fuzzy, no-c-format +msgid "" +"// in the first session\n" +"Cat cat = (Cat) firstSession.load(Cat.class, catID);\n" +"\n" +"// in a higher tier of the application\n" +"Cat mate = new Cat();\n" +"cat.setMate(mate);\n" +"\n" +"// later, in a new session\n" +"secondSession.saveOrUpdate(cat); // update existing state (cat has a non-" +"null id)\n" +"secondSession.saveOrUpdate(mate); // save the new instance (mate has a null " +"id)" +msgstr "" +"" #. Tag: para +#: session_api.xml:556 #, no-c-format -msgid "The usage and semantics of saveOrUpdate() seems to be confusing for new users. Firstly, so long as you are not trying to use instances from one session in another new session, you should not need to use update(), saveOrUpdate(), or merge(). Some whole applications will never use either of these methods." -msgstr "saveOrUpdate() 用途和语义可能会使新用户感到迷惑。首先,只要你没有尝试在某个 session 中使用来自另一 session 的实例,你就应该不需要使用 update()saveOrUpdate(),或 merge()。有些程序从来不用这些方法。" +msgid "" +"The usage and semantics of saveOrUpdate() seems to be " +"confusing for new users. Firstly, so long as you are not trying to use " +"instances from one session in another new session, you should not need to " +"use update(), saveOrUpdate(), or " +"merge(). Some whole applications will never use either of " +"these methods." +msgstr "" +"saveOrUpdate() 用途和语义可能会使新用户感到迷惑。首先,只" +"要你没有尝试在某个 session 中使用来自另一 session 的实例,你就应该不需要使" +"用 update()saveOrUpdate(),或 " +"merge()。有些程序从来不用这些方法。" #. Tag: para +#: session_api.xml:563 #, no-c-format -msgid "Usually update() or saveOrUpdate() are used in the following scenario:" -msgstr "通常下面的场景会使用 update()saveOrUpdate():" +msgid "" +"Usually update() or saveOrUpdate() are " +"used in the following scenario:" +msgstr "" +"通常下面的场景会使用 update()saveOrUpdate():" #. Tag: para +#: session_api.xml:569 #, no-c-format msgid "the application loads an object in the first session" msgstr "程序在第一个 session 中加载对象" #. Tag: para +#: session_api.xml:573 #, no-c-format msgid "the object is passed up to the UI tier" msgstr "该对象被传递到表现层" #. Tag: para +#: session_api.xml:577 #, no-c-format msgid "some modifications are made to the object" msgstr "对象发生了一些改动" #. Tag: para +#: session_api.xml:581 #, no-c-format msgid "the object is passed back down to the business logic tier" msgstr "该对象被返回到业务逻辑层" #. Tag: para +#: session_api.xml:585 #, no-c-format -msgid "the application persists these modifications by calling update() in a second session" +msgid "" +"the application persists these modifications by calling update() in a second session" msgstr "程序调用第二个 session 的 update() 方法持久这些改动" #. Tag: para +#: session_api.xml:590 #, no-c-format msgid "saveOrUpdate() does the following:" msgstr "saveOrUpdate() 做下面的事:" #. Tag: para +#: session_api.xml:594 #, no-c-format msgid "if the object is already persistent in this session, do nothing" msgstr "如果对象已经在本 session 中持久化了,不做任何事" #. Tag: para +#: session_api.xml:599 #, no-c-format -msgid "if another object associated with the session has the same identifier, throw an exception" -msgstr "如果另一个与本 session 关联的对象拥有相同的持久化标识(identifier),抛出一个异常" +msgid "" +"if another object associated with the session has the same identifier, throw " +"an exception" +msgstr "" +"如果另一个与本 session 关联的对象拥有相同的持久化标识(identifier),抛出一个" +"异常" #. Tag: para +#: session_api.xml:604 #, no-c-format msgid "if the object has no identifier property, save() it" -msgstr "如果对象没有持久化标识(identifier)属性,对其调用 save()" +msgstr "" +"如果对象没有持久化标识(identifier)属性,对其调用 save()" #. Tag: para +#: session_api.xml:609 #, no-c-format -msgid "if the object's identifier has the value assigned to a newly instantiated object, save() it" -msgstr "如果对象的持久标识(identifier)表明其是一个新实例化的对象,对其调用 save()。" +msgid "" +"if the object's identifier has the value assigned to a newly instantiated " +"object, save() it" +msgstr "" +"如果对象的持久标识(identifier)表明其是一个新实例化的对象,对其调用 " +"save()。" #. Tag: para +#: session_api.xml:614 #, no-c-format -msgid "if the object is versioned by a <version> or <timestamp>, and the version property value is the same value assigned to a newly instantiated object, save() it" -msgstr "如果对象是附带版本信息的(通过 <version><timestamp>)并且版本属性的值表明其是一个新实例化的对象,save() 它。 " +msgid "" +"if the object is versioned by a <version> or " +"<timestamp>, and the version property value is the " +"same value assigned to a newly instantiated object, save() it" +msgstr "" +"如果对象是附带版本信息的(通过 <version> 或 " +"<timestamp>)并且版本属性的值表明其是一个新实例化的" +"对象,save() 它。 " #. Tag: para +#: session_api.xml:622 #, no-c-format msgid "otherwise update() the object" msgstr "否则 update() 这个对象" #. Tag: para +#: session_api.xml:626 #, no-c-format msgid "and merge() is very different:" msgstr "merge() 可非常不同:" #. Tag: para +#: session_api.xml:630 #, no-c-format -msgid "if there is a persistent instance with the same identifier currently associated with the session, copy the state of the given object onto the persistent instance" -msgstr "如果 session 中存在相同持久化标识(identifier)的实例,用用户给出的对象的状态覆盖旧有的持久实例" +msgid "" +"if there is a persistent instance with the same identifier currently " +"associated with the session, copy the state of the given object onto the " +"persistent instance" +msgstr "" +"如果 session 中存在相同持久化标识(identifier)的实例,用用户给出的对象的状态" +"覆盖旧有的持久实例" #. Tag: para +#: session_api.xml:636 #, no-c-format -msgid "if there is no persistent instance currently associated with the session, try to load it from the database, or create a new persistent instance" -msgstr "如果 session 没有相应的持久实例,则尝试从数据库中加载,或创建新的持久化实例" +msgid "" +"if there is no persistent instance currently associated with the session, " +"try to load it from the database, or create a new persistent instance" +msgstr "" +"如果 session 没有相应的持久实例,则尝试从数据库中加载,或创建新的持久化实例" #. Tag: para +#: session_api.xml:642 #, no-c-format msgid "the persistent instance is returned" msgstr "最后返回该持久实例" #. Tag: para +#: session_api.xml:646 #, no-c-format -msgid "the given instance does not become associated with the session, it remains detached" +msgid "" +"the given instance does not become associated with the session, it remains " +"detached" msgstr "用户给出的这个对象没有被关联到 session 上,它依旧是脱管的" #. Tag: title +#: session_api.xml:653 #, no-c-format msgid "Deleting persistent objects" msgstr "删除持久对象" #. Tag: para +#: session_api.xml:655 #, no-c-format -msgid "Session.delete() will remove an object's state from the database. Your application, however, can still hold a reference to a deleted object. It is best to think of delete() as making a persistent instance, transient." -msgstr "使用 Session.delete() 会把对象的状态从数据库中移除。当然,你的应用程序可能仍然持有一个指向已删除对象的引用。所以,最好这样理解:delete() 的用途是把一个持久实例变成瞬时(transient)实例。 " +msgid "" +"Session.delete() will remove an object's state from the " +"database. Your application, however, can still hold a reference to a deleted " +"object. It is best to think of delete() as making a " +"persistent instance, transient." +msgstr "" +"使用 Session.delete() 会把对象的状态从数据库中移除。当然," +"你的应用程序可能仍然持有一个指向已删除对象的引用。所以,最好这样理解:" +"delete() 的用途是把一个持久实例变成瞬时(transient)实" +"例。 " + +#. Tag: programlisting +#: session_api.xml:660 +#, fuzzy, no-c-format +msgid "sess.delete(cat);" +msgstr "" #. Tag: para +#: session_api.xml:662 #, no-c-format -msgid "You can delete objects in any order, without risk of foreign key constraint violations. It is still possible to violate a NOT NULL constraint on a foreign key column by deleting objects in the wrong order, e.g. if you delete the parent, but forget to delete the children." -msgstr "你可以用你喜欢的任何顺序删除对象,不用担心外键约束冲突。当然,如果你搞错了顺序,还是有可能引发在外键字段定义的 NOT NULL 约束冲突。例如你删除了父对象,但是忘记删除其子对象。" +msgid "" +"You can delete objects in any order, without risk of foreign key constraint " +"violations. It is still possible to violate a NOT NULL " +"constraint on a foreign key column by deleting objects in the wrong order, e." +"g. if you delete the parent, but forget to delete the children." +msgstr "" +"你可以用你喜欢的任何顺序删除对象,不用担心外键约束冲突。当然,如果你搞错了顺" +"序,还是有可能引发在外键字段定义的 NOT NULL 约束冲突。例如" +"你删除了父对象,但是忘记删除其子对象。" #. Tag: title +#: session_api.xml:670 #, no-c-format msgid "Replicating object between two different datastores" msgstr "在两个不同数据库间复制对象" #. Tag: para +#: session_api.xml:672 #, no-c-format -msgid "It is sometimes useful to be able to take a graph of persistent instances and make them persistent in a different datastore, without regenerating identifier values." -msgstr "偶尔会用到不重新生成持久化标识(identifier),将持久实例以及其关联的实例持久到不同的数据库中的操作。 " +msgid "" +"It is sometimes useful to be able to take a graph of persistent instances " +"and make them persistent in a different datastore, without regenerating " +"identifier values." +msgstr "" +"偶尔会用到不重新生成持久化标识(identifier),将持久实例以及其关联的实例持久" +"到不同的数据库中的操作。 " + +#. Tag: programlisting +#: session_api.xml:676 +#, fuzzy, no-c-format +msgid "" +"//retrieve a cat from one database\n" +"Session session1 = factory1.openSession();\n" +"Transaction tx1 = session1.beginTransaction();\n" +"Cat cat = session1.get(Cat.class, catId);\n" +"tx1.commit();\n" +"session1.close();\n" +"\n" +"//reconcile with a second database\n" +"Session session2 = factory2.openSession();\n" +"Transaction tx2 = session2.beginTransaction();\n" +"session2.replicate(cat, ReplicationMode.LATEST_VERSION);\n" +"tx2.commit();\n" +"session2.close();" +msgstr "" +"" #. Tag: para +#: session_api.xml:678 #, no-c-format -msgid "The ReplicationMode determines how replicate() will deal with conflicts with existing rows in the database:" -msgstr "ReplicationMode 决定在和数据库中已存在记录由冲突时,replicate() 如何处理。 " +msgid "" +"The ReplicationMode determines how replicate() will deal with conflicts with existing rows in the database:" +msgstr "" +"ReplicationMode 决定在和数据库中已存在记录由冲突时," +"replicate() 如何处理。 " #. Tag: para +#: session_api.xml:684 #, no-c-format -msgid "ReplicationMode.IGNORE: ignores the object when there is an existing database row with the same identifier" -msgstr "ReplicationMode.IGNORE:当某个现有数据库记录具有相同标识符时忽略它" +msgid "" +"ReplicationMode.IGNORE: ignores the object when there is " +"an existing database row with the same identifier" +msgstr "" +"ReplicationMode.IGNORE:当某个现有数据库记录具有相同标识符" +"时忽略它" #. Tag: para +#: session_api.xml:689 #, no-c-format -msgid "ReplicationMode.OVERWRITE: overwrites any existing database row with the same identifier" -msgstr "ReplicationMode.OVERWRITE:用相同的标识符覆盖现有数据库记录" +msgid "" +"ReplicationMode.OVERWRITE: overwrites any existing " +"database row with the same identifier" +msgstr "" +"ReplicationMode.OVERWRITE:用相同的标识符覆盖现有数据库记" +"录" #. Tag: para +#: session_api.xml:694 #, no-c-format -msgid "ReplicationMode.EXCEPTION: throws an exception if there is an existing database row with the same identifier" -msgstr "ReplicationMode.EXCEPTION:当某个现有数据库记录具有相同标识符时抛出异常" +msgid "" +"ReplicationMode.EXCEPTION: throws an exception if there " +"is an existing database row with the same identifier" +msgstr "" +"ReplicationMode.EXCEPTION:当某个现有数据库记录具有相同标" +"识符时抛出异常" #. Tag: para +#: session_api.xml:700 #, no-c-format -msgid "ReplicationMode.LATEST_VERSION: overwrites the row if its version number is earlier than the version number of the object, or ignore the object otherwise" -msgstr "ReplicationMode.LATEST_VERSION:如果当前的版本较新,则覆盖,否则忽略" +msgid "" +"ReplicationMode.LATEST_VERSION: overwrites the row if its " +"version number is earlier than the version number of the object, or ignore " +"the object otherwise" +msgstr "" +"ReplicationMode.LATEST_VERSION:如果当前的版本较新,则覆" +"盖,否则忽略" #. Tag: para +#: session_api.xml:706 #, no-c-format -msgid "Usecases for this feature include reconciling data entered into different database instances, upgrading system configuration information during product upgrades, rolling back changes made during non-ACID transactions and more." -msgstr "这个功能的用途包括使录入的数据在不同数据库中一致,产品升级时升级系统配置信息,回滚 non-ACID 事务中的修改等等。(译注,non-ACID,非 ACID;ACID,Atomic,Consistent,Isolated and Durable 的缩写)" +msgid "" +"Usecases for this feature include reconciling data entered into different " +"database instances, upgrading system configuration information during " +"product upgrades, rolling back changes made during non-ACID transactions and " +"more." +msgstr "" +"这个功能的用途包括使录入的数据在不同数据库中一致,产品升级时升级系统配置信" +"息,回滚 non-ACID 事务中的修改等等。(译注,non-ACID,非 ACID;ACID,Atomic," +"Consistent,Isolated and Durable 的缩写)" #. Tag: title +#: session_api.xml:713 #, no-c-format msgid "Flushing the Session" msgstr "Session 刷出(flush)" #. Tag: para +#: session_api.xml:715 #, no-c-format -msgid "Sometimes the Session will execute the SQL statements needed to synchronize the JDBC connection's state with the state of objects held in memory. This process, called flush, occurs by default at the following points:" -msgstr "每间隔一段时间,Session 会执行一些必需的 SQL 语句来把内存中的对象的状态同步到 JDBC 连接中。这个过程被称为刷出(flush),默认会在下面的时间点执行: " +msgid "" +"Sometimes the Session will execute the SQL statements " +"needed to synchronize the JDBC connection's state with the state of objects " +"held in memory. This process, called flush, occurs by " +"default at the following points:" +msgstr "" +"每间隔一段时间,Session 会执行一些必需的 SQL 语句来把内存" +"中的对象的状态同步到 JDBC 连接中。这个过程被称为刷出(flush),默认会在下面的时间点执行: " #. Tag: para +#: session_api.xml:723 #, no-c-format msgid "before some query executions" msgstr "在某些查询执行之前" #. Tag: para +#: session_api.xml:727 #, no-c-format msgid "from org.hibernate.Transaction.commit()" msgstr "在调用 org.hibernate.Transaction.commit() 的时候" #. Tag: para +#: session_api.xml:732 #, no-c-format msgid "from Session.flush()" msgstr "在调用 Session.flush() 的时候" #. Tag: para +#: session_api.xml:736 #, no-c-format msgid "The SQL statements are issued in the following order:" msgstr "涉及的 SQL 语句会按照下面的顺序发出执行: " #. Tag: para +#: session_api.xml:740 #, no-c-format -msgid "all entity insertions in the same order the corresponding objects were saved using Session.save()" -msgstr "所有对实体进行插入的语句,其顺序按照对象执行 Session.save() 的时间顺序 " +msgid "" +"all entity insertions in the same order the corresponding objects were saved " +"using Session.save()" +msgstr "" +"所有对实体进行插入的语句,其顺序按照对象执行 Session.save() 的时间顺序 " #. Tag: para +#: session_api.xml:745 #, no-c-format msgid "all entity updates" msgstr "所有对实体进行更新的语句" #. Tag: para +#: session_api.xml:749 #, no-c-format msgid "all collection deletions" msgstr "所有进行集合删除的语句" #. Tag: para +#: session_api.xml:753 #, no-c-format msgid "all collection element deletions, updates and insertions" msgstr "所有对集合元素进行删除,更新或者插入的语句" #. Tag: para +#: session_api.xml:757 #, no-c-format msgid "all collection insertions" msgstr "所有进行集合插入的语句" #. Tag: para +#: session_api.xml:761 #, no-c-format -msgid "all entity deletions in the same order the corresponding objects were deleted using Session.delete()" -msgstr "所有对实体进行删除的语句,其顺序按照对象执行 Session.delete() 的时间顺序 " +msgid "" +"all entity deletions in the same order the corresponding objects were " +"deleted using Session.delete()" +msgstr "" +"所有对实体进行删除的语句,其顺序按照对象执行 Session.delete() 的时间顺序 " #. Tag: para +#: session_api.xml:766 #, no-c-format -msgid "An exception is that objects using native ID generation are inserted when they are saved." -msgstr "有一个例外是,如果对象使用 native 方式来生成 ID(持久化标识)的话,它们一执行 save 就会被插入。" +msgid "" +"An exception is that objects using native ID generation " +"are inserted when they are saved." +msgstr "" +"有一个例外是,如果对象使用 native 方式来生成 ID(持久化标" +"识)的话,它们一执行 save 就会被插入。" #. Tag: para +#: session_api.xml:769 #, no-c-format -msgid "Except when you explicitly flush(), there are absolutely no guarantees about when the Session executes the JDBC calls, only the order in which they are executed. However, Hibernate does guarantee that the Query.list(..) will never return stale or incorrect data." -msgstr "除非你明确地发出了 flush() 指令,关于 Session 何时会执行这些 JDBC 调用是完全无法保证的,只能保证它们执行的前后顺序。当然,Hibernate 保证,Query.list(..) 绝对不会返回已经失效的数据,也不会返回错误数据。 " +msgid "" +"Except when you explicitly flush(), there are absolutely " +"no guarantees about when the Session " +"executes the JDBC calls, only the order in which they " +"are executed. However, Hibernate does guarantee that the Query.list" +"(..) will never return stale or incorrect data." +msgstr "" +"除非你明确地发出了 flush() 指令,关于 Session 何" +"时会执行这些 JDBC 调用是完全无法保证的,只能保证它们执行的前后顺" +"序。当然,Hibernate 保证,Query.list(..) 绝对不会返回已经" +"失效的数据,也不会返回错误数据。 " #. Tag: para -#, no-c-format -msgid "It is possible to change the default behavior so that flush occurs less frequently. The FlushMode class defines three different modes: only flush at commit time when the Hibernate Transaction API is used, flush automatically using the explained routine, or never flush unless flush() is called explicitly. The last mode is useful for long running units of work, where a Session is kept open and disconnected for a long time (see )." -msgstr "也可以改变默认的设置,来让刷出(flush)操作发生的不那么频繁。FlushMode 类定义了三种不同的方式。仅在提交时刷出(仅当 Hibernate 的 Transaction API 被使用时有效),按照刚才说的方式刷出,以及除非明确使用 flush() 否则从不刷出。 最后一种模式对于那些需要长时间保持 Session 为打开或者断线状态的长时间运行的工作单元很有用。(参见 )。" +#: session_api.xml:776 +#, fuzzy, no-c-format +msgid "" +"It is possible to change the default behavior so that flush occurs less " +"frequently. The FlushMode class defines three different " +"modes: only flush at commit time when the Hibernate Transaction API is used, flush automatically using the explained routine, or " +"never flush unless flush() is called explicitly. The last " +"mode is useful for long running units of work, where a Session is kept open and disconnected for a long time (see )." +msgstr "" +"也可以改变默认的设置,来让刷出(flush)操作发生的不那么频繁。" +"FlushMode 类定义了三种不同的方式。仅在提交时刷出(仅当 " +"Hibernate 的 Transaction API 被使用时有效),按照刚才说的" +"方式刷出,以及除非明确使用 flush() 否则从不刷出。 最后一种" +"模式对于那些需要长时间保持 Session 为打开或者断线状态的长" +"时间运行的工作单元很有用。(参见 )。" + +#. Tag: programlisting +#: session_api.xml:786 +#, fuzzy, no-c-format +msgid "" +"sess = sf.openSession();\n" +"Transaction tx = sess.beginTransaction();\n" +"sess.setFlushMode(FlushMode.COMMIT); // allow queries to return stale state\n" +"\n" +"Cat izi = (Cat) sess.load(Cat.class, id);\n" +"izi.setName(iznizi);\n" +"\n" +"// might return stale data\n" +"sess.find(\"from Cat as cat left outer join cat.kittens kitten\");\n" +"\n" +"// change to izi is not flushed!\n" +"...\n" +"tx.commit(); // flush occurs\n" +"sess.close();" +msgstr "" +"" #. Tag: para -#, no-c-format -msgid "During flush, an exception might occur (e.g. if a DML operation violates a constraint). Since handling exceptions involves some understanding of Hibernate's transactional behavior, we discuss it in ." -msgstr "刷出(flush)期间,可能会抛出异常(例如一个 DML 操作违反了约束)。异常处理涉及到对 Hibernate 事务性行为的理解,因此我们将在 中讨论。 " +#: session_api.xml:788 +#, fuzzy, no-c-format +msgid "" +"During flush, an exception might occur (e.g. if a DML operation violates a " +"constraint). Since handling exceptions involves some understanding of " +"Hibernate's transactional behavior, we discuss it in ." +msgstr "" +"刷出(flush)期间,可能会抛出异常(例如一个 DML 操作违反了约束)。异常处理涉" +"及到对 Hibernate 事务性行为的理解,因此我们将在 中讨论。 " #. Tag: title +#: session_api.xml:795 #, no-c-format msgid "Transitive persistence" msgstr "传播性持久化(transitive persistence)" #. Tag: para +#: session_api.xml:797 #, no-c-format -msgid "It is quite cumbersome to save, delete, or reattach individual objects, especially if you deal with a graph of associated objects. A common case is a parent/child relationship. Consider the following example:" -msgstr "对每一个对象都要执行保存,删除或重关联操作让人感觉有点麻烦,尤其是在处理许多彼此关联的对象的时候。一个常见的例子是父子关系。考虑下面的例子:" +msgid "" +"It is quite cumbersome to save, delete, or reattach individual objects, " +"especially if you deal with a graph of associated objects. A common case is " +"a parent/child relationship. Consider the following example:" +msgstr "" +"对每一个对象都要执行保存,删除或重关联操作让人感觉有点麻烦,尤其是在处理许多" +"彼此关联的对象的时候。一个常见的例子是父子关系。考虑下面的例子:" #. Tag: para +#: session_api.xml:802 #, no-c-format -msgid "If the children in a parent/child relationship would be value typed (e.g. a collection of addresses or strings), their life cycle would depend on the parent and no further action would be required for convenient \"cascading\" of state changes. When the parent is saved, the value-typed child objects are saved and when the parent is deleted, the children will be deleted, etc. This works for operations such as the removal of a child from the collection. Since value-typed objects cannot have shared references, Hibernate will detect this and delete the child from the database." -msgstr "如果一个父子关系中的子对象是值类型(value typed)(例如,地址或字符串的集合)的,他们的生命周期会依赖于父对象,可以享受方便的级联操作(Cascading),不需要额外的动作。父对象被保存时,这些值类型(value typed)子对象也将被保存;父对象被删除时,子对象也将被删除。这对将一个子对象从集合中移除是同样有效:Hibernate 会检测到,并且因为值类型(value typed)的对象不可能被其他对象引用,所以 Hibernate 会在数据库中删除这个子对象。 " +msgid "" +"If the children in a parent/child relationship would be value typed (e.g. a " +"collection of addresses or strings), their life cycle would depend on the " +"parent and no further action would be required for convenient \"cascading\" " +"of state changes. When the parent is saved, the value-typed child objects " +"are saved and when the parent is deleted, the children will be deleted, etc. " +"This works for operations such as the removal of a child from the " +"collection. Since value-typed objects cannot have shared references, " +"Hibernate will detect this and delete the child from the database." +msgstr "" +"如果一个父子关系中的子对象是值类型(value typed)(例如,地址或字符串的集合)" +"的,他们的生命周期会依赖于父对象,可以享受方便的级联操作(Cascading),不需要" +"额外的动作。父对象被保存时,这些值类型(value typed)子对象也将被保存;父对象" +"被删除时,子对象也将被删除。这对将一个子对象从集合中移除是同样有效:" +"Hibernate 会检测到,并且因为值类型(value typed)的对象不可能被其他对象引用," +"所以 Hibernate 会在数据库中删除这个子对象。 " #. Tag: para +#: session_api.xml:812 #, no-c-format -msgid "Now consider the same scenario with parent and child objects being entities, not value-types (e.g. categories and items, or parent and child cats). Entities have their own life cycle and support shared references. Removing an entity from the collection does not mean it can be deleted), and there is by default no cascading of state from one entity to any other associated entities. Hibernate does not implement persistence by reachability by default." -msgstr "现在考虑同样的场景,不过父子对象都是实体(entities)类型,而非值类型(value typed)(例如,类别与个体,或母猫和小猫)。实体有自己的生命期,允许共享对其的引用(因此从集合中移除一个实体,不意味着它可以被删除),并且实体到其他关联实体之间默认没有级联操作的设置。 Hibernate 默认不实现所谓的可到达即持久化(persistence by reachability)的策略。 " +msgid "" +"Now consider the same scenario with parent and child objects being entities, " +"not value-types (e.g. categories and items, or parent and child cats). " +"Entities have their own life cycle and support shared references. Removing " +"an entity from the collection does not mean it can be deleted), and there is " +"by default no cascading of state from one entity to any other associated " +"entities. Hibernate does not implement persistence by " +"reachability by default." +msgstr "" +"现在考虑同样的场景,不过父子对象都是实体(entities)类型,而非值类型(value " +"typed)(例如,类别与个体,或母猫和小猫)。实体有自己的生命期,允许共享对其的" +"引用(因此从集合中移除一个实体,不意味着它可以被删除),并且实体到其他关联实" +"体之间默认没有级联操作的设置。 Hibernate 默认不实现所谓的可到达即持" +"久化(persistence by reachability)的策略。 " #. Tag: para +#: session_api.xml:820 #, no-c-format -msgid "For each basic operation of the Hibernate session - including persist(), merge(), saveOrUpdate(), delete(), lock(), refresh(), evict(), replicate() - there is a corresponding cascade style. Respectively, the cascade styles are named create, merge, save-update, delete, lock, refresh, evict, replicate. If you want an operation to be cascaded along an association, you must indicate that in the mapping document. For example:" -msgstr "每个 Hibernate session 的基本操作 — 包括 persist(), merge(), saveOrUpdate(), delete(), lock(), refresh(), evict(), replicate() — 都有对应的级联风格(cascade style)。这些级联风格(cascade style)风格分别命名为 create, merge, save-update, delete, lock, refresh, evict, replicate。如果你希望一个操作被顺着关联关系级联传播,你必须在映射文件中指出这一点。例如:" +msgid "" +"For each basic operation of the Hibernate session - including " +"persist(), merge(), saveOrUpdate(), delete(), lock(), refresh(), " +"evict(), replicate() - there is a corresponding cascade style. " +"Respectively, the cascade styles are named create, merge, save-" +"update, delete, lock, refresh, evict, replicate. If you want an " +"operation to be cascaded along an association, you must indicate that in the " +"mapping document. For example:" +msgstr "" +"每个 Hibernate session 的基本操作 — 包括 persist(), merge(), " +"saveOrUpdate(), delete(), lock(), refresh(), evict(), replicate() " +"— 都有对应的级联风格(cascade style)。这些级联风格(cascade style)风格分别" +"命名为 create, merge, save-update, delete, lock, refresh, evict, " +"replicate。如果你希望一个操作被顺着关联关系级联传播,你必须在映射文" +"件中指出这一点。例如:" + +#. Tag: programlisting +#: session_api.xml:828 +#, fuzzy, no-c-format +msgid "<one-to-one name=\"person\" cascade=\"persist\"/>" +msgstr "]]>" #. Tag: para +#: session_api.xml:830 #, no-c-format msgid "Cascade styles my be combined:" msgstr "级联风格(cascade style)是可组合的:" -#. Tag: para -#, no-c-format -msgid "You can even use cascade=\"all\" to specify that all operations should be cascaded along the association. The default cascade=\"none\" specifies that no operations are to be cascaded." -msgstr "你可以使用 cascade=\"all\" 来指定全部操作都顺着关联关系级联(cascaded)。默认值是 cascade=\"none\",即任何操作都不会被级联(cascaded)。 " +#. Tag: programlisting +#: session_api.xml:832 +#, fuzzy, no-c-format +msgid "<one-to-one name=\"person\" cascade=\"persist,delete,lock\"/>" +msgstr "" +"]]>" #. Tag: para +#: session_api.xml:834 #, no-c-format -msgid "A special cascade style, delete-orphan, applies only to one-to-many associations, and indicates that the delete() operation should be applied to any child object that is removed from the association." -msgstr "注意有一个特殊的级联风格(cascade style) delete-orphan,只应用于 one-to-many 关联,表明 delete() 操作应该被应用于所有从关联中删除的对象。" +msgid "" +"You can even use cascade=\"all\" to specify that " +"all operations should be cascaded along the " +"association. The default cascade=\"none\" specifies that " +"no operations are to be cascaded." +msgstr "" +"你可以使用 cascade=\"all\" 来指定全部" +"操作都顺着关联关系级联(cascaded)。默认值是 cascade=\"none\",即任何操作都不会被级联(cascaded)。 " #. Tag: para +#: session_api.xml:839 +#, no-c-format +msgid "" +"In case you are using annotatons you probably have noticed the " +"cascade attribute taking an array of " +"CascadeType as a value. The cascade concept in JPA is " +"very is similar to the transitive persistence and cascading of operations as " +"described above, but with slightly different semantics and cascading types:" +msgstr "" + +#. Tag: para +#: session_api.xml:848 +#, no-c-format +msgid "" +"CascadeType.PERSIST: cascades the persist (create) " +"operation to associated entities persist() is called or if the entity is " +"managed" +msgstr "" + +#. Tag: para +#: session_api.xml:854 +#, no-c-format +msgid "" +"CascadeType.MERGE: cascades the merge operation to " +"associated entities if merge() is called or if the entity is managed" +msgstr "" + +#. Tag: para +#: session_api.xml:860 +#, no-c-format +msgid "" +"CascadeType.REMOVE: cascades the remove operation to " +"associated entities if delete() is called" +msgstr "" + +#. Tag: para +#: session_api.xml:865 +#, no-c-format +msgid "" +"CascadeType.REFRESH: cascades the refresh operation to " +"associated entities if refresh() is called" +msgstr "" + +#. Tag: para +#: session_api.xml:870 +#, no-c-format +msgid "" +"CascadeType.DETACH: cascades the detach operation to " +"associated entities if detach() is called" +msgstr "" + +#. Tag: para +#: session_api.xml:875 +#, fuzzy, no-c-format +msgid "CascadeType.ALL: all of the above" +msgstr "saveOrUpdate() 做下面的事:" + +#. Tag: para +#: session_api.xml:880 +#, no-c-format +msgid "" +"CascadeType.ALL also covers Hibernate specific operations like save-update, " +"lock etc..." +msgstr "" + +#. Tag: para +#: session_api.xml:884 +#, no-c-format +msgid "" +"A special cascade style, delete-orphan, applies only to " +"one-to-many associations, and indicates that the delete() " +"operation should be applied to any child object that is removed from the " +"association. Using annotations there is no CascadeType.DELETE-" +"ORPHAN equivalent. Instead you can use the attribute " +"orphanRemoval as seen in . If an entity is removed from a " +"@OneToMany collection or an associated entity is " +"dereferenced from a @OneToOne association, this " +"associated entity can be marked for deletion if orphanRemoval is set to true." +msgstr "" + +#. Tag: title +#: session_api.xml:897 +#, no-c-format +msgid "@OneToMany with orphanRemoval" +msgstr "" + +#. Tag: programlisting +#: session_api.xml:900 +#, no-c-format +msgid "" +"@Entity \n" +"public class Customer {\n" +" private Set<Order> orders;\n" +"\n" +" @OneToMany(cascade=CascadeType.ALL, orphanRemoval=true) \n" +" public Set<Order> getOrders() { return orders; }\n" +"\n" +" public void setOrders(Set<Order> orders) { this.orders = orders; }\n" +"\n" +" [...]\n" +"}\n" +"\n" +"@Entity \n" +"public class Order { ... }\n" +"\n" +"Customer customer = em.find(Customer.class, 1l);\n" +"Order order = em.find(Order.class, 1l);\n" +"customer.getOrders().remove(order); //order will be deleted by cascade" +msgstr "" + +#. Tag: para +#: session_api.xml:903 #, no-c-format msgid "Recommendations:" msgstr "建议:" #. Tag: para -#, no-c-format -msgid "It does not usually make sense to enable cascade on a <many-to-one> or <many-to-many> association. Cascade is often useful for <one-to-one> and <one-to-many> associations." -msgstr "通常在 <many-to-one><many-to-many> 关系中应用级联(cascade)没什么意义。级联(cascade)通常在 <one-to-one><one-to-many> 关系中比较有用。 " +#: session_api.xml:907 +#, fuzzy, no-c-format +msgid "" +"It does not usually make sense to enable cascade on a many-to-one or many-to-" +"many association. In fact the @ManyToOne and " +"@ManyToMany don't even offer a orphanRemoval attribute. Cascading is often useful for one-to-one and one-to-many " +"associations." +msgstr "" +"通常在 <many-to-one><many-to-" +"many> 关系中应用级联(cascade)没什么意义。级联(cascade)通常" +"在 <one-to-one><one-to-many> 关系中比较有用。 " #. Tag: para -#, no-c-format -msgid "If the child object's lifespan is bounded by the lifespan of the parent object, make it a life cycle object by specifying cascade=\"all,delete-orphan\"." -msgstr "如果子对象的寿命限定在父亲对象的寿命之内,可通过指定 cascade=\"all,delete-orphan\" 将其变为自动生命周期管理的对象(lifecycle object)。 " +#: session_api.xml:915 +#, fuzzy, no-c-format +msgid "" +"If the child object's lifespan is bounded by the lifespan of the parent " +"object, make it a life cycle object by specifying " +"cascade=\"all,delete-orphan\"(@OneToMany" +"(cascade=CascadeType.ALL, orphanRemoval=true))." +msgstr "" +"如果子对象的寿命限定在父亲对象的寿命之内,可通过指定 cascade=\"all," +"delete-orphan\" 将其变为自动生命周期管理的对象" +"(lifecycle object)。 " #. Tag: para +#: session_api.xml:923 #, no-c-format -msgid "Otherwise, you might not need cascade at all. But if you think that you will often be working with the parent and children together in the same transaction, and you want to save yourself some typing, consider using cascade=\"persist,merge,save-update\"." -msgstr "其他情况,你可根本不需要级联(cascade)。但是如果你认为你会经常在某个事务中同时用到父对象与子对象,并且你希望少打点儿字,可以考虑使用 cascade=\"persist,merge,save-update\"。" +msgid "" +"Otherwise, you might not need cascade at all. But if you think that you will " +"often be working with the parent and children together in the same " +"transaction, and you want to save yourself some typing, consider using " +"cascade=\"persist,merge,save-update\"." +msgstr "" +"其他情况,你可根本不需要级联(cascade)。但是如果你认为你会经常在某个事务中同" +"时用到父对象与子对象,并且你希望少打点儿字,可以考虑使用 cascade=" +"\"persist,merge,save-update\"。" #. Tag: para +#: session_api.xml:931 #, no-c-format -msgid "Mapping an association (either a single valued association, or a collection) with cascade=\"all\" marks the association as a parent/child style relationship where save/update/delete of the parent results in save/update/delete of the child or children." -msgstr "可以使用 cascade=\"all\" 将一个关联关系(无论是对值对象的关联,或者对一个集合的关联)标记为父/子关系的关联。 这样对父对象进行 save/update/delete 操作就会导致子对象也进行 save/update/delete 操作。" +msgid "" +"Mapping an association (either a single valued association, or a collection) " +"with cascade=\"all\" marks the association as a " +"parent/child style relationship where save/update/" +"delete of the parent results in save/update/delete of the child or children." +msgstr "" +"可以使用 cascade=\"all\" 将一个关联关系(无论是对值对象的" +"关联,或者对一个集合的关联)标记为父/子关系的关联。 这样" +"对父对象进行 save/update/delete 操作就会导致子对象也进行 save/update/delete " +"操作。" #. Tag: para -#, no-c-format -msgid "Furthermore, a mere reference to a child from a persistent parent will result in save/update of the child. This metaphor is incomplete, however. A child which becomes unreferenced by its parent is not automatically deleted, except in the case of a <one-to-many> association mapped with cascade=\"delete-orphan\". The precise semantics of cascading operations for a parent/child relationship are as follows:" -msgstr "此外,一个持久的父对象对子对象的浅引用(mere reference)会导致子对象被同步 save/update。不过,这个隐喻(metaphor)的说法并不完整。除非关联是 <one-to-many> 关联并且被标记为 cascade=\"delete-orphan\",否则父对象失去对某个子对象的引用不会导致该子对象被自动删除。父子关系的级联(cascading)操作准确语义如下: " +#: session_api.xml:937 +#, fuzzy, no-c-format +msgid "" +"Furthermore, a mere reference to a child from a persistent parent will " +"result in save/update of the child. This metaphor is incomplete, however. A " +"child which becomes unreferenced by its parent is not " +"automatically deleted, except in the case of a one-to-many association " +"mapped with cascade=\"delete-orphan\". The precise " +"semantics of cascading operations for a parent/child relationship are as " +"follows:" +msgstr "" +"此外,一个持久的父对象对子对象的浅引用(mere reference)会导致子对象被同步 " +"save/update。不过,这个隐喻(metaphor)的说法并不完整。除非关联是 " +"<one-to-many> 关联并且被标记为 cascade=" +"\"delete-orphan\",否则父对象失去对某个子对象的引用不会导致该子对象被自动删除。父子关系的级联(cascading)操作准确语义如" +"下: " #. Tag: para +#: session_api.xml:948 #, no-c-format -msgid "If a parent is passed to persist(), all children are passed to persist()" -msgstr "如果父对象被 persist(),那么所有子对象也会被 persist()" +msgid "" +"If a parent is passed to persist(), all children are " +"passed to persist()" +msgstr "" +"如果父对象被 persist(),那么所有子对象也会被 " +"persist()" #. Tag: para +#: session_api.xml:953 #, no-c-format -msgid "If a parent is passed to merge(), all children are passed to merge()" -msgstr "如果父对象被 merge(),那么所有子对象也会被 merge()" +msgid "" +"If a parent is passed to merge(), all children are passed " +"to merge()" +msgstr "" +"如果父对象被 merge(),那么所有子对象也会被 merge" +"()" #. Tag: para +#: session_api.xml:958 #, no-c-format -msgid "If a parent is passed to save(), update() or saveOrUpdate(), all children are passed to saveOrUpdate()" -msgstr "如果父对象被 save()update()saveOrUpdate(),那么所有子对象则会被 saveOrUpdate()" +msgid "" +"If a parent is passed to save(), update() or saveOrUpdate(), all children are passed to " +"saveOrUpdate()" +msgstr "" +"如果父对象被 save()update() 或 " +"saveOrUpdate(),那么所有子对象则会被 saveOrUpdate" +"()" #. Tag: para +#: session_api.xml:964 #, no-c-format -msgid "If a transient or detached child becomes referenced by a persistent parent, it is passed to saveOrUpdate()" -msgstr "如果某个持久的父对象引用了瞬时(transient)或者脱管(detached)的子对象,那么子对象将会被 saveOrUpdate()" +msgid "" +"If a transient or detached child becomes referenced by a persistent parent, " +"it is passed to saveOrUpdate()" +msgstr "" +"如果某个持久的父对象引用了瞬时(transient)或者脱管(detached)的子对象,那么" +"子对象将会被 saveOrUpdate()" #. Tag: para +#: session_api.xml:970 #, no-c-format -msgid "If a parent is deleted, all children are passed to delete()" +msgid "" +"If a parent is deleted, all children are passed to delete()" msgstr "如果父对象被删除,那么所有子对象也会被 delete()" #. Tag: para +#: session_api.xml:975 #, no-c-format -msgid "If a child is dereferenced by a persistent parent, nothing special happens - the application should explicitly delete the child if necessary - unless cascade=\"delete-orphan\", in which case the \"orphaned\" child is deleted." -msgstr "除非被标记为 cascade=\"delete-orphan\"(删除“孤儿”模式,此时不被任何一个父对象引用的子对象会被删除),否则子对象失掉父对象对其的引用时,什么事也不会发生。如果有特殊需要,应用程序可通过显式调用 delete() 删除子对象。" +msgid "" +"If a child is dereferenced by a persistent parent, nothing special " +"happens - the application should explicitly delete the child if " +"necessary - unless cascade=\"delete-orphan\", in which " +"case the \"orphaned\" child is deleted." +msgstr "" +"除非被标记为 cascade=\"delete-orphan\"(删除“孤儿”模式,此" +"时不被任何一个父对象引用的子对象会被删除),否则子对象失掉父对象对其的引用" +"时,什么事也不会发生。如果有特殊需要,应用程序可通过显式" +"调用 delete() 删除子对象。" #. Tag: para +#: session_api.xml:983 #, no-c-format -msgid "Finally, note that cascading of operations can be applied to an object graph at call time or at flush time. All operations, if enabled, are cascaded to associated entities reachable when the operation is executed. However, save-update and delete-orphan are transitive for all associated entities reachable during flush of the Session." -msgstr "最后,注意操作的级联可能是在调用期(call time)或者写入期(flush time)作用到对象图上的。所有的操作,如果允许,都在操作被执行的时候级联到可触及的关联实体上。然而,save-upatedelete-orphan 是在Session flush 的时候才作用到所有可触及的被关联对象上的。 " +msgid "" +"Finally, note that cascading of operations can be applied to an object graph " +"at call time or at flush time. All " +"operations, if enabled, are cascaded to associated entities reachable when " +"the operation is executed. However, save-update and " +"delete-orphan are transitive for all associated entities " +"reachable during flush of the Session." +msgstr "" +"最后,注意操作的级联可能是在调用期(call time)或者" +"写入期(flush time)作用到对象图上的。所有的操作,如果允" +"许,都在操作被执行的时候级联到可触及的关联实体上。然而,save-upatedelete-orphan 是在Session " +"flush 的时候才作用到所有可触及的被关联对象上的。 " #. Tag: title +#: session_api.xml:993 #, no-c-format msgid "Using metadata" msgstr "使用元数据" #. Tag: para +#: session_api.xml:995 #, no-c-format -msgid "Hibernate requires a rich meta-level model of all entity and value types. This model can be useful to the application itself. For example, the application might use Hibernate's metadata to implement a \"smart\" deep-copy algorithm that understands which objects should be copied (eg. mutable value types) and which objects that should not (e.g. immutable value types and, possibly, associated entities)." -msgstr "Hibernate 中有一个非常丰富的元级别(meta-level)的模型,含有所有的实体和值类型数据的元数据。 有时这个模型对应用程序本身也会非常有用。比如说,应用程序可能在实现一种“智能”的深度拷贝算法时,通过使用 Hibernate 的元数据来了解哪些对象应该被拷贝(比如,可变的值类型数据),那些不应该(不可变的值类型数据,也许还有某些被关联的实体)。 " +msgid "" +"Hibernate requires a rich meta-level model of all entity and value types. " +"This model can be useful to the application itself. For example, the " +"application might use Hibernate's metadata to implement a \"smart\" deep-" +"copy algorithm that understands which objects should be copied (eg. mutable " +"value types) and which objects that should not (e.g. immutable value types " +"and, possibly, associated entities)." +msgstr "" +"Hibernate 中有一个非常丰富的元级别(meta-level)的模型,含有所有的实体和值类" +"型数据的元数据。 有时这个模型对应用程序本身也会非常有用。比如说,应用程序可能" +"在实现一种“智能”的深度拷贝算法时,通过使用 Hibernate 的元数据来了解哪些对象应" +"该被拷贝(比如,可变的值类型数据),那些不应该(不可变的值类型数据,也许还有" +"某些被关联的实体)。 " #. Tag: para +#: session_api.xml:1002 #, no-c-format -msgid "Hibernate exposes metadata via the ClassMetadata and CollectionMetadata interfaces and the Type hierarchy. Instances of the metadata interfaces can be obtained from the SessionFactory." -msgstr "Hibernate 提供了 ClassMetadata 接口,CollectionMetadata 接口和 Type 层次体系来访问元数据。可以通过 SessionFactory 获取元数据接口的实例。 " +msgid "" +"Hibernate exposes metadata via the ClassMetadata and " +"CollectionMetadata interfaces and the Type hierarchy. Instances of the metadata interfaces can be obtained " +"from the SessionFactory." +msgstr "" +"Hibernate 提供了 ClassMetadata 接口," +"CollectionMetadata 接口和 Type 层次体系" +"来访问元数据。可以通过 SessionFactory 获取元数据接口的实" +"例。 " + +#. Tag: programlisting +#: session_api.xml:1007 +#, fuzzy, no-c-format +msgid "" +"Cat fritz = ......;\n" +"ClassMetadata catMeta = sessionfactory.getClassMetadata(Cat.class);\n" +"\n" +"Object[] propertyValues = catMeta.getPropertyValues(fritz);\n" +"String[] propertyNames = catMeta.getPropertyNames();\n" +"Type[] propertyTypes = catMeta.getPropertyTypes();\n" +"\n" +"// get a Map of all properties which are not collections or associations\n" +"Map namedValues = new HashMap();\n" +"for ( int i=0; i<propertyNames.length; i++ ) {\n" +" if ( !propertyTypes[i].isEntityType() && !propertyTypes[i]." +"isCollectionType() ) {\n" +" namedValues.put( propertyNames[i], propertyValues[i] );\n" +" }\n" +"}" +msgstr "" +"" #~ msgid "" -#~ "" +#~ "A special cascade style, delete-orphan, applies only " +#~ "to one-to-many associations, and indicates that the delete() operation should be applied to any child object that is removed " +#~ "from the association." #~ msgstr "" -#~ "" -#~ msgid "" -#~ "" -#~ msgstr "" -#~ "" -#~ msgid "" -#~ msgstr "" -#~ msgid "" -#~ "" -#~ msgstr "" -#~ "" -#~ msgid "" -#~ "" -#~ msgstr "" -#~ "" -#~ msgid "" -#~ "" -#~ msgstr "" -#~ "" -#~ msgid "" -#~ "" -#~ msgstr "" -#~ "" -#~ msgid "" -#~ "" -#~ msgstr "" -#~ "" -#~ msgid "" -#~ "" -#~ msgstr "" -#~ "" -#~ msgid "" -#~ "" -#~ msgstr "" -#~ "" -#~ msgid "" -#~ "" -#~ msgstr "" -#~ "" -#~ msgid "" -#~ "" -#~ msgstr "" -#~ "" -#~ msgid "" -#~ "" -#~ msgstr "" -#~ "" -#~ msgid "" -#~ "" -#~ msgstr "" -#~ "" -#~ msgid "" -#~ "" -#~ msgstr "" -#~ "" -#~ msgid "" -#~ "" -#~ msgstr "" -#~ "" -#~ msgid "" -#~ " i++ ) && cats.next() ) pageOfCats.add( cats.get" -#~ "(1) );\n" -#~ "\n" -#~ "}\n" -#~ "cats.close()]]>" -#~ msgstr "" -#~ " i++ ) && cats.next() ) pageOfCats.add( cats.get" -#~ "(1) );\n" -#~ "\n" -#~ "}\n" -#~ "cats.close()]]>" -#~ msgid "" -#~ " ?\n" -#~ "] ]>]]>" -#~ msgstr "" -#~ " ?\n" -#~ "] ]>]]>" -#~ msgid "" -#~ "" -#~ msgstr "" -#~ "" -#~ msgid "" -#~ "" -#~ msgstr "" -#~ "" -#~ msgid "" -#~ "" -#~ msgstr "" -#~ "" -#~ msgid "" -#~ "" -#~ msgstr "" -#~ "" -#~ msgid "" -#~ "" -#~ msgstr "" -#~ "" -#~ msgid "" -#~ "" -#~ msgstr "" -#~ "" -#~ msgid "" -#~ "" -#~ msgstr "" -#~ "" -#~ msgid "" -#~ "" -#~ msgstr "" -#~ "" -#~ msgid "" -#~ "" -#~ msgstr "" -#~ "" -#~ msgid "" -#~ "" -#~ msgstr "" -#~ "" -#~ msgid "" -#~ "" -#~ msgstr "" -#~ "" -#~ msgid "" -#~ msgstr "" -#~ msgid "" -#~ "" -#~ msgstr "" -#~ "" -#~ msgid "" -#~ "" -#~ msgstr "" -#~ "" -#~ msgid "]]>" -#~ msgstr "]]>" -#~ msgid "" -#~ "]]>" -#~ msgstr "" -#~ "]]>" -#~ msgid "" -#~ "" -#~ msgstr "" -#~ "" - +#~ "注意有一个特殊的级联风格(cascade style) delete-orphan,只应用于 one-to-many 关联,表明 delete() 操作" +#~ "应该被应用于所有从关联中删除的对象。" diff --git a/documentation/manual/src/main/docbook/zh-CN/content/tutorial.po b/documentation/manual/src/main/docbook/zh-CN/content/tutorial.po index c57e5679da..ee2d1c3ab9 100644 --- a/documentation/manual/src/main/docbook/zh-CN/content/tutorial.po +++ b/documentation/manual/src/main/docbook/zh-CN/content/tutorial.po @@ -6,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: tutorial\n" "Report-Msgid-Bugs-To: http://bugs.kde.org\n" -"POT-Creation-Date: 2010-02-11T05:38:16\n" +"POT-Creation-Date: 2010-07-20 21:02+0000\n" "PO-Revision-Date: 2010-03-16 09:56+1000\n" "Last-Translator: Xi HUANG \n" "Language-Team: \n" @@ -16,1950 +16,3104 @@ msgstr "" "X-Generator: KBabel 1.11.4\n" #. Tag: title +#: tutorial.xml:34 #, no-c-format msgid "Tutorial" msgstr "教程" #. Tag: para +#: tutorial.xml:36 #, no-c-format -msgid "Intended for new users, this chapter provides an step-by-step introduction to Hibernate, starting with a simple application using an in-memory database. The tutorial is based on an earlier tutorial developed by Michael Gloegl. All code is contained in the tutorials/web directory of the project source." -msgstr "面向新用户,从一个简单的使用内存数据库的例子开始,本章提供对 Hibernate 的逐步介绍。本教程基于 Michael Gloegl 早期编写的手册。所有代码都包含在 tutorials/web 目录下。" +msgid "" +"Intended for new users, this chapter provides an step-by-step introduction " +"to Hibernate, starting with a simple application using an in-memory " +"database. The tutorial is based on an earlier tutorial developed by Michael " +"Gloegl. All code is contained in the tutorials/web " +"directory of the project source." +msgstr "" +"面向新用户,从一个简单的使用内存数据库的例子开始,本章提供对 Hibernate 的逐步" +"介绍。本教程基于 Michael Gloegl 早期编写的手册。所有代码都包含在 " +"tutorials/web 目录下。" #. Tag: para +#: tutorial.xml:45 #, no-c-format -msgid "This tutorial expects the user have knowledge of both Java and SQL. If you have a limited knowledge of JAVA or SQL, it is advised that you start with a good introduction to that technology prior to attempting to learn Hibernate." -msgstr "本教程期望用户具备 Java 和 SQL 知识。如果你这方面的知识有限,我们建议你在学习 Hibernate 之前先好好了解这些技术。" +msgid "" +"This tutorial expects the user have knowledge of both Java and SQL. If you " +"have a limited knowledge of JAVA or SQL, it is advised that you start with a " +"good introduction to that technology prior to attempting to learn Hibernate." +msgstr "" +"本教程期望用户具备 Java 和 SQL 知识。如果你这方面的知识有限,我们建议你在学" +"习 Hibernate 之前先好好了解这些技术。" #. Tag: para +#: tutorial.xml:54 #, no-c-format -msgid "The distribution contains another example application under the tutorial/eg project source directory." -msgstr "本版本在源代码目录 tutorial/eg 下还包含另外一个例程。" +msgid "" +"The distribution contains another example application under the " +"tutorial/eg project source directory." +msgstr "" +"本版本在源代码目录 tutorial/eg 下还包含另外一个例程。" #. Tag: title +#: tutorial.xml:62 #, no-c-format msgid "Part 1 - The first Hibernate Application" msgstr "第一部分 - 第一个 Hibernate 应用程序" #. Tag: para +#: tutorial.xml:64 #, no-c-format -msgid "For this example, we will set up a small database application that can store events we want to attend and information about the host(s) of these events." -msgstr "在这个例子里,我们将设立一个小应用程序可以保存我们希望参加的活动(events)和这些活动主办方的相关信息。(译者注:在本教程的后面部分,我们将直接使用 event 而不是它的中文翻译“活动”,以免混淆。)" +msgid "" +"For this example, we will set up a small database application that can store " +"events we want to attend and information about the host(s) of these events." +msgstr "" +"在这个例子里,我们将设立一个小应用程序可以保存我们希望参加的活动(events)和" +"这些活动主办方的相关信息。(译者注:在本教程的后面部分,我们将直接使用 event " +"而不是它的中文翻译“活动”,以免混淆。)" #. Tag: para +#: tutorial.xml:70 #, no-c-format -msgid "Although you can use whatever database you feel comfortable using, we will use HSQLDB (an in-memory, Java database) to avoid describing installation/setup of any particular database servers." -msgstr "虽然你可以使用任何数据库,我们还是用 HSQLDB(一个用 Java 编写的内存数据库)来避免花费篇章对数据库服务器的安装/配置进行解释。" +msgid "" +"Although you can use whatever database you feel comfortable using, we will " +"use HSQLDB (an in-memory, Java " +"database) to avoid describing installation/setup of any particular database " +"servers." +msgstr "" +"虽然你可以使用任何数据库,我们还是用 HSQLDB(一个用 Java 编写的内存数据库)来避免花费篇章对数据库服务器" +"的安装/配置进行解释。" #. Tag: title +#: tutorial.xml:79 #, no-c-format msgid "Setup" msgstr "设置" #. Tag: para +#: tutorial.xml:81 #, no-c-format -msgid "The first thing we need to do is to set up the development environment. We will be using the \"standard layout\" advocated by alot of build tools such as Maven. Maven, in particular, has a good resource describing this layout. As this tutorial is to be a web application, we will be creating and making use of src/main/java, src/main/resources and src/main/webapp directories." -msgstr "我们需要做的第一件事情是设置开发环境。我们将使用许多构建工具如 Maven 所鼓吹的“标准格式”。特别是 Maven,它的资源对这个格式(layout)有着很好的描述。因为本教程使用的是 web 应用程序,我么将创建和使用 src/main/javasrc/main/resourcessrc/main/webapp 目录。" +msgid "" +"The first thing we need to do is to set up the development environment. We " +"will be using the \"standard layout\" advocated by alot of build tools such " +"as Maven. Maven, in particular, has " +"a good resource describing this layout. As this tutorial is to be a web application, we will be creating and " +"making use of src/main/java, src/main/" +"resources and src/main/webapp directories." +msgstr "" +"我们需要做的第一件事情是设置开发环境。我们将使用许多构建工具如 Maven 所鼓吹的“标准格式”。特别是 Maven,它的资源" +"对这个格式(layout)有着很好的描" +"述。因为本教程使用的是 web 应用程序,我么将创建和使用 src/main/" +"javasrc/main/resourcessrc/" +"main/webapp 目录。" #. Tag: para +#: tutorial.xml:91 #, no-c-format -msgid "We will be using Maven in this tutorial, taking advantage of its transitive dependency management capabilities as well as the ability of many IDEs to automatically set up a project for us based on the maven descriptor." -msgstr "在本教程里我们将使用 Maven,利用其 transitive dependency 管理以及根据 Maven 描述符用 IDE 自动设置项目的能力。" +msgid "" +"We will be using Maven in this tutorial, taking advantage of its transitive " +"dependency management capabilities as well as the ability of many IDEs to " +"automatically set up a project for us based on the maven descriptor." +msgstr "" +"在本教程里我们将使用 Maven,利用其 transitive dependency 管理以及根据 Maven " +"描述符用 IDE 自动设置项目的能力。" + +#. Tag: programlisting +#: tutorial.xml:97 +#, no-c-format +msgid "" +"\n" +"\n" +" 4.0.0\n" +"\n" +" org.hibernate.tutorials\n" +" hibernate-tutorial\n" +" 1.0.0-SNAPSHOT\n" +" First Hibernate Tutorial\n" +"\n" +" \n" +" \n" +" ${artifactId}\n" +" \n" +"\n" +" \n" +" \n" +" org.hibernate\n" +" hibernate-core\n" +" \n" +"\n" +" \n" +" \n" +" javax.servlet\n" +" servlet-api\n" +" \n" +"\n" +" \n" +" \n" +" org.slf4j\n" +" slf4j-simple\n" +" \n" +"\n" +" \n" +" \n" +" javassist\n" +" javassist\n" +" \n" +" \n" +"\n" +"]]>" +msgstr "" +"\n" +"\n" +" 4.0.0\n" +"\n" +" org.hibernate.tutorials\n" +" hibernate-tutorial\n" +" 1.0.0-SNAPSHOT\n" +" First Hibernate Tutorial\n" +"\n" +" \n" +" \n" +" ${artifactId}\n" +" \n" +"\n" +" \n" +" \n" +" org.hibernate\n" +" hibernate-core\n" +" \n" +"\n" +" \n" +" \n" +" javax.servlet\n" +" servlet-api\n" +" \n" +"\n" +" \n" +" \n" +" org.slf4j\n" +" slf4j-simple\n" +" \n" +"\n" +" \n" +" \n" +" javassist\n" +" javassist\n" +" \n" +" \n" +"\n" +"]]>" #. Tag: para -#, no-c-format -msgid "It is not a requirement to use Maven. If you wish to use something else to build this tutoial (such as Ant), the layout will remain the same. The only change is that you will need to manually account for all the needed dependencies. If you use something like Ivy providing transitive dependency management you would still use the dependencies mentioned below. Otherwise, you'd need to grab all dependencies, both explicit and transitive, and add them to the project's classpath. If working from the Hibernate distribution bundle, this would mean hibernate3.jar, all artifacts in the lib/required directory and all files from either the lib/bytecode/cglib or lib/bytecode/javassist directory; additionally you will need both the servlet-api jar and one of the slf4j logging backends." -msgstr "Maven 并不要求这样。如果你希望使用其他技术来构建这个教程(如 Ant),格式将保持不变。唯一的改变是你将需要手工管理所有的依赖关系。如果你使用 Ivy 来提供 transitive dependency 管理,你将仍然下面提到的依赖关系。否则,你将需要找到所有的依赖关系(显性的和过渡的)并把它们添加到项目的 classpath 里。如果使用 Hibernate 捆绑版本,这意味着 hibernate3.jarlib/required 目录下的所有 artifact 和 lib/bytecode/cgliblib/bytecode/javassist 下的所有文件,此外你将需要 servlet-api jar 和一个 slf4j 日志后台文件。 " +#: tutorial.xml:100 +#, fuzzy, no-c-format +msgid "" +"It is not a requirement to use Maven. If you wish to use something else to " +"build this tutorial (such as Ant), the layout will remain the same. The only " +"change is that you will need to manually account for all the needed " +"dependencies. If you use something like Ivy providing transitive dependency management you would " +"still use the dependencies mentioned below. Otherwise, you'd need to grab " +"all dependencies, both explicit and transitive, and add " +"them to the project's classpath. If working from the Hibernate distribution " +"bundle, this would mean hibernate3.jar, all artifacts " +"in the lib/required directory and all files from either " +"the lib/bytecode/cglib or lib/bytecode/" +"javassist directory; additionally you will need both the servlet-" +"api jar and one of the slf4j logging backends." +msgstr "" +"Maven 并不要求这样。如果你希望使用其他技术来构建这个教程(如 Ant),格式将保" +"持不变。唯一的改变是你将需要手工管理所有的依赖关系。如果你使用 Ivy 来提供 transitive dependency 管" +"理,你将仍然下面提到的依赖关系。否则,你将需要找到所有的依赖关系(显性的和过" +"渡的)并把它们添加到项目的 classpath 里。如果使用 Hibernate 捆绑版本,这意味" +"着 hibernate3.jarlib/required 目" +"录下的所有 artifact 和 lib/bytecode/cglib 或 " +"lib/bytecode/javassist 下的所有文件,此外你将需要 " +"servlet-api jar 和一个 slf4j 日志后台文件。 " #. Tag: para +#: tutorial.xml:117 #, no-c-format -msgid "Save this file as pom.xml in the project root directory." +msgid "" +"Save this file as pom.xml in the project root directory." msgstr "把这个文件保存为项目根目录下的 pom.xml。" #. Tag: title +#: tutorial.xml:124 #, no-c-format msgid "The first class" msgstr "第一个 class" #. Tag: para +#: tutorial.xml:126 #, no-c-format -msgid "Next, we create a class that represents the event we want to store in the database; it is a simple JavaBean class with some properties:" -msgstr "接下来我们创建一个类,用来代表那些我们希望储存在数据库里的 event,这是一个具有一些属性的简单 JavaBean 类:" +msgid "" +"Next, we create a class that represents the event we want to store in the " +"database; it is a simple JavaBean class with some properties:" +msgstr "" +"接下来我们创建一个类,用来代表那些我们希望储存在数据库里的 event,这是一个具" +"有一些属性的简单 JavaBean 类:" + +#. Tag: programlisting +#: tutorial.xml:131 +#, no-c-format +msgid "" +"" +msgstr "" +"" #. Tag: para +#: tutorial.xml:133 #, no-c-format -msgid "This class uses standard JavaBean naming conventions for property getter and setter methods, as well as private visibility for the fields. Although this is the recommended design, it is not required. Hibernate can also access fields directly, the benefit of accessor methods is robustness for refactoring." -msgstr "你可以看到这个类对属性的存取方法(getter and setter method)使用了标准 JavaBean 命名约定,同时把类属性(field)的访问级别设成私有的(private)。这是推荐的设计,但并不是必须的。Hibernate 也可以直接访问这些 field,而使用访问方法(accessor method)的好处是提供了重构时的健壮性(robustness)。" +msgid "" +"This class uses standard JavaBean naming conventions for property getter and " +"setter methods, as well as private visibility for the fields. Although this " +"is the recommended design, it is not required. Hibernate can also access " +"fields directly, the benefit of accessor methods is robustness for " +"refactoring." +msgstr "" +"你可以看到这个类对属性的存取方法(getter and setter method)使用了标准 " +"JavaBean 命名约定,同时把类属性(field)的访问级别设成私有的(private)。这是" +"推荐的设计,但并不是必须的。Hibernate 也可以直接访问这些 field,而使用访问方" +"法(accessor method)的好处是提供了重构时的健壮性(robustness)。" #. Tag: para +#: tutorial.xml:141 #, no-c-format -msgid "The id property holds a unique identifier value for a particular event. All persistent entity classes (there are less important dependent classes as well) will need such an identifier property if we want to use the full feature set of Hibernate. In fact, most applications, especially web applications, need to distinguish objects by identifier, so you should consider this a feature rather than a limitation. However, we usually do not manipulate the identity of an object, hence the setter method should be private. Only Hibernate will assign identifiers when an object is saved. Hibernate can access public, private, and protected accessor methods, as well as public, private and protected fields directly. The choice is up to you and you can match it to fit your application design." -msgstr "对一特定的 event, id 属性持有唯一的标识符(identifier)的值。如果我们希望使用 Hibernate 提供的所有特性,那么所有的持久化实体(persistent entity)类(这里也包括一些次要依赖类)都需要一个这样的标识符属性。而事实上,大多数应用程序(特别是 web 应用程序)都需要通过标识符来区别对象,所以你应该考虑使用标识符属性而不是把它当作一种限制。然而,我们通常不会操作对象的标识(identity),因此它的 setter 方法的访问级别应该声明 private。这样当对象被保存的时候,只有 Hibernate 可以为它分配标识符值。你可看到Hibernate可以直接访问 public,private 和 protected 的访问方法和 field。所以选择哪种方式完全取决于你,你可以使你的选择与你的应用程序设计相吻合。 " +msgid "" +"The id property holds a unique identifier value for a " +"particular event. All persistent entity classes (there are less important " +"dependent classes as well) will need such an identifier property if we want " +"to use the full feature set of Hibernate. In fact, most applications, " +"especially web applications, need to distinguish objects by identifier, so " +"you should consider this a feature rather than a limitation. However, we " +"usually do not manipulate the identity of an object, hence the setter method " +"should be private. Only Hibernate will assign identifiers when an object is " +"saved. Hibernate can access public, private, and protected accessor methods, " +"as well as public, private and protected fields directly. The choice is up " +"to you and you can match it to fit your application design." +msgstr "" +"对一特定的 event, id 属性持有唯一的标识符(identifier)的" +"值。如果我们希望使用 Hibernate 提供的所有特性,那么所有的持久化实体" +"(persistent entity)类(这里也包括一些次要依赖类)都需要一个这样的标识符属" +"性。而事实上,大多数应用程序(特别是 web 应用程序)都需要通过标识符来区别对" +"象,所以你应该考虑使用标识符属性而不是把它当作一种限制。然而,我们通常不会操" +"作对象的标识(identity),因此它的 setter 方法的访问级别应该声明 private。这" +"样当对象被保存的时候,只有 Hibernate 可以为它分配标识符值。你可看到Hibernate" +"可以直接访问 public,private 和 protected 的访问方法和 field。所以选择哪种方" +"式完全取决于你,你可以使你的选择与你的应用程序设计相吻合。 " #. Tag: para +#: tutorial.xml:156 #, no-c-format -msgid "The no-argument constructor is a requirement for all persistent classes; Hibernate has to create objects for you, using Java Reflection. The constructor can be private, however package or public visibility is required for runtime proxy generation and efficient data retrieval without bytecode instrumentation." -msgstr "所有的持久化类(persistent classes)都要求有无参的构造器,因为 Hibernate 必须使用 Java 反射机制来为你创建对象。构造器(constructor)的访问级别可以是 private,然而当生成运行时代理(runtime proxy)的时候则要求使用至少是 package 级别的访问控制,这样在没有字节码指令(bytecode instrumentation)的情况下,从持久化类里获取数据会更有效率。 " +msgid "" +"The no-argument constructor is a requirement for all persistent classes; " +"Hibernate has to create objects for you, using Java Reflection. The " +"constructor can be private, however package or public visibility is required " +"for runtime proxy generation and efficient data retrieval without bytecode " +"instrumentation." +msgstr "" +"所有的持久化类(persistent classes)都要求有无参的构造器,因为 Hibernate 必须" +"使用 Java 反射机制来为你创建对象。构造器(constructor)的访问级别可以是 " +"private,然而当生成运行时代理(runtime proxy)的时候则要求使用至少是 package " +"级别的访问控制,这样在没有字节码指令(bytecode instrumentation)的情况下,从" +"持久化类里获取数据会更有效率。 " #. Tag: para +#: tutorial.xml:164 #, no-c-format -msgid "Save this file to the src/main/java/org/hibernate/tutorial/domain directory." -msgstr "把这个文件保存到 src/main/java/org/hibernate/tutorial/domain 目录下。" +msgid "" +"Save this file to the src/main/java/org/hibernate/tutorial/domain directory." +msgstr "" +"把这个文件保存到 src/main/java/org/hibernate/tutorial/domain 目录下。" #. Tag: title +#: tutorial.xml:171 #, no-c-format msgid "The mapping file" msgstr "映射文件" #. Tag: para +#: tutorial.xml:173 #, no-c-format -msgid "Hibernate needs to know how to load and store objects of the persistent class. This is where the Hibernate mapping file comes into play. The mapping file tells Hibernate what table in the database it has to access, and what columns in that table it should use." -msgstr "Hibernate 需要知道怎样去加载(load)和存储(store)持久化类的对象。这正是 Hibernate 映射文件发挥作用的地方。映射文件告诉 Hibernate 它应该访问数据库(database)里面的哪个表(table)及应该使用表里面的哪些字段(column)。" +msgid "" +"Hibernate needs to know how to load and store objects of the persistent " +"class. This is where the Hibernate mapping file comes into play. The mapping " +"file tells Hibernate what table in the database it has to access, and what " +"columns in that table it should use." +msgstr "" +"Hibernate 需要知道怎样去加载(load)和存储(store)持久化类的对象。这正是 " +"Hibernate 映射文件发挥作用的地方。映射文件告诉 Hibernate 它应该访问数据库" +"(database)里面的哪个表(table)及应该使用表里面的哪些字段(column)。" #. Tag: para +#: tutorial.xml:181 #, no-c-format msgid "The basic structure of a mapping file looks like this:" msgstr "一个映射文件的基本结构看起来像这样:" -#. Tag: para +#. Tag: programlisting +#: tutorial.xml:185 #, no-c-format -msgid "Hibernate DTD is sophisticated. You can use it for auto-completion of XML mapping elements and attributes in your editor or IDE. Opening up the DTD file in your text editor is the easiest way to get an overview of all elements and attributes, and to view the defaults, as well as some comments. Hibernate will not load the DTD file from the web, but first look it up from the classpath of the application. The DTD file is included in hibernate-core.jar (it is also included in the hibernate3.jar, if using the distribution bundle)." -msgstr "注意 Hibernate 的 DTD 是非常复杂的。你的编辑器或者 IDE 里使用它来自动完成那些用来映射的 XML 元素(element)和属性(attribute)。你也可以在文本编辑器里打开 DTD — 这是最简单的方式来概览所有的元素和 attribute,并查看它们的缺省值以及注释。注意 Hibernate 不会从 web 加载 DTD 文件,但它会首先在应用程序的 classpath 中查找。DTD 文件已包括在 hibernate3.jar 里,同时也在 Hibernate 发布包的 src/ 目录下。 " +msgid "" +"\n" +"\n" +"\n" +"\n" +"[...]\n" +"]]>" +msgstr "" +"\n" +"\n" +"\n" +"\n" +"[...]\n" +"]]>" #. Tag: para +#: tutorial.xml:187 #, no-c-format -msgid "We will omit the DTD declaration in future examples to shorten the code. It is, of course, not optional." -msgstr "为缩短代码长度,在以后的例子里我们会省略 DTD 的声明。当然,在实际的应用程序中,DTD 声明是必需的。 " +msgid "" +"Hibernate DTD is sophisticated. You can use it for auto-completion of XML " +"mapping elements and attributes in your editor or IDE. Opening up the DTD " +"file in your text editor is the easiest way to get an overview of all " +"elements and attributes, and to view the defaults, as well as some comments. " +"Hibernate will not load the DTD file from the web, but first look it up from " +"the classpath of the application. The DTD file is included in " +"hibernate-core.jar (it is also included in the " +"hibernate3.jar, if using the distribution bundle)." +msgstr "" +"注意 Hibernate 的 DTD 是非常复杂的。你的编辑器或者 IDE 里使用它来自动完成那些" +"用来映射的 XML 元素(element)和属性(attribute)。你也可以在文本编辑器里打" +"开 DTD — 这是最简单的方式来概览所有的元素和 attribute,并查看它们的缺省值以及" +"注释。注意 Hibernate 不会从 web 加载 DTD 文件,但它会首先在应用程序的 " +"classpath 中查找。DTD 文件已包括在 hibernate3.jar 里,同时" +"也在 Hibernate 发布包的 src/ 目录下。 " #. Tag: para +#: tutorial.xml:200 #, no-c-format -msgid "Between the two hibernate-mapping tags, include a class element. All persistent entity classes (again, there might be dependent classes later on, which are not first-class entities) need a mapping to a table in the SQL database:" -msgstr "在 hibernate-mapping 标签(tag)之间, 含有一个 class 元素。所有的持久化实体类(再次声明,或许接下来会有依赖类,就是那些次要的实体)都需要一个这样的映射,来把类对象映射到 SQL 数据库里的表:" +msgid "" +"We will omit the DTD declaration in future examples to shorten the code. It " +"is, of course, not optional." +msgstr "" +"为缩短代码长度,在以后的例子里我们会省略 DTD 的声明。当然,在实际的应用程序" +"中,DTD 声明是必需的。 " #. Tag: para +#: tutorial.xml:206 #, no-c-format -msgid "So far we have told Hibernate how to persist and load object of class Event to the table EVENTS. Each instance is now represented by a row in that table. Now we can continue by mapping the unique identifier property to the tables primary key. As we do not want to care about handling this identifier, we configure Hibernate's identifier generation strategy for a surrogate primary key column:" -msgstr "到目前为止,我们告诉了 Hibernate 怎样把 Events 类的对象持久化到数据库的 EVENTS 表里,以及怎样从 EVENTS 表加载到 Events 类的对象。每个实例对应着数据库表中的一行。现在我们将继续讨论有关唯一标识符属性到数据库表的映射。另外,由于我们不关心怎样处理这个标识符,我们就配置由 Hibernate 的标识符生成策略来产生代理主键字段:" +msgid "" +"Between the two hibernate-mapping tags, include a " +"class element. All persistent entity classes (again, " +"there might be dependent classes later on, which are not first-class " +"entities) need a mapping to a table in the SQL database:" +msgstr "" +"在 hibernate-mapping 标签(tag)之间, 含有一个 " +"class 元素。所有的持久化实体类(再次声明,或许接下来会有依" +"赖类,就是那些次要的实体)都需要一个这样的映射,来把类对象映射到 SQL 数据库里" +"的表:" + +#. Tag: programlisting +#: tutorial.xml:213 +#, no-c-format +msgid "" +"\n" +"\n" +" \n" +"\n" +" \n" +"\n" +"]]>" +msgstr "" +"\n" +"\n" +" \n" +"\n" +" \n" +"\n" +"]]>" #. Tag: para +#: tutorial.xml:215 #, no-c-format -msgid "The id element is the declaration of the identifier property. The name=\"id\" mapping attribute declares the name of the JavaBean property and tells Hibernate to use the getId() and setId() methods to access the property. The column attribute tells Hibernate which column of the EVENTS table holds the primary key value." -msgstr "id 元素是对 identifier 属性的声明。name=\"id\" 映射属性声明了 JavaBean 属性的名称并告诉 Hibernate 使用 getId()setId() 方法来访问这个属性。column 属性告诉 Hibernate EVENTS 表的哪个字段持有主键值。" +msgid "" +"So far we have told Hibernate how to persist and load object of class " +"Event to the table EVENTS. Each " +"instance is now represented by a row in that table. Now we can continue by " +"mapping the unique identifier property to the tables primary key. As we do " +"not want to care about handling this identifier, we configure Hibernate's " +"identifier generation strategy for a surrogate primary key column:" +msgstr "" +"到目前为止,我们告诉了 Hibernate 怎样把 Events 类的对象持" +"久化到数据库的 EVENTS 表里,以及怎样从 EVENTS 表加载到 Events 类的对象。每个实例对应着数据库表" +"中的一行。现在我们将继续讨论有关唯一标识符属性到数据库表的映射。另外,由于我" +"们不关心怎样处理这个标识符,我们就配置由 Hibernate 的标识符生成策略来产生代理" +"主键字段:" + +#. Tag: programlisting +#: tutorial.xml:225 +#, no-c-format +msgid "" +"\n" +"\n" +" \n" +" \n" +" \n" +" \n" +" \n" +"\n" +"]]>" +msgstr "" +"\n" +"\n" +" \n" +" \n" +" \n" +" \n" +" \n" +"\n" +"]]>" #. Tag: para +#: tutorial.xml:227 #, no-c-format -msgid "The nested generator element specifies the identifier generation strategy (aka how are identifier values generated?). In this case we choose native, which offers a level of portability depending on the configured database dialect. Hibernate supports database generated, globally unique, as well as application assigned, identifiers. Identifier value generation is also one of Hibernate's many extension points and you can plugin in your own strategy." -msgstr "嵌套的 generator 元素指定标识符的生成策略(也就是标识符值是怎么产生的)。在这个例子里,我们选择 native,它提供了取决于数据库方言的可移植性。Hibernate 数据库生成的、全局性唯一的以及应用程序分配的标识符。标识符值的生成也是 Hibernate 的扩展功能之一,你可以插入自己的策略。" +msgid "" +"The id element is the declaration of the identifier " +"property. The name=\"id\" mapping attribute declares the " +"name of the JavaBean property and tells Hibernate to use the getId()" +" and setId() methods to access the property. " +"The column attribute tells Hibernate which column of the EVENTS table holds the primary key value." +msgstr "" +"id 元素是对 identifier 属性的声明。name=\"id\" 映射属性声明了 JavaBean 属性的名称并告诉 Hibernate 使用 " +"getId()setId() 方法来访问这个属性。" +"column 属性告诉 Hibernate EVENTS 表的哪个字段持有主键值。" #. Tag: para +#: tutorial.xml:237 #, no-c-format -msgid "native is no longer consider the best strategy in terms of portability. for further discussion, see " -msgstr "从移植性来说,native 不再被认为是最好的策略。进一步的讨论,请参考 。 " +msgid "" +"The nested generator element specifies the identifier " +"generation strategy (aka how are identifier values generated?). In this case " +"we choose native, which offers a level of portability " +"depending on the configured database dialect. Hibernate supports database " +"generated, globally unique, as well as application assigned, identifiers. " +"Identifier value generation is also one of Hibernate's many extension points " +"and you can plugin in your own strategy." +msgstr "" +"嵌套的 generator 元素指定标识符的生成策略(也就是标识符值" +"是怎么产生的)。在这个例子里,我们选择 native,它提供了取" +"决于数据库方言的可移植性。Hibernate 数据库生成的、全局性唯一的以及应用程序分" +"配的标识符。标识符值的生成也是 Hibernate 的扩展功能之一,你可以插入自己的策" +"略。" #. Tag: para -#, no-c-format -msgid "Lastly, we need to tell Hibernate about the remaining entity class properties. By default, no properties of the class are considered persistent:" -msgstr "最后我们在映射文件里面包含需要持久化属性的声明。默认情况下,类里面的属性都被视为非持久化的: " +#: tutorial.xml:249 +#, fuzzy, no-c-format +msgid "" +"native is no longer consider the best strategy in terms " +"of portability. for further discussion, see" +msgstr "" +"从移植性来说,native 不再被认为是最好的策略。进一步的讨" +"论,请参考 。 " #. Tag: para +#: tutorial.xml:255 #, no-c-format -msgid "Similar to the id element, the name attribute of the property element tells Hibernate which getter and setter methods to use. In this case, Hibernate will search for getDate(), setDate(), getTitle() and setTitle() methods." -msgstr "和 id 元素一样,property 元素的 name 属性告诉 Hibernate 使用哪个 getter 和 setter 方法。在此例中,Hibernate 会寻找 getDate()setDate()getTitle()setTitle() 方法。 " +msgid "" +"Lastly, we need to tell Hibernate about the remaining entity class " +"properties. By default, no properties of the class are considered persistent:" +msgstr "" +"最后我们在映射文件里面包含需要持久化属性的声明。默认情况下,类里面的属性都被" +"视为非持久化的: " + +#. Tag: programlisting +#: tutorial.xml:261 +#, no-c-format +msgid "" +"\n" +"\n" +" \n" +" \n" +" \n" +" \n" +" \n" +" \n" +" \n" +"\n" +"]]>" +msgstr "" +"\n" +"\n" +" \n" +" \n" +" \n" +" \n" +" \n" +" \n" +" \n" +"\n" +"]]>" #. Tag: para +#: tutorial.xml:263 #, no-c-format -msgid "Why does the date property mapping include the column attribute, but the title does not? Without the column attribute, Hibernate by default uses the property name as the column name. This works for title, however, date is a reserved keyword in most databases so you will need to map it to a different name." -msgstr "为什么 date 属性的映射含有 column attribute,而 title 却没有?当没有设定 column attribute 的时候,Hibernate 缺省地使用 JavaBean 的属性名作为字段名。对于 title,这样工作得很好。然而,date 在多数的数据库里,是一个保留关键字,所以我们最好把它映射成一个不同的名字。 " +msgid "" +"Similar to the id element, the name " +"attribute of the property element tells Hibernate which " +"getter and setter methods to use. In this case, Hibernate will search for " +"getDate(), setDate(), getTitle" +"() and setTitle() methods." +msgstr "" +"和 id 元素一样,property 元素的 " +"name 属性告诉 Hibernate 使用哪个 getter 和 setter 方法。在" +"此例中,Hibernate 会寻找 getDate()setDate()getTitle()setTitle() 方" +"法。 " #. Tag: para +#: tutorial.xml:274 #, no-c-format -msgid "The title mapping also lacks a type attribute. The types declared and used in the mapping files are not Java data types; they are not SQL database types either. These types are called Hibernate mapping types, converters which can translate from Java to SQL data types and vice versa. Again, Hibernate will try to determine the correct conversion and mapping type itself if the type attribute is not present in the mapping. In some cases this automatic detection using Reflection on the Java class might not have the default you expect or need. This is the case with the date property. Hibernate cannot know if the property, which is of java.util.Date, should map to a SQL date, timestamp, or time column. Full date and time information is preserved by mapping the property with a timestamp converter." -msgstr "另一有趣的事情是 title 属性缺少一个 type attribute。我们在映射文件里声明并使用的类型,却不是我们期望的那样,是 Java 数据类型,同时也不是 SQL 数据库的数据类型。这些类型就是所谓的 Hibernate 映射类型(mapping types),它们能把 Java 数据类型转换到 SQL 数据类型,反之亦然。再次重申,如果在映射文件中没有设置 type 属性的话,Hibernate 会自己试着去确定正确的转换类型和它的映射类型。在某些情况下这个自动检测机制(在 Java 类上使用反射机制)不会产生你所期待或需要的缺省值。date 属性就是个很好的例子,Hibernate 无法知道这个属性(java.util.Date 类型的)应该被映射成:SQL date,或 timestamp,还是 time 字段。在此例中,把这个属性映射成 timestamp 转换器,这样我们预留了日期和时间的全部信息。 " +msgid "" +"Why does the date property mapping include the " +"column attribute, but the title does " +"not? Without the column attribute, Hibernate by default " +"uses the property name as the column name. This works for title, however, date is a reserved keyword in most " +"databases so you will need to map it to a different name." +msgstr "" +"为什么 date 属性的映射含有 column " +"attribute,而 title 却没有?当没有设定 column attribute 的时候,Hibernate 缺省地使用 JavaBean 的属性名作为字段名。" +"对于 title,这样工作得很好。然而,date " +"在多数的数据库里,是一个保留关键字,所以我们最好把它映射成一个不同的名字。 " #. Tag: para +#: tutorial.xml:284 #, no-c-format -msgid "Hibernate makes this mapping type determination using reflection when the mapping files are processed. This can take time and resources, so if startup performance is important you should consider explicitly defining the type to use." -msgstr "当处理映射文件时,Hibernate 用反射(reflection)来决定这个映射类型。这需要时间和资源,所以如果你注重启动性能,你应该考虑显性地定义所用的类型。" +msgid "" +"The title mapping also lacks a type " +"attribute. The types declared and used in the mapping files are not Java " +"data types; they are not SQL database types either. These types are called " +"Hibernate mapping types, converters which can translate " +"from Java to SQL data types and vice versa. Again, Hibernate will try to " +"determine the correct conversion and mapping type itself if the " +"type attribute is not present in the mapping. In some " +"cases this automatic detection using Reflection on the Java class might not " +"have the default you expect or need. This is the case with the " +"date property. Hibernate cannot know if the property, " +"which is of java.util.Date, should map to a SQL " +"date, timestamp, or time column. Full date and time information is preserved by mapping the " +"property with a timestamp converter." +msgstr "" +"另一有趣的事情是 title 属性缺少一个 type attribute。我们在映射文件里声明并使用的类型,却不是我们期望的那样," +"是 Java 数据类型,同时也不是 SQL 数据库的数据类型。这些类型就是所谓的 " +"Hibernate 映射类型(mapping types),它们能把 Java 数据" +"类型转换到 SQL 数据类型,反之亦然。再次重申,如果在映射文件中没有设置 " +"type 属性的话,Hibernate 会自己试着去确定正确的转换类型和" +"它的映射类型。在某些情况下这个自动检测机制(在 Java 类上使用反射机制)不会产" +"生你所期待或需要的缺省值。date 属性就是个很好的例子," +"Hibernate 无法知道这个属性(java.util.Date 类型的)应该被" +"映射成:SQL date,或 timestamp,还是 " +"time 字段。在此例中,把这个属性映射成 timestamp 转换器,这样我们预留了日期和时间的全部信息。 " #. Tag: para +#: tutorial.xml:300 #, no-c-format -msgid "Save this mapping file as src/main/resources/org/hibernate/tutorial/domain/Event.hbm.xml." -msgstr "把这个映射文件保存为 src/main/resources/org/hibernate/tutorial/domain/Event.hbm.xml。" +msgid "" +"Hibernate makes this mapping type determination using reflection when the " +"mapping files are processed. This can take time and resources, so if startup " +"performance is important you should consider explicitly defining the type to " +"use." +msgstr "" +"当处理映射文件时,Hibernate 用反射(reflection)来决定这个映射类型。这需要时" +"间和资源,所以如果你注重启动性能,你应该考虑显性地定义所用的类型。" + +#. Tag: para +#: tutorial.xml:307 +#, no-c-format +msgid "" +"Save this mapping file as src/main/resources/org/hibernate/" +"tutorial/domain/Event.hbm.xml." +msgstr "" +"把这个映射文件保存为 src/main/resources/org/hibernate/tutorial/" +"domain/Event.hbm.xml。" #. Tag: title +#: tutorial.xml:315 #, no-c-format msgid "Hibernate configuration" msgstr "Hibernate 配置" #. Tag: para +#: tutorial.xml:317 #, no-c-format -msgid "At this point, you should have the persistent class and its mapping file in place. It is now time to configure Hibernate. First let's set up HSQLDB to run in \"server mode\"" -msgstr "此时,你应该有了持久化类和它的映射文件。现在是配置 Hibernate 的时候了。首先让我们设立 HSQLDB 使其运行在“服务器模式”。" +msgid "" +"At this point, you should have the persistent class and its mapping file in " +"place. It is now time to configure Hibernate. First let's set up HSQLDB to " +"run in \"server mode\"" +msgstr "" +"此时,你应该有了持久化类和它的映射文件。现在是配置 Hibernate 的时候了。首先让" +"我们设立 HSQLDB 使其运行在“服务器模式”。" #. Tag: para +#: tutorial.xml:324 #, no-c-format msgid "We do this do that the data remains between runs." msgstr "数据在程序运行期间需要保持有效。 " #. Tag: para +#: tutorial.xml:329 #, no-c-format -msgid "We will utilize the Maven exec plugin to launch the HSQLDB server by running: mvn exec:java -Dexec.mainClass=\"org.hsqldb.Server\" -Dexec.args=\"-database.0 file:target/data/tutorial\" You will see it start up and bind to a TCP/IP socket; this is where our application will connect later. If you want to start with a fresh database during this tutorial, shutdown HSQLDB, delete all files in the target/data directory, and start HSQLDB again." -msgstr "在开发的根目录下创建一个 data 目录 - 这是 HSQL DB 存储数据文件的地方。此时在 data 目录中运行 java -classpath ../lib/hsqldb.jar org.hsqldb.Server 就可启动数据库。你可以在 log 中看到它的启动,及绑定到 TCP/IP 套接字,这正是我们的应用程序稍后会连接的地方。如果你希望在本例中运行一个全新的数据库,就在窗口中按下 CTRL + C 来关闭 HSQL 数据库,并删除 data/ 目录下的所有文件,再重新启动 HSQL 数据库。 " +msgid "" +"We will utilize the Maven exec plugin to launch the HSQLDB server by " +"running: mvn exec:java -Dexec.mainClass=\"org.hsqldb.Server\" -" +"Dexec.args=\"-database.0 file:target/data/tutorial\" You will see " +"it start up and bind to a TCP/IP socket; this is where our application will " +"connect later. If you want to start with a fresh database during this " +"tutorial, shutdown HSQLDB, delete all files in the target/data directory, and start HSQLDB again." +msgstr "" +"在开发的根目录下创建一个 data 目录 - 这是 HSQL DB 存储数" +"据文件的地方。此时在 data 目录中运行 java -classpath ../lib/hsqldb." +"jar org.hsqldb.Server 就可启动数据库。你可以在 log 中看到它的启动," +"及绑定到 TCP/IP 套接字,这正是我们的应用程序稍后会连接的地方。如果你希望在本" +"例中运行一个全新的数据库,就在窗口中按下 CTRL + C 来关闭 " +"HSQL 数据库,并删除 data/ 目录下的所有文件,再重新启动 " +"HSQL 数据库。 " #. Tag: para +#: tutorial.xml:340 #, no-c-format -msgid "Hibernate will be connecting to the database on behalf of your application, so it needs to know how to obtain connections. For this tutorial we will be using a standalone connection pool (as opposed to a javax.sql.DataSource). Hibernate comes with support for two third-party open source JDBC connection pools: c3p0 and proxool. However, we will be using the Hibernate built-in connection pool for this tutorial." -msgstr "Hibernate 将为你的应用程序连接到数据库,所以它需要知道如何获取连接。在这个教程里,我们使用一个独立连接池(和 javax.sql.DataSource 相反)。Hibernate 支持两个第三方的开源 JDBC 连接池:c3p0proxool。然而,在本教程里我们将使用 Hibernate 内置的连接池。" +msgid "" +"Hibernate will be connecting to the database on behalf of your application, " +"so it needs to know how to obtain connections. For this tutorial we will be " +"using a standalone connection pool (as opposed to a javax.sql." +"DataSource). Hibernate comes with support for two third-" +"party open source JDBC connection pools: c3p0 and proxool. However, we will be using the Hibernate built-in " +"connection pool for this tutorial." +msgstr "" +"Hibernate 将为你的应用程序连接到数据库,所以它需要知道如何获取连接。在这个教" +"程里,我们使用一个独立连接池(和 javax.sql.DataSource 相反)。Hibernate 支持两个第三方的开源 JDBC 连接池:c3p0proxool。然而,在本教程里我们将使" +"用 Hibernate 内置的连接池。" #. Tag: para +#: tutorial.xml:351 #, no-c-format -msgid "The built-in Hibernate connection pool is in no way intended for production use. It lacks several features found on any decent connection pool." +msgid "" +"The built-in Hibernate connection pool is in no way intended for production " +"use. It lacks several features found on any decent connection pool." msgstr "嵌入的 Hibernate 连接池不用于产品环境。它缺乏连接池里的几个功能。" #. Tag: para +#: tutorial.xml:357 #, no-c-format -msgid "For Hibernate's configuration, we can use a simple hibernate.properties file, a more sophisticated hibernate.cfg.xml file, or even complete programmatic setup. Most users prefer the XML configuration file:" -msgstr "为了保存 Hibernate 的配置,我们可以使用一个简单的 hibernate.properties 文件,或者一个稍微复杂的 hibernate.cfg.xml,甚至可以完全使用程序来配置 Hibernate。多数用户更喜欢使用 XML 配置文件: " +msgid "" +"For Hibernate's configuration, we can use a simple hibernate." +"properties file, a more sophisticated hibernate.cfg.xml file, or even complete programmatic setup. Most users prefer the " +"XML configuration file:" +msgstr "" +"为了保存 Hibernate 的配置,我们可以使用一个简单的 hibernate." +"properties 文件,或者一个稍微复杂的 hibernate.cfg.xml,甚至可以完全使用程序来配置 Hibernate。多数用户更喜欢使用 XML 配置文" +"件: " + +#. Tag: programlisting +#: tutorial.xml:363 +#, no-c-format +msgid "" +"\n" +"\n" +"\n" +"\n" +"\n" +" \n" +"\n" +" \n" +" org.hsqldb.jdbcDriver\n" +" jdbc:hsqldb:hsql://localhost\n" +" sa\n" +" \n" +"\n" +" \n" +" 1\n" +"\n" +" \n" +" org.hibernate.dialect.HSQLDialect\n" +"\n" +" \n" +" thread\n" +"\n" +" \n" +" org.hibernate.cache." +"NoCacheProvider\n" +"\n" +" \n" +" true\n" +"\n" +" \n" +" update\n" +"\n" +" \n" +"\n" +" \n" +"\n" +"]]>" +msgstr "" +"\n" +"\n" +"\n" +"\n" +"\n" +" \n" +"\n" +" \n" +" org.hsqldb.jdbcDriver\n" +" jdbc:hsqldb:hsql://localhost\n" +" sa\n" +" \n" +"\n" +" \n" +" 1\n" +"\n" +" \n" +" org.hibernate.dialect.HSQLDialect\n" +"\n" +" \n" +" thread\n" +"\n" +" \n" +" org.hibernate.cache." +"NoCacheProvider\n" +"\n" +" \n" +" true\n" +"\n" +" \n" +" update\n" +"\n" +" \n" +"\n" +" \n" +"\n" +"]]>" #. Tag: para +#: tutorial.xml:366 #, no-c-format msgid "Notice that this configuration file specifies a different DTD" msgstr "请注意,这个配置文件指定了一个不同的 DTD。" #. Tag: para +#: tutorial.xml:369 #, no-c-format -msgid "You configure Hibernate's SessionFactory. SessionFactory is a global factory responsible for a particular database. If you have several databases, for easier startup you should use several <session-factory> configurations in several configuration files." -msgstr "注意这个 XML 配置使用了一个不同的 DTD。在这里,我们配置了 Hibernate 的SessionFactory — 一个关联于特定数据库全局的工厂(factory)。如果你要使用多个数据库,就要用多个的 <session-factory>,通常把它们放在多个配置文件中(为了更容易启动)。 " +msgid "" +"You configure Hibernate's SessionFactory. SessionFactory " +"is a global factory responsible for a particular database. If you have " +"several databases, for easier startup you should use several <" +"session-factory> configurations in several configuration files." +msgstr "" +"注意这个 XML 配置使用了一个不同的 DTD。在这里,我们配置了 Hibernate 的" +"SessionFactory — 一个关联于特定数据库全局的工厂" +"(factory)。如果你要使用多个数据库,就要用多个的 <session-" +"factory>,通常把它们放在多个配置文件中(为了更容易启动)。 " #. Tag: para +#: tutorial.xml:376 #, no-c-format -msgid "The first four property elements contain the necessary configuration for the JDBC connection. The dialect property element specifies the particular SQL variant Hibernate generates." -msgstr "签名 4 个 property 元素包含了 JDBC 连接所必需的配置。方言 property 元素指定了 Hibernate 生成的特定 SQL 语句。" +msgid "" +"The first four property elements contain the necessary " +"configuration for the JDBC connection. The dialect property element specifies the particular SQL variant Hibernate generates." +msgstr "" +"签名 4 个 property 元素包含了 JDBC 连接所必需的配置。方言 " +"property 元素指定了 Hibernate 生成的特定 SQL 语句。" #. Tag: para -#, no-c-format -msgid "In most cases, Hibernate is able to properly determine which dialect to use. See for more information." -msgstr "在大多数情况下,Hibernate 都能够正确地决定所使用的方言。更多信息请参考 。 " +#: tutorial.xml:383 +#, fuzzy, no-c-format +msgid "" +"In most cases, Hibernate is able to properly determine which dialect to use. " +"See for more information." +msgstr "" +"在大多数情况下,Hibernate 都能够正确地决定所使用的方言。更多信息请参考 。 " #. Tag: para +#: tutorial.xml:389 #, no-c-format -msgid "Hibernate's automatic session management for persistence contexts is particularly useful in this context. The hbm2ddl.auto option turns on automatic generation of database schemas directly into the database. This can also be turned off by removing the configuration option, or redirected to a file with the help of the SchemaExport Ant task. Finally, add the mapping file(s) for persistent classes to the configuration." -msgstr "最开始的 4 个 property 元素包含必要的 JDBC 连接信息。方言(dialect)的 property 元素指明 Hibernate 生成的特定 SQL 变量。你很快会看到,Hibernate 对持久化上下文的自动 session 管理就会派上用场。 打开 hbm2ddl.auto 选项将自动生成数据库模式(schema)- 直接加入数据库中。当然这个选项也可以被关闭(通过去除这个配置选项)或者通过 Ant 任务 SchemaExport 的帮助来把数据库 schema 重定向到文件中。最后,在配置中为持久化类加入映射文件。 " +msgid "" +"Hibernate's automatic session management for persistence contexts is " +"particularly useful in this context. The hbm2ddl.auto " +"option turns on automatic generation of database schemas directly into the " +"database. This can also be turned off by removing the configuration option, " +"or redirected to a file with the help of the SchemaExport " +"Ant task. Finally, add the mapping file(s) for persistent classes to the " +"configuration." +msgstr "" +"最开始的 4 个 property 元素包含必要的 JDBC 连接信息。方言" +"(dialect)的 property 元素指明 Hibernate 生成的特定 SQL " +"变量。你很快会看到,Hibernate 对持久化上下文的自动 session 管理就会派上用" +"场。 打开 hbm2ddl.auto 选项将自动生成数据库模式(schema)" +"- 直接加入数据库中。当然这个选项也可以被关闭(通过去除这个配置选项)或者通" +"过 Ant 任务 SchemaExport 的帮助来把数据库 schema 重定向到" +"文件中。最后,在配置中为持久化类加入映射文件。 " #. Tag: para +#: tutorial.xml:398 #, no-c-format -msgid "Save this file as hibernate.cfg.xml into the src/main/resources directory." -msgstr "把这个文件保存为 src/main/resources 目录下的 hibernate.cfg.xml。" +msgid "" +"Save this file as hibernate.cfg.xml into the " +"src/main/resources directory." +msgstr "" +"把这个文件保存为 src/main/resources 目录下的 " +"hibernate.cfg.xml。" #. Tag: title +#: tutorial.xml:406 #, no-c-format msgid "Building with Maven" msgstr "用 Maven 构建 " #. Tag: para +#: tutorial.xml:408 #, no-c-format -msgid "We will now build the tutorial with Maven. You will need to have Maven installed; it is available from the Maven download page. Maven will read the /pom.xml file we created earlier and know how to perform some basic project tasks. First, lets run the compile goal to make sure we can compile everything so far:" -msgstr "我们将用 Maven 构建这个教程。你将需要安装 Maven;你可以从 Maven 下载页面获得 Maven。Maen 将读取我们先前创建的 /pom.xml 并知道执行基本的项目任务。首先,让我们运行 compile 目标来确保我们可以编译到目前为止的所有程序:" +msgid "" +"We will now build the tutorial with Maven. You will need to have Maven " +"installed; it is available from the Maven download page. Maven will read the /" +"pom.xml file we created earlier and know how to perform some " +"basic project tasks. First, lets run the compile goal to " +"make sure we can compile everything so far:" +msgstr "" +"我们将用 Maven 构建这个教程。你将需要安装 Maven;你可以从 Maven 下载页面获得 Maven。" +"Maen 将读取我们先前创建的 /pom.xml 并知道执行基本的项目" +"任务。首先,让我们运行 compile 目标来确保我们可以编译到目" +"前为止的所有程序:" + +#. Tag: programlisting +#: tutorial.xml:418 +#, no-c-format +msgid "" +"" +msgstr "" #. Tag: title +#: tutorial.xml:423 #, no-c-format msgid "Startup and helpers" msgstr "启动和辅助类" #. Tag: para +#: tutorial.xml:425 #, no-c-format -msgid "It is time to load and store some Event objects, but first you have to complete the setup with some infrastructure code. You have to startup Hibernate by building a global org.hibernate.SessionFactory object and storing it somewhere for easy access in application code. A org.hibernate.SessionFactory is used to obtain org.hibernate.Session instances. A org.hibernate.Session represents a single-threaded unit of work. The org.hibernate.SessionFactory is a thread-safe global object that is instantiated once." -msgstr "是时候来加载和储存一些 Event 对象了,但首先我们得编写一些基础的代码以完成设置。我们必须启动 Hibernate,此过程包括创建一个全局的 SessoinFactory,并把它储存在应用程序代码容易访问的地方。SessionFactory 可以创建并打开新的 Session。一个 Session 代表一个单线程的单元操作,org.hibernate.SessionFactory 则是个线程安全的全局对象,只需要被实例化一次。 " +msgid "" +"It is time to load and store some Event objects, but " +"first you have to complete the setup with some infrastructure code. You have " +"to startup Hibernate by building a global org.hibernate." +"SessionFactory object and storing it somewhere for easy " +"access in application code. A org.hibernate.SessionFactory is used to obtain org.hibernate.Session instances. A org.hibernate.Session represents a single-threaded unit of work. The " +"org.hibernate.SessionFactory is a thread-safe " +"global object that is instantiated once." +msgstr "" +"是时候来加载和储存一些 Event 对象了,但首先我们得编写一些" +"基础的代码以完成设置。我们必须启动 Hibernate,此过程包括创建一个全局的 " +"SessoinFactory,并把它储存在应用程序代码容易访问的地方。" +"SessionFactory 可以创建并打开新的 Session。一个 Session 代表一个单线程的单元操作," +"org.hibernate.SessionFactory 则是个线程安全的" +"全局对象,只需要被实例化一次。 " #. Tag: para +#: tutorial.xml:439 #, no-c-format -msgid "We will create a HibernateUtil helper class that takes care of startup and makes accessing the org.hibernate.SessionFactory more convenient." -msgstr "我们将创建一个 HibernateUtil 辅助类(helper class)来负责启动 Hibernate 和更方便地操作 org.hibernate.SessionFactory。让我们来看一下它的实现:" +msgid "" +"We will create a HibernateUtil helper class that takes " +"care of startup and makes accessing the org.hibernate." +"SessionFactory more convenient." +msgstr "" +"我们将创建一个 HibernateUtil 辅助类(helper class)来负责" +"启动 Hibernate 和更方便地操作 org.hibernate.SessionFactory。让我们来看一下它的实现:" + +#. Tag: programlisting +#: tutorial.xml:445 +#, fuzzy, no-c-format +msgid "" +"" +msgstr "" +"package util;\n" +"\n" +"import org.hibernate.*;\n" +"import org.hibernate.cfg.*;\n" +"\n" +"public class HibernateUtil {\n" +"\n" +" private static final SessionFactory sessionFactory;\n" +"\n" +" static {\n" +" try {\n" +" // Create the SessionFactory from hibernate.cfg.xml\n" +" sessionFactory = new Configuration().configure()." +"buildSessionFactory();\n" +" } catch (Throwable ex) {\n" +" // Make sure you log the exception, as it might be swallowed\n" +" System.err.println(\"Initial SessionFactory creation failed.\" + " +"ex);\n" +" throw new ExceptionInInitializerError(ex);\n" +" }\n" +" }\n" +"\n" +" public static SessionFactory getSessionFactory() {\n" +" return sessionFactory;\n" +" }\n" +"\n" +"}" #. Tag: para +#: tutorial.xml:447 #, no-c-format -msgid "Save this code as src/main/java/org/hibernate/tutorial/util/HibernateUtil.java" -msgstr "把这段代码保存为 src/main/java/org/hibernate/tutorial/util/HibernateUtil.java。" +msgid "" +"Save this code as src/main/java/org/hibernate/tutorial/util/" +"HibernateUtil.java" +msgstr "" +"把这段代码保存为 src/main/java/org/hibernate/tutorial/util/" +"HibernateUtil.java。" #. Tag: para +#: tutorial.xml:452 #, no-c-format -msgid "This class not only produces the global org.hibernate.SessionFactory reference in its static initializer; it also hides the fact that it uses a static singleton. We might just as well have looked up the org.hibernate.SessionFactory reference from JNDI in an application server or any other location for that matter." -msgstr "这个类不但在它的静态初始化过程(仅当加载这个类的时候被 JVM 执行一次)中产生全局的 org.hibernate.SessionFactory,而且隐藏了它使用了静态 singleton 的事实。它也可能在应用程序服务器中的 JNDI 查找 org.hibernate.SessionFactory。" +msgid "" +"This class not only produces the global org.hibernate." +"SessionFactory reference in its static initializer; it also " +"hides the fact that it uses a static singleton. We might just as well have " +"looked up the org.hibernate.SessionFactory " +"reference from JNDI in an application server or any other location for that " +"matter." +msgstr "" +"这个类不但在它的静态初始化过程(仅当加载这个类的时候被 JVM 执行一次)中产生全" +"局的 org.hibernate.SessionFactory,而且隐藏了" +"它使用了静态 singleton 的事实。它也可能在应用程序服务器中的 JNDI 查找 " +"org.hibernate.SessionFactory。" #. Tag: para +#: tutorial.xml:461 #, no-c-format -msgid "If you give the org.hibernate.SessionFactory a name in your configuration, Hibernate will try to bind it to JNDI under that name after it has been built. Another, better option is to use a JMX deployment and let the JMX-capable container instantiate and bind a HibernateService to JNDI. Such advanced options are discussed later." -msgstr "如果你在配置文件中给 org.hibernate.SessionFactory 一个名字,在 它创建后,Hibernate 会试着把它绑定到 JNDI。要完全避免这样的代码,你也可以使用 JMX 部署,让具有 JMX 能力的容器来实例化 HibernateService 并把它绑定到 JNDI。这些高级可选项在后面的章节中会讨论到。" +msgid "" +"If you give the org.hibernate.SessionFactory " +"a name in your configuration, Hibernate will try to bind it to JNDI under " +"that name after it has been built. Another, better option is to use a JMX " +"deployment and let the JMX-capable container instantiate and bind a " +"HibernateService to JNDI. Such advanced options are " +"discussed later." +msgstr "" +"如果你在配置文件中给 org.hibernate.SessionFactory 一个名字,在 它创建后,Hibernate 会试着把它绑定到 JNDI。要完全" +"避免这样的代码,你也可以使用 JMX 部署,让具有 JMX 能力的容器来实例化 " +"HibernateService 并把它绑定到 JNDI。这些高级可选项在后面的" +"章节中会讨论到。" #. Tag: para +#: tutorial.xml:470 #, no-c-format -msgid "You now need to configure a logging system. Hibernate uses commons logging and provides two choices: Log4j and JDK 1.4 logging. Most developers prefer Log4j: copy log4j.properties from the Hibernate distribution in the etc/ directory to your src directory, next to hibernate.cfg.xml. If you prefer to have more verbose output than that provided in the example configuration, you can change the settings. By default, only the Hibernate startup message is shown on stdout." -msgstr "再次编译这个应用程序应该不会有问题。最后我们需要配置一个日志(logging)系统 — Hibernate 使用通用日志接口,允许你在 Log4j 和 JDK 1.4 日志之间进行选择。多数开发者更喜欢 Log4j:从 Hibernate 的发布包中(它在 etc/ 目录下)拷贝 log4j.properties 到你的 src 目录,与 hibernate.cfg.xml 放在一起。看一下配置示例,如果你希望看到更加详细的输出信息,你可以修改配置。默认情况下,只有 Hibernate 的启动信息才会显示在标准输出上。 " +msgid "" +"You now need to configure a logging system. Hibernate uses commons logging " +"and provides two choices: Log4j and JDK 1.4 logging. Most developers prefer " +"Log4j: copy log4j.properties from the Hibernate " +"distribution in the etc/ directory to your src directory, next to hibernate.cfg.xml. If you " +"prefer to have more verbose output than that provided in the example " +"configuration, you can change the settings. By default, only the Hibernate " +"startup message is shown on stdout." +msgstr "" +"再次编译这个应用程序应该不会有问题。最后我们需要配置一个日志(logging)系统 — " +"Hibernate 使用通用日志接口,允许你在 Log4j 和 JDK 1.4 日志之间进行选择。多数" +"开发者更喜欢 Log4j:从 Hibernate 的发布包中(它在 etc/ 目" +"录下)拷贝 log4j.properties 到你的 src " +"目录,与 hibernate.cfg.xml 放在一起。看一下配置示例,如果" +"你希望看到更加详细的输出信息,你可以修改配置。默认情况下,只有 Hibernate 的启" +"动信息才会显示在标准输出上。 " #. Tag: para +#: tutorial.xml:480 #, no-c-format -msgid "The tutorial infrastructure is complete and you are now ready to do some real work with Hibernate." +msgid "" +"The tutorial infrastructure is complete and you are now ready to do some " +"real work with Hibernate." msgstr "示例的基本框架完成了 — 现在我们可以用 Hibernate 来做些真正的工作。 " #. Tag: title +#: tutorial.xml:488 #, no-c-format msgid "Loading and storing objects" msgstr "加载并存储对象" #. Tag: para -#, no-c-format -msgid "We are now ready to start doing some real worjk with Hibernate. Let's start by writing an EventManager class with a main() method:" -msgstr "我们终于可以使用 Hibernate 来加载和存储对象了,编写一个带有 main() 方法的 EventManager 类: " +#: tutorial.xml:490 +#, fuzzy, no-c-format +msgid "" +"We are now ready to start doing some real work with Hibernate. Let's start " +"by writing an EventManager class with a main() method:" +msgstr "" +"我们终于可以使用 Hibernate 来加载和存储对象了,编写一个带有 main() 方法的 EventManager 类: " + +#. Tag: programlisting +#: tutorial.xml:496 +#, fuzzy, no-c-format +msgid "" +"" +msgstr "" +"package events;\n" +"import org.hibernate.Session;\n" +"\n" +"import java.util.Date;\n" +"\n" +"import util.HibernateUtil;\n" +"\n" +"public class EventManager {\n" +"\n" +" public static void main(String[] args) {\n" +" EventManager mgr = new EventManager();\n" +"\n" +" if (args[0].equals(\"store\")) {\n" +" mgr.createAndStoreEvent(\"My Event\", new Date());\n" +" }\n" +"\n" +" HibernateUtil.getSessionFactory().close();\n" +" }\n" +"\n" +" private void createAndStoreEvent(String title, Date theDate) {\n" +"\n" +" Session session = HibernateUtil.getSessionFactory().getCurrentSession" +"();\n" +"\n" +" session.beginTransaction();\n" +"\n" +" Event theEvent = new Event();\n" +" theEvent.setTitle(title);\n" +" theEvent.setDate(theDate);\n" +"\n" +" session.save(theEvent);\n" +"\n" +" session.getTransaction().commit();\n" +" }\n" +"\n" +"}" #. Tag: para +#: tutorial.xml:498 #, no-c-format -msgid "In createAndStoreEvent() we created a new Event object and handed it over to Hibernate. At that point, Hibernate takes care of the SQL and executes an INSERT on the database." -msgstr "在 createAndStoreEvent() 来里我们创建了一个新的 Event 对象并把它传递给 Hibernate。现在 Hibernate 负责与 SQL 打交道,并把 INSERT 命令传给数据库。" +msgid "" +"In createAndStoreEvent() we created a new Event object and handed it over to Hibernate. At that point, Hibernate " +"takes care of the SQL and executes an INSERT on the " +"database." +msgstr "" +"在 createAndStoreEvent() 来里我们创建了一个新的 " +"Event 对象并把它传递给 Hibernate。现在 Hibernate 负责与 " +"SQL 打交道,并把 INSERT 命令传给数据库。" #. Tag: para -#, no-c-format -msgid "A org.hibernate.Session is designed to represent a single unit of work (a single atmoic piece of work to be performed). For now we will keep things simple and assume a one-to-one granularity between a Hibernate org.hibernate.Session and a database transaction. To shield our code from the actual underlying transaction system we use the Hibernate org.hibernate.Transaction API. In this particular case we are using JDBC-based transactional semantics, but it could also run with JTA." -msgstr "一个 org.hibernate.Session 就是个单一的工作单元。我们暂时让事情简单一些,并假设 Hibernate org.hibernate.Session 和数据库事务是一一对应的。为了让我们的代码从底层的事务系统中脱离出来(此例中是 JDBC,但也可能是 JTA),我们使用 org.hibernate.Transaction API。在这个例子里我们使用基于 JDBC 的事务性 semantic,但它也可以和 JTA 一起运行。" +#: tutorial.xml:505 +#, fuzzy, no-c-format +msgid "" +"A org.hibernate.Session is designed to represent a " +"single unit of work (a single atomic piece of work to be performed). For now " +"we will keep things simple and assume a one-to-one granularity between a " +"Hibernate org.hibernate.Session and a database " +"transaction. To shield our code from the actual underlying transaction " +"system we use the Hibernate org.hibernate.Transaction API. In this particular case we are using JDBC-based " +"transactional semantics, but it could also run with JTA." +msgstr "" +"一个 org.hibernate.Session 就是个单一的工作单元。我们" +"暂时让事情简单一些,并假设 Hibernate org.hibernate.Session 和数据库事务是一一对应的。为了让我们的代码从底层的事务系统中脱离出" +"来(此例中是 JDBC,但也可能是 JTA),我们使用 org.hibernate." +"Transaction API。在这个例子里我们使用基于 JDBC 的事务性 " +"semantic,但它也可以和 JTA 一起运行。" #. Tag: para +#: tutorial.xml:518 #, no-c-format -msgid "What does sessionFactory.getCurrentSession() do? First, you can call it as many times and anywhere you like once you get hold of your org.hibernate.SessionFactory. The getCurrentSession() method always returns the \"current\" unit of work. Remember that we switched the configuration option for this mechanism to \"thread\" in our src/main/resources/hibernate.cfg.xml? Due to that setting, the context of a current unit of work is bound to the current Java thread that executes the application." -msgstr "sessionFactory.getCurrentSession() 是干什么的呢?首先,只要你持有 org.hibernate.SessionFactory,大可在任何时候、任何地点调用这个方法。getCurrentSession() 方法总会返回“当前的”工作单元。记得我们在 src/main/resources/hibernate.cfg.xml 中把这一配置选项调整为 \"thread\" 了吗?因此,因此,当前工作单元被绑定到当前执行我们应用程序的 Java 线程。但是,这并非是完全准确的,你还得考虑工作单元的生命周期范围(scope),它何时开始,又何时结束。" +msgid "" +"What does sessionFactory.getCurrentSession() do? First, " +"you can call it as many times and anywhere you like once you get hold of " +"your org.hibernate.SessionFactory. The " +"getCurrentSession() method always returns the \"current\" " +"unit of work. Remember that we switched the configuration option for this " +"mechanism to \"thread\" in our src/main/resources/hibernate.cfg." +"xml? Due to that setting, the context of a current unit of work " +"is bound to the current Java thread that executes the application." +msgstr "" +"sessionFactory.getCurrentSession() 是干什么的呢?首先,只" +"要你持有 org.hibernate.SessionFactory,大可在" +"任何时候、任何地点调用这个方法。getCurrentSession() 方法总" +"会返回“当前的”工作单元。记得我们在 src/main/resources/hibernate." +"cfg.xml 中把这一配置选项调整为 \"thread\" 了吗?因此,因此,当前工" +"作单元被绑定到当前执行我们应用程序的 Java 线程。但是,这并非是完全准确的,你还" +"得考虑工作单元的生命周期范围(scope),它何时开始,又何时结束。" #. Tag: para +#: tutorial.xml:532 #, no-c-format -msgid "Hibernate offers three methods of current session tracking. The \"thread\" based method is not intended for production use; it is merely useful for prototyping and tutorials such as this one. Current session tracking is discussed in more detail later on." -msgstr "Hibernate 提供三种跟踪当前会话的方法。基于“线程”的方法不适合于产品环境,它仅用于 prototyping 和教学用途。后面将更详细地讨论会话跟踪。" +msgid "" +"Hibernate offers three methods of current session tracking. The \"thread\" " +"based method is not intended for production use; it is merely useful for " +"prototyping and tutorials such as this one. Current session tracking is " +"discussed in more detail later on." +msgstr "" +"Hibernate 提供三种跟踪当前会话的方法。基于“线程”的方法不适合于产品环境,它仅" +"用于 prototyping 和教学用途。后面将更详细地讨论会话跟踪。" #. Tag: para +#: tutorial.xml:541 #, no-c-format -msgid "A org.hibernate.Session begins when the first call to getCurrentSession() is made for the current thread. It is then bound by Hibernate to the current thread. When the transaction ends, either through commit or rollback, Hibernate automatically unbinds the org.hibernate.Session from the thread and closes it for you. If you call getCurrentSession() again, you get a new org.hibernate.Session and can start a new unit of work." -msgstr "org.hibernate.Session 在第一次被使用的时候,即第一次调用 getCurrentSession() 的时候,其生命周期就开始。然后它被 Hibernate 绑定到当前线程。当事务结束的时候,不管是提交还是回滚,Hibernate 会自动把 org.hibernate.Session 从当前线程剥离,并且关闭它。假若你再次调用 getCurrentSession(),你会得到一个新的 org.hibernate.Session,并且开始一个新的工作单元。" +msgid "" +"A org.hibernate.Session begins when the first call to " +"getCurrentSession() is made for the current thread. It is " +"then bound by Hibernate to the current thread. When the transaction ends, " +"either through commit or rollback, Hibernate automatically unbinds the " +"org.hibernate.Session from the thread and closes it " +"for you. If you call getCurrentSession() again, you get a " +"new org.hibernate.Session and can start a new unit of " +"work." +msgstr "" +"org.hibernate.Session 在第一次被使用的时候,即第一次调" +"用 getCurrentSession() 的时候,其生命周期就开始。然后它被 " +"Hibernate 绑定到当前线程。当事务结束的时候,不管是提交还是回滚,Hibernate 会" +"自动把 org.hibernate.Session 从当前线程剥离,并且关闭" +"它。假若你再次调用 getCurrentSession(),你会得到一个新的 " +"org.hibernate.Session,并且开始一个新的工作单元。" #. Tag: para +#: tutorial.xml:554 #, no-c-format -msgid "Related to the unit of work scope, should the Hibernate org.hibernate.Session be used to execute one or several database operations? The above example uses one org.hibernate.Session for one operation. However this is pure coincidence; the example is just not complex enough to show any other approach. The scope of a Hibernate org.hibernate.Session is flexible but you should never design your application to use a new Hibernate org.hibernate.Session for every database operation. Even though it is used in the following examples, consider session-per-operation an anti-pattern. A real web application is shown later in the tutorial which will help illustrate this." -msgstr "和工作单元的生命周期这个话题相关,Hibernate org.hibernate.Session 是否被应该用来执行多次数据库操作?上面的例子对每一次操作使用了一个 org.hibernate.Session,这完全是巧合,这个例子不是很复杂,无法展示其他方式。Hibernate org.hibernate.Session 的生命周期可以很灵活,但是你绝不要把你的应用程序设计成为每一次数据库操作都用一个新的 Hibernate org.hibernate.Session。因此就算下面的例子(它们都很简单)中你可以看到这种用法,记住每次操作一个 session 是一个反模式。在本教程的后面会展示一个真正的(web)程序。" +msgid "" +"Related to the unit of work scope, should the Hibernate org." +"hibernate.Session be used to execute one or several database " +"operations? The above example uses one org.hibernate.Session for one operation. However this is pure coincidence; the example " +"is just not complex enough to show any other approach. The scope of a " +"Hibernate org.hibernate.Session is flexible but you " +"should never design your application to use a new Hibernate org." +"hibernate.Session for every database " +"operation. Even though it is used in the following examples, consider " +"session-per-operation an anti-pattern. A real web " +"application is shown later in the tutorial which will help illustrate this." +msgstr "" +"和工作单元的生命周期这个话题相关,Hibernate org.hibernate." +"Session 是否被应该用来执行多次数据库操作?上面的例子对每一次操作" +"使用了一个 org.hibernate.Session,这完全是巧合,这个例" +"子不是很复杂,无法展示其他方式。Hibernate org.hibernate.Session 的生命周期可以很灵活,但是你绝不要把你的应用程序设计成为" +"每一次数据库操作都用一个新的 Hibernate org.hibernate." +"Session。因此就算下面的例子(它们都很简单)中你可以看到这种用法," +"记住每次操作一个 session 是一个反模式。在本教程的后面会" +"展示一个真正的(web)程序。" #. Tag: para -#, no-c-format -msgid "See for more information about transaction handling and demarcation. The previous example also skipped any error handling and rollback." -msgstr "关于事务处理及事务边界界定的详细信息,请参看 。在上面的例子中,我们也忽略了所有的错误与回滚的处理。 " +#: tutorial.xml:571 +#, fuzzy, no-c-format +msgid "" +"See for more information about transaction " +"handling and demarcation. The previous example also skipped any error " +"handling and rollback." +msgstr "" +"关于事务处理及事务边界界定的详细信息,请参看 。在上面的例子中,我们也忽略了所有的错误与回滚的处理。 " #. Tag: para +#: tutorial.xml:577 #, no-c-format -msgid "To run this, we will make use of the Maven exec plugin to call our class with the necessary classpath setup: mvn exec:java -Dexec.mainClass=\"org.hibernate.tutorial.EventManager\" -Dexec.args=\"store\"" -msgstr "要运行它,我们将使用 Maven exec 插件以及必要的 classpath 设置来进行调用:mvn exec:java -Dexec.mainClass=\"org.hibernate.tutorial.EventManager\" -Dexec.args=\"store\"。" +msgid "" +"To run this, we will make use of the Maven exec plugin to call our class " +"with the necessary classpath setup: mvn exec:java -Dexec.mainClass=" +"\"org.hibernate.tutorial.EventManager\" -Dexec.args=\"store\"" +msgstr "" +"要运行它,我们将使用 Maven exec 插件以及必要的 classpath 设置来进行调用:" +"mvn exec:java -Dexec.mainClass=\"org.hibernate.tutorial.EventManager" +"\" -Dexec.args=\"store\"。" #. Tag: para +#: tutorial.xml:584 #, no-c-format msgid "You may need to perform mvn compile first." msgstr "你可能需要先执行 mvn compile。" #. Tag: para +#: tutorial.xml:589 #, no-c-format -msgid "You should see Hibernate starting up and, depending on your configuration, lots of log output. Towards the end, the following line will be displayed:" -msgstr "你应该会看到,编译以后,Hibernate 根据你的配置启动,并产生一大堆的输出日志。在日志最后你会看到下面这行: " +msgid "" +"You should see Hibernate starting up and, depending on your configuration, " +"lots of log output. Towards the end, the following line will be displayed:" +msgstr "" +"你应该会看到,编译以后,Hibernate 根据你的配置启动,并产生一大堆的输出日志。" +"在日志最后你会看到下面这行: " + +#. Tag: programlisting +#: tutorial.xml:594 +#, fuzzy, no-c-format +msgid "" +"" +msgstr "" +"[java] Hibernate: insert into EVENTS (EVENT_DATE, title, EVENT_ID) values " +"(?, ?, ?)" #. Tag: para +#: tutorial.xml:596 #, no-c-format msgid "This is the INSERT executed by Hibernate." msgstr "执行 HQL INSERT 语句的例子如下: " #. Tag: para +#: tutorial.xml:600 #, no-c-format msgid "To list stored events an option is added to the main method:" -msgstr "我们想要列出所有已经被存储的 events,就要增加一个条件分支选项到 main 方法中:" +msgstr "" +"我们想要列出所有已经被存储的 events,就要增加一个条件分支选项到 main 方法中:" + +#. Tag: programlisting +#: tutorial.xml:604 +#, fuzzy, no-c-format +msgid "" +"" +msgstr "" +"if (args[0].equals(\"store\")) {\n" +" mgr.createAndStoreEvent(\"My Event\", new Date());\n" +"}\n" +"else if (args[0].equals(\"list\")) {\n" +" List events = mgr.listEvents();\n" +" for (int i = 0; i < events.size(); i++) {\n" +" Event theEvent = (Event) events.get(i);\n" +" System.out.println(\"Event: \" + theEvent.getTitle() +\n" +" \" Time: \" + theEvent.getDate());\n" +" }\n" +"}" #. Tag: para +#: tutorial.xml:606 #, no-c-format msgid "A new listEvents() method is also added:" msgstr "我们也增加一个新的 listEvents() 方法: " -#. Tag: para -#, no-c-format -msgid "Here, we are using a Hibernate Query Language (HQL) query to load all existing Event objects from the database. Hibernate will generate the appropriate SQL, send it to the database and populate Event objects with the data. You can create more complex queries with HQL. See for more information." -msgstr "我们在这里是用一个 HQL(Hibernate Query Language-Hibernate查询语言)查询语句来从数据库中加载所有存在的 Event 对象。Hibernate 会生成适当的 SQL,把它发送到数据库,并操作从查询得到数据的 Event 对象。当然,你可以使用 HQL 来创建更加复杂的查询。更多信息请参考 。 " +#. Tag: programlisting +#: tutorial.xml:610 +#, fuzzy, no-c-format +msgid "" +"" +msgstr "" +"private List listEvents() {\n" +"\n" +" Session session = HibernateUtil.getSessionFactory().getCurrentSession" +"();\n" +"\n" +" session.beginTransaction();\n" +"\n" +" List result = session.createQuery(\"from Event\").list();\n" +"\n" +" session.getTransaction().commit();\n" +"\n" +" return result;\n" +"}" #. Tag: para +#: tutorial.xml:612 +#, fuzzy, no-c-format +msgid "" +"Here, we are using a Hibernate Query Language (HQL) query to load all " +"existing Event objects from the database. Hibernate will " +"generate the appropriate SQL, send it to the database and populate " +"Event objects with the data. You can create more complex " +"queries with HQL. See for more information." +msgstr "" +"我们在这里是用一个 HQL(Hibernate Query Language-Hibernate查询语言)查询语句" +"来从数据库中加载所有存在的 Event 对象。Hibernate 会生成适" +"当的 SQL,把它发送到数据库,并操作从查询得到数据的 Event " +"对象。当然,你可以使用 HQL 来创建更加复杂的查询。更多信息请参考 。 " + +#. Tag: para +#: tutorial.xml:620 #, no-c-format -msgid "Now we can call our new functionality, again using the Maven exec plugin: mvn exec:java -Dexec.mainClass=\"org.hibernate.tutorial.EventManager\" -Dexec.args=\"list\"" -msgstr "现在我们可以再次用 Maven exec plugin - mvn exec:java -Dexec.mainClass=\"org.hibernate.tutorial.EventManager\" -Dexec.args=\"list\" 调用新的功能了。" +msgid "" +"Now we can call our new functionality, again using the Maven exec plugin: " +"mvn exec:java -Dexec.mainClass=\"org.hibernate.tutorial.EventManager" +"\" -Dexec.args=\"list\"" +msgstr "" +"现在我们可以再次用 Maven exec plugin - mvn exec:java -Dexec." +"mainClass=\"org.hibernate.tutorial.EventManager\" -Dexec.args=\"list\" 调用新的功能了。" #. Tag: title +#: tutorial.xml:630 #, no-c-format msgid "Part 2 - Mapping associations" msgstr "第二部分 - 关联映射" #. Tag: para +#: tutorial.xml:632 #, no-c-format -msgid "So far we have mapped a single persistent entity class to a table in isolation. Let's expand on that a bit and add some class associations. We will add people to the application and store a list of events in which they participate." -msgstr "我们已经映射了一个持久化实体类到表上。让我们在这个基础上增加一些类之间的关联。首先我们往应用程序里增加人(people)的概念,并存储他们所参与的一个 Event 列表。(译者注:与 Event 一样,我们在后面将直接使用 person 来表示“人”而不是它的中文翻译) " +msgid "" +"So far we have mapped a single persistent entity class to a table in " +"isolation. Let's expand on that a bit and add some class associations. We " +"will add people to the application and store a list of events in which they " +"participate." +msgstr "" +"我们已经映射了一个持久化实体类到表上。让我们在这个基础上增加一些类之间的关" +"联。首先我们往应用程序里增加人(people)的概念,并存储他们所参与的一个 Event " +"列表。(译者注:与 Event 一样,我们在后面将直接使用 person 来表示“人”而不是它" +"的中文翻译) " #. Tag: title +#: tutorial.xml:640 #, no-c-format msgid "Mapping the Person class" msgstr "映射 Person 类" #. Tag: para +#: tutorial.xml:642 #, no-c-format msgid "The first cut of the Person class looks like this:" msgstr "最初简单的 Person 类: " -#. Tag: para -#, no-c-format -msgid "Save this to a file named src/main/java/org/hibernate/tutorial/domain/Person.java" -msgstr "把它保存为文件 src/main/java/org/hibernate/tutorial/domain/Person.java。" +#. Tag: programlisting +#: tutorial.xml:646 +#, fuzzy, no-c-format +msgid "" +"" +msgstr "" +"package events;\n" +"\n" +"public class Person {\n" +"\n" +" private Long id;\n" +" private int age;\n" +" private String firstname;\n" +" private String lastname;\n" +"\n" +" public Person() {}\n" +"\n" +" // Accessor methods for all properties, private setter for 'id'\n" +"\n" +"}" #. Tag: para +#: tutorial.xml:648 #, no-c-format -msgid "Next, create the new mapping file as src/main/resources/org/hibernate/tutorial/domain/Person.hbm.xml" -msgstr "然后,创建新的映射文件 src/main/resources/org/hibernate/tutorial/domain/Person.hbm.xml。" +msgid "" +"Save this to a file named src/main/java/org/hibernate/tutorial/" +"domain/Person.java" +msgstr "" +"把它保存为文件 src/main/java/org/hibernate/tutorial/domain/Person." +"java。" #. Tag: para +#: tutorial.xml:653 +#, no-c-format +msgid "" +"Next, create the new mapping file as src/main/resources/org/" +"hibernate/tutorial/domain/Person.hbm.xml" +msgstr "" +"然后,创建新的映射文件 src/main/resources/org/hibernate/tutorial/" +"domain/Person.hbm.xml。" + +#. Tag: programlisting +#: tutorial.xml:658 +#, fuzzy, no-c-format +msgid "" +"\n" +"\n" +" \n" +" \n" +" \n" +" \n" +" \n" +" \n" +" \n" +" \n" +"\n" +"]]>" +msgstr "" +"<hibernate-mapping>\n" +"\n" +" <class name=\"events.Person\" table=\"PERSON\">\n" +" <id name=\"id\" column=\"PERSON_ID\">\n" +" <generator class=\"native\"/>\n" +" </id>\n" +" <property name=\"age\"/>\n" +" <property name=\"firstname\"/>\n" +" <property name=\"lastname\"/>\n" +" </class>\n" +"\n" +"</hibernate-mapping>" + +#. Tag: para +#: tutorial.xml:660 #, no-c-format msgid "Finally, add the new mapping to Hibernate's configuration:" msgstr "最后,把新的映射加入到 Hibernate 的配置中:" +#. Tag: programlisting +#: tutorial.xml:664 +#, fuzzy, no-c-format +msgid "" +"\n" +"]]>" +msgstr "" +"<mapping resource=\"events/Event.hbm.xml\"/>\n" +"<mapping resource=\"events/Person.hbm.xml\"/>" + #. Tag: para +#: tutorial.xml:666 #, no-c-format -msgid "Create an association between these two entities. Persons can participate in events, and events have participants. The design questions you have to deal with are: directionality, multiplicity, and collection behavior." -msgstr "现在我们在这两个实体之间创建一个关联。显然,persons 可以参与一系列 events,而 events 也有不同的参加者(persons)。我们需要处理的设计问题是关联方向(directionality),阶数(multiplicity)和集合(collection)的行为。 " +msgid "" +"Create an association between these two entities. Persons can participate in " +"events, and events have participants. The design questions you have to deal " +"with are: directionality, multiplicity, and collection behavior." +msgstr "" +"现在我们在这两个实体之间创建一个关联。显然,persons 可以参与一系列 events," +"而 events 也有不同的参加者(persons)。我们需要处理的设计问题是关联方向" +"(directionality),阶数(multiplicity)和集合(collection)的行为。 " #. Tag: title +#: tutorial.xml:676 #, no-c-format msgid "A unidirectional Set-based association" msgstr "单向 Set-based 的关联" #. Tag: para +#: tutorial.xml:678 #, no-c-format -msgid "By adding a collection of events to the Person class, you can easily navigate to the events for a particular person, without executing an explicit query - by calling Person#getEvents. Multi-valued associations are represented in Hibernate by one of the Java Collection Framework contracts; here we choose a java.util.Set because the collection will not contain duplicate elements and the ordering is not relevant to our examples:" -msgstr "我们将向 Person 类增加一连串的 events。那样,通过调用 aPerson.getEvents(),就可以轻松地导航到特定 person 所参与的 events,而不用去执行一个显式的查询。我们使用 Java 的集合类(collection):Set,因为 set 不包含重复的元素及与我们无关的排序。 " +msgid "" +"By adding a collection of events to the Person class, you " +"can easily navigate to the events for a particular person, without executing " +"an explicit query - by calling Person#getEvents. Multi-" +"valued associations are represented in Hibernate by one of the Java " +"Collection Framework contracts; here we choose a java.util." +"Set because the collection will not contain duplicate " +"elements and the ordering is not relevant to our examples:" +msgstr "" +"我们将向 Person 类增加一连串的 events。那样,通过调用 " +"aPerson.getEvents(),就可以轻松地导航到特定 person 所参与" +"的 events,而不用去执行一个显式的查询。我们使用 Java 的集合类(collection):" +"Set,因为 set 不包含重复的元素及与我们无关的排序。 " + +#. Tag: programlisting +#: tutorial.xml:689 +#, fuzzy, no-c-format +msgid "" +"" +msgstr "" +"public class Person {\n" +"\n" +" private Set events = new HashSet();\n" +"\n" +" public Set getEvents() {\n" +" return events;\n" +" }\n" +"\n" +" public void setEvents(Set events) {\n" +" this.events = events;\n" +" }\n" +"}" #. Tag: para +#: tutorial.xml:691 #, no-c-format -msgid "Before mapping this association, let's consider the other side. We could just keep this unidirectional or create another collection on the Event, if we wanted to be able to navigate it from both directions. This is not necessary, from a functional perspective. You can always execute an explicit query to retrieve the participants for a particular event. This is a design choice left to you, but what is clear from this discussion is the multiplicity of the association: \"many\" valued on both sides is called a many-to-many association. Hence, we use Hibernate's many-to-many mapping:" -msgstr "在映射这个关联之前,先考虑一下此关联的另外一端。很显然,我们可以保持这个关联是单向的。或者,我们可以在 Event 里创建另外一个集合,如果希望能够双向地导航,如:anEvent.getParticipants()。从功能的角度来说,这并不是必须的。因为你总可以显式地执行一个查询,以获得某个特定 event 的所有参与者。这是个在设计时需要做出的选择,完全由你来决定,但此讨论中关于关联的阶数是清楚的:即两端都是“多”值的,我们把它叫做多对多(many-to-many)关联。因而,我们使用 Hibernate 的多对多映射: " +msgid "" +"Before mapping this association, let's consider the other side. We could " +"just keep this unidirectional or create another collection on the " +"Event, if we wanted to be able to navigate it from both " +"directions. This is not necessary, from a functional perspective. You can " +"always execute an explicit query to retrieve the participants for a " +"particular event. This is a design choice left to you, but what is clear " +"from this discussion is the multiplicity of the association: \"many\" valued " +"on both sides is called a many-to-many association. " +"Hence, we use Hibernate's many-to-many mapping:" +msgstr "" +"在映射这个关联之前,先考虑一下此关联的另外一端。很显然,我们可以保持这个关联" +"是单向的。或者,我们可以在 Event 里创建另外一个集合,如果" +"希望能够双向地导航,如:anEvent.getParticipants()。从功能" +"的角度来说,这并不是必须的。因为你总可以显式地执行一个查询,以获得某个特定 " +"event 的所有参与者。这是个在设计时需要做出的选择,完全由你来决定,但此讨论中" +"关于关联的阶数是清楚的:即两端都是“多”值的,我们把它叫做多对多" +"(many-to-many)关联。因而,我们使用 Hibernate 的多对多映射: " + +#. Tag: programlisting +#: tutorial.xml:704 +#, fuzzy, no-c-format +msgid "" +"\n" +" \n" +" \n" +" \n" +" \n" +" \n" +" \n" +"\n" +" \n" +" \n" +" \n" +" \n" +"\n" +"]]>" +msgstr "" +"<class name=\"events.Person\" table=\"PERSON\">\n" +" <id name=\"id\" column=\"PERSON_ID\">\n" +" <generator class=\"native\"/>\n" +" </id>\n" +" <property name=\"age\"/>\n" +" <property name=\"firstname\"/>\n" +" <property name=\"lastname\"/>\n" +"\n" +" <set name=\"events\" table=\"PERSON_EVENT\">\n" +" <key column=\"PERSON_ID\"/>\n" +" <many-to-many column=\"EVENT_ID\" class=\"events.Event\"/>\n" +" </set>\n" +"\n" +"</class>" #. Tag: para +#: tutorial.xml:706 #, no-c-format -msgid "Hibernate supports a broad range of collection mappings, a set being most common. For a many-to-many association, or n:m entity relationship, an association table is required. Each row in this table represents a link between a person and an event. The table name is decalred using the table attribute of the set element. The identifier column name in the association, for the person side, is defined with the key element, the column name for the event's side with the column attribute of the many-to-many. You also have to tell Hibernate the class of the objects in your collection (the class on the other side of the collection of references)." -msgstr "Hibernate 支持各种各样的集合映射,<set> 使用的最为普遍。对于多对多关联(或叫 n:m 实体关系), 需要一个关联表(association table)。里面的每一行代表从 person 到 event 的一个关联。表名是由 set 元素的 table 属性配置的。关联里面的标识符字段名,对于 person 的一端,是由 <key> 元素定义,而 event 一端的字段名是由 <many-to-many> 元素的 column 属性定义。你也必须告诉 Hibernate 集合中对象的类(也就是位于这个集合所代表的关联另外一端的类)。 " +msgid "" +"Hibernate supports a broad range of collection mappings, a set being most common. For a many-to-many association, or n:" +"m entity relationship, an association table is required. Each row " +"in this table represents a link between a person and an event. The table " +"name is decalred using the table attribute of the " +"set element. The identifier column name in the " +"association, for the person side, is defined with the key " +"element, the column name for the event's side with the column attribute of the many-to-many. You also have to " +"tell Hibernate the class of the objects in your collection (the class on the " +"other side of the collection of references)." +msgstr "" +"Hibernate 支持各种各样的集合映射,<set> 使用的最为普" +"遍。对于多对多关联(或叫 n:m 实体关系), 需要一个关联表" +"(association table)。里面的每一行代表从 person 到 " +"event 的一个关联。表名是由 set 元素的 table 属性配置的。关联里面的标识符字段名,对于 person 的一端,是由 " +"<key> 元素定义,而 event 一端的字段名是由 " +"<many-to-many> 元素的 column 属性" +"定义。你也必须告诉 Hibernate 集合中对象的类(也就是位于这个集合所代表的关联另" +"外一端的类)。 " #. Tag: para +#: tutorial.xml:722 #, no-c-format msgid "The database schema for this mapping is therefore:" msgstr "因而这个映射的数据库 schema 是:" +#. Tag: programlisting +#: tutorial.xml:726 +#, fuzzy, no-c-format +msgid "" +" | *EVENT_ID | | |\n" +" | EVENT_DATE | | *PERSON_ID | <--> | *PERSON_ID |\n" +" | TITLE | |__________________| | AGE |\n" +" |_____________| | FIRSTNAME |\n" +" | LASTNAME |\n" +" |_____________|\n" +" ]]>" +msgstr "" +"_____________ __________________\n" +" | | | | _____________\n" +" | EVENTS | | PERSON_EVENT | | |\n" +" |_____________| |__________________| | PERSON |\n" +" | | | | |_____________|\n" +" | *EVENT_ID | <--> | *EVENT_ID | | |\n" +" | EVENT_DATE | | *PERSON_ID | <--> | *PERSON_ID |\n" +" | TITLE | |__________________| | AGE |\n" +" |_____________| | FIRSTNAME |\n" +" | LASTNAME |\n" +" |_____________|" + #. Tag: title +#: tutorial.xml:731 #, no-c-format msgid "Working the association" msgstr "使关联工作" #. Tag: para +#: tutorial.xml:733 #, no-c-format -msgid "Now we will bring some people and events together in a new method in EventManager:" -msgstr "我们把一些 people 和 events 一起放到 EventManager 的新方法中: " +msgid "" +"Now we will bring some people and events together in a new method in " +"EventManager:" +msgstr "" +"我们把一些 people 和 events 一起放到 EventManager 的新方法" +"中: " + +#. Tag: programlisting +#: tutorial.xml:737 +#, fuzzy, no-c-format +msgid "" +"" +msgstr "" +"private void addPersonToEvent(Long personId, Long eventId) {\n" +"\n" +" Session session = HibernateUtil.getSessionFactory().getCurrentSession" +"();\n" +" session.beginTransaction();\n" +"\n" +" Person aPerson = (Person) session.load(Person.class, personId);\n" +" Event anEvent = (Event) session.load(Event.class, eventId);\n" +"\n" +" aPerson.getEvents().add(anEvent);\n" +"\n" +" session.getTransaction().commit();\n" +"}" #. Tag: para +#: tutorial.xml:739 #, no-c-format -msgid "After loading a Person and an Event, simply modify the collection using the normal collection methods. There is no explicit call to update() or save(); Hibernate automatically detects that the collection has been modified and needs to be updated. This is called automatic dirty checking. You can also try it by modifying the name or the date property of any of your objects. As long as they are in persistent state, that is, bound to a particular Hibernate org.hibernate.Session, Hibernate monitors any changes and executes SQL in a write-behind fashion. The process of synchronizing the memory state with the database, usually only at the end of a unit of work, is called flushing. In our code, the unit of work ends with a commit, or rollback, of the database transaction." -msgstr "在加载一 PersonEvent 后,使用普通的集合方法就可容易地修改我们定义的集合。如你所见,没有显式的 update()save(),Hibernate 会自动检测到集合已经被修改并需要更新回数据库。这叫做自动脏检查(automatic dirty checking),你也可以尝试修改任何对象的 name 或者 date 属性,只要他们处于持久化状态,也就是被绑定到某个 Hibernate 的 Session 上(如:他们刚刚在一个单元操作被加载或者保存),Hibernate 监视任何改变并在后台隐式写的方式执行 SQL。同步内存状态和数据库的过程,通常只在单元操作结束的时候发生,称此过程为清理缓存(flushing)。在我们的代码中,工作单元由数据库事务的提交(或者回滚)来结束——这是由 CurrentSessionContext 类的 thread 配置选项定义的。 " +msgid "" +"After loading a Person and an Event, " +"simply modify the collection using the normal collection methods. There is " +"no explicit call to update() or save(); Hibernate automatically detects that the collection has been " +"modified and needs to be updated. This is called automatic dirty " +"checking. You can also try it by modifying the name or the date " +"property of any of your objects. As long as they are in " +"persistent state, that is, bound to a particular " +"Hibernate org.hibernate.Session, Hibernate " +"monitors any changes and executes SQL in a write-behind fashion. The process " +"of synchronizing the memory state with the database, usually only at the end " +"of a unit of work, is called flushing. In our code, the " +"unit of work ends with a commit, or rollback, of the database transaction." +msgstr "" +"在加载一 PersonEvent 后,使用普通的" +"集合方法就可容易地修改我们定义的集合。如你所见,没有显式的 update()" +"save(),Hibernate 会自动检测到集合已经被修改" +"并需要更新回数据库。这叫做自动脏检查(automatic dirty checking),你也可以尝试修改任何对象的 name 或者 date 属性,只要他们处于" +"持久化状态,也就是被绑定到某个 Hibernate 的 " +"Session 上(如:他们刚刚在一个单元操作被加载或者保存)," +"Hibernate 监视任何改变并在后台隐式写的方式执行 SQL。同步内存状态和数据库的过" +"程,通常只在单元操作结束的时候发生,称此过程为清理缓存(flushing)" +"。在我们的代码中,工作单元由数据库事务的提交(或者回滚)来结束——这" +"是由 CurrentSessionContext 类的 thread " +"配置选项定义的。 " #. Tag: para +#: tutorial.xml:758 #, no-c-format -msgid "You can load person and event in different units of work. Or you can modify an object outside of a org.hibernate.Session, when it is not in persistent state (if it was persistent before, this state is called detached). You can even modify a collection when it is detached:" -msgstr "当然,你也可以在不同的单元操作里面加载 person 和 event。或在 Session 以外修改不是处在持久化(persistent)状态下的对象(如果该对象以前曾经被持久化,那么我们称这个状态为脱管(detached))。你甚至可以在一个集合被脱管时修改它: " +msgid "" +"You can load person and event in different units of work. Or you can modify " +"an object outside of a org.hibernate.Session, " +"when it is not in persistent state (if it was persistent before, this state " +"is called detached). You can even modify a collection " +"when it is detached:" +msgstr "" +"当然,你也可以在不同的单元操作里面加载 person 和 event。或在 " +"Session 以外修改不是处在持久化(persistent)状态下的对象" +"(如果该对象以前曾经被持久化,那么我们称这个状态为脱管(detached)" +")。你甚至可以在一个集合被脱管时修改它: " + +#. Tag: programlisting +#: tutorial.xml:767 +#, fuzzy, no-c-format +msgid "" +"" +msgstr "" +"private void addPersonToEvent(Long personId, Long eventId) {\n" +"\n" +" Session session = HibernateUtil.getSessionFactory().getCurrentSession" +"();\n" +" session.beginTransaction();\n" +"\n" +" Person aPerson = (Person) session\n" +" .createQuery(\"select p from Person p left join fetch p.events " +"where p.id = :pid\")\n" +" .setParameter(\"pid\", personId)\n" +" .uniqueResult(); // Eager fetch the collection so we can use it " +"detached\n" +"\n" +" Event anEvent = (Event) session.load(Event.class, eventId);\n" +"\n" +" session.getTransaction().commit();\n" +"\n" +" // End of first unit of work\n" +"\n" +" aPerson.getEvents().add(anEvent); // aPerson (and its collection) is " +"detached\n" +"\n" +" // Begin second unit of work\n" +"\n" +" Session session2 = HibernateUtil.getSessionFactory().getCurrentSession" +"();\n" +" session2.beginTransaction();\n" +"\n" +" session2.update(aPerson); // Reattachment of aPerson\n" +"\n" +" session2.getTransaction().commit();\n" +"}" #. Tag: para +#: tutorial.xml:769 #, no-c-format -msgid "The call to update makes a detached object persistent again by binding it to a new unit of work, so any modifications you made to it while detached can be saved to the database. This includes any modifications (additions/deletions) you made to a collection of that entity object." -msgstr "对 update 的调用使一个脱管对象重新持久化,你可以说它被绑定到一个新的单元操作上,所以在脱管状态下对它所做的任何修改都会被保存到数据库里。这也包括你对这个实体对象的集合所作的任何改动(增加/删除)。 " +msgid "" +"The call to update makes a detached object persistent " +"again by binding it to a new unit of work, so any modifications you made to " +"it while detached can be saved to the database. This includes any " +"modifications (additions/deletions) you made to a collection of that entity " +"object." +msgstr "" +"对 update 的调用使一个脱管对象重新持久化,你可以说它被绑定" +"到一个新的单元操作上,所以在脱管状态下对它所做的任何修改都会被保存到数据库" +"里。这也包括你对这个实体对象的集合所作的任何改动(增加/删除)。 " #. Tag: para +#: tutorial.xml:778 #, no-c-format -msgid "This is not much use in our example, but it is an important concept you can incorporate into your own application. Complete this exercise by adding a new action to the main method of the EventManager and call it from the command line. If you need the identifiers of a person and an event - the save() method returns it (you might have to modify some of the previous methods to return that identifier):" -msgstr "这对我们当前的情形不是很有用,但它是非常重要的概念,你可以把它融入到你自己的应用程序设计中。在EventManager的 main 方法中添加一个新的动作,并从命令行运行它来完成我们所做的练习。如果你需要 person 及 event 的标识符 — 那就用 save() 方法返回它(你可能需要修改前面的一些方法来返回那个标识符): " +msgid "" +"This is not much use in our example, but it is an important concept you can " +"incorporate into your own application. Complete this exercise by adding a " +"new action to the main method of the EventManager and " +"call it from the command line. If you need the identifiers of a person and " +"an event - the save() method returns it (you might have " +"to modify some of the previous methods to return that identifier):" +msgstr "" +"这对我们当前的情形不是很有用,但它是非常重要的概念,你可以把它融入到你自己的" +"应用程序设计中。在EventManager的 main 方法中添加一个新的动" +"作,并从命令行运行它来完成我们所做的练习。如果你需要 person 及 event 的标识" +"符 — 那就用 save() 方法返回它(你可能需要修改前面的一些方" +"法来返回那个标识符): " + +#. Tag: programlisting +#: tutorial.xml:786 +#, fuzzy, no-c-format +msgid "" +"" +msgstr "" +"else if (args[0].equals(\"addpersontoevent\")) {\n" +" Long eventId = mgr.createAndStoreEvent(\"My Event\", new Date());\n" +" Long personId = mgr.createAndStorePerson(\"Foo\", \"Bar\");\n" +" mgr.addPersonToEvent(personId, eventId);\n" +" System.out.println(\"Added person \" + personId + \" to event \" + " +"eventId);\n" +"}" #. Tag: para +#: tutorial.xml:788 #, no-c-format -msgid "This is an example of an association between two equally important classes : two entities. As mentioned earlier, there are other classes and types in a typical model, usually \"less important\". Some you have already seen, like an int or a java.lang.String. We call these classes value types, and their instances depend on a particular entity. Instances of these types do not have their own identity, nor are they shared between entities. Two persons do not reference the same firstname object, even if they have the same first name. Value types cannot only be found in the JDK , but you can also write dependent classes yourself such as an Address or MonetaryAmount class. In fact, in a Hibernate application all JDK classes are considered value types." -msgstr "上面是个关于两个同等重要的实体类间关联的例子。像前面所提到的那样,在特定的模型中也存在其它的类和类型,这些类和类型通常是“次要的”。你已看到过其中的一些,像 intString。我们称这些类为值类型(value type),它们的实例依赖(depend)在某个特定的实体上。这些类型的实例没有它们自己的标识(identity),也不能在实体间被共享(比如,两个 person 不能引用同一个 firstname 对象,即使他们有相同的 first name)。当然,值类型并不仅仅在 JDK 中存在(事实上,在一个 Hibernate 应用程序中,所有的 JDK 类都被视为值类型),而且你也可以编写你自己的依赖类,例如 AddressMonetaryAmount。 " +msgid "" +"This is an example of an association between two equally important classes : " +"two entities. As mentioned earlier, there are other classes and types in a " +"typical model, usually \"less important\". Some you have already seen, like " +"an int or a java.lang.String. We " +"call these classes value types, and their instances " +"depend on a particular entity. Instances of these types " +"do not have their own identity, nor are they shared between entities. Two " +"persons do not reference the same firstname object, even " +"if they have the same first name. Value types cannot only be found in the " +"JDK , but you can also write dependent classes yourself such as an " +"Address or MonetaryAmount class. In " +"fact, in a Hibernate application all JDK classes are considered value types." +msgstr "" +"上面是个关于两个同等重要的实体类间关联的例子。像前面所提到的那样,在特定的模" +"型中也存在其它的类和类型,这些类和类型通常是“次要的”。你已看到过其中的一些," +"像 intString。我们称这些类为" +"值类型(value type),它们的实例依赖(depend)" +"在某个特定的实体上。这些类型的实例没有它们自己的标识(identity)," +"也不能在实体间被共享(比如,两个 person 不能引用同一个 firstname 对象,即使他们有相同的 first name)。当然,值类型并不仅仅在 JDK 中存" +"在(事实上,在一个 Hibernate 应用程序中,所有的 JDK 类都被视为值类型),而且" +"你也可以编写你自己的依赖类,例如 Address," +"MonetaryAmount。 " #. Tag: para +#: tutorial.xml:806 #, no-c-format -msgid "You can also design a collection of value types. This is conceptually different from a collection of references to other entities, but looks almost the same in Java." -msgstr "你也可以设计一个值类型的集合,这在概念上与引用其它实体的集合有很大的不同,但是在 Java 里面看起来几乎是一样的。 " +msgid "" +"You can also design a collection of value types. This is conceptually " +"different from a collection of references to other entities, but looks " +"almost the same in Java." +msgstr "" +"你也可以设计一个值类型的集合,这在概念上与引用其它实体的集合有很大的不同,但" +"是在 Java 里面看起来几乎是一样的。 " #. Tag: title +#: tutorial.xml:815 #, no-c-format msgid "Collection of values" msgstr "值类型的集合" #. Tag: para +#: tutorial.xml:817 #, no-c-format -msgid "Let's add a collection of email addresses to the Person entity. This will be represented as a java.util.Set of java.lang.String instances:" -msgstr "让我们在 Person 实体里添加一个电子邮件的集合。这将以 java.lang.String 实例的 java.util.Set 出现:" +msgid "" +"Let's add a collection of email addresses to the Person " +"entity. This will be represented as a java.util.Set of java.lang.String instances:" +msgstr "" +"让我们在 Person 实体里添加一个电子邮件的集合。这将以 " +"java.lang.String 实例的 java.util.Set 出现:" + +#. Tag: programlisting +#: tutorial.xml:823 +#, fuzzy, no-c-format +msgid "" +"" +msgstr "" +"private Set emailAddresses = new HashSet();\n" +"\n" +"public Set getEmailAddresses() {\n" +" return emailAddresses;\n" +"}\n" +"\n" +"public void setEmailAddresses(Set emailAddresses) {\n" +" this.emailAddresses = emailAddresses;\n" +"}" #. Tag: para +#: tutorial.xml:825 #, no-c-format msgid "The mapping of this Set is as follows:" msgstr "这个 Set 的映射如下:" -#. Tag: para -#, no-c-format -msgid "The difference compared with the earlier mapping is the use of the element part which tells Hibernate that the collection does not contain references to another entity, but is rather a collection whose elements are values types, here specifically of type string. The lowercase name tells you it is a Hibernate mapping type/converter. Again the table attribute of the set element determines the table name for the collection. The key element defines the foreign-key column name in the collection table. The column attribute in the element element defines the column name where the email address values will actually be stored." -msgstr "比较这次和此前映射的差别,主要在于 element 部分,这次并没有包含对其它实体引用的集合,而是元素类型为 String 的集合(在映射中使用小写的名字”string“是向你表明它是一个 Hibernate 的映射类型或者类型转换器)。和之前一样,set 元素的 table 属性决定了用于集合的表名。key 元素定义了在集合表中外键的字段名。element 元素的 column 属性定义用于实际保存 String 值的字段名。 " +#. Tag: programlisting +#: tutorial.xml:829 +#, fuzzy, no-c-format +msgid "" +"\n" +" \n" +" \n" +" ]]>" +msgstr "" +"<set name=\"emailAddresses\" table=\"PERSON_EMAIL_ADDR\">\n" +" <key column=\"PERSON_ID\"/>\n" +" <element type=\"string\" column=\"EMAIL_ADDR\"/>\n" +"</set>" #. Tag: para +#: tutorial.xml:831 +#, no-c-format +msgid "" +"The difference compared with the earlier mapping is the use of the " +"element part which tells Hibernate that the collection " +"does not contain references to another entity, but is rather a collection " +"whose elements are values types, here specifically of type string. The lowercase name tells you it is a Hibernate mapping type/" +"converter. Again the table attribute of the set element determines the table name for the collection. The " +"key element defines the foreign-key column name in the " +"collection table. The column attribute in the " +"element element defines the column name where the email " +"address values will actually be stored." +msgstr "" +"比较这次和此前映射的差别,主要在于 element 部分,这次并没" +"有包含对其它实体引用的集合,而是元素类型为 String 的集合" +"(在映射中使用小写的名字”string“是向你表明它是一个 Hibernate 的映射类型或者类" +"型转换器)。和之前一样,set 元素的 table 属性决定了用于集合的表名。key 元素定义了在集合表" +"中外键的字段名。element 元素的 column " +"属性定义用于实际保存 String 值的字段名。 " + +#. Tag: para +#: tutorial.xml:847 #, no-c-format msgid "Here is the updated schema:" msgstr "看一下修改后的数据库 schema。 " -#. Tag: para -#, no-c-format -msgid "You can see that the primary key of the collection table is in fact a composite key that uses both columns. This also implies that there cannot be duplicate email addresses per person, which is exactly the semantics we need for a set in Java." -msgstr "你可以看到集合表的主键实际上是个复合主键,同时使用了两个字段。这也暗示了对于同一个 person 不能有重复的 email 地址,这正是 Java 里面使用 Set 时候所需要的语义(Set 里元素不能重复)。" +#. Tag: programlisting +#: tutorial.xml:851 +#, fuzzy, no-c-format +msgid "" +" | *EVENT_ID | | | |" +"___________________|\n" +" | EVENT_DATE | | *PERSON_ID | <--> | *PERSON_ID | <--> | " +"*PERSON_ID |\n" +" | TITLE | |__________________| | AGE | | " +"*EMAIL_ADDR |\n" +" |_____________| | FIRSTNAME | |" +"___________________|\n" +" | LASTNAME |\n" +" |_____________|\n" +" ]]>" +msgstr "" +"_____________ __________________\n" +" | | | | _____________\n" +" | EVENTS | | PERSON_EVENT | | | " +"___________________\n" +" |_____________| |__________________| | PERSON | " +"| |\n" +" | | | | |_____________| | " +"PERSON_EMAIL_ADDR |\n" +" | *EVENT_ID | <--> | *EVENT_ID | | | |" +"___________________|\n" +" | EVENT_DATE | | *PERSON_ID | <--> | *PERSON_ID | <--" +"> | *PERSON_ID |\n" +" | TITLE | |__________________| | AGE | | " +"*EMAIL_ADDR |\n" +" |_____________| | FIRSTNAME | |" +"___________________|\n" +" | LASTNAME |\n" +" |_____________|" #. Tag: para +#: tutorial.xml:853 #, no-c-format -msgid "You can now try to add elements to this collection, just like we did before by linking persons and events. It is the same code in Java:" -msgstr "你现在可以试着把元素加入到这个集合,就像我们在之前关联 person 和 event 的那样。其实现的 Java 代码是相同的: " +msgid "" +"You can see that the primary key of the collection table is in fact a " +"composite key that uses both columns. This also implies that there cannot be " +"duplicate email addresses per person, which is exactly the semantics we need " +"for a set in Java." +msgstr "" +"你可以看到集合表的主键实际上是个复合主键,同时使用了两个字段。这也暗示了对于" +"同一个 person 不能有重复的 email 地址,这正是 Java 里面使用 Set 时候所需要的" +"语义(Set 里元素不能重复)。" #. Tag: para +#: tutorial.xml:859 #, no-c-format -msgid "This time we did not use a fetch query to initialize the collection. Monitor the SQL log and try to optimize this with an eager fetch." -msgstr "这次我们没有使用 fetch 查询来初始化集合。因此,调用其 getter 方法会触发另一附加的 select 来初始化集合,这样我们才能把元素添加进去。检查 SQL log,试着通过预先抓取来优化它。 " +msgid "" +"You can now try to add elements to this collection, just like we did before " +"by linking persons and events. It is the same code in Java:" +msgstr "" +"你现在可以试着把元素加入到这个集合,就像我们在之前关联 person 和 event 的那" +"样。其实现的 Java 代码是相同的: " + +#. Tag: programlisting +#: tutorial.xml:864 +#, fuzzy, no-c-format +msgid "" +"" +msgstr "" +"private void addEmailToPerson(Long personId, String emailAddress) {\n" +"\n" +" Session session = HibernateUtil.getSessionFactory().getCurrentSession" +"();\n" +" session.beginTransaction();\n" +"\n" +" Person aPerson = (Person) session.load(Person.class, personId);\n" +"\n" +" // The getEmailAddresses() might trigger a lazy load of the collection\n" +" aPerson.getEmailAddresses().add(emailAddress);\n" +"\n" +" session.getTransaction().commit();\n" +"}" + +#. Tag: para +#: tutorial.xml:866 +#, no-c-format +msgid "" +"This time we did not use a fetch query to initialize " +"the collection. Monitor the SQL log and try to optimize this with an eager " +"fetch." +msgstr "" +"这次我们没有使用 fetch 查询来初始化集合。因此,调用其 " +"getter 方法会触发另一附加的 select 来初始化集合,这样我们才能把元素添加进去。" +"检查 SQL log,试着通过预先抓取来优化它。 " #. Tag: title +#: tutorial.xml:875 #, no-c-format msgid "Bi-directional associations" msgstr "双向关联" #. Tag: para +#: tutorial.xml:877 #, no-c-format -msgid "Next you will map a bi-directional association. You will make the association between person and event work from both sides in Java. The database schema does not change, so you will still have many-to-many multiplicity." -msgstr "接下来我们将映射双向关联(bi-directional association)— 在 Java 里让 person 和 event 可以从关联的任何一端访问另一端。当然,数据库 schema 没有改变,我们仍然需要多对多的阶数。一个关系型数据库要比网络编程语言更加灵活,所以它并不需要任何像导航方向(navigation direction)的东西 — 数据可以用任何可能的方式进行查看和获取。 " +msgid "" +"Next you will map a bi-directional association. You will make the " +"association between person and event work from both sides in Java. The " +"database schema does not change, so you will still have many-to-many " +"multiplicity." +msgstr "" +"接下来我们将映射双向关联(bi-directional association)— 在 Java 里让 person " +"和 event 可以从关联的任何一端访问另一端。当然,数据库 schema 没有改变,我们仍" +"然需要多对多的阶数。一个关系型数据库要比网络编程语言更加灵活,所以它并不需要" +"任何像导航方向(navigation direction)的东西 — 数据可以用任何可能的方式进行查" +"看和获取。 " #. Tag: para +#: tutorial.xml:885 #, no-c-format -msgid "A relational database is more flexible than a network programming language, in that it does not need a navigation direction; data can be viewed and retrieved in any possible way." -msgstr "关系型数据库比网络编程语言更为灵活,因为它不需要方向导航,其数据可以用任何可能的方式进行查看和提取。" +msgid "" +"A relational database is more flexible than a network programming language, " +"in that it does not need a navigation direction; data can be viewed and " +"retrieved in any possible way." +msgstr "" +"关系型数据库比网络编程语言更为灵活,因为它不需要方向导航,其数据可以用任何可" +"能的方式进行查看和提取。" #. Tag: para +#: tutorial.xml:893 #, no-c-format -msgid "First, add a collection of participants to the Event class:" -msgstr "首先,把一个参与者(person)的集合加入 Event 类中: " +msgid "" +"First, add a collection of participants to the Event " +"class:" +msgstr "" +"首先,把一个参与者(person)的集合加入 Event 类中: " + +#. Tag: programlisting +#: tutorial.xml:898 +#, fuzzy, no-c-format +msgid "" +"" +msgstr "" +"private Set participants = new HashSet();\n" +"\n" +"public Set getParticipants() {\n" +" return participants;\n" +"}\n" +"\n" +"public void setParticipants(Set participants) {\n" +" this.participants = participants;\n" +"}" #. Tag: para +#: tutorial.xml:900 #, no-c-format -msgid "Now map this side of the association in Event.hbm.xml." +msgid "" +"Now map this side of the association in Event.hbm.xml." msgstr "在 Event.hbm.xml 里面也映射这个关联。 " -#. Tag: para -#, no-c-format -msgid "These are normal set mappings in both mapping documents. Notice that the column names in key and many-to-many swap in both mapping documents. The most important addition here is the inverse=\"true\" attribute in the set element of the Event's collection mapping." -msgstr "如你所见,两个映射文件里都有普通的 set 映射。注意在两个映射文件中,互换了 keymany-to-many 的字段名。这里最重要的是 Event 映射文件里增加了 set 元素的 inverse=\"true\" 属性。 " +#. Tag: programlisting +#: tutorial.xml:904 +#, fuzzy, no-c-format +msgid "" +"\n" +" \n" +" \n" +" ]]>" +msgstr "" +"<set name=\"participants\" table=\"PERSON_EVENT\" inverse=\"true\">\n" +" <key column=\"EVENT_ID\"/>\n" +" <many-to-many column=\"PERSON_ID\" class=\"events.Person\"/>\n" +"</set>" #. Tag: para +#: tutorial.xml:906 #, no-c-format -msgid "What this means is that Hibernate should take the other side, the Person class, when it needs to find out information about the link between the two. This will be a lot easier to understand once you see how the bi-directional link between our two entities is created." -msgstr "这意味着在需要的时候,Hibernate 能在关联的另一端 — Person 类得到两个实体间关联的信息。这将会极大地帮助你理解双向关联是如何在两个实体间被创建的。 " +msgid "" +"These are normal set mappings in both mapping documents. " +"Notice that the column names in key and many-to-" +"many swap in both mapping documents. The most important addition " +"here is the inverse=\"true\" attribute in the " +"set element of the Event's collection " +"mapping." +msgstr "" +"如你所见,两个映射文件里都有普通的 set 映射。注意在两个映" +"射文件中,互换了 keymany-to-many 的" +"字段名。这里最重要的是 Event 映射文件里增加了 " +"set 元素的 inverse=\"true\" 属性。 " + +#. Tag: para +#: tutorial.xml:914 +#, no-c-format +msgid "" +"What this means is that Hibernate should take the other side, the " +"Person class, when it needs to find out information about " +"the link between the two. This will be a lot easier to understand once you " +"see how the bi-directional link between our two entities is created." +msgstr "" +"这意味着在需要的时候,Hibernate 能在关联的另一端 — Person " +"类得到两个实体间关联的信息。这将会极大地帮助你理解双向关联是如何在两个实体间" +"被创建的。 " #. Tag: title +#: tutorial.xml:923 #, no-c-format msgid "Working bi-directional links" msgstr "使双向连起来" #. Tag: para +#: tutorial.xml:925 #, no-c-format -msgid "First, keep in mind that Hibernate does not affect normal Java semantics. How did we create a link between a Person and an Event in the unidirectional example? You add an instance of Event to the collection of event references, of an instance of Person. If you want to make this link bi-directional, you have to do the same on the other side by adding a Person reference to the collection in an Event. This process of \"setting the link on both sides\" is absolutely necessary with bi-directional links." -msgstr "首先请记住,Hibernate 并不影响通常的 Java 语义。 在单向关联的例子中,我们是怎样在 PersonEvent 之间创建联系的?我们把 Event 实例添加到 Person 实例内的 event 引用集合里。因此很显然,如果我们要让这个关联可以双向地工作,我们需要在另外一端做同样的事情 - 把 Person 实例加入 Event 类内的 Person 引用集合。这“在关联的两端设置联系”是完全必要的而且你都得这么做。 " +msgid "" +"First, keep in mind that Hibernate does not affect normal Java semantics. " +"How did we create a link between a Person and an " +"Event in the unidirectional example? You add an instance " +"of Event to the collection of event references, of an " +"instance of Person. If you want to make this link bi-" +"directional, you have to do the same on the other side by adding a " +"Person reference to the collection in an Event. This process of \"setting the link on both sides\" is absolutely " +"necessary with bi-directional links." +msgstr "" +"首先请记住,Hibernate 并不影响通常的 Java 语义。 在单向关联的例子中,我们是怎" +"样在 PersonEvent 之间创建联系的?我" +"们把 Event 实例添加到 Person 实例内的 " +"event 引用集合里。因此很显然,如果我们要让这个关联可以双向地工作,我们需要在" +"另外一端做同样的事情 - 把 Person 实例加入 " +"Event 类内的 Person 引用集合。这“在关联的两端设置联系”是完" +"全必要的而且你都得这么做。 " #. Tag: para +#: tutorial.xml:935 #, no-c-format -msgid "Many developers program defensively and create link management methods to correctly set both sides (for example, in Person):" -msgstr "许多开发人员防御式地编程,创建管理关联的方法来保证正确的设置了关联的两端,比如在 Person 里: " +msgid "" +"Many developers program defensively and create link management methods to " +"correctly set both sides (for example, in Person):" +msgstr "" +"许多开发人员防御式地编程,创建管理关联的方法来保证正确的设置了关联的两端,比" +"如在 Person 里: " + +#. Tag: programlisting +#: tutorial.xml:940 +#, fuzzy, no-c-format +msgid "" +"" +msgstr "" +"protected Set getEvents() {\n" +" return events;\n" +"}\n" +"\n" +"protected void setEvents(Set events) {\n" +" this.events = events;\n" +"}\n" +"\n" +"public void addToEvent(Event event) {\n" +" this.getEvents().add(event);\n" +" event.getParticipants().add(this);\n" +"}\n" +"\n" +"public void removeFromEvent(Event event) {\n" +" this.getEvents().remove(event);\n" +" event.getParticipants().remove(this);\n" +"}" #. Tag: para +#: tutorial.xml:942 #, no-c-format -msgid "The get and set methods for the collection are now protected. This allows classes in the same package and subclasses to still access the methods, but prevents everybody else from altering the collections directly. Repeat the steps for the collection on the other side." -msgstr "注意现在对于集合的 get 和 set 方法的访问级别是 protected — 这允许在位于同一个包(package)中的类以及继承自这个类的子类可以访问这些方法,但禁止其他任何人的直接访问,避免了集合内容的混乱。你应尽可能地在另一端也把集合的访问级别设成 protected。 " +msgid "" +"The get and set methods for the collection are now protected. This allows " +"classes in the same package and subclasses to still access the methods, but " +"prevents everybody else from altering the collections directly. Repeat the " +"steps for the collection on the other side." +msgstr "" +"注意现在对于集合的 get 和 set 方法的访问级别是 protected — 这允许在位于同一个" +"包(package)中的类以及继承自这个类的子类可以访问这些方法,但禁止其他任何人的" +"直接访问,避免了集合内容的混乱。你应尽可能地在另一端也把集合的访问级别设成 " +"protected。 " #. Tag: para +#: tutorial.xml:949 #, no-c-format -msgid "What about the inverse mapping attribute? For you, and for Java, a bi-directional link is simply a matter of setting the references on both sides correctly. Hibernate, however, does not have enough information to correctly arrange SQL INSERT and UPDATE statements (to avoid constraint violations). Making one side of the association inverse tells Hibernate to consider it a mirror of the other side. That is all that is necessary for Hibernate to resolve any issues that arise when transforming a directional navigation model to a SQL database schema. The rules are straightforward: all bi-directional associations need one side as inverse. In a one-to-many association it has to be the many-side, and in many-to-many association you can select either side." -msgstr "inverse 映射属性究竟表示什么呢?对于你和 Java 来说,一个双向关联仅仅是在两端简单地正确设置引用。然而,Hibernate 并没有足够的信息去正确地执行 INSERTUPDATE 语句(以避免违反数据库约束),所以它需要一些帮助来正确的处理双向关联。把关联的一端设置为 inverse 将告诉 Hibernate 忽略关联的这一端,把这端看成是另外一端的一个镜象(mirror)。这就是所需的全部信息,Hibernate 利用这些信息来处理把一个有向导航模型转移到数据库 schema 时的所有问题。你只需要记住这个直观的规则:所有的双向关联需要有一端被设置为 inverse。在一对多关联中它必须是代表多(many)的那端。而在多对多(many-to-many)关联中,你可以任意选取一端,因为两端之间并没有差别。 " +msgid "" +"What about the inverse mapping attribute? For you, and " +"for Java, a bi-directional link is simply a matter of setting the references " +"on both sides correctly. Hibernate, however, does not have enough " +"information to correctly arrange SQL INSERT and " +"UPDATE statements (to avoid constraint violations). " +"Making one side of the association inverse tells " +"Hibernate to consider it a mirror of the other side. " +"That is all that is necessary for Hibernate to resolve any issues that arise " +"when transforming a directional navigation model to a SQL database schema. " +"The rules are straightforward: all bi-directional associations need one side " +"as inverse. In a one-to-many association it has to be the " +"many-side, and in many-to-many association you can select either side." +msgstr "" +"inverse 映射属性究竟表示什么呢?对于你和 Java 来说,一个双" +"向关联仅仅是在两端简单地正确设置引用。然而,Hibernate 并没有足够的信息去正确" +"地执行 INSERTUPDATE 语句(以避免违" +"反数据库约束),所以它需要一些帮助来正确的处理双向关联。把关联的一端设置为 " +"inverse 将告诉 Hibernate 忽略关联的这一端,把这端看成是另" +"外一端的一个镜象(mirror)。这就是所需的全部信息," +"Hibernate 利用这些信息来处理把一个有向导航模型转移到数据库 schema 时的所有问" +"题。你只需要记住这个直观的规则:所有的双向关联需要有一端被设置为 " +"inverse。在一对多关联中它必须是代表多(many)的那端。而在" +"多对多(many-to-many)关联中,你可以任意选取一端,因为两端之间并没有差别。 " #. Tag: title +#: tutorial.xml:965 #, no-c-format msgid "Part 3 - The EventManager web application" msgstr "第三部分 - EventManager web 应用程序" #. Tag: para +#: tutorial.xml:967 #, no-c-format -msgid "A Hibernate web application uses Session and Transaction almost like a standalone application. However, some common patterns are useful. You can now write an EventManagerServlet. This servlet can list all events stored in the database, and it provides an HTML form to enter new events." -msgstr "Hibernate web 应用程序使用 SessionTransaction 的方式几乎和独立应用程序是一样的。但是,有一些常见的模式(pattern)非常有用。现在我们编写一个 EventManagerServlet。这个 servlet 可以列出数据库中保存的所有的 events,还提供一个 HTML 表单来增加新的 events。 " +msgid "" +"A Hibernate web application uses Session and " +"Transaction almost like a standalone application. " +"However, some common patterns are useful. You can now write an " +"EventManagerServlet. This servlet can list all events " +"stored in the database, and it provides an HTML form to enter new events." +msgstr "" +"Hibernate web 应用程序使用 Session 和 " +"Transaction 的方式几乎和独立应用程序是一样的。但是,有一些" +"常见的模式(pattern)非常有用。现在我们编写一个 " +"EventManagerServlet。这个 servlet 可以列出数据库中保存的所" +"有的 events,还提供一个 HTML 表单来增加新的 events。 " #. Tag: title +#: tutorial.xml:975 #, no-c-format msgid "Writing the basic servlet" msgstr "编写基本的 servlet" #. Tag: para +#: tutorial.xml:977 #, no-c-format -msgid "First we need create our basic processing servlet. Since our servlet only handles HTTP GET requests, we will only implement the doGet() method:" -msgstr "这个 servlet 只处理 HTTP GET 请求,因此,我们要实现的是 doGet() 方法: " +msgid "" +"First we need create our basic processing servlet. Since our servlet only " +"handles HTTP GET requests, we will only implement the " +"doGet() method:" +msgstr "" +"这个 servlet 只处理 HTTP GET 请求,因此,我们要实现的是 " +"doGet() 方法: " + +#. Tag: programlisting +#: tutorial.xml:983 +#, fuzzy, no-c-format +msgid "" +"" +msgstr "" +"protected void doGet(HttpServletRequest request,\n" +" HttpServletResponse response)\n" +" throws ServletException, IOException {\n" +"\n" +" SimpleDateFormat dateFormatter = new SimpleDateFormat(\"dd.MM.yyyy\");\n" +"\n" +" try {\n" +" // Begin unit of work\n" +" HibernateUtil.getSessionFactory()\n" +" .getCurrentSession().beginTransaction();\n" +"\n" +" // Process request and render page...\n" +"\n" +" // End unit of work\n" +" HibernateUtil.getSessionFactory()\n" +" .getCurrentSession().getTransaction().commit();\n" +"\n" +" } catch (Exception ex) {\n" +" HibernateUtil.getSessionFactory()\n" +" .getCurrentSession().getTransaction().rollback();\n" +" throw new ServletException(ex);\n" +" }\n" +"\n" +"}" #. Tag: para +#: tutorial.xml:985 #, no-c-format -msgid "Save this servlet as src/main/java/org/hibernate/tutorial/web/EventManagerServlet.java" -msgstr "把这个 servlet 保存为 src/main/java/org/hibernate/tutorial/web/EventManagerServlet.java。" +msgid "" +"Save this servlet as src/main/java/org/hibernate/tutorial/web/" +"EventManagerServlet.java" +msgstr "" +"把这个 servlet 保存为 src/main/java/org/hibernate/tutorial/web/" +"EventManagerServlet.java。" #. Tag: para +#: tutorial.xml:990 #, no-c-format -msgid "The pattern applied here is called session-per-request. When a request hits the servlet, a new Hibernate Session is opened through the first call to getCurrentSession() on the SessionFactory. A database transaction is then started. All data access occurs inside a transaction irrespective of whether the data is read or written. Do not use the auto-commit mode in applications." -msgstr "我们称这里应用的模式为每次请求一个 session(session-per-request)。当有请求到达这个 servlet 的时候,通过对 SessionFactory 的第一次调用,打开一个新的 Hibernate Session。然后启动一个数据库事务 — 所有的数据访问都是在事务中进行,不管是读还是写(我们在应用程序中不使用 auto-commit 模式)。 " +msgid "" +"The pattern applied here is called session-per-request. " +"When a request hits the servlet, a new Hibernate Session " +"is opened through the first call to getCurrentSession() " +"on the SessionFactory. A database transaction is then " +"started. All data access occurs inside a transaction irrespective of whether " +"the data is read or written. Do not use the auto-commit mode in applications." +msgstr "" +"我们称这里应用的模式为每次请求一个 session(session-per-request)。当有请求到达这个 servlet 的时候,通过对 SessionFactory 的第一次调用,打开一个新的 Hibernate Session。然" +"后启动一个数据库事务 — 所有的数据访问都是在事务中进行,不管是读还是写(我们在" +"应用程序中不使用 auto-commit 模式)。 " #. Tag: para +#: tutorial.xml:999 #, no-c-format -msgid "Do not use a new Hibernate Session for every database operation. Use one Hibernate Session that is scoped to the whole request. Use getCurrentSession(), so that it is automatically bound to the current Java thread." -msgstr "不要为每次数据库操作都使用一个新的 Hibernate Session。将 Hibernate Session 的范围设置为整个请求。要用 getCurrentSession(),这样它自动会绑定到当前 Java 线程。" +msgid "" +"Do not use a new Hibernate Session " +"for every database operation. Use one Hibernate Session " +"that is scoped to the whole request. Use getCurrentSession(), so that it is automatically bound to the current Java thread." +msgstr "" +"不要为每次数据库操作都使用一个新的 Hibernate " +"Session。将 Hibernate Session 的范围设" +"置为整个请求。要用 getCurrentSession(),这样它自动会绑定到" +"当前 Java 线程。" #. Tag: para +#: tutorial.xml:1006 #, no-c-format -msgid "Next, the possible actions of the request are processed and the response HTML is rendered. We will get to that part soon." -msgstr "下一步,对请求的可能动作进行处理,渲染出反馈的 HTML。我们很快就会涉及到那部分。 " +msgid "" +"Next, the possible actions of the request are processed and the response " +"HTML is rendered. We will get to that part soon." +msgstr "" +"下一步,对请求的可能动作进行处理,渲染出反馈的 HTML。我们很快就会涉及到那部" +"分。 " #. Tag: para +#: tutorial.xml:1011 #, no-c-format -msgid "Finally, the unit of work ends when processing and rendering are complete. If any problems occurred during processing or rendering, an exception will be thrown and the database transaction rolled back. This completes the session-per-request pattern. Instead of the transaction demarcation code in every servlet, you could also write a servlet filter. See the Hibernate website and Wiki for more information about this pattern called Open Session in View. You will need it as soon as you consider rendering your view in JSP, not in a servlet." -msgstr "最后,当处理与渲染都结束的时候,这个工作单元就结束了。假若在处理或渲染的时候有任何错误发生,会抛出一个异常,回滚数据库事务。这样,session-per-request 模式就完成了。为了避免在每个 servlet 中都编写事务边界界定的代码,可以考虑写一个 servlet 过滤器(filter)来更好地解决。关于这一模式的更多信息,请参阅 Hibernate 网站和 Wiki,这一模式叫做 Open Session in View — 只要你考虑用JSP来渲染你的视图(view),而不是在servlet中,你就会很快用到它。 " +msgid "" +"Finally, the unit of work ends when processing and rendering are complete. " +"If any problems occurred during processing or rendering, an exception will " +"be thrown and the database transaction rolled back. This completes the " +"session-per-request pattern. Instead of the transaction " +"demarcation code in every servlet, you could also write a servlet filter. " +"See the Hibernate website and Wiki for more information about this pattern " +"called Open Session in View. You will need it as soon " +"as you consider rendering your view in JSP, not in a servlet." +msgstr "" +"最后,当处理与渲染都结束的时候,这个工作单元就结束了。假若在处理或渲染的时候" +"有任何错误发生,会抛出一个异常,回滚数据库事务。这样,session-per-" +"request 模式就完成了。为了避免在每个 servlet 中都编写事务边界界定的" +"代码,可以考虑写一个 servlet 过滤器(filter)来更好地解决。关于这一模式的更多" +"信息,请参阅 Hibernate 网站和 Wiki,这一模式叫做 Open Session in " +"View — 只要你考虑用JSP来渲染你的视图(view),而不是在servlet中," +"你就会很快用到它。 " #. Tag: title +#: tutorial.xml:1025 #, no-c-format msgid "Processing and rendering" msgstr "处理与渲染" #. Tag: para +#: tutorial.xml:1027 #, no-c-format -msgid "Now you can implement the processing of the request and the rendering of the page." +msgid "" +"Now you can implement the processing of the request and the rendering of the " +"page." msgstr "我们来实现处理请求以及渲染页面的工作。 " -#. Tag: para -#, no-c-format -msgid "This coding style, with a mix of Java and HTML, would not scale in a more complex application—keep in mind that we are only illustrating basic Hibernate concepts in this tutorial. The code prints an HTML header and a footer. Inside this page, an HTML form for event entry and a list of all events in the database are printed. The first method is trivial and only outputs HTML:" -msgstr "必须承认,这种编码风格把 Java 和 HTML 混在一起,在更复杂的应用程序里不应该大量使用 — 记住,在本章里我们仅仅是展示了 Hibernate 的基本概念。这段代码打印出了 HTML 页眉和页脚,在这个页面里,还打印了一个输入 events 条目的表单单并列出了数据库里的有的 events。第一个方法微不足道,仅仅是输出 HTML:" +#. Tag: programlisting +#: tutorial.xml:1031 +#, fuzzy, no-c-format +msgid "" +"Event Manager" +"\");\n" +"\n" +" // Handle actions\n" +" if ( \"store\".equals(request.getParameter(\"action\")) ) {\n" +"\n" +" String eventTitle = request.getParameter(\"eventTitle\");\n" +" String eventDate = request.getParameter(\"eventDate\");\n" +"\n" +" if ( \"\".equals(eventTitle) || \"\".equals(eventDate) ) {\n" +" out.println(\"Please enter event title and date.\");\n" +" }\n" +" else {\n" +" createAndStoreEvent(eventTitle, dateFormatter.parse" +"(eventDate));\n" +" out.println(\"Added event.\");\n" +" }\n" +" }\n" +"\n" +" // Print page\n" +" printEventForm(out);\n" +" listEvents(out, dateFormatter);\n" +"\n" +" // Write HTML footer\n" +" out.println(\"\");\n" +" out.flush();\n" +" out.close();]]>" +msgstr "" +"// Write HTML header\n" +"PrintWriter out = response.getWriter();\n" +"out.println(\"<html><head><title>Event Manager</" +"title></head><body>\");\n" +"\n" +"// Handle actions\n" +"if ( \"store\".equals(request.getParameter(\"action\")) ) {\n" +"\n" +" String eventTitle = request.getParameter(\"eventTitle\");\n" +" String eventDate = request.getParameter(\"eventDate\");\n" +"\n" +" if ( \"\".equals(eventTitle) || \"\".equals(eventDate) ) {\n" +" out.println(\"<b><i>Please enter event title and date." +"</i></b>\");\n" +" } else {\n" +" createAndStoreEvent(eventTitle, dateFormatter.parse(eventDate));\n" +" out.println(\"<b><i>Added event.</i></b>" +"\");\n" +" }\n" +"}\n" +"\n" +"// Print page\n" +"printEventForm(out);\n" +"listEvents(out, dateFormatter);\n" +"\n" +"// Write HTML footer\n" +"out.println(\"</body></html>\");\n" +"out.flush();\n" +"out.close();" #. Tag: para +#: tutorial.xml:1033 #, no-c-format -msgid "The listEvents() method uses the Hibernate Session bound to the current thread to execute a query:" -msgstr "listEvents() 方法使用绑定到当前线程的 Hibernate Session 来执行查询:" +msgid "" +"This coding style, with a mix of Java and HTML, would not scale in a more " +"complex application—keep in mind that we are only illustrating basic " +"Hibernate concepts in this tutorial. The code prints an HTML header and a " +"footer. Inside this page, an HTML form for event entry and a list of all " +"events in the database are printed. The first method is trivial and only " +"outputs HTML:" +msgstr "" +"必须承认,这种编码风格把 Java 和 HTML 混在一起,在更复杂的应用程序里不应该大" +"量使用 — 记住,在本章里我们仅仅是展示了 Hibernate 的基本概念。这段代码打印出" +"了 HTML 页眉和页脚,在这个页面里,还打印了一个输入 events 条目的表单单并列出" +"了数据库里的有的 events。第一个方法微不足道,仅仅是输出 HTML:" + +#. Tag: programlisting +#: tutorial.xml:1042 +#, fuzzy, no-c-format +msgid "" +"Add new event:\");\n" +" out.println(\"
\");\n" +" out.println(\"Title:
" +"\");\n" +" out.println(\"Date (e.g. 24.12.2009):
\");\n" +" out.println(\"" +"\");\n" +" out.println(\"
\");\n" +" }]]>" +msgstr "" +"private void printEventForm(PrintWriter out) {\n" +" out.println(\"<h2>Add new event:</h2>\");\n" +" out.println(\"<form>\");\n" +" out.println(\"Title: <input name='eventTitle' length='50'/><br/" +">\");\n" +" out.println(\"Date (e.g. 24.12.2009): <input name='eventDate' " +"length='10'/><br/>\");\n" +" out.println(\"<input type='submit' name='action' value='store'/>" +"\");\n" +" out.println(\"</form>\");\n" +"}" #. Tag: para +#: tutorial.xml:1044 #, no-c-format -msgid "Finally, the store action is dispatched to the createAndStoreEvent() method, which also uses the Session of the current thread:" -msgstr "最后,store 动作会被导向到 createAndStoreEvent() 方法,它也使用当前线程的 Session:" +msgid "" +"The listEvents() method uses the Hibernate " +"Session bound to the current thread to execute a query:" +msgstr "" +"listEvents() 方法使用绑定到当前线程的 Hibernate " +"Session 来执行查询:" + +#. Tag: programlisting +#: tutorial.xml:1050 +#, fuzzy, no-c-format +msgid "" +" 0) {\n" +" out.println(\"

Events in database:

\");\n" +" out.println(\"\");\n" +" out.println(\"\");\n" +" out.println(\"\");\n" +" out.println(\"\");\n" +" out.println(\"\");\n" +" Iterator it = result.iterator();\n" +" while (it.hasNext()) {\n" +" Event event = (Event) it.next();\n" +" out.println(\"\");\n" +" out.println(\"\");\n" +" out.println(\"\");\n" +" out.println(\"\");\n" +" }\n" +" out.println(\"
Event titleEvent date
\" + event.getTitle() + \"\" + dateFormatter.format(event.getDate()) " +"+ \"
\");\n" +" }\n" +" }]]>" +msgstr "" +"private void listEvents(PrintWriter out, SimpleDateFormat dateFormatter) {\n" +"\n" +" List result = HibernateUtil.getSessionFactory()\n" +" .getCurrentSession().createCriteria(Event.class).list" +"();\n" +" if (result.size() > 0) {\n" +" out.println(\"<h2>Events in database:</h2>\");\n" +" out.println(\"<table border='1'>\");\n" +" out.println(\"<tr>\");\n" +" out.println(\"<th>Event title</th>\");\n" +" out.println(\"<th>Event date</th>\");\n" +" out.println(\"</tr>\");\n" +" for (Iterator it = result.iterator(); it.hasNext();) {\n" +" Event event = (Event) it.next();\n" +" out.println(\"<tr>\");\n" +" out.println(\"<td>\" + event.getTitle() + \"</td>" +"\");\n" +" out.println(\"<td>\" + dateFormatter.format(event.getDate" +"()) + \"</td>\");\n" +" out.println(\"</tr>\");\n" +" }\n" +" out.println(\"</table>\");\n" +" }\n" +"}" #. Tag: para +#: tutorial.xml:1052 #, no-c-format -msgid "The servlet is now complete. A request to the servlet will be processed in a single Session and Transaction. As earlier in the standalone application, Hibernate can automatically bind these objects to the current thread of execution. This gives you the freedom to layer your code and access the SessionFactory in any way you like. Usually you would use a more sophisticated design and move the data access code into data access objects (the DAO pattern). See the Hibernate Wiki for more examples." -msgstr "大功告成,这个 servlet 写完了。Hibernate 会在单一的 SessionTransaction 中处理到达的 servlet 请求。如同在前面的独立应用程序中那样,Hibernate 可以自动的把这些对象绑定到当前运行的线程中。这给了你用任何你喜欢的方式来对代码分层及访问 SessionFactory 的自由。通常,你会用更加完备的设计,把数据访问代码转移到数据访问对象中(DAO 模式)。请参见 Hibernate Wiki,那里有更多的例子。 " +msgid "" +"Finally, the store action is dispatched to the " +"createAndStoreEvent() method, which also uses the " +"Session of the current thread:" +msgstr "" +"最后,store 动作会被导向到 createAndStoreEvent()" +" 方法,它也使用当前线程的 Session:" + +#. Tag: programlisting +#: tutorial.xml:1058 +#, fuzzy, no-c-format +msgid "" +"" +msgstr "" +"protected void createAndStoreEvent(String title, Date theDate) {\n" +" Event theEvent = new Event();\n" +" theEvent.setTitle(title);\n" +" theEvent.setDate(theDate);\n" +"\n" +" HibernateUtil.getSessionFactory()\n" +" .getCurrentSession().save(theEvent);\n" +"}" + +#. Tag: para +#: tutorial.xml:1060 +#, no-c-format +msgid "" +"The servlet is now complete. A request to the servlet will be processed in a " +"single Session and Transaction. As " +"earlier in the standalone application, Hibernate can automatically bind " +"these objects to the current thread of execution. This gives you the freedom " +"to layer your code and access the SessionFactory in any " +"way you like. Usually you would use a more sophisticated design and move the " +"data access code into data access objects (the DAO pattern). See the " +"Hibernate Wiki for more examples." +msgstr "" +"大功告成,这个 servlet 写完了。Hibernate 会在单一的 SessionTransaction 中处理到达的 servlet 请求。如同在" +"前面的独立应用程序中那样,Hibernate 可以自动的把这些对象绑定到当前运行的线程" +"中。这给了你用任何你喜欢的方式来对代码分层及访问 SessionFactory 的自由。通常,你会用更加完备的设计,把数据访问代码转移到数据访问对象" +"中(DAO 模式)。请参见 Hibernate Wiki,那里有更多的例子。 " #. Tag: title +#: tutorial.xml:1074 #, no-c-format msgid "Deploying and testing" msgstr "部署与测试" #. Tag: para +#: tutorial.xml:1076 #, no-c-format -msgid "To deploy this application for testing we must create a Web ARchive (WAR). First we must define the WAR descriptor as src/main/webapp/WEB-INF/web.xml" -msgstr "要部署这个应用程序以进行测试,我们必须出具一个 Web ARchive (WAR)。首先我们必须定义 WAR 描述符为 src/main/webapp/WEB-INF/web.xml。" +msgid "" +"To deploy this application for testing we must create a Web ARchive (WAR). " +"First we must define the WAR descriptor as src/main/webapp/WEB-INF/" +"web.xml" +msgstr "" +"要部署这个应用程序以进行测试,我们必须出具一个 Web ARchive (WAR)。首先我们必" +"须定义 WAR 描述符为 src/main/webapp/WEB-INF/web.xml。" + +#. Tag: programlisting +#: tutorial.xml:1082 +#, fuzzy, no-c-format +msgid "" +"\n" +"\n" +"\n" +" \n" +" Event Manager\n" +" org.hibernate.tutorial.web.EventManagerServlet\n" +" \n" +"\n" +" \n" +" Event Manager\n" +" /eventmanager\n" +" \n" +"]]>" +msgstr "" +"<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n" +"<web-app version=\"2.4\"\n" +" xmlns=\"http://java.sun.com/xml/ns/j2ee\"\n" +" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"\n" +" xsi:schemaLocation=\"http://java.sun.com/xml/ns/j2ee\n" +" http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd\">\n" +"\n" +" <servlet>\n" +" <servlet-name>Event Manager</servlet-name>\n" +" <servlet-class>events.EventManagerServlet</servlet-" +"class>\n" +" </servlet>\n" +"\n" +" <servlet-mapping>\n" +" <servlet-name>Event Manager</servlet-name>\n" +" <url-pattern>/eventmanager</url-pattern>\n" +" </servlet-mapping>\n" +"</web-app>" #. Tag: para +#: tutorial.xml:1084 #, no-c-format -msgid "To build and deploy call mvn package in your project directory and copy the hibernate-tutorial.war file into your Tomcat webapps directory." -msgstr "在你的开发目录中,调用 ant war 来构建、打包,然后把 hibernate-tutorial.war 文件拷贝到你的 tomcat 的 webapps 目录下。假若你还没安装 Tomcat,就去下载一个,按照指南来安装。对此应用的发布,你不需要修改任何 Tomcat 的配置。 " +msgid "" +"To build and deploy call mvn package in your project " +"directory and copy the hibernate-tutorial.war file into " +"your Tomcat webapps directory." +msgstr "" +"在你的开发目录中,调用 ant war 来构建、打包,然后把 " +"hibernate-tutorial.war 文件拷贝到你的 tomcat 的 " +"webapps 目录下。假若你还没安装 Tomcat,就去下载一个,按照" +"指南来安装。对此应用的发布,你不需要修改任何 Tomcat 的配置。 " #. Tag: para -#, no-c-format -msgid "If you do not have Tomcat installed, download it from and follow the installation instructions. Our application requires no changes to the standard Tomcat configuration." -msgstr "如果你还没有安装 Tomcat,请从 下载并按照安装说明进行安装。我们的应用程序不需要对标准的 Tomcat 配置进行修改。 " +#: tutorial.xml:1091 +#, fuzzy, no-c-format +msgid "" +"If you do not have Tomcat installed, download it from and follow the installation instructions. Our " +"application requires no changes to the standard Tomcat configuration." +msgstr "" +"如果你还没有安装 Tomcat,请从 下" +"载并按照安装说明进行安装。我们的应用程序不需要对标准的 Tomcat 配置进行修改。 " #. Tag: para +#: tutorial.xml:1099 #, no-c-format -msgid "Once deployed and Tomcat is running, access the application at http://localhost:8080/hibernate-tutorial/eventmanager. Make sure you watch the Tomcat log to see Hibernate initialize when the first request hits your servlet (the static initializer in HibernateUtil is called) and to get the detailed output if any exceptions occurs." -msgstr "在部署完,启动 Tomcat 之后,通过 http://localhost:8080/hibernate-tutorial/eventmanager 进行访问你的应用,在第一次 servlet 请求发生时,请在 Tomcat log 中确认你看到 Hibernate 被初始化了(HibernateUtil 的静态初始化器被调用),假若有任何异常抛出,也可以看到详细的输出。" +msgid "" +"Once deployed and Tomcat is running, access the application at " +"http://localhost:8080/hibernate-tutorial/eventmanager. " +"Make sure you watch the Tomcat log to see Hibernate initialize when the " +"first request hits your servlet (the static initializer in " +"HibernateUtil is called) and to get the detailed output " +"if any exceptions occurs." +msgstr "" +"在部署完,启动 Tomcat 之后,通过 http://localhost:8080/hibernate-" +"tutorial/eventmanager 进行访问你的应用,在第一次 servlet 请求发生" +"时,请在 Tomcat log 中确认你看到 Hibernate 被初始化了" +"(HibernateUtil 的静态初始化器被调用),假若有任何异常抛" +"出,也可以看到详细的输出。" #. Tag: title +#: tutorial.xml:1112 #, no-c-format msgid "Summary" msgstr "总结" #. Tag: para +#: tutorial.xml:1114 #, no-c-format -msgid "This tutorial covered the basics of writing a simple standalone Hibernate application and a small web application. More tutorials are available from the Hibernate website." -msgstr "本章覆盖了如何编写一个简单独立的 Hibernate 命令行应用程序及小型的 Hibernate web 应用程序的基本要素。更多的教程可以在 website 上找到。" - -#~ msgid "" -#~ "\n" -#~ "\n" -#~ " 4.0.0\n" -#~ "\n" -#~ " org.hibernate.tutorials\n" -#~ " hibernate-tutorial\n" -#~ " 1.0.0-SNAPSHOT\n" -#~ " First Hibernate Tutorial\n" -#~ "\n" -#~ " \n" -#~ " \n" -#~ " ${artifactId}\n" -#~ " \n" -#~ "\n" -#~ " \n" -#~ " \n" -#~ " org.hibernate\n" -#~ " hibernate-core\n" -#~ " \n" -#~ "\n" -#~ " \n" -#~ " \n" -#~ " javax.servlet\n" -#~ " servlet-api\n" -#~ " \n" -#~ "\n" -#~ " \n" -#~ " \n" -#~ " org.slf4j\n" -#~ " slf4j-simple\n" -#~ " \n" -#~ "\n" -#~ " \n" -#~ " \n" -#~ " javassist\n" -#~ " javassist\n" -#~ " \n" -#~ " \n" -#~ "\n" -#~ "]]>" -#~ msgstr "" -#~ "\n" -#~ "\n" -#~ " 4.0.0\n" -#~ "\n" -#~ " org.hibernate.tutorials\n" -#~ " hibernate-tutorial\n" -#~ " 1.0.0-SNAPSHOT\n" -#~ " First Hibernate Tutorial\n" -#~ "\n" -#~ " \n" -#~ " \n" -#~ " ${artifactId}\n" -#~ " \n" -#~ "\n" -#~ " \n" -#~ " \n" -#~ " org.hibernate\n" -#~ " hibernate-core\n" -#~ " \n" -#~ "\n" -#~ " \n" -#~ " \n" -#~ " javax.servlet\n" -#~ " servlet-api\n" -#~ " \n" -#~ "\n" -#~ " \n" -#~ " \n" -#~ " org.slf4j\n" -#~ " slf4j-simple\n" -#~ " \n" -#~ "\n" -#~ " \n" -#~ " \n" -#~ " javassist\n" -#~ " javassist\n" -#~ " \n" -#~ " \n" -#~ "\n" -#~ "]]>" -#~ msgid "" -#~ "" -#~ msgstr "" -#~ "" -#~ msgid "" -#~ "\n" -#~ "\n" -#~ "\n" -#~ "\n" -#~ "[...]\n" -#~ "]]>" -#~ msgstr "" -#~ "\n" -#~ "\n" -#~ "\n" -#~ "\n" -#~ "[...]\n" -#~ "]]>" -#~ msgid "" -#~ "\n" -#~ "\n" -#~ " \n" -#~ "\n" -#~ " \n" -#~ "\n" -#~ "]]>" -#~ msgstr "" -#~ "\n" -#~ "\n" -#~ " \n" -#~ "\n" -#~ " \n" -#~ "\n" -#~ "]]>" -#~ msgid "" -#~ "\n" -#~ "\n" -#~ " \n" -#~ " \n" -#~ " \n" -#~ " \n" -#~ " \n" -#~ "\n" -#~ "]]>" -#~ msgstr "" -#~ "\n" -#~ "\n" -#~ " \n" -#~ " \n" -#~ " \n" -#~ " \n" -#~ " \n" -#~ "\n" -#~ "]]>" -#~ msgid "" -#~ "\n" -#~ "\n" -#~ " \n" -#~ " \n" -#~ " \n" -#~ " \n" -#~ " \n" -#~ " \n" -#~ " \n" -#~ "\n" -#~ "]]>" -#~ msgstr "" -#~ "\n" -#~ "\n" -#~ " \n" -#~ " \n" -#~ " \n" -#~ " \n" -#~ " \n" -#~ " \n" -#~ " \n" -#~ "\n" -#~ "]]>" -#~ msgid "" -#~ "\n" -#~ "\n" -#~ "\n" -#~ "\n" -#~ "\n" -#~ " \n" -#~ "\n" -#~ " \n" -#~ " org.hsqldb.jdbcDriver\n" -#~ " jdbc:hsqldb:hsql://localhost\n" -#~ " sa\n" -#~ " \n" -#~ "\n" -#~ " \n" -#~ " 1\n" -#~ "\n" -#~ " \n" -#~ " org.hibernate.dialect.HSQLDialect\n" -#~ "\n" -#~ " \n" -#~ " thread\n" -#~ "\n" -#~ " \n" -#~ " org.hibernate.cache." -#~ "NoCacheProvider\n" -#~ "\n" -#~ " \n" -#~ " true\n" -#~ "\n" -#~ " \n" -#~ " update\n" -#~ "\n" -#~ " \n" -#~ "\n" -#~ " \n" -#~ "\n" -#~ "]]>" -#~ msgstr "" -#~ "\n" -#~ "\n" -#~ "\n" -#~ "\n" -#~ "\n" -#~ " \n" -#~ "\n" -#~ " \n" -#~ " org.hsqldb.jdbcDriver\n" -#~ " jdbc:hsqldb:hsql://localhost\n" -#~ " sa\n" -#~ " \n" -#~ "\n" -#~ " \n" -#~ " 1\n" -#~ "\n" -#~ " \n" -#~ " org.hibernate.dialect.HSQLDialect\n" -#~ "\n" -#~ " \n" -#~ " thread\n" -#~ "\n" -#~ " \n" -#~ " org.hibernate.cache." -#~ "NoCacheProvider\n" -#~ "\n" -#~ " \n" -#~ " true\n" -#~ "\n" -#~ " \n" -#~ " update\n" -#~ "\n" -#~ " \n" -#~ "\n" -#~ " \n" -#~ "\n" -#~ "]]>" - -#, fuzzy -#~ msgid "" -#~ "" -#~ msgstr "" -#~ "package util;\n" -#~ "\n" -#~ "import org.hibernate.*;\n" -#~ "import org.hibernate.cfg.*;\n" -#~ "\n" -#~ "public class HibernateUtil {\n" -#~ "\n" -#~ " private static final SessionFactory sessionFactory;\n" -#~ "\n" -#~ " static {\n" -#~ " try {\n" -#~ " // Create the SessionFactory from hibernate.cfg.xml\n" -#~ " sessionFactory = new Configuration().configure()." -#~ "buildSessionFactory();\n" -#~ " } catch (Throwable ex) {\n" -#~ " // Make sure you log the exception, as it might be swallowed\n" -#~ " System.err.println(\"Initial SessionFactory creation failed." -#~ "\" + ex);\n" -#~ " throw new ExceptionInInitializerError(ex);\n" -#~ " }\n" -#~ " }\n" -#~ "\n" -#~ " public static SessionFactory getSessionFactory() {\n" -#~ " return sessionFactory;\n" -#~ " }\n" -#~ "\n" -#~ "}" - -#, fuzzy -#~ msgid "" -#~ "" -#~ msgstr "" -#~ "package events;\n" -#~ "import org.hibernate.Session;\n" -#~ "\n" -#~ "import java.util.Date;\n" -#~ "\n" -#~ "import util.HibernateUtil;\n" -#~ "\n" -#~ "public class EventManager {\n" -#~ "\n" -#~ " public static void main(String[] args) {\n" -#~ " EventManager mgr = new EventManager();\n" -#~ "\n" -#~ " if (args[0].equals(\"store\")) {\n" -#~ " mgr.createAndStoreEvent(\"My Event\", new Date());\n" -#~ " }\n" -#~ "\n" -#~ " HibernateUtil.getSessionFactory().close();\n" -#~ " }\n" -#~ "\n" -#~ " private void createAndStoreEvent(String title, Date theDate) {\n" -#~ "\n" -#~ " Session session = HibernateUtil.getSessionFactory()." -#~ "getCurrentSession();\n" -#~ "\n" -#~ " session.beginTransaction();\n" -#~ "\n" -#~ " Event theEvent = new Event();\n" -#~ " theEvent.setTitle(title);\n" -#~ " theEvent.setDate(theDate);\n" -#~ "\n" -#~ " session.save(theEvent);\n" -#~ "\n" -#~ " session.getTransaction().commit();\n" -#~ " }\n" -#~ "\n" -#~ "}" - -#, fuzzy -#~ msgid "" -#~ "" -#~ msgstr "" -#~ "[java] Hibernate: insert into EVENTS (EVENT_DATE, title, EVENT_ID) values " -#~ "(?, ?, ?)" - -#, fuzzy -#~ msgid "" -#~ "" -#~ msgstr "" -#~ "if (args[0].equals(\"store\")) {\n" -#~ " mgr.createAndStoreEvent(\"My Event\", new Date());\n" -#~ "}\n" -#~ "else if (args[0].equals(\"list\")) {\n" -#~ " List events = mgr.listEvents();\n" -#~ " for (int i = 0; i < events.size(); i++) {\n" -#~ " Event theEvent = (Event) events.get(i);\n" -#~ " System.out.println(\"Event: \" + theEvent.getTitle() +\n" -#~ " \" Time: \" + theEvent.getDate());\n" -#~ " }\n" -#~ "}" - -#, fuzzy -#~ msgid "" -#~ "" -#~ msgstr "" -#~ "private List listEvents() {\n" -#~ "\n" -#~ " Session session = HibernateUtil.getSessionFactory().getCurrentSession" -#~ "();\n" -#~ "\n" -#~ " session.beginTransaction();\n" -#~ "\n" -#~ " List result = session.createQuery(\"from Event\").list();\n" -#~ "\n" -#~ " session.getTransaction().commit();\n" -#~ "\n" -#~ " return result;\n" -#~ "}" - -#, fuzzy -#~ msgid "" -#~ "" -#~ msgstr "" -#~ "package events;\n" -#~ "\n" -#~ "public class Person {\n" -#~ "\n" -#~ " private Long id;\n" -#~ " private int age;\n" -#~ " private String firstname;\n" -#~ " private String lastname;\n" -#~ "\n" -#~ " public Person() {}\n" -#~ "\n" -#~ " // Accessor methods for all properties, private setter for 'id'\n" -#~ "\n" -#~ "}" - -#, fuzzy -#~ msgid "" -#~ "\n" -#~ "\n" -#~ " \n" -#~ " \n" -#~ " \n" -#~ " \n" -#~ " \n" -#~ " \n" -#~ " \n" -#~ " \n" -#~ "\n" -#~ "]]>" -#~ msgstr "" -#~ "<hibernate-mapping>\n" -#~ "\n" -#~ " <class name=\"events.Person\" table=\"PERSON\">\n" -#~ " <id name=\"id\" column=\"PERSON_ID\">\n" -#~ " <generator class=\"native\"/>\n" -#~ " </id>\n" -#~ " <property name=\"age\"/>\n" -#~ " <property name=\"firstname\"/>\n" -#~ " <property name=\"lastname\"/>\n" -#~ " </class>\n" -#~ "\n" -#~ "</hibernate-mapping>" - -#, fuzzy -#~ msgid "" -#~ "\n" -#~ "]]>" -#~ msgstr "" -#~ "<mapping resource=\"events/Event.hbm.xml\"/>\n" -#~ "<mapping resource=\"events/Person.hbm.xml\"/>" - -#, fuzzy -#~ msgid "" -#~ "" -#~ msgstr "" -#~ "public class Person {\n" -#~ "\n" -#~ " private Set events = new HashSet();\n" -#~ "\n" -#~ " public Set getEvents() {\n" -#~ " return events;\n" -#~ " }\n" -#~ "\n" -#~ " public void setEvents(Set events) {\n" -#~ " this.events = events;\n" -#~ " }\n" -#~ "}" - -#, fuzzy -#~ msgid "" -#~ "\n" -#~ " \n" -#~ " \n" -#~ " \n" -#~ " \n" -#~ " \n" -#~ " \n" -#~ "\n" -#~ " \n" -#~ " \n" -#~ " \n" -#~ " \n" -#~ "\n" -#~ "]]>" -#~ msgstr "" -#~ "<class name=\"events.Person\" table=\"PERSON\">\n" -#~ " <id name=\"id\" column=\"PERSON_ID\">\n" -#~ " <generator class=\"native\"/>\n" -#~ " </id>\n" -#~ " <property name=\"age\"/>\n" -#~ " <property name=\"firstname\"/>\n" -#~ " <property name=\"lastname\"/>\n" -#~ "\n" -#~ " <set name=\"events\" table=\"PERSON_EVENT\">\n" -#~ " <key column=\"PERSON_ID\"/>\n" -#~ " <many-to-many column=\"EVENT_ID\" class=\"events.Event\"/>\n" -#~ " </set>\n" -#~ "\n" -#~ "</class>" - -#, fuzzy -#~ msgid "" -#~ " | *EVENT_ID | | |\n" -#~ " | EVENT_DATE | | *PERSON_ID | <--> | *PERSON_ID |\n" -#~ " | TITLE | |__________________| | AGE |\n" -#~ " |_____________| | FIRSTNAME |\n" -#~ " | LASTNAME |\n" -#~ " |_____________|\n" -#~ " ]]>" -#~ msgstr "" -#~ "_____________ __________________\n" -#~ " | | | | _____________\n" -#~ " | EVENTS | | PERSON_EVENT | | |\n" -#~ " |_____________| |__________________| | PERSON |\n" -#~ " | | | | |_____________|\n" -#~ " | *EVENT_ID | <--> | *EVENT_ID | | |\n" -#~ " | EVENT_DATE | | *PERSON_ID | <--> | *PERSON_ID |\n" -#~ " | TITLE | |__________________| | AGE |\n" -#~ " |_____________| | FIRSTNAME |\n" -#~ " | LASTNAME |\n" -#~ " |_____________|" - -#, fuzzy -#~ msgid "" -#~ "" -#~ msgstr "" -#~ "private void addPersonToEvent(Long personId, Long eventId) {\n" -#~ "\n" -#~ " Session session = HibernateUtil.getSessionFactory().getCurrentSession" -#~ "();\n" -#~ " session.beginTransaction();\n" -#~ "\n" -#~ " Person aPerson = (Person) session.load(Person.class, personId);\n" -#~ " Event anEvent = (Event) session.load(Event.class, eventId);\n" -#~ "\n" -#~ " aPerson.getEvents().add(anEvent);\n" -#~ "\n" -#~ " session.getTransaction().commit();\n" -#~ "}" - -#, fuzzy -#~ msgid "" -#~ "" -#~ msgstr "" -#~ "private void addPersonToEvent(Long personId, Long eventId) {\n" -#~ "\n" -#~ " Session session = HibernateUtil.getSessionFactory().getCurrentSession" -#~ "();\n" -#~ " session.beginTransaction();\n" -#~ "\n" -#~ " Person aPerson = (Person) session\n" -#~ " .createQuery(\"select p from Person p left join fetch p." -#~ "events where p.id = :pid\")\n" -#~ " .setParameter(\"pid\", personId)\n" -#~ " .uniqueResult(); // Eager fetch the collection so we can use " -#~ "it detached\n" -#~ "\n" -#~ " Event anEvent = (Event) session.load(Event.class, eventId);\n" -#~ "\n" -#~ " session.getTransaction().commit();\n" -#~ "\n" -#~ " // End of first unit of work\n" -#~ "\n" -#~ " aPerson.getEvents().add(anEvent); // aPerson (and its collection) is " -#~ "detached\n" -#~ "\n" -#~ " // Begin second unit of work\n" -#~ "\n" -#~ " Session session2 = HibernateUtil.getSessionFactory().getCurrentSession" -#~ "();\n" -#~ " session2.beginTransaction();\n" -#~ "\n" -#~ " session2.update(aPerson); // Reattachment of aPerson\n" -#~ "\n" -#~ " session2.getTransaction().commit();\n" -#~ "}" - -#, fuzzy -#~ msgid "" -#~ "" -#~ msgstr "" -#~ "else if (args[0].equals(\"addpersontoevent\")) {\n" -#~ " Long eventId = mgr.createAndStoreEvent(\"My Event\", new Date());\n" -#~ " Long personId = mgr.createAndStorePerson(\"Foo\", \"Bar\");\n" -#~ " mgr.addPersonToEvent(personId, eventId);\n" -#~ " System.out.println(\"Added person \" + personId + \" to event \" + " -#~ "eventId);\n" -#~ "}" - -#, fuzzy -#~ msgid "" -#~ "" -#~ msgstr "" -#~ "private Set emailAddresses = new HashSet();\n" -#~ "\n" -#~ "public Set getEmailAddresses() {\n" -#~ " return emailAddresses;\n" -#~ "}\n" -#~ "\n" -#~ "public void setEmailAddresses(Set emailAddresses) {\n" -#~ " this.emailAddresses = emailAddresses;\n" -#~ "}" - -#, fuzzy -#~ msgid "" -#~ "\n" -#~ " \n" -#~ " \n" -#~ " ]]>" -#~ msgstr "" -#~ "<set name=\"emailAddresses\" table=\"PERSON_EMAIL_ADDR\">\n" -#~ " <key column=\"PERSON_ID\"/>\n" -#~ " <element type=\"string\" column=\"EMAIL_ADDR\"/>\n" -#~ "</set>" - -#, fuzzy -#~ msgid "" -#~ " | *EVENT_ID | | | |" -#~ "___________________|\n" -#~ " | EVENT_DATE | | *PERSON_ID | <--> | *PERSON_ID | <--> | " -#~ "*PERSON_ID |\n" -#~ " | TITLE | |__________________| | AGE | | " -#~ "*EMAIL_ADDR |\n" -#~ " |_____________| | FIRSTNAME | |" -#~ "___________________|\n" -#~ " | LASTNAME |\n" -#~ " |_____________|\n" -#~ " ]]>" -#~ msgstr "" -#~ "_____________ __________________\n" -#~ " | | | | _____________\n" -#~ " | EVENTS | | PERSON_EVENT | | | " -#~ "___________________\n" -#~ " |_____________| |__________________| | PERSON | " -#~ "| |\n" -#~ " | | | | |_____________| | " -#~ "PERSON_EMAIL_ADDR |\n" -#~ " | *EVENT_ID | <--> | *EVENT_ID | | " -#~ "| |___________________|\n" -#~ " | EVENT_DATE | | *PERSON_ID | <--> | *PERSON_ID | " -#~ "<--> | *PERSON_ID |\n" -#~ " | TITLE | |__________________| | AGE | | " -#~ "*EMAIL_ADDR |\n" -#~ " |_____________| | FIRSTNAME | |" -#~ "___________________|\n" -#~ " | LASTNAME |\n" -#~ " |_____________|" - -#, fuzzy -#~ msgid "" -#~ "" -#~ msgstr "" -#~ "private void addEmailToPerson(Long personId, String emailAddress) {\n" -#~ "\n" -#~ " Session session = HibernateUtil.getSessionFactory().getCurrentSession" -#~ "();\n" -#~ " session.beginTransaction();\n" -#~ "\n" -#~ " Person aPerson = (Person) session.load(Person.class, personId);\n" -#~ "\n" -#~ " // The getEmailAddresses() might trigger a lazy load of the " -#~ "collection\n" -#~ " aPerson.getEmailAddresses().add(emailAddress);\n" -#~ "\n" -#~ " session.getTransaction().commit();\n" -#~ "}" - -#, fuzzy -#~ msgid "" -#~ "" -#~ msgstr "" -#~ "private Set participants = new HashSet();\n" -#~ "\n" -#~ "public Set getParticipants() {\n" -#~ " return participants;\n" -#~ "}\n" -#~ "\n" -#~ "public void setParticipants(Set participants) {\n" -#~ " this.participants = participants;\n" -#~ "}" - -#, fuzzy -#~ msgid "" -#~ "\n" -#~ " \n" -#~ " \n" -#~ " ]]>" -#~ msgstr "" -#~ "<set name=\"participants\" table=\"PERSON_EVENT\" inverse=\"true" -#~ "\">\n" -#~ " <key column=\"EVENT_ID\"/>\n" -#~ " <many-to-many column=\"PERSON_ID\" class=\"events.Person\"/>\n" -#~ "</set>" - -#, fuzzy -#~ msgid "" -#~ "" -#~ msgstr "" -#~ "protected Set getEvents() {\n" -#~ " return events;\n" -#~ "}\n" -#~ "\n" -#~ "protected void setEvents(Set events) {\n" -#~ " this.events = events;\n" -#~ "}\n" -#~ "\n" -#~ "public void addToEvent(Event event) {\n" -#~ " this.getEvents().add(event);\n" -#~ " event.getParticipants().add(this);\n" -#~ "}\n" -#~ "\n" -#~ "public void removeFromEvent(Event event) {\n" -#~ " this.getEvents().remove(event);\n" -#~ " event.getParticipants().remove(this);\n" -#~ "}" - -#, fuzzy -#~ msgid "" -#~ "" -#~ msgstr "" -#~ "protected void doGet(HttpServletRequest request,\n" -#~ " HttpServletResponse response)\n" -#~ " throws ServletException, IOException {\n" -#~ "\n" -#~ " SimpleDateFormat dateFormatter = new SimpleDateFormat(\"dd.MM.yyyy" -#~ "\");\n" -#~ "\n" -#~ " try {\n" -#~ " // Begin unit of work\n" -#~ " HibernateUtil.getSessionFactory()\n" -#~ " .getCurrentSession().beginTransaction();\n" -#~ "\n" -#~ " // Process request and render page...\n" -#~ "\n" -#~ " // End unit of work\n" -#~ " HibernateUtil.getSessionFactory()\n" -#~ " .getCurrentSession().getTransaction().commit();\n" -#~ "\n" -#~ " } catch (Exception ex) {\n" -#~ " HibernateUtil.getSessionFactory()\n" -#~ " .getCurrentSession().getTransaction().rollback();\n" -#~ " throw new ServletException(ex);\n" -#~ " }\n" -#~ "\n" -#~ "}" - -#, fuzzy -#~ msgid "" -#~ "Event Manager\");\n" -#~ "\n" -#~ " // Handle actions\n" -#~ " if ( \"store\".equals(request.getParameter(\"action\")) ) {\n" -#~ "\n" -#~ " String eventTitle = request.getParameter(\"eventTitle\");\n" -#~ " String eventDate = request.getParameter(\"eventDate\");\n" -#~ "\n" -#~ " if ( \"\".equals(eventTitle) || \"\".equals(eventDate) ) {\n" -#~ " out.println(\"Please enter event title and date.\");\n" -#~ " }\n" -#~ " else {\n" -#~ " createAndStoreEvent(eventTitle, dateFormatter.parse" -#~ "(eventDate));\n" -#~ " out.println(\"Added event.\");\n" -#~ " }\n" -#~ " }\n" -#~ "\n" -#~ " // Print page\n" -#~ " printEventForm(out);\n" -#~ " listEvents(out, dateFormatter);\n" -#~ "\n" -#~ " // Write HTML footer\n" -#~ " out.println(\"\");\n" -#~ " out.flush();\n" -#~ " out.close();]]>" -#~ msgstr "" -#~ "// Write HTML header\n" -#~ "PrintWriter out = response.getWriter();\n" -#~ "out.println(\"<html><head><title>Event Manager</" -#~ "title></head><body>\");\n" -#~ "\n" -#~ "// Handle actions\n" -#~ "if ( \"store\".equals(request.getParameter(\"action\")) ) {\n" -#~ "\n" -#~ " String eventTitle = request.getParameter(\"eventTitle\");\n" -#~ " String eventDate = request.getParameter(\"eventDate\");\n" -#~ "\n" -#~ " if ( \"\".equals(eventTitle) || \"\".equals(eventDate) ) {\n" -#~ " out.println(\"<b><i>Please enter event title and date." -#~ "</i></b>\");\n" -#~ " } else {\n" -#~ " createAndStoreEvent(eventTitle, dateFormatter.parse(eventDate));\n" -#~ " out.println(\"<b><i>Added event.</i></b>" -#~ "\");\n" -#~ " }\n" -#~ "}\n" -#~ "\n" -#~ "// Print page\n" -#~ "printEventForm(out);\n" -#~ "listEvents(out, dateFormatter);\n" -#~ "\n" -#~ "// Write HTML footer\n" -#~ "out.println(\"</body></html>\");\n" -#~ "out.flush();\n" -#~ "out.close();" - -#, fuzzy -#~ msgid "" -#~ "Add new event:\");\n" -#~ " out.println(\"
\");\n" -#~ " out.println(\"Title:
" -#~ "\");\n" -#~ " out.println(\"Date (e.g. 24.12.2009):
\");\n" -#~ " out.println(\"" -#~ "\");\n" -#~ " out.println(\"
\");\n" -#~ " }]]>" -#~ msgstr "" -#~ "private void printEventForm(PrintWriter out) {\n" -#~ " out.println(\"<h2>Add new event:</h2>\");\n" -#~ " out.println(\"<form>\");\n" -#~ " out.println(\"Title: <input name='eventTitle' length='50'/><" -#~ "br/>\");\n" -#~ " out.println(\"Date (e.g. 24.12.2009): <input name='eventDate' " -#~ "length='10'/><br/>\");\n" -#~ " out.println(\"<input type='submit' name='action' value='store'/>" -#~ "\");\n" -#~ " out.println(\"</form>\");\n" -#~ "}" - -#, fuzzy -#~ msgid "" -#~ " 0) {\n" -#~ " out.println(\"

Events in database:

\");\n" -#~ " out.println(\"\");\n" -#~ " out.println(\"\");\n" -#~ " out.println(\"\");\n" -#~ " out.println(\"\");\n" -#~ " out.println(\"\");\n" -#~ " Iterator it = result.iterator();\n" -#~ " while (it.hasNext()) {\n" -#~ " Event event = (Event) it.next();\n" -#~ " out.println(\"\");\n" -#~ " out.println(\"\");\n" -#~ " out.println(\"\");\n" -#~ " out.println(\"\");\n" -#~ " }\n" -#~ " out.println(\"
Event titleEvent date
\" + event.getTitle() + \"\" + dateFormatter.format(event.getDate" -#~ "()) + \"
\");\n" -#~ " }\n" -#~ " }]]>" -#~ msgstr "" -#~ "private void listEvents(PrintWriter out, SimpleDateFormat dateFormatter) " -#~ "{\n" -#~ "\n" -#~ " List result = HibernateUtil.getSessionFactory()\n" -#~ " .getCurrentSession().createCriteria(Event.class).list" -#~ "();\n" -#~ " if (result.size() > 0) {\n" -#~ " out.println(\"<h2>Events in database:</h2>\");\n" -#~ " out.println(\"<table border='1'>\");\n" -#~ " out.println(\"<tr>\");\n" -#~ " out.println(\"<th>Event title</th>\");\n" -#~ " out.println(\"<th>Event date</th>\");\n" -#~ " out.println(\"</tr>\");\n" -#~ " for (Iterator it = result.iterator(); it.hasNext();) {\n" -#~ " Event event = (Event) it.next();\n" -#~ " out.println(\"<tr>\");\n" -#~ " out.println(\"<td>\" + event.getTitle() + \"</td>" -#~ "\");\n" -#~ " out.println(\"<td>\" + dateFormatter.format(event." -#~ "getDate()) + \"</td>\");\n" -#~ " out.println(\"</tr>\");\n" -#~ " }\n" -#~ " out.println(\"</table>\");\n" -#~ " }\n" -#~ "}" - -#, fuzzy -#~ msgid "" -#~ "" -#~ msgstr "" -#~ "protected void createAndStoreEvent(String title, Date theDate) {\n" -#~ " Event theEvent = new Event();\n" -#~ " theEvent.setTitle(title);\n" -#~ " theEvent.setDate(theDate);\n" -#~ "\n" -#~ " HibernateUtil.getSessionFactory()\n" -#~ " .getCurrentSession().save(theEvent);\n" -#~ "}" - -#, fuzzy -#~ msgid "" -#~ "\n" -#~ "\n" -#~ "\n" -#~ " \n" -#~ " Event Manager\n" -#~ " org.hibernate.tutorial.web.EventManagerServlet\n" -#~ " \n" -#~ "\n" -#~ " \n" -#~ " Event Manager\n" -#~ " /eventmanager\n" -#~ " \n" -#~ "]]>" -#~ msgstr "" -#~ "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n" -#~ "<web-app version=\"2.4\"\n" -#~ " xmlns=\"http://java.sun.com/xml/ns/j2ee\"\n" -#~ " xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"\n" -#~ " xsi:schemaLocation=\"http://java.sun.com/xml/ns/j2ee\n" -#~ " http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd\">\n" -#~ "\n" -#~ " <servlet>\n" -#~ " <servlet-name>Event Manager</servlet-name>\n" -#~ " <servlet-class>events.EventManagerServlet</servlet-" -#~ "class>\n" -#~ " </servlet>\n" -#~ "\n" -#~ " <servlet-mapping>\n" -#~ " <servlet-name>Event Manager</servlet-name>\n" -#~ " <url-pattern>/eventmanager</url-pattern>\n" -#~ " </servlet-mapping>\n" -#~ "</web-app>" - +msgid "" +"This tutorial covered the basics of writing a simple standalone Hibernate " +"application and a small web application. More tutorials are available from " +"the Hibernate website." +msgstr "" +"本章覆盖了如何编写一个简单独立的 Hibernate 命令行应用程序及小型的 Hibernate " +"web 应用程序的基本要素。更多的教程可以在 website 上找到。"