hello all,
i am getting a "net.sf.hibernate.MappingException: No persister for" error. Googling this error doesnt shed much light.
i get the error when attempting to compile the program listed below.
any suggestions would help.
greg
Hibernate version:
Hibernate 2.1.6
Mapping documents:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE hibernate-mapping
PUBLIC "=//Hibernate/Hibernate Mapping DTD 2.0//EN"
"http://hibernate.sourceforge.net/hibernate-mapping-2.0.dtd">
<hibernate-mapping>
<class name="com.dom.well.Well" table="WELL">
<meta attribute="class-description">
Represents a single well in the GWS Database.
@author Gregory Smith
</meta>
<id name="primaryKey" type="int" column="WELL_SEQ">
<meta attribute="scope-set">protected</meta>
<generator class="native"/>
</id>
<property name="title" type="string" not-null="true"/>
<property name="botttomHoleTemperature" type="double" not-null="false"/>
<property name="casingSize" type="double" not-null="false"/>
<property name="notificationPressure" type="double" not-null="false"/>
<property name="sandTop" type="double" not-null="false"/>
<property name="pluggedDate" type="date" not-null="false"/>
<property name="checkValve" type="string" not-null="false"/>
<property name="masterMeter" type="string" not-null="false"/>
<property name="meter" type="string" not-null="false"/>
<property name="plugged" type="string" not-null="false"/>
</class>
</hibernate-mapping>
Code between sessionFactory.openSession() and session.close():
public static void main(String[] args) throws Exception {
Transaction tx = null;
Configuration config = new Configuration();
SessionFactory sessionFactory = config.buildSessionFactory();
Session session = sessionFactory.openSession();
try {
config.addClass(Well.class);
tx = session.beginTransaction();
Well well = new Well("first", 1.5, 2.4, 3.3, 4.3, new Date(), "Y", "N", "N", "Y");
session.save(well);
well = new Well("second", 1.5, 2.4, 3.3, 4.3, new Date(), "Y", "N", "N", "Y");
session.save(well);
well = new Well("third", 1.5, 2.4, 3.3, 4.3, new Date(), "Y", "N", "N", "Y");
session.save(well);
tx.commit();
} catch (Exception ex) {
ex.printStackTrace();
if (tx != null) {
try {
tx.rollback();
} catch (Exception ex2) {
ex2.printStackTrace();
}
}
} finally {
session.close();
}
sessionFactory.close();
}
Full stack trace of any exception that occurs:
[java] 10:36:27,640 INFO SessionFactoryObjectFactory:82 - Not binding fact
ory to JNDI, no JNDI name configured
[java] 10:36:27,687 INFO Configuration:350 - Mapping resource: com/dom/wel
l/Well.hbm.xml
[java] 10:36:27,890 INFO Binder:229 - Mapping class: com.dom.well.Well ->
WELL
[java] net.sf.hibernate.MappingException: No persister for: com.dom.well.Well
[java] at net.sf.hibernate.impl.SessionFactoryImpl.getPersister(Session
FactoryImpl.java:347)
[java] at net.sf.hibernate.impl.SessionImpl.getClassPersister(SessionIm
pl.java:2690)
[java] at net.sf.hibernate.impl.SessionImpl.getPersister(SessionImpl.ja
va:2697)
[java] at net.sf.hibernate.impl.SessionImpl.saveWithGeneratedIdentifier
(SessionImpl.java:763)
[java] at net.sf.hibernate.impl.SessionImpl.save(SessionImpl.java:738)
[java] at com.dom.well.WellTest.main(WellTest.java:21)
Name and version of the database you are using:
oracle 9i
Debug level Hibernate log excerpt:
n/a
_________________ greg
|