Announcement Announcement Module
Collapse
No announcement yet.
Hibernate annotation not working with column name Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Hibernate annotation not working with column name

    I've got the following annotation for the Money member of a Product entity:
    Code:
    @Type(type="com.company.project.dao.usertype.MoneyUserType")
        @Columns(columns = {
            @Column(name="price"),
            @Column(name="currency")
        })
        private Money price;
    This is the Money class (ommitted members):
    Code:
    @Embeddable
    public final class Money implements Serializable {
    
      public Money(BigDecimal amount, Currency currency) {
    	this.amount = amount;
    	this.currency = currency;
      }
    The problem is that the SQL generated from Hibernate doesn't contain the "price" column, but instead wants to retrieve data from the "amount" column.

    I don't understand why this is happening? What did I do wrong?
Working...
X