Re: commitChanges() problem

From: Andrus Adamchik (andru..bjectstyle.org)
Date: Fri Oct 08 2004 - 09:22:01 EDT

  • Next message: James Treleaven: "Re: My Cayenne Modeler new feature wish list"

    Hi Ahmad,

    I think this ma have something to do with your property naming conventions
    ("setPREF_NAME" instead of more traditional Java "setPrefName"). When I
    get home tonight I'll try it out myself. This shouldn't really break
    Cayenne, but frankly I never tried such naming schema before.

    Andrus

    > 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 : Fri Oct 08 2004 - 09:22:04 EDT