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