impetus-opensource/Kundera — pull request #27 by zenbones (2012-01-25 20:42:25+00:00)
Title: Kundera 2.0.5

This is a 2.0.5 patch with...

1) Added creation of source jars in the parent pom (helpful for anyone wishing to debug kundera)
2) Changed getId() in PropertyAccessorHelper to use method access only for proxy classes, and use field level access on original Entities (as this is the only access kundera currently supports).

Unfortunately, as my last patch request seems to have never been integrated from the viewpoint of my fork in git, there are older patch files included here. However, as this is the slf4j patch, which should also be both correct and necessary, that's probably fine. It's your patch process, so I guess you'll work it out.

I'll note there's probably still a problem with setId() in PropertyAccessorHelper, as it still always uses method level access. As this will *never* operate correctly with the internally held id, within the proxy wrapper, I'm not sure how to handle this. Why is the 'id' field being updated by kundera? Should the proxy me made aware of id updates so it can keep its internal model in synch? Either way, field level access should be used against the real Entity. So, what I believe would be correct is...

1) If not a proxy, update the id via field level access (see my patch for getId()).
2) If a proxy, use 'setId()' on the proxy class itself. The proxy class should intercept this call (look for it the same way it looks for getId() calls), update its internal model (setting its 'id'), and then call against the actual Entity with field level access.

Both getId() and setId() will need to be updated once kundera properly handles both field and property level access (responding to where @Id is placed), to leverage the right access method against the non-proxied underlying Entity in all cases.