|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectcom.github.drinkjava2.jsqlbox.sqlitem.SampleItem
public class SampleItem
This Sample is a CustomizedSqlItem, used to build a " where field1=? and field2=? ..." SQL piece, usages see below (detail demo see CrudTest.java):
Assert.assertEquals(1, ctx.entityFindBySample(u1).size());
Assert.assertEquals(1, ctx.entityFindAll(CrudUser.class, new SampleItem(u2).sql(" where ").notNullFields()).size());
CrudUser sample = new CrudUser("Nam", "addr");
Assert.assertEquals(4, ctx.entityFindAll(CrudUser.class,
new SampleItem(sample).sql(" where (").allFields().sql(") or name like ?").param(":name%").sql(" order by name"))
.size());
Assert.assertEquals(4, ctx.entityFindBySQL(CrudUser.class, new SampleItem(sample).sql("select * from CrudUser where (")
.nullFields().sql(") or name like ?").param(":name%").sql(" order by name")).size());
| Constructor Summary | |
|---|---|
SampleItem(Object entityBean)
|
|
SampleItem(Object entityBean,
TableModel model)
|
|
| Method Summary | |
|---|---|
SampleItem |
allFields()
For all fields, create field1=? and field2=? and field3 is null... |
void |
doPrepare(PreparedSQL ps)
Prepare special SQL items |
SampleItem |
notNullFields()
For all not null fields, create field1=? and field2=?... |
SampleItem |
nullFields()
For all fields has null values, create field1 is null and field2 is null... |
SampleItem |
param(Object... params)
Add a Sql param |
SampleItem |
sql(String... sqlPiece)
Add a sql piece |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public SampleItem(Object entityBean)
public SampleItem(Object entityBean,
TableModel model)
| Method Detail |
|---|
public SampleItem notNullFields()
public SampleItem nullFields()
public SampleItem allFields()
public SampleItem sql(String... sqlPiece)
public SampleItem param(Object... params)
public void doPrepare(PreparedSQL ps)
CustomizedSqlItem
doPrepare in interface CustomizedSqlItemps - PreparedSQL instance
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||