How to call a stored procedure in Spring Data JPA without entities (and therefore without repositories)?

Viewed 3814

I'm being able to call a stored procedure using Spring Data JPA, by using the following code. This is the mapping for the stored procedure, included in a class annotated with @Entity

@NamedStoredProcedureQuery(name = "testProc0", procedureName = "testproc", parameters = {
        @StoredProcedureParameter(mode = ParameterMode.IN, name = "input", type = String.class),
        @StoredProcedureParameter(mode = ParameterMode.OUT, name = "output", type = String.class) })

The method for calling the stored procedure in turn, is defined in the repository corresponding to the previously mentioned class, with the following two lines:

@Procedure("testproc")
String testProc(String input);

Now the question is: I want to create a module that only calls the stored procedure. However, this new module won't have any classes annotated with @Entity, and therefore no repositories. Is this possible? And if it is, where should I put the code for defining and calling the stored procedure?

0 Answers
Related