-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 2 posts ] 
Author Message
 Post subject: The annotated entities could found in multiple persistences
PostPosted: Thu Jun 07, 2012 9:23 am 
Newbie

Joined: Tue Jun 05, 2012 6:07 am
Posts: 3
I have the following project structure :-

1. CommonGlobal module which is using hibernate without JPA and which has mainly the global objects which will be used in other modules. Here it is important to mention that this module is working fine independently. The hbm files for these BDOs are in a jar file put in lib folder of EAR.

2. MainModule which is using JPA 2.0 with hibernate 4.1. This module will use the BDO from CommonGlobal module. I had done with the mapping in persistentence.xml like the following :-

<?xml version="1.0" encoding="UTF-8"?>
<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/ ... ce_2_0.xsd" version="2.0">
<persistence-unit name="main-jpa" transaction-type="JTA">
<provider>org.hibernate.ejb.HibernatePersistence</provider>
<jta-data-source>MAINDS</jta-data-source>
<shared-cache-mode>NONE</shared-cache-mode>
<properties>
<property name="hibernate.dialect" value="org.hibernate.dialect.Oracle9Dialect" />
<property name="java.naming.factory.initial" value="weblogic.jndi.WLInitialContextFactory" />
<property name="hibernate.transaction.manager_lookup_class"
value="org.hibernate.transaction.WeblogicTransactionManagerLookup" />
<property name="hibernate.transaction.factory_class"
value="org.hibernate.transaction.CMTTransactionFactory"/>
<property name="hibernate.show_sql" value="true" />
<property name="hibernate.archive.autodetection" value="class"/>
</properties>
</persistence-unit>
<persistence-unit name="COMMNPU" transaction-type="JTA">
<jta-data-source>COMMNDS</jta-data-source>
<properties>
<property name="hibernate.ejb.cfgfile" value="/common-hibernate.cfg.xml" />
<property name="hibernate.archive.autodetection" value="" />
</properties>
</persistence-unit>

As shown in persistence unit code above, I had given the hibernate cfg file of commonmodule in separate persisitence unit in same file. This persistence.xml file I am putting in Meta-inf of a jar which is in EAR file. All BDOs(annotated for MAINMODULE ) classes are in other jars put in lib folder.

Now the problem I am facing is that the BDOs of common module are visible to entitymanager but I am not able to get the (annotated) BDOs of MainModule. Where I am doing wrong ?


Top
 Profile  
 
 Post subject: Re: The annotated entities could found in multiple persistences
PostPosted: Fri Jun 15, 2012 1:36 pm 
Newbie

Joined: Tue Jun 05, 2012 6:07 am
Posts: 3
If I add the<class> in first PU, it did not get the cfg file entities but if I remove class tag, it gets the cfg file entities but then not getting the first PU entities.Please help


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 2 posts ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.