Sql代码:
Session session=HibernateUtil.getSessionFactory().getCurrentSession()
session.beginTransaction()
String strSQL=" delete from Classes as a where a.classno like :name"
Query query = session.createQuery(strSQL)
query.setString("name", "%"+OId+"%")
Session session=HibernateUtil.getSessionFactory().getCurrentSession()
session.beginTransaction()
String strSQL="from Classes as a where a.classno like :name"
Query query = session.createQuery(strSQL)
HQL代码:
Session session = HibernateUtil.getSessionFactory().getCurrentSession()
session.beginTransaction()
List result=session.createQuery("delete from Classes as a where a.classno
like " '%"+OId+"慎腔%'").list()
[sql] view plaincopyprint?
Session session = HibernateUtil.getSessionFactory().getCurrentSession()
session.beginTransaction()
List result=session.createQuery("from Classes as a where a.classno like " '%"+OId+"%'").list()
Session session = HibernateUtil.getSessionFactory().getCurrentSession()
session.beginTransaction()
String result=session.createQuery("delete from Classes as a where a.classno like " '%"+OId+"%'").list()
创建hibernate3需要导入的jar包如下:1.hibernate3.jar:
2.cglib-full-2.0.2.jar
CGLIB库,Hibernate用它来实现PO字节码的动态带伍燃生成,蠢虚非常核心的库,必须使用的jar包
3.dom4j-1.4.jar
dom4j是一个Java的XML API,类似于jdom,用来读写XML文件的。
4.odmg-3.0.jar
ODMG是一个ORM的规范,Hibernate实现了ODMG规范,这是一个核心的库,必须使用的jar包。
5.commons-collections-2.1.1.jar:
Apache Commons包中的一个,包含了橘液一些Apache开发的集合类,功能比java.util.*强大。必须使用的jar包。
6.commons-beanutils.jar:
Apache Commons包中的一个,包含了一些Bean工具类类。必须使用的jar包。
7.commons-lang-1.0.1.jar
Apache Commons包中的一个,包含了一些数据类型工具类,是java.lang.*的扩展。必须使用的jar包。
8.commons-logging-1.0.4.jar
Apache Commons包中的一个,包含了日志功能,必须使用的jar包。
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)