开发者

Do gae datanucleus annotations modify our java code?

I placed this question in Google groups for gae java (http://groups.google.com/group/google-appengine-java/browse_thread/thread/85dc9f10d7e12a3), but sometimes it takes a week for someone to bother answering a question and I feel I need to know the answer much quicker.

We are advised to have our persistent fields accessible only thro setter/getter and not to allow public access, lest the JDO mechanism is bypassed.

We are also advised to implement persistenceCapable interface. However, in gae java, we don't seem to require to implement persistenceCapable interface, but merely place @PersistenceCapable annotation appropriately.

A setter/getter is merely

setHello(hello){this.hello开发者_开发问答 = hello;} 
getHello{return this.hello;}

There is nothing else in between those lines that could be bypassed. That set me thinking ...

Does @PersistenceCapable and all the other gae @ annotations modify/ enhance my java code and insert extra stuffs into my setters/getters during compilation which would be bypassed if those fields were accessed directly by non-persistence aware classes?

Also, does @PersistenceCapable cause gae sdk to insert "implements PersistenceCapable" for us or is it the case that gae simply/ inconsistently does not require us to implement PersistenceCapable?


but sometimes it takes a week for someone to bother answering a question

Some people answer questions in their spare time, here and over there. Good job I "bothered" answering your question over there then ;-)

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜