Hello,
I have a table  with like, lets say,  5 fields. I need to do query like
"select * from  tableA order by field1name" ,
"select * from  tableA order by field2name"
"select * from  tableA order by field3name"
"select * from  tableA order by field4name"
"select * from  tableA order by field5name"

In the home interface, is there a way I can have a findMethod which takes
the orderby field as a parameter
because I didn't like the idea of having 5 find methods for same purpose
except for one param.  Not only that I have to edit vendor-specific xml
file to map the query five times.


I tried to do what I just said  but it didn't work. Our app-server executes
the query like a PreparedSatement does( I can see that from the generated
query ) . I am not sure if this is the same across different vendors.  Aas
you all know, with the case ofPreparedStatement , the following  code will
not do what I expect it to do.

String query = "select * from tableA order by ? ";
PreparedStatement ps = conn.prepareStatement(query);
ps.setString(1, field1name );
ResultSet rs = ps.executeQuery();
//and get the values

I guess thats the reason  my finder method didn't produce the expected
result when I pass the fieldname to be orderedby.

Any workarounds? Any suggestions? Or there is no way out?

--Pradeep

===========================================================================
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff EJB-INTEREST".  For general help, send email to
[EMAIL PROTECTED] and include in the body of the message "help".

Reply via email to