i feel that modleler should truncate the spaces around the column names while generating sql queries and classes. I feel that exception message/trace is not thorough enought to pin point what column/ issue is causing the commit / insert to fail. I executed the insert manually, it is succeeded. Only when I am going thru cayenne, it is getting failed. I feel that there is no other difference except a blank at the end of column name. As more and more packages/frameworks are being used to reduce time and improve automation and productivity, it is important that logging/tracing/exception messages should be accurate , brief and complete so that we can quickly correct the issue.
On Wed, Jul 29, 2009 at 11:45 AM, sridhar devatha <devatha.srid...@gmail.com > wrote: > 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.and...@gmail.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.srid...@gmail.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 < >> m...@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.srid...@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 >> > >> > > > > -- > > Yours Sincerely, > Devatha Sridhar > -- Yours Sincerely, Devatha Sridhar