cancel
Showing results for 
Search instead for 
Did you mean: 

session bean code

Former Member
0 Kudos

hi all,

i need to crete a web service link for inserting and retrieving data from dictionary table..

i hv writtn the following code for showRecords()::::


public WrapperClass[] showRecords(
		String title,
		String desc,
		String types,
		String status,
		Date start_date,
		Date end_date,
		String cc,
		String comments) 
	{
		ArrayList arr = new ArrayList();
		
		try {
			InitialContext ctx = new InitialContext();
DataSource ds = (DataSource)ctx.lookup("jdbc/SAP" + (String) System.getProperties().get("SAPSYSTEMNAME")+"DB");
Connection conn = ds.getConnection();
			
Statement stmt = conn.createStatement();
ResultSet result = stmt.executeQuery("select * from CAT_TABLE");
			
while(result.next())
{
WrapperClass wrap = new WrapperClass();
				
wrap.setCC(result.getString("COST_CODE"));
wrap.setComments(result.getString("COMMENTS"));
wrap.setDescription(result.getString("DESCRIPTION"));
wrap.setEnd_date(result.getDate("END_DATE"));
wrap.setSt_date(result.getDate("START_DATE"));
wrap.setStatus(result.getString("STATUS"));
wrap.setTitle(result.getString("TITLE"));
wrap.setTypes(result.getString("TYPES"));
				
arr.add(wrap);
			
}
WrapperClass[] wrapArr = new WrapperClass[arr.size()];
			
for(int i= 0; i<=arr.size();i++)
{
WrapperClass wrapObj = (WrapperClass)arr.get(i);
wrapArr<i>  = wrapObj;
	}
			
conn.close();
			

return wrapArr;
			
		} catch (Exception e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
			return null;
		}
		
		
		
	}

wrapper class is the getter and setter methods for all paramaters...

bt nw i cant create a constructor for this method ..

as it is reqd to bind with the context...

plz help me with the coding

Regards,

josita

Accepted Solutions (0)

Answers (1)

Answers (1)

Former Member
0 Kudos

HI,

What do you mean by creating constructor for method?

See, You can call BusinessMethods of SessionBean using

lookup only, either local or remote..

Incase of local, we are able to access the methods using

<SessionBeanName>LocalHome object only..

In case of remote, we use remote interface

<SessionBeanName>Home object..

Please explain clearly your problem..

Regards

LN

Former Member
0 Kudos

hi,

i want to create a web service model...

for inserting and selecting records from dict table.

i am nt able to create a constructor for the model node to bind with context..

Former Member
0 Kudos

Hi,

I think you are facing problem in statements like,

Request<RequestForMethod> objReq=new Request<RequestForMethod>();

wdContext.nodeRequest<RequestNode>().bind(objReq);

if yes, please make sure that, The object

of Request<RequestForMethod> and the mapped model node

are assosiated with same method or not..

what error you are getting?

Regards

LN

Former Member
0 Kudos

thats exactly where the prob is..

it says no constructors of such type defined

Former Member
0 Kudos

Hi,

This type of problem occurs, when we bound our modelNode with one method of a model, and trying to bind the object of

Request<> of another method.. Please make sure that both same.. check once in "data modeler".

Regards

LN