摘要: 欢迎转载http://www.cnblogs.com/shizhongtao/p/3440486.html《--这个是lucene4.6的api下载地址,格式是chm的。需要的人可以下载http://ishare.iask.sina.com.cn/f/64138671.html--》Field.St... 阅读全文
posted @ 2013-11-24 22:26 bingyulei 阅读(271) 评论(0) 推荐(0) 编辑
摘要: 欢迎转载http://www.cnblogs.com/shizhongtao/p/3440479.html接着上一篇,这里继续搜索,对于搜索和创建一样,首先你要确定搜索位置,然后用规定的类来读取。还要注意一点,确定分词器,因为不同的分词器所创建的分词规则不同。上篇我使用的是默认的分词器,这里我也先不管分词器。为了方便阅读,代码就全部粘上。 1 package com.bing.test; 2 3 import java.io.File; 4 import java.io.FileNotFoundException; 5 import java.io.FileReader; 6 i... 阅读全文
posted @ 2013-11-24 20:59 bingyulei 阅读(357) 评论(0) 推荐(0) 编辑
摘要: 欢迎转载http://www.cnblogs.com/shizhongtao/p/3440325.htmllucene你可以理解为一种数据库,他是全文搜索的一种引擎。1.首先去官网download最新的jar包,我下载的是4.5版本的,当然你也可以使用maven来下载,2.新建项目,并把lucene-core-4.5.1.jar加入到项目中,其他需要的分词器等jar包,可以用的时候加入就可以。因为是入门创建java project就可以了。3.lucene中主要分为三部分,分别是索引部分、分词部分、搜索部分。索引部分:可以理解像字典中前面的查找索引分词部分:就是将内容进行拆分,比如“我是好人” 阅读全文
posted @ 2013-11-24 19:00 bingyulei 阅读(413) 评论(0) 推荐(0) 编辑
摘要: 博客地址http://www.cnblogs.com/shizhongtao/p/3438431.html属性文件命名是*.properties,在java中,用类java.util.Properties来处理,例如我创建文件my.properties,然后加入属性filename=你好path=D\:\\app那么在java中就可以这样读取属性InputStream in=App.class.getResourceAsStream ("/my.properties"); Properties pro=new Properties(); try { ... 阅读全文
posted @ 2013-11-22 23:33 bingyulei 阅读(1231) 评论(0) 推荐(0) 编辑
摘要: 博客地址http://www.cnblogs.com/shizhongtao/p/3437372.html,欢迎转载 使用hibernate时候,对于任何一个实体类都有三种状态,他们分别是transient、persistent、detached。以前上课时候,老师给过一个示意图:在上图中,讲述了三种状态的转换。下面,以自己的理解对三种状态分别进行说明,不过要注意一点,在hibernate3以后session就没有find和iterate方法了,有query接口的list方法来代替。transient:当我们实例化一个对象时候,它就处于这种状态,状态具体表现是,它只是内存中一个对象,没对应的. 阅读全文
posted @ 2013-11-22 13:22 bingyulei 阅读(277) 评论(0) 推荐(0) 编辑
摘要: 官方文档中有这样一段话。If you intend to express annotation-driven injection by name, do not primarily use @Autowired, even if is technically capable of referring to a bean name through @Qualifier values. Instead, use the JSR-250 @Resource annotation, which is semantically defined to identify a specific target 阅读全文
posted @ 2013-11-21 22:49 bingyulei 阅读(427) 评论(0) 推荐(0) 编辑
摘要: 欢迎转载,请注明出处http://www.cnblogs.com/shizhongtao/p/3436523.html一、xml配置方式的id生成 其中class常用的值有四个,native、 identity、 sequence、 uuid。注:其中native和uuid不局限与数据库。如果用oracle的话。使用native,就会在数据库中使用sequence来自动生成id;在mysql中。会设置id auto_increatment(代表id自动增长) “uuid.hex” : 由 Hibernate 基于128 位 UUID 算法 生成16 进制数值(编码后以长度32 的字符串表示). 阅读全文
posted @ 2013-11-21 22:31 bingyulei 阅读(363) 评论(0) 推荐(0) 编辑
摘要: 本文中的JdbcTemplate的用法可以参看官方文档http://docs.spring.io/spring/docs/3.2.5.RELEASE/spring-framework-reference/htmlsingle/#jdbc-JdbcTemplate我们使用spring时候,一般数据库连接交给spring去管理。首先配置datasource 配置好之后,你如果乐意,就可以直接把它注入到类中使用,例如:spring提供了操作数据库的模板类,JdbcTemplate。如果使用它,代码就变得简单了,我们创建一个基础的数据库交互类,BaseDao,然后把Jd... 阅读全文
posted @ 2013-11-21 21:51 bingyulei 阅读(773) 评论(0) 推荐(0) 编辑
摘要: 官方说明文档地址https://maven.apache.org/guides/introduction/introduction-to-dependency-mechanism.html#Dependency_ScopeThere are 6 scopes available:compileThis is the default scope, used if none is specified. Compile dependencies are available in all classpaths of a project. Furthermore, those dependencies 阅读全文
posted @ 2013-11-21 21:13 bingyulei 阅读(1024) 评论(0) 推荐(0) 编辑
摘要: 欢迎转载,出处http://www.cnblogs.com/shizhongtao/p/3433679.html利用cxf的框架实现import javax.xml.namespace.QName;import org.apache.cxf.endpoint.Client;import org.apache.cxf.jaxws.endpoint.dynamic.JaxWsDynamicClientFactory; JaxWsDynamicClientFactory factory = JaxWsDynamicClientFactory.newInstance(); ... 阅读全文
posted @ 2013-11-20 15:24 bingyulei 阅读(277) 评论(0) 推荐(0) 编辑