On Mon, Jul 13, 2009 at 11:47 AM, Tom Ware
<tom.ware@xxxxxxxxxx> wrote:
If I am reading correctly, the relationship between Document and GLaAcounts is not fully represented in the database (the effectiveDate field is not in any table). Is that correct?
Yes. A Document has 4/5 of a foreign key :-) to a GLAccount. The remaining component is a fiscal year.
Under normal circumstances--which these aren't!--I'd introduce a join table, that would associate a Document on the "left" side with a GLAccount on the "right" side, adding a fiscal year field as an additional property of the join relationship (ASCII art follows):
Document JoinTable GLAccount
======== ========= =========
pk <--- docPK
four fks ---> four pks
fiscal yr ---> fiscal yr
Instead what I have is this (ASCII art):
Document GLAccount
======== =========
pk fiscal yr
four fks ---> four pks
...and effectively cannot change the database.
How are GLAAcounts and Documents inserted into the database? Are they read-only?
Nope.
Unless I am mistaken above, I do not think there is anything as simple as what you suggest as a solution. The things that come to mind that might help:
- In JPA you could use named native queries and result set mappings to somehow buildyour objects
Yeah; was looking for some sort of sugar to help here.
- EclipseLink allows customization of the queries that are used to traverse mapping. Depending on exactly what you are trying to acheive, you may be able to use a DescriptorCustomizer to access the query that traverses the Document->GlaAccounts mapping and ammend it to accept some additional criteria.
Interesting; will look.
Thanks,
Laird