Persistence – Iteration 4 Vancouver Bootcamp Aaron Zeckoski

Slides:



Advertisements
Similar presentations
Introduction to NHibernate By Andrew Smith. The Basics Object Relation Mapper Maps POCOs to database tables Based on Java Hibernate. V stable Generates.
Advertisements

Connecting to Databases. relational databases tables and relations accessed using SQL database -specific functionality –transaction processing commit.
PHP SQL. Connection code:- mysql_connect("server", "username", "password"); Connect to the Database Server with the authorised user and password. Eg $connect.
Creative Commons Attribution- NonCommercial-ShareAlike 2.5 License Sakai Programmer's Café Sakai Tool Naming Tips Aaron Zeckoski
NHibernate Object/Relational Persistence for.NET.
Spring, Hibernate and Web Services 13 th September 2014.
.NET Database Technologies: Open-Source Frameworks.
Hibernate 1. Introduction ORM goal: Take advantage of the things SQL databases do well, without leaving the Java language of objects and classes. ORM.
Object Relational Mapping. What does ORM do? Maps Object Model to Relational Model. Resolve impedance mismatch. Resolve mapping of scalar and non-scalar.
Performed by:Gidi Getter Svetlana Klinovsky Supervised by:Viktor Kulikov 08/03/2009.
MC365 JDBC in Servlets. Today We Will Cover: DBVisualizer Using JDBC in servlets Using properties files.
ORM Object-Relational Mapping 1. Object Persistence Persistence is the ability of an object to survive the lifecycle of the process, in which it resides.
Session-02.
Session-01. Hibernate Framework ? Why we use Hibernate ?
Creative Commons Attribution- NonCommercial-ShareAlike 2.5 License Sakai Programmer's Café Configuring Sakai from Outside the Web Application Tony Atkins.
Intro to Spring CJUG - January What is Spring? “The Spring framework provides central transaction control of various objects.” This means that any.
Creative Commons Attribution- NonCommercial-ShareAlike 2.5 License Sakai Programmer's Café Sakai Montreal CRIM Workshop Data Persistence and Intro to Hibernate.
Hibernatification! Roadmap for Migrating from Plain Old SQL on JDBC to JPA on Hibernate Duke Banerjee Senior Developer, DrillingInfo.com.
Creative Commons Attribution- ShareAlike 2.5 License Sakai Programmer's Café Sakai Oxford Tetra ELF Workshop Sakai Persistence and Intro to Hibernate Aaron.
SJSU CS157B Dr. Lee1  2004 Jenny Mitchell Two Useful Tools You Can’t Live Without by Jenny Mitchell SJSU CS157B Section PHP and MySQL.
UPortal Developers MIT August 2004 Persistence Strategy for uPortal 3 Mike DeSimone the r-smart group
W. Sliwinski – eLTC – 7March08 1 LSA & Safety – Integration of RBAC and MCS in the LHC control system.
CHAPTER 14 USING RELATIONAL DATABASES TO PROVIDE OBJECT PERSISTENCE (ONLINE) © 2013 Pearson Education, Inc. Publishing as Prentice Hall 1 Modern Database.
M1G Introduction to Database Development 6. Building Applications.
Seminar on. Overview Hibernate. What is it? Hibernate. How does it work? Hibernate Tools.
Spring Data Access By, Srinivas Reddy.S
Object Oriented Analysis and Design 1 Chapter 7 Database Design  UML Specification for Data Modeling  The Relational Data Model and Object Model  Persistence.
Effective Test Driven Database Development Gojko Adzic
Creative Commons Attribution- NonCommercial-ShareAlike 2.5 License Sakai Programmer's Café Sakai Persistence and Hibernate Aaron Zeckoski
Effective Test Driven Database Development Gojko Adzic
© 2011 Pearson Education, Inc. Publishing as Prentice Hall 1 Chapter 14 Using Relational Databases to Provide Object Persistence (Overview) Modern Database.
Spring Database Access Ojitha Kumanayaka Copyright © Virtusa, 2007.
Hibernate 3.0. What is Hibernate Hibernate is a free, open source Java package that makes it easy to work with relational databases. Hibernate makes it.
Object Oriented Software Development 10. Persistent Storage.
Storing Data. A Note About Creating Games Why do you want to store data? 1.Data files 2.Configuration files.
JPA / HIBERNATE CSCI 6370 Nilayan Bhattacharya Sanket Sable.
Creative Commons Attribution- NonCommercial-ShareAlike 2.5 License Sakai Programmer's Café Sakai development and app/tool tips Aaron Zeckoski
Persistence – Iteration 4 Vancouver Bootcamp Aaron Zeckoski
Fall CIS 764 Database Systems Engineering L18.2 : Object Relational Mapping … ….Object persistence.
Sakai WebApp Structure
Text 16 de mayo de 2009 Spring Framework Part III. Portable Service Abstractions Buenos Aires, June 2009.
Topic : Hibernate 1 Kaster Nurmukan. An ORM tool The problem fixed by ORM Advantage Hibernate Hibernate Basic –Hibernate sessionFactory –Hibernate Session.
Copyright 2007 SpringSource. Copying, publishing or distributing without express written permission is prohibited. Introduction to Data Access with Spring.
ESG-CET Meeting, Boulder, CO, April 2008 Gateway Implementation 4/30/2008.
Text 16 de mayo de 2009 Spring Framework Part III. Portable Service Abstractions Buenos Aires, June 2009.
Topic : Hibernate 1 Kaster Nurmukan. An ORM tool Used in data layer of applications Implements JPA.
Introduction – ORM, Helloworld Application
Fundamentals of MyBATIS
Configuration & Management for Joachim Flammer Integration Team EGEE is a project funded by the European Union under contract IST JRA1 all-hands-meeting,
Introduction to ORM Hibernate Hibernate vs JDBC. May 12, 2011 INTRODUCTION TO ORM ORM is a programming technique for converting data between relational.
CS422 Principles of Database Systems Object-Relational Mapping (ORM) Chengyu Sun California State University, Los Angeles.
CS 440 Database Management Systems Stored procedures & OR mapping 1.
Hibernate Online Training. Introduction to Hibernate Hibernate is a high-performance Object-Relational persistence and query service which takes care.
Hibernate Java Persistence API. What is Persistence Persistence: The continued or prolonged existence of something. Most Applications Achieve Persistence.
Fall CIS 764 Database Systems Engineering L11: Object Relational Mapping … (a) ORM, Object persistence (b) Pets sequence.
HIBERNATE/Java Overview of technology for Hibernate by محمد حسن کاظمی پوران Master : M.M.Nematollahi.
Best 3 Software Development Languages. Hibernate Training Hibernate is a high-performance object-relational mapping tool and query service. Hibernate.
A very brief introduction
Persistence – Iteration 4 Vancouver Bootcamp
LOCO Extract – Transform - Load
Sakai Persistence and Intro to Hibernate
Entity Framework By: Casey Griffin.
Aaron Zeckoski Sakai Tool Naming Tips Aaron Zeckoski
Sakai WebApp Structure
Intro to Spring CJUG - January 2013.
Configuring Sakai from Outside the Web Application
Hibernate Bayu Priyambadha, S.Kom.
Testing a persistence layer
Developing and testing enterprise Java applications
Data Access Layer (Con’t) (Overview)
Presentation transcript:

Persistence – Iteration 4 Vancouver Bootcamp Aaron Zeckoski

2 What is persistence? Taking temporary data (like in-memory program data) and storing it in a more permanent form Putting program data somewhere so you can retrieve it later (e.g. after a restart) Writing the information in your Java objects somewhere so you can get to it again after they are destroyed

3 How do we persist data in Sakai? Pretty much always use the database Some file system storage for tools like resources so data is accessible via WebDav You should probably use the database

4 Databases and Sakai Settings to control the database that is used are stored in sakai.properties The sakai.properties file is located in your sakai home (this is configurable but is normally your tomcat home) in the sakai directory Look for the following line in the file # DATABASE CONFIGURATION

5 Some DB config tips Always leave auto.dll=true HSQLDB is turned on by default, it only stores data in memory by default HSQLDB works well for development and for demos You cannot look at the HSQLDB database without some serious trickery

6 More DB config tips MySQL is easy to setup and use and runs pretty efficiently Allows you to look at the database to see if things are working Seems to have trouble working with Sakai in Windows sometimes If all else fails, switch to HSQLDB file storage

7 HSQLDB file storage To use HSQLDB in file mode (where it stores data on the filesystem), comment out this line: and uncomment this one jdbc:hsqldb:${sakai.home}/db/sakai.db

8 MySQL config To use MySQL, uncomment the six lines under this line: ## MySQL settings Comment out the 7 lines under this one: ## HSQLDB settings Update the username and password lines

9 One last DB tip You can turn on verbose Hibernate logging in the sakai.properties file Change the following from false to true # enable hibernate SQL debugging output hibernate.show_sql=false

10 3 ways to persist data to the DB JDBC Spring JDBC nce/jdbc.html Hibernate

11 JDBC Info Java Database Connectivity Industry standard but has some issues: –The developer needs to deal with lot of plumbing and infrastructure, such as endless try-catch-finally-try-catch blocks. –Applications need complex error handling to ensure that connections are properly closed after they're used, which makes the code verbose, bloated, and repetitive. –JDBC uses the rather uninformative SQLException. –JDBC has no exception hierarchy

12 Spring JDBC Info Abstraction framework for JDBC –i.e. It does lots of stuff for you! Some features of Spring JDBC –JdbcDaoSupport – super class, provides JdbcTemplate access –Spring provides an abstract exception layer, moving verbose and error-prone exception handling out of application code into the framework. The framework takes care of all exception handling; application code can concentrate on extracting results by using appropriate SQL. –Spring provides a significant exception hierarchy for your application code to work with in place of SQLException. –For creating instances of oracle.sql.BLOB (binary large object) and oracle.sql.CLOB(character large object), Spring provides the class org.springframework.jdbc.support.lob.OracleLobHandler.

13 Hibernate Info Object / Relational mapping (ORM) and persistence / query framework –i.e. It does even more stuff for you! Some features of Hibernate –HibernateDaoSupport – super class, easy HibernateTemplate access –Database independence - sits between the database and your java code, easy database switch without changing any code –Object / Relational Mapping (ORM) - Allows a developer to treat a database like a collection of Java objects –Object oriented query language (HQL) - Fully supports polymorphic queries, native SQL, and Criteria queries –Hibernate Mapping - Uses HBM XML files to map value objects (POJOs) to database tables –Transparent persistence - Allows easy saves/delete/retrieve for simple value objects –High performance because it is such a lightweight framework

14 More Hibernate Info