apache cayenne: a java orm alternative
TRANSCRIPT
![Page 1: Apache Cayenne: a Java ORM Alternative](https://reader034.vdocument.in/reader034/viewer/2022052705/5882522f1a28ab37158b6f19/html5/thumbnails/1.jpg)
Apache Cayennea Java ORM Alternativeby Andrus Adamchik @andrus_a
![Page 2: Apache Cayenne: a Java ORM Alternative](https://reader034.vdocument.in/reader034/viewer/2022052705/5882522f1a28ab37158b6f19/html5/thumbnails/2.jpg)
About Me
• Member and VP of the Apache Software Foundation.• Run a company called ObjectStyle.• Open source developer: ORM, dependency injection, REST,
no-container, etc.
![Page 3: Apache Cayenne: a Java ORM Alternative](https://reader034.vdocument.in/reader034/viewer/2022052705/5882522f1a28ab37158b6f19/html5/thumbnails/3.jpg)
What is Apache Cayenne• A mature user-friendly Java ORM with modeling tools.• An alternative object persistence philosophy.• Current dev version is 4.0 (209 new features and bug fixes).• Used by commercial, government and educational orgs on
all continents.
![Page 4: Apache Cayenne: a Java ORM Alternative](https://reader034.vdocument.in/reader034/viewer/2022052705/5882522f1a28ab37158b6f19/html5/thumbnails/4.jpg)
History• 2001: Inception.• 2002: First Alpha Release and a large production
deployment.• 2006: "ObjectStyle Cayenne" becomes "Apache Cayenne".• 2016: Active project with great community.
![Page 5: Apache Cayenne: a Java ORM Alternative](https://reader034.vdocument.in/reader034/viewer/2022052705/5882522f1a28ab37158b6f19/html5/thumbnails/5.jpg)
"Community over Code"• A community-driven project under Apache Foundation
umbrella.• Dozens of contributors over the years.• 8 PMC (Project Management Committee) members.• Meritocracy - anyone can earn a vote by contributing.
![Page 6: Apache Cayenne: a Java ORM Alternative](https://reader034.vdocument.in/reader034/viewer/2022052705/5882522f1a28ab37158b6f19/html5/thumbnails/6.jpg)
Demo
![Page 7: Apache Cayenne: a Java ORM Alternative](https://reader034.vdocument.in/reader034/viewer/2022052705/5882522f1a28ab37158b6f19/html5/thumbnails/7.jpg)
Project Setup• CayenneModeler helps to setup and maintain the project.• DB-first approach to ORM gets you started quickly with
existing DB.• Auto sync of DB changes without overriding custom
mapping.
![Page 8: Apache Cayenne: a Java ORM Alternative](https://reader034.vdocument.in/reader034/viewer/2022052705/5882522f1a28ab37158b6f19/html5/thumbnails/8.jpg)
Starting Cayenne
![Page 9: Apache Cayenne: a Java ORM Alternative](https://reader034.vdocument.in/reader034/viewer/2022052705/5882522f1a28ab37158b6f19/html5/thumbnails/9.jpg)
Obtaining ObjectContext
![Page 10: Apache Cayenne: a Java ORM Alternative](https://reader034.vdocument.in/reader034/viewer/2022052705/5882522f1a28ab37158b6f19/html5/thumbnails/10.jpg)
Running a Query
![Page 11: Apache Cayenne: a Java ORM Alternative](https://reader034.vdocument.in/reader034/viewer/2022052705/5882522f1a28ab37158b6f19/html5/thumbnails/11.jpg)
Editing and Saving Objects
![Page 12: Apache Cayenne: a Java ORM Alternative](https://reader034.vdocument.in/reader034/viewer/2022052705/5882522f1a28ab37158b6f19/html5/thumbnails/12.jpg)
Cayenne vs. JPA / Hibernate
![Page 13: Apache Cayenne: a Java ORM Alternative](https://reader034.vdocument.in/reader034/viewer/2022052705/5882522f1a28ab37158b6f19/html5/thumbnails/13.jpg)
Transactions• JPA/Hibernate were born in the EJB world. Both are
transaction-centric.• Cayenne transactions are implicit, unless you want it
otherwise.• Cayenne is not connected to DB between JDBC operations.• Better connection pool reuse and no user TX code.
![Page 14: Apache Cayenne: a Java ORM Alternative](https://reader034.vdocument.in/reader034/viewer/2022052705/5882522f1a28ab37158b6f19/html5/thumbnails/14.jpg)
ObjectContext• An isolated unit of work (each context has its own copy of objects).
• Not holding any open resources (connections, etc.), doesn't need to be closed.
• Fairly cheap - you can create as many instances as you need.
• Can be nested (similar to nested transactions, only in memory).
• Object graph can be expanded lazily as object relationships are traversed.
![Page 15: Apache Cayenne: a Java ORM Alternative](https://reader034.vdocument.in/reader034/viewer/2022052705/5882522f1a28ab37158b6f19/html5/thumbnails/15.jpg)
Persistent Object• Framework-provided superclass - CayenneDataObject.• No pollution with ORM annotations.• Generic property access API.• Generic mapping - can be created in runtime.
![Page 16: Apache Cayenne: a Java ORM Alternative](https://reader034.vdocument.in/reader034/viewer/2022052705/5882522f1a28ab37158b6f19/html5/thumbnails/16.jpg)
Other Good Things
![Page 17: Apache Cayenne: a Java ORM Alternative](https://reader034.vdocument.in/reader034/viewer/2022052705/5882522f1a28ab37158b6f19/html5/thumbnails/17.jpg)
Dependency Injection (DI)
![Page 18: Apache Cayenne: a Java ORM Alternative](https://reader034.vdocument.in/reader034/viewer/2022052705/5882522f1a28ab37158b6f19/html5/thumbnails/18.jpg)
Nested Contexts
![Page 19: Apache Cayenne: a Java ORM Alternative](https://reader034.vdocument.in/reader034/viewer/2022052705/5882522f1a28ab37158b6f19/html5/thumbnails/19.jpg)
Remote Object Persistence
![Page 20: Apache Cayenne: a Java ORM Alternative](https://reader034.vdocument.in/reader034/viewer/2022052705/5882522f1a28ab37158b6f19/html5/thumbnails/20.jpg)
Caching
![Page 21: Apache Cayenne: a Java ORM Alternative](https://reader034.vdocument.in/reader034/viewer/2022052705/5882522f1a28ab37158b6f19/html5/thumbnails/21.jpg)
Handling Large Result Sets
![Page 22: Apache Cayenne: a Java ORM Alternative](https://reader034.vdocument.in/reader034/viewer/2022052705/5882522f1a28ab37158b6f19/html5/thumbnails/22.jpg)
Batch Iterator
![Page 23: Apache Cayenne: a Java ORM Alternative](https://reader034.vdocument.in/reader034/viewer/2022052705/5882522f1a28ab37158b6f19/html5/thumbnails/23.jpg)
cayenne-crypto
![Page 24: Apache Cayenne: a Java ORM Alternative](https://reader034.vdocument.in/reader034/viewer/2022052705/5882522f1a28ab37158b6f19/html5/thumbnails/24.jpg)
Why Cayenne?• Mature, performant, user-friendly.• Opinionated on the side of usability.• Not obsessed about transactions. Smooth object graph
navigation.• Community-driven. You can have a voice!
![Page 25: Apache Cayenne: a Java ORM Alternative](https://reader034.vdocument.in/reader034/viewer/2022052705/5882522f1a28ab37158b6f19/html5/thumbnails/25.jpg)
Questions?
• @ApacheCayenne• http://cayenne.apache.org/• https://github.com/apache/cayenne