db4o????????????????
???????????? ???????[ 2013/5/31 10:13:34 ] ????????
????db4o(database for object ) ????????????????????????.
?????????к???????????????????ù????ORM???????.
????????ORM???к???????:
????"??????洢?????????δ??????????????????????????????????????????????????????????????????? ORM ?????????????????????????????????? ORM ?????????????????????鷳??ì????????????? Hibernate ???????????????????????????????????????“????????????????? SP ???????? CRUD ???? Hibernate ”???????????? BearingPoint ????????????"
????????db4o ??????μ?????????orm???????...
???????????????????????????????????ī????:????????? ?????????????????????????????.
???????????????????.for JDKV1.4?????С???600??k????????????????????????????????????~~~
??????????????????????:
????1- ???????????: www.db4o.com ??????????????????μ?汾??
????2- object manager:?????????????????????????UI???????? www.db4o.com ???????????????汾??
????3- ???????? db4o??Ч???????? ORM???????????:
????"db4o ????????????????????db4o ????? Hibernate/MySQL ???????Щ??????·??????? 44 ?????????????????????? 400Kb ????? .jar ?? .dll ???????"
???????滹??????????????????:
???????????????????????3???Ч???????????!
public class TestDb4o {
private static ObjectContainer db = null;
public static void main(String args[]){
openLocalDb();
System.out.println("--running--");
//queryForQBE(db);
//queryForSODA(db);
queryForNQ(db);
closeDb();
//openServer(1233??"admin"??"1");
//System.out.println("--running--");
}
public static void queryForNQ(ObjectContainer ocdb){
List list = db.query(
new Predicate() {
public boolean match(Car car) {
return car.getColor().equals("BLUE");
}
}
);
outPutList(list);
}
public static void queryForSODA(ObjectContainer ocdb){
Query q = ocdb.query();
q.constrain(Car.class);
q.descend("name").constrain("????");
List l = q.execute();
outPutList(l);
}
/**
* QBE?????? : Query By Example
* @param ocdb
*/
public static void queryForQBE(ObjectContainer ocdb){
Car car = new Car();
car.setColor("BLUE");
List l = ocdb.get(car);
outPutList(l);
}
public static void outPutList(List list){
for(Iterator it=list.iterator();it.hasNext();){
Car c = (Car)it.next(); //5.0 ???????????
System.out.println(c);
}
}
/**
* ???????
* @param port
* @param userName
* @param password
*/
public static void openServer(int port??String userName??String password){
ObjectServer server=Db4o.openServer("D:/DB4O_TDB01.yap"??port);
server.grantAccess(userName??password);
server.openClient();
}
/**
* ??????
* @param IPaddress
* @param userName
* @param password
* @param port
*/
public static void openClient(String IPaddress??String userName??String password??int port){
try {
db=Db4o.openClient(IPaddress??port??userName??password);
} catch (IOException e) {
e.printStackTrace();
}
}
/**
* ???????
*
*/
public static void openLocalDb(){
db = Db4o.openFile("D:/DB4O_TDB01.yap");
}
/**
* ????
*
*/
public static void closeDb(){
if(db!=null) db.close();
}
}
??????
???·???
??????????????????
2023/3/23 14:23:39???д?ò??????????
2023/3/22 16:17:39????????????????????Щ??
2022/6/14 16:14:27??????????????????????????
2021/10/18 15:37:44???????????????
2021/9/17 15:19:29???·???????·
2021/9/14 15:42:25?????????????
2021/5/28 17:25:47??????APP??????????
2021/5/8 17:01:11