Skip to content
Branch: master
Find file Copy path
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
56 lines (44 sloc) 1.16 KB
<title>DTO Query | Intro | Ebean</title>
<meta name="layout" content="_layout/docs_intro_query.html"/>
<meta name="bread2" content="DTO Query" href="/docs/intro/query-abstractions/dto-query"/>
<#assign dtoQuery="active">
<h2>DTO Query</h2>
We can specify the query as SQL and have that automatically mapped into DTO beans.
In typical recent applications around <code>10%</code> of queries were DTO queries.
<#include "/_common/lang-buttons.html">
<div class="code-java">
<pre content="java">
public class CustomerDto {
Integer id;
String name;
... // getters & setters
List<|CustomerDto> beans =
DB.findDto(CustomerDto.class, "select id, name from customer where name = ?")
.setParameter(1, "Rob")
<div class="code-kt">
<pre content="kotlin">
class CustomerDto {
var id: Int = 0
var name: String? = null
val beans =
DB.findDto(, "select id, name from customer where name = ?")
.setParameter(1, "Rob")
<@next_edit "SQL Query" "sql-query" "/docs/intro/query-abstractions/dto-query.html"/>
You can’t perform that action at this time.