Gianna,. this will not work, as I do not want to make ActiveJDBC to be dependent on ActiveWeb.
What you can do, is create a parent controller and extend it by all other controllers.
In the parent controller, you can create a method like this:
public class MySuperController<T extends Model> extends AppController{
protected T createModel(Class<T> clazz){
User user = (User)session("user");
Model m = clazz.newInstance();
m.set("user_id", user.getId());
}
}
Then, in your child controller you can:
public class BookController extends MySuperController{
@POST
public void save(){
Person p = createModel(Person.class);
/// more code
}
}
will this work?