Hi Charith,

Thank you very much for your message.

In jOOQ, the most appropriate way to implement this kind of functionality
would be to use a custom data type converter, which converts your bind
variables of some HTML type to a string, and back to that HTML type:
https://www.jooq.org/doc/latest/manual/sql-execution/fetching/data-type-conversion/

In my personal opinion, this would also be the best way to validate said
string in Hibernate, instead of using a string type (raw data) to model
HTML. Using semantic types, you can *always* guarantee that your HTML
content implements the semantics of that type, and you do not rely on some
external mechanism to attach to some lifecycle that is not really related
to the type itself.

I hope this helps,
Lukas

On Wed, Sep 11, 2019 at 1:31 PM Charith Chowdary K P <[email protected]>
wrote:

> Hi,
>
> Is it possible to add a hibernate validator or a custom validator to a
> specific column of a table using Jooq.
> The entities are generated via CodeGen.
>
> for ex.
>
> A certain field is only supposed to have safe html tags. (
> https://docs.jboss.org/hibernate/validator/4.2/api/org/hibernate/validator/constraints/SafeHtml.html
>  )
> Is it possible to annotate that field with Validator functions.
>
> Consider a "Book" Table. "Title" is a property of the Book Table.
> Title is supposed to have only safeHtml.
>
> like e.g.
>
> BookRecord.java
>
> @SafeHtml
> public String setTitle(final String title)
> {
> }
>
>
> Is there a way to do this via some settings in Codegen xml or any other
> way. Looking for some direction regarding this.
>
> Thanks.
>
> --
> 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].
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/jooq-user/a0ce661d-4e2b-43f0-a95c-14976929277e%40googlegroups.com
> <https://groups.google.com/d/msgid/jooq-user/a0ce661d-4e2b-43f0-a95c-14976929277e%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
>

-- 
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].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/jooq-user/CAB4ELO6cwGjyOB_Y4Aqv_R6eG2sD%2B4bjCdwEJ-e4vZYfQxKq5g%40mail.gmail.com.

Reply via email to