Umm.. it seems there's a little error in the ForeignKey class. Only the
hashCode() method is using the updateRule and deleteRule properties, while
the equals() is not using these properties at all. Should we be checking
equality using the updateRule and deleteRule properties, are these
significant?
- Animesh
On Fri, May 15, 2009 at 6:29 PM, Animesh Jain <[email protected]> wrote:
> I went debugging into the source to identify the cause. It seems that on
> ForeignKey objects obtained from the hibernate class, the update rule and
> delete rule are null, while the ForeignKey objects for the database have an
> update rule and delete rule = 3 (in my case)
>
> Is this something that can be ignored for hibernate somehow. Or is there a
> way to specify these in hibernate. Maybe make up an annotation of our own,
> if there isn't any? I'm not too sure about this. Looking for some advice.
>
> - Animesh
>
>
> On Fri, May 15, 2009 at 4:58 PM, Animesh Jain <[email protected]>wrote:
>
>> Hi
>>
>> This is a bug I'm facing when diffing my target db against a hibernate
>> domain model, instead of a DB.
>>
>> Assume that I have a table1 in target db with a FK named
>> fk_table1_column1. Now Liquibase is generating addForeignKeyConstraint's
>> with a randomly generated constraint name, and is not detecting that I
>> already have such a constraint present. Eg. the following two statements are
>> getting generated
>>
>> <changeSet author="user (generated)" id="1242384909234-14">
>> <addForeignKeyConstraint baseColumnNames="column1"
>> baseTableName="table1" constraintName="FK5A80D15D488CCCFB"
>> deferrable="false" initiallyDeferred="false" referencedColumnNames="column2"
>> referencedTableName="table2"/>
>> </changeSet>
>>
>> <changeSet author="user (generated)" id="1242384909234-160">
>> <dropForeignKeyConstraint baseTableName="table1"
>> constraintName="fk_table1_column1"/>
>> </changeSet>
>>
>> Now even if I do name my foreign key constraint using the hibernate
>> @ForeignKey attribute to the same name that is already in the target db
>> (fk_table1_column1) it still generates two change sets, one adding a foreign
>> key by the name fk_table1_column1 and one deleting fk_table1_column1. In
>> this case, the first one which is adding the foreign key contraint will fail
>> because it already exists in the target db.
>>
>> Things work fine if I compare between two databases as opposed to
>> comparing with the hibernate model. I hope I've made myself clear.
>>
>> Let me know if you cannot reproduce this and I'll send over a test setup
>> to help out with that. Looking forward to your response.
>>
>> Cheers
>> Animesh
>>
>
>
------------------------------------------------------------------------------
Crystal Reports - New Free Runtime and 30 Day Trial
Check out the new simplified licensing option that enables
unlimited royalty-free distribution of the report engine
for externally facing server and web deployment.
http://p.sf.net/sfu/businessobjects
_______________________________________________
Liquibase-user mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/liquibase-user