Hello Andre,
What is the type of emptyArray?
----- Original Message -----
From: "A Leg" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Sunday, January 25, 2004 4:17 AM
Subject: Problem using getCollectionByQuery
> Hi
>
> I have some problem using getCollectionByQuery.
>
> Here is the peace of Code :
>
> System.out.println("Send COLLECTIONQUERY MGT ");
> Collection results =
> (Collection)broker.getCollectionByQuery(listQuery);
> System.out.println("Get COLLECTIONQUERY MGT Rows : " +
> results.size());
> MGT_Request[] resArray = (MGT_Request[])results.toArray(emptyArray);
> System.out.println("Get COLLECTIONQUERY toArray done ");
>
> I get this trace :
>
> Send COLLECTIONQUERY MGT
> Get COLLECTIONQUERY MGT Rows : 2
> java.lang.ArrayStoreException
> at java.lang.System.arraycopy(Native Method)
> at java.util.Vector.toArray(Vector.java:688)
> at
> org.compiere.mfg_scm.dbManager.TaskConsumer.mfgGetCollectionByQuery(Unknown
> Source)
> at
> org.compiere.mfg_scm.dbManager.DbManagerImpl.mfgGetCollectionByQuery(Unknown
> Source)
> at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
> at
> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
> at
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
> at java.lang.reflect.Method.invoke(Method.java:324)
> at
> sun.rmi.server.UnicastServerRef.dispatch(UnicastServerRef.java:261)
> at sun.rmi.transport.Transport$1.run(Transport.java:148)
> at java.security.AccessController.doPrivileged(Native Method)
> at sun.rmi.transport.Transport.serviceCall(Transport.java:144)
> at
> sun.rmi.transport.tcp.TCPTransport.handleMessages(TCPTransport.java:460)
> at
> sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run(TCPTransport.java:701)
> at java.lang.Thread.run(Thread.java:534)
>
> I have 2 records in my test table, so the size is good.
> But methods of Collection to extract objects from the Collection :
> Iterator, toArray seems to have problem with the results Collection.
>
> When using the pb broker with getObjectByQuery on the same table and
> same object it is working good.
>
> I am using db-ojb-1.0.rc4
>
> Can anybody help me, I turn alone this problem from one day and get no
> progress.
>
> Andre Legendre
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]