The problem is not that the column type is at least not what JPA is complaining about right now, the problem is that the JPA does not know how to map the Price type, which is not one of the main supported type or object.
2.1.1 Constant fields and properties
Permanent fields or properties an organization can have the following types: Java primitive types; java.lang.String ; other Java serializable types (including wrappers of primitive types, java.math.BigInteger java.math.BigDecimal java.util.Date java.util.Calendar java.math.BigInteger , java.math.BigInteger , java.math.BigInteger , user-defined serializable types, byte[] , byte[] , char[] and Character[] ; enumerations; organization types and / or collections of entity types; and inline classes (see section 2.1.5).
With standard JPA, try using the Embeddable and Embedded annotations:
@Embeddable public class Price { private BigDecimal amount; ... }
and then in your organization:
@Embedded @AttributeOverrides({ @AttributeOverride(name="amount", column=@Column (name="AMOUNT")) }) public Price getPrice() { ... }
Another option is to use TransformationMapping (specific to EclipseLink).
References
- JPA 1.0 Specification
- 2.1.5 Inline classes
- 2.1.6 Display default values ββfor fields or properties without binding
- 9.1.34 Embed annotation
- 9.1.35 Built-in annotation
source share