/*
 * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
* ORACLE PROPRIETARY/CONFIDENTIAL. Use is subject to license terms.
*/
package com.sun.ts.tests.jpa.core.annotations.convert;

import javax.persistence.Converter;
import javax.persistence.AttributeConverter;

// Having this set to false means that these methods should not be executed
@Converter(autoApply = false)
public class DisableAutoApplyConverter implements AttributeConverter<String, String> {

    public String convertToDatabaseColumn(String attribute) {
        System.out.println("*** Entering DisableAutoApplyConverter:convertToDatabaseColumn["+attribute+"] ***");
        attribute="DisableAutoApplyConverter:convertToDatabaseColumn - THIS SHOULD NOT HAVE BEEN EXECUTED";
        System.out.println("*** Leaving DisableAutoApplyConverter:convertToDatabaseColumn["+attribute+"] ***");
        return attribute;
    }

    public String convertToEntityAttribute(String dbData) {
        System.out.println("*** Entering DisableAutoApplyConverter:convertToEntityAttribute["+dbData+"] ***");
        dbData="AutoApplyConverter2:convertToEntityAttribute - THIS SHOULD NOT HAVE BEEN EXECUTED";
        System.out.println("*** Leaving DisableAutoApplyConverter:convertToEntityAttribute["+dbData+"] ***");

        return dbData;
    }

}

