java - Where should logic go for deciding which SQL query to execute -


i have dao method commitmentlistdao.getlistbyownerbadge returns arraylist of commitment items against supervisor badge (database field owned_by)

    string sql_view_list_by_supervisor = select_query +      " c.owned_by = ? " +     " order p.program_name"; 

now, want add pull down on web form allow user choose between owned by or tasked to i'll need add where c.tasked_to = ? clause in dao.

do perform logic field search on within dao - passed in parameter of pulldown (never request object) , rename method getlistbybadge(string whichfield, string badge) or should commitmentlistform class have logic , make appropriate call either getlistbyownerbadge or getlistbytasketobadge

i go dao on 2 different methods differentiate call does.

the point of dao hide sql implementation details. should consider question standpoint of, "what if switched different persistence mechanism, hbase?" hbase implementation may not store in way differentiates field name. dao should make possible hide detail, different methods.

just opinion, of course. :)


Comments

Popular posts from this blog

java - SNMP4J General Variable Binding Error -

windows - Python Service Installation - "Could not find PythonClass entry" -

Determine if a XmlNode is empty or null in C#? -