摘要: 官方文档中有这样一段话。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) 编辑