Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 972145
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T03:04:35+00:00 2026-05-16T03:04:35+00:00

This looks really simple and I can’t believe I haven’t found a solution myself.

  • 0

This looks really simple and I can’t believe I haven’t found a solution myself. I have a bean named PersonBean, which has a name. Now I want to write a finder method that takes a string and looks for people with that string in their name, case-insensitively. Here is my current EJB QL:

SELECT OBJECT(p)
FROM Person p
WHERE (p.name LIKE ?1)

I have 2 problems with this:

  1. I want the search to be case-insensitive (the above is case-sensitive) and I can’t find something like lower() or upper() in EJB QL. What can I do to have that behavior? UPDATE: I’m using J2EE version 1.4 and glassfish version 2.1, if that matters.
  2. I have to pass an ugly string to the method, i.e findByString("%john%"). Is there a way to write the EJB QL so that I can pass something like findByString("john")?
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-16T03:04:36+00:00Added an answer on May 16, 2026 at 3:04 am

    Regarding your second question, there is a CONCAT function in EJB QL 2.1, so I think the following should work:

    WHERE (p.name LIKE CONCAT(‘%’, CONCAT(?1, ‘%’)))

    Edit: The above does not work because the ql grammer only allows literal strings and input parameters in a LIKE expression, which is really limiting. It should be possible to achive the same effect by using the LOCATE function like this:

    WHERE LOCATE(p.name, ?1) <> 0
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have found this example on StackOverflow: var people = new List<Person> { new
I have a new web app that is packaged as a WAR as part
This is beyond both making sense and my control. That being said here is
I want to use a temp directory that will be unique to this build.
Let say I have the following desire, to simplify the IConvertible's to allow me
I have a login.jsp page which contains a login form. Once logged in the
I am playing with TFS 2010, and am trying to setup a build process
(please excuse that I didn't use aliases). I would like my query output to
I'm trying to build a C++ extension for python using swig. I've followed the
I need to develop a file indexing application in python and wanted to know

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.