column="customer_id"/>
a)
b)
c)
d)
inverse属性不可以设置为false
cascade属性可设置为true
class="com.x.entity.Order"应为type="com.x.entity.Order"
column属性不可再节点内设置
8)
执行下面的hql查询,关于返回值的说法,正确的是()。
select
u.username,u.userid
1
from
com.x.entity.Useru
whereuisnotnull
a)
b)
c)
d)
语法错误,不能执行
返回一个类型为List的实例
返回一个数组
当返回结果只有一条时,返回一个数组
9)
下面创建Criteria对象的语句中正确的是()。
a)
b)
c)
d)
Criteriac=query.createCriteria();
Criteriac=query.addCriteria();
Criteriac=session.createCriteria();
Criteriac=session.createCriteria(User.class);
10)一般情况下,关系数据模型与对象模型之间不包括下列哪个匹配关系?
()
a)
b)
c)
d)
表对应类
记录对应对象
表的字段对应类的属性
表之间的参考关系对应类之间的依赖关系
11)以下关于SessionFactory的说法哪些正确?
a)
b)
c)
对于每个数据库事务,应该创建一个SessionFactory对象
一个SessionFactory对象对应一个数据库存储源。
SessionFactory是重量级的对象,不应该随意创建。
如果系统中只有一个数据库存
储源,需要创建多个。
d)
SessionFactory的load()方法用于加载持久化对象
12)Customer类中有一个Set类型的orders属性,用来存放Order订单对象,在
Customer.hbm.xml文件中,用哪个元素映射orders属性?
a)
b)
c)
d)
13)元素有一个cascade属性,如果希望Hibernate级联保存集合中的对象,casecade
属性应该取什么值?
()
a)
b)
c)
d)
none
save
delete
save-update
14)以下哪些不属于Session的方法?
a)
b)
c)
d)
load()
save()
open()
saveOrUpdate()
15)创建序列时,若未指定Cycle选项,则当当前值大于MaxValue时将()
a)
b)
c)
d)
从MinValue重新开始循环
重复使用MaxValue值
执行出错
使用随机值
2
16)以下程序的打印结果是什么?
tx=session.beginTransaction();
Customerc1=(Customer)session.load(Customer.class,newLong
(1));
Customerc2=(Customer)session.load(Customer.class,newLong
(1));
System.out.println(c1==c2);
mit();
session.close();
a)
b)
c)
d)
运行出错,抛出异常
打印false
打印true
编译出错
17)以下程序代码对Customer的name属性修改了两次:
tx=session.beginTransaction();
Customercustomer=(Customer)session.load(Customer.class,newLong
(1));
customer.setName(\"Jack\");
customer.setName(\"Mike\");
mit();
执行以上程序,Hibernate需要向数据库提交几条update语句?
()
a)
b)
c)
d)
0
1
2
3
18)在持久化层,对象分为的状态不包括?
()
a)
b)
c)
d)
瞬时(Transient)
新建(New)
脱管(Detached)
持久(Persistent)
19)对于以下程序,Customer对象在第几行变为持久化状态?
()
Customercustomer=newCustomer();
customer.setName(\"Tom\");
Sessionsession1=sessionFactory.openSession();
Transactiontx1=session1.beginTransaction();
//line1
session1.save(customer);
//line2
mit();
//line3
session1.close();//line4
a)
b)
c)
d)
line1
line2
line3
line4
20)对于以下程序,Customer对象在第几行变为游离状态?
()
Customercustomer=newCustomer();
customer.setName(\"Tom\");
Sessionsession1=sessionFactory.openSession();
Transactiontx1=session1.beginTransaction();
//line1
3
session1.save(customer);
//line2
mit();
//line3
session1.close();//line4
a)
b)
c)
d)
line1
line2
line3
line4
21)以下哪一种检索策略利用了外连结查询?
()
a)
b)
c)
d)
立即检索
延迟检索
迫切左外连结检索
迫切右外连结检索
22)假设对Customer类的orders集合采用延迟检索策略,编译或运行以下程序,会出现什
么情况()
Sessionsession=sessionFactory.openSession();
tx=session.beginTransaction();
Customercustomer=(Customer)session.get(Customer.class,newLong
(1));
mit();
session.close();
IteratororderIterator=customer.getOrders().iterator();
a)
b)
c)
d)
编译出错
编译通过,正常运行,不显示任何信息
编译通过,正常运行,并显示出结果
编译通过,但运行时抛出异常
23)POJO是
a)
b)
c)
d)
PlainOldJavaObject
ProgrammingObjectJavaObject
PageOldJavaObject
PlainObjectJavaOld
24)POJO的作用是
a)
b)
c)
d)
普通的Java对象映射数据库元组
数据访问
对象的赋值
保存客户端对象
25)实现equals和hashCode最显而易见的作用是
a)
b)
c)
d)
比较两个对象标识符的值
比较数据库的两条数据
比较两个组建是否部署在同一个应用服务器上
对象与字段的映射
26)持久化状态前进行合法性检查,需要实现的接口是
a)
b)
c)
d)
ActionListener
Lifecycle
HttpServletRequest
持久化状态合法检查不需要实现接口
4
27)在源代码中嵌入映射信息需要
a)
b)
c)
d)
XDoclet
EJB
Hibernate
Spring
28)所有的Hibernate,除了
了都支持空(null)语义。
a)
b)
c)
d)
Collection
Element
Entity
NodeList
29)
30)元素把子对象的一些元素与父类对应的表的一些字段映射起来
a)
b)
c)
d)
Component
Element
Attribute
ActionForm
31)要实现一个自定义类型,需要实现的接口是
a)
b)
c)
d)
org.hibernate.UserType
org.hibernate.CompositeType
org.hibernate.Session
org.hibernate.CompositeUserType.UserType
32)ORM是
a)
b)
c)
d)
对象关系映射
对象实体映射
数据传输对象
数据访问对象
33)JDBC不可以完成以下那个选