[
http://opensource.atlassian.com/projects/hibernate/browse/HHH-5937?page=c...
]
Gail Badner commented on HHH-5937:
----------------------------------
I see that the test case was already pushed to master, but not to 3.6. The test also
passes on 3.6, so I've pushed it to the 3.6 branch.
Steve, can this be resolved now?
@Enumerated(EnumType.STRING) not taken into account in an @Embeddable
included in another @Embeddable
-----------------------------------------------------------------------------------------------------
Key: HHH-5937
URL:
http://opensource.atlassian.com/projects/hibernate/browse/HHH-5937
Project: Hibernate Core
Issue Type: Bug
Components: annotations
Affects Versions: 3.6.1
Environment: MySQL 5.1.40 / hibernate-entitymanager 3.6.1.Final
Reporter: Thomas Vanstals
Assignee: Steve Ebersole
Fix For: 3.6.next
Time Spent: 44m
I have a Customer entity containing a collection of Investment.
The Investment ({{@Embeddable}}) class contains a MonetaryAmount.
The MonetaryAmount ({{@Embeddable}}) contains an enumerated property ('currency')
annotated with {{(a)Enumerated(EnumType.STRING)}}.
The 'currency' field is mapped to a column having the following definition:
{{`currency` int(11) DEFAULT NULL}}. This is not correct. The column definition should be
{{`currency` varchar(3) DEFAULT NULL}}.
If a add a MonetaryAmount property in the Customer class, the generated column definition
is correct ({{`currency` varchar(3) DEFAULT NULL}}).
{code:title=Customer.java|borderStyle=solid}
@Entity
public class Customer {
@Valid
@ElementCollection(fetch = FetchType.EAGER)
private List<Investment> investments = new ArrayList<Investment>();
}
{code}
{code:title=Investment.java|borderStyle=solid}
@Embeddable
public class Investment {
@Valid @NotNull
private MonetaryAmount amount;
@Column(length = 500) @Length(max = 500)
private String description;
private Date date;
}
{code}
{code:title=MonetaryAmount.java|borderStyle=solid}
@Embeddable
public class MonetaryAmount {
@NotNull
private Double amount;
@Column(length = 3)
@Enumerated(EnumType.STRING)
private CurrencyCode currency;
}
{code}
--
This message is automatically generated by JIRA.
For more information on JIRA, see:
http://www.atlassian.com/software/jira