java - In the hibernate.cfg.xml file, can you use both mapping resource, and mapping class in the same session factory? -


i'm making putting system basic job of persisting hibernate pojos database. we've got bit of legacy system in place @ moment older pojos generated hbm.xml files, new pojos annotated classes.

this hibernate.cfg.xml file

<?xml version="1.0" encoding="utf-8"?> <!doctype hibernate-configuration public "-//hibernate/hibernate configuration dtd 3.0//en"                                          "http://hibernate.sourceforge.net/hibernate-configuration-3.0.dtd"> <hibernate-configuration>     <session-factory name="">         <!-- database connection settings hsql db -->         <property name="connection.driver_class">org.hsqldb.jdbcdriver</property>         <property name="connection.url">jdbc:hsqldb:mem:test</property>         <property name="connection.username">sa</property>         <property name="connection.password" />         <property name="dialect">org.hibernate.dialect.hsqldialect</property>         <property name="hbm2ddl.auto">create-drop</property>         <property name="show_sql">true</property>         <property name="show_comments">true</property>         <property name="hibernate.connection.pool_size">0</property>         <mapping resource="com/dto/address.hbm.xml" />         <mapping class="com.dto.customer"/>     </session-factory> </hibernate-configuration> 

this ok except when comes time unit testing , appears having both resource , class mapping in cfg.xml file seems break unit tests @ build time.

    <mapping resource="com/dto/address.hbm.xml" />     <mapping class="com.dto.customer"/> 

is there way round this? can use 2 differnt mapping types in hibernate.cfg.xml file?


Comments

Popular posts from this blog

c# - Operator '==' incompatible with operand types 'Guid' and 'Guid' using DynamicExpression.ParseLambda<T, bool> -