Kickstart Jpa


Published on

Published in: Technology
  • Be the first to comment

  • Be the first to like this

No Downloads
Total views
On SlideShare
From Embeds
Number of Embeds
Embeds 0
No embeds

No notes for slide

Kickstart Jpa

  1. 1.
  2. 2. Kickstart JPA The Tools Max Rydahl Andersen JBoss Tools Lead JBoss, a division of Red Hat|
  3. 3. Speaker’s qualifications Max was online when Stephan was looking for someone to replace a JPA talk Max developed Hibernate Tools Max is a contributor to Eclipse Dali Max is part of Hibernate and Seam team Max leads the development of JBoss Tools and Developer Studio at JBoss 3
  4. 4. Do you need JPA Tools? JPA runtime combines: Java Classes Java Classes Mapping Metadata Java SE/EE Database schema JPA Queries JPA Persistence Provider Mapping Metadata Relational Database Schema Database Design Time Runtime 4
  5. 5. Do you need JPA Tools? How can you tell if they all match? Deploy and run tests? Java Classes slow Java SE/EE find one problem at a time (fix, run, fix, …) definitive Design time validation? JPA Persistence Provider Mapping Metadata quick finds all issues validates against spec runtime may not match spec JPA Queries Relational Completion Database Schema Database Validation Execution Visualization DesignTime Design Time Runtime Runtime 5
  6. 6. About Dali Support for the definition, editing, and deployment of JPA Entities  Simplify mapping definition and editing through: intelligent mapping assistance problem identification  mapping generation Extensible frameworks and tools so vendors and open source projects can provide specific support for their JPA runtimes A subproject of the Web Tools Platform (WTP) 6
  7. 7. Hibernate Tools Own unique feature-set Wizards .hbm.xml editor HQL/JPA Query prototyping Query inline validation/completion Flexible code generation Hibernate Tools Mapping Diagram Uses Hibernate as Core model Dali Adds Hibernate support to Dali Eclipse Web Tools Hibernate Runtime 7
  8. 8. The tools Goals Simplicity Intelligent mapping assistance and automated generation Intuitiveness Use existing and consistent modeling and tooling practices in Eclipse Light-weight views offer assistance but don’t get in the way of power users Compliance Dali: Support any and all JPA 1.0 compliant runtime implementations, Test using JPA Reference Implementation (Dali) Hibernate: Support Hibernate core, annotations, entity manager Extensibility Provide the ability for vendors and open source projects to seamlessly add their own value- add features 8
  9. 9. Dali JPA supports “The Persistence of Memory”— which is the title of a well known Salvador Dali painting.
  10. 10. Dali in Eclipse JPA Mapping Validation JPA Structure View JPA Details View Persistence.xml Editor Java Source Editor enhancements Text Markers Code Completion of table/columns JPA Project Explorer Content 10
  11. 11. Mapping Validation Annotations and/or XML used to define JPA Entities. JDT validates syntax, but doesn’t understand what the annotations mean. 11
  12. 12. Mapping Validation Java Source Editor enhancements Mapping Problem Markers ADDRESS ADD RES CITY … P_CODE S_ID Default mapping won’t work! 12
  13. 13. Mapping Assistance JPA Details View ADDRESS ADD RES CITY … P_CODE S_ID 13
  14. 14. ...for Basic Mapping ADDRESS ADD RES CITY … P_CODE S_ID No Mapping Errors! 14
  15. 15. JPA Structure View Provides a JPA specific view of Java Class or ORM XML Mapping File A thumbnail sketch of how an Entity is mapped Supports navigation between mappings Automatically adjusts to either property or field mapping in Java Represents structure in Java and XML artifacts 15
  16. 16. JPA Project Explorer Provides a JPA specific view of persistence from the persistence.xml down Easily navigate and view the contents of a persistence unit. Represents structure in Java and XML artifacts 16
  17. 17. JPA Perspective/All Views 17
  18. 18. Persistence XML Editor 18
  19. 19. Sync. Persistence.xml In Java SE environment, persistence.xml should list the Entities—Dali offers synchronization 19
  20. 20. Sync. Persistence.xml 20
  21. 21. Hibernate Tools in Eclipse
  22. 22. Hibernate Tools in Eclipse Persistence.xml Editor (Hibernate specific) Java Source Editor enhancements Generate JPA Annotations for existing Java JPA/HQL code completion Validation of JPA/HQL HQL and Criteria Editor Query execution Dynamic SQL Preview .hbm.xml editor Flexible reverse engineering and code generation 22
  23. 23. Hibernate persistence.xml When Hibernate selected the persistence.xml editor has Hibernate specific features 23
  24. 24. .hbm.xml editor Code completion in .hbm.xml (class, properties, types, etc) 24
  25. 25. JPA Queries in Java Editor Code completion & Validation 25
  26. 26. Query prototyping Dynamically edit and execute HQL and Criteria 26
  27. 27. .hbm.xml editor Structured hbm.xml editor 27
  28. 28. Mapping diagram Mapping overview and easy navigation 28
  29. 29. Independent Hibernate Hibernate Tools Setup is not coupled to WTP nor JDT 29
  30. 30. rev.eng & generation You can generate JPA, .hbm.xml, DDL, custom, etc. (also from Ant) 30
  31. 31. Generate Annotations Add JPA Annotations to existing Java model 31
  32. 32. DEMO Dali & Hibernate Tools
  33. 33. Summary Dali—the WTP project bringing Hibernate Tools – the JBoss developer productivity to Tools project for Hibernate JPA Support “normal” Java Projects as Mapping validation to avoid the map, well as Dali JPA projects deploy, debug cycle Add's Hibernate platform to Dali Intelligent mapping assistance to avoid problems and speed up the Provides additional unique features process of mapping Focused around Hibernate including Integrated with WTP to support Hibernate Core, Annotations and development for Java SE and EE JPA Focused on JPA spec 33
  34. 34. How to get it ? Eclipse Dali: Download WTP at Hibernate Tools: Download at JBoss Developer Studio got everything included and configured: 34
  35. 35. Q&A More at 17:25, Room 5: “Making full use of Hibernate Tools”