cancel
Showing results for 
Search instead for 
Did you mean: 

Problem in placing the EJB queries

Former Member
0 Kudos

Hi all,

I am working on the migration of an application from J2EE to SAP WAS.

The original application contains some EJB queries present in the file sun-j2ee-ri.xml.

Entery for one of the query is given below:

<ejb20-cmp>

<sql-statement>

<operation>storeRow</operation>

<sql>UPDATE "UserEJBTable" SET "password" = ? WHERE "userName" = ? </sql>

</sql-statement>

<sql-statement>

<operation>findByPrimaryKey</operation>

<sql>SELECT "userName" FROM "UserEJBTable" WHERE "userName" = ? </sql>

</sql-statement>

</ejb20-cmp>

I cannot understand where(in which file) to make entry for this query.

Please help me out with this problem.

Accepted Solutions (0)

Answers (1)

Answers (1)

kishorg
Advisor
Advisor
0 Kudos

Hi Neethu,

if u have migrated ur application or created one ejb in NWDs,

if ur Entity Bean have selectMethods , findByPK or..

then u can create EJB queries ..

in the persistent.xml file , u have the provision to create EJB queries ..

click on this persistent.xml file , here will have list of entity beans in ur EJB project .

click on particular bean-->

then there are two subparts displaying the cmr fields and query..

if u have included selectMethod , then there u can select particular method and create queries..

Regards

Kishor Gopinathan

Message was edited by: Kishor Gopinathan

Message was edited by: Kishor Gopinathan

Former Member
0 Kudos

Hi Kishor,

In the query tab u have mentioned i am not getting the entry for the particular methods like 'findByPrimaryKey'.

It is not giving me the provision to create any queries either.

How do i make an entry for these queries.

Some other queries also need to be added like

storeRow, loadRow, deleteRow.

But i cannot make out any place to enter these queries.

kishorg
Advisor
Advisor
0 Kudos

Hi Neethu,

i think for the standard method "findByPrimaryKey", u cannot create EJB queries..

just create your own findmethod ,(same as that of indByPrimaryKey) , then

it will be displayed in query list .. for this u can write EJB QL , and u can use this method in place of indByPrimaryKey.

Regards

Kishor Gopinathan

Former Member
0 Kudos

Hi Kishor,

As you had told me yesterday, I created a finderMethod of my own in the EJBLocalHome interface.

This query got reflected in the ejb-jar.xml where I mentioned the EJB QL.

I even validated this QL with the validate option.

But on deploying the application i got the same exception again:

com.sap.engine.services.ejb.exceptions.BaseEJBException: Exception in method com.sun.j2ee.blueprints.signon.user.ejb.UserLocalHomeImpl0.findByGivenKey(java.lang.String).

where findByGivenKey is the method created by me.

Please help.

kishorg
Advisor
Advisor
0 Kudos

HI Neethu ,

can u give the query u have written there ?.

Regards

Kishor Gopinathan

have u followed this -->

<b>To support parameterized queries, you use logical placeholders of the form ?n, where n represents the location of the value in

the method params list, starting from an index of 1</b>.

Message was edited by: Kishor Gopinathan

Former Member
0 Kudos

Hi Kishor,

The query is

SELECT OBJECT(a) FROM User a WHERE a.userName = ?1

Regards

neetu