Dave,

> After reviewing these comments I think we are making this way more
> complicated than it has to be. As far as I am concerned we should only
> need the relationship stuff in jbosscmp-jdbc.xml for relationships that
> use a relation table (ex. self relation employee/manager, just to
> control the name and fields ) or for primary keys that are composite.

Relax.  The only reason you need the jbosscmp-jdbc.xml file is that you are
tiring to exactly specify the foreign key field.  If you just let the system
define the foreign key field for you, you would not have any problems.  I
have a test case that closely matches what you have coded except my case
uses a general oid for the line item and the order fk is auto generated.

> We should avoid creating tables if all possible. I would see only 3
> cases where you need a third table
> Many to Many
> 1 to Many (unidirectional. I can not come up with an example but it
> would be valid)
> Self referencing entry

A relation table is only required for a many-to-many relationship. A
unidirectional many-to-one relationship can always use foreign keys.  The
trick is that the database mapping of the relationship does not have to
match the object level navigability.  A self-referencing entity can also use
a foreign key to itself.

> Time passes ...
>
> I'm am really trying hard to not have to use this jboss-jdbc.xml ... For
>   composite foreign keys would could also the jdbc method
> getImportedKeys() to figure out composite keys. This would mean the jdbc
> driver would have to support the DatabaseMetaData method and the dba
> would have to use the references in their table definition. We could
> always fall back to the xml file if it did not exsist. So with a good
> jdbc driver we really would only have to create an xml entry if we had a
> specfic relation table we had already predefined.

This is a good idea but, would only work if there were only a single
relationship between the two entities.  The problem is that it is very
common for entities to have multiple relationships.  For example, order has
a shipping address and a billing address.

> Maybe I'm foaming at the mouth,  but I feel this is a HUGE feature for
> people writing business apps and it should be as simple as possible. I
> really think this could be simpler for the developers and users.

I agree.  It think the configuration is very complicated.  I was thinking of
writing a took that could generate the jbosscmp-jdbc.xml file based on the
system defaults. Then the user could modify the default configuration. This
utility could also read in the current config and fill in the unspecified
options.  Something like this or a gui could make configuration very easy.

Have I missed something? Do you have a counter point or suggestion?

As a side note, I am happy to see someone challenging my design decisions.
I have been known to be full of it (and my self).  Please keep the criticism
up, and don't worry about ticking me off (it takes a lot).

Thanks a lot,

-dain


_______________________________________________
Jboss-development mailing list
[EMAIL PROTECTED]
http://lists.sourceforge.net/lists/listinfo/jboss-development

Reply via email to