SQL : BeanSerializer with hashCode + equals + toString

Bug #759130 reported by Timo Westkämper
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
Revision history for this message
Luis Fernando Planella Gonzalez (luisfpg) wrote :

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

Revision history for this message
Timo Westkämper (timo-westkamper) wrote :

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;
    }

Revision history for this message
Luis Fernando Planella Gonzalez (luisfpg) wrote :

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
Revision history for this message
Timo Westkämper (timo-westkamper) wrote :

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  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.