版權(quán)說(shuō)明:本文檔由用戶提供并上傳,收益歸屬內(nèi)容提供方,若內(nèi)容存在侵權(quán),請(qǐng)進(jìn)行舉報(bào)或認(rèn)領(lǐng)
文檔簡(jiǎn)介
1、<p><b> 英文文獻(xiàn)</b></p><p> Object persistence and Java</p><p> By Arsalan Saljoughy, JavaWorld.com, 05/01/97</p><p> Object durability, or persistence, is the ter
2、m you often hear used in conjunction with the issue of storing objects in databases. Persistence is expected to operate with transactional integrity, and as such it is subject to strict conditions. (See the Resources sec
3、tion of this article for more information on transaction processing.) In contrast, language services offered through standard language libraries and packages are often free from transactional constraints.</p><
4、p> As we'll see in this article, evidence suggests that simple Java persistence will likely stem from the language itself, while sophisticated database functionality will be offered by database vendors.</p>
5、<p> No object is an island</p><p> In the real world, you rarely find an object that lacks relations to other objects. Objects are components of object models. The issue of object durability transc
6、ends the issue of object model durability and distribution once we make the observation that objects are interconnected by virtue of their relations to one another.</p><p> The relational approach to data s
7、torage tends to aggregate data by type. Rows in a table represent the physical aggregate of objects of the same type on disk. The relationships among objects are then represented by keys that are shared across many table
8、s. Although through database organization, relational databases sometimes allow tables that are likely to be used together to be co-located (or clustered) in the same logical partition, such as a database segment, they h
9、ave no mechanism to store o</p><p> To query or to navigate?</p><p> In storing objects on disk, we are faced with the choice of co-locating related objects to better accommodate navigational
10、access, or to store objects in table-like collections that aggregate objects by type to facilitate predicate-based access (queries), or both. The co-location of objects in persistent storage is an area where relational a
11、nd object-oriented databases widely differ. The choice of the query language is another area of consideration. Structured Query Language (SQL) and extensions</p><p> setOfGoodCustomers = setOfAccounts.query
12、(account.inGoodStanding());</p><p> While several of the existing object databases are capable of processing such a query style in C++ and Smalltalk, it is difficult for them to do so for larger (say, 500+
13、gigabytes) collections and more complex query expressions. Several of the relational database companies, such as Oracle and Informix, will soon offer other, SQL-based syntax to achieve the same result.</p><p&g
14、t; Persistence and type</p><p> An object-oriented language aficionado would say persistence and type are orthogonal properties of an object; that is, persistent and transient objects of the same type can
15、be identical because one property should not influence the other. The alternative view holds that persistence is a behavior supported only by persistable objects and certain behaviors may apply only to persistent objects
16、. The latter approach calls for methods that instruct persistable objects to store and retrieve themselves </p><p> Canonicalization and language independence</p><p> Objects of the same type
17、in a language should be stored in persistent storage with the same layout, regardless of the order in which their interfaces appear. The processes of transforming an object layout to this common format are collectively k
18、nown as canonicalization of object representation. In compiled languages with static typing (not Java) objects written in the same language, but compiled under different systems, should be identically represented in pers
19、istent storage.</p><p> An extension of canonicalization addresses language-independent object representation. If objects can be represented in a language-independent fashion, it will be possible for differ
20、ent representations of the same object to share the same persistent storage.</p><p> One mechanism to accomplish this task is to introduce an additional level of indirection through an interface definition
21、language (IDL). Object database interfaces can be made through the IDL and the corresponding data structures. The downside of IDL style bindings is two fold: First, the extra level of indirection always requires an addit
22、ional level of translation, which impacts the overall performance of the system; second, it limits use of database services that are unique to particular vendo</p><p> A similar mechanism is to support obje
23、ct services through an extension of the SQL. Relational database vendors and smaller object/relational vendors are proponents of this approach; however, how successful these companies will be in shaping the framework for
24、 object storage remains to be seen.</p><p> But the question remains: Is object persistence part of the object's behavior or is it an external service offered to objects via separate interfaces? How abo
25、ut collections of objects and methods for querying them? Relational, extended relational, and object/relational approaches tend to advocate a separation between language, while object databases -- and the Java language i
26、tself -- see persistence as intrinsic to the language:</p><p> Native Java persistence via serialization</p><p> Object serialization is the Java language-specific mechanism for the storage an
27、d retrieval of Java objects and primitives to streams. It is worthy to note that although commercial third-party libraries for serializing C++ objects have been around for some time, C++ has never offered a native mechan
28、ism for object serialization. Here's how to use Java's serialization:</p><p> // Writing "foo" to a stream (for example, a file) </p><p> // Step 1. Create an output stream &
29、lt;/p><p> // that is, create bucket to receive the bytes </p><p> FileOutputStream out = new FileOutputStream("fooFile"); </p><p> // Step 2. Create ObjectOutputStream &l
30、t;/p><p> // that is, create a hose and put its head in the bucket </p><p> ObjectOutputStream os = new ObjectOutputStream(out) </p><p> // Step 3. Write a string and an object to t
31、he stream </p><p> // that is, let the stream flow into the bucket</p><p> os.writeObject("foo"); </p><p> os.writeObject(new Foo()); </p><p> // Step 4.
32、Flush the data to its destination </p><p> os.flush(); </p><p> The Writeobject method serializes foo and its transitive closure -- that is, all objects that can be referenced from foo within
33、the graph. Within the stream only one copy of the serialized object exists. Other references to the objects are stored as object handles to save space and avoid circular references. The serialized object starts with the
34、class followed by the fields of each class in the inheritance hierarchy.</p><p> // Reading an object from a stream </p><p> // Step 1. Create an input stream </p><p> FileInputS
35、tream in = new FileInputStream("fooFile"); </p><p> // Step 2. Create an object input stream </p><p> ObjectInputStream ins = new ObjectInputStream(in); </p><p> // Ste
36、p 3. Got to know what you are reading </p><p> String fooString = (String)ins.readObject(); </p><p> Foo foo = (Foo)s.readObject(); </p><p> Object serialization and security<
37、/p><p> By default, serialization writes and reads non-static and non-transient fields from the stream. This characteristic can be used as a security mechanism by declaring fields that may not be serialized as
38、 private transient. If a class may not be serialized at all, writeObject and readObject methods should be implemented to throw NoAccessException.</p><p> Persistence with transactional integrity: Introducin
39、g JDBC</p><p> Modeled after X/Open's SQL CLI (Client Level Interface) and Microsoft's ODBC abstractions, Java database connectivity (JDBC) aims to provide a database connectivity mechanism that is
40、independent of the underlying database management system (DBMS).To become JDBC-compliant, drivers need to support at least the ANSI SQL-2 entry-level API, which gives third-party tool vendors and applications enough flex
41、ibility for database access.</p><p> JDBC is designed to be consistent with the rest of the Java system. Vendors are encouraged to write an API that is more strongly typed than ODBC, which affords greater s
42、tatic type-checking at compile time.</p><p> Here's a description of the most important JDBC interfaces:</p><p> java.sql.Driver.Manager handles the loading of drivers and provides support
43、 for new database connections.</p><p> java.sql.Connection represents a connection to a particular database.</p><p> java.sql.Statement acts as a container for executing an SQL statement on a
44、given connection.</p><p> java.sql.ResultSet controls access to the result set.</p><p> You can implement a JDBC driver in several ways. The simplest would be to build the driver as a bridge t
45、o ODBC. This approach is best suited for tools and applications that do not require high performance. A more extensible design would introduce an extra level of indirection to the DBMS server by providing a JDBC network
46、driver that accesses the DBMS server through a published protocol. The most efficient driver, however, would directly access the DBMS proprietary API.</p><p> Object databases and Java persistence</p>
47、<p> A number of ongoing projects in the industry offer Java persistence at the object level. However, as of this writing, Object Design's PSE (Persistent Storage Engine) and PSE Pro are the only fully Java-b
48、ased, object-oriented database packages available (at least, that I am aware of). Check the Resources section for more information on PSE and PSE Pro.</p><p> Java development has led to a departure from th
49、e traditional development paradigm for software vendors, most notably in the development process timeline. For example, PSE and PSE Pro are developed in a heterogeneous environment. And because there isn't a linking
50、step in the development process, developers have been able to create various functional components independent of each other, which results in better, more reliable object-oriented code.</p><p> PSE Pro has
51、 the ability to recover a corrupted database from an aborted transaction caused by system failure. The classes that are responsible for this added functionality are not present in the PSE release. No other differences ex
52、ist between the two products. These products are what we call "dribbleware" -- software releases that enhance their functionality by plugging in new components. In the not-so-distant future, the concept of purc
53、hasing large, monolithic software would become a thing of t</p><p> PSE works by post-processing and annotating class files after they have been created by the developer. From PSE's point of view, class
54、es in an object graph are either persistent-capable or persistent-aware. Persistent-capable classes may persist themselves while persistent-aware classes can operate on persistent objects. This distinction is necessary b
55、ecause persistence may not be a desired behavior for certain classes. The class file post-processor makes the following modifications to classes:</p><p> Modifies the class to inherit from odi.Persistent or
56、 odi.util.HashPersistent.</p><p> Defines the initializeContents() method to load real values into hollow instances of your Persistent subclass. ObjectStore provides methods on the GenericObject class that
57、retrieves each Field type.</p><p> Be sure to call the correct methods for the fields in your persistent object. A separate method is available for obtaining each type of Field object. ObjectStore calls the
58、 initializeContents() method as needed. The method signature is:</p><p> public void initializeContents(GenericObject genObj)</p><p> Defines the flushContents() method to copy values from a m
59、odified instance (active persistent object) back to the database. ObjectStore provides methods on the GenericObject </p><p> Be sure to call the correct methods for the fields in your persistent object. A s
60、eparate method is available for setting each type of Field object. ObjectStore calls the flushContents() method as needed. The method signature is:</p><p> public void flushContents(GenericObject genObj)<
61、;/p><p> Defines the clearContents() method to reset the values of an instance to the default values. This method must set all reference fields that referred to persistent objects to null. ObjectStore calls th
62、is method as needed. The method signature is:</p><p> public void clearContents()</p><p> Modifies the methods that reference non-static fields to call the Persistent.fetch() and Persistent.di
63、rty() methods as needed. These methods must be called before the contents of persistent objects can be accessed or modified, respectively. While this step is not mandatory, it does provide a systematic way to ensure that
64、 the fetch() or dirty() method is called prior to accessing or updating object content.</p><p> Defines a class that provides schema information about the persistence-capable class.</p><p> Al
65、l these steps can be completed either manually or automatically.</p><p> PSE's transaction semantic</p><p> You old-time users of ObjectStore probably will find the database and transactio
66、n semantics familiar. There is a system-wide ObjectStore object that initializes the environment and is responsible for system-wide parameters. The Database class offers methods (such as create, open, and close), and the
67、 Transaction class has methods to begin, abort, or commit transactions. As with serialization, you need to find an entry point into the object graph. The getRoot and setRoot methods of the Database cl</p><p>
68、; ObjectStore.initialize(serverName, null);</p><p><b> try { </b></p><p> db = Database.open(dbName, Database.openUpdate);</p><p> } catch(DatabaseNotFoundException
69、exception) {</p><p> db = Database.create(dbName, 0664);</p><p><b> }</b></p><p> This next snippet shows how to start and commit a transaction:</p><p>
70、 Transaction transaction = Transaction.begin(Transaction.update);</p><p><b> try {</b></p><p> foo = (Foo)db.getRoot("fooHead");</p><p> } catch(DatabaseRoo
71、tNotFoundException exception) {</p><p> db.createRoot("fooHead", new Foo());</p><p><b> }</b></p><p> transaction.commit();</p><p> The three
72、classes specified above -- Transaction, Database, and ObjectStore -- are fundamental classes for ObjectStore. PSE 1.0 does not support nested transactions, backup and recovery, clustering, large databases, object securit
73、y beyond what is available in the language, and any type of distribution. What is exciting, however, is all of this functionality will be incrementally added to the same foundation as the product matures.</p><
74、p> About the author</p><p> Arsalan Saljoughy is asystems engineer specializing in object technology at Sun Microsystems. He earned his M.S. in mathematics from SUNY at Albany, and subsequently was a re
75、search fellow at the University of Berlin. Before joining Sun, he worked as a developer and as an IT consultant to financial services companies. </p><p> Conclusion</p><p> Although it is stil
76、l too early to establish which methodology for object persistence in general and Java persistence in particular will be dominant in the future, it is safe to assume that a myriad of such styles will co-exist. The shift o
77、f storing objects as objects without disassembly into rows and columns is sure to be slow, but it will happen. In the meantime, we are more likely to see object databases better utilized in advanced engineering and telec
78、ommunications applications than in bankin</p><p><b> 英文翻譯</b></p><p> 對(duì)象持久化和Java-深入的了解面向?qū)ο笳Z(yǔ)言中的對(duì)象持久的討論</p><p> Arsalan Saljoughy,JavaWorld.com, 05/01/97</p><
79、;p> 對(duì)象持久化這個(gè)術(shù)語(yǔ)你常常會(huì)和數(shù)據(jù)存儲(chǔ)一起聽到。持久化被期望用于事務(wù)完整性和更嚴(yán)格的條件(參看文獻(xiàn)部分獲取更多的事務(wù)處理的信息)。但是,編程語(yǔ)言提供的標(biāo)準(zhǔn)類庫(kù)和包都沒(méi)有包含事務(wù)約束。正如本文中我們將清楚的看到簡(jiǎn)單的java持久化很有可能會(huì)滋生語(yǔ)言本身,而復(fù)雜的數(shù)據(jù)庫(kù)功能將由數(shù)據(jù)庫(kù)廠商提供。</p><p><b> 沒(méi)有對(duì)象是一個(gè)島嶼</b></p><p
80、> 在真實(shí)的世界,你很少發(fā)現(xiàn)一個(gè)事物跟其它事物之間沒(méi)有關(guān)系,事物是對(duì)象模型的成分。對(duì)事物的持久比對(duì)對(duì)象模型的持久要困難,而且我們可以觀察到對(duì)象之間是通過(guò)他們之間的關(guān)系關(guān)聯(lián)在一起的。關(guān)聯(lián)方式的數(shù)據(jù)存儲(chǔ)趨于根據(jù)類型進(jìn)行數(shù)據(jù)匯總,表中的行表示硬盤上同一種類型對(duì)象的物理存儲(chǔ),對(duì)象之間的關(guān)系是通過(guò)多張表共享關(guān)鍵字表現(xiàn)的。雖然通過(guò)數(shù)據(jù)庫(kù)組織,關(guān)系數(shù)據(jù)庫(kù)有時(shí)允許多表能在同一邏輯塊中一起使用組成群集,例如,一個(gè)數(shù)據(jù)庫(kù)部分,它沒(méi)有機(jī)制存儲(chǔ)對(duì)象關(guān)系
81、。因此,為了構(gòu)建一個(gè)對(duì)象模型,這些關(guān)系從進(jìn)程運(yùn)行時(shí)已經(jīng)存在的關(guān)鍵字被構(gòu)建的,又被稱作表連接。這同樣時(shí)眾所周知的關(guān)系數(shù)據(jù)庫(kù)的一個(gè)特性叫做“數(shù)據(jù)獨(dú)立性”。幾乎所有的對(duì)象數(shù)據(jù)庫(kù)都提供一些機(jī)制來(lái)增強(qiáng)系統(tǒng)的性能,包括復(fù)雜的對(duì)象關(guān)系,都超過(guò)傳統(tǒng)的關(guān)系數(shù)據(jù)庫(kù)。</p><p><b> 查詢或?yàn)g覽?</b></p><p> 在存儲(chǔ)數(shù)據(jù)到磁盤上時(shí),我們要面臨的選擇是協(xié)同定位有關(guān)
82、的對(duì)象以更適合瀏覽訪問(wèn),或者存儲(chǔ)到表上-根據(jù)對(duì)象的類型進(jìn)行匯集使更容易進(jìn)行查詢?cè)L問(wèn)(查詢),或者兩者一起使用。對(duì)象的協(xié)同定位是持久化存儲(chǔ)中關(guān)系和面向?qū)ο髷?shù)據(jù)庫(kù)非常不一樣的一個(gè)方面。選擇查詢語(yǔ)言是另外一個(gè)值得考慮的方面。結(jié)構(gòu)化查詢語(yǔ)言(SQL)和它的擴(kuò)展已經(jīng)證明使用條件判斷存取機(jī)制的關(guān)系系統(tǒng)的成功。對(duì)象查詢語(yǔ)言(OQL)是SQL的一個(gè)變種,由ODMG定制的標(biāo)準(zhǔn),但是對(duì)這個(gè)語(yǔ)言的支持卻非常的少。多種形式組合的方法使對(duì)象的集合在構(gòu)建語(yǔ)意查詢上
83、空前的簡(jiǎn)潔。例如,假設(shè)一個(gè)賬戶有多種行為組合叫做isInGoodStanding,這樣所有的in good standing的賬戶都將會(huì)返回正確,其它的返回錯(cuò)誤?,F(xiàn)在可以想象查詢賬戶集合的簡(jiǎn)潔性,ingoodstanding為多有in good standing的賬戶實(shí)行不同的基礎(chǔ)上的業(yè)務(wù)規(guī)則。它看起來(lái)像:</p><p> setOfGoodCustomers = setOfAccounts.query(ac
84、count.inGoodStanding());</p><p> 大多數(shù)的對(duì)象數(shù)據(jù)庫(kù)能夠處理在C++和Samlltalk中像這樣的查選語(yǔ)法,但是它門確很難處理更大數(shù)據(jù)的集合和更復(fù)雜的查詢表達(dá)式。許多關(guān)系數(shù)據(jù)庫(kù)公司,例如Oracle和Informix,將很快提供其它的方式,基于SQL語(yǔ)法來(lái)達(dá)到同樣的效果。</p><p><b> 持久化和類型</b></p
85、><p> 面向?qū)ο笳Z(yǔ)言的支持者會(huì)說(shuō)持久化和類型是對(duì)象的兩個(gè)相交的特性,也就是說(shuō),同一類型的對(duì)象的持久和變化過(guò)程是能夠相同的,因?yàn)橐粋€(gè)特性不能夠影響其它的特性。另一類觀點(diǎn)認(rèn)為持久化只是可持久對(duì)象的行為,某些行為可能被應(yīng)用于持久性對(duì)象。后面的方法提倡通知可持久化對(duì)象存儲(chǔ)和從存儲(chǔ)器檢索,模型提供一個(gè)實(shí)體對(duì)象的應(yīng)用試圖――通常延伸虛擬內(nèi)存。</p><p><b> 規(guī)范化和語(yǔ)言獨(dú)立&
86、lt;/b></p><p> 一種語(yǔ)言同一類型的對(duì)象應(yīng)該已同樣的方式儲(chǔ)存到持久的儲(chǔ)存器上,不管它們的表現(xiàn)形式是怎么樣的。把對(duì)象的布局改變成普通形式的過(guò)程被大家稱做對(duì)象形式的規(guī)范化。在編譯語(yǔ)言中,靜態(tài)類型對(duì)象一種語(yǔ)言編寫,但在不同的系統(tǒng)下編譯,在吃酒儲(chǔ)存器中應(yīng)該具有相同的表現(xiàn)形式。</p><p> 對(duì)獨(dú)立語(yǔ)言對(duì)象表示規(guī)范化的進(jìn)行擴(kuò)展。如果對(duì)象能以單獨(dú)的一種語(yǔ)言表示,那么同一對(duì)象
87、的不同表現(xiàn)形式就可以共享同一持久化存儲(chǔ)器。</p><p> 一種策略為達(dá)到這個(gè)目的就是通過(guò)接口定義語(yǔ)言(IDL)引進(jìn)一個(gè)新的層。通過(guò)IDL可以生成對(duì)象數(shù)據(jù)庫(kù)接口和相應(yīng)的數(shù)據(jù)結(jié)構(gòu)。IDL機(jī)構(gòu)的底部包括兩種,第一,額外的中間層總是需要額外的轉(zhuǎn)換成,這樣會(huì)影響系統(tǒng)的總體性能;第二,它限制了數(shù)據(jù)庫(kù)服務(wù)對(duì)于特定廠商是唯一的價(jià)值 ,這樣可能對(duì)于應(yīng)用開發(fā)人員來(lái)說(shuō)是相當(dāng)有價(jià)值的。</p><p>
88、另一種簡(jiǎn)單的策略是通過(guò)對(duì)SQL的擴(kuò)展來(lái)實(shí)現(xiàn)對(duì)對(duì)象服務(wù)的支持。關(guān)系數(shù)據(jù)庫(kù)廠商和較小的對(duì)象/關(guān)系廠商都提倡這種做法;然而,這些公司在塑造對(duì)象存儲(chǔ)框架上是否能成功仍有待觀察。</p><p> 但是問(wèn)題依然存在:對(duì)象持久化是對(duì)象特征的一部分或者是外部服務(wù)通過(guò)提供分離的接口給對(duì)象?通過(guò)什么樣的對(duì)象集合和方法查詢它們?在對(duì)象數(shù)據(jù)庫(kù)和java語(yǔ)言本身視持久化為語(yǔ)言的內(nèi)在時(shí),關(guān)系,擴(kuò)展關(guān)系,對(duì)象/關(guān)系往往在語(yǔ)言之間主張分裂的
89、做法。</p><p> 串行化實(shí)現(xiàn)java持久化</p><p> 對(duì)象串行化是java語(yǔ)言中對(duì)象和元素的流的存儲(chǔ)和讀取的特殊策略。值得提醒的是,雖然有商用的第三方庫(kù)對(duì)串行化C++對(duì)象的支持,但是C++本身并沒(méi)有提供對(duì)象串行化的策略。下面是如何使用java的串行化:</p><p> // Writing "foo" to a strea
90、m (for example, a file)</p><p> // Step 1. Create an output stream </p><p> // that is, create bucket to receive the bytes </p><p> FileOutputStream out = new FileOutputStream(&q
91、uot;fooFile"); </p><p> // Step 2. Create ObjectOutputStream </p><p> // that is, create a hose and put its head in the bucket </p><p> ObjectOutputStream os = new ObjectOut
92、putStream(out) </p><p> // Step 3. Write a string and an object to the stream </p><p> // that is, let the stream flow into the bucket</p><p> os.writeObject("foo"); &l
93、t;/p><p> os.writeObject(new Foo()); </p><p> // Step 4. Flush the data to its destination </p><p> os.flush();</p><p> writeObject方法串行化了foo對(duì)象和它的傳遞閉包――指的就是圖中所有引用foo的對(duì)象
94、。流內(nèi)部只有串行化對(duì)象的一個(gè)副本存在。其它引用對(duì)象以對(duì)象句柄的形式存在來(lái)保存空格和防止循環(huán)引用。串行化對(duì)象以繼承結(jié)構(gòu)的每個(gè)類的屬性開始,如下類的實(shí)現(xiàn):</p><p> // Reading an object from a stream </p><p> // Step 1. Create an input stream </p><p> FileInp
95、utStream in = new FileInputStream("fooFile"); </p><p> // Step 2. Create an object input stream </p><p> ObjectInputStream ins = new ObjectInputStream(in); </p><p> //
96、Step 3. Got to know what you are reading </p><p> String fooString = (String)ins.readObject(); </p><p> Foo foo = (Foo)s.readObject(); </p><p><b> 對(duì)象串行化和安全</b></p&
97、gt;<p> 默認(rèn)情況下,串行化寫入流中和從流中讀取的都是非靜態(tài)和非臨時(shí)的屬性。這種特性能夠被用作一個(gè)安全策略,通過(guò)定義無(wú)需串行化的屬性為私有臨時(shí)類型的變量。如果一個(gè)類不被串行化,那么writeObject和readObject方法將拋出NoAccessException異常。</p><p> 使用事務(wù)完整性的持久化:介紹JDBC</p><p> 與X/Open的
98、SQL CLI(客戶端接口)和微軟抽象的ODBC類型,JDBC的目的也是提供一個(gè)與數(shù)據(jù)庫(kù)管理系統(tǒng)(DBMS)無(wú)關(guān)的數(shù)據(jù)庫(kù)連接策略。要成為適用的JDBC,驅(qū)動(dòng)至少要支持ANSI SQL-2 entry-level API,它是提供第三方工具和靈活數(shù)據(jù)庫(kù)訪問(wèn)應(yīng)用的廠商。</p><p> JDBC被設(shè)計(jì)為能與java系統(tǒng)相互兼容。開發(fā)者們要求廠商們提供比ODBC更加完善的API,能夠在編譯時(shí)提供靜態(tài)類型的檢查。下面
99、是關(guān)于幾個(gè)主要JDBC接口的描述:</p><p> Java.sql.Driver.Manager 手動(dòng)加載驅(qū)動(dòng)和為新的數(shù)據(jù)庫(kù)連接提供支持</p><p> Java.sql.Connection 表示一個(gè)特殊數(shù)據(jù)庫(kù)的連接</p><p> Java.sql.Statement 在執(zhí)行給定連接的SQL語(yǔ)句時(shí)擔(dān)當(dāng)容器</p><p>
100、 Java.sql.ResultSet 控制訪問(wèn)的結(jié)果集</p><p> 你可以多種方式來(lái)實(shí)現(xiàn)JDBC驅(qū)動(dòng)。最簡(jiǎn)單的是構(gòu)建ODBC橋,這種方法最適合工具和應(yīng)用不需要很高的性能。一個(gè)更容易擴(kuò)展的設(shè)計(jì)是引進(jìn)一個(gè)中間層來(lái)連接DBMS服務(wù)器,該層提供一個(gè)JDBC網(wǎng)絡(luò)驅(qū)動(dòng)器,它通過(guò)公共的協(xié)議來(lái)訪問(wèn)DBMS服務(wù)器。但是最有效率的驅(qū)動(dòng)器就是直接使用DBMS本身的API。</p><p> 對(duì)象數(shù)據(jù)
101、庫(kù)和java持久化</p><p> 在行業(yè)中許多正在進(jìn)行的項(xiàng)目都在對(duì)象層面提供了java持久化。對(duì)象設(shè)計(jì)的PSE(持久性存儲(chǔ)引擎)和PSE Pro是唯一完全基于java的,可用的面向?qū)ο髷?shù)據(jù)庫(kù)軟件包(至少,這是我所知道的)。關(guān)于PSE和專業(yè)PSE的更多信息請(qǐng)參看文獻(xiàn)部分。</p><p> 對(duì)軟件廠家來(lái)說(shuō),java開發(fā)引領(lǐng)顛覆了傳統(tǒng)的開發(fā)形式,在開發(fā)過(guò)程中是顯而易見的。例如,PSE和
102、PSE Pro是在不同的環(huán)境下開發(fā)的。因?yàn)樵陂_發(fā)過(guò)程中這個(gè)不是在連接這步上,開發(fā)者們不得不創(chuàng)建相互獨(dú)立的多個(gè)功能模塊,這樣就形成了更好,更可靠的面向?qū)ο缶幋a。</p><p> PSE Pro能夠恢復(fù)由于系統(tǒng)故障導(dǎo)致失敗的事務(wù)引起的數(shù)據(jù)庫(kù)的破壞。負(fù)責(zé)額外功能的類沒(méi)有在發(fā)布的PSE版本中體現(xiàn)出來(lái)。除了這個(gè)區(qū)別,兩個(gè)產(chǎn)品就沒(méi)有其它的區(qū)別了。這些產(chǎn)品是我們所稱的" dribbleware "――通
103、過(guò)插入新的組件來(lái)增強(qiáng)軟件發(fā)布版本的功能。不遠(yuǎn)的將來(lái),購(gòu)買大型的單個(gè)軟件的概念將成為過(guò)去的事。這種在網(wǎng)絡(luò)空間中的新的商業(yè)環(huán)境,加上java的處理技術(shù),使用戶只需要購(gòu)買他們需要的對(duì)象模型,這樣就導(dǎo)致更緊湊的最終產(chǎn)品。</p><p> PSE的工作是通過(guò)后處理技術(shù)和在開發(fā)人員創(chuàng)建的類文件中添加注解。從PSE的視圖可以看出,在對(duì)象圖中的類不是有可能持久化的就是已知要持久化的。有可能持久化的類只能持久它們本身,而已知要
溫馨提示
- 1. 本站所有資源如無(wú)特殊說(shuō)明,都需要本地電腦安裝OFFICE2007和PDF閱讀器。圖紙軟件為CAD,CAXA,PROE,UG,SolidWorks等.壓縮文件請(qǐng)下載最新的WinRAR軟件解壓。
- 2. 本站的文檔不包含任何第三方提供的附件圖紙等,如果需要附件,請(qǐng)聯(lián)系上傳者。文件的所有權(quán)益歸上傳用戶所有。
- 3. 本站RAR壓縮包中若帶圖紙,網(wǎng)頁(yè)內(nèi)容里面會(huì)有圖紙預(yù)覽,若沒(méi)有圖紙預(yù)覽就沒(méi)有圖紙。
- 4. 未經(jīng)權(quán)益所有人同意不得將文件中的內(nèi)容挪作商業(yè)或盈利用途。
- 5. 眾賞文庫(kù)僅提供信息存儲(chǔ)空間,僅對(duì)用戶上傳內(nèi)容的表現(xiàn)方式做保護(hù)處理,對(duì)用戶上傳分享的文檔內(nèi)容本身不做任何修改或編輯,并不能對(duì)任何下載內(nèi)容負(fù)責(zé)。
- 6. 下載文件中如有侵權(quán)或不適當(dāng)內(nèi)容,請(qǐng)與我們聯(lián)系,我們立即糾正。
- 7. 本站不保證下載資源的準(zhǔn)確性、安全性和完整性, 同時(shí)也不承擔(dān)用戶因使用這些下載資源對(duì)自己和他人造成任何形式的傷害或損失。
最新文檔
- 基于HIBERNATE的JAVA對(duì)象持久化.pdf
- java-面向?qū)ο蠹夹g(shù)基礎(chǔ)
- 用Hibernate實(shí)現(xiàn)Java對(duì)象持久化.pdf
- java的面向?qū)ο缶幊掏馕馁Y料翻譯
- 基于UML的面向?qū)ο髷?shù)據(jù)持久化研究.pdf
- 面向?qū)ο蟮膉ava語(yǔ)言練習(xí)
- 基于對(duì)象關(guān)系映射的對(duì)象持久化模型的分析與設(shè)計(jì).pdf
- 基于對(duì)象關(guān)系映射的對(duì)象持久化模型分析與應(yīng)用.pdf
- 基于.net的對(duì)象持久化研究與應(yīng)用
- 計(jì)算機(jī)畢業(yè)論文外文翻譯---面向?qū)ο蠛蚦++
- java-面向?qū)ο蟾呒?jí)程序設(shè)計(jì)
- 基于.net平臺(tái)的對(duì)象持久化組件的設(shè)計(jì)和實(shí)現(xiàn)
- 計(jì)算機(jī)專業(yè)畢業(yè)設(shè)計(jì)外文翻譯--jsp內(nèi)置對(duì)象
- 模型驅(qū)動(dòng)的實(shí)體對(duì)象持久化技術(shù)的研究.pdf
- 基于ORM的對(duì)象持久化框架的設(shè)計(jì)與應(yīng)用.pdf
- 基于J2EE的對(duì)象持久化的研究.pdf
- 基于組件結(jié)構(gòu)的對(duì)象持久層研究.pdf
- 面向?qū)ο蠹夹g(shù) - 計(jì)算機(jī)系主頁(yè)
- java面向?qū)ο罂偨Y(jié)
- 基于關(guān)系數(shù)據(jù)庫(kù)的對(duì)象持久化研究.pdf
評(píng)論
0/150
提交評(píng)論