Hello.

The cayenne way is like this:

ObjectContext ctxt = ....
Pessoa p = (Pessoa) ctxt.newObject(PessoaFisica.class);
p.setName("Gilberto");
p.setDateOfBirth(Date.valueOf("2009-01-01"));
ctxt.commitChanges();

It seem strange at the beginning, but there are lots of benefits with the context keeping track of the objects.

Take a look at the examples: (the formatting of the code-examples look strange..)
http://cayenne.apache.org/doc/tutorial-dataobjects.html

 - Tore.

On Aug 7, 2009, at 20:57, Gilberto C. Andrade wrote:

                Pessoa p;
                p = new PessoaFisica(1, "Gilberto", "F", "Endereço",
Date.valueOf("2009-01-01"), "RG", "CPF");
                assertNotNull(p);

Reply via email to