|
From: <one...@us...> - 2003-02-02 07:02:34
|
Update of /cvsroot/hibernate/Hibernate2/doc/reference/html
In directory sc8-pr-cvs1:/tmp/cvs-serv31456/reference/html
Modified Files:
session-configuration.html
Log Message:
fixed dialect class names
Index: session-configuration.html
===================================================================
RCS file: /cvsroot/hibernate/Hibernate2/doc/reference/html/session-configuration.html,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -d -r1.2 -r1.3
*** session-configuration.html 28 Jan 2003 13:25:09 -0000 1.2
--- session-configuration.html 2 Feb 2003 07:02:31 -0000 1.3
***************
*** 6,10 ****
relational database. These mappings are compiled from various XML mapping
files. You may obtain a <tt>Configuration</tt> instance by
! instantiating it directly. Heres an example of setting up a datastore from
mappings defined in two XML configuration files:
</p><pre class="programlisting">Configuration cfg = new Configuration()
--- 6,10 ----
relational database. These mappings are compiled from various XML mapping
files. You may obtain a <tt>Configuration</tt> instance by
! instantiating it directly. Heres an example of setting up a datastore from
mappings defined in two XML configuration files:
</p><pre class="programlisting">Configuration cfg = new Configuration()
***************
*** 36,42 ****
using more than one database.
</p><pre class="programlisting">SessionFactory sessions = cfg.buildSessionFactory();</pre></div><div class="sect1"><div class="titlepage"><div><h2 class="title" style="clear: both"><a name="session-configuration-s3"></a>User provided JDBC connection</h2></div></div><p>
! A <tt>SessionFactory</tt> may open a <tt>Session</tt> on
! a user-provided JDBC connection. This design choice frees the application to
! obtain JDBC connections wherever it pleases. The application must be careful
not to open two concurrent sessions on the same connection.
</p><pre class="programlisting">java.sql.Connection conn = datasource.getConnection();
--- 36,42 ----
using more than one database.
</p><pre class="programlisting">SessionFactory sessions = cfg.buildSessionFactory();</pre></div><div class="sect1"><div class="titlepage"><div><h2 class="title" style="clear: both"><a name="session-configuration-s3"></a>User provided JDBC connection</h2></div></div><p>
! A <tt>SessionFactory</tt> may open a <tt>Session</tt> on
! a user-provided JDBC connection. This design choice frees the application to
! obtain JDBC connections wherever it pleases. The application must be careful
not to open two concurrent sessions on the same connection.
</p><pre class="programlisting">java.sql.Connection conn = datasource.getConnection();
***************
*** 68,72 ****
<tt>hibernate.cfg.xml</tt> (see below).
</p></li></ol></div><p>
! Hibernate will obtain (and pool) connections using <tt>java.sql.DriverManager</tt>
if you set the following properties:
</p><div class="itemizedlist"><ul type="disc"><li><p>
--- 68,72 ----
<tt>hibernate.cfg.xml</tt> (see below).
</p></li></ol></div><p>
! Hibernate will obtain (and pool) connections using <tt>java.sql.DriverManager</tt>
if you set the following properties:
</p><div class="itemizedlist"><ul type="disc"><li><p>
***************
*** 89,93 ****
level (optional)</i></span>
</p></li><li><p>
! <tt>hibernate.connection.xxxx</tt> = <span class="emphasis"><i>pass the JDBC property
<tt>xxxx</tt> to <tt>DriverManager.getConnection()</tt></i></span>
</p></li></ul></div><p>
--- 89,93 ----
level (optional)</i></span>
</p></li><li><p>
! <tt>hibernate.connection.xxxx</tt> = <span class="emphasis"><i>pass the JDBC property
<tt>xxxx</tt> to <tt>DriverManager.getConnection()</tt></i></span>
</p></li></ul></div><p>
***************
*** 123,134 ****
</p><p>
There is also built-in support for Apache DBCP connection pooling. You must set the
! properties <tt>hibernate.dbcp.*</tt> (DBCP connection pool properties) and
! <tt>hibernate.dbcp.ps.*</tt> (DBCP statement cache properties) to enable
! <tt>DBCPConnectionProvider</tt>. Please refer the the Apache commons-pool
documentation for the interpretation of these properties. All Hibernate property
names are defined on the class <tt>net.sf.hibernate.Environment</tt>.
</p><p>
For use inside an application server, Hibernate may obtain connections from a
! <tt>javax.sql.Datasource</tt> registered in JNDI. Set the following
properties:
</p><div class="itemizedlist"><ul type="disc"><li><p>
--- 123,134 ----
</p><p>
There is also built-in support for Apache DBCP connection pooling. You must set the
! properties <tt>hibernate.dbcp.*</tt> (DBCP connection pool properties) and
! <tt>hibernate.dbcp.ps.*</tt> (DBCP statement cache properties) to enable
! <tt>DBCPConnectionProvider</tt>. Please refer the the Apache commons-pool
documentation for the interpretation of these properties. All Hibernate property
names are defined on the class <tt>net.sf.hibernate.Environment</tt>.
</p><p>
For use inside an application server, Hibernate may obtain connections from a
! <tt>javax.sql.Datasource</tt> registered in JNDI. Set the following
properties:
</p><div class="itemizedlist"><ul type="disc"><li><p>
***************
*** 160,174 ****
This property is only necessary when using user supplied
connections. Hibernate uses connection metadata otherwise.</td></tr><tr><td><tt>hibernate.jdbc.use_streams_for_binary</tt></td><td><tt>true</tt> | <tt>false</tt></td><td>use streams when writing / reading <tt>binary</tt>
! or <tt>serializable</tt> types to / from JDBC</td></tr><tr><td><tt>hibernate.connection.provider_class</tt></td><td><tt>full.classname.of.ConnectionProvider</tt></td><td>classname of a custom <tt>ConnectionProvider</tt></td></tr><tr><td><tt>hibernate.transaction.factory_class</tt></td><td><tt>full.classname.of.TransactionFactory</tt></td><td>classname of a <tt>TransactionFactory</tt> to use with
! Hibernate Transaction API</td></tr><tr><td><tt>jta.UserTransaction</tt></td><td><tt>jndi/composite/name</tt></td><td>A JNDI name used by <tt>JTATransactionFactory</tt> to
obtain the JTA <tt>UserTransaction</tt></td></tr><tr><td><tt>hibernate.transaction.manager_lookup_class</tt></td><td><tt>full.classname.of.TransactionManagerLookup</tt></td><td>classname of a <tt>TransactionManagerLookup</tt> - needed
when JVM-level caching is enabled in a JTA environment</td></tr><tr><td><tt>hibernate.query.imports</tt></td><td><tt>package.name, other.package.name</tt></td><td>A list of packages containing persistent classes. If the package is
! listed here, your Hibernate queries need not specify the full class name of a
persistent class. (You can use <tt>from foo in class Foo</tt> as an
alternative to <tt>from foo in class eg.foo.Foo</tt>.)</td></tr><tr><td><tt>hibernate.query.substitutions</tt></td><td><tt>hqlLiteral=SQL_LITERAL, hqlFunction=SQLFUNC</tt></td><td>mapping from tokens in Hibernate queries to SQL tokens ( tokens might be
function or literal names, for example )</td></tr><tr><td><tt>hibernate.show_sql</tt></td><td><tt>true</tt> | <tt>false</tt></td><td>write all SQL statements to console ( as an alternative to use of the
logging functionality )</td></tr></tbody></table></div><p>
! You should always set the <tt>hibernate.dialect</tt> property to the correct
! <tt>net.sf.hibernate.sql.Dialect</tt> subclass for your database. This is not
strictly essential unless you wish to use <tt>native</tt> or
<tt>sequence</tt> primary key generation or pessimistic locking (
--- 160,174 ----
This property is only necessary when using user supplied
connections. Hibernate uses connection metadata otherwise.</td></tr><tr><td><tt>hibernate.jdbc.use_streams_for_binary</tt></td><td><tt>true</tt> | <tt>false</tt></td><td>use streams when writing / reading <tt>binary</tt>
! or <tt>serializable</tt> types to / from JDBC</td></tr><tr><td><tt>hibernate.connection.provider_class</tt></td><td><tt>full.classname.of.ConnectionProvider</tt></td><td>classname of a custom <tt>ConnectionProvider</tt></td></tr><tr><td><tt>hibernate.transaction.factory_class</tt></td><td><tt>full.classname.of.TransactionFactory</tt></td><td>classname of a <tt>TransactionFactory</tt> to use with
! Hibernate Transaction API</td></tr><tr><td><tt>jta.UserTransaction</tt></td><td><tt>jndi/composite/name</tt></td><td>A JNDI name used by <tt>JTATransactionFactory</tt> to
obtain the JTA <tt>UserTransaction</tt></td></tr><tr><td><tt>hibernate.transaction.manager_lookup_class</tt></td><td><tt>full.classname.of.TransactionManagerLookup</tt></td><td>classname of a <tt>TransactionManagerLookup</tt> - needed
when JVM-level caching is enabled in a JTA environment</td></tr><tr><td><tt>hibernate.query.imports</tt></td><td><tt>package.name, other.package.name</tt></td><td>A list of packages containing persistent classes. If the package is
! listed here, your Hibernate queries need not specify the full class name of a
persistent class. (You can use <tt>from foo in class Foo</tt> as an
alternative to <tt>from foo in class eg.foo.Foo</tt>.)</td></tr><tr><td><tt>hibernate.query.substitutions</tt></td><td><tt>hqlLiteral=SQL_LITERAL, hqlFunction=SQLFUNC</tt></td><td>mapping from tokens in Hibernate queries to SQL tokens ( tokens might be
function or literal names, for example )</td></tr><tr><td><tt>hibernate.show_sql</tt></td><td><tt>true</tt> | <tt>false</tt></td><td>write all SQL statements to console ( as an alternative to use of the
logging functionality )</td></tr></tbody></table></div><p>
! You should always set the <tt>hibernate.dialect</tt> property to the correct
! <tt>net.sf.hibernate.dialect.Dialect</tt> subclass for your database. This is not
strictly essential unless you wish to use <tt>native</tt> or
<tt>sequence</tt> primary key generation or pessimistic locking (
***************
*** 178,182 ****
</p><p>
The following table displays possible values for <tt>hibernate.dialect</tt>.
! </p><table class="simplelist" border="0" summary="Simple list"><tr><td>DB2</td><td><tt>net.sf.hibernate.sql.DB2Dialect</tt></td></tr><tr><td>MySQL</td><td><tt>net.sf.hibernate.sql.MySQLDialect</tt></td></tr><tr><td>SAP DB</td><td><tt>net.sf.hibernate.sql.SAPDBDialect</tt></td></tr><tr><td>Oracle</td><td><tt>net.sf.hibernate.sql.OracleDialect</tt></td></tr><tr><td>Sybase</td><td><tt>net.sf.hibernate.sql.SybaseDialect</tt></td></tr><tr><td>Progress</td><td><tt>net.sf.hibernate.sql.ProgressDialect</tt></td></tr><tr><td>Mckoi SQL</td><td><tt>net.sf.hibernate.sql.McKoiDialect</tt></td></tr><tr><td>Interbase</td><td><tt>net.sf.hibernate.sql.InterbaseDialect</tt></td></tr><tr><td>Pointbase</td><td><tt>net.sf.hibernate.sql.PointbaseDialect</tt></td></tr><tr><td>PostgreSQL</td><td><tt>net.sf.hibernate.sql.PostgreSQLDialect</tt></td></tr><tr><td>HypersonicSQL</td><td><tt>net.sf.hibernate.sql.HSQLDialect</tt></td></tr><tr><td>Microsoft SQL Server</td><td><tt>net.sf.hibernate.sql.SybaseDialect</tt></td></tr></table><p>
If your database supports ANSI or Oracle style outerjoins, <span class="emphasis"><i>outer join
fetching</i></span> might increase performance by limiting the number of round
--- 178,182 ----
</p><p>
The following table displays possible values for <tt>hibernate.dialect</tt>.
! </p><table class="simplelist" border="0" summary="Simple list"><tr><td>DB2</td><td><tt>net.sf.hibernate.dialect.DB2Dialect</tt></td></tr><tr><td>MySQL</td><td><tt>net.sf.hibernate.dialect.MySQLDialect</tt></td></tr><tr><td>SAP DB</td><td><tt>net.sf.hibernate.dialect.SAPDBDialect</tt></td></tr><tr><td>Oracle</td><td><tt>net.sf.hibernate.dialect.OracleDialect</tt></td></tr><tr><td>Sybase</td><td><tt>net.sf.hibernate.dialect.SybaseDialect</tt></td></tr><tr><td>Progress</td><td><tt>net.sf.hibernate.dialect.ProgressDialect</tt></td></tr><tr><td>Mckoi SQL</td><td><tt>net.sf.hibernate.dialect.McKoiDialect</tt></td></tr><tr><td>Interbase</td><td><tt>net.sf.hibernate.dialect.InterbaseDialect</tt></td></tr><tr><td>Pointbase</td><td><tt>net.sf.hibernate.dialect.PointbaseDialect</tt></td></tr><tr><td>PostgreSQL</td><td><tt>net.sf.hibernate.dialect.PostgreSQLDialect</tt></td></tr><tr><td>HypersonicSQL</td><td><tt>net.sf.hibernate.dialect.HSQLDialect</tt></td></tr><tr><td>Microsoft SQL Server</td><td><tt>net.sf.hibernate.dialect.SybaseDialect</tt></td></tr></table><p>
If your database supports ANSI or Oracle style outerjoins, <span class="emphasis"><i>outer join
fetching</i></span> might increase performance by limiting the number of round
***************
*** 190,201 ****
Oracle limits the size of <tt>byte</tt> arrays that may
be passed to/from its JDBC driver. If you wish to use large instances of
! <tt>binary</tt> or <tt>serializable</tt> type, you should
enable <tt>hibernate.jdbc.use_streams_for_binary</tt>.
<span class="emphasis"><i>This is a JVM-level setting only.</i></span>
</p><p>
! <tt>hibernate.show_sql</tt> forces Hibernate to write SQL statements
to the console. This is provided as an easy alternative to enabling logging.
</p><p>
! You may define your own plugin strategy for obtaining JDBC connections by
implementing the interface
<tt>net.sf.hibernate.connection.ConnectionProvider</tt>.
--- 190,201 ----
Oracle limits the size of <tt>byte</tt> arrays that may
be passed to/from its JDBC driver. If you wish to use large instances of
! <tt>binary</tt> or <tt>serializable</tt> type, you should
enable <tt>hibernate.jdbc.use_streams_for_binary</tt>.
<span class="emphasis"><i>This is a JVM-level setting only.</i></span>
</p><p>
! <tt>hibernate.show_sql</tt> forces Hibernate to write SQL statements
to the console. This is provided as an easy alternative to enabling logging.
</p><p>
! You may define your own plugin strategy for obtaining JDBC connections by
implementing the interface
<tt>net.sf.hibernate.connection.ConnectionProvider</tt>.
***************
*** 203,209 ****
<tt>hibernate.connection.provider_class</tt>.
</p><p>
! If you wish to use the Hibernate <tt>Transaction</tt> API, you must
specify a factory class for <tt>Transaction</tt> instances by
! setting the property <tt>hibernate.transaction.factory_class</tt>.
There are two standard (built-in) choices:
</p><table class="simplelist" border="0" summary="Simple list"><tr><td><tt>net.sf.hibernate.transaction.JDBCTransactionFactory</tt></td><td>delegates to database (JDBC) transactions</td></tr><tr><td><tt>net.sf.hibernate.transaction.JTATransactionFactory</tt></td><td>delegates to JTA (if an existing transaction is underway, the <tt>Session</tt>
--- 203,209 ----
<tt>hibernate.connection.provider_class</tt>.
</p><p>
! If you wish to use the Hibernate <tt>Transaction</tt> API, you must
specify a factory class for <tt>Transaction</tt> instances by
! setting the property <tt>hibernate.transaction.factory_class</tt>.
There are two standard (built-in) choices:
</p><table class="simplelist" border="0" summary="Simple list"><tr><td><tt>net.sf.hibernate.transaction.JDBCTransactionFactory</tt></td><td>delegates to database (JDBC) transactions</td></tr><tr><td><tt>net.sf.hibernate.transaction.JTATransactionFactory</tt></td><td>delegates to JTA (if an existing transaction is underway, the <tt>Session</tt>
***************
*** 214,234 ****
a strategy for obtaining the JTA <tt>TransactionManager</tt>.
</p><table class="simplelist" border="0" summary="Simple list"><tr><td><tt>net.sf.hibernate.transaction.JBossTransactionManagerLookup</tt></td><td>for JBoss</td></tr><tr><td><tt>net.sf.hibernate.transaction.WeblogicTransactionManagerLookup</tt></td><td>for Weblogic</td></tr><tr><td><tt>net.sf.hibernate.transaction.WebSphereTransactionManagerLookup</tt></td><td>for WebSphere</td></tr><tr><td><tt>net.sf.hibernate.transaction.OrionTransactionManagerLookup</tt></td><td>for Orion</td></tr><tr><td><tt>net.sf.hibernate.transaction.ResinTransactionManagerLookup</tt></td><td>for Resin</td></tr></table><p>
! If you wish to have the <tt>SessionFactory</tt> bound to a JNDI namespace, specify
! a name (eg. <tt>hibernate/session_factory</tt>) as using the property
! <tt>hibernate.session_factory_name</tt>. Then EJBs, for example, may obtain the
<tt>SessionFactory</tt> using a JNDI lookup. Hibernate will use
! <tt>hibernate.jndi.url</tt>, <tt>hibernate.jndi.class</tt> to instantiate
an initial context.
</p><p>
You may define new Hibernate query tokens using <tt>hibernate.query.substitutions</tt>.
! For example:
! <pre class="programlisting">hibernate.query.substitutions true=1, false=0</pre>
! would cause the tokens <tt>true</tt> and <tt>false</tt> to be translated to
! integer literals in the generated SQL.
<pre class="programlisting">hibernate.query.substitutions toLowercase=LOWER</pre>
would allow you to rename the SQL <tt>lower</tt> function.
</p></div><div class="sect1"><div class="titlepage"><div><h2 class="title" style="clear: both"><a name="session-configuration-s6"></a>XML Configuration File</h2></div></div><p>
An alternative approach is to specify a full configuration in a file named
! <tt>hibernate.cfg.xml</tt>. The configuration file is expected to
be in the root of your |CLASSPATH|.
</p><pre class="programlisting"><?xml version='1.0' encoding='utf-8'?>
--- 214,234 ----
a strategy for obtaining the JTA <tt>TransactionManager</tt>.
</p><table class="simplelist" border="0" summary="Simple list"><tr><td><tt>net.sf.hibernate.transaction.JBossTransactionManagerLookup</tt></td><td>for JBoss</td></tr><tr><td><tt>net.sf.hibernate.transaction.WeblogicTransactionManagerLookup</tt></td><td>for Weblogic</td></tr><tr><td><tt>net.sf.hibernate.transaction.WebSphereTransactionManagerLookup</tt></td><td>for WebSphere</td></tr><tr><td><tt>net.sf.hibernate.transaction.OrionTransactionManagerLookup</tt></td><td>for Orion</td></tr><tr><td><tt>net.sf.hibernate.transaction.ResinTransactionManagerLookup</tt></td><td>for Resin</td></tr></table><p>
! If you wish to have the <tt>SessionFactory</tt> bound to a JNDI namespace, specify
! a name (eg. <tt>hibernate/session_factory</tt>) as using the property
! <tt>hibernate.session_factory_name</tt>. Then EJBs, for example, may obtain the
<tt>SessionFactory</tt> using a JNDI lookup. Hibernate will use
! <tt>hibernate.jndi.url</tt>, <tt>hibernate.jndi.class</tt> to instantiate
an initial context.
</p><p>
You may define new Hibernate query tokens using <tt>hibernate.query.substitutions</tt>.
! For example:
! <pre class="programlisting">hibernate.query.substitutions true=1, false=0</pre>
! would cause the tokens <tt>true</tt> and <tt>false</tt> to be translated to
! integer literals in the generated SQL.
<pre class="programlisting">hibernate.query.substitutions toLowercase=LOWER</pre>
would allow you to rename the SQL <tt>lower</tt> function.
</p></div><div class="sect1"><div class="titlepage"><div><h2 class="title" style="clear: both"><a name="session-configuration-s6"></a>XML Configuration File</h2></div></div><p>
An alternative approach is to specify a full configuration in a file named
! <tt>hibernate.cfg.xml</tt>. The configuration file is expected to
be in the root of your |CLASSPATH|.
</p><pre class="programlisting"><?xml version='1.0' encoding='utf-8'?>
***************
*** 245,249 ****
<!-- properties -->
<property name="connection.datasource">my/first/datasource</property>
! <property name="dialect">net.sf.hibernate.sql.MySQLDialect</property>
<property name="show_sql">false</property>
<property name="use_outer_join">true</property>
--- 245,249 ----
<!-- properties -->
<property name="connection.datasource">my/first/datasource</property>
! <property name="dialect">net.sf.hibernate.dialect.MySQLDialect</property>
<property name="show_sql">false</property>
<property name="use_outer_join">true</property>
|