Search icon CANCEL
Subscription
0
Cart icon
Your Cart (0 item)
Close icon
You have no products in your basket yet
Arrow left icon
Explore Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Free Learning
Arrow right icon
Arrow up icon
GO TO TOP
Spring Roo 1.1 Cookbook

You're reading from   Spring Roo 1.1 Cookbook Over 60 recipes to help you speed up the development of your Java web applications using the Spring Roo development tool

Arrow left icon
Product type Paperback
Published in Sep 2011
Publisher Packt
ISBN-13 9781849514583
Length 460 pages
Edition 1st Edition
Arrow right icon
Toc

Table of Contents (14) Chapters Close

Spring Roo 1.1 Cookbook
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface
1. Getting Started with Spring Roo 2. Persisting Objects Using JPA FREE CHAPTER 3. Advanced JPA Support in Spring Roo 4. Web Application Development with Spring Web MVC 5. Web Application Development with GWT, Flex, and Spring Web Flow 6. Emailing, Messaging, Spring Security, Solr, and GAE 7. Developing Add-ons and Removing Roo from Projects Index

Creating applications that interact with multiple databases


As of Spring Roo 1.1.3, both entity and persistence setup commands support the persistenceUnit argument which lets you create enterprise applications which interact with multiple databases. In this recipe we'll create two persistent units:

  • flight: the flight persistence unit consists of a single entity, Flight. It uses Hibernate as a JPA provider and maps to a MySQL database named "myFlightDB".

  • payment: the payment persistence unit consists of a single entity, Payment. It uses Hibernate as the JPA provider and maps to a MySQL database named "myPaymentDB".

Getting ready

Exit the Roo shell and delete the contents of the C:\roo-cookbook\ch02-recipes directory.

Start the Roo shell from the C:\roo-cookbook\ch02-recipes directory.

How to do it...

The following steps will demonstrate how to create an application that interacts with multiple databases:

  1. Create the flight-app Roo project:

    ..roo> project --topLevelPackage sample.roo.flightapp...
You have been reading a chapter from
Spring Roo 1.1 Cookbook
Published in: Sep 2011
Publisher: Packt
ISBN-13: 9781849514583
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at $19.99/month. Cancel anytime
Banner background image