草庐IT

uni-data-select

全部标签

java - 如何在 JPA/Spring-Data JPA 中使用审计?

我在项目中使用JPA和Spring-DataJPA。我有一张表,其中我插入然后更新数据。但是我需要审计信息来保存所有对象的状态,即我需要插入的状态信息和另一个表中的所有后续更新。我知道我可以在数据库中使用触发器来做到这一点。但是,这可以使用JPA/SpringDataJPA来完成吗?如有任何帮助,我们将不胜感激。 最佳答案 JPA规范(section3.5)定义了生命周期回调方法:prePersistpostPersist预删除删除后预更新发布更新加载后这可能是您在纯JPA中所能找到的最接近的东西。SpringData本身具有进一步

java - 使用自定义字体 [java.io.IOException : Error reading font data.]

标题不允许我说问题,所以实际的错误信息是-java.io.IOException:Problemreadingfontdata.atjava.awt.Font.createFont(UnknownSource)atAddFont.createFont(AddFont.java:11)atMainFrame$1.run(MainFrame.java:105)atjava.awt.event.InvocationEvent.dispatch(UnknownSource)atjava.awt.EventQueue.dispatchEventImpl(UnknownSource)atjava.

java - 如何将 hibernate @DynamicUpdate 与 spring data jpa 一起使用?

我正在使用springdata-jpa。我只想更新一列。我的仓库是;publicinterfaceUserRepositoryextendsJpaRepository{}我的服务是;publicUsersave(Useruser){returnuserRepository.save(user);}我的实体;@Entity@DynamicUpdate(true)publicclassUserimplementsSerializable{//columndefinitions,etc.}如何只更新User中的一列? 最佳答案 首先,我想

java - 无法在 Spring Data Repository 中创建自定义查询方法

这个问题在这里已经有了答案:HowtoaddcustommethodtoSpringDataJPA(13个答案)关闭4年前。我想创建自定义存储库:publicinterfaceFriendRepositoryCustom{PagefindFriends(FriendCriteriafriendCriteria,Pageablepageable);}及其实现:@Repository@Transactional(readOnly=true)publicclassFriendRepositoryCustomImplimplementsFriendRepositoryCustom{@Persi

java - 为什么 ‘No database selected’ SQLException?

这个问题在这里已经有了答案:java.sql.SQLException:Nodatabaseselected-why?(4个答案)关闭3年前。为什么这个程序在第二次进入dowhile循环时没有执行,为什么它给出异常“Exceptionjava.sql.SQLException:[MySQL][ODBC5.1Driver][mysqld-5.0.51a-community-nt]没有选择数据库”//importjava.io.InputStream;importjava.sql.Connection;importjava.sql.DriverManager;importjava.sql.

java - Spring Data 网页分页 "page"参数不起作用

我正在尝试让SpringData的Web分页正常工作。在这里描述:http://static.springsource.org/spring-data/data-jpa/docs/current/reference/html/repositories.html#web-pagination这是我的Java(SpringWebMVC@Controller处理程序方法):@RequestMapping(value="/list",method=RequestMethod.GET)publicStringlist(@PageableDefaults(value=50,pageNumber=0

java - Spring Data Rest - 具有默认值的参数

我创建了以下@RepositoryRestResource查询,我想在其中为我的restapi创建一个动态查询。所以基本上我想做类似的事情:myHost/myApp/data/search/all?name=me&age=20&address=myhome&etc=etc所以我创建了以下查询:@Query("SelecttfromDatat"+"where"+"t.namelike:nameAND"+"t.age=:ageAND"+"t.address=:addressAND"+"t.etc=:etc"@RestResource(path="all",rel="all")Pagefin

java - Spring Data JPA 存储库抛出空指针

这个问题在这里已经有了答案:WhyismySpring@Autowiredfieldnull?(21个回答)关闭6年前。我一直在使用SpringBoot和SpringData。通过JavaConfig文档,我已经设置了一个SpringJPA配置,但是当在我的存储库中调用save方法时,会抛出一个空指针。我的仓库:importorg.springframework.data.jpa.repository.JpaRepository;publicinterfaceHouseRepositoryextendsJpaRepository{}我的POJO:抽象屋@MappedSuperclass

java - spring-data-jpa: ORA-01795: 列表中表达式的最大数量为 1000

我正在使用SpringDataJPA。我想从ListclientIdList获取client.id的交易.问题是我传递了一个非常大的列表,然后返回了一个ORA-01795错误。@Query(value="SELECTTransactRepViewModelFROMTransactRepViewModelaWHEREa.clientIdIN(?1)ANDa.clDateBETWEEN?2and?3",nativeQuery=true)ListfindByClientIdList(ListclientIdList,DatestartDate,DateendDate)throwsDataAc

java - 在 IntelliJ IDEA 中设置 JDK 10 : the selected directory is not a valid home for JDK

有人试过在MacOS的IntelliJ上设置JDK10吗?尝试这样做时,我收到的消息是“所选目录不是JDK的有效主目录”。我已经安装了oracle为MacOS提供的JDK10我机器上的JDK安装路径是/Library/Java/JavaVirtualMachines/jdk-10.0.1.jdk/Contents/Home 最佳答案 正确支持Java10需要IntelliJIDEA2018.x版本。IntelliJIDEA2017.x版本可能无法正确检测Java安装路径。 关于java-