Hibernate persistence
Hibernate Persistence
What is persistence persist data to database or other storage a In Oo world, persistence means persist object to external storage Relational database SQL a Using SQL in Java a Persistence object-oriented applications: ORM
What is Persistence ◼ Persist data to database or other storage. ❑ In OO world, persistence means persist object to external storage. ◼ Relational database ❑ SQL ❑ Using SQL in Java ❑ Persistence object-oriented applications: ORM
What is Hibernate? Popular Open Source(LGPL) Object/Relational Mapping(oRM) tool Transparent persistence for POJOs (Plain Old Java objects Core of JBoss Cmp 2.0 impl
What is Hibernate? ◼ Popular Open Source (LGPL) Object/Relational Mapping (ORM) tool ◼ Transparent persistence for POJOs (Plain Old Java Objects) ◼ Core of JBoss CMP 2.0 impl
Why Hibernate? Minimizes code Does not require a container Model is not tied to persistence implementation, Retains natural object model (transparent)
Why Hibernate? • Minimizes Code • Does not require a container • Model is not tied to persistence implementation, Retains natural object model (transparent)
Object/Relational Mapping Javaobject SOL Table int id; string namei string getName( id [int] primary key, int getId() void setName(string) name [varchar(50) void setId(int) Magic Happens Here (O/R Mapper-1e Hibernate)
Object/Relational Mapping JavaObject int id; String name; String getName() int getId() void setName(String) void setId(int) SQL Table id [int] primary key, name [varchar(50)] Magic Happens Here (O/R Mapper – i.e. Hibernate)