Wednesday 21 November 2012

itcrowd-domain-findbugs 1.0.0

We're tired for manual checking javax.validation annotations against entity's persistent properties. For all of you who feel the same we bring itcrowd-domain-findbugs.

What is so painful? Let's look at the example.
@Table(name = "SizeTestingEntity")
public class SizeTestingEntity {
// ------------------------------ FIELDS ------------------------------

    @Column(length = 34)
    private String invalidD;

    private String invalidE;

    @Size(max = 34)
    @Column(length = 34)
    private String validA;

    @Column(nullable = false)
    private String missingNotNull;

    @ManyToOne(optional = false)
    @JoinTable(name = "BLA", joinColumns = @JoinColumn(name = "ManyToOneEntity"), inverseJoinColumns = @JoinColumn(name = "joinTableD"))
    private Group joinTableD;

If we have @Column for attribute of type String it's good to specify @Size.
@Column with attribute "nullable=false" should be accompanied with  @NotNull or @NotEmpty annotation.
Other thing we have to keep synchronized is value of "optional" attribute of @ManyToOne against @NotNull.

There is also many other checks. Maintaining this manually is a nightmare, so we've written plugin for findbugs that does this automatically.
Right now there are following checks:
  • ForeignKeyInconsistency
  • NotNullInconsistency
  • NotEmptyInconsistency
  • SizeInconsistency
  • TableInconsistency
  • ManyToOneInconsistency
We plan to add more checks in future.


All you have to do is to configure findbugs to be aware of our plugin. Here is sample configuration of findbugs-maven-plugin:
Of course you have to add our artifactory to your maven settings.xml:
Downloads are available at our Artifactory : itcrowd-findbugs-domain-1.0.0.jar.
Sources are hosted at

1 comment:

  1. Still, take the extra time to certain that|be sure that|ensure that} the bonuses and promotions are best suited for you. Every cell casino will offer you a great new participant promotion, however it is still important to consider about|to contemplate} whether it is the proper deal for you. For instance, a sign-up bonus that gives a huge number of free spins on slots is still nice, however 바카라사이트 not best suited to a participant who prefers blackjack.