Tell a friend
Link to us
Bookmark Us
Total Members
      Members: 87081
Sitemap Forum Chat
 
Java Home
Java Members (28736)
Java Member Articles ( 41 )
Java Discussion (283)
Java Q & A ( 172 )
- Java Ask Question
- Java Questions
- Java Unanswered Questions
Java Resources
Java Source Code (1096)
Java Articles (552)
Java Blogs (133)
Java Jobs (801)
Java Components (85)
Java Books (169)
Java Websites (127)
Java News (103)

 
Resource Directory
Java Hosting (0)
Source Code (0)

 
GROUP INFO
Members: 28736
Access Type: Anyone can join

 
GROUPS
.NET
ASP.NET
.NET
C#
ASP
Visual Basic
Java
Java
JSP
EJB
Other
Delphi
C++
Ajax
UML
JavaScript
PHP
Web Design
Web Hosting
SQL Server
Oracle
Project Management
More Groups

 
LEARNING CENTER
TUTORIALS
.NET
.NET Tutorial
ASP Tutorial
ASP.NET Database Tutorial
ASP.NET Development Tips
ASP.Net Security,Internationalisation And Deployment
ASP.NET Server Controls Tips
ASP.NET Tutorial
C Sharp Tutorial
LINQ Tutorial
Web Development
Flex Tutorial
HTML Tutorial
Javascript Tutorial
Learn AJAX Tutorial
PHP Tutorial
Software Development
Database Tutorial
SQL Tutorial
UML Tutorial
Java
Ant Tutorial
EJB 3 Tutorial
Grails Tutorial
Hibernate Tutorial
Java 1.6 Tutorial
Java Tutorial
Java Web Component Tutorial
Java XML Tutorial
JDBC Tutorial
JDK1.5 Tutorial
JSF Tutorial
JSP And J2EE Design Tutorial
JSP Tutorial
Service-Oriented Architecture (SOA) Tutorial For Managers
Spring Tutorial
Struts Tutorial
Tomcat Tutorial

RESOURCES
Q & A (531 )
Source Code (3276 )
Articles (365 )
Books (373 )
Components (1647 )
News (898 )
Websites (1208 )

SUBMISSIONS
Submit Article
Submit Website
Submit News
Submit Source Code
Submit Component

COMMUNITY
Authors
Members Directory
Discussion Forum
Chat

SITE
About Us
Sitemap
Search
Contact Us
Feedback
Tell a Friend
Advertise

 

Home > Java > Member Articles > Database >
 

Hibernate Tutorial


  Author : VisualBuilder.com
  Date Published : 05/13/2007
  Accessed : 21256
   visualbuilder
Next >> 

Developing enterprise applications involves a lot of efforts to store the business objects in the database. Usually,70% of the efforts to develop enterprise applications are writing the code to maintain database connections and save the entities to database. Most of the enterprise applications are developed using Object Oriented techniques. The business logic inside the application flows in the form of objects instead of textual messages as it used to be in the days of structural programming where we had set of variable to perform operations or indicate the state of an entity. Today,Object Oriented technologies are used to solve the complex problems and maintain the business flow. Only saving the objects to the database is a stage where the objects are transformed back to text and stored to the database. To understand this problem,consider the following code snippets.


This is typically how the connection is obtained in Java language.


Class.forName(driverClass);
java.sql.Connection connection = java.sql.DriverManager.getConnection(databaseUrl,databaseUser,databasePassword);


Suppose we have an object of User class,and we need to store this object to the database. Consider the following function:


private void saveUser(User user) throws SQLException
{
    PreparedStatement pstmt = connection.prepareStatement("insert into users values(?,?,?)");
    pstmt.setInt(1,user.getId());
    pstmt.setString(2,user.getName());
    pstmt.setString(3,user.getEmail());
    pstmt.setString(4,user.getAddress());
    pstmt.execute();
}


The problem with this code is that this is scattered everywhere in the application which affects the maintainability of the application. There are many problems with this approach like:



  • Code is scattered at different un-manageable places.

  • If your design changes after developing the application,it will be too expensive to identify the places where changes are required.

  • Difficult to identify and fix the bugs

  • Managing the database connections is a difficult task since the SQL code is scattered,so are the database connections.

  • Managing the transactions is a complex task.


Due to these problems,bug fixing is an accepted stage of an application development process which makes the application too expensive even after the successful completion of development cycle.


It is highly needed to have a mechanism to isolate the database persistent code and write it so efficiently that when there is a change in the database design,it can be easily implemented with the belief that there is no un-identified place which may show a bug later.


Benefits of Relational Database Systems:


searching and sorting is fast
Work with large amounts of data
Work with groups of data
Joining, aggregating
Sharing across multiple users and multiple locations
Concurrency (Transactions)
Support for multiple applications
Consistent Integrity
Constraints at different levels
Transaction isolation



Issues with Relational Database systems:


Database Modeling does not support polymorphism
Business logic in the application server could be duplicated in the database as stored procedures
Does not make use of real world objects
Extra code required to map the Java objects to database objects.


1  2  3  4  5  6  7  8  9  10  11  12  13  14  15  16  17  18  19  20  21  22  Next >>  Next: Part 2: Introduction to Hibernate >>

 
   Printer Friendly
   Email to a friend
   Add to my Favourites  Report Bad Submissions  Submit Feedback
  Download PDF version
 
                 Click each image to add
this page to each site.
 
Related Articles of Java
Previous Article    -     Random Articles    -     Next Article
 
 
 
 
 
 
 
 
Welcome Guest Signup
Member's Panel
EMAIL
PASSWORD
Forgot your password?
New User? Click Here!
 
Resend Activation Email!

SEARCH
 



 
 
 
 
 


Home | Login | About Us | Contact Us | Privacy Policy | Advertising | Feedback Please