Hello Andy

Thank you for your help.
In fact the code is very limited, because for "debugging purpose" I had take off many elements.
I try to give you below all what can help you to find out the solution.


Variables definition is :

private static final MGT_Request[] emptyArray = new MGT_Request[0];
Query listQuery = QueryFactory.newQuery(MGT_Request.class, null, false);

The only things more in the code is the try and catch statement dans the transaction begin, commit and abord elements.

repository is (I have kept only this during this debugging)

<class-descriptor class="org.compiere.mfg_scm.dbManager.MGT_Request" proxy="dynamic" table="MGT_REQUEST">
<field-descriptor name="jobNum" primarykey="true" nullable="false" column="JOBNUM" jdbc-type="NUMERIC"/>
<field-descriptor name="channelName" nullable="false" column="CHANNELNAME" jdbc-type="VARCHAR"/>
<field-descriptor name="noId" nullable="false" column="NOID" jdbc-type="NUMERIC"/>
<field-descriptor name="Request" nullable="false" column="REQUEST" jdbc-type="VARCHAR"/>
<field-descriptor name="from_Service" nullable="false" column="FROM_SERVICE" jdbc-type="VARCHAR"/>
<field-descriptor name="action_Type" nullable="false" column="ACTION_TYPE" jdbc-type="VARCHAR"/>
<field-descriptor name="hold" nullable="false" column="HOLD" jdbc-type="VARCHAR"/>
<field-descriptor name="userName" nullable="false" column="USERNAME" jdbc-type="VARCHAR"/>
<field-descriptor name="startTime" nullable="false" column="STARTTIME" jdbc-type="NUMERIC"/>
</class-descriptor>


The MGT_Request class code is (it implements serializable because it is require for my application) :

public class MGT_Request implements java.io.Serializable
{
  public static final String JOBNUM            = "jobNum";
  public static final String CHANNELNAME       = "channelName";
  public static final String NOID              = "noId";
  public static final String REQUEST           = "Request";
  public static final String FROM_SERVICE      = "from_Service";
  public static final String ACTION_TYPE       = "action_Type";
  public static final String HOLD              = "hold";
  public static final String USERNAME          = "userName";
  public static final String STARTTIME         = "startTime";

//---------------------------------------------------------------------------

  public static final int CHANNELNAME_SIZE     = 32;
  public static final int REQUEST_SIZE         = 2000;
  public static final int FROM_SERVICE_SIZE    = 200;
  public static final int ACTION_TYPE_SIZE     = 32;
  public static final int HOLD_SIZE            = 1;
  public static final int USERNAME_SIZE        = 200;

//---------------------------------------------------------------------------

  public BigDecimal       jobNum;
  public String     channelName;
  public BigDecimal       noId;
  public String     Request;
  public String     from_Service;
  public String     action_Type;
  public String       hold;
  public String     userName;
  public BigDecimal       startTime;

public MGT_Request() {
this.startTime = new BigDecimal(System.currentTimeMillis());
}
public MGT_Request(String channelName) {
this.channelName = channelName;
this.startTime = new BigDecimal(System.currentTimeMillis());
}
public MGT_Request(String channelName, BigDecimal jobNum, BigDecimal noId, String Request, String from_Service, String action_Type, String hold, String userName) {
this.channelName = channelName;
this.jobNum = jobNum;
this.noId = noId;
this.Request = Request;
this.from_Service = from_Service;
this.action_Type = action_Type;
this.hold = hold;
this.userName = userName;
this.startTime = new BigDecimal(System.currentTimeMillis());
}
//---------------------------------------------------------------------------
public BigDecimal getJobNum() { return jobNum; }


  public void setJobNum(BigDecimal jobNum)
  {
     this.jobNum = jobNum;
  }

//---------------------------------------------------------------------------

public String getChannelName() { return channelName; }

  public void setChannelName(String channelName)
  {
     this.channelName = channelName;
  }

//---------------------------------------------------------------------------

public BigDecimal getNoId() { return noId; }

  public void setNoId(BigDecimal noId)
  {
     this.noId = noId;
  }

//---------------------------------------------------------------------------

public String getRequest() { return Request; }

  public void setRequest(String Request)
  {
     this.Request = Request;
  }

//---------------------------------------------------------------------------

public String getFrom_Service() { return from_Service; }

  public void setFrom_Service(String from_Service)
  {
     this.from_Service = from_Service;
  }

//---------------------------------------------------------------------------

public String getAction_Type() { return action_Type; }

  public void setAction_Type(String action_Type)
  {
     this.action_Type = action_Type;
  }

//---------------------------------------------------------------------------

public String getHold() { return hold; }

public void setHold(String hold)
{
this.hold = hold;
}
//---------------------------------------------------------------------------


public String getUserName() { return userName; }

  public void setUserName(String userName)
  {
     this.userName = userName;
  }

//---------------------------------------------------------------------------

public BigDecimal getStartTime() { return startTime; }

  public void setStartTime(BigDecimal startTime)
  {
     this.startTime = startTime;
  }
}

Andre

Andy Malakov wrote:

Hello Andre,

Can you please provide minimal but complete code that contains definitions of all 
variables used in you original mail (including
listQuery and emptyArray)?



----- Original Message ----- From: "A Leg" <[EMAIL PROTECTED]>
To: "OJB Users List" <[EMAIL PROTECTED]>
Sent: Monday, January 26, 2004 2:16 PM
Subject: Re: Problem using getCollectionByQuery





Hi Andy

The empty array is a MGT_Request[]

Andre

Andy Malakov wrote:



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]






--------------------------------------------------------------------- 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]






--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]



Reply via email to