No, only one persistence.xml file per PU. The PU can comprise of classes
and other configuration files (e.g. orm.xml) spread across several jars.
I hope you are not confusing orm.xml with persistence.xml.
The spec supports persistence.xml in a directory in classpath.
Sahoo
Farrukh Najmi wrote:
> The spec says:
>
> "A persistence unit may be packaged within *one or more* jar files
> contained within a WAR or EAR, as a
> set of classes within an EJB-JAR file or in the WAR classes directory,
> or as a combination of these as
> defined below."
>
> Notice the "one or more" above. It leads me to believe that a
> persistence unit may be defined in more than one persistence.xml files.
>
> My question is whether the spec supports having one of these
> persistence.xml files in a directory in the classpath (and not in a
> jar, war, ear etc.).
>
> Thanks for your help.
>
> Sahoo wrote:
>> There is one persistence.xml per persistence-unit.
>> META-INF/persistence.xml can be anywhere in the classpath as long as
>> it contains the list of persistence class names. Look at chapter #6.2
>> of the JPA 1.0 spec.
>>
>> Thanks,
>> Sahoo
>>
>> Farrukh Najmi wrote:
>>>
>>> I have a base project (base-project) that produces a jar with
>>> persistence classes and a META-INF/persistence.xml file.
>>>
>>> Next, I want to use a standalone test program that depends upon the
>>> base-project.jar for persistence classes and wish to add additional
>>> persistence.xml files (to add entity listeners and perhaps
>>> additional persistence classes etc.).
>>>
>>> Does the spec require that any additional persistence.xml files be
>>> in a jar/war etc. or can it be anywhere in the classpath including
>>> under a directory in classpath?
>>>
>>> Specifically, is it legal to place it in META-INF/persistence.xml in
>>> any directory on the classpath and expect it to be processed by the
>>> Persistence provider?
>>>
>>> TIA for your help.
>>>
>
>