-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 
Author Message
 Post subject: HibernateMappingExcepion when using Generics
PostPosted: Fri Jun 20, 2008 2:48 pm 
Newbie

Joined: Fri Jun 20, 2008 2:16 pm
Posts: 6
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 Declaration
Code:
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 HThingType

Code:
<?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


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.