google-code-export / morphia

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

Support for mixin annotations or external persistence configuration? #327

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
It would be nice if Morphia supported "mixin" annotations akin to the ones 
found in Jackson.

ie., given a domain object:

class Obj {
  int oid;
  double[] vals;
}

That I want to persist via Morphia & Mongo, but don't want to add annotations 
to the class. So I want to be able to define the annotations/persistence 
information outside of that class in something like:

@Entity class ObjMixin {
  @Id int oid;
  double[] vals;
}

And then somewhere in the mapping code do something like:

datastore.mapWith(Obj.class, ObjMixin.class)

Mapping in JSON or XML would also work.

Original issue reported on code.google.com by thegreen...@gmail.com on 20 Sep 2011 at 4:21

GoogleCodeExporter commented 9 years ago
This would be awesome in a variety of use cases.

Original comment by apetresc on 7 Oct 2011 at 4:21

GoogleCodeExporter commented 9 years ago
There is an example of this now in the test. It isn't the final impl. but is 
working and part of the tests.

See this commit: http://code.google.com/p/morphia/source/detail?r=1789

Original comment by scotthernandez on 20 Nov 2011 at 9:52