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

  • SEARCH
  • Home
  • 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 a really simple build script that looks like this: <Project xmlns=http://schemas.microsoft.com/developer/msbuild/2003 ToolsVersion=4.0
I just cannot figure this out, it looks really simple but I'm relatively new
I'm not totally sure but this looks wrong: I have a header file named
This seems really simple but for whatever reason I can't access a few radio
This is going to be a really simple question I'm sure. I have an
I have this in my form, it's really simple: <script> $(function() { var availableProducts
So, I have what I believe is some really simple php/html code. I just
I just saw this question and one of the answers looks really appealing to
This looks simple but I am confused: The way I create a vector of
I want to know what this looks like. I don't have any ideas about

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.