Hi Armin,

I have seen the FAQ. Thanks.

But it doesn't work for me.

My SQL query is "select workstationName from Workstation".
>From my database query analyzer, this query retrieves 36 rows.

In OJB I try:
----code----
String sql = "select workstationName from Workstation";

Query query = QueryFactory.newQuery(Workstation.class, sql);

try {
        broker.beginTransaction();
        Collection col = broker.getCollectionByQuery(query);
                        
        int size = col.size();
        System.out.println(size);

        broker.commitTransaction();
} catch (Throwable t) {
        broker.abortTransaction();
        t.printStackTrace();
}
----code----

The problem is that the size of the collection is 0!
OJB doesn't retrieve anything!

But if I try the query "select * from Workstation", it works!!

Have you an idea what's the problem?

I'm using OJB 0.9.5.


Thanks
Sylvain


-----Message d'origine-----
De: Armin Waibel [mailto:[EMAIL PROTECTED]
Date: mercredi, 19. mars 2003 16:12
�: OJB Users List
Objet: Re: how to send a real SQL query to OJB


Hi Sylvain,

see FAQ
http://db.apache.org/ojb/faq.html

topic "Is it possible to perform my own sql-queries in OJB?"
+ "Can I directly obtain a java.sql.Connection within OJB?"

regards,
Armin

----- Original Message -----
From: <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Wednesday, March 19, 2003 4:05 PM
Subject: how to send a real SQL query to OJB


Hello,

I have a String variable which contains a real SQL query like this:
"SELECT distinct(workstationName) FROM Workstation w, WntWorkstation t,
Package p, Package_Workstation r WHERE (w.workstationName like '%' or
w.workstationName is NULL) order by w.workstationName"

How can I send this query (as written above) to OJB?

Thanks
Sylvain

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