Ennovation – Behind the       Products     Anish Alex, CTO
Java Persistence Problem    • Closest native language support       – Serialization    • Lifecycle       – Begins and Ends...
Java Persistence Technologies    • Object Relational Mappers – ORM’s       – Map Java objects to Relational database      ...
Java Persistence Technologies4              Evolvus Solutions. Proprietary and Confidential, do not copy, duplicate or dis...
HibernateRelational Persistence for Java
Hibernate - Relational Persistence for Java    •   XML file to map POJO to Tables    •   Configuration    •   Classes to b...
Sample Code ORM
Hibernate ORM    • Generators       –   native       –   increment       –   sequence       –   assigned       –   hilo / ...
Hibernate ORM    • References       – http://www.mkyong.com/tutorials/hibernate-         tutorials/       – http://docs.jb...
Hibernate ORM     • To-Do        –   One-to-Many using foreign keys        –   Many-to-One        –   Many-to-One using fo...
THANK YOU !!Questions / Contact
Upcoming SlideShare
Loading in …5
×

Persistence

220 views
202 views

Published on

Java Persistence

Published in: Technology
0 Comments
0 Likes
Statistics
Notes
  • Be the first to comment

  • Be the first to like this

No Downloads
Views
Total views
220
On SlideShare
0
From Embeds
0
Number of Embeds
3
Actions
Shares
0
Downloads
6
Comments
0
Likes
0
Embeds 0
No embeds

No notes for slide
  • 1. Behind the products 2. IT management peace of mind Freedom of choice Any relational database - oracle/mysql/mssql/db2 Any application server - JBoss, Websphere, Weblogic - even Tomcat! Any os - Windows, Linux, *nix Any hardware - well, almost :-) - no mainframes Good corporate citizen Integrates with monitoring systems - Integrates with various SSO systems - Siteminder, CAS, AD, Custom Solutions Easy test instance creation Built in purge/backup solution Test automation Minimal IT involvement 3. High performance/High Scalability 4. Industrial strength Cluster enabled - Application and database failover 5. Open Source No Vendor Lock-in Community Contribution 6. Device inclusive Tablets / Smart Phones / Desktop
  • Closest to persistence in Java means Serialization Objects created and destroyed based on scope, GC frequency – eventually JVM Objects identified by Memory location by default, or by overriding the equals/hashcode methods No Mapping to Relational databases – Primary Key / Foreign Key / Data type constraints
  • Several competition mechanisms to solve the problem of Java Object Persistence ORM -> Object to Relational Database JDO -> Object to File/XML/Relational database – Multiple targets, JDOQL, Annotations, XML Custom like iBatis -> Using SQL/Stored Procedures JPA -> Object to Relational Database, JQL, Annotations JDBC -> Using SQL’s EJB’s -> Entity Beans
  • Configure which database you want to connect to / the dialect, driver etc.
  • Persistence

    1. 1. Ennovation – Behind the Products Anish Alex, CTO
    2. 2. Java Persistence Problem • Closest native language support – Serialization • Lifecycle – Begins and Ends with JVM • Identity – Equals / Hashcode / Memory Location • Data Types – Int/long/string.. • RDBMS – Long term persistence / Primary Key – SQL – VARCHAR / NUMBER2 Evolvus Solutions. Proprietary and Confidential, do not copy, duplicate or distribute.
    3. 3. Java Persistence Technologies • Object Relational Mappers – ORM’s – Map Java objects to Relational database table records e.g. – Top Link / Hibernate • Java Data Objects (JDO) – Apache jdo • JDBC • Java Persistence API (JPA) – Hibernate – Top Link – Open JPA • EJB • Custom3 Evolvus Solutions. Proprietary and Confidential, do not copy, duplicate or distribute.
    4. 4. Java Persistence Technologies4 Evolvus Solutions. Proprietary and Confidential, do not copy, duplicate or distribute.
    5. 5. HibernateRelational Persistence for Java
    6. 6. Hibernate - Relational Persistence for Java • XML file to map POJO to Tables • Configuration • Classes to bootstrap the framework • JPA Implementation6 Evolvus Solutions. Proprietary and Confidential, do not copy, duplicate or distribute.
    7. 7. Sample Code ORM
    8. 8. Hibernate ORM • Generators – native – increment – sequence – assigned – hilo / identify / uuid.hex / uuid.string / foreign • Version – Prevents invalid overwrites • Property – String – specify length – BigDecimal – specify precision/scale – Date / Timestamp / Long - nothing to specify8 Evolvus Solutions. Proprietary and Confidential, do not copy, duplicate or distribute.
    9. 9. Hibernate ORM • References – http://www.mkyong.com/tutorials/hibernate- tutorials/ – http://docs.jboss.org/hibernate/orm/3.3/refe rence/en/html/index.htmlPrevents invalid overwrites – Sample code - http://codeserver/demo- repository/svndemo/anisht/trunk/training/hib ernate9 Evolvus Solutions. Proprietary and Confidential, do not copy, duplicate or distribute.
    10. 10. Hibernate ORM • To-Do – One-to-Many using foreign keys – Many-to-One – Many-to-One using foreign keys – One-to-One – Run the same examples against SQL Server10 Evolvus Solutions. Proprietary and Confidential, do not copy, duplicate or distribute.
    11. 11. THANK YOU !!Questions / Contact

    ×