FasterXML/jackson-datatype-hibernate — pull request #64 by shane-axiom (2014-12-14 20:59:59+00:00)
Title: Add Feature.ALWAYS_SERIALIZE_LAZY_LOADED_OBJECTS_AS_IDENTIFIER

This pull request adds a Hibernate4Module feature to always serialize lazy loaded objects as bare identifiers, even if the object has already been initialized.

In my use case I need to have the serialization behave consistently whether or not objects have been loaded. Server code decides which full objects should be sent back in a result, and the client assembles the graph based on id fields.

I refactored BaseTest a bit to accomodate the growing number of features. The commit includes a test case for the new feature (AlwaysSerializeIdentifierTest). I also built a test for Feature.SERIALIZE_IDENTIFIER_FOR_LAZY_NOT_LOADED_OBJECTS, which previously didn't have one (UninitializedIdentifierTest).

I only implemented this for Hibernate4Module. Hibernate4Module seems to have several features not present in Hibernate3Module, and the last version of Hibernate 3 was released three years ago, so this seemed sensible to me.

If this request is merged I'll create another with a backport/cherry-pick to 2.4.

Also, I sent a completed [CLA agreement](https://github.com/FasterXML/jackson/blob/master/contributor-agreement.pdf) to info at fasterxml.com.