RE: Error trying to commit

From: Marconetto, Adrian Eduardo (A.) ("Marconetto,)
Date: Mon May 26 2003 - 12:43:44 EDT

  • Next message: Michael Amster: "Help with PK field accessible by web app"

    Thanks Andrus!
    You were right, I haven't configured any DataNode. I corrected this and it begun to work.
    By the way, when the modeler creates the Primary key support sequences in the DB, it specifies them beginning in 200 and incrementing by 20. Is there any specific reason to do it that way, or they could be created beginning with 1 and incrementing by 1?
    Other issue: I'm setting up my model over an existing database. When I tried to create the primary key support sequence for one of my tables, Oracle rejected the name suggested by the modeler ("pk_ttis815_bkb_transactions_data") because it was too long.
    I can't rename the table because it's used by other applications. How can I still have primary key support for it??
     
    PS: Yes, I know the name for the table is a bit long, but I'm not responsible for it :)
     
     
     -----Original Message-----
    From: Andrus Adamchik [mailto:andru..bjectstyle.org]
    Sent: Viernes 23 de Mayo de 2003 20:39 PM
    To: 'cayenne-use..bjectstyle.org'
    Subject: Re: Error trying to commit

    Adrian,

    following the stack trace of this exception, I suspect that there are some issues with DataNode settings. I am adding a better assertion code to cayenne now (to get informative message instead of NullPointerException), but for now could you verify a few things :

    1. Are there any warnings when you save your DataMap in the Modeler? Like "DataMap not linked to any DataNodes" ?

    2. Is there a DataNode configured at all?

    3. If there is, did you select OracleAdapter in DBAdapter dropdown? (Otherwise you would see a warning "DataNode has no DbAdapter").

    If this doesn't help, I will need to take a look at your Cayenne XML files.

    Andrus

    On Friday, May 23, 2003, at 05:03 PM, Marconetto, Adrian Eduardo (A.) wrote:

    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 : Mon May 26 2003 - 12:42:57 EDT