From 315267e68cf7fe35db1e2041978b3c0498a56d52 Mon Sep 17 00:00:00 2001 From: Paulo Veiga Date: Mon, 30 Oct 2023 05:34:45 +0000 Subject: [PATCH] Migrate to hibernate 6 --- wise-webapp/pom.xml | 49 ++---- .../com/wisemapping/dao/LabelManagerImpl.java | 36 ++-- .../com/wisemapping/dao/MindmapManager.java | 6 - .../wisemapping/dao/MindmapManagerImpl.java | 157 +++++++----------- .../com/wisemapping/dao/UserManagerImpl.java | 69 ++++---- .../wisemapping/service/MindmapService.java | 2 - .../service/MindmapServiceImpl.java | 5 - .../main/webapp/WEB-INF/wisemapping-dao.xml | 4 - .../main/webapp/WEB-INF/wisemapping-model.xml | 9 +- 9 files changed, 131 insertions(+), 206 deletions(-) diff --git a/wise-webapp/pom.xml b/wise-webapp/pom.xml index 8f40c583..26ff41f8 100644 --- a/wise-webapp/pom.xml +++ b/wise-webapp/pom.xml @@ -13,10 +13,8 @@ - 6.0.11 + 6.0.13 6.1.2 - 6.2.6.Final - 6.0.21.Final 6.0.2 @@ -86,8 +84,14 @@ org.hibernate - hibernate-core-jakarta - 5.6.15.Final + hibernate-core + 6.1.7.Final + + + + jakarta.xml.bind + jakarta.xml.bind-api + 4.0.1 @@ -130,12 +134,12 @@ org.springframework.data spring-data-jpa - 2.6.1 + 3.1.0 org.springframework spring-test - 5.3.15 + 6.0.6 test @@ -189,16 +193,6 @@ jakarta.mail 2.0.2 - - - - - - - - - - org.apache.logging.log4j log4j-core @@ -362,27 +356,6 @@ - - - - - - - - - - - - - - - - - - - - - org.apache.maven.plugins maven-war-plugin diff --git a/wise-webapp/src/main/java/com/wisemapping/dao/LabelManagerImpl.java b/wise-webapp/src/main/java/com/wisemapping/dao/LabelManagerImpl.java index b9bd4f64..01012bc8 100644 --- a/wise-webapp/src/main/java/com/wisemapping/dao/LabelManagerImpl.java +++ b/wise-webapp/src/main/java/com/wisemapping/dao/LabelManagerImpl.java @@ -19,14 +19,21 @@ package com.wisemapping.dao; import com.wisemapping.model.Label; import com.wisemapping.model.User; +import jakarta.annotation.Resource; +import org.hibernate.Session; +import org.hibernate.SessionFactory; +import org.hibernate.query.SelectionQuery; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; -import org.springframework.orm.hibernate5.support.HibernateDaoSupport; +import org.springframework.stereotype.Repository; import java.util.List; -public class LabelManagerImpl extends HibernateDaoSupport +@Repository +public class LabelManagerImpl implements LabelManager { + @Resource + private SessionFactory sessionFactory; @Override public void addLabel(@NotNull final Label label) { @@ -35,31 +42,37 @@ public class LabelManagerImpl extends HibernateDaoSupport @Override public void saveLabel(@NotNull final Label label) { - currentSession().save(label); + getSession().persist(label); + } + + private Session getSession() { + return sessionFactory.getCurrentSession(); } @NotNull @Override - @SuppressWarnings("unchecked") public List