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

Support for Custom Simple Value Types for @Id #1075

Closed
josephearl opened this issue Oct 27, 2021 · 2 comments
Closed

Support for Custom Simple Value Types for @Id #1075

josephearl opened this issue Oct 27, 2021 · 2 comments
Labels
status: waiting-for-feedback We need additional information before we can continue

Comments

@josephearl
Copy link

As a developer
I would like to be able to encapsulate the currently supported ID types like Integer, Long, String etc inside a custom simple value type
So that I can use a domain type for the ID

For instance suppose a products table with a primary key of product ID, where product IDs are strings which must follow a specific format of - for instance - two letters followed by two numbers.

Instead of passing a string around my program as the ID type, I would like to be able to create a ProductId class which enforces the validity of the IDs, and use the ProductId as the ID type in my entity.

Would possible be solved by #574

@spring-projects-issues spring-projects-issues added the status: waiting-for-triage An issue we've not yet triaged label Oct 27, 2021
@schauder
Copy link
Contributor

That really should work with custom conversion. Can you check / provide a reproducer, that it doesn't work?

@schauder schauder added status: waiting-for-feedback We need additional information before we can continue and removed status: waiting-for-triage An issue we've not yet triaged labels Oct 27, 2021
@josephearl
Copy link
Author

josephearl commented Oct 27, 2021

Thank you that does work. Perhaps the documentation around IDs could be updated to make this clearer and point to the custom conversion docs.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
status: waiting-for-feedback We need additional information before we can continue
Projects
None yet
Development

No branches or pull requests

3 participants