随后致电JPA在Springboot中失败
我正在尝试执行测试,但只有第一个呼叫Findby()才成功。使用Spring Boot v2.6.7,Spring v5.3.19,Hibernate Jar = 5.6.8运行。
Application application = Application.builder()
.appName("APP1")
.productName("PRD1")
.build();
applicationDao.save(application);
Application app1 = applicationDao.findByAppNameIgnoreCaseAndProductNameIgnoreCaseContaining("APP1","PRD");
assertEquals("APP1", app1.getAppName());
随后在同一junit测试方法中调用时,第二个呼叫在junit中失败
Application app2= applicationDao.findByAppNameIgnoreCaseAndProductNameIgnoreCaseContaining("APP1","PRD");
assertEquals("APP1", app2.getAppName());
:
org.springframework.dao.InvalidDataAccessApiUsageException: Parameter value [APP1] did not match expected type [java.lang.Character (n/a)]; nested exception is java.lang.IllegalArgumentException: Parameter value [APP1] did not match expected type [java.lang.Character (n/a)]
I'm trying to execute tests but only the first call to findBy() is successful. Running with Spring Boot v2.6.7, Spring v5.3.19, hibernate jar = 5.6.8.
Application application = Application.builder()
.appName("APP1")
.productName("PRD1")
.build();
applicationDao.save(application);
Application app1 = applicationDao.findByAppNameIgnoreCaseAndProductNameIgnoreCaseContaining("APP1","PRD");
assertEquals("APP1", app1.getAppName());
The second calls fails in JUnit when called subsequently in the same JUnit test method
Application app2= applicationDao.findByAppNameIgnoreCaseAndProductNameIgnoreCaseContaining("APP1","PRD");
assertEquals("APP1", app2.getAppName());
Error:
org.springframework.dao.InvalidDataAccessApiUsageException: Parameter value [APP1] did not match expected type [java.lang.Character (n/a)]; nested exception is java.lang.IllegalArgumentException: Parameter value [APP1] did not match expected type [java.lang.Character (n/a)]
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
看起来像是冬眠中的错误。降级冬眠版本后工作。
Looks like a bug in hibernate. Worked after downgrading hibernate version.