NamedQuery in orm.xml

Hi,
I want to keep all my queries into orm.xml because I need to avoid select statements in my code. I got the following in my orm.xml:
     <named-query name="Person.basic">
          <query>SELECT p FROM Person p WHERE p.name LIKE :name</query>
     </named-query>
And then I make the query:
     Query query = em.createNamedQuery("Person.basic");
What I need now is to access the query string in order to add a dynamic condition. It would be something like this:
     String newQuery = query.getQueryString() + "AND p.surname LIKE :surname";
     Query q2 = em.createQuery(newQuery);
Is there a way to do this? I know I can put this condition inside orm.xml, but what if the user fills a
search form with different fields and different combinations?
Regards

at the beginning of your post, you said you didn't want sql queries in your code. but, then you ask how you can put queries in your code...?
named queries cannot be modified at runtime. the point of them is to avoid hard coding sql queries into your code (as you mentioned). if you need to generate queries at runtime, named queries are not going to work for you.

Similar Messages

  • JPA - orm.xml mapping problem.

    Hi folks,
    I am trying to give entity mappings in orm .xml
    Sequence generation tag is not working fine for me.
    its giving me a xml parsing error.
    can some body give me a right combination .
    I want to give automatic generation for a database field which is not the primary key.
    My orm.xml file is given below....
    some body pls help me....
    <?xml version="1.0" encoding="UTF-8"?>
    <entity-mappings version="1.0" xmlns="http://java.sun.com/xml/ns/persistence/orm"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
              xsi:schemaLocation="http://java.sun.com/xml/ns/persistence/orm orm_1_0.xsd">
    <entity class="com.git.oms.common.entity.ORDReply" name="ORDReply" metadata-complete="false">
         <table name="ORDReply"/>
         <attributes>     
         <basic name="serialNo">
              <column name="SerialNo"/>
              <generated-value generator="ORDREPLY_SEQ" strategy="SEQUENCE"/>
              <sequence-generator name="ORDREPLY_SEQ" sequence-name="ORDREPLY_SEQ" allocation-size="1"/>
         </basic>      
         </attributes>
    </entity-mappings>

    Hi folks,
    I am trying to give entity mappings in orm .xml
    Sequence generation tag is not working fine for me.
    its giving me a xml parsing error.
    can some body give me a right combination .
    I want to give automatic generation for a database
    field which is not the primary key.
    My orm.xml file is given below....
    some body pls help me....
    <?xml version="1.0" encoding="UTF-8"?>
    <entity-mappings version="1.0" xmlns="http://java.sun.com/xml/ns/persistence/orm"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://java.sun.com/xml/ns/persist
    ence/orm orm_1_0.xsd">
    <entity class="com.git.oms.common.entity.ORDReply" name="ORDReply" metadata-complete="false">
    <table name="ORDReply"/>
    <attributes>
    <basic name="serialNo">
    <column name="SerialNo"/>
    <generated-value generator="ORDREPLY_SEQ" strategy="SEQUENCE"/>
    <sequence-generator name="ORDREPLY_SEQ" sequence-name="ORDREPLY_SEQ" allocation-size="1"/>
    </basic>
    </attributes>
    </entity-mappings>I am not able to configure a sequence for a Id coloumn also.
    Getting some xml parsing error. Some one please help me by giving some sample.
    I am also using same kind of orm.xml and sequence-generator

  • Error when using CDATA in orm.xml

    Hi everyone!
    I am writing an application using TopLink Essentials. Something really weird is happening when I use CDATA sections in my orm.xml file to declare named queries.
    I declared a named query like this in my orm.xml file:
    &lt;/named-query&gt;
    &lt;named-query name="findLatestExchangeRate"&gt;
    SELECT a
    FROM ExchangeRate a
    WHERE
    a.code = :currency AND
    a.date = (SELECT MAX(b.date)
    FROM ExchangeRate b
    WHERE b.code = :currency AND b.date &amp;lt;= :before)
    &lt;/query&gt;
    &lt;/named-query&gt;
    This worked like a charm.
    Nonetheless, when I decided to use CDATA sections to declare the query and ovoid XML entities, somewhat like this:
    &lt;named-query name="findLatestExchangeRate"&gt;
    &lt;query&gt;
    &lt;![CDATA[
    SELECT a
    FROM ExchangeRate a
    WHERE
    a.code = :currency AND
    a.date = (SELECT MAX(b.date)
    FROM ExchangeRate b
    WHERE b.code = :currency AND b.date &lt;= :before)
    ]]&gt;
    &lt;/query&gt;
    &lt;/named-query&gt;
    Then the weirdest thing happen. I am not even able to create the EntityManagerFactory. I get an error that says:
    Exception in thread "main" Local Exception Stack:
    Exception [TOPLINK-8028] (Oracle TopLink Essentials - 2.0.1 (Build SNAPSHOT (02/01/2008))): oracle.toplink.essentials.exceptions.EJBQLException
    Exception Description: Syntax error parsing the query [findLatestExchangeRate:
              ], line 1, column 41: unexpected end of query.
    Internal Exception: line 1:41: unexpected token: null
    Does anyone has any idea of what could be going wrong here?
    Thanks in advance for any help you can give me.
    Edited by: [email protected] on Oct 13, 2008 1:10 PM

    I tried it in EclipseLink 1.0.1 and had no problems. I would recommend filing a bug against TopLink Essentials in case there is a known work-around.
    If you are using TopLink Essentials as a supported Oracle TopLink user please consider upgrading to Oracle TopLink 11g (includes EclipseLink) or if that is not possible please open a service request with Oracle support.
    Doug

  • JPA - generate orm.xml from existing JPA annotations

    Hi,
    Is there any tool which can be used to generate the orm.xml file from existing JPA java annotated source files?
    Thank you,
    Virgil

    Yes. Map some of the classes with JPA annotations or orm.xml, for the other leave them unmapped, and don't list them in your persistence.xml. Then in a SessionCustomizer you can load your native EclipseLink project.xml file using the XMLProjectReader, and then manually add the descriptors from the Project to the JPA EclipseLink Session using DatabaseSession.addDescriptors(Project).

  • Persistence-unit-defaults in orm.xml do not impact TopLink Essentials?

    Hi,
    I have configured a default schema in the persistence-unit-defaults section of the orm.xml mapping file:
    <persistence-unit-metadata>
         <persistence-unit-defaults>
              <schema>SCHEMA_NAME</schema>     
         </persistence-unit-defaults>
    </persistence-unit-metadata>
    The queries that TopLink JPA is generating (and logging) do not qualify any table name with the schema as configured above. It seems that the persistence-unit-default settings are ignored by TopLink JPA?
    N.B: TopLink mentions that it is searching for a file named orm.xml and that it found one - so the file should be processed by TopLink. ("Found a default mapping file at ...")
    Any ideas?

    Thank you for mentioning that workaround.
    Regarding to the results of my tests, the persistence-unit-defauls "schema" does not affect sequences? Is this part of the bug and can expected to be fixed or is the schema/owner of sequences outside the JPA spec?
    currently I found no other solution than to specify the default schema in the persistence-unit-defaults in orm.xml AND declarate all sequences used with the fully qualified name, i.e. when switching the schema this would require changing it at multiple points....
    regards,
    hans

  • JPA: Translating Annotations to Metadata (orm.xml)

    I'm trying to translate the commented annotations in the next two classes to metadata:
    package pfc.model;
    import java.io.Serializable;
    import java.util.Date;
    //import javax.persistence.*;
    //@Entity
    public class DadesComentari implements Serializable {
        //@Id
        //@Column(name = "id", nullable = false)
        private Integer id;
        //@Column(name = "accio")
        private Integer accio;
        //@Column(name = "idAutor", nullable = false)
        private String idAutor;
        //@Column(name = "perfilAutor", nullable = false)
        private Integer perfilAutor;
        //@Column(name = "dataCreacio", nullable = false)
        //@Temporal(TemporalType.TIMESTAMP)
        private Date dataCreacio;
        //@Column(name = "text", nullable = false)
        private String text;
        //@Column(name = "idIncidencia", nullable = false)
        private Integer idIncidencia;
         ...(Setters and getters)...
    package pfc.model;
    import java.io.Serializable;
    import java.util.ArrayList;
    import java.util.Date;
    //import javax.persistence.*;
    //@Entity
    public class DadesIncidencia implements Serializable {
        //@Id
        //@Column(name = "id", nullable = false)
        private Integer id;
        //@Column(name = "servAfectats", nullable = false)
        private Integer servAfectats;
        //@Column(name = "idCreador", nullable = false)
        private String idCreador;
        //@Column(name = "idTecnic")
        private String idTecnic;
        //@Column(name = "idTD")
        private String idTD;
        //@Column(name = "visitaSolicitada", nullable = false)
        private Boolean visitaSolicitada;
        //@Column(name = "dataCreacio", nullable = false)
        //@Temporal(TemporalType.TIMESTAMP)
        private Date dataCreacio;
        //@Column(name = "dataTancament")
        //@Temporal(TemporalType.TIMESTAMP)
        private Date dataTancament;
        //@Column(name = "nomClient")
        private String nomClient;
        //@Column(name = "cognomsClient")
        private String cognomsClient;
        //@Transient
        private ArrayList comentaris;
         ...(Setters and getters)...
    }To do it I have created the next file orm.xml:
    <?xml version="1.0" encoding="UTF-8" ?>
    <entity-mappings xmlns="http://java.sun.com/xml/ns/persistence/orm"
                     xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
                     xsi:schemaLocation="http://java.sun.com/xml/ns/persistence/orm http://java.sun.com/xml/ns/persistence/orm_1_0.xsd"
                     version="1.0">
        <package>pfc</package>
        <entity class="pfc.model.DadesIncidencia" name="incidencia">     
            <attributes>
                <id name="id">
                    <column name="id" nullable="false"/>
                </id>
                <basic name="servAfectats">
                    <column name="servAfectats" nullable="false"/>
                </basic>
                <basic name="dataCreacio">
                    <column name="dataCreacio" nullable="false"/>
                    <temporal>TIMESTAMP</temporal>
                </basic> 
                <basic name="dataTancament">
                    <column name="dataTancament"/>
                    <temporal>TIMESTAMP</temporal>
                </basic>
                <basic name="idCreador">
                    <column name="idCreador" nullable="false"/>
                </basic>
                <basic name="idTecnic">
                    <column name="idTecnic"/>
                </basic>
                <basic name="idTD">
                    <column name="idTD"/>
                </basic>
                <basic name="visitaSolicitada">
                    <column name="visitaSolicitada" nullable="false"/>
                </basic>
                <basic name="nomClient">
                    <column name="nomClient"/>
                </basic> 
                <basic name="cognomsClient">
                    <column name="cognomsClient"/>
                </basic>  
                <transient name="comentaris"/>
            </attributes>
        </entity>
        <entity class="pfc.model.DadesComentari" name="comentari">
            <attributes>
                <id name="id">
                    <column name="id" nullable="false"/>
                </id>           
                <basic name="idIncidencia">
                    <column name="idIncidencia" nullable="false"/>
                </basic>
                <basic name="perfilAutor">
                    <column name="perfilAutor" nullable="false"/>
                </basic>
                <basic name="idAutor">
                    <column name="idAutor" nullable="false"/>
                </basic>
                <basic name="dataCreacio">
                    <column name="dataCreacio" nullable="false"/>
                    <temporal>TIMESTAMP</temporal>
                </basic>
                <basic name="accio">
                    <column name="accio" />
                </basic>
                <basic name="text">
                    <column name="text" nullable="false"/>
                </basic>           
            </attributes>
        </entity>
    </entity-mappings>Which I reference from the persistence.xml:
    <?xml version="1.0" encoding="UTF-8"?>
    <persistence version="1.0" xmlns="http://java.sun.com/xml/ns/persistence" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/persistence http://java.sun.com/xml/ns/persistence/persistence_1_0.xsd">
        <persistence-unit name="pfc" transaction-type="RESOURCE_LOCAL">
            <provider>oracle.toplink.essentials.PersistenceProvider</provider>
            <mapping-file>pfc/model/orm.xml</mapping-file>
            <!--<class>pfc.model.DadesIncidencia</class>
        <class>pfc.model.DadesComentari</class> -->
            <properties>
                <property name="toplink.jdbc.driver" value="com.mysql.jdbc.Driver"/>
                <property name="toplink.jdbc.url" value="jdbc:mysql://localhost/pfc"/>
                <property name="toplink.jdbc.password" value=""/>
                <property name="toplink.jdbc.user" value="root"/>
            </properties>
        </persistence-unit>
    </persistence>Having done only these modifications, the next exception appears when trying to execute the application:
    Exception [TOPLINK-30005] (Oracle TopLink Essentials - 2.0 (Build b58g-fcs (09/07/2007))): oracle.toplink.essentials.exceptions.PersistenceUnitLoadingException
    Exception Description: An exception was thrown while searching for persistence archives with ClassLoader: WebappClassLoader
      delegate: false
      repositories:
        /WEB-INF/classes/
    ----------> Parent Classloader:
    org.apache.catalina.loader.StandardClassLoader@f4f44a
    Internal Exception: javax.persistence.PersistenceException: Exception [TOPLINK-28018] (Oracle TopLink Essentials - 2.0 (Build b58g-fcs (09/07/2007))): oracle.toplink.essentials.exceptions.EntityManagerSetupException
    Exception Description: predeploy for PersistenceUnit [pfc] failed.
    Internal Exception: java.lang.NullPointerException
         at oracle.toplink.essentials.exceptions.PersistenceUnitLoadingException.exceptionSearchingForPersistenceResources(PersistenceUnitLoadingException.java:143)
         at oracle.toplink.essentials.ejb.cmp3.EntityManagerFactoryProvider.createEntityManagerFactory(EntityManagerFactoryProvider.java:169)
         at javax.persistence.Persistence.createEntityManagerFactory(Persistence.java:110)
         at javax.persistence.Persistence.createEntityManagerFactory(Persistence.java:83)
         at pfc.model.DAOFactory.connectarBD(DAOFactory.java:15)
         at pfc.model.FaçanaDelModel.obtenirDadesIncidencia(FaçanaDelModel.java:33)
         at pfc.IncidenciaController.handleRequest(IncidenciaController.java:18)Anybody can see what I'm not doing properly?
    Thank you in advance, and sorry for my "still in progress" English

    There is not yet any built in support for this.
    What I have been doing is configuring JDev to understand the orm.xml schema so that when editing the file with JDeveloper it can assist me on the available elements and attributes as well as a default structure.
    JDeveloper :: Tools -> Preferences -> XML Schema -> Add
    jar:file:/C:/oracle/10.1.3.1/preview/jdev/toplink/jlib/toplink-essentials.jar!/orm_1_0.xsd
    Now when you wish to create an orm XML instance document in your project you can use:
    New -> General -> XML -> XML Document from Schema
    Select "Use Registered Schema"
    Select the ORM target namespace: http://java.sun.com/xml/ns/persistence/orm
    This will give you a basic orm.xml file properly configured which you can then use to define your mappings.
    Doug

  • Generating orm.xml

    is there any tool to generate orm.xml ?
    Thanks..

    No, as far as I know. Most IDEs are focusing on annotations. However the next releases of Dali for Eclipse and JDeveloper will provide orm.xml creation and editing support. Dali 1.0 is scheduled to be released as part of the coordinated Europa Eclipse release in June of next year--but milestone builds will be available sooner. Check out http://www.eclipse.org/dali and the milestone plan available from the sidebar on the right. The JDeveloper release date has not been finalized.
    --Shaun                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   

  • Kodo extensions in orm.xml?

    I'm evaluating Kodo for use with JPA, but I would like to use externalized mapping files. These work fine for standard "to the spec" mappings, but I'd like to be able to use some of the Kodo-specific extensions (such as custom field handlers). Is this possible within an externalized JPA mapping file (e.g. orm.xml)? All of the docs that I have found for Kodo JPA use annotations.

    "Amol" <[email protected]> writes:
    I have been going thru mails in the newsgrp, for help in my work and I
    found a lot of extensions used (r they only kodo-specific). I have gone
    thru all of the documentation tht comes with 2.2 release but havent a
    documentation for this extensions. Where can i find them.The JDO standard defines a syntax for adding vendor-specific metadata to
    the JDO metadata files. So yes, the extensions that you are referring to
    are Kodo-specific.
    Most of our vendor extensions are used for controlling the
    object-relational mapping that Kodo performs.
    Look in the metadata and existing schema sections of the 2.2.2
    documentation for more information on possible extensions. The 2.2.3
    documentation is formatted slightly differently; it contains an appendix
    with a list of all extensions supported by Kodo.
    -Patrick
    Patrick Linskey [email protected]
    SolarMetric Inc. http://www.solarmetric.com

  • Reference to superclass in orm.xml required?

    Hi,
    I've been experimenting with TopLink essentials for the past few days and am pretty impressed so far. Nice work :)
    Just one thing I noticed: it seems that if I create an orm.xml for an entity, I must include an <entity> tag for that entity's superclass even though the superclass's metadata has already been loaded from another orm.xml file. TopLink doesn't seem to demand a metadata-complete mapping for the superclass, but I was wondering if it is required by the JPA spec.
    The way my app is distributed prevents me from having a single orm.xml file.
    Roger

    I've discovered that you also need a entry for entities in relationships (or one-to-one relationships at least). Otherwise, the exception is
    Exception [TOPLINK-41] (Oracle TopLink Essentials - 2006.5 (Build 060511)):
              oracle.toplink.essentials.exceptions.DescriptorException
    Exception Description: A non-read-only mapping must be defined for the
              sequence number field.
    Descriptor: RelationalDescriptor(figbird.commerce.entities.Product -->
              [DatabaseTable(fb_metadata), DatabaseTable(FB_PRODUCTS)])

  • How to generate orm.xml

    Hi,
    I would like to know how to generate orm.xml, the mapping file for JPA. I am using jdev 10.1.3.0.4.
    Thanks in advance

    There is not yet any built in support for this.
    What I have been doing is configuring JDev to understand the orm.xml schema so that when editing the file with JDeveloper it can assist me on the available elements and attributes as well as a default structure.
    JDeveloper :: Tools -> Preferences -> XML Schema -> Add
    jar:file:/C:/oracle/10.1.3.1/preview/jdev/toplink/jlib/toplink-essentials.jar!/orm_1_0.xsd
    Now when you wish to create an orm XML instance document in your project you can use:
    New -> General -> XML -> XML Document from Schema
    Select "Use Registered Schema"
    Select the ORM target namespace: http://java.sun.com/xml/ns/persistence/orm
    This will give you a basic orm.xml file properly configured which you can then use to define your mappings.
    Doug

  • Generate of orm.xml from annotations

    Hi,
    How can a bunch of annotated classes (in JPA) can be processed so that an equivalent orm.xml is generated? The situation is like, I have many annotated Java files and I want to create equivalent orm.xml before the application is actually deployed in production.

    Hi,
    How can a bunch of annotated classes (in JPA) can be processed so that an equivalent orm.xml is generated? The situation is like, I have many annotated Java files and I want to create equivalent orm.xml before the application is actually deployed in production.

  • Cannot open persistence.xml nor orm.xml

    I had to kill JDev process after I realized Data Control could not be created on a session EJB since application was not created with JSF,EJB technology. JDev kept trying to create Data Control. I left it trying over night and in the morning I killed process. I restarted JDev and tried to open files persistence.xml and orm.xml, but JDev just showed up message "Loading...Please wait." and it was stuck with that message. I could open all other files except these two XML files.
    Is there a workaround?

    CG_AUDIO wrote:
    Has anyone been able to open a pages file that has the cannot open .xml required error?
    I opened a doc from pages'08 in pages'09 made some crucial changes saved as new name and cannot open it again now.
    I tried opening in '08 and of course no luck.
    I just finished 3 hours of writing and cannot do that again!!!
    3 hours of writing without no intermediate save in different files is silly.
    Attach the file to a mail
    send them to my maibox.
    I will try to revive the raw text.
    Click my blue name to get my address.
    IMPORTANT: search for the keystring _"backup, backup"_ in existing threads !
    Yvan KOENIG (VALLAURIS, France.) jeudi 20 août 2009 20:09:19

  • Problem with Persistence.xml in JDev final after migration

    Hi,
    I am trying to migrate a current project from JDev 11gTp4 to the JDev production release. When deploying the EJB module I get the following problem though (Stack from DefaultServer.log)
    weblogic.application.ModuleException: Exception preparing module: EJBModule(Nexus-NexusModel-ejb)
         at weblogic.ejb.container.deployer.EJBModule.prepare(EJBModule.java:452)
         at weblogic.application.internal.flow.ModuleListenerInvoker.prepare(ModuleListenerInvoker.java:93)
         at weblogic.application.internal.flow.DeploymentCallbackFlow$1.next(DeploymentCallbackFlow.java:387)
         at weblogic.application.utils.StateMachineDriver.nextState(StateMachineDriver.java:37)
         at weblogic.application.internal.flow.DeploymentCallbackFlow.prepare(DeploymentCallbackFlow.java:58)
         at weblogic.application.internal.flow.DeploymentCallbackFlow.prepare(DeploymentCallbackFlow.java:42)
         at weblogic.application.internal.BaseDeployment$1.next(BaseDeployment.java:615)
         at weblogic.application.utils.StateMachineDriver.nextState(StateMachineDriver.java:37)
         at weblogic.application.internal.BaseDeployment.prepare(BaseDeployment.java:191)
         at weblogic.application.internal.EarDeployment.prepare(EarDeployment.java:16)
         at weblogic.application.internal.DeploymentStateChecker.prepare(DeploymentStateChecker.java:155)
         at weblogic.deploy.internal.targetserver.AppContainerInvoker.prepare(AppContainerInvoker.java:60)
         at weblogic.deploy.internal.targetserver.operations.ActivateOperation.createAndPrepareContainer(ActivateOperation.java:197)
         at weblogic.deploy.internal.targetserver.operations.ActivateOperation.doPrepare(ActivateOperation.java:89)
         at weblogic.deploy.internal.targetserver.operations.AbstractOperation.prepare(AbstractOperation.java:217)
         at weblogic.deploy.internal.targetserver.DeploymentManager.handleDeploymentPrepare(DeploymentManager.java:723)
         at weblogic.deploy.internal.targetserver.DeploymentManager.prepareDeploymentList(DeploymentManager.java:1190)
         at weblogic.deploy.internal.targetserver.DeploymentManager.handlePrepare(DeploymentManager.java:248)
         at weblogic.deploy.internal.targetserver.DeploymentServiceDispatcher.prepare(DeploymentServiceDispatcher.java:159)
         at weblogic.deploy.service.internal.targetserver.DeploymentReceiverCallbackDeliverer.doPrepareCallback(DeploymentReceiverCallbackDeliverer.java:157)
         at weblogic.deploy.service.internal.targetserver.DeploymentReceiverCallbackDeliverer.access$000(DeploymentReceiverCallbackDeliverer.java:12)
         at weblogic.deploy.service.internal.targetserver.DeploymentReceiverCallbackDeliverer$1.run(DeploymentReceiverCallbackDeliverer.java:45)
         at weblogic.work.SelfTuningWorkManagerImpl$WorkAdapterImpl.run(SelfTuningWorkManagerImpl.java:516)
         at weblogic.work.ExecuteThread.execute(ExecuteThread.java:201)
         at weblogic.work.ExecuteThread.run(ExecuteThread.java:173)
    java.lang.UnsupportedOperationException: This parser does not support specification "null" version "null"
         at javax.xml.parsers.DocumentBuilderFactory.setSchema(DocumentBuilderFactory.java:561)
         at weblogic.xml.jaxp.RegistryDocumentBuilder.setupDocumentBuilderFactory(RegistryDocumentBuilder.java:393)
         at weblogic.xml.jaxp.RegistryDocumentBuilder.getDefaultDocumentBuilderFactory(RegistryDocumentBuilder.java:359)
         at weblogic.xml.jaxp.RegistryDocumentBuilder.getDocumentBuilder(RegistryDocumentBuilder.java:298)
         at weblogic.xml.jaxp.RegistryDocumentBuilder.parse(RegistryDocumentBuilder.java:150)
         at org.eclipse.persistence.platform.xml.jaxp.JAXPParser.parse(JAXPParser.java:163)
         at org.eclipse.persistence.platform.xml.jaxp.JAXPParser.parse(JAXPParser.java:197)
         at org.eclipse.persistence.internal.oxm.record.DOMUnmarshaller.unmarshal(DOMUnmarshaller.java:213)
         at org.eclipse.persistence.oxm.XMLUnmarshaller.unmarshal(XMLUnmarshaller.java:309)
         at org.eclipse.persistence.internal.jpa.metadata.xml.XMLEntityMappingsReader.read(XMLEntityMappingsReader.java:72)
         at org.eclipse.persistence.internal.jpa.metadata.xml.XMLEntityMappingsReader.read(XMLEntityMappingsReader.java:112)
         at org.eclipse.persistence.internal.jpa.metadata.MetadataProcessor.loadStandardMappingFiles(MetadataProcessor.java:343)
         at org.eclipse.persistence.internal.jpa.metadata.MetadataProcessor.loadMappingFiles(MetadataProcessor.java:271)
         at org.eclipse.persistence.internal.jpa.deployment.PersistenceUnitProcessor.processORMetadata(PersistenceUnitProcessor.java:294)
         at org.eclipse.persistence.internal.jpa.EntityManagerSetupImpl.predeploy(EntityManagerSetupImpl.java:830)
         at org.eclipse.persistence.jpa.PersistenceProvider.createContainerEntityManagerFactory(PersistenceProvider.java:189)
         at weblogic.deployment.PersistenceUnitInfoImpl.createEntityManagerFactory(PersistenceUnitInfoImpl.java:330)
         at weblogic.deployment.PersistenceUnitInfoImpl.<init>(PersistenceUnitInfoImpl.java:123)
         at weblogic.deployment.AbstractPersistenceUnitRegistry.storeDescriptors(AbstractPersistenceUnitRegistry.java:331)
         at weblogic.deployment.AbstractPersistenceUnitRegistry.loadPersistenceDescriptor(AbstractPersistenceUnitRegistry.java:245)
         at weblogic.deployment.ModulePersistenceUnitRegistry.<init>(ModulePersistenceUnitRegistry.java:63)
         at weblogic.ejb.container.deployer.EJBModule.setupPersistenceUnitRegistry(EJBModule.java:209)
         at weblogic.ejb.container.deployer.EJBModule$1.execute(EJBModule.java:310)
         at weblogic.deployment.PersistenceUnitRegistryInitializer.setupPersistenceUnitRegistries(PersistenceUnitRegistryInitializer.java:62)
         at weblogic.ejb.container.deployer.EJBModule.prepare(EJBModule.java:376)
         at weblogic.application.internal.flow.ModuleListenerInvoker.prepare(ModuleListenerInvoker.java:93)
         at weblogic.application.internal.flow.DeploymentCallbackFlow$1.next(DeploymentCallbackFlow.java:387)
         at weblogic.application.utils.StateMachineDriver.nextState(StateMachineDriver.java:37)
         at weblogic.application.internal.flow.DeploymentCallbackFlow.prepare(DeploymentCallbackFlow.java:58)
         at weblogic.application.internal.flow.DeploymentCallbackFlow.prepare(DeploymentCallbackFlow.java:42)
         at weblogic.application.internal.BaseDeployment$1.next(BaseDeployment.java:615)
         at weblogic.application.utils.StateMachineDriver.nextState(StateMachineDriver.java:37)
         at weblogic.application.internal.BaseDeployment.prepare(BaseDeployment.java:191)
         at weblogic.application.internal.EarDeployment.prepare(EarDeployment.java:16)
         at weblogic.application.internal.DeploymentStateChecker.prepare(DeploymentStateChecker.java:155)
         at weblogic.deploy.internal.targetserver.AppContainerInvoker.prepare(AppContainerInvoker.java:60)
         at weblogic.deploy.internal.targetserver.operations.ActivateOperation.createAndPrepareContainer(ActivateOperation.java:197)
         at weblogic.deploy.internal.targetserver.operations.ActivateOperation.doPrepare(ActivateOperation.java:89)
         at weblogic.deploy.internal.targetserver.operations.AbstractOperation.prepare(AbstractOperation.java:217)
         at weblogic.deploy.internal.targetserver.DeploymentManager.handleDeploymentPrepare(DeploymentManager.java:723)
         at weblogic.deploy.internal.targetserver.DeploymentManager.prepareDeploymentList(DeploymentManager.java:1190)
         at weblogic.deploy.internal.targetserver.DeploymentManager.handlePrepare(DeploymentManager.java:248)
         at weblogic.deploy.internal.targetserver.DeploymentServiceDispatcher.prepare(DeploymentServiceDispatcher.java:159)
         at weblogic.deploy.service.internal.targetserver.DeploymentReceiverCallbackDeliverer.doPrepareCallback(DeploymentReceiverCallbackDeliverer.java:157)
         at weblogic.deploy.service.internal.targetserver.DeploymentReceiverCallbackDeliverer.access$000(DeploymentReceiverCallbackDeliverer.java:12)
         at weblogic.deploy.service.internal.targetserver.DeploymentReceiverCallbackDeliverer$1.run(DeploymentReceiverCallbackDeliverer.java:45)
         at weblogic.work.SelfTuningWorkManagerImpl$WorkAdapterImpl.run(SelfTuningWorkManagerImpl.java:516)
         at weblogic.work.ExecuteThread.execute(ExecuteThread.java:201)
         at weblogic.work.ExecuteThread.run(ExecuteThread.java:173)
    My persistence.xml looks like
    <?xml version="1.0" encoding="windows-1252" ?>
    <persistence xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://java.sun.com/xml/ns/persistence http://java.sun.com/xml/ns/persistence/persistence_1_0.xsd"
    version="1.0" xmlns="http://java.sun.com/xml/ns/persistence">
    <persistence-unit name="Nexus-ejbPU">
    <provider>
    org.eclipse.persistence.jpa.PersistenceProvider
    </provider>
    <jta-data-source>
    jdbc/NexusPoolDS
    </jta-data-source>
    <mapping-file>
    META-INF/orm.xml
    </mapping-file>
    <properties>
    <property name="eclipselink.target-server" value="WebLogic_10"/>
    <property name="eclipselink.logging.file" value="Toplink.log"/>
    <property name="eclipselink.logging.timestamp" value="true"/>
    <property name="eclipselink.logging.exceptions" value="true"/>
    <property name="eclipselink.logging.session" value="true"/>
    </properties>
    </persistence-unit>
    </persistence>
    orm.xml looks like this
    <?xml version="1.0" encoding="windows-1252" ?>
    <entity-mappings xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://java.sun.com/xml/ns/persistence/orm http://java.sun.com/xml/ns/persistence/orm_1_0.xsd"
    version="1.0"
    xmlns="http://java.sun.com/xml/ns/persistence/orm">
    <persistence-unit-metadata>
    <persistence-unit-defaults>
    <schema>
    XXX
    </schema>
    </persistence-unit-defaults>
    </persistence-unit-metadata>
    <package>
    za.co.medscheme.model.persistence.xxx
    </package>
    <schema>
    XXX
    </schema>
    </entity-mappings>
    I have noticed that the persistence.xml file have changed quite drastically from the version we had in TP4 release during project upgrade, but can not explain the problem we are getting. I have also tried to just create a dummy project and create a persistence unit, and the file looks exactly the same afterwards. Any thoughts?
    Drikus

    Just thought I would add a temporary solution to the problem for those of you sitting with the same issue.
    In the root folder of your application you will find a src folder with a meta-inf folder and weblogic-application.xml inside.
    Add the following before the closing weblogic-application tag...
    <xml>
    <parser-factory>
    <saxparser-factory>
    weblogic.xml.jaxp.WebLogicSAXParserFactory
    </saxparser-factory>
    <document-builder-factory>
    weblogic.xml.jaxp.WebLogicDocumentBuilderFactory
    </document-builder-factory>
    <transformer-factory>
    weblogic.xml.jaxp.WebLogicSAXTransformerFactory
    </transformer-factory>
    </parser-factory>
    </xml>
    If there wasnt an xml tag in the file, it seems that JDeveloper somehow adds one on the fly for you pointing to an oracle xml parser that does not contain the setSchema method required by weblogic on deployment.
    Hope this helps anybody else that has this problem.
    Regards
    Drikus Britz

  • Help on creating a ServerSession in Eclipse with XML file

    Hi,
    I am using Toplink in Eclipse with Tomcat/Apache (or at least trying to :)
    I am trying to make the following code work:
    Project myProject = XMLProjectReader.read("myproject.xml");
    Server serverSession = myProject.createServerSession();
    but I get an exception:
    {color:#ff0000} +"7099", "The deployment project xml resource {0} was not found on the resource path. Check that the resource name/path and classloader passed to the XMLProjectReader are correct. The project xml should be included in the root of the application's deployed jar, if the project xml is deployed in a sub-directory in the application's jar ensure that the correct resource path using \"/\" not \"\\" is used."+ {color}
    - I think the project cannot find the xml file in my project - but I was never sure where this should go in any case - I put it in the META-INF folder but made no difference. Where should I put these xml files?
    Any help much appreciated

    Simon,
    Hi, I assume you are deploying a WAR to Tomcat. The following tutorial on running TopLink using the org.eclipse.persistence.jpa.PersistenceProvider is pure JPA but deals with the same deployment issues.
    In particular note that there are two META-INF directories - we want to use only the one off of src.
    "Make sure that your persistence.xml (and optionaly orm.xml) file is placed off of the src/META-INF directory and not the default WebContent/META-INF dir so that it gets picked up by the servlet classloader from the classes directory."
    http://wiki.eclipse.org/EclipseLink/Examples/JPA/Tomcat_Web_Tutorial#persistence.xml
    thank you
    /michael
    http://www.eclipselink.org

  • XML file parse issue

    I have a requirement to print <attribute-override> and <column> in a spreadsheet.
    My xml file is as
    <?xml version="1.0" encoding="UTF-8"?>
    <entity-mappings xmlns="http://www.eclipse.org/eclipselink/xsds/persistence/orm" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.eclipse.org/eclipselink/xsds/persistence/orm http://www.eclipse.org/eclipselink/xsds/eclipselink_orm_2_4.xsd">
      <entity class="com.ofss.fc.domain.account.entity.accountcreditmatrix.CreditMetricDetails">
        <table name="FLX_AC_ACCT_CREDIT_MATRIX_DTLS"/>
        <attributes>
          <embedded-id attribute-type="com.ofss.fc.domain.account.entity.accountcreditmatrix.CreditMetricDetailsKey" name="key">
            <attribute-override name="accountId">
              <column name="ACCOUNT_ID"/>
            </attribute-override>
            <attribute-override name="accountType">
              <column name="ACCOUNT_TYPE"/>
            </attribute-override>
            <attribute-override name="effectiveDate">
              <column name="EFFECTIVE_DATE"/>
            </attribute-override>
            <attribute-override name="matrixIdvalue">
              <column name="MATRIX_ID_VALUE"/>
            </attribute-override>
            <attribute-override name="classification">
              <column name="Classification"/>
            </attribute-override>
          </embedded-id>
          <embedded attribute-type="com.ofss.fc.domain.account.entity.accountcreditmatrix.CreditMetric" name="creditMetric">
            <attribute-override name="metricType">
              <column name="METRIC_TYPE" unique="false"/>
            </attribute-override>
            <attribute-override name="metricValue">
              <column name="METRIC_VALUE" unique="false"/>
            </attribute-override>
          </embedded>
          <embedded attribute-type="com.ofss.fc.domain.account.entity.accountcreditmatrix.RiskScore" name="riskScore">
            <attribute-override name="scoreType">
              <column name="SCORE_TYPE" unique="false"/>
            </attribute-override>
            <attribute-override name="otherScoreType">
              <column name="OTHER_SCORE_TYPE" unique="false"/>
            </attribute-override>
            <attribute-override name="scoreCardExternalReferenceNo">
              <column name="SCORE_EXTR_REF_NO" unique="false"/>
            </attribute-override>
            <attribute-override name="ratingModel">
              <column name="RATING_MODEL" unique="false"/>
            </attribute-override>
            <attribute-override name="ratingStatus">
              <column name="RATING_STATUS" unique="false"/>
            </attribute-override>
            <attribute-override name="riskGrade">
              <column name="RISK_GRADE" unique="false"/>
            </attribute-override>
            <attribute-override name="scoreCardIndex">
              <column name="SCORE_CARD_INDEX" unique="false"/>
            </attribute-override>
            <attribute-override name="score">
              <column name="SCORE" unique="false"/>
            </attribute-override>
          </embedded>
        </attributes>
      </entity>
    </entity-mappings>
    I have managed to write the code as
    package xmlexcel;
    import org.apache.poi.hssf.usermodel.*;
    import java.util.ArrayList;
    import java.awt.List;
    import java.io.*;
    import java.util.ArrayList;
    import javax.xml.parsers.DocumentBuilder;
    import javax.xml.parsers.DocumentBuilderFactory;
    import javax.xml.parsers.ParserConfigurationException;
    import org.xml.sax.SAXException;
    import org.apache.poi.hssf.usermodel.HSSFCell;
    import org.apache.poi.hssf.usermodel.HSSFRow;
    import org.apache.poi.hssf.usermodel.HSSFSheet;
    import org.apache.poi.hssf.usermodel.HSSFWorkbook;
    import org.w3c.dom.Document;
    import org.w3c.dom.Element;
    import org.w3c.dom.Node;
    import org.w3c.dom.NodeList;
    public class XMLconvertExcel {
      private static File xmlDocument;
        private static NodeList e;
        int a;
      public void generateExcel(File xmlDocument) {
      try {
      HSSFWorkbook wb = new HSSFWorkbook();
      HSSFSheet spreadSheet = wb.createSheet("spreadSheet");
      spreadSheet.setColumnWidth((short)0,(short) (256*25));
      spreadSheet.setColumnWidth((short)1,(short) (256*25));
      spreadSheet.setColumnWidth((short)2,(short) (256*25));
      spreadSheet.setColumnWidth((short)3,(short) (256*25));
      DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
      DocumentBuilder builder = factory.newDocumentBuilder();
      Document document = builder.parse(xmlDocument);
      NodeList nList = document.getElementsByTagName("attributes");
      document.getDocumentElement().normalize();
      //a=nodelist.getLength();
      //e = printStackTrace();
      //System.out.println("I am here " +e);
             System.out.println("Root element :" + document.getDocumentElement().getNodeName() + " nlist length  " +nList.getLength());
             System.out.println("Node Type :" + document.getDocumentElement().getNodeType());
      HSSFRow row = spreadSheet.createRow(0);
      HSSFCell cell = row.createCell((short)0);
      cell.setCellValue("Entity");
      cell = row.createCell((short)1);
      cell.setCellValue("Table");
      cell = row.createCell((short)2);
      cell.setCellValue("Attribute");
      cell = row.createCell((short)3);
      cell.setCellValue("Column");
      HSSFRow row1 = spreadSheet.createRow(1);
      HSSFRow row2 = spreadSheet.createRow(2);
      HSSFRow row3 = spreadSheet.createRow(3);
      for (int i = 0; i < nList.getLength(); i++) {
      Node nNode = nList.item(i);
                 System.out.println("\nCurrent Element :"    + nNode.getNodeName());
                 switch {
      case 0:
      //cell = row1.createCell((short)0);
      //cell.setCellValue("Attribute");
      //trying from http://architects.dzone.com/articles/parsing-xml-using-dom-sax-and
      cell = row1.createCell((short) 2);
                    cell.setCellValue(((Element) (nList.item(0)))
                       .getElementsByTagName("attribute-override").item(0)
                       .getFirstChild().getNodeValue());
      break;
      case 1:
      //cell = row1.createCell((short)1);
      //cell.setCellValue("Table");
      cell = row1.createCell((short) 3);
      cell.setCellValue(((Element) (nList.item(0)))
      .getElementsByTagName("column").item(0)
      .getFirstChild().getNodeValue());
      break;
      case 2:
      cell = row1.createCell((short)2);
      cell.setCellValue("Attribute");
      cell = row1.createCell((short) 2);
      cell.setCellValue(((Element) (nodelist.item(2)))
      .getElementsByTagName("attribute-override").item(0)
      .getFirstChild().getNodeValue());
      cell = row1.createCell((short)3);
      cell.setCellValue("Column");
      cell = row1.createCell((short) 3);
      cell.setCellValue(((Element) (nodelist.item(3)))
      .getElementsByTagName("column").item(0)
      .getFirstChild().getNodeValue());
      break;
      default:
      break;
      //wb.write(arg1.getOutputPayload().getOutputStream());
      //Outputting to Excel spreadsheet
      FileOutputStream output = new FileOutputStream(new File("C:\\java_training\\com\\XMLtoExcel\\ormaccount.xls"));
             wb.write(output);
             output.flush();
             output.close();
      } catch (IOException e) {
      System.out.println("IOException " + e.getMessage());
      } catch (ParserConfigurationException e) {
      System.out.println("ParserConfigurationException " +e.getMessage());
      }catch (SAXException e) {
      System.out.println("SAXException " +e.getMessage());
      private String printStackTrace() {
      // TODO Auto-generated method stub
      return null;
      * @param args
      public static void main(String[] args) {
      File xmlDocument = new File("C:\\java_training\\com\\XMLtoExcel\\AccountCreditMatrixDetails.orm.xml");
      XMLconvertExcel excel = new XMLconvertExcel();
      excel.generateExcel(xmlDocument);
    Both the tags are not getting printed in separate columns.
    I have looked at
    http://www.javaworld.com/article/2076189/enterprise-java/book-excerpt--converting-xml-to-spreadsheet--and-vice-versa.html
    http://scn.sap.com/thread/3224533
    http://www.tutorialspoint.com/java_xml/java_dom_parse_document.htm
    The above URL shows example of simple xml.
    Please can I get assistance.

    I too received this error as I tried to run my first Windows 8.1 deployment. Per another post I commented out this line
    <IEWelcomeMsg>false</IEWelcomeMsg>
    from the IE section of the unattend.xml. I was then able to run my deployment. I do not see this line in your posting though.
    I referenced this link even though it was for Windows 7.
    http://social.technet.microsoft.com/Forums/en-US/c41a2b69-a591-4cd3-86ab-6a0f8a73b858/getting-windows-could-not-parse-or-process-the-unattend-answer-file-for-pass-specialize-with?forum=mdt
    Hope this helps someone.
    JayTheTech
    To clarify, I edited the unattend.xml file from from Deployment Share, not C:\Windows\Panther.
    DS\control\task sequence ID\unattend.xml
    JayTheTech

Maybe you are looking for

  • Adobe digital editions will not open

    I all of a sudden keep having this error pop up every time I try and open Adobe Digital Editions. It used to work fine and suddenly won't anymore. The computer is using windows 7 home premium 64 bit operating system. I can't even even put books on my

  • Camera Raw Sluggish in CS5 vs CS4

    My computer is Windows Vista Home Premium, 64-bit.  Quad Core Q6600, 2.4 GHz, 6gb RAM. When running Photoshop CS4 with Bridge and Camera Raw, I could change any of the settings, and the preview would update pretty much instantaneously, with no lag. I

  • Oops programming in abap

    hi,    i need oops programming in abap where in i need only programmin and coding tecnique strictly(dont want theory)means where oops programming needs in reporting,alv and bdc ,i need only programming related material,so if any body having the conne

  • Can't edit the message popup in teststand 4.2.1

    Hi, I installed the 2010 version of TestStand on my PC. Everything has been fine until today. Every time i try to edit a property loader I get the following error: Error in cal to LoadPanelEx. Parent Panel Handel: 0 UIR File Name: PropertyLoaderUI.ui

  • Segmentation Fault while starting weblogic server - Weblogic 6.0-6.1 on RedHat Linux

    Hi, I have this problem with 6.0 and 6.1 : Can you help me please ?