1. You should *not* use jar-file in your persistence.xml file in Java SE
environment, for that may not be supported in Java SE environment by all
providers.
2. You don't need to specify META-INF/orm.xml in persistence.xml file if
it is located in the root of the PU, i.e., it is next to persistence.xml
file.
3. Behavior for multiple mapping files by the same name is not well
defined in the spec. GlassFish provider throws an exception in such a case.
Sahoo
Farrukh Najmi wrote:
> Farrukh Najmi wrote:
>> Sahoo wrote:
>>> Entity listener information can be supplied in O/R mapping XML file
>>> like orm.xml. You can have a provision for a mapping file in your
>>> persistence.xml file by adding a <mapping-file> entry in
>>> persistence.xml of base-project.jar. You can populate the content of
>>> that mapping file as per your need and install it in classpath. If
>>> you don't want any listeners, just install a valid, empty mapping
>>> file. Again, take a look at the spec for more details about mapping
>>> file.
>>
>> I need one more clarification on this...
>>
>> The spec says:
>>
>> "
>> Example 2:
>>
>> <persistence-unit name="OrderManagement2">
>> <mapping-file>mappings.xml</mapping-file>
>> </persistence-unit>
>>
>> A persistence unit named OrderManagement2 is created. Any annotated
>> managed persistence
>> classes found in the root of the persistence unit are added to the
>> list of managed persistence classes. The
>> mappings.xml resource exists on the classpath and any classes and
>> mapping information contained
>> in it are used as specified above. *If a META-INF/orm.xml file
>> exists*, any classes and mapping infor-
>> mation contained in it are used as well. The transaction type, data
>> source, and provider are as described
>> above.
>> "
>>
>> Above implies that I do not need to explicitly reference the orm.xml
>> file using mapping-file if it is in the right place. Am I correct in
>> my interpretation?
>>
>> If so, where does the META-INF/orm.xml file have to exist?
>> Can if be in any jar or classpath directory (not reference via
>> <jar-file> tag in persistence.xml)?
>>
>> Thanks again for your kind help.
>>
>
> Also what if multiple META-INF/orm.xml files are found in the jars /
> classpath?
> What are the semantics for that?
>