开发者

Google AppEngine JDO Persistence FK Arrays

开发者 https://www.devze.com 2023-01-03 03:07 出处:网络
I\'m hoping someone\'s seen this. I\'ve f开发者_如何学Pythonound no clues on Google. I\'m using Google AppEngine with JDO to persist my objects.

I'm hoping someone's seen this. I've f开发者_如何学Pythonound no clues on Google.

I'm using Google AppEngine with JDO to persist my objects.

I have two objects, Parent and Child. Each Parent has n Child objects.

I initially stored the Child objects in an ArrayList data member in the Parent class.

I got the exception "java.lang.UnsupportedOperationException: FK Arrays not supported" when persisting the Parent object.

I put this down to my storing more than one Child key references, so changed it around so that the Child objects store key references to the Parent object instead. In this way, there is only one key reference per Child object instead of n key references per Parent object.

Yet the exception still gets thrown when persisting the Parent object. So I suspect I was mistaken about the probable cause of this exception.

Has anyone seen this exception or know what it means?


According to DataNucleus a lot of things are persisted by default... and they even had a complaint in their blog about the manual in the google app engine site, which said that you need to explicitly mark fields as @Persistent.


I figured out what was wrong.

It wasn't complaining about my ArrayList.

My Parent class had an array data member that I hadn't put an annotation on. Arrays are persisted by default in the absence of annotations.

I added the annotation @NotPersistent and this solved my problem.

0

精彩评论

暂无评论...
验证码 换一张
取 消