Re: null pointer exception while committing new object.

From: sridhar devatha (devatha.sridha..mail.com)
Date: Wed Jul 29 2009 - 02:15:25 EDT

  • Next message: sridhar devatha: "Re: null pointer exception while committing new object."

    latest stable cayenne 2.x version. Part of the data map containing the table
    and it's corresponding data object I will try to provide. But, as far as i
    know, several other tables and data objects are proper. only thing is that
    while creating table I accidentally modified some columns then I added a
    space at the end of columns. But, I did not use the generated data object
    class. Because I thought there is no other change. I think space at the end
    of columns resulted in _ (underscore)being added to property names in the
    generated data object. May be that is the same reason , even in map, extra
    single blank space is added to the column names.I compared the two versions
    of map files ignoring blanks. today I will compare without ignoring blanks.
    Then I will see.
    before committing i am creating a new object with new values. Nothing more
    than that. it is standard creation operation.
    On Tue, Jul 28, 2009 at 11:09 PM, Andrey Razumovsky <
    razumovsky.andre..mail.com> wrote:

    > What version of Cayenne are you using? Can we see the code you are
    > performing before committing the context? Could you show part of DataMap
    > declaration? Probably you are incorrectly registering persistent objects in
    > Cayenne context. I'm afraid information you are currently providing is not
    > enough to help you.
    >
    > 2009/7/28 sridhar devatha <devatha.sridha..mail.com>
    >
    > > 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
    > >
    >

    -- 
    

    Yours Sincerely, Devatha Sridhar



    This archive was generated by hypermail 2.0.0 : Wed Jul 29 2009 - 02:39:06 EDT