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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T13:05:25+00:00 2026-06-06T13:05:25+00:00

i am using gwt with jdo datanucleus. i have requirement to get child with

  • 0

i am using gwt with jdo datanucleus. i have requirement to get child with parent. but i am not getting child when access parent.
my code is as following

my parent class is

@PersistenceCapable(identityType = IdentityType.APPLICATION, table = "user")
public class User implements Serializable {

    private static final long serialVersionUID = 2660867968471555842L;

    @PrimaryKey
    @Persistent
    private String email;

    @Persistent(defaultFetchGroup = "true",mappedBy="user")
    private UserProfile profile;

    public User() {}

    public User(String email) {
        this.email = email;
    }

    public String getEmail() {
        return email;
    }

    public void setEmail(String email) {
        this.email = email;
    }

    public UserProfile getProfile() {
        return profile;
    }

    public void setProfile(UserProfile profile) {
        this.profile = profile;
    }
}

and my child class is

@PersistenceCapable(identityType = IdentityType.APPLICATION,table = "user_profile")
public class UserProfile implements Serializable {

    private static final long serialVersionUID = -6818036410894395030L;

    @PrimaryKey
    @Persistent(defaultFetchGroup="true")
    private User user;

    @Persistent
    private String name;

    public UserProfile() {}

    public UserProfile(User user) {
        this.user = user;
        user.setProfile(this);
    }

    public User getUser() {
        return user;
    }

    public void setUser(User user) {
        this.user = user;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

}

i am fetching data by following query

PersistenceManager pm = PMF.get().getPersistenceManager();
                 User user=null;

                try{
                    String userId ="abc@abc.com";
                    Query userQuery = pm.newQuery(User.class);
                    userQuery.setFilter("email == '" + userId + "'");
                    userQuery.setUnique(true);
                    user = (User) userQuery.execute();
                } catch (Exception e) {
                    throw new IllegalAccessError("Failed to get the User..");
                }finally{
                    pm.close();
                }

but i am getting userprofile null in object user.
where is the problem ?
how to load children with parent ?

  • 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-06T13:05:27+00:00Added an answer on June 6, 2026 at 1:05 pm

    I’m not sure if you found your answer, but for those that stumble across this I just wanted to share how I got it working.

    @PersistenceCapable(detachable = "true") 
    @FetchGroup(name = "fooGroup", members = { @Persistent(name = "list") }) 
    public class ParentClass {
    
        @Persistent(mappedBy = "parent")
        @Element(dependent = "true") //can not exist without parent
        private List<ChildClass> list;
    
    }
    
    @PersistenceCapable(detachable = "true") 
    public class ChildClass {
        @Persistent
        private ParentClass parent;
    }
    

    and then to do the fetching:

    PersistenceManager pm = PMF.get("eventual-reads-shortdeadlines").getPersistenceManager();
    pm.setDetachAllOnCommit(true); 
    pm.getFetchPlan().addGroup("fooGroup");
    Transaction tx = pm.currentTransaction();
    
        try {
            tx.begin();
    
            Query query = pm.newQuery(ParentClass.class);
            list = (List<ParentClass>) query.execute();
    
            tx.commit();
        } catch (Exception ex) {
            ...
        } finally {
            if (pm != null) {
                if(pm.currentTransaction().isActive()){
                    pm.currentTransaction().rollback();
                }
                pm.close();
            }
        }
    

    Your ParentClass’s should now have all the ChildClass’s for each. Hope that helps!

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

Sidebar

Related Questions

Using GWT 1.6.4, I have the following code to retrieve the dimensions of the
When using GWT I get following warning: Referencing deprecated class 'com.google.gwt.user.client.rpc.SerializableException' While it's only
I am using GWT/JAVA for development. I have following problem: I want to remove
I have an application built with GWT/Appengine/Jdo...and i am using Google User Service for
I have a class of data that I am persisting using JDO on GWT
I'm using GWT 2.3 and I have json-p requests in my code similar to
I'm using GWT 2.4. I have a com.google.gwt.user.cellview.client.CellTable widget, but I'm having trouble figuring
I'm programming using GWT, which includes Jetty. I have defined my own servlet and
When using GWT 2.0.x and SmartGWT 2.2 Code as simple as: public class SmartGwtTest
I'm using GWT (2.4) with Spring integrated as in this article . I have

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.