Compare commits
2 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
0572af6ea2 | ||
| 9fa1e5e071 |
@@ -378,3 +378,8 @@
|
|||||||
### Features
|
### Features
|
||||||
|
|
||||||
* Enhance EntityManagerProvider to use Play configuration for database settings ([476db28](https://git.janis-eccarius.de/KnockOutWhist/KnockOutWhist-Web/commit/476db288216ed2c1013fe3ddb9b82472254e352b))
|
* Enhance EntityManagerProvider to use Play configuration for database settings ([476db28](https://git.janis-eccarius.de/KnockOutWhist/KnockOutWhist-Web/commit/476db288216ed2c1013fe3ddb9b82472254e352b))
|
||||||
|
## (2026-01-20)
|
||||||
|
|
||||||
|
### Features
|
||||||
|
|
||||||
|
* Disable default JPA and Hibernate modules and enhance EntityManagerProvider for HikariCP integration ([9fa1e5e](https://git.janis-eccarius.de/KnockOutWhist/KnockOutWhist-Web/commit/9fa1e5e07122aebd0391d47c3513013243a72a0f))
|
||||||
|
|||||||
@@ -1,10 +1,9 @@
|
|||||||
package di
|
package di
|
||||||
|
|
||||||
import com.google.inject.Provider
|
import com.google.inject.{Inject, Provider}
|
||||||
import com.google.inject.Inject
|
|
||||||
import play.api.Configuration
|
|
||||||
import jakarta.inject.Singleton
|
import jakarta.inject.Singleton
|
||||||
import jakarta.persistence.{EntityManager, EntityManagerFactory, Persistence}
|
import jakarta.persistence.{EntityManager, EntityManagerFactory, Persistence}
|
||||||
|
import play.api.Configuration
|
||||||
|
|
||||||
@Singleton
|
@Singleton
|
||||||
class EntityManagerProvider @Inject()(config: Configuration) extends Provider[EntityManager] {
|
class EntityManagerProvider @Inject()(config: Configuration) extends Provider[EntityManager] {
|
||||||
@@ -19,6 +18,14 @@ class EntityManagerProvider @Inject()(config: Configuration) extends Provider[En
|
|||||||
props.put("jakarta.persistence.jdbc.user", dbConfig.get[String]("username"))
|
props.put("jakarta.persistence.jdbc.user", dbConfig.get[String]("username"))
|
||||||
props.put("jakarta.persistence.jdbc.password", dbConfig.get[String]("password"))
|
props.put("jakarta.persistence.jdbc.password", dbConfig.get[String]("password"))
|
||||||
|
|
||||||
|
// Also pass HikariCP settings if present
|
||||||
|
dbConfig.getOptional[Configuration]("hikaricp").foreach { hikariConfig =>
|
||||||
|
hikariConfig.keys.foreach { key =>
|
||||||
|
val value = hikariConfig.underlying.getValue(key).unwrapped()
|
||||||
|
props.put(s"hibernate.hikari.$key", value)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
Persistence.createEntityManagerFactory("defaultPersistenceUnit", props)
|
Persistence.createEntityManagerFactory("defaultPersistenceUnit", props)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -9,12 +9,6 @@
|
|||||||
<provider>org.hibernate.jpa.HibernatePersistenceProvider</provider>
|
<provider>org.hibernate.jpa.HibernatePersistenceProvider</provider>
|
||||||
|
|
||||||
<properties>
|
<properties>
|
||||||
<!-- Database connection settings (Overridden by EntityManagerProvider) -->
|
|
||||||
<property name="jakarta.persistence.jdbc.driver" value="org.postgresql.Driver"/>
|
|
||||||
<property name="jakarta.persistence.jdbc.url" value="jdbc:postgresql://localhost:5432/knockoutwhist"/>
|
|
||||||
<property name="jakarta.persistence.jdbc.user" value="kw_user"/>
|
|
||||||
<property name="jakarta.persistence.jdbc.password" value="postgres"/>
|
|
||||||
|
|
||||||
<!-- Hibernate specific settings -->
|
<!-- Hibernate specific settings -->
|
||||||
<property name="hibernate.dialect" value="org.hibernate.dialect.PostgreSQLDialect"/>
|
<property name="hibernate.dialect" value="org.hibernate.dialect.PostgreSQLDialect"/>
|
||||||
<property name="hibernate.hbm2ddl.auto" value="update"/>
|
<property name="hibernate.hbm2ddl.auto" value="update"/>
|
||||||
|
|||||||
@@ -2,6 +2,9 @@
|
|||||||
play.filters.disabled += play.filters.csrf.CSRFFilter
|
play.filters.disabled += play.filters.csrf.CSRFFilter
|
||||||
play.filters.disabled += play.filters.hosts.AllowedHostsFilter
|
play.filters.disabled += play.filters.hosts.AllowedHostsFilter
|
||||||
|
|
||||||
|
# Disable default JPA and Hibernate modules to use custom EntityManagerProvider
|
||||||
|
play.modules.disabled += "play.db.jpa.JPAModule"
|
||||||
|
|
||||||
play.http.secret.key="QCY?tAnfk?aZ?iwrNwnxIlR6CTf:G3gf:90Latabg@5241AB`R5W:1uDFN];Ik@n"
|
play.http.secret.key="QCY?tAnfk?aZ?iwrNwnxIlR6CTf:G3gf:90Latabg@5241AB`R5W:1uDFN];Ik@n"
|
||||||
play.http.secret.key=${?APPLICATION_SECRET}
|
play.http.secret.key=${?APPLICATION_SECRET}
|
||||||
|
|
||||||
|
|||||||
@@ -1,3 +1,3 @@
|
|||||||
MAJOR=4
|
MAJOR=4
|
||||||
MINOR=37
|
MINOR=38
|
||||||
PATCH=0
|
PATCH=0
|
||||||
|
|||||||
Reference in New Issue
Block a user