Hello All,
My problem is concerning Hibernate Mapping Exception when trying to persist something like:
Code:
private T type;
Given below, are the details.
Any help is appreciated
Hibernate Vesion: 3.2.6.ga: Class DeclarationCode:
public abstract class HEntityType<T extends EntityType<T>> implements EntityType<T> {
private String etypeGlobalId;
private T supertype; //ISSUE!!!
//getters & setters ....
}
class HThingType extends HEntityType<ThingType> implements ThingType {
}
Also, I am using top-down schema generation approach : props.put("hibernate.hbm2ddl.auto","update")
Mapping Document Content:
I am using Table Per Subclass approach: Hence Have defined HEntityType.hbm.xml for the abstract class - HEntityType which has a joined-sublcass mapping for HThingTypeCode:
<?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="com.quantum4d.common.q4do.impl.hnate">
<class name="HEntityType" table="HENTITYTYPE" abstract="true">
<id name="etypeGlobalId" type="string" column="etype_global_id">
<generator class="assigned"></generator>
</id>
<property name="supertype"></property>
<joined-subclass name="HThingType" table="HTHINGTYPE">
<key column="etype_global_id"></key>
</class>
</hibernate-mapping>
Full stack trace of exception that occurs:
The Exception is thrown during the configuration process when it attempts to create tables
Quote:
org.hibernate.MappingException: Could not determine type for: com.quantum4d.common.q4do.EntityType, at table: HENTITYTYPE, for columns: [org.hibernate.mapping.Column(supertype)] at org.hibernate.mapping.SimpleValue.getType(SimpleValue.java:269)
at org.hibernate.mapping.SimpleValue.isValid(SimpleValue.java:253)
at org.hibernate.mapping.Property.isValid(Property.java:185)
at org.hibernate.mapping.PersistentClass.validate(PersistentClass.java:440)
at org.hibernate.mapping.RootClass.validate(RootClass.java:192)
at org.hibernate.cfg.Configuration.validate(Configuration.java:1108)
at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1293)
at com.quantum4d.common.q4do.impl.hnate.HibernateSessionFactoryUtil.getSessionFactory(HibernateSessionFactoryUtil.java:42)
at com.quantum4d.common.q4do.impl.hnate.PersistOntology.createAndPersistOntology(PersistOntology.java:29)
at com.quantum4d.common.q4do.impl.hnate.PersistOntology.main(PersistOntology.java:24)
Exception in thread "main" java.lang.NullPointerException
at com.quantum4d.common.q4do.impl.hnate.PersistOntology.createAndPersistOntology(PersistOntology.java:30)
at com.quantum4d.common.q4do.impl.hnate.PersistOntology.main(PersistOntology.java:24)
Name and version of the database: PostgreSQL 8.3
Thanks
-kashyup