All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.mantledillusion.metrics.trail.UUIDStringAttributeConverter Maven / Gradle / Ivy

The newest version!
package com.mantledillusion.metrics.trail;

import javax.persistence.AttributeConverter;
import java.util.UUID;

/**
 * JPA {@link AttributeConverter} to convert a {@link UUID} to {@link String} and vice versa.
 */
public class UUIDStringAttributeConverter implements AttributeConverter {

    @Override
    public String convertToDatabaseColumn(UUID attribute) {
        return attribute.toString();
    }

    @Override
    public UUID convertToEntityAttribute(String dbData) {
        return UUID.fromString(dbData);
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy