News for hackers. Stuff that matters.
Re:An annotation nightmare by grey-area on Sunday December 22, 2013 @11:26AM (#6950694)
Just to take the join definition, here it is :

    @JoinTable(
    name = "customer_order",
    joinColumns = {
        @JoinColumn(name = "customer_id", referencedColumnName = "id")
    },
    inverseJoinColumns = {
        @JoinColumn(name = "order_id", referencedColumnName = "id")
    }
    )
In rails, this would be:

    belongs_to :customer
and maybe has_many or belongs_to on customer for the inverse.

and the xml translation is pretty transparent too, under the hood it's not very different, but it's a lot simpler to write/read. It is possible to get rid of a lot of this sort of boilerplate by adopting conventions about naming etc and then specifying the exceptions where necessary. I do think these would be better moved to methods rather than being object attributes like this (which read like a translation of XML into text annotations on the object, rather than convention + code when convention isn't enough).

There are no comments on this comment yet.