On Wed, May 16, 2012 at 7:22 AM, Tibor Mlynarik
<[email protected]> wrote:

> Can somebody please explain to me why are *DTOs ( value composites
> that mirrros entities) necessary
> and why only values can be serialized into JSON and entities not ?

Uhhhh.... The history is probably forgotten. If we instead look
forward, in 2.0 I expect that entities can be turned into Values with
a simple toValue() method, since Rickard fixed that Values can now
contain (Many)Associations. And since inheritence from Composite meta
types are not going to be necessary in 2.0, I expect something like
this to work;

Person pEntity = uow.get( Person.class, "niclas" );
Person pValue = pEntity.toValue();

OR, since toJSON() is probably going into Module.toJSON( Object value
), or something like that (since Values no longer need to inherit
ValueComposite), perhaps it will look like;

Person pEntity = uow.get( Person.class, "niclas" );
Person pValue = module.toValue( pEntity);



Cheers
-- 
Niclas Hedhman, Software Developer
http://www.qi4j.org - New Energy for Java

I live here; http://tinyurl.com/3xugrbk
I work here; http://tinyurl.com/6a2pl4j
I relax here; http://tinyurl.com/2cgsug

_______________________________________________
qi4j-dev mailing list
[email protected]
http://lists.ops4j.org/mailman/listinfo/qi4j-dev

Reply via email to