public void test() {
Update<EBasicEncrypt> deleteAll = Ebean.createUpdate(EBasicEncrypt.class, "delete from EBasicEncrypt");
deleteAll.execute();
EBasicEncrypt e = new EBasicEncrypt();
e.setName("testname");
e.setDescription("testdesc");
e.setDob(new Date(System.currentTimeMillis() - 100000));
Ebean.save(e);
Date earlyDob = new Date(System.currentTimeMillis() - 500000);
List<EBasicEncrypt> qlList = Ebean
.createQuery(EBasicEncrypt.class, "where description like :d and dob >= :dob")
.setParameter("d", "testde%").setParameter("dob", earlyDob).findList();
Assert.assertTrue(qlList.size() > 0);
qlList = Ebean
.createQuery(EBasicEncrypt.class, "find e (id, description) where description = :d")
.setParameter("d", "testdesc").findList();
Assert.assertTrue(qlList.size() == 1);
SqlQuery q = Ebean.createSqlQuery("select * from e_basicenc where id = :id");
q.setParameter("id", e.getId());
SqlRow row = q.findUnique();
String name = row.getString("name");
Object desc = row.get("description");
System.out.println("SqlRow: " + name + " " + desc);
EBasicEncrypt e1 = Ebean.find(EBasicEncrypt.class, e.getId());
String desc1 = e1.getDescription();
System.out.println("Decrypted: " + desc1 + " " + e1.getDob());
e1.setName("testmod");
e1.setDescription("moddesc");
Ebean.save(e1);
EBasicEncrypt e2 = Ebean.find(EBasicEncrypt.class, e.getId());
String desc2 = e2.getDescription();
System.out.println("moddesc=" + desc2);
SpiEbeanServer server = (SpiEbeanServer) Ebean.getServer(null);
DbEncrypt dbEncrypt = server.getDatabasePlatform().getDbEncrypt();