Aaron Mulder wrote:
So in your CMP settings, you can include the
enforce-foreign-key-constraints setting. This ultimately causes TranQL to
use either a SimpleFlushStrategy or an EnforceRelationshipsFlushStrategy.
I just want to double-check my understanding of this.
Is it the case that this controls what happens when you have
pending DB changes at the end of a transaction, and TranQL has to decide
what SQL to execute? So with the SimpleFS, it just does the
inserts/updates/deletes in whatever order it feels like. With the
EnforceRelationshipsFS, it tries to order them according to relationships
between tables -- for example, when deleting a parent with children, it
would issue the child deletes first.
I assume this needs to be set if your DB enforces foreign keys as
each statement is executed, and does not need to be set if your DB doesn't
enforce foreign keys until the transaction is committed.
Yes, the simple strategy is just that and pays no attention to ordering
requirements imposed by the model. The most likely use case is for when
you have no DB level constraints in place (or they are disabled) as most
RDBMS systems are not real happy if you defer enforcement to commit time.
If all that's right, then my last question is, are the
calculations for the EnforceRelationshipsFS based on inspecting the DB
schema via DBMetaData or something, or are they strictly based on Entity
relationships you may have declared in your ejb-jar.xml?
They are based on the info in the logical data model which for now is
defined by the relationships in the EJB model and not by the database.
The architecture allows for the separation of the three models
(front-end (EJB), logical and back-end (DBMS)) so at some point in the
future expect this to also include information from all of those models
not just the front-end one.
--
Jeremy