开发者

Can auto generated queries from annotations be query cached with hibernate

@OneToMany( mappedBy = "campaignChallenge" )
@OrderBy( "challengeGameNumber ASC" )
public List<ChallengeGame> getChallengeGames() {
    return challengeGames;
}

In the example above I'm using JPA to annotate. It will auto create a query when I call the method getChallengeGames.

select challengeg0_.campaign_challenge_id as campaign6_2_, challengeg0_.challenge_game_id as challenge1_2_, challengeg0_.challenge_game_id as challenge1_5_1_, challengeg0_.campaign_challenge_id as campaign6_5_1_, challengeg0_.challenge_game_number as challenge2_5_1_, challengeg0_.field_art_logo_url as field3_5_1_, challengeg0_.game_mode_id as game7_5_1_, challengeg0_.goal as goal5_1_, challengeg0_.team_group_id as team8_5_1_, challengeg0_.user_team_origin as user5_5_1_, teamgroup1_.team_group_id as team1_63_0_, teamgroup1_.affiliation as affiliat2_63_0_, teamgroup1_.hidden as hidden63_0_, teamgroup1_.name as name63_0_, teamgroup1_.team_group_type as team5_63_0_ from challenge_game challengeg0_ left outer join team_group teamgroup1_ on challen开发者_StackOverflow中文版geg0_.team_group_id=teamgroup1_.team_group_id where challengeg0_.campaign_challenge_id=? order by challengeg0_.challenge_game_number ASC

Is there anyway to get it to use the hibernate query cache? If I create the query directly I need to use a jpa call to set the hint to cache. Is there an annotation equivalent?


Do you read this http://docs.jboss.org/hibernate/core/3.6/reference/en-US/html/performance.html#performance-cache ? I found there everything what i needed.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜