Class MyBatisContext

java.lang.Object
org.springframework.data.jdbc.mybatis.MyBatisContext

public class MyBatisContext extends Object
MyBatisContext instances get passed to MyBatis mapped statements as arguments, making Ids, instances, domainType and other attributes available to the statements. All methods might return null depending on the kind of values available on invocation.
Author:
Jens Schauder, Christoph Strobl
  • Constructor Details

    • MyBatisContext

      public MyBatisContext(@Nullable Object id, @Nullable Object instance, @Nullable Class<?> domainType, Map<String,Object> additionalValues)
    • MyBatisContext

      public MyBatisContext(Identifier identifier, @Nullable Object instance, @Nullable Class<?> domainType)
  • Method Details

    • getId

      @Nullable public Object getId()
      The ID of the entity to query/act upon.
      Returns:
      Might return null.
    • getIdentifier

      @Nullable public Identifier getIdentifier()
      The Identifier for a path to query.
      Returns:
      Might return null.
    • getInstance

      @Nullable public Object getInstance()
      The entity to act upon. This is null for queries, since the object doesn't exist before the query.
      Returns:
      Might return null.
    • getDomainType

      @Nullable public Class getDomainType()
      The domain type of the entity to query or act upon.
      Returns:
      Might return null.
    • get

      @Nullable public Object get(String key)
      Returns a value for the given key. Used to communicate ids of parent entities.
      Parameters:
      key - Must not be null.
      Returns:
      Might return null.