Digest for jooq-user@googlegroups.com - 3 updates in 2 topics

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

Digest for jooq-user@googlegroups.com - 3 updates in 2 topics

http://groups.google.com/group/jooq-user/topics mailing list
Max Kremer <[hidden email]>: Sep 11 12:54PM -0700

I'm trying to perform some simple CRUD operations with JPA annotated Pojos.
 
I've run into the need of returning the generated id (Identity columns) for
records that are inserted. Seems that the best way to do this is with
UpdateableRecord

To date we've been using CustomRecord and its hasn't really come up
 
 
public class SpendEventRecord extends CustomRecord<SpendEventRecord> {
 
But I can't figure out how to create UpdatebleRecord instances based on my
pojos.
 
Related:
https://stackoverflow.com/questions/50627182/jooq-after-executeinsert-need-to-know-the-auto-generated-id
https://stackoverflow.com/questions/43552078/jooq-exclude-id-field-when-inserting-from-pojo
https://stackoverflow.com/questions/8127378/jooq-insert-query-with-returning-generated-keys
Charith Chowdary K P <[hidden email]>: Sep 11 04:31AM -0700

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.
Lukas Eder <[hidden email]>: Sep 11 01:48PM +0200

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 <[hidden email]>
wrote:
 
You received this digest because you're subscribed to updates for this group. You can change your settings on the group membership page.
To unsubscribe from this group and stop receiving emails from it send an email to [hidden email].