After upgrading hibernate-core
from 5.3.14.Final
to 5.4.29.Final
I have started seeing this “warning” while booting up my application which shuts down by itself afterwards:
... @EnableJpaRepositories declared on JpaRepositoriesRegistrar.EnableJpaRepositoriesConfiguration: Invocation of init method failed; nested exception is java.lang.IllegalArgumentException: Validation failed for query for method public abstract org.springframework.data.domain.Page com.testApp.repository.FlashMessageByZipCodeRepository.searchByText(java.lang.String,org.springframework.data.domain.Pageable)!
This error is pointing to repository (and below shown query):
@Repository
public interface FlashMessageByZipCodeRepository extends JpaRepository<FlashMessageByZipCodeEntity, FlashMessageByZipCodeKey>, Searchable<FlashMessageByZipCodeEntity> {
@Override
@EntityGraph(attributePaths = "flashMessageEntity.applicationParameter")
@Query("select x from FlashMessageByZipCodeEntity x where x.flashMessageEntity.comments like ?1 or x.flashMessageEntity.applicationParameter.parameterName like ?1 or x.zipCode like ?1 or x.userUpdated like ?1")
Page<FlashMessageByZipCodeEntity> searchByText(String searchText, Pageable pageable);
}
For more reference
These are the two entities used in above query:
@Entity
@Table(name = "FLSH_MSG_ZIP")
public class FlashMessageByZipCodeEntity implements Serializable {
@Id
@OneToOne(fetch = FetchType.LAZY)
@JoinColumns({
@JoinColumn(name = "APPL_C", referencedColumnName = "APPL_C"
, nullable = false),
@JoinColumn(name = "FLSH_MSG_PARM_I", referencedColumnName = "FLSH_MSG_PARM_I"
, nullable = false)
})
private FlashMessageEntity flashMessageEntity;
...
}
@Entity
@Table(name = "FLSH_MSG")
public class FlashMessageEntity {
@Id
@Enumerated(EnumType.STRING)
@Column(name = "APPL_C", nullable = false)
private ApplicationCode applicationCode;
@Id
@OneToOne(fetch = FetchType.LAZY)
@JoinColumn(name = "FLSH_MSG_PARM_I", nullable = false)
private ApplicationParameterEntity applicationParameter;
...
}
Any help would be much appreciated.