SlideShare a Scribd company logo
1 of 15
Ebean Een hibernate killer Hielke Hoeve TopicusOnderwijs
Ebean (Yet another) ORM implementatie Sessies / Autofetching / Queries / Transactions / Async. Query Executions
Sessieloos Sessie management is vies
Autofetching Statistischeanalyse voor lazy loading Ali Ibrahim & William R. Cook University of Texas http://www.cs.utexas.edu/~aibrahim/autofetch/
Queries Makkelijke queries maken
Queries (voorbeeld 1) List<Order> list = Ebean.find(Order.class) 	.join("customer") 	.where().eq("status.code", "SHIPPED") 	.findList();
Queries (voorbeeld 2) find order (orderDate, shipDate) join orderDetails (*) join product (sku, name) where customer.name like :custname 3 auto joins
Queries (voorbeeld 2) select order.orderDate, order.shipDate, 	orderDetails.*, product.sku, product.name from order left outer join orderDetails 	onorderDetails .order = order.id left outer join product on orderDetails.product = product.id inner join customer on customer.id = order.customer where customer.name like :custname
Queries (voorbeeld 3) @NamedQueries(value={ 	@NamedQuery(name="bugsSummary“, query=“..."), 	@NamedQuery(name="bugStatus“, query=“...") }) @Entity @Table(name="s_user") public class User implements Serializable {
Transactions Not invented by me
Async. Query Executions FutureList & PagingList
Async. Query Executions Query<Order> query = Ebean.find(Order.class); FutureList<Order> futureList = query.findFutureList(); if (!futureList.isDone()) 	futureList.cancel(true); List<Order> list = futureList.get(); // or with a timeout List<Order> list2 = futureList.get(30, TimeUnit.SECONDS);
Async. Query Executions PagingList<TOne> pagingList = Ebean.find(TOne.class).findPagingList(pageSize); Future<Integer> futRowCount = pagingList.getFutureRowCount(); Page<TOne> page = pagingList.getPage(0); List<TOne> pageList = page.getList(); int totalRows = page.getTotalRowCount();
Conclusie
Fin

More Related Content

Recently uploaded

+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
?#DUbAI#??##{{(☎️+971_581248768%)**%*]'#abortion pills for sale in dubai@
 
Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and Myths
Joaquim Jorge
 

Recently uploaded (20)

Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
 
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
 
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot TakeoffStrategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
 
Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024
 
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
 
Tech Trends Report 2024 Future Today Institute.pdf
Tech Trends Report 2024 Future Today Institute.pdfTech Trends Report 2024 Future Today Institute.pdf
Tech Trends Report 2024 Future Today Institute.pdf
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt Robison
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
 
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
 
Developing An App To Navigate The Roads of Brazil
Developing An App To Navigate The Roads of BrazilDeveloping An App To Navigate The Roads of Brazil
Developing An App To Navigate The Roads of Brazil
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘
 
Real Time Object Detection Using Open CV
Real Time Object Detection Using Open CVReal Time Object Detection Using Open CV
Real Time Object Detection Using Open CV
 
Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivity
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024
 
[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf
 
What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdf
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day Presentation
 
Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and Myths
 

Featured

Social Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie InsightsSocial Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie Insights
Kurio // The Social Media Age(ncy)
 

Featured (20)

AI Trends in Creative Operations 2024 by Artwork Flow.pdf
AI Trends in Creative Operations 2024 by Artwork Flow.pdfAI Trends in Creative Operations 2024 by Artwork Flow.pdf
AI Trends in Creative Operations 2024 by Artwork Flow.pdf
 
Skeleton Culture Code
Skeleton Culture CodeSkeleton Culture Code
Skeleton Culture Code
 
PEPSICO Presentation to CAGNY Conference Feb 2024
PEPSICO Presentation to CAGNY Conference Feb 2024PEPSICO Presentation to CAGNY Conference Feb 2024
PEPSICO Presentation to CAGNY Conference Feb 2024
 
Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)
 
How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024
 
Social Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie InsightsSocial Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie Insights
 
Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024
 
5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summary5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summary
 
ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd
 
Getting into the tech field. what next
Getting into the tech field. what next Getting into the tech field. what next
Getting into the tech field. what next
 
Google's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search IntentGoogle's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search Intent
 
How to have difficult conversations
How to have difficult conversations How to have difficult conversations
How to have difficult conversations
 
Introduction to Data Science
Introduction to Data ScienceIntroduction to Data Science
Introduction to Data Science
 
Time Management & Productivity - Best Practices
Time Management & Productivity -  Best PracticesTime Management & Productivity -  Best Practices
Time Management & Productivity - Best Practices
 
The six step guide to practical project management
The six step guide to practical project managementThe six step guide to practical project management
The six step guide to practical project management
 
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
 
Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...
Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...
Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...
 
12 Ways to Increase Your Influence at Work
12 Ways to Increase Your Influence at Work12 Ways to Increase Your Influence at Work
12 Ways to Increase Your Influence at Work
 
ChatGPT webinar slides
ChatGPT webinar slidesChatGPT webinar slides
ChatGPT webinar slides
 
More than Just Lines on a Map: Best Practices for U.S Bike Routes
More than Just Lines on a Map: Best Practices for U.S Bike RoutesMore than Just Lines on a Map: Best Practices for U.S Bike Routes
More than Just Lines on a Map: Best Practices for U.S Bike Routes
 

Ebean

  • 1. Ebean Een hibernate killer Hielke Hoeve TopicusOnderwijs
  • 2. Ebean (Yet another) ORM implementatie Sessies / Autofetching / Queries / Transactions / Async. Query Executions
  • 4. Autofetching Statistischeanalyse voor lazy loading Ali Ibrahim & William R. Cook University of Texas http://www.cs.utexas.edu/~aibrahim/autofetch/
  • 6. Queries (voorbeeld 1) List<Order> list = Ebean.find(Order.class) .join("customer") .where().eq("status.code", "SHIPPED") .findList();
  • 7. Queries (voorbeeld 2) find order (orderDate, shipDate) join orderDetails (*) join product (sku, name) where customer.name like :custname 3 auto joins
  • 8. Queries (voorbeeld 2) select order.orderDate, order.shipDate, orderDetails.*, product.sku, product.name from order left outer join orderDetails onorderDetails .order = order.id left outer join product on orderDetails.product = product.id inner join customer on customer.id = order.customer where customer.name like :custname
  • 9. Queries (voorbeeld 3) @NamedQueries(value={ @NamedQuery(name="bugsSummary“, query=“..."), @NamedQuery(name="bugStatus“, query=“...") }) @Entity @Table(name="s_user") public class User implements Serializable {
  • 11. Async. Query Executions FutureList & PagingList
  • 12. Async. Query Executions Query<Order> query = Ebean.find(Order.class); FutureList<Order> futureList = query.findFutureList(); if (!futureList.isDone()) futureList.cancel(true); List<Order> list = futureList.get(); // or with a timeout List<Order> list2 = futureList.get(30, TimeUnit.SECONDS);
  • 13. Async. Query Executions PagingList<TOne> pagingList = Ebean.find(TOne.class).findPagingList(pageSize); Future<Integer> futRowCount = pagingList.getFutureRowCount(); Page<TOne> page = pagingList.getPage(0); List<TOne> pageList = page.getList(); int totalRows = page.getTotalRowCount();
  • 15. Fin

Editor's Notes

  1. Aannames:Enigekennis van DatabasesJava/.net
  2. IkzaljullielatenzienwatEbeaninhoudt, sommigedelenzullenbekendvoorkomen, maareenaantalaspectenzijnveelbelovend. GezienEbeannogaardig in ontwikkeling is kanikniet van elkeonderdeelalles tot in de diepteuitleggen. Maar ten eerste:
  3. Is ebeansessieloos. In tegenstelling tot andere ORM pakkettenheeftebeangeensessie management. In plaatshiervanwordtditvoornamelijk in de entiteitzelfonthouden. Wanneeriemandietswijzigtweet het object zelf of het “dirty” is. Ofwel of het gewijzigd is t.o.v. de database.Watebeanwelheeft is eenpersistance context. Dezezorgtervoordatelke object maar 1 keerbestaat. Je krijgt in feitealleennieuwereferentiesnaarhetzelfde object. Dit is tovandere ORM pakettennietechtanders. De persistance context bestaat van het begin van eentransactie tot het eind van de request cycle.Eennadeel vandezeaanpak is weldatwijzigingen op properties van het entiteit van mutable types nietwordenmeegenomen. Denkhierbijaaneen Date, als je hiereen dag bijopteltwordtdit intern gedaan en niet op het entiteit. Je moetdandus de date vervangen met eennieuwe.Van sessiesgaan we naarautofetching.
  4. Autofetching is een term die bedacht is door Ali Ibrahim en William Cook, zijhebbenditideeuitgewerkt in een paper waarinzeuitleggen hoe autofetchingwerkt. In het kortwerkt het door het gedrag van de applicatie live te analyseren en te kijkenwelkevelden van de opgehaaldeEnteitennodigzijn en dezeautomatisch op te halen. Ditwerkt in combinatie met zogeheten lazy objects, objecten die maargedeeltelijkzijnopgehaalduit de database omzo de round-trip tijd te verkorten.
  5. APIeigen query taal named queries
  6. Net als elk ander ORMkan je via een API queries bouwen, maarwanneerwenselijkkanditook via eeneigen query taal..NET mensenzullendeze method chaining herkennen van Linq, het lijkteropmaardat is danookalles.
  7. // find all the orders (with orderDetails and products)// ... fetching the order id, orderDate and shipDate// ... fetching all the properties for orderDetail// ... fetching the product id, sku and name
  8. Ebeanheeftzijneigentransactiemethoden@TransactionalTxRunnable en TxCallablecreateTransaction() en beginTransaction()Spring transaction support wordtaangewerkt.
  9. // get the row count in the background...// ... otherwise it is fetched on demand// ... when getTotalRowCount() or getTotalPageCount()// ... is called
  10. Demeesteprojectenhebben Hibernate al erg ingeburgerd en ondanksverwoedepogingen van veelontwikkelaarsomtussen de sproetjes Hibernate overalzoveelmogelijk te verwijderenzalditnooitlukken. Met proxies en met specialeactiesom de beloofde performance te halen is diteenhel.Voor nieuweprojectenzal het eenleukideezijn, zelfbenik al bezig met eenkleinprojectjeom Hibernate te verwijderen. Met maareenhandjevolentiteitenzalditniet erg moeilijkzijn, het meestezal in het onderwijs framework Cobra zitten. Hier is hibernate al knap irritant maarechtebikkelsgevenniet op.Een van de voordelenzaltochwelzijndatergeensessiebij je entiteiten is en dat je zodoende je objectenkanbewarenzoals je datzelf correct acht. Met autofetching is ebeaneengoedewegingeslagen want ditzalbijzwaresystementochweleenboelschelen.