|
This example is web application running as a book search engine. Techniques used are Struts,Spring,and Hibernate.
Hibernate overview Hibernate is a powerful,high performance object/relational persistence and query service. Hibernate lets you develop persistent classes following object-oriented idiom – including association,inheritance,polymorphism,composition and collections. Hibernate allows you to express queries in its own portable SQL extension (HQL),as well as in native SQL.
For more information,go to the home site of Hibernate at http://www.hibernate.org
Hibernate allows you map data tables to objects and use these object for data operation instead of accessing directly to data tables,as description below:


Design and code Architecture of the example looks as:

In there: • Struts layer controls request • Hibernate layer accesses real database • Spring layer register Hibernate services as beans so Struts layer can use them We created the Spring.hibernate.bean.xml file to declare Hibernate data service as below:
 .jpg)
You can see two extend Spring classes: BookService and CategoryService were declared as beans: bookService and categoryService
How to deploy and run Before doing that,must ensure your classpath environment variable point to Spring and Hibernate lib folder.
The simplest way is to copy all jar files of Spring and Hibernate lib folders to the lib folder of the web application. The figure below shows that the web lib folder contains all lib jar files of Spring and Hibernate:
|