4 Replies Latest reply on Feb 5, 2002 3:44 AM by hennings

    CMP 2.0 getter-method problem

    hennings

      I have created a CMP 2.0 bean with the aid of xdoclet1.1.

      I have successfully created bean instances in the database (SQL-Server 2000) using a home-create method. I can use the basic set-methods, but when I try the get-methods I get an exception.

      Any clues?

        • 1. Re: CMP 2.0 getter-method problem
          ppetit

          I think you have to check twice the relationships settings of your entity beans.
          Perhaps you have to check too what is going on in your getter method when no data are returned...

          regards,
          Philippe

          • 2. Re: CMP 2.0 getter-method problem
            hennings

            The getter method just returns the value. The bean is stand-alone, so checking the deployment descriptors may not be such a bad idea...

            • 3. Re: CMP 2.0 getter-method problem
              hennings

              Well, I can't find anything wrong with the descriptor files. It is not possible to validate them though, because jboss.dtd is not updated for version 3.0. The ejb-jar-file looks good.

              It can't be too hard getting a CMP test-bean to run (no business logic other than pure get-set).

              Anyway, I'll attach the descriptor files and the server-log if anyone want to look at it.

              • 4. Re: CMP 2.0 getter-method problem
                hennings

                and the code-snippet that makes the thing crash...

                ActionHome home = (ActionHome) PortableRemoteObject.narrow(obj, ActionHome.class);
                Collection col = home.findAll();
                Iterator i = col.iterator();
                int highest =0;
                while (i.hasNext())
                {
                Action action = (Action)i.next();
                ActionPK pk = (ActionPK)action.getPrimaryKey();
                if (pk.getId().intValue() > highest)
                {
                highest = pk.getId().intValue();
                }
                //System.out.println("action.pk = " + pk.toString());
                }
                highest++;

                for (int x=highest; x < highest + 1; x++)
                {
                System.out.println("Creating new Action entry with id = " + x);
                Action action = home.create(new Integer(x));
                action.setDuration(4L);
                action.setName("test");
                action.setRelativeStartTime(1000L);
                action.getDuration(); // <---------- CRASH
                }