2017.06.15

来源:互联网 发布:免费记忆力训练软件 编辑:程序博客网 时间:2024/05/21 10:31
mybatis:
http://www.cnblogs.com/xdp-gacl/category/655890.html
1.basic CRUD
create database
congif.xml  to config datasources,
create entity  refer to tables
mapping.xml to define sql 
add mapping.xml to config.xml
load config.xml in java to call sql in mapping.xml
2.deal clash between cloumn and attribute
2.1.use alias replace cloumn on table by object's attribute
2.2.use <resultMap> to rename
3.mybatis Related inquiries
3.1.one to one
table:
one table keep fk refer to another table.
object:
the table who keep a foriegn key that the object is keep an object who containt the fk.
select result is use association to mapping columns'value to the object who the fk refer to own attribute.
3.2.one to many
table:
one do not change anything.
many keep a foreign key refer to one's id
object:
one is keep a list that containted object like many.
many does not keep foreign key's attribute in class.
select result:
use <collection> to mapping select result to list. 
4.mybatis redis:
first cache:default open by session
second cache:sessionFactory cache.


Hibernate:cfg.xml need to load by ourself in code but struts and spring will config in web.xml
http://www.cnblogs.com/zhengcheng/p/5014246.html
1.basic:main file:hibernate.cfg.xml,student.hbm.xml
Configuration cf = new Configuration().configure();//create configuration
SessionFactory sf= cf.buildSessionFactory();//create SessionFactory
Session session = sf.openSession();//create session
public List<Student> qureyAll() {
String hql = "from student";
Query query = session.createQuery(hql);//don't begin transation
list = query.list();
}
public Student queryOne(String stuNo){
stu = session.load(Student.class,stuNo);
}
public void add(Student stu) {//add,update,delete need transation
Transation tx;
try{
tx = session.beginTransation();
session.save(stu);
tx.commit();
}catch(Exception e){
tx.rollback();
}finally{
session.close();
}
}
public void update(String stuNo,Student newStu){
tx = session.beginTransation();
Student stu = session.load(Student.class,stuNo);//first to find the object by id
stu.setName(newStu.getName());//change value for attributes
...
session.save(stu);//save
tx.commit();//commit or rollback
}
public void delete(String stuNo){
tx = session.beginTransation();
stu = session.load(Student.class,stuNo);
session.delete(stu);
tx.commit();
}

springMVC:
1.basic demo
1.1.create springmvc.xml:scan controller class under backage.
1.2.add servlet and servlet mapping to web.xml to interceptor request.
1.3.create controller class use @Controller and @RequestMapping tab and return modelAndView. 
2.springmvc's annotates
@RequestMapping
@Controller
@PathVariable:receive data from url like http://localhost:8080/springmvc/hello/1
the class annotate like @RequestMapping("/hello/{id}"),and formal param annotate like @PathVariable(value="id") String id
@RequestParam
receive data like http://localhost:8080/springmvc/hello?id=1 that containt key and value mapping.









Linux:
1.ls -al / ll /
2.cd ~/ cd ../  ~:show current user's load
3.pwd
4.mkdir -pv /abc/123.txt     p:creat parent dir if not exit./v:show detail
5.rmdir
6.cat install.log
 more /root/install.log
7.less -mN /root/install.log   N:show line number
8.cp -r /root/install.log /root/temp.log
9.mv -f /root/temp /root/install.log     f:force to corver the old file
10.rm /root/install.log        rm a file
  rm -rf /root    force to rm a dir by r
11.find /root/ -name 'test*'
12.vi install.log
           i to input and exit to out,:wq is to exit vi
13.grep -i context /root/install.log/     seach containt "context" content in install.log.
  cat /root/install/log | grep -i control    filter that containt "control" base on out of cat install.log
    SYS.ORDER
14.ps aux | grep -i ping       show current thread's msg and filter that containt "ping" String.
  ps -ef | grep -i ping       i:ignore-case
15.kill -l     show all running programming
  kill -9 pid     kill the 9 program
16.ifconfig        equal win's ipconfig
17.ping 192.168.0.1
18.tar -zcvf /root/itheima.tar /root/itheima/               create
  rm -rf /root/ithrima/                      romove the dir first then to extract
  ll | grep -i itheima                       query by filter
  tar -zxvf /root/ithemia.tar                extract
19.reboot            restart
  halt              colse the power 
20.chmod u-rwx /root/install.log        cancle the all the power who's the user of this file.
  chmod g-rwx /root/install.log
        0
                 a
  chmod 777 /root/install.log




mysql:
http://www.cnblogs.com/whgk/p/6149009.html
  transaction 


spring:
aop:
1.impl 
   
原创粉丝点击