Skip to content

Vision: integration with jOOQ data types #431

Open
@beargiles

Description

@beargiles

This is either a vision or a fever dream. I'm not sure which.

In a nutshell jOOQ is an integration tool that's designed to provide a consistent type-safe interface to multiple databases. It does this by rewriting queries with the database-specific syntax (e.g., pagination), and even has support for functionality that the database lacks. E.g., it supported a 'merge' function for PostgreSQL long before PostgreSQL added it.

It can produce the appropriate schema from the java classes, or the java classes from an existing schema.

I mentioned it's type-safe - it uses interfaces/classes like

interface Record6<T1,T2,T3,T4,T5,T6,T7,T8> {
    T1 value1();
    T2 value2();
    ...

Some people like to define wrappers that use meaningful names, e.g., 'getName() { return value1() }'

It also supports user defined types: UDT, UDTRecord. It's much easier to understand if you look at the examples.

It occurred to me that it should be possible to define a pljava UDT in a way that's consistent with jOOQ but introduces no dependencies on jooq outside of a new pljava-jooq directory.

The usage would be similar to the existing conversion from a schema to java. There would be a maven plugin that takes a pljava jar and extracts a usable schema from it. The rest of the conversion can use the existing jOOQ code. This can probably be handled with new annotations.

Another option is adding the pljava jar as a dependency but that will bring in transitive dependencies - possibly ones that conflict with the application. Using a tool to reproduce the java class(es) is safer.

There's at least one complication - our UDT classes themselves might have dependencies. E.g., anything involving cryptography might have BouncyCastle classes in its UDT. There needs to be a way to provide a list of dependencies to the user.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions