All Projects → zhangdaiscott → Minidao

zhangdaiscott / Minidao

轻量级JAVA持久层,类似Mybatis一样的用法,基于SpringJdbc实现更轻量

Programming Languages

java
68154 projects - #9 most used programming language

Projects that are alternatives of or similar to Minidao

Java Persistence Frameworks Comparison
Comparison of non-JPA SQL mapping frameworks for Java (Jooq, Spring JDBCTemplate, MyBatis, EBean, JDBI, Speedment, sql2o)
Stars: ✭ 213 (+20.34%)
Mutual labels:  sql, mybatis, jdbc, jpa
Jplusone
Tool for automatic detection and asserting "N+1 SELECT problem" occurences in JPA based Spring Boot Java applications and finding origin of JPA issued SQL statements in general
Stars: ✭ 91 (-48.59%)
Mutual labels:  sql, hibernate, jdbc, jpa
MiniDao
An powerful enhanced toolkit of SpringJdbc for simplify development
Stars: ✭ 200 (+12.99%)
Mutual labels:  jdbc, jpa, hibernate, mybatis
Jooq
jOOQ is the best way to write SQL in Java
Stars: ✭ 4,695 (+2552.54%)
Mutual labels:  sql, hibernate, jdbc, jpa
Micronaut Data
Ahead of Time Data Repositories
Stars: ✭ 352 (+98.87%)
Mutual labels:  sql, hibernate, jdbc, jpa
Hibernate Springboot
Collection of best practices for Java persistence performance in Spring Boot applications
Stars: ✭ 589 (+232.77%)
Mutual labels:  sql, hibernate, jdbc, jpa
Db Util
If you are using JPA and Hibernate, this tool can auto-detect N+1 query issues during testing.
Stars: ✭ 194 (+9.6%)
Mutual labels:  sql, jdbc, jpa
Sqlhelper
SQL Tools ( Dialect, Pagination, DDL dump, UrlParser, SqlStatementParser, WallFilter, BatchExecutor for Test) based Java. it is easy to integration into any ORM frameworks
Stars: ✭ 242 (+36.72%)
Mutual labels:  sql, mybatis, jdbc
Quickperf
QuickPerf is a testing library for Java to quickly evaluate and improve some performance-related properties
Stars: ✭ 231 (+30.51%)
Mutual labels:  sql, hibernate, jdbc
Easyee
开源 JavaEE 企业级快速开发平台。提供了 Spring Boot, Struts2, Hibernate, MyBatis, Shiro, EasyUI 等技术,包含完整的权限管理系统等。提供自动化代码生成器。 Open source JaveEE enterprise-class rapid development of the basic platform. Integration of Spring Boot, Struts2, Hibernate, MyBatis, Shiro, EasyUI and other technologies, including the integrity of the rights management. Provides an automated code generator.
Stars: ✭ 275 (+55.37%)
Mutual labels:  mybatis, hibernate, jpa
Jeddict
Jakarta EE 8 (Java EE) & MicroProfile 3.2 application generator and modeler
Stars: ✭ 358 (+102.26%)
Mutual labels:  sql, hibernate, jpa
Erupt
🚀 纯 Java 注解,快速开发 Admin 管理后台。不生成任何代码、零前端代码、零 CURD、自动建表、注解式API,支持所有主流数据库,支持自定义页面,支持多数据源,提供二十几类业务组件,十几种展示形式,支持逻辑删除,动态定时任务,前端后端分离等。核心技术:Spring Boot、JPA、Reflect、TypeScript、NG-ZORRO等。 开源不易,记得右上角点个star鼓励作者~
Stars: ✭ 421 (+137.85%)
Mutual labels:  sql, mybatis, jpa
Hibernate Orm
Hibernate's core Object/Relational Mapping functionality
Stars: ✭ 4,806 (+2615.25%)
Mutual labels:  hibernate, jdbc, jpa
Ebean
Ebean ORM
Stars: ✭ 1,172 (+562.15%)
Mutual labels:  sql, jdbc, jpa
Jcabi Jdbc
Fluent Wrapper of JDBC
Stars: ✭ 90 (-49.15%)
Mutual labels:  sql, jdbc
Sample Boot Hibernate
Spring Boot + JPA ( Hibernate ) + Java8 [ DDD Sample ]
Stars: ✭ 97 (-45.2%)
Mutual labels:  hibernate, jpa
Hibernate Reactive
A reactive API for Hibernate ORM, supporting non-blocking database drivers and a reactive style of interaction with the database.
Stars: ✭ 167 (-5.65%)
Mutual labels:  hibernate, jpa
Hibernate Performance
Samples for "Hibernate performance tuning" talk
Stars: ✭ 87 (-50.85%)
Mutual labels:  hibernate, jpa
Fastsql
Database rapid development framework for Java(数据库快速开发框架).
Stars: ✭ 100 (-43.5%)
Mutual labels:  sql, jdbc
Java Course
Self paced course for Java Engineers
Stars: ✭ 103 (-41.81%)
Mutual labels:  hibernate, jdbc

MiniDao (轻量级JAVA持久层,Hibernate完美助手)

当前最新版本: 1.6.4 (发布日期:20180604)

MiniDao产生的初衷?

采用Hibernate的J2EE项目都有一个痛病,针对复杂业务SQL,hibernate能力不足,SQL不好优化和也无法分离。 这个时候大家就想到集成mybatis,但是一个项目既用hibernate又用mybatis,显得很重事务也不好控制。大家常规的做法是采用springjdbc来实现原生SQL编写,但是也同样存在问题,SQL无法分离也没有逻辑标签能力。 所以为了解决这个痛病,Jeecg针对springjdbc+freemarker做了封装,出了这么一个轻量级持久层,可以让Hiberate拥有mybatis一样SQL灵活能力,同时支持事务统一、SQL标签能力。

MiniDao 简介及特征

MiniDao 是一款轻量级JAVA持久层框架,基于 SpringJdbc + freemarker 实现,具备Mybatis一样的SQL分离和逻辑标签能力。Minidao产生的初衷是为了解决Hibernate项目,在复杂SQL具备Mybatis一样的灵活能力,同时支持事务同步。

具有以下特征:

  • O/R mapping不用设置xml,零配置便于维护
  • 不需要了解JDBC的知识
  • SQL语句和java代码的分离
  • 只需接口定义,无需接口实现
  • SQL支持脚本语言(强大脚本语言,freemarker语法)
  • 支持与hibernate轻量级无缝集成
  • 支持自动事务处理和手动事务处理
  • 性能优于Mybatis
  • 比Mybatis更简单易用
  • SQL 支持注解方式
  • SQL 支持独立文件方式,SQL文件的命名规则: 类名_方法名; SQL文件更容易定位,方便后期维护,项目越大此优势越明显
  • SQL标签采用Freemarker的基本语法

如何快速集成minidao?

方式一:springmvc与minidao集成

https://minidao.mydoc.io/?t=293634

方式二:springboot2与minidao集成

https://minidao.mydoc.io/?t=336070

技术交流

代码体验

1. 接口定义[EmployeeDao.java]

@MiniDao
public interface EmployeeDao {

 @Arguments({ "employee"})
 @Sql("select * from employee")
 List<Map<String,Object>> getAll(Employee employee);

 @Sql("select * from employee where id = :id")
 Employee get(@Param("id") String id);

 @Sql("select * from employee where empno = :empno and  name = :name")
 Map getMap(@Param("empno")String empno,@Param("name")String name);

 @Sql("SELECT count(*) FROM employee")
 Integer getCount();

 int update(@Param("employee") Employee employee);

 void insert(@Param("employee") Employee employee);
 
 @ResultType(Employee.class)
 public MiniDaoPage<Employee> getAll(@Param("employee") Employee employee,@Param("page")  int page,@Param("rows") int rows);

}

2. SQL文件[EmployeeDao_getAllEmployees.sql]

SELECT * FROM employee where 1=1 
<#if employee.age ?exists>
and age = :employee.age
</#if>
<#if employee.name ?exists>
and name = :employee.name
</#if>
<#if employee.empno ?exists>
and empno = :employee.empno
</#if>

3. 接口和SQL文件对应目录

github

4. 测试代码

public class Client {
public static void main(String args[]) {
	BeanFactory factory = new ClassPathXmlApplicationContext("applicationContext.xml");
 		
	EmployeeDao employeeDao = (EmployeeDao) factory.getBean("employeeDao");
	Employee employee = new Employee();
	String id = UUID.randomUUID().toString().replaceAll("-", "").toUpperCase();
	employee.setId(id);
	employee.setEmpno("A001");
	employee.setSalary(new BigDecimal(5000));
	employee.setBirthday(new Date());
	employee.setName("scott");
	employee.setAge(25);
	//调用minidao方法插入
	employeeDao.insert(employee);
}
}
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].