[Contrib: Evaluation System] Question about "batch" creation of eval entities

Jim Eng jimeng at umich.edu
Mon Jul 26 08:40:35 PDT 2010


Hi Aaron,

This email describes a scenario and asks a two-part question about it.  The first part of the question is intended to be about hibernate generally.  The second part of the question is intended to focus in on specifics about the use of hibernate in EVALSYS.

The scenario:  We import EVALSYS entities from an external system.  Each "order" contains XML describing a template [1], a bunch of template items [2], an evaluation [3] and an assign group [4].  Relationships among these various entities are expressed as EID elements in the XML.  For example, a template has an EID, and each of the template items has a template element that contains an EID element indicating the template it belongs to.  Each of these items is used just once (e.g. each evaluation has a unique template, each assign group has a unique evaluation, etc).

Suppose we create Java objects for each of the entities represented in an XML document representing one "order" as described above.  Then you call EvalTemplateItem.setTemplate(EvalTemplate) on each of the template item objects, passing the template object as a parameter, and you call EvalTemplate.setTemplateItems(Set<EvalTemplateItem>) passing a Set containing all of the template item objects.  You also call EvalTemplateItem.setItem(EvalItem) for each template item, passing in a previously persisted object of type EvalItem that has been retrieved using EvalCommonLogic.getItemByEid(String).  And we go on to create a fully connected object graph, with all relationships among the set of new entities described by the XML are explicitly set, and all references to previously persisted entities are explicitly set as references to Java objects retrieved through evaluation API methods.  Ultimately, you would have an object of type EvalAssignGroup "containing" an object of type EvalEvaluation in a member variable.  The EvalEvaluation would "contain" an object of type EvalTemplate, and the EvalTemplate object would contain a set of objects of type EvalTemplateItem, each of which also "contains" that same EvalTemplate object

The question:  Might it be possible to save all of these new entities with a single API call?  I'd really like to ask this in two parts: (1) Does hibernate support such operations in general?  and, if so, (2) Would it be possible to add a method chain from one of the EVALSYS logic classes to the DAO to hibernate to make such a scheme work in EVALSYS?   

I guess I should also ask whether this would be desirable if it's possible, but I'll address that separately.  I will instead add a sentence or two about my motivation in asking these questions:  Our current import process works, but it spends a lot of time in the hibernate layer saving (and maybe resaving) sets of template items.  Basically it is calling API methods to save a template and then to save each of the template items. It seems like hibernate spends more time than necessary doing that in methods dealing with "persistable sets" of template items.  That makes us wonder if the process might be improved by persisting the entire fully-connected object graph rather than by saving each entity separately.  

We appreciate any advice you might have about this.

Thanks.

Jim
   


[1] https://source.sakaiproject.org/contrib/evaluation/trunk/api/src/java/org/sakaiproject/evaluation/model/EvalTemplate.java
[2] https://source.sakaiproject.org/contrib/evaluation/trunk/api/src/java/org/sakaiproject/evaluation/model/EvalTemplateItem.java
[3] https://source.sakaiproject.org/contrib/evaluation/trunk/api/src/java/org/sakaiproject/evaluation/model/EvalEvaluation.java
[4] https://source.sakaiproject.org/contrib/evaluation/trunk/api/src/java/org/sakaiproject/evaluation/model/EvalAssignGroup.java




More information about the evaluation mailing list