Multiple Persistence Units

Hi... im having the following problem:

I have a persistence.xml with multiple persistence units defined. In each of the definitions im using true and then manually define the entities i want to associate with each persistence unit using ]]>.

IDEA seems to completely ignore the persistence.xml, because when i add a JPA facet, all the persistence units are there, just as i defined them in the persistence.xml file, but all classes im my project with the @Entity annotation are added to each of the persistence unit.

I expected that only the classes that i manually defined in the persistence.xml would be added in the IDEA persistence units facet.

Am i doing something wrong, or is this an IDEA problem?

5 comments
Comment actions Permalink

http://www.jetbrains.net/jira/browse/IDEADEV-21365
Fixed,
Thank you

Roberto Cortez wrote:

Hi... im having the following problem:

I have a persistence.xml with multiple persistence units defined. In
each of the definitions im using
<exclude-unlisted-classes>true</exclude-unlisted-classes> and then
manually define the entities i want to associate with each
persistence unit using <class></class>.

IDEA seems to completely ignore the persistence.xml, because when i
add a JPA facet, all the persistence units are there, just as i
defined them in the persistence.xml file, but all classes im my
project with the @Entity annotation are added to each of the
persistence unit.

I expected that only the classes that i manually defined in the
persistence.xml would be added in the IDEA persistence units facet.

Am i doing something wrong, or is this an IDEA problem?

0
Comment actions Permalink

Thank you for the quick response... ill be waiting for the new release :)

0
Comment actions Permalink

I'm currently using IDEA 7.0.4 Build # 7941, and I see this problem.
I have one persistence.xml in my module, but I see all the other Entity Beans from the other modules underneath this Persistence Unit and in the ER diagram.

org.hibernate.ejb.HibernatePersistence dme.dm.device.Operation ... ... ]]>

0
Comment actions Permalink

Hello Thomas,

I'm currently using IDEA 7.0.4 Build # 7941, and I see this problem.

I have one persistence.xml in my module, but I see all the other
Entity Beans from the other modules underneath this Persistence Unit
and in the ER diagram.

<persistence-unit name="Test" >
<provider>org.hibernate.ejb.HibernatePersistence</provider>
<non-jta-data-source/>
<class>dme.dm.device.Operation</class>
...
<properties>
<property name="hibernate.connection.driver_class"
value="com.mysql.jdbc.Driver"/>
...
</properties>
</persistence-unit>


Have you tried
<exclude-unlisted-classes>true</exclude-unlisted-classes>
setting?

Alexander.


0
Comment actions Permalink

Hi Alexander

I didn't even know it existed. Thank you for bringing back the order ;)

Thomas

0

Please sign in to leave a comment.