Enity Bean with No Primary Key class(BMP)


EJB programming & troubleshooting: Enity Bean with No Primary Key class(BMP)

  1. Enity Bean with No Primary Key class(BMP) (2 messages)

    Is it possible to have Entity Bean with no primary key class, because I have a table with no primary key and this is used by many tables.

    Is it better to have a helper class??...

    Please throw some light on this..

  2. All entity beans need to be able to be uniquely identified so they need a unique identifier (primary key).

    If your database table contains duplicate rows, ie there is no primary key in the table - it's not possible to uniquely identify a row.

    In this case I would say entity beans are not the correct choice for what you're trying to do.

    Perhaps use raw JDBC instead.
  3. Hmmm....

    A "proper" relational table has no duplicate rows, therefore the set of all columns in the table should uniquely identify a single row (thus a single bean). If you have duplicate entries in the table then perhaps you need to re-evaluate your data model.