7 Replies Latest reply on May 4, 2004 4:14 PM by aloubyansky

    weird cmp error, any ideas?

    jae77

      i've got an abstract entity bean that defines a few columns that are common to all the news tables. (create_date, ip).

      the getter/setter method for the create_date field gives me no issues. however, it seems that if i have a column name called "ip" and i try to retreive the field, it tells me "method not known as cmp accessor" - but i don't understand why. the beans deploy w/o any spec violations, and i can successfully insert data into the table.

      in any case, calling the column name "ip_addr" (and perhaps that i wrapped the getter method w/ another to remove the need to invoke the getter method from outside the bean) seems to have addressed the issue, but i'm at a loss as to what the problem is. tracing in the logs doesn't seem to turn up anything useful either (at least as far as i can tell).

      any ideas?

      p.s. this does mean that the db tables for news now change :)

        • 1. Re: weird cmp error, any ideas?

          how is called your CMP persistent field in ejb-jar.xml
          what are your accessor names get/set ?

          • 2. Re: weird cmp error, any ideas?
            jae77

            the getter/setter were

            setIPAddr(String ip)
            getIPAddr()

            they were correctly mapped to the "ip" column.

            i'd have to revert the changes i made to get it working to see what the ejb-jar.xml file looks like. i did check it and it looked correct. i wonder if something didn't like the "ip" column name.

            • 3. Re: weird cmp error, any ideas?
              triathlon98

              In any case, I would strongly suggest to use some kind of prefix for table and field names, eg "t_" for tables and "f_" for fields.

              This may be completely unrelated to your problem, but it is essential for cross db compatibility. Most DB systems have reserved words and they can differ. For consistency and o avoid problems, the prefixes can help.

              As far as table names are concerned, JBoss can (and will) automatically change them (avoid reserved words and limit to the maximum length). However, for fields, this is currently not the case.

              Joachim

              • 4. Re: weird cmp error, any ideas?
                aloubyansky

                This also might occur when these accessors are inherited from some other class. It was fixed today in Branch_3_2.

                • 5. Re: weird cmp error, any ideas?
                  hxp

                  Alex --

                  Thanks for comin and slummin with us Nukes guys ;)

                  As CMP guru, you could be mighty helpful as we move Nukes to pure-CMP. When you get a chance, please take a look at these threads:

                  MySQL & Pure-CMP --- issues w News & FAQ modules
                  http://jboss.org/index.html?module=bb&op=viewtopic&t=49132


                  Pure-CMP & FAQ Module revamp
                  http://jboss.org/index.html?module=bb&op=viewtopic&t=49034

                  Hope you'll check in with us more over the next few weeks.

                  -- Howard

                  • 6. Re: weird cmp error, any ideas?
                    jae77

                     

                    "loubyansky" wrote:
                    This also might occur when these accessors are inherited from some other class. It was fixed today in Branch_3_2.


                    any chance you could provide a bit more explination on what would cause this? (or point me somewhere that i can read about it?)

                    thx!!!

                    • 7. Re: weird cmp error, any ideas?
                      aloubyansky

                      I meant that the ejb-class you specify in ejb-jar.xml might extend some other class, inherit its abstract setters and getters that you declare as cmp and cmr fields in the ejb-jar.xml and at the same time override these same inherited abstract setters and getters.
                      Earlier we mapped CMP/CMR field and ejbSelect invocation handlers (more accurately bridges) to Method objects (one to one). In the iheritance case like above, doing casting tricks in some JVMs it could occur that we invoked a getter or setter defined in the super class that was not mapped to its bridge resulting in the mentioned error.