I've been working on a program using hibernate3 with mySQL and it is currently working as intended in Eclipse and as an application from the command line. However, I have been unable to get it to work as an applet, which is the form I actually need it in. I've looked through the documentation and forums, but I can't find anything that might account for this problem.
The error I get in the Java console for Internet Explorer is:
problem parsing configuration/hibernate.cfg.xml
hibernate.cfg.xml
Code:
<?xml version='1.0' encoding='utf-8'?>
<!DOCTYPE hibernate-configuration PUBLIC "-//Hibernate/Hibernate Configuration DTD//EN" "http://hibernate.sourceforge.net/hibernate-configuration-2.0.dtd">
<hibernate-configuration>
<session-factory>
<property name="hibernate.connection.driver_class">com.mysql.jdbc.Driver</property>
<property name="hibernate.connection.url">jdbc:mysql://mysql.cs.orst.edu/baileyvi</property>
<property name="hibernate.connection.username">baileyvi</property>
<property name="hibernate.connection.password">pwd</property>
<property name="hibernate.connection.pool_size">20</property>
<property name="show_sql">true</property>
<property name="dialect">org.hibernate.dialect.MySQLDialect</property>
<!-- "<property name="hibernate.hbm2ddl.auto">update</property>" -->
<!-- Mapping files -->
<mapping resource="Kit.hbm.xml"/>
</session-factory>
</hibernate-configuration>
Kit.hbm.xml
Code:
<?xml version="1.0"?>
<!DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/Hibernate Mapping DTD//EN" "http://hibernate.sourceforge.net/hibernate-mapping-2.0.dtd">
<hibernate-mapping>
<class name="Kit" table="KitInventory">
<id name="kitName" type="string" column="KitName" >
<generator class="assigned"/>
</id>
<property name="price">
<column name="Price" />
</property>
<property name="quantity">
<column name="Quantity" />
</property>
</class>
</hibernate-mapping>
One solution I tried was configuring in the program as such:
Code:
Configuration config = new Configuration().addResource("Kit.hbm.xml");
config = config.addClass(Kit.class);
config = config.setProperty("hibernate.dialect", "org.hibernate.dialect.MySQLDialect");
config = config.setProperty("hibernate.connection.driver_class", " com.mysql.jdbc.Driver");
config = config.setProperty("hibernate.connection.url", "jdbc:mysql://mysql.cs.orst.edu/baileyvi");
config = config.setProperty("hibernate.connection.username", "baileyvi");
config = config.setProperty("hibernate.connection.password", "pwd");
SessionFactory sessionFactory = config.buildSessionFactory();
session = sessionFactory.openSession();
When I do it this way, the Java console gives me the error:
Error reading resource: Kit.hbm.xml
If anyone has any insight, it would be much appreciated.