-
Notifications
You must be signed in to change notification settings - Fork 76
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
surrogate key suppression #698
Comments
The idea of
Anyway, I'll leave this issue open for now as a reminder for me to add some documentation about this, because I agree that it's not obvious. |
well, obviously it's a feature of JPA not hibernate ;). I'm not sure Either way, I'm not able to find a way to make equalsverifier work with @EmbeddedId, suppressing or not I get an error. So my biggest focus is, how do I get equalsverifier passing again. |
You should keep the If that doesn't work, can you please make a small zip file with a complete project that I can import directly into my IDE, preferably using Java instead of Kotlin? It will increase the chances of me being able to take a further look at this within a reasonable amount of time. |
yeah, that worked. I wonder if maybe it's worth just a little more documentation though if |
Glad to hear it worked! I think the But I agree that it tells you so in a confusing way, so I'll definitely make the error message more clear, and add a paragraph in de documentation on the website. I'll leave the issue open until I do so. |
It would be interesting to here your thoughts on whether an @Version field should be part of an "equals/hashcode". I mean obviously it's an optimistic lock and all this applies to more than hibernate (that's just a very common database mapping tool). |
To be clear it's about whether an aggregate, which has a long lifecycle where it changes over time (imagine an object that changes in memory), is it still equal to itself even though the properties are different. E.g. if I clone and make a change, but I don't change the surrogate id. |
To be honest, I don't have enough experience with JPA in general to be able to make an informed call on this. I've simply never used |
Don't know, but it's not a jpa specific problem. Version is just a convenience method for an optimistic lock. Any database with multiple concurrent users might need this solution. |
Error messages have been improved in EqualsVerifier 3.12. I've thought about the |
Describe the bug
equalsverifier tells me to suppress surrogate key and then it stacks when I do so
To Reproduce
Code that triggers the behavior
Error message
if I remove the supress I get
Expected behavior
prior to using
@EmbeddedId
instead using@Id
there was no error or suppression required. I would expect the behavior to remain the same.Version
What version of EqualsVerifier are you using?
nl.jqno.equalsverifier:equalsverifier:3.10.1
Additional context
I'm not sure if embeddedid should be considered surrogate on the basis that it's for compound keys. Mine certainly is, but as a generalization. Also, should an
@Version
be considered part of the equality check for the entitity?The text was updated successfully, but these errors were encountered: