Which column is your primary key? I've had similar trouble when I've tried to access the primary key column from the objects that represents the table.
-----Original Message-----
From: Marconetto, Adrian Eduardo (A.) [mailto:amarcon..ord.com]
Sent: May 23, 2003 3:04 PM
To: 'cayenne-use..bjectstyle.org'
Subject: Error trying to commit
Hi, I´m really new using Cayenne.
I´m just trying the product, using a web application.
I think I've set up everything as stated in the docs. Then I ussed the modeler to create my classes and stored them in the same package of the servlet. Then I added the primary key support to the related tables in my database (Oracle 9i).
The following code is in the doPost method of my servlet.
**Init method of my servlet:
public void init(ServletConfig config) throws ServletException
{
super.init(config);
// disable logging configuration attempts by Cayenne
org.objectstyle.cayenne.conf.Configuration.setLoggingConfigured(true);
//configure log4j
BasicConfigurator.configure();
}
**In the doPost method I have this Cayenne related relevant code:
DataContext ctxt =BasicServletConfiguration.getDefaultContext(request.getSession());
BkbTmpConsulta consulta = (BkbTmpConsulta) ctxt.createAndRegisterNewObject("BkbTmpConsulta");
consulta.setBtcNroConsulta("1234");
// commit to the database
// using log level of WARN to show the query execution
ctxt.commitChanges(Level.WARN);
But when I run the above I get:
java.lang.NullPointerException
at org.objectstyle.cayenne.access.util.PrimaryKeyHelper.createPermIdsForObjEntity(PrimaryKeyHelper.java:137)
at org.objectstyle.cayenne.access.ContextCommit.createPrimaryKeys(ContextCommit.java:517)
at org.objectstyle.cayenne.access.ContextCommit.commit(ContextCommit.java:139)
at org.objectstyle.cayenne.access.DataContext.commitChanges(DataContext.java:725)
at myPackage.MyServlet.doPost(FordXmlRec.java:70)
at myPackage.MyServlet.doGet(FordXmlRec.java:53)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:740)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:247)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:193)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:243)
at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:566)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:472)
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:190)
at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:566)
at org.apache.catalina.valves.CertificatesValve.invoke(CertificatesValve.java:246)
at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:564)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:472)
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943)
at org.apache.catalina.core.StandardContext.invoke(StandardContext.java:2347)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:180)
at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:566)
at org.apache.catalina.valves.ErrorDispatcherValve.invoke(ErrorDispatcherValve.java:170)
at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:564)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:170)
at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:564)
at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:468)
at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:564)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:472)
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:174)
at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:566)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:472)
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943)
at org.apache.catalina.connector.http.HttpProcessor.process(HttpProcessor.java:1027)
at org.apache.catalina.connector.http.HttpProcessor.run(HttpProcessor.java:1125)
at java.lang.Thread.run(Thread.java:536)
Can any one help me?, I´m really stuck with it.
Thanks
Adrián Marconetto
This archive was generated by hypermail 2.0.0 : Fri May 23 2003 - 17:14:07 EDT