Closed tacianosilva closed 8 years ago
Did you read my code or not?
Hi @Raysmond,
I read your code. I tested the design rules recommended the Hibernate documentation and the JPA specification. I found the following results:
Rule NoArgumentConstructorRule: All entities passed (They are OK). Rule ProvideIdentifierPropertyRule: All entities passed (They are OK). Rule NoFinalClassRule: All entities passed (They are OK). Rule ProvideGetsSetsFieldsRule: All entities passed (They are OK).
Rule HashCodeAndEqualsRule: All entities failed (Recommendation Hibernate Docs). com.raysmond.blog.models.Tag com.raysmond.blog.models.User com.raysmond.blog.models.Setting com.raysmond.blog.models.Post
Rule UseSetCollectionRule: Two entities failed. com.raysmond.blog.models.Tag com.raysmond.blog.models.User
Rule ImplementsSerializableRule: All entities failed (Recommendation of the JPA Spec). com.raysmond.blog.models.Tag com.raysmond.blog.models.User com.raysmond.blog.models.Setting com.raysmond.blog.models.Post
Do you think these software projects have latent bugs caused by the design rules violations or is the rule unnecessary?
Hi @Raysmond,
What did you think of the results of Design Tests?
Best regards!
If you indeed study my code, you'll know there's no such problem.
Really your code is correct. My tests did not check the superclass.
I have only one question:
Why the post attribute in the User class is List (ArrayList) and It is not Set (HashSet) as the others?
Thank you for your attention and your time. You helped me a lot.
Are there any big problems using List? Cause I think it's ok with me. Besides, the post list is user class is never used.
Hi,
While analyzing some design rules with design tests for persistent classes, I discovered that 91% of a sample of 40 projects from GitHub don't follow the rule about the implementation of the equals/hashCode methods.
These rules are in the documentation of Hibernate (subsection 2.1.5 chapter 2). The first one states that the equals/hashCode methods must be implemented and the second one that their implementation must not access the identifying property. 66% of the projects violate the first rule and 25% violate the second one.
How do you use the framework Hibernate / JPA. I would like to ask two questions:
Do you think these software projects have latent bugs caused by the design rules violations or is the rule unnecessary?
Did your development team discusses about the recommendations for use of Hibernate / JPA?
There are also other rules that they aren't being followed. For more details about the experiment with others results, access: http://tacianosilva.github.io/designtests
Thanks in advance!