问题
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