📄 query_sql.po
字号:
"名と同じであると仮定していました。 複数のテーブルが同じカラム名を持つ場合があ""るため、 複数テーブルを結合するSQLクエリで問題となる場合があります。"#. Tag: para#: query_sql.xml:153#, no-c-formatmsgid """Column alias injection is needed in the following query (which most likely ""will fail):"msgstr """下記のような(失敗しそうな)クエリでは、 カラム別名インジェクション(column ""alias injection)が必要です。"#. Tag: programlisting#: query_sql.xml:156#, no-c-formatmsgid """<![CDATA[sess.createSQLQuery(\"SELECT c.*, m.* FROM CATS c, CATS m WHERE c.""MOTHER_ID = c.ID\")\n"" .addEntity(\"cat\", Cat.class)\n"" .addEntity(\"mother\", Cat.class)\n""]]>"msgstr ""#. Tag: para#: query_sql.xml:158#, no-c-formatmsgid """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\")."msgstr """このクエリの意図は、 1行ごとに2つのCatインスタンス、つまり猫とその母親を返""すということです。 同じカラム名にマッピングすることにより名前が衝突するため、""このクエリは失敗します。 ベータベースによっては、返されるカラムの別名が \"c.""ID\"、\"c.NAME\" などの形式であり、 マッピングで指定されたカラム(\"ID\" と ""\"NAME\")と等しくないため、失敗します。"#. Tag: para#: query_sql.xml:165#, no-c-formatmsgid "The following form is not vulnerable to column name duplication:"msgstr "下記の形式は、カラム名が重複しても大丈夫です。"#. Tag: programlisting#: query_sql.xml:168#, no-c-formatmsgid """<![CDATA[sess.createSQLQuery(\"SELECT {cat.*}, {mother.*} FROM CATS c, CATS ""m WHERE c.MOTHER_ID = c.ID\")\n"" .addEntity(\"cat\", Cat.class)\n"" .addEntity(\"mother\", Cat.class)\n""]]>"msgstr ""#. Tag: para#: query_sql.xml:174#, no-c-formatmsgid """the SQL query string, with placeholders for Hibernate to inject column ""aliases"msgstr """SQLクエリ文字列 (Hibernateがカラムの別名を挿入するためのプレースホルダを含""む)"#. Tag: para#: query_sql.xml:179#, no-c-formatmsgid "the entities returned by the query"msgstr "クエリによって返されるエンティティ"#. Tag: para#: query_sql.xml:183#, no-c-formatmsgid """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."msgstr """上記で使用している {cat.*} と {mother.*} という表記は、 「すべてのプロパ""ティ」を表す省略形です。 代わりに、明示的にカラムを列挙してもよいですが、 そ""の場合は、Hibernateに各プロパティに対応するSQLカラムの別名を挿入させるべきで""しょう。 カラムの別名のためのプレースホルダは、テーブルの別名によって修飾され""たプロパティ名です。 下記の例では、別のテーブル cat_log から マッピングメタ""データで定義された Cat とその母親を復元します。 もし好むなら、where節の中で""も、プロパティの別名を使えます。"#. Tag: programlisting#: query_sql.xml:192#, no-c-formatmsgid """<![CDATA[String sql = \"SELECT ID as {c.id}, NAME as {c.name}, \" + \n"" \"BIRTHDATE as {c.birthDate}, MOTHER_ID as {c.mother}, {mother.*} ""\" +\n"" \"FROM CAT_LOG c, CAT_LOG m WHERE {c.mother} = c.ID\";\n""\n""List loggedCats = sess.createSQLQuery(sql)\n"" .addEntity(\"cat\", Cat.class)\n"" .addEntity(\"mother\", Cat.class).list()\n""]]>"msgstr ""#. Tag: title#: query_sql.xml:195#, no-c-formatmsgid "Alias and property references"msgstr "別名とプロパティのリファレンス"#. Tag: para#: query_sql.xml:197#, no-c-formatmsgid """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."msgstr """多くの場合、上記のような別名インジェクションが必要です。 ただし、複合プロパ""ティ、継承識別子、コレクションなどのような より複雑なマッピングと関連するクエ""リがなければです。 ある特定の別名を使用することにより、Hibernateは適切な別名""を挿入できます。"#. Tag: para#: query_sql.xml:202#, no-c-formatmsgid """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."msgstr """別名インジェクションとして使用できるものを下表に示します。 注意:下表の別名は""一例です。 それぞれの別名は一意であり、使用する際にはおそらく異なる名前を持ち""ます。"#. Tag: title#: query_sql.xml:208#, no-c-formatmsgid "Alias injection names"msgstr "別名に挿入する名前"#. Tag: entry#: query_sql.xml:219#, no-c-formatmsgid "Description"msgstr "説明"#. Tag: entry#: query_sql.xml:221#, no-c-formatmsgid "Syntax"msgstr "構文"#. Tag: entry#: query_sql.xml:223#, no-c-formatmsgid "Example"msgstr "例"#. Tag: entry#: query_sql.xml:229#, no-c-formatmsgid "A simple property"msgstr "単純なプロパティ"#. Tag: literal#: query_sql.xml:231#, no-c-formatmsgid "{[aliasname].[propertyname]"msgstr "{[aliasname].[propertyname]}"#. Tag: literal#: query_sql.xml:233#, no-c-formatmsgid "A_NAME as {item.name}"msgstr "A_NAME as {item.name}"#. Tag: entry#: query_sql.xml:237#, no-c-formatmsgid "A composite property"msgstr "複合プロパティ"#. Tag: literal#: query_sql.xml:239#, no-c-formatmsgid "{[aliasname].[componentname].[propertyname]}"msgstr "{[aliasname].[componentname].[propertyname]}"#. Tag: literal#: query_sql.xml:241#, no-c-formatmsgid "CURRENCY as {item.amount.currency}, VALUE as {item.amount.value}"msgstr "CURRENCY as {item.amount.currency}, VALUE as {item.amount.value}"#. Tag: entry#: query_sql.xml:246#, no-c-formatmsgid "Discriminator of an entity"msgstr "エンティティのクラスを識別する値"#. Tag: literal#: query_sql.xml:248#, no-c-formatmsgid "{[aliasname].class}"msgstr "{[aliasname].class}"#. Tag: literal#: query_sql.xml:250#, no-c-formatmsgid "DISC as {item.class}"msgstr "DISC as {item.class}"#. Tag: entry#: query_sql.xml:254#, no-c-formatmsgid "All properties of an entity"msgstr "エンティティの全プロパティ"#. Tag: literal#: query_sql.xml:256 query_sql.xml:304#, no-c-formatmsgid "{[aliasname].*}"msgstr "{[aliasname].*}"#. Tag: literal#: query_sql.xml:258#, no-c-formatmsgid "{item.*}"msgstr "{item.*}"#. Tag: entry#: query_sql.xml:262#, no-c-formatmsgid "A collection key"msgstr "コレクションのキー"#. Tag: literal#: query_sql.xml:264#, no-c-formatmsgid "{[aliasname].key}"msgstr "{[aliasname].key}"#. Tag: literal#: query_sql.xml:266#, no-c-formatmsgid "ORGID as {coll.key}"msgstr "ORGID as {coll.key}"#. Tag: entry#: query_sql.xml:270#, no-c-formatmsgid "The id of an collection"msgstr "コレクションのID"#. Tag: literal#: query_sql.xml:272#, no-c-formatmsgid "{[aliasname].id}"msgstr "{[aliasname].id}"#. Tag: literal#: query_sql.xml:274#, no-c-formatmsgid "EMPID as {coll.id}"msgstr "EMPID as {coll.id}"#. Tag: entry#: query_sql.xml:278#, no-c-formatmsgid "The element of an collection"msgstr "コレクションの要素"#. Tag: literal#: query_sql.xml:280#, no-c-formatmsgid "{[aliasname].element}"msgstr "{[aliasname].element}"#. Tag: literal#: query_sql.xml:282#, no-c-formatmsgid "XID as {coll.element}"msgstr "XID as {coll.element}"#. Tag: entry#: query_sql.xml:286#, no-c-formatmsgid "roperty of the element in the collection"msgstr "コレクションの要素のプロパティ"#. Tag: literal#: query_sql.xml:288#, no-c-formatmsgid "{[aliasname].element.[propertyname]}"msgstr "{[aliasname].element.[propertyname]}"#. Tag: literal#: query_sql.xml:290#, no-c-formatmsgid "NAME as {coll.element.name}"msgstr "NAME as {coll.element.name}"#. Tag: entry#: query_sql.xml:294#, no-c-formatmsgid "All properties of the element in the collection"msgstr "コレクションの要素の全プロパティ"#. Tag: literal#: query_sql.xml:296#, no-c-formatmsgid "{[aliasname].element.*}"msgstr "{[aliasname].element.*}"#. Tag: literal#: query_sql.xml:298#, no-c-formatmsgid "{coll.element.*}"msgstr "{coll.element.*}"#. Tag: entry#: query_sql.xml:302#, no-c-formatmsgid "All properties of the the collection"msgstr "コレクションの全プロパティ"#. Tag: literal#: query_sql.xml:306#, no-c-formatmsgid "{coll.*}"msgstr "{coll.*}"#. Tag: title#: query_sql.xml:315#, no-c-formatmsgid "Returning non-managed entities"msgstr "管理されていないエンティティの取得"#. Tag: para#: query_sql.xml:317#, no-c-formatmsgid """It is possible to apply a ResultTransformer to native sql queries. Allowing ""it to e.g. return non-managed entities."msgstr """ネイティブSQLクエリに ResultTransformer を適用できます。 下記のように、例え""ば、管理されていないエンティティを返します。"#. Tag: programlisting#: query_sql.xml:319#, no-c-formatmsgid """<![CDATA[sess.createSQLQuery(\"SELECT NAME, BIRTHDATE FROM CATS\")\n"" .setResultTransformer(Transformers.aliasToBean(CatDTO.class))]]>"msgstr ""#. Tag: para#: query_sql.xml:329#, no-c-formatmsgid "a result transformer"
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -