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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T12:00:46+00:00 2026-05-24T12:00:46+00:00

Using the peristance manager, how can I retrieve a child object knowing a child

  • 0

Using the peristance manager, how can I retrieve a child object knowing a child property and the parent key?

The Parent is defined like this:

public class User {

@PrimaryKey
@Persistent(valueStrategy = IdGeneratorStrategy.IDENTITY)
private Key id;

@Persistent(mappedBy = "user")
@Element(dependent = "true")
private List<Section> sections;
...

And the child is defined like this:

public class Section {

@PrimaryKey
@Persistent(valueStrategy = IdGeneratorStrategy.IDENTITY)
private Long id;

@Persistent
private User user;

@Persistent
private String title;
...

Knowing the ‘User’ id and the ‘Section’ title, how can I retrieve the section?. I was trying to build a query to retrieve the section using something like this: ‘where title == xxx AND user.id ¿? == xxx’ but I’m not sure how to specify the user id. Is there any way to do it using queries or methods from the persistance manager?

Thanks.

  • 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-24T12:00:47+00:00Added an answer on May 24, 2026 at 12:00 pm

    I finally made it with this method:

    public static Section getSectionByTitle(String title, Key user_key){
        PersistenceManager pm = PMF.get().getPersistenceManager();  
        Query query = pm.newQuery("select from "+Section.class.getName()+" WHERE title == s && user == keyParam");
        query.declareParameters("String s, String k");
        query.setUnique(true);
        Section section = (Section) query.execute(title, user_key.getId());
        return section;
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am using EJB3 on Glassfish using the default TopLink persistance manager. Within a
I'm currently developping an application in java using Hibernate as a persistence manager and
Currently I am using ViewData or TempData for object persistance in my ASP.NET MVC
When using Persistence frameworks like Hibernate, JPA etc. on the server side, what are
I am using spring and hibernate together. In my application context, I have this
I am using jdo and configuring the persistence manager with jdoconfig.xml However everywhere I
I've written a task manager program using Java, and made a single UI implementation
I am trying to inject entity manager in some helper class, I can pass
I am using Eclipselink in glassfish to deploy an application and I'd like to
I have a master-child tables. User can add/remove childs after selecting the master item/entity.

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.