Shop now Learn more Shop now Shop Cyber Monday Deals Week in Fashion Cloud Drive Photos Amazon Fire TV Shop now DIYED Shop now Shop Fire Kids Edition Shop Kindle Paperwhite Listen in Prime Shop now Shop now
FREE Delivery in the UK.
In stock.
Dispatched from and sold by Amazon. Gift-wrap available.
Grails Persistence with G... has been added to your Basket
+ £2.80 UK delivery
Used: Like New | Details
Sold by book-services
Condition: Used: Like New
Have one to sell?
Flip to back Flip to front
Listen Playing... Paused   You're listening to a sample of the Audible audio edition.
Learn more
See all 2 images

Grails Persistence with GORM and GSQL Paperback – 28 Apr 2009

2 customer reviews

See all formats and editions Hide other formats and editions
Amazon Price
New from Used from
"Please retry"
£20.49 £1.17
Note: This item is eligible for click and collect. Details
Pick up your parcel at a time and place that suits you.
  • Choose from over 13,000 locations across the UK
  • Prime members get unlimited deliveries at no additional cost
How to order to an Amazon Pickup Location?
  1. Find your preferred location and add it to your address book
  2. Dispatch to this address when you check out
Learn more

Cyber Monday Deals Week in Books
Visit our Deals in Books store to discover Amazon's greatest ever deals. Shop now
£23.99 FREE Delivery in the UK. In stock. Dispatched from and sold by Amazon. Gift-wrap available.

Enter your mobile number or email address below and we'll send you a link to download the free Kindle App. Then you can start reading Kindle books on your smartphone, tablet, or computer - no Kindle device required.

  • Apple
  • Android
  • Windows Phone

To get the free app, enter your e-mail address or mobile phone number.

Product details

Product Description

About the Author

Robert Fischer is an independent contractor specializing in web application development and technical leadership. He is a regular presenter at conferences on the topic of Groovy and Grails, development best practices, and functional programming. He also is a regular contributor to open source in many languages, with his key contributions being the JConch library for Java concurrency, a plugin for Grails for background thread processing, and a plugin for Grails for automatic database updating. He resides in Durham, North Carolina, with his wife.

Inside This Book

(Learn More)
Browse Sample Pages
Front Cover | Copyright | Table of Contents | Excerpt | Back Cover
Search inside this book:

Customer Reviews

3.5 out of 5 stars
5 star
4 star
3 star
2 star
1 star
See both customer reviews
Share your thoughts with other customers

Most Helpful Customer Reviews

1 of 1 people found the following review helpful By Mr. Jeremy Flowers on 10 Jan. 2010
Format: Paperback
This book has some some five star content in places.
I've picked up a few new Groovy tricks to add to my coding repertoire and I'd recommend this book for that alone.
The book demonstrated things with extensive use of Assert statements which was good.

But there are a few things that irked me and hence the loss of a couple of stars (points 5-7 lose a star and points 8 & 9 causes loss of a second).
1) Comments showing artifact names weren't in some other font or bold or in italics to show a clear deliniation between artifacts in an individual listing.
2) P25 Luke Daley's Injecto library. The link seems to have stopped working at the time I write this.
I looked on the Wayback machine and found it was also used in GLDAPO. Then I exchanged Tweets with Luke & he tells me the @mixin annotation have replaced this.
Guiilliame LaForge covers @mixin this in the Groovymag April 2009 issue (What's new in Groovy 1.6) and Craig Wickesser gave an example in Dec 2009 issue (Groovy MetaObject Programming).
3) P27 1-30 should be 1-32
4) P130.
- Firstly, it seems there are a couple of lines missing here to declare the Testing class and a comment to signify where the artifact is along with its name.
- Secondly the author quotes parameter mapping for Dates as not working in Grails Controllers. So statements like:
def foo = new Foo(params)
def foo = new Foo() = params
wouldn't work for Dates.

I investigated this a bit more and I think this was as a result of the test the author was performing not a Grails problem per se!
ie Date.toString() doesn't give a date in a format that the underlying Spring binding understands!
Read more ›
Comment Was this review helpful to you? Yes No Sending feedback...
Thank you for your feedback.
Sorry, we failed to record your vote. Please try again
Report abuse
Format: Paperback Verified Purchase
I found this book via a link in a blog. I was able to download it straight away using the magic of Kindle and, while I appreciate this Amazon magic rather than book magic, it did make me approach the book with a positive mood).

I read the whole thing over a weekend. This is unheard for for me - there's normally something I find too dry that I start hopping around and subsequently only really "use" a fraction of a book - nothing wrong in that of course.

For me this book was ideal. I've been using Grails for a while on a personal project but was aware I didn't know how to do much beyond using the "findBy*" methods. I've used Hibernate before but find that a bit abstract at times.

The book introduced the various ways of getting "stuff" from the DB - from GORM to SQL and it gave a quick overview of the caches and how to use Grails cache directives. These tips alone justified getting the book for me.

Chris Ward
If I want more detail I now at least know what to go and look for.

I liked it. For me it did exactly what it said on the tin.
Comment Was this review helpful to you? Yes No Sending feedback...
Thank you for your feedback.
Sorry, we failed to record your vote. Please try again
Report abuse

Most Helpful Customer Reviews on (beta) 14 reviews
5 of 5 people found the following review helpful
Guys. It's a FirstPress intro book. Seriously. 3 July 2009
By John Stoneham - Published on
Format: Paperback
The other reviewers are complaining there's not much here. I admit I picked it up in eBook format hoping to get a detailed, deep dive into the very bowels of Grails persistence. This isn't that book.

What I did find is that it's ideal for someone new to Grails, to understand all of the options available to you for persistence-level work. Everything from the basics of domain classes through Hibernate-land all the way down to raw SQL. It's a short survey work - which I should have expected given that it's by FirstPress. Give it to the new Grails developers on your project - this is stuff they NEED to know and they can read it in a couple of hours.

I got a second copy for our DBA. This is her first foray above the database level into helping with the application programming level. It's helping her understand where we developers are coming from, and to give us better advice.

Recommended as a starter work to understand your options. But to go deeper into Grails or Hibernate, you'll want an additional book. I recommend Grails in Action and Java Persistence with Hibernate.
4 of 4 people found the following review helpful
Good reference for Grails persistence 6 May 2009
By Trevor Burnham - Published on
Format: Paperback Verified Purchase
This is a good, quick guide to persistence in Grails. It follows a good pattern: Here's some short code, here's an explanation, and here's an integration test to cover the details. At times, this style is too quick, sketching over details and leaving me without a complete understanding.

The book doesn't talk about setting up your Grails environment. It's clearly aimed at people who already know how to use Grails but want a more thorough understanding of how to use their domain objects. All of this information is online, of course, but as the author points out a couple of times, the official documentation has always contained some inaccuracies. So this book is a good supplement. Is it a good read? Not really. It doesn't use an example project. It doesn't tell you how to built a better database. It assumes you know what you want to do and tells you how to do it. I mean that in the best possible way: Despite the popularity of Grails, info on best practices remains hard to find, and the source code in this book is very sleek, well-tested and Grails-y.

Whereas every Grails developer absolutely must have The Definitive Guide to Grails, Second Edition, which covers GORM pretty well, this book is good for reference. Not, however, in its slim, oversized-text print edition, which, as a FirstPress book, doesn't even have an index. I'd recommend it as an eBook only.
3 of 3 people found the following review helpful
Handy Reference for GORM 7 May 2009
By G. Dickens - Published on
Format: Paperback Verified Purchase
At first I was surprised that it was a total of 156 pages (I was pleased that I didn't have to work my way through yet another 700 page book).

As the title indicates this is focused on one of the greatest assets of Grails, GORM. When working with GORM, you really need examples and options to help you with common data query and dataset organization tasks, this book provides that.

In a nutshell, if you are working on a Grails project, this book will provide you with a concise reference with great code examples of valuable GORM features that you will refer back to.
4 of 5 people found the following review helpful
Comments from the Author 26 Jun. 2009
By Robert Fischer - Published on
Format: Paperback
This book was intended for the beginner-to-immediate developer, and so those who are already pros may find it a bit simplistic (although I'm not sure). It was also intended to be a lot more accessible than the more thorough and in-depth "Definitive Guide to Grails" or "Grails in Action": it was supposed to be a bit of a handbook instead of a deep dive.

The emphasis of this book was on demonstrating clear and provably-correct code around GORM: I wanted to write a test-driven book so that if you encountered problems in your code, you could figure out how to test them. I also wanted to show that I was not only asserting how things *should* work, but really demonstrating how things *do* work.

Once these basics were covered, I proceeded to go into some tips and tricks I knew. Although much of the first third of the book is either demonstrations of or corrections to information available through Grails online resources, the last two thirds of the book comes directly from my conversations and problem solving as part of the Grails-User mailing list and as an independent Grails consultant. Although some of the tips and tricks might be obvious to an established Grails professional who has been keeping up with Grails-User for the last couple of years, many of the stunts I outline were surprises or tricky to get right for me when I first encountered them. Because of that, I wanted to share these stunts more widely.

If you'd like to see an expanded and updated version with more details, I'd encourage you to contact APress and let them know. The FirstPress nature of the book was extremely constraining -- I pushed right up against the 150 page limit of the FirstPress format, and while I tried to cram as much meet as I could into 150 pages, there's naturally stuff that was going to be left out. I'd be very interested in doing an expanded and updated version of the book for Grails 1.2 (whenever that finally comes out).
Disappointed - but greatful for Fischer's contributions 18 Jun. 2010
By Parsh McHydrogenated - Published on
Format: Paperback Verified Purchase
LARGE TYPE which with my eye sight is good but the book is thin to start with. It's like writing your 4rd grade homework and the teacher asked for 5 pages so you write big.

Not sure if Apress or the Author was just lazy or if they really consider this a worthy book. If you look on the Roadmap on the back of the definitive guide they show this as the next book on the roadmap.

REALLY DISAPPOINTED. The book is basicly the test cases for validating GORM, rudimentary. It's as if, and I am almost certain this is the fact, APRESS solicited books and Robert Fischer went to the john and pinched off a couple of chapters.

I really needed a deeper project focused book with more involved queries. Granted, I am looking for a solution to a problem and the answer either does not exist or I have yet to soak up the light.

The book title should really say 'Basic Validation of' Grails Persistence with GORM and GSQL.

Here's what I was looking for and you won't find it in this book, I was able to hack this out given MarkMail messages. Many of which Fischer contributed to...I appreciate his contribution to the Grails project I just wish Apress & Fischer would have taken more time, payed him a stipend to create a more advanced book, especially given this is one of the only books specifically for GORM, GSQL.

I hope someone finds this constructive.

Really the issue is learning the ins, outs of the Hibernate Builder, which I am still trying to understand.

Could not get the formatting to stick. So,indents are removed.
calling routine
....Other processing to setup the query.....
.... Html page multi select dropdown request user input for columns to display i.e. "projections"
.... Html page for each column input box this becomes the "columnsmap"
.... user can enter multi strings in input box to filter a search in the OR part of query
.... value= split of input box\
.... This is Powerful dynamic stuff.

params.max = Math.min(params.max ? params.max.toInteger() : 10, 100)

def klmQueryTotal = Klm.createCriteria().count(defaultKlmQuery)

results = Klm.createCriteria().list(defaultKlmQuery)

println "count=$klmQueryTotal"
println "results.size()=$results.size()"
// results.each
// { println "results=$it" }

[ paramsList:params, columnList:columnsmap.keySet(), resultList:results, klmQueryTotal:klmQueryTotal ]
// columnsmap is a map of the columns to include and assoc. string to use as a where condition.

def defaultKlmQuery =
println "Hello projections - $params"

println "projections{"
println " property($key)"
println "AND1"
// where customerName like 'gil%' or customerName like 'for%'
// and siteName like 'atl%' or sitName like 'aust%'

{key,value ->
println "$key,$value size="+ value.size()
println "join ="+value.join().size()

if (value.join().size() != 0)
// OR the _id Elements of KLM
case 'customer':
case 'site':
case 'serviceInfo':
case 'mtu':
case 'config':
case 'software':
case 'salesOrder':
println "OR $key like $value"
{searchkey ->
println "Or $key{ ilike('${usecolumn[key]}','$searchkey') }"
"$key"{ ilike(usecolumn[key], "%${searchkey.trim()}%") }

// AND the KLM elements
case 'sn':
case 'soNumber':
//for each in list if value is a list
{searchkey ->
println "And $key{ ilike('${usecolumn[key]}','$searchkey') }"

if ( params.useMax == true)
if (params?.offset)

// sqlRestriction "distinct sn"
// sqlRestriction "sn in select * from klm where sn='2'"
// addToCriteria('select distinct sn from klm')
// addToCriteria(Restrictions.sqlRestriction('sn in (select distinct sn from klm where user_tbx is null)'))

Were these reviews helpful? Let us know