酒店軟裝設計是多元化的產(chǎn)品ppt課件_第1頁
酒店軟裝設計是多元化的產(chǎn)品ppt課件_第2頁
酒店軟裝設計是多元化的產(chǎn)品ppt課件_第3頁
酒店軟裝設計是多元化的產(chǎn)品ppt課件_第4頁
酒店軟裝設計是多元化的產(chǎn)品ppt課件_第5頁
已閱讀5頁,還剩38頁未讀, 繼續(xù)免費閱讀

下載本文檔

版權說明:本文檔由用戶提供并上傳,收益歸屬內(nèi)容提供方,若內(nèi)容存在侵權,請進行舉報或認領

文檔簡介

1、2022/7/13Institute of Computer SoftwareNanjing UniversityPersistent Objects耐久對象酒店設計 bbdde.2022/7/13Institute of Computer SoftwareNanjing UniversityObject Persistence問題處理方案Language-levelDatabasesRelational O-RObject-Oriented databaseHibernate 簡介討論.2022/7/13Institute of Computer SoftwareNanjing Univer

2、sityPersistence What happens to the objects of an application when its execution terminates?Transient objectsPersistent objects.2022/7/13Institute of Computer SoftwareNanjing University / Serialize todays date to a file. FileOutputStream f = new FileOutputStream(tmp); ObjectOutput s = new ObjectOutp

3、utStream(f); s.writeObject(Today); s.writeObject(new Date(); s.flush();Java:Writing to an Object Stream.2022/7/13Institute of Computer SoftwareNanjing UniversityReading from an Object Stream / Deserialize a string and date from a file. FileInputStream in = new FileInputStream(tmp); ObjectInputStream

4、 s = new ObjectInputStream(in); String today = (String)s.readObject(); Date date = (Date)s.readObject();.2022/7/13Institute of Computer SoftwareNanjing University對象構造的存儲與提取對象耐久化的難點之一:對象之間的援用.2022/7/13Institute of Computer SoftwareNanjing University對象構造的存儲與提取需耐久化整個對象援用閉包Persistence closureJava的serial

5、izable規(guī)那么缺省規(guī)那么:非static 非transient 的數(shù)據(jù)成員用戶定義class List implements Serializable List next; private static final ObjectStreamField serialPersistentFields = new ObjectStreamField(next, List.class); .2022/7/13Institute of Computer SoftwareNanjing University對象構造的存儲與提取存儲格式問題同構環(huán)境異構環(huán)境 XML (Tool: Caster ).202

6、2/7/13Institute of Computer SoftwareNanjing University對象構造的存儲與提取閉包能夠太大小對象援用共享的大對象.2022/7/13Institute of Computer SoftwareNanjing University對象構造的存儲與提取Java 的 transient 修飾子Transient fields 不被序列化Static 也不開發(fā)者擔任維護.2022/7/13Institute of Computer SoftwareNanjing UniversitySchema evolution耐久化問題的又一難點讀取對象的類不是存

7、儲對象的類,比如做了修正,或是其某個子類?Nave approaches放棄先前耐久化的對象一次性全體轉換自動對象轉換DetectionNotificationCorrection.2022/7/13Institute of Computer SoftwareNanjing University自動對象轉換Detection:標志對象版本Policies: nominal vs. structuralNominal: class versioning 命名Configuration Management或者 Random number (OLE2)集中注冊處Structural: 根據(jù)Clas

8、s 構造據(jù)之生成 Class descriptor,類名;類全文;類名屬性方法; 再加類不變式.2022/7/13Institute of Computer SoftwareNanjing University自動對象轉換Notification言語機制支持Eiffelin Class GENERALcorrect_mismatch is doraise_mismatch_exceptionend開發(fā)者可在ANY中為整個系統(tǒng)重定義該feature.2022/7/13Institute of Computer SoftwareNanjing University自動對象轉換Correction添

9、加attribute刪除attribute中心在于維護不變式.2022/7/13Institute of Computer SoftwareNanjing University自動對象轉換:JavaserialVersionUID 自動定義 根據(jù)類文件生成1. Class name 2. The class modifiers 3. The name of each interface 4. For each field of the class(except private static and private transient fields): The name of the field

10、 The modifiers of the field The descriptor of the field 5. For each method including constructors, except private methods and constructors: The name of the method The modifiers of the method The descriptor of the method .2022/7/13Institute of Computer SoftwareNanjing University自動對象轉換:Java手工指定ANY-ACC

11、ESS-MODIFIER static final long serialVersionUID = 42L; 類改動時依然可以反序列化Java定義了一些“兼容條件,符合條件的自動轉換可以容忍的:adding fields etc太糟糕的: “Changing the type of a field, del fields, etc.2022/7/13Institute of Computer SoftwareNanjing University對于真實“糟糕的類修正可以定制序列化和反序列化方法private void readObject(ObjectInputStream in) priva

12、te void writeObject(ObjectOutputStream out) .2022/7/13Institute of Computer SoftwareNanjing University對象耐久化與數(shù)據(jù)庫為什么要數(shù)據(jù)庫序列化:單個對象入口的一個對象閉包,須一次提取、重建一切對象基于內(nèi)容的查詢?并發(fā)存取?.2022/7/13Institute of Computer SoftwareNanjing University對象耐久化與數(shù)據(jù)庫數(shù)據(jù)庫Persistence Programmable structureArbitrary sizeAccess controlPropert

13、y-based queering Integrity constraintsAdministrationSharingLockingTransaction自然地,要用數(shù)據(jù)庫來存儲耐久化對象.2022/7/13Institute of Computer SoftwareNanjing University對象耐久化與數(shù)據(jù)庫關系型數(shù)據(jù)庫:數(shù)據(jù)庫的主流關系關系代數(shù)Selection, Projection , Join.2022/7/13Institute of Computer SoftwareNanjing University.2022/7/13Institute of Computer So

14、ftwareNanjing University.2022/7/13Institute of Computer SoftwareNanjing University對象耐久化與數(shù)據(jù)庫對象 關系 互操作模型不同假設有時對象系統(tǒng)必需處置關系數(shù)據(jù)庫中的數(shù)據(jù)有時對象構造很簡單,關系模型可以表達否那么 impedance mismatch.2022/7/13Institute of Computer SoftwareNanjing University對象耐久化與數(shù)據(jù)庫impedance mismatch關系數(shù)據(jù)庫數(shù)據(jù)構造規(guī)整,成員數(shù)目類型固定構造簡單,成員類型屬于一個既定小集合這些類型由大小固定的類型

15、組合而成那么大小不定的域?表示對象援用的域?基于援用的間接查詢?承繼?更重要的是:對象identity語義.2022/7/13Institute of Computer SoftwareNanjing University對象耐久化與數(shù)據(jù)庫面向?qū)ο髷?shù)據(jù)庫處理面向?qū)ο筌浖到y(tǒng)進展對象耐久化時,與關系數(shù)據(jù)庫間的不匹配問題抑制關系數(shù)據(jù)庫本身的限制提供更高級的數(shù)據(jù)庫設備.2022/7/13Institute of Computer SoftwareNanjing University對象耐久化與數(shù)據(jù)庫面向?qū)ο髷?shù)據(jù)庫最小要求 zdonik 1990數(shù)據(jù)庫功能支持封裝對象聯(lián)絡于獨一ID支持對象援用此外對象

16、版本,類版本與schema evolution, Long transactions, locking queris.2022/7/13Institute of Computer SoftwareNanjing UniversityHibernate: Object-Relation Mapping當前的現(xiàn)實:運用分層兩層構造三層構造N-層構造.2022/7/13Institute of Computer SoftwareNanjing University.2022/7/13Institute of Computer SoftwareNanjing University.2022/7/13I

17、nstitute of Computer SoftwareNanjing University.2022/7/13Institute of Computer SoftwareNanjing University對象關系 映射簡單映射將一個類中的一個數(shù)據(jù)成員定為關鍵字其它數(shù)據(jù)成員為屬性添加、更新、刪除、查詢.2022/7/13Institute of Computer SoftwareNanjing University對象關系 映射承繼:方案1:子類父類各自映射到各自的關系上。優(yōu)點?缺陷?.2022/7/13Institute of Computer SoftwareNanjing Unive

18、rsity對象關系 映射承繼方案 2:一切承繼自一個類的類都映射到一個表上添加一欄標志當前記錄對應的對象的類優(yōu)點? 缺陷?.2022/7/13Institute of Computer SoftwareNanjing University對象關系 映射承繼方案 3:父類映射的關系與子映射的關系共享一樣的主鍵值,父類關系只記錄本身的屬性,假設要查詢的是子類,則透過外鍵參考從父類表格中獲得繼承而來的屬性值。 .2022/7/13Institute of Computer SoftwareNanjing University.2022/7/13Institute of Computer SoftwareNanjing University.2022/7/13Institute of Computer SoftwareNanjing University對象關系 映射Component 映射子對象Set 映射對象中某屬性是一個集合集合元素僅僅是值,無identity 映射到另一個關系,用外關鍵字闡明其屬于哪個對象List 映射與Set類似 再加一欄表示位置.2022/7/13Institute of Computer SoftwareNanjing University對象關系 映射Map映射Key-Val 屬于誰S

溫馨提示

  • 1. 本站所有資源如無特殊說明,都需要本地電腦安裝OFFICE2007和PDF閱讀器。圖紙軟件為CAD,CAXA,PROE,UG,SolidWorks等.壓縮文件請下載最新的WinRAR軟件解壓。
  • 2. 本站的文檔不包含任何第三方提供的附件圖紙等,如果需要附件,請聯(lián)系上傳者。文件的所有權益歸上傳用戶所有。
  • 3. 本站RAR壓縮包中若帶圖紙,網(wǎng)頁內(nèi)容里面會有圖紙預覽,若沒有圖紙預覽就沒有圖紙。
  • 4. 未經(jīng)權益所有人同意不得將文件中的內(nèi)容挪作商業(yè)或盈利用途。
  • 5. 人人文庫網(wǎng)僅提供信息存儲空間,僅對用戶上傳內(nèi)容的表現(xiàn)方式做保護處理,對用戶上傳分享的文檔內(nèi)容本身不做任何修改或編輯,并不能對任何下載內(nèi)容負責。
  • 6. 下載文件中如有侵權或不適當內(nèi)容,請與我們聯(lián)系,我們立即糾正。
  • 7. 本站不保證下載資源的準確性、安全性和完整性, 同時也不承擔用戶因使用這些下載資源對自己和他人造成任何形式的傷害或損失。

評論

0/150

提交評論