📄 performance.po
字号:
#. Tag: programlisting#: performance.xml:311#, no-c-formatmsgid """<![CDATA[<class name=\"CatImpl\" proxy=\"Cat\">\n"" ......\n"" <subclass name=\"DomesticCatImpl\" proxy=\"DomesticCat\">\n"" .....\n"" </subclass>\n""</class>]]>"msgstr ""#. Tag: para#: performance.xml:313#, no-c-formatmsgid """where <literal>CatImpl</literal> implements the interface <literal>Cat</""literal> and <literal>DomesticCatImpl</literal> implements the interface ""<literal>DomesticCat</literal>. Then proxies for instances of <literal>Cat</""literal> and <literal>DomesticCat</literal> may be returned by <literal>load""()</literal> or <literal>iterate()</literal>. (Note that <literal>list()</""literal> does not usually return proxies.)"msgstr """<literal>CatImpl</literal> は <literal>Cat</literal> インターフェイスを実装す""るのに対し、 <literal>DomesticCatImpl</literal> は <literal>DomesticCat</""literal> を実装します。 すると、 <literal>load()</literal> や ""<literal>iterate()</literal> は、 <literal>Cat</literal> や ""<literal>DomesticCat</literal> のインスタンスのプロキシを 返します。""( <literal>list()</literal> は通常はプロキシを返さないことに注意してくださ""い。)"#. Tag: programlisting#: performance.xml:321#, no-c-formatmsgid """<![CDATA[Cat cat = (Cat) session.load(CatImpl.class, catid);\n""Iterator iter = session.createQuery(\"from CatImpl as cat where cat.""name='fritz'\").iterate();\n""Cat fritz = (Cat) iter.next();]]>"msgstr ""#. Tag: para#: performance.xml:323#, no-c-formatmsgid """Relationships are also lazily initialized. This means you must declare any ""properties to be of type <literal>Cat</literal>, not <literal>CatImpl</""literal>."msgstr """関連も遅延初期化されます。これはプロパティを <literal>Cat</literal> 型で宣言""しなければ ならないことを意味します。 <literal>CatImpl</literal> ではありませ""ん。"#. Tag: para#: performance.xml:328#, no-c-formatmsgid """Certain operations do <emphasis>not</emphasis> require proxy initialization"msgstr """プロキシの初期化を <emphasis>必要としない</emphasis> 操作も存在します。"#. Tag: para#: performance.xml:334#, no-c-formatmsgid """<literal>equals()</literal>, if the persistent class does not override ""<literal>equals()</literal>"msgstr """<literal>equals()</literal> (永続クラスが <literal>equals()</literal> を ""オーバーライドしないとき)"#. Tag: para#: performance.xml:340#, no-c-formatmsgid """<literal>hashCode()</literal>, if the persistent class does not override ""<literal>hashCode()</literal>"msgstr """<literal>hashCode()</literal> (永続クラスが <literal>hashCode()</literal> ""を オーバーライドしないとき)"#. Tag: para#: performance.xml:346#, no-c-formatmsgid "The identifier getter method"msgstr "識別子のgetterメソッド"#. Tag: para#: performance.xml:352#, no-c-formatmsgid """Hibernate will detect persistent classes that override <literal>equals()</""literal> or <literal>hashCode()</literal>."msgstr """Hibernateは <literal>equals()</literal> や <literal>hashCode()</literal> を""オーバーライドした 永続クラスを検出します。"#. Tag: para#: performance.xml:357#, no-c-formatmsgid """By choosing <literal>lazy=\"no-proxy\"</literal> instead of the default ""<literal>lazy=\"proxy\"</literal>, we can avoid the problems associated with ""typecasting. However, we will require buildtime bytecode instrumentation, ""and all operations will result in immediate proxy initialization."msgstr """デフォルトの <literal>lazy=\"proxy\"</literal> の代わりに、 <literal>lazy=""\"no-proxy\"</literal> を 選んだことで、型変換に関連する問題を回避することが""出来ます。 しかし、ビルド時のバイトコード組み込みが必要になり、どのような操作""であっても、 ただちにプロキシの初期化を行うことになるでしょう。"#. Tag: title#: performance.xml:367#, no-c-formatmsgid "Initializing collections and proxies"msgstr "コレクションとプロキシの初期化"#. Tag: para#: performance.xml:369#, no-c-formatmsgid """A <literal>LazyInitializationException</literal> will be thrown by Hibernate ""if an uninitialized collection or proxy is accessed outside of the scope of ""the <literal>Session</literal>, ie. when the entity owning the collection or ""having the reference to the proxy is in the detached state."msgstr """<literal>LazyInitializationException</literal> は、 <literal>Session</""literal> のスコープ外から 初期化していないコレクションやプロキシにアクセスさ""れたときに、Hibernateによってスローされます。 すなわち、コレクションやプロキ""シへの参照を持つエンティティが分離された状態の時です。"#. Tag: para#: performance.xml:375#, no-c-formatmsgid """Sometimes we need to ensure that a proxy or collection is initialized before ""closing the <literal>Session</literal>. Of course, we can alway force ""initialization by calling <literal>cat.getSex()</literal> or <literal>cat.""getKittens().size()</literal>, for example. But that is confusing to readers ""of the code and is not convenient for generic code."msgstr """<literal>Session</literal> をクローズする前にプロキシやコレクションの初期化を""確実に 行いたいときがあります。もちろん、 <literal>cat.getSex()</literal> や ""<literal>cat.getKittens().size()</literal> などを常に呼び出すことで初期化を強""制することはできます。 しかしこれはコードを読む人を混乱させ、汎用的なコードと""いう点からも不便です。"#. Tag: para#: performance.xml:382#, no-c-formatmsgid """The static methods <literal>Hibernate.initialize()</literal> and ""<literal>Hibernate.isInitialized()</literal> provide the application with a ""convenient way of working with lazily initialized collections or proxies. ""<literal>Hibernate.initialize(cat)</literal> will force the initialization ""of a proxy, <literal>cat</literal>, as long as its <literal>Session</""literal> is still open. <literal>Hibernate.initialize( cat.getKittens() )</""literal> has a similar effect for the collection of kittens."msgstr """staticメソッドの <literal>Hibernate.initialize()</literal> や ""<literal>Hibernate.isInitialized()</literal> は遅延初期化のコレクションやプロ""キシを扱うときに便利な方法をアプリケーションに提供します。 ""<literal>Hibernate.initialize(cat)</literal> は、 <literal>Session</literal> ""がオープンしている限りは <literal>cat</literal> プロキシを強制的に初期化しま""す。 <literal>Hibernate.initialize( cat.getKittens() )</literal> はkittensコ""レクションに対して同様の 効果があります。"#. Tag: para#: performance.xml:391#, no-c-formatmsgid """Another option is to keep the <literal>Session</literal> open until all ""needed collections and proxies have been loaded. In some application ""architectures, particularly where the code that accesses data using ""Hibernate, and the code that uses it are in different application layers or ""different physical processes, it can be a problem to ensure that the ""<literal>Session</literal> is open when a collection is initialized. There ""are two basic ways to deal with this issue:"msgstr """別の選択肢として、必要なすべてのコレクションやプロキシがロードされるまで ""<literal>Session</literal> をオープンにしておく方法があります。いくつかのアプ""リケーションの アーキテクチャでは、特にHibernateによるデータアクセスを行う""コードと、それを使う コードが異なるアプリケーションのレイヤーや、物理的に異な""るプロセッサのときには、 コレクションが初期化されるときに <literal>Session</""literal> がオープンしていることを 保証する問題があります。この問題に対しては2""つの基本的な方法があります。"#. Tag: para#: performance.xml:402#, no-c-formatmsgid """In a web-based application, a servlet filter can be used to close the ""<literal>Session</literal> only at the very end of a user request, once the ""rendering of the view is complete (the <emphasis>Open Session in View</""emphasis> pattern). Of course, this places heavy demands on the correctness ""of the exception handling of your application infrastructure. It is vitally ""important that the <literal>Session</literal> is closed and the transaction ""ended before returning to the user, even when an exception occurs during ""rendering of the view. See the Hibernate Wiki for examples of this \"Open ""Session in View\" pattern."msgstr """Webベースのアプリケーションでは、 ビューのレンダリングが完了し、リクエストが""終わる一番最後で <literal>Session</literal> をクローズするために、サーブレッ""トフィルタを使うことができます( <emphasis>Open Session in View</emphasis> パ""ターンです)。もちろん、アプリケーション基盤の例外処理の正確性が非常に重要に""なります。 ビューのレンダリング中に例外が発生したときでさえ、ユーザに処理が戻""る前に <literal>Session</literal> のクローズとトランザクションの終了を行う こ""とが不可欠になります。 HibernateのWikiに載っている\"Open Session in View\"パ""ターンの例を参照してください。"#. Tag: para#: performance.xml:415#, no-c-formatmsgid """In an application with a separate business tier, the business logic must ""\"prepare\" all collections that will be needed by the web tier before ""returning. This means that the business tier should load all the data and ""return all the data already initialized to the presentation/web tier that is ""required for a particular use case. Usually, the application calls ""<literal>Hibernate.initialize()</literal> for each collection that will be ""needed in the web tier (this call must occur before the session is closed) ""or retrieves the collection eagerly using a Hibernate query with a ""<literal>FETCH</literal> clause or a <literal>FetchMode.JOIN</literal> in ""<literal>Criteria</literal>. This is usually easier if you adopt the ""<emphasis>Command</emphasis> pattern instead of a <emphasis>Session Facade</""emphasis>."msgstr """ビジネス層が分離しているアプリケーションでは、ビジネスロジックは Web層で必要""になるすべてのコレクションを事前に\"準備\"する必要があります。 これは特定の""ユースケースで必要となるプレゼンテーション/Web層に対し、 ビジネス層がすべての""データをロードし、すべてのデータを初期化して返すべきと いうことを意味していま""す。通常は、アプリケーションはWeb層で必要なコレクション それぞれに対して ""<literal>Hibernate.initialize()</literal> を呼び出すか (この呼び出しはセッ""ションをクローズする前に行う必要があります)、 Hibernateクエリの ""<literal>FETCH</literal> 節や <literal>Criteria</literal> の ""<literal>FetchMode.JOIN</literal> を使ってコレクションを先に復元します。 普通""は <emphasis>Session Facade</emphasis> パターンの代わりに <emphasis>Command</""emphasis> パターンを採用するほうがより簡単です。"#. Tag: para#: performance.xml:430#, no-c-formatmsgid """You may also attach a previously loaded object to a new <literal>Session</""literal> with <literal>merge()</literal> or <literal>lock()</literal> before ""accessing uninitialized collections (or other proxies). No, Hibernate does ""not, and certainly <emphasis>should</emphasis> not do this automatically, ""since it would introduce ad hoc transaction semantics!"msgstr """初期化されていないコレクション(もしくは他のプロキシ)にアクセスする前に、 ""<literal>merge()</literal> や <literal>lock()</literal> を使って新しい ""<literal>Session</literal> に以前にロードされたオブジェクトを追加することも出""来ます。 アドホックなトランザクションのセマンティクスを導入したので、""Hibernateは これを自動的に行わず、 <emphasis>行うべきでもありません</""emphasis> !"#. Tag: para#: performance.xml:440#, no-c-formatmsgid """Sometimes you don't want to initialize a large collection, but still need ""some information about it (like its size) or a subset of the data."msgstr """大きなコレクションを初期化したくはないが、コレクションについてのなんらかの情""報(サイズのような) やデータのサブセットを必要とすることがあります。"#. Tag: para#: performance.xml:445#, no-c-formatmsgid """You can use a collection filter to get the size of a collection without ""initializing it:"msgstr """コレクションフィルタを使うことで、初期化せずにコレクションのサイズを取得する""ことが出来ます。"#. Tag: programlisting#: performance.xml:449#, no-c-formatmsgid """<![CDATA[( (Integer) s.createFilter( collection, \"select count(*)\" ).list""().get(0) ).intValue()]]>"msgstr ""#. Tag: para#: performance.xml:451#, no-c-formatmsgid """The <literal>createFilter()</literal> method is also used to efficiently ""retrieve subsets of a collection without needing to initialize the whole ""collection:"msgstr """<literal>createFilter()</literal> メソッドは、コレクション全体を初期化する必""要なしに、コレクションの サブセットを復元するために効果的に使えます。"#. Tag: programlisting#: performance.xml:456#, no-c-formatmsgid """<![CDATA[s.createFilter( lazyCollection, \"\").setFirstResult(0).""setMaxResults(10).list();]]>"msgstr ""#. Tag: title#: performance.xml:461#, no-c-formatmsgid "Using batch fetching"msgstr "バッチフェッチの使用"#. Tag: para
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -