[hibernate-dev] unit test PSA

Brett Meyer brmeyer at redhat.com
Mon Aug 5 16:49:04 EDT 2013


A friendly PSA regarding unit tests...

I spent the afternoon cleaning up tests that were failing in our matrix CI job.  There were lots of failures on various DBs due to the following:

1.) Columns referenced by a UK/PK must NOT be nullable.
2.) Tests that solely use ConnectionProviderBuilder in the Configuration (pure unit tests, not functional tests) should use "@RequiresDialectFeature( value = ConnectionProviderBuilder.class )".  ConnectionProviderBuilder now extends DialectCheck.  The Dialect used by ConnectionProviderBuilder (currently H2) will therefore be required and all others skipped.
3.) Avoid the use of reserved keywords ("User", "Table", "Comment", etc.).  If it seems like it's possible for it to be reserved somewhere, please avoid.
4.) Table and column name lengths, including collection tables, should be less than 30 characters.  This was mainly an issue with entities embedded in the test class (implicit name is ParentClass$SubClass).

https://hibernate.atlassian.net/browse/HHH-8420

If everyone could keep those in mind, I'd sincerely appreciate it.  It removes time-consuming debugging later on (although I realize that most of those are very dialect-specific).  Thanks!


More information about the hibernate-dev mailing list