Skip to content

Commit 42bb5b2

Browse files
authored
Hibernate config file
1 parent 9e384a8 commit 42bb5b2

File tree

1 file changed

+47
-0
lines changed

1 file changed

+47
-0
lines changed

hibernate.cfg.xml

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
<!-- ~ Hibernate, Relational Persistence for Idiomatic Java ~ ~ License:
2+
GNU Lesser General Public License (LGPL), version 2.1 or later. ~ See the
3+
lgpl.txt file in the root directory or <http://www.gnu.org/licenses/lgpl-2.1.html>. -->
4+
<!DOCTYPE hibernate-configuration PUBLIC
5+
"-//Hibernate/Hibernate Configuration DTD 3.0//EN"
6+
"http://www.hibernate.org/dtd/hibernate-configuration-3.0.dtd">
7+
8+
<hibernate-configuration>
9+
<session-factory>
10+
<property name="hibernate.dialect">org.hibernate.dialect.PostgreSQLDialect</property>
11+
<property name="hibernate.connection.driver_class">org.postgresql.Driver</property>
12+
<property name="hibernate.connection.username">postgres</property>
13+
<property name="hibernate.connection.password">password</property>
14+
<property name="hibernate.connection.url">jdbc:postgresql://127.0.0.1:5432/hibernatedb</property>
15+
<!-- JDBC connection pool (use the built-in) -->
16+
<property name="connection.pool_size">1</property>
17+
18+
<property name="hibernate.jdbc.use_streams_for_binary">true</property>
19+
<property name="hibernate.jdbc.batch_size">0</property>
20+
<property name="hibernate.max_fetch_depth">3</property>
21+
22+
23+
<!-- Using create drops and creates a new db everytime which loses all previously entered data in db -->
24+
<!-- Drop and re-create the database schema on startup -->
25+
<property name="hibernate.hbm2ddl.auto">create</property>
26+
27+
<property name="hibernate.generate_statistics">true</property>
28+
29+
30+
<!-- SQL dialect -->
31+
<property name="dialect">org.hibernate.dialect.PostgreSQLDialect</property>
32+
33+
<!-- Enable Hibernate's automatic session context management -->
34+
<property name="current_session_context_class">thread</property>
35+
36+
<!-- Disable the second-level cache -->
37+
<property name="cache.provider_class">org.hibernate.cache.internal.NoCacheProvider</property>
38+
39+
<!-- Echo all executed SQL to stdout -->
40+
<property name="show_sql">true</property>
41+
42+
<mapping class="org.hibernate.dto.UserDetails" />
43+
<mapping class="org.hibernate.dto.EmpDetails" />
44+
<mapping class="org.hibernate.dto.StudentDetails" />
45+
46+
</session-factory>
47+
</hibernate-configuration>

0 commit comments

Comments
 (0)