Community
Participate
Working Groups
Build Identifier: 20110916-0149 Eclipselink 2.3.0 Oracle 10g r2 db @Override public void customize(ClassDescriptor descriptor) throws Exception { descriptor.setReadOnly(); DescriptorQueryManager dqm = descriptor.getDescriptorQueryManager(); StoredFunctionCall sfc = new StoredFunctionCall(); ReadAllQuery raq = new ReadAllQuery(Table.class); sfc.setProcedureName("procedure_name"); sfc.useUnnamedCursorOutputAsResultSet(); sfc.setParameters(null); sfc.setResult("FUNCTION_RESULT", Table.class); raq.setCall(sfc); dqm.setReadAllCall(sfc); dqm.setReadAllQuery(raq); dqm.setReadAllSQLString(null); descriptor.setQueryManager(dqm); } Descriptor is called as expected (I can breakpoint it, also there are errors when you try to do stupid things). The customized realall operation is ignored. I will get generated select * from table query (Which fails since user doesn't have permissions). Hence it seems crud customization feature which is advertised in documentation is not working at all. Also I could not find one complete example how to implement this. Have tried querying using EntityManager and eclipselink Sesssion to no avail. I am sure someone from the project could verify this in no time. Reproducible: Sometimes Steps to Reproduce: Try overriding default readall operation to use function. It does not work.
Setting target and priority. See the following page for the meanings of these fields: http://wiki.eclipse.org/EclipseLink/Development/Bugs/Guidelines Community: Please vote for this bug if it is important to you. Votes are one of the main criteria we use to determine which bugs to fix next.
Correcting target milestone to next milestone that will include community-submitted bugs.
The three DescriptorQueryManager's methods setReadAllCall, setReadAllQuery and setReadAllSQLString all do the same thing: they set readAllQuery - so you need to use just one of them. Also you have to set readObject query - for reading of a single object by primary key. Here's a simple example from Eclipselink tests for class Employee: StoredProcedureCall readObjectCall = new StoredProcedureCall(); readObjectCall.setProcedureName("Read_Employee"); readObjectCall.addNamedArgument("P_EMP_ID", "EMP_ID"); readObjectCall.useNamedCursorOutputAsResultSet("RESULT_CURSOR"); descriptor.getQueryManager().setReadObjectCall(readObjectCall); StoredProcedureCall readAllCall = new StoredProcedureCall(); readAllCall.setProcedureName("Read_All_Employees"); readAllCall.useNamedCursorOutputAsResultSet("RESULT_CURSOR"); descriptor.getQueryManager().setReadAllCall(readAllCall); Where "Read_Employee" and "Read_All_Employees" are stored procedures defined in the Oracle db: CREATE OR REPLACE PROCEDURE "READ_EMPLOYEE" ( P_EMP_ID NUMBER, RESULT_CURSOR OUT CURSOR_TYPE.ANY_CURSOR) AS BEGIN OPEN RESULT_CURSOR FOR Select E.*, S.* from EMPLOYEE E, SALARY S where E.EMP_ID = S.EMP_ID AND E.EMP_ID = P_EMP_ID; END; CREATE OR REPLACE PROCEDURE "READ_ALL_EMPLOYEES" ( RESULT_CURSOR OUT CURSOR_TYPE.ANY_CURSOR) AS BEGIN OPEN RESULT_CURSOR FOR Select E.*, S.* from EMPLOYEE E, SALARY S WHERE E.EMP_ID = S.EMP_ID; END; Class Employee is mapped to two tables EMPLOYEE and SALARY, it's pk is mapped to EMPLOYEE.EMP_ID, SALARY.EMP_ID is a foreign key joining SALARY and EMPLOYEE tables.
The Eclipselink project has moved to Github: https://github.com/eclipse-ee4j/eclipselink