Professional Documents
Culture Documents
• Data Access
• @Override
• public String getFortune() {
• // TODO Auto-generated method stub
• return null;
•}
The JSP(Java Server Pages)
• <html>
• <body>
• <p>Welcome to Spring MVC by Saumya Singh</p>
• </body>
• </html>
Output:
Advantages of Spring Framework
• Separate roles - The Spring MVC separates each role, where the model
object, controller, command object, view resolver, DispatcherServlet,
validator, etc.
• Light-weight - It uses light-weight servlet container to develop and deploy
your application.
• Rapid development - The Spring MVC facilitates fast and parallel
development.
• Reusable business code - Instead of creating new objects, it allows us to
use the existing business objects.
• Easy to test - In Spring, generally we create JavaBeans classes that enable
you to inject test data using the setter methods.
• Flexible Mapping - It provides the specific annotations that easily redirect
the page.
What is Hibernate?
• Hibernate is the framework for persisting/saving java objects in the
database.
• Hibernate is a Java framework that simplifies the development of Java
application to interact with the database. It is an open source,
lightweight, ORM (Object Relational Mapping) tool.
Why Hibernate?
• When a Java application needs to access database:
• open connection to database
• use JDBC driver to send SQL queries to database
• process the results that are returned
• close the connection.
BENEFITS OF HIBERNATE:
Hibernate handles all the low level sql tasks.
Minimizes the amount of JDBC code you have to develop.
Hibernate provides Object-to-Database Mapping(ORM)
ORM:
• The developer defines the mapping between java class and database
tables.
Saving the java object with Hibernate:
• Creating the object
• Storing the object
Retrieving the data from database:
References:
Any Questions?