StoredProcedureParameter annotation

Dear Team,

I am trying to call a stored procedure with persistence.
Everything is ok if I use @NamedStoredProcedureQuery and @StoredProcedureParameter annotations; however I need to add an attribute to the StoredProcedureParameter interface.
Since is supposed to contain the procedure parameter name as it is. The attribute purpose is to map value object (i.e. ProcedureArgument.paramName) so we can return the ProcedureArgument class filled with the procedure values to the dev.
The question is: is there a way to add an attribute/variable to StoredProcedureParameter interface?

Even if you could add something to the JPA interfaces (note that you can’t), you’d still need to alter Hibernate so it makes use of this. Maybe explain your use case a bit. I’m pretty sure Hibernate already has a way for you to do what you want.

Dear Beikov,

@NamedStoredProcedureQuery are defined like this:

And that’s how i am executing this stored procedure:

StoredProcedureQuery query = em.createNamedStoredProcedureQuery(STORED_P_ONE);
query.setParameter(CUST_NAME, test);
query.setParameter(CITY_NAME, test);

My Problem:
the name attribute in the @StoredProcedureParameter should be the same as parameter name in the stored procedure it self on the level of the database, i don’t want to be related to the database naming, since if i change the name of the parameter on the database level i should go back to my java code and make changes.
I need to map the parameters to variables of a class, so when I get the results I can cast them directly to my class

That’s simply not possible with the annotation API. You can use the EntityManager#createStoredProcedureQuery method and register the parameters on the StoredProcedureQuery manually if you want to defer the naming of procedure parameters.