2018-05-15 19:49 GMT+02:00 P R <rathiprad...@gmail.com>:

> Thank you for the pointers. I was expecting that if there is no primary
> key but only one unique key, the generator would pick it by default. If
> there are multiple unique keys, I understand that one cannot pick at random.
>

That would be an option (jOOQ 1.0 did this), but it might be surprising to
some people as well. After all, what's the point of not having a primary
key in the first place? Especially in your case, the example below is a
many-to-many relationship table, and it is good practice to make the two
foreign keys part of the composite primary key...


> Anyways, I tried specifying via configuration and still didn't see DAO
> being generated.
>

Were the keys generated (in Keys.java)? And referenced in
PersonEmail.getPrimaryKey()?


> Perhaps, missing something basic on my end. Here's what my table
> definition looks like in the Postgres database.
>
> CREATE TABLE public."PersonEmail"
> (
>   "personId" character(8) NOT NULL,
>   email character varying(64) NOT NULL,
>   "contactTypeId" smallint NOT NULL,
>   CONSTRAINT "PersonEmail_personId_contactTypeId_key" UNIQUE ("personId",
> "contactTypeId")
> )
>
> And here are the two configurations that I tried independently.
>
> <syntheticPrimaryKeys>public\.PersonEmail\.COLUMN(1|3)</synt
> heticPrimaryKeys>
>

What's this COLUMN(1|3)? That seems to have been copy-pasted from the
manual, right? It should be:

<syntheticPrimaryKeys>public\.PersonEmail\.(personId|contactTypeId)</synt
heticPrimaryKeys>

<overridePrimaryKeys>PersonEmail_personId_contactTypeId_key<
> /overridePrimaryKeys>
>

That's interesting, this works for me. What happens if you fully qualify
that name (e.g. prefixing it by .*)?


> Appreciate if you could point me to what's wrong in the above
> configurations? I also presume, I can have multiple entries, each delimited
> by "|".
>

Yes, it's an ordinary Java regular expression

-- 
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 jooq-user+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to