努力尽今夕,少年犹可夸。这篇文章主要讲述What would be the closest equivalent in Java to a Micro ORM such as Dapper, PetaPoco, Massive or Cod相关的知识,希望能为你提供帮助。
Java Micro ORM equivalent [closed]
Ask Question
up vote 51 down vote favorite
21 |
【What would be the closest equivalent in Java to a Micro ORM such as Dapper, PetaPoco, Massive or Cod】What would be the closest equivalent in java to a Micro ORM such as Dapper, PetaPoco, Massive or CodingHorror?
java subsonic dapper petapoco massive
shareimprove this question
|
edited Jun 11 ‘12 at 15:24
|
asked Jun 27 ‘11 at 15:05
文章图片
Kynth
1,8881224 |
|
closed as off-topic by Laurel, manetsus, Lambda Ninja, Compass, Edvin Tenovimas Aug 6 ‘16 at 6:57 This question appears to be off-topic. The users who voted to close gave this specific reason:
- "Questions asking us to recommend or find a book, tool, software library, tutorial or other 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." – Laurel, manetsus, Lambda Ninja, Compass, Edvin Tenovimas
If this question can be reworded to fit the rules in the help center, please edit the question.
|
|
add a comment
|
6 Answers activeoldestvotes
up vote 20 down vote accepted
|
I recommend Spring JDBC templates. While it‘s not a "true" ORM, it‘s a pleasure to use where Hibernate seems to be an overkill.
shareimprove this answer
|
answered Jun 27 ‘11 at 22:49
文章图片
Arnelism
9331918 |
|
|
add a comment
|
up vote 23 down vote
|
sql2o seems like a Dapper alternative - thin wrapper around JDBC
String sql =
"SELECT id, category, duedate " +
"FROM tasks " +
"WHERE category = :category";
Sql2o sql2o = new Sql2o(DB_URL, USER, PASS);
List<
Task>
tasks = sql2o.createQuery(sql)
.addParameter("category", "foo")
.executeAndFetch(Task.class);
github - https://github.com/aaberg/sql2o
site - http://www.sql2o.org/
shareimprove this answer
|
answered Aug 9 ‘13 at 7:58
文章图片
tomaszkubacki
1,59011226 |
|
|
add a comment
|
up vote 12 down vote
|
Here‘s a list of tools that "ease the pain" when interacting with simple JDBC:
- Spring‘s JdbcTemplate
- Apache DbUtils
- JDBI
- sql2o
- persism
And here‘s a list of tools that go a bit beyond simple JDBC, i.e. provide some ORM / ActiveRecord facilities
- jOOQ (This one probably doesn‘t qualify as micro-ORM)
- JaQu
- ActiveJDBC (This one is more of an ActiveRecord API, than an ORM)
- MyBatis (This one focuses on SQL templating, but also has some mapping features)
- EBean
shareimprove this answer
|
edited Sep 7 ‘13 at 10:25
|
answered Sep 7 ‘13 at 10:04
文章图片
Lukas Eder
114k63383771 |
|
|
add a comment
|
up vote 4 down vote
|
Another interesting light ORM is JDBI. Here is Five minute intro
It has two alternative APIs:
Fluent API
DBI dbi = new DBI(ds);
Handle h = dbi.open();
String name = h.createQuery("select name from something where id = :id")
.bind("id", 1)
.map(StringMapper.FIRST)
.first();
and SQL Object API where SQL statements are mapped to methods with declarative interfaces like this:
public interface MyDAO
{
@SqlUpdate("create table something (id int primary key, name varchar(100))")
void createSomethingTable();
}DBI dbi = new DBI(ds);
MyDAO dao = dbi.open(MyDAO.class);
dao.createSomethingTable();
shareimprove this answer
|
answered Aug 23 ‘13 at 3:13
文章图片
tomaszkubacki
1,59011226 |
|
|
add a comment
|
up vote 3 down vote
|
Also checkout SimpleFlatMapper
It‘s a performant simple ResultSet to Object mapper. It just plug on top of jdbc and gives far better performance than Hibernate Ibatis or even sql2o. It easily integrate JdbcTemplate and provides constructor, setter and field injection.
shareimprove this answer
|
answered Sep 1 ‘14 at 10:34
文章图片
Anaud Roger
311 |
|
|
add a comment
|
up vote 2 down vote
|
This one doesn‘t seem to be mentioned here yet: dalesbred
Similar to sql2o and dapper...
shareimprove this answer
|
answered Aug 11 ‘15 at 5:40
文章图片
jl.
576415 |
|
|
|
推荐阅读