-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 
Author Message
 Post subject: Weird Column Length problem
PostPosted: Tue Sep 08, 2009 7:57 pm 
Newbie

Joined: Tue Sep 08, 2009 7:38 pm
Posts: 6
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.


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.