1 Reply Latest reply on Apr 8, 2005 4:40 AM by Terry Paterson

    Entity Beans not portable between diffirent DB

    tbech Newbie

      Hi all,
      I had to port application to PostgreSQL and I found it rather clumsy.
      One of the key of EJB/or other good persistance is independence of underlying DB.
      Even if I use EJBQL, portable selects, etc. JBoss-Entity-Beans depend on the DB type.
      1. jbosscmp-jdbc.xml


      2. jbosscmp-jdbc.xml - auto generated keys
      <entity-command name="postgresql-fetch-seq">

      3. No abstraction of CLOB-Oralce/TEXT-PostgreSQL.

      All those files must be change in order to port to other DB vendor. In my opinion it is major flaw in design of Entity/persistance layer. This should never be set in application descriptors. Simply it should depend on the type of the driver. If driver is Oracle - use datasource-mapping for Oracle, the same for the sequence. Even if you don't want (or impossible) to do it by detecting the driver, simply specify it in the jca db xml configuration file.

      Hope, there will be refactoring of JBoss to simply the developers work.

      But, what now?
      I use xdoclet to generate all stubs and descriptors. Two DBs means to me changes in the .java files. How to deal with:
      * @jboss.entity-command name="postgresql-fetch-seq/ or oracle-sql here"
      * @jboss.entity-command-attribute name="sequence" value="xxx_sequence"

      Should I back 20 years and make some preprocessing (like C #define)? Horrible. Should I do some postprocessing on descriptors? (a little bit better).
      Does someone has good experience with such tiny but ugly configuration?