Persistence
Persistence in Sakai - Former user (Deleted)
- 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
- How do we persist data in Sakai?
- Pretty much always use the database
- File / binary stream storage available (using content hosting service), example: resources/dropbox tool
- Pretty much always use the database
- Databases and Sakai
- Settings are in the sakai.properties file
- 3 accepted ways to persist data to the database
- JDBC - advantages and disadvantages? same as Spring JDBC but harder to use!
- Spring JDBC - advantages and disadvantages? not ORM, more work, more control
- Hibernate - advantages and disadvantages? ORM, easier, less control
- JDBC in Sakai
- Hibernate in Sakai
- 3 ways of using Hibernate in Sakai (powerpoint)
- Create a SessionFactory using settings inside your tool
- Note: Only use this for accessing external databases (out of scope for these docs)
- Create a session factory from the global Sakai sessionFactoryBase
- We will use this method for the workshop and the Task List Tool Exercise
- Add our HBMs to the global Sakai sessionFactory
- This method is demonstrated in this version of the tasklist tool: tasklist-complex
- Example - Enhance Task List Tool to persist tasks