Class BulkQueryEntities

  • public class BulkQueryEntities
    extends java.lang.Object
    Utilities for managing an alternative JPA entity model optimized for bulk loading multi-level entities such as DomainBase and DomainHistory.

    In a bulk query for a multi-level JPA entity type, the JPA framework only generates a bulk query (SELECT * FROM table) for the base table. Then, for each row in the base table, additional queries are issued to load associated rows in child tables. This can be very slow when an entity type has multiple child tables.

    We have defined an alternative entity model for DomainBase and DomainHistory, where the base table as well as the child tables are mapped to single-level entity types. The idea is to load each of these types using a bulk query, and assemble them into the target type in memory in a pipeline. The main use case is Datastore-Cloud SQL validation during the Registry database migration, where we will need the full database snapshots frequently.

    • Field Detail


        public static final<java.lang.String,​java.lang.String> JPA_ENTITIES_REPLACEMENTS
        The JPA entity classes in persistence.xml to replace when creating the JpaTransactionManager for bulk query.

        public static final<java.lang.String> JPA_ENTITIES_NEW
    • Constructor Detail

      • BulkQueryEntities

        public BulkQueryEntities()