openjpa-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Michael Dick" <michael.d.d...@gmail.com>
Subject Re: Access to persistence metadata from datastore API
Date Mon, 27 Oct 2008 20:07:43 GMT
Hi Martin,

The table and column annotations are processed by
AnnotationPersistenceMappingParser.java 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)
                .getMetaDataRepositoryInstance().getMetaData(entityClass,
                        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
overrides.

Hope this helps,
-mike

On Mon, Oct 27, 2008 at 2:10 PM, Westhead, Martin (Martin) <
westhead@avaya.com> wrote:

> Hi,
>
>
> I am investigating implementing an LDAP data store for Open JPA. I have
> 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 do
> it. Any hints and especially code snippets would be very gratefully
> received.
>
>
>
> Thanks,
>
>
>
> Martin
>
>

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message