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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T22:34:31+00:00 2026-06-04T22:34:31+00:00

I have a problem with a QueryDSL query. Classes: @Entity @Table(name=project) @Cacheable(true) @Cache(usage= CacheConcurrencyStrategy.NONSTRICT_READ_WRITE)

  • 0

I have a problem with a QueryDSL query. Classes:

@Entity
@Table(name="project")
@Cacheable(true)
@Cache(usage= CacheConcurrencyStrategy.NONSTRICT_READ_WRITE)
public class Project extends DomainObject implements Comparable<Project>, IconizedComponent, Commentable {

    @ManyToMany(targetEntity=Student.class)
    @JoinTable(name="project_student")
    @Sort(type=SortType.NATURAL) //Required by hibernate
        @QueryInit({"user"})
    private SortedSet<Student> projectParticipants = new TreeSet<Student>();

    private Project(){}

    //attributes, get+set methods etc

}

@Entity
@Cacheable(true)
@Cache(usage= CacheConcurrencyStrategy.NONSTRICT_READ_WRITE) //Hibernate specific
public class Student extends Role {

    public Student(){}

    //attributes, get+set methods etc

}

@Entity
@DiscriminatorColumn(name = "rolename", discriminatorType = DiscriminatorType.STRING, length = 8)
@Table(name="role", uniqueConstraints={@UniqueConstraint(columnNames={"user_id","rolename"}, name = "role_is_unique")})
@Inheritance(strategy=InheritanceType.SINGLE_TABLE)
public abstract class Role extends LazyDeletableDomainObject implements Comparable<Role> {

    @ManyToOne(optional=false)
    protected User user;

    public Role(){}

    //attributes, get+set methods etc
}

@Entity
@Table(name="user")
@Cacheable(true)
@Cache(usage= CacheConcurrencyStrategy.NONSTRICT_READ_WRITE) //Hibernate specific
public class User extends LazyDeletableDomainObject implements Comparable<User>, IconizedComponent {

    private String firstName;
    private String lastName;

    public User(){}

    //attributes, get+set methods etc

}

Query:

private BooleanExpression authorsNameContains(String searchTerm){
        QUser user = new QUser("user");
        user.firstName.containsIgnoreCase(searchTerm).or(user.lastName.contains(searchTerm));
        QStudent student = new QStudent("student");
        student.user.eq(user);
        return QProject.project.projectParticipants.contains(student);

    //java.lang.IllegalArgumentException: Undeclared path 'student'. Add this path as a source to the query to be able to reference it.
}

I have also tried annotating the projectParticipants set in Project with

@QueryInit("*.*")

But that gives the same exception. Any hints?

  • 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-04T22:34:32+00:00Added an answer on June 4, 2026 at 10:34 pm

    @Timo Westkämper
    @siebZ0r

    Thanks for your attention. Sorry for the delayed reply and incorrectly phrased question. Actually what I wanted to do was to write a working BooleanExpression.

    In combination with the annotations already made, this was what I was after:

    private BooleanExpression authorsFirstNameContains(String searchTerm){
        return QProject.project.projectParticipants.any().user.firstName.containsIgnoreCase(searchTerm);
    }
    

    I got this right with the help of a colleague.

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

Sidebar

Related Questions

I have a problem with using QueryDSL to create a query. I want to
I have problem with following query: SELECT g_contac.contid, g_contac.name, g_contac.email, f_sync.foreign_key, ( SELECT COUNT(g_cpers.cpersid)
I have problem with sql query. For example, I have table like this: ID
I have problem with css styles in aspx.cs file HttpContext.Current.Response.Write(<table class=\'bordered\' cellpadding=\'5\' color: \'red\'
I have problem with Uploadify: I log in the project using: FormsAuthentication.SetAuthCookie(myName, false); Then,
I've got an Eclipse Maven project for spring-data-jpa and QueryDsl. I seem to have
I have problem with deleting rows from table. I have a class for cell
I have problem with add new row to the table. I use Google Maps,
I have problem with Install-Shield. I create package to install my project and then
I have problem with searching. So, I have Task entity and Owner Entity. They

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.