Hello, I have a snippet like this.
Public Zero Update (student student) {student = super.merge (student); CurrentSession () Update (student). Return; } But occasionally throws this code
java.lang.IllegalArgumentException: try to save and update event with tap unit. I was wondering how this possible merge could be zero in any circuit?
Because I have examined the student , because zero is merge throws.
Exception in thread "main" java.lang.IllegalArgumentException: attempt to create merge event with zero entity The only condition I think is that the stuff Is it possible when merge tap is coming back ??
Sorry if this question is simple, there is a very good connection to Venezuela.
Merge () is used to merge a separate object with an attached object (both are the same ID) For example, you have passed a student1 object method in Update (), the ID And its status is different:
public zero update (student student 1) {// student1 is in different situation, you have Area can be modified if not yet student1.setName ( "ABC"); // Now load a student ID 2 with the same ID, note that the student is in constant position 2 student student 2 = current session () Load (student class, student1.getId ()); // Mix student 1 into student 2 and return a new student 3 student student 3 = current session (). Merge (student1); // - done, checkout student 3, you will see "ABC" has been merged. You can not call the update () in this case; } If you just want to update the updates to the student, then student = super.merge (student); , delete the call save or update (), like this:
public zero update (student student) {current session (). SaveOrUpdate (student); Return; }
No comments:
Post a Comment