From e8d0c6aeec474368cbdd5decbb032629bf96214d Mon Sep 17 00:00:00 2001 From: Kevin Guanche Darias Date: Sat, 10 Feb 2024 09:39:27 +0000 Subject: [PATCH] Migrate to Spring Boot 3.2 --- business/pom.xml | 14 +++++++++++--- .../dialect/OwgeMysqlFunctionContributor.java | 15 +++++++++++++++ .../repository/MissionReportRepository.java | 2 +- .../org.hibernate.boot.model.FunctionContributor | 1 + game-rest/pom.xml | 5 ++--- .../src/main/resources/application.properties | 1 + 6 files changed, 31 insertions(+), 7 deletions(-) create mode 100644 business/src/main/java/com/kevinguanchedarias/owgejava/entity/dialect/OwgeMysqlFunctionContributor.java create mode 100644 business/src/main/resources/META-INF/services/org.hibernate.boot.model.FunctionContributor diff --git a/business/pom.xml b/business/pom.xml index 19756150..f4902c8f 100644 --- a/business/pom.xml +++ b/business/pom.xml @@ -4,7 +4,7 @@ org.springframework.boot spring-boot-starter-parent - 3.0.13 + 3.2.2 com.kevinguanchedarias.owge @@ -212,6 +212,14 @@ org.hibernate.jakarta.persistence hibernate-jpa-2.1-api + + dom4j + dom4j + + + org.hibernate + hibernate-core + @@ -267,6 +275,7 @@ mockito-inline org.mockito test + 5.2.0 @@ -277,8 +286,7 @@ org.apache.maven.plugins maven-compiler-plugin - 17 - 17 + 21 diff --git a/business/src/main/java/com/kevinguanchedarias/owgejava/entity/dialect/OwgeMysqlFunctionContributor.java b/business/src/main/java/com/kevinguanchedarias/owgejava/entity/dialect/OwgeMysqlFunctionContributor.java new file mode 100644 index 00000000..ffcd29d5 --- /dev/null +++ b/business/src/main/java/com/kevinguanchedarias/owgejava/entity/dialect/OwgeMysqlFunctionContributor.java @@ -0,0 +1,15 @@ +package com.kevinguanchedarias.owgejava.entity.dialect; + +import org.hibernate.boot.model.FunctionContributions; +import org.hibernate.boot.model.FunctionContributor; +import org.hibernate.dialect.function.StandardSQLFunction; +import org.hibernate.type.StandardBasicTypes; + +public class OwgeMysqlFunctionContributor implements FunctionContributor { + + @Override + public void contributeFunctions(FunctionContributions functionContributions) { + functionContributions.getFunctionRegistry() + .register("TIME_TO_SEC", new StandardSQLFunction("TIME_TO_SEC", StandardBasicTypes.DOUBLE)); + } +} diff --git a/business/src/main/java/com/kevinguanchedarias/owgejava/repository/MissionReportRepository.java b/business/src/main/java/com/kevinguanchedarias/owgejava/repository/MissionReportRepository.java index 725923a6..72f4d170 100644 --- a/business/src/main/java/com/kevinguanchedarias/owgejava/repository/MissionReportRepository.java +++ b/business/src/main/java/com/kevinguanchedarias/owgejava/repository/MissionReportRepository.java @@ -27,7 +27,7 @@ public interface MissionReportRepository extends JpaRepository * @since 0.9.0 */ - @Query("UPDATE MissionReport rp SET rp.userReadDate = CURRENT_DATE WHERE rp.user.id = :userId AND rp.id IN :reportsIds") + @Query("UPDATE MissionReport rp SET rp.userReadDate = CURRENT_TIMESTAMP WHERE rp.user.id = :userId AND rp.id IN :reportsIds") @Modifying void markAsReadIfUserIsOwner(List reportsIds, Integer userId); diff --git a/business/src/main/resources/META-INF/services/org.hibernate.boot.model.FunctionContributor b/business/src/main/resources/META-INF/services/org.hibernate.boot.model.FunctionContributor new file mode 100644 index 00000000..aa0224dd --- /dev/null +++ b/business/src/main/resources/META-INF/services/org.hibernate.boot.model.FunctionContributor @@ -0,0 +1 @@ +com.kevinguanchedarias.owgejava.entity.dialect.OwgeMysqlFunctionContributor \ No newline at end of file diff --git a/game-rest/pom.xml b/game-rest/pom.xml index 60595e25..265cc7ac 100644 --- a/game-rest/pom.xml +++ b/game-rest/pom.xml @@ -5,7 +5,7 @@ org.springframework.boot spring-boot-starter-parent - 3.0.13 + 3.2.2 com.kevinguanchedarias.owgejava @@ -107,8 +107,7 @@ org.apache.maven.plugins maven-compiler-plugin - 17 - 17 + 21 diff --git a/game-rest/src/main/resources/application.properties b/game-rest/src/main/resources/application.properties index 22e504f1..415f75c7 100644 --- a/game-rest/src/main/resources/application.properties +++ b/game-rest/src/main/resources/application.properties @@ -6,6 +6,7 @@ spring.jpa.open-in-view=false # spring.jpa.show-sql=true spring.jpa.properties.hibernate.enable_lazy_load_no_trans=true spring.session.store-type=none +spring.threads.virtual.enabled=true spring.main.allow-bean-definition-overriding=true server.servlet.session.tracking-modes= logging.level.com.kevinguanchedarias.owgejava=${OWGE_KGD_DEBUG_LEVEL:INFO}