Reputation: 1353
I have a entity like
@Entity
@Table(name = "ebooking")
public class EBooking {
@Id
@Column(name = "bookId")
private String bookId;
And I implemented repository llike
public interface EBookingRepository extends JpaRepository<EBooking, String>, JpaSpecificationExecutor<EBooking> {
@Query("select book from EBooking book where book.bookId = :id")
EBooking getByBookId(@Param("id") String id);
}
When I try to run this method i have exception:
org.springframework.dao.InvalidDataAccessResourceUsageException: could not extract ResultSet; SQL [n/a]; nested exception is org.hibernate.exception.SQLGrammarException: could not extract ResultSet
org.postgresql.util.PSQLException: ERROR: column ebooking0_.book_id does not exist
Position: 8
Why ebooking0_.book_id
? There is only ebooking
table.
Thank you!
Upvotes: 0
Views: 2830
Reputation: 24423
ebooking0_
is an alias for ebooking
table generated by Hibernate. You can check that if you turn on SQL logging.
Error does indicate that you don't have column book_id
in table ebooking
.
Upvotes: 2