Issue Type: Bug Bug
Affects Versions: 2.1-PublicReviewDraft
Assignee: Unassigned
Created: 28/Jun/13 8:34 AM
Description:

When testing a JPA 2.1 Converter, the following exception is thrown:

java.lang.ClassCastException: java.lang.Boolean cannot be cast to java.lang.String at com.acme.entity.util.BooleanTFConverter.convertToEntityAttribute(BooleanTFConverter.java:1)

The converter class is:
package com.acme.entity.util;

import javax.persistence.AttributeConverter;
import javax.persistence.Converter;
@Converter
public class BooleanTFConverter
implements AttributeConverter<Boolean, String> {
@Override
public String convertToDatabaseColumn(Boolean value)

{ return Boolean.TRUE.equals(value) ? "T" : "F"; }

@Override
public Boolean convertToEntityAttribute(String value)

{ return "T".equals(value); }

}

The use in my entity is:
import javax.persistence.Convert;
import com.acme.entity.util.BooleanTFConverter;
...
@Column(name = "ACCOUNT_UNLOCKED")
@Convert(converter=BooleanTFConverter.class)
private Boolean accountUnlocked = true;

This converter works perfectly in the JPA 2.1 reference implementation (EclipseLink 2.5). I can provide a full Eclipse Kepler project if necessary.

Environment: hibernate-release-4.3.0.Beta3
Project: Java Persistence API
Labels: jpa21 Converter
Priority: Blocker Blocker
Reporter: Edward Rayl
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira