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

📄 session_api.po

📁 hibernate-distribution-3.3.1.GA-dist.zip源码
💻 PO
📖 第 1 页 / 共 5 页
字号:
msgid """A collection <emphasis>filter</emphasis> is a special type of query that may ""be applied to a persistent collection or array. The query string may refer ""to <literal>this</literal>, meaning the current collection element."msgstr """コレクション <emphasis>フィルタ</emphasis> は、永続化されているコレクションや""配列に適用される 特殊なタイプのクエリです。そのクエリ文字列では、コレクション""のその時点での要素を意味する <literal>this</literal> を使います。"#. Tag: programlisting#: session_api.xml:415#, no-c-formatmsgid """<![CDATA[Collection blackKittens = session.createFilter(\n""    pk.getKittens(), \n""    \"where this.color = ?\")\n""    .setParameter( Color.BLACK, Hibernate.custom(ColorUserType.class) )\n""    .list()\n"");]]>"msgstr ""#. Tag: para#: session_api.xml:417#, no-c-formatmsgid """The returned collection is considered a bag, and it's a copy of the given ""collection. The original collection is not modified (this is contrary to the ""implication of the name \"filter\", but consistent with expected behavior)."msgstr """返されるコレクションはBagとみなされます。そして、それはもとのコレクションのコ""ピーになります。 元のコレクションは修正されません(これは、\"filter\"という名""前の意味とは異なりますが、 期待される動きとは一致しています)。"#. Tag: para#: session_api.xml:423#, no-c-formatmsgid """Observe that filters do not require a <literal>from</literal> clause (though ""they may have one if required). Filters are not limited to returning the ""collection elements themselves."msgstr """フィルタには <literal>from</literal> 節が不要であることに気づくでしょう(必要""なら、持つことも可能ですが)。 フィルタは、コレクションの要素自体を返して構い""ません。"#. Tag: programlisting#: session_api.xml:428#, no-c-formatmsgid """<![CDATA[Collection blackKittenMates = session.createFilter(\n""    pk.getKittens(), \n""    \"select this.mate where this.color = eg.Color.BLACK.intValue\")\n""    .list();]]>"msgstr ""#. Tag: para#: session_api.xml:430#, no-c-formatmsgid """Even an empty filter query is useful, e.g. to load a subset of elements in a ""huge collection:"msgstr """クエリを含まないフィルタも役に立ちます。 例えば、非常に大きなコレクションの部""分集合をロードするために使えます。"#. Tag: programlisting#: session_api.xml:435#, no-c-formatmsgid """<![CDATA[Collection tenKittens = session.createFilter(\n""    mother.getKittens(), \"\")\n""    .setFirstResult(0).setMaxResults(10)\n""    .list();]]>"msgstr ""#. Tag: title#: session_api.xml:440#, no-c-formatmsgid "Criteria queries"msgstr "クライテリアのクエリ"#. Tag: para#: session_api.xml:442#, no-c-formatmsgid """HQL is extremely powerful but some developers prefer to build queries ""dynamically, using an object-oriented API, rather than building query ""strings. Hibernate provides an intuitive <literal>Criteria</literal> query ""API for these cases:"msgstr """HQLは非常に強力ですが、クエリ文字列を作るよりも、オブジェクト指向のAPIを使っ""て 動的にクエリを作る方を好む開発者もいます。 こういった場合のために、""Hibernateは直感的な <literal>Criteria</literal> クエリAPIを提供しています。"#. Tag: programlisting#: session_api.xml:448#, no-c-formatmsgid """<![CDATA[Criteria crit = session.createCriteria(Cat.class);\n""crit.add( Restrictions.eq( \"color\", eg.Color.BLACK ) );\n""crit.setMaxResults(10);\n""List cats = crit.list();]]>"msgstr ""#. Tag: para#: session_api.xml:450#, no-c-formatmsgid """The <literal>Criteria</literal> and the associated <literal>Example</""literal> API are discussed in more detail in <xref linkend=\"querycriteria\"/"">."msgstr """<literal>Criteria</literal> と <literal>Example</literal> APIの詳細は、 ""<xref linkend=\"querycriteria\"/> に述べられています。"#. Tag: title#: session_api.xml:458#, no-c-formatmsgid "Queries in native SQL"msgstr "ネイティブSQLのクエリ"#. Tag: para#: session_api.xml:460#, no-c-formatmsgid """You may express a query in SQL, using <literal>createSQLQuery()</literal> ""and let Hibernate take care of the mapping from result sets to objects. Note ""that you may at any time call <literal>session.connection()</literal> and ""use the JDBC <literal>Connection</literal> directly. If you chose to use the ""Hibernate API, you must enclose SQL aliases in braces:"msgstr """<literal>createSQLQuery()</literal> を使って、SQLでクエリを表現することもでき""ます。 そして、Hibernateに、ResultSet からオブジェクトへのマッピングをまかせ""ます。 <literal>session.connection()</literal> を呼べばどんなときでも、直接、""JDBC <literal>Connection</literal> を使用できることを覚えておきましょう。 も""し、Hibernate APIを使うのであれば、下記のようにSQLの別名を括弧でくくらなけれ""ばなりません。"#. Tag: programlisting#: session_api.xml:468#, no-c-formatmsgid """<![CDATA[List cats = session.createSQLQuery(\"SELECT {cat.*} FROM CAT {cat} ""WHERE ROWNUM<10\")\n""    .addEntity(\"cat\", Cat.class)\n"".list();]]>"msgstr ""#. Tag: programlisting#: session_api.xml:470#, no-c-formatmsgid """<![CDATA[List cats = session.createSQLQuery(\n""    \"SELECT {cat}.ID AS {cat.id}, {cat}.SEX AS {cat.sex}, \" +\n""           \"{cat}.MATE AS {cat.mate}, {cat}.SUBCLASS AS {cat.class}, ... \" ""+\n""    \"FROM CAT {cat} WHERE ROWNUM<10\")\n""    .addEntity(\"cat\", Cat.class)\n"".list()]]>"msgstr ""#. Tag: para#: session_api.xml:472#, no-c-formatmsgid """SQL queries may contain named and positional parameters, just like Hibernate ""queries. More information about native SQL queries in Hibernate can be found ""in <xref linkend=\"querysql\"/>."msgstr """SQLクエリは、Hibernateクエリと同じように、名前付きのパラメータと位置パラメー""タを持つことができます。 HibernateにおけるネイティブなSQLクエリの詳細について""は、 <xref linkend=\"querysql\"/> を参照してください。"#. Tag: title#: session_api.xml:483#, no-c-formatmsgid "Modifying persistent objects"msgstr "永続オブジェクトの修正"#. Tag: para#: session_api.xml:485#, no-c-formatmsgid """<emphasis>Transactional persistent instances</emphasis> (ie. objects loaded, ""saved, created or queried by the <literal>Session</literal>) may be ""manipulated by the application and any changes to persistent state will be ""persisted when the <literal>Session</literal> is <emphasis>flushed</""emphasis> (discussed later in this chapter). There is no need to call a ""particular method (like <literal>update()</literal>, which has a different ""purpose) to make your modifications persistent. So the most straightforward ""way to update the state of an object is to <literal>load()</literal> it, and ""then manipulate it directly, while the <literal>Session</literal> is open:"msgstr """<emphasis>処理中の永続インスタンス</emphasis> (例: <literal>Session</""literal> によって、 ロード、セーブ、作成、クエリされたオブジェクト)は、アプ""リケーションに操作されます。 その際に変更された永続状態は、 ""<literal>Session</literal> が <emphasis>フラッシュ</emphasis> されるときに、""永続化されます(これは、この章の後半で述べています)。 変更を永続化するため""に、特殊なメソッド( <literal>update()</literal> のようなもの。これは、別の目""的で使用します)を 呼ぶ必要はありません。 オブジェクトの状態を更新する一番簡""単な方法は、オブジェクトを <literal>load()</literal> し、 <literal>Session</""literal> をオープンにしている間に、直接操作することです。"#. Tag: programlisting#: session_api.xml:496#, no-c-formatmsgid """<![CDATA[DomesticCat cat = (DomesticCat) sess.load( Cat.class, new Long""(69) );\n""cat.setName(\"PK\");\n""sess.flush();  // changes to cat are automatically detected and persisted]]>"msgstr ""#. Tag: para#: session_api.xml:498#, no-c-formatmsgid """Sometimes this programming model is inefficient since it would require both ""an SQL <literal>SELECT</literal> (to load an object) and an SQL ""<literal>UPDATE</literal> (to persist its updated state) in the same ""session. Therefore Hibernate offers an alternate approach, using detached ""instances."msgstr """(オブジェクトをロードするための)SQLの <literal>SELECT</literal> と(更新さ""れた状態を永続化するための) SQLの <literal>UPDATE</literal> が同じセッション""で必要となるので、このプログラミングモデルは、 効率が悪くなる場合がありま""す。 そのため、Hibernateは別の方法を用意しています。それは、インスタンスを分""離する(detached)方法です。"#. Tag: emphasis#: session_api.xml:506#, fuzzy, no-c-formatmsgid """Note that Hibernate does not offer its own API for direct execution of ""<literal>UPDATE</literal> or <literal>DELETE</literal> statements. Hibernate ""is a <emphasis>state management</emphasis> service, you don't have to think ""in <emphasis>statements</emphasis> to use it. JDBC is a perfect API for ""executing SQL statements, you can get a JDBC <literal>Connection</literal> ""at any time by calling <literal>session.connection()</literal>. Furthermore, ""the notion of mass operations conflicts with object/relational mapping for ""online transaction processing-oriented applications. Future versions of ""Hibernate may however provide special mass operation functions. See <xref ""linkend=\"batch\"/> for some possible batch operation tricks."msgstr """Hibernateは、 <placeholder-1/> 文や <placeholder-2/> 文を直接実行するAPIを用""意していません。 Hibernateは、 <placeholder-3/> サービスであり、使われるSQL ""<placeholder-4/> のことを開発者が考える必要はありません。 JDBCはSQL文を実行す""る完璧なAPIであり、 <placeholder-5/> を呼ぶことで いつでも、JDBC ""<placeholder-6/> を開発者は取得できます。 さらに、大量のデータ操作の考え方""は、オンライントランザクション処理向きアプリケーションの オブジェクト/リレー""ショナルマッピングと衝突します。 しかし、Hibernateの今後のバージョンでは、大""量データを処理する特別な機能を提供するかもしれません。 バッチ操作に利用できる""いくつかの工夫については、 <xref linkend=\"batch\"/> を参照してください。"#. Tag: title#: session_api.xml:521#, no-c-formatmsgid "Modifying detached objects"msgstr "分離オブジェクトの修正"#. Tag: para#: session_api.xml:523#, no-c-formatmsgid """Many applications need to retrieve an object in one transaction, send it to ""the UI layer for manipulation, then save the changes in a new transaction. ""Applications that use this kind of approach in a high-concurrency ""environment usually use versioned data to ensure isolation for the \"long\" ""unit of work."msgstr """多くのアプリケーションでは次のことが必要になります。 それは、あるトランザク""ションでオブジェクトを復元し、操作するためにそれをUI層に送り、 その後に、新し""いトランザクションで変更をセーブするといったことです。 並行性の高い環境で、こ""のタイプのアプローチを使うアプリケーションでは、 \"期間の長い\" 作業単位の隔""離性を保証するために、バージョンデータが通常使われます。"#. Tag: para#: session_api.xml:530#, no-c-formatmsgid """Hibernate supports this model by providing for reattachment of detached ""instances using the <literal>Session.update()</literal> or <literal>Session.""merge()</literal> methods:"msgstr """Hibernateは、 <literal>Session.update()</literal> や <literal>Session.merge()""</literal> メソッドを 使って、分離インスタンスを再追加することで、このモデル""に対応します。"#. Tag: programlisting#: session_api.xml:536#, no-c-formatmsgid """<![CDATA[// in the first session\n""Cat cat = (Cat) firstSession.load(Cat.class, catId);\n""Cat potentialMate = new Cat();\n""firstSession.save(potentialMate);\n""\n""// in a higher layer of the application\n""cat.setMate(potentialMate);\n""\n""// later, in a new session\n""secondSession.update(cat);  // update cat\n""secondSession.update(mate); // update mate]]>"msgstr ""#. Tag: para#: session_api.xml:538#, no-c-formatmsgid """If the <literal>Cat</literal> with identifier <literal>catId</literal> had ""already been loaded by <literal>secondSession</literal> when the application ""tried to reattach it, an exception would have been thrown."

⌨️ 快捷键说明

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