Discussions

EJB design: Least Impact Design

  1. Least Impact Design (1 messages)

    Java Guru's,

    I am looking for least possible redesign of my java code.

    The database has gone for a major change. Prior to this, my java program uses single primary key to identify the entity and on the basis of this key, I create the sets of java object (Which actually represent the tables in database). So logically each table is identifiable from the other by respective primary key (which is in fact one and only one).

    The same key server as a foreign key for the other table, which has it’s own primary key. And so on. Each table is represented as java object.

    But now the database tables have been given a different look. Each table is representation of a huge 5-6 fields serving as primary key (instead of old model of having just one primary key).

    This model is not very different from the old one except each table has a combination of fields serving as primary key and referential integrity is served the same way as earlier.

    Problem –

    My problem is huge code has been written out by considering one unique key. I need to know, how can I generate unique key from combinations of keys and use them with least possible java code modification. Can it be possible ..

    You feedback will be a great help
  2. Least Impact Design[ Go to top ]

    Since you did not give a lot of details about your java implementation (ie are you using Entity bean or Plain Java Object), it's difficult to make an assessment. You will have to refactor your Java codes and build an primary key generator classes to handle the database change.