SlideShare a Scribd company logo
Chicago, October 19 - 22,
2010
New Persistence Features in
Spring Roo 1.1
Stefan Schmidt
Agenda
•  Spring Roo’s Approach to Persistence
•  Incremental Database Reverse Engineering
•  Apache Solr / Lucene Integration
•  Alternative Persistence Technologies
Spring Roo’s Approach to
Persistence
Peristence Choices
•  JPA2 for ORM
–  4 choices of ORM providers
•  Hibernate
•  EclipseLink
•  OpenJPA
•  DataNucleus (DN1 supported for GAE, DN2 used by VMforce)
•  12+ Database choices
–  constantly growning list of DBs to choose from
–  popular ones: MySQL, Postgres, HSQLDB (for dev)
•  Switch out ORM and / or DB with a single command
–  persistence setup --provider HIBERNATE --database MYSQL
No DAOs?
•  No DAO layer by default
–  Objections:
•  testing
•  separation of concern
•  pluggable implementations
•  non JPA persistence
•  security authorizations
•  security auditing
•  finders
•  architectural reasons
Feature Extension Points
•  Add-ons can contribute persistence feature extensions via
ITDs
–  Finder add-on is a good example
•  Every @RooEntity exposes the JPA entity manager
–  use for creating custom type-safe queries via Criteria API
–  getting access to the underlying ORM
Incremental Database
Reverse Engineering
Alternatives to Roo’s Incremental DBRE
•  Eclipse “JPA Entities from tables” wizard
–  Generates entities from a JDBC connection
–  Can be tailored to change generated type and field names
–  Does not handle tables with no primary keys
•  JPA Implementation Tools
Limitations of Existing DBRE Tools
•  Lack of incremental reverse engineering
•  Complex and long-winded wizard style interactions
•  Missing entity lifecycle management
–  Application requires manual adjustment if the datamodel
changes
Introducing Roo’s Incremental Database
Reverse Engineering
•  DBRE was the most requested feature for Spring Roo
•  Introspect relational databases such as Oracle, MySQL,
PostgreSQL and Microsoft SQL Server
•  Reverse engineer complex schemas into Java entities in
seconds
•  Creates and maintains relationships with JPA 2.0
annotations
•  Incrementally updates your domain model as your DB
schema changes
How does DBRE work?
•  Uses the standard java.sql.DatabaseMetaData
implementation of your JDK
•  Connects to a live database using JDBC and creates
entities from the database metadata obtained
•  Similar to the output generated by the Eclipse wizard with
all accepted defaults
Spring Roo DBRE Commands
•  database introspect --schema <name> [--file <name>]
–  Displays database metadata in XML format in the Roo shell
–  Optional --file <file name> saves metadata to specified file
–  Provides a preview of the mappings used in the final model
Spring Roo DBRE Commands
•  database reverse engineer [--schema <name>] [--
package <name>]
–  Creates entities in the specified package
–  --schema and --package options required only for first time
run of command
–  Automatically generates type and field names from table
and column names
–  JPA-annotated fields and getters/setters saved in AspectJ
ITDs, eg Person_Roo_DbManaged.aj
Primary Keys
•  Supports single and composite primary keys
–  Creates a separate primary key class for tables having more
than one primary key or no primary key (uses all fields for
key)
–  Annotates the primary key class with @Embeddable and the
entity's id with @EmbeddedId
Entity Relationships
•  Automatically creates and maintains bi-directional
relationships:
–  @ManyToMany, many-valued associations with many-to-
many multiplicity
–  @OneToOne, single-valued associations to other entities
that have one-to-one multiplicity
–  @OneToMany, many-valued associations with one-to-many
multiplicity
–  @ManyToOne, single-valued associations to other entities
that have many-to-one multiplicity
DEMO
Database Reverse Engineering Demo
Apache Solr / Lucene
Integration
What is Apache Solr?
•  Search server
•  Built upon Apache Lucene (Java)
•  Fast, very
•  Scalable, query load and collection size
•  Distributed search and index replication
•  Interoperable
•  Extensible
Solr Features
•  Powerful full-text search
•  Hit highlighting
•  Faceted search
•  Spell checking
•  Dynamic clustering
•  Database integration
•  Rich document (e.g., Word, PDF) handling.
Interacting with Solr
•  HTTP GET / POST
•  JSON / XML
•  SolrJ (embedded over HTTP)
•  Ruby: solr-ruby, RSolr
•  many others: python, PHP, solrsharp, XSLT
•  JMX monitoring available
•  Admin interface available
Configuring Solr
•  schema.xml
–  Defines field types
–  Can drive more intelligent processing
–  Dynamic Fields enable on-the-fly addition of new fields
–  CopyField
•  indexing a single field multiple ways
•  combining multiple fields into a single searchable field
–  Many additional text analysis components
•  word splitting,
•  regex filters
•  sounds-like filters
Roo Solr Integration
•  Roo Shell
–  solr setup  install SolrJ driver in project pom.xml
–  solr add  make individual type searchable
–  solr all  make all JPA entities searchable
•  @RooSolrSearchable type annotation
•  Hooks into JPA lifecycle
–  @PostPersist
–  @PostUpdate
–  @PreDelete
•  Uses SolrJ client
Entity Methods Introduced via Roo
•  QueryResponse search(String queryString)
•  QueryResponse search(SolrQuery query)
•  @Async void indexPerson(Person person)
•  @Async void indexPeople(Collection<Person> people)
•  @Async deleteIndex(Owner owner)
•  solrServer is also accessible on target type.
DEMO
Apache Solr
Alternative Persistence
Technologies
Demand for Choice
•  ROO-301: Choose between data access patterns
–  demand for repository and DAO pattern support
•  70+ votes in Spring Roo Jira, second most popular issue
–  Spring JDBC template
–  demand for iBatis support (ROO-452)
–  demand for NoSQL integration
–  demand for polyglot persistence
Hades Add-On
•  Have you heard of Hades project?
–  Utility library to work with Data Access Objects
•  implemented with Spring and JPA
–  Main goal is to ease the development and operation of a
data access layer in applications
•  Installation in the Roo shell with a single command:
–  addon install --bundleSymbolicName org.synyx.hades.roo.addon
–  hades setup
–  hades repository --entity ~.domain.Person
–  more features planned (finders, DDD, etc)
DEMO
Hades Add-On
Summary
•  Roo has deep and rich persistence support
•  Roo’s Incremental DBRE feature is the next generation in
DBRE capabilities
•  Solr and Incremental DBRE offer devs a major
productivity boost
•  Alternative persistence technologies supported and
expanding

More Related Content

PPT
Solr vs ElasticSearch
PDF
Solr Distributed Indexing in WalmartLabs: Presented by Shengua Wan, WalmartLabs
PPTX
Battle of the giants: Apache Solr vs ElasticSearch
PPTX
Introduction to Lucene & Solr and Usecases
PPTX
ElasticSearch in Production: lessons learned
PPT
Finite State Queries In Lucene
PDF
Solr Metrics - Andrzej Białecki, Lucidworks
PDF
Solr Recipes
Solr vs ElasticSearch
Solr Distributed Indexing in WalmartLabs: Presented by Shengua Wan, WalmartLabs
Battle of the giants: Apache Solr vs ElasticSearch
Introduction to Lucene & Solr and Usecases
ElasticSearch in Production: lessons learned
Finite State Queries In Lucene
Solr Metrics - Andrzej Białecki, Lucidworks
Solr Recipes

What's hot (20)

PDF
How Solr Search Works
PDF
Apache Solr/Lucene Internals by Anatoliy Sokolenko
PDF
Oracle to Postgres Migration - part 1
PDF
Solr 4
ODP
ORM, JPA, & Hibernate Overview
PDF
Lucene for Solr Developers
PDF
High Performance JSON Search and Relational Faceted Browsing with Lucene
PDF
[EPPG] Oracle to PostgreSQL, Challenges to Opportunity
PDF
Apache Solr: Upgrading Your Upgrade Experience - Hrishikesh Gadre, Lucidworks
PPTX
Introduction to Apache Solr
PPT
Oracle by Muhammad Iqbal
PDF
Large Scale ETL for Hadoop and Cloudera Search using Morphlines
PDF
Data Science with Solr and Spark
PDF
Search at Twitter
PPTX
Introduction to Lucene and Solr - 1
PPTX
Best practices on Building a Big Data Analytics Solution (SQLBits 2018 Traini...
PDF
Webinar: What's New in Solr 7
PDF
Oracle to Postgres Migration - part 2
PDF
Integrating the Solr search engine
PDF
Solr Indexing and Analysis Tricks
How Solr Search Works
Apache Solr/Lucene Internals by Anatoliy Sokolenko
Oracle to Postgres Migration - part 1
Solr 4
ORM, JPA, & Hibernate Overview
Lucene for Solr Developers
High Performance JSON Search and Relational Faceted Browsing with Lucene
[EPPG] Oracle to PostgreSQL, Challenges to Opportunity
Apache Solr: Upgrading Your Upgrade Experience - Hrishikesh Gadre, Lucidworks
Introduction to Apache Solr
Oracle by Muhammad Iqbal
Large Scale ETL for Hadoop and Cloudera Search using Morphlines
Data Science with Solr and Spark
Search at Twitter
Introduction to Lucene and Solr - 1
Best practices on Building a Big Data Analytics Solution (SQLBits 2018 Traini...
Webinar: What's New in Solr 7
Oracle to Postgres Migration - part 2
Integrating the Solr search engine
Solr Indexing and Analysis Tricks
Ad

Viewers also liked (20)

PPTX
Pandemics Week 3 Presentation Summary 1 D
PDF
Next Generation Spring MVC with Spring Roo
PPT
C:\fakepath\ch 1 intro_to_ob
PPTX
Creative commons folkbildning
PPTX
Powerpoint version of question two
PPT
Arima i Hais
PPTX
Openspace isoc
PPTX
World Music Week 3 Presentation
PDF
Java Enterprise Applications in the Cloud: Fast, Fun and Easier than Ever
PPTX
Sociala medier läromedel
PPTX
Ung företagande och Webbstjärnan
PPTX
Internetiskolan Webbstjarnan
PPSX
At home-animated.ppt
PPTX
Upphovsrätt och Källkritik Åva
PPT
Twitter för oss #smp10 Boras
PPTX
World cup week 4 presentation
PPTX
digitalaverktyg-skolan
Pandemics Week 3 Presentation Summary 1 D
Next Generation Spring MVC with Spring Roo
C:\fakepath\ch 1 intro_to_ob
Creative commons folkbildning
Powerpoint version of question two
Arima i Hais
Openspace isoc
World Music Week 3 Presentation
Java Enterprise Applications in the Cloud: Fast, Fun and Easier than Ever
Sociala medier läromedel
Ung företagande och Webbstjärnan
Internetiskolan Webbstjarnan
At home-animated.ppt
Upphovsrätt och Källkritik Åva
Twitter för oss #smp10 Boras
World cup week 4 presentation
digitalaverktyg-skolan
Ad

Similar to New Persistence Features in Spring Roo 1.1 (20)

PDF
Not Just ORM: Powerful Hibernate ORM Features and Capabilities
PPTX
Rapid With Spring Roo
PDF
Effective Persistence Using ORM With Hibernate
PDF
Java Persistence API
PDF
Rapid application development with spring roo j-fall 2010 - baris dere
KEY
Intro to Apache Solr for Drupal
PDF
EclipseLink: Beyond Relational and NoSQL to Polyglot and HTML5
PDF
Webinar: Persistence with Hibernate - Portal Development & Text Searching wit...
PDF
Cassandra Summit 2015 - Building a multi-tenant API PaaS with DataStax Enterp...
PPT
Hibernate
PPT
jpa-hibernate-presentation
PDF
NoSQL, Apache SOLR and Apache Hadoop
PPTX
Apache solr
PPTX
DrupalTour. Lviv — Apache solr. Advanced use cases (Artem Sylchuk, InternetDe...
PDF
Solr Recipes Workshop
PPT
Java persistence api
PPT
ORM Concepts and JPA 2.0 Specifications
PDF
Spring Boot Tutorial Part 2 (JPA&Hibernate) .pdf
PDF
Painless Persistence in a Disconnected World
PDF
ORM Injection
Not Just ORM: Powerful Hibernate ORM Features and Capabilities
Rapid With Spring Roo
Effective Persistence Using ORM With Hibernate
Java Persistence API
Rapid application development with spring roo j-fall 2010 - baris dere
Intro to Apache Solr for Drupal
EclipseLink: Beyond Relational and NoSQL to Polyglot and HTML5
Webinar: Persistence with Hibernate - Portal Development & Text Searching wit...
Cassandra Summit 2015 - Building a multi-tenant API PaaS with DataStax Enterp...
Hibernate
jpa-hibernate-presentation
NoSQL, Apache SOLR and Apache Hadoop
Apache solr
DrupalTour. Lviv — Apache solr. Advanced use cases (Artem Sylchuk, InternetDe...
Solr Recipes Workshop
Java persistence api
ORM Concepts and JPA 2.0 Specifications
Spring Boot Tutorial Part 2 (JPA&Hibernate) .pdf
Painless Persistence in a Disconnected World
ORM Injection

Recently uploaded (20)

PPTX
20250228 LYD VKU AI Blended-Learning.pptx
PDF
Advanced methodologies resolving dimensionality complications for autism neur...
PDF
The Rise and Fall of 3GPP – Time for a Sabbatical?
PDF
Blue Purple Modern Animated Computer Science Presentation.pdf.pdf
PPTX
Spectroscopy.pptx food analysis technology
PDF
Encapsulation_ Review paper, used for researhc scholars
PPTX
KOM of Painting work and Equipment Insulation REV00 update 25-dec.pptx
PDF
Optimiser vos workloads AI/ML sur Amazon EC2 et AWS Graviton
PDF
NewMind AI Weekly Chronicles - August'25 Week I
PPTX
VMware vSphere Foundation How to Sell Presentation-Ver1.4-2-14-2024.pptx
PDF
7 ChatGPT Prompts to Help You Define Your Ideal Customer Profile.pdf
PPTX
Programs and apps: productivity, graphics, security and other tools
PPTX
Understanding_Digital_Forensics_Presentation.pptx
PDF
Building Integrated photovoltaic BIPV_UPV.pdf
PDF
Machine learning based COVID-19 study performance prediction
PDF
Review of recent advances in non-invasive hemoglobin estimation
PDF
Profit Center Accounting in SAP S/4HANA, S4F28 Col11
PDF
Unlocking AI with Model Context Protocol (MCP)
PPTX
ACSFv1EN-58255 AWS Academy Cloud Security Foundations.pptx
PDF
Empathic Computing: Creating Shared Understanding
20250228 LYD VKU AI Blended-Learning.pptx
Advanced methodologies resolving dimensionality complications for autism neur...
The Rise and Fall of 3GPP – Time for a Sabbatical?
Blue Purple Modern Animated Computer Science Presentation.pdf.pdf
Spectroscopy.pptx food analysis technology
Encapsulation_ Review paper, used for researhc scholars
KOM of Painting work and Equipment Insulation REV00 update 25-dec.pptx
Optimiser vos workloads AI/ML sur Amazon EC2 et AWS Graviton
NewMind AI Weekly Chronicles - August'25 Week I
VMware vSphere Foundation How to Sell Presentation-Ver1.4-2-14-2024.pptx
7 ChatGPT Prompts to Help You Define Your Ideal Customer Profile.pdf
Programs and apps: productivity, graphics, security and other tools
Understanding_Digital_Forensics_Presentation.pptx
Building Integrated photovoltaic BIPV_UPV.pdf
Machine learning based COVID-19 study performance prediction
Review of recent advances in non-invasive hemoglobin estimation
Profit Center Accounting in SAP S/4HANA, S4F28 Col11
Unlocking AI with Model Context Protocol (MCP)
ACSFv1EN-58255 AWS Academy Cloud Security Foundations.pptx
Empathic Computing: Creating Shared Understanding

New Persistence Features in Spring Roo 1.1

  • 1. Chicago, October 19 - 22, 2010 New Persistence Features in Spring Roo 1.1 Stefan Schmidt
  • 2. Agenda •  Spring Roo’s Approach to Persistence •  Incremental Database Reverse Engineering •  Apache Solr / Lucene Integration •  Alternative Persistence Technologies
  • 3. Spring Roo’s Approach to Persistence
  • 4. Peristence Choices •  JPA2 for ORM –  4 choices of ORM providers •  Hibernate •  EclipseLink •  OpenJPA •  DataNucleus (DN1 supported for GAE, DN2 used by VMforce) •  12+ Database choices –  constantly growning list of DBs to choose from –  popular ones: MySQL, Postgres, HSQLDB (for dev) •  Switch out ORM and / or DB with a single command –  persistence setup --provider HIBERNATE --database MYSQL
  • 5. No DAOs? •  No DAO layer by default –  Objections: •  testing •  separation of concern •  pluggable implementations •  non JPA persistence •  security authorizations •  security auditing •  finders •  architectural reasons
  • 6. Feature Extension Points •  Add-ons can contribute persistence feature extensions via ITDs –  Finder add-on is a good example •  Every @RooEntity exposes the JPA entity manager –  use for creating custom type-safe queries via Criteria API –  getting access to the underlying ORM
  • 8. Alternatives to Roo’s Incremental DBRE •  Eclipse “JPA Entities from tables” wizard –  Generates entities from a JDBC connection –  Can be tailored to change generated type and field names –  Does not handle tables with no primary keys •  JPA Implementation Tools
  • 9. Limitations of Existing DBRE Tools •  Lack of incremental reverse engineering •  Complex and long-winded wizard style interactions •  Missing entity lifecycle management –  Application requires manual adjustment if the datamodel changes
  • 10. Introducing Roo’s Incremental Database Reverse Engineering •  DBRE was the most requested feature for Spring Roo •  Introspect relational databases such as Oracle, MySQL, PostgreSQL and Microsoft SQL Server •  Reverse engineer complex schemas into Java entities in seconds •  Creates and maintains relationships with JPA 2.0 annotations •  Incrementally updates your domain model as your DB schema changes
  • 11. How does DBRE work? •  Uses the standard java.sql.DatabaseMetaData implementation of your JDK •  Connects to a live database using JDBC and creates entities from the database metadata obtained •  Similar to the output generated by the Eclipse wizard with all accepted defaults
  • 12. Spring Roo DBRE Commands •  database introspect --schema <name> [--file <name>] –  Displays database metadata in XML format in the Roo shell –  Optional --file <file name> saves metadata to specified file –  Provides a preview of the mappings used in the final model
  • 13. Spring Roo DBRE Commands •  database reverse engineer [--schema <name>] [-- package <name>] –  Creates entities in the specified package –  --schema and --package options required only for first time run of command –  Automatically generates type and field names from table and column names –  JPA-annotated fields and getters/setters saved in AspectJ ITDs, eg Person_Roo_DbManaged.aj
  • 14. Primary Keys •  Supports single and composite primary keys –  Creates a separate primary key class for tables having more than one primary key or no primary key (uses all fields for key) –  Annotates the primary key class with @Embeddable and the entity's id with @EmbeddedId
  • 15. Entity Relationships •  Automatically creates and maintains bi-directional relationships: –  @ManyToMany, many-valued associations with many-to- many multiplicity –  @OneToOne, single-valued associations to other entities that have one-to-one multiplicity –  @OneToMany, many-valued associations with one-to-many multiplicity –  @ManyToOne, single-valued associations to other entities that have many-to-one multiplicity
  • 17. Apache Solr / Lucene Integration
  • 18. What is Apache Solr? •  Search server •  Built upon Apache Lucene (Java) •  Fast, very •  Scalable, query load and collection size •  Distributed search and index replication •  Interoperable •  Extensible
  • 19. Solr Features •  Powerful full-text search •  Hit highlighting •  Faceted search •  Spell checking •  Dynamic clustering •  Database integration •  Rich document (e.g., Word, PDF) handling.
  • 20. Interacting with Solr •  HTTP GET / POST •  JSON / XML •  SolrJ (embedded over HTTP) •  Ruby: solr-ruby, RSolr •  many others: python, PHP, solrsharp, XSLT •  JMX monitoring available •  Admin interface available
  • 21. Configuring Solr •  schema.xml –  Defines field types –  Can drive more intelligent processing –  Dynamic Fields enable on-the-fly addition of new fields –  CopyField •  indexing a single field multiple ways •  combining multiple fields into a single searchable field –  Many additional text analysis components •  word splitting, •  regex filters •  sounds-like filters
  • 22. Roo Solr Integration •  Roo Shell –  solr setup  install SolrJ driver in project pom.xml –  solr add  make individual type searchable –  solr all  make all JPA entities searchable •  @RooSolrSearchable type annotation •  Hooks into JPA lifecycle –  @PostPersist –  @PostUpdate –  @PreDelete •  Uses SolrJ client
  • 23. Entity Methods Introduced via Roo •  QueryResponse search(String queryString) •  QueryResponse search(SolrQuery query) •  @Async void indexPerson(Person person) •  @Async void indexPeople(Collection<Person> people) •  @Async deleteIndex(Owner owner) •  solrServer is also accessible on target type.
  • 26. Demand for Choice •  ROO-301: Choose between data access patterns –  demand for repository and DAO pattern support •  70+ votes in Spring Roo Jira, second most popular issue –  Spring JDBC template –  demand for iBatis support (ROO-452) –  demand for NoSQL integration –  demand for polyglot persistence
  • 27. Hades Add-On •  Have you heard of Hades project? –  Utility library to work with Data Access Objects •  implemented with Spring and JPA –  Main goal is to ease the development and operation of a data access layer in applications •  Installation in the Roo shell with a single command: –  addon install --bundleSymbolicName org.synyx.hades.roo.addon –  hades setup –  hades repository --entity ~.domain.Person –  more features planned (finders, DDD, etc)
  • 29. Summary •  Roo has deep and rich persistence support •  Roo’s Incremental DBRE feature is the next generation in DBRE capabilities •  Solr and Incremental DBRE offer devs a major productivity boost •  Alternative persistence technologies supported and expanding