SQL : BeanSerializer with hashCode + equals + toString

Bug #759130 reported by Timo Westkämper on 2011-04-12
8
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Querydsl
Fix Released
Undecided
Unassigned

Bug Description

* equals(): based on class and primary key
* hashCode(): return primary keys's hash code
* toString(): Something like "Class#pk" for single column PKs, and Class#<col1,col2,col3> for multiple columns.

summary: - SQL : BeanExporter with hashCode + equals + toString
+ SQL : BeanSerializer with hashCode + equals + toString
Changed in querydsl:
status: New → In Progress

Attached a patch to output <null> on toString() to null pk's, not invoking the super.toString()

The patch didn't work, but I commited something similar :

patch :

    @Override
    public String toString() {
        return "Multikey#" + id == null ? "<null>" : "\"" + id + "\""+ "; + id2 == null ? "<null>" : "\"" + id2 + "\""+ "; + id3 == null ? "<null>" : "\"" + id3 + "\"";
    }

commited :

    @Override
    public String toString() {
        return "Multikey#" + id+ ";" + id2+ ";" + id3;
    }

Way better.
When I first looked at the serializer code, I thought you had quoted each value, that's why I added them...
The way it is now, it's perfect.

Changed in querydsl:
status: In Progress → Fix Committed

Released in 2.2.0-beta4

Changed in querydsl:
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers