Use Querydsl templates to create tables

22 views
Skip to first unread message

Dmitry Grankin

unread,
Nov 7, 2017, 12:03:05 PM11/7/17
to Querydsl
I use Querydsl to generate queries for different SQL dialects.

The goal is to generate queries for creation of tables either, but Querydsl doesn't provide such a feature.

I'm trying to use `SQLTemplates` to implement this, in particular, to get SQL type names for different dialects using type codes (values from `java.sql.Types`).

The issue in `SQLTemplates.addTypeNameToCode(type, code, override)` method. E.g. `SQLTemplates` adds the `Types.BINARY` with name "binary",
`PostgreSQLTemplates` also adds `Types.BINARY` with name "bytea" (and does it with `override = false`).
In the result, from `PostgreSQLTemplates` by the type code `Types.BINARY`, I'm receiving type name "binary".
But want "bytea" to specify it as a column type during table creation.

What's the reason behind such an implementation, why TypeName-TypeCode mapping should not be always overridden?

Anyway, if there are any other ways to obtain type names by type codes besides using `SQLTemplates`, give me a tip.

Thank you for your attention!




Reply all
Reply to author
Forward
0 new messages