Why Hibernates ignores the name attribute of the @Column annotation?

Posted by svachon on Stack Overflow See other posts from Stack Overflow or by svachon
Published on 2010-04-22T15:03:40Z Indexed on 2010/04/22 15:13 UTC
Read the original article Hit count: 187

Filed under:
|
|
|
|

Using Hibernate 3.3.1 and Hibernate Annotations 3.4, the database is DB2/400 V6R1, running that on WebSphere 7.0.0.9

I have the following class

@Entity
public class Ciinvhd implements Serializable {


    @Id
    private String ihinse;

    @Id
    @Column(name="IHINV#")
    private BigDecimal ihinv;

 ....

}

For reasons I can't figure, Hibernate ignores the specified column name and uses 'ihinv' to generate the SQL:

select
        ciinvhd0_.ihinse as ihinse13_,
        ciinvhd0_.ihinv as ihinv13_,
...

Which of course gives me the following error:

Column IHINV not in table CIINVHD

Did anyone had this problem before? I have other entities that are very alike in the way that they are using # in their database field names and that are part of the PK and I don't have this problem with them.

© Stack Overflow or respective owner

Related posts about hibernate

Related posts about annotations