I have this question that's been bugging me all day. I have a function like this:
public void voidUsersByUserId(List<Integer> userIds) {
Query query = getHibernateTemplate().getSessionFactory().getCurrentSession()
.createSQLQuery("...")
.setParameter("...",...)
query.executeUpdate();
}
That I don't know where to put in my web application. I'm struggling with figuring out a good MVC location to put this.
This looks and begs to be put in the Users model, but it involves SQL. Is that a bad thing to make the model aware of the database it's residing on? Is it ok to have something like a UserAction.class that contains SQL scripts and other database related things that would deal with the Users table? The above function would be re-used in a variety of places, so modularity and testability are important.
Thanks!