This week's book giveaway is in the OO, Patterns, UML and Refactoring forum.
We're giving away four copies of Refactoring for Software Design Smells: Managing Technical Debt and have Girish Suryanarayana, Ganesh Samarthyam & Tushar Sharma on-line!
See this thread for details.
The moose likes Beginning Java and the fly likes Question related to reflection and setting attbibutes Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

JavaRanch » Java Forums » Java » Beginning Java
Bookmark "Question related to reflection and setting attbibutes " Watch "Question related to reflection and setting attbibutes " New topic

Question related to reflection and setting attbibutes

ganesh pol
Ranch Hand

Joined: Apr 29, 2005
Posts: 151
problem is as follows

my method in subclass
public ExpenseModel saveEditDeleteExpesne(ExpenseModel expenseModel) throws TechnicalException {
String mn="saveEditDeleteExpesne(expenseModel)";

and one defined in superclass

protected final Long saveEditDeleteModel(AbstractModel model,String primaryKeySetterMethod){
final String mn="saveEditDeleteModel(model)";
System.out.println("model is"+model.getClass().getName()+ "model status is "+model);
Long modelId=null;
if(model!=null && !model.getStatus().equals(IModel.NONE)){
Integer modelStatus=model.getStatus();
}else if(modelStatus.equals(IModel.EDIT) || modelStatus.equals(IModel.DELETE)){

}catch(DataAccessException dae){


return modelId;


now i want to set primarykey (here expenseId) value by using refletion how should i do it

and instead of returning modelId to subclass method how should i return Value object
Have you checked out Aspose?
subject: Question related to reflection and setting attbibutes
It's not a secret anymore!