hibernate初印象

1,ddl,

create会重写创建表

update不会

2, one to many

https://www.cnblogs.com/bella-fly/articles/5114182.html

 

3, cache

first level cache, session scope

second-level  cache, shading,

 

 

 

 @Cacheable, @Cache(usage=CacheConcurrencyStrategy.readonly

 eh cached, 要下载jar,注意和hibernate版本一样

query cache

在property指出,在语句指出,q1.setCachealbe(true)

4,lifecycle

 

transient:刚刚创建出来的状态

persistent:

  • 调用了session的save/ saveOrUpdate/ get/ load/ list方法
  • 数据库对应, known as dirty checking in hibernate.
  • 受session管理

detach:session关闭后

 

 5,get and load

when we don't use data, get method still hit the database

load give you a proxy, with throw a exception

6, 4步

 

 

 1,语句

2,createQuery

3, setParameter

4, getResult

自增主键

use-new-id-generator-mappings: false, 这个没用

 

 

 

面试答题:https://www.javatpoint.com/hibernate-interview-questions

posted on 2020-01-21 16:10  Kooing  阅读(111)  评论(0编辑  收藏  举报

导航