cancel
Showing results for 
Search instead for 
Did you mean: 

Multiple Persistence Units in persistence.xml

Former Member
0 Kudos

Hi,

in my session bean I want to read data from two ORACLE-database tables, which are located in two ORACLE-schemas (same ORACLE-instance). So I have defined two datasources, one for each schema. Then I defined two persistence-units in 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="DACC/AEMA">

<jta-data-source>AEMA</jta-data-source>

</persistence-unit>

<persistence-unit name="DACC/ALLGEMEIN">

<jta-data-source>ALLGEMEIN</jta-data-source>

</persistence-unit>

</persistence>

In NetWeaver Development Studio this result in the following error:

"2 persistence units are found. Only exactly one persistence unti is supported."

What's the solution here? Of course I could define two session beans. But this would result in two development components (DC) as well, because there is only 1 persistence.xml per DC (is this correct?). I don't think this is a good idea. Any other suggestions?

Kind regards,

Christoph

Accepted Solutions (1)

Accepted Solutions (1)

Vlado
Advisor
Advisor
0 Kudos

Hi Christoph,

From a Java EE server perspective there are no issues with multiple PUs in a persistence.xml. This is a limitation of NWDS, or WTP (Dali), to be precise. So, you could try to ignore this error and deploy on the server.

HTH!

\-- Vladimir

Answers (0)