On Nov 24, 2009, at 11/245:37 AM , Andrey Razumovsky wrote:
2009/11/24 Andrus Adamchik <[email protected]>
I did not, but I defined 3 different types of objects (ROP, POJO,
JPA) that
don't use this approach for setting reverse relationship. So that's
what I
mean by pluggable :-)
And now I want at least ROP-like classes do use this approach as
well (i
mean what is contained inside "setToOneTarget" method). I just want to
minimize duplicating the code. Alternatively, same code will be
added to the
places where we process those "different types".
Property p = ClassDescriptor.getProperty(String);
p.readProperty(Object);
p.readPropertyDirectly(Object);
...and more lines to get ClassDescriptor:
ClassDescriptor cd = object.getObjectContext().
getEntityResolver
().getClassDescriptor(object.getObjectId().getEntityName());
Too hard for user who does not know Cayenne internals I think
I'll second that. I ran into a very similar use case yesterday in a
hibernate project... I was wanting to get at hibernate's version of
ClassDescription, and it took me forever to track down the right way
to do it; once I knew how, it was simple enough, and just a few lines
of code, but I fear the above would cause a new Cayenne user the same
level of frustration I experienced yesterday with Hibernate. ;)
Robert