Home arrow Java arrow Page 2 - Introducing Hibernate
JAVA

Introducing Hibernate


Databases are complex to implement. This is especially true when components of a database based on two different approaches (i.e. object oriented vs. relational) must interact with each other. Object Relational Mapping (ORM) frameworks can act as mediators between the two approaches. Hibernate, the topic of this article, is an ORM framework for Java.

Author Info:
By: A.P.Rajshekhar
Rating: 4 stars4 stars4 stars4 stars4 stars / 77
December 06, 2005
TABLE OF CONTENTS:
  1. · Introducing Hibernate
  2. · Object Relational Mapping: What is it?
  3. · Getting Started With Hibernate
  4. · Hibernate in the Real World

print this article
SEARCH DEVARTICLES

Introducing Hibernate - Object Relational Mapping: What is it?
(Page 2 of 4 )

The process of transformation from a relational approach to an object oriented approach is known as Object Relational Mapping or ORM for short. By the definition it is clear that to understand ORM, the concepts of both relational and object approaches must be understood. So let’s take a look at them. When the context of discussion is the object oriented approach, the following terms always reappear:

  1. Identity
  2. State
  3. Behavior
  4. Type
  5. Association
  6. Class
  7. Encapsulation
  8. Inheritance

Of these, the last three (class, encapsulation, and inheritance) are well known concepts. So I will be focusing on the first five.

1. Identity:

Identity distinguishes an object from all other objects of similar Type. Every object at the time of creation receives an identity. It is the identity that differentiates an object from an Abstract Data Type (ADT).

2. State:

The state of an object is the value contained by the object. In other words, the state is the current value associated with the Identity. An object can go through various states throughout its lifetime. The state of an object can only be made visible by examining the behavior of the object.

3. Behavior:

    The behavior of an object consists of:

    a. The set of operations or methods that an object provides; this is also called Interface.

    b.  The responses the operation provide to the caller; this is also known as messages.

    c. The changes these operations make to the object.

All of the communication with the object must be done through the interface. The state of an object can be inspected by means of the effects on the behavior. In other words, the returned values of operations and the aftereffects of these operations provide insight into the behavior of the object, which in turn tells us the state of the object.

4. Type:

Objects can support interfaces having different specifications. These specifications form the Type of the Interface, which is implemented by the object. Different objects can be of the same type, and such objects can be interacted with through the same Interface. An object can implement multiple Types.

5. Association:

 An object of one type can be linked with object of another type. This link is known as an Association. Association helps in traversing other objects linked with an object.

Next, you need to understand is the terms used regularly among the wise ones of the relational world. These terms are:

  1. Relation
  2. Attribute
  3. Domain
  4. Tuple

Though these terms are from the mathematics world, they are more used in database terminology. Let's examine each of them.

1. Relation:

This is a truth statement. In essence, a relation defines all of the attributes involved in a predicate. The meaning of the predicate is defined by it. For example, the following relation means that there exists a Person with Social Security No SSN# and whose name is full_name:

Person: {SSN#, full_name}

The other term for relation is table.

2. Attribute:

The name that participates in a relation is identified by an attribute. It also specifies the domain from which the values must come. In other words, an attribute of a relationship specifies the name and the valid values that it can contain. For example:

Person: {SSN#:SSN, full_name:STRING}

specifies that SSN# is of type SSN and the name is SSN#. The well known term for attribute is column.

3. Domain:

It has already been said about domain that it represents the type of values that an attribute can have. Simply put, the domain is the data type. The purpose of the domain is to provide data abstraction. That is, it specifies the possible values of data and the operations upon them. For example in full_name: STRING STRING is the Domain.

4. Tuple:

Like relation, a tuple is a truth statement. The only difference is that tuple is a truth statement with respect to a Relation. It has attribute values matching the attributes in the relation and states the condition that is known to be true. Following is a tuple:

<Person SSN#=”123-55-6547” Name=”John Doe”>

Now that the terminology of both object oriented and relational approaches have been introduced, it's time to introduce the framework that provides mapping between the approaches -- the Hibernate framework.


blog comments powered by Disqus
JAVA ARTICLES

- Java Too Insecure, Says Microsoft Researcher
- Google Beats Oracle in Java Ruling
- Deploying Multiple Java Applets as One
- Deploying Java Applets
- Understanding Deployment Frameworks
- Database Programming in Java Using JDBC
- Extension Interfaces and SAX
- Entities, Handlers and SAX
- Advanced SAX
- Conversions and Java Print Streams
- Formatters and Java Print Streams
- Java Print Streams
- Wildcards, Arrays, and Generics in Java
- Wildcards and Generic Methods in Java
- Finishing the Project: Java Web Development ...

Watch our Tech Videos 
Dev Articles Forums 
 RSS  Articles
 RSS  Forums
 RSS  All Feeds
Write For Us 
Weekly Newsletter
 
Developer Updates  
Free Website Content 
Contact Us 
Site Map 
Privacy Policy 
Support 

Developer Shed Affiliates

 




© 2003-2017 by Developer Shed. All rights reserved. DS Cluster - Follow our Sitemap
Popular Web Development Topics
All Web Development Tutorials