114 Star 687 Fork 131

automvc / bee

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
贡献代码
同步代码
取消
提示: 由于 Git 不支持空文件夾,创建文件夹后会生成空的 .keep 文件
Loading...
README
Apache-2.0

Bee

好消息:

Bee 2.1 完善的Sharding分片功能, 完善的MongoDB ORM功能。
当前最新版本为:V2.2 LTS版
1.7.x LTS版为:1.17.21

Sharding分片:对业务开发透明,编码透明,只加少量分片配置即可实现分片功能.

快速开始:Shardign最佳实践参考实例

工欲善其事必先利其器!——《论语》

为适应互联网时代软件需求量大,需求变更频繁,性能要求高等要求,ORM Bee应运而生!

Bee,一个简单,易用,功能强大(编码少、开发速度快,运行快)的 JAVA ORM 框架。
Bee,互联网新时代的Java ORM框架,更快、更简单、更自动,开发速度快,运行快,更智能!
Bee简单易用概念简单,10分钟即可入门。
Bee功能强大:运行速度比其它流行ORM工具更快。
Bee功能丰富:支持JDBC/关系型数据库; 支持手机环境ORM:Android和Harmony;支持NoSQL的Cassandra,Mongodb等;支持Sharding分片;支持ElasticSearch查询。

如果说Mybatis在Hibernate之后不是重复造轮子,那Bee在Hibernate和Mybatis之后也不会是重复造轮子!
择其优点,避其缺点,此外,还加有自己的优点!

磨刀不误砍柴工! Bee连磨刀的时间都帮你省了。

IT->AiTea

环境要求

Bee jdk1.8+

Bee2.1.8 + Spring boot3.0.8对应版本2.1.8.boot3.0.8 需要JDK17
Bee2.2 + Spring boot3.0.13对应版本2.2.boot3.0.13 需要JDK17

Bee主要功能特点介绍:

主要功能介绍

最新功能简介:

V2.4.0

1.chaing SQL编程支持占位符预编译,防止注入攻击;增加update,delete的chaing编程支持
2.没有指定表名则不放缓存
3.添加Calculate默认日期分片实现,添加自定义分片实现样例
4.支持ElasticSearch(7.x) ORM 查询
5.自定义sql(PreparedSql)增加关联表名的方法,让自定义sql中,方法没带实体T的,也能纳入缓存管理
6.MongoDB根据表生成Javabean,支持生成默认注解

7.Sharding模板方法类使用finally处理上下文回收
8.MapSql(MapSuid)支持使用Condition实现更加复杂的where条件,updateSet设值
MapSql增加方法: public void where(Condition condition);
public void updateSet(Condition condition);
9.添加ConditionExt支持使用entity::getName形式引用属性名
10.添加链式编程工厂引用类ChainSqlFactory

详细完整功能介绍

点击链接可查看 详细完整功能介绍

ORM比较

应用于JDBC方面的比较

ORM-Compare (More Detail)

测试环境: Windows.
数据库: MySQL (Version 5.6.24).
测试点: 批量插入;分页查询;事务(update and select).

批量插入(单位: ms)
  5k 1w 2w 5w 10w
Bee 529.00 458.33 550.00 1315.67 4056.67
MyBatis 1193 713 1292.67 1824.33 Exception

 

分页查询(单位: ms)
  20次 50次 100次 200次 500次
Bee 17.33 58.67 52.33 38.33 57.33
MyBatis 314.33 446.00 1546.00 2294.33 6216.67

 

事务(update and select) (单位: ms)
  20次 50次 100次 200次 500次
Bee 1089.00 70.00 84.00 161.33 31509.33
MyBatis 1144 35 79.67 146.00 32155.33

Bee需要的文件
orm\compare\bee\service\BeeOrdersService.java

Mybatis需要的文件(对一个表的操作,就会比Bee多三个dao相关文件)
orm\compare\mybatis\service\MybatisOrdersService.java orm\compare\mybatis\dao\OrdersDao.java orm\compare\mybatis\dao\OrdersMapper.java orm\compare\mybatis\dao\impl\OrdersDaoImpl.java

公共都需要的有,Javabean和Service接口:
Orders.java
OrdersService.java

用Bee无需用户再写Dao代码,一个表少三个Dao文件,100个表就少300个Dao文件.

Bee应用于APP方面的比较

Bee应用于APP开发性能对比数据
操作1万条数据 ,使用时间对比如下.

操作1w条数据 (单位: ms)
  insert query delete
greenDao(Android) 104666 600 47
Bee(Android 8.1) 747 184 25
Bee(HarmonyOS P40 Pro模拟器) 339 143 2

快速开始:

1. 引入Bee

1.1 maven工程,添加如下依赖

       <dependency>
	      <groupId>org.teasoft</groupId>
	      <artifactId>bee-all</artifactId>
	      <version>2.2</version>
        </dependency>
		
	    <!-- Mysql config.You need change it to the real database config. -->
		<dependency>
			<groupId>mysql</groupId>
			<artifactId>mysql-connector-java</artifactId>
			<version>5.1.47</version>
			<scope>runtime</scope>
		</dependency>

Gradle

implementation group: 'org.teasoft', name: 'bee-all', version: '2.2'
//Gradle(Short)
implementation 'org.teasoft:bee-all:2.2'

1.2 也可以直接下载jar文件

2. 创建数据库和表

举例如下:
创建一个数据库,默认名称为bee.
可以用init-data(user-orders)-mysql.sql脚本创建表和插入初始化数据.

3. 更新数据库的配置信息(在bee.properties)

注:如果还没有bee.properties文件,可以自己新建一个.
(默认的bee.properties位于Hoeny工程下,对应HoneyConfig.java,列举了Bee所有会用到的配置)
也可以配置数据源(此处只是一个例子).

#bee.databaseName=MySQL
bee.db.dbName=MySQL
bee.db.driverName = com.mysql.jdbc.Driver
#bee.db.url =jdbc:mysql://localhost:3306/bee?characterEncoding=UTF-8
bee.db.url =jdbc:mysql://127.0.0.1:3306/bee?characterEncoding=UTF-8&useSSL=false
bee.db.username = root
bee.db.password =

#输出日志
bee.osql.showSQL=true
bee.osql.showSql.showType=true
bee.osql.showSql.showExecutableSql=true
# since 2.1.7 =true时,可格式化sql bee.osql.showSql.sqlFormat=false

#log4j>slf4j>log4j2>androidLog>harmonyLog>systemLogger>fileLogger>noLogging>jdkLog>commonsLog
#fileLogger 输出到文件; systemLogger 控制台输出
bee.osql.loggerType=systemLogger

4. 生成Javabean Orders可参考:

Orders(Javabean)
自动生成Javabean

5. 运行下面的 java代码

关键代码

List<Orders> list1 =suid.select(orders1);  //select
int updateNum=suid.update(orders1);   //update
int insertNum=suid.insert(orders2); //insert 
int deleteNum=suid.delete(orders2);   //delete

详细实例

		
import java.math.BigDecimal;
import java.util.List;

import org.teasoft.bee.osql.api.Suid;
import org.teasoft.honey.osql.core.BeeFactoryHelper;

/**
 * 查,改,增,删 Suid (select,update,insert,delete)实例
 * @author Kingstar
 * @since  2.1
 */
public class SuidExam {
	
	public static void main(String[] args) {

		Suid suid=BeeFactoryHelper.getSuid();
//	    Suid suid=BF.getSuid();//从1.9.8开始,可以加快输入
		
		//需要先生成相应的Javabean
		Orders orders1=new Orders();
		orders1.setId(100001L);
		orders1.setName("Bee(ORM Framework)");
		
		//1:select查询实例
		//默认不处理null和空字符串.不用再写一堆的判断;其它有值的字段全部自动作为过滤条件
		List<Orders> list1 =suid.select(orders1);  //select
		for (int i = 0; i < list1.size(); i++) {
			System.out.println(list1.get(i).toString());
		}
		
		//2:update更新实例
		orders1.setName("Bee--ORM Framework");
		//默认只更新需要更新的字段. 过滤条件默认只用id字段,其它需求可用SuidRich中的方法.
		int updateNum=suid.update(orders1);   //update
		System.out.println("update record:"+updateNum);
		
		
		Orders orders2=new Orders();
		orders2.setUserid("bee");
		orders2.setName("Bee(ORM Framework)");
		orders2.setTotal(new BigDecimal(91.99));
		orders2.setRemark("");  //empty String test
		
		//3:insert 插入实例
		int insertNum=suid.insert(orders2); //insert  		
		//默认不处理null和空字符串.不用再写一堆的判断;其它有值的字段全部自动插入数据库中. 
		//方便结合DB插值,如id自动增长,由DB插入;createtime由DB默认插入
		System.out.println("insert record:"+insertNum);
		
		//4:delete 删除实例
		//默认不处理null和空字符串.不用再写一堆的判断;其它有值的字段全部自动作为过滤条件
		//int deleteNum=suid.delete(orders2);   //delete
		//System.out.println("delete record:"+deleteNum);
		
	}
}
//注意: 事务,分页,排序,范围查询,查询结果直接返回json等都支持,这里只是一个入门例子.
//更加应用参考,请查看: 更多例子   和    综合应用 .

6.操作视频:


快速开始:Harmony环境使用Bee及性能对比

快速开始:Android环境使用Bee及性能对比

更多例子/测试用例

Bee+Spring-boot Demo

2.2.boot3.0.13需要JDK17

Bee架构介绍

V2.1

Bee常用接口介绍

综合应用:

Java快速编程, 让Java的开发速度超过php和Rails。

更快的开发Java Web的新组合:
Bee+Spring+SpringMVC
包括仅分库多数据源实例

Bee+Spring+SpringMVC开发学校教务管理与分数管理系统

更快的开发Spring Cloud微服务的新组合:
Bee + Spring Boot

HarmonyOS使用Bee开发App实例:
Bee + HarmonyOS

自动生成代码GenCode
Generate code automatically

快码加编

快码加编——代码生成神器

  • 1.一键生成整个工程(无需再搭建系统框架)
  • 2.自动生成增删改查等常用功能
  • 3.生成的工程可以直接运行,不再是只能看不能跑的demo
  • 4.快速响应变化,与客户边聊边改,立即可以看到更改后的效果
  • 5.基础功能无需人工测试、接口联调,简化整个开发流程
  • 6.设计的软件易维护、易扩展,利于二次开发、增加新功能!
  • 7.既可以节约开发成本,也可以提高开发效率
    ......

FAQ常见问题

点击链接可查看(资料) FAQ常见问题

其它学习资料:

API-DOC

API-V1.17 下载代码含有 bee-1.17中文和英文版API,bee-1.17中文版源码
API-V2.1(最新版) 下载代码含有 bee-2.1英文版API

使用文档

wiki 文档

Bee常用大全

CSDN: ORM Bee资料大全

企业版:

为了给大家提供更多更强大的功能,Bee团队与企业合作,推出企业版本.
注:免费版本不会故意少加ORM的功能而让你去购买企业版;企业版本只会推出更加专业,安全,节约成本的企业级功能.

新增特性

我们希望提供更多简单易用的Bee功能!进一步提高开发效率! 

  • 1.降低金融计算型项目开发难度,简化金融数字计算等
  • 2.@AutoSetString注解易用性改进,轻松处理像CreateBy,UpdateBy等自动填充功能
  • 自动插入租户的值
  • 3.@Desensitize,敏感信息模糊处理
  • 4.@Dict具体字段字典数值转化
  • 5.@DictI18n多语言国际化字典转化,全局统一设置,无需逐个设置,省时省力
  • 6.@MultiTenancy多租户
  • 7.@Column实现Javabean属性与表列名不一致时,定义映射关系(新系统不建议使用,主要是为了兼容旧系统)
  • 8.@Json实体属性是Javabean与DB表Json类型字段在参数设置与查询结果时自动转换
    支持List结构实体Json解析(V1.11.0.5.6)
  • 9.支持EDI XML电子报文自动生成
  • 10.Sql Server支持start,size两个参数分页(V1.11.0.5.8)
    注: 除1、5、9外,其它已添加到V2.1版

价格(企业版)

企业用户:
¥999
个人用户:
¥198

使用期限(企业版)

购买后永久使用,免费获取升级

技术支持

企业版使用,专业技术支持,解决方案咨询,由以下单位提供:
深圳彩凤软件
(有意愿加入的企业,请联系我们!)

Bee 网址:
https://github.com/automvc/bee
Bee在gitee 的网址:
https://gitee.com/automvc/bee
bee-ext:
https://github.com/automvc/bee-ext

联系与欢迎:

作者的电子邮箱email: honeysoft@126.com

如有任何相关建议,欢迎给作者发邮件,不胜感激!

更多设计思想,请关注微信公众号: 软件设计活跃区

为了我们能够相互了解,更好的为你服务,你可以到以下地址登录使用情况. https://github.com/automvc/bee/issues/43
https://gitee.com/automvc/bee/issues/I3PIUJ
完成登记的伙伴,请加QQ群(992650213),可找群主领企业级生产环境建议相关资料!

为了能及时解答大家的疑问,可以加入Bee的技术QQ群:992650213

同时,也欢迎你加入到Bee框架的开发之中,相信有你的加入,Bee会更加美好!

Apache License Version 2.0, January 2004 http://www.apache.org/licenses/ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION 1. Definitions. "License" shall mean the terms and conditions for use, reproduction, and distribution as defined by Sections 1 through 9 of this document. "Licensor" shall mean the copyright owner or entity authorized by the copyright owner that is granting the License. "Legal Entity" shall mean the union of the acting entity and all other entities that control, are controlled by, or are under common control with that entity. For the purposes of this definition, "control" means (i) the power, direct or indirect, to cause the direction or management of such entity, whether by contract or otherwise, or (ii) ownership of fifty percent (50%) or more of the outstanding shares, or (iii) beneficial ownership of such entity. "You" (or "Your") shall mean an individual or Legal Entity exercising permissions granted by this License. "Source" form shall mean the preferred form for making modifications, including but not limited to software source code, documentation source, and configuration files. "Object" form shall mean any form resulting from mechanical transformation or translation of a Source form, including but not limited to compiled object code, generated documentation, and conversions to other media types. "Work" shall mean the work of authorship, whether in Source or Object form, made available under the License, as indicated by a copyright notice that is included in or attached to the work (an example is provided in the Appendix below). "Derivative Works" shall mean any work, whether in Source or Object form, that is based on (or derived from) the Work and for which the editorial revisions, annotations, elaborations, or other modifications represent, as a whole, an original work of authorship. For the purposes of this License, Derivative Works shall not include works that remain separable from, or merely link (or bind by name) to the interfaces of, the Work and Derivative Works thereof. "Contribution" shall mean any work of authorship, including the original version of the Work and any modifications or additions to that Work or Derivative Works thereof, that is intentionally submitted to Licensor for inclusion in the Work by the copyright owner or by an individual or Legal Entity authorized to submit on behalf of the copyright owner. For the purposes of this definition, "submitted" means any form of electronic, verbal, or written communication sent to the Licensor or its representatives, including but not limited to communication on electronic mailing lists, source code control systems, and issue tracking systems that are managed by, or on behalf of, the Licensor for the purpose of discussing and improving the Work, but excluding communication that is conspicuously marked or otherwise designated in writing by the copyright owner as "Not a Contribution." "Contributor" shall mean Licensor and any individual or Legal Entity on behalf of whom a Contribution has been received by Licensor and subsequently incorporated within the Work. 2. Grant of Copyright License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable copyright license to reproduce, prepare Derivative Works of, publicly display, publicly perform, sublicense, and distribute the Work and such Derivative Works in Source or Object form. 3. Grant of Patent License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable (except as stated in this section) patent license to make, have made, use, offer to sell, sell, import, and otherwise transfer the Work, where such license applies only to those patent claims licensable by such Contributor that are necessarily infringed by their Contribution(s) alone or by combination of their Contribution(s) with the Work to which such Contribution(s) was submitted. If You institute patent litigation against any entity (including a cross-claim or counterclaim in a lawsuit) alleging that the Work or a Contribution incorporated within the Work constitutes direct or contributory patent infringement, then any patent licenses granted to You under this License for that Work shall terminate as of the date such litigation is filed. 4. Redistribution. You may reproduce and distribute copies of the Work or Derivative Works thereof in any medium, with or without modifications, and in Source or Object form, provided that You meet the following conditions: (a) You must give any other recipients of the Work or Derivative Works a copy of this License; and (b) You must cause any modified files to carry prominent notices stating that You changed the files; and (c) You must retain, in the Source form of any Derivative Works that You distribute, all copyright, patent, trademark, and attribution notices from the Source form of the Work, excluding those notices that do not pertain to any part of the Derivative Works; and (d) If the Work includes a "NOTICE" text file as part of its distribution, then any Derivative Works that You distribute must include a readable copy of the attribution notices contained within such NOTICE file, excluding those notices that do not pertain to any part of the Derivative Works, in at least one of the following places: within a NOTICE text file distributed as part of the Derivative Works; within the Source form or documentation, if provided along with the Derivative Works; or, within a display generated by the Derivative Works, if and wherever such third-party notices normally appear. The contents of the NOTICE file are for informational purposes only and do not modify the License. You may add Your own attribution notices within Derivative Works that You distribute, alongside or as an addendum to the NOTICE text from the Work, provided that such additional attribution notices cannot be construed as modifying the License. You may add Your own copyright statement to Your modifications and may provide additional or different license terms and conditions for use, reproduction, or distribution of Your modifications, or for any such Derivative Works as a whole, provided Your use, reproduction, and distribution of the Work otherwise complies with the conditions stated in this License. 5. Submission of Contributions. Unless You explicitly state otherwise, any Contribution intentionally submitted for inclusion in the Work by You to the Licensor shall be under the terms and conditions of this License, without any additional terms or conditions. Notwithstanding the above, nothing herein shall supersede or modify the terms of any separate license agreement you may have executed with Licensor regarding such Contributions. 6. Trademarks. This License does not grant permission to use the trade names, trademarks, service marks, or product names of the Licensor, except as required for reasonable and customary use in describing the origin of the Work and reproducing the content of the NOTICE file. 7. Disclaimer of Warranty. Unless required by applicable law or agreed to in writing, Licensor provides the Work (and each Contributor provides its Contributions) on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied, including, without limitation, any warranties or conditions of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A PARTICULAR PURPOSE. You are solely responsible for determining the appropriateness of using or redistributing the Work and assume any risks associated with Your exercise of permissions under this License. 8. Limitation of Liability. In no event and under no legal theory, whether in tort (including negligence), contract, or otherwise, unless required by applicable law (such as deliberate and grossly negligent acts) or agreed to in writing, shall any Contributor be liable to You for damages, including any direct, indirect, special, incidental, or consequential damages of any character arising as a result of this License or out of the use or inability to use the Work (including but not limited to damages for loss of goodwill, work stoppage, computer failure or malfunction, or any and all other commercial damages or losses), even if such Contributor has been advised of the possibility of such damages. 9. Accepting Warranty or Additional Liability. While redistributing the Work or Derivative Works thereof, You may choose to offer, and charge a fee for, acceptance of support, warranty, indemnity, or other liability obligations and/or rights consistent with this License. However, in accepting such obligations, You may act only on Your own behalf and on Your sole responsibility, not on behalf of any other Contributor, and only if You agree to indemnify, defend, and hold each Contributor harmless for any liability incurred by, or claims asserted against, such Contributor by reason of your accepting any such warranty or additional liability. END OF TERMS AND CONDITIONS APPENDIX: How to apply the Apache License to your work. To apply the Apache License to your work, attach the following boilerplate notice, with the fields enclosed by brackets "[]" replaced with your own identifying information. (Don't include the brackets!) The text should be enclosed in the appropriate comment syntax for the file format. We also recommend that a file or class name and description of purpose be included on the same "printed page" as the copyright notice for easier identification within third-party archives. Copyright [yyyy] [name of copyright owner] Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

简介

Bee,互联网新时代的Java ORM框架,支持Sharding;JDBC,Android,HarmonyOS;支持多种关系型数据库,还支持NoSQL的Cassandra,Mongodb等;更快、更简单、更自动,开发速度快,运行快,更智能! 展开 收起
Java
Apache-2.0
取消

贡献者

全部

近期动态

加载更多
不能加载更多了
Java
1
https://gitee.com/automvc/bee.git
git@gitee.com:automvc/bee.git
automvc
bee
bee
master

搜索帮助