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;
}