对数据层如何写有疑惑,举个例子
请教数据层是如何实现以下sql的
select * from table1 where date1=@string1
select * from table1 where date1<@string1
select * from table1 where date1>@string1
select * from table1 where date1=@string1 and date2>@string2
select * from table1 where date1=@string1 or date2>@string2
是不是每个sql语句都要成一个方法?
另外,还有join,岂不是更复杂?
望高手指教,不胜感谢!

解决方案 »

  1.   

    你想实现什么功能说下吧!
    你写的那么多SQL语句是为了什么,这些不需要这么,在后台判断进行处理就可以了
    要不就写个触发器
      

  2.   

    我只是举例说明ORM问题,看看有没有人能帮我解答。
      

  3.   

    如果是ibatis的话
    select * from table1 where date1=@string1

    后面直接加语句判断就可以了
    如果是hibernate的话,那就更不用管了。。不知楼主目的
    jion的是用于多表链接的