SQLG2 Java Preprocessor 1.4
New release of SQLG2 preprocessor allows Java developers easily use plain SQL for DB interaction. This release requires JDK 1.6 or later.
New features:
- Improved type safety
- Database meta-data retrieval
- Custom DB-to-Java mapping
SQLG2 is the tool for those who think relationally and do not like ORMs. If you know SQL (and PL/SQL, as the primary target is Oracle) then SQLG2 code should seem quite natural:
@RowType
public abstract static class EmpRow {
}
@Business
public List<EmpRow> selectAll()
throws SQLException {
/**
* SELECT * FROM EMP ORDER BY EMP_NO
*/
@Prepare PreparedStatement stmt = null;
return multiRowQuery(stmt, EmpRow.class);
}
And this SQL is checked at preprocess-time, giving you almost complete safety at runtime.
Required runtime library is a very thin wrapper over JDBC - it is less than 70 KB with no external dependencies.
See also project documentation.
(1 vote)
Tags:
- Login or register to post comments
- 4044 reads
- Printer-friendly version
(Note: Opinions expressed in this article and its replies are the opinions of their respective authors and not those of DZone, Inc.)




Comments
Thomas Mueller replied on Wed, 2008/12/24 - 4:56am
find(Integer id, String firstName, String lastName) { String sql = "SELECT * FROM ADDRESS WHERE 1=1"; if (id != null) sql += " AND ID=?"; if (firstName != null) sql += " AND FIRST_NAME=?"; ... }Oleg Sobolev replied on Wed, 2008/12/24 - 3:27pm
Thomas Mueller replied on Wed, 2008/12/24 - 4:51pm