Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.

Persistence

272 views

Published on

Java Persistence

Published in: Technology
  • Be the first to comment

  • Be the first to like this

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

×