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

how do I code a like clause with Hibernate?

 
Max Tomlinson
Ranch Hand
Posts: 365
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Tired several suggestion on this board and could not get them to work

I want to code a simple

createQuery("from ... where e.name like :name etc.....")

I want the equivalent of name%

thank you
Max
 
Max Tomlinson
Ranch Hand
Posts: 365
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
as usually happens, I figure it out once I've posted a question:

so, for anyone interested:

-->where e.name like :name bla bla


then:

-->query.setParameter("name", someStr+"%")
 
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!