|
Hibernate example source code file (tutorial.po)
This example Hibernate source code file (tutorial.po) is included in the DevDaily.com
"Java Source Code
Warehouse" project. The intent of this project is to help you "Learn Java by Example" TM.
The Hibernate tutorial.po source code
# translation of Collection_Mapping.po to
# Xi HUANG <xhuang@redhat.com>, 2007, 2009, 2010.
msgid ""
msgstr ""
"Project-Id-Version: Collection_Mapping\n"
"Report-Msgid-Bugs-To: http://bugs.kde.org\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 <xhuang@redhat.com>\n"
"Language-Team: <en@li.org>\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"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 <filename>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 "
"<filename>tutorial/eg project source directory."
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 "
"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 <ulink url=\"http://hsqldb.org/\">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 <ulink url=\"http://maven.org\">Maven. Maven, in particular, has "
"a good resource describing this <ulink url=\"http://maven.apache.org/guides/"
"introduction/introduction-to-the-standard-directory-layout.html\">layout</"
"ulink>. As this tutorial is to be a web application, we will be creating and "
"making use of <filename>src/main/java, src/main/"
"resources</filename> 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: programlisting
#: tutorial.xml:97
#, no-c-format
msgid ""
"<![CDATA[\n"
"\n"
" <groupId>org.hibernate.tutorials\n"
" <artifactId>hibernate-tutorial\n"
" <version>1.0.0-SNAPSHOT\n"
" <name>First Hibernate Tutorial\n"
"\n"
" <build>\n"
" <!-- we dont want the version to be part of the generated war file "
"name -->\n"
" <finalName>${artifactId}\n"
" </build>\n"
"\n"
" <dependencies>\n"
" <dependency>\n"
" <groupId>org.hibernate\n"
" <artifactId>hibernate-core\n"
" </dependency>\n"
"\n"
" <!-- Because this is a web app, we also have a dependency on the "
"servlet api. -->\n"
" <dependency>\n"
" <groupId>javax.servlet\n"
" <artifactId>servlet-api\n"
" </dependency>\n"
"\n"
" <!-- Hibernate uses slf4j for logging, for our purposes here use the "
"simple backend -->\n"
" <dependency>\n"
" <groupId>org.slf4j\n"
" <artifactId>slf4j-simple\n"
" </dependency>\n"
"\n"
" <!-- Hibernate gives you a choice of bytecode providers between "
"cglib and javassist -->\n"
" <dependency>\n"
" <groupId>javassist\n"
" <artifactId>javassist\n"
" </dependency>\n"
" </dependencies>\n"
"\n"
"</project>]]>"
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 <ulink url=\"http://ant.apache.org/"
"ivy/\">Ivy</ulink> providing transitive dependency management you would "
"still use the dependencies mentioned below. Otherwise, you'd need to grab "
"<emphasis>all dependencies, both explicit and transitive, and add "
"them to the project's classpath. If working from the Hibernate distribution "
"bundle, this would mean <filename>hibernate3.jar, all artifacts "
"in the <filename>lib/required directory and all files from either "
"the <filename>lib/bytecode/cglib or lib/bytecode/"
"javassist</filename> 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 <filename>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 ""
"<![CDATA[package org.hibernate.tutorial.domain;\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"
"}]]>"
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 "
"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 ""
"ã”覧ã®ã¨ãŠã‚Šã€ã“ã®ã‚¯ãƒ©ã‚¹ã¯ãƒ•ã‚£ãƒ¼ãƒ«ãƒ‰ãŒ private ã®å¯è¦–性をæŒã£ã¦ã„ã‚‹ã®ã¨åŒæ™‚"
"ã«ã€ JavaBean 標準ã®ã‚²ãƒƒã‚¿ãƒ¼ã€ã‚»ãƒƒã‚¿ãƒ¼ãƒ¡ã‚½ãƒƒãƒ‰ã®å‘½åè¦ç´„ã«å¾“ã£ã¦ã„ã¾ã™ã€‚ã“ã®"
"よã†ãªè¨è¨ˆã¯æŽ¨å¥¨ã•ã‚Œã¦ã„ã¾ã™ãŒå¿…é ˆã§ã¯ã‚ã‚Šã¾ã›ã‚“。アクセサメソッドをè¨ã‘ã‚‹ã®"
"ã¯ãƒªãƒ•ã‚¡ã‚¯ã‚¿ãƒªãƒ³ã‚°ã‚’考ãˆãŸé ‘å¥æ€§ã®ãŸã‚ã§ã€ Hibernate ã¯ãƒ•ã‚£ãƒ¼ãƒ«ãƒ‰ã«ç›´æŽ¥ã‚¢ã‚¯ã‚»"
"スã™ã‚‹ã“ã¨ã‚‚å¯èƒ½ã§ã™ã€‚引数ã®ãªã„コンストラクタã¯ã€ãƒªãƒ•ãƒ¬ã‚¯ã‚·ãƒ§ãƒ³ã§ã“ã®ã‚¯ãƒ©ã‚¹"
"ã®ã‚¤ãƒ³ã‚¹ã‚¿ãƒ³ã‚¹ã‚’作æˆã™ã‚‹ãŸã‚ã«å¿…è¦ã§ã™ã€‚"
#. Tag: para
#: tutorial.xml:141
#, no-c-format
msgid ""
"The <literal>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 ""
"<literal>id プãƒãƒ‘ティã¯ã€ã‚る特定ã®ã‚¤ãƒ™ãƒ³ãƒˆã«å¯¾ã™ã‚‹ãƒ¦ãƒ‹ãƒ¼ã‚¯ãªè˜åˆ¥"
"åã®å€¤ã‚’ä¿æŒã—ã¾ã™ã€‚ Hibernate ã®å®Œå…¨ãªæ©Ÿèƒ½ã‚’使ã„ãŸã‘ã‚Œã°ã€ã™ã¹ã¦ã®æ°¸ç¶šã‚¨ãƒ³"
"ティティクラス (ãã‚Œã»ã©é‡è¦ã§ã¯ãªã„ä¾å˜ã‚¯ãƒ©ã‚¹ã¨ã„ã†ã‚‚ã®ã‚‚ã‚ã‚Šã¾ã™ï¼‰ ã«ã“ã®"
"よã†ãªè˜åˆ¥åプãƒãƒ‘ティãŒå¿…è¦ã«ãªã‚Šã¾ã™ã€‚事実上ã»ã¨ã‚“ã©ã®ã‚¢ãƒ—リケーション "
"( 特㫠web アプリケーション) ã§ã¯ã€è˜åˆ¥åã§ã‚ªãƒ–ジェクトを区別ã™ã‚‹å¿…è¦ãŒã‚ã‚‹"
"ãŸã‚ã€ã“ã‚Œã¯åˆ¶é™ã¨ã„ã†ã‚ˆã‚Šã‚‚特徴ã§ã‚ã‚‹ã¨è€ƒãˆã‚‹ã¹ãã§ã™ã€‚ã—ã‹ã—通常オブジェク"
"ト㮠ID ã‚’æ“作ã™ã‚‹ã‚ˆã†ãªã“ã¨ã¯ã—ã¾ã›ã‚“。ãã®ãŸã‚セッターメソッド㯠private ã«"
"ã™ã‚‹ã¹ãã§ã™ã€‚ Hibernate ã ã‘ãŒã‚ªãƒ–ジェクトãŒã‚»ãƒ¼ãƒ–ã•ã‚ŒãŸã¨ãã«è˜åˆ¥åã¸å€¤ã‚’代"
"å…¥ã—ã¾ã™ã€‚ Hibernate ãŒï¼ˆpublic, private, protected)フィールドã«ç›´æŽ¥ã‚¢ã‚¯ã‚»ã‚¹"
"ã§ãã‚‹ã®ã¨åŒæ§˜ã«ã€ public, private, protected ã®ã‚¢ã‚¯ã‚»ã‚µãƒ¡ã‚½ãƒƒãƒ‰ã«ã‚¢ã‚¯ã‚»ã‚¹ã§"
"ãã‚‹ã¨ã„ã†ã“ã¨ãŒã‚ã‹ã‚‹ã§ã—ょã†ã€‚é¸æŠžã¯ã‚ãªãŸã«ä»»ã•ã‚Œã¦ã„ã‚‹ã®ã§ã€ã‚ãªãŸã®ã‚¢ãƒ—"
"リケーションã®è¨è¨ˆã«åˆã‚ã›ã‚‹ã“ã¨ãŒã§ãã¾ã™ã€‚"
#. 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 ""
"引数ã®ãªã„コンストラクタã¯ã™ã¹ã¦ã®æ°¸ç¶šã‚¯ãƒ©ã‚¹ã«å¿…é ˆã§ã™ã€‚ã“れ㯠Hibernate ㌠"
"Java ã®ãƒªãƒ•ãƒ¬ã‚¯ã‚·ãƒ§ãƒ³ã‚’使ã£ã¦ã€ã‚ªãƒ–ジェクトを作æˆã—ãªã‘ã‚Œã°ãªã‚‰ãªã„ãŸã‚ã§ã™ã€‚"
"コンストラクタを private ã«ã™ã‚‹ã“ã¨ã¯å¯èƒ½ã§ã™ãŒã€å®Ÿè¡Œæ™‚ã®ãƒ—ãƒã‚シ生æˆã¨ã€ãƒã‚¤"
"トコードæ“作ãªã—ã®åŠ¹çŽ‡çš„ãªãƒ‡ãƒ¼ã‚¿ã®æŠ½å‡ºã«ã¯ã€ package å¯è¦–性ãŒå¿…è¦ã§ã™ã€‚"
#. Tag: para
#: tutorial.xml:164
#, no-c-format
msgid ""
"Save this file to the <filename>src/main/java/org/hibernate/tutorial/domain"
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 "
"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 "
"<filename>hibernate-core.jar (it is also included in the "
"<filename>hibernate3.jar, if using the distribution bundle)."
msgstr ""
"Hibernate DTD ãŒéžå¸¸ã«æ´—ç·´ã•ã‚Œã¦ã„ã‚‹ã“ã¨ã«æ³¨ç›®ã—ã¦ãã ã•ã„。ã“ã® DTD ã¯ã€ã‚¨"
"ディタや IDE ã§ã® XML マッピングè¦ç´ ã¨å±žæ€§ã®ã‚ªãƒ¼ãƒˆã‚³ãƒ³ãƒ—リーション機能ã«åˆ©ç”¨"
"ã§ãã¾ã™ã€‚ã¾ãŸ DTD ファイルをテã‚ストエディタã§é–‹ã‘ã¦ã¿ã¦ãã ã•ã„。ã¨ã„ã†ã®"
"ã‚‚ã€ã™ã¹ã¦ã®è¦ç´ ã¨å±žæ€§ã‚’概観ã—ã€ã‚³ãƒ¡ãƒ³ãƒˆã‚„デフォルトã®å€¤ã‚’見るã«ã¯ä¸€ç•ªç°¡å˜ãª"
"方法ã ã‹ã‚‰ã§ã™ã€‚ Hibernate ã¯ã€ web ã‹ã‚‰ DTD ファイルをãƒãƒ¼ãƒ‰ã›ãšã«ã€ã¾ãšã‚¢ãƒ—"
"リケーションã®ã‚¯ãƒ©ã‚¹ãƒ‘スã‹ã‚‰ã“れを探ã—出ãã†ã¨ã™ã‚‹ã“ã¨ã«æ³¨æ„ã—ã¦ãã ã•ã„。 "
"DTD ファイル㯠Hibernate ディストリビューション㮠<literal>src/ "
"ディレクトリã¨åŒæ§˜ã€<literal>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 "
"is, of course, not optional."
msgstr ""
"以é™ã®ä¾‹ã§ã¯ã‚³ãƒ¼ãƒ‰ã‚’çŸãã™ã‚‹ãŸã‚ã« DTD 宣言をçœç•¥ã—ã¾ã™ã€‚当然ã§ã™ãŒã“ã‚Œã¯ã‚ªãƒ—"
"ションã§ã¯ã‚ã‚Šã¾ã›ã‚“。"
#. Tag: para
#: tutorial.xml:206
#, no-c-format
msgid ""
"Between the two <literal>hibernate-mapping tags, include a "
"<literal>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 ""
"2ã¤ã® <literal>hibernate-mapping ã‚¿ã‚°ã®é–“ã« class"
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 "
"<literal>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 ""
"ã“ã‚Œã¾ã§ç§ãŸã¡ã¯ã€ <literal>Event クラスã®ã‚ªãƒ–ジェクトを "
"<literal>EVENTS テーブルã«å¯¾ã—ã¦ã€ã©ã®ã‚ˆã†ã«æ°¸ç¶šåŒ–ã—ãŸã‚Šãƒãƒ¼ãƒ‰ã—ãŸ"
"ã‚Šã™ã‚‹ã®ã‹ã‚’ Hibernate ã«æ•™ãˆã¦ãã¾ã—ãŸã€‚ãã—ã¦å€‹ã€…ã®ã‚¤ãƒ³ã‚¹ã‚¿ãƒ³ã‚¹ã¯ãƒ†ãƒ¼ãƒ–ルã®"
"è¡Œã¨ã—ã¦è¡¨ç¾ã•ã‚Œã¾ã™ã€‚ãã‚Œã§ã¯å¼•ã続ãテーブルã®ä¸»ã‚ーã«å¯¾ã™ã‚‹ãƒ¦ãƒ‹ãƒ¼ã‚¯ãªè˜åˆ¥"
"åプãƒãƒ‘ティをマッピングã—ã¦ã„ãã¾ã™ã€‚ã•ã‚‰ã«ã€ã“ã®è˜åˆ¥åã®æ‰±ã„ã«æ°—を使ã„ãŸã"
"ãªã‹ã£ãŸã®ã¨åŒæ§˜ã«ã€ä»£ç†ã®ä¸»ã‚ーカラムã«å¯¾ã™ã‚‹ Hibernate ã®è˜åˆ¥å生æˆæˆ¦ç•¥ã‚’è¨"
"定ã—ã¾ã™ã€‚"
#. Tag: programlisting
#: tutorial.xml:225
#, fuzzy, no-c-format
msgid ""
"<![CDATA["
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 <literal>id element is the declaration of the identifier "
"property. The <literal>name=\"id\" mapping attribute declares the "
"name of the JavaBean property and tells Hibernate to use the <literal>getId()"
"</literal> and setId() methods to access the property. "
"The column attribute tells Hibernate which column of the <literal>EVENTS element specifies the identifier "
"generation strategy (aka how are identifier values generated?). In this case "
"we choose <literal>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 ""
"<literal>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
#, fuzzy, no-c-format
msgid ""
"<![CDATA[\n"
"<hibernate-mapping package=\"org.hibernate.tutorial.domain\">\n"
"\n"
" <class name=\"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>]]>"
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 <literal>id element, the name "
"attribute of the <literal>property element tells Hibernate which "
"getter and setter methods to use. In this case, Hibernate will search for "
"<literal>getDate(), setDate(), getTitle"
"()</literal> and setTitle() methods."
msgstr ""
"<literal>id è¦ç´ ã®å ´åˆã¨åŒæ§˜ã«ã€ property è¦ç´ "
"ã® <literal>name 属性ã§ã€ã©ã®ã‚²ãƒƒã‚¿ãƒ¼ã¨ã‚»ãƒƒã‚¿ãƒ¼ãƒ¡ã‚½ãƒƒãƒ‰ã‚’使ã†ã¹ãã‹"
"ã‚’ Hibernate ã«æ•™ãˆã¾ã™ã€‚ã“ã®ä¾‹ã§ã¯ã€ Hibernate 㯠<literal>getDate()/setDate"
"()</literal> 㨠getTitle()/setTitle() を探ã—ã¾ã™ã€‚"
#. Tag: para
#: tutorial.xml:274
#, no-c-format
msgid ""
"Why does the <literal>date property mapping include the "
"<literal>column attribute, but the title does "
"not? Without the <literal>column attribute, Hibernate by default "
"uses the property name as the column name. This works for <literal>titledate is a reserved keyword in most "
"databases so you will need to map it to a different name."
msgstr ""
"ãªãœ <literal>date プãƒãƒ‘ティã®ãƒžãƒƒãƒ”ングã«ã¯ columntitle プãƒãƒ‘ティã«ã¯ãªã„ã®ã§ã—ょã†"
"ã‹ï¼Ÿ <literal>column 属性ãŒãªã‘ã‚Œã°ã€ Hibernate ã¯ãƒ‡ãƒ•ã‚©ãƒ«ãƒˆã§ãƒ—ãƒ"
"パティåをカラムåã¨ã—ã¦ä½¿ã„ã¾ã™ã€‚ã“れ㯠<literal>title ã§ã¯ä¸Šæ‰‹ã"
"ã„ãã¾ã™ã€‚ã—ã‹ã— <literal>date ã¯ã€ã»ã¨ã‚“ã©ã®ãƒ‡ãƒ¼ã‚¿ãƒ™ãƒ¼ã‚¹ã§äºˆç´„語ãª"
"ã®ã§ã€é•ã†åå‰ã§ãƒžãƒƒãƒ”ングã—ãŸæ–¹ãŒã‚ˆã„ã®ã§ã™ã€‚"
#. Tag: para
#: tutorial.xml:284
#, no-c-format
msgid ""
"The <literal>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 "
"<emphasis>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 "
"<literal>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 "
"<literal>date property. Hibernate cannot know if the property, "
"which is of <literal>java.util.Date, should map to a SQL "
"<literal>date, timestamp, or time converter."
msgstr ""
"次ã«èˆˆå‘³æ·±ã„ã®ã¯ <literal>title マッピング㌠type ã¨å‘¼ã°ã‚Œ"
"る〠Java ã‹ã‚‰ SQL データã®åž‹ã¸ã¾ãŸã¯ SQL ã‹ã‚‰ Java データ型ã¸ç¿»è¨³ã™ã‚‹ã‚³ãƒ³"
"ãƒãƒ¼ã‚¿ã§ã™ã€‚ç¹°ã‚Šè¿”ã—ã«ãªã‚Šã¾ã™ãŒã€ Hibernate 㯠<literal>type 属性"
"ãŒãƒžãƒƒãƒ”ングファイル内ã«ãªã‘ã‚Œã°ã€æ£ã—ã„コンãƒãƒ¼ã‚¸ãƒ§ãƒ³ã¨ãƒžãƒƒãƒ”ング型を自分ã§"
"解決ã—よã†ã¨ã—ã¾ã™ã€‚ (Javaクラスã®ãƒªãƒ•ãƒ¬ã‚¯ã‚·ãƒ§ãƒ³ã‚’使ã£ãŸï¼‰ã“ã®è‡ªå‹•æ¤œçŸ¥ã¯ã€å ´"
"åˆã«ã‚ˆã£ã¦ã¯ã‚ãªãŸãŒæœŸå¾…ã¾ãŸã¯å¿…è¦ã¨ã™ã‚‹ãƒ‡ãƒ•ã‚©ãƒ«ãƒˆå€¤ã«ãªã‚‰ãªã„ã‹ã‚‚ã—ã‚Œã¾ã›"
"ん。 <literal>date プãƒãƒ‘ティã®å ´åˆãŒãã†ã§ã—ãŸã€‚ Hibernate ã¯ã“ã®"
"( <literal>java.util.Date ã®ï¼‰ãƒ—ãƒãƒ‘ティを SQL ã® datetimestamp , time ã®ã†ã¡ã€ã©"
"ã®ã‚«ãƒ©ãƒ ã«ãƒžãƒƒãƒ”ングã™ã‚‹ã¹ããªã®ã‹ã‚ã‹ã‚Šã¾ã›ã‚“。 <literal>timestamp ã¨ã„ã†ãƒ‡ã‚£ãƒ¬ã‚¯ãƒˆãƒªã‚’開発ディレクトリã®ãƒ«ãƒ¼ãƒˆã«ä½œæˆã—"
"ã¦ãã ã•ã„。 HSQL DB ã¯ã“ã“ã«ãƒ‡ãƒ¼ã‚¿ãƒ•ã‚¡ã‚¤ãƒ«ã‚’æ ¼ç´ã—ã¾ã™ã€‚ã“ã®ãƒ‡ãƒ¼ã‚¿ãƒ‡ã‚£ãƒ¬ã‚¯ãƒˆ"
"リã«ãŠã„㦠<literal>java -classpath ../lib/hsqldb.jar org.hsqldb.Server を押ã—ã¾"
"ã™ï¼‰ <literal>data/ ディレクトリ内ã®ãƒ•ã‚¡ã‚¤ãƒ«ã‚’å…¨ã¦æ¶ˆåŽ»ã—ãŸå¾Œã€ "
"HSQL DB ã‚’å†èµ·å‹•ã—ã¾ã™ã€‚"
#. 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 <interfacename>javax.sql."
"DataSource</interfacename>). Hibernate comes with support for two third-"
"party open source JDBC connection pools: <ulink url=\"https://sourceforge."
"net/projects/c3p0\">c3p0</ulink> and . 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 <literal>hibernate."
"properties</literal> file, a more sophisticated hibernate.cfg.xml ファイ"
"ルã€ãれより少ã—æ´—ç·´ã•ã‚Œã¦ã„ã‚‹ <literal>hibernate.cfg.xml ファイ"
"ルã€ã¾ãŸã¯å®Œå…¨ã«ãƒ—ãƒã‚°ãƒ©ãƒ 上ã§ã‚»ãƒƒãƒˆã‚¢ãƒƒãƒ—ã™ã‚‹æ–¹æ³•ãŒåˆ©ç”¨ã§ãã¾ã™ã€‚ã»ã¨ã‚“ã©ã®"
"ユーザーãŒå¥½ã‚€ã®ã¯ XML è¨å®šãƒ•ã‚¡ã‚¤ãƒ«ã§ã™ï¼š"
#. Tag: programlisting
#: tutorial.xml:363
#, fuzzy, no-c-format
msgid ""
"<![CDATA[\n"
" <property name=\"connection.password\">\n"
"\n"
" <!-- JDBC connection pool (use the built-in) -->\n"
" <property name=\"connection.pool_size\">1\n"
"\n"
" <!-- SQL dialect -->\n"
" <property name=\"dialect\">org.hibernate.dialect.HSQLDialect\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\n"
"\n"
" <!-- Drop and re-create the database schema on startup -->\n"
" <property name=\"hbm2ddl.auto\">update\n"
"\n"
" <mapping resource=\"org/hibernate/tutorial/domain/Event.hbm.xml\"/>\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 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 <literal>SessionFactory. SessionFactory "
"is a global factory responsible for a particular database. If you have "
"several databases, for easier startup you should use several <literal><"
"session-factory></literal> configurations in several configuration files."
msgstr ""
"特定ã®ãƒ‡ãƒ¼ã‚¿ãƒ™ãƒ¼ã‚¹ã‚’å—ã‘æŒã¤ã‚°ãƒãƒ¼ãƒãƒ«ãƒ•ã‚¡ã‚¯ãƒˆãƒªã§ã‚ã‚‹ Hibernate ã® "
"<literal>SessionFactory ã‚’è¨å®šã—ã¾ã™ã€‚ã‚‚ã—複数ã®ãƒ‡ãƒ¼ã‚¿ãƒ™ãƒ¼ã‚¹ãŒã‚ã‚‹"
"å ´åˆã«ã¯ã€ (スタートアップを簡å˜ã«ã™ã‚‹ãŸã‚)通常ã„ãã¤ã‹ã®è¨å®šãƒ•ã‚¡ã‚¤ãƒ«å†…ã§ã€"
"ã„ãã¤ã‹ã® <literal><session-factory> を使ã†è¨å®šã«ã—ã¦ãã ã•"
"ã„。"
#. Tag: para
#: tutorial.xml:376
#, no-c-format
msgid ""
"The first four <literal>property elements contain the necessary "
"configuration for the JDBC connection. The dialect <literal>property è¦ç´ 㯠JDBC コãƒã‚¯ã‚·ãƒ§ãƒ³ã«å¿…è¦ãªè¨å®š"
"ã‚’å«ã‚“ã§ã„ã¾ã™ã€‚ dialect ã¨ã„ã†åå‰ã® <literal>property è¦ç´ ã¯ã€ "
"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 <xref linkend=\"portability-dialectresolver\"/> 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 <literal>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 <literal>SchemaExport "
"Ant task. Finally, add the mapping file(s) for persistent classes to the "
"configuration."
msgstr ""
"永続的ãªã‚³ãƒ³ãƒ†ã‚ストã«å¯¾ã™ã‚‹ Hibernate ã®ã‚»ãƒƒã‚·ãƒ§ãƒ³ã®è‡ªå‹•ç®¡ç†ã¯ã€å¾Œã®ä¾‹ã§ã™ã"
"ã«ã‚ã‹ã‚‹ã‚ˆã†ã«ã€å½¹ã«ç«‹ã¤ã“ã¨ã§ã—ょã†ã€‚ <literal>hbm2ddl.auto オプ"
"ションã¯ãƒ‡ãƒ¼ã‚¿ãƒ™ãƒ¼ã‚¹ã‚¹ã‚ーマã®è‡ªå‹•ç”Ÿæˆã‚’ on ã«ã—ã¾ã™ã€‚ã“ã‚Œã¯ç›´æŽ¥ãƒ‡ãƒ¼ã‚¿ãƒ™ãƒ¼ã‚¹"
"ã«å¯¾ã—ã¦ç”Ÿæˆã•ã‚Œã¾ã™ã€‚当然(config オプションを削除ã—ã¦ï¼‰ off ã«ã—ãŸã‚Šã€ "
"<literal>SchemaExport ã¨ã„ㆠAnt タスクã®åŠ©ã‘を借りã¦ãƒ•ã‚¡ã‚¤ãƒ«ã«ãƒªãƒ€"
"イレクトã—ãŸã‚Šã§ãã¾ã™ã€‚最後ã«æ°¸ç¶šã‚¯ãƒ©ã‚¹ã®ãŸã‚ã®ãƒžãƒƒãƒ”ングファイルをè¨å®šã«è¿½"
"åŠ ã—ã¾ã™ã€‚"
#. Tag: para
#: tutorial.xml:398
#, no-c-format
msgid ""
"Save this file as <filename>hibernate.cfg.xml into the "
"<filename>src/main/resources directory."
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 "
"installed; it is available from the <ulink url=\"http://maven.apache.org/"
"download.html\">Maven download page</ulink>. Maven will read the /"
"pom.xml</filename> file we created earlier and know how to perform some "
"basic project tasks. First, lets run the <literal>compile goal to "
"make sure we can compile everything so far:"
msgstr ""
#. Tag: programlisting
#: tutorial.xml:418
#, no-c-format
msgid ""
"<![CDATA[[hibernateTutorial]$ mvn compile\n"
"[INFO] Scanning for projects...\n"
"[INFO] "
"------------------------------------------------------------------------\n"
"[INFO] Building First Hibernate Tutorial\n"
"[INFO] task-segment: [compile]\n"
"[INFO] "
"------------------------------------------------------------------------\n"
"[INFO] [resources:resources]\n"
"[INFO] Using default encoding to copy filtered resources.\n"
"[INFO] [compiler:compile]\n"
"[INFO] Compiling 1 source file to /home/steve/projects/sandbox/"
"hibernateTutorial/target/classes\n"
"[INFO] "
"------------------------------------------------------------------------\n"
"[INFO] BUILD SUCCESSFUL\n"
"[INFO] "
"------------------------------------------------------------------------\n"
"[INFO] Total time: 2 seconds\n"
"[INFO] Finished at: Tue Jun 09 12:25:25 CDT 2009\n"
"[INFO] Final Memory: 5M/547M\n"
"[INFO] "
"------------------------------------------------------------------------]]>"
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 <literal>Event objects, but "
"first you have to complete the setup with some infrastructure code. You have "
"to startup Hibernate by building a global <interfacename>org.hibernate."
"SessionFactory</interfacename> object and storing it somewhere for easy "
"access in application code. A <interfacename>org.hibernate.SessionFactoryorg.hibernate.Sessionorg.hibernate.Session is a thread-safe "
"global object that is instantiated once."
msgstr ""
"ã•ã¦ <literal>Event オブジェクトをãƒãƒ¼ãƒ‰ã—ãŸã‚Šæ ¼ç´ã—ãŸã‚Šã™ã‚‹æº–å‚™ãŒ"
"ã§ãã¾ã—ãŸã€‚ã—ã‹ã—ã¾ãšã¯ã‚¤ãƒ³ãƒ•ãƒ©ã‚¹ãƒˆãƒ©ã‚¯ãƒãƒ£ã®ã‚³ãƒ¼ãƒ‰ã‚’書ã„ã¦ã€ã‚»ãƒƒãƒˆã‚¢ãƒƒãƒ—ã‚’"
"完了ã™ã‚‹å¿…è¦ãŒã‚ã‚Šã¾ã™ã€‚ã¾ãšã¯ Hibernate をスタートアップã—ãªã‘ã‚Œã°ãªã‚Šã¾ã›"
"ん。ã“ã®ã‚¹ã‚¿ãƒ¼ãƒˆã‚¢ãƒƒãƒ—ã«ã¯ã€ã‚°ãƒãƒ¼ãƒãƒ«ã® <literal>SessionFactory オ"
"ブジェクトを生æˆã—ã¦ã€ãれをアプリケーションã®ã‚³ãƒ¼ãƒ‰ã§ã‚¢ã‚¯ã‚»ã‚¹ã—ã‚„ã™ã„å ´æ‰€ã«"
"æ ¼ç´ã™ã‚‹ã“ã¨ãŒå«ã¾ã‚Œã¾ã™ã€‚ <interfacename>org.hibernate.SessionFactoryorg.hibernate.Session "
"をオープンã™ã‚‹ã“ã¨ãŒã§ãã¾ã™ã€‚ <interfacename>org.hibernate.Session ã¯ã‚¹ãƒ¬ãƒƒãƒ‰"
"セーフã®ã‚°ãƒãƒ¼ãƒãƒ«ã‚ªãƒ–ジェクトã§ã‚ã‚Šã€ä¸€åº¦ã ã‘インスタンス化ã•ã‚Œã¾ã™ã€‚"
#. Tag: para
#: tutorial.xml:439
#, no-c-format
msgid ""
"We will create a <literal>HibernateUtil helper class that takes "
"care of startup and makes accessing the <interfacename>org.hibernate."
"SessionFactory</interfacename> more convenient."
msgstr ""
"ã“ã“ã§ã‚¹ã‚¿ãƒ¼ãƒˆã‚¢ãƒƒãƒ—ã‚’è¡Œã„ã€ä¾¿åˆ©ã« <interfacename>org.hibernate."
"SessionFactory</interfacename> ã¸ã‚¢ã‚¯ã‚»ã‚¹ã™ã‚‹ HibernateUtil "
"reference from JNDI in an application server or any other location for that "
"matter."
msgstr ""
"ã“ã®ã‚¯ãƒ©ã‚¹ã¯é™çš„åˆæœŸåŒ–ブãƒãƒƒã‚¯ï¼ˆã‚¯ãƒ©ã‚¹ãŒãƒãƒ¼ãƒ‰ã•ã‚Œã‚‹ã¨ãã« JVM ã«ã‚ˆã£ã¦ä¸€åº¦ã "
"ã‘呼ã°ã‚Œã‚‹ï¼‰ ã§ã‚°ãƒãƒ¼ãƒãƒ«ã® <interfacename>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 "
"<literal>HibernateService to JNDI. Such advanced options are "
"discussed later."
msgstr ""
"è¨å®šãƒ•ã‚¡ã‚¤ãƒ«å†…㧠<interfacename>org.hibernate.SessionFactory "
"ã«åå‰ã‚’与ãˆã‚‹ã¨ã€ Hibernate 㯠<interfacename>org.hibernate.SessionFactory ã‚’ JNDI ã¸ãƒã‚¤ãƒ³ãƒ‰ã™ã‚‹"
"ã“ã¨ã‚‚ã§ãã¾ã™ã€‚ã“れらã®é«˜åº¦ãªã‚ªãƒ—ションã¯ã€ Hibernate ã®ãƒªãƒ•ã‚¡ãƒ¬ãƒ³ã‚¹ãƒ‰ã‚ュメ"
"ントã§èª¬æ˜Žã•ã‚Œã¦ã„ã¾ã™ã€‚"
#. Tag: para
#: tutorial.xml:470
#, fuzzy, 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 <literal>log4j.properties from the Hibernate "
"distribution in the <literal>etc/ directory to your srchibernate.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 ""
"ã“ã‚Œã¯å•é¡Œãªãå†ã‚³ãƒ³ãƒ‘イルã§ãã‚‹ã¯ãšã§ã™ã€‚最後ã«ãƒã‚®ãƒ³ã‚°ã‚·ã‚¹ãƒ†ãƒ ã‚’è¨å®šã™ã‚‹å¿…"
"è¦ãŒã‚ã‚Šã¾ã™ã€‚ Hibernate 㯠commons logging を使ã†ãŸã‚〠Log4j 㨠JDK 1.4 "
"logging ã®é¸æŠžã‚’ã™ã‚‹å¿…è¦ãŒã‚ã‚Šã¾ã›ã‚“。ã»ã¨ã‚“ã©ã®é–‹ç™ºè€…ãŒå¥½ã‚€ã®ã¯ Log4j ã§"
"ã™ã€‚ Hibernate ディストリビューションã®ï¼ˆ <literal>etc/ ディレクト"
"リ)ã‹ã‚‰ <literal>log4j.properties ã‚’ã‚ãªãŸã® srchibernate.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."
msgstr ""
"ãƒãƒ¥ãƒ¼ãƒˆãƒªã‚¢ãƒ«ã®ã‚¤ãƒ³ãƒ•ãƒ©ã¯å®Œå…¨ã§ã™ã€‚ Hibernate を使ã£ã¦å®Ÿéš›ã®ä½œæ¥ã‚’ã™ã‚‹æº–å‚™ãŒ"
"æ•´ã„ã¾ã—ãŸã€‚"
#. Tag: title
#: tutorial.xml:488
#, no-c-format
msgid "Loading and storing objects"
msgstr "オブジェクトã®ãƒãƒ¼ãƒ‰ã¨æ ¼ç´"
#. Tag: para
#: 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 <literal>EventManager class with a main() メソッドをæŒã¤ EventManager クラ"
"スを書ãã¾ã™ï¼š"
#. Tag: programlisting
#: tutorial.xml:496
#, fuzzy, no-c-format
msgid ""
"<![CDATA[package org.hibernate.tutorial;\n"
"\n"
"import org.hibernate.Session;\n"
"\n"
"import java.util.*;\n"
"\n"
"import org.hibernate.tutorial.domain.Event;\n"
"import org.hibernate.tutorial.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"
" Session session = HibernateUtil.getSessionFactory().getCurrentSession"
"();\n"
" session.beginTransaction();\n"
"\n"
" Event theEvent = new Event();\n"
" theEvent.setTitle(title);\n"
" theEvent.setDate(theDate);\n"
" session.save(theEvent);\n"
"\n"
" session.getTransaction().commit();\n"
" }\n"
"\n"
"}]]>"
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 <literal>createAndStoreEvent() we created a new Event on the "
"database."
msgstr ""
"æ–°ã—ã„ <literal>Event オブジェクトを生æˆã—ã€ãれを Hibernate ã«æ¸¡ã—"
"ã¾ã™ã€‚ Hibernate ㌠SQL を処ç†ã—ã€ãƒ‡ãƒ¼ã‚¿ãƒ™ãƒ¼ã‚¹ã§ <literal>INSERT ã‚’"
"実行ã—ã¾ã™ã€‚実行å‰ã«l <literal>Session 㨠Transaction 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 <interface>org.hibernate.Session and a database "
"transaction. To shield our code from the actual underlying transaction "
"system we use the Hibernate <interfacename>org.hibernate.Transaction ã¯1ã¤ã®ä½œæ¥å˜ä½ (Unit of Work) "
"ã§ã™ã€‚当分ã®é–“ã€è©±ã‚’ç°¡å˜ã«ã™ã‚‹ãŸã‚ã«ã€ <interface>org.hibernate.SessionTransaction ã®å¯¾å¿œã‚’一対一ã¨ä»®å®šã—ã¾ã™ã€‚使用"
"ã—ã¦ã„るトランザクションシステム(ã“ã®ã‚±ãƒ¼ã‚¹ã§ã¯ JTA ã¨å…±å˜ã§ãã‚‹å˜ç´”㪠"
"JDBC)ã‹ã‚‰ã‚³ãƒ¼ãƒ‰ã‚’ä¿è·ã™ã‚‹ãŸã‚ã«ã€ Hibernate <literal>Session 上ã§"
"利用å¯èƒ½ãª <interfacename>org.hibernate.Transaction API を使"
"用ã—ã¾ã™ã€‚"
#. Tag: para
#: tutorial.xml:518
#, fuzzy, no-c-format
msgid ""
"What does <literal>sessionFactory.getCurrentSession() do? First, "
"you can call it as many times and anywhere you like once you get hold of "
"your <interfacename>org.hibernate.SessionFactory. The "
"<literal>getCurrentSession() method always returns the \"current\" "
"unit of work. Remember that we switched the configuration option for this "
"mechanism to \"thread\" in our <filename>src/main/resources/hibernate.cfg."
"xml</filename>? Due to that setting, the context of a current unit of work "
"is bound to the current Java thread that executes the application."
msgstr ""
"<literal>sessionFactory.getCurrentSession() ã¯ä½•ã‚’ã™ã‚‹ã®ã§ã—ょã†"
"ã‹ï¼Ÿã¾ãšã€ã„ã£ãŸã‚“ <interfacename>org.hibernate.SessionFactoryHibernateUtil ã®ãŠã‹"
"ã’ã§ç°¡å˜ã§ã™ï¼‰ã€ã“ã®ãƒ¡ã‚½ãƒƒãƒ‰ã‚’何度ã§ã‚‚ã€ã©ã“ã‹ã‚‰ã§ã‚‚呼ã³å‡ºã™ã“ã¨ãŒã§ãã¾ã™ã€‚ "
"<literal>getCurrentSession() メソッドã¯å¸¸ã«ã€Œç¾åœ¨ã®ã€ä½œæ¥å˜ä½(Unit "
"of Work)ã‚’è¿”ã—ã¾ã™ã€‚ <filename>src/main/resources/hibernate.cfg.xml begins when the first call to "
"<literal>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 "
"<interface>org.hibernate.Session from the thread and closes it "
"for you. If you call <literal>getCurrentSession() again, you get a "
"new <interface>org.hibernate.Session and can start a new unit of "
"work."
msgstr ""
"<interface>org.hibernate.Session ã¯æœ€åˆã«å¿…è¦ã¨ãªã£ãŸã¨ãã€ã¤ã¾ã‚Š"
"最åˆã« <literal>getCurrentSession() ãŒå‘¼ã°ã‚ŒãŸã¨ãã«é–‹å§‹ã—ã¾ã™ã€‚ã"
"ã®ã¨ã Hibernate ã«ã‚ˆã‚Šç¾åœ¨ã®ã‚¹ãƒ¬ãƒƒãƒ‰ã«çµã³ä»˜ã‘られã¾ã™ã€‚トランザクションãŒçµ‚"
"了(コミットもã—ãã¯ãƒãƒ¼ãƒ«ãƒãƒƒã‚¯ï¼‰ã—ãŸã¨ã〠Hibernate もスレッドã‹ã‚‰ "
"<interface>org.hibernate.Session を切り離ã—ã€ã‚¯ãƒãƒ¼ã‚ºã—ã¾ã™ã€‚å†"
"ã³ <literal>getCurrentSession() を呼ã¶ã¨ã€æ–°ã—ã„ org."
"hibernate.Session</interface> ã‚’å–å¾—ã—ã¦æ–°ã—ã„作æ¥å˜ä½ã‚’スタートã§ãã¾ã™ã€‚ã“"
"ã® <emphasis>thread-bound プãƒã‚°ãƒ©ãƒŸãƒ³ã‚°ãƒ¢ãƒ‡ãƒ«ã¯ã€ã‚³ãƒ¼ãƒ‰ã®ãƒ•ãƒ¬ã‚ã‚·"
"ブルãªãƒ¬ã‚¤ãƒ¤ãƒªãƒ³ã‚°ã‚’å¯èƒ½ã«ã™ã‚‹ã®ã§ã€ Hibernate を利用ã™ã‚‹ä¸Šã§æœ€ã‚‚人気ãŒã‚ã‚Šã¾"
"ã™ (ã“ã®ãƒãƒ¥ãƒ¼ãƒˆãƒªã‚¢ãƒ«ã§å¾Œã»ã©è§¦ã‚Œã¾ã™ãŒãƒˆãƒ©ãƒ³ã‚¶ã‚¯ã‚·ãƒ§ãƒ³å¢ƒç•Œã‚³ãƒ¼ãƒ‰ã¯ãƒ‡ãƒ¼ã‚¿ã‚¢"
"クセスコードã¨ã¯åŒºåˆ¥ã•ã‚Œã¾ã™)。"
#. Tag: para
#: tutorial.xml:554
#, no-c-format
msgid ""
"Related to the unit of work scope, should the Hibernate <interface>org."
"hibernate.Session</interface> be used to execute one or several database "
"operations? The above example uses one <interface>org.hibernate.Session is flexible but you "
"should never design your application to use a new Hibernate <interface>org."
"hibernate.Session</interface> for every database "
"operation. Even though it is used in the following examples, consider "
"<emphasis>session-per-operation an anti-pattern. A real web "
"application is shown later in the tutorial which will help illustrate this."
msgstr ""
"作æ¥å˜ä½ (Unit of Work) ã®ç¯„囲ã«é–¢ã—ã¦ã€ Hibernate ã® <interface>org."
"hibernate.Session</interface> ã¯1ã¤ã¾ãŸã¯ã„ãã¤ã‹ã®ãƒ‡ãƒ¼ã‚¿ãƒ™ãƒ¼ã‚¹ã‚ªãƒšãƒ¬ãƒ¼ã‚·ãƒ§ãƒ³"
"を実行ã™ã‚‹ãŸã‚ã«ä½¿ç”¨ã•ã‚Œã‚‹ã¹ãã§ã—ょã†ã‹ï¼Ÿä¸Šè¨˜ã®ä¾‹ã¯ã€ï¼‘ã¤ã®ã‚ªãƒšãƒ¬ãƒ¼ã‚·ãƒ§ãƒ³ã§1"
"ã¤ã® <interface>org.hibernate.Session を使用ã—ã¾ã™ã€‚ã“ã‚Œã¯ç´”粋ãª"
"å¶ç„¶ã§ã€ä¾‹ã¯ãã®ä»–ã®ã‚¢ãƒ—ãƒãƒ¼ãƒã‚’示ã™ã»ã©è¾¼ã¿å…¥ã£ã¦ã„ã¾ã›ã‚“。 Hibernate ã® "
"<interface>org.hibernate.Session ã®ç¯„囲ã¯æŸ”軟ã§ã™ãŒã€ "
"å…¨ã¦ã®</emphasis> データベースオペレーションã®ãŸã‚ã«æ–°ã—ã„ Hibernate "
"<interface>org.hibernate.Session を使用ã™ã‚‹ã‚ˆã†ã«ã‚¢ãƒ—リケーション"
"をデザインã™ã‚‹ã¹ãã§ã¯ã‚ã‚Šã¾ã›ã‚“。従ã£ã¦ã€ã‚‚ã—ãれを以下㮠(普通ã®) 例ã§ä½•åº¦"
"ã‹è¦‹ãŸã¨ã—ã¦ã‚‚ã€ã‚¢ãƒ³ãƒãƒ‘ターンã§ã‚ã‚‹ <emphasis>オペレーション毎㮠Session 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 ""
"コンパイルã™ã‚‹ã¨ã€ Hibernate ãŒã‚¹ã‚¿ãƒ¼ãƒˆã—ã€è¨å®šã«ã‚ˆã‚Šã¾ã™ãŒã€å¤šãã®ãƒã‚°å‡ºåŠ›ãŒ"
"ã‚ã‚‹ã¯ãšã§ã™ã€‚ãã®æœ€å¾Œã«ã¯ä»¥ä¸‹ã®è¡ŒãŒã‚ã‚‹ã§ã—ょã†ï¼š"
#. Tag: programlisting
#: tutorial.xml:594
#, fuzzy, no-c-format
msgid ""
"<![CDATA[[java] Hibernate: insert into EVENTS (EVENT_DATE, title, EVENT_ID) "
"values (?, ?, ?)]]>"
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 <literal>INSERT executed by Hibernate."
msgstr "HQL ã® <literal>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 ""
"<![CDATA[ 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(\n"
" \"Event: \" + theEvent.getTitle() + \" Time: \" + "
"theEvent.getDate()\n"
" );\n"
" }\n"
" }]]>"
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 <literal>listEvents() method is also added:"
msgstr "æ–°ã—ã„ <literal>listEvents()メソッド ã‚‚è¿½åŠ ã—ã¾ã™ã€‚"
#. Tag: programlisting
#: tutorial.xml:610
#, fuzzy, no-c-format
msgid ""
"<![CDATA[ private List listEvents() {\n"
" Session session = HibernateUtil.getSessionFactory().getCurrentSession"
"();\n"
" session.beginTransaction();\n"
" List result = session.createQuery(\"from Event\").list();\n"
" session.getTransaction().commit();\n"
" return result;\n"
" }]]>"
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 <literal>Event objects from the database. Hibernate will "
"generate the appropriate SQL, send it to the database and populate "
"<literal>Event objects with the data. You can create more complex "
"queries with HQL. See <xref linkend=\"queryhql\"/> for more information."
msgstr ""
"ã“ã“ã§ã™ã‚‹ã“ã¨ã¯ã€ãƒ‡ãƒ¼ã‚¿ãƒ™ãƒ¼ã‚¹ã‹ã‚‰å˜åœ¨ã™ã‚‹ã™ã¹ã¦ã® <literal>Event "
"オブジェクトをãƒãƒ¼ãƒ‰ã™ã‚‹ HQL (Hibernate Query Language) クエリを使ã†ã“ã¨ã§"
"ã™ã€‚ Hibernate ã¯é©åˆ‡ãª SQL を生æˆã—ã€ãれをデータベースã«é€ã‚Šã€ãã®ãƒ‡ãƒ¼ã‚¿ã‚’"
"使ã£ã¦ <literal>Event オブジェクトを生æˆã—ã¾ã™ã€‚当然 HQL ã§ã•ã‚‰ã«è¤‡"
"雑ãªã‚¯ã‚¨ãƒªã‚’作æˆã§ãã¾ã™ã€‚"
#. Tag: para
#: tutorial.xml:620
#, no-c-format
msgid ""
"Now we can call our new functionality, again using the Maven exec plugin: "
"<command>mvn exec:java -Dexec.mainClass=\"org.hibernate.tutorial.EventManager"
"\" -Dexec.args=\"list\"</command>"
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 "
"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 "Person クラスã®ãƒžãƒƒãƒ”ング"
#. Tag: para
#: tutorial.xml:642
#, no-c-format
msgid "The first cut of the <literal>Person class looks like this:"
msgstr "最åˆã® <literal>Person クラスã¯å˜ç´”ã§ã™ï¼š"
#. Tag: programlisting
#: tutorial.xml:646
#, fuzzy, no-c-format
msgid ""
"<![CDATA[package org.hibernate.tutorial.domain;\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"
"}]]>"
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 <filename>src/main/java/org/hibernate/tutorial/"
"domain/Person.java</filename>"
msgstr ""
#. Tag: para
#: tutorial.xml:653
#, no-c-format
msgid ""
"Next, create the new mapping file as <filename>src/main/resources/org/"
"hibernate/tutorial/domain/Person.hbm.xml</filename>"
msgstr ""
#. Tag: programlisting
#: tutorial.xml:658
#, fuzzy, no-c-format
msgid ""
"<![CDATA["
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 ""
"<![CDATA["
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 ""
"ãã‚Œã§ã¯ã“れら2ã¤ã®ã‚¨ãƒ³ãƒ†ã‚£ãƒ†ã‚£é–“ã®é–¢é€£ã‚’作æˆã—ã¾ã™ã€‚人々ãŒã‚¤ãƒ™ãƒ³ãƒˆã«å‚åŠ ã§"
"ãã€ã‚¤ãƒ™ãƒ³ãƒˆãŒå‚åŠ è€…ã‚’æŒã¤ã®ã¯æ˜Žã‚‰ã‹ã§ã™ã€‚扱ã‚ãªã‘ã‚Œã°ãªã‚‰ãªã„è¨è¨ˆã®å•é¡Œã¯ã€"
"æ–¹å‘ã€å¤šé‡åº¦ã€ã‚³ãƒ¬ã‚¯ã‚·ãƒ§ãƒ³ã®æŒ¯ã‚‹èˆžã„ã§ã™ã€‚"
#. 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 <literal>Person class, you "
"can easily navigate to the events for a particular person, without executing "
"an explicit query - by calling <literal>Person#getEvents. Multi-"
"valued associations are represented in Hibernate by one of the Java "
"Collection Framework contracts; here we choose a <interfacename>java.util."
"Set</interfacename> because the collection will not contain duplicate "
"elements and the ordering is not relevant to our examples:"
msgstr ""
"イベントã®ã‚³ãƒ¬ã‚¯ã‚·ãƒ§ãƒ³ã‚’ <literal>Person クラスã«è¿½åŠ ã—ã¾ã™ã€‚ã“ã†ã—"
"ã¦ãŠãã¨ã€æ˜Žç¤ºçš„ãªã‚¯ã‚¨ãƒªã€ã¤ã¾ã‚Šã‚ã–ã‚ã– <literal>aPerson.getEvents(), 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 <emphasis>many-to-many association. "
"Hence, we use Hibernate's many-to-many mapping:"
msgstr ""
"ã“ã®é–¢é€£ã‚’マッピングã™ã‚‹å‰ã«ã€å対å´ã«ã¤ã„ã¦è€ƒãˆã¦ãã ã•ã„。明らã‹ãªã“ã¨ã§ã™"
"ãŒã€ä»Šã¯ã“れをå˜æ–¹å‘ã«ã—ãŸã ã‘ã§ã™ã€‚逆ã«ã€ <literal>Event å´ã«ã‚‚別"
"ã®ã‚³ãƒ¬ã‚¯ã‚·ãƒ§ãƒ³ã‚’作るã“ã¨ã‚‚ã§ãã¾ã™ã€‚例ãˆã° <literal>anEvent.getParticipants()"
"</literal> ã®ã‚ˆã†ã«ã€åŒæ–¹å‘ã«ãƒŠãƒ“ゲートã—ãŸã‘ã‚Œã°ã€ãã†ã™ã‚‹ã“ã¨ã‚‚ã§ãã¾ã™ã€‚ã“"
"ã‚Œã¯æ©Ÿèƒ½çš„ã«ã¿ã¦å¿…è¦ã§ã¯ã‚ã‚Šã¾ã›ã‚“。特定ã®ã‚¤ãƒ™ãƒ³ãƒˆã«é–¢ä¿‚ã™ã‚‹ãƒ‡ãƒ¼ã‚¿ã‚’å–å¾—ã™ã‚‹"
"明確ãªã‚¯ã‚¨ãƒªã‚’ã€ã„ã¤ã§ã‚‚実行ã™ã‚‹ã“ã¨ãŒå‡ºæ¥ã¾ã—ãŸã€‚ã“ã®è¨è¨ˆã®é¸æŠžã¯é–‹ç™ºè€…ã«ä»»"
"ã•ã‚Œã¦ã„ã¦ã€ã“ã®è°è«–ã«ã‚ˆã‚Šæ˜Žã‚‰ã‹ãªã®ã¯é–¢é€£ã®å¤šé‡åº¦ã§ã™ã€‚ã¤ã¾ã‚Šä¸¡å´ã‚’「多ã€å€¤"
"ã«ã™ã‚‹ã€ <emphasis>多対多 ã¨å‘¼ã°ã‚Œã‚‹é–¢é€£ã§ã™ã€‚ãã®ãŸã‚ Hibernate "
"ã®å¤šå¯¾å¤šãƒžãƒƒãƒ”ングを使ã„ã¾ã™ï¼š"
#. Tag: programlisting
#: tutorial.xml:704
#, fuzzy, no-c-format
msgid ""
"<![CDATA["
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 <literal>setn:"
"m</emphasis> 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 <literal>table attribute of the "
"<literal>set element. The identifier column name in the "
"association, for the person side, is defined with the <literal>key "
"element, the column name for the event's side with the <literal>columnmany-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 ã¯ã‚ã‚Šã¨ã‚らゆる種類ã®ã‚³ãƒ¬ã‚¯ã‚·ãƒ§ãƒ³ãƒžãƒƒãƒ”ングをサãƒãƒ¼ãƒˆã—ã¦ã„ã¾ã™"
"ãŒã€æœ€ã‚‚一般的ãªã‚‚ã®ãŒ <literal>set ã§ã™ã€‚ 多対多関連(ã¾ãŸã¯ "
"<emphasis>n:m エンティティリレーションシップ)ã«ã¯ã€é–¢é€£ãƒ†ãƒ¼ãƒ–ルãŒ"
"å¿…è¦ã§ã™ã€‚ã“ã®ãƒ†ãƒ¼ãƒ–ルã®ãã‚Œãžã‚Œã®è¡Œã¯ã€äººã¨ã‚¤ãƒ™ãƒ³ãƒˆé–“ã®ãƒªãƒ³ã‚¯ã‚’表ç¾ã—ã¾ã™ã€‚"
"テーブルå㯠<literal>set è¦ç´ ã® table 属性ã§è¨"
"定ã—ã¾ã™ã€‚人å´ã®é–¢é€£ã®è˜åˆ¥åカラムå㯠<literal>key è¦ç´ ã§ã€ã‚¤ãƒ™ãƒ³"
"トå´ã®ã‚«ãƒ©ãƒ å㯠<literal>many-to-many ã® column:"
msgstr ""
"<literal>EventManager ã®æ–°ã—ã„メソッドã§äººã€…ã¨ã‚¤ãƒ™ãƒ³ãƒˆã‚’一緒ã«ã—ã¾"
"ã—ょã†ï¼š"
#. Tag: programlisting
#: tutorial.xml:737
#, fuzzy, no-c-format
msgid ""
"<![CDATA[ private void addPersonToEvent(Long personId, Long eventId) {\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"
" aPerson.getEvents().add(anEvent);\n"
"\n"
" session.getTransaction().commit();\n"
" }]]>"
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 <literal>Person and an Event, "
"simply modify the collection using the normal collection methods. There is "
"no explicit call to <literal>update() or save() state, that is, bound to a particular "
"Hibernate <interfacename>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 <emphasis>flushing. In our code, the "
"unit of work ends with a commit, or rollback, of the database transaction."
msgstr ""
"<literal>Person 㨠Event ã‚’ãƒãƒ¼ãƒ‰ã—ãŸå¾Œã€æ™®é€šã®"
"コレクションメソッドを使ã£ã¦å˜ç´”ã«ãã®ã‚³ãƒ¬ã‚¯ã‚·ãƒ§ãƒ³ã‚’ä¿®æ£ã—ã¦ãã ã•ã„。ã”覧ã®"
"ã¨ãŠã‚Š <literal>update() ã‚„ save() ã®æ˜Žç¤ºçš„ãªå‘¼"
"ã³å‡ºã—ã¯ã‚ã‚Šã¾ã›ã‚“。 Hibernate ã¯ã€ä¿®æ£ã•ã‚ŒãŸã“ã¨ã«ã‚ˆã‚Šæ›´æ–°ã™ã‚‹å¿…è¦ã®ã‚るコレ"
"クションを自動的ã«æ¤œçŸ¥ã—ã¾ã™ã€‚ã“れ㯠<emphasis>自動ダーティãƒã‚§ãƒƒã‚¯ 状態ã«ã‚ã‚‹é™ã‚Šã€ã¤ã¾ã‚Šç‰¹å®š"
"ã® Hibernate <literal>Session ã«ãƒã‚¤ãƒ³ãƒ‰ã•ã‚Œã¦ã„ã‚‹é™ã‚Š (例ãˆã°ä½œæ¥"
"å˜ä½ (Unit of Work) ã®ä¸ã§å˜ã«ãƒãƒ¼ãƒ‰ã¾ãŸã¯ã‚»ãƒ¼ãƒ–ã•ã‚ŒãŸï¼‰ã€ Hibernate ã¯ã©ã‚“ãª"
"変更もモニターã—ã€é…延書ã込㿠(write-behind) 㧠SQL を実行ã—ã¾ã™ã€‚通常ã€ä½œæ¥"
"å˜ä½ (Unit of Work) ã®æœ€å¾Œã«ã ã‘è¡Œã‚れるデータベースã¨ãƒ¡ãƒ¢ãƒªã®çŠ¶æ…‹ã‚’åŒæœŸã•ã›"
"る処ç†ã¯ã€ <emphasis>フラッシュ ã¨å‘¼ã°ã‚Œã¾ã™ã€‚ã“ã®ã‚³ãƒ¼ãƒ‰ã§ã¯ã€ä½œæ¥"
"å˜ä½ (Unit of Work) ã¯ãƒ‡ãƒ¼ã‚¿ãƒ™ãƒ¼ã‚¹ãƒˆãƒ©ãƒ³ã‚¶ã‚¯ã‚·ãƒ§ãƒ³ã®ã‚³ãƒŸãƒƒãƒˆï¼ˆã‚‚ã—ãã¯ãƒãƒ¼ãƒ«"
"ãƒãƒƒã‚¯ï¼‰ã§çµ‚了ã—ã¾ã™ã€‚ã“ã‚Œã¯ã€ <literal>CurrentSessionContext クラ"
"スã«å¯¾ã—㦠<literal>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 <interfacename>org.hibernate.Session, "
"when it is not in persistent state (if it was persistent before, this state "
"is called <emphasis>detached). You can even modify a collection "
"when it is detached:"
msgstr ""
"ç•°ãªã‚‹ä½œæ¥å˜ä½ (Unit of Work) ã§äººã€…ã¨ã‚¤ãƒ™ãƒ³ãƒˆã‚’ãƒãƒ¼ãƒ‰ã™ã‚‹ã“ã¨ã‚‚当然ã§ãã¾"
"ã™ã€‚ãã†ã§ãªã‘ã‚Œã°ã€æ°¸ç¶šçŠ¶æ…‹ã«ãªã„ã¨ã(以å‰ã«æ°¸ç¶šã§ã‚ã£ãŸãªã‚‰ã€ã“ã®çŠ¶æ…‹ã‚’ "
"<emphasis>分離(detached) ã¨å‘¼ã³ã¾ã™ï¼‰ã€ org."
"hibernate.Session</interfacename> ã®å¤–部ã§ã‚ªãƒ–ジェクトを修æ£ã—ã¾ã™ã€‚分離ã•ã‚Œ"
"ã‚‹ã¨ãã«ã¯ã‚³ãƒ¬ã‚¯ã‚·ãƒ§ãƒ³ã‚’変更ã™ã‚‹ã“ã¨ã‚‚å¯èƒ½ã§ã™ï¼š"
#. Tag: programlisting
#: tutorial.xml:767
#, fuzzy, no-c-format
msgid ""
"<![CDATA[ private void addPersonToEvent(Long personId, Long eventId) {\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"
" 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"
" session2.update(aPerson); // Reattachment of aPerson\n"
"\n"
" session2.getTransaction().commit();\n"
" }]]>"
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 <literal>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 ""
"<literal>update ã®å‘¼ã³å‡ºã—ã¯åˆ†é›¢ã‚ªãƒ–ジェクトをå†ã³æ°¸ç¶šåŒ–ã—ã¾ã™ã€‚ã“"
"ã‚Œã¯ã€æ–°ã—ã„作æ¥å˜ä½ (Unit of Work) ã«ãƒã‚¤ãƒ³ãƒ‰ã™ã‚‹ã¨è¨€ãˆã‚‹ã§ã—ょã†ã€‚ãã®ãŸã‚"
"分離ã®é–“ã«åŠ ãˆã‚‰ã‚ŒãŸã©ã®ã‚ˆã†ãªä¿®æ£ã‚‚データベースã«ã‚»ãƒ¼ãƒ–ã§ãã¾ã™ã€‚エンティ"
"ティオブジェクトã®ã‚³ãƒ¬ã‚¯ã‚·ãƒ§ãƒ³ã¸ã®ä¿®æ£ï¼ˆè¿½åŠ ・削除)もåŒæ§˜ã«ã‚»ãƒ¼ãƒ–ã§ãã¾ã™ã€‚"
#. 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 <literal>EventManager and "
"call it from the command line. If you need the identifiers of a person and "
"an event - the <literal>save() method returns it (you might have "
"to modify some of the previous methods to return that identifier):"
msgstr ""
"ã“ã‚Œã¯ä»Šã¯ã‚ã¾ã‚Šä½¿ã„ã¿ã¡ãŒã‚ã‚Šã¾ã›ã‚“ãŒã€è‡ªåˆ†ã®ã‚¢ãƒ—リケーションã®è¨è¨ˆã«çµ„ã¿è¾¼"
"ã‚€ã“ã¨ãŒã§ãã‚‹é‡è¦ãªã‚³ãƒ³ã‚»ãƒ—トã§ã™ã€‚ãã‚Œã§ã¯ã“ã®ã‚¨ã‚¯ã‚µã‚µã‚¤ã‚ºã®æœ€å¾Œã«ã€ "
"<literal>EventManager ã®ãƒ¡ã‚¤ãƒ³ãƒ¡ã‚½ãƒƒãƒ‰ã«æ–°ã—ã„ã‚¢ã‚¯ã‚·ãƒ§ãƒ³ã‚’è¿½åŠ ã—ã¦"
"コマンドラインã‹ã‚‰å‘¼ã³å‡ºã—ã¦ã¿ã¾ã—ょã†ã€‚人やイベントã®è˜åˆ¥åãŒå¿…è¦ãªã‚‰ã€ "
"<literal>save() メソッドãŒè¿”ã—ã¦ãã‚Œã¾ã™ ï¼ˆå ´åˆã«ã‚ˆã£ã¦ã¯è˜åˆ¥åã‚’è¿”"
"ã™ãŸã‚ã«ãƒ¡ã‚½ãƒƒãƒ‰ã‚’ä¿®æ£ã™ã‚‹å¿…è¦ãŒã‚ã‚‹ã‹ã‚‚ã—ã‚Œã¾ã›ã‚“)。"
#. Tag: programlisting
#: tutorial.xml:786
#, fuzzy, no-c-format
msgid ""
"<![CDATA[ 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"
" }]]>"
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 <literal>int or a java.lang.String. We "
"call these classes <emphasis>value types, and their instances "
"<emphasis>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 <literal>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 "
"<literal>Address or MonetaryAmount class. In "
"fact, in a Hibernate application all JDK classes are considered value types."
msgstr ""
"ã“ã‚Œã¯åŒã˜ã‚ˆã†ã«é‡è¦ãª2ã¤ã®ã‚¯ãƒ©ã‚¹ã€ã¤ã¾ã‚Š2ã¤ã®ã‚¨ãƒ³ãƒ†ã‚£ãƒ†ã‚£é–“ã®é–¢é€£ã®ä¾‹ã§ã—"
"ãŸã€‚å‰ã«è¿°ã¹ãŸã‚ˆã†ã«ã€å…¸åž‹çš„ãªãƒ¢ãƒ‡ãƒ«ã«ã¯ã€æ™®é€šã€Œæ¯”較的é‡è¦ã§ã¯ãªã„ã€ä»–ã®ã‚¯ãƒ©"
"スã¨åž‹ãŒã‚ã‚Šã¾ã™ã€‚ã“ã‚Œã¾ã§ã«è¦‹ãŸã‚ˆã†ãª <literal>int ã‚„ "
"<classname>java.lang.String ã®ã‚ˆã†ãªã‚‚ã®ã§ã™ã€‚ã“ã®ã‚ˆã†ãªã‚¯ãƒ©ã‚¹ã‚’ "
"<emphasis>値型 ã¨è¨€ã„ã¾ã™ã€‚ã“ã®ã‚¤ãƒ³ã‚¹ã‚¿ãƒ³ã‚¹ã¯ç‰¹å®šã®ã‚¨ãƒ³ãƒ†ã‚£ãƒ†ã‚£ã« "
"<emphasis>ä¾å˜ ã—ã¾ã™ã€‚ã“ã®åž‹ã®ã‚¤ãƒ³ã‚¹ã‚¿ãƒ³ã‚¹ã¯ç‹¬è‡ªã® ID ã‚’æŒã¡ã¾ã›"
"ã‚“ã—ã€ã‚¨ãƒ³ãƒ†ã‚£ãƒ†ã‚£é–“ã§å…±æœ‰ã•ã‚Œã‚‹ã“ã¨ã‚‚ã‚ã‚Šã¾ã›ã‚“ (ファーストãƒãƒ¼ãƒ ãŒåŒã˜ã ã£"
"ãŸã¨ã—ã¦ã‚‚ã€2人ã®äººã¯åŒã˜ <literal>firstname オブジェクトをå‚ç…§ã—ã¾"
"ã›ã‚“)。値型ã¯ã‚‚ã¡ã‚ã‚“ JDK 内ã«è¦‹ã¤ã‹ã‚Šã¾ã™ãŒã€ãã‚Œã ã‘ã§ã¯ãªã (実際〠"
"Hibernate アプリケーションã«ãŠã„ã¦ã™ã¹ã¦ã® JDK クラスã¯å€¤åž‹ã¨è¦‹ãªã›ã¾ã™ï¼‰ã€ "
"例ãˆã° <literal>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 ã§ã¯ã»ã¨ã‚“ã©åŒã˜ã‚ˆã†ã«è¦‹ãˆ"
"ã¾ã™ã€‚"
#. 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 <literal>Person "
"entity. This will be represented as a <interfacename>java.util.Setjava.lang.String instances:"
msgstr ""
#. Tag: programlisting
#: tutorial.xml:823
#, fuzzy, no-c-format
msgid ""
"<![CDATA[ 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"
" }]]>"
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 <literal>Set is as follows:"
msgstr "ã“ã® <literal>Set ã®ãƒžãƒƒãƒ”ングã§ã™ï¼š"
#. Tag: programlisting
#: tutorial.xml:829
#, fuzzy, no-c-format
msgid ""
"<![CDATA[ "
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 "
"<literal>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 <literal>string attribute of the set element defines the foreign-key column name in the "
"collection table. The <literal>column attribute in the "
"<literal>element element defines the column name where the email "
"address values will actually be stored."
msgstr ""
"å‰ã®ãƒžãƒƒãƒ”ングã¨æ¯”ã¹ã¦é•ã†ã®ã¯ <literal>element ã®éƒ¨åˆ†ã§ã™ãŒã€ "
"Hibernate ã«ã“ã®ã‚³ãƒ¬ã‚¯ã‚·ãƒ§ãƒ³ãŒä»–ã®ã‚¨ãƒ³ãƒ†ã‚£ãƒ†ã‚£ã¸ã®å‚照をå«ã¾ãšã€ "
"<literal>string åž‹ã®è¦ç´ ã®ã‚³ãƒ¬ã‚¯ã‚·ãƒ§ãƒ³ã‚’å«ã‚€ã“ã¨ã‚’æ•™ãˆã¾ã™ï¼ˆå°æ–‡å—"
"ã®åå‰ (string) 㯠Hibernate ã®ãƒžãƒƒãƒ”ング型ã¾ãŸã¯ã‚³ãƒ³ãƒãƒ¼ã‚¿ã§ã‚ã‚‹ã¨ã„ã†ã“ã¨ã§"
"ã™ï¼‰ã€‚ç¹°ã‚Šè¿”ã—ã¾ã™ãŒã€<literal>set è¦ç´ ã® table "
"属性ã¯ã€ã‚³ãƒ¬ã‚¯ã‚·ãƒ§ãƒ³ã®ãŸã‚ã®ãƒ†ãƒ¼ãƒ–ルåを指定ã—ã¾ã™ã€‚ <literal>key "
"è¦ç´ ã¯ã‚³ãƒ¬ã‚¯ã‚·ãƒ§ãƒ³ãƒ†ãƒ¼ãƒ–ルã®å¤–部ã‚ーカラムåを定義ã—ã¾ã™ã€‚ <literal>elementcolumn 属性㯠string ã®"
"値ãŒå®Ÿéš›ã«æ ¼ç´ã•ã‚Œã‚‹ã‚«ãƒ©ãƒ ã®åå‰ã‚’定義ã—ã¾ã™ã€‚"
#. 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 ""
"<![CDATA[\n"
" _____________ __________________\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"
" |_____________|\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 "
"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 ""
"コレクションテーブルã®ä¸»ã‚ーã¯ã€å®Ÿéš›ã¯ä¸¡æ–¹ã®ã‚«ãƒ©ãƒ を使ã£ãŸè¤‡åˆã‚ーã§ã‚ã‚‹ã“ã¨"
"ãŒã‚ã‹ã‚Šã¾ã™ã€‚ã“ã‚Œã¯äººã”ã¨ã« E メールアドレスãŒé‡è¤‡ã§ããªã„ã¨ã„ã†ã“ã¨ã§ã€ "
"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 "
"by linking persons and events. It is the same code in Java:"
msgstr ""
"以å‰äººã¨ã‚¤ãƒ™ãƒ³ãƒˆã‚’関連ã¥ã‘ãŸã¨ãã¨å…¨ãåŒã˜ã‚ˆã†ã«ã€ä»Šã‚„試ã—ã«ã‚³ãƒ¬ã‚¯ã‚·ãƒ§ãƒ³ã«è¦"
"ç´ ã‚’è¿½åŠ ã™ã‚‹ã“ã¨ãŒã§ãるよã†ã«ãªã‚Šã¾ã—ãŸã€‚ 両方ã¨ã‚‚ Java ã§ã¯åŒã˜ã‚³ãƒ¼ãƒ‰ã§ã™ã€‚"
#. Tag: programlisting
#: tutorial.xml:864
#, fuzzy, no-c-format
msgid ""
"<![CDATA[ private void addEmailToPerson(Long personId, String "
"emailAddress) {\n"
" Session session = HibernateUtil.getSessionFactory().getCurrentSession"
"();\n"
" session.beginTransaction();\n"
"\n"
" Person aPerson = (Person) session.load(Person.class, personId);\n"
" // adding to the emailAddress collection might trigger a lazy load "
"of the collection\n"
" aPerson.getEmailAddresses().add(emailAddress);\n"
"\n"
" session.getTransaction().commit();\n"
" }]]>"
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 <emphasis>fetch query to initialize "
"the collection. Monitor the SQL log and try to optimize this with an eager "
"fetch."
msgstr ""
"今回ã€ã‚³ãƒ¬ã‚¯ã‚·ãƒ§ãƒ³ã®åˆæœŸåŒ–ã« <emphasis>fetch クエリを使用ã—ã¾ã›ã‚“"
"ã§ã—ãŸã€‚ãã®ãŸã‚〠getter メソッドã®å‘¼ã³å‡ºã—ã«ã‚ˆã£ã¦ã‚³ãƒ¬ã‚¯ã‚·ãƒ§ãƒ³ã‚’åˆæœŸåŒ–ã™ã‚‹"
"ãŸã‚ã® SELECT ãŒå®Ÿè¡Œã•ã‚Œã‚‹ã®ã§ã€ã‚³ãƒ¬ã‚¯ã‚·ãƒ§ãƒ³ã«è¦ç´ ã‚’è¿½åŠ ã§ãã¾ã™ã€‚ SQL ã®ãƒã‚°"
"を監視ã—ã¦ã€å³æ™‚フェッãƒã‚’使ã£ã¦æœ€é©åŒ–ã—ã¦ãã ã•ã„。"
#. 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 ""
"次ã«åŒæ–¹å‘関連をマッピングã—ã¾ã™ã€‚ Java ã§ä¸¡å´ã‹ã‚‰äººã¨ã‚¤ãƒ™ãƒ³ãƒˆã®é–¢é€£ã‚’動作ã•"
"ã›ã¾ã™ã€‚ã‚‚ã¡ã‚ã‚“ã€ãƒ‡ãƒ¼ã‚¿ãƒ™ãƒ¼ã‚¹ã‚¹ã‚ーマã¯å¤‰ã‚ã‚Šã¾ã›ã‚“ãŒã€å¤šé‡åº¦ã¯å¤šå¯¾å¤šã®ã¾ã¾"
"ã§ã™ã€‚"
#. 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 <literal>Event "
"class:"
msgstr ""
"ã¾ãš <literal>Event イベントクラスã«å‚åŠ è€…ã®ã‚³ãƒ¬ã‚¯ã‚·ãƒ§ãƒ³ã‚’è¿½åŠ ã—ã¾"
"ã™ï¼š"
#. Tag: programlisting
#: tutorial.xml:898
#, fuzzy, no-c-format
msgid ""
"<![CDATA[ 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"
" }]]>"
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 <literal>Event.hbm.xml."
msgstr ""
"ãã‚Œã§ã¯ <literal>Event.hbm.xml ã§é–¢é€£ã®ã“ã¡ã‚‰å´ã‚’マッピングã—ã¦ã"
"ã ã•ã„。"
#. Tag: programlisting
#: tutorial.xml:904
#, fuzzy, no-c-format
msgid ""
"<![CDATA[ "
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 <literal>set mappings in both mapping documents. "
"Notice that the column names in <literal>key and many-to-"
"many</literal> swap in both mapping documents. The most important addition "
"here is the <literal>inverse=\"true\" attribute in the "
"<literal>set element of the Event's collection "
"mapping."
msgstr ""
"ã”覧ã®ã¨ãŠã‚Šã€ã„ãšã‚Œã®ãƒžãƒƒãƒ”ングドã‚ュメント (XMLファイル) ã§ã‚‚ã€æ™®é€šã® "
"<literal>set マッピングを使ã£ã¦ã„ã¾ã™ã€‚ key 㨠"
"<literal>many-to-many ã®ã‚«ãƒ©ãƒ åãŒã€ä¸¡æ–¹ã®ãƒžãƒƒãƒ”ングドã‚ュメントã§"
"入れ替ãˆã«ãªã£ã¦ã„ã‚‹ã“ã¨ã«æ³¨ç›®ã—ã¦ãã ã•ã„。ã“ã“ã§æœ€ã‚‚é‡è¦ãªè¿½åŠ é …ç›®ã¯ã€ "
"<literal>Event ã®ã‚³ãƒ¬ã‚¯ã‚·ãƒ§ãƒ³ãƒžãƒƒãƒ”ング㮠set è¦"
"ç´ ã«ã‚ã‚‹ <literal>inverse=\"true\" 属性ã§ã™ã€‚"
#. Tag: para
#: tutorial.xml:914
#, no-c-format
msgid ""
"What this means is that Hibernate should take the other side, the "
"<literal>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 ""
"ã“ã®æŒ‡å®šã®æ„味ã¯ã€2ã¤ã®é–“ã®ã‚¨ãƒ³ãƒ†ã‚£ãƒ†ã‚£é–“ã®ãƒªãƒ³ã‚¯ã«ã¤ã„ã¦ã®æƒ…å ±ã‚’æŽ¢ã™å¿…è¦ãŒã‚"
"ã‚‹ã¨ã〠Hibernate ã¯å対å´ã®ã‚¨ãƒ³ãƒ†ã‚£ãƒ†ã‚£ã€ã¤ã¾ã‚Š <literal>Person "
"クラスã‹ã‚‰æŽ¢ã™ã¨ã„ã†ã“ã¨ã§ã™ã€‚一度2ã¤ã®ã‚¨ãƒ³ãƒ†ã‚£ãƒ†ã‚£é–“ã®åŒæ–¹å‘リンクãŒã©ã®ã‚ˆã†"
"ã«ä½œæˆã•ã‚Œã‚‹ã‹ãŒã‚ã‹ã‚Œã°ã€ã“れをç†è§£ã™ã‚‹ã“ã¨ã¯ã¨ã¦ã‚‚ç°¡å˜ã§ã™ã€‚"
#. 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 <literal>Person and an "
"<literal>Event in the unidirectional example? You add an instance "
"of <literal>Event to the collection of event references, of an "
"instance of <literal>Person. If you want to make this link bi-"
"directional, you have to do the same on the other side by adding a "
"<literal>Person reference to the collection in an EventEvent ã®é–“ã®ãƒªãƒ³ã‚¯ã‚’作æˆã—ãŸã§ã—ょã†ã‹ï¼Ÿ "
"<literal>Person ã®ã‚¤ãƒ³ã‚¹ã‚¿ãƒ³ã‚¹ã®ã‚¤ãƒ™ãƒ³ãƒˆã¸ã®å‚ç…§ã®ã‚³ãƒ¬ã‚¯ã‚·ãƒ§ãƒ³ã« "
"<literal>Event ã®ã‚¤ãƒ³ã‚¹ã‚¿ãƒ³ã‚¹ã‚’è¿½åŠ ã—ã¾ã—ãŸã€‚ãã®ãŸã‚ã“ã®ãƒªãƒ³ã‚¯ã‚’åŒ"
"æ–¹å‘ã«ã—ãŸã‘ã‚Œã°ã€å½“ãŸã‚Šå‰ã§ã™ãŒå対å´ã«ã‚‚åŒã˜ã“ã¨ã‚’ã—ãªã‘ã‚Œã°ãªã‚Šã¾ã›ã‚“。 "
"<literal>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 <literal>Person):"
msgstr ""
"多ãã®é–‹ç™ºè€…ã¯æ…Žé‡ã«ãƒ—ãƒã‚°ãƒ©ãƒ ã™ã‚‹ã®ã§ã€ã‚¨ãƒ³ãƒ†ã‚£ãƒ†ã‚£ã®ä¸¡å´ã«æ£ã—ã関連をè¨å®š"
"ã™ã‚‹ãƒªãƒ³ã‚¯ç®¡ç†ãƒ¡ã‚½ãƒƒãƒ‰ã‚’作æˆã—ã¾ã™ã€‚例ãˆã° <literal>Person ã§ã¯ä»¥ä¸‹"
"ã®ã‚ˆã†ã«ãªã‚Šã¾ã™ã€‚:"
#. Tag: programlisting
#: tutorial.xml:940
#, fuzzy, no-c-format
msgid ""
"<![CDATA[ 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"
" }]]>"
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 ""
"コレクションã®ã‚²ãƒƒãƒˆã¨ã‚»ãƒƒãƒˆãƒ¡ã‚½ãƒƒãƒ‰ãŒç¾åœ¨ protected ã«ãªã£ã¦ã„ã‚‹ã“ã¨ã«æ³¨æ„ã—"
"ã¦ãã ã•ã„。ã“ã‚Œã¯åŒã˜ãƒ‘ッケージã®ã‚¯ãƒ©ã‚¹ã‚„サブクラスã®ãƒ¡ã‚½ãƒƒãƒ‰ã¯ä¾ç„¶ã‚¢ã‚¯ã‚»ã‚¹"
"ãŒå¯èƒ½ã§ã™ãŒã€ (ã»ã¨ã‚“ã©ï¼‰ ãã®ãƒ‘ッケージ外ã®ã©ã®ã‚¯ãƒ©ã‚¹ã§ã‚‚直接ãã®ã‚³ãƒ¬ã‚¯"
"ションをå°ç„¡ã—ã«ã™ã‚‹ã“ã¨ã‚’防ãŽã¾ã™ã€‚ãŠãらãå対å´ã®ã‚³ãƒ¬ã‚¯ã‚·ãƒ§ãƒ³ã«ã‚‚åŒã˜ã“ã¨"
"ã‚’ã—ãŸæ–¹ãŒã„ã„ã§ã—ょã†ã€‚"
#. Tag: para
#: tutorial.xml:949
#, no-c-format
msgid ""
"What about the <literal>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 <literal>INSERT and "
"<literal>UPDATE statements (to avoid constraint violations). "
"Making one side of the association <literal>inverse tells "
"Hibernate to consider it a <emphasis>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 <literal>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 ""
"<literal>inverse マッピング属性ã¨ã¯ã„ã£ãŸã„何ã§ã—ょã†ã‹ï¼Ÿé–‹ç™ºè€…㨠"
"Java ã«ã¨ã£ã¦ã¯ã€åŒæ–¹å‘リンクã¯å˜ã«ä¸¡å´ã®å‚照をæ£ã—ãè¨å®šã™ã‚‹ã¨ã„ã†ã“ã¨ã§ã™ã€‚"
"ã—ã‹ã— Hibernate ã¯ï¼ˆåˆ¶ç´„é•åã‚’é¿ã‘ã‚‹ãŸã‚ã«ï¼‰ SQL ã® <literal>INSERTUPDATE 文をæ£ç¢ºã«å¤‰æ›´ã™ã‚‹ãŸã‚ã®å分ãªæƒ…å ±ã‚’"
"æŒã£ã¦ã„ãªã„ã®ã§ã€åŒæ–¹å‘関連プãƒãƒ‘ティを扱ã†ãŸã‚ã®ä½•ã‚‰ã‹ã®åŠ©ã‘ã‚’å¿…è¦ã¨ã—ã¾"
"ã™ã€‚関連ã®ç‰‡å´ã‚’ <literal>inverse ã«è¨å®šã™ã‚‹ã“ã¨ã§ã€ Hibernate ã¯åŸº"
"本的ã«ã¯è¨å®šã—ãŸå´ã‚’無視ã—ã€å対å´ã® <emphasis>é¡ ã¨ã—ã¦è€ƒãˆã¾ã™ã€‚"
"ã“ã‚Œã ã‘ã§ã€ Hibernate ã¯æ–¹å‘ã‚’æŒã¤ãƒŠãƒ“ゲーションモデルを SQL データベースス"
"ã‚ーマã¸å¤‰æ›ã™ã‚‹ã¨ãã®ã™ã¹ã¦ã®å•é¡Œã«ã†ã¾ã対処ã§ãã¾ã™ã€‚覚ãˆã¦ãŠã‹ãªã‘ã‚Œã°ãª"
"らãªã„ルールã¯ç°¡å˜ã§ã™ã€‚åŒæ–¹å‘関連ã¯å¿…ãšç‰‡å´ã‚’ <literal>inverse ã«"
"ã™ã‚‹å¿…è¦ãŒã‚ã‚‹ã¨ã„ã†ã“ã¨ã§ã™ã€‚一対多関連ã§ã¯ãã‚Œã¯å¤šå´ã§ãªã‘ã‚Œã°ãªã‚Šã¾ã›ã‚“。"
"多対多関連ã§ã¯ã©ã¡ã‚‰å´ã§ã‚‚構ã„ã¾ã›ã‚“。ã©ã¡ã‚‰ã§ã‚‚é•ã„ã¯ã‚ã‚Šã¾ã›ã‚“。"
#. 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 <literal>Session and "
"<literal>Transaction almost like a standalone application. "
"However, some common patterns are useful. You can now write an "
"<literal>EventManagerServlet. This servlet can list all events "
"stored in the database, and it provides an HTML form to enter new events."
msgstr ""
"Hibernate ã® Web アプリケーションã¯ã€ã‚¹ã‚¿ãƒ³ãƒ‰ã‚¢ãƒãƒ¼ãƒ³ã®ã‚¢ãƒ—リケーションã®ã‚ˆã†"
"ã« <literal>Session 㨠Transaction を使用ã—ã¾"
"ã™ã€‚ã—ã‹ã—ã„ãã¤ã‹ã®ä¸€èˆ¬çš„ãªãƒ‘ターンãŒå½¹ç«‹ã¡ã¾ã™ã€‚ã“ã“㧠"
"<literal>EventManagerServlet を作æˆã—ã¾ã™ã€‚ã“ã®ã‚µãƒ¼ãƒ–レットã¯ã€ãƒ‡ãƒ¼"
"タベースã«æ ¼ç´ã—ãŸå…¨ã¦ã®ã‚¤ãƒ™ãƒ³ãƒˆã‚’リストã«ã§ãã€ã•ã‚‰ã« HTML フォームã‹ã‚‰æ–°ã—"
"ã„イベントを入力ã§ãã‚‹ã‚‚ã®ã§ã™ã€‚"
#. 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 <literal>GET requests, we will only implement the "
"<literal>doGet() method:"
msgstr ""
"Servlet 㯠HTTP ã® <literal>GET リクエストã®ã¿ã‚’処ç†ã™ã‚‹ã®ã§ã€ "
"<literal>doGet() を実装ã—ã¾ã™ã€‚"
#. Tag: programlisting
#: tutorial.xml:983
#, fuzzy, no-c-format
msgid ""
"<![CDATA[package org.hibernate.tutorial.web;\n"
"\n"
"// Imports\n"
"\n"
"public class EventManagerServlet extends HttpServlet {\n"
"\n"
" protected void doGet(\n"
" HttpServletRequest request,\n"
" HttpServletResponse response) throws ServletException, "
"IOException {\n"
"\n"
" SimpleDateFormat dateFormatter = new SimpleDateFormat( \"dd.MM.yyyy"
"\" );\n"
"\n"
" try {\n"
" // Begin unit of work\n"
" HibernateUtil.getSessionFactory().getCurrentSession()."
"beginTransaction();\n"
"\n"
" // Process request and render page...\n"
"\n"
" // End unit of work\n"
" HibernateUtil.getSessionFactory().getCurrentSession()."
"getTransaction().commit();\n"
" }\n"
" catch (Exception ex) {\n"
" HibernateUtil.getSessionFactory().getCurrentSession()."
"getTransaction().rollback();\n"
" if ( ServletException.class.isInstance( ex ) ) {\n"
" throw ( ServletException ) ex;\n"
" }\n"
" else {\n"
" throw new ServletException( ex );\n"
" }\n"
" }\n"
" }\n"
"\n"
"}]]>"
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 <filename>src/main/java/org/hibernate/tutorial/web/"
"EventManagerServlet.java</filename>"
msgstr ""
#. Tag: para
#: tutorial.xml:990
#, no-c-format
msgid ""
"The pattern applied here is called <emphasis>session-per-request. "
"When a request hits the servlet, a new Hibernate <literal>Session "
"is opened through the first call to <literal>getCurrentSession() "
"on the <literal>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 ""
"ã“れ㯠<emphasis>session-per-request ã¨ã„ã†ãƒ‘ターンã§ã™ã€‚ Servlet "
"ãŒãƒªã‚¯ã‚¨ã‚¹ãƒˆã‚’å—ã‘å–ã‚‹ã¨ã€ <literal>SessionFactory ã® "
"<literal>getCurrentSession() ã®æœ€åˆã®å‘¼ã³å‡ºã—ã§ã€ Hibernate ã®æ–°ã—"
"ã„ <literal>Session ãŒé–‹ã‹ã‚Œã¾ã™ã€‚ãã®ã¨ãデータベーストランザク"
"ションãŒé–‹å§‹ã•ã‚Œã¾ã™ã€‚データã®èªã¿æ›¸ãã«é–¢ã‚らãšã€ã™ã¹ã¦ã®ãƒ‡ãƒ¼ã‚¿ã‚¢ã‚¯ã‚»ã‚¹ã¯ãƒˆ"
"ランザクション内ã§è¡Œã„ã¾ã™ï¼ˆã‚¢ãƒ—リケーション内ã§ã¯ã‚ªãƒ¼ãƒˆã‚³ãƒŸãƒƒãƒˆãƒ¢ãƒ¼ãƒ‰ã‚’使用"
"ã—ã¾ã›ã‚“)。"
#. Tag: para
#: tutorial.xml:999
#, no-c-format
msgid ""
"Do <emphasis>not use a new Hibernate Session "
"for every database operation. Use one Hibernate <literal>Session "
"that is scoped to the whole request. Use <literal>getCurrentSession()ã—ãªã„ã§ãã ã•ã„ 。全ã¦ã®ãƒªã‚¯ã‚¨ã‚¹ãƒˆã§æ©Ÿ"
"能ã™ã‚‹ã€ï¼‘ã¤ã® Hibernate <literal>Session を使用ã—ã¦ãã ã•ã„。自動"
"çš„ã«ç¾åœ¨ã® Java スレッドã«ãƒã‚¤ãƒ³ãƒ‰ã•ã‚Œã‚‹ã®ã§ã€ <literal>getCurrentSession() 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 <emphasis>Open Session in View. You will need it as soon "
"as you consider rendering your view in JSP, not in a servlet."
msgstr ""
"最後ã«ãƒªã‚¯ã‚¨ã‚¹ãƒˆã®å‡¦ç†ã¨ HTML æç”»ãŒå®Œäº†ã—ãŸã¨ãã«ã€ä½œæ¥å˜ä½ (Unit of Work) "
"を終了ã—ã¾ã™ã€‚ã‚‚ã—処ç†ã‚„æç”»ä¸ã«å•é¡ŒãŒç™ºç”Ÿã—ãŸå ´åˆã€ä¾‹å¤–ãŒé€å‡ºã•ã‚Œã¦ã¦ãƒ‡ãƒ¼ã‚¿"
"ベーストランザクションをãƒãƒ¼ãƒ«ãƒãƒƒã‚¯ã—ã¾ã™ã€‚ã“れ㧠<literal>session-per-"
"request</literal> パターンãŒå®Œäº†ã—ã¾ã™ã€‚å…¨ã¦ã®ã‚µãƒ¼ãƒ–レットã«ãƒˆãƒ©ãƒ³ã‚¶ã‚¯ã‚·ãƒ§ãƒ³"
"境界ã®ã‚³ãƒ¼ãƒ‰ã‚’書ã代ã‚ã‚Šã«ã€ã‚µãƒ¼ãƒ–レットフィルタã«è¨˜è¿°ã™ã‚‹ã“ã¨ã‚‚å¯èƒ½ã§ã™ã€‚ "
"<emphasis>Open Session in View ã¨å‘¼ã°ã‚Œã‚‹ã“ã®ãƒ‘ターンã«ã¤ã„ã¦ã¯ã€ "
"Hibernate ã® Web サイトや Wiki ã‚’å‚ç…§ã—ã¦ãã ã•ã„。サーブレットã§ã¯ãªã JSP "
"㧠HTML æ画をã—よã†ã¨ã™ã‚‹ã¨ã€ã™ãã«ã“ã®ãƒ‘ターンã«ã¤ã„ã¦ã®æƒ…å ±ãŒå¿…è¦ã«ãªã‚‹ã§"
"ã—ょã†ã€‚"
#. 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 ""
"<![CDATA[ // Write HTML header\n"
" PrintWriter out = response.getWriter();\n"
" out.println(\"<html>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(\"<b>Please enter event title and date.Added event.\");\n"
" }\n"
" }\n"
"\n"
" // Print page\n"
" printEventForm(out);\n"
" listEvents(out, dateFormatter);\n"
"\n"
" // Write HTML footer\n"
" out.println(\"</body>\");\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 "
"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 ã®"
"ヘッダーã¨ãƒ•ãƒƒã‚¿ãƒ¼ã®è¨˜è¿°ã§ã™ã€‚ã“ã®ãƒšãƒ¼ã‚¸ã«ã¯ã€ã‚¤ãƒ™ãƒ³ãƒˆã‚’入力ã™ã‚‹ HTML フォー"
"ムã¨ã€ãƒ‡ãƒ¼ã‚¿ãƒ™ãƒ¼ã‚¹ã«ã‚ã‚‹å…¨ã¦ã®ã‚¤ãƒ™ãƒ³ãƒˆã®ãƒªã‚¹ãƒˆãŒè¡¨ç¤ºã•ã‚Œã¾ã™ã€‚最åˆã®ãƒ¡ã‚½ãƒƒãƒ‰"
"ã¯ã”ãå˜ç´”㪠HTML 出力ã§ã™ã€‚"
#. Tag: programlisting
#: tutorial.xml:1042
#, fuzzy, no-c-format
msgid ""
"<![CDATA[ private void printEventForm(PrintWriter out) {\n"
" out.println(\"<h2>Add new event:\");\n"
" out.println(\"<form>\");\n"
" out.println(\"Title: <input name='eventTitle' length='50'/> "
"\");\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"
" }]]>"
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 <literal>listEvents() method uses the Hibernate "
"<literal>Session bound to the current thread to execute a query:"
msgstr ""
"<literal>listEvents() メソッドã¯ã€ç¾åœ¨ã®ã‚¹ãƒ¬ãƒƒãƒ‰ã«çµã³ã¤ã "
"Hibernate ã® <literal>Session を使用ã—ã¦ã€ã‚¯ã‚¨ãƒªã‚’実行ã—ã¾ã™ã€‚"
#. Tag: programlisting
#: tutorial.xml:1050
#, fuzzy, no-c-format
msgid ""
"<![CDATA[ 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:\");\n"
" out.println(\"<table border='1'>\");\n"
" out.println(\"<tr>\");\n"
" out.println(\"<th>Event title\");\n"
" out.println(\"<th>Event date\");\n"
" out.println(\"</tr>\");\n"
" Iterator it = result.iterator();\n"
" while (it.hasNext()) {\n"
" Event event = (Event) it.next();\n"
" out.println(\"<tr>\");\n"
" out.println(\"<td>\" + event.getTitle() + \" |