SPRING FRAMEWORK
Spring ORM
ORM
• Object/Relational Mapping tools require
proper transaction integration
– synchronization with transactions
• cache c...
ORM
• ORM tools usually support two different transaction
modes
– native transactions through ORM API
– participating in g...
ORM
• Spring provides pre-built integration for
all major ORM providers
–
–
–
–

Hibernate 2.1 / 3.x
TopLink 9.0.4 / 10.1....
ORM
• Example: Hibernate
– Spring's LocalSessionFactoryBean
• setup of Hibernate SessionFactory

– Spring's HibernateTrans...
ORM
• Example: TopLink
– Spring's LocalSessionFactoryBean
• setup of TopLink SessionFactory /
TopLink master Session

– Sp...
ORM
• Newest kid on the block: JPA
– Java Persistence API 1.0
• aka "EJB3 persistence" / "JSR-220 persistence"
• part of t...
• Spring provides generic transaction
management for any kind of Java application
– consistent programming model
– consist...
• Seamless switching between native
transactions and JTA transactions
– consistent programming model across
different depl...
• Explicit support for ORM tools
– transaction synchronization
• scoping of ORM resources

– consistent transaction demarc...
Exercise
1.Make spring application to use Spring ORM
Upcoming SlideShare
Loading in …5
×

Best spring classes in navi mumbai,spring course-provider in navi-mumbai,spring training in navi-mumbai,spring classes in-navi-mumbai

222 views

Published on

best spring classes in-navi-mumbai,spring classes in navi-mumbai,spring course-provider in-navi-mumbai,best spring classes in navi-mumbai,best spring classes in-navi-mumbai,spring classes in navi-mumbai,spring course-provider in-navi-mumbai,best spring classes in navi-mumbai,best spring classes in-navi-mumbai,spring classes in navi-mumbai,spring course-provider in-navi-mumbai,best spring classes in navi-mumbai,

Published in: Education, Technology, Real Estate
0 Comments
0 Likes
Statistics
Notes
  • Be the first to comment

  • Be the first to like this

No Downloads
Views
Total views
222
On SlideShare
0
From Embeds
0
Number of Embeds
1
Actions
Shares
0
Downloads
2
Comments
0
Likes
0
Embeds 0
No embeds

No notes for slide

Best spring classes in navi mumbai,spring course-provider in navi-mumbai,spring training in navi-mumbai,spring classes in-navi-mumbai

  1. 1. SPRING FRAMEWORK
  2. 2. Spring ORM
  3. 3. ORM • Object/Relational Mapping tools require proper transaction integration – synchronization with transactions • cache callbacks on commit / rollback • required for transactional cache handling – scoping of ORM resources • • • • one Hibernate Session per transaction one TopLink UnitOfWork per transaction one JDO PersistenceManager per transaction required for proper transaction isolation
  4. 4. ORM • ORM tools usually support two different transaction modes – native transactions through ORM API – participating in global JTA transactions – -> different programming model! • Spring supports consistent transaction demarcation across all environments – native transactions or global JTA – same transaction demarcation – same DAO implementation model
  5. 5. ORM • Spring provides pre-built integration for all major ORM providers – – – – Hibernate 2.1 / 3.x TopLink 9.0.4 / 10.1.3 JDO 1.0 / 2.0 Apache OJB 1.0 • Set of integration classes per strategy – factories for ORM resources – native transaction managers – DAO implementation helpers
  6. 6. ORM • Example: Hibernate – Spring's LocalSessionFactoryBean • setup of Hibernate SessionFactory – Spring's HibernateTransactionManager • native transactions against single database – Spring's HibernateTemplate • implicit management of Hibernate Sessions • or use SessionFactory.getCurrentSession() – Spring's OpenSessionInViewFilter • seamless lazy loading during view rendering
  7. 7. ORM • Example: TopLink – Spring's LocalSessionFactoryBean • setup of TopLink SessionFactory / TopLink master Session – Spring's TopLinkTransactionManager • native transactions against single database – Spring's TopLinkTemplate • implicit management of TopLink Session / UnitOfWork • or use Session.getActiveSession() / Session.getActiveUnitOfWork()
  8. 8. ORM • Newest kid on the block: JPA – Java Persistence API 1.0 • aka "EJB3 persistence" / "JSR-220 persistence" • part of the forthcoming J2EE 5.0 – optimized for application servers • explicit, strong integration with J2EE transactions • but also usable in a standalone fashion • Spring will support JPA persistence – as further ORM strategy, analogous to JDO – use Spring's transaction management with JPA-based DAOs
  9. 9. • Spring provides generic transaction management for any kind of Java application – consistent programming model – consistent transaction demarcation – seamless switching between different transaction managers • Declarative transaction demarcation – XML-based proxy definitions – JDK 5.0 annotations – alternative: programmatic demarcation
  10. 10. • Seamless switching between native transactions and JTA transactions – consistent programming model across different deployment scenarios – leverage J2EE server when available, while still being able to run outside of J2EE • Full declarative transactions even on Tomcat! – on the other end of the spectrum: WebLogic JTA extensions supported as well – choose deployment environment according to your service needs (scaling both up and down)
  11. 11. • Explicit support for ORM tools – transaction synchronization • scoping of ORM resources – consistent transaction demarcation across native transactions and JTA transactions • with consistent ORM semantics • All major ORM providers supported – Hibernate, TopLink, JDO, JPA, etc – integration comes out-of-the-box! • maintained by Spring team
  12. 12. Exercise 1.Make spring application to use Spring ORM

×