[hibernate-dev] [OGM] When is AssociationKey serialized?

Sanne Grinovero sanne at hibernate.org
Mon Feb 3 06:08:32 EST 2014


If you store anything in Infinispan, it should at the very least be
Serializable.

A better solution would be to provide custom Externalizers:
https://hibernate.atlassian.net/browse/OGM-37

On 3 February 2014 10:56, Gunnar Morling <gunnar at hibernate.org> wrote:
> Hi,
>
> I'm wondering why org.hibernate.ogm.grid.AssociationKey implements
> Serializable. When is it actually serialized?

When you use Infinispan in clustered mode.

>
> I'm suspecting the answer is "never", as the type of the "metadata" member
> is not serializable, so I'd expect a NotSerializableException to be raised.

Our problem is probably that we don't have integration tests using
Infinispan in modes other than "Local".
I suspect I avoided making them as they make the testsuite slower, but
it seems you just highlighted an important reason to add them :-/

>
> If so, does anything speak against making AssociationKey not implement
> Serializable?

It's needed. Also I think it's an important "warning flag" in terms of
design: never consider hooking references to services in such a key,
and strive to keep it as a very simple value holder.

-- Sanne

>
> Thanks,
>
> --Gunnar
> _______________________________________________
> hibernate-dev mailing list
> hibernate-dev at lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/hibernate-dev


More information about the hibernate-dev mailing list