google-code-export / morphia

Automatically exported from code.google.com/p/morphia
1 stars 0 forks source link

Multiple insert issue #451

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
What version are you using? (Morphia 0.99 / MongoDB 2.0.2)

Please include a stack trace below:
There is no error but when i save multiple objects like this it saved only last 
record to database, 

Datastore ds = conM.getConnections();
for (Record res : dataList) {
Person prs = new Person();
prs.setName(res.getName()) ;
ds.save(prs);
prs = null;
}

There are 20 records but saved onlt last record, what can be the reason ? 
Thanks

Original issue reported on code.google.com by eros...@rcapl.com on 12 Feb 2013 at 8:06

GoogleCodeExporter commented 9 years ago
Sorry for the inconvenient, I have made a mistake , i put follow line in pojo 
class, then all records replaced, Remove that line working fine, 
    @Id
    private int _id;

Original comment by eros...@rcapl.com on 12 Feb 2013 at 8:30