Using foreign keys?


General J2EE: Using foreign keys?

  1. Using foreign keys? (4 messages)

    We use an ERP framework with Bea Weblogic 7.0 and Oracle 9.

    The tables in our database don't use any foreign keys. Relationships are set only in the deployment descriptor XML file of the application server.

    I don't like that there are no foreign keys. Because of that, I cannot use the Master Detail Browser of Toad. This would be very nice for debugging or understanding your data in the database. I would choose a recordset and would then see all the other recordsets which are connected to it without having to write a SQL script for this purpose.

    What do you think? Does it make sense not to use foreign keys?

    Threaded Messages (4)

  2. Using foreign keys?[ Go to top ]

    It sounds as though the relationships might be derived from specific business rules. In other words, perhaps the descriptors are specifying that object a (of type A) *must* relate to object b (of type B).

    If so, then this is a different thing to a key column relationship (an entity relationship) because there you have business rules that only constrain type to type (A to B). There are no special rules for specific instances.

    If you look at the deployment descriptors, you *might* find that the relationships are derived from business rules that cannot be satisfactorily expressed using keys at all. Whoever put the relationships there may well have had a reason for doing so...
  3. Using foreign keys?[ Go to top ]

    I don't understand what you want to express.

    My question is very simple. Does it make sense in your eyes not to use foreign keys or not?

    I assume that using or not using foreign keys in the DB has no effect on anything except on the DB tool Toad in order to use its Master Detail Browser.

    So anyone answering me should know what Toad is, what its Master Detail Browser is and whether introducing foreign keys in the DB has any side effects in our situation (custom J2EE ERP framework, Bea Weblogic 7.0, Oracle).
  4. Using foreign keys?[ Go to top ]

    Unless you are doing something strange, Weblogic 7 does allow you to map CMP EJB to foreign key relationships. In fact, that is the only way it can manage 1-to-many relationships. Depending on how you did things, it may be using foreign key relationship, but did not explicitly set the foreign key constaint on the field in the database. Adding this constaint should not hurt Weblogic, and will let Toad function the way you are used to it.
  5. Hi, We just released SQL Edge 1.2, which is a SQL query tool that allows users to visualize the master-detail relationships. It also allows you to define master-detail
    relationships even between tables in different databases.

    It has two relationship views. Relationship table view
    displays related data in the master-detail style. The
    Relationship tree view displays master table data as
    top-level tree node, and the related data as child nodes.

    Both views are much intuitive than toad's implementation.

    Check it out at

    As foreign key is concerned, it's possible that no
    foreign key is defined just to improve database performance
    for high performance OO applications.