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

📄 configuration.pot

📁 hibernate-distribution-3.3.1.GA-dist.zip源码
💻 POT
📖 第 1 页 / 共 5 页
字号:
# SOME DESCRIPTIVE TITLE.# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.##, fuzzymsgid ""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 <kde-i18n-doc@kde.org>\n""MIME-Version: 1.0\n""Content-Type: application/x-xml2pot; charset=UTF-8\n""Content-Transfer-Encoding: 8bit\n"#. Tag: title#: configuration.xml:29#, no-c-formatmsgid "Configuration"msgstr ""#. Tag: para#: configuration.xml:31#, no-c-formatmsgid "Because Hibernate is designed to operate in many different environments, there are a large number of configuration parameters. Fortunately, most have sensible default values and Hibernate is distributed with an example <literal>hibernate.properties</literal> file in <literal>etc/</literal> that shows the various options. Just put the example file in your classpath and customize it."msgstr ""#. Tag: title#: configuration.xml:40#, no-c-formatmsgid "Programmatic configuration"msgstr ""#. Tag: para#: configuration.xml:42#, no-c-formatmsgid "An instance of <classname>org.hibernate.cfg.Configuration</classname> represents an entire set of mappings of an application's Java types to an SQL database. The <classname>org.hibernate.cfg.Configuration</classname> is used to build an (immutable) <interfacename>org.hibernate.SessionFactory</interfacename>. The mappings are compiled from various XML mapping files."msgstr ""#. Tag: para#: configuration.xml:49#, no-c-formatmsgid "You may obtain a <classname>org.hibernate.cfg.Configuration</classname> instance by instantiating it directly and specifying XML mapping documents. If the mapping files are in the classpath, use <literal>addResource()</literal>:"msgstr ""#. Tag: programlisting#: configuration.xml:55#, no-c-formatmsgid ""      "<![CDATA[Configuration cfg = new Configuration()\n"      "    .addResource(\"Item.hbm.xml\")\n"      "    .addResource(\"Bid.hbm.xml\");]]>"msgstr ""#. Tag: para#: configuration.xml:57#, no-c-formatmsgid "An alternative (sometimes better) way is to specify the mapped class, and let Hibernate find the mapping document for you:"msgstr ""#. Tag: programlisting#: configuration.xml:62#, no-c-formatmsgid ""      "<![CDATA[Configuration cfg = new Configuration()\n"      "    .addClass(org.hibernate.auction.Item.class)\n"      "    .addClass(org.hibernate.auction.Bid.class);]]>"msgstr ""#. Tag: para#: configuration.xml:64#, no-c-formatmsgid "Then Hibernate will look for mapping files named <filename>/org/hibernate/auction/Item.hbm.xml</filename> and <filename>/org/hibernate/auction/Bid.hbm.xml</filename> in the classpath. This approach eliminates any hardcoded filenames."msgstr ""#. Tag: para#: configuration.xml:70#, no-c-formatmsgid "A <classname>org.hibernate.cfg.Configuration</classname> also allows you to specify configuration properties:"msgstr ""#. Tag: programlisting#: configuration.xml:75#, no-c-formatmsgid ""      "<![CDATA[Configuration cfg = new Configuration()\n"      "    .addClass(org.hibernate.auction.Item.class)\n"      "    .addClass(org.hibernate.auction.Bid.class)\n"      "    .setProperty(\"hibernate.dialect\", \"org.hibernate.dialect.MySQLInnoDBDialect\")\n"      "    .setProperty(\"hibernate.connection.datasource\", \"java:comp/env/jdbc/test\")\n"      "    .setProperty(\"hibernate.order_updates\", \"true\");]]>"msgstr ""#. Tag: para#: configuration.xml:77#, no-c-formatmsgid "This is not the only way to pass configuration properties to Hibernate. The various options include:"msgstr ""#. Tag: para#: configuration.xml:84#, no-c-formatmsgid "Pass an instance of <classname>java.util.Properties</classname> to <literal>Configuration.setProperties()</literal>."msgstr ""#. Tag: para#: configuration.xml:90#, no-c-formatmsgid "Place a file named <filename>hibernate.properties</filename> in a root directory of the classpath."msgstr ""#. Tag: para#: configuration.xml:95#, no-c-formatmsgid "Set <literal>System</literal> properties using <literal>java -Dproperty=value</literal>."msgstr ""#. Tag: para#: configuration.xml:100#, no-c-formatmsgid "Include <literal>&lt;property&gt;</literal> elements in <literal>hibernate.cfg.xml</literal> (discussed later)."msgstr ""#. Tag: para#: configuration.xml:107#, no-c-formatmsgid "<filename>hibernate.properties</filename> is the easiest approach if you want to get started quickly."msgstr ""#. Tag: para#: configuration.xml:111#, no-c-formatmsgid "The <classname>org.hibernate.cfg.Configuration</classname> is intended as a startup-time object, to be discarded once a <literal>SessionFactory</literal> is created."msgstr ""#. Tag: title#: configuration.xml:119#, no-c-formatmsgid "Obtaining a SessionFactory"msgstr ""#. Tag: para#: configuration.xml:121#, no-c-formatmsgid "When all mappings have been parsed by the <classname>org.hibernate.cfg.Configuration</classname>, the application must obtain a factory for <interfacename>org.hibernate.Session</interfacename> instances. This factory is intended to be shared by all application threads:"msgstr ""#. Tag: programlisting#: configuration.xml:127#, no-c-formatmsgid "<![CDATA[SessionFactory sessions = cfg.buildSessionFactory();]]>"msgstr ""#. Tag: para#: configuration.xml:129#, no-c-formatmsgid "Hibernate does allow your application to instantiate more than one <interfacename>org.hibernate.SessionFactory</interfacename>. This is useful if you are using more than one database."msgstr ""#. Tag: title#: configuration.xml:138#, no-c-formatmsgid "JDBC connections"msgstr ""#. Tag: para#: configuration.xml:140#, no-c-formatmsgid "Usually, you want to have the <interfacename>org.hibernate.SessionFactory</interfacename> create and pool JDBC connections for you. If you take this approach, opening a <interfacename>org.hibernate.Session</interfacename> is as simple as:"msgstr ""#. Tag: programlisting#: configuration.xml:146#, no-c-formatmsgid "<![CDATA[Session session = sessions.openSession(); // open a new Session]]>"msgstr ""#. Tag: para#: configuration.xml:148#, no-c-formatmsgid "As soon as you do something that requires access to the database, a JDBC connection will be obtained from the pool."msgstr ""#. Tag: para#: configuration.xml:153#, no-c-formatmsgid "For this to work, we need to pass some JDBC connection properties to Hibernate. All Hibernate property names and semantics are defined on the class <classname>org.hibernate.cfg.Environment</classname>. We will now describe the most important settings for JDBC connection configuration."msgstr ""#. Tag: para#: configuration.xml:159#, no-c-formatmsgid "Hibernate will obtain (and pool) connections using <classname>java.sql.DriverManager</classname> if you set the following properties:"msgstr ""#. Tag: title#: configuration.xml:165#, no-c-formatmsgid "Hibernate JDBC Properties"msgstr ""#. Tag: entry#: configuration.xml:171 configuration.xml:257 configuration.xml:353 configuration.xml:548 configuration.xml:743 configuration.xml:850 configuration.xml:938#, no-c-formatmsgid "Property name"msgstr ""#. Tag: entry#: configuration.xml:172 configuration.xml:258 configuration.xml:354 configuration.xml:549 configuration.xml:744 configuration.xml:851 configuration.xml:939#, no-c-formatmsgid "Purpose"msgstr ""#. Tag: property#: configuration.xml:178#, no-c-formatmsgid "hibernate.connection.driver_class"msgstr ""#. Tag: emphasis#: configuration.xml:181#, no-c-formatmsgid "JDBC driver class"msgstr ""#. Tag: property#: configuration.xml:186#, no-c-formatmsgid "hibernate.connection.url"msgstr ""#. Tag: emphasis#: configuration.xml:189#, no-c-formatmsgid "JDBC URL"msgstr ""#. Tag: property#: configuration.xml:194 configuration.xml:288#, no-c-formatmsgid "hibernate.connection.username"msgstr ""#. Tag: emphasis#: configuration.xml:197#, no-c-formatmsgid "database user"msgstr ""#. Tag: property#: configuration.xml:202 configuration.xml:296#, no-c-formatmsgid "hibernate.connection.password"msgstr ""#. Tag: emphasis#: configuration.xml:205#, no-c-formatmsgid "database user password"msgstr ""#. Tag: property#: configuration.xml:210#, no-c-formatmsgid "hibernate.connection.pool_size"msgstr ""#. Tag: emphasis#: configuration.xml:213#, no-c-formatmsgid "maximum number of pooled connections"msgstr ""#. Tag: para#: configuration.xml:220#, no-c-formatmsgid "Hibernate's own connection pooling algorithm is however quite rudimentary. It is intended to help you get started and is <emphasis>not intended for use in a production system</emphasis> or even for performance testing. You should use a third party pool for best performance and stability. Just replace the <property>hibernate.connection.pool_size</property> property with connection pool specific settings. This will turn off Hibernate's internal pool. For example, you might like to use C3P0."msgstr ""#. Tag: para#: configuration.xml:230#, no-c-formatmsgid "C3P0 is an open source JDBC connection pool distributed along with Hibernate in the <filename>lib</filename> directory. Hibernate will use its <classname>org.hibernate.connection.C3P0ConnectionProvider</classname> for connection pooling if you set <property>hibernate.c3p0.*</property> properties. If you'd like to use Proxool refer to the packaged <filename>hibernate.properties</filename> and the Hibernate web site for more information."msgstr ""#. Tag: para#: configuration.xml:238#, no-c-formatmsgid "Here is an example <filename>hibernate.properties</filename> file for C3P0:"msgstr ""#. Tag: programlisting#: configuration.xml:242#, no-c-formatmsgid ""      "<![CDATA[hibernate.connection.driver_class = org.postgresql.Driver\n"      "hibernate.connection.url = jdbc:postgresql://localhost/mydatabase\n"      "hibernate.connection.username = myuser\n"      "hibernate.connection.password = secret\n"      "hibernate.c3p0.min_size=5\n"      "hibernate.c3p0.max_size=20\n"      "hibernate.c3p0.timeout=1800\n"      "hibernate.c3p0.max_statements=50\n"      "hibernate.dialect = org.hibernate.dialect.PostgreSQLDialect]]>"msgstr ""#. Tag: para#: configuration.xml:244#, no-c-formatmsgid "For use inside an application server, you should almost always configure Hibernate to obtain connections from an application server <interfacename>javax.sql.Datasource</interfacename> registered in JNDI. You'll need to set at least one of the following properties:"msgstr ""#. Tag: title#: configuration.xml:251#, no-c-formatmsgid "Hibernate Datasource Properties"msgstr ""#. Tag: property#: configuration.xml:264#, no-c-formatmsgid "hibernate.connection.datasource"msgstr ""#. Tag: emphasis#: configuration.xml:267#, no-c-formatmsgid "datasource JNDI name"msgstr ""#. Tag: property#: configuration.xml:272#, no-c-formatmsgid "hibernate.jndi.url"msgstr ""#. Tag: entry#: configuration.xml:274#, no-c-formatmsgid "<emphasis>URL of the JNDI provider</emphasis> (optional)"msgstr ""#. Tag: property#: configuration.xml:280#, no-c-formatmsgid "hibernate.jndi.class"msgstr ""#. Tag: entry#: configuration.xml:282#, no-c-formatmsgid "<emphasis>class of the JNDI <literal>InitialContextFactory</literal></emphasis> (optional)"msgstr ""#. Tag: entry#: configuration.xml:290#, no-c-formatmsgid "<emphasis>database user</emphasis> (optional)"msgstr ""#. Tag: entry#: configuration.xml:298#, no-c-formatmsgid "<emphasis>database user password</emphasis> (optional)"msgstr ""#. Tag: para#: configuration.xml:306#, no-c-formatmsgid "Here's an example <filename>hibernate.properties</filename> file for an application server provided JNDI datasource:"msgstr ""#. Tag: programlisting#: configuration.xml:311#, no-c-formatmsgid ""      "<![CDATA[hibernate.connection.datasource = java:/comp/env/jdbc/test\n"      "hibernate.transaction.factory_class = \\\n"      "    org.hibernate.transaction.JTATransactionFactory\n"      "hibernate.transaction.manager_lookup_class = \\\n"      "    org.hibernate.transaction.JBossTransactionManagerLookup\n"      "hibernate.dialect = org.hibernate.dialect.PostgreSQLDialect]]>"msgstr ""#. Tag: para#: configuration.xml:313#, no-c-formatmsgid "JDBC connections obtained from a JNDI datasource will automatically participate in the container-managed transactions of the application server."msgstr ""#. Tag: para#: configuration.xml:318#, no-c-formatmsgid "Arbitrary connection properties may be given by prepending \"<literal>hibernate.connection</literal>\" to the connection property name. For example, you may specify a <property>charSet</property> connection property using <property>hibernate.connection.charSet</property>."msgstr ""#. Tag: para#: configuration.xml:324#, no-c-formatmsgid "You may define your own plugin strategy for obtaining JDBC connections by implementing the interface <interfacename>org.hibernate.connection.ConnectionProvider</interfacename>, and specifying your custom implementation via the <property>hibernate.connection.provider_class</property> property."msgstr ""#. Tag: title#: configuration.xml:333#, no-c-formatmsgid "Optional configuration properties"msgstr ""#. Tag: para#: configuration.xml:335#, no-c-formatmsgid "There are a number of other properties that control the behaviour of Hibernate at runtime. All are optional and have reasonable default values."msgstr ""#. Tag: para#: configuration.xml:340#, no-c-formatmsgid "<emphasis>Warning: some of these properties are \"system-level\" only.</emphasis> System-level properties can be set only via <literal>java -Dproperty=value</literal> or <filename>hibernate.properties</filename>. They may <emphasis>not</emphasis> be set by the other techniques described above."msgstr ""#. Tag: title#: configuration.xml:347#, no-c-formatmsgid "Hibernate Configuration Properties"msgstr ""#. Tag: property#: configuration.xml:360#, no-c-format

⌨️ 快捷键说明

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