Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » EclipseLink » Error on calling StoredProcedure
Error on calling StoredProcedure [message #1829908] Mon, 13 July 2020 17:48 Go to next message
Bruno Tavares is currently offline Bruno TavaresFriend
Messages: 2
Registered: July 2020
Junior Member
I got this error when I try to call a StoredProcedure on Postgresql.

Caused by: Exception [EclipseLink-4002] (Eclipse Persistence Services - 2.7.6.payara-p1): org.eclipse.persistence.exceptions.DatabaseException
Internal Exception: java.sql.SQLFeatureNotSupportedException: Method org.postgresql.jdbc.PgCallableStatement.setBigDecimal(String,BigDecimal) is not yet implemented.
Error Code: 0
Call: {?= CALL pck_app_colheitas.set_estado_atendimento(?, ?, ?, ?, ?)}
bind => [6 parameters bound]
Query: ResultSetMappingQuery()
at org.eclipse.persistence.exceptions.DatabaseException.sqlException(DatabaseException.java:342)
at org.eclipse.persistence.internal.databaseaccess.DatabaseAccessor.basicExecuteCall(DatabaseAccessor.java:691)
at org.eclipse.persistence.internal.databaseaccess.DatabaseAccessor.executeCall(DatabaseAccessor.java:567)
at org.eclipse.persistence.internal.sessions.AbstractSession.basicExecuteCall(AbstractSession.java:2099)
at org.eclipse.persistence.sessions.server.ClientSession.executeCall(ClientSession.java:313)
at org.eclipse.persistence.internal.queries.DatasourceCallQueryMechanism.executeCall(DatasourceCallQueryMechanism.java:275)
at org.eclipse.persistence.internal.queries.DatasourceCallQueryMechanism.executeCall(DatasourceCallQueryMechanism.java:261)
at org.eclipse.persistence.internal.queries.DatasourceCallQueryMechanism.execute(DatasourceCallQueryMechanism.java:253)
at org.eclipse.persistence.queries.ResultSetMappingQuery.executeDatabaseQuery(ResultSetMappingQuery.java:318)
at org.eclipse.persistence.queries.DatabaseQuery.execute(DatabaseQuery.java:911)
at org.eclipse.persistence.queries.DatabaseQuery.executeInUnitOfWork(DatabaseQuery.java:810)
at org.eclipse.persistence.internal.sessions.UnitOfWorkImpl.internalExecuteQuery(UnitOfWorkImpl.java:2983)
at org.eclipse.persistence.internal.sessions.AbstractSession.executeQuery(AbstractSession.java:1898)
at org.eclipse.persistence.internal.sessions.AbstractSession.executeQuery(AbstractSession.java:1880)
at org.eclipse.persistence.internal.sessions.AbstractSession.executeQuery(AbstractSession.java:1845)
at org.eclipse.persistence.internal.jpa.QueryImpl.executeReadQuery(QueryImpl.java:262)
... 96 more
Caused by: java.sql.SQLFeatureNotSupportedException: Method org.postgresql.jdbc.PgCallableStatement.setBigDecimal(String,BigDecimal) is not yet implemented.
at org.postgresql.Driver.notImplemented(Driver.java:693)
at org.postgresql.jdbc.PgCallableStatement.setBigDecimal(PgCallableStatement.java:749)
at com.sun.gjc.spi.base.CallableStatementWrapper.setBigDecimal(CallableStatementWrapper.java:860)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.base/java.lang.reflect.Method.invoke(Method.java:566)
at com.sun.gjc.spi.jdbc40.ProfiledConnectionWrapper40$1.invoke(ProfiledConnectionWrapper40.java:437)
at com.sun.proxy.$Proxy403.setBigDecimal(Unknown Source)
at org.eclipse.persistence.internal.databaseaccess.DatabasePlatform.setParameterValueInDatabaseCall(DatabasePlatform.java:2692)
at org.eclipse.persistence.queries.StoredProcedureCall.prepareStatement(StoredProcedureCall.java:893)
at org.eclipse.persistence.internal.databaseaccess.DatabaseAccessor.basicExecuteCall(DatabaseAccessor.java:628)
... 110 more


It's working on eclipselink 2.7.4, but not working on 2.7.7.


Code to test is:
StoredProcedureQuery setEstadoAtendimento = em.createStoredProcedureQuery("pck_app_colheitas.set_estado_atendimento");

setEstadoAtendimento.registerStoredProcedureParameter("vNumepisodio", BigInteger.class, ParameterMode.IN);
setEstadoAtendimento.registerStoredProcedureParameter("vUser", String.class, ParameterMode.IN);
setEstadoAtendimento.registerStoredProcedureParameter("vIdSala", BigInteger.class, ParameterMode.IN);
setEstadoAtendimento.registerStoredProcedureParameter("vIdCentro", BigInteger.class, ParameterMode.IN);
setEstadoAtendimento.registerStoredProcedureParameter("vIdEstado", Integer.class, ParameterMode.IN);
setEstadoAtendimento.registerStoredProcedureParameter("vRetorno", Integer.class, ParameterMode.OUT);

setEstadoAtendimento.setParameter("vNumepisodio", idEpisodio);
setEstadoAtendimento.setParameter("vUser", username);
setEstadoAtendimento.setParameter("vIdSala", idSala);
setEstadoAtendimento.setParameter("vIdCentro", idCentro);
setEstadoAtendimento.setParameter("vIdEstado", estadoAtendimento.getId());

setEstadoAtendimento.execute();


Postgresql driver is:
postgresql-42.2.12.jar


Re: Error on calling StoredProcedure [message #1829950 is a reply to message #1829908] Tue, 14 July 2020 16:03 Go to previous messageGo to next message
Chris Delahunt is currently offline Chris DelahuntFriend
Messages: 1388
Registered: July 2009
Senior Member
Looks like the driver used doesn't have support for named parameters. You will have to define them by their positions instead:

setEstadoAtendimento.registerStoredProcedureParameter(1, BigInteger.class, ParameterMode.IN);
...
setEstadoAtendimento.setParameter(1, idEpisodio);
..

I have no idea why this would have worked previously though.

Best Regards,
Chris

[Updated on: Tue, 14 July 2020 16:04]

Report message to a moderator

Re: Error on calling StoredProcedure [message #1830059 is a reply to message #1829950] Thu, 16 July 2020 14:05 Go to previous message
Bruno Tavares is currently offline Bruno TavaresFriend
Messages: 2
Registered: July 2020
Junior Member
Hi Chris,

That works, thanks!

It seems that the parameters were filled in the order in which they were registered and not by name.

Best Regards,
Bruno



Previous Topic:How to create a history for a Many To Many relationship?
Next Topic:How can I share a column between two FKs to the same reference table?
Goto Forum:
  


Current Time: Sat Jun 19 23:22:11 GMT 2021

Powered by FUDForum. Page generated in 0.01366 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top