본문 바로가기
개발자의 공부방/스프링

스프링부트 에러] 에러 모음.

by 쌈빡한 쥬니준 2020. 3. 17.

Caused by: java.sql.SQLDataException: data exception: invalid character value for cast

 

==> insert 하는 컬럼의 위치가 잘못됐다.

 

 

Caused by: java.sql.SQLSyntaxErrorException: row column count mismatch

 

==> 컬럼을 추가했는데 insert 되는 곧에 추가한 컬럼을 포함하지 않고 insert 를 하려고 하니깐 나오는 에러

 

 

Caused by: java.lang.IllegalArgumentException: Validation failed for query for method public abstract java.util.Collection org.springframework.samples.petclinic.owner.OwnerRepository.findByLastName(java.lang.String)!

 

Caused by: java.lang.IllegalArgumentException: org.hibernate.hql.internal.ast.QuerySyntaxException: unexpected token: % near line 1, column 137 [SELECT DISTINCT owner FROM org.springframework.samples.petclinic.owner.Owner owner left join fetch owner.pets WHERE owner.lastName LIKE %: lastName%]

at org.hibernate.internal.ExceptionConverterImpl.convert(ExceptionConverterImpl.java:138) ~[hibernate-core-5.4.10.Final.jar:5.4.10.Final]

at org.hibernate.internal.ExceptionConverterImpl.convert(ExceptionConverterImpl.java:181) ~[hibernate-core-5.4.10.Final.jar:5.4.10.Final]

at org.hibernate.internal.ExceptionConverterImpl.convert(ExceptionConverterImpl.java:188) ~[hibernate-core-5.4.10.Final.jar:5.4.10.Final]

at org.hibernate.internal.AbstractSharedSessionContract.createQuery(AbstractSharedSessionContract.java:718) ~[hibernate-core-5.4.10.Final.jar:5.4.10.Final]

at org.hibernate.internal.AbstractSharedSessionContract.createQuery(AbstractSharedSessionContract.java:109) ~[hibernate-core-5.4.10.Final.jar:5.4.10.Final]

at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:na]

at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[na:na]

at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[na:na]

at java.base/java.lang.reflect.Method.invoke(Method.java:567) ~[na:na]

 

==> 쿼리를 작성할 때 %:firstName%" 이게 맞는거였는데 % : firstName%" 이렇게 띄어쓰기를 해서 나는 오류였다.

 

 

 

javax.validation.UnexpectedTypeException: HV000030: No validator could be found for constraint 'javax.validation.constraints.NotEmpty' validating type 'java.lang.Integer'. Check configuration for 'age'

at org.hibernate.validator.internal.engine.constraintvalidation.ConstraintTree.getExceptionForNullValidator(ConstraintTree.java:108) ~[hibernate-validator-6.0.18.Final.jar:6.0.18.Final]

at org.hibernate.validator.internal.engine.constraintvalidation.ConstraintTree.getInitializedConstraintValidator(ConstraintTree.java:140) ~[hibernate-validator-6.0.18.Final.jar:6.0.18.Final]

at org.hibernate.validator.internal.engine.constraintvalidation.SimpleConstraintTree.validateConstraints(SimpleConstraintTree.java:55) ~[hibernate-validator-6.0.18.Final.jar:6.0.18.Final]

at org.hibernate.validator.internal.engine.constraintvalidation.ConstraintTree.validateConstraints(ConstraintTree.java:73) ~[hibernate-validator-6.0.18.Final.jar:6.0.18.Final]

at org.hibernate.validator.internal.metadata.core.MetaConstraint.doValidateConstraint(MetaConstraint.java:127) ~[hibernate-validator-6.0.18.Final.jar:6.0.18.Final]

at org.hibernate.validator.internal.metadata.core.MetaConstraint.validateConstraint(MetaConstraint.java:120) ~[hibernate-validator-6.0.18.Final.jar:6.0.18.Final]

at org.hibernate.validator.internal.engine.ValidatorImpl.validateMetaConstraint(ValidatorImpl.java:552) ~[hibernate-validator-6.0.18.Final.jar:6.0.18.Final]

at org.hibernate.validator.internal.engine.ValidatorImpl.validateConstraintsForSingleDefaultGroupElement(ValidatorImpl.java:515) ~[hibernate-validator-6.0.18.Final.jar:6.0.18.Final]

at org.hibernate.validator.internal.engine.ValidatorImpl.validateConstraintsForDefaultGroup(ValidatorImpl.java:485) ~[hibernate-validator-6.0.18.Final.jar:6.0.18.Final]

at org.hibernate.validator.internal.engine.ValidatorImpl.validateConstraintsForCurrentGroup(ValidatorImpl.java:447) ~[hibernate-validator-6.0.18.Final.jar:6.0.18.Final]

at org.hibernate.validator.internal.engine.ValidatorImpl.validateInContext(ValidatorImpl.java:397) ~[hibernate-validator-6.0.18.Final.jar:6.0.18.Final]

at org.hibernate.validator.internal.engine.ValidatorImpl.validate(ValidatorImpl.java:173) ~[hibernate-validator-6.0.18.Final.jar:6.0.18.Final]

 

No validator could be found for constraint 'javax.validation.constraints.NotEmpty' validating type 'java.lang.Integer'. Check configuration for 'age'

 

==> @NotEmpty 는 String 과 collection 에만 사용이 가능한데  age 라는 변수를 Integer로 선언하고 @NotEmpty 를 걸어놔서 생기는 에러였다. @NotEmpty 는 삭제.

출처 : https://055055.tistory.com/37

댓글0