Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat : using blaze MultiSelect View #363

Open
wants to merge 10 commits into
base: main
Choose a base branch
from
2 changes: 1 addition & 1 deletion .gitpod.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@

image: gitpod/workspace-java-17
image: gitpod/workspace-java-21

tasks:
- init: ./gradlew build -x test
Expand Down
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ spotless_version=6.25.0

jacoco_min_coverage_required=0.84

spring_boot_version=3.2.5
spring_boot_version=3.2.6
blaze_persistence_version=1.6.11
spring_dependency_management_version=1.1.5
springdoc_openapi_version=2.5.0
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
package com.learning.mfscreener.repository;

import com.learning.mfscreener.models.entityviews.UserCASDetailsEntityView;

public interface CustomUserCASDetailsEntityRepository {

UserCASDetailsEntityView findByInvestorEmailAndName(String email, String name);
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
package com.learning.mfscreener.repository;

import com.blazebit.persistence.CriteriaBuilderFactory;
import com.blazebit.persistence.view.EntityViewManager;
import com.blazebit.persistence.view.EntityViewSetting;
import com.learning.mfscreener.entities.UserCASDetailsEntity;
import com.learning.mfscreener.models.entityviews.UserCASDetailsEntityView;
import jakarta.persistence.EntityManager;

public class CustomUserCASDetailsEntityRepositoryImpl implements CustomUserCASDetailsEntityRepository {

private final EntityManager entityManager;

private final CriteriaBuilderFactory criteriaBuilderFactory;

private final EntityViewManager entityViewManager;

public CustomUserCASDetailsEntityRepositoryImpl(
EntityManager entityManager,
CriteriaBuilderFactory criteriaBuilderFactory,
EntityViewManager entityViewManager) {
this.entityManager = entityManager;
this.criteriaBuilderFactory = criteriaBuilderFactory;
this.entityViewManager = entityViewManager;
}

@Override
public UserCASDetailsEntityView findByInvestorEmailAndName(String email, String name) {
return entityViewManager
.applySetting(
EntityViewSetting.create(UserCASDetailsEntityView.class),
criteriaBuilderFactory.create(entityManager, UserCASDetailsEntity.class))
.where("investorInfoEntity.email")
.eq(email)
.where("investorInfoEntity.name")
.eq(name) // Adding condition for the name
.getSingleResult();
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Add exception handling and documentation to findByInvestorEmailAndName.

Handling exceptions and providing documentation will improve the robustness and maintainability of this method.

}
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@
import org.springframework.stereotype.Repository;

@Repository
public interface UserCASDetailsEntityRepository extends JpaRepository<UserCASDetailsEntity, Long> {
public interface UserCASDetailsEntityRepository
extends JpaRepository<UserCASDetailsEntity, Long>, CustomUserCASDetailsEntityRepository {
rajadilipkolli marked this conversation as resolved.
Show resolved Hide resolved

@Query(
nativeQuery = true,
Expand Down
Loading