📄 802848177125001d172f8a51a2e7ba8c
字号:
package com.lib.persistence.hibernate.home;
// Generated 2008-5-14 23:22:48 by Hibernate Tools 3.2.0.b9
import java.util.Iterator;
import java.util.List;
import java.util.Set;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.hibernate.LockMode;
import org.hibernate.Query;
import org.hibernate.criterion.Example;
import com.lib.persistence.hibernate.pojo.Bookpre;
import com.lib.persistence.hibernate.pojo.CatalogDetailTable;
import com.lib.persistence.util.HibernateUtil;
/**
* Home object for domain model class Book.
* @see com.lib.persistence.hibernate.pojo.Book
* @author Hibernate Tools
*/
public class BookpreHome extends BaseHome{
private static final Log log = LogFactory.getLog(BookpreHome.class);
private static BookpreHome instance;
public static BookpreHome getInstance(){
if(instance==null){
instance = new BookpreHome();
}
return instance;
}
public void persist(Bookpre transientInstance) {
log.debug("persisting Bookpre instance");
try {
currentSession().persist(transientInstance);
log.debug("persist successful");
} catch (RuntimeException re) {
log.error("persist failed", re);
throw re;
}
}
public void attachDirty(Bookpre instance) {
log.debug("attaching dirty Bookpre instance");
try {
currentSession().saveOrUpdate(instance);
log.debug("attach successful");
} catch (RuntimeException re) {
log.error("attach failed", re);
throw re;
}
}
public void attachClean(Bookpre instance) {
log.debug("attaching clean Bookpre instance");
try {
currentSession().lock(instance, LockMode.NONE);
log.debug("attach successful");
} catch (RuntimeException re) {
log.error("attach failed", re);
throw re;
}
}
public void delete(Bookpre persistentInstance) {
log.debug("deleting Bookpre instance");
try {
currentSession().delete(persistentInstance);
log.debug("delete successful");
} catch (RuntimeException re) {
log.error("delete failed", re);
throw re;
}
}
public Bookpre merge(Bookpre detachedInstance) {
log.debug("merging Bookpre instance");
try {
Bookpre result = (Bookpre) currentSession().merge(
detachedInstance);
log.debug("merge successful");
return result;
} catch (RuntimeException re) {
log.error("merge failed", re);
throw re;
}
}
public Bookpre findById(java.lang.String id) {
log.debug("getting Bookpre instance with id: " + id);
try {
Bookpre instance = (Bookpre) currentSession().get(
"com.lib.persistence.hibernate.pojo.Bookpre", id);
if (instance == null) {
log.debug("get successful, no instance found");
} else {
log.debug("get successful, instance found");
}
return instance;
} catch (RuntimeException re) {
log.error("get failed", re);
throw re;
}
}
public List findByExample(Bookpre instance) {
log.debug("finding Bookpre instance by example");
try {
List results = currentSession().createCriteria(
"com.lib.persistence.hibernate.pojo.Bookpre").add(
Example.create(instance)).list();
log.debug("find by example successful, result size: "
+ results.size());
return results;
} catch (RuntimeException re) {
log.error("find by example failed", re);
throw re;
}
}
public static void main(String[] args) {
HibernateUtil.currentSession().beginTransaction();
// String sql ="from Bookpre where catalogDetailTables in" +
// "(from OrderDetailTable where acceptDetailTables in" +
// "(from AcceptDetailTable where acceptTable in" +
// "(from AcceptTable where acceptNum='6'))))";
// Query query = HibernateUtil.currentSession().createQuery(sql);
// List list = query.list();
// System.out.println(list.size());
//
String sql2 = "select book from book where book.isbn in " +
"(select isbn from catalog_detail_table where catalog_detail_table.zd_num in" +
"(select zd_num from order_detail_table where order_detail_table.order_detail_num in " +
"(select order_detail_num from accept_detail_table where accept_detail_table.accept_num ='6')))";
Query query2 = HibernateUtil.currentSession().createSQLQuery(sql2);
List list2 = query2.list();
System.out.println(list2.size());
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -