• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

what is ORM exactly??

 
Poonam Agarwal
Ranch Hand
Posts: 324
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hey guys,

I am very new to this forum "ORM".. Is ORM stands for Object Relationship Mapping or is it Object Relational Mapping?? I just start reading concepts about Hibernate... Is this tool is a replacement to SQL/JDBC coding in a JAVA application??

Please help me to clear my doubts about the basic concepts of Hibernate...

Thanks in advance
 
Marco Ehrentreich
best scout
Bartender
Posts: 1294
IntelliJ IDE Java Scala
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Poonam,

ORM is Object Relational Mapping. It's not really a replacement for JDBC and SQL because under the hood it usually uses JDBC/SQL. You can think of it as an easier way for developers to map a Java data model to a corresponding database model in both directions. If you've setup this mapping with Hibernate, Java Persistence API or another ORM framework you don't have to worry any longer about the low level details of database interactions. Basically you define a mapping between Java classes and database tables or class members and table columns and the ORM mapper takes care of the communication between your Java code and an underlying database. Additionally you can still use native SQL statements and JDBC but for the more common use cases you don't have to worry about the database which gives you a lot of advantages, for example it should be very easy to replace the underlying database server with another RDBMS.

I hope now it's a bit clearer If you still have doubts or questions just let me know...

Marco
[ September 12, 2008: Message edited by: Marco Ehrentreich ]
 
Poonam Agarwal
Ranch Hand
Posts: 324
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hey macro,

I really appreciate your inputs.. its really make me help atleast to get the basic idea clear.

I guess Hibernate help to bridge the gap between Object Level Model and Database Model..

please correct me if I said somthing wrong..
 
Jair Rillo Junior
Ranch Hand
Posts: 114
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

I guess Hibernate help to bridge the gap between Object Level Model and Database Model..

please correct me if I said somthing wrong..


Yes!! you're correct.
Using an ORM you won't worry about Database Model. You will keep your application OOP (even in the model/database layer).

Supposing you're using pure JDBC, you have a OOP software, however when you have to deal with the database, you put many and many SQL statementes. Is that OOP? No!! Instead, you will work with Objects in the database model as well.

Furthermore, it is easier work with ORM than JDBC. A large SQL Insert can be changed by a simple: Object.save();

Finally, if you're planning to study ORM, I advice you to have a look at JPA (Java Persistence API)
 
Paul Sturrock
Bartender
Posts: 10336
Eclipse IDE Hibernate Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The gap you are talking about even has a name, its called the Object-Relational impedance mismatch.
 
Lalit Bhatt
Ranch Hand
Posts: 69
Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
ORM is important from the perspective that it helps Object Oriented programming developers to think in terms of OO paradigms. Foe a discussion of ORM concept Introduction to ORM
 
Ekta Matani
Greenhorn
Posts: 14
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Object Relation Mapping is a technique which hibernate uses to modal object oriented paradigm and relational database paradigm.
The object oriented model deals with object, their attributes while relational model deals with tables, their column, tuples.
so these two are altogether different paradigms and there is gap between these two.
to fulfil this gap, hibernate uses ORM which maps both paradigms, where object is mapped to table and property(instance variable) of object is mapped to table column.
 
Paul Sturrock
Bartender
Posts: 10336
Eclipse IDE Hibernate Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Kind and well intentioned though both your answers are, Poonam Agarwal asked this question seven months ago. I don't think they will still be patiently waiting for an answer!
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic