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

📄 query_sql.po

📁 hibernate-distribution-3.3.1.GA-dist.zip源码
💻 PO
📖 第 1 页 / 共 4 页
字号:
msgid ""msgstr """Project-Id-Version: PACKAGE VERSION\n""Report-Msgid-Bugs-To: http://bugs.kde.org\n""POT-Creation-Date: 2008-08-14 15:28+0000\n""PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n""Last-Translator: FULL NAME <EMAIL@ADDRESS>\n""Language-Team: LANGUAGE <LL@li.org>\n""MIME-Version: 1.0\n""Content-Type: text/plain; charset=UTF-8\n""Content-Transfer-Encoding: 8bit\n"#. Tag: title#: query_sql.xml:29#, no-c-formatmsgid "Native SQL"msgstr "SQL natif"#. Tag: para#: query_sql.xml:31#, no-c-formatmsgid """You may also express queries in the native SQL dialect of your database. ""This is useful if you want to utilize database specific features such as ""query hints or the <literal>CONNECT</literal> keyword in Oracle. It also ""provides a clean migration path from a direct SQL/JDBC based application to ""Hibernate."msgstr """Vous pouvez aussi écrire vos requêtes dans le dialecte SQL natif de votre ""base de données. Ceci est utile si vous souhaitez utiliser les ""fonctionnalités spécifiques de votre base de données comme le mot clé ""<literal>CONNECT</literal> d'Oracle. Cette fonctionnalité offre par ailleurs ""un moyen de migration plus propre et doux d'une application basée sur SQL/""JDBC vers une application Hibernate."#. Tag: para#: query_sql.xml:37#, no-c-formatmsgid """Hibernate3 allows you to specify handwritten SQL (including stored ""procedures) for all create, update, delete, and load operations."msgstr """Hibernate3 vous permet de spécifier du SQL écrit à la main (incluant les ""procédures stockées) pour toutes les opérations de création, mise à jour, ""suppression et chargement."#. Tag: title#: query_sql.xml:41#, no-c-formatmsgid "Using a <literal>SQLQuery</literal>"msgstr "Utiliser une <literal>SQLQuery</literal>"#. Tag: para#: query_sql.xml:43#, no-c-formatmsgid """Execution of native SQL queries is controlled via the <literal>SQLQuery</""literal> interface, which is obtained by calling <literal>Session.""createSQLQuery()</literal>. The following describes how to use this API for ""querying."msgstr """L'exécution des requêtes en SQL natif est contrôlée par l'interface ""<literal>SQLQuery</literal>, laquelle est obtenue en appelant ""<literal>Session.createSQLQuery()</literal>. Dans des cas extrêmement ""simples, nous pouvons utiliser la forme suivante :"#. Tag: title#: query_sql.xml:49#, no-c-formatmsgid "Scalar queries"msgstr "Scalar queries"#. Tag: para#: query_sql.xml:51#, no-c-formatmsgid "The most basic SQL query is to get a list of scalars (values)."msgstr "The most basic SQL query is to get a list of scalars (values)."#. Tag: programlisting#: query_sql.xml:54#, no-c-formatmsgid """<![CDATA[sess.createSQLQuery(\"SELECT * FROM CATS\").list();\n""sess.createSQLQuery(\"SELECT ID, NAME, BIRTHDATE FROM CATS\").list();\n""]]>"msgstr ""#. Tag: para#: query_sql.xml:56#, no-c-formatmsgid """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."msgstr """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."#. Tag: para#: query_sql.xml:61#, no-c-formatmsgid """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>."msgstr """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>."#. Tag: programlisting#: query_sql.xml:65#, no-c-formatmsgid """<![CDATA[sess.createSQLQuery(\"SELECT * FROM CATS\")\n"" .addScalar(\"ID\", Hibernate.LONG)\n"" .addScalar(\"NAME\", Hibernate.STRING)\n"" .addScalar(\"BIRTHDATE\", Hibernate.DATE)\n""]]>"msgstr ""#. Tag: para#: query_sql.xml:67 query_sql.xml:113 query_sql.xml:194 query_sql.xml:345#, no-c-formatmsgid "This query specified:"msgstr "This query specified:"#. Tag: para#: query_sql.xml:71 query_sql.xml:117 query_sql.xml:349#, no-c-formatmsgid "the SQL query string"msgstr "the SQL query string"#. Tag: para#: query_sql.xml:75#, no-c-formatmsgid "the columns and types to return"msgstr "the columns and types to return"#. Tag: para#: query_sql.xml:79#, fuzzy, no-c-formatmsgid """This will still return Object arrays, but now it will not use ""<literal>ResultSetMetadata</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."msgstr """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."#. Tag: para#: query_sql.xml:87#, no-c-formatmsgid """It is possible to leave out the type information for all or some of the ""scalars."msgstr """It is possible to leave out the type information for all or some of the ""scalars."#. Tag: programlisting#: query_sql.xml:90#, no-c-formatmsgid """<![CDATA[sess.createSQLQuery(\"SELECT * FROM CATS\")\n"" .addScalar(\"ID\", Hibernate.LONG)\n"" .addScalar(\"NAME\")\n"" .addScalar(\"BIRTHDATE\")\n""]]>"msgstr ""#. Tag: para#: query_sql.xml:92#, no-c-formatmsgid """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."msgstr """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."#. Tag: para#: query_sql.xml:96#, no-c-formatmsgid """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."msgstr """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."#. Tag: title#: query_sql.xml:104#, no-c-formatmsgid "Entity queries"msgstr "Entity queries"#. Tag: para#: query_sql.xml:106#, no-c-formatmsgid """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>."msgstr """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>."#. Tag: programlisting#: query_sql.xml:111#, no-c-formatmsgid """<![CDATA[sess.createSQLQuery(\"SELECT * FROM CATS\").addEntity(Cat.class);\n""sess.createSQLQuery(\"SELECT ID, NAME, BIRTHDATE FROM CATS\").addEntity(Cat.""class);\n""]]>"msgstr ""#. Tag: para#: query_sql.xml:121#, no-c-formatmsgid "the entity returned by the query"msgstr "the entity returned by the query"#. Tag: para#: query_sql.xml:125#, no-c-formatmsgid """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."msgstr """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."#. Tag: para#: query_sql.xml:129#, no-c-formatmsgid """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>:"msgstr """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>:"#. Tag: programlisting#: query_sql.xml:137#, no-c-formatmsgid """<![CDATA[sess.createSQLQuery(\"SELECT ID, NAME, BIRTHDATE, DOG_ID FROM CATS""\").addEntity(Cat.class);\n""]]>"msgstr ""#. Tag: para#: query_sql.xml:139#, no-c-formatmsgid "This will allow cat.getDog() to function properly."msgstr "This will allow cat.getDog() to function properly."#. Tag: title#: query_sql.xml:143#, no-c-formatmsgid "Handling associations and collections"msgstr "Handling associations and collections"#. Tag: para#: query_sql.xml:145#, no-c-formatmsgid """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."msgstr """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."#. Tag: programlisting#: query_sql.xml:150#, no-c-formatmsgid """<![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\")\n"" .addEntity(\"cat\", Cat.class)\n"" .addJoin(\"cat.dog\");\n""]]>"msgstr ""#. Tag: para#: query_sql.xml:152#, no-c-formatmsgid """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."msgstr """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."#. Tag: programlisting#: query_sql.xml:160#, no-c-formatmsgid """<![CDATA[sess.createSQLQuery(\"SELECT ID, NAME, BIRTHDATE, D_ID, D_NAME, ""CAT_ID FROM CATS c, DOGS d WHERE c.ID = d.CAT_ID\")\n"" .addEntity(\"cat\", Cat.class)\n"" .addJoin(\"cat.dogs\");\n""]]>"msgstr ""#. Tag: para#: query_sql.xml:162#, no-c-formatmsgid """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."msgstr """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."#. Tag: title#: query_sql.xml:170#, no-c-formatmsgid "Returning multiple entities"msgstr "Returning multiple entities"#. Tag: para#: query_sql.xml:172#, no-c-formatmsgid """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."msgstr ""

⌨️ 快捷键说明

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