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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 21, 20262026-05-21T21:56:12+00:00 2026-05-21T21:56:12+00:00

I have an EJB with an @onetomany relationship like this in my parent class

  • 0

I have an EJB with an @onetomany relationship like this in my parent class (Timeslot):

@OneToMany(mappedBy = "rsTimeslots")
private List<RsEvents> rsEventsList;

I also have a function to get the rsEventList:

public void setRsEventsList(List<RsEvents> rsEventsList) {
    this.rsEventsList = rsEventsList;
}

This was all auto generated so far. In my view-layer code I can get a timeslot object and do something like timeslot.getRsEventList() and get all children of this timeslot. Now I need to restrict that list based on a criteria. For example I only want events that are children of this timeslot with a status of 1. Is there a way to do this with annotations?

  • 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-21T21:56:13+00:00Added an answer on May 21, 2026 at 9:56 pm

    Not in JPA.

    Normally you would execute a Query for this, using JPQL or the criteria API.

    Some JPA providers do provide ways to restrict relationships, but I think you would be best off with a query, or providing a get/filter method on your class that just accesses the list and filters it (i.e. getStatus1Events()).

    For an EclipseLink example of having a criteria on a mapping see,
    http://wiki.eclipse.org/EclipseLink/Examples/JPA/MappingSelectionCriteria

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

Sidebar

Related Questions

I have a EJB defined as this: package com.foo; @Stateless (mappedName=HelloWorld) public class HelloWorldBean
I have two entites, Person and Teacher , with a OneToMany relationship: public class
I'm developing an application on Glassfish 3. I have an EJB that looks like
I have this Entity called 'Operation': @Entity @Table(name=operation) public class Operation implements Serializable {
public class Servlet2Stateless extends HttpServlet { @EJB private HelloUserLocal helloUser; @Override public void doGet(HttpServletRequest
I have a EJB bean that exposed to two interface like below: Local interface
I have an EJB: @Stateless(mappedName = MetadataFacade) public class MetadataFacade implements MetadataFacadeRemote { and
I have an EJB method. public List<Rfsprsus> findAll() { List<Rfsprsus> rl = getEntityManager() .createNamedQuery(Rfsprsus.findAll,
I have an EJB which I don't want anyone to be able to instantiate
I have an EJB that uses additional resource files (textual template files placed in

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.