Class JpaAssociationAttributeConverter<T extends org.jmolecules.ddd.types.AggregateRoot<T,ID>,ID extends org.jmolecules.ddd.types.Identifier,S>

java.lang.Object
org.jmolecules.spring.jpa.JpaAssociationAttributeConverter<T,ID,S>
All Implemented Interfaces:
javax.persistence.AttributeConverter<org.jmolecules.ddd.types.Association<T,ID>,S>

public class JpaAssociationAttributeConverter<T extends org.jmolecules.ddd.types.AggregateRoot<T,ID>,ID extends org.jmolecules.ddd.types.Identifier,S> extends Object implements javax.persistence.AttributeConverter<org.jmolecules.ddd.types.Association<T,ID>,S>
JPA flavor of AssociationAttributeConverter.
Author:
Oliver Drotbohm
  • Field Details

    • OBJECT_TYPE_DESCRIPTOR

      protected static org.springframework.core.convert.TypeDescriptor OBJECT_TYPE_DESCRIPTOR
    • toAssociation

      protected final PrimitivesToAssociationConverter<?> toAssociation
    • toPrimitive

      protected final AssociationToPrimitivesConverter<?> toPrimitive
    • idTypeDescriptor

      protected final org.springframework.core.convert.TypeDescriptor idTypeDescriptor
  • Constructor Details

    • JpaAssociationAttributeConverter

      public JpaAssociationAttributeConverter(Class<ID> idType)
      Creates a new JpaAssociationAttributeConverter for the given id type.
      Parameters:
      idType - must not be null.
  • Method Details

    • convertToDatabaseColumn

      public S convertToDatabaseColumn(org.jmolecules.ddd.types.Association<T,ID> attribute)
      Specified by:
      convertToDatabaseColumn in interface javax.persistence.AttributeConverter<T extends org.jmolecules.ddd.types.AggregateRoot<T,ID>,ID extends org.jmolecules.ddd.types.Identifier>
    • convertToEntityAttribute

      public org.jmolecules.ddd.types.Association<T,ID> convertToEntityAttribute(S dbData)
      Specified by:
      convertToEntityAttribute in interface javax.persistence.AttributeConverter<T extends org.jmolecules.ddd.types.AggregateRoot<T,ID>,ID extends org.jmolecules.ddd.types.Identifier>