Accessing JPA metadata

I have some "none" JPA data columns that I support using @Transient methods that use JDBC to lazy fetch the data. In this case it is JGeometry, while I'm waiting for some bug fixes in the extensions Doug Clarke is working on; but the problem will extend to any data type not supported by Toplink.
To facilitate this I need to, regretfully, resort to native (SQL) queries. This requires me to know the table name associated with an entity class. My table names are overloaded using the orm.xml file, so even if I reflect on the class looking for the @Table annotation, I won't get the correct table.
My entity classes are layered into base classes that contain common attributes extended by implementing classes that add in the additional columns used for a particular client schema. The orm.xml file is used to adjust table and column names to fit a particular legacy database.
Perhaps I'm missing something, but I can't seem to find an API class in the persistence architecture that will let me discover the table name for a class or a column name for a property; useful information when I have to resort to building an SQL query.
Thanks, Mark.

Hi Mark,
All the meta data, including table name(s) for a class as well as the columns associated with properties are available at runtime. The code below will print out all the tables for each entity and the columns for each mapping.
EntityManagerFactory emf = Persistence.createEntityManagerFactory("demo");
EntityManager em = emf.createEntityManager();
EntityManagerImpl emImpl = (EntityManagerImpl)em;
Collection<ClassDescriptor> descs =emImpl.getServerSession().getProject().getDescriptors().values();
for (ClassDescriptor desc : descs) {
     System.out.println(desc.getTableNames());
     Collection<DatabaseMapping> mappings = desc.getMappings();
     for (DatabaseMapping databaseMapping : mappings) {
          System.out.println(databaseMapping.getField());
}If you need to do some custom coding per descriptor you can write a descriptor customizer (some links in this Cache in multiple server enviroment). In there you can use the native TopLink API above to get at the metadata for the class.
--Shaun                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               

Similar Messages

  • Access CDF MetaData from Region Template

    How can I access the MetaData of a CDF from the Region Template?
    I have read that I can use DOC_INFO, but this does not seem to work. I tried:
    DOC_INFO.dDocAccount and got nothing.
    I tried:
    executeService("DOC_INFO")
    DOC_INFO.dDocAccount
    Thank you in advance for any help.
    _t                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               

    If you're looking for the CDF that's assigned to the region template, use:
    <!--$#active.[metadata field name]-->
    For example, <!--$#active.xDescription-->
    If you're trying to get from a different CDF, use:
    <!--$dDocName="[Content ID]"-->
    <!--$executeService("DOC_INFO_BY_NAME")-->
    <!--$#active.[metadata field name]-->
    For example,
    <!--$dDocName="CONTENT123456"-->
    <!--$executeService("DOC_INFO_BY_NAME")-->
    <!--$#active.xDescription-->

  • How can we access Page metadata in DataView Webpart in SharePoint Designer 2013?

    Hi,
     I need to access Page metadata in my Data view web part and I am having a feeling, that the "Form" option can help me getting Page metadata, but I am not able to get much information about using this field as a parameter source on net? Can
    anybody advise, how to use "Form" option in "Parameter Source" in SharePoint Designer 2013
     OR Suggest me any other way to get Page metadata in Data View Webpart?
    Thanks in advance,
    Regards,
    Deepali
    Deepali

    Hi  Deepali,
    All the parameter source are ASP Request Object collections  which is used to get information from a visitor.  
    For accessing page metadata, you can select Server  Variable.
    For more information ,you can refer to the following article:
    http://www.w3schools.com/asp/asp_ref_request.asp
    http://blogs.msdn.com/b/spdsupport/archive/2008/07/25/data-view-data-form-parameters-you-don-t-know-about.aspx
    Best Regards,
    Eric
    Eric Tao
    TechNet Community Support

  • I have a merge publication , it says : The merge process was unable to access row metadata at the 'Subscriber'

    The merge process was unable to access row metadata at the 'Subscriber'. When troubleshooting, restart the synchronization with verbose history logging and specify an output file to write to, or use SQL Profiler to determine the source of the failure. 
    (Source: MSSQL_REPL, Error number: MSSQL_REPL-2147200996)
    Get help: http://help/MSSQL_REPL-2147200996
    Could not find stored procedure ''. (Source: MSSQLServer, Error number: 2812)
    Get help: http://help/2812
    Failed to get metadata for a batch of rows. (Source: MSSQLServer, Error number: 20680)
    Get help: http://help/20680
    The process was successfully stopped. (Source: MSSQL_REPL, Error number: MSSQL_REPL-2147199481)
    what can I do ?

    Hi,
    Are you facing the same problem when starting with a new subscriber database?
    From the error message suggested that replication metadata may be corrupt. I suggest you drop and re-create the subscription.
    Then click on synchronization status and run the snapshot agent. It hard to tell the cause unless we check Merge Agent error log.
    Regarding the Unreadable Characters,
    change system locale to Chinese if current system locale is English and test the issue. A computer restart is required to make the change effective.
    Thanks.
    Tracy Cai
    TechNet Community Support

  • [CS3 JS] How To Access Custom Metadata?

    I have InCopy documents that contain custom XMP metadata in two namespaces, Dublin Core and PRISM, e.g.:<br /><br />    ...<br />    <rdf:Description<br />      rdf:about=""><br />      <dc:format<br />        xmlns:dc="http://purl.org/dc/elements/1.1/">application/x-incopy</dc:format><br />      <dc:title>Chickens and You</dc:title><br />    </rdf:Description><br />    <rdf:Description<br />      rdf:about=""><br />      <prism:publicationName<br />        xmlns:prism="http://prismstandard.org/namespaces/basic/1.2/"<br />        >Poultry Daily</prism:publicationName><br />    </rdf:Description><br />    ...<br /><br />In my JavaScript, I can access the Dublin core values but cannot access the PRISM values and I'm not sure why not.<br /><br />For example, I have this:<br /><br />doc = app.activeDocument;<br />metadata = doc.metadataPreferences;<br /><br />namespaces["dc"] = "http://purl.org/dc/elements/1.1/";<br />namespaces["prism"] = "http://prismstandard.org/namespaces/basic/1.2/";<br /><br />$.writeln("dc:title=" + <br />     metadata.getProperty(namespaces["dc"], <br />          "title/*[1]"))<br />// Returns expected result "Chickens and You"<br /><br />$.writeln("prism:publicationName=" + <br />     metadata.getProperty(namespaces["prism"], <br />          "publicationName/*[1]"))<br />// Returns unexpected empty result, should be "Poultry Daily".<br /><br />If I do metadata.save() I see the PRISM metadata in the saved result:<br /><br />     <rdf:Description rdf:about=""<br />            xmlns:prism="http://prismstandard.org/namespaces/basic/1.2/"><br />         <prism:publicationName>Poultry Daily</prism:publicationName><br />     </rdf:Description><br /><br />So I'm sort of at a loss but I suspect that I don't really understand what the path value should be--I haven't been able to find any clear documentation on what the path is addressing or how its actually interpreted.<br /><br />What am I missing or doing wrong?<br /><br />Thanks,<br /><br />Eliot

    [email protected] wrote:
    > Dude, I started that thread :-)
    Missed that. It's been a long week.
    The problem is this line (probably).
    metadata.getProperty(namespaces["prism"], "publicationName/*[1]")
    You apparently copied the syntax from dc:title in the previous line. dc:title is
    an 'Lang Alt' kind of property which is, effectively, an array. Your
    prism:publicationName is a simple value property. I suspect that the "[1]"
    syntax (and possible the "/*" before it) are what's causing problems.
    I don't recall seeing docs for this either.
    -X

  • Access Image Metadata

    Hi!
    I'm attempting to create a photo uploader as part of a school project, and I was wondering how I can access, and edit, the metadata for the images I'm uploading.  I want to change the tags, description, etc.  I tried Googling, but it didn't return anything I can use.
    I also suspect it might not be possible to edit metadata in Flex.  If so, is there another way I can do this?
    By the way, I'm using Flash Builder 4.5 Premium, with Flex 4.5.1 SDK.
    Cheers
    Mark

    I've not tried this but it looks promising
    http://code.google.com/p/exif-as3/

  • How to access Image Metadata with AS3?

    An image, like a jpeg, has a bunch of metadata stored in it.
    The "IPTC Core" metadata usually includes the photographers name,
    address, title, description, etc.
    Is there any way to access this information using AS3 so
    that, say, captions for images in a flash gallery could be
    generated automatically?

    As far as I know this is not possible with AS3 directly, but
    if you are interested you could check out the as3corelib at
    http://code.google.com/p/as3corelib/
    They have some pretty nifty JPEG things going on there
    (although I do not know if this includes metadata - but I hope
    so).

  • Access BPEL metadata tables in Olite install of SOA Suite

    Hi,
    Iwanted to know if there is a way to acess bpel metadata tables in olite.
    like for esb we use system/any user/pass and oraesb sid.
    I am unable to do so by changing sid from oraesb to orabpel.
    It gives access violation error.
    Thanks in advance

    if you check out the datasources.xml file in your AS-installation you will see that the username/password isn't the same for orabpel as for the oraesb schema. You need to use system/manager instead of system/any

  • Access FLV metadata from Spark VideoPlayer

    Is there any way to access FLV metada in Spark VideoPlayer? There was metadataReceived event in past. But now there is no any event for metadata.
    Thank you

    I don't know PHP, but if PH can introspect the file and send
    that data to Flash in an XML format, then yes, you can do what you
    are asking. The key is PHP getting the data and then formatting it
    so that Flash can consume it.
    good luck!

  • Access custom metadata from another plugin

    I was wondering if it would be possible to access the custom metadata from one plugin from another plugin.
    I know you use the _PLUGIN object when you read or write the metadata with a plugin.Is there any way to pass the varible to another plugin, maybe stored in a xml or text file in the modules folder? I also see where you can use the "unique identifying string" or plugin.id. Is this id differant for every installation of Lightroom?

    Allen, I'm pretty sure the answer is no - you can't access another plug-in's custom fields.
    I'm sure I have read this limitation somewhere - even if I can't now see it stated explicitly in the documentation. If anything, the docs imply getPropertyForPlugin can do so by specifying the LrToolkitIdentifier value (which you may be able to pass as a preference). So this doesn't work:
         getData = photo:getPropertyForPlugin("uk.co.beardsworth.missing", jbMissing )
    It is an important point though that one plug-in should be able to access another's custom fields. Obviously one can think of many ordinary circumstances where it would be handy, but I'm more worried about the longer term DAM viability of custom metadata. Let's say I decided to release a plug-in based around custom fields and users entered metadata which had some value to them - whether that's just input time or business data (eg client or agency account number). Now move on to LR3 and the plug-in no longer works - I've disappeared, driven mad by SDK changes, or you're unwilling to pay my extortionate plug-in upgrade fee.
    Now what happens to that valuable metadata? The data is still in the database but you can't read it because the original plug-in's unavailable, and Adobe's built-in "All" Plugin Metadata panel only shows data from enabled plug-ins. It's not in the XMP either. You're stuffed - unless you're resourceful enough to reverse engineer chunks of the plug-in. Assuming that I encrypted my plug-in's code, that means you're going to have to dig around the SQL to figure out my plug-in's ID and its field names. Only then can you create a plug-in to rescue your custom data. And you've got to hope to hell that my plug-in didn't encrypt or obscure the values you entered.
    For me what this shows is
    1) You're taking a big risk if you store valuable custom metadata - if you can't sort it out yourself, should you do it?
    2) You should ensure any plug-in with custom metadata stores its field definitions in unencrypted files
    3) The All Plug-in Metadata panel needs to show all plug-in metadata
    4) The SDK should allow you to get custom metadata from other plug-ins
    4) Custom fields should be mapped to XMP
    Short answer - No.
    John

  • Access XMP Metadata outside of Acrobat

    Is it possible to access the PDF metadata without using the full version of Acrobat?

    An XML packet created with XMP tool kit, which conforms to XMP, can be added to the document level by attaching to the Catalog dictionary. It is also possible to add object level metadata to PDF component represented as a dictionary or stream. In either case, a reserved key Metadata associated with the dictionaries indirectly references the XMP metadata streams.<br /><br />However, in reality, writing XML packet into PDF without using Acrobat APIs, is complicated and requires a good understanding of PDF. The client must handle it cautiously:<br /> <br />·     construct an XMP conformant XML packet as the document metadata, which is in a writable XML Packet with enough padding provided for the in-place edits and expansion;<br />·     synchronize the information in the metadata stream with that in the document information dictionary;<br />·     write the XML packet to the right place in PDF; <br />·     interpret the multiple versions of XML packet correctly.<br /><br />As recommended in the XMP framework specification, applications should allocate 50% of the XML data size as padding, with a minimum of 4 KB. The purpose is to enable in-place edits and expansion of the embedded XML if the value of the end attribute is set as w in the packet trailer, <?xpacket end='w'?>.<br /><br />In addition, applications that create PDF 1.4 documents (such as Acrobat 5.0) should include the metadata for a document in the document information dictionary as well as in the documents metadata stream. Applications that support PDF 1.4 should check for the existence of a metadata stream and synchronize the information in it with that in the document information dictionary (see Implementation Note 104 on p. 804 of  PDF Reference: Third Edition, version 1.4).<br /><br />Moreover, in Acrobat 5.0 (PDF1.4), the document level metadata is constructed automatically from the document information dictionary. However, due to the incremental update mechanism of PDF, it is possible to end up with more than one copy of XML packet in PDF. Whenever the PDF is saved, a new copy of XMP metadata stream will be appended to the cross-reference section, although there may be only one or two properties are changed (i.e., ModDate and MetadataDate). <br /><br />The following PDF sample illustrates the complications. When the PDF was first created, the metadata stream is defined in the object 19 associating with the /Metadata key in the /Catalog dictionary. The value of <xap:MetadataDate> property is 2002-02-11T13:43:24-08:00. When the PDF was saved later, a new XMP metadata packet was appended to the cross-reference section, which associated with the updated entry (/Metadata 21 0 R) in the catalog dictionary. The value of <xap:MetadataDate> property is 2002-02-11T13:46:52-08:00.<br />   <br />%PDF-1.4<br /><br />7 0 obj<br /><< <br />/Type /Catalog <br />/Pages 3 0 R <br />/Metadata 19 0 R <br />/PageLabels 2 0 R <br />>> <br />endobj<br /><br />19 0 obj<br /><< /Type /Metadata /Subtype /XML /Length 1338 >> <br />stream<br /><br /><xap:MetadataDate>2002-02-11T13:43:24-08:00</xap:MetadataDate><br /><br />endstream<br />endobj<br /><br />startxref<br /><br />7 0 obj<br /><< <br />/Type /Catalog <br />/Pages 3 0 R <br />/Metadata 21 0 R <br />/PageLabels 2 0 R <br />>> <br />endobj<br /><br />21 0 obj<br /><< /Type /Metadata /Subtype /XML /Length 1338 >> <br />stream<br /><br /><xap:MetadataDate>2002-02-11T13:46:52-08:00</xap:MetadataDate><br /><br />endstream<br />endobj<br /><br />xref<br /><br />%%EOF<br /><br />Because of the above complications, Adobe can only support use of the PDF Library and Acrobat SDK plug-in for adding new XMP packets into PDF.

  • Access Image Metadata in a jpeg?

    An image, like a jpeg, has a bunch of metadata stored in it.
    The "IPTC Core" metadata usually includes the photographers name,
    address, title, description, etc.
    Is there any way to access this information using Flash so
    that, say, captions for images in a flash gallery could be
    generated automatically?

    Look at the documentation for the BitmapData class. I think
    this provides you with access to the raw image data.
    Look at the documentation of the jpeg i.e. the JPEG header
    format. I think you might be able to parse out some image label
    data from raw JPEG header. This would be one way. The second way is
    to pass the name/caption of the image in the HTTP server response
    and parse it using the URLLoader object. Read documentation of
    URLLoader.

  • Flv access to MetaData.. via php ?

    Is there a way to runtime reading / access MetaData from a
    php script so i can from the file it self get stuff like
    videodatarate / audiodatarate / framerate / width and height ..
    ?

    I don't know PHP, but if PH can introspect the file and send
    that data to Flash in an XML format, then yes, you can do what you
    are asking. The key is PHP getting the data and then formatting it
    so that Flash can consume it.
    good luck!

  • Accessing swf metadata rdf:Description etc

    Hi Guys, anyone found a way for a swf to access it's own xmp and rdf metadata.
    Essentially what i'm after is a way to embed a variable in a swf without having to decompile and recompile it, setting one of the preused metadata tags to that and then reading it would solve that problem.
    Any help is much appreciated

    Unfortunatley not, i'm trying to automate a dynamic content system, much like the old macromedia generator, where we have one swf file with one internal variable changed.

  • JPA Metadata issue/ Weird Column error or bug in openjpa ...?

    Hi All,
    I am getting the following exception when using openjpa in my project.
    The line of code that throws the error is also mentioned
    The latter error shows a column mismatch error which i am not sure is correct since the db i am using is Oracle 10g and the datatypes for the column are varchar2.
             BcsPort bcsPort=em.find(BcsPort .class, port);   //Error after this call.
    EJB Exception: : &lt;openjpa-1.1.1-SNAPSHOT-r422266:965591 fatal user error&gt; org.apache.openjpa.per
    sistence.ArgumentException: Errors encountered while resolving metadata.  See nested exceptions for details.
            at org.apache.openjpa.meta.MetaDataRepository.resolve(MetaDataRepository.java:567)
            at org.apache.openjpa.meta.MetaDataRepository.getMetaData(MetaDataRepository.java:308)
            at org.apache.openjpa.kernel.BrokerImpl.newObjectId(BrokerImpl.java:1121)
            at org.apache.openjpa.kernel.DelegatingBroker.newObjectId(DelegatingBroker.java:268)
            at org.apache.openjpa.persistence.EntityManagerImpl.find(EntityManagerImpl.java:451)
            at sun.reflect.GeneratedMethodAccessor472.invoke(Unknown Source)
            at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
            at java.lang.reflect.Method.invoke(Method.java:597)
            at weblogic.deployment.BasePersistenceContextProxyImpl.invoke(BasePersistenceContextProxyImpl.java:93)
            at weblogic.deployment.TransactionalEntityManagerProxyImpl.invoke(TransactionalEntityManagerProxyImpl.java:91)
            at weblogic.deployment.BasePersistenceContextProxyImpl.invoke(BasePersistenceContextProxyImpl.java:80)
            at weblogic.deployment.TransactionalEntityManagerProxyImpl.invoke(TransactionalEntityManagerProxyImpl.java:26)
            at $Proxy76.find(Unknown Source)
           .... so onFollowed by this as the cause from what i can make
    Caused by: &lt;openjpa-1.1.1-SNAPSHOT-r422266:965591 fatal user error&gt; org.apache.openjpa.persistence.ArgumentException: "
    com.test.domain.BcsNe.ne" declares a column that is not compatible with the expected type "varchar".  Column detail
    s:
    Full Name: bcsne.ne
    Type: blob
    Size: 0
    Default: null
    Not Null: false
            at org.apache.openjpa.jdbc.meta.MappingInfo.mergeColumn(MappingInfo.java:660)
            at org.apache.openjpa.jdbc.meta.MappingInfo.createColumns(MappingInfo.java:518)
            at org.apache.openjpa.jdbc.meta.ValueMappingInfo.getColumns(ValueMappingInfo.java:143)
            at org.apache.openjpa.jdbc.meta.strats.StringFieldStrategy.map(StringFieldStrategy.java:79)
            at org.apache.openjpa.jdbc.meta.FieldMapping.setStrategy(FieldMapping.java:120)
            at org.apache.openjpa.jdbc.meta.RuntimeStrategyInstaller.installStrategy(RuntimeStrategyInstaller.java:80)
            at org.apache.openjpa.jdbc.meta.FieldMapping.resolveMapping(FieldMapping.java:438)
            at org.apache.openjpa.jdbc.meta.FieldMapping.resolve(FieldMapping.java:403)
            at org.apache.openjpa.jdbc.meta.ClassMapping.resolveNonRelationMappings(ClassMapping.java:834)
            at org.apache.openjpa.jdbc.meta.MappingRepository.prepareMapping(MappingRepository.java:324)
            at org.apache.openjpa.meta.MetaDataRepository.preMapping(MetaDataRepository.java:667)
            at org.apache.openjpa.meta.MetaDataRepository.resolve(MetaDataRepository.java:549)
            ... 78 moreI have seen this link https://issues.apache.org/jira/browse/OPENJPA-1481
    Can anyone help me out on this as i cannot make out if this is a problem in openjpa or the weblogic server 10.0 server
    that i am using to make the call..
    Any inputs on this highly appraciated

    gimbal2 wrote:
    That link seems to deal with a bug relating to a one to many mapping. I don't see anywhere in your post that you are dealing with the same thing.
    Actually i am using Many to One mapping as you can see from the code excerpt
    BcsPort
    @ManyToOne(optional=false, cascade=CascadeType.ALL, fetch=FetchType.EAGER)
         @JoinColumn(name="ne",referencedColumnName="ne")
         private BcsNe bcsNe;Why i posted the link was that it seems to throw the same weird column exception that i got and more googling revelead that it was indeed some issue between the way the oracle varchar2 field is being handled by openjpa.
    so just needed to confirm if this was a widely faced issue and a possible fix to the same
    Is there a particular reason why you are using openjpaActually it's been added recenlty to the system as before it was using normal JDBC Code...
    In stead of the persistence provider shipped with your JEE container anyway?Do you mean that i should use the Oracle Weblogic 10.3 persistence provider...?
    kindly suggest...
    thanks

Maybe you are looking for