| Calling preparedStatement/Function the JPA way [message #755450] |
Tue, 08 November 2011 09:53  |
Neikius Mising name Messages: 32 Registered: April 2011 |
Member |
|
|
Well, the JPA documentation suggests this:
http://en.wikibooks.org/wiki/Java_Persistence/Advanced_Topics#Stored_Procedures
EntityManager em = getEntityManager();
Query query = em.createNativeQuery("BEGIN VALIDATE_EMP(P_EMP_ID=>?); END;");
query.setParameter(1, empId);
query.executeUpdate();
But this doesn't work for me.
Quote:
> Caused by: java.lang.IllegalStateException: You cannot call executeUpdate() on this query. It is the incorrect query type.
I guess EclipseLink has its own PreparedStatement/Function methods. But how do you invoke that using injected container-managed EntityManager? I know how to do stuff using EclipseLink Session construct, but inside this EJB context I just cannot get Session... clues, help? I am just stuck on this at every corner. Well, I can still get the connection direcly, but would like to avoid that if possible since I have managed to fetch data using JPA.
Is it worth trying at all?
|
|
|
|
|
| Re: Calling preparedStatement/Function the JPA way [message #757571 is a reply to message #755523] |
Sat, 19 November 2011 10:45   |
Om Patel Messages: 2 Registered: November 2011 |
Junior Member |
|
|
Hi,
I have user BIRT3.7 version. I want create data set with stored procedure with cursor.data not retrieve but error is:
A BIRT exception occurred.
Plug-in Provider:Eclipse BIRT Project
Plug-in Name:BIRT Data Engine
Plug-in ID:org.eclipse.birt.data
Version:3.7.1.v20110905
Error Code:odaconsumer.CannotExecuteStatement
Error Message:Cannot execute the statement.
org.eclipse.birt.report.data.oda.jdbc.JDBCException: SQL statement does not return a ResultSet object.
SQL error #1:Protocol violation
;
java.sql.SQLException: Protocol violation
please help me
Thanks
Om
[Updated on: Sat, 19 November 2011 11:03] Report message to a moderator
|
|
|
| Re: Calling preparedStatement/Function the JPA way [message #758005 is a reply to message #755523] |
Sat, 19 November 2011 10:45  |
Om Patel Messages: 2 Registered: November 2011 |
Junior Member |
|
|
Hi,
I have user BIRT3.7 version. I want create data set with stored procedure with cursor. but error is:
A BIRT exception occurred.
Plug-in Provider:Eclipse BIRT Project
Plug-in Name:BIRT Data Engine
Plug-in ID:org.eclipse.birt.data
Version:3.7.1.v20110905
Error Code:odaconsumer.CannotExecuteStatement
Error Message:Cannot execute the statement.
org.eclipse.birt.report.data.oda.jdbc.JDBCException: SQL statement does not return a ResultSet object.
SQL error #1:Protocol violation
;
java.sql.SQLException: Protocol violation
please help me
Thanks
Om
|
|
|
Powered by
FUDForum. Page generated in 0.01866 seconds