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

Joining entities for a simple full text search

 
Frank Müller
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi!

I think I have a very short question (with an easy solution, I still hope). Maybe someone
of you can give a quick answer. It's hard too find a solution for that kind of problem with
google because I can't think of any useful keywords for such a problem.

I have the following 2 entities:



What I want is that I get a result List of MainObjects that either have fulltext in their description
or have the fulltext string in the descriptions in one or more of its uploads.

My problem is that I get no result at all from my current query...

This is my current Query:



I know how to set Parameters of a query, so that can't be the problem.


Thank you in advance.



Frank Mueller
 
Frank Müller
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Frank Müller wrote:
This is my current Query:



never mind. I found the solution myself. I only had to add "select m" in front of my query, so it is now


and it worked. If you leave that away you get a cast error by Hibernate/JPA. On a simpler query without "join" my application worked without "select".

Frank Mueller
 
What are you doing? You are supposed to be reading this tiny ad!
the new thread boost feature brings a LOT of attention to your favorite threads
https://coderanch.com/t/674455/Thread-Boost-feature
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!