Hotspots: Admin Pages | Turn-in Site |
Current Links: Cases Final Project Summer 2007
Working with Glorp - Edric Chen
Ok this is going to be short and straight to the point. Glorp is very easy to use once you figure out the basics.
Here is what you need to know to get started:
- Set up a table descriptor class. This took me forever to figure out until I found the tutorial that I have attached below. The table descriptor maps your objects to the databases tables. You will only need one of these for your system. See our final.st file in m6/m7 for Team Smalltalk to see what I mean.
- You can use the store repository as your database. Make sure you register a new username and password because you really don't want to use your publishing account for the database. It is just not good practice. Just go to the same place your registered to get in the repository and make a new account.
- Don't worry about knowing how to use databases. Glorp takes most of that stress away from you.
- To check that your data stored correctly go to Tools->Database->Ad Hoc SQL and login using the the new account you created for storing in the database and the environment is the same place as the repository, just copy and paste it in there. To look for your data just use SELECT (or Column Name) FROM myTable (Your Tables Name) and hit execute.
For coding, here are some tips:
- When you set up a BeginUnitOfWork you can edit data that you have pulled by just committing like with CommitUnitOfWork.
- Only use the register command when you are storing new stuff into the database, not when editing.
- Glorp can store OrderedCollections and Dictionarys and these are in the tutorial. It would be best if you stick to these 2 types of collections so you don't have to figure out how to store other types.
- Always pull the top level data from your collection like if you have a System class that holds collections of everything else, pull the System class using the readOneOf command and edit the data from there using basic smalltalk and commit it to the database using CommitUnitOfWork.
- You will find it stupid that you have to place the code for a new session and accessor everytime you need to access data. Just create a method that you can call that will do this for you. Just remember to logout of the accessor each time you call that method though.
- Make sure you always have a way of recognizing your objects. For example, in our System class we had a system_id variable since no other variables were in that class. You don't need an id with ever class, just at least one unique variable to pull from like a username.
Here is all the guides I used to get me on my way as well as our final.st file to help you out:
Final.st – My groups code to help you out.
FILE function cannot find the upload. – Helps you understand the ordered collection stuff a little bit more.
GlorpTutorial.pdf –THE BEST TUTORIAL!
GlorpUserGuide.pdf – The lousy and outdated Glorp tutorial from their website. Don't use this. I just posted it here so you would know not to.
Link to this Page
- Cases last edited on 30 July 2011 at 2:33 am by r59h132.res.gatech.edu