@SuppressWarnings("deprecation")
public class HibernateUtil { private static final SessionFactory sessionFactory; static {
sessionFactory = new AnnotationConfiguration().configure().buildSessionFactory();
} public static Session getOpenSession() {
return sessionFactory.openSession();
} public static Session getCurrentSession() {
return sessionFactory.getCurrentSession();
}
}
@Entity
public class Employee { private Integer id;
private String name;
private Integer age; @Id
@GeneratedValue
public Integer getId() {
return id;
} public void setId(Integer id) {
this.id = id;
} @Basic
public String getName() {
return name;
} public void setName(String name) {
this.name = name;
} @Basic
public Integer getAge() {
return age;
} public void setAge(Integer age) {
this.age = age;
} public String toString() {
return "id:" + id + " " + "name:" + name + " " + "age:" + age;
}
}
@SuppressWarnings("all")
public class HQLDemo { @Test
public void testHQL() {
Session session = HibernateUtil.getOpenSession();
List<Employee> employeeList = session.createQuery("from Employee as e").list();
for(Employee e : employeeList)
System.out.println(e);
} @Test
public void testHQLHasParameter() {
Session session = HibernateUtil.getOpenSession();
List<Employee> employeeList = session.createQuery("from Employee as e where e.name = :personName").setString("personName", "xujianguo").list();
for(Employee e : employeeList)
System.out.println(e);
}
}

HQL是Hibernate Query Language的缩写,语法很想SQL,但是HQL是一种面向对象的查询语言。SQL的操作对象是数据列、表等数据库对象,而HQL操作的是类、实例、属性

HQL查询依赖于Query类,每个Query实例对应一个查询对象,使用HQL查询按如下步骤进行:

1.获取Hibernate Session对象 2.编写HQL语句 3.以HQL语句作为参数,调用Session的createQuery方法创建查询对象 4.如果HQL语句包含参数,则调用Query的setXxx方法为参数赋值 5.调用Query独享的list()或uniqueResult()方法返回查询结果列表

简单的例子:

HQL查询的from子句:

from是最简单的HQL语句,也是最基本的HQL语句,from关键字后紧跟持久化类的类名,如:

from Employee表名从Employee类中选出全部的实例

不过我们常用的是这样做:

from employee as e这个e就是Employee的别名,也就是实例名,推荐这么写。

  HQL查询的select子句:

  select子句用于选择指定的属性或直接选择某个实体,当然select选择的属性必须是from后持久化类包含的属性,如:

select e.name from Employee as e  select可以选择任意属性,即不仅可以选择持久化类的直接属性,还可以选择组件属性包含的属性,如:

select e.name.firstName from Employee as eHQL查询的聚集函数:

  聚集函数:  

    avg:计算属性的平均值

    count:统计选择对象的数量

    max:统计属性值的最大值

    min:统计属性值的最小值

    sum:计算属性值的总和

如:
select count(*) from Employee as e    @Test
    public void testHQLFunction()
{
        Session session = HibernateUtil.getOpenSession();
       
System.out.println(session.createQuery("select count(*) from Employee as
e").uniqueResult());
    }  

多态查询:

  HQL不仅会查询出该持久化类的全部实例,还会查询出该类的子类的全部实例,前提是存在继承映射。

  HQL查询的where子句:

  where子句主要用于筛选选中的结果,缩小选择的范围,如:

from employee as e where e.name like "xjg%"    @Test
public void testHQLWhere() {
Session session = HibernateUtil.getOpenSession();
List<Employee> employeeList = session.createQuery("from Employee as e where e.name like 'zhou%'").list();
for(Employee e : employeeList)
System.out.println(e);
}  

order by子句:

  查询返回结合可以根据类或组件属性的任何属性进行排序,还可以使用asc或desc关键字指定升序或者降序,如:

from Employee as e order by e.name desc  

子查询:

  子查询中就是查询语句中还有查询语句,如:

from Employee as e where e.age > (select p.age from Person as p)    @Test
public void testHQLChildQuery() {
Session session = HibernateUtil.getOpenSession();
List<Employee> employeeList = session.createQuery("from Employee as e where e.age > (select e1.age from Employee as e1 where e1.name = 'xujianguo')").list();
for(Employee e : employeeList)
System.out.println(e);
}  
[code] 命名查询: HQL查询还支持将查询所用的HQL语句放入配置文件中,而不是代码中,在Hibernate映射文件的<hibernate-mapping>元素中使用<query>子元素来定义命名查询,这个<query>元素只需指定一个name属性,指定该命名查询的名字 ,如: [code]
<query name="query">
from Employee as e
<query />  

Session里提供了一个getNamedQuery(String
name)方法,该方法用于创建一个Query对象,一旦获得Query对象,剩下的工作就跟前面的一样了。

@Test
public void testHQLNamedQuery() {
Session session = HibernateUtil.getOpenSession();
List<Employee> employeeList = session.getNamedQuery("query").list();
for(Employee e : employeeList)
System.out.println(e);
}
HQL 查询语句

/**
*
*/
package com.b510.example; import java.util.Iterator;
import java.util.List;
import java.util.Map; import org.hibernate.Criteria;
import org.hibernate.FetchMode;
import org.hibernate.Query;
import org.hibernate.Session; /**
*
* @author XHW
*
* @date 2011-6-18
*
*/
public class HibernateTest { /**
* @param args
*/
public static void main(String[] args) {
HibernateTest test = new HibernateTest();
test.where();
test.function();
test.update();
test.jiaoChaCheck();
test.innerJoin();
test.QBC();
test.leftOuterJoin();
test.rightOuterJoin();
} public void where() {
// 使用where查询
Session session = HibernateSessionFactoryUtil.getSessionFactory()
.openSession();
session.beginTransaction();
Query query = session
.createQuery("from User where id not between 200 and 2000");
List<User> list = query.list(); for (User user : list) {
System.out.println(user.getId() + user.getUsername());
}
// 投影查询 中使用where子句
query = session.createQuery("select username from User where id=2");
List<String> listname = query.list(); for (String name : listname) {
System.out.println(name);
}
// in查询
query = session
.createQuery("from User where username in ('Hongten','Hanyuan','dfgd')");
List<User> listin = query.list(); for (User user : listin) {
System.out.println(user.getId() + user.getUsername());
}
// like查询
query = session.createQuery("from User where username not like 'Hon%'");
List<User> listlike = query.list(); for (User user : listlike) {
System.out.println(user.getId() + user.getUsername());
}
// null查询
query = session.createQuery("from User where password is null");
List<User> listnull = query.list(); for (User user : listnull) {
System.out.println(user.getId() + user.getUsername());
}
// and查询
query = session
.createQuery("from User where password is not null and id<5");
List<User> listand = query.list(); for (User user : listand) {
System.out.println(user.getId() + user.getUsername()
+ user.getPassword());
}
// order by
query = session.createQuery("from User order by username,id desc");
List<User> listorderby = query.list(); for (User user : listorderby) {
System.out.println(user.getId() + user.getUsername());
}
// 使用"?"号 作为参数占位符,一条HQL语句中可以使用多个?
// query.setInteger(0,2)
// query.setString(0,"Hongten")
query = session
.createQuery("select username from User where username=?");
query.setString(0, "Hongten");
List<String> listwenhao = query.list();
for (String name : listwenhao) {
System.out.println(name);
} session.getTransaction().commit(); } public void function() {// 把大写字母转化为小写字母
// 作用可以用在:比如在一个用户注册的程序中,大小写不容易区分,但是全部转化为小写后就可以很容易进行比较
Session session = HibernateSessionFactoryUtil.getSessionFactory()
.openSession();
session.beginTransaction();
// 输出原始的数据
Query query = session.createQuery("select username from User");
List<String> list = query.list(); for (String name : list) {
System.out.println(name);
}
System.out.println("-------------------------------------------");
// 输出的数据全部转化为小写
query = session.createQuery("select lower(username) from User");
List<String> listChange = query.list(); for (String name : listChange) {
System.out.println(name);
}
session.getTransaction().commit();
} public void update() {
Session session = HibernateSessionFactoryUtil.getSessionFactory()
.openSession();
session.beginTransaction();
Query query = session
.createQuery("update User set username='洪伟1231' where id=?");
query.setInteger(0, 3);
int rowCount = query.executeUpdate();
System.out.println(rowCount);
session.getTransaction().commit();
} public void operateProfile() {// 对profile这个类执行HQL语句操作
Session session = HibernateSessionFactoryUtil.getSessionFactory()
.openSession();
session.beginTransaction();
// 执行查询操作
Query query = session.createQuery("from Profile");
List<Profile> list = query.list();
for (Profile profile : list) {
System.out.println(profile.getId() + profile.getEmail()
+ profile.getAddress() + profile.getMobile()
+ profile.getPostcode());
}
// 执行删除操作
query = session.createQuery("delete from Profile where id=?");
query.setInteger(0, 3);
int rowCount = query.executeUpdate();
System.out.println(rowCount);
session.getTransaction().commit();
} public void jiaoChaCheck() {//交叉查询
//这种方法查询出来的结果是笛卡尔积,对于我们开发中没有多大用处
Session session = HibernateSessionFactoryUtil.getSessionFactory()
.openSession();
session.beginTransaction();
Query query=session.createQuery("from User,Profile"); List<Object[]> list=query.list(); for(Object[] values:list){
User user=(User)values[0];
System.out.print("ID :"+user.getId()+",UserName:"+user.getUsername()+",Password:"+user.getPassword());
Profile profile=(Profile)values[1];
System.out.println(profile.getEmail()+profile.getMobile()+profile.getAddress()+profile.getPostcode());
} session.getTransaction().commit();
} public void innerJoin(){//内连接查询
/**
* 下面三种hql语句都是可以得到相同的结果
* String hql="select p from Profile as p inner join p.user";
* 在下面的hql语句中加入"fetch"后,此hql语句变为了"迫切HQL"语句,这样的查询效率要比上面的hql语句要高
* String hql="select p from Profile as p inner join fetch p.user";
*
* String hql="select p from Profile p,User u where p.user=u";
* String hql="select p from Profile p,User u where p.user.id=u.id";
*
*/
Session session = HibernateSessionFactoryUtil.getSessionFactory()
.openSession();
session.beginTransaction();
String hql="select p from Profile as p inner join fetch p.user";
//String hql="select p from Profile p,User u where p.user=u";
//String hql="select p from Profile p,User u where p.user.id=u.id";
Query query=session.createQuery(hql);
List<Profile> list=query.list();
for(Profile p:list){
System.out.println("ID:"+p.getUser().getId()+" Username: "+p.getUser().getUsername()+" Email: "+p.getEmail()+", Address: "+p.getAddress());
}
session.getTransaction().commit();
} public void QBC(){//QBC中实现内连接查询
Session session=HibernateSessionFactoryUtil.getSessionFactory().openSession();
session.beginTransaction();
Criteria criteria=session.createCriteria(Profile.class).createCriteria("user");
List<Profile> list=criteria.list(); for(Profile p:list){
System.out.println("ID:"+p.getUser().getId()+" Username: "+p.getUser().getUsername()+" Email: "+p.getEmail()+", Address: "+p.getAddress());
}
//QBC中实现外连接
System.out.println("##################################################");
criteria=session.createCriteria(Profile.class).setFetchMode("user", FetchMode.JOIN);
List<Profile> listp=criteria.list(); for(Profile p:list){
System.out.println("ID:"+p.getUser().getId()+" Username: "+p.getUser().getUsername()+" Email: "+p.getEmail()+", Address: "+p.getAddress());
}
session.getTransaction().commit();
} public void leftOuterJoin(){//左外连接
/**
* String hql="select p from Profile p left outer join p.user order by p.user.id";
* 在下面的hql语句中加入"fetch"后,此hql语句变为了"迫切HQL"语句,这样的查询效率要比上面的hql语句要高
* String hql="select p from Profile p left outer join fetch p.user order by p.user.id";
*
* String hqlu="select u from User u left outer join u.profiles";
* 在下面的hql语句中加入"fetch"后,此hql语句变为了"迫切HQL"语句,这样的查询效率要比上面的hql语句要高
* String hqlu="select u from User u left outer join fetch u.profiles";
*/
Session session=HibernateSessionFactoryUtil.getSessionFactory().getCurrentSession();
session.beginTransaction();
String hql="select p from Profile p left outer join fetch p.user order by p.user.id";
Query query=session.createQuery(hql); List<Profile> list=query.list();
for(Profile p:list){
System.out.println("ID:"+p.getUser().getId()+" Username: "+p.getUser().getUsername()+" Email: "+p.getEmail()+", Address: "+p.getAddress());
} System.out.println("-------------------------------------");
String hqlu="select u from User u left outer join fetch u.profiles";
query=session.createQuery(hqlu); List<User> listu=query.list();
for(User u:listu){
System.out.println(u.getId()+u.getUsername()+u.getProfiles());
}
session.getTransaction().commit(); } public void rightOuterJoin(){//右外连接
Session session=HibernateSessionFactoryUtil.getSessionFactory().getCurrentSession();
session.beginTransaction();
String hql="select u from User u right outer join u.profiles order by u.id";
Query query=session.createQuery(hql); List<User> listu=query.list();
for(User user:listu){
System.out.println(user.getId()+user.getUsername()+user.getProfiles());
} session.getTransaction().commit(); } } 结果: log4j:WARN No appenders could be found for logger (org.hibernate.cfg.Environment).
log4j:WARN Please initialize the log4j system properly.
Hibernate:
select
user0_.id as id0_,
user0_.username as username0_,
user0_.password as password0_
from
users.user user0_
where
user0_.id not between 200 and 2000
1hongten
2hanyuan
3hongwei
4mingliu
5shouzhang
Hibernate:
select
user0_.username as col_0_0_
from
users.user user0_
where
user0_.id=2
hanyuan
Hibernate:
select
user0_.id as id0_,
user0_.username as username0_,
user0_.password as password0_
from
users.user user0_
where
user0_.username in (
'Hongten' , 'Hanyuan' , 'dfgd'
)
1hongten
2hanyuan
Hibernate:
select
user0_.id as id0_,
user0_.username as username0_,
user0_.password as password0_
from
users.user user0_
where
user0_.username not like 'Hon%'
2hanyuan
4mingliu
5shouzhang
Hibernate:
select
user0_.id as id0_,
user0_.username as username0_,
user0_.password as password0_
from
users.user user0_
where
user0_.password is null
Hibernate:
select
user0_.id as id0_,
user0_.username as username0_,
user0_.password as password0_
from
users.user user0_
where
(
user0_.password is not null
)
and user0_.id<5
1hongten123
2hanyuan5645645
3hongwei5645645
4mingliu5645645
Hibernate:
select
user0_.id as id0_,
user0_.username as username0_,
user0_.password as password0_
from
users.user user0_
order by
user0_.username,
user0_.id desc
2hanyuan
1hongten
3hongwei
4mingliu
5shouzhang
Hibernate:
select
user0_.username as col_0_0_
from
users.user user0_
where
user0_.username=?
hongten
Hibernate:
select
user0_.username as col_0_0_
from
users.user user0_
hongten
hanyuan
hongwei
mingliu
shouzhang
-------------------------------------------
Hibernate:
select
lower(user0_.username) as col_0_0_
from
users.user user0_
hongten
hanyuan
hongwei
mingliu
shouzhang
Hibernate:
update
users.user
set
username='Hongwei1231'
where
id=?
1
Hibernate:
select
user0_.id as id0_0_,
profile1_.id as id1_1_,
user0_.username as username0_0_,
user0_.password as password0_0_,
profile1_.user_id as user2_1_1_,
profile1_.email as email1_1_,
profile1_.phone as phone1_1_,
profile1_.mobile as mobile1_1_,
profile1_.address as address1_1_,
profile1_.postcode as postcode1_1_
from
users.user user0_,
users.profile profile1_
ID :1,UserName:hongten,Password:123hongtenzone@foxmail.com45464Guangzhoushi65465
ID :1,UserName:hongten,Password:123hanyuan@foxmail.com45648255GuangzhoushiDianbian65465
ID :1,UserName:hongten,Password:123hanyuan@foxmail.com45648255GuangzhoushiDianbian65465
ID :2,UserName:hanyuan,Password:5645645hongtenzone@foxmail.com45464Guangzhoushi65465
ID :2,UserName:hanyuan,Password:5645645hanyuan@foxmail.com45648255GuangzhoushiDianbian65465
ID :2,UserName:hanyuan,Password:5645645hanyuan@foxmail.com45648255GuangzhoushiDianbian65465
ID :3,UserName:Hongwei1231,Password:5645645hongtenzone@foxmail.com45464Guangzhoushi65465
ID :3,UserName:Hongwei1231,Password:5645645hanyuan@foxmail.com45648255GuangzhoushiDianbian65465
ID :3,UserName:Hongwei1231,Password:5645645hanyuan@foxmail.com45648255GuangzhoushiDianbian65465
ID :4,UserName:mingliu,Password:5645645hongtenzone@foxmail.com45464Guangzhoushi65465
ID :4,UserName:mingliu,Password:5645645hanyuan@foxmail.com45648255GuangzhoushiDianbian65465
ID :4,UserName:mingliu,Password:5645645hanyuan@foxmail.com45648255GuangzhoushiDianbian65465
ID :5,UserName:shouzhang,Password:5645645hongtenzone@foxmail.com45464Guangzhoushi65465
ID :5,UserName:shouzhang,Password:5645645hanyuan@foxmail.com45648255GuangzhoushiDianbian65465
ID :5,UserName:shouzhang,Password:5645645hanyuan@foxmail.com45648255GuangzhoushiDianbian65465
Hibernate:
select
profile0_.id as id1_0_,
user1_.id as id0_1_,
profile0_.user_id as user2_1_0_,
profile0_.email as email1_0_,
profile0_.phone as phone1_0_,
profile0_.mobile as mobile1_0_,
profile0_.address as address1_0_,
profile0_.postcode as postcode1_0_,
user1_.username as username0_1_,
user1_.password as password0_1_
from
users.profile profile0_
inner join
users.user user1_
on profile0_.user_id=user1_.id
ID:1 Username: hongten Email: hongtenzone@foxmail.com, Address: Guangzhoushi
ID:2 Username: hanyuan Email: hanyuan@foxmail.com, Address: GuangzhoushiDianbian
ID:3 Username:Hongwei1231 Email: hanyuan@foxmail.com, Address: GuangzhoushiDianbian
Hibernate:
select
this_.id as id1_1_,
this_.user_id as user2_1_1_,
this_.email as email1_1_,
this_.phone as phone1_1_,
this_.mobile as mobile1_1_,
this_.address as address1_1_,
this_.postcode as postcode1_1_,
user1_.id as id0_0_,
user1_.username as username0_0_,
user1_.password as password0_0_
from
users.profile this_
inner join
users.user user1_
on this_.user_id=user1_.id
ID:1 Username: hongten Email: hongtenzone@foxmail.com, Address: Guangzhoushi
ID:2 Username: hanyuan Email: hanyuan@foxmail.com, Address: GuangzhoushiDianbian
ID:3 Username: Hongwei1231 Email: hanyuan@foxmail.com, Address: GuangzhoushiDianbian
##################################################
Hibernate:
select
this_.id as id1_1_,
this_.user_id as user2_1_1_,
this_.email as email1_1_,
this_.phone as phone1_1_,
this_.mobile as mobile1_1_,
this_.address as address1_1_,
this_.postcode as postcode1_1_,
user2_.id as id0_0_,
user2_.username as username0_0_,
user2_.password as password0_0_
from
users.profile this_
left outer join
users.user user2_
on this_.user_id=user2_.id
ID:1 Username: hongten Email: hongtenzone@foxmail.com, Address: Guangzhoushi
ID:2 Username: hanyuan Email: hanyuan@foxmail.com, Address: GuangzhoushiDianbian
ID:3 Username: 洪伟1231 Email: hanyuan@foxmail.com, Address: GuangzhoushiDianbian
Hibernate:
select
profile0_.id as id1_0_,
user1_.id as id0_1_,
profile0_.user_id as user2_1_0_,
profile0_.email as email1_0_,
profile0_.phone as phone1_0_,
profile0_.mobile as mobile1_0_,
profile0_.address as address1_0_,
profile0_.postcode as postcode1_0_,
user1_.username as username0_1_,
user1_.password as password0_1_
from
users.profile profile0_
left outer join
users.user user1_
on profile0_.user_id=user1_.id
order by
profile0_.user_id
ID:1 Username: hongten Email: hongtenzone@foxmail.com, Address: Guangzhoushi
ID:2 Username: hanyuan Email: hanyuan@foxmail.com, Address: GuangzhoushiDianbian
ID:3 Username: 洪伟1231 Email: hanyuan@foxmail.com, Address: GuangzhoushiDianbian
-------------------------------------
Hibernate:
select
user0_.id as id0_0_,
profiles1_.id as id1_1_,
user0_.username as username0_0_,
user0_.password as password0_0_,
profiles1_.user_id as user2_1_1_,
profiles1_.email as email1_1_,
profiles1_.phone as phone1_1_,
profiles1_.mobile as mobile1_1_,
profiles1_.address as address1_1_,
profiles1_.postcode as postcode1_1_,
profiles1_.user_id as user2_0__,
profiles1_.id as id0__
from
users.user user0_
left outer join
users.profile profiles1_
on user0_.id=profiles1_.user_id
1hongten[com.b510.example.Profile@14eaec9]
2hanyuan[com.b510.example.Profile@569c60]
3Hongwei1231[com.b510.example.Profile@d67067]
4mingliu[]
5shouzhang[]
Hibernate:
select
user0_.id as id0_,
user0_.username as username0_,
user0_.password as password0_
from
users.user user0_
right outer join
users.profile profiles1_
on user0_.id=profiles1_.user_id
order by
user0_.id
Hibernate:
select
profiles0_.user_id as user2_1_,
profiles0_.id as id1_,
profiles0_.id as id1_0_,
profiles0_.user_id as user2_1_0_,
profiles0_.email as email1_0_,
profiles0_.phone as phone1_0_,
profiles0_.mobile as mobile1_0_,
profiles0_.address as address1_0_,
profiles0_.postcode as postcode1_0_
from
users.profile profiles0_
where
profiles0_.user_id=?
1hongten[com.b510.example.Profile@10c0f66]
Hibernate:
select
profiles0_.user_id as user2_1_,
profiles0_.id as id1_,
profiles0_.id as id1_0_,
profiles0_.user_id as user2_1_0_,
profiles0_.email as email1_0_,
profiles0_.phone as phone1_0_,
profiles0_.mobile as mobile1_0_,
profiles0_.address as address1_0_,
profiles0_.postcode as postcode1_0_
from
users.profile profiles0_
where
profiles0_.user_id=?
2hanyuan[com.b510.example.Profile@e265d0]
Hibernate:
select
profiles0_.user_id as user2_1_,
profiles0_.id as id1_,
profiles0_.id as id1_0_,
profiles0_.user_id as user2_1_0_,
profiles0_.email as email1_0_,
profiles0_.phone as phone1_0_,
profiles0_.mobile as mobile1_0_,
profiles0_.address as address1_0_,
profiles0_.postcode as postcode1_0_
from
users.profile profiles0_
where
profiles0_.user_id=?

转的

HQL查询语言的使用介绍的更多相关文章

  1. HQL查询语言——转载(http://www.cnblogs.com/20gg-com/p/6045739.html)

    Hibernate查询语言(HQL)是一种面向对象的查询语言,类似于SQL,但不是对表和列操作,HQL适用于持久对象和它们的属性. HQL查询由Hibernate转换成传统的SQL查询,这在圈上的数据 ...

  2. Hibernate之HQL介绍

    Hibernate中提供了多种检索对象的方式,主要包括以下种类: 导航对象图检索方式:根据已经加载的对象导航到其他对象 OID检索方式:根据对象的OID来检索对象 HQL检索方式:使用面向对象的HQL ...

  3. [原创]java WEB学习笔记89:Hibernate学习之路-- -Hibernate检索方式(5种),HQL介绍,实现功能,实现步骤,

    本博客的目的:①总结自己的学习过程,相当于学习笔记 ②将自己的经验分享给大家,相互学习,互相交流,不可商用 内容难免出现问题,欢迎指正,交流,探讨,可以留言,也可以通过以下方式联系. 本人互联网技术爱 ...

  4. Java进阶知识13 Hibernate查询语言(HQL),本文以hibernate注解版为例讲解

    1.简单概述 1.1. 1) SQL:面向的是数据库 select * from tableName;2) HQL查询(Hibernate Query language): hibernate 提供的 ...

  5. 【Hibernate 6】常用的hql语句以及N+1问题

    HQL:Hibernate Query Language,是Hibernate框架中的查询语言,十分接近于SQL语言!以下介绍一些常用的Hql语句: 一.测试类 Classes类: <span ...

  6. hive介绍及架构设计

    hive介绍及架构设计 作者:尹正杰 版权声明:原创作品,谢绝转载!否则将追究法律责任. 我们知道MapReduce和Spark它们提供了高度抽象的编程接口便于用户编写分布式程序,它们具有极好的扩展性 ...

  7. hibernate检索方式(HQL 检索方式,QBC 检索方式,本地 SQL 检索方式)

    hibernate有五种检索方式,这儿用 单向的一对多的映射关系 例子,这儿有后三种的方式: 导航对象图检索方式: 根据已经加载的对象导航到其他对象 OID 检索方式: 按照对象的 OID 来检索对象 ...

  8. Hibernate 检索查询的几种方式(HQL,QBC,本地SQL,集成Spring等)

    1.非集成Spring hibernate的检索方式,主要有以下五种. 1.导航对象图检索方式.(根据已经加载的对象,导航到其他对象.) 2.OID检索方式.(按照对象的OID来检索对象.) 3.HQ ...

  9. Hibernate之HQL查询

    一.Hibernate 提供了以下几种检索对象的方式: 导航对象图检索方式: 根据已经加载的对象导航到其他对象 OID 检索方式: 按照对象的 OID 来检索对象 HQL 检索方式:使用面向对象的 H ...

随机推荐

  1. POJ 2739 Sum of Consecutive Prime Numbers 难度:0

    题目链接:http://poj.org/problem?id=2739 #include <cstdio> #include <cstring> using namespace ...

  2. checkbox全选功能

    $("#cb_classType_all").change(function () { if ($(this).is(":checked")) { $(&quo ...

  3. VisualSVN SERVER的安装和使用

    SVN Server安装 Subversion是优秀的版本控制工具,其具体的的优点和详细介绍,这里就不再多说.下载的网址是:http://subversion.apache.org/packages. ...

  4. JQery w3school学习第一章 标签的隐藏和显示

    鄙人初学JQuery,最关键的是JQuery获取标签对象的方式 这一章学习的是点击按钮让所有标签的文字以及标签栏的位置隐藏起来,因为单纯的隐藏文字,还是会有空格和空行的影响 这里最关键的代码就是 $( ...

  5. CCNA 6.3

    no encapsulation ppp(默认是encapsulation hdlc 在encapsulation ppp 后想要改回 hdlc 除了可用encapsulation hdlc外,还可以 ...

  6. java基础之 string

    一 string public final class String 继承自java.lang.Object类. 实现了接口: java.io.Serializable, Comparable< ...

  7. [转]C++运算优先级列表

    From:http://en.cppreference.com/w/cpp/language/operator_precedence Precedence Operator Description A ...

  8. .net 小技巧

    简单提示效果: <input runat="server" type="text" id="SelPerson" value=&quo ...

  9. 标签navtab

    创建navtab 创建一个navtab有以下两种方式: 1.Data属性:DOM添加属性data-toggle="navtab"后,单击触发. a链接示例: <a href= ...

  10. hadoop 常见问题

    1.Eclipse 读取hdfs文件错误:  java.io.IO Exception : Could not obtain block: blk_194219614024901469_1100 fi ...