How to handle compound keys with Spring Data JDBC

3.2k Views Asked by At

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

There are 1 best solutions below

5
On

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

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