3 Replies Latest reply on Oct 10, 2001 6:21 PM by David Jencks

    CMP or BMP?

    neil mcclements Newbie

      I vaguely remember that it used to be the case with Jboss 2.0 that changing a CMP bean (eg adding new fields)would cause the existing data in the underlying table to be lost.

      Was this ever the case (or have I got my wires crossed)? Does jBoss 2.4.x resolve this issue?

        • 1. Re: CMP or BMP?
          David Jencks Master

          If you are using JAWS to create your tables, you can't change the data/mapping in your cmp beans without dropping and recreating your tables: JAWS can't figure out how to modify your tables from one version to another. (It would need some semantic metadata anyway, you might have swapped the meaning of 2 columns or something like that). You, however, can add, modify, or drop the appropriate columns in your original table definition (at least you can drop with some databases), and JAWS should work with the modified table just fine. You may want to deploy the new bean in an empty database to get a complete new table definition from JAWS, and then work backwards with the modifications. Alternatively you can then write some scripts to copy the old data to the new database. IMHO JAWS is basically a convenience during development so you aren't bothering your dba all the time: when you get a reasonably stable table structure you presumably want to check where everything is stored, add appropriate indices and foreign keys, etc etc.

          • 2. Re: CMP or BMP?
            neil mcclements Newbie

            Thanks! Just the info I needed.

            Looks like I'll stick with BMP for the time being!

            • 3. Re: CMP or BMP?
              David Jencks Master

              If you are willing to manage your db schema, as you are since you are using bmp, you can use cmp and not have jaws create your tables and not have to write the db access code (if it is simple enough to fit into JAWS capabilities).