[hibernate-issues] [Hibernate-JIRA] Commented: (HHH-2558) Allow batching inserts for multi-table entities

Karl Baum (JIRA) noreply at atlassian.com
Mon Jun 4 08:59:04 EDT 2007


    [ http://opensource.atlassian.com/projects/hibernate/browse/HHH-2558?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_27115 ] 

Karl Baum commented on HHH-2558:
--------------------------------

Although my experience with the Hibernate code base is nowhere near where it needs to be to address an issue like this, I would just like to throw out an idea.  After reading over JIRA HHH-1 it sounds like we have the ability to order relationships between entities in order to leverage batch inserting.  We run into problems, however, when one Entity spans multiple tables.   

I was thinking it might be possible to leverage Entity sorting in dealing with joined-subclasses.  In theory, all joined-subclass mappings could instead be replaced with a one-to-one unidirectional constrained foreign key relationship.  Another words, instead of:

public class Parent {

}

public class Child extends Parent {

}

We could have:

public class Parent {

}

public class Child {

  private Parent parent;

  public Parent getParent() {
    return parent;
  }

  public void setParent(Parent parent) {
     this.parent=parent;
  }
}

Would it be possible to somehow represent all joined subclasses as one-to-one relationships when sorting Entities for jdbc batching?  

The idea might be naive, but just thought I would throw it out there.

thx.

-karl


> Allow batching inserts for multi-table entities
> -----------------------------------------------
>
>                 Key: HHH-2558
>                 URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-2558
>             Project: Hibernate3
>          Issue Type: Improvement
>          Components: core
>            Reporter: Steve Ebersole
>
> <joined-subclass/> as well as entity's containing <join/> mappings currently cannot participating in JDBC batching.  The reaons being that the actions (i.e. Executables) perform the insert or update in an atomic fashion through the persisters; the persisters perform the multiple statements.
> One possible approach for solving would be to have the persisters somehow expose the fact that inserts or updates effect multiple tables and to have the actions drive the executions of those statements.
> Another possible approach would be to change how Batcher works.  Currently, batcher is capable of tracking a single jdbc batch statement, which it does by string comparison of the sql.  So a new sql command is seen as the impetus to start a new batch.  So we could change this to make batch a logical concept  such that the "grouping" is actually at a higher level : like say "[command]:[entity-name](:[id])".  Then we could have batches keyed by "update:Customer:1" rather than "update CUSTOMER set ...".  Would need to be very careful in the case of dynamic-insert and dynamic-update...
> This is a follow-on  to HHH-1

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://opensource.atlassian.com/projects/hibernate/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        



More information about the hibernate-issues mailing list