From the course: Learning JDBC
Unlock this course with a free trial
Join today to access over 24,900 courses taught by industry experts.
Ordering and limiting results
From the course: Learning JDBC
Ordering and limiting results
- [Instructor] So now we're going to walk through the concept of ordering, and limiting results, and doing so through buying variables. So what I want you to do is to go into source main Java, open up the Dao package and go to the service Dao. Now at the very top, we're going to do a private static final String, GET_ALL_LIMIT, and we're going to set that equal to select service id, name, price from wisdom.services order by name limit ?. Now we could do the same with the order by clause, but the limit will get you the same thing that you need to know. So let's go ahead and create a function down here towards the bottom. This going to be a public list of type service. Get AllLimit. We will pass in an integer that is our limit. We'll do a list of service called services, as a new Arraylist. (instructor typing) We will do our connection. (instructor typing) (instructor typing) And I just realized that I missed an angle bracket there. So let's go ahead and put that in. Now we're going to…