MappedSuperclass註解的使用

2021-10-24 14:19:45 字數 1242 閱讀 6088

起因:

@getter

@setter

@entitylisteners

(auditingentitylistener.

class

)public

class

baseentity

implements

serializable

{@createdby

@column

(name =

"create_by"

, updatable =

false

)@apimodelproperty

(value =

"建立人"

, hidden =

true

)private string createby;

@lastmodifiedby

@column

(name =

"update_by"

)@apimodelproperty

(value =

"更新人"

, hidden =

true

)private string updatedby;

@creationtimestamp

@column

(name =

"create_time"

, updatable =

false

)@apimodelproperty

(value =

"建立時間"

, hidden =

true

)private timestamp createtime;

@updatetimestamp

@column

(name =

"update_time"

)@apimodelproperty

(value =

"更新時間"

, hidden =

true

)private timestamp updatetime;

當我們進行開發專案時,我們經常會用到實體對映到資料庫表的操作,此時我們經常會發現在我們需要隱射的幾個實體類中,有幾個共同的屬性,例如編號id,建立者,建立時間,修改者,修改時間,備註等。遇到這種情況,我們可能會想到把這些屬性抽象出來當成乙個父類,然後再以不同的實體類來繼承這個父類。

使用環境:

hibernate validato 註解使用

notblank 只用在string上,表示傳進來的值不能為null,而且呼叫trim 後,長度必須大於0 notnull integet上使用 不能為null,但可以為empty 分配了記憶體空間,但值為空 notempty list上使用 不能為null,而且長度必須大於0 valid放在con...

ingress controller 註解使用

http 跳轉到https nginx.ingress.kubernetes.io ssl redirect true 即使未啟用tls,也強制將重定向到https nginx.ingress.kubernetes.io force ssl redirect true abc.com 跳轉到www....

Springboot Async註解簡單使用

啟動類 enablescheduling enabletransactionmanagement enableasync 被非同步呼叫的方法 async public void async throws interruptedexception 呼叫者 呼叫者 解決辦法 author yz clas...