> Just from scratching the surface (I'm sure there is a lot more that I
> haven't discovered) jOOQ also supports Generics and mapping of views/tables,
> both of which JPublisher doesnt. JPublisher is old and is not being carried
> forward to embrace the newer Java language features.
Yes, also OBJECT, TABLE, VARRAY types are mapped. One specialty for
OBJECT types is that you can call member methods on them. One example:
----------------------------------
CREATE OR REPLACE TYPE u_author_type AS OBJECT (
id number(7),
first_name varchar2(50),
last_name varchar2(50),
member procedure load,
member procedure get_books (
book1 OUT u_book_type,
book2 OUT u_book_type,
books OUT u_book_table),
member function count_books return number
)
----------------------------------
This can then lead to client Java code like this:
----------------------------------
OracleFactory ora = new OracleFactory(...);
author = ora.newRecord(U_AUTHOR_TYPE);
author.setId(1);
// Call a member procedure directly on the UDT
author.load();
assertEquals("George", author.getFirstName());
assertEquals("Orwell", author.getLastName());
// UDT member functions can be called standalone
assertEquals(new BigDecimal("2"), author.countBooks());
// ... or in SQL statements
assertEquals(new BigDecimal("2"), ora.select(countBooks(author)).fetchOne(0));
// Multiple OUT parameters are supported just as
// with standalone procedures
GetBooks books = author.getBooks();
assertEquals(1, (int) books.getBook1().getId());
assertEquals("1984", books.getBook1().getTitle());
----------------------------------
This is currently not documented in the manual, but it shows how far
jOOQ goes (and wants to go in the future)
Cheers
Lukas