cayenne-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sridhar devatha <devatha.srid...@gmail.com>
Subject Re: null pointer exception while committing new object.
Date Tue, 28 Jul 2009 16:10:33 GMT
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 <matt@centralparksoftware.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.sridhar@gmail.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

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message