Hibernate needs to know "in Advance" the mapping details that defines how the java classes are related to database tables.
Hibernate needs to set configuration settings related to database and other related parameters.
The information will be given through a standard java property file called "hibernate.properties" or the "hibernate.cfg.xml".
The file will reside inside the root directory of your application classpath.
basically this file may look like this
---------------------
"-//Hibernate/Hibernate Configuration DTD 3.0//EN"
"http://hibernate.sourceforge.net/hibernate-configuration-3.0.dtd">
let's see what these all about
S.N. | Properties and Description |
---|---|
1 | hibernate.dialect This property makes Hibernate generate the appropriate SQL for the chosen database. |
2 | hibernate.connection.driver_class The JDBC driver class. |
3 | hibernate.connection.url The JDBC URL to the database instance. |
4 | hibernate.connection.username The database username. |
5 | hibernate.connection.password The database password. |
6 | hibernate.connection.pool_size Limits the number of connections waiting in the Hibernate database connection pool. |
7 | hibernate.connection.autocommit Allows autocommit mode to be used for the JDBC connection. |
If you are using a database along with an application server and JNDI then you would have to configure the following properties:
S.N. | Properties and Description |
---|---|
1 | hibernate.connection.datasource The JNDI name defined in the application server context you are using for the application. |
2 | hibernate.jndi.class The InitialContext class for JNDI. |
3 | hibernate.jndi. Passes any JNDI property you like to the JNDI InitialContext. |
4 | hibernate.jndi.url Provides the URL for JNDI. |
5 | hibernate.connection.username The database username. |
6 | hibernate.connection.password The database password. |
No comments:
Post a Comment