More About Domain Classes
Now we have a persistent TekEvent class. We can create instances of this class and save them to the database. We can even find existing instances by their id or by their properties. You might be wondering how that can be—where is the code for all this functionality? We’ll learn more about that when we start using these features, but the short answer is that Grails uses Groovy metaprogramming (which we discussed in Metaprogramming) to dynamically add powerful behavior to our domain classes. As we get further in developing our application, we’ll see that we can call methods like TekEvent.save(), TekEvent.list(), and TekEvent.findAllByStartDateGreaterThan(new Date() - 30), even though we’ve never written any code to ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access