Win a copy of Murach's Python Programming this week in the Jython/Python forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Dynamic query problem in WAS 6.0  RSS feed

Inthiquab Deen
Posts: 3
  • Mark post as helpful
  • send pies
  • 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.


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


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.


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



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


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.


Inthiquab Deen
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!