{HibernateSessionFactory.closeSession(); } %>

<body><div align="center"><font size="7">OSMS Hibernate Test Page</font> <%initSession();%>

</div><h2>1.Retrieve data from table USERS via hibernate<br> <%showData(out,queryAll());%>

<h2>2.Insert firstname 'Smith',lastname 'Barney' into table USERS and show the query result via hibernate<br>

<%Long userId=insert();%> <%showData(out,queryAll());%>

<h2>3.Update lastname of the record which inserted in step 2 to 'root' and retrieve it via hibernate<br>

<%update(userId);%>

<%showData(out,queryAll());%>

<h2>4.Delete the test data then query again via hibernate<br> <%delete(userId);%>

<%showData(out,queryAll());%>

<%clean();%>

</body>

</html>

Appendix D: Hibernate Test Application Source Code 57

Page 57
Image 57
HP 5991-5565 manual Appendix D Hibernate Test Application Source Code