SlideShare une entreprise Scribd logo
1  sur  33
Easy ORM-ness with Objectify-Appengine Meetu Maltiar Inphina Technologies
Overall Presentation Goal Google Datastore Basics Options available for managing persistence Objectify-Appengine Demo of an application using Objectify
Enough About Me Senior Software Engineer at Inphina Technologies that interest me:      Cloud Computing      Scala      Hadoop
Datastore Basics Entities Operations Keys Transactions
Entities An Entity is an object’s worth of data in the datastore In datastore an Entity is like HashMap-like object of type Entity  Datastore is conceptually a HashMap of keys to entities, and an Entity is conceptually a HashMap of name/value pairs
Operations Get() an entity as a whole from datastore Put() an entity as whole in datastore Delete() an entity from datastore Query() for entities matching criteria you define
Keys In the datastore, entities are identified by the id (or name) and a kind, which corresponds to the type of Object you are storing.  So, to get Employee #111 from datastore, we need to call something like get_from_datastore (“Employee”, 111)
Keys Continued There is actually a third parameter required to identify an entity and it is called parent Parent places the child in the same entity group as the parent Parent (which can be null for the un-parented, root entity) is also required to uniquely identify an Entity.
Keys Continued So, to get Employee #111 from datastore we need to call something equivalent to: get_from_datastore (“Employee”, 111, null) or, get_from_datastore (“Employee”, 111, the_parent).  Instead of passing three parameters datastore wraps it in a single Object called Key.
Transactions Data gets stored in gigantic form of thousands of machines In order to perform an atomic transaction datastore requires that entities lie on same servers. To give us more control over where our data is stored, the datastore has a concept of an entity group To give us more control over where our data is stored, the datastore has a concept of an entity group
Transactions Continued Within a Transaction we can access data from a single entity group Choose entity groups carefully Why not have everything in a single entity group? Google restricts number of requests per second per entity group
Executing Transactions When we execute get(), put(), delete() or query() in transaction We must operate it on single entity group All operations will either fail or succeed completely If another process modifies the data before commit datastore operation will fail
Tools
Persistence Options JPA/JDO Google Datastore Persistence Frameworks on GAE   Objectify-Appengine   Twig   Simple Datastore   Slim3
Google Datastore Challenges Supports just four operations It persists GAE-Specific entity classes rather than POJO’s Datastore Keys are untyped
JPA/JDO Challenges Extra Cruft Fetch Groups    Detaching    Owned/Unownedrelationships Leaky Abstraction Keys    Entity Groups    Indexes
Developers Dilemma
Objectify It lets you persist, retrieve, delete and query typed objects All native datastore features are supported It provides type safe key and query classes
Objectify Design Considerations Minimally impacts cold start time. It is light weight No external dependencies apart from GAE SDK
Working With Datastore Entity ent = new Entity(“car”); ent.setProperty(“color”, “red”); ent.setProperty(“doors”, 2); service.put(ent);
Objectify ORMNess Objects! Employee emp = new Employee(); emp.setFirstName(“John”); emp.setLastName(“Smith”); service.put(emp);
An Objectify Entity public class Employee {   @Id Long id;    private String firstName;    private String lastName; }
get() Operation Objectify ofy = Objectifyservice.begin(); Employee emp = ofy.get(Employee.class, 123); Map<Long, Employee> employees =  ofy.get(Employee.class, 123, 124, 125);
put() Operation Objectify ofy = Objectifyservice.begin(); Employee emp = new Employee(“John”, “adams”); ofy.put(emp); System.out.println(“Id Generated is ” + emp.getId()); List<Employee> employees = createEmployees(); ofy.put(employees);
delete() Operation Objectify ofy = Objectifyservice.begin(); ofy.delete(Employee.class, 123); Employee emp = // get Employee from some where ofy.delete(emp);
query() Operation Objectify ofy = Objectifyservice.begin(); List<Employee> employees =        ofy.query(Employee.class).filter(“firstName =”, “John”)
Demo     get()     put()     delete()     query()
Objectify Best Practices Use a DAO to register entities Automatic Scanning not advised adds to initialization time     will require dependency jars apart from GAE     will require changes in web.xml GAE spins down the instance when not in use. When it comes up the request is slow because of added initialization time. This is called cold start.
Objectify Best Practices … Use Batch Gets Instead of Queries Use Indexes sparingly By default every field of object will be indexed. It comes with heavy computational price. Use @Unindexed  on entity level and @Indexed at fields required for query Avoid @Parent In JPA “owned” entity relationship provides referential integrity checking and cascading deletes and saves. Not so here.
Happy Developer
Conclusion JDO/JPA learning curve is steep due to App Engine’s non-relational nature and unique concepts such as entity groups, owned and un-owned relationships. Google Datastore is low level. It makes no pretense of being relational but also does not allow working with objects. It just stores the objects of type com.google.appengine.api.datastore.Entity Objectify is light weight and it preserves the simplicity and transparency of low level API and does all work converting to and from POJOS to Entity Objects.
mmaltiar@inphina.com www.inphina.com http://thoughts.inphina.com
References Objectify-Appengine http://code.google.com/p/objectify-appengine/ Google IO 2011 Session on highly productive gwt rapid development with app-engine objectify-requestfactory and gwt-platform Twitter mining with Objectify-Appengine http://www.ibm.com/developerworks/java/library/j-javadev2-14/?ca=drs-

Contenu connexe

Tendances

Certification preparation - Error Handling and Troubleshooting recap.pptx
Certification preparation - Error Handling and Troubleshooting recap.pptxCertification preparation - Error Handling and Troubleshooting recap.pptx
Certification preparation - Error Handling and Troubleshooting recap.pptxRohit Radhakrishnan
 
Testing database content with DBUnit. My experience.
Testing database content with DBUnit. My experience.Testing database content with DBUnit. My experience.
Testing database content with DBUnit. My experience.Serhii Kartashov
 
Intro To Hibernate
Intro To HibernateIntro To Hibernate
Intro To HibernateAmit Himani
 
Entity Persistence with JPA
Entity Persistence with JPAEntity Persistence with JPA
Entity Persistence with JPASubin Sugunan
 
Object identification and its management
Object identification and its managementObject identification and its management
Object identification and its managementVinay Kumar Pulabaigari
 
Introduction to JPA and Hibernate including examples
Introduction to JPA and Hibernate including examplesIntroduction to JPA and Hibernate including examples
Introduction to JPA and Hibernate including examplesecosio GmbH
 
Introduction to hibernate
Introduction to hibernateIntroduction to hibernate
Introduction to hibernatehr1383
 
Hibernate complete Training
Hibernate complete TrainingHibernate complete Training
Hibernate complete Trainingsourabh aggarwal
 
ERRest - Designing a good REST service
ERRest - Designing a good REST serviceERRest - Designing a good REST service
ERRest - Designing a good REST serviceWO Community
 
Introduction to Hibernate Framework
Introduction to Hibernate FrameworkIntroduction to Hibernate Framework
Introduction to Hibernate FrameworkRaveendra R
 
Hibernate training mumbai_hql
Hibernate training mumbai_hqlHibernate training mumbai_hql
Hibernate training mumbai_hqlvibrantuser
 
JPA 2.1 performance tuning tips
JPA 2.1 performance tuning tipsJPA 2.1 performance tuning tips
JPA 2.1 performance tuning tipsosa_ora
 

Tendances (19)

Certification preparation - Error Handling and Troubleshooting recap.pptx
Certification preparation - Error Handling and Troubleshooting recap.pptxCertification preparation - Error Handling and Troubleshooting recap.pptx
Certification preparation - Error Handling and Troubleshooting recap.pptx
 
Testing database content with DBUnit. My experience.
Testing database content with DBUnit. My experience.Testing database content with DBUnit. My experience.
Testing database content with DBUnit. My experience.
 
hibernate with JPA
hibernate with JPAhibernate with JPA
hibernate with JPA
 
Intro To Hibernate
Intro To HibernateIntro To Hibernate
Intro To Hibernate
 
Entity Persistence with JPA
Entity Persistence with JPAEntity Persistence with JPA
Entity Persistence with JPA
 
Object identification and its management
Object identification and its managementObject identification and its management
Object identification and its management
 
ERRest in Depth
ERRest in DepthERRest in Depth
ERRest in Depth
 
Introduction to JPA and Hibernate including examples
Introduction to JPA and Hibernate including examplesIntroduction to JPA and Hibernate including examples
Introduction to JPA and Hibernate including examples
 
ERRest
ERRestERRest
ERRest
 
Introduction to hibernate
Introduction to hibernateIntroduction to hibernate
Introduction to hibernate
 
Jpa 2.1 Application Development
Jpa 2.1 Application DevelopmentJpa 2.1 Application Development
Jpa 2.1 Application Development
 
Hibernate complete Training
Hibernate complete TrainingHibernate complete Training
Hibernate complete Training
 
JPA Best Practices
JPA Best PracticesJPA Best Practices
JPA Best Practices
 
ERRest - Designing a good REST service
ERRest - Designing a good REST serviceERRest - Designing a good REST service
ERRest - Designing a good REST service
 
Introduction to Hibernate Framework
Introduction to Hibernate FrameworkIntroduction to Hibernate Framework
Introduction to Hibernate Framework
 
Hibernate
HibernateHibernate
Hibernate
 
Spring data jpa
Spring data jpaSpring data jpa
Spring data jpa
 
Hibernate training mumbai_hql
Hibernate training mumbai_hqlHibernate training mumbai_hql
Hibernate training mumbai_hql
 
JPA 2.1 performance tuning tips
JPA 2.1 performance tuning tipsJPA 2.1 performance tuning tips
JPA 2.1 performance tuning tips
 

En vedette

22nd june Run Against Tobacco project report
22nd june Run Against Tobacco project report 22nd june Run Against Tobacco project report
22nd june Run Against Tobacco project report AmitSamarth
 
Testing your application on Google App Engine
Testing your application on Google App EngineTesting your application on Google App Engine
Testing your application on Google App EngineInphina Technologies
 
Google appenginemigrationcasestudy
Google appenginemigrationcasestudyGoogle appenginemigrationcasestudy
Google appenginemigrationcasestudyInphina Technologies
 
God Bless America Presentation
God Bless America PresentationGod Bless America Presentation
God Bless America Presentationslblue
 
Urbanising India and health issues
Urbanising India and health issuesUrbanising India and health issues
Urbanising India and health issuesAmitSamarth
 
Urban Planning to address Non-Communicable diseases
Urban Planning to address Non-Communicable diseasesUrban Planning to address Non-Communicable diseases
Urban Planning to address Non-Communicable diseasesAmitSamarth
 
Facilitair en Gebouwbeheer Werken in optimale vrijheid
Facilitair en Gebouwbeheer Werken in optimale vrijheidFacilitair en Gebouwbeheer Werken in optimale vrijheid
Facilitair en Gebouwbeheer Werken in optimale vrijheidProminent Comfortproducten BV
 
Healthy Cities India
Healthy Cities IndiaHealthy Cities India
Healthy Cities IndiaAmitSamarth
 
Ironman 15th March
Ironman 15th MarchIronman 15th March
Ironman 15th MarchAmitSamarth
 
Dynamic and Static Modeling
Dynamic and Static ModelingDynamic and Static Modeling
Dynamic and Static ModelingSaurabh Kumar
 

En vedette (16)

The doll
The doll The doll
The doll
 
22nd june Run Against Tobacco project report
22nd june Run Against Tobacco project report 22nd june Run Against Tobacco project report
22nd june Run Against Tobacco project report
 
Testing your application on Google App Engine
Testing your application on Google App EngineTesting your application on Google App Engine
Testing your application on Google App Engine
 
Inphina cloud
Inphina cloudInphina cloud
Inphina cloud
 
Google appenginemigrationcasestudy
Google appenginemigrationcasestudyGoogle appenginemigrationcasestudy
Google appenginemigrationcasestudy
 
God Bless America Presentation
God Bless America PresentationGod Bless America Presentation
God Bless America Presentation
 
Inphina at a glance
Inphina at a glanceInphina at a glance
Inphina at a glance
 
Urbanising India and health issues
Urbanising India and health issuesUrbanising India and health issues
Urbanising India and health issues
 
Preparing yourdataforcloud
Preparing yourdataforcloudPreparing yourdataforcloud
Preparing yourdataforcloud
 
Urban Planning to address Non-Communicable diseases
Urban Planning to address Non-Communicable diseasesUrban Planning to address Non-Communicable diseases
Urban Planning to address Non-Communicable diseases
 
Facilitair en Gebouwbeheer Werken in optimale vrijheid
Facilitair en Gebouwbeheer Werken in optimale vrijheidFacilitair en Gebouwbeheer Werken in optimale vrijheid
Facilitair en Gebouwbeheer Werken in optimale vrijheid
 
Healthy Cities India
Healthy Cities IndiaHealthy Cities India
Healthy Cities India
 
Ironman 15th March
Ironman 15th MarchIronman 15th March
Ironman 15th March
 
Scala test
Scala testScala test
Scala test
 
Cloud Foundry Impressions
Cloud Foundry Impressions Cloud Foundry Impressions
Cloud Foundry Impressions
 
Dynamic and Static Modeling
Dynamic and Static ModelingDynamic and Static Modeling
Dynamic and Static Modeling
 

Similaire à Easy ORMness with Objectify-Appengine

Java Web Programming on Google Cloud Platform [2/3] : Datastore
Java Web Programming on Google Cloud Platform [2/3] : DatastoreJava Web Programming on Google Cloud Platform [2/3] : Datastore
Java Web Programming on Google Cloud Platform [2/3] : DatastoreIMC Institute
 
S03 hybrid app_and_gae_datastore_v1.0
S03 hybrid app_and_gae_datastore_v1.0S03 hybrid app_and_gae_datastore_v1.0
S03 hybrid app_and_gae_datastore_v1.0Sun-Jin Jang
 
JavaOne 2007 - TS4721
JavaOne 2007 - TS4721 JavaOne 2007 - TS4721
JavaOne 2007 - TS4721 Edgar Silva
 
Java Enterprise Performance - Unburdended Applications
Java Enterprise Performance - Unburdended ApplicationsJava Enterprise Performance - Unburdended Applications
Java Enterprise Performance - Unburdended ApplicationsLucas Jellema
 
The 90-Day Startup with Google AppEngine for Java
The 90-Day Startup with Google AppEngine for JavaThe 90-Day Startup with Google AppEngine for Java
The 90-Day Startup with Google AppEngine for JavaDavid Chandler
 
Spring Data JPA in detail with spring boot
Spring Data JPA in detail with spring bootSpring Data JPA in detail with spring boot
Spring Data JPA in detail with spring bootrinky1234
 
PHP Barcelona 2010 - Architecture and testability
PHP Barcelona 2010 - Architecture and testabilityPHP Barcelona 2010 - Architecture and testability
PHP Barcelona 2010 - Architecture and testabilityGiorgio Sironi
 
PyCon India 2010 Building Scalable apps using appengine
PyCon India 2010 Building Scalable apps using appenginePyCon India 2010 Building Scalable apps using appengine
PyCon India 2010 Building Scalable apps using appenginePranav Prakash
 
SPCA2013 - SharePoint Nightmares - Coding Patterns and Practices
SPCA2013 - SharePoint Nightmares - Coding Patterns and PracticesSPCA2013 - SharePoint Nightmares - Coding Patterns and Practices
SPCA2013 - SharePoint Nightmares - Coding Patterns and PracticesNCCOMMS
 
Performance Tuning of .NET Application
Performance Tuning of .NET ApplicationPerformance Tuning of .NET Application
Performance Tuning of .NET ApplicationMainul Islam, CSM®
 
Wcf data services
Wcf data servicesWcf data services
Wcf data servicesEyal Vardi
 
Data Seeding via Parameterized API Requests
Data Seeding via Parameterized API RequestsData Seeding via Parameterized API Requests
Data Seeding via Parameterized API RequestsRapidValue
 
Spring Data JPA USE FOR CREATING DATA JPA
Spring Data JPA USE FOR CREATING DATA  JPASpring Data JPA USE FOR CREATING DATA  JPA
Spring Data JPA USE FOR CREATING DATA JPAmichaelaaron25322
 
Deferred Processing in Ruby - Philly rb - August 2011
Deferred Processing in Ruby - Philly rb - August 2011Deferred Processing in Ruby - Philly rb - August 2011
Deferred Processing in Ruby - Philly rb - August 2011rob_dimarco
 
Introducing Struts 2
Introducing Struts 2Introducing Struts 2
Introducing Struts 2wiradikusuma
 

Similaire à Easy ORMness with Objectify-Appengine (20)

Java Web Programming on Google Cloud Platform [2/3] : Datastore
Java Web Programming on Google Cloud Platform [2/3] : DatastoreJava Web Programming on Google Cloud Platform [2/3] : Datastore
Java Web Programming on Google Cloud Platform [2/3] : Datastore
 
S03 hybrid app_and_gae_datastore_v1.0
S03 hybrid app_and_gae_datastore_v1.0S03 hybrid app_and_gae_datastore_v1.0
S03 hybrid app_and_gae_datastore_v1.0
 
JavaOne 2007 - TS4721
JavaOne 2007 - TS4721 JavaOne 2007 - TS4721
JavaOne 2007 - TS4721
 
Java Enterprise Performance - Unburdended Applications
Java Enterprise Performance - Unburdended ApplicationsJava Enterprise Performance - Unburdended Applications
Java Enterprise Performance - Unburdended Applications
 
The 90-Day Startup with Google AppEngine for Java
The 90-Day Startup with Google AppEngine for JavaThe 90-Day Startup with Google AppEngine for Java
The 90-Day Startup with Google AppEngine for Java
 
Spring data requery
Spring data requerySpring data requery
Spring data requery
 
Spring Data JPA in detail with spring boot
Spring Data JPA in detail with spring bootSpring Data JPA in detail with spring boot
Spring Data JPA in detail with spring boot
 
Struts2
Struts2Struts2
Struts2
 
PHP Barcelona 2010 - Architecture and testability
PHP Barcelona 2010 - Architecture and testabilityPHP Barcelona 2010 - Architecture and testability
PHP Barcelona 2010 - Architecture and testability
 
PyCon India 2010 Building Scalable apps using appengine
PyCon India 2010 Building Scalable apps using appenginePyCon India 2010 Building Scalable apps using appengine
PyCon India 2010 Building Scalable apps using appengine
 
SPCA2013 - SharePoint Nightmares - Coding Patterns and Practices
SPCA2013 - SharePoint Nightmares - Coding Patterns and PracticesSPCA2013 - SharePoint Nightmares - Coding Patterns and Practices
SPCA2013 - SharePoint Nightmares - Coding Patterns and Practices
 
Django design-patterns
Django design-patternsDjango design-patterns
Django design-patterns
 
Performance Tuning of .NET Application
Performance Tuning of .NET ApplicationPerformance Tuning of .NET Application
Performance Tuning of .NET Application
 
ORM JPA
ORM JPAORM JPA
ORM JPA
 
Wcf data services
Wcf data servicesWcf data services
Wcf data services
 
Data Seeding via Parameterized API Requests
Data Seeding via Parameterized API RequestsData Seeding via Parameterized API Requests
Data Seeding via Parameterized API Requests
 
Spring Data JPA USE FOR CREATING DATA JPA
Spring Data JPA USE FOR CREATING DATA  JPASpring Data JPA USE FOR CREATING DATA  JPA
Spring Data JPA USE FOR CREATING DATA JPA
 
Deferred Processing in Ruby - Philly rb - August 2011
Deferred Processing in Ruby - Philly rb - August 2011Deferred Processing in Ruby - Philly rb - August 2011
Deferred Processing in Ruby - Philly rb - August 2011
 
Dapper performance
Dapper performanceDapper performance
Dapper performance
 
Introducing Struts 2
Introducing Struts 2Introducing Struts 2
Introducing Struts 2
 

Plus de Inphina Technologies

Plus de Inphina Technologies (6)

Scala collections
Scala collectionsScala collections
Scala collections
 
Cloud slam2011 multi-tenancy
Cloud slam2011 multi-tenancyCloud slam2011 multi-tenancy
Cloud slam2011 multi-tenancy
 
Multi-Tenancy in the Cloud
Multi-Tenancy in the CloudMulti-Tenancy in the Cloud
Multi-Tenancy in the Cloud
 
Multi-tenancy in the cloud
Multi-tenancy in the cloudMulti-tenancy in the cloud
Multi-tenancy in the cloud
 
Preparing your data for the cloud
Preparing your data for the cloudPreparing your data for the cloud
Preparing your data for the cloud
 
Getting started with jClouds
Getting started with jCloudsGetting started with jClouds
Getting started with jClouds
 

Dernier

TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024Lonnie McRorey
 
Commit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easyCommit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easyAlfredo García Lavilla
 
What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024Stephanie Beckett
 
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)Mark Simos
 
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks..."LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...Fwdays
 
CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):comworks
 
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek SchlawackFwdays
 
Developer Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQLDeveloper Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQLScyllaDB
 
Designing IA for AI - Information Architecture Conference 2024
Designing IA for AI - Information Architecture Conference 2024Designing IA for AI - Information Architecture Conference 2024
Designing IA for AI - Information Architecture Conference 2024Enterprise Knowledge
 
Connect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck PresentationConnect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck PresentationSlibray Presentation
 
Anypoint Exchange: It’s Not Just a Repo!
Anypoint Exchange: It’s Not Just a Repo!Anypoint Exchange: It’s Not Just a Repo!
Anypoint Exchange: It’s Not Just a Repo!Manik S Magar
 
SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024Lorenzo Miniero
 
Hyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdf
Hyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdfHyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdf
Hyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdfPrecisely
 
DevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache MavenDevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache MavenHervé Boutemy
 
Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 365Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 3652toLead Limited
 
Search Engine Optimization SEO PDF for 2024.pdf
Search Engine Optimization SEO PDF for 2024.pdfSearch Engine Optimization SEO PDF for 2024.pdf
Search Engine Optimization SEO PDF for 2024.pdfRankYa
 
Human Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsHuman Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsMark Billinghurst
 
Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!Commit University
 
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage Cost
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage CostLeverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage Cost
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage CostZilliz
 

Dernier (20)

TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024
 
Commit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easyCommit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easy
 
What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024
 
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
 
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks..."LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
 
CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):
 
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
 
Developer Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQLDeveloper Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQL
 
Designing IA for AI - Information Architecture Conference 2024
Designing IA for AI - Information Architecture Conference 2024Designing IA for AI - Information Architecture Conference 2024
Designing IA for AI - Information Architecture Conference 2024
 
Connect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck PresentationConnect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck Presentation
 
E-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptx
E-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptxE-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptx
E-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptx
 
Anypoint Exchange: It’s Not Just a Repo!
Anypoint Exchange: It’s Not Just a Repo!Anypoint Exchange: It’s Not Just a Repo!
Anypoint Exchange: It’s Not Just a Repo!
 
SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024
 
Hyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdf
Hyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdfHyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdf
Hyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdf
 
DevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache MavenDevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache Maven
 
Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 365Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 365
 
Search Engine Optimization SEO PDF for 2024.pdf
Search Engine Optimization SEO PDF for 2024.pdfSearch Engine Optimization SEO PDF for 2024.pdf
Search Engine Optimization SEO PDF for 2024.pdf
 
Human Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsHuman Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR Systems
 
Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!
 
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage Cost
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage CostLeverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage Cost
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage Cost
 

Easy ORMness with Objectify-Appengine

  • 1. Easy ORM-ness with Objectify-Appengine Meetu Maltiar Inphina Technologies
  • 2. Overall Presentation Goal Google Datastore Basics Options available for managing persistence Objectify-Appengine Demo of an application using Objectify
  • 3. Enough About Me Senior Software Engineer at Inphina Technologies that interest me: Cloud Computing Scala Hadoop
  • 4. Datastore Basics Entities Operations Keys Transactions
  • 5. Entities An Entity is an object’s worth of data in the datastore In datastore an Entity is like HashMap-like object of type Entity Datastore is conceptually a HashMap of keys to entities, and an Entity is conceptually a HashMap of name/value pairs
  • 6. Operations Get() an entity as a whole from datastore Put() an entity as whole in datastore Delete() an entity from datastore Query() for entities matching criteria you define
  • 7. Keys In the datastore, entities are identified by the id (or name) and a kind, which corresponds to the type of Object you are storing. So, to get Employee #111 from datastore, we need to call something like get_from_datastore (“Employee”, 111)
  • 8. Keys Continued There is actually a third parameter required to identify an entity and it is called parent Parent places the child in the same entity group as the parent Parent (which can be null for the un-parented, root entity) is also required to uniquely identify an Entity.
  • 9. Keys Continued So, to get Employee #111 from datastore we need to call something equivalent to: get_from_datastore (“Employee”, 111, null) or, get_from_datastore (“Employee”, 111, the_parent). Instead of passing three parameters datastore wraps it in a single Object called Key.
  • 10. Transactions Data gets stored in gigantic form of thousands of machines In order to perform an atomic transaction datastore requires that entities lie on same servers. To give us more control over where our data is stored, the datastore has a concept of an entity group To give us more control over where our data is stored, the datastore has a concept of an entity group
  • 11. Transactions Continued Within a Transaction we can access data from a single entity group Choose entity groups carefully Why not have everything in a single entity group? Google restricts number of requests per second per entity group
  • 12. Executing Transactions When we execute get(), put(), delete() or query() in transaction We must operate it on single entity group All operations will either fail or succeed completely If another process modifies the data before commit datastore operation will fail
  • 13. Tools
  • 14. Persistence Options JPA/JDO Google Datastore Persistence Frameworks on GAE Objectify-Appengine Twig Simple Datastore Slim3
  • 15. Google Datastore Challenges Supports just four operations It persists GAE-Specific entity classes rather than POJO’s Datastore Keys are untyped
  • 16. JPA/JDO Challenges Extra Cruft Fetch Groups Detaching Owned/Unownedrelationships Leaky Abstraction Keys Entity Groups Indexes
  • 18. Objectify It lets you persist, retrieve, delete and query typed objects All native datastore features are supported It provides type safe key and query classes
  • 19. Objectify Design Considerations Minimally impacts cold start time. It is light weight No external dependencies apart from GAE SDK
  • 20. Working With Datastore Entity ent = new Entity(“car”); ent.setProperty(“color”, “red”); ent.setProperty(“doors”, 2); service.put(ent);
  • 21. Objectify ORMNess Objects! Employee emp = new Employee(); emp.setFirstName(“John”); emp.setLastName(“Smith”); service.put(emp);
  • 22. An Objectify Entity public class Employee { @Id Long id; private String firstName; private String lastName; }
  • 23. get() Operation Objectify ofy = Objectifyservice.begin(); Employee emp = ofy.get(Employee.class, 123); Map<Long, Employee> employees = ofy.get(Employee.class, 123, 124, 125);
  • 24. put() Operation Objectify ofy = Objectifyservice.begin(); Employee emp = new Employee(“John”, “adams”); ofy.put(emp); System.out.println(“Id Generated is ” + emp.getId()); List<Employee> employees = createEmployees(); ofy.put(employees);
  • 25. delete() Operation Objectify ofy = Objectifyservice.begin(); ofy.delete(Employee.class, 123); Employee emp = // get Employee from some where ofy.delete(emp);
  • 26. query() Operation Objectify ofy = Objectifyservice.begin(); List<Employee> employees = ofy.query(Employee.class).filter(“firstName =”, “John”)
  • 27. Demo get() put() delete() query()
  • 28. Objectify Best Practices Use a DAO to register entities Automatic Scanning not advised adds to initialization time will require dependency jars apart from GAE will require changes in web.xml GAE spins down the instance when not in use. When it comes up the request is slow because of added initialization time. This is called cold start.
  • 29. Objectify Best Practices … Use Batch Gets Instead of Queries Use Indexes sparingly By default every field of object will be indexed. It comes with heavy computational price. Use @Unindexed on entity level and @Indexed at fields required for query Avoid @Parent In JPA “owned” entity relationship provides referential integrity checking and cascading deletes and saves. Not so here.
  • 31. Conclusion JDO/JPA learning curve is steep due to App Engine’s non-relational nature and unique concepts such as entity groups, owned and un-owned relationships. Google Datastore is low level. It makes no pretense of being relational but also does not allow working with objects. It just stores the objects of type com.google.appengine.api.datastore.Entity Objectify is light weight and it preserves the simplicity and transparency of low level API and does all work converting to and from POJOS to Entity Objects.
  • 33. References Objectify-Appengine http://code.google.com/p/objectify-appengine/ Google IO 2011 Session on highly productive gwt rapid development with app-engine objectify-requestfactory and gwt-platform Twitter mining with Objectify-Appengine http://www.ibm.com/developerworks/java/library/j-javadev2-14/?ca=drs-