Andrus Adamchik commented on CAY-574:
-------------------------------------
Security is one reason why there's no DbEntity on the client... But more generally, this is done by design to isolate the client from any information about the DB schema. I think we can solve this issue without breaking DB schema encapsulation. How about something like this:
class ObjEntity {
...
Collection<String> getPrimaryKeyNames();
}
Server ObjEntity would look it up via a DbEntity, and we can create a client ObjEntity subclass that would store a collection of the names explicitly (we already have special client subclasses for ObjAttribute and ObjRelationship, we can do a similar thing for ObjEntity).
> DataObjectUtils 'objectForPK' should work on the client
> -------------------------------------------------------
>
> Key: CAY-574
> URL: https://issues.apache.org/cayenne/browse/CAY-574
> Project: Cayenne
> Issue Type: Improvement
> Components: Cayenne Core Library
> Affects Versions: 1.2 [STABLE], UNDEFINED FUTURE
> Reporter: Andrus Adamchik
> Fix For: UNDEFINED FUTURE
>
>
> While DataObjectUtil.objectForPK takes ObjectContext as an argument, using it on the remote client is not possible. The following exceptions happen on various overloaded calls:
> 1. This will require method signature change:
> DataObjectUtils.objectForPK( c1,new ObjectId("MtTable1", "TABLE1_ID", 1));
> java.lang.ClassCastException
> at org.objectstyle.cayenne.DataObjectUtils.objectForPK(DataObjectUtils.java:276)
> at org.objectstyle.cayenne.remote.ClientChannelEventsTst.testSyncSimpleProperty(ClientChannelEventsTst.java:93)
>
> 2. This should issue a query instead of doing DbEntity lookup:
> DataObjectUtils.objectForPK(
> c2,
> ClientMtTable1.class,
> 1);
> org.objectstyle.cayenne.CayenneRuntimeException: [v..AYENNE_VERSION@ @CAYENNE_BUILD_DATE@] No DbEntity for ObjEntity: MtTable1
> at org.objectstyle.cayenne.DataObjectUtils.buildId(DataObjectUtils.java:352)
> at org.objectstyle.cayenne.DataObjectUtils.objectForPK(DataObjectUtils.java:167)
>
-- This message is automatically generated by JIRA. - You can reply to this email to add a comment to the issue online.
This archive was generated by hypermail 2.0.0 : Sun Feb 03 2008 - 08:15:59 EST