I have a List of APIObjects List<APIObjects> apiObjectList as an Input to my API (through HTTP-Post), I need to check all the parameters within this Object exists in my Database
DatabaseObject.java
@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
@Entity
@Table(name = "my_table")
public class DatabaseObject {
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
Long id;
@Column(name = "name")
String name;
@Column(name = "group_id")
String groupId;
@Column(name = "artifact_id")
String artifactId;
@Column(name = "version")
String version;
}
APIObject.java
@Data
@NoArgsConstructor
@AllArgsConstructor
@Builder
public class APIObject{
private String groupId;
private String artifactId;
private String version;
}
In my Repository Interface i have a method like this
List<DatabaseObject> findByGroupIdAndArtifactIdAndVersionIn (List<APIobject> apiList);
But i get this exception
Caused by: java.lang.IllegalArgumentException: No parameter available for part artifactId SIMPLE_PROPERTY (1): [Is, Equals].
How to write a Spring-data-JPA method for this ? All the three parameters should match (groupid, artifactid and version)