Eclipse and Java: Introducing Persistence

Original location: http://eclipsetutorial.sourceforge.net/persistence.html

Companion document: Persistence-Tutorial-Companion-Document.pdf (248.97 kb)

Lesson 1

  • Create Java project in Eclipse using Import from archive file
  • Learn how to export a project
  • Review of MyLibrary classes
  • Introduce try / catch blocks
  • Create a Scrapbook page
  • Run try / catch blocks inside Scrapbook
  • Checking Javadoc location and Source attachment
  • persistence-lesson01.zip

Lesson 2

  • Convert from JUnit 3 to JUnit 4
  • Introduce Java Annotations
  • Plan methods for converting objects to XML text files
  • Discuss Static Methods
  • Start test method for saveStringToFile() method
  • persistence-lesson02.zip

Lesson 3

  • Complete test method for saveStringToFile() method
  • DIscuss unit tests as class documentation in agile software development
  • Start actual saveStringToFile() method
  • persistence-lesson03.zip

Lesson 4

  • Finish on saveStringToFile() method
  • Discuss BufferedWriter and FileWriter classes
  • Discuss exceptions and throws keyword
  • persistence-lesson04.zip

Lesson 5

  • Finish getStringFromFile() method
  • TODO and Tasks View
  • Run MyUtilitiesTest JUnit test
  • Reading Stack Trace
  • persistence-lesson05.zip

Lesson 6

  • Download and add XStream XML program library to our project
  • Attach source code to Java language classes to our project
  • Learn how to browse the Java source code
  • Learn how to use the Eclipse Hierarchy view
  • Use Eclipse to automatically create equals() and hashCode() methods for Person class
  • persistence-lesson06.zip

Lesson 7

  • Automatically create equals() and hashcode() methods for Book and MyLibrary classes
  • Use Elclipse Open Declaration and Open Type Hierarchy to explore Java language classes
  • Discuss the benefits of XML format
  • Write test method for convertToXML() and convertFromXML() methods
  • persistence-lesson07.zip

Lesson 8

  • Create convertToXML() and convertFromXML() methods
  • Look at XStream web tutorial
  • Test conversion methods
  • Write test method to test conversion to and from XML disk file
  • persistence-lesson08.zip

Lesson 9

  • Create saveMyLibraryToXMLFile() and getMyLibraryFromXMLFile() methods
  • Test our methods
  • Use Eclipse XML editor to examine XML file
  • XML object reference options in XStream
  • Use the Eclipse Compare With Local History feature to compare versions of XML files
  • persistence-lesson09.zip

Lesson 10

  • History View and Compare With Local for Java Source
  • Modify MyLibrary main method and run as Java application in Eclipse
  • Learn about Java class and JAR files
  • Create JAR manifest file with Class-Path
  • Set Java compiler compliance level
  • Create JAR file in Eclipse
  • Execute JAR file in Windows and Linux
  • persistence-lesson10.zip

Lesson 11

  • Overview of Java Object Serialization
  • Discuss the pros and cons of object serialization and XML
  • Create test method for saveMyLibraryToSerialFile() and getMyLibraryFromSerialFile() methods
  • Write saveMyLibraryToSerialFile() method
  • persistence-lesson11.zip

Lesson 12

  • Write getMyLibraryToSerialFile() method
  • Add Serializable interface and serialVersionUID to classes
  • Modify and run AllTests to test the entire application
  • Look at Java Compiler Errors/Warning options
  • persistence-lesson12.zip