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);
Top comments (0)