Skip to content

Instantly share code, notes, and snippets.

@shakib04
Forked from SergioDiniz/hibernate.cfg.xml
Created October 9, 2022 18:14
Show Gist options
  • Save shakib04/cbf8fc57a4d65d00b02a364f50335b1a to your computer and use it in GitHub Desktop.
Save shakib04/cbf8fc57a4d65d00b02a364f50335b1a to your computer and use it in GitHub Desktop.
hibernate.cfg.xml for PostgreSQL
<!--
~ Hibernate, Relational Persistence for Idiomatic Java
~
~ License: GNU Lesser General Public License (LGPL), version 2.1 or later.
~ See the lgpl.txt file in the root directory or <http://www.gnu.org/licenses/lgpl-2.1.html>.
-->
<!DOCTYPE hibernate-configuration PUBLIC
"-//Hibernate/Hibernate Configuration DTD 3.0//EN"
"http://www.hibernate.org/dtd/hibernate-configuration-3.0.dtd">
<hibernate-configuration>
<session-factory>
<property name="connection.url">jdbc:postgresql://localhost/myDBName</property> <!-- BD Mane -->
<property name="connection.driver_class">org.postgresql.Driver</property> <!-- DB Driver -->
<property name="connection.username">postgres</property> <!-- DB User -->
<property name="connection.password">12345</property> <!-- DB Password -->
<property name="dialect">org.hibernate.dialect.PostgreSQLDialect</property> <!-- DB Dialect -->
<property name="hbm2ddl.auto">update</property> <!-- create / create-drop / update -->
<property name="show_sql">true</property> <!-- Show SQL in console -->
<property name="format_sql">true</property> <!-- Show SQL formatted -->
<mapping class="beans.Task"/>
</session-factory>
</hibernate-configuration>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment