cancel
Showing results for 
Search instead for 
Did you mean: 

problem with displaying records from the database in a table ui element

Former Member
0 Kudos

Hi,

Iam creating an application which retrieves data from an oracle database. Iam able to connect to the database and retrieve the data in a result set. Then I try to set these values in a context node as follows,

while (resultSet.next()) {

String name = result.getString(1);

String EmpId = result.getString(2);

IEmpNode node = wdContext.nodeEmp();

IEmpElement el = node.createEmpElement();

el.setName(name);

el.setEmpId(EmpId);

node.addElement(el);

}

where the context structure is emp(node)

---name(attribute)

---empId(attribute)

Then I have bound the node emp to a table ui element.If I try to deploy this it comes up with Internal Server error.

But if try this way, without creating a node, only with attributes name and empId,

wdContext.currentContextElement.setName(name);

wdContext.currentContextElement.setEmpId(EmpId);

and binding the attributes to inputfields in the view, Iam able to see the last record in the database table.

So where am I going wrong while using the table ui element?

Regards,

Rachel

Accepted Solutions (0)

Answers (3)

Answers (3)

Former Member
0 Kudos

Hi

Can u please mail me the sample code for this. I am looking for this only. I want to retreive data from table in the database using EJB module.

my id is abhi027@gmail.com

Abhishek

Former Member
0 Kudos

What is "result"? It is not changed inside the loop.

Also make sure that node "emp" has cardinality 0:N.

Can you post the stacktrace of the exception?

Armin

Former Member
0 Kudos

Hi Mukesh,

I tried with same procedure. Still it is showing internal server error.

Armin,

I made a mistake there, its not result but resultSet. The cardinality is correct. Im not able to check the stacktrace.

Regards,

Rachel

Former Member
0 Kudos

Hi,

try

IPrivate<viewname>.IEmpNode node = wdContext.nodeEmp();

IPrivate<viewname>.IEmpElement el = node.createEmpElement();

instead of,

IEmpNode node = wdContext.nodeEmp();

IEmpElement el = node.createEmpElement();

Former Member
0 Kudos

The stacktrace is written into the server logfile, please have a look and post it here.

Armin

Former Member
0 Kudos

Hi

Try this

//Create the node in outer of while loop and bind to Table UIElement

IEmpNode node = wdContext.nodeEmp();

while (resultSet.next()) {

String name = result.getString(1);

String EmpId = result.getString(2);

IEmpElement el = wdContext.createEmpElement();

el.setName(name);

el.setEmpId(EmpId);

node.addElement(el);

}

Kind Regards

Mukesh