Reputation: 648
I am working with Hibernate and would like to use some NamedStoredProcedureQueries annotations with custom ResultMapping, i.e.
@Entity
@NamedStoredProcedureQuery(
name = SP_NAME,
procedureName = SP_NAME,
resultSetMappings = {},
parameters = {
@StoredProcedureParameter(mode = ParameterMode.IN, type = BigDecimal.class, name = PARAM)
}
)
The Problem ist now that the @NamedStoredProcedureQuery annotation will only be processed if put into an entity.
But in this case, I dont have (and want) an entity because there is no result mapping neccessary and also dont have an ID to put the @Id annotation on.
Is there another way to declare NamedStoredProcedureQueries without using entities?
Upvotes: 2
Views: 2837
Reputation: 2933
There is no other way using that annotation.
Specifies multiple named stored procedure queries. Query names are scoped to the persistence unit. The NamedStoredProcedureQueries annotation can be applied to an entity or mapped superclass.
https://docs.oracle.com/javaee/7/api/javax/persistence/NamedStoredProcedureQueries.html
You can call SP programmatically.
Upvotes: 1