ebean-redis issue with UUID keys

47 views
Skip to first unread message

fga...@cloudops.com

unread,
Jun 21, 2023, 12:29:18 PM6/21/23
to Ebean ORM
Hi,

we are trying to set L2 Caching with ebean-redis (latest version) and I am running into an issue where it's complaining that the key its trying to encode is a UUID instead of a string but only in specific cases. I have these two models

@Cache
@Entity
class Organization {
   @Id
   UUID id;

  @OneToMany(mappedBy="organization")
   List<Account> accounts;
   ..
}

@Cache
@Entity
class Account {
   @Id
   UUID id;

  @ManyToOne
   Organization organization;
   ..
}

I get the following stacktrace when it tries to lazy load the accounts of the Organization object. (I also get it in a few other places but the issue is always in EncodePrefixKey.encode)

java.lang.RuntimeException: Failed to decode cache data
at io.ebean.redis.encode.EncodePrefixKey.encode(EncodePrefixKey.java:24)
at io.ebean.redis.RedisCache.key(RedisCache.java:90)
at io.ebean.redis.RedisCache.put(RedisCache.java:177)
at io.ebeaninternal.server.deploy.BeanDescriptorCacheHelp.cachePutManyIds(BeanDescriptorCacheHelp.java:327)
at io.ebeaninternal.server.deploy.BeanDescriptorCacheHelp.manyPropPut(BeanDescriptorCacheHelp.java:317)
at io.ebeaninternal.server.deploy.BeanDescriptor.cacheManyPropPut(BeanDescriptor.java:1215)
at io.ebeaninternal.api.LoadManyRequest.postLoad(LoadManyRequest.java:122)
at io.ebeaninternal.server.core.DefaultBeanLoader.loadMany(DefaultBeanLoader.java:38)
at io.ebeaninternal.server.core.DefaultServer.loadMany(DefaultServer.java:529)
at io.ebeaninternal.server.loadcontext.DLoadManyContext$LoadBuffer.loadMany(DLoadManyContext.java:222)
at io.ebean.common.AbstractBeanCollection.lazyLoadCollection(AbstractBeanCollection.java:90)
at io.ebean.common.BeanList.init(BeanList.java:141)
at io.ebean.common.BeanList.iterator(BeanList.java:327)
Caused by: java.lang.IllegalStateException: Expecting String keys but got type:class java.util.UUID
at io.ebean.redis.encode.EncodePrefixKey.encode(EncodePrefixKey.java:19)
... 67 common frames omitted

Rob Bygrave

unread,
Jun 21, 2023, 5:28:19 PM6/21/23
to eb...@googlegroups.com
What is the version of Ebean being used?  (From memory this looks like an old bug ... )

--

---
You received this message because you are subscribed to the Google Groups "Ebean ORM" group.
To unsubscribe from this group and stop receiving emails from it, send an email to ebean+un...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/ebean/ff819b16-d359-44cd-8622-4e7aa58a6dd8n%40googlegroups.com.

fga...@cloudops.com

unread,
Jun 22, 2023, 7:50:25 AM6/22/23
to Ebean ORM
Hi Rob,

I have upgraded to the latest version from 13.8.0 (the version we were on) and it seems to have fixed the issue. Thanks for your help!
Reply all
Reply to author
Forward
0 new messages