Skip to Content
0
Former Member
Aug 13, 2015 at 12:59 PM

EclipseLink generates wrong sql code when calling stored procedure

231 Views

Hi,

I am using EclipseLink 2.5 trying to call a HANA stored procedure, like this:

1) describe it in the xml:

<named-stored-procedure-query
  name="findAllStationsNamedProc"
  result-class="com.domain.Station"
  procedure-name="CC_TEST_READ_STATIONS">
</named-stored-procedure-query>

2) use it in code:

Query q = em.createNamedQuery("findAllStationsNamedProc");
List<Station> stationList = q.getResultList();
System.out.println("Loaded  " + stationList.size() + " stations");

Although other calls that do not involve calling a stored procedure work fine through JDBC, this one doesn't. The generated SQL doesn't seem to be proper HANA SQL, having EXECUTE instead of CALL:

javax.persistence.PersistenceException: Exception [EclipseLink-4002] (Eclipse Persistence Services - 2.6.0.v20150309-bf26070): org.eclipse.persistence.exceptions.DatabaseException
Internal Exception: com.sap.db.jdbc.exceptions.JDBCDriverException: SAP DBTech JDBC: [257]: sql syntax error: incorrect syntax near "EXECUTE": line 1 col 1 (at pos 1)
Error Code: 257
Call: EXECUTE PROCEDURE CC_TEST_READ_STATIONS()
Query: ReadAllQuery(name="findAllStationsThroughAMDPNamedProc" referenceClass=Station )

Any ideas why it generates with EXECUTE and what would be any possible solutions?

Thank you,

Alex