Last active
August 10, 2022 18:10
-
-
Save anas-didi95/ca1802753ea5c2238ad7cfad81b0cca4 to your computer and use it in GitHub Desktop.
hibernate_hibernate.cfg.xml
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?xml version="1.0" encoding="UTF-8"?> | |
<!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="hbm2ddl.auto">update</property> | |
<property name="dialect">org.hibernate.dialect.OracleDialect</property> | |
<property name="connection.url">jdbc:oracle:thin:@127.0.0.1:1521:xe</property> | |
<property name="connection.username">system</property> | |
<property name="connection.password">password</property> | |
<property name="connection.driver_class">oracle.jdbc.driver.OracleDriver</property> | |
<property name="show_sql">true</property> | |
<mapping class="models.User"/> | |
<mapping class="models.LogHistory"/> | |
</session-factory> | |
</hibernate-configuration> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
hibernate.cfg.xml Properties
Disable when omitted.
Available options:
- validate: validate the schema, make no changes to the database.
- update: update the schema.
- create: creates the schema, destroying previous data.
- create-drop: drop the schema when the SessionFactory is closed explicitly, when the application is stopped.
http://stackoverflow.com/questions/438146/ddg#1689769
https://stackoverflow.com/questions/3179765/how-to-turn-off-hbm2ddl
Available options:
- MySQL: org.hibernate.dialect.MySQLDialect
- Oracle (any version): org.hibernate.dialect.OracleDialect
- PostgreSQL: org.hibernate.dialect.PostgreSQLDialect
https://www.tutorialspoint.com/hibernate/hibernate_configuration.htm
Available options:
- MySQL: jdbc:mysql://localhost:3306/SampleDB
- Oracle: jdbc:oracle:thin:@127.0.0.1:1521:xe
- PostgreSQL: jdbc:postgresql://localhost:5432/hibernatedb
Available options:
- MySQL: com.mysql.jdbc.Driver
- Oracle: oracle.jdbc.driver.OracleDriver
- PostgreSQL: org.postgresql.Driver