What would be the best solution for programmers like http://vimeo.com/28885655
The people who created the video believe
I heard about some other ORM implementations like
I would like to hear how they compare and what are the advantages/disadvantages of each one.
JPA alternatives If JPA and Hibernate are not a good fit for your use case, you can use any of the following frameworks: MyBatis, which is a very lightweight SQL query mapper framework. QueryDSL, which allows you to build SQL, JPA, Lucene, and MongoDB queries dynamically.
Hibernate is an object-relational mapping framework (ORM) which maps Java classes to database tables. MyBatis is a persistence framework – not ORM. It maps SQL statements to Java methods.
No, Hibernate is not deprecated.
Here you can find an extensive list of Java ORMs and persistence solutions. Not all of the follows Hibernate/JPAs approach, some of them are quite easy by design.
Of course there are solutions not listed on that site, i.e. Spring JDBC with templates, etc.. And this is my personal choice for projects that require fast, easy to build JDBC access and are already using Spring.
In general, for me at least, it's a little bit to early to say Hibernate is bad and it grown to big. It serves it's purpose quite well, but grown to fit to many shoes. My personal opinion is that it will stay as it is, but NoSQL solutions will probably give birth to a new breed of Java data mapping solutions, like Spring Data. There is a need to create a simple approach to interact with application data, but I don't believe there is a consensus on how to get there... yet.
The presenter makes a good case that some frameworks are overly complicated. The vast number of ORM libraries seems to be an indicator that a good solution is elusive.
Github, bitbucket, source forge have hundreds of ORM projects. Wikipedia has a good list too.
I invented sormula as a lightweight alternative to complicated frameworks like JPA. See sormula site for a list of features and examples.
It also contains a package that implements the active record pattern for those that like that approach but is not required.
If you want control over the used SQL and remain close to JDBC in general, you may be interested in MyBatis, which let's you write your own queries and provides a framework for "automatically" mapping ResultSets to POJOs based on XML- or annotation-based metadata.
A select would look like this in XML:
<select id="selectUsers" parameterType="int" resultType="my.User">
select id, username, password
from users
where id = #{id}
</select>
This would be mapped to a user like this:
<resultMap id="userResultMap" type="my.User">
<id property="id" column="id" />
<result property="username" column="user_name"/>
<result property="password" column="hashed_password"/>
</resultMap>
With the properties being Bean properties in the POJO my.User
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With