Class PathConverter

  • All Implemented Interfaces:
    javax.persistence.AttributeConverter<java.nio.file.Path,​java.lang.String>

    public class PathConverter
    extends java.lang.Object
    implements javax.persistence.AttributeConverter<java.nio.file.Path,​java.lang.String>
    Converts a Path to a String before persisting a value to a column in a database. Allows us to store a the absolute path to a file instead of trying to store the file in the relational database.
    • Constructor Detail

      • PathConverter

        public PathConverter()
    • Method Detail

      • convertToDatabaseColumn

        public java.lang.String convertToDatabaseColumn​(java.nio.file.Path attribute)
        Specified by:
        convertToDatabaseColumn in interface javax.persistence.AttributeConverter<java.nio.file.Path,​java.lang.String>
      • convertToEntityAttribute

        public java.nio.file.Path convertToEntityAttribute​(java.lang.String dbData)
        Specified by:
        convertToEntityAttribute in interface javax.persistence.AttributeConverter<java.nio.file.Path,​java.lang.String>