.thrift中定義類:
include ‘fare.thrift’
typedef fare.Rule Rule
struct TzRule {
1:optional Rule rule,
}
在mongo數據庫中存入TzRule類的時候會報錯
應該寫成:
struct TzRule {
1:optional fare.Rule rule,
}
http://diwakergupta.github.io/thrift-missing-guide/
Typedefs
The Java language does not have any native support for "typedefs". So when the Thrit Java code generator encounters a typedef declaration, it merely substitutes it with the original type. That is, even though you may have typedefd TypeA to TypeB, in the generated Java code, all references to TypeB will be replaced by TypeA.
Consider the example IDL above. The declaration for tweets in the generated code for TweetSearchResults is simply public List<Tweets> tweets.
此外mongo+jetty也有錯誤,最好用tomcat