Hibernate: delete from Employee where EMPID=?ĭinesh Rajput is the chief editor of a website Dineshonjava, a technical blog dedicated to the Spring and Java technologies. * Dinesh class Employee int String int long salary Creating Database and Table(Employee Table) CREATE TABLE Employee(Įmployee.java package Now first we see that example using annotation. Creating the Spring Configuration File ( spring.xml) but creating bean with using annotation.Creating Employee Class with using annotation( Employee.java).We can also use the Annotation for using this example with following steps. Creating Application Class for using this.Creating the DAO class ( EmployeeDao.java).Creating the Spring Configuration File ( spring.xml).Creating the Hibernate Mapping file for Employee table( ).Creating Employee Class( Employee.java).Creating Database and Table( Employee Table).The following sections cover the various steps involved in the Spring-Hiberante integration along with a detailed explanation. We can simply integrate Hibernate configuration with the Spring than struts 2, In hibernate framework file using for the hibernate configuration with the application but in case of Spring there are no need to use this file we can simply configure with in the Spring.xml or applicationContext.xml configuration file. It means that now it is possible to use the Hibernate objects as Spring Beans and they can enjoy all the facilities that Spring provides. In simple words, the state of an object can be externalized from the Application code. In the case of Spring, the business objects can be highly configurable with the help of IOC Container. Moreover, the Application code has to manually maintain and manage these objects. These objects will continue to get scattered across the code throughout the Application. One of the problem with using Hibernate is that the client Application that accesses the database using Hibernate Framework has to depend on the Hibernate APIs like Configuration, SessionFactory and Session. Another good thing is that Hibernate can be coupled well with both J2SE and J2EE Applications. All the necessary details for accessing a particular data source is easily configurable in Xml files. There is no need for the Application to depend on the low-level JDBC details like managing connection, dealing with statements and result sets. It enables Application to access data from any database in a platform-independent manner. It is well known that Hibernate is a powerful ORM tool that lies between Application and Database. As a pre-requisite, let us understand the need for such integration before we actually get into the integration between these two technologies.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |