Mulptiple PersistenceUnit within the Persistence.xml

Latest response

Caused by: java.lang.IllegalArgumentException: JBAS011470: Persistence unitName was not specified and there are 2 persistence unit definitions in application deployment deployment "xyz-1.0.ear". Either change the application deployment to have only one persistence unit definition or specify the unitName for each reference to a persistence unit.

The Structure of the persistence.xml looks like the following

persistence 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_2_0.xsd"
version="2.0">

<persistence-unit name="appPersistenceUnit1" transaction-type="JTA">       
   <jta-data-source>java:jboss/datasources/FedDS1</jta-data-source>
    <jar-file>XYZServices-1.0.jar</jar-file>      
    <class>xyz.data.entities.Event</class>   
</persistence-unit>

java:jboss/datasources/FedDS2
XYZServices-1.0.jar
xyz.data.entities.Event

The persistence.xml resides in the ear.

Responses

Hi Deepali,

Could you please provide some more information about your issue? For example, what product are you using?

Close

Welcome! Check out the Getting Started with Red Hat page for quick tours and guides for common tasks.