Hi folks!
We are using Hibernate as our persistence layer with NetBeans 6.7.1, EJB3, Glassfish and PostgreSQL.
We have almost 200 tables defined as EJB entities. We use annotations on the entities to define the tables/columns. As we are still in an early testing phase, we regularly drop all the tables in the database and use the Hibernate auto schema update to recreate them.
Recently we changed the length of a standard field that appears in many of our tables. The column is called ID_ORDER and is defined in the entities using the following code:
Code:
@Column(name = "ID_ORDER", length = STANDARD_ID_ORDER_LENGTH, nullable = false)
private String idOrder;
where STANDARD_ID_ORDER_LENGTH is defined as a public static final int in the superclass of these tables.
This length used to be 20, but we increased this to 50, recompiled all the affected classes, dropped all the tables and redeployed.
Now, on 2 developer machines this change worked correctly, with the new tables having their ID_ORDER columns all length 50.
However, on the other 2 developer machines, one table (called FEED_TYPE) gets recreated with the ID_ORDER column with length 20.
We have tried all sorts of things on these machines to try and 'fix' this. We have removed the column completely, recreated the table and it is still there! We have explicitly set the length in the annotation of the column of this one table and the length is always ignored. We have renamed the existing column and deployed, but the new column is always length 20. We have renamed the table and then recreated it - still wrong. We have even dropped the entire database and recreated it, but the length of 20 remains!
We are pulling our hair out on this one, it just doesn't make any sense. Where is hibernate 'caching' the length definition of this one column in one table?
Any ideas would be gratefully received.
Cheers, Duncan.