2 Replies Latest reply on Dec 22, 2002 10:14 PM by fumeishi

    How to map EJB names to table names of my choosing?

    fumeishi

      Hello everyone, I'm a newbie.

      Can anyone tell me how to map EJB names to db table names of my choosing?

      Background:

      Using Oracle9i and JBOSS 3.0.2 to implement a J2EE Web application. Until recently, I've been using mySQL, but just started my efforts to migrate to Oracle.

      On startup, my web app creates a number of tables via JDBC. It's able to do so without a problem under mySQL, but runs into a problem with Oracle:

      java.sql.SQLException: ORA-00972: identifier is too long.

      I've since learned that this is due to a limitation of Oracle where schema objects must be <=30 characters in length. And, in fact, I have three EJBs whose names exceed that, so I'm happy to understand the nature of my problem there.

      I don't know whether or not that 30 char limit is insurmountable, but I'd like to fix the problem by designating table names of my choosing. I know that with weblogic, for example, there's an XML file (weblogic-cmp-rdbms-jar.xml) that allows me to make this kind of mapping. Can anyone tell me if there's a JBOSS equivalent?

      Thanks a lot in advance.

        • 1. Re: How to map EJB names to table names of my choosing?
          b0howard

          Hi Fumeishi:

          I'm a new guy too.

          The file "jbosscmp-jdbc.xml" is roughly equivalant to the "weblogic-cmp-rdbms-jar.xml". I can't be certain because I don't know weblogic, but jbosscmp-jdbc.xml does associate table names with ejb entities.


          You can alter this file directly.

          But you should be using something like XDoclet to prepare your deployment descriptors.

          1 - In you ejb enity java file, include the xdoclet tag:
          @jboss:table-name table-name="yourTableName"
          in the class javadoc comment block.

          2 - Run xdoclet and the jbosscmp-jdbc.xml file will now
          have yourtable name associated with your ejb entity.

          See the template files from the free document web-pages.

          Don't have XDoclet? Your can find it at sourceforge.net

          Cheer's
          Bruce

          • 2. Re: How to map EJB names to table names of my choosing?
            fumeishi

            Bruce.

            Thank you very much. I really appreciate your advice and that you took the time to respond.

            I think I've got to learn XDoclet, but it sounds well worth it. Thanks once again.

            arigatou. (thank you)