The Challenge of the ORM in Java(Simple querying)
Braisdom
Posted on December 11, 2020
The ObjectiveSQL is a new ORM framework, it enhances the existed ORM framework capability, the first is simple querying.
Definition of domain model
@DomainModel
public class Blog {
private Long id;
private String title;
private Integer state;
@Relation(relationType = RelationType.BELONGS_TO)
private Author author;
}
In MyBatis:
<mapper>
<resultMap type="Blog" id="blog">
<id column="id" property="id" />
...
<association property="author" javaType="Author">
...
</association>
</resultMap>
<select id="findBlog" parameterType="int" resultMap="blog">
...
</select>
</mapper>
...
BlogMapper mapper = session.getMapper(BlogMapper.class);
Blog blog = mapper. findBlog(...);
In ObjectiveSQL:
Blog blog = Blog.queryByPrimaryKey(1, Blog.BELONGS_TO_AUTHOR);
💖 💪 🙅 🚩
Braisdom
Posted on December 11, 2020
Join Our Newsletter. No Spam, Only the good stuff.
Sign up to receive the latest update from our blog.
Related
webdev Understanding HTTP, Cookies, Email Protocols, and DNS: A Guide to Key Internet Technologies
November 30, 2024
softwareengineering Git Mastery: Essential Questions and Answers for Developers 🚀
November 30, 2024