|
首页>相关研究方向>lucene/nutch> |
J2EE Search的增删查改及检索初步实现 |
|
Visited times , Welcome to Data Mining Forum & Data Mining Expert |
|
|
logger.info("finding Book instance with id: " + id); try { Book instance = getJpaTemplate().find(Book.class, id); return instance; } catch (RuntimeException re) { logger.error("find failed", re); throw re; } }
@SuppressWarnings("unchecked") public List<Book> findByProperty(String propertyName, final Object value) { logger.info("finding Book instance with property: " + propertyName + ", value: " + value); try { final String queryString = "select model from Book model where model." + propertyName + "= :propertyValue"; return getJpaTemplate().executeFind(new JpaCallback() { public Object doInJpa(EntityManager em) throws PersistenceException { Query query = em.createQuery(queryString); query.setParameter("propertyValue", value); return query.getResultList(); } }); } catch (RuntimeException re) { logger.error("find by property name failed", re); throw re; } }
public List<Book> findByName(Object name) { return findByProperty(NAME, name); }
@SuppressWarnings("unchecked") public List<Book> findAll() { logger.info("finding all Book instances"); try { final String queryString = "select model from Book model"; return getJpaTemplate().executeFind(new JpaCallback() { 数据挖掘实验室 public Object doInJpa(EntityManager em) throws PersistenceException { Query query = em.createQuery(queryString); return query.getResultList(); } }); } catch (RuntimeException re) { logger.error("find all failed", re); throw re; } }
public static BookDAO getFromApplicationContext(ApplicationContext ctx) { return (BookDAO) ctx.getBean("BookDAO"); }
private void makeIndex(EntityManager em){ FullTextEntityManager fullTextEntityManager = Search.createFullTextEntityManager(em); List<Book> books = em.createQuery("select book from Book as book").getResultList();
|
| 上一页 1 2 3 4 56 下一页 |
|
|
|
[数据挖掘专家]
[数据挖掘研究院]
[数据挖掘论坛]
[数据挖掘实验室]
|
上一篇:
FilteredTermEnum (Lucene 2.2.0 API)
下一篇:Grails的全文检索插件
|
|
|
|