cancel
Showing results for 
Search instead for 
Did you mean: 

Retrieval of the column name in Java Mapping

Former Member
0 Kudos

Hi All

I am presently working on JAVA mapping which retrives the data construct the xml I want to dynamically generate the xml tag name (table column names of the Table) is there any way to do it

Thanks

Jayaraman

Accepted Solutions (1)

Accepted Solutions (1)

bhavesh_kantilal
Active Contributor
0 Kudos

Hi,

Can you give more details? Maybe with an example?

Regards,

Bhavesh

Former Member
0 Kudos

Hi Bhavesh

Thanks for the reply

For Ex in java mapping we will be constructing an xml

<<b>empname</b>>raj<<b>/empname</b>>

what we are expecting is to get the column name directly from the databse table.

Thanks

Jayaraman

Former Member
0 Kudos

Hi,

You can get column names from database tables as...

ResultSet resultSet=statement.executeQuery("select * from table");

resultSetMetadata=resultSet.getMetaData();

String col1 = resultSetMetadata.getColumnLabel(1); ---> to get first column name

and use in XML node creation as...

Document document = DocumentHelper.createDocument();

Element root = document.addElement("Root");

Element Node1 = document.addElement(col1);

Regards,

Uma

Answers (1)

Answers (1)

Former Member
0 Kudos

txs