0 Replies Latest reply on Feb 26, 2006 3:17 AM by Colin Goudie

    Use Primitives or Not to use Primitives

    Colin Goudie Newbie

      Is it bad design to use primitives such as int, long, boolean etc.. in Entity beans?

      The reason I ask is that I created an entity on the client but didnt set the primary key (which was a long). I forgot to put code in to set the primary key before calling persist. As a result it was added fine with a primary key of 0. I realised this and ran the code again and of course got a duplicate primary key exception.

      This led me to think that if I had all my entities not using any primitive types then any fields that I didnt set that were marked as NOT NULL would throw errors when attempting to persist them.

      Is this a better way to go?