Say I have 2 cmp entities with properties:

Office
- int id
- String tel
- String fax
- String address

Employee
- int id
- String name
- Office office

I have 2 finders in EmployeeHome that finds all employees in a particular
office:
        public Collection findByOffice(int officeId) throws...
        public Collection findByOffice(Office office) throws...
and they both have the following entries in orion-ejb-jar.xml:
        <finder-method query="$office = $1"> ...

All's good and working fine, but I need to pass across to the Employee
finder method a group of Offices (either in a Collection or an array).

I have tried adding the following methods:
        public Collection findByOffice(int[] officeIds) throws...
        public Collection findByOffice(Office[] offices) throws...
        public Collection findByOffice(Collection offices) throws...
with:
        <finder-method query="$office IN ($1)" />

But I get the following errors:

- When using int[], upon deploying the ejb-jar file:
        Bean-type 'int' used in or-mapping not found

- When using Office[], upon deployment:
        java.lang.NullPointerException:
        at com.evermind.server.ejb.deployment.eg.vk(JAX)
        at com.evermind.server.ejb.database.eh.yw(JAX)
        at com.evermind.server.ejb.compilation.e2.aad(JAX)
        at com.evermind.server.ejb.compilation.ew.o6(JAX)
          ... very long stack trace.

- When using Collection, the ejb deploys fine, but upon calling the finder
method, an SQL error msg is thrown by the db (Sybase 11.9.2):
        Operand type clash: IMAGE is incompatible with INT
This suggests that orion is simply passing across the serialized Collection
as a blob of data. (IMAGE is Sybase's equivalent of BLOB).

Does anyone know if it's possible to pass across Collections or arrays to
finder methods, and if so what I'm doing wrong.

I'm convinced it's possible because in the orion documention for
orion-ejb-jar/enterprise-beans/entity-deployment/finder-method/method/method
-params/method-param, it uses int[] as the example.

Thanks in advance.

-Joe Walnes


Reply via email to