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

📄 query_sql.po

📁 hibernate 开源框架的代码 jar包希望大家能喜欢
💻 PO
📖 第 1 页 / 共 4 页
字号:
"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."#. 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 is needed in the following query (which most likely ""will fail):"#. 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 """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\")."#. Tag: para#: query_sql.xml:165#, no-c-formatmsgid "The following form is not vulnerable to column name duplication:"msgstr "The following form is not vulnerable to column name duplication:"#. 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 """the SQL query string, with placeholders for Hibernate to inject column ""aliases"#. Tag: para#: query_sql.xml:179#, no-c-formatmsgid "the entities returned by the query"msgstr "the entities returned by the query"#. 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 """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."#. 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 "Alias and property references"#. 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 """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."#. 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 """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."#. Tag: title#: query_sql.xml:208#, no-c-formatmsgid "Alias injection names"msgstr "Alias injection names"#. Tag: entry#: query_sql.xml:219#, no-c-formatmsgid "Description"msgstr "Description"#. Tag: entry#: query_sql.xml:221#, no-c-formatmsgid "Syntax"msgstr "Syntax"#. Tag: entry#: query_sql.xml:223#, no-c-formatmsgid "Example"msgstr "Example"#. Tag: entry#: query_sql.xml:229#, no-c-formatmsgid "A simple property"msgstr "A simple property"#. 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 "A composite property"#. 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 "Discriminator of an entity"#. 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 "All properties of an entity"#. 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 "A collection key"#. 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 "The id of an collection"#. 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 "The element of an collection"#. 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 "roperty of the element in the collection"#. 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 "All properties of the element in the collection"#. 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 "All properties of the the collection"#. 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 "Returning non-managed entities"#. 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 """It is possible to apply a ResultTransformer to native sql queries. Allowing ""it to e.g. return non-managed entities."#. 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"msgstr "a result transformer"#. Tag: para

⌨️ 快捷键说明

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