Thank you very much Ari: I can't do that you have told me: city = context.newObject(City.class); city.setcdCity(11);
In my code, I've not Classes because i'm using Generic Persistent Class (http://cayenne.apache.org/doc30/generic-persistent-class.html). Length 2 is because when I designed the DbEntity (table) with cayenneModeler, I chose in the atribute CD_CITY the type NUMERIC and MAXLENGTH 2. After when cayenne generated automatically the Database Schema for an Oracle Database, this column is NUMBER(2,0). I think that the generic persistent is a good idea because you musn't write or generated the POJO for your classes, but I don't know if it's the best way to use Cayenne.... Saludos!!
