This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.

Bug 170348 - persistence.xml: mapping-file element
Summary: persistence.xml: mapping-file element
Status: NEW
Alias: None
Product: xml
Classification: Unclassified
Component: Code (show other bugs)
Version: 6.x
Hardware: All All
: P3 blocker (vote)
Assignee: issues@xml
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2009-08-13 22:28 UTC by vladperl
Modified: 2009-09-16 16:28 UTC (History)
1 user (show)

See Also:
Issue Type: ENHANCEMENT
Exception Reporter:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description vladperl 2009-08-13 22:28:38 UTC
When I run "validate XML" of my persistence.xml I got the following errors:

-------------------------------------------------------------
XML validation started.
Checking file:/D:/SPS/project/patient-service-gf3/src/conf/persistence.xml...
cvc-complex-type.2.4.a: Invalid content was found starting with element 'mapping-file'. One of
'{"http://java.sun.com/xml/ns/persistence":jar-file, "http://java.sun.com/xml/ns/persistence":class,
"http://java.sun.com/xml/ns/persistence":exclude-unlisted-classes, "http://java.sun.com/xml/ns/persistence":properties}'
is expected. [14] 
cvc-complex-type.2.4.a: Invalid content was found starting with element 'mapping-file'. One of
'{"http://java.sun.com/xml/ns/persistence":jar-file, "http://java.sun.com/xml/ns/persistence":class,
"http://java.sun.com/xml/ns/persistence":exclude-unlisted-classes, "http://java.sun.com/xml/ns/persistence":properties}'
is expected. [26] 
cvc-complex-type.2.4.a: Invalid content was found starting with element 'mapping-file'. One of
'{"http://java.sun.com/xml/ns/persistence":jar-file, "http://java.sun.com/xml/ns/persistence":class,
"http://java.sun.com/xml/ns/persistence":exclude-unlisted-classes, "http://java.sun.com/xml/ns/persistence":properties}'
is expected. [38] 
cvc-complex-type.2.4.a: Invalid content was found starting with element 'mapping-file'. One of
'{"http://java.sun.com/xml/ns/persistence":jar-file, "http://java.sun.com/xml/ns/persistence":class,
"http://java.sun.com/xml/ns/persistence":exclude-unlisted-classes, "http://java.sun.com/xml/ns/persistence":properties}'
is expected. [50] 
cvc-complex-type.2.4.a: Invalid content was found starting with element 'mapping-file'. One of
'{"http://java.sun.com/xml/ns/persistence":jar-file, "http://java.sun.com/xml/ns/persistence":class,
"http://java.sun.com/xml/ns/persistence":exclude-unlisted-classes, "http://java.sun.com/xml/ns/persistence":properties}'
is expected. [62] 
XML validation finished.
------------------------------------------------------------------

And because of those errors I can't deploy the application to Glassfish 3.0 (build 59).
Deployment to Glassfish Prelude works without any problem.

I'm using NetBeans IDE Dev (Build 200908130201)


Here is my 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="lmap-access" transaction-type="JTA">
    <jta-data-source>jdbc/lmap-access</jta-data-source>
    <jar-file>lib/access-control-lib.jar</jar-file>
    <properties/>
  </persistence-unit>
  <persistence-unit name="lmap-enterprise" transaction-type="JTA">
    <jta-data-source>jdbc/lmap-enterprise</jta-data-source>
  </persistence-unit>
  <persistence-unit name="midwood" transaction-type="JTA">
    <jta-data-source>jdbc/midwood</jta-data-source>
    <jar-file>lib/medenterprise-domain.jar</jar-file>
    <mapping-file>META-INF/medenterprise.xml</mapping-file>
    <jar-file>lib/patient-service-domain.jar</jar-file>
    <mapping-file>META-INF/patient-service.xml</mapping-file>
    <jar-file>lib/medical-billing-domain.jar</jar-file>
    <mapping-file>META-INF/medical-billing.xml</mapping-file>
    <properties>
      <property name="eclipselink.cache.shared.default" value="false"/>
    </properties>
  </persistence-unit>
  <persistence-unit name="benson" transaction-type="JTA">
    <jta-data-source>jdbc/benson</jta-data-source>
    <jar-file>lib/medenterprise-domain.jar</jar-file>
    <mapping-file>META-INF/medenterprise.xml</mapping-file>
    <jar-file>lib/patient-service-domain.jar</jar-file>
    <mapping-file>META-INF/patient-service.xml</mapping-file>
    <jar-file>lib/medical-billing-domain.jar</jar-file>
    <mapping-file>META-INF/medical-billing.xml</mapping-file>
    <properties>
      <property name="eclipselink.cache.shared.default" value="false"/>
    </properties>
  </persistence-unit>
  <persistence-unit name="canarsie" transaction-type="JTA">
    <jta-data-source>jdbc/canarsie</jta-data-source>
    <jar-file>lib/medenterprise-domain.jar</jar-file>
    <mapping-file>META-INF/medenterprise.xml</mapping-file>
    <jar-file>lib/patient-service-domain.jar</jar-file>
    <mapping-file>META-INF/patient-service.xml</mapping-file>
    <jar-file>lib/medical-billing-domain.jar</jar-file>
    <mapping-file>META-INF/medical-billing.xml</mapping-file>
    <properties>
      <property name="eclipselink.cache.shared.default" value="false"/>
    </properties>
  </persistence-unit>
  <persistence-unit name="avez" transaction-type="JTA">
    <jta-data-source>jdbc/avez</jta-data-source>
    <jar-file>lib/medenterprise-domain.jar</jar-file>
    <mapping-file>META-INF/medenterprise.xml</mapping-file>
    <jar-file>lib/patient-service-domain.jar</jar-file>
    <mapping-file>META-INF/patient-service.xml</mapping-file>
    <jar-file>lib/medical-billing-domain.jar</jar-file>
    <mapping-file>META-INF/medical-billing.xml</mapping-file>
    <properties>
      <property name="eclipselink.cache.shared.default" value="false"/>
    </properties>
  </persistence-unit>
  <persistence-unit name="jns" transaction-type="JTA">
    <jta-data-source>jdbc/jns</jta-data-source>
    <jar-file>lib/medenterprise-domain.jar</jar-file>
    <mapping-file>META-INF/medenterprise.xml</mapping-file>
    <jar-file>lib/patient-service-domain.jar</jar-file>
    <mapping-file>META-INF/patient-service.xml</mapping-file>
    <jar-file>lib/medical-billing-domain.jar</jar-file>
    <mapping-file>META-INF/medical-billing.xml</mapping-file>
    <properties>
      <property name="eclipselink.cache.shared.default" value="false"/>
    </properties>
  </persistence-unit>
</persistence>
Comment 1 vladperl 2009-08-14 16:37:35 UTC
After placing all <mapping-file> elements before <jar-file> elements every things started work.
XML validation was successful and application was deployed without problem to Glassfish 3 (build 59).
Anyway I believe the issue must be fixed because specification didn't specify explicitly that  
<mapping-file> element should be always located before <jar-file> element.

    <mapping-file>META-INF/medenterprise.xml</mapping-file>
    <mapping-file>META-INF/patient-service.xml</mapping-file>
    <mapping-file>META-INF/medical-billing.xml</mapping-file>
    <jar-file>lib/medenterprise-domain.jar</jar-file>
    <jar-file>lib/patient-service-domain.jar</jar-file>
    <jar-file>lib/medical-billing-domain.jar</jar-file>
Comment 2 Sergey Petrov 2009-09-14 12:00:56 UTC
<xsd:sequence> Element

Requires the elements in the group to appear in the specified sequence within the containing element.

xsd is part of specification,

mapping-file and jar-file are in sequence elements.
Comment 3 vladperl 2009-09-15 04:09:04 UTC
> mapping-file and jar-file are in sequence elements.

Then related editor should enforce this rule :)
Comment 4 Sergey Petrov 2009-09-15 05:32:46 UTC
which one editor, xml or design?
I don't see support for mapped-file/jar in design view, and in xml editor you can enter anything you want manually
without any restrictions
Comment 5 vladperl 2009-09-16 03:45:44 UTC
I'm suggesting to enforce some restrictions in xml editor. For example not allow to create tag "mapping-file" below
"jar-file" tag. XML Spy has this kind of restrictions and that working good.
Comment 6 Sergey Petrov 2009-09-16 05:15:29 UTC
then it's more like enhancement request for xml
Comment 7 vladperl 2009-09-16 16:28:36 UTC
>then it's more like enhancement request for xml
You are right it's enhancement. Thank you for supporting idea!