Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Primary keys of type UUID #6

Open
razvanmuscalu opened this issue Nov 9, 2019 · 5 comments
Open

Primary keys of type UUID #6

razvanmuscalu opened this issue Nov 9, 2019 · 5 comments

Comments

@razvanmuscalu
Copy link

I started experimenting with JOLO to potentially introduce it into our our project. I see that only keys of type Long are supported, but we have keys of type UUID. Is this a big limitation by design or something that can be potentially be implemented into the library?

@Mordavolt
Copy link

Hey @razvanmuscalu, thanks for contacting us.
As it is mentioned here and as you have noticed, we don't support any keys other than that of Long. For us, it is not likely that we will have a necessity for such functionality in the nearest future. We would accept a PR though if you are willing to try your hand at it :)

@razvanmuscalu
Copy link
Author

razvanmuscalu commented Nov 11, 2019

Ah yes, I overlooked that bit in the README, which already had the answer I was asking for.

Can I also ask whether the library supports custom behaviour for fields? e.g. for performing in-flight operations before setting the field on the Java object.
simpleflatmapper for example supports something like this:

JdbcTemplateMapperFactory.newInstance()
        .addColumnDefinition("my_enum_column_name",
            FieldMapperColumnDefinition.customGetter((Getter<ResultSet, MyEnum>) rs
                -> MyEnum.fromShortCode(rs.getString("my_enum_column_name"))))
        .newRowMapper(MyDto.class);

this example is just for mapping to an enum, but the in-flight operation can be anything.

I see the README mentions Supports adding extra (non-table) fields to entities. but not sure whether it's what I'm after in terms of above.

@Mordavolt
Copy link

I think what you are looking for is present in the Jooq itself. Check out if the Converters do what you need.
We use the converters together with Jooq code generation, so our mapping automatically applies the relevant converter to any data coming out of DB.

@razvanmuscalu
Copy link
Author

The Converters do seem like what I need. Thank you for the link.

I made some changes to make the key type generic (but still preserving the validation to only allow long and UUID). I'm getting permission denied trying to push my branch to the repository however. (Not sure whether it's because there's something wrong with my git config, or because I need write access to the repository).

@Stephan202
Copy link
Member

@razvanmuscalu the way this works on Github is that you fork this repository, push a new branch with your changes to that fork, and then open a PR against this repository. My colleagues will then review the proposal :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

3 participants