Hi David..
O.k., I've checked the Hibernate version and the DTD and can find nothing wrong. Here's my log file:
15:37:21,455 INFO Environment:456 - Hibernate 3.0rc1
15:37:21,465 INFO Environment:469 - hibernate.properties not found
15:37:21,465 INFO Environment:502 - using CGLIB reflection optimizer
15:37:21,465 INFO Environment:532 - using JDK 1.4 java.sql.Timestamp handling
15:37:21,465 INFO Configuration:1228 - configuring from resource: /hibernate.cfg.xml
15:37:21,475 INFO Configuration:1199 - Configuration resource: /hibernate.cfg.xml
15:37:21,776 DEBUG DTDEntityResolver:42 - trying to locate
http://hibernate.sourceforge.net/hibern ... on-3.0.dtd in classpath under org/hibernate/
15:37:21,776 DEBUG DTDEntityResolver:53 - found
http://hibernate.sourceforge.net/hibern ... on-3.0.dtd in classpath
15:37:21,836 DEBUG Configuration:1185 - connection.driver_class=oracle.jdbc.driver.OracleDriver
15:37:21,836 DEBUG Configuration:1185 - connection.url=jdbc:oracle:thin:@134.29.51.11:1521:hart
15:37:21,836 DEBUG Configuration:1185 - dialect=org.hibernate.dialect.OracleDialect
15:37:21,836 DEBUG Configuration:1185 - connection.username=hart
15:37:21,836 DEBUG Configuration:1185 - connection.password=hart
15:37:21,836 DEBUG Configuration:1185 - show_sql=true
15:37:21,836 DEBUG Configuration:1185 - hbm2ddl.auto=create
15:37:21,846 DEBUG Configuration:1380 - null<-org.dom4j.tree.DefaultAttribute@1968e23 [Attribute: name resource value "org/Person.hbm.xml"]
15:37:21,846 INFO Configuration:439 - Mapping resource: org/Person.hbm.xml
15:37:21,846 DEBUG DTDEntityResolver:42 - trying to locate
http://hibernate.sourceforge.net/hibern ... ng-3.0.dtd in classpath under org/hibernate/
15:37:21,846 DEBUG DTDEntityResolver:53 - found
http://hibernate.sourceforge.net/hibern ... ng-3.0.dtd in classpath
15:37:21,946 ERROR XMLHelper:59 - Error parsing XML: XML InputStream(19) The content of element type "class" must match "(meta*,subselect?,cache?,synchronize*,(id|composite-id),discriminator?,(version|timestamp)?,(property|many-to-one|one-to-one|component|dynamic-component|properties|any|map|set|list|bag|idbag|array|primitive-array|query-list)*,((join*,subclass*)|joined-subclass*|union-subclass*),loader?,sql-insert?,sql-update?,sql-delete?,filter*)".
Here's my Person.hbm.xml file:
<?xml version="1.0"?>
<!DOCTYPE hibernate-mapping PUBLIC
"-//Hibernate/Hibernate Mapping DTD 3.0//EN"
"http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">
<hibernate-mapping
package="org"
default-access="field">
<class name="Person">
<id name="id">
<generator class="increment"/>
</id>
<property name="name" not-null="true"/>
<sql-insert callable="true">{call createPerson (?, ?)}</sql-insert>
<sql-delete callable="true">{? = call deletePerson (?)}</sql-delete>
<sql-update callable="true">{? = call updatePerson (?, ?)}</sql-update>
</class>
</hibernate-mapping>
Here's my Person.java file:
package org;
public class Person {
private Long id;
private String name;
public Person() {}
public Person(String name) {
this.name = name;
}
public Long getId() {
return id;
}
public void setId(Long id) {
this.id = id;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
}
Here's my driver (Test.java):
package org;
import java.math.BigDecimal;
import org.hibernate.*;
import org.hibernate.cfg.Configuration;
import org.hibernate.Criteria;
import java.util.*;
import java.util.List;
public class Test {
private static SessionFactory sessionFactory;
public static void main(String[] args) throws Exception {
final Test app = new Test();
// Build SessionFactory
try {
app.sessionFactory = new Configuration().configure().buildSessionFactory();
} catch (HibernateException e) {
throw e;
}
// Hibernate placeholders
Session session = null;
Transaction tx = null;
java.io.Serializable courseId = null;
try {
session = app.sessionFactory.openSession();
tx = session.beginTransaction();
Person person = new Person();
person.setName("Allan");
session.save(person);
tx.commit();
} catch (HibernateException e) {
System.out.println(e.getMessage());
tx.rollback();
e.printStackTrace();
} finally {
if (session != null)
session.close();
}
// Close the SessionFactory (not mandatory)
app.sessionFactory.close();
}
}
Any help would be most appreciated.
TIA,
Allan M. Hart