30, 2, 'EJB QL', ' 现在来说对象型的数据库越来越重要,随着面向对象的语言的流行,不过现在大部分的数据库
还都是关系型的!好像现在只有美国的唯一一个数据库是对象型的。所以现在出现了面向对象的查询
语言,例如hibernate,ejb这样的处理持久层机制的部分都是有面向对象的查询语言!她让我们感觉到
好像是对象直接存储到数据库中一样,其实不是的,那么现在的关系型数据库就叫做伪对象数据库。
EJB QL也是面向对象的查询语言,和SQL类似,只不过前者面向的是对象:
对象检索语句:
select t from Teacher t where t.age>28
select t from Teacher t where t.sex is null
对象属性检索语句:
select b.teacherid.name,b.teacherid.age from Classroom a,IN(a.lessionCollection) b where a.id=100027
distinct(去掉重复的行)和order by(排序)
select distinct b.teacherid.name from Classroom a,IN(a.lessionCollection) b where a.id=0098
select a from Teacher t order by c.name desc,c.age asc
between in like语句
select c from Teacher c where c.age between 30 and 50
select c from Teacher c where c.age in(008,009,006)
select c from Teacher c where c.name like '张%'
is (not) null 用于非集合的属性的
is empty用于集合属性
选出编号为009的学生对象选择的所有课程对象
select s from Student c,IN(c.lessions)where c=009
子查询:
检出所有:from Classroom c where 50
检出具有:from Classroom c where 50 检出有:from Classroom c where 50对象操作查询:
delete Teacher t where t.age>28
update Student p set p.name='xiaoxiao' where p.name='ranran'
', '2008-07-22 22:32:16'
阅读(902) | 评论(0) | 转发(0) |