Skip to Main Content

Integration

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

JPA - LIKE Statement with wildcard

533988Sep 15 2006 — edited Sep 19 2006
Hi,

I'm trying to use the LIKE statement with JPA. What I want to do is get all the items that have a name that matchs the keyword 'og' for example ('Dog', 'Big dog'...). If I write that :

query = em.createQuery("SELECT i FROM Item i WHERE i.name LIKE :keyword");
query.setParameter("keyword", keyword);

That will take the items that have the exact keword (in my example only 'og' will appear). I've tried to use the wildcards % but id doesn't work :

query = em.createQuery("SELECT i FROM Item i WHERE i.name LIKE '%:keyword%'");
query = em.createQuery("SELECT i FROM Item i WHERE i.name LIKE %:keyword%");

Does anybody knows how to use the LIKE statement with wildcards ? And by the way, is there a way to ignore the case of my keyword ('og' or 'OG' should give the same result).

Thanks,

Antonio Goncalves

Comments

mac2
Answer

To work around the error, I just used -tables instead.

Marked as Answer by mac2 · Sep 27 2020
ChrisJenkins-Oracle

Hi,

This specific error message is output only in the case that an input line from the file does not contain a newline (linefeed) character within the first 96 characters. So maybe your input file is not in the right format... Perhaps it only has carriage return line endings?

What platform are you running on and how was the input file created?

Chris

1 - 2
Locked Post
New comments cannot be posted to this locked post.

Post Details

Locked on Oct 17 2006
Added on Sep 15 2006
4 comments
54,576 views