I am just starting out with Hibernate and I am using Hibernate 3.0.1. I have a couple of configuration questions:
1. I want to store the <mapping> tags in a different file. If I do the following, will the properties or settings be merged?
Code:
String mainConfigFile = "/web/etc/hibernate.cfg.xml";
String mappingConfigFile = "/web/etc/hibernate.mapping.xml";
Configuration config = new Configuration();
config.configure(new File(mainConfigFile));
config.configure(new File(mappingConfigFile));
SessionFactory factory = config.buildSessionFactory();
2. When defining the mappings in the hibernate.cfg.xml file, is it possible to specify either a root directory (the top level directory of my application class path; used when developing) or specify a Jar file (used in production) so Hibernate can scan for the "*.hbm.xml" files?
I looked in the "http://hibernate.sourceforge.net/hibernate-configuration-3.0.dtd"
and I saw the following attributes of the mapping tag:
Code:
<!ELEMENT mapping EMPTY> <!-- reference to a mapping file -->
<!ATTLIST mapping resource CDATA #IMPLIED>
<!ATTLIST mapping file CDATA #IMPLIED>
<!ATTLIST mapping jar CDATA #IMPLIED>
<!ATTLIST mapping package CDATA #IMPLIED>
<!ATTLIST mapping class CDATA #IMPLIED>
But, the only one that worked is the "resource" to specify a specific ".hbm.xml" file. I experimented with the other attributes and they all threw a errors like this:
Quote:
[2005-04-22 21:03:52.209] com.caucho.config.LineConfigException: conf/resin.conf:278: org.hibernate.MappingException: An AnnotationConfiguration instance is required to use <mapping package="com.marinersupply.authentication"/>
thanks for your help