My custom type is (no default constructor!):
package com.XXX.common;
public class Email implements Serializable {
private String e;
public Email(String str) {
e = str;
}
}
My entity in Hibernate 3.5.6:
package com.XXX.persistence;
import com.XXX.common;
@Entity
@TypeDef(
name = "email",
defaultForType = Email.class,
typeClass = Email.class
)
public class User {
@Id private Integer id;
@Type(type = "email")
private Email email;
}
Hibernate says:
org.hibernate.MappingException: Could not determine type for:
com.XXX.common.Email, at table: user, for columns:
[org.hibernate.mapping.Column(email)]
What am I doing wrong?