jackson-datatype-hibernate icon indicating copy to clipboard operation
jackson-datatype-hibernate copied to clipboard

Allow passing `SessionFactory` override via (de)serialization attributes

Open cowtowncoder opened this issue 11 years ago • 1 comments

(related to #58)

In addition to allowing module to be constructed with specific SessionFactory, it may be useful to allow passing of per-call factory instead. If so, this is easiest done using new "attributes" functionality that was added in Jackson 2.4.

cowtowncoder avatar Sep 25 '14 17:09 cowtowncoder

Implementation should be quite easy with:

  1. Define key to use for the attribute: either custom java.lang.Object with proper overrides (to guarantee equality-uniqueness) or just a String
  2. Make PersistentCollectionSerializer aware of key to use, check to see if a SessionFactory has been specified, use it.

and the only (?) messy part is the fact that the user needs to directly set given Attribute with the name; this can not be done via Module (since it's not connected with mapper after registration), although we could allow changing of key to use if that makes sense (not sure it does but whatever).

cowtowncoder avatar Jan 23 '15 18:01 cowtowncoder