ããã¯Java EE Advent Calendar 2013ã®21æ¥ç®
æ¨æ¥ã¯[twitter:@Hachiro808]ããã®Thymeleafを業務で使いたいã§ããã
çæ§ã¯JPAã®L2ãã£ãã·ã¥ã¨ãããã®ããåç¥ã§ããããã
L2ãã£ãã·ã¥ã¨ã¯
ã¨ã³ãã£ãã£ããã£ãã·ã¥ããè¤æ°ã®ã¹ã¬ããéã§ã¨ã³ãã£ãã£ã使ã£ã¦ãã¼ã¿ãããã¨ãããå ´åã«ãã¡ãã¡ãã¼ã¿ãã¼ã¹ã«ã¢ã¯ã»ã¹ããªãã¦è¯ãããããã®ãã£ãã·ã¥ã§ãã
æ®éã«ã¨ã³ãã£ãã£ã®ãã£ãã·ã¥ã§ããã¡ãªã¿ã«L1ãã£ãã·ã¥ã¨ããã®ãããã¾ãã¦ããã¡ãã¯åãã¹ã¬ããå
ã§åãã¨ã³ãã£ãã£ãåå¾ããå ´åã«æ¯åDBã«ã¢ã¯ã»ã¹ãã«è¡ããªãã¦è¯ãããããã®ãã£ãã·ã¥ã§ãã
詳ããã¯Oracleã®äººãæ¸ããè³æããã£ãã®ã§ãã¡ããåç
§ãã¦ãã ããã
JPAのキャッシュを使ったアプリケーション高速化手法
è¶ ã¯ã»ã¢ããªL2ãã£ãã·ã¥
ã¨ã¾ããåé¢ã ãè¦ãã¨é常ã«è¯ããã®ãªæããããã®ã§ããããããªãã¾ãã¯è¡ããªãããã§ã
å®ã¯JPAの仕様(JSR-000338)ã®ä¸ã§ã¯L2ãã£ãã·ã¥ã«é¢ããè¨è¿°ã¯3ãã¼ã¸ããããã¾ããã
ããããã®ãã¡ååã¯ä½¿ç¨ã§ããã¤ã³ã¿ã¼ãã§ã¼ã¹ã«é¢ããè¨è¿°ã§ãããååã¯ãã£ãã·ã¥ãå©ç¨ã§ããã¨ãããã¨ã¨ããã£ãã·ã¥ãå©ç¨ããããã«ã¯ã©ãããã°ãããç¨åº¦ã®è¨è¿°ã
ã¤ã¾ãå
容ããªãã
ãã£ãã·ã¥ã®æéãããã£ãã·ã¥ã®éãã©ããããçã¯ãã¹ã¦JPAãããã¤ãã®æ¹ã«ä»»ããã¦ããã¾ãã
ãªã®ã§ãL2ãã£ãã·ã¥ã使ç¨ãã段éã§ãã¼ã¿ããªãã£ã¯è«¦ããã»ããè¯ãã®ã§ã¯ãªãã§ããããã
ãªã®ã§ãL2ãã£ãã·ã¥ãå®éã«ã©ã使ããã®ãã®è¨å®ã¯ãããã¤ãæ¯ã«éãã¾ãã®ã§ãã注æä¸ããã
L2ãã£ãã·ã¥ã使ç¨ããä¸ã§ã®æ³¨æ
ããã§çµããããã®ãã¢ã¬ãªã®ã§ãL2ãã£ãã·ã¥ã使ç¨ããä¸ã§ã®æ³¨æç¹ãã
è¤æ°å°æ§æã§ã¾ã¨ãã«ä½¿ç¨ããããã«ã¯åºæ¬çã«JPAãããã¤ã以ä¸ã®ä½ããå¿ è¦
ä¾ãã°Oracle CoherenceãInfinispanããã
Eclipse LinkãHibernateã«ä»ãã¦ãããã£ãã·ã¥æ©è½ã ã¨ä¸ã¤ã®JVMå
ã§ãããã£ãã·ã¥ãã¦ãããªãã®ã§ãã¯ã©ã¤ã¢ã³ããã©ãã®ãµã¼ãã¼ã«ã¤ãªãã®ãããããªãç¶æ
ã§ã¯å¤æ´ããæ
å ±ããã£ãã·ã¥ããã®ã«ã¢ã¯ã»ã¹ã§ãããã§ããªãã£ããã
æ´æ°ãããã®ã®æ¬¡ã®ã¢ã¯ã»ã¹ã§ã¯æ
å ±ãå
ã«æ»ã£ã¦ãããçºçãã¾ãã
ãããé²ãããã«ã¯è¤æ°å°æ§æã®éã§ãã£ãã·ã¥ãããã¨ãããããã®æ¹æ³ãå¿
è¦ã§ãã¨ã³ã¿ã¼ãã©ã¤ãºã¨ã³ã¿ã¼ãã©ã¤ãºã¨å±ããããªããããªåé·ãªä»çµã¿ãã
OracleãããL2ãã£ãã·ã¥ã®æå¹æ§ããã訴ãã¦ããã®ãè¦ãã®ã¯Coherenceã売ãããã¦å£²ãããã¦ãããããªãã®ããããã¾ããã*1
ãã£ãã·ã¥ããæ
å ±ãã¦ã¼ã¶ã¼ãã¨ã«ç¬ç«ãã¦ãããã¤é »ç¹ã«æ´æ°ããããããªãã®ãªããã¼ããã©ã³ãµã¼ã®æ¹ã§ã¦ã¼ã¶ã¼ãèå¥ããã¦ä¸åº¦ã¢ã¯ã»ã¹ãããµã¼ãã¼ã«ãã£ã¨ã¢ã¯ã»ã¹ãããã ãã§ãè¯ãããããã¾ããã
ãã ããã®å ´åããããã£ãæ©è½ãæã£ããã¼ããã©ã³ãµã¼è£½åãé¸å®ããªããã°ãªãã¾ãããã
ä¸å°æ§æã§ã注æç¹ããã
ä¸å¤§æ§æãªãå¿é
ããªããã¨è¨ãããã¨å°ãç®æãã
ã¨ã³ãã£ãã£åä½ã§ãã£ãã·ã¥ããããããJPQLã§newå¥ã使ã£ã¦ã¢ã¯ã»ã¹ããå ´åã¯ãã£ãã·ã¥ã«ããããã¾ããã*2
ã¨ã³ãã£ãã£åä½ã§ã®ãã£ãã·ã¥æ©è½ãªã®ã§ãããããã¼ã ã¨è¨ããã¦ãã¾ãã°ãã®ã¨ãããªã®ã§ãããä¸è¦§ã®è¡¨ç¤ºã§ãµããªã¼ãä½ãããå ´åã«newå¥ã¯å¤ç¨ããã®ã§çµæ§è¾ãã
é©åãªã¨ã³ãã£ãã£è¨è¨ãããã¦ããªãã¨ãã£ãã·ã¥ã«ã¢ã¯ã»ã¹ããããã«å¤§éã®ãã¼ã¿ããã£ãã·ã¥ããªããã°ãªããã¡ã¢ãªã¼å¨ãã§çæ»ããã¨ãããã¨ã«ãªãããã¾ããã
ã¡ã¢ãªã足ããªãï¼ãªãoracle exalogicã(以ä¸èªä¸»è¦å¶)
DBã«ç´æ¥ããã¢ã¯ã»ã¹ã¯ãã£ãã·ã¥ã«ãããããªã
ãããå½ç¶ã§ããã
ãããå¦çãä½ãã§shellã§SQLå©ããå ´åã«ãã£ãã·ã¥ã¨æ
å ±ãåæããã¾ããã
常ã«ãªã³ã©ã¤ã³ãªã·ã¹ãã ã ã¨ãããæ¸å¿µç¹ã¨ãã¦ããããããããJavaEEãµã¼ãã¼ã«çµã¿è¾¼ãã§ãããã®èµ·åãhttpãªã¯ã¨ã¹ãã§è¡ã£ãããã¾ãã
ãããããã¨ã§ããªã³ã©ã¤ã³ã·ã¹ãã ã¨åãJVMä¸ã§ããããèµ·åããããã¨ãã§ããããã«ãªããåããã£ãã·ã¥ãåç
§ããããã¨ãã§ããããã«ãªãã¾ãã
ãã ãã¦ã§ãã·ã¹ãã ã¨ããããåãJVMä¸ã§åãããã«ãªãã¡ã¢ãªãããããå¿
è¦ã«ãªã£ã¦oracle exa(以ä¸ç¥)
èªã¿åãå°ç¨ã ã£ããã¡ã½ãããã£ãã·ã¥ã¨ãã®ä½¿ç¨ããæ¤è¨ãã ãã
ã¨ã³ãã£ãã£ã®å½¢å¼ã§ãããã£ãã·ã¥ãã§ããªãã®ã§ããã£ã¨Viewã§ä½¿ããããå½¢å¼(DTO)ã«å¤æããä¸ã§ãã£ãã·ã¥ãããã®ãè¯ãã®ã§ã¯ãªãã§ããããã
ehcacheã¨ããã使ããããã®ãããã¾ããã
ã¾ã¨ã
æãããã§ããããªããã
Eclipse Linkã¯ããã©ã«ãã§L2ãã£ãã·ã¥ãæå¹ã«ãªã£ã¦ããã®ã§ã注æãã ãããªã