Chapter 13. Advanced GORM kung fu

In this chapter

  • Specialized domain class options
  • Caching, profiling, and optimizing tips
  • Dealing with multiple dataSource objects in one application
  • Legacy integration strategies

In chapter 3, you had your first exposure to Grails’ domain classes. Life was simple: we saved, we validated, and we used dynamic finds. You can go a long way with that knowledge—probably all the way to your first few publicly hosted Grails applications. But then you’ll hit the wall. As users flock to your stunning new social networking applications, you’ll wonder how you can tune your queries to run more efficiently. You’ll start to think about query-caching options. You’ll want to refactor your domain classes. And you’ll want to monitor where all your cycles are going. In short, you’ll want to take off the safety harness and get into some serious GORM kung fu. When you hit the performance and scalability wall, this is the chapter for you.

13.1. Domain model kung fu

13.2. Caching kung fu: moving from 2 users to 2^10

13.3. Legacy integration kung fu: dealing with multiple data sources

13.4. Dealing with difficult legacy databases

13.5. Summary and best practices