|
Emmanuel, I don't think the problem is that the algorithm is relying on an ordering from the X layer. It's relying on the fact that xClass.getDeclaredProperties() returns a list of properties whose names are unique. (Which is a reasonable assumption to me.)
The X layer is returning two properties named "id" – one based on getId() and one based on isId(). This seems broken to me. (Maybe it's not; there's no javadoc on getDeclaredProperties().)
On the other hand, the java beans Introspector doesn't do what we'd like, either. It returns one property, but it picks isId() (on my jvm anyway). For the test to pass, the getId() method must be chosen. So, making xClass work just like Introspector (which I originally thought would be the best way to go) wouldn't help.
Perhaps really the best solution is to make this scenario throw an exception? It does when you use hbm.xml. It'd be consistent to outlaw this scenario when you use annotations, as well.
|