Book Image

Lift Application Development Cookbook

By : Gilberto Tadeu Garcia Jun
Book Image

Lift Application Development Cookbook

By: Gilberto Tadeu Garcia Jun

Overview of this book

Developing secure web applications is one of the most important tasks developers have to deal with. With Lift, it is easy to create solid and formidable web applications as it is the most secure web framework available today. The View-First approach and being able to handle things as purely data transformation, makes working with Lift an exciting task. "Lift Application Development Cookbook" teaches you how to build web applications using this amazing framework. The book moves gradually, starting with the basics (starting a new project, submitting a form, and so on) before covering more advanced topics such as building a REST API and integrating your application with other technologies and applications. "Lift Application Development Cookbook" takes you on a journey of creating secure web applications. Step-by-step instructions help you understand how things work and how various elements relate to each other. You'll learn different ways to process a form, build dynamic HTML pages, and create an API using REST. You'll also learn how to work with relational and NoSQL databases and how to integrate your application with other technologies as well as with third-part applications such as Gmail and Facebook. By the end of the book, you will be able to understand how Lift works and be able to build web applications using this amazing and exciting framework.
Table of Contents (15 chapters)
Lift Application Development Cookbook
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface
Index

Paginating result sets using Record


In Chapter 5, Working with Databases, we have seen how to paginate result sets using PaginatorSnippet and Mapper, in the Paginating result sets recipe. We'll be using the PaginatorSnippet tool, so there will be nothing new in that sense; however, Record does not have the helper methods that Mapper does. Therefore, paginating the result sets using Record and Squeryl is a little different.

In this recipe we will look at these differences and learn how to paginate result sets using Squeryl.

Getting ready

To keep things simple and to focus on what is important, we will use the project from the second recipe of this chapter, Mapping a table to a Scala class, where we mapped the contacts table. You can create a new project by duplicating the old one or you can modify it.

How to do it...

Perform the following steps to paginate a result set using Record and Squeryl:

  1. Modify the Contact class by adding the following method definitions:

      def count = { 
        from(LiftBookSchema...