Problem in JDeveloper 3.1 and OBCJ

From: Pedro Sousa <pedro.sousa_at_novabase.pt>
Date: Fri, 5 Jan 2001 16:19:31 -0000
Message-ID: <978711571.435233_at_cachalote.ip.pt>


  Hello,

   i am having this strange problem with obcj:    When i make a query in a table with 2 records    with an order by "desc" and try to acess the    getEstimatedRowCount() it works fine.   but if i try to acess first record (with the method first()),  the bc throws this strange exception:

 oracle.jbo.SQLStmtException: JBO-27122: SQL error during statement preparation. Statement: SELECT
HistoricoMensalNi.NUMERO_PS_NAO_IDENTIFICADA, .... ... ORDER BY MES_ANO_REFERENCIA DESC  the field its of type varchar2(6);

 when i make the same search, but with order by asc it works fine...

Thanks in advance,
Please Reply to here or to my email,

Pedro Sousa
Pedro.sousa_at_novabase.pt
www.Novabase.pt

Here is the source code:

package teste;

import java.io.Serializable;
import java.util.Hashtable;

import javax.naming.Context;
import javax.naming.InitialContext;
import javax.naming.NamingException;

import oracle.jbo.ApplicationModuleHome; import oracle.jbo.JboContext;

public class Search extends Object {

    TesteModuleImpl applicationModule;
    HistoricoMensalNiViewImpl vo;
    HistoricoMensalNiViewRowImpl row;

    /**
     * Constructor
     */
    public Search() {
        try{
            createApplicationModule();
            applicationModule.getTransaction().connect("url", "user",
"pass");
            vo = applicationModule.getHistoricoMensalNiView();
            vo.setOrderByClause("MES_ANO_REFERENCIA desc");
            vo.executeQuery();
            System.out.println(vo.getEstimatedRowCount());
            row = (HistoricoMensalNiViewRowImpl) vo.first();
            System.out.println(row.getMesAnoReferencia());
        }catch(Exception e){
            System.out.println(e);
        }

}

    protected void createApplicationModule() throws Exception{

        // A preparar o environment do Application Module
        Hashtable env = new Hashtable(10);
        env.put(Context.INITIAL_CONTEXT_FACTORY,
JboContext.JBO_CONTEXT_FACTORY);
        env.put(JboContext.DEPLOY_PLATFORM, JboContext.PLATFORM_LOCAL);

        // A indicar o contexto
        Context ic = new InitialContext(env);

        // Procura o Application Module
        ApplicationModuleHome home = (ApplicationModuleHome)
ic.lookup("teste.TesteModule");
        applicationModule = (TesteModuleImpl) home.create();

}
    /**
     * main
     * _at_param args
     */
    public static void main(String[] args) {
        Search search = new Search();

}

} Received on Fri Jan 05 2001 - 17:19:31 CET

Original text of this message