BUG : postgresql @NamedStoredProcedureQuery call [message #1120996] |
Mon, 30 September 2013 02:50  |
Eclipse User |
|
|
|
I created a simple function in postgresql
CREATE OR REPLACE FUNCTION simpletest()
RETURNS bigint AS
$BODY$
BEGIN
return 10;
END;
$BODY$
LANGUAGE plpgsql
when I try to run it with eclipse link I get this exception
ERROR: syntax error at or near ")"
Position: 20
Error Code: 0
Call: EXECUTE simpletest()
Query: DataReadQuery(name="simpletest" )
I assume this is eclipselink bug and this is how I define and run the function.
@NamedStoredProcedureQuery(name="simpletest", procedureName="simpletest")
public class Student
public void exec()
{
Query createNamedQuery = entityManager.createNamedQuery("simpletest");
System.out.println(createNamedQuery.getResultList());
}
is this a bug ?
|
|
|
|
|
Re: BUG : postgresql @NamedStoredProcedureQuery call [message #1124425 is a reply to message #1121392] |
Thu, 03 October 2013 10:23   |
Eclipse User |
|
|
|
thank you Chris,
if you mean org.eclipse.persistence.platform.database.PostgreSQLPlatform
yes I have used it as target database and it is "EXECUTE" in getProcedureCallHeader() method not SELECT anyway Do you know why direction is deprecated ?
I have a function with two input arguments and two output arguments which is defined as follow
@NamedStoredProcedureQuery(name = DocumentAccess.CONTAINS_DOC_BY_ANOTHER_OWNER, procedureName = "contains_doc_by_another_owner", parameters = {
@StoredProcedureParameter(queryParameter = "commaSeparatedIds", type = String.class, direction=Direction.IN),
@StoredProcedureParameter(queryParameter = "uid", type = Long.class, direction=Direction.IN),
@StoredProcedureParameter(queryParameter = "has_another_owner", type = Boolean.class, direction= Direction.OUT),
@StoredProcedureParameter(queryParameter = "doc_id", type = Long.class, direction= Direction.OUT)}, resultSetMappings = { DocumentAccess.CONTAINS_DOC_BY_ANOTHER_OWNER }),
but the query is select contains_doc_by_another_owner(?,?) . it should be
select has_another_owner, doc_id from contains_doc_by_another_owner(?,?)
|
|
|
|
Re: BUG : postgresql @NamedStoredProcedureQuery call [message #1126061 is a reply to message #1125564] |
Sat, 05 October 2013 01:26  |
Eclipse User |
|
|
|
I had it fixed by extending Postgresql platform
public class PostgresqlPlatform extends PostgreSQLPlatform
{
@Override
public String getProcedureCallHeader()
{
return "SELECT * FROM ";
}
@Override
public boolean shouldPrintStoredProcedureArgumentNameInCall()
{
return false;
}
}
|
|
|
Powered by
FUDForum. Page generated in 0.03760 seconds