Issue 307 in morphia: error using datastore with composite _id

39 views
Skip to first unread message

mor...@googlecode.com

unread,
Aug 5, 2011, 4:33:10 AM8/5/11
to morphia...@googlegroups.com
Status: New
Owner: ----
Labels: Type-Defect Priority-Low

New issue 307 by had...@gmail.com: error using datastore with composite _id
http://code.google.com/p/morphia/issues/detail?id=307

I have a class with another class as an _id field.
when doing save/insert via the BasicDAO, i get the following exception.
doing save insert via the collection itself works just fine.

What version are you using? (Morphia/Driver/MongoDB)
mongo 2.5 and morphia 1.0 snapshit
Please include a stack trace below:

java.lang.RuntimeException: @Id mismatch:
knil.categories.mongo.beans.ObjectClassType$CTId@190872ce !=
knil.categories.mongo.beans.ObjectClassType$CTId@5675b3ee for
knil.categories.mongo.beans.ObjectClassType
at
com.google.code.morphia.mapping.Mapper.updateKeyInfo(Mapper.java:239)
at
com.google.code.morphia.DatastoreImpl.postSaveOperations(DatastoreImpl.java:933)
at
com.google.code.morphia.DatastoreImpl.postSaveGetKey(DatastoreImpl.java:716)
at
com.google.code.morphia.DatastoreImpl.save(DatastoreImpl.java:767)

mor...@googlecode.com

unread,
Aug 5, 2011, 9:24:58 AM8/5/11
to morphia...@googlegroups.com

Comment #1 on issue 307 by scotthernandez: error using datastore with
composite _id
http://code.google.com/p/morphia/issues/detail?id=307

Can you provide a sample of code to reproduce this?

mor...@googlecode.com

unread,
Jan 18, 2012, 5:22:15 AM1/18/12
to morphia...@googlegroups.com

Comment #2 on issue 307 by had...@gmail.com: error using datastore with
composite _id
http://code.google.com/p/morphia/issues/detail?id=307

@Embeded
public class Oid
{
public Long x;
public Long y;

public oID(Long x,Long y)
{
this.x = x;
this.y = y;
}
}

@Entity
public class Ent
{
@Id
Oid id;
public ent(Oid id)
{
this.id = id;
}
}
Morphia morphia = new Morphia().map(Ent.class)
new DatastoreImpl(morphia,mongo).insert(new Ent(new Oid(1l,2l)));

the object is saved just fine, but the above exception is thrown

mor...@googlecode.com

unread,
Jan 18, 2012, 5:33:20 AM1/18/12
to morphia...@googlegroups.com

Comment #3 on issue 307 by had...@gmail.com: error using datastore with
composite _id
http://code.google.com/p/morphia/issues/detail?id=307

the last line where the datastore creation is should be.
morphia.createDatastore(mongo,"test").save(new Ent....;

mor...@googlecode.com

unread,
Feb 23, 2012, 1:05:47 AM2/23/12
to morphia...@googlegroups.com

Comment #4 on issue 307 by scotthernandez: error using datastore with
composite _id
http://code.google.com/p/morphia/issues/detail?id=307

Issue 378 has been merged into this issue.

mor...@googlecode.com

unread,
Feb 23, 2012, 1:09:07 AM2/23/12
to morphia...@googlegroups.com
Updates:
Status: Fixed

Comment #5 on issue 307 by scotthernandez: error using datastore with
composite _id
http://code.google.com/p/morphia/issues/detail?id=307

This issue was closed by revision r1809.

mor...@googlecode.com

unread,
Feb 23, 2012, 1:33:16 AM2/23/12
to morphia...@googlegroups.com
Updates:
Labels: Milestone-Release0.99.1

Comment #6 on issue 307 by scotthernandez: error using datastore with
composite _id
http://code.google.com/p/morphia/issues/detail?id=307

(No comment was entered for this change.)

Reply all
Reply to author
Forward
0 new messages