Questions asking us to recommend or find a tool, library or favorite off-site resource are off-topic for Stack Overflow as they tend to attract opinionated answers and spam. Instead, describe the problem and what has been done so far to solve it.
Closed 11 years ago.
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
接受
或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
发布评论
评论(6)
以下是与简单 JDBC 交互时“减轻痛苦”的工具列表:
Here's a list of tools that "ease the pain" when interacting with simple JDBC:
还有 ORMLite 和 MyBatis 也非常轻量。使用 spring 及其行映射器非常简单,但确实需要您直接处理 JDBC。像上面任何一个这样的东西都会隐藏很多东西,而不是像休眠那样过于复杂。
There's also ORMLite and MyBatis which are pretty lightweight as well. Using spring and it's rowmappers is pretty easy, but does require you to deal directly with the JDBC. Something like either of the above will hide alot of that away from you, while not being as overly complicated as hibernate.
https://code.google.com/p/jdbc-helper/
这是我复制的说明其项目页面:
受 Spring Jdbctemplate 和 Commons Dbutils 项目的启发,JdbcHelper 是一个非常小的库,用于帮助开发人员编写常见的 jdbc 操作。 JdbcHelper 非常轻量级。它只有 ~70K 并且没有外部依赖。
https://code.google.com/p/jdbc-helper/
Here is the description I copied from its project page:
Inspired by Spring Jdbctemplate and Commons Dbutils projects, JdbcHelper is a very small library for helping the developers code common jdbc operations. JdbcHelper is very lightweight. It is only ~70K and it has no external dependencies.
有 Yank,它是一个包装 DBUtils 的超轻量 JDBC 持久层。要使用它,您需要为每个表创建一个 POJO 和一个 DAO 类。您编写自己的 SQL 语句并通过 DBProxy 类执行查询。您不必处理连接、结果集和/或其他低级 JDBC 代码。截至 2.0.0 版,Yank jar 只有 13 KB,并且它仅依赖于 SLF4J、DBUtils 和第 3 方数据库 jar,无论您使用哪种数据库技术。
There is Yank, which is an ultra-light JDBC persistance layer that wraps DBUtils. To use it you create for each table a POJO and a DAO Class. You write your own SQL statements and execute queries through the DBProxy class. You don't have to deal with Connections, ResultSets, and or other low level JDBC code. The Yank jar is only 13 KB as of release 2.0.0, and it depends on only SLF4J, DBUtils, and a 3rd-party database jar, whichever database technology you're using.
Spring 框架 (spring- dao) 是你的朋友。如果你正确地编程了你的接口,稍后(如果有必要的话)你可以轻松地切换到更强大的东西,比如 Hibernate。也不要低估 Hibernate: Native SQL为您提供了完整 SQL 的功能,并且您仍然可以从对象映射中受益 - 无论如何您都必须进行编程,除非您只需要执行像
select count(*) from ... 一样简单的查询
。Spring Framework (spring-dao) is your friend. If you program your interfaces correctly, later (provided it would be necessary) you can easily switch to something more powerful like Hibernate. Also don't underestimate Hibernate: Native SQL gives you a power of full SQL and still you can benefit from object mapping – something which you will have to program anyway unless you only need to execute the queries as simple as
select count(*) from ...
.在不需要 ORM 的情况下,我使用 springs JdbcTemplate 。
示例
In cases where an ORM is not neccessary I use springs JdbcTemplate .
Examples