soubin hace 7 años
padre
commit
10729e7821

+ 2
- 2
README.md Ver fichero

17
 {"ex":{"exClass":"org.springframework.dao.DataIntegrityViolationException","message":"could not execute statement; SQL [n/a]; constraint [PRIMARY]; nested exception is org.hibernate.exception.ConstraintViolationException: could not execute statement"},"exCause":{"causeBy":"org.hibernate.exception.ConstraintViolationException","message":"could not execute statement"}}
17
 {"ex":{"exClass":"org.springframework.dao.DataIntegrityViolationException","message":"could not execute statement; SQL [n/a]; constraint [PRIMARY]; nested exception is org.hibernate.exception.ConstraintViolationException: could not execute statement"},"exCause":{"causeBy":"org.hibernate.exception.ConstraintViolationException","message":"could not execute statement"}}
18
 
18
 
19
 #5.insert 唯一索引冲突
19
 #5.insert 唯一索引冲突
20
-{"ex":{"exClass":"org.springframework.dao.DataIntegrityViolationException","message":"could not execute statement; SQL [n/a]; constraint [PRIMARY]; nested exception is org.hibernate.exception.ConstraintViolationException: could not execute statement"},"exCause":{"causeBy":"org.hibernate.exception.ConstraintViolationException","message":"could not execute statement"}}
20
+{"ex":{"exClass":"org.springframework.dao.DataIntegrityViolationException","message":"could not execute statement; SQL [n/a]; constraint [idx_email]; nested exception is org.hibernate.exception.ConstraintViolationException: could not execute statement"},"exCause":{"causeBy":"org.hibernate.exception.ConstraintViolationException","message":"could not execute statement"}}
21
 
21
 
22
 #6. update 无主键
22
 #6. update 无主键
23
 {"ex":{"exClass":"org.springframework.orm.jpa.JpaSystemException","message":"ids for this class must be manually assigned before calling save(): ltass.staudy.spring.data.jpa.entity.User; nested exception is org.hibernate.id.IdentifierGenerationException: ids for this class must be manually assigned before calling save(): ltass.staudy.spring.data.jpa.entity.User"},"exCause":{"causeBy":"org.hibernate.id.IdentifierGenerationException","message":"ids for this class must be manually assigned before calling save(): ltass.staudy.spring.data.jpa.entity.User"}}
23
 {"ex":{"exClass":"org.springframework.orm.jpa.JpaSystemException","message":"ids for this class must be manually assigned before calling save(): ltass.staudy.spring.data.jpa.entity.User; nested exception is org.hibernate.id.IdentifierGenerationException: ids for this class must be manually assigned before calling save(): ltass.staudy.spring.data.jpa.entity.User"},"exCause":{"causeBy":"org.hibernate.id.IdentifierGenerationException","message":"ids for this class must be manually assigned before calling save(): ltass.staudy.spring.data.jpa.entity.User"}}
32
 {"ex":{"exClass":"org.springframework.orm.ObjectOptimisticLockingFailureException","message":"Object of class [ltass.staudy.spring.data.jpa.entity.User] with identifier [1]: optimistic locking failed; nested exception is org.hibernate.StaleObjectStateException: Row was updated or deleted by another transaction (or unsaved-value mapping was incorrect) : [ltass.staudy.spring.data.jpa.entity.User#1]"},"exCause":{"causeBy":"org.hibernate.StaleObjectStateException","message":"Row was updated or deleted by another transaction (or unsaved-value mapping was incorrect) : [ltass.staudy.spring.data.jpa.entity.User#1]"}}
32
 {"ex":{"exClass":"org.springframework.orm.ObjectOptimisticLockingFailureException","message":"Object of class [ltass.staudy.spring.data.jpa.entity.User] with identifier [1]: optimistic locking failed; nested exception is org.hibernate.StaleObjectStateException: Row was updated or deleted by another transaction (or unsaved-value mapping was incorrect) : [ltass.staudy.spring.data.jpa.entity.User#1]"},"exCause":{"causeBy":"org.hibernate.StaleObjectStateException","message":"Row was updated or deleted by another transaction (or unsaved-value mapping was incorrect) : [ltass.staudy.spring.data.jpa.entity.User#1]"}}
33
 
33
 
34
 #10. update 唯一索引冲突
34
 #10. update 唯一索引冲突
35
-{"ex":{"exClass":"org.springframework.dao.DataIntegrityViolationException","message":"could not execute statement; SQL [n/a]; constraint [PRIMARY]; nested exception is org.hibernate.exception.ConstraintViolationException: could not execute statement"},"exCause":{"causeBy":"org.hibernate.exception.ConstraintViolationException","message":"could not execute statement"}}
35
+{"ex":{"exClass":"org.springframework.dao.DataIntegrityViolationException","message":"could not execute statement; SQL [n/a]; constraint [idx_email]; nested exception is org.hibernate.exception.ConstraintViolationException: could not execute statement"},"exCause":{"causeBy":"org.hibernate.exception.ConstraintViolationException","message":"could not execute statement"}}

+ 2
- 1
src/main/java/ltass/staudy/spring/data/jpa/controller/TestController.java Ver fichero

143
     @GetMapping("/user/insert/error/conflict_unique")
143
     @GetMapping("/user/insert/error/conflict_unique")
144
     public String insertErrorConflictUnique() {
144
     public String insertErrorConflictUnique() {
145
         User user = new User();
145
         User user = new User();
146
-        user.setId(1L);
146
+        user.setId(9L);
147
         user.setNickName("nickName");
147
         user.setNickName("nickName");
148
         user.setName("myName");
148
         user.setName("myName");
149
         user.setEmail("email");
149
         user.setEmail("email");
172
         user.setName("myName");
172
         user.setName("myName");
173
         user.setEmail("email2");
173
         user.setEmail("email2");
174
         user.setDelFlag(0);
174
         user.setDelFlag(0);
175
+        user.setVerNo(0);
175
         user.setRegisterDatetime("2019/01/01 01:01:00");
176
         user.setRegisterDatetime("2019/01/01 01:01:00");
176
         user.setRegisterUserId(1L);
177
         user.setRegisterUserId(1L);
177
         user.setRegisterProcess("web");
178
         user.setRegisterProcess("web");

Loading…
Cancelar
Guardar