java - After adding @Future annotation to entity - TraversableResolver.isReachable() threw an exception -
I used the Spring Framework 4 & Hibernate 4
I put a Future interrupt in my unit and after that I'm running the exception:
javax.validation.ValidationException: HV000041: Traversable receiver. () Has threw an exception After some research I found out that this hash is due to the inclusion of the code in the code code id , if I haveh If code is removed from the id then the exception is over and it acts as a purpose. @override public int hashode () {int result = id.hashCode (); // Code intentionally left out the result; } The question is : Why can not I use the hashode method in the id ? How do I change it? Entity code:
@Antity @Table (name = "ACTIVITY") Public category activity serialization {@Id @GeneratedValue (strategy = GenerationType.Inantity ) @column (name = "id", tap = incorrect, length = 10) Private long id; @ Temporal (TemporalType.TIMESTAMP) @ Future @column (name = "ACTIVITY_FROM", tap = incorrect, length = 1 9) Private date activity; // Code of other attributes deliberately public long IID (return id; } Public Zero Set ID (Long ID) {this.id = id; } Public Date getActivityFrom () {from return activity; } Public Zero Sat activism (from date activity) {this.activityFrom = activityFrom; } // codes of other methods intentionally @Override public int hashCode () {int result = id.hashCode (); // Code intentionally left out the result; }} Resolution: I changed the feature ID:
@ id @ generatedValue ( Strategy = generation type.INNTPTI) @column (name = "id", length = 10) private long id; I have changed the hash code method:
Full results = ID! = Null? Id.hashCode (): 0; First: The stacktrait you posted is not enough because it is the root cause of the exception. Hides. But anyway, I suspect a null pointer;) There are two problems with your code. The first issue is that you are assuming a non-tap id all the time, which is a new unit In the case (most likely) is not true which is not permanent. Therefore, fix this by checking the null in your hashed method.
Eclipse can help you create equally / hashed methods, which is usually close to the code I need.
The second issue is not clear as if you were using Hibernate, this unit was lazy, so any unit example could be a proxy. As a side effect, which is implemented as a sub-class, also keeps these properties and you expect that you can not get it. As far as I know, the interval is not implemented directly.
To do this, you must actually use "non-final" to fix the second issue! Hesiod / equivalent recipients methods, which are proxied by proxy and assigned to your actual unit example.
Comments
Post a Comment