Hi all,
I have many tables with composite keys, which generate Id classes during reveng.
I'd like to see reveng generate toString() on these Id classes. (NOT on the entity classes themselves, that would eventually pull in the entire database and then generate infinite output due to circular references between Pojos.)
The Id classes do get equals() and hashCode(), but no toString().
The PojoToString.ftl template file checks a pojo.needsToString() property, but I don't know how to trigger that property at the right times.
I could use <meta attribute="use-in-tostring">true</meta> on all id attributes in all tables, but that would be a lot of XML coding.
Or maybe add the meta in the reveng strategy class (I have one anyway). Not sure where that should be added though.
Either way, I suspect the generated toString might go into the entity class, and I don't want it there.
Use caseI'm currently hunting a bug that says things like
Code:
org.hibernate.ObjectNotFoundException: No row with the given identifier exists: [class.path.Entity#class.path.EntityId@599b1a9e]
The part after the # is effectively generated from somePojo.getId().toString(), and I want a toString that mentions the field values, Object#toString() gives me a rather useless JVM id.