CS27020 Object Relational Mapping and a Persistence Layer PDF

Document Details

LuckierObsidian9566

Uploaded by LuckierObsidian9566

Praboda Rajapaksha (with credit to Nigel Hardy)

Tags

object relational mapping persistence layer database management java programming

Summary

This document is lecture notes on Object Relational Mapping and a Persistence Layer. It covers integration with high-level languages, building applications with persistent storage, the ResultSet object, accessing the ResultSet, metadata, and more. It also includes examples and other relevant topics.

Full Transcript

Object Relational Mapping and a Persistence Layer O-R Mapping Integration with high level languages Building applications with persistent storage Praboda Rajapaksha...

Object Relational Mapping and a Persistence Layer O-R Mapping Integration with high level languages Building applications with persistent storage Praboda Rajapaksha (with credit to Nigel Hardy) Modelling Persistent Data CS27020 Computer Science Department 1 / 31 Object Relational Mapping and a Persistence Layer O-R Mapping Last time Introduction Started to look at JDBC as an example of a CLI Did not see handling of the responses from the DBMS 2 / 31 Object Relational Mapping and a Persistence Layer O-R Mapping The ResultSet object Has metadata resultSet.getMetaData() an object that can be used to get information about the types and properties of the columns in a ResultSet object. access methods to describe the set, include: details of the column headers can the result set be re-read (scroll back) Has a concept of “current record” Initially the cursor is positioned before the first row..next and (probably) a range of methods to move the “cursor” to the next row and can use a while loop to iterate over has get methods for named and indexed fields can get fields as a wide range of types (if they convert) The SQL ordered list is mapped as a Java iterable collection a special type (class) not a domain specific type 3 / 31 Object Relational Mapping and a Persistence Layer O-R Mapping Accessing the ResultSet ResultSet resultSet = statement. executeQuery ( " s e l e c t ∗ from e l e c t e d m a y o r s " ) ; R e s u l t S e t M e t a D a t a metaData = r e s u l t S e t. getMetaData ( ) ; 4 / 31 Object Relational Mapping and a Persistence Layer O-R Mapping The metadata i n t c o l s = metaData. getColumnCount ( ) ; for ( int i = 1 ; i

Use Quizgecko on...
Browser
Browser