HI,
We were using Spring boot 2.7.1 earlier but are in process of upgrading to spring boot 3 (java17).
1.Validation failed for query for method public abstract java.util.List com.mdesk.studio.ApplicationRepository.findActiveApplication(int)",“name”:“org.springframework.data.repository.query.QueryCreationException
message”:“org.hibernate.query.SemanticException: Cannot compare left expression of type ‘java.sql.Timestamp’ with right expression of type ‘java.lang.String’”,“name”:“java.lang.IllegalArgumentException”,
The Query is as follows
*Query(" SELECT apps from Scores score where score .enable=:enabled and ( score .endDate is NULL or score.endDate='')")*
List findScoresByFlag(@Param(“enabled”) int enabled);
In the hibernate 6.X upgrade, how can we handle empty string.
- In other query
The Query is as follows
Query(" SELECT apps from Scores score where score .enable=:enabled and ( score .endDate>=GETDATE() and score .endDate is NULL or score.endDate=‘’)")
List findScoresByFlagEndDate(@Param(“enabled”) int enabled);
Here we are getting an error like
Cannot compare left expression of type ‘java.sql.Timestamp’ with right expression of type ‘java.lang.Object’",“message”:“org.hibernate.query.SemanticException: Cannot compare left expression of type ‘java.sql.Timestamp’ with right expression of type ‘java.lang.Object’”,“name”:"java.lang.IllegalArgumentException
The entity field is as follows
import java.util.Date;
Column(name = “EndDate”)
- private Date endDate;*
Can you help us in resolvoing this? Our business case is that the query should be comparing date field with empty string (‘’) / query should compare whether date field is greater that todays(current) date