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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T13:33:05+00:00 2026-05-26T13:33:05+00:00

I am new to MongoDB and JDO after mostly doing development with Hibernate in

  • 0

I am new to MongoDB and JDO after mostly doing development with Hibernate in the past. I am trying to persist a simple object and leverage the generated “_id” from MongoDB as the primary key for the persisted object. Unfortunately, it looks like DataNucleus is generating an “IDENTITY” field as well as Mongo generating an “_id” field in the persisted document. So, every object is persisted with two unique identifiers. How can I enforce DataNucleus to simply use the generated Mongo ObjectId? My persistent class is below.

@PersistentCapable(identityType=IdentityType.DATASTORE)
public class HistoricalPrice {

private String ticker;
private Date day;
private double open;
private double close;
private double high;
private double low;
private long volume;

public HistoricalPrice(String ticker, Date day, double open, double close, double high, double low, long volume) {
    super();
    this.ticker = ticker;
    this.day = day;
    this.open = open;
    this.close = close;
    this.high = high;
    this.low = low;
    this.volume = volume;
}
  • 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-26T13:33:06+00:00Added an answer on May 26, 2026 at 1:33 pm

    Define the datastore identity “strategy” to be IDENTITY (as opposed to the default of NATIVE).

    @DatastoreIdentity(strategy=IdGeneratorStrategy.IDENTITY)
    

    i.e consistent with what would be needed on an RDBMS to use some inbuilt mechanism.

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

Sidebar

Related Questions

We're adopting MongoDB for a new solution and are currently trying to design the
I'm new to rails and mongodb, and have a simple form attempting to create
I'm new to Rails development and I'm starting with MongoDB also. I have been
I'm trying to parse a very large chunk of data into a new MongoDB
I am new to mongodb and thinking of trying this out in PHP5. If
I have a mongodb object as follows: array ( '_id' => new MongoId(4cc97fb0247ae8747ec5fefb), 'posts'
I'm new to rails application. I got connection with mongodb using mongoid. I generated
New class is a subclass of the original object It needs to be php4
New to Linux programming in general. I am trying to communicate with a kernel
New day, new problem :-) Code: Client Side: void abw_Closed(object sender, EventArgs e) {

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.