cancel
Showing results for 
Search instead for 
Did you mean: 

EclipseLink generates wrong sql code when calling stored procedure

Former Member
0 Kudos

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

Accepted Solutions (0)

Answers (1)

Answers (1)

lbreddemann
Active Contributor
0 Kudos

Are you sure that EclipseLink would actually support SAP HANA?

org.eclipse.persistence.platform.database (EclipseLink 2.4.2, build 'v20130514-5956486' API Referenc...

Only lists SAP MaxDB as somewhat "similar" (from the SQL user interface point of view) DBMS.

Most likely it would make sense  to ask this question in an EclipseLink forum, though...

thomas_jung
Developer Advocate
Developer Advocate
0 Kudos

In general EclipseLink does support HANA as of 2.5.x:

Programming with JPA

EclipseLink/Development/DatabasePlatform/HANAPlatform - Eclipsepedia

However if I look at the header of the EclipseLink library for HANA I found the following supported features list:

* <b>Database Platform for SAP HANA</b> <br>
*
* <p>
* <b>Feature Testing</b><br>
* ----------------------
* <ul>
* <li>DDL Generation - Succeeds
* <li>Outer Join - Succeeds
* <li>Subquery - Succeeds
* <li>Stored Procedure Calls - Not supported
* <li>Stored Procedure Generation - Not supported
* <li>Native Sequences/Identifier fields - Succeeds
* <li>JPA Bulk Update/Delete - Succeeds with Limitations
* <li>Batch Reading - Succeeds
* <li>Batch Writing - Succeeds
* <li>Pessimistic Locking - Succeeds with Limitations
* <li>First Result/Limit - Succeeds with Limitations
* <li>Expression Framework - Succeeds with Limitations
* <li>Delimiters - Succeeds
* <li>Auto Detection - Succeeds