What do you need...
Whatever you need to do on the database, there is something for you
- Find something... (or a subset of things)
- Count something... (or a subset of things - i.e. return a number from a query)
- Question something... (i.e. return a boolean yes or no from a query)
- Delete something... (or a subset of things)
- Update something... (or a subset of things)
I need to find something...
- Find everything...
- There is a
findAllmethod on everyFinder - Find by primary key...
- There is a
findByPrimaryKeymethod on everyFinder - Find all rows that match a query
- In the
.jsonfile you can use afinder, or for a short-cut method afieldFinder, example:
"fieldFinders": [
{ "field_one": "multiple" },
{ "field_one,field_two": "unique" }
]multiple
multiple- This designation tells h2zero that one or more rows will be returned
The first field finder will generate a where clause with the parameter: field_one, (e.g. select * from table where field_one = ?)
The generated code will create a method that returns a List<Model> with a signature that would be of the form: public List<Model> findByFieldOne(<Type> fieldOne);
unique
unique(you may also usesingle)- This designation tells h2zero that only one row will be returned
the second will generate a where clause with two parameters, namely: field_one and field_two (e.g. select * from table where field_one = ? and field_two = ?)
The generated code will create a method that returns a Model with a signature that would be of the form: public Model findByFieldOneFieldTwo(<Type> fieldOne, <Type> fieldTwo);
- Find a sub-set of fields
- In the
.jsonfile you can use aselectClauseFinderwhich will return aselectClauseBean, this will only return a sub-set of the fields in a table, encapsulated in a Bean.
I need to count something...
Remember: counters always return a single integer value...
- Count all...
- There is a
countAllmethod on everyCount - Count all rows that match a query
- In the
.jsonfile you can use acounterwith awhereClause
I need to question something...
Remember: questions always return a single boolean value...
- Boolean question...
- In the
.jsonfile you can use anquestion
I need to delete something...
- Delete all...
- There is a
deleteAllmethod on everyDeleter - Delete by primary key...
- There is a
deleteByPrimaryKeymethod on everyDeleter - Delete all rows that match a query
- In the
.jsonfile you can use adeleterwith awhereClause
I need to update something...
- Update all rows that match a query
- In the
.jsonfile you can use anupdaterwith awhereClause