Skip to content

Instantly share code, notes, and snippets.

@ShahBinoy
Created March 1, 2017 15:01
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ShahBinoy/842853ceb92dc464722249f271999c42 to your computer and use it in GitHub Desktop.
Save ShahBinoy/842853ceb92dc464722249f271999c42 to your computer and use it in GitHub Desktop.
Oracle JDBC / JPA Configuration for Playframework 2.5.x
evolutionplugin = disabled
# the value below matches the config tag in line 10
play.db.default = "oracle"
jpa {
default = devPersistenceUnit # should match the value of persistence-unit#name in persistence.xml
}
db {
# the value below should match the value of property "play.db.default"
oracle {
# You can expose this datasource via JNDI if needed (Useful for JPA)
jndiName = LocalDevDS
# Set a connection's default autocommit setting
autocommit = true
hikaricp {
dataSourceClassName = oracle.jdbc.pool.OracleDataSource
dataSource {
serverName = ${DB_HOST}
user = ${DB_USER}
password = ${DB_PASS}
databaseName = ${DB_NAME}
portNumber = ${DB_PORT}
networkProtocol = tcp
driverType = thin
}
maximumPoolSize = 8
registerMbeans = true
# 15 minutes
maxLifetime = 450000
# 5 minutes
idleTimeout = 300000
connectionTimeout = 60000
}
}
}
<persistence xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns="http://java.sun.com/xml/ns/persistence"
xsi:schemaLocation="http://java.sun.com/xml/ns/persistence http://java.sun.com/xml/ns/persistence/persistence_2_0.xsd"
version="2.0">
<persistence-unit name="awsDevPersistenceUnit" transaction-type="RESOURCE_LOCAL">
<provider>org.hibernate.jpa.HibernatePersistenceProvider</provider>
<non-jta-data-source>AWSDevDS</non-jta-data-source>
<shared-cache-mode>ALL</shared-cache-mode>
<properties>
<property name="hibernate.dialect" value="org.hibernate.dialect.Oracle10gDialect"/>
<property name="hibernate.hbm2ddl.auto" value="update"/>
<property name="hibernate.show_sql" value="false"></property>
<property name="hibernate.format_sql" value="true"></property>
</properties>
</persistence-unit>
<!--Persistence Unit for Testing on H2-->
<persistence-unit name="testPersistenceUnit" transaction-type="RESOURCE_LOCAL">
<provider>org.hibernate.jpa.HibernatePersistenceProvider</provider>
<non-jta-data-source>DefaultTestDS</non-jta-data-source>
<properties>
<property name="hibernate.dialect" value="org.hibernate.dialect.Oracle10gDialect"/>
<property name="hibernate.hbm2ddl.auto" value="update"/>
<property name="hibernate.show_sql" value="false"></property>
<property name="hibernate.format_sql" value="true"></property>
</properties>
</persistence-unit>
<persistence-unit name="devPersistenceUnit" transaction-type="RESOURCE_LOCAL">
<provider>org.hibernate.jpa.HibernatePersistenceProvider</provider>
<non-jta-data-source>LocalDevDS</non-jta-data-source>
<properties>
<property name="hibernate.dialect" value="org.hibernate.dialect.Oracle10gDialect"/>
<property name="hibernate.hbm2ddl.auto" value="update"/>
<property name="hibernate.show_sql" value="true"></property>
<property name="hibernate.format_sql" value="true"></property>
</properties>
</persistence-unit>
</persistence>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment