0 Replies Latest reply on Feb 3, 2004 8:55 AM by Joerg Thoennes

    cache secondary keys like primary keys

    Joerg Thoennes Newbie


      if I use primary keys to access Entity Beans, I can avoid all database accesses (using commit option A) since the cache is addressed by the primary key. But how could I tell JBoss to handle secondary keys (unique keys which could be also used as primary keys) in the same way? If we could avoid database access here this would be a great performance boost for us.

      Currently I have two ideas:

      1. Define a second Entity Bean with the secondary key as PK and which accesses the same table. Does this help to avoid database accesses? Or do I need to change the commit option?

      2. Use CMR: Is it possible to define a relationship of a bean to itself? How could I do that?
      And what role plays the foreign-key attribute of CMR here?

      Thanks for any ideas,