i have problem with spring data JPA naming method findAllBy...
This is my entity :
@Id
@GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "sequenceGenerator")
@SequenceGenerator(name = "sequenceGenerator")
private Long id;
@Column(name = "entity_id")
private Long entityId;
@Column(name = "entity_name")
private String entityName;
@Column(name = "user_id")
private Long userId;
@Column(name = "rating")
private Double rating;
@Column(name = "like")
private Long like;
@Column(name = "dislike")
private Long dislike;
@Column(name = "review_title")
private String reviewTitle;
@Lob
@Column(name = "review_comment")
private String reviewComment;
@Column(name = "time")
private ZonedDateTime time;
@ManyToOne
private RatingType type;
with getters and setters.
This is method call in ratingServiceImpl with @Autowired ratingRepository :
List<Rating> ratings = ratingRepository.findAllByEntityIdAndEntityName(entityId, entityName);
and repository :
@Repository
public interface RatingRepository extends JpaRepository<Rating, Long>,
JpaSpecificationExecutor<Rating> {
List<Rating> findAllByEntityIdAndEntityName(Long entityId, String entityName);
}
Dependency :
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-data-jpa</artifactId>
<version>1.5.10.RELEASE</version>
</dependency>
Caused by :
Caused by: org.h2.jdbc.JdbcSQLException: Syntax error in SQL statement "SELECT RATING0_.ID AS ID1_48_, RATING0_.DISLIKE AS DISLIKE2_48_, RATING0_.ENTITY_ID AS ENTITY_I3_48_, RATING0_.ENTITY_NAME AS ENTITY_N4_48_, RATING0_.LIKE[*] AS LIKE5_48_, RATING0_.RATING AS RATING6_48_, RATING0_.REVIEW_COMMENT AS REVIEW_C7_48_, RATING0_.REVIEW_TITLE AS REVIEW_T8_48_, RATING0_.TIME AS TIME9_48_, RATING0_.TYPE_ID AS TYPE_ID11_48_, RATING0_.USER_ID AS USER_ID10_48_ FROM RATING RATING0_ WHERE RATING0_.ENTITY_ID=? AND RATING0_.ENTITY_NAME=? "; expected "identifier"; SQL statement: select rating0_.id as id1_48_, rating0_.dislike as dislike2_48_, rating0_.entity_id as entity_i3_48_, rating0_.entity_name as entity_n4_48_, rating0_.like as like5_48_, rating0_.rating as rating6_48_, rating0_.review_comment as review_c7_48_, rating0_.review_title as review_t8_48_, rating0_.time as time9_48_, rating0_.type_id as type_id11_48_, rating0_.user_id as user_id10_48_ from rating rating0_ where rating0_.entity_id=? and rating0_.entity_name=? [42001-196]
other locations of exception on this link
Thank you for solution in advance.