|
I have attached a patch for a MySQL-specific unit test, MySQLWithNativeGeneratedIdsTest, that reproduces this issue. It is the same as org.hibernate.test.sql.MySQLTest except its mapping file uses native-generated (auto-increment) IDs. I've add it to the test suite in org.hibernate.test.sql.MySQLWithNativeGeneratedIdsTest. I have also verified that AbstractEntityPersister.patch fixes this issue and does not cause any other unit tests to fail. Gail Badner I have attached a patch for a new test case, I've created this new test case, CustomSQLWithNativeGeneratedIdsTest, so that it will execute using the default dialect (HQLDialect). This test case extends HandSQLTest. The mapping for this test case is the same as MySQLEmployment.hbm.xml except that the native ID generator (identity) is used and it only includes those definitions used by HandSQLTest.testHandSQL(). I moved the methods in HandSQLTest that dealt with stored procedures into HandSQLWithStoredProcsTest and changed Db2SQLTest, MSSQLTest, MySQLTest, DataDirectOracleSQLTest, and OracleSQLTest to extend HandSQLWithStoredProcsTest. I did this for several reasons. I thought it best if this test run by default with HSQLDialect. Since Hypersonic stored procedures are more complicated (they must be written in Java and made accessible to the DB server), and because I felt that HandSQLTest.testHandSQL() was sufficient to test this issue, I decided that implementing this test using stored procedures was not worthwhile. The first patch ( Gail Badner fix looks trivial; lets include it for the next version. note: I haven't looked at the testcases from Gail - just the patch. Well, I checked Gail's testcases. Great work as usual Gail I did make one minor change to your CustomSQLWithNativeGeneratedIdsTest class. You had it extending from the HandSQLTest stuff. I changed it to extend from the more generic DatabaseSpecificFunctionalTestCase. I then applied this test to all dialects which support IDENTITY columns. I then mapped just one entity (Organization) in the corresponding mapping, with a PK using the identity generator. I also added your name as author on your work. I also took this opporunity to clean up this series of tests a little bit. |
|||||||||||||||||||||||||||||||||||||||||||||||||
This patch restores the behavior of 3.1.3 by checking to see if custom insert SQL has been defined and if so, using it instead of the generated SQL.