On 3 February 2014 12:12, Gunnar Morling <gunnar(a)hibernate.org> wrote:
2014/2/3 Sanne Grinovero <sanne(a)hibernate.org>
>
> 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
Ah, I see. I like the Externalizer approach as I found it surprising that AK
implements Serializable as there apparently is no need for it from the
perspective of the core engine itself.
>
>
>
> On 3 February 2014 10:56, Gunnar Morling <gunnar(a)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 :-/
Ok, I've created
https://hibernate.atlassian.net/browse/OGM-434 for adding a
test for this scenario. I'm still wondering how it supposed to work given
that AssociationKey contains a non-serializable non-transient member.
That's a problem, we need to remove it.
I can help making the Infinispan tests but would be nice if you could
start removing the non-serializable members, or track it as a separate
issue. That would help me a lat, as I fear I've got a bit out of touch
with that area of OGM.
>
> >
> > 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.
Hum, not sure whether making a type Serializable is the right way to
indicate such a matter. But of course the requirement stands as is for
Infinispan as you describe, at least unless that Externalizer-based approach
gets implemented.
I guess it's a matter of habits. If I see a class declaring
"Serializable" it (personally) affects my design considerations.
Sanne
Thanks for the clarification,
--Gunnar
>
>
> -- Sanne
>
> >
> > Thanks,
> >
> > --Gunnar
> > _______________________________________________
> > hibernate-dev mailing list
> > hibernate-dev(a)lists.jboss.org
> >
https://lists.jboss.org/mailman/listinfo/hibernate-dev