This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan 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


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "Question related to reflection and setting attbibutes " Watch "Question related to reflection and setting attbibutes " New topic
Author

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)";
saveEditDeleteModel(expenseModel,"setExpenseId");
}


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();
try{
if(modelStatus.equals(IModel.ADD)){
modelId=(Long)getDataAccess(HIBERNATE_DATA_ACCESS).save(model);
}else if(modelStatus.equals(IModel.EDIT) || modelStatus.equals(IModel.DELETE)){
getDataAccess(HIBERNATE_DATA_ACCESS).update(model);
}

}catch(DataAccessException dae){
throwTechnicalException(dae,mn);
}

}

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
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Question related to reflection and setting attbibutes
 
Similar Threads
a question about RMI implementation's concept
DynaActionForm and "No getter method for property"
Help Need " javax .servlet.jsp.Jsp Exception: Failed to obtain specified collection"
B&S: findByCriteria - pls review
JSP Parameters and HTML Form Values