I have a class that implement all my workflow method. At some pointing time, when the request is approved by the workflow, I need to update status in database. For this I need to call the respective service class to save the status. The following method is saving the status in db:

public void changeStatus(String employeeNumber, String carid,String Status) throws Exception {
    Car car = carService.findCarByPrimaryKey(carid);
    car.setStatus(Status);
    carService.saveCarDetails(car);
}

I want to make this method generic since I don't have status for car only. I have to update status for different object depending from the application made. It can be for application for leave/parking...I can keep the field Status with the same name in all table. Please advise me how to proceed. Thanks

Recommended Answers

All 2 Replies

you can pass the tablename, columnname id and new value as parameters:
update <tablename> set columname = <new value> where id = <id>

but am not writing the query in the method. I'm calling only service class. the service class will call my dao and as such it will execute the query. Is there any sample available like this?

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.