Mirage is a simple SQL centric database access library. It has a following two features:
- 2WaySQL
The main feature of Mirage is 2WaySQL. This makes plain old SQL template, and it is executable using any SQL client tools because parameters and conditions are written as SQL comment. - SQL less Update
Generally, update processing are simpler than search processing. However, especially, large INSERT SQL brings us the considerable pain. In the Mirage, you can insert / update / delete records using entity class (without SQL).
The main feature of Mirage is 2WaySQL. This makes plain old SQL template. See the following example:
SELECT * FROM BOOK /*BEGIN*/ WHERE /*IF author != null */ AUTHOR = /*author*/'Naoki Takezoe' /*END*/ /*IF minPrice != null */ AND PRICE >= /*minPrice*/20 /*END*/ /*IF maxPrice != null */ AND PRICE <= /*maxPrice*/100 /*END*/ /*END*/ ORDER BY BOOK_ID ASC
Mirage processes this SQL template and executes it using PreparedStatement at runtime. And this SQL template is exacutable even it is on SQL client tools such as SQL*Plus(Oracle) or psql(PostgreSQL). So it makes easy to test SQL.
See details about Mirage at our web site. I would also talk about Mirage in this blog.