对数据层如何写有疑惑,举个例子
请教数据层是如何实现以下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,岂不是更复杂?
望高手指教,不胜感谢!
请教数据层是如何实现以下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,岂不是更复杂?
望高手指教,不胜感谢!
解决方案 »
- ------求助JavaEE------
- DWR回调问题
- Hibernate 使用动态模型(Map)时报 org.hibernate.LazyInitializationException错误
- 一个bug问题,急需帮忙!!!!
- hibernate建表问题
- 求救itext制作pdf 定位问题
- 在hibernate下写SQL语句的问题
- 有关上传组件SmartUpload的问题
- 有关DecimalFormat格式化字符串的问题???
- 我的开发工具时weblogic8.x+jbuilder x,我编译程序时就出现java.lang.StringIndexOutofBoundsException的错误,急!!!
- 如何使div边角圆滑
- 求教jasperreport导出Excel,单元格可以带超链接吗
你写的那么多SQL语句是为了什么,这些不需要这么,在后台判断进行处理就可以了
要不就写个触发器
select * from table1 where date1=@string1
后面直接加语句判断就可以了
如果是hibernate的话,那就更不用管了。。不知楼主目的
jion的是用于多表链接的