Win a copy of Java Mock Exams (software) this week in the Programmer Certification (OCPJP) forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

BasicPathUsageException: Cannot join to attribute of basic type

 
RichardH Marais
Greenhorn
Posts: 15
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi All,

I am using Java 8 with JSP (Hibernate 5.2.1). I have a like clause which works perfectly, until I introduce the like clause to make use the foreign key table values too.

I am getting the following error:

BasicPathUsageException: Cannot join to attribute of basic type

I think the problem is related to the fact that I have a join table, and I am not sure how to create the LIKE Join using the join table.

Employee - employee_category - category

model (Employee.java):



model (Category.java):



JPA

When I introduce the following code, it fails with the error above (I think the problem is with this new piece of code):



This is the entire method:




Any help will e appreciated.
 
Frits Walraven
Creator of Enthuware JWS+ V6
Saloon Keeper
Posts: 2778
174
Android Chrome Eclipse IDE
  • Likes 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I guess you want to join on the "categories" rather than on the id-field.
 
RichardH Marais
Greenhorn
Posts: 15
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks Frits, that worked. You saved me a lot of time.
 
Happiness is not a goal ... it's a by-product of a life well lived - Eleanor Roosevelt. Tiny ad:
the new thread boost feature: great for the advertiser and smooth for the coderanch user
https://coderanch.com/t/674455/Thread-Boost-feature
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!