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.
Standalone GORM<br />Michael Collado<br />
What is Hibernate?<br />Object –Relational mapping tool<br />Object-Oriented querying<br />Database agnostic query languag...
Typical Hibernate Java bean and configuration<br />Event.java<br />Event.hbm.xml<br />
What is GORM?<br />Groovy layer over Hibernate<br />Convention over configuration mapping<br />Dynamic finder/persistence ...
Equivalent GORM entity definition<br />Event.groovv<br />
GORM in Java<br />Hurdles<br />No dynamic methods in Java<br />No dynamic typing in Java<br />Cross-compilation<br />Semic...
Maven groovy plugin
Intermediary entity manager</li></li></ul><li>Configure Maven build<br />pom.xml<br />
Set up GORM in Spring<br />GORM XML namespace<br />
Add sessionFactory bean and dependencies<br />
Create TestBean entity<br />TestBean.groovy<br />
Create TestBean entity<br />
Use Java interface to bridge Java - Groovy<br />EntityManager.java<br />TestBeanManager.java<br />
Using GORM dynamic methods<br />TestBeanManagerImpl.groovy<br />
This works… but…<br />My database schema looks like this:<br />
Groovy Metaprogramming<br />Use JDK Proxy to implement interfaces<br />Use Groovy MetaMethods to call GORM methods dynamic...
DynamicManagerImpl.groovy<br />
Upcoming SlideShare
Loading in …5
×

Standalone GORM

2,496 views

Published on

Published in: Technology
  • Be the first to comment

Standalone GORM

  1. 1. Standalone GORM<br />Michael Collado<br />
  2. 2. What is Hibernate?<br />Object –Relational mapping tool<br />Object-Oriented querying<br />Database agnostic query language<br />XML configuration or annotations<br />
  3. 3. Typical Hibernate Java bean and configuration<br />Event.java<br />Event.hbm.xml<br />
  4. 4.
  5. 5. What is GORM?<br />Groovy layer over Hibernate<br />Convention over configuration mapping<br />Dynamic finder/persistence methods<br />DSL based querying<br />
  6. 6. Equivalent GORM entity definition<br />Event.groovv<br />
  7. 7.
  8. 8. GORM in Java<br />Hurdles<br />No dynamic methods in Java<br />No dynamic typing in Java<br />Cross-compilation<br />Semicolons<br /><ul><li>Solutions
  9. 9. Maven groovy plugin
  10. 10. Intermediary entity manager</li></li></ul><li>Configure Maven build<br />pom.xml<br />
  11. 11. Set up GORM in Spring<br />GORM XML namespace<br />
  12. 12. Add sessionFactory bean and dependencies<br />
  13. 13. Create TestBean entity<br />TestBean.groovy<br />
  14. 14. Create TestBean entity<br />
  15. 15. Use Java interface to bridge Java - Groovy<br />EntityManager.java<br />TestBeanManager.java<br />
  16. 16. Using GORM dynamic methods<br />TestBeanManagerImpl.groovy<br />
  17. 17. This works… but…<br />My database schema looks like this:<br />
  18. 18. Groovy Metaprogramming<br />Use JDK Proxy to implement interfaces<br />Use Groovy MetaMethods to call GORM methods dynamically<br />invokeMethod<br />methodMissing<br />
  19. 19. DynamicManagerImpl.groovy<br />
  20. 20. Demo<br />

×