You are viewing a plain text version of this content. The canonical link for it is here.
Posted to ojb-user@db.apache.org by tr...@thinkvirtual.com on 2002/12/02 05:09:26 UTC

RE: Problem with JDO Query

You should probably cast the execute() to Collection rather than Vector.  

Collection Lista = (Collection) Consulta.execute();

travis

---- Original Message ----
From: Glaucio Jannotti <gj...@uol.com.br>
Sent: 2002-11-29
To: ojb-user@jakarta.apache.org
Subject: Problem with JDO Query

I have problem with a simple Query using JDO Engine.
The operation of save persistent class has working, the problem only occurs in the Query execution.

The code is the bellow:

Vector Lista = new Vector();
Query Consulta = Manager.newQuery(Paciente.class);
Lista = (Vector) Consulta.execute();
for (int I = 0; I < Lista.size(); I++)
{
  System.out.println(((Paciente) Lista.get(I)).getNome());
}

The error of java is : NullPointerException.
I debuged the code and see what the Lista Vector has size() after the line "Lista = (Vector) Consulta.execute()".

What�s wrong in this code ?

The JDO Query is working ?

Can I made a Query in my JDO system using Broker.Query ?


[]�s
Glaucio Jannotti