Hi guys!Im doing a web application using hibernate2.1, jdk1.3 and tomcat4.0.3 but Im getting an error.
Here's my java class
public class Material implements Serializable{
private String code = "";
private String description = "";
private String creUser = "";
private String modUser = "";
private Date creDate = null;
private Date modDate = null;
private char hw;
....
}
my xml mapping
<hibernate-mapping default-cascade="save-update">
<class name="vo.Material" table="eqp_material_types">
<id name="code">
<generator class="uuid.string"/>
</id>
<property name="description" length="60"/>
<property name="creUser" column="CREUSR" length="20"/>
<property name="modUser" column="MODUSR" length="20"/>
<property name="hw"/>
<property name="creDate"/>
<property name="creDate"/>
</class>
</hibernate-mapping>
when i try to load the class using the following code
try{
Configuration cfg = new Configuration()
.addClass(Material.class);
SessionFactory sf = cfg.buildSessionFactory();
Session session = sf.openSession();
Material material = (Material)session.load(vo.Material.class,"TSTSY");
System.out.println("Material is " + material.getCode());
}catch (Exception e) {
e.printStackTrace();
}
here's the error
java.lang.ExceptionInInitializerError: java.lang.NullPointerException
at java.util.HashMap.put(HashMap.java:327)
at net.sf.hibernate.type.TypeFactory.<clinit>(TypeFactory.java:50)
at net.sf.hibernate.util.ReflectHelper.reflectedPropertyType(ReflectHelper.java:70)
at net.sf.hibernate.mapping.SimpleValue.setTypeByReflection(SimpleValue.java:170)
at net.sf.hibernate.cfg.Binder.bindRootClass(Binder.java:258)
at net.sf.hibernate.cfg.Binder.bindRoot(Binder.java:1204)
at net.sf.hibernate.cfg.Configuration.add(Configuration.java:247)
at net.sf.hibernate.cfg.Configuration.addInputStream(Configuration.java:281)
at net.sf.hibernate.cfg.Configuration.addClass(Configuration.java:322)
at servlet.WebAppInit.init(WebAppInit.java:31)
at org.apache.catalina.core.StandardWrapper.loadServlet(StandardWrapper.java:916)
at org.apache.catalina.core.StandardWrapper.load(StandardWrapper.java:808)
at org.apache.catalina.core.StandardContext.loadOnStartup(StandardContext.java:3266)
at org.apache.catalina.core.StandardContext.reload(StandardContext.java:2479)
at org.apache.catalina.loader.WebappContextNotifier.run(WebappLoader.java:1329)
at java.lang.Thread.run(Thread.java:484)
btw, im using oracle91 db.
thanks.
raymond
|