java - Equal and hashcode in inherited class -
In my understanding, implementation under the same and hashed is safe because the correct method will apply in the acquired category (rather than the parent ), Even if I call it through the original pointers provided the parent is considered as an intangible class (use in the JAPA-Habir base base) Please see this assumption on the basis given below. Confirm it.
@Entity @ Inheritance class A {string type; } @ Entity Class B extension A {String uniqueName; ....... @ Override Public Boolean Barrage {.} @ Override Public Ent Hashod () {}} @Entity Class C Expands One {String Exclusive Name; ....... @ Override Public Boolean Parbar (object obj) {.} @ Override Public Ent Hashod () {}} Category D {AA; String name; }
Since writing a similar / hash method for A, B can accept both A and C examples, it is fine with the above implementation (in B & C only, Not in) There will be no such case, where A starts immediately (New A).
Thank you.
I think your example code is incomplete because I suspect you're asking that if What is the version of the equal ()
method, if the d.equals ()
method uses a.equals ()
?
If you ask, the answer will be equal to ()
method a
if a
a B
, then BFL ()
will be called. If is a
a c
, then c. Balan ()
becomes A >
Similarity ()
Whether the method has its own implementation or not.
Since you have mentioned Hibernate, I think that you are trying to 're-create an add-subclass mapping or something like this if you map it correctly, hibernate Do not try to straighten out a a
which should in fact be in essence in some way, because by this you describe it.
Comments
Post a Comment