-->
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.  [ 2 posts ] 
Author Message
 Post subject: Generating Schema Process Reorders FK Columns Arbitrarily
PostPosted: Wed Apr 09, 2008 5:07 am 
Newbie

Joined: Fri Oct 06, 2006 8:09 pm
Posts: 5
Location: Costa Mesa, CA
Starting with hibernate-annotations-3.2.0.GA, the schema SQL file that is generated via the Configuration, AnnotationConfiguration, Table, etc. classes arbitrarily reorders the foreign key columns (in the generated create table statements).

I've tracked this down to a Comparator class created in the AnnotationConfiguration.processFkSecondPassInOrder() method. This Comparator uses the hashcode value against instances of the FkSecondPass.java class. Unfortunately, FkSecondPass,java doesn't implement hashCode, so the ordering of foreign key columns changes for one execution of the generate schema process to another.

This isn't really a bug, however, our build process takes a checksum of the file generated by this process, as well as 4 or 5 other files we generate with additional constraints, indexes, etc. With the foreign key columns changing order all the time, this checksum is constantly changing, forcing our developers to drop their schema, test data, etc., then recreate the schema, seed data, etc., and with well over 400 tables, 4000 constraints, tons of seed data, tests that need to execute to re-build some binary information, etc., the turn around time for recreating the schema is about 20 minutes.

Anyway, I've added simple hashCode() and equals() methods to the FkSecondPass.java class, and this problem went away. The hashcode and equals includes the FkSecondPass.java class' Ejb3JoinColumns, so the hashcode is deterministic.

If this change or something similar could be incorporated into a future release of the annotations project, that would be great.


Top
 Profile  
 
 Post subject:
PostPosted: Thu Apr 10, 2008 6:44 pm 
Hibernate Team
Hibernate Team

Joined: Sun Sep 14, 2003 3:54 am
Posts: 7256
Location: Paris, France
3.3.2 no longer suffer this bug AFAIR

_________________
Emmanuel


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

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.