備忘録です。

インストール

README.txt で、runtime , required と指定されているものをWEB-INFのlib フォルダにコピーしたら、 lib以下の全ての jarファイルをプロジェクトのビルドパスに登録する。

JDBCドライバーをプロジェクトのclasspathに通す

利用するデータベースのJDBCドライバーは各ベンダーなどから提供されるか、ベンダーのホームページからダウンロードできます。

hibernate.cfg.xml やhibernate.propertiesなどの設定ファイルを新規作成

01.<?xml version="1.0"?>
02.<!DOCTYPE hibernate-configuration PUBLIC
03. "-//Hibernate/Hibernate Configuration DTD//EN"
04. "http://hibernate.sourceforge.net/hibernate-configu...">
05.
06.
07.<hibernate-configuration>
08. <!-- セッション・ファクトリ定義 -->
09. <session-factory>
10.<!-- データベースの接続・設定 -->
11. <!-- org.hibernate.dialect.MySQLDialect -->
12. <!-- JDBCドライバー(ここではMySQLのcom.mysql.jdbc.Driverを用いる) -->
13. <property name="connection.driver_class">com.mysql.jdbc.Driver</property>
14.
15. <!-- DB接続URL(適当修正してください) -->
16. <property name="connection.url">jdbc:mysql://localhost/myproj</property>
17. <property name="connection.username">myproj</property>
18. <property name="connection.password">myproj</property>
19.
20. <!-- HibernateのDialect(方言)設定(ここではMySQLのDialectを用いる) -->
21. <property name="dialect">org.hibernate.dialect.MySQLDialect</property>
22.
23. <!-- configuration pool via c3p0-->
24.<!-- コネクション・プールの設定例(c3p0)
25. <property name="c3p0.acquire_increment">1</property>
26. <property name="c3p0.idle_test_period">100</property>
27. <property name="c3p0.max_size">100</property>
28. <property name="c3p0.max_statements">0</property>
29. <property name="c3p0.min_size">10</property>
30. <property name="c3p0.timeout">100</property>
31.-->
32.
33.<!-- キャッシュの設定例(EhCacheProvider)
34. <property name="hibernate.cache.use_query_cache">true</property>
35. <property name="hibernate.cache.provider_class">
36. org.hibernate.cache.EhCacheProvider
37. </property>
38.-->
39.
40. <!-- 実際に実行されたSQL文を表示するかどうかの設定。デバッグ時特に有用 -->
41. <property name="show_sql">false</property>
42. <!-- OUTER JOINを使うかどうか -->
43. <property name="use_outer_join">true</property>
44.
45. <!-- マッピングファイル&クエリの定義ファイル -->
46. <mapping resource="TableName01.hbm.xml"/>
47. <mapping resource="TableName02.hbm.xml"/>
48. <!-- クエリを単独のファイルで定義する場合、その定義ファイルを追加しましょう -->
49. <mapping resource="Query.hbm.xml"/>
50.
51.
52. <!-- usage: read-only read-write nonstrict-read-write transaction -->
53. <!-- cache -->
54.<!-- テーブルごとのキャッシュ設定
55. <class-cache class="xxx.yyy.entity.Table01" usage="nonstrict-read-write"/>
56. <class-cache class="xxx.yyy.entity.Table02" usage="read-only"/>
57.-->
58. <!--
59. <collection-cache collection="xxx.yyy.entity.Table01.zzzSet" usage="read-write"/>
60. -->
61.
62. </session-factory>
63.</hibernate-configuration>

このページへのコメント

CbfFf1 I think this is a real great article.Really thank you! Great.

0
Posted by awesome things! 2014年01月23日(木) 00:05:58 返信

5BLOAx Thanks again for the post.Much thanks again. Much obliged.

0
Posted by look at this 2014年01月17日(金) 05:24:50 返信

Hello
http://www.darinkamontano.com/
http://www.awfmmellowtouch.net/
http://www.rajasthantour-travels.com/
canada goose jackets on sale http://www.awfmmellowtouch.net/

0
Posted by canada goose jackets on sale 2013年12月22日(日) 10:10:13 返信

Q4oLFQ <a href="http://wjuoqllwpdxm.com/">wjuoqllwpdxm</a>, [url=http://guifzckwyqzl.com/]guifzckwyqzl[/url], [link=http://wgcvxniwrycr.com/]wgcvxniwrycr[/link], http://lxybdllnzwmm.com/

0
Posted by ioslcaguy 2013年11月21日(木) 02:50:16 返信

WIIqIc Great post.Really looking forward to read more. Want more.

0
Posted by watch this 2013年11月19日(火) 14:01:12
http://point.md
返信

コメントをかく


「http://」を含む投稿は禁止されています。

利用規約をご確認のうえご記入下さい

管理人/副管理人のみ編集できます