In the below I can have the modifedDate
as null some times. at that time it is throwing error as
"could not extract ResultSet; SQL [n/a]; nested exception is org.hibernate.exception.SQLGrammarException: could not extract ResultSet"
How can I get data even the modifiedDate
is null. Some time the date will be coming.
How do this ?
I want the below Query method return data always
- return based on adminStatus if modifiedDate is null.
- return based on adminStatus and modifiedDate. if modifiedDate is not null.
we can do by building a dynamic query and executing with entity Manager. but I want with repository.
@Repository
public interface AdminRepository extends JpaRepository<AdminEntity, Long> {
@Query(
value="SELECT * from admin_entity where status=:adminStatus and modified_tsz>=:modifedDate:",
nativeQuery=true)
List<AdminEntity> getAdmins(String adminStatus, Date modifedDate)
}