beijing-penguin / Myjdbc Rainbow
Licence: apache-2.0
jpa--轻量级orm模式对象与数据库映射api
Stars: ✭ 23
Programming Languages
java
68154 projects - #9 most used programming language
Projects that are alternatives of or similar to Myjdbc Rainbow
Sqli
orm sql interface, Criteria, CriteriaBuilder, ResultMapBuilder
Stars: ✭ 1,644 (+7047.83%)
Mutual labels: jdbc, mysql
Hibernate Springboot
Collection of best practices for Java persistence performance in Spring Boot applications
Stars: ✭ 589 (+2460.87%)
Mutual labels: jdbc, mysql
Watchdog Framework
🍻 「停止维护」基于SpringBoot+Shiro+Mybatis等开发的轻量级管理系统快速开发脚手架
Stars: ✭ 421 (+1730.43%)
Mutual labels: jdbc, mysql
Quill
Compile-time Language Integrated Queries for Scala
Stars: ✭ 1,998 (+8586.96%)
Mutual labels: jdbc, mysql
Scalikejdbc
A tidy SQL-based DB access library for Scala developers. This library naturally wraps JDBC APIs and provides you easy-to-use APIs.
Stars: ✭ 1,139 (+4852.17%)
Mutual labels: jdbc, mysql
Requery
requery - modern SQL based query & persistence for Java / Kotlin / Android
Stars: ✭ 3,071 (+13252.17%)
Mutual labels: jdbc, mysql
Mycat2
MySQL Proxy using Java NIO based on Sharding SQL,Calcite ,simple and fast
Stars: ✭ 750 (+3160.87%)
Mutual labels: jdbc, mysql
Sample Hazelcast Spring Datagrid
sample spring-boot applications integrated with hazelcast imdg, and providing hot cache with hazelcast and striim
Stars: ✭ 16 (-30.43%)
Mutual labels: mysql
Reiner
萊納 - A MySQL wrapper which might be better than the ORMs and written in Golang
Stars: ✭ 19 (-17.39%)
Mutual labels: mysql
Goloquent
This repo no longer under maintenance, please go to https://github.com/si3nloong/sqlike
Stars: ✭ 16 (-30.43%)
Mutual labels: mysql
Go jwt
golang for websocket wechat or weixin and jwt,http ratelimit
Stars: ✭ 19 (-17.39%)
Mutual labels: mysql
Mysqlconnection
Simple library to make it much easier to use MySQL in Visual Studio projects
Stars: ✭ 6 (-73.91%)
Mutual labels: mysql
入口类DBHelper.java,new出来就能用。
具体测试用例在myjdbc-example项目中,测试sql在sql目录下,导入mysql数据库即可。
②main方式简单使用,确保引入myjdbc源码jar 包,或者引用了pom.xml,或者直接 copy源代码到src下。引入druid,HikariDataSource,或者你习惯使用的任何一种数据源jar包,main方法查询test数据库中的数据集合如下
public class App {
public static void main( String[] args ) {
HikariDataSource dataSource = new HikariDataSource();
dataSource.setJdbcUrl("jdbc:mysql://localhost:3306/test?useUnicode=true&characterEncoding=UTF-8&autoReconnect=true&useSSL=false");
dataSource.setUsername("root");
dataSource.setPassword("123456");
try{
DBHelper dbHelper = new DBHelper(dataSource);
//start 对象操作 操作原理说明,根据实体构造最终完整sql并执行操作,改操方法api最多有3个参数,第一个entity(Object类型) 第二个wheresql(String主要是where条件),第三个sql语句对应的参数(对象,list,map,数组)
User user = new User();
user.setName("张三");
user.setSex(23);
ConnectionManager.setTransaction(true);
//插入一个行数据到数据库,然后赋值给user对象的id属性
Long id = dbHelper.insertEntityRtnPK(user);
user.setId(id);
//更新一个对象,注意只能根据主键更新一个对象,只更新有值的字段,没有值的字段不会被更新
//dbhelper能够自动检查对象User的字段中是否包含主键,如果没有主键,会抛出异常。
System.out.println(dbHelper.updateEntity(user));
//同理删除对象,也只能根据主键删除,如果主键没有,或者为空,则报错
System.out.println(dbHelper.deleteEntity(user));
//纯sql操作,改操方法api最多有3个参数,第一个entity(Object类型) 第二个wheresql(String主要是where条件),第三个sql语句对应的参数(对象,list,map,数组)
//目前只支持?和#匹配符,如果有朋友建议或需要的可以加上:或者其他通配符
User u2 = dbHelper.selectOne("select * from user where sex = #{sex} and name=#{name}",User.class, user);
User u3 = dbHelper.selectOne("select * from user where sex = ? and name=?",User.class, 23,"张三");
//===>上一步等价于:
User u4 = dbHelper.selectOne("select * from user where sex = ? and name=?",User.class,new Object[]{23,"张三"});
//===>上一步等价于:
List<Object> paramList = new ArrayList<Object>();
paramList.add(23);
paramList.add("张三");
User u5 = dbHelper.selectOne("select * from user where sex = ? and name=?",User.class,paramList);
//返回集合查询,这个传参方式跟使用selectOne一模一样,不过多举例。
List<User> u6List = dbHelper.selectList("select * from user where sex = ? name=?",User.class,paramList);
ConnectionManager.commitAll();
}catch (Exception e) {
ConnectionManager.rollbackAll();
}finally {
ConnectionManager.closeConnectionAll();
}
}
}
支持事务,配置请参考另外一份SpringConfig.txt aop配置说明
支持读写分离
支持0配置0注解对实体对象的增删改,也支持直接传入sql操作数据库
支持完整的sql日志打印与日志是否输出动态控制
支持业务上常见的跨库操作+弱事务支持
支持无缝对接当当开源的分库分表sharding-jdbc
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].