草庐IT

jazn-data

全部标签

java - Spring-data findFirstBy 抛出 IncorrectResultSizeDataAccessException?

我想在spring-data中使用sqlselectbymethodname。选择应按价格排序。@EntitypublicclassProduct{intname;BigDecimalprice;}interfaceProductRepositoryextendsCrudRepository{ProductfindFirstByNameOrderByPriceAsc(Stringname);}结果:org.springframework.dao.IncorrectResultSizeDataAccessException:resultreturnsmorethanoneelements

java - Spring-data findFirstBy 抛出 IncorrectResultSizeDataAccessException?

我想在spring-data中使用sqlselectbymethodname。选择应按价格排序。@EntitypublicclassProduct{intname;BigDecimalprice;}interfaceProductRepositoryextendsCrudRepository{ProductfindFirstByNameOrderByPriceAsc(Stringname);}结果:org.springframework.dao.IncorrectResultSizeDataAccessException:resultreturnsmorethanoneelements

Spring MVC 使用表单 :checkbox to bind data

我知道已经有关于这个话题的问题,但我还没有想出如何解决以下问题:我有一个用户/角色关系,我想将JSP中的所有可用角色列为复选框项目,其中用户分配的复选框被选中。但是,没有检查匹配项(这里我使用的是Spring3.1)。从用户对象中提取:privateSetroles=newHashSet();从SpringController中提取(将用户对象和角色列表添加到Model):UserEntityuserEntity=userEntityService.findById(UserEntity.class,newLong(id));model.addAttribute("userAttrib

Spring MVC 使用表单 :checkbox to bind data

我知道已经有关于这个话题的问题,但我还没有想出如何解决以下问题:我有一个用户/角色关系,我想将JSP中的所有可用角色列为复选框项目,其中用户分配的复选框被选中。但是,没有检查匹配项(这里我使用的是Spring3.1)。从用户对象中提取:privateSetroles=newHashSet();从SpringController中提取(将用户对象和角色列表添加到Model):UserEntityuserEntity=userEntityService.findById(UserEntity.class,newLong(id));model.addAttribute("userAttrib

java - 使用 Spring Data 和 Hibernate 时如何正确执行后台线程?

我正在构建一个使用SpringData和Hibernate的简单Tomcatwebapp。有一个端点做了很多工作,所以我想将工作卸载到后台线程,这样Web请求就不会在工作完成时挂起10多分钟。所以我在组件扫描包中编写了一个新服务:@ServicepublicclassBackgroundJobService{@AutowiredprivateThreadPoolTaskExecutorthreadPoolTaskExecutor;publicvoidstartJob(Runnablerunnable){threadPoolTaskExecutor.execute(runnable);}

java - 使用 Spring Data 和 Hibernate 时如何正确执行后台线程?

我正在构建一个使用SpringData和Hibernate的简单Tomcatwebapp。有一个端点做了很多工作,所以我想将工作卸载到后台线程,这样Web请求就不会在工作完成时挂起10多分钟。所以我在组件扫描包中编写了一个新服务:@ServicepublicclassBackgroundJobService{@AutowiredprivateThreadPoolTaskExecutorthreadPoolTaskExecutor;publicvoidstartJob(Runnablerunnable){threadPoolTaskExecutor.execute(runnable);}

java - 在 Spring Data Query 中过滤子对象

我有以下领域模型:Playlist->List->Video@EntityclassPlaylist{//id,name,etcListplaylistItems;//gettersandsetters}@EntityclassPlaylistItem{//id,name,etc.Videovideo;//gettersandsetters}@EntityclassVideo{//id,name,etc.booleanisDeleted;//gettersandsetters}还有我的仓库:publicinterfacePlaylistRepositoryextendsJpaRepos

java - 在 Spring Data Query 中过滤子对象

我有以下领域模型:Playlist->List->Video@EntityclassPlaylist{//id,name,etcListplaylistItems;//gettersandsetters}@EntityclassPlaylistItem{//id,name,etc.Videovideo;//gettersandsetters}@EntityclassVideo{//id,name,etc.booleanisDeleted;//gettersandsetters}还有我的仓库:publicinterfacePlaylistRepositoryextendsJpaRepos

java - 在 Spring Data Rest 响应中选择性地扩展关联

我有一个标准的Spring数据JPA和Spring数据Rest设置,它们正确地将关联作为指向正确资源的链接返回。{"id":1,"version":2,"date":"2011-11-22","description":"XPTO","_links":{"self":{"href":"http://localhost:8000/api/domain/1"},"otherDomain":{"href":"http://localhost:8000/api/domain/1/otherDomain"}}}但是,在一些请求中,我希望扩展与“otherDomain”的关联(因此客户端不必执行N

java - 在 Spring Data Rest 响应中选择性地扩展关联

我有一个标准的Spring数据JPA和Spring数据Rest设置,它们正确地将关联作为指向正确资源的链接返回。{"id":1,"version":2,"date":"2011-11-22","description":"XPTO","_links":{"self":{"href":"http://localhost:8000/api/domain/1"},"otherDomain":{"href":"http://localhost:8000/api/domain/1/otherDomain"}}}但是,在一些请求中,我希望扩展与“otherDomain”的关联(因此客户端不必执行N