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 8342387
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T05:45:23+00:00 2026-06-09T05:45:23+00:00

Is there a shortcut in Play Framework / JPA to save building this query

  • 0

Is there a shortcut in Play Framework / JPA to save building this query manually?

public List<User> getAllExceptThese(Collection<String> emails) {
    checkArgument(!emails.isEmpty());

    StringBuilder query = new StringBuilder("email not in (");
    boolean first = true;
    for (String email : emails) {
        if (!first) {
            query.append(", ");
        }
        first = false;
        query.append("?");
    }
    query.append(")");

    return findAll(query.toString(), emails.toArray());
}
  • 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-06-09T05:45:25+00:00Added an answer on June 9, 2026 at 5:45 am

    I don’t know about Play-framework, but if it’s possible to create JPQL-queries, how about building a Query-object and using it to insert the collection instead…

      public List<User> getAllExceptThese(Collection<String> emails) {
                checkArgument(!emails.isEmpty());
    
                String queryStr = "FROM User u WHERE u.email NOT IN (:excludedEmails)";
    
                Query query = entityManager.createQuery(queryStr);
                query.setParameter("excludedEmails", emails);
                return (List<User>)query.getResultList();
      }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

There's a shortcut to this without having to specify SET all the time right?
Is there any shortcut or an extension to reload extensions in Chrome? This is
is there any shortcut key to do this?
Is there a shortcut for writing the following mySQL query? I am looking for
Is there any shortcut or better way to typecast List<bool> to List<object> ? I
Is there a shortcut to selecting all the components of a user-defined datatype/structure in
Is there a shortcut for this code? -(IBAction)reset{ button1.hidden=NO; button2.hidden=NO; button3.hidden=NO; button4.hidden=NO; button5.hidden=NO; button6.hidden=NO;
Lets say I have this in my controller @appointment.add_appointer Is there a shortcut in
Is there a keyboard shortcut to do this? ctrl m + ctrl g toggles
Is there a shortcut in IntelliJ IDEA to close all opened windows?

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.