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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T07:37:23+00:00 2026-06-09T07:37:23+00:00

I am using DataNucleus 3.0.0-release JDO implementation to connect my Java app to MongoDB.

  • 0

I am using DataNucleus 3.0.0-release JDO implementation to connect my Java app to MongoDB.

The related JARs in my CLASSPATH are as follows:

  • datanucleus-api-jdo-3.0.0-release.jar
  • datanucleus-core-3.0.0-release.jar
  • datanucleus-jdo-query-3.0.0-release.jar
  • datanucleus-mongodb-3.0.0-release.jar
  • mongo-java-driver-2.5.2.jar

UPDATE: This problem also occurred with version 3.1 and is related to DataNucleus’ Level2 cache. See my answer below for a workaround.

The class that I am trying to load is as follows:

@PersistenceCapable(detachable = "true")
public class UserProfile implements Serializable, Cacheable<String> {

    private static final long serialVersionUID = 7132595253084641884L;

    @PrimaryKey
    @Persistent(defaultFetchGroup = "true")
    private String username;

    @Persistent(defaultFetchGroup = "true")
    private String name;

    @Persistent(defaultFetchGroup = "true")
    private String surname;

    @Persistent(embeddedElement = "true", defaultFetchGroup = "true")
    private Map<String, UserProfileSummary> connections;

    ...
}

The following is the UserProfileSummary class:

@PersistenceCapable(embeddedOnly = "true")
public class UserProfileSummary implements Serializable {

    private static final long serialVersionUID = 6120670018375572406L;

    @Persistent(defaultFetchGroup = "true")
    private String username;

    @Persistent(defaultFetchGroup = "true")
    private String fullName;
    ...
}

The following is how I am trying to load stored objects of type UserProfile:

PersistenceManager pm = MyPersistenceManagerFactory.get().getPersistenceManager();

UserProfile profile = null;
try {
    profile = pm.getObjectById(UserProfile.class, username);
}
catch (JDOObjectNotFoundException onfe) {
    // handle
}
catch (Exception e) {
    // handle
}

The problem is that the connections field of UserProfile is sometimes loaded correctly, but sometimes loaded as null with the same call to getObjectById(). The field is marked to be in the defaultFetchGroup, so it should be loaded every time.

Could this be a DataNucleus bug (race condition?)? Is anyone else experiencing the same problem?

Note: I know that DataNucleus 3.1.0-release is available, but I can’t use it because of a problem with its enhancer.

  • 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-09T07:37:24+00:00Added an answer on June 9, 2026 at 7:37 am

    I have turned DataNucleus level2 cache off and from preliminary tests it seems like this problem has disappeared.

    To turn the level2 cache off, add the following line to your jdoconfig.xml:

    <jdoconfig xmlns="http://java. ... .xsd">
        <persistence-manager-factory name="MyPMF">
            ...
            <property name="datanucleus.cache.level2.type" value="none" />
        </persistence-manager-factory>
    </jdoconfig>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Assuming one has an operational Java application using DataNucleus's implementation of JDO to access
I am using Guice with JDO and Datanucleus in my desktop app. I am
I'm having trouble retrieving 2 artifacts in my Maven/Java/Google App Engine project: com.google.appengine.orm:datanucleus-appengine:jar:1.0.7.final com.google.appengine:appengine-api-1.0-sdk:jar:1.3.4
I am using DataNucleus' implementation of JDO to populate a table on a local
I am using DataNucleus's implementation of JDO on an H2 database instance opened in
I am using DataNucleus' implement of JDO on a local H2 database. I want
i am using gwt with jdo datanucleus. i have requirement to get child with
I am using Datanucleus JDO on top of HSqlDb. I would like to execute
I am trying to write a small application to use DataNucleus' JDO implementation on
I use ANT to run my JDO application example implemented using Datanucleus solution. When

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.