Anda di halaman 1dari 3

http://www.developer.com/open/article.phpr/3559931/Hibernate-Basics.htm http://www.allapplabs.com/hibernate/introduction_to_hibernate.htm http://www.techfaq360.com/tutorial/hibernate.jsp http://www.devx.com/dbzone/Article/29685 http://www.javabeat.net/articles/37-introduction-to-hibernate-caching-1.html http://www.javabeat.net/articles/7-hibernate-ormobjectrelational-framework-an-in trodu-1.

html

The term object/relational mapping (ORM) refers to the technique of mapping a da ta representation from an object model to a relational data model with a SQL-bas ed schema. ORM software greatly simplifies the transformation of business data between an application and a relational-database. Some of the most popular ORM project/products are iBatis Data Access Objects fro m Apache, NDO (.NET Data Objects) for .NET languages Comparison with other Technologies Before the advent of Hibernate, there were so many other technologies a nd specifications from Sun, for persistence. 4.1) Problems with JDBC Java provided an initial solution for persistence in the form of JDBC an d developers are depending on JDBC API's to connect to the database. One of the major drawbacks of JDBC is that, one has to embed the application's data into th e SQL syntax, i.e., for saving the data in an application, the business object h as to be converted to relational-object model by embedding the various pieces of data within the SQL language syntax. Consider the following situation, there is a business object called Empl oyee with properties name and age and this has to be persisted to a database. Th e following is the class representation of the Employee class, class Employee { private String name; private int age; //Other Methods go here. } Employee employee = getEmployeeObject(); String sqlInsertStmt = "INSERT INTO EMPLOYEE VALUES ('" + employee.getNa me() + "', '" + employee.getAge() + "')"); statement.executeQuery(sqlInsertStmt); The above is generally a poorer code, and also the business object (Empl oyee object, in our case) is tightly integrated with the SQL syntax. During data retrieval, the reverse of the above process will happen. The

information that is fetched from the database has to be mapped to the business object. Consider the following piece of code which has the conversion process of representing the business object from the relational data model. String sqlQueryStmt = "SELECT * FROM EMPLOYEE WHERE EMP_ID = '100'"); ResultSet employees = statement.executeQuery(sqlInsertStmt); if (employees.next()) { Employee fetchedEmployee = new Employee(); fetchedEmployee.setName(employees.getString("name")); fetchedEmployee.setAge(employees.getInt("age")); } 4.2) Entity Beans Entity beans, which were one of the major components in the EJB Specific ation failed drastically to provide a persistent layer in the applications. The initial version of the EJB specification has little support for the Entity beans. The first disadvantage is, an Entity Bean is not a local object, b ut a remote object, so, there are overheads related to network performance issue s. And the worst thing is that the relationships between entity beans have to be manually managed in the application code and the actual mappings were done in v endor-specific configuration files which invented lots of changes in the configu ration files when the application is made to point out to a different database s erver. Though, the later version of the specification overcome many of the draw backs that were found in the initial versions by introducing the notion of local interfaces for representing an enterprise bean and EJB Query Language (EJB-QL), etc., the art of designing and managing an entity bean still yielded much compl exity in the hands of the developers. Hibernate doesn't replace JDBC. Hibernate is sitting on top of JDBC to connect t o the database. Internally Hibernate is using these JDBC calls to connect to the database systems Hibernate is neither forcing its developers to use some specific interfaces fo r the classes to be persisted in an application nor it requires the program to f ollow some standard design to achieve its goals. For this reason, Hibernate can well integrate with all kinds any of J2SE/J2EE application and with any kind of frameworks (like Spring, Struts etc). 5.1) Hibernate Modules The open-source Hibernate project has various different modules each rep resenting a unique functionality. * Hibernate Core which represent the basic and the core module of the Hib ernate project provides support for OO features along with the Query services. * Another module called Java Persistence with Hibernate is an implementat ion for the specification "Java Persistence API (JPA)" from Sun and we can be us ed in any Sun's compliant Application Server as well as with J2SE applications. * There is a separate module called Hibernate Search that provides rich f unctionality for searching the persistence domain model using a simplified API. * For validating the data, Hibernate comes with a set of validation rules in the form of Annotations in a module called Hibernate validations and it also allows the developers to create custom validation rules. * Support for Querying and inserting data from multiple databases can be

achieved by using the Hibernate Shards API. Hibernate Core API 6.1) The 'Configuration' class The Configuration class is the initial entry point of a Hiberna te application This class provides convinient ways to import the Hibernate Conf iguration File and the necessary Mapping Files

5,60,000 48,000 1,07,000 20,000 76,000 1,00,000 80,000

-----------------------------

shares naavi nannavi naanna amount(sbi) SBI pedagantyada FDR BOI LIC cancellation naa savings Durga amount

Total --- 9,91,000 (by december 2010)

Anda mungkin juga menyukai