Question: The select query given below from hibernate has an error like : Basic paths cannot be dereferenced SELECT b from book b inner join b.tags

The select query given below from hibernate has an error like : Basic paths cannot be dereferenced

"SELECT b from book b inner join b.tags t on b.id = t.b__id " from class book using @ElementCollection.

I am not able to make reference to Collection table book_tag and select the data from book table

where book.java is as given below

@Entity @Table(name = "book") // POJO class public class book { @Id @Column(name = "bookId") public int id; @Column(name = "bookName") public String bookName; public int getId() { return id; } public void setId(int id) { this.id = id; } public String getBookName() { return bookName; } public void setBookName(String bookName) { this.bookName = bookName; } @ElementCollection (targetClass =String.class,fetch = FetchType.LAZY) @CollectionTable(name = "book_tag", joinColumns = @JoinColumn(name = "b__id") ) @Column(name = "b_tag") private Set tags; public void model(int id, String bookName, Set tags) { this.id = id; this.bookName= bookName; this.tags = tags; } public Set getTags() { return tags; } public void setTags(Set tags) { this.tags = tags; } public List getResultList() { // TODO Auto-generated method stub return null; } @Override public String toString() { return "Model [id=" + id + ", bookName=" + bookName + ", tags=" + tags + "]"; }

I am posting this question 3rd time so the person who whose hibernate and HQL please answer other wise please dont answer it.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!