查询sql太不方便
sql:select * from table where id in (select id from table where ...)
hibernate:from table where id in (select id from table where ..)报错
查询速度太慢,查出来的数据太多
sql:
select id,name,password,
(select deptName from dept d where d.deptId=user.deptId ) as deptName
from user where ...
hibernate:查出user所有字段,和dept所有字段,还要做下配置映射关系
就算配上lazy,在一些情况还容易出错,最近我就在这方面碰到问题
修改方面
sql:update user set name='x' where name='z'
hibernate:
Lst list = find("from user where name='z'")
for(user u :list){
u.setName("x");
u.save();
}
查询字段处理不方便
总结上面两点说下,java应用大都是企业级,网站方面还是少的,企业级中业务本身复杂,DB的表繁多,DB设计者别说面向对象,三范式都不遵守,有许多数据库诵读都是历史形成的,经过多次改动,后期维护都会修改字段。上百行的select语句经常碰到,hibernate根本帮不上忙,
sql:select * from table where id in (select id from table where ...)
hibernate:from table where id in (select id from table where ..)报错
查询速度太慢,查出来的数据太多
sql:
select id,name,password,
(select deptName from dept d where d.deptId=user.deptId ) as deptName
from user where ...
hibernate:查出user所有字段,和dept所有字段,还要做下配置映射关系
就算配上lazy,在一些情况还容易出错,最近我就在这方面碰到问题
修改方面
sql:update user set name='x' where name='z'
hibernate:
Lst list = find("from user where name='z'")
for(user u :list){
u.setName("x");
u.save();
}
查询字段处理不方便
总结上面两点说下,java应用大都是企业级,网站方面还是少的,企业级中业务本身复杂,DB的表繁多,DB设计者别说面向对象,三范式都不遵守,有许多数据库诵读都是历史形成的,经过多次改动,后期维护都会修改字段。上百行的select语句经常碰到,hibernate根本帮不上忙,