Hi all, I'm new to Hibernate and have downloaded the sample from here:
http://wiki.netbeans.org/HibernateAndWebApp
I have followed all the set-up instructions but can't get it to work. I have spent a long time trying to work it out but no luck :(
Thanks in advance.
Help please you kind people.
Hibernate version: 3.2.5
Mapping documents:
Actor.hbm.xml:
<?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 dynamic-insert="false" dynamic-update="false" mutable="true" name="dvdrental.Actor" optimistic-lock="version" polymorphism="implicit" select-before-update="false" table="actor">
<id column="actor_id" name="actorID">
<generator class="increment"/>
</id>
<property column="first_name" name="firstName" />
<property column="last_name" name="lastName" />
</class>
</hibernate-mapping>
Category.hbm.xml:
<?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 dynamic-insert="false" dynamic-update="false" mutable="true" name="dvdrental.Category" optimistic-lock="version" polymorphism="implicit" select-before-update="false" table="category">
<id column="category_id" name="categoryID">
<generator class="increment"/>
</id>
<property column="name" name="name" />
</class>
</hibernate-mapping>
Film.hbm.xml:
<?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 dynamic-insert="false" dynamic-update="false" mutable="true" name="dvdrental.Film" optimistic-lock="version" polymorphism="implicit" select-before-update="false" table="film">
<id column="film_id" name="filmID">
<generator class="increment"/>
</id>
<property column="description" name="description"/>
<property column="language_id" name="languageID"/>
<property column="last_update" name="lastUpdate"/>
<property column="length" name="length"/>
<property column="original_language_id" name="origLangID"/>
<property column="rating" name="rating"/>
<property column="release_year" name="releaseYear"/>
<property column="rental_duration" name="rentalDuration"/>
<property column="rental_rate" name="rentalRate"/>
<property column="special_features" name="specialFeatures"/>
<property column="title" name="title"/>
</class>
</hibernate-mapping
FilmActor.hbm.xml:
<?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 dynamic-insert="false" dynamic-update="false" mutable="true" name="dvdrental.FilmActor" optimistic-lock="version" polymorphism="implicit" select-before-update="false" table="film_actor">
<id column="actor_id" name="actorID">
<generator class="increment"/>
</id>
<property column="film_id" name="filmID" />
</class>
</hibernate-mapping>
FilmCategory.hbm.xml:
<?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 dynamic-insert="false" dynamic-update="false" mutable="true" name="dvdrental.FilmCategory" optimistic-lock="version" polymorphism="implicit" select-before-update="false" table="film_category">
<id column="category_id" name="categoryID">
<generator class="increment"/>
</id>
<property column="film_id" name="filmID" />
</class>
</hibernate-mapping>
Language.hbm.xml:
<?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 dynamic-insert="false" dynamic-update="false" mutable="true" name="dvdrental.Language" optimistic-lock="version" polymorphism="implicit" select-before-update="false" table="language">
<id column="language_id" name="languageID">
<generator class="increment"/>
</id>
<property column="name" name="language" />
</class>
</hibernate-mapping>
Code between sessionFactory.openSession() and session.close(): Not sure cos I can't find sessionFactory or openSession!
Full stack trace of any exception that occurs:
The exception occurs when the following line executes:
org.hibernate.Transaction tx = session.beginTransaction();
exception
org.apache.jasper.JasperException: java.lang.NullPointerException
org.apache.jasper.servlet.JspServletWrapper.handleJspException(JspServletWrapper.java:522)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:416)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:337)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:266)
javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
org.netbeans.modules.web.monitor.server.MonitorFilter.doFilter(MonitorFilter.java:390)
root cause
java.lang.NullPointerException
org.apache.jsp.index_jsp._jspService(index_jsp.java:125)
org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70)
javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:374)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:337)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:266)
javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
org.netbeans.modules.web.monitor.server.MonitorFilter.doFilter(MonitorFilter.java:390)
Name and version of the database you are using: 5.0.51
The generated SQL (show_sql=true): ?
Debug level Hibernate log excerpt: ?