Thanks Matt for the reply.

I have tried it with the following result:

Only core2's hibernate.cfg.xml loaded:

[INFO] [hibernate3:hbm2ddl {execution: default}]
[INFO] Configuration XML file loaded: file:/E:/Projects/
firmaaqui.com/wsFirmaqui/firmaquiModular/firmaqui/portasigmaquota-core/src/m
ain/resources/hibernate.cfg.xml
16:28:44,792  INFO org.hibernate.cfg.annotations.Version - Hibernate
Annotations 3.3.0.GA
16:28:44,811  INFO org.hibernate.cfg.Environment - Hibernate 3.2.5
16:28:44,814  INFO org.hibernate.cfg.Environment - hibernate.properties not
found
16:28:44,815  INFO org.hibernate.cfg.Environment - Bytecode provider name :
cglib
16:28:44,818  INFO org.hibernate.cfg.Environment - using JDK 1.4
java.sql.Timestamp handling
[INFO] Configuration XML file loaded: file:/E:/Projects/
firmaaqui.com/wsFirmaqui/firmaquiModular/firmaqui/portasigmaquota-core/src/m
ain/resources/hibernate.cfg.xml
16:28:44,866  INFO org.hibernate.cfg.Configuration - configuring from url:
file:/E:/Projects/firmaaqui.com/wsFirmaqui/firmaquiModula
r/firmaqui/portasigmaquota-core/src/main/resources/hibernate.cfg.xml
16:28:44,996  INFO org.hibernate.cfg.Configuration - Configured
SessionFactory: null
[INFO] Configuration Properties file loaded: E:\Projects\firmaaqui.com
\wsFirmaqui\firmaquiModular\firmaqui\portasigmaquota-core\targ

etc

If I delete core2's hibernate.cfg.xml, then core1's is effectively loaded,
but then the additional core2's beans are missing:

[INFO] [hibernate3:hbm2ddl {execution: default}]
[INFO] src/main/resources/hibernate.cfg.xml not found within the project.
Trying absolute path.
[INFO] Configuration XML file loaded:
jar:file:/C:/Users/jgarcia/.m2/repository/es/isigma/firmaqui/portasigma-core/1.1/portasigma-co
re-1.1.jar!/hibernate.cfg.xml
16:35:56,707  INFO org.hibernate.cfg.annotations.Version - Hibernate
Annotations 3.3.0.GA
16:35:56,726  INFO org.hibernate.cfg.Environment - Hibernate 3.2.5
16:35:56,729  INFO org.hibernate.cfg.Environment - hibernate.properties not
found
16:35:56,731  INFO org.hibernate.cfg.Environment - Bytecode provider name :
cglib
16:35:56,734  INFO org.hibernate.cfg.Environment - using JDK 1.4
java.sql.Timestamp handling
[INFO] src/main/resources/hibernate.cfg.xml not found within the project.
Trying absolute path.
[INFO] Configuration XML file loaded:
jar:file:/C:/Users/jgarcia/.m2/repository/es/isigma/firmaqui/portasigma-core/1.1/portasigma-co
re-1.1.jar!/hibernate.cfg.xml
16:35:56,784  INFO org.hibernate.cfg.Configuration - configuring from url:
jar:file:/C:/Users/jgarcia/.m2/repository/es/isigma/firma
qui/portasigma-core/1.1/portasigma-core-1.1.jar!/hibernate.cfg.xml
16:35:56,928  INFO org.hibernate.cfg.Configuration - Configured
SessionFactory: null

hibernate.cfg.xml is packaged in the jar's root.

Josep

2010/6/29 Matt Raible <m...@raibledesigns.com>

> I would suggest putting your hibernate.cfg.xml in both project's
> src/main/resources (in the root directory), then using
> classpath*:hibernate.cfg.xml should work. If it doesn't, crack open
> core1.jar and make sure the file is being properly included in the JAR. If
> you're putting it in src/main/java, it won't be included unless you tell
> Maven to include *.xml files.
>
> On Jun 29, 2010, at 7:49 AM, Josep García wrote:
>
> Hello,
> I am making progress in converting my AppFuse application to multi-module,
> for better structure and multiple deployments.
> I am using AppFuse 2.0.2 with struts2 + spring.
> Ok.
> I am now stuck with this:
>
> I have modules:
> - core1
> - core2
>
> Each module has his own beans. core2 depends on core1, and references
> core1's beans.
> In core1 I have src/main/resources/hibernate.cfg.xml with his mapping class
> defs.
>
> In core2 I would like to have only the additional mapping class defs in his
> own hibernate.cfg.xml file.
>
> Based on what's suggested in post:
> http://appfuse.547863.n4.nabble.com/how-to-config-more-than-one-hibernate-cfg-xml-td565276.html,
> I tried having several hibernate config files with this core1's
> applicationContext-dao.xml update:
>
>         <property name="configLocations"
> value="classpath*:hibernate.cfg.xml"/>
>
> But doesn't work for me. Only core2's hibernate.cfg.xml is loaded.
>
> I also tried this:
>
> core2's: applicationContext-dao-core2.xml:
>
> <bean class="org.appfuse.dao.spring.HibernateExtensionPostProcessor">
>      <property name="mappingResources">
>          <list>
>
> <value>es/isigma/portasigmaquota/model/hibernate.cfg.xml</value>
>          </list>
>      </property>
>  </bean>
>
> ... core2's beans ...
> but doens't make a difference.
>
> Any pointers for this?
>
> Josep
>
>
>

Reply via email to