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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T10:47:27+00:00 2026-05-25T10:47:27+00:00

Let’s assume a User class with theese fields : @Entity public class User extends

  • 0

Let’s assume a User class with theese fields :

@Entity
public class User extends Model {
    public String email;
    public String password;
    @ElementCollection
    public List<String> stringList;
}

I am looking for a way to execute a database request to find all users that have a given string into their stringList, something like

List<User> usersHelloWorld = User.find("byStringList", "HelloWorld").fetch();

But of course, this doesn’t work. Is there any way to make it work ?

Edit :

Here are my actual class fields :

@Entity
public class User extends Model {
    public String email;
    public String password;
    public String firstname;
    public String lastname;
    public String gender;
    public String fbId;
    public String googleId;
    @ElementCollection
    public List<String> eventTopicIds;
    @Transient
    UserEventBuffer eventBuffer;
    @Transient
    public String fbAccessToken;
    public String googleAccessToken;
}

With this request :

List<User> u = User.find("SELECT u from User u where ? IN u.eventTopicIds", "internalns_rootTopic1").fetch();

I get that error :

JPAQueryException occured : Error while executing query SELECT u
from User u where ? IN u.eventTopicIds: Syntax error in SQL statement
“SELECT USER0_.ID AS ID3_, USER0_.EMAIL AS EMAIL3_, USER0_.FBID AS
FBID3_, USER0_.FIRSTNAME AS FIRSTNAME3_, USER0_.GENDER AS GENDER3_,
USER0_.GOOGLEACCESSTOKEN AS GOOGLEAC6_3_, USER0_.GOOGLEID AS
GOOGLEID3_, USER0_.LASTNAME AS LASTNAME3_, USER0_.PASSWORD AS
PASSWORD3_ FROM USER USER0_ CROSS JOIN USER_EVENTTOPICIDS EVENTTOPIC1_
WHERE USER0_.ID=EVENTTOPIC1_.USER_ID AND (? IN (.[*])) “; expected
“NOT, EXISTS, SELECT, FROM”; SQL statement: select user0_.id as id3_,
user0_.email as email3_, user0_.fbId as fbId3_, user0_.firstname as
firstname3_, user0_.gender as gender3_, user0_.googleAccessToken as
googleAc6_3_, user0_.googleId as googleId3_, user0_.lastname as
lastname3_, user0_.password as password3_ from User user0_ cross join
User_eventTopicIds eventtopic1_ where user0_.id=eventtopic1_.User_id
and (? in (.)) [42001-149]

  • 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-25T10:47:27+00:00Added an answer on May 25, 2026 at 10:47 am

    Normally you should be able to run a JPA query like

    User.find("Select u from User as u inner join u.stringList as strings where ? in strings", "HelloWorld").fetch();
    

    Did a small test, my object had emails instead of Strings, but it should be the same, unless you run into some reserved words. The problem was not the in keyword, I had to inner join the stringList in order to use the in keyword. A bit quick of the marker earlier:)

    Hope this helps.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Let's say I have a class like this: public class Person { private String
Let us assume I have two classes: class Base{}; class Derived: public Base{}; none
Let's say you have a class called Customer, which contains the following fields: UserName
Let's say I have this: public DefaultListModel model = new DefaultListModel(); how do i
Let's say I'm writing a PHP (>= 5.0) class that's meant to be a
Let's say that I have an arbitrary string like `A man + a plan
Let's say I have a link in a table like: <td class=ms-vb width=100%> <a
Let's say you have some products which have 2 fields, a description and a
Let's assume I want to deserialize this (I've removed the namespaces to make things
Let's suppose I've got a 2D vector template class: template<typename T> class Vec2 {

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.