Hi Roger, There is a general contract specified for QueryPart.hashCode() as documented in the Javadocs: http://www.jooq.org/javadoc/latest/org/jooq/QueryPart.html#hashCode--
It reads: In general, QueryPart hash codes are the same as the hash codes generated from toString() <http://www.jooq.org/javadoc/latest/org/jooq/QueryPart.html#toString-->. This guarantees consistent behaviour with equals(Object) <http://www.jooq.org/javadoc/latest/org/jooq/QueryPart.html#equals-java.lang.Object-> Some QueryPart implementations may choose to override this behaviour for improved performance, as toString() <http://www.jooq.org/javadoc/latest/org/jooq/QueryPart.html#toString--> is an expensive operation, if called many times. In other words, the current implementation is probably safe for your use-case. Note that it does depend on the SQLDialect (for obvious reasons) and the Settings (for reasons like generating uppercase or lowercase keywords, names, etc.), so you will get different hash codes if you're using different database dialects. You could of course generate the hash code always from the SQLDialect.DEFAULT dialect, for instance. I'm very curious about your use-case. So, essentially, you have an application that runs on e.g. Oracle, MySQL, PostgreSQL, and you write DDL with jOOQ and execute it with Flyway on each database? Cheers, Lukas 2016-05-05 23:59 GMT+02:00 RIT <[email protected]>: > I am just wondering what is used to generate the hashCode in the following > example code for createTable > > > DSLContext create = DSL.using (connection, SQLDialect.DERBY); > > long val = create.createTable("tableName") > .column("first", SQLDataType.BIT) > .column("second", SQLDataType.TINYINT) > .hashCode(); > > The reason for asking is that I am looking to combine JOOQ DDL capability > with Flyway's schema management capabilities and this is best done by > providing Flyway a checksum of each schema modification. This means that > the hashCode should only be generated from the SQL statement that is to be > executed rather than the wider information maintained by the DSLContext. > > If .hashCode in this situation does combine wider information I can just > generate my own from the getSQL, but it would be good to know. > > The idea behind all of this is to use JOOQ's cross dialect capabilities to > handle a couple of different database targets, rather than having to > integrate yet another tool/library/definition stricture to do the the job. > > > Thanks > > -- > You received this message because you are subscribed to the Google Groups > "jOOQ User Group" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to [email protected]. > For more options, visit https://groups.google.com/d/optout. > -- You received this message because you are subscribed to the Google Groups "jOOQ User Group" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. For more options, visit https://groups.google.com/d/optout.
