From 9c9ea69f01ac04235706c823a5e466b9b81e34c8 Mon Sep 17 00:00:00 2001 From: Nitin Vavdiya Date: Fri, 8 Mar 2024 12:08:36 +0530 Subject: [PATCH] fix: generic issue in specification utils --- .../java/commons/base/service/BaseService.java | 6 ++++-- .../java/commons/specification/SpecificationUtil.java | 3 ++- gradle.properties | 4 ++-- 3 files changed, 8 insertions(+), 5 deletions(-) diff --git a/commons-dao/src/main/java/com/smartsensesolutions/java/commons/base/service/BaseService.java b/commons-dao/src/main/java/com/smartsensesolutions/java/commons/base/service/BaseService.java index 1ed43d6..1ec7652 100644 --- a/commons-dao/src/main/java/com/smartsensesolutions/java/commons/base/service/BaseService.java +++ b/commons-dao/src/main/java/com/smartsensesolutions/java/commons/base/service/BaseService.java @@ -51,9 +51,11 @@ public abstract class BaseService { /** * Method needs to Override by each service which extends BaseService. * - * @return Specification of @{@link jakarta.persistence.Entity} class + * @return Specification of @{@link BaseEntity} class */ - protected abstract SpecificationUtil getSpecificationUtil(); + protected SpecificationUtil getSpecificationUtil(){ + return new SpecificationUtil<>(); + }; /** * Method used for save entity. diff --git a/commons-dao/src/main/java/com/smartsensesolutions/java/commons/specification/SpecificationUtil.java b/commons-dao/src/main/java/com/smartsensesolutions/java/commons/specification/SpecificationUtil.java index 60eb279..2750b6b 100644 --- a/commons-dao/src/main/java/com/smartsensesolutions/java/commons/specification/SpecificationUtil.java +++ b/commons-dao/src/main/java/com/smartsensesolutions/java/commons/specification/SpecificationUtil.java @@ -16,6 +16,7 @@ package com.smartsensesolutions.java.commons.specification; +import com.smartsensesolutions.java.commons.base.entity.BaseEntity; import com.smartsensesolutions.java.commons.filter.FilterCriteria; import jakarta.persistence.criteria.*; import org.springframework.data.jpa.domain.Specification; @@ -31,7 +32,7 @@ * @param - Indicates @{@link jakarta.persistence.Entity} class. */ @Component -public class SpecificationUtil { +public class SpecificationUtil { private static String getContainsValue(String value) { return "%".concat(value).concat("%"); } diff --git a/gradle.properties b/gradle.properties index 3a44568..68fe120 100644 --- a/gradle.properties +++ b/gradle.properties @@ -19,7 +19,7 @@ packageVersion=0.0.1 springBootVersion=3.0.6 springDependencyManagementVersion=1.1.0 #Commons-Dao version Details -commonDaoVersion=0.0.11 +commonDaoVersion=0.0.12 #Sample version Details sampleVersion=0.0.1 #OSSRH and GPG Signing configuration @@ -27,4 +27,4 @@ signing.keyId= signing.password= signing.secretKeyRingFile= ossrhUsername= -ossrhPassword= \ No newline at end of file +ossrhPassword=