RE: Problems fro begginer.

From: Gentry, Michael (michael_gentr..anniemae.com)
Date: Thu Jul 29 2004 - 09:05:29 EDT

  • Next message: sarvesh.naid..t.com: "Second Step for Cayenne"

    In addition to what Mike said, if "id" is your primary key, you should
    probably let Cayenne automatically generate it for you.

    /dev/mrg

    -----Original Message-----
    From: Reinaldo Coelho Sartorelli
    [mailto:reinaldo_sartorell..ahoo.com.br]
    Sent: Wednesday, July 28, 2004 7:03 PM
    To: cayenne-use..bjectstyle.org
    Subject: Problems fro begginer.

    Hi all.

    I'm a new user of Cayenne and PostgreSQL, and i try create a insert
    method,
    but not return error and not insert values.

    The table :
            Generos(Codigo Integer, Descricao Varchar(255));

    This is a code :

                    try{
                            DataContext con =
    DataContext.createDataContext();
                            Generos y = new Generos(con);

                            Integer id = new Integer(1);
                            y.setCodigo(id);
                            y.setDescricao("Teste");
                            System.out.println("ID:" + y.getCodigo());
                            System.out.println("Name:" + y.getDescricao());
                            con.commitChanges();
                    }
                    catch(Exception e){
                            System.out.println(e.getMessage());
                    }

    Tks for all.
    Reinaldo.

    PS: Sorry my english.



    This archive was generated by hypermail 2.0.0 : Thu Jul 29 2004 - 09:05:34 EDT