Easy for Stronger.
Bee is an ORM framework.
Bee is an easy and high efficiency ORM framework.
Coding Complexity is O(1),it means that Bee will do the Dao for you.
You don't need to write the Dao by yourself anymore.Help you to focus more on the development of business logic.
Good Feature: AI, Timesaving/Tasteful, Easy, Automatic (AiTeaSoft Style)
Bee see:
https://github.com/automvc/bee
jdk1.7+
Support many Database(MySQL,MariaDB,Oracle,H2,SQLite,PostgreSQL,SQL Server,Cassandra and so on) and easily extend.
Good performance, close to the speed of JDBC; Small files:Bee V1.8 jar 217k, V1.9.5 jar,315k, V1.9.8 jar 310k.
- 1.The interface is simple and easy to use, Suid (select,update,insert,delete) object-oriented operation.
- 2.All Suid(select,update,insert,delete) operation use the same Bee interface,no longer need new dao interface.
- 3.Convention-over-configuration:Javabean can no annotation,no xml.
- 4.Automatic filter the null and empty field for default.
- 5.Select some fields easily.
- 6.Dynamic & random combination of query conditions,no need to prepare the interface in advance; new query requirements, no need to change the query interface.
- 7.Native SQL sort support,native paging support(do not need select all records before).
- 8.Support return the JSON format query results directly; Chain programming.
- 9.Support:transaction ,same connection,for update,batch insert,procedure.
- 10.more tables select oriented object support(has not the n+1 problem,one to one,one to many,many to one,many to many).sub-field type support Javabean or List.
- 11.L1 cache, simple in concept and powerful in function; L1 cache can also be fine tuned like the JVM; Support updatable long-term cache list and update configuration table without restart. Inherently resistant to cache penetration. L2 cache extension support; Redis L2 cache support.
- 12.Support java_db naming translation and support customize,default implement.
- 13.Many DB supports easy extension(MySQL,MariaDB,Oracle,H2,SQLite,PostgreSQL,SQL Server,Cassandra,etc. are directly available),In theory, can support all DB which support JDBC.
- 14.Add multi-DataSource support(Write/Read, only Split Database);support Jndi DataSource.
- 15.Support use many type database at the same time(eg: use Mysql,Oracle,SQL Server at the same).
- 16.Support distributed primary key(global unique id,Serial distributed unique id in one workid).
- 17.The same database sub table support, dynamic table name mapping support.
- 18.Support interceptor、multi-tenant,convert PreparedStatement parameter,custom TypeHandler and process the ResultSet.
- 19.Suid,SuidRich,PreparedSql,MapSuid,MoreTable support set the dataSource name.
- 20.MapSuid:opertate(suid) the database no need Javabean.
- 21.No third-party plug-in dependency; It can be used in zero configuration.
- 22.Good performance, close to the speed of JDBC; Small files:Bee V1.8 jar 217k, V1.9.5 jar,315k, V1.9.8 jar 310k.
Assist function: - 23.Automatically generate the Javabean via DB table or view.Automatically create table via the Javabean,JavaWeb back-end code;Can print non placeholder executable SQL statements to facilitate debugging; support generate JSON format SQL scripts.
- 24.Support reading excel and importing data from Excel to DB easily.
- 25.Stream tool class streamutil.
- 26.The front and back ends of complex queries can be automatically parsed.
- 27.Annotation support:PrimaryKey,Datetime,Createtime,Updatetime;JustFetch,ReplaceInto(MySQL).
- 28.Extensible annotation: multi tenant, fuzzy processing of sensitive information, automatic setting of field values, dictionary conversion, dicti18n multilingual International Dictionary conversion, column name and field name mapping.
V1.11
V1.11.0.1.1(2022 New Year)
SuidRich add method:
public long insertAndReturnId(T entity,IncludeType includeType);
PreparedSql add method:
public List select(String sql,T returnType);
add annotation PrimaryKey
MapSqlKey support PrimaryKey
BF is shortcut for BeeFactoryHelper
Enhance:config info add trim() about multi-DataSource Write/Read
fix a bug for naming transfer
V1.11.0.2.1(2022 Spring Festival)
add function: Interceptor、multi-tenant
add Interceptor,InterceptorChain
add DefaultInterceptor,CommInterceptorChain,DefaultInterceptorChain
V1.11.0.2.4(2022 Beijing Winter Olympics)
level tow ext cache support
Redis cache support
add BeeExtCache,DefaultBeeExtCache
add BeeExtRedisCache
V1.11.0.2.15(2022 the Lantern Festival)
add annotation:Datetime,Createtime,Updatetime;JustFetch
add support Jndi DataSource
check MapSqlKey value
V1.11.0.2.20(Honor)
Optimize use different Database Type at same time(multi-Ds)
Support use differnt type Database at the same time(eg:use Mysql,Oracle,SQL Server at same time)
PreparedSql,MapSuid support Interceptor
Suid,PreparedSql,MapSuid support get DataSource,get InterceptorChain
Suid,PreparedSql,MapSuid,MoreTable add method:setDataSourceName,getDataSourceName,getInterceptorChain
add Annotation:
AnnotationHandler,AutoSetString
Desensitize
ReplaceInto,MySQL replace into
MultiTenancy
BeforeReturnAnnotationHandler,AbstractDictI18nDefaultHandler
Dict
DictI18n
V1.11.0.2.28 (Special Day)
add ShardingStruct prepare for sharding.
add Column annotation support to extend mapping column and Javabean field name.
support custom TypeHandler,and process the ResultSet.
PreparedSql custom sql support more table select,and return more table struct Javabean.
fixed bug:
More table self association query of the same entity forbid multi-self-cycles
V1.11.0.3.8 (Lady First)
add SetParaTypeConvert for convert PreparedStatement parameter.
Javabean use java.util.Date type for SUID compatibility processing.
SQLite get the timestamp result for conversion.
The Json field of DB is automatically converted to the attribute marked with Json annotation of Javabean(Javabean structure corresponding to Json).
V1.11.0.3.12 (Tree Planting Day)
Ddl.java uses Javabean to create tables, supports the mapping between Java and DB field types, and supports the setting java_dbtype mapping.
Ddl.java is compatible with raw char type and java.util.Date.
PreparedSql support batch insert.
Support Suid instance set NameTranslate.
Add DbFeature Registry,it is easy for setting custom database dialect.
Support Cassandra.
V1.11.0.3.20 (Spring Equinox)
add Custom dynamic SQL token,@in,@toIsNULL1,@toIsNULL2,<if isNotNull>,<if isNotBlank>.
dynamic SQL list transfer list to SQL in eg:in (1,2,3),no need foreach;batch insert also no need foreach.
Separate CN and EN API.
V1.11.0.4.22 (The World Earth Day)
Add registry interface; Add nameregistry.
Change serializer throws exceptions type.
Mapsuid and mapsql support parsing string to boolean type.
Genbean, which does not support JDBC type, reminds you which file to set;
Genbean support config where override the old file;
Genbean support gen javabean's field file;
SuidRich's method selectString support variable-length arguments:
public List<String[]> selectString(T entity,String... selectFields);
CommInterceptorChain check whether add same class.
SystemLogger supports setting log level to facilitate development and debugging.
The logger add method: public static void debug (string MSG, throwable T) (convenient for development and debugging).
Nocache add log prompt.
Improve cache security.
Add preload SPI interface Preload.
Add InterceptorChainRegistry, an interceptor registrar for global use.
Add configuration item:
pagingWithLimitOffset
notCatchModifyDuplicateException
notShowModifyDuplicateException
fixed bug for type converter.
fixed bug about @PrimaryKey in Suid update(entity).
Test Evn : Local windows.
DB: MySQL (Version 5.6.24).
Test point: Batch Insert;Paging Select; Transaction(update and select).
Batch Insert(unit: 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 |
Paging Select(unit: 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 |
Transaction(update and select) (unit: 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 need files
orm\compare\bee\service\BeeOrdersService.java
MyBatis need files
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
common,Javabean and Service interface:
Orders.java
OrdersService.java
<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>
eg:
Create one database,default name is bee.
Create the tables and init the data by run the init-data(user-orders)-mysql.sql file(it is mysql sql script).
If no the bee.properties file, you can create it by yourself.
#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 =
Orders(Javabean)
Auto Genernate Javabean
import java.math.BigDecimal;
import java.util.List;
import org.teasoft.bee.osql.BeeException;
import org.teasoft.bee.osql.Suid;
import org.teasoft.honey.osql.core.BeeFactoryHelper;
import org.teasoft.honey.osql.core.Logger;
/**
* @author Kingstar
* @since 1.0
*/
public class SuidExamEN {
public static void main(String[] args) {
try {
Suid suid = BeeFactoryHelper.getSuid();
Orders orders1 = new Orders();//need gen the Javabean
orders1.setId(100001L);
orders1.setName("Bee(ORM Framework)");
List<Orders> list1 = suid.select(orders1); // 1. select
for (int i = 0; i < list1.size(); i++) {
Logger.info(list1.get(i).toString());
}
orders1.setName("Bee(ORM Framework)");
int updateNum = suid.update(orders1); //2. update
Logger.info("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
int insertNum = suid.insert(orders2); // 3. insert
Logger.info("insert record:" + insertNum);
int deleteNum = suid.delete(orders2); // 4. delete
Logger.info("delete record:" + deleteNum);
} catch (BeeException e) {
Logger.error("In SuidExamEN (BeeException):" + e.getMessage());
e.printStackTrace();
} catch (Exception e) {
Logger.error("In SuidExamEN (Exception):" + e.getMessage());
e.printStackTrace();
}
}
}
// notice: this is just a simple sample. Bee suport transaction,paging,complicate select,slect json,and so on.
Let Java more quicker programming than php and Rails.
Faster development of new combinations for Java Web:
Bee+Spring+SpringMVC
Faster development of new combinations for Spring Cloud microservices:
Bee + Spring Boot
...