Hello!

So that's the problem, when i run my simple example:
public static void main(String[] args) throws CayenneException {
                ClientConnection connection = new 
HessianConnection("http://localhost:8080/cayenne/cws";);
                
                DataChannel channel = new ClientChannel(connection);
                ObjectContext context = new CayenneContext(channel);
                
                Militaryman mm = 
(Militaryman)DataObjectUtils.objectForPK(context, Militaryman.class, 
100110250529L);           
                Dicrow dr = (Dicrow)DataObjectUtils.objectForPK(context, 
Dicrow.class, 100110142120L);

                mm.setToDicrow1(dr);
                context.commitChanges();
        }

I get exception on client:
Exception in thread "main" org.apache.cayenne.CayenneRuntimeException: [v.3.0M2 
Oct 28 2007 16:09:02] No DbEntity for ObjEntity: Militaryman
        at org.apache.cayenne.DataObjectUtils.buildId(DataObjectUtils.java:308)
        at 
org.apache.cayenne.DataObjectUtils.objectForPK(DataObjectUtils.java:149)
        at com.nic.porshe.Main.main(Main.java:26)

Still, this code works all right:
public static void main4(String[] args) throws CayenneException {
                ClientConnection connection = new 
HessianConnection("http://localhost:8080/cayenne/cws";);
                
                DataChannel channel = new ClientChannel(connection);
                ObjectContext context = new CayenneContext(channel);
                
                Expression e1 = 
Expression.fromString("db:militarymanid='100110250529'"); 
                SelectQuery select = new SelectQuery(Militaryman.class, e1);
                Militaryman mm = 
(Militaryman)context.performQuery(select).get(0);
                
                Expression e2 = 
Expression.fromString("db:dicrowid='100110142120'"); 
                SelectQuery select2 = new SelectQuery(Dicrow.class, e2);
                Dicrow dr = (Dicrow)context.performQuery(select2).get(0);

                mm.setToDicrow1(dr);
                context.commitChanges();
        }

Thanks for help,
Andrey)

Reply via email to