|
From: <hib...@li...> - 2006-08-10 00:27:32
|
Author: honma
Date: 2006-08-09 20:27:25 -0400 (Wed, 09 Aug 2006)
New Revision: 10238
Modified:
trunk/Hibernate3/doc/reference/ja/master.xml
trunk/Hibernate3/doc/reference/ja/modules/architecture.xml
trunk/Hibernate3/doc/reference/ja/modules/basic_mapping.xml
trunk/Hibernate3/doc/reference/ja/modules/query_sql.xml
trunk/Hibernate3/doc/reference/ja/modules/tutorial.xml
trunk/Hibernate3/doc/reference/ja/readme_ja.txt
Log:
I've finished translating reference document v3.2.0 at last : )
Modified: trunk/Hibernate3/doc/reference/ja/master.xml
===================================================================
--- trunk/Hibernate3/doc/reference/ja/master.xml 2006-08-09 21:12:56 UTC (rev 10237)
+++ trunk/Hibernate3/doc/reference/ja/master.xml 2006-08-10 00:27:25 UTC (rev 10238)
@@ -33,7 +33,7 @@
<bookinfo>
<title>HIBERNATE - Relational Persistence for Idiomatic Java</title>
<subtitle>Hibernate Reference Documentation</subtitle>
- <releaseinfo>3.1.2</releaseinfo>
+ <releaseinfo>3.2 cr3</releaseinfo>
</bookinfo>
<toc/>
@@ -42,19 +42,6 @@
<title>O</title>
<para>
- WARNING! This is a translated version of the English Hibernate reference
- documentation. The translated version might not be up to date! However, the
- differences should only be very minor. Consult the English reference
- documentation if you are missing information or encounter a translation
- error. If you like to contribute to a particular translation, contact us
- on the Hibernate developer mailing list.
- </para>
-
- <para>
- Translator(s): Chikara Honma, Yusuke Hiroto;
- </para>
-
- <para>
ƊɂāAIuWFNgwgEFAƃ[Vif[^x[XɊւ ώGŖcԂvƂ܂B
HibernateavãIuWFNg/[Vi}bsOc[łB
@@ -65,7 +52,7 @@
<para>
HibernateavaNX[^x[Xe[uցiavaf[^^Lf[^^ցj
- ̃}bsO邾ł͂ȂAf[^̃NGƕ̎dg݂܂B
+ ̃}bsO邾ł͂ȂAf[^̃NGƕ̎dg݂܂B
̂QLDBCƂł̃f[^ɔJԂɍ팸ł܂B
</para>
@@ -89,8 +76,6 @@
<para>
<xref linkend="tutorial"/> B
iKIɉĂ܂B
- <xref linkend="tutorial"/> B
- iKIɉĂ܂B
`[gÃ\[XR[h̓fBXgr[V
<literal>doc/reference/tutorial</literal> fBNgɊ܂܂܂B
</para>
@@ -127,11 +112,11 @@
FAQibernateEFuTCgɂB
</para>
</listitem>
- <listitem>
+ <listitem>
<para>
T[hp[eB̃fA`[gAibernateEFuTCgɃNB
</para>
- </listitem>
+ </listitem>
<listitem>
<para>
HibernateEFuTCg̃R~jeBGÁAfUCp^[₳܂܂ȓ\[V
@@ -142,9 +127,9 @@
<para>
₪HibernateEFuTCg̃[UtH[pĂB
- ܂oO|[gƃtB[`NGXĝIRAǐՃVXeӂĂ܂B
+ ܂oO|[gƃtB[`NGXĝIRAۑՃVXeӂĂ܂B
Hibernate̊JɋAJ҃[OXgɎQĂB
- ̃hLgȂB̌|ꍇ́A
+ ̃hLgȂ̍̌tɖ|ꍇ́A
J҃[OXgŎɃR^NgĂB
</para>
@@ -154,7 +139,7 @@
Hibernaterofessional Open SourcevWFNgA
Boss Enterprise Middleware SystemiJEMSjv_NgXC[g̃NeBJR|[lgłB
</para>
-
+
<sect1 id="preface-s1" revision="-1">
<title>/title>
@@ -179,7 +164,7 @@
<title>Ŗ|ɂ/title>
<para id="preface-s1-1-p4" revision="-1">
- Ńo[W3.1.2̖|GNT
+ Ńo[W3.2 cr3̖|GNT
i<ulink url="http://www.exa-corp.co.jp">z[y[W͂ulink>j
̈ȉ̃o[ōs܂B
{ԗ́i6,18,19,21,22,23͒SjA
Modified: trunk/Hibernate3/doc/reference/ja/modules/architecture.xml
===================================================================
--- trunk/Hibernate3/doc/reference/ja/modules/architecture.xml 2006-08-09 21:12:56 UTC (rev 10237)
+++ trunk/Hibernate3/doc/reference/ja/modules/architecture.xml 2006-08-10 00:27:25 UTC (rev 10238)
@@ -7,9 +7,6 @@
<title>T/title>
<para>
- A (very) high-level view of the Hibernate architecture:
- </para>
- <para>
HibernateA[LeN`́iɁjxr[F
</para>
@@ -23,23 +20,12 @@
</mediaobject>
<para>
- This diagram shows Hibernate using the database and configuration data to
- provide persistence services (and persistent objects) to the application.
- </para>
- <para>
̐}ibernateAAvP[VɑĉiT[rX
iƉiIuWFNgj邽߂ɁAf[^x[XƐݒ[^Ƃ Ă܂B
</para>
<para>
- We would like to show a more detailed view of the runtime architecture.
- Unfortunately, Hibernate is flexible and supports several approaches. We will
- show the two extremes. The "lite" architecture has the application
- provide its own JDBC connections and manage its own transactions. This approach
- uses a minimal subset of Hibernate's APIs:
- </para>
- <para>
ŎsA[LeN`̂ڍׂȃr[܂傤B
ɂAHibernate͏_낢Av[`|[gĂ܂B
ł́A2̋ɒ[ȗ܂B
@@ -58,10 +44,6 @@
</mediaobject>
<para>
- The "full cream" architecture abstracts the application away from the
- underlying JDBC/JTA APIs and lets Hibernate take care of the details.
- </para>
- <para>
udvA[LeN`́AAvP[V̉ɈʒuBCAPI ĒۉȀڍׂ̖ʓ|ernateɌ܂B
</para>
@@ -83,13 +65,6 @@
<term>SessionFactory (<literal>org.hibernate.SessionFactory</literal>)</term>
<listitem>
<para>
- A threadsafe (immutable) cache of compiled mappings for a single database.
- A factory for <literal>Session</literal> and a client of
- <literal>ConnectionProvider</literal>. Might hold an optional (second-level)
- cache of data that is reusable between transactions, at a
- process- or cluster-level.
- </para>
- <para>
1̃f[^x[XɑpCꂽ}bsO XbhZ[tȁiXVs\́jLbVB
<literal>Session</literal> ̃t@Ngł
@@ -103,13 +78,6 @@
<term>Session (<literal>org.hibernate.Session</literal>)</term>
<listitem>
<para>
- A single-threaded, short-lived object representing a conversation between
- the application and the persistent store. Wraps a JDBC connection. Factory
- for <literal>Transaction</literal>. Holds a mandatory (first-level) cache
- of persistent objects, used when navigating the object graph or looking up
- objects by identifier.
- </para>
- <para>
AvP[VƉiXgAƂ̑ΘbA
VOXbhŒZ̃IuWFNgB
JDBCRlNVbv܂B
@@ -124,14 +92,6 @@
<term>Persistent objects Collections</term>
<listitem>
<para>
- Short-lived, single threaded objects containing persistent state and business
- function. These might be ordinary JavaBeans/POJOs, the only special thing about
- them is that they are currently associated with (exactly one)
- <literal>Session</literal>. As soon as the <literal>Session</literal> is closed,
- they will be detached and free to use in any application layer (e.g. directly
- as data transfer objects to and from presentation).
- </para>
- <para>
iƃrWlX\bhAZŃVOXbh̃IuWFNgB
ʏJavaBeans/POJÔƂAIȂƂ́A
̎_ł́i1́j <literal>Session</literal> Ɗ֘AĂ邱ƂłB
@@ -146,12 +106,6 @@
<term>Transient detached objects Collections</term>
<listitem>
<para>
- Instances of persistent classes that are not currently associated with a
- <literal>Session</literal>. They may have been instantiated by
- the application and not (yet) persisted or they may have been instantiated by a
- closed <literal>Session</literal>.
- </para>
- <para>
_ł<literal>Session</literal> Ɗ֘AĂȂA
iNX̃CX^XB
łɃAvP[VŃCX^XāA܂iȂA
@@ -163,14 +117,6 @@
<term>Transaction (<literal>org.hibernate.Transaction</literal>)</term>
<listitem>
<para>
- (Optional) A single-threaded, short-lived object used by the application to
- specify atomic units of work. Abstracts application from underlying JDBC,
- JTA or CORBA transaction. A <literal>Session</literal> might span several
- <literal>Transaction</literal>s in some cases. However, transaction demarcation,
- either using the underlying API or <literal>Transaction</literal>, is never
- optional!
- </para>
- <para>
(IvV)qPUnit of Work)肷邽߂ɁAAvP[Vgp
VOXbhŒZȃIuWFNgB
ɈʒuBCAJTAACORBAgUNVvP[V𒊏ۉ܂B
@@ -185,11 +131,6 @@
<term>ConnectionProvider (<literal>org.hibernate.connection.ConnectionProvider</literal>)</term>
<listitem>
<para>
- (Optional) A factory for (and pool of) JDBC connections. Abstracts application from
- underlying <literal>Datasource</literal> or <literal>DriverManager</literal>.
- Not exposed to application, but can be extended/implemented by the developer.
- </para>
- <para>
(IvV)JDBCRlNViƂ̃v[j̃t@NgB
̑wɈʒuliteral>Datasource</literal> <literal>DriverManager</literal> vP[V𒊏ۉ܂B
@@ -201,10 +142,6 @@
<term>TransactionFactory (<literal>org.hibernate.TransactionFactory</literal>)</term>
<listitem>
<para>
- (Optional) A factory for <literal>Transaction</literal> instances. Not exposed to the
- application, but can be extended/implemented by the developer.
- </para>
- <para>
(IvV) <literal>Transaction</literal> CX^X̃t@NgB
AvP[Vɂ͌AJ҂p܂͎邱Ƃ͉\łB
</para>
@@ -214,10 +151,6 @@
<term><emphasis>Extension Interfaces</emphasis></term>
<listitem>
<para>
- Hibernate offers many optional extension interfaces you can implement to customize
- the behavior of your persistence layer. See the API documentation for details.
- </para>
- <para>
HibernatéAiw̐U镑X^}CY邽߂ɁA
̃IvVgC^tF[XӂĂ܂B
ڍׂPIhLgƂĂB
@@ -228,11 +161,6 @@
</para>
<para>
- Given a "lite" architecture, the application bypasses the
- <literal>Transaction</literal>/<literal>TransactionFactory</literal> and/or
- <literal>ConnectionProvider</literal> APIs to talk to JTA or JDBC directly.
- </para>
- <para>
uyvA[LeN`ł́AAvP[V͒TABCƑΘb邽߂ɁA
<literal>Transaction</literal> literal>TransactionFactory</literal> <literal>ConnectionProvider</literal> CpX܂B
@@ -242,11 +170,6 @@
<sect1 id="architecture-states" revision="1">
<title>CX^X̏/title>
<para>
- An instance of a persistent classes may be in one of three different states,
- which are defined with respect to a <emphasis>persistence context</emphasis>.
- The Hibernate <literal>Session</literal> object is the persistence context:
- </para>
- <para>
iNX̃CX^X́ÂR̈قȂԂ̂ǂꂩɂȂB
A <emphasis>iReLXg</emphasis> ɂČ܂B
Hibernate<literal>Session</literal> IuWFNgAiReLXgɂȂB
@@ -257,11 +180,6 @@
<term>transient</term>
<listitem>
<para>
- The instance is not, and has never been associated with
- any persistence context. It has no persistent identity
- (primary key value).
- </para>
- <para>
̏̃CX^X́A݂ĉߋɂĂ
iReLXgɊ֘AÂĂ܂܂AiIDi[̒lj Ă܂@@ -272,15 +190,6 @@
<term>persistent</term>
<listitem>
<para>
- The instance is currently associated with a persistence
- context. It has a persistent identity (primary key value)
- and, perhaps, a corresponding row in the database. For a
- particular persistence context, Hibernate
- <emphasis>guarantees</emphasis> that persistent identity
- is equivalent to Java identity (in-memory location of the
- object).
- </para>
- <para>
̏̃CX^X́A̎_ʼniReLXgɊ֘AÂĂ܂B
܂AiIDi[̒ljA
Ă̓f[^x[XɑΉĂ傤B
@@ -294,15 +203,6 @@
<term>detached</term>
<listitem>
<para>
- The instance was once associated with a persistence
- context, but that context was closed, or the instance
- was serialized to another process. It has a persistent
- identity and, perhaps, a corrsponding row in the database.
- For detached instances, Hibernate makes no guarantees
- about the relationship between persistent identity and
- Java identity.
- </para>
- <para>
̏̃CX^X́AĉiReLXgɊ֘AÂA
̃ReLXgN[YꂽA邢́A
̃vZXɂ̃CX^XVACYꂽłB
@@ -319,11 +219,6 @@
<title>JMXƂ̓</title>
<para>
- JMX is the J2EE standard for management of Java components. Hibernate may be managed via
- a JMX standard service. We provide an MBean implementation in the distribution,
- <literal>org.hibernate.jmx.HibernateService</literal>.
- </para>
- <para>
JMXavaR|[lgǗ2EEWłB
JMXWT[rXāAHibernate͊ǗB
fBXgr[V̒<literal>org.hibernate.jmx.HibernateService</literal> Ƃ
@@ -331,11 +226,6 @@
</para>
<para>
- For an example how to deploy Hibernate as a JMX service on the JBoss Application Server,
- please see the JBoss User Guide. On JBoss AS, you also get these benefits if you deploy
- using JMX:
- </para>
- <para>
JBoss AvP[VT[o[HibernateT[rXƂăfvC@̗ẮA
JBoss [UKChƂĂB JBoss AvP[VT[o[ɂāA
JMXăfvCÃbg܂B
@@ -344,16 +234,6 @@
<itemizedlist>
<listitem>
<para>
- <emphasis>Session Management:</emphasis> The Hibernate <literal>Session</literal>'s lifecycle
- can be automatically bound to the scope of a JTA transaction. This means you no
- longer have to manually open and close the <literal>Session</literal>, this
- becomes the job of a JBoss EJB interceptor. You also don't have to worry about
- transaction demarcation in your code anymore (unless you'd like to write a portable
- persistence layer of course, use the optional Hibernate <literal>Transaction</literal>
- API for this). You call the <literal>HibernateContext</literal> to access a
- <literal>Session</literal>.
- </para>
- <para>
<emphasis>ZbVǗ:</emphasis> Hibernate<literal>Session</literal> ̃CtTCŃA
ITAgUNṼXR[vɌт܂BA <literal>Session</literal> [vN[Y肷vȂƂ܂B
@@ -367,14 +247,6 @@
</listitem>
<listitem>
<para>
- <emphasis>HAR deployment:</emphasis> Usually you deploy the Hibernate JMX service using a JBoss
- service deployment descriptor (in an EAR and/or SAR file), it supports all the usual
- configuration options of a Hibernate <literal>SessionFactory</literal>. However, you still
- have to name all your mapping files in the deployment descriptor. If you decide to use
- the optional HAR deployment, JBoss will automatically detect all mapping files in your
- HAR file.
- </para>
- <para>
<emphasis>HAR fvC:</emphasis> ʏ(EAR ܂SAR t@CɂJBoss T[rX
fvCgfBXNv^āAHibernate JMX T[rXvC܂B
AHibernate<literal>SessionFactory</literal> ̑SĂ̈IȐݒvV -387,18 +259,11 @@
</itemizedlist>
<para>
- Consult the JBoss AS user guide for more information about these options.
- </para>
- <para>
̃IvVɂĂ̏ڍׂȏ́AJBossAvP[VT[o[UKCh QlɂĂB
</para>
<para>
- Another feature available as a JMX service are runtime Hibernate statistics. See
- <xref linkend="configuration-optional-statistics"/>.
- </para>
- <para>
JMXT[rXƂėp\ȑ̋@\ɁAHibernatesvB
<xref linkend="configuration-optional-statistics"/> ĂB
</para>
@@ -407,10 +272,6 @@
<sect1 id="architecture-jca" revision="1">
<title>JCA T|[g</title>
<para>
- Hibernate may also be configured as a JCA connector. Please see the website for more
- details. Please note that Hibernate JCA support is still considered experimental.
- </para>
- <para>
Hibernate JCA RlN^ƂĂ܂BڍׂɂẮAWebTCgĂB
Hibernate JCA T|[ǵÂƂiKƂčlĂ邱ƂɒӂĂB
</para>
@@ -419,15 +280,6 @@
<sect1 id="architecture-current-session" revision="2">
<title>ReLXgZbV</title>
<para>
- Most applications using Hibernate need some form of "contextual" sessions, where a given
- session is in effect throughout the scope of a given context. However, across applications
- the definition of what constitutes a context is typically different; and different contexts
- define different scopes to the notion of current. Applications using Hibernate prior
- to version 3.0 tended to utilize either home-grown <literal>ThreadLocal</literal>-based
- contextual sessions, helper classes such as <literal>HibernateUtil</literal>, or utilized
- third-party frameworks (such as Spring or Pico) which provided proxy/interception-based contextual sessions.
- </para>
- <para>
Hibernate AvP[V́AقƂAȂ̌`ReLXg"ZbVKvɂȂB
uReLXgZbVv́AReLXg̃XR[v̂ȂŗLbV̂ƂłB
AʏvP[VƂɃReLXĝ͈̒قȂB
@@ -439,16 +291,6 @@
</para>
<para>
- Starting with version 3.0.1, Hibernate added the <literal>SessionFactory.getCurrentSession()</literal>
- method. Initially, this assumed usage of <literal>JTA</literal> transactions, where the
- <literal>JTA</literal> transaction defined both the scope and context of a current session.
- The Hibernate team maintains that, given the maturity of the numerous stand-alone
- <literal>JTA TransactionManager</literal> implementations out there, most (if not all)
- applications should be using <literal>JTA</literal> transaction management whether or not
- they are deployed into a <literal>J2EE</literal> container. Based on that, the
- <literal>JTA</literal>-based contextual sessions is all you should ever need to use.
- </para>
- <para>
o[W 3.0.1 Hibernate ɂ<literal>SessionFactory.getCurrentSession()</literal>
܂B A <literal>JTA</literal> gUNV̎gpĂ܂B
<literal>JTA</literal> gUNV́Ã݂ZbṼXR[vƃReLXg̗`܂B
@@ -462,13 +304,6 @@
</para>
<para>
- However, as of version 3.1, the processing behind
- <literal>SessionFactory.getCurrentSession()</literal> is now pluggable. To that
- end, a new extension interface (<literal>org.hibernate.context.CurrentSessionContext</literal>)
- and a new configuration parameter (<literal>hibernate.current_session_context_class</literal>)
- have been added to allow pluggability of the scope and context of defining current sessions.
- </para>
- <para>
Ao[W 3.1 A <literal>SessionFactory.getCurrentSession()</literal> ̌A
vKuɂȂB
āÃ݂ZbV`R[vƃReLXg̃vKreB\ɂ邽߂ɁA
@@ -477,13 +312,6 @@
</para>
<para>
- See the Javadocs for the <literal>org.hibernate.context.CurrentSessionContext</literal>
- interface for a detailed discussion of its contract. It defines a single method,
- <literal>currentSession()</literal>, by which the implementation is responsible for
- tracking the current contextual session. Out-of-the-box, Hibernate comes with three
- implementations of this interface.
- </para>
- <para>
<literal>org.hibernate.context.CurrentSessionContext</literal> C^tF[X̋KĂ ڍׂȓJavadoc ƂĂB
́A <literal>currentSession()</literal> Ƃ1̃\bh
@@ -494,12 +322,6 @@
<itemizedlist>
<listitem>
<para>
- <literal>org.hibernate.context.JTASessionContext</literal> - current sessions
- are tracked and scoped by a <literal>JTA</literal> transaction. The processing
- here is exactly the same as in the older JTA-only approach. See the Javadocs
- for details.
- </para>
- <para>
<literal>org.hibernate.context.JTASessionContext</literal> -
<literal>JTA</literal> gUNVɂāÃ݂ZbVǐՂ
XR[v߂܂B̏́AÂJTÃAv[`Ƃ܂łB
@@ -508,10 +330,6 @@
</listitem>
<listitem>
<para>
- <literal>org.hibernate.context.ThreadLocalSessionContext</literal> - current
- sessions are tracked by thread of execution. Again, see the Javadocs for details.
- </para>
- <para>
<literal>org.hibernate.context.ThreadLocalSessionContext</literal> -
Xbh̎sɂāÃ݂ZbVǐՂB
ڍׂavadocƂĂB
@@ -519,12 +337,6 @@
</listitem>
<listitem>
<para>
- <literal>org.hibernate.context.ManagedSessionContext</literal> - current
- sessions are tracked by thread of execution. However, you are responsible to
- bind and unbind a <literal>Session</literal> instance with static methods
- on this class, it does never open, flush, or close a <literal>Session</literal>.
- </para>
- <para>
<literal>org.hibernate.context.ManagedSessionContext</literal> -
Xbh̎sɂāÃ݂ZbVǐՂB
ÃNXtatic\bh<literal>Session</literal> CX^X -535,17 +347,6 @@
</itemizedlist>
<para>
- The first two implementations provide a "one session - one database transaction" programming
- model, also known and used as <emphasis>session-per-request</emphasis>. The beginning
- and end of a Hibernate session is defined by the duration of a database transaction.
- If you use programatic transaction demarcation in plain JSE without JTA, you are adviced to
- use the Hibernate <literal>Transaction</literal> API to hide the underlying transaction system
- from your code. If you use JTA, use the JTA interfaces to demarcate transactions. If you
- execute in an EJB container that supports CMT, transaction boundaries are defined declaratively
- and you don't need any transaction or session demarcation operations in your code.
- Refer to <xref linkend="transactions"/> for more information and code examples.
- </para>
- <para>
n߂̎́A"1ZbV - 1f[^x[XgUNV" vO~Of܂B
<emphasis>NGXgƂ̃ZbVisession-per-requestj</emphasis> ƂĂĂgĂ܂B
Hibernate ZbV̊JnƏÍAf[^x[XgUNV̊܂B
@@ -559,16 +360,6 @@
</para>
<para>
- The <literal>hibernate.current_session_context_class</literal> configuration parameter
- defines which <literal>org.hibernate.context.CurrentSessionContext</literal> implementation
- should be used. Note that for backwards compatibility, if this config param is not set
- but a <literal>org.hibernate.transaction.TransactionManagerLookup</literal> is configured,
- Hibernate will use the <literal>org.hibernate.context.JTASessionContext</literal>.
- Typically, the value of this parameter would just name the implementation class to
- use; for the three out-of-the-box implementations, however, there are two corresponding
- short names, "jta", "thread", and "managed".
- </para>
- <para>
<literal>hibernate.current_session_context_class</literal> ݒ[^́A
<literal>org.hibernate.context.CurrentSessionContext</literal> ̂ǂ̎肵܂B
ʌ݊̂߁Ãp[^ݒ肳ꂸ
Modified: trunk/Hibernate3/doc/reference/ja/modules/basic_mapping.xml
===================================================================
--- trunk/Hibernate3/doc/reference/ja/modules/basic_mapping.xml 2006-08-09 21:12:56 UTC (rev 10237)
+++ trunk/Hibernate3/doc/reference/ja/modules/basic_mapping.xml 2006-08-10 00:27:25 UTC (rev 10238)
@@ -119,26 +119,17 @@
</title>
<para>
-
As mentioned previously, Hibernate will first attempt to resolve DTDs in its classpath. The
manner in which it does this is by registering a custom <literal>org.xml.sax.EntityResolver</literal>
implementation with the SAXReader it uses to read in the xml files. This custom
<literal>EntityResolver</literal> recognizes two different systemId namespaces.
-
-
-
-
+
-
- Oq悤ɁAHibernate͂܂̃NXpXDTD悤Ƃ܂B
- DTD̉́A
- JX^ <literal>org.xml.sax.EntityResolver</literal> ̎^邱Ƃɂčs܂B
- ̂Ƃ <literal>EntityResolver</literal> ̎́A
- XMLt@Cݍނ߂AX[_ibernateɓo^B
- ̃JX^<literal>EntityResolver</literal> ̈قȂXeIDOŔFB
-
-
+ Oq悤ɁAHibernate͂܂NXpXDTD悤Ƃ܂B
+ <literal>org.xml.sax.EntityResolver</literal> ̃JX^ XMLt@Cݍނ߂AXReaderɓo^邱ƂɂāADTD܂B
+ ̃JX^<literal>EntityResolver</literal> ̈قȂXeIDO܂B
</para>
@@ -146,23 +137,19 @@
<listitem>
<para>
-
a <literal>hibernate namespace</literal> is recognized whenever the
resolver encounteres a systemId starting with
<literal>http://hibernate.sourceforge.net/</literal>; the resolver
attempts to resolve these entities via the classlaoder which loaded
the Hibernate classes.
-
-
<literal>HibernateO/literal> ́A]o
- <literal>http://hibernate.sourceforge.net/</literal> Ŏn܂XeIDɓBƂ- KFB
- ă]óAHibernatẽNXɂă[hꂽNX[_āA
+ <literal>http://hibernate.sourceforge.net/</literal> Ŏn܂XeIDɓBƂɁA
+ FB
+ ă]óAHibernatẽNX[hNX[_āA
̃GeBeB悤Ƃ܂B
-
@@ -171,24 +158,20 @@
<listitem>
<para>
-
a <literal>user namespace</literal> is recognized whenever the
resolver encounteres a systemId using a <literal>classpath://</literal>
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.
-
-
- <literal>[UO/literal>́A]o
- URLvgR<literal>classpath://</literal> VXeIDɓBƂ- KFBă]óA(1)݂̃XbhReLXgāA܂- (2)HibernatẽNXɂă[hꂽNX[_āA
- ̃GeBeB悤Ƃ܂B
-
+ <literal>[UO/literal> ́A]o
+ URLvgR<literal>classpath://</literal> VXeIDɓBƂɁA
+ FBă]óA(1)JgXbh̃ReLXgNX[_[A
+ ܂2)HibernatẽNX[hNX[_āA
+ ̃GeBeB悤Ƃ܂B
</para>
@@ -221,17 +204,13 @@
</hibernate-mapping>]]></programlisting>
<para>
-
Where <literal>types.xml</literal> is a resource in the <literal>your.domain</literal>
package and contains a custom <xref linkend="mapping-types-custom">typedef</xref>.
-
-
- literal>types.xml</literal> <literal>your.domain</literal>pbP[W\[Xł
- JX^ <xref linkend="mapping-types-custom">typedef</xref>ނ܂B
-
+ <literal>types.xml</literal> <literal>your.domain</literal> pbP[W\[Xł
+ JX^ <xref linkend="mapping-types-custom">typedef</xref> ނ܂B
</para>
</sect3>
Modified: trunk/Hibernate3/doc/reference/ja/modules/query_sql.xml
===================================================================
--- trunk/Hibernate3/doc/reference/ja/modules/query_sql.xml 2006-08-09 21:12:56 UTC (rev 10237)
+++ trunk/Hibernate3/doc/reference/ja/modules/query_sql.xml 2006-08-10 00:27:25 UTC (rev 10238)
@@ -17,38 +17,22 @@
C^[tFCXĐ䂵܂B
<literal>SQLQuery</literal> C^[tFCX <literal>Session.createSQLQuery()</literal> яoĎ擾܂B
- The following describes how to use this API for querying.
PIĖ₢킹@Ő܂B</para>
-܂
- <sect2>
- <title>Scalar queries@@XJ[̃NG</title>
+ <title>XJ[̃NG</title>
- <para>The most basic SQL query is to get a list of scalars
- (values).</para>
-
<para>ł{IQLNG̓XJ[ilj̃Xg邱ƂłB</para>
<programlisting><![CDATA[sess.createSQLQuery("SELECT * FROM CATS").list();
sess.createSQLQuery("SELECT ID, NAME, BIRTHDATE FROM CATS").list();
]]></programlisting>
- <para>These will both 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.</para>
-
<para>͂ǂACATSe[ůeJ̃XJ[l Objectzbject[]j̃Xg܂B
- ԂXJ[l̎ۂ̏Ԃƌ^𐄘_邽߂ɁA
+ ԂXJ[l̎ۂ̏Ԃƌ^𐄒肷邽߂ɁA
HibernateesultSetMetadatap܂B</para>
- <para>To avoid the overhead of using
- <literal>ResultSetMetadata</literal> or simply to be more explicit in
- what is returned one can use <literal>addScalar()</literal>.</para>
-
<para><literal>ResultSetMetadata</literal> p[o[wbh邽߁A
͒PɉԂmɂ邽߁A<literal>addScalar()</literal>
܂B</para>
@@ -59,30 +43,18 @@
.addScalar("BIRTHDATE", Hibernate.DATE)
]]></programlisting>
- <para>This query specified:</para>
-
<para>̃NGŎw肳̂LɎ܂B</para>
<itemizedlist>
<listitem>
- <para>the SQL query string</para>
<para>SQLNGara>
</listitem>
<listitem>
- <para>the columns and types to return</para>
<para>ԂJƌ^</para>
</listitem>
</itemizedlist>
- <para>This will still return Object arrays, but now it will not use
- <literal>ResultSetMetdata</literal> 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
- <literal>*</literal> and could return more than the three listed
- columns.</para>
-
<para>܂ObjectzԂ܂A
<literal>ResultSetMetdata</literal> p܂ Ȃɂ郊UgZbg@ -92,9 +64,6 @@
ƂANG <literal>*</literal> pA
R̃JĂB</para>
- <para>It is possible to leave out the type information for all or some
- of the scalars.</para>
-
<para>XJ[̌^Ƃ܂B</para>
<programlisting><![CDATA[sess.createSQLQuery("SELECT * FROM CATS")
@@ -103,20 +72,12 @@
.addScalar("BIRTHDATE")
]]></programlisting>
- <para>This is essentially the same query as before, but now
- <literal>ResultSetMetaData</literal> is used to decide the type of NAME
- and BIRTHDATE where as the type of ID is explicitly specified.</para>
-
- <para>{IɑOƓNGłA
+ <para>
+ {IɑOƓNGłAA
NAME BIRTHDATE ̌^߂邽߂<literal>ResultSetMetaData</literal>
- p܂BID ̌^͖IɎw肳܂Biwhere as ̖/para>
+ p܂BAID ̌^͖IɎw肳܂B
+ </para>
- <para>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 <literal>registerHibernateType</literal> in
- the Dialect.</para>
-
<para>
ResultSetMetaData java.sql.Types bernate ̌^ }bsO邱Ƃ́ADialect 䂵܂B
@@ -127,13 +88,8 @@
</sect2>
<sect2>
- <title>Entity queries@@GeBeB NG</title>
+ <title>GeBeB̃NG</title>
- <para>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
- <literal>addEntity()</literal>.</para>
-
<para>܂ł̃NǴAׂăXJ[lłB
IɁAUgZbgHv̒l܂B
ȍ~ł́A<literal>addEntity()</literal> ɂAlCeBuSQLNG@ -143,40 +99,25 @@
sess.createSQLQuery("SELECT ID, NAME, BIRTHDATE FROM CATS").addEntity(Cat.class);
]]></programlisting>
- <para>This query specified:</para>
-
<para>̃NGŎw肳̂LɎ܂B</para>
<itemizedlist>
<listitem>
- <para>the SQL query string</para>
<para>SQLNGara>
</listitem>
<listitem>
- <para>the entity returned by the query</para>
- <para>NGԂGeBeBQLe[u̕ʖ</para>
+ <para>NGԂGeBeBQLe[u̕ʖ
+ </para>
</listitem>
</itemizedlist>
- <para>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.</para>
+ <para>CatID, NAME, BIRTHDATẼJăNXɃ}bsOꍇA
+ ̃NG͂ǂAvfCatGeBeBł郊Xg܂B</para>
- <para>Cat XƂDANAMEABIRTHDATE JɃ}bsO肵A
- ̃NG͗ Cat GeBeBfƂĎXg܂Biςȓj</para>
-
- <para>If the entity is mapped with a <literal>many-to-one</literal> 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 <literal>many-to-one</literal> to a
- <literal>Dog</literal>:</para>
-
<para>GeBeB̃GeBeB<literal>Έliteral> Ń}bsOẮA
lCeBuNGsɁA̕ʂ̃GeBeBƂ܂B
- Af[^x[XŗĹuJvG[܂B
+ Af[^x[XŗĹucolumn not found(JG[܂B
* \Lpۂ́Alj̃JIɕԂA
̗悤ɁA<literal>Dog</literal> <literal>Έliteral> ł邱Ƃ 邱Ƃ͍D݂܂B</para>
@@ -184,40 +125,25 @@
<programlisting><![CDATA[sess.createSQLQuery("SELECT ID, NAME, BIRTHDATE, DOG_ID FROM CATS").addEntity(Cat.class);
]]></programlisting>
- <para>This will allow cat.getDog() to function properly.</para>
-
<para> cat.getDog() @\܂B</para>
</sect2>
<sect2>
- <title>Handling associations and collections
- ֘AƃRNV̑title>
+ <title>֘AƃRNV̑title>
- <para>It is possible to eagerly join in the <literal>Dog</literal> to
- avoid the possible extra roundtrip for initializing the proxy. This is
- done via the <literal>addJoin()</literal> method, which allows you to
- join in an association or collection.</para>
-
- <para>vLV邽߂̗]ȃhgbviroundtripj邽߁A
+ <para>vLV邽߂̗]ȏ邽߁A
<literal>Dog</literal> ̒őł܂B
<literal>addJoin()</literal> \bhɂs܂B
- ֘A̓RNVɌł܂B</para>
+ ֘A̓RNVɌł܂B
+ </para>
<programlisting><![CDATA[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")
.addEntity("cat", Cat.class)
.addJoin("cat.dog");
]]></programlisting>
- <para>In this example the returned <literal>Cat</literal>'s will have
- their <literal>dog</literal> property fully initialized without any
- extra roundtrip to the database. Notice that we added a 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
- <literal>Cat</literal> had a one-to-many to <literal>Dog</literal>
- instead.</para>
-
<para>̗ŁAԂ <literal>Cat</literal> ́A
- f[^x[Xւ̗]ȃhgbviroundtripjȂŁA
+ f[^x[Xւ̗]ȂŁA
Sɏꂽ <literal>dog</literal> vpeB܂B
Ώۂ̃vpeBւ̃pXɁA
ʖiucatvjƂɒӂĂB
@@ -230,99 +156,61 @@
.addJoin("cat.dogs");
]]></programlisting>
- <p>At this stage we are reaching the limits of what is possible with
- native queries without starting to enhance the sql queries to make them
- usable in Hibernate; the problems starts to arise when returning
- multiple entities of the same type or when the default alias/column
- names are not enough.</p>
-
- iparåԈႢHj
- <p>݂̂Ƃ
- HibernateŎg₷邽߂QLNG邱ƂȂɁA
- lCeBuNGƉ\ɂEɗĂ܂B
+ <para>݂̂Ƃ
+ HibernateŎg₷邽߂QLNG̊gȂɁA
+ lCeBuNGʼn\ɂEɗĂ܂B
^̃GeBeBԂۂftHg̕ʖŏ\ł͂ȂꍇɁA
- ͋N߂܂B</p>
+ ͋N߂܂B
+ </para>
</sect2>
<sect2>
- <title>Returning multiple entities
- GeBeB̎擾</title>
+ <title>GeBeB̎擾</title>
- <para>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 which join multiple tables, since the same
- column names may appear in more than one table.</para>
-
<para>܂ł́AUgZbg̃J́A
}bsOt@CŎw肳ꂽJƓł肵Ă܂B
̃e[uJꍇ邽߁A
e[uLNGŖƂȂB</para>
- <para>Column alias injection is needed in the following query (which
- most likely will fail):</para>
-
<para>L̂悤ȁisȁjNGł́A
- JʖCWFNViJʖ}icolumn alias injectionjKvłB</para>
+ JʖCWFNVicolumn alias injectionjKvłB</para>
<programlisting><![CDATA[sess.createSQLQuery("SELECT c.*, m.* FROM CATS c, CATS m WHERE c.MOTHER_ID = m.ID")
.addEntity("cat", Cat.class)
.addEntity("mother", Cat.class)
]]></programlisting>
- <para>The intention for this query is to return two Cat instances per
- row, a cat and its mother. This will fail since there is a conflict of
- names since they are mapped to the same column names and 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 specificed in
- the mappings ("ID" and "NAME").</para>
-
<para>̃NG̈Ӑ}́A
- PsƂɂQatCX^XiLƂ̕jƂƂłB
- JɃ}bsO邱ƂɂAOՓ˂邽߁ÃNG͎s܂B
+ PsƂɂQatCX^XA܂Ƃ̕ƂƂłB
+ JɃ}bsO邱ƂɂOՓ˂邽߁ÃNG͎s܂B
x[^x[XɂẮAԂJ̕ʖ "c.ID"A"c.NAME" Ȃǂ̌`ł
}bsOŎw肳ꂽJi"ID" "NAME"jƓȂ߁As܂B</para>
- <para>The following form is not vulnerable to column name
- duplication:</para>
- <para>Ľ`́AJdĂvinot vulnerablejłB</para>
+ <para>Ľ`́AJdĂłB</para>
<programlisting><![CDATA[sess.createSQLQuery("SELECT {cat.*}, {mother.*} FROM CATS c, CATS m WHERE c.MOTHER_ID = m.ID")
.addEntity("cat", Cat.class)
.addEntity("mother", Cat.class)
]]></programlisting>
- <para>This query specified:</para>
-
<para>̃NGŎw肳̂LɎ܂B</para>
<itemizedlist>
<listitem>
- <para>the SQL query string, with placeholders for Hibernate to
- inject column aliases</para>
<para>SQLNG iHibernateJ̕ʖ߂̃v[Xz_ށj</para>
</listitem>
<listitem>
- <para>the entities returned by the query</para>
<para>NGɂĕԂGeBeB</para>
</listitem>
</itemizedlist>
- <para>The {cat.*} and {mother.*} notation used above is a shorthand for
- "all properties". Alternatively, you may list the columns explicity, but
- even in this case we let Hibernate inject 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, we retrieve
- Cats and their mothers from a different table (cat_log) to the one
- declared in the mapping metadata. Notice that we may even use the
- property aliases in the where clause if we like.</para>
-
<para>ŎgpĂcat.*} {mother.*} Ƃ\ĹA
uׂẴvpeBvȗ`łB
AIɃJĂłA
- ̏ꍇ́AHibernateɊevpeBɑΉLJ̕ʖł傤B
+ ̏ꍇ́AHibernateɊevpeBɑΉLJ̕ʖł傤B
J̕ʖ̂߂̃v[Xz_́Ae[u̕ʖɂďCvpeBłB
Ĺ̗Aʂ̃e[u cat_log }bsO^f[^Œꂽ Cat Ƃ̕܂B
@@ -338,28 +226,16 @@
]]></programlisting>
<sect3 id="querysql-aliasreferences" revision="2">
- <title>Alias and property references
- ʖƃvpeB̃t@XíAQlj</title>
+ <title>ʖƃvpeB̃t@X</title>
- <para>For most cases the above alias injection is needed, but for
- queries relating to more complex mappings like composite properties,
- inheritance discriminators, collections etc. there are some specific
- aliases to use to allow Hibernate to inject the proper aliases.</para>
-
- <para>̏ꍇÂ悤ȕʖCWFNViʖ}KvłB
+ <para>̏ꍇÂ悤ȕʖCWFNVKvłB
AvpeBApʎqARNVȂǂ̂悤- Gȃ}bsOƊ֘AGȂłibut for̖B
+ Gȃ}bsOƊ֘AGȂłB
ʖp邱ƂɂAHibernate͓Kȕʖ܂B</para>
- <para>The following table shows the different possibilities of using
- the alias injection. Note: the alias names in the result are examples,
- each alias will have a unique and probably different name when
- used.</para>
-
- <para>ʖCWFNViʖ}Ďgpł̂\Ɏ܂B
+ <para>ʖCWFNVƂĎgpł̂\Ɏ܂B
ӁF\̕ʖ͈łB
ꂼʖ͈łgpɂ͂炭قȂ閼O܂B</para>
-܂
<table frame="topbot" id="aliasinjection-summary">
<title>ʖɑ}O</title>
@@ -436,72 +312,51 @@
</sect3>
</sect2>
- <sect2>
- <title>Returning non-managed entities
- ǗȂGeBeB̎擾</title>
+ <title>ǗȂGeBeB̎擾</title>
- <para>It is possible to apply a ResultTransformer to native sql queries. Allowing it to e.g. return non-managed entities.</para>
-
<para>lCeBuSQLNGResultTransformer pł܂B
L̂悤ɁAႦAǗȂGeBeB܂B</para>
<programlisting><![CDATA[sess.createSQLQuery("SELECT NAME, BIRTHDATE FROM CATS")
.setResultTransformer(Transformers.aliasToBean(CatDTO.class))]]></programlisting>
- <para>This query specified:</para>
-
<para>̃NGŎw肳̂LɎ܂B</para>
<itemizedlist>
<listitem>
- <para>the SQL query string</para>
<para>SQLNGara>
</listitem>
<listitem>
- <para>a result transformer</para>
<para>ʂ</para>
</listitem>
</itemizedlist>
- <para>
- The above query will return a list of <literal>CatDTO</literal> which has been instantiated and injected the values of NAME and BIRTHNAME into its corresponding
- properties or fields.
- </para>
-
<para>̃NǴACX^XANAME BIRTHDATE ̒l ΉpeB̓tB[hɑ}<literal>CatDTO</literal>
̃Xg܂B</para>
</sect2>
<sect2>
- <title>Handling inheritance@@p̐title>
+ <title>p̐title>
- <para>Native sql queries which query for entities that is mapped as part
- of an inheritance must include all properties for the baseclass and all
- it subclasses.</para>
-
<para>p̈ꕔƂă}bsOꂽGeBeB킹CeBuSQLNǴA
x[X̃NXƂׂ̂ẴTuNX̃vpeBׂĂ܂ȂȂ/para>
</sect2>
<sect2>
- <title>Parameters@@p[^</title>
+ <title>p[^</title>
- <para>Native sql queries support positional as well as named
- parameters:</para>
+ <para>lCeBuSQLNǴAȉ̂悤ɁA
+ Otp[^i:namejƓlɈʒup[^|[g܂B</para>
- <para>lCeBuSQLNǴAʒup[^i?jƓ悤ɁA
- ̂悤ȖOtp[^i:namej|[g܂B</para>
-
<programlisting><![CDATA[Query query = sess.createSQLQuery("SELECT * FROM CATS WHERE NAME like ?").addEntity(Cat.class);
List pusList = query.setString(0, "Pus%").list();
query = sess.createSQLQuery("SELECT * FROM CATS WHERE NAME like :name").addEntity(Cat.class);
List pusList = query.setString("name", "Pus%").list(); ]]></programlisting>
</sect2>
-܂
</sect1>
@@ -584,10 +439,6 @@
WHERE person.NAME LIKE :namePattern
</sql-query>]]></programlisting>
- <para>You can alternatively use the resultset mapping information in your
- hbm files directly in java code.</para>
-
<para>Ahbmt@CUgZbg̃}bsO avaR[h̒Ŏgpł܂B</para>
@@ -596,7 +447,6 @@
)
.setResultSetMapping("catAndKitten")
.list();]]></programlisting>
-܂
<sect2 id="propertyresults">
<title>ʖIɎw肷邽߂return-property </title>
Modified: trunk/Hibernate3/doc/reference/ja/modules/tutorial.xml
===================================================================
--- trunk/Hibernate3/doc/reference/ja/modules/tutorial.xml 2006-08-09 21:12:56 UTC (rev 10237)
+++ trunk/Hibernate3/doc/reference/ja/modules/tutorial.xml 2006-08-10 00:27:25 UTC (rev 10238)
@@ -6,22 +6,12 @@
<title>O</title>
<para>
- This chapter is an introductory tutorial for new users of Hibernate. We start
- with a simple command line application using an in-memory database and develop
- it in easy to understand steps.
- </para>
- <para>
̏͂ibernate߂Ďg[Uȃ`[gAłB
Cf[^x[XȒPȃR}hCAvP[V߁A
킩߂܂B
</para>
<para>
- This tutorial is intended for new users of Hibernate but requires Java and
- SQL knowledge. It is based on a tutorial by Michael Gloegl, the third-party
- libraries we name are for JDK 1.4 and 5.0. You might need others for JDK 1.3.
- </para>
- <para>
̃`[gAibernate߂Ďg[U肵Ă܂A
avaQLɂĂ̒mKvłB
Michael Gloegl̎`[gA~ɂĂ܂A
@@ -30,10 +20,6 @@
</para>
<para>
- The source code for the tutorial is included in the distribution in the
- <literal>doc/reference/tutorial/</literal> directory.
- </para>
- <para>
`[gÃ\[XR[hibernatefBXgr[V
<literal>doc/reference/tutorial/</literal> ɂB
</para>
@@ -44,33 +30,18 @@
<title>p[g1 - ߂ĂibernateAvP[V</title>
<para>
- First, we'll create a simple console-based Hibernate application. We use an
- Java database (HSQL DB), so we do not have to install any database server.
- </para>
- <para>
ŏɃR\[x[X̊ȒPibernateAvP[V܂B
Javaf[^x[XiHSQL DBj𗘗pŁA
f[^x[XT[oXg[v͂ </para>
<para>
- Let's assume we need a small database application that can store events we want to
- attend, and information about the hosts of these events.
- </para>
- <para>
ɏȃf[^x[XAvP[VKvƂ܂傤B
̃AvP[Vɂ͏oȂCxgƁA
̃Cxg̃zXgɂĂ̏[̂Ƃ܂B
</para>
<para>
- The first thing we do, is set up our development directory and put all the
- Java libraries we need into it. Download the Hibernate distribution from the
- Hibernate website. Extract the package and place all required libraries
- found in <literal>/lib</literal> into into the <literal>/lib</literal> directory
- of your new development working directory. It should look like this:
- </para>
- <para>
܂ŏɂ邱Ƃ͊Jp̃fBNgbgAbvāA
KvƂȂ邷ׂĂavaCuu邱ƂłB
HibernateEFuTCgbernatefBXgr[VE[hĂB
@@ -93,14 +64,6 @@
log4j.jar ]]></programlisting>
<para>
- This is the minimum set of required libraries (note that we also copied
- hibernate3.jar, the main archive) for Hibernate <emphasis>at the time of writing</emphasis>.
- The Hibernate release you are using might require more or less libraries. See the
- <literal>README.txt</literal> file in the <literal>lib/</literal> directory of the
- Hibernate distribution for more information about required and optional third-party
- libraries. (Actually, Log4j is not required but preferred by many developers.)
- </para>
- <para>
ꂪ <emphasis>{hLgM_ł/emphasis> Hibernate̕KvŒ̃Cuł
iCA[JCuibernate3.jars[Ă邱ƂɒӂĂjB
Hibernatẽo[WɂĂ͂KvȃCusvȃCu邩@@ -111,9 +74,6 @@
</para>
<para>
- Next we create a class that represents the event we want to store in database.
- </para>
- <para>
Ƀf[^x[XɊi[xgNX܂B
</para>
@@ -121,7 +81,7 @@
<title>ŏ̃NX</title>
<para>
- Our first persistent class is a simple JavaBean class with some properties:
+ ŏ̉iNX́AvpeBVvavaBeanłF
</para>
<programlisting><![CDATA[package events;
@@ -162,13 +122,6 @@
}]]></programlisting>
<para>
- You can see that this class uses standard JavaBean naming conventions for property
- getter and setter methods, as well as private visibility for the fields. This is
- a recommended design - but not required. Hibernate can also access fields directly,
- the benefit of accessor methods is robustness for refactoring. The no-argument
- constructor is required to instantiate an object of this class through reflection.
- </para>
- <para>
̂Ƃ̃NX̓tB[hprivatẻĂƓɁA
JavaBeanW̃Qb^[AZb^[\bh̖K]Ă܂B
̂悤Ȑv͐܂K{ł͂@@ -179,17 +132,6 @@
</para>
<para>
- The <literal>id</literal> 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 (esp. web applications) need to distinguish objects by identifier, so you
- should consider this a feature rather than a limitation. However, we usually don't manipulate
- the identity of an object, hence the setter method should be private. Only Hibernate will assign
- identifiers when an object is saved. You can see that Hibernate can access public, private,
- and protected accessor methods, as well as (public, private, protected) fields directly. The
- choice is up to you and you can match it to fit your application design.
- </para>
- <para>
<literal>id</literal> vpeB́ACxgɑ郆j[NȎʎq̒l܂B
Hibernate̊Sȋ@\AׂẲiGeBeBNX
iǏdvł͂ȂˑNXƂj
@@ -205,12 +147,6 @@
</para>
<para>
- 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 visibility is required for runtime proxy generation and
- efficient data retrieval without bytecode instrumentation.
- </para>
- <para>
ȂRXgN^ׂ͂ẲiNXɕK{łB
HibernateJavãtNVāAIuWFNgȂȂ߂łB
RXgN^vateɂ邱Ƃ͉\łA
@@ -219,10 +155,6 @@
</para>
<para>
- Place this Java source file in a directory called <literal>src</literal> in the
- development folder, and in its correct package. The directory should now look like this:
- </para>
- <para>
JtH_<literal>src</literal> ƂfBNg̓KȃpbP[WɁA
ava\[Xt@CuĂB
̎_ŃfBNg͈ȉ̂悤ɂȂĂłF
@@ -236,9 +168,6 @@
Event.java]]></programlisting>
<para>
- In the next step, we tell Hibernate about this persistent class.
- </para>
- <para>
̃Xebvł́AHibernateɂ̉iNX̏܂B
</para>
@@ -248,12 +177,6 @@
<title>}bsOt@C</title>
<para>
- 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.
- </para>
- <para>
HibernatéAǂ̂悤ɉiNX̃IuWFNg[hi[悢vB
ibernate}bsOt@Coꂵ܂B
}bsOt@ĆAf[^x[Xǂ̃e[uɃANZXȂȂA
@@ -261,9 +184,6 @@
</para>
<para>
- The basic structure of a mapping file looks like this:
- </para>
- <para>
}bsOt@C̊Iȍ\͂̂悤ɂȂF
</para>
@@ -277,16 +197,6 @@
</hibernate-mapping>]]></programlisting>
<para>
- Note that the Hibernate DTD is very sophisticated. You can use it for
- auto-completion of XML mapping elements and attributes in your editor or
- IDE. You also should open up the DTD file in your text editor - it's the
- easiest way to get an overview of all elements and attributes and to see
- the defaults, as well as some comments. Note that 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 <literal>hibernate3.jar</literal>
- as well as in the <literal>src/</literal> directory of the Hibernate distribution.
- </para>
- <para>
Hibernate DTDɐ邱ƂɒڂĂB
TD́AGfB^EłML}bsOvfƑ̃I[gRv[V@\ɗpł܂B
܂DTDt@CLXgGfB^ŊJĂ݂ĂB
@@ -299,21 +209,11 @@
</para>
<para>
- We will omit the DTD declaration in future examples to shorten the code. It is
- of course not optional.
- </para>
- <para>
ȍ~̗̓R[h邽߂TD錾܂B
RłIvVł͂ </para>
<para>
- Between the two <literal>hibernate-mapping</literal> tags, include a
- <literal>class</literal> element. All persistent entity classes (again, there
- might be dependent classes later on, which are not first-class entities) need
- such a mapping, to a table in the SQL database:
- </para>
- <para>
2<literal>hibernate-mapping</literal> ^O̊Ԃ <literal>class</literal> vf߂ĂB
ׂẲiGeBeBNXiO܂A
@@ -330,13 +230,6 @@
</hibernate-mapping>]]></programlisting>
<para>
- So far we told Hibernate how to persist and load object of class <literal>Event</literal>
- to the table <literal>EVENTS</literal>, each instance represented by a row in that table.
- Now we continue with a mapping of the unique identifier property to the tables primary key.
- In addition, as we don't want to care about handling this identifier, we configure Hibernate's
- identifier generation strategy for a surrogate primary key column:
- </para>
- <para>
Ŏ́A<literal>Event</literal> NX̃IuWFNg <literal>EVENTS</literal> e[uɑāAǂ̂悤ɉi胍[h肷 HibernateɋĂ܂BČX̃CX^X̓e[u̍sƂĕ\B
@@ -356,18 +249,6 @@
</hibernate-mapping>]]></programlisting>
<para>
- The <literal>id</literal> element is the declaration of the identifer property,
- <literal>name="id"</literal> declares the name of the Java property -
- Hibernate will use the getter and setter methods to access the property.
- The column attribute tells Hibernate which column of the
- <literal>EVENTS</literal> table we use for this primary key. The nested
- <literal>generator</literal> element specifies the identifier generation strategy,
- in this case we used <literal>native</literal>, which picks the best strategy depending
- on the configured database (dialect). Hibernate supports database generated, globally
- unique, as well as application assigned identifiers (or any strategy you have written
- an extension for).
- </para>
- <para>
<literal>id</literal> vf͎ʎqvpeB̐錾ł
<literal>name="id"</literal> avavpeB̖O܂B
Hibernate͂̃vpeBփANZX邽߂ɃQb^[AZb^[\bh܂B
@@ -381,11 +262,6 @@
</para>
<para>
- Finally we include declarations for the persistent properties of the class in
- the mapping file. By default, no properties of the class are considered
- persistent:
- </para>
- <para>
ŌNX̉ivpeB̐錾bsOt@CɊ܂߂܂B
ftHgł́ANX̃vpeB͉iƌȂ </para>
@@ -404,12 +280,6 @@
</hibernate-mapping>]]></programlisting...
[truncated message content] |