Here is all the info:
Hibernate version:3.2
Mapping documents:
Code:
<hibernate-mapping
package="com.integrallis.techconf.domain">
<class name="Address">
<id name="Id" column="PK_ID" type="integer">
<generator class="identity"/>
</id>
<property name="StreetAddress"/>
<property name="State"/>
<property name="ZipCode"/>
<property name="City"/>
<property name="AptNumber"/>
</class>
</hibernate-mapping>
Code between sessionFactory.openSession() and session.close():Code:
Address address = new Address();
Configuration config = new Configuration().
setProperty("hibernate.dialect", "org.hibernate.dialect.MySQLDialact").
setProperty("hibernate.connection.driver_class", "com.mysql.jdbc.Driver").
setProperty("hibernate.connection.url", "jdbc:mysql://localhost/tcms").
setProperty("hibernate.connection.username", "root").
setProperty("hibernate.connection.password", "eskimo").
setProperty("hibernate.show_sql", "true");
config.addClass(Address.class);
SessionFactory factory = config.buildSessionFactory();
Session session = null;
Transaction tx = null;
try {
session = factory.openSession();
tx = session.beginTransaction();
session.persist(address);
tx.commit();
}catch(Exception ex) {
if(tx != null) tx.rollback();
}finally {
session.close();
}
Full stack trace of any exception that occurs:Code:
Error parsing XML: XML inputstream(1) Document root element "hibernate-mapping", mush match DOCTYPE root
Exception in thread "main" org.hibernate.InvalidMappingException: Could not parse mapping documents from resource
at org.hibernate.cfg.Configuration.addResource(Configuration.java:539)
at org.hibernate.cfg.Configuration.addClass(Configuration.java:586)
at com.integrallis.techconf.domain.Address.main(Address.java:98)
...
Name and version of the database you are using:
MySQL 5.1 and Database "tcms"