What does the "embedded" boolean mean in that piece of code? And why is RuntimeException thrown if embedded is true?
The full stack trace was:
(The bean that is being accessed is behind a LAZY OneToMany mapping and caching was enabled for both beans.)
Caused by: java.lang.RuntimeException: null at com.avaje.ebeaninternal.server.deploy.BeanPropertyAssocOne.getCacheDataValu e(BeanPropertyAssocOne.java:396) ~[ebean-2.7.5.jar:na] at com.avaje.ebeaninternal.server.cache.CachedBeanDataFromBean.extract(CachedB eanDataFromBean.java:57) ~[ebean-2.7.5.jar:na] at com.avaje.ebeaninternal.server.cache.CachedBeanDataFromBean.extract(CachedB eanDataFromBean.java:22) ~[ebean-2.7.5.jar:na] at com.avaje.ebeaninternal.server.deploy.BeanDescriptor.cachePutBeanData(BeanD escriptor.java:1091) ~[ebean-2.7.5.jar:na] at com.avaje.ebeaninternal.server.core.DefaultBeanLoader.loadBean(DefaultBeanL oader.java:382) ~[ebean-2.7.5.jar:na] at com.avaje.ebeaninternal.server.core.DefaultServer.loadBean(DefaultServer.ja va:529) ~[ebean-2.7.5.jar:na] at com.avaje.ebeaninternal.server.loadcontext.DLoadBeanContext.loadBean(DLoadB eanContext.java:203) ~[ebean-2.7.5.jar:na] at com.avaje.ebean.bean.EntityBeanIntercept.loadBeanInternal(EntityBeanInterce pt.java:531) ~[ebean-2.7.5.jar:na] at com.avaje.ebean.bean.EntityBeanIntercept.loadBean(EntityBeanIntercept.java: 499) ~[ebean-2.7.5.jar:na] at com.avaje.ebean.bean.EntityBeanIntercept.preGetter(EntityBeanIntercept.java :625) ~[ebean-2.7.5.jar:na]
On Saturday, September 1, 2012 10:00:33 AM UTC+3, Mikael Nousiainen wrote:
> I tried to enable L2 caching for my entities, but I get a weird exception > without any explanation of the reason.
> I also found out the exact source code line that was causing the > exception, and the code looks really weird, as it is just throwing an > exception in this particular case:
I did some more searching in Ebean source code (without really knowing my way around), and I found only these places where setEmbedded is used: http://grepcode.com/search/usages?type=method&id=repo1.maven.org%24mav...@org.avaje%24eb...@2.7.5@com%24avaje%24ebeaninternal%24server%24deploy%24meta@DeployBeanPrope rty@setEmbedded%28boolean%29&k=u
All the cases are related to either using @Embedded, @EmbeddedId or @Id, so I wonder why @ManyToOne with @JoinColumn would have it set. One thing worth mentioning might be that I am using @Embedded in *another*field in the same class, but I guess that should not have any effect to other fields.
> A setter for a field with those mappings was called to cause the exception.
> I can't see how anything called "embedded" would have anything to do with > the field...
> On Saturday, September 1, 2012 10:00:33 AM UTC+3, Mikael Nousiainen wrote:
>> I tried to enable L2 caching for my entities, but I get a weird exception >> without any explanation of the reason.
>> I also found out the exact source code line that was causing the >> exception, and the code looks really weird, as it is just throwing an >> exception in this particular case:
On Saturday, September 1, 2012 10:00:33 AM UTC+3, Mikael Nousiainen wrote:
> I tried to enable L2 caching for my entities, but I get a weird exception > without any explanation of the reason.
> I also found out the exact source code line that was causing the > exception, and the code looks really weird, as it is just throwing an > exception in this particular case:
*>> Do you have any idea why this exception gets thrown?
*
That code where the exception is thrown ... indicates to me that the
feature to support embedded beans in the caching wasn't finished - which is
a bit pants.
It would seem that one of the types or fields is annotated with Embedded or
EmbeddedId ? You suggest that is not the case though so it is not obvious
at this point why you are hitting this issue.
Cheers, Rob.
On 4 September 2012 21:57, Mikael Nousiainen <mik...@incompleteopus.net>wrote:
Ok. Actually, I *am* using @Embedded in one of the fields in both classes: the one containing the collection, and the one in the collection.
So are you suggesting that caching will not work if any of the fields * inside* a cached entity are @Embedded? (Meaning that the types that are cached are not embedded, but some of the fields inside them are.)
On Tuesday, September 4, 2012 1:18:38 PM UTC+3, Rob Bygrave wrote: > *>> Do you have any idea why this exception gets thrown? > * > That code where the exception is thrown ... indicates to me that the > feature to support embedded beans in the caching wasn't finished - which is > a bit pants.
> It would seem that one of the types or fields is annotated with Embedded > or EmbeddedId ? You suggest that is not the case though so it is not > obvious at this point why you are hitting this issue.
> Cheers, Rob.
> On 4 September 2012 21:57, Mikael Nousiainen <mik...@incompleteopus.net<javascript:> > > wrote:
>> Rob,
>> Do you have any idea why this exception gets thrown? >> Even a little hint towards the right direction would be appreciated :)
>> Thanks!
>> On Saturday, September 1, 2012 10:00:33 AM UTC+3, Mikael Nousiainen wrote:
>>> I tried to enable L2 caching for my entities, but I get a weird >>> exception without any explanation of the reason.
*>> So are you suggesting that caching will not work if any of the fields
inside a cached entity are @Embedded**?
*
Yes.
It is a bit (enter a bad word / less than ideal) but yes. Throwing that
exception should be replaced with actual implementation (that I managed to
forget / miss etc). The bean cache has got 'arrays of values' rather than
actual beans in it ... and the missing implementation should convert an
embedded bean into a 'value'.
On 4 September 2012 22:59, Mikael Nousiainen <mik...@incompleteopus.net>wrote:
> Ok. Actually, I *am* using @Embedded in one of the fields in both
> classes: the one containing the collection, and the one in the collection.
> So are you suggesting that caching will not work if any of the fields *
> inside* a cached entity are @Embedded?
> (Meaning that the types that are cached are not embedded, but some of the
> fields inside them are.)
> On Tuesday, September 4, 2012 1:18:38 PM UTC+3, Rob Bygrave wrote:
>> *>> Do you have any idea why this exception gets thrown?
>> *
>> That code where the exception is thrown ... indicates to me that the
>> feature to support embedded beans in the caching wasn't finished - which is
>> a bit pants.
>> It would seem that one of the types or fields is annotated with Embedded
>> or EmbeddedId ? You suggest that is not the case though so it is not
>> obvious at this point why you are hitting this issue.
>> Cheers, Rob.
>> On 4 September 2012 21:57, Mikael Nousiainen <mik...@incompleteopus.net>wrote:
>>> Rob,
>>> Do you have any idea why this exception gets thrown?
>>> Even a little hint towards the right direction would be appreciated :)
>>> Thanks!
>>> On Saturday, September 1, 2012 10:00:33 AM UTC+3, Mikael Nousiainen
>>> wrote:
>>>> I tried to enable L2 caching for my entities, but I get a weird
>>>> exception without any explanation of the reason.
On Tuesday, September 4, 2012 2:35:45 PM UTC+3, Rob Bygrave wrote:
> *>> So are you suggesting that caching will not work if any of the fields > inside a cached entity are @Embedded**? > * > Yes.
> It is a bit (enter a bad word / less than ideal) but yes. Throwing that > exception should be replaced with actual implementation (that I managed to > forget / miss etc). The bean cache has got 'arrays of values' rather than > actual beans in it ... and the missing implementation should convert an > embedded bean into a 'value'.
> On 4 September 2012 22:59, Mikael Nousiainen <mik...@incompleteopus.net<javascript:> > > wrote:
>> Ok. Actually, I *am* using @Embedded in one of the fields in both >> classes: the one containing the collection, and the one in the collection.
>> So are you suggesting that caching will not work if any of the fields * >> inside* a cached entity are @Embedded? >> (Meaning that the types that are cached are not embedded, but some of the >> fields inside them are.)
>> On Tuesday, September 4, 2012 1:18:38 PM UTC+3, Rob Bygrave wrote:
>>> *>> Do you have any idea why this exception gets thrown? >>> * >>> That code where the exception is thrown ... indicates to me that the >>> feature to support embedded beans in the caching wasn't finished - which is >>> a bit pants.
>>> It would seem that one of the types or fields is annotated with Embedded >>> or EmbeddedId ? You suggest that is not the case though so it is not >>> obvious at this point why you are hitting this issue.
>>> Cheers, Rob.
>>> On 4 September 2012 21:57, Mikael Nousiainen <mik...@incompleteopus.net>wrote:
>>>> Rob,
>>>> Do you have any idea why this exception gets thrown? >>>> Even a little hint towards the right direction would be appreciated :)
>>>> Thanks!
>>>> On Saturday, September 1, 2012 10:00:33 AM UTC+3, Mikael Nousiainen >>>> wrote:
>>>>> I tried to enable L2 caching for my entities, but I get a weird >>>>> exception without any explanation of the reason.
> Allright. I'll manage for a while without caching, so it's not a
> showstopper for me :)
> Would this be a terribly demanding feature to implement?
> Is it on the roadmap for next releases?
> On Tuesday, September 4, 2012 2:35:45 PM UTC+3, Rob Bygrave wrote:
>> *>> So are you suggesting that caching will not work if any of the
>> fields inside a cached entity are @Embedded**?
>> *
>> Yes.
>> It is a bit (enter a bad word / less than ideal) but yes. Throwing that
>> exception should be replaced with actual implementation (that I managed to
>> forget / miss etc). The bean cache has got 'arrays of values' rather than
>> actual beans in it ... and the missing implementation should convert an
>> embedded bean into a 'value'.
>> On 4 September 2012 22:59, Mikael Nousiainen <mik...@incompleteopus.net>wrote:
>>> Ok. Actually, I *am* using @Embedded in one of the fields in both
>>> classes: the one containing the collection, and the one in the collection.
>>> So are you suggesting that caching will not work if any of the fields *
>>> inside* a cached entity are @Embedded?
>>> (Meaning that the types that are cached are not embedded, but some of
>>> the fields inside them are.)
>>> On Tuesday, September 4, 2012 1:18:38 PM UTC+3, Rob Bygrave wrote:
>>>> *>> Do you have any idea why this exception gets thrown?
>>>> *
>>>> That code where the exception is thrown ... indicates to me that the
>>>> feature to support embedded beans in the caching wasn't finished - which is
>>>> a bit pants.
>>>> It would seem that one of the types or fields is annotated with
>>>> Embedded or EmbeddedId ? You suggest that is not the case though so it is
>>>> not obvious at this point why you are hitting this issue.
>>>> Cheers, Rob.
>>>> On 4 September 2012 21:57, Mikael Nousiainen <mik...@incompleteopus.net
>>>> > wrote:
>>>>> Rob,
>>>>> Do you have any idea why this exception gets thrown?
>>>>> Even a little hint towards the right direction would be appreciated :)
>>>>> Thanks!
>>>>> On Saturday, September 1, 2012 10:00:33 AM UTC+3, Mikael Nousiainen
>>>>> wrote:
>>>>>> I tried to enable L2 caching for my entities, but I get a weird
>>>>>> exception without any explanation of the reason.