DEV Community

Cover image for Palmyra-FlexiQuery
Raja
Raja

Posted on

Palmyra-FlexiQuery

An alternative to CriteriaBuilders for SpringBoot/JPA developers.

As part of our roadmap on SpringBoot integration, we are introducing Flexi Query feature into Standard Springboot Controller.
Now you can query N number of tables with criteria and order by -- all driven by Annotations.

Sample project here -- https://github.com/palmyralabs/springboot-query

@RestController
@RequiredArgsConstructor
@RequestMapping("supplier")
public class SupplierController {
    private final ModelQueryService queryService;

    @GetMapping("")
    public void querySuppliers(@RequestParam Map<String, String> paramsMap) {
        RequestParams params = queryService.getRequestParams(SupplierModel.class, 
                paramsMap);     
        queryService.executeAndSendListResponse(params);
    }
}
Enter fullscreen mode Exit fullscreen mode
@PalmyraType(type = "Supplier")
public class SupplierModel {
    private Integer id;
    private String name;
    private String email;
    private String phoneNumber;
    private String address;
}

Enter fullscreen mode Exit fullscreen mode

The above model is a simple example show-casing to query single table. More examples on multi-table model will be posted soon.

Top comments (0)