1 Reply Latest reply on May 6, 2003 7:25 PM by juhalindfors

    Primitive type or Object wrapper in CMP fields

    peterwarde

      Can anyone explain the design and performance issues and any other in having a CMP field on an entity bean as a primitive type or an object type such as a wrapper.

      For example a field can be either an int or an Integer and both create an int 4 type in the database(Postgres) table when loaded into the container. However the primitive seems to be a NOT NULL contraint while the Integer allows nulls.

      Can anyone help with the following

      - Is this correct for all db's or just Postgres?

      - If so is it a good design pratice to define sql tables as allowing NULL and NOT NULL using Integer and int declarations on entity bean fields ( as opposed to doing this directly in SQL)

      - Are there any performance or other issues

      Thanks

      Peter

        • 1. Re: Primitive type or Object wrapper in CMP fields

          > - Is this correct for all db's or just Postgres?

          All DBs, this is a property of the DB type mappings.

          > - If so is it a good design pratice to define sql
          > tables as allowing NULL and NOT NULL using Integer
          > and int declarations on entity bean fields ( as
          > opposed to doing this directly in SQL)

          There is no meaningful value for a primitive int if NULL is present in the column, an Integer field can contain a null reference I guess.

          > - Are there any performance or other issues

          Performance different would be insignificant.