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@
 
Why Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businessWhy Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire business
panagenda
 

Recently uploaded (20)

Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...
Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...
Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...
 
MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...
 
Strategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherStrategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a Fresher
 
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
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024
 
Corporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptxCorporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptx
 
GenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdfGenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdf
 
presentation ICT roal in 21st century education
presentation ICT roal in 21st century educationpresentation ICT roal in 21st century education
presentation ICT roal in 21st century education
 
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
 
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin WoodPolkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
 
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, AdobeApidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
 
Ransomware_Q4_2023. The report. [EN].pdf
Ransomware_Q4_2023. The report. [EN].pdfRansomware_Q4_2023. The report. [EN].pdf
Ransomware_Q4_2023. The report. [EN].pdf
 
+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...
 
Apidays Singapore 2024 - Modernizing Securities Finance by Madhu Subbu
Apidays Singapore 2024 - Modernizing Securities Finance by Madhu SubbuApidays Singapore 2024 - Modernizing Securities Finance by Madhu Subbu
Apidays Singapore 2024 - Modernizing Securities Finance by Madhu Subbu
 
Why Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businessWhy Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire business
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
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...
 
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...
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processors
 

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.