开发者

ColdFusion 9 ORM/Hibernate and Remoting

Why does my cfc method (when returning JSON format or called via remoting) return all related obj开发者_StackOverflow社区ects regardless of the lazy setting on the property?


My guess is that when CF serializes those objects into JSON, it is forced to call the getters for the related objects, which in turn causes them to looked up in the database. The "lazy" property controls whether or not related objects are retrieved during the retrieval of the main objects or delayed until you actually request them. In this case, when serializing the object, the related objects are either looked up or not based on the JSON returned, so regardless of the lazy setting, they'll come back.

Basically, if you have a data structure of baseball players and teams, if the JSON returned for a selected player (i.e. Josh Beckett) calls for info about the team (i.e. Red Sox), regardless of the lazy property setting, that team object will either be retrieved when you get the player object or when you ask for the team object that relates to the player.

Make sense?

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜