PersistenceList and PersistenceMap: new syntax proposal for composite primary key support

November 26, 2008

So far Ammentos’ support for this composite primary keys has been limited, so that currently is not possible to use Persistent Entities declared this way into one-to-many relationships, for instance as items into a PersistenceList.

Maybe I’ve just found a simple way to complete the support for composite primary keys. I’m still working on that and I’ll write about it when it will (hopefully) be ready.

At the moment I am just wondering about the new mapping syntax to adopt while declaring PersistenceLists (and PersistenceMaps). I’d like to make the change the most little as possible. Here’s my proposal:

    @PersistentList(query="invoice_id=? and year=?")
    private List<Item> m_invoiceItems;

I think the syntax is pretty good but what about keys ordering? Should I parse the query and accept any usage or just assume the order must be the same as in the class declaration, similarly to the Ammentos.load(Class, Object … ) method?

I honestly think the second idea is the best because:

1) It is coeherent with the rest of the api

2) It lets the user free to make the query as he wants without worring about which names to use in his sql code. For instance, the query can be executed into a view with differently specified field names.

If you have any suggestions please write me or put a comment below. :)

Entry Filed under: ammentos, development, java, opensource. .

Leave a Comment

Required

Required, hidden

Some HTML allowed:
<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <pre> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

Trackback this post  |  Subscribe to the comments via RSS Feed


Mission plan

November 2008
M T W T F S S
« Oct   Dec »
 12
3456789
10111213141516
17181920212223
24252627282930

Recent Posts

Top Clicks

RSS News from JUG Sardegna

Links

Blogroll