Re: null pointer exception while committing new object.

From: sridhar devatha (devatha.sridha..mail.com)
Date: Tue Jul 28 2009 - 12:10:33 EDT

  • Next message: Andrey Razumovsky: "Re: null pointer exception while committing new object."

    INFO QueryLogger: Created connection pool:
    jdbc:derby://localhost:1527/empDB;create=false
            Driver class: org.apache.derby.jdbc.ClientDriver
            Min. connections in the pool: 1
            Max. connections in the pool: 1
    INFO QueryLogger: Opening connection:
    jdbc:derby://localhost:1527/empDB;create=false
            Login: fsau
            Password: *******
    INFO QueryLogger: +++ Connecting: SUCCESS.
    INFO QueryLogger: Detected and installed adapter:
    org.apache.cayenne.dba.derby.DerbyAdapter
    Exception in thread "main" java.lang.NullPointerException
            at
    org.apache.cayenne.CayenneDataObject.validateForSave(CayenneDataObject.java:551)
            at
    org.apache.cayenne.CayenneDataObject.validateForInsert(CayenneDataObject.java:658)
            at
    org.apache.cayenne.access.ObjectStoreGraphDiff.validateAndCheckNoop(ObjectStoreGraphDiff.java:100)
            at
    org.apache.cayenne.access.DataContext.flushToParent(DataContext.java:1217)
            at
    org.apache.cayenne.access.DataContext.commitChanges(DataContext.java:1138)
            at
    com.empApp.dao.impl.CayenneDAOImpl.commitChanges(CayenneDAOImpl.java:32)

    CayenneDAOImpl is as follows:
    public abstract class CayenneDAOImpl {
        private DataContext dc = null;
    /**
         * Returns thread-bound DataContext.
         */
         protected synchronized DataContext getDataContext() {
            try {
                if(dc == null){
                    dc = DataContext.getThreadDataContext();
                }
            } catch(IllegalStateException ISE){
                dc = DataContext.createDataContext();
                DataContext.bindThreadDataContext(dc);
            }
            return dc;
        }

        synchronized protected void commitChanges(){
            getDataContext().commitChanges();
        }

    }

    On Tue, Jul 28, 2009 at 9:33 AM, Matt Kerr <mat..entralparksoftware.com>wrote:

    > any chance you have a stack trace ?
    > or code snippet ?
    > project even ?
    >
    > very hard to offer suggestion / debug
    > without more info :-?
    >
    > ok -thanks
    > -matt
    >
    >
    > On Mon, Jul 27, 2009 at 11:59 PM, sridhar
    > devatha<devatha.sridha..mail.com> wrote:
    > > Hi,
    > >
    > > I am getting null pointer exception while committing new object. I
    > committed
    > > several other objects of different classes using cayenne's
    > > datacontext.commitchanges. But, i am unable to commit this object.
    > >
    > > --
    > >
    > > Yours Sincerely,
    > > Sridhar
    > >
    >

    -- 
    

    Yours Sincerely, Devatha Sridhar



    This archive was generated by hypermail 2.0.0 : Tue Jul 28 2009 - 12:11:07 EDT