usually, java developers convert objects between layers. for example from application domain objects to persistent entities and vice versa. however, apache cayenne use ObjectId to represent keys in database, and it's a combination of entity name and keys in map, so I would like to know what is the best practice to map ObjectId to other layers. In fact, I am using ObjectId in my POJO right now, but I don't know if it is applicable. Thanks...
best practice to handle ObjectId while convert cayenne generated class to other layers
70 views Asked by robinly At
1
Since your POJOs goal is to mirror JSON, the main consideration here should be your REST API convenience for the consumer.
While on the Java side, having a semi-opaque ObjectId is often a good idea, in JSON REST API I would suggest to "unpack" the ID map into individual properties. Hence the POJO would also need those properties.