• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Dynamic query problem in WAS 6.0

 
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I would appreciate if someone will be able to assist us in solving this issue.





The issue is that I have 2 ejb projects say ejbA and ejbB. Let us assume that project ejbA has 2 CMP�s CMP1 and CMP2. Project ejbB has CMP�s CMP1 and CMP2 as well. The Abstract Schema names are not unique in the server scope.







The structure of project ejbA�s CMP1 is



Name String



Description String





The Structure of projects ejbA�s CMP2 is



No Integer



Desc String







The structure of project ejbB�s CMP1 is



Name String



Description String





The Structure of projects ejbB�s CMP2 is



No Integer



Desc String







When I had to execute the query select ejb.* from CMP1 ejb , since there is an ambiguity in the ASN names, it requires the queryDomain parameter. And as mentioned in the docs. I tried the ASN, EJB Home object reference pair.





executeQuery




public QueryIterator executeQuery(java.lang.String queryStatement,
java.lang.Object[] parameterVars,
java.util.Properties queryDomain,
int skipRows,
int maxRows)
throws java.rmi.RemoteException,
QueryException
validate and execute an ejb query statement

Parameters:

queryStatement -

parameterVars - The values to be substituted for any query parameters in the query statement.

queryDomain - Normally a null value. This parameter is null in the cases where the Abstract Schema Names (ASN) used in the query statement are unique in the server scope. If ASN names are not unique across applications in the server, then the ASN name must be qualified by its EJB Home reference. This takes the form of name/value pairs (ASN name, EJB Home object reference). An EJB Home reference can be obtained from a name service lookup call.

skipRows - Number of tuples in the final result set to skip.

maxRows - Maximum number of tuples to return in result set.

Throws:

QueryException - Indicates an invalid query plan, a server or database error occurred, or the query invoked an application method which threw an exception.

java.rmi.RemoteException





/**

* @param filterQuery

* @param whereClauseValues

* @param skipRows

* @param maxRows

* @return

*/

public QueryIterator getQueryResult()

throws RemoteException, NamingException, CreateException,

QueryException {



String qryString = " select ejb.* from CMP1 ejb ";



Properties queryDomain = new Properties();



queryDomain.put("ejb/CMP1", CMP1LocalHome.class);



InitialContext ic = new InitialContext();

QueryHome qh = (QueryHome) ic

.lookup("com/ibm/websphere/ejbquery/Query");

Query qb = qh.create();

QueryIterator it = qb.executeQuery(qryString, null,

queryDomain, 0, 100);



return it;

}





It gives me an error.



The concern is I am not too sure about the format of queryDomain properties file. I would be grateful if you can send me some samples.





Regards



Inthiquab Deen
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
reply
    Bookmark Topic Watch Topic
  • New Topic