cancel
Showing results for 
Search instead for 
Did you mean: 

Call Stored Proc using SAP JPA

Former Member
0 Kudos

Hi

Can we call stored procedures using SAP implementation of JPA. I had no success till now. I tried to call using named query and native query.

Thanks

Vidyadhar

Accepted Solutions (1)

Accepted Solutions (1)

rolf_paulsen
Active Participant
0 Kudos

Hi

on SAP JPA with system data source, native queries are not "really" native but Open SQL queries.

see Adrian Görlers post how to solve this:

This hint and query.executeUpdate() should work.

Cheers

Rolf

Former Member
0 Kudos

Hi Rolf

It worked.

Query query = entityManager.createNativeQuery("CALL INSERTEMPLOYEE()");

query.executeUpdate();

But if I try with named query I am getting JPQL parser exception saying: unexpected token: CALL. Didn't work.

Thanks

Vidyadhar

rolf_paulsen
Active Participant
0 Kudos

Hi,

named queries are made for selects that return objects.

You might try to change your stored procedure to a function returning e.g. 1 (number) and call it with "select myfunc from dual".

If you really need named query support for PL/SQL consider to switch to eclipselink. They have extended PL/SQL support in their latest release.

http://wiki.eclipse.org/EclipseLink/UserGuide/JPA/Advanced_JPA_Development/Stored_Procedure_and_PL/S...

Regards

Rolf

Answers (0)