Oracle
Oracle supports JdbcTemplate, annotation/XML Mapper, Lambda, BaseMapper, object mapping and JDBC transactions. Handwritten SQL retains Oracle semantics. Builders generate SQL through the Oracle dialect, but not every general interface applies.
API Support and Boundaries
| Capability | Boundary |
|---|---|
| CRUD and pagination | Supported; builder pagination generates nested ROWNUM queries, with slicing performed by the database |
| Entity and Map mapping | Supported; unquoted column names commonly return uppercase, so do not assume raw Map keys are lowercase |
| Strings | Oracle treats empty character strings as NULL; empty strings and null need not round-trip distinctly |
| Generated keys | Auto uses generated keys; Sequence with @KeySeq obtains the value before insertion |
| Batch inserts | Lambda/BaseMapper use individual execution, including inserts without key backfill; this does not mean Oracle JDBC lacks batching |
| Transactions | Supports commit and rollback; isolation levels and savepoint release depend on Oracle JDBC, so not every database transaction option is portable |
| Arrays, cursors and specialized types | Use the corresponding Oracle JDBC registration, retrieval, and type-handling conventions |
Quick Overview of Differences
| Concern | Oracle Behavior |
|---|---|
| Primary Key Generation | IDENTITY (12c+) or sequence |
| Pagination | ROWNUM nested query |
| Write Conflicts | MERGE INTO ... WHEN MATCHED ... WHEN NOT MATCHED ... |
| Batch Writes | Lambda/BaseMapper inserts execute individually; native JDBC Batch is a separate call path |
| Stored Procedures | Supported |
| Sequences | Supports seq.NEXTVAL |
Key Generation
Oracle 12c+ IDENTITY columns are backfilled via JDBC generated keys. Critical configuration: keyColumn must be explicitly specified, otherwise the Oracle JDBC driver only returns ROWID instead of the business primary key column.
Mapper files can use selectKey to obtain a sequence value before INSERT:
<insert id="insertUser">
<selectKey keyProperty="id" keyColumn="id" order="BEFORE">
SELECT user_info_seq.NEXTVAL AS id FROM dual
</selectKey>
INSERT INTO user_info (id, name, age) VALUES (#{id}, #{name}, #{age})
</insert>
The Builder API supports KeyType.Sequence + @KeySeq for automatic sequence assignment. See Key Generation.
Special Topics
- Programmatic API: queries, writes, multiple results, and stored routine differences.
- Mapper API: annotations, Mapper reads and writes, and execution differences.
- Builder API: Supported operations, datasource-specific behavior, and usage.
- Pagination: Pagination principles, usage and notes.
- Insert Conflicts: Conflict scenarios, strategies, usage and notes.
- Key Generation:
IDENTITY, sequences,keyColumn, andselectKey. - Data Backfill: return inserted, updated, or deleted field values with
RETURNING INTO. - Parameters and rules: empty strings and parameter reuse.
- Type Support: Java values, storage choices and readback boundaries.
- Transaction Support: handling partial failures with transactions.
Related Documentation
For common usage, see Core API.