A simple ORM framework, support database sharding.
Do you agree that Hibernate suck, too complex and not support database sharding? If yes, ARConn is your best alternative.
- Simple, small code base, easy to learn API
- Active Record design pattern
- Database sharding, ARconn simplify multi-database access.
- Reuse jdbc connections when you access different db on the same mysql instance.
- Reverse engineering tool for generating pojo from database.
Connection jdbcConn = fetchConntion();//create or fetch a jdbc connection
String dbName = chooseDatabase();// choose the database
ARConn conn = new ARConn( jdbcConn, dbName);
try{
TblMail mail = conn.create(TblMail.class);
mail.setSender("[email protected]");
mail.setReceiver("[email protected]");
mail.setSubject("test");
mail.insert(); //insert to db
TblMail mail_ = conn.find(TblMail.class, 1L); // find by primary key
mail_.setBcc("[email protected]");
mail_.update(); //update db
List<TblMail> mailList1 = conn.findAll(TblMail.class, "sender", "[email protected]");
List<TblMail> mailList2 = conn.queryAll(TblMail.class, " sender = [email protected] ");
}finally{
conn.close();
}
To build the JAR file of DbPojo, you need to install Maven (http://maven.apache.org), then type the following command:
$ mvn package
To generate project files (.project, .classpath) for Eclipse, do
$ mvn eclipse:eclipse
then import the folder from your Eclipse.
======== Please feel free to contact me([email protected]) if you have any questions.