How to handle compound keys with Spring Data JDBC

谁都会走 提交于 2020-01-14 14:44:08

问题


I'm trying to use Spring Data JDBC to access a table that has a compound key, and although I can find lots of info on how Spring Data JPA handles this, the same doesn't seem to apply to Spring Data JDBC.

Can anyone give a quick example of how you need to declare an Entity/Repository with Spring Data JDBC to talk to a table with a compound primary key ? (Eg. Two Strings)


回答1:


Using the CrudRepository for compound keys is currently (Version 1.0.2) not possible.

Of course, you can still use methods annotated with @Query.



来源:https://stackoverflow.com/questions/53345366/how-to-handle-compound-keys-with-spring-data-jdbc

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!