Hi Aram,

Strictly speaking, an index is not a requirement for a unique constraint,
even if from a performance perspective, it would be silly not to have an
index backing a constraint - and most databases automatically create such
an index when the constraint is created.

So, I agree, the syntheticPrimaryKeys feature should also produce
"syntheticIndexes". I have created these feature requests:

- https://github.com/jOOQ/jOOQ/issues/7858: Specification of
<syntheticIndexes>
- https://github.com/jOOQ/jOOQ/issues/7859: Auto creation of
<syntheticIndexes> from all <syntheticPrimaryKeys>

For completeness sake, there should also be an option to generate:

- https://github.com/jOOQ/jOOQ/issues/7860: Synthetic unique keys
- https://github.com/jOOQ/jOOQ/issues/7155: Synthetic foreign keys

I hope this helps,
Lukas

On Wed, Sep 12, 2018 at 7:37 PM <[email protected]> wrote:

>
> Hi,
>
> We're doing a new project which uses spring-data and we're using Jooq
> 3.11.1 as our generator only for now.
>
> As part of the generation, there are several tables that are "filtered
> views" which means they don't have an independent PrimaryKey, but do have
> the original "id" column which is a unique key in the base table.
>
> It does produce a @UniqueConstraint but Spring-data is still not happy
> with that.  Should the use of syntheticPrimaryKeys be adding an @Index
> annotation as well?
>
> As an enhancement request-- it would be great if one column was enough to
> kick off the annotation since we already have a unique field, just not
> marked as a primary key.
>
> Aram
>
> --
> You received this message because you are subscribed to the Google Groups
> "jOOQ User Group" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> For more options, visit https://groups.google.com/d/optout.
>

-- 
You received this message because you are subscribed to the Google Groups "jOOQ 
User Group" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to