See my reply in "is is possible to dynamically create entity in cayenne" 
thread. An explicit reverse-engineering step is required.

Andrus

> On Jul 22, 2018, at 6:46 PM, 刘波 <[email protected]> wrote:
> 
> ServerRuntime cayenneRuntime = ServerRuntime.builder()
>                .addConfig("cayenne-project.xml")
>                .build();
>        ObjectContext context = cayenneRuntime.newContext();
> 
> 
>        DataObject person = new CayenneDataObject();
>        person.setObjectId(new ObjectId("Person"));
>        context.registerNewObject(person);
> 
>        String name = (String) person.readProperty("name");
> Exception in thread "main" java.lang.IllegalArgumentException: Can't find 
> ObjEntity for Persistent class: org.apache.cayenne.CayenneDataObject, class 
> is likely not mapped.
>       at 
> org.apache.cayenne.access.DataContext.registerNewObject(DataContext.java:536)
> 
> Person is a table in mysql, we aren't map it in xml, we want use it in fly, 
> we don't define a deEntity for the table, just want use cayenne api to do the 
> ORM job.
> 
> 
> and ideas, thanks~

Reply via email to