Class PojoEntityTuplizer

    • Method Detail

      • buildProxyFactory

        protected ProxyFactory buildProxyFactory​(PersistentClass persistentClass,
                                                 Getter idGetter,
                                                 Setter idSetter)
        Description copied from class: AbstractEntityTuplizer
        Build an appropriate ProxyFactory for the given mapped entity.
        Specified by:
        buildProxyFactory in class AbstractEntityTuplizer
        Parameters:
        persistentClass - The mapping information regarding the mapped entity.
        idGetter - The constructed Getter relating to the entity's id property.
        idSetter - The constructed Setter relating to the entity's id property.
        Returns:
        An appropriate ProxyFactory instance.
      • getPropertyValuesToInsert

        public java.lang.Object[] getPropertyValuesToInsert​(java.lang.Object entity,
                                                            java.util.Map mergeMap,
                                                            SharedSessionContractImplementor session)
        Description copied from interface: EntityTuplizer
        Extract the values of the insertable properties of the entity (including backrefs)
        Specified by:
        getPropertyValuesToInsert in interface EntityTuplizer
        Overrides:
        getPropertyValuesToInsert in class AbstractEntityTuplizer
        Parameters:
        entity - The entity from which to extract.
        mergeMap - a map of instances being merged to merged instances
        session - The session in which the result set is being made.
        Returns:
        The insertable property values.
      • setPropertyValuesWithOptimizer

        protected void setPropertyValuesWithOptimizer​(java.lang.Object object,
                                                      java.lang.Object[] values)
      • getPropertyValuesWithOptimizer

        protected java.lang.Object[] getPropertyValuesWithOptimizer​(java.lang.Object object)
      • getEntityMode

        public EntityMode getEntityMode()
        Description copied from interface: EntityTuplizer
        Return the entity-mode handled by this tuplizer instance.
        Returns:
        The entity-mode
      • getMappedClass

        public java.lang.Class getMappedClass()
        Description copied from interface: Tuplizer
        Return the pojo class managed by this tuplizer.

        Need to determine how to best handle this for the Tuplizers for EntityModes other than POJO.

        todo : be really nice to not have this here since it is essentially pojo specific...
        Returns:
        The persistent class.
      • buildPropertyGetter

        protected Getter buildPropertyGetter​(Property mappedProperty,
                                             PersistentClass mappedEntity)
        Description copied from class: AbstractEntityTuplizer
        Build an appropriate Getter for the given property.
        Specified by:
        buildPropertyGetter in class AbstractEntityTuplizer
        Parameters:
        mappedProperty - The property to be accessed via the built Getter.
        mappedEntity - The entity information regarding the mapped entity owning this property.
        Returns:
        An appropriate Getter instance.
      • buildPropertySetter

        protected Setter buildPropertySetter​(Property mappedProperty,
                                             PersistentClass mappedEntity)
        Description copied from class: AbstractEntityTuplizer
        Build an appropriate Setter for the given property.
        Specified by:
        buildPropertySetter in class AbstractEntityTuplizer
        Parameters:
        mappedProperty - The property to be accessed via the built Setter.
        mappedEntity - The entity information regarding the mapped entity owning this property.
        Returns:
        An appropriate Setter instance.
      • determineConcreteSubclassEntityName

        public java.lang.String determineConcreteSubclassEntityName​(java.lang.Object entityInstance,
                                                                    SessionFactoryImplementor factory)
        Description copied from interface: EntityTuplizer
        Given an entity instance, determine the most appropriate (most targeted) entity-name which represents it. This is called in situations where we already know an entity name for the given entityInstance; we are being asked to determine if there is a more appropriate entity-name to use, specifically within an inheritance hierarchy.

        For example, consider a case where a user calls session.update( "Animal", cat );. Here, the user has explicitly provided Animal as the entity-name. However, they have passed in an instance of Cat which is a subclass of Animal. In this case, we would return Cat as the entity-name.

        null may be returned from calls to this method. The meaning of null in that case is assumed to be that we should use whatever explicit entity-name the user provided (Animal rather than Cat in the example above).

        Parameters:
        entityInstance - The entity instance.
        factory - Reference to the SessionFactory.
        Returns:
        The most appropriate entity name to use.