commitChanges() problem

From: Ahmad Ruswandi Y (ayuliant..lb.com)
Date: Thu Oct 07 2004 - 21:34:42 EDT

  • Next message: Andrus Adamchik: "Re: commitChanges() problem"

    Hi,

    I have a web application using Cayenne. Here is the code.

    DataContext context = BasicServletConfiguration.getDefaultContext(session);
    SelectQuery query = new SelectQuery(OE_PREFS.class);
    List prefs = context.performQuery(query);
    out.print(prefs.size());

    /***** commented out
             OE_PREFS pref =
    (OE_PREFS)context.createAndRegisterNewObject(OE_PREFS.class);
             pref.setUSER_ID(new Integer("12"));
             pref.setPREF_VALUE("VALUE");
             pref.setPREF_NAME("NAME");
             context.setValidatingObjectsOnCommit(false);
             context.commitChanges();
    ***/

    It works. But, when I uncomment those 'commented out' code, I have the
    following errors:

    org.objectstyle.cayenne.CayenneRuntimeException: [v.1.1B3 September 20
    2004] Commit Exception
             at
    org.objectstyle.cayenne.access.DataContext.commitChanges(DataContext.java:1240)
    <cut>

    Caused by: java.sql.SQLException: ORA-01400: cannot insert NULL into
    ("DPDEV"."OE_PREFS"."PREF_NAME")

             at oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java:114)

    For me, it seems that 'pref.setPREF_NAME("NAME")' statement does not work.
    Is there any other configuration I need to set?

    thanks
    ahmad



    This archive was generated by hypermail 2.0.0 : Thu Oct 07 2004 - 21:47:45 EDT