Hi

I get some more elements on my getCollectionByQuery problem.

It seems that elements of the Collection I get are not valid to be casted by my class.
If I change to put an Iterator on the Collection it works good as soon I don't try to cast to my Objects.


Does anybody can help me ?
I am realy stuck.

Andre

I change the code to :

System.out.println("Send COLLECTIONQUERY MGT ");
Collection results = (Collection)broker.getCollectionByQuery(listQuery);
//System.out.println("Get COLLECTIONQUERY MGT Rows : " + results.size());
System.out.println("Get COLLECTIONQUERY MGT Rows : INCONNU");
Iterator iter = results.iterator();
Collection acc = new Vector();
System.out.println("Get COLLECTIONQUERY ojbIterator get ");
MGT_Request tmpReq = new MGT_Request();
System.out.println("Get COLLECTIONQUERY ojbIterator iter");
while (iter.hasNext())
{
acc.add(iter.next());
}
System.out.println("Get COLLECTIONQUERY ojbIterator done ");
MGT_Request[] resArray = (MGT_Request[])acc.toArray(emptyArray);
System.out.println("Get COLLECTIONQUERY toArray done ");


And I got the error message :

Send COLLECTIONQUERY MGT
Get COLLECTIONQUERY MGT Rows : INCONNU
Get COLLECTIONQUERY ojbIterator get
Get COLLECTIONQUERY ojbIterator iter
Get COLLECTIONQUERY ojbIterator done
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)



A Leg wrote:


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]



Reply via email to