Hi all,
I'm new to Hibernate and i stack with this error exception -
"Initial SessionFactory creation failed.org.hibernate.MappingException: Could not determine type for: com.ColoRight.DataModel.Recipes.ZoneRecipe, at table: RECIPE_HAIRZONES_ZONERECIPE, for columns: "
325 [main] INFO org.hibernate.cfg.Configuration - Reading mappings from resource : com/ColoRight/DataModel/enums/HairZones.hbm.xml
327 [main] WARN org.hibernate.util.DTDEntityResolver - recognized obsolete hibernate namespace
http://hibernate.sourceforge.net/. Use namespace
http://www.hibernate.org/dtd/ instead. Refer to Hibernate 3.6 Migration Guide!
334 [main] INFO org.hibernate.cfg.Configuration - Configured SessionFactory: null
379 [main] INFO org.hibernate.cfg.HbmBinder - Mapping class: com.ColoRight.DataModel.Session -> SESSION
393 [main] INFO org.hibernate.cfg.HbmBinder - Mapping collection: com.ColoRight.DataModel.Session.recipeHistory -> RECIPE_HISTORY
394 [main] INFO org.hibernate.cfg.HbmBinder - Mapping class: com.ColoRight.DataModel.Recipes.Recipe -> RECIPE
396 [main] INFO org.hibernate.cfg.HbmBinder - Mapping collection: com.ColoRight.DataModel.Recipes.Recipe.ZoneRecipes -> RECIPE_HAIRZONES_ZONERECIPE
397 [main] INFO org.hibernate.cfg.HbmBinder - Mapping class: com.ColoRight.DataModel.Recipes.ZoneRecipe -> ZONERECIPE
397 [main] INFO org.hibernate.cfg.HbmBinder - Mapping class: com.ColoRight.DataModel.enums.HairZones -> HAIRZONES
407 [main] INFO org.hibernate.cfg.Configuration - Hibernate Validator not found: ignoring
410 [main] INFO org.hibernate.cfg.search.HibernateSearchEventListenerRegister - Unable to find org.hibernate.search.event.FullTextIndexEventListener on the classpath. Hibernate Search is not enabled.
Initial SessionFactory creation failed.org.hibernate.MappingException: Could not determine type for: com.ColoRight.DataModel.Recipes.ZoneRecipe, at table: RECIPE_HAIRZONES_ZONERECIPE, for columns: [org.hibernate.mapping.Column(hairZone)]
java.lang.ExceptionInInitializerError
at com.ColoRight.Scripts.Hibernate.HibernateUtils.buildSessionFactory(HibernateUtils.java:73)
at com.ColoRight.Scripts.Hibernate.HibernateUtils.<clinit>(HibernateUtils.java:36)
Caused by: org.hibernate.MappingException: Could not determine type for: com.ColoRight.DataModel.Recipes.ZoneRecipe, at table: RECIPE_HAIRZONES_ZONERECIPE, for columns: [org.hibernate.mapping.Column(hairZone)]
at org.hibernate.mapping.SimpleValue.getType(SimpleValue.java:306)
at org.hibernate.mapping.SimpleValue.isValid(SimpleValue.java:290)
at org.hibernate.mapping.IndexedCollection.validate(IndexedCollection.java:91)
at org.hibernate.cfg.Configuration.validate(Configuration.java:1336)
at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1835)
at com.ColoRight.Scripts.Hibernate.HibernateUtils.buildSessionFactory(HibernateUtils.java:67)
... 1 more
i attach the relevant code (if something missing tell me) -
I'm trying to create schema -
private static void createSchema() {
// TODO Auto-generated method stub
//config.addAnnotatedClass(Client.class);//com.ColoRight.DataModel.Client.Client.class);
//config.configure();
SchemaExport schemaExport= new SchemaExport(config);
schemaExport.setOutputFile("C:\\temp\\fff.txt");
schemaExport.setDelimiter("\n");
schemaExport.create(true, true);
}
<?xml version="1.0"?>
<!DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/Hibernate Mapping DTD 3.0//EN"
"http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">
<!-- Generated May 3, 2011 12:25:21 PM by Hibernate Tools 3.4.0.CR1 -->
<hibernate-mapping>
<class name="com.ColoRight.DataModel.Recipes.Recipe" table="RECIPE">
<id name="ID" type="long">
<column name="ID" />
<generator class="native" />
</id>
<property name="duration" type="double" access="field">
<column name="DURATION" />
</property>
<property name="durationWating" type="double" access="field">
<column name="DURATIONWATING" />
</property>
<map name="ZoneRecipes" table="RECIPE_HAIRZONES_ZONERECIPE" lazy="true">
<key column="ID"/>
<map-key column="hairZone" type="com.ColoRight.DataModel.enums.Enums$HairZonesEnum"/>
<element column="zonerecipe" type="com.ColoRight.DataModel.Recipes.ZoneRecipe"/>
<!-- <one-to-many class="com.ColoRight.DataModel.enums.Enums$HairZonesEnum" not-found="ignore|exception"/>
<element column="ZONERECIPES" type="com.ColoRight.DataModel.Recipes.ZoneRecipe"/> -->
</map>
</class>
</hibernate-mapping>
<?xml version="1.0"?>
<!DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/Hibernate Mapping DTD 3.0//EN"
"http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">
<!-- Generated Apr 6, 2011 9:48:39 AM by Hibernate Tools 3.4.0.CR1 -->
<hibernate-mapping>
<class name="com.ColoRight.DataModel.Recipes.ZoneRecipe" table="ZONERECIPE">
<id name="ID" type="long">
<column name="ID" />
<generator class="native" />
</id>
</class>
</hibernate-mapping>
10X