[hibernate-dev] Help with first patch
Nikolas Everett
nik9000 at gmail.com
Wed Jun 17 10:47:00 EDT 2009
>
> I have another question. The particular bug I wrote a patch for only
>> comes up with MySQL. Is there some way to test hibernate against
>>
>
> Yes. On Hibernate Core, you can override the appliesTo(Dialect) method and
> return "true" for MySQL-based dialects and false for the others.
If I wanted to write a test that ensured that transactions aren't
accidentally committed during a polymorphic delete when a database
constraint is violated, where would I put it?
org.hibernate.test.ops.DeleteTest has a number of tests relating to the
delete operation but none of the mappings in the org.hibernate.test.ops
package have any joined-subclasses in them.
I've attached a diagram of the schema I'd create. My test would:
1. Create a Child and a KeyHolder with a reference to it
2. Commit
3. Delete the Child
4. Catch the expected constraint exception and fail if no exception was
thrown
5. Query for the Child and ensure that its type is still Child and not
Parent
Step 5 would fail for MySQL with InnoDB at this point.
I think if I did override appliesTo(Dialect) it would be to make sure that
foreign key constraints and temp tables work for that dialect. I know
MyISAM doesn't support foreign key constraints and polymorphic deletes
aren't supported for Dialects that don't support temp tables.
Also I ended up testing Hibernate against mysql by:
1. Adding a mysql5 profile to my ~/.m2/settings.xml which overrides
jdbc.url, jdbc.user, and jdbc.pass
2. JAVA_HOME=/usr/lib/jvm/java-1.5.0-sun/ mvn -P mysql5 clean test
That seemed to do the trick. It looks like the same tests fail for mysql as
for the rest of HSQLDB but I didn't do a very thorough check.
Is there a web page with stuff like this? Its not super hard to figure out,
but it would be nice to spell it out explicitly.
>
> MySQL? Just out of curiosity, is there a build farm for hibernate that
>> covers all of the different databases like Postgres has for operating
>> systems at http://buildfarm.postgresql.org/cgi-bin/show_status.pl ?
>>
>
> There is a public Hudson (CI software) instance [1] which should receive
> some attention in the next months. You may want to check the job
> "hibernate-all-trunk" and ignore the others. Also, note that this includes
> most Hibernate projects (ANN/EM/Validator/Search/Validator/...), not only
> Core.
>
> [1] http://hudson.jboss.org/hudson/view/hibernate/
>
Neat. Its not quite as easy to see what is going on compared to the
Postgres one but its a good start.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/hibernate-dev/attachments/20090617/9f40fdbc/attachment.html
-------------- next part --------------
A non-text attachment was scrubbed...
Name: PolymorphicDelete.png
Type: image/png
Size: 4112 bytes
Desc: not available
Url : http://lists.jboss.org/pipermail/hibernate-dev/attachments/20090617/9f40fdbc/attachment.png
More information about the hibernate-dev
mailing list