Here are some tips and tricks for developers of Sonar core.
Connect to Derby from command line
- download derby(the same version as used by sonar)
- set the DERBY_HOME property
- execute the command $DERBY_HOME/bin/ij
- connect to the database :
Compare XML files from JUnit
Use XMLUnit. The dependency is already defined into maven.
Warning : There's a bug on the similar method. It should not fail when just moving xml nodes, but actually it fails.
Override Object.equals() and hashCode()
You can use EqualsBuilder and HashCodeBuilder from commons-lang to simplify. Just define the fields to compare. Example on the Rule class :
How to map CLOB columns to String Java fields into Hibernate
Example on the table RULES, mapped by the class Rule. The DESCRIPTION column is a CLOB whereas as the Java field is a String. The most frequent error is :
The solution is to add the @Type annotation :

