jStorm FAQ

Gareth Reeves


Questions
  1. What databases does jStorm Support?
  2. How do I get started?
  3. How does aggregation work?
  4. Does jStorm do one to many associations?
  5. Does jStorm support WHERE clauses?
  6. Can the mapping object be used to hydrate data from multiple tables into a single class?

  1. What databases does jStorm Support?

    Right now jStorm only works on MySql, but we think that there is only one piece of database specific code. That is the code that generates ID's. This code is isolated to within the SqlRunner class. jStorm is built for modification, please feel free to change it to meet your needs. Let me know if you port it to a different database as I would like to include support for more databases.

  2. How do I get started?

    To start using jStorm simple construct a new Mapping object that represents the object that you want to persist or load from the database. Alternatively you can extend StorableObject which uses the template pattern to enable jStorm to get a Mapping for the object. This is the preferred method because it ties the Mapping and the object together.

  3. How does aggregation work?

    Aggregation works by giving two mappings to jStorm and two fields for SELECT to join on. A vector of the objects represented by the second mapping will be returned to the caller. jStorm will look for a setter method on the second object that takes a parameter of the first object. If it finds one it will invoke it and pass the first object as the parameter. Therefore, if you want jStorm to actually join the two objects together you need to make sure that there is a setter method on the second object that takes the first object.

    I know that this is both confusing and limited. I plan on improving it soon. Please send me any suggestions that you have.

  4. Does jStorm do one to many associations?

    No. This is something on my to do list.

  5. Do you support WHERE clauses?

    Yes, and query objects. Both can be specified when as part of the API call. A query object is an instance of one of the objects that you are trying to get back from the database that contains the constraining data. For example, if the object has a id, you could set the id of the object that you want to be returned from the database on the query object and pass it to jStorm. The fully hydrated object will be returned from the database.

  6. Can the mapping object be used to hydrate data from multiple tables into a single class?

    No. You can use simple aggregation to retrieve data from two mappings into two objects that are joined together (i.e. a instance variable on one object is set to the value of the other).