Hi
I am new to hibernate so my question is probably not that interesting.
My table in the DB uses a own column with automatically assigned GUIDS.
I tried following but it doesn't work.
Thank you very much
the greenhorn
Code:
Initial SessionFactory creation failed.org.hibernate.MappingException: Could not determine type for: guid, for columns: [org.hibernate.mapping.Column(GUIDModulID)]
Exception in thread "main" java.lang.ExceptionInInitializerError
at util.HibernateUtil.<clinit>(HibernateUtil.java:17)
at verwaltung.Modulmanager.createModul(Modulmanager.java:32)
at verwaltung.Modulmanager.main(Modulmanager.java:17)
Caused by: org.hibernate.MappingException: Could not determine type for: guid, for columns: [org.hibernate.mapping.Column(GUIDModulID)]
at org.hibernate.mapping.SimpleValue.getType(SimpleValue.java:266)
at org.hibernate.mapping.SimpleValue.isValid(SimpleValue.java:253)
at org.hibernate.mapping.RootClass.validate(RootClass.java:193)
at org.hibernate.cfg.Configuration.validate(Configuration.java:982)
at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1146)
at util.HibernateUtil.<clinit>(HibernateUtil.java:13)
... 2 more
Code:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/Hibernate Mapping DTD 3.0//EN" "http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd" >
<hibernate-mapping>
<class name="verwaltung.Modul" table="Modul">
<id name="id" column="GUIDModulID" >
<generator class="guid"></generator>
</id>
<property name="Name"> <column name="ModulBezeichnung"></column></property>
</class>
</hibernate-mapping>
Code:
package verwaltung;
import org.hibernate.id.GUIDGenerator;
public class Modul {
private GUIDGenerator id;
private String fName;
public Modul(){}
public String getName() {
return fName;
}
public void setName(String name) {
fName = name;
}
public GUIDGenerator getId() {
return id;
}
private void setId(GUIDGenerator id) {
this.id = id;
};
}