Skip to content

ChenProgramer/babyfish

 
 

Repository files navigation

What is BabyFish?

1. A Java framework for data model classes.

2. An enhancement of JPA/Hibernate.

By the way, "BabyFish" is a Chinglish word, it means "Andrias davidianus". Its voice sounds like the baby's cry, that why Chinese call it "BabyFish". ^ω^

How to run and learn it

  • Please view "tutorial.docx"(not finished) or "tutorial_zh_CN.docx" to understand it in short time.
  • Please view get-started.html to install and run it.
  • Please view demo/demo-guide.html to learn it, that document describe all the demos and give a suggestion for learning order.

Fastest way to learn it

This framework is big so it need some time to know all the functionalities. If the time or interest is not enough so that you want to know only the most important functionalities of BabyFish in least possible time. You can learn 4 UnitTest classes

  • ${babyfish-dir}/demo/babyfishdemo-om4java/src/test/java/org/babyfishdemo/om4java/l2ir/ObjectModelOfListAndIndexedReferenceTest.java
  • ${babyfish-dir}/demo/babyfishdemo-spring/src/test/java/org/babyfishdemo/spring/dal/QueryPathTest.java
  • ${babyfish-dir}/demo/babyfishdemo-xcollection/src/test/java/org/babyfishdemo/xcollection/uce/UnstableCollectionElementsTest.java
  • ${babyfish-dir}/demo/babyfishdemo-macollection/src/test/java/org/babyfishdemo/macollection/bubble/SimpleBubbleEventTest.java

Functionalities

A. Java Part

  • Event combiner: support .NET style event notification mechanism.
  • Typed-18N: support strong type "18N" which can report the I18N errors at compilation time.
  • X-Collection-Framework: Enhance the Java Collection Framework. The most important functionality is "Unstable Collection Elements", element/key can be modified after it has been added into set(map) because the corresponding sets/maps will be adjusted automatically when it's changed.
  • MA-Collection-Framework: Enhance the X-Collection-Framework to let collections support modification notification like the trigger of database. The most important functionality is "Bubbled Event", If the modification event has been triggered by iterator or view(eg: List.subList, SortedMap.subMap), it will bubbled to its parent view, util the original root collection triggered the event.
  • ObjectModel4Java: A powerful API to create Java model classes, it supports the bidirectional association between objects. When one side bidirectional association is changed, the other side will be notified and adjusted automatically. User only need to declared some annotations and all the functionalities will be implemented by the byte-code generated dynamically in runtime.

B. ORM Part

  • ObjectMode4JPA: Enhance ObjectModel4Java. let ObjectModel support JPA entity classes.
  • Replace the lazy proxy and lazy collection of Hibernate to support ObjectModel with laziness management.
  • Support Maven plugin to change the byte-code of entity class at compilation time, programmer only need to write the simple JPA entity classes, and complex code for the ObjectMode4JPA can be added into entity classes automatically during compilation.
  • BabyFish-JPA-Criteria: A smarter implementation of JPA Criteria, it supports more functionalities, and it can optimize the generated JPQL.
  • QueryPath: Its source code is generated by maven plugin at compilation time so that all the errors can be report at compilation time. It can be decided by UI Layer dynamically, then dispatch it to Business Logic Layer, and finally dispatch it to the Data Access Layer. In Data Access Layer, it can
  • Fetch lazy associations dynamically with any depth and breadth
  • Fetch lazy scalar associations(eg: Lob) dynamically
  • Sort the query result or collection association dynamically with any depth and breadth
  • DistinctLimiQuery: Enhance the Oracle Dialect of Hibernate to resolve a problem of Hibernate, In hibernate, when paging query(with firstResult/maxResults) contains collection fetches, hibernate has to query all the data and do the paging filter in memory. This functionality can resolve this problem when database is Oracle.

license: LPGL3.0

BabyFish uses the LGPL-3.0 license so that it can be used in commercial projects, please see http://opensource.org/licenses/LGPL-3.0 to know more.

Thanks

Thank two great frameworks: ASM and ANTLR

Video resources

Chinese videos:

English videos:

History

  • Aug 2008: I have some ideas, I decided to create an open source framework by using all of my spare time.
  • Oct 2015: This first version 1.0.0.Alpha is finished, and it's published on github.

About me

Tao Chen(Chinese Name: 陈涛), babyfish-ct@163.com

2015-10-11, ChengDu, China

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Java 94.8%
  • HTML 2.7%
  • JavaScript 2.2%
  • C++ 0.2%
  • PLSQL 0.1%
  • Batchfile 0.0%