|
|
Re: @NamedStoredProcedureQuery [message #377447 is a reply to message #377443] |
Wed, 30 July 2008 20:43 |
Mohamed Messages: 3 Registered: July 2009 |
Junior Member |
|
|
Hi James,
I was testing a @NamedStroedProcedureQuery
I created procedure without IN or OUT parameters just testing.
It seams when you have a procedure without IN or OUT parameters, you will
get this kind of warning.
[EPS Warning]: 2008.07.29
11:33:01.562--UnitOfWork(27104945)--java.lang.ClassCastExcep tion:
oracle.jdbc.driver.T4CPreparedStatement cannot be cast to
java.sql.CallableStatement
To reproduce the warning, you can call a procedure without IN/OUT
parameters
Now I have changed to a procedure with IN parameter and no OUT parameter.
Here is the def. of the proc
create or replace procedure INSERTCOUNTRY(cityname IN VARCHAR2)
AS
BEGIN
INSERT IGNORE INTO COUNTRY VALUES(cityname);
END;
ANNOTATION:
@Entity
@NamedStoredProcedureQuery(
name="FirstCallProcedure",
procedureName="INSERTCOUNTRY",
resultClass=void.class,
parameters={@StoredProcedureParameter(direction=Direction.IN ,
name="cityname",
queryParameter="NAME",
type=void.class)}
)
public class Country implements Serializable {
EXECUTION:
EntityManagerFactory entityManagerFactory =
Persistence.createEntityManagerFactory("JPAStart");
EntityManager em = entityManagerFactory.createEntityManager();
Query q = em.createNamedQuery("FirstCallProcedure");
q.setParameter("NAME", "ITALY");
q.getSingleResult();
EXCEPTION:
[EPS Info]: 2008.07.30 16:08:51.686--ServerSession(19318181)--EclipseLink,
version: Eclipse Persistence Services - 1.0 (Build SNAPSHOT - 20080409)
[EPS Info]: 2008.07.30
16:08:52.076--ServerSession(19318181)--JPATest-session login successful
wait minute I am going to call Stored procedure
[EPS Warning]: 2008.07.30 16:08:52.248--UnitOfWork(16667599)--Exception
[EclipseLink-4002] (Eclipse Persistence Services - 1.0 (Build SNAPSHOT -
20080409)): org.eclipse.persistence.exceptions.DatabaseException
Internal Exception: java.sql.SQLException: ORA-06550: line 1, column 7:
PLS-00306: wrong number or types of arguments in call to 'INSERTCOUNTRY'
ORA-06550: line 1, column 7:
PL/SQL: Statement ignored
Error Code: 6550
Call: BEGIN INSERTCOUNTRY(); END;
Query: ResultSetMappingQuery()
Exception [EclipseLink-4002] (Eclipse Persistence Services - 1.0 (Build
SNAPSHOT - 20080409)): org.eclipse.persistence.exceptions.DatabaseException
Internal Exception: java.sql.SQLException: ORA-06550: line 1, column 7:
PLS-00306: wrong number or types of arguments in call to 'INSERTCOUNTRY'
ORA-06550: line 1, column 7:
PL/SQL: Statement ignored
Error Code: 6550
Call: BEGIN INSERTCOUNTRY(); END;
Query: ResultSetMappingQuery()
Many thanks indeed
Mohamed
|
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.02753 seconds