-
Notifications
You must be signed in to change notification settings - Fork 30
Expand file tree
/
Copy pathMain.java
More file actions
41 lines (29 loc) · 1001 Bytes
/
Main.java
File metadata and controls
41 lines (29 loc) · 1001 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
package org.example;
import io.ebean.DB;
import org.example.domain.Contact;
import org.example.domain.Customer;
import org.example.domain.query.QContact;
import java.util.List;
public class Main {
public static void main(String[] args) {
System.out.println("running ...");
DB.getDefault();
Customer customer = new Customer("cust6");
customer.save();
Contact contact = new Contact();
contact.setFirstName("foo6");
contact.setCustomer(customer);
contact.save();
List<Contact> found = DB.find(Contact.class).findList();
System.out.println("contacts: " + found);
List<Contact> contacts = new QContact()
.firstName.startsWith("foo")
.findList();
System.out.println("contacts: " + contacts);
List<Contact> list2 = DB.findNative(Contact.class, "select * from contract where firstName like :name")
.setParameter("name", "f%")
.findList();
System.out.println("list2 " + list2);
System.out.println("done");
}
}