openjpa-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Westhead, Martin (Martin)" <>
Subject RE: Access to persistence metadata from datastore API
Date Tue, 28 Oct 2008 00:09:11 GMT
Thanks much Michael.  A small modification to your (remarkably
memorized) code in case anyone else is interested. There is another cast
required on this line:

Column[] cols = ((FieldMapping)

Thanks again,


-----Original Message-----
From: Michael Dick [] 
Sent: Monday, October 27, 2008 1:08 PM
Subject: Re: Access to persistence metadata from datastore API

Hi Martin,

The table and column annotations are processed by and are then stored in the
MappingRepository. You can get the MappingRepository from
JDBCConfigurationImpl by calling getMappingRepositoryInstance().

>From there you can query the ClassMapping and get the table / column
information from there.

>From my head the code would look something like this :

ClassMapping mapping = (ClassMapping) ((JDBCConfiguration)conf)
                        getClass().getClassLoader(), true);

Table table = mapping.getTable().getName();
Column[] cols = mapping.getField(fieldName).getColumns();
Column col = cols[0];

>From there you have the results of applying the annotations and any xml

Hope this helps,

On Mon, Oct 27, 2008 at 2:10 PM, Westhead, Martin (Martin) <> wrote:

> Hi,
> I am investigating implementing an LDAP data store for Open JPA. I
> some basic storage and retrieval capabilities working in a proof of
> concept implementation. I was hoping to find some help accessing the
> persistence metadata, particularly things like the contents of @Table
> and @Column annotations. I was expecting this to be possible from the
> OpenJPAConfigurationImpl object but I haven't been able to see how to
> it. Any hints and especially code snippets would be very gratefully
> received.
> Thanks,
> Martin

View raw message