I have 2 datasources configured in Spring : <bean id="dataSource" class="org.apache.commons.dbcp.BasicDataSource" destroy-method="close"> <property name="driverClassName" value="${jdbc.driverClassName}" /> <property name="url" value="${jdbc.url}" /> <property name="username" value="${jdbc.username}" /> <property name="password" value="${jdbc.password}" /> <property name="maxActive" value="30" /> <property name="maxIdle" value="10" /> <property name="maxWait" value="1000" /> <property name="defaultAutoCommit" value="true" /> </bean> <bean id="embeddedDataSource" class="org.apache.commons.dbcp.BasicDataSource" destroy-method="close"> <property name="driverClassName"> <value>org.hsqldb.jdbcDriver</value> </property> <property name="url"> <value>jdbc:hsqldb:file:config</value> </property> <property name="username"> <value>sa</value> </property> <property name="password"> <value></value> </property> </bean> attached with 2 distinct session factories : <bean id="sessionFactory" class="org.springframework.orm.hibernate3.LocalSessionFactoryBean"> <property name="dataSource" ref="dataSource"/> <property name="mappingResources"> <list> <value>mapping1.hbm.xml</value> </list> </property> <property name="hibernateProperties"> <props> <prop key="hibernate.dialect">${hibernate.dialect}</prop> <prop key="hibernate.query.factory_class">${hibernate.query.factory_class}</prop> <prop key="hibernate.cache.provider_class">org.hibernate.cache.NoCacheProvider</prop> <prop key="hibernate.cache.use_second_level_cache">false</prop> <prop key="hibernate.cache.use_query_cache">false</prop> </props> </property> </bean> <bean id="embeddedSessionFactory" class="org.springframework.orm.hibernate3.LocalSessionFactoryBean"> <!-- property name="dataSource" ref="embeddedDataSource"/--> <property name="mappingResources"> <list> <value>mapping2.hbm.xml</value> </list> </property> <property name="hibernateProperties"> <props> <prop key="hibernate.dialect">org.hibernate.dialect.HSQLDialect</prop> <prop key="hibernate.query.factory_class">org.hibernate.hql.ast.ASTQueryTranslatorFactory</prop> </props> </property> </bean> so in my pom.xml : <plugin> <groupId>org.codehaus.mojo</groupId> <artifactId>hibernate3-maven-plugin</artifactId> <version>2.1</version> <configuration> <components> <component> <name>hbm2ddl</name> <implementation> configuration </implementation> </component> </components> <componentProperties> <propertyfile> target/classes/jdbc.properties </propertyfile> <skip>${dbunit.off}</skip> </componentProperties> </configuration> <executions> <execution> <phase>process-test-resources</phase> <goals> <goal>hbm2ddl</goal> </goals> </execution> </executions> <dependencies> <dependency> <groupId>${jdbc.groupId}</groupId> <artifactId>${jdbc.artifactId}</artifactId> <version>${jdbc.version}</version> </dependency> </dependencies> </plugin> Why hbm2ddl creates tables mapped in mapping2.hbm.xml in the database dataSource ? I just want it generates tables mapped in mapping1.hbm.xml ! --
|
- [mojo-user] Maven Hibernate3 Plugin > spring/hi... Jean-Christophe Lagache
- Re: [mojo-user] Maven Hibernate3 Plugin > ... Johann Reyes
- Re: [mojo-user] Maven Hibernate3 Plugin &... Johann Reyes
- Re: [mojo-user] Maven Hibernate3 Plug... Jean-Christophe Lagache