Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [riena-dev] Issue with hashCode() and 3.5 databinding

Elias Volanakis schrieb:
Quick heads up:

I discovered that having beans which change their hashCode() over
their lifetime (see Person), causes problems with 3.5 databinding and
viewers.

Any objections in changing this in Person?

BankData and Customer are also affected. It's a good idea to review
your bean classes for this...

https://bugs.eclipse.org/bugs/show_bug.cgi?id=264801

Elias.
_______________________________________________
riena-dev mailing list
riena-dev@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/riena-dev

  
hashCode and equals always should use properties not changing over the lifecycle,
so I think the databinding reacts correctly: if hashCode changes its not the same object
for databinding then before

to avoid such problems which also arrive if you're using a primary key generated by database
all my entities have an UUID like

@Column(name = "ADR_UUID", nullable = false, updatable = false, length = 36)
    private String uUID = java.util.UUID.randomUUID().toString();

    /**
     * universally unique identifier (UUID), 16-byte (128-bit)    (36 characters als String)
     * wird als Objekt-Identität benutzt #equals() und #hashCode()
     * used to guarantee object - identity #equals() and #hashCode()
     *
     * @return uUID as {@code  String}
     */
    public String getUUID() {
        return this.uUID;
    }

only my 2c

ekke

--

ekkehard gentz
software-architect
erp-consultant
max-josefs-platz 30, D-83022 rosenheim, germany
homeoffice (1+1 VoIP): +49 8031 2068 325
mailto:ekkehard@xxxxxxxxxxxxxxxxx
homepage: http://www.gentz-software.de
opensource: http://ekkehard.org
blog (en): http://ekkes-corner.org
blog (de): http://ekkes-ecke.org
skype: ekkes-corner
Steuer-Nr: 156/220/30931 FA Rosenheim, UST-ID: DE189929490


Back to the top