Java Micro ORM equivalent [Closed]ask Question
Up vote vote favorite |
What would is the closest equivalent in Java to a Micro ORM such as Dapper, Petapoco, Massive or C Odinghorror? Java subsonic dapper Petapoco massive
shareimp Rove this question |
edited jun" at 15:24 |
asked jun" at 15:05 kynth1,88812 24 |
|
closed as Off-topic by Laurel, Manetsus, Lambda Ninja, Compass, Edvin tenovimas 6 ' + 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 is Off-topic for Stack Overflow as they tend to attract opinionated answers and spam. Instead, describe the problem and what have been done so far to solve it. "–laurel, Manetsus, Lambda Ninja, Compass, Edvin Tenovimas
If This question can is reworded to fit the ' rules in the ' Help Center ', please edit the question. |
|
|
ooh, good Question– marc gravell Jun "at 15:11 |
|
@Marc: Exactly. There ' re many projects that port out of Java projects. These microorms is ones that could is ported from. NET to Java. – robert koritnik jun" at 16:24 |
|
@Robert: It would is great to see some of the good. Net work heading the other-the-too, for sure. –kynth Sep 6 ' one at 16:20 |
Add a Comment |
6 Answers Active oldest votes
Up vote vote accepted |
I recommend Spring JDBC templates. While it's not a "true" ORM, it's a pleasure to the use of where Hibernate seems to is an overkill.
ShareImprove this answer |
answered June "at 22:49 arnelism93319 |
|
|
|
it sounds like a good fit, then;p Dapper, Petapoco and Massive is also not "true" orms-t Hey instead concentrate on doing an insanely good job of simple data access, which covers a high% of use-cases. – marc gravell Jun "at 12:15 |
|
queryforobject seems a bit clunky, can that is do with generics in Java? Eg:query<car> ("SELECT * from Cars")? – sam Saffron jul 4 ' one at 1:33 |
|
@sam-saffron yes! Use simplejdbctemplete-static.springsource.org/spring/docs/2.0.x/reference/...–arnelism Jul ' one at 16:04 |
Add a Comment |
Up vote 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 9 ' at 7:58 tomaszkubacki1,5901 |
|
|
|
I would say that sql2o are the easiest and small framework to treat queries like INSERT, UPDATE, delete. I ' ve been using it since 1 year smoothly, however there ' s not major update since 2015. It is missing a functionality to treat view and joins in one query to avoid round trips to db. –maximus Decimus Jul 7 ' at 0:52 |
Add a Comment |
Up vote Vote |
Here's a list of tools that "ease the pain" when interacting and 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 a ActiveRecord API, than an ORM)
- MyBatis (this one focuses in SQL templating, but also have some mapping features)
- Ebean
ShareImprove this answer |
Edited Sep 7 ' at 10:25 |
answered Sep 7 ' at 10:04 Lukas Eder114k383 771 |
|
|
|
i ' ve been Using SQL2O for 1 year without any trouble. However there is no major update since!!!!! I Hope this library doesn ' t get obsolete. It is PLAIN and simple to use. However I think the creator is requesting ideas to treat views and/or joins queries since so long. I checked quickly this list and Apache dbutils It's the more closest to Sql2o. – maximus Decimus jul 7" at 0:45 |
|
@MaximusDecimus: If You ' re such a fan of SQL2O, why abandon it instead of contributing? You could even become its new maintainer! –lukas Eder Jul 7 ' at 8:14 |
Add a Comment |
Up vote 4 down vote |
Another interesting light ORM is jdbi. Here is Five minute intro It has the 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 is 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 ' at 3:13 tomaszkubacki1,590 1 |
|
|
|
pro tip:you Can mix both approaches using abstract class instead of interface in object Api– tomaszkubacki oct" at 1:03 |
|
That SQL Object API looks super cool! –jjnguy Jan at 2:23 |
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 the JDBC and gives far better performance than Hibernate Ibatis or even sql2o. It easily integrate JdbcTemplate and provides constructor, setter and field injection. answered Sep 1 ' + at 10:34 Anaud roger 311
/td> |
|
|
May I know what is the disadvantages of simpleflatmapper compared to Spring ' s own beanpropertyrowmapper? –yudhistira Arya Sep One ' at 15:42 |
Add a Comment |
up vote 2 down vote |
This one doesn ' t seem to being mentioned here yet:dalesbred Similar to Sql2o and dapper ... answered Aug 11 ' 15 At 5:40 JL. 576 415
|
&NBSP; |
tr>
&NBSP;&NBSP; |
|
i should also mention that s QL2O seems more active. The API for Sql2o seems a bit more natural to me. Dalesbred supports WHERE ... In queries whereas SQL2O does. – jl. Oct 7 ' at 18:15 |
|
|
What would is the closest equivalent in Java to a Micro ORM such as Dapper, Petapoco, Massive or codinghorror?