Hibernate version: 3.1.1
Name and version of the database you are using: Postgres 8
I have several multi-column value objects, like Money:
Code:
public class Money implements Comparable, Serializable {
private final BigDecimal amount;
private final Currency currency;
public Money(BigDecimal amount, Currency currency) {
...
}
public BigDecimal getAmount() {
return amount;
}
public Currency getCurrency() {
return currency;
}
...
}
These objects are used as properties on entities and are mapped as such:
Code:
...
public class SomeEntity {
...
private Money money;
@Columns(columns = { @Column(name = "money_amount"), @Column(name = "money_currency" })
@Type("money")
public Money getMoney() { return money; }
public void setMoney(Money money) { this.money = money; }
...
}
Each value object has a CompositeUserType, and everything works fine for all other cases. However, when I try to DML update an entity with a Money property (or any other value object mapped to more than one column), I get bad SQL grammar:
Code:
could not execute update query; bad SQL grammar [update some_entity set money_amount, money_currency1=null where other_prop=?]; nested exception is java.sql.SQLException: ERROR: syntax error at or near ","
So, it looks like the thing that's mapping the property name to the column name(s) doesn't take proper SQL update syntax into account. I haven't been able to find anything in JIRA about this, nor did I see it in the changelog for 3.1.2 or 3.1.3. Is this a bug (that I should file), or am I missing something?
Thanks