当前位置:网站首页>Bee framework, an ORM framework that can be learned in ten minutes --bee

Bee framework, an ORM framework that can be learned in ten minutes --bee

2022-06-22 08:15:00 abckingaa

Bee  It's a ORM frame . Focus on : To save time / grace 、 Simple and easy 、 Automatically ( Tea: Timesaving/Tasteful, Easy, Automatic) characteristic . Reduce the amount of coding for developers , Just for one purpose -- Let others stop calling us code farmers ! Give Way Bee Become the tea of endless aftertaste in the hands of software engineers ! sample tea , Product software !

Bee More than others JAVA Of ORM frame , class ORM The framework should be easy to use , Easy to use . You can learn to use it in ten minutes . And for many new requirements, there is no need to add interfaces or change sql The configuration file .Bee Of Coding complexity by O(1).

If a worker wants to do a good job, he must sharpen his tools first !——《 The analects of Confucius · Wei linggong 》

Bee Introduction to main functions and features :

Bee Simple concept (10 Minutes to get started )、 Powerful .
Bee  Simplify and DB Interactive coding workload . Connect , Transactions can be handled by Bee The framework is responsible for managing .

To save time , Fast development speed

Simple and easy to use

  • 1. The interface is simple , Easy to use .Suid The interface corresponds to SQL Linguistic select,update,insert,delete Operation provides 4 A method with the same name .
  • 2. Used Bee, You don't have to write anything else dao Code , Call directly Bee Of api To complete the DB The operation of .
  • 3. Convention over configuration :Javabean There is no comment , Don't need to, xml The mapping file , It's just pure Javabean that will do , even to the extent that get,set The method is not necessary .
  • 4. Intelligent automatic filtering null And empty string , No longer need to write code to judge non empty .
  • 5. Support Query only part of the fields .

Automatically , Powerful work

  • 6. dynamic / Arbitrary combination Query criteria , There's no need to prepare in advance dao Interface , There is no need to modify or add interfaces when there are new query requirements .
  • 7. Support native SQL Sort ,  Native statement paging ( There's no need to look up all the data ).
  • 8. Support Go straight back to Json Format query results ; Chain programming .
  • 9. Support Business 、 Multiple ORM The operation uses the same connection 、for update, Support The batch operation , Support native SQL( Customize sql sentence ), Support stored procedure .
  • 10. Support object-oriented complex query 、 Multi-table query ( nothing n+1 problem ; Support : one-on-one , One to many , For one more , Many to many ).
  • 11. First level cache , Simple concept , Powerful ; L1 cache can also image JVM Fine grained tuning as well ; Support updatable long-term cache list , Update configuration table , No need to reboot .
  • 12. Table name and entity name 、 The mapping between field name and attribute name provides multiple implementations by default , And support Custom mapping rule extension .
  • 13. Varied DB Support easy expansion (MySQL,MariaDB,Oracle,H2,SQLite,PostgreSQL,SQL Server And so on ).
  • 14. Support Read / write separation One master, many followers , only sub-treasury etc. Multiple data sources Pattern ( There is no need to modify the previous code , This function is transparent to the code , That is, no additional coding is required ), Multiple types of databases can be used at the same time .
  • 15. Distributed Generate... In an environment Continuously monotonically increasing ( In a workerid Inside ), Globally unique Numbers id; Provide a natural and simple distributed primary key generation method .
  • 16. Support the same database sub table , Dynamic table name mapping .
  • 17. You don't need the corresponding table Javabean Can also operate DB.
  • 18. nothing Third party plug-ins depend on ; It can be used with zero configuration .
  • 19. Good performance : near JDBC The speed of ; The file is small :Bee V1.8 jar only 217kV1.9.5 jar, only 315k.
    Auxiliary function :
  • 20. Support automatic generation of the corresponding table Javabean, according to Javabean Create table ,Javaweb Back end code according to The template is generated automatically ; Can print non placeholder Executable sql, Convenient debugging .
  • 21. Support Read Excel, from Excel Import data to DB, It's easy to operate .

Bee Open source , Open source address

GitHub - automvc/bee: Bee is an AI, easy and high efficiency ORM framework.

Bee At the code cloud website :
bee: The new era of the Internet Java ORM Tools , Simple 、 Efficient , Fast development speed !

It also provides a lot of information related to SpringMVC, Spring Boot Related examples of ( Please check out : Comprehensive application part )

The following is a detailed introduction :

The latest version V1.9.8  (2021-11)

V1.9.5  (2021-05)

Detailed and complete function introduction

Click on the link to view Detailed and complete function introduction

ORM Compare

ORM-Compare

Test environment : Windows.
database : MySQL (Version 5.6.24).
Test point : Batch insert ; Paging query ; Business (update and select).

 

Batch insert ( Company : ms)

 5k1w2w5w10w
Bee529.00458.33550.001315.674056.67
MyBatis11937131292.671824.33Exception

Paging query ( Company : ms)

 20 Time 50 Time 100 Time 200 Time 500 Time
Bee17.3358.6752.3338.3357.33
MyBatis314.33446.001546.002294.336216.67

Business (update and select) ( Company : ms)

 20 Time 50 Time 100 Time 200 Time 500 Time
Bee1089.0070.0084.00161.3331509.33
MyBatis11443579.67146.0032155.33

Quick start :

1. introduce Bee

1.1 maven engineering , Add the following dependencies

        <dependency>
			<groupId>org.teasoft</groupId>
			<artifactId>bee</artifactId>
			<version>1.9.8</version>
		</dependency>
		<dependency>
			<groupId>org.teasoft</groupId>
			<artifactId>honey</artifactId>
			<version>1.9.8</version>
		</dependency>
		<!--for log framework,Excel(poi) -->
		<dependency>
			<groupId>org.teasoft</groupId>
			<artifactId>bee-ext</artifactId>
			<version>1.9.8</version>
		</dependency>

1.2 It can also be downloaded directly jar file

2. Create databases and tables

Examples are as follows :
Create a database , The default name is bee.
It can be used init-data(user-orders)-mysql.sql Scripts create tables and insert initialization data .

3. Update the configuration information of the database ( stay bee.properties)

notes : If not bee.properties file , You can create a new .
You can also configure data sources ( This is just an example ).

//#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.username = root
bee.db.password =

4. Generate Javabean Orders May refer to :

Orders(Javabean)
Auto Genernate Javabean

5. Run the following java Code

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

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

/**
 *  check , Change , increase , Delete  Suid (select,update,insert,delete) example 
 * @author Kingstar
 * @since  1.0
 */
public class SuidExam {
	
	public static void main(String[] args) {

		Suid suid=BeeFactoryHelper.getSuid();
		
		// You need to become the corresponding Javabean
		Orders orders1=new Orders();
		orders1.setId(100001L);
		orders1.setName("Bee(ORM Framework)");
		
		//1:select Query instance 
		// Default not to handle null And empty string . No more judgments ; All other fields with values are automatically used as filtering conditions 
		List<Orders> list1 =suid.select(orders1);  //select
		for (int i = 0; i < list1.size(); i++) {
			System.out.println(list1.get(i).toString());
		}
		
		//2:update Update instance 
		orders1.setName("Bee--ORM Framework");
		// By default, only the fields that need to be updated are updated .  By default, only id Field , Other requirements are available SuidRich The method in .
		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  Insert instance 
		int insertNum=suid.insert(orders2); //insert  		
		// Default not to handle null And empty string . No more judgments ; All other fields with values are automatically inserted into the database . 
		// Easy to combine DB interpolation , Such as id Automatic growth , from DB Insert ;createtime from DB Default insert 
		System.out.println("insert record:"+insertNum);
		
		//4:delete  Delete the instance 
		// Default not to handle null And empty string . No more judgments ; All other fields with values are automatically used as filtering conditions 
		//int deleteNum=suid.delete(orders2);   //delete
		//System.out.println("delete record:"+deleteNum);
		
	}
}
// Be careful :  Business , Pagination , Sort , Range queries , The query results directly return json Such as support , Here is just an introductory example .
// More application reference , Please check out :  More examples     and      Comprehensive application  .

More examples / The test case

Bee+Spring-boot Demo

Comprehensive application :

Java Rapid programming , Give Way Java The development speed of php and Rails.

Faster development Java Web A new combination of
Bee+Spring+SpringMVC
Including only sub database multi data source instances

Bee+Spring+SpringMVC Develop school educational administration management and score management system

Faster development Spring Cloud A new combination of microservices
Bee + Spring Boot

......

FAQ common problem

Click on the link to view FAQ common problem

E-mail address of the author email: [email protected]

If you have any suggestions , Welcome to email the author , Thank you for !

In order to answer your questions in time , You can join Bee Technology QQ Group :992650213

meanwhile , You are also welcome to join Bee The development of the framework , I believe you will join us ,Bee It will be better !

          Long press the QR code to follow

         More articles are waiting for you !

原网站

版权声明
本文为[abckingaa]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/02/202202220529316168.html