Re: metadata api?

2009-09-13 Thread Christopher Giblin
Thanks Jeremy, However, pk.getName() returns null as does fk[i].getName(). In the debugger, I see the table clsMapping.getTable() is the expected table. Also, pk is instantiated and fk[] has the right number of foreign keys. They just don't return their respective names, which is what I need.

Re: metadata api?

2009-09-13 Thread Christopher Giblin
Hi, If I go over the column, I get closer:: pk.getColumns()[0].getName() Wondering how I would get the attribute name instead of column name? In following example, how would I get groupId instead of group_id ? attributes id name=groupId column name=group_id/

metadata api?

2009-09-09 Thread Christopher Giblin
Hi, I defined object-relational mappings in orm.xml. Works fine. Is an API available which allows querying of the orm definition for a given object? I am programming with reflection and would like to know, given an object, which of its attributes are primary or foreign keys. Thanks, chris

Re: metadata api?

2009-09-09 Thread Jeremy Bauer
Hi Chris, OpenJPA provides APIs that allow you to interrogate class mappings. Using a direct approach (OpenJPA resolves class mapping and metadata as part of creating an emf/em), this code gives you access to the primary and foreign keys of an entity via the schema information stored in the