Hello,
I am using JBoss Studio (2.0.0.Beta1, windows XP, JDK 1.6.11, Oracle 10G R2) to generate java code from hibernate configuration files. I have manually created some classes and successfully created and run a hibernate session, updating an Oracle table. In short, hibernate is working fine, if I create all code and config by hand. My issue is with Hibernate tools.
When I try to configure Hibernate code generation in the IDE to generate Java it fails with:
org.hibernate.console.HibernateConsoleRuntimeException: Could not resolve audit_fact.hbm.xml to a file
at org.hibernate.eclipse.console.EclipseLaunchConsoleConfigurationPreferences.pathToFile(EclipseLaunchConsoleConfigurationPreferences.java:56)
at org.hibernate.eclipse.console.EclipseLaunchConsoleConfigurationPreferences.pathToFile(EclipseLaunchConsoleConfigurationPreferences.java:45)
at org.hibernate.eclipse.console.EclipseLaunchConsoleConfigurationPreferences.strToFile(EclipseLaunchConsoleConfigurationPreferences.java:38)
at org.hibernate.eclipse.console.EclipseLaunchConsoleConfigurationPreferences.getConfigXMLFil(EclipseLaunchConsoleConfigurationPreferences.java:72)
at org.hibernate.console.ConsoleConfiguration.loadConfigurationXML(ConsoleConfiguration.java:272)
at org.hibernate.console.ConsoleConfiguration.configureStandardConfiguration(ConsoleConfiguration.java:575)
at org.hibernate.console.ConsoleConfiguration.buildConfiguration(ConsoleConfiguration.java:547)
....
As far as I can tell, it seems to look for a file 'audit_fact.hbm.xml' - no matter what my configuration files are called (I actually renamed my file to 'audit_fact.hbm.xml' to see if it would work). This was the file name initially, before I renamed it, so it may be just a caching problem.
Here are my config files (both in java /src directory)
audit_fact.hbm.xml:
<hibernate-mapping>
<class name="nsw.osr.service.audit.data.AuditFact" table="ESB_AUDIT_FACT">
<id name="id" column="AUDIT_ID" type="long">
<generator class="sequence">
<param name="sequence">ESB.ESB_AUDIT_FACT_SEQ</param>
</generator>
</id>
<property name="receivedTime" type="date" column="RECEIVED_TIME" />
<property name="sourceID" type="int" column="SOURCE_ID" />
<property name="destinationID" type="int" column="DESTINATION_ID" />
<property name="fileName" type="string" column="FILENAME" />
<property name="pathID" type="int" column="PATH_ID" />
<property name="userID" type="int" column="USER_ID" />
</class>
</hibernate-mapping>
hibernate.cfg.xml:
<hibernate-configuration>
<session-factory name="SergeLocalORCL">
<property name="hibernate.connection.driver_class">oracle.jdbc.driver.OracleDriver</property>
<property name="hibernate.connection.password">password</property>
<property name="hibernate.connection.url">jdbc:oracle:thin:@localhost:1521:orcl</property>
<property name="hibernate.connection.username">system</property>
<property name="hibernate.default_schema">ESB</property>
<property name="hibernate.dialect">org.hibernate.dialect.Oracle10gDialect</property>
<mapping resource="audit_fact.hbm.xml" />
</session-factory>
</hibernate-configuration>
Your help appreciated,
Serge
|