顯示具有 Hibernate 標籤的文章。 顯示所有文章
顯示具有 Hibernate 標籤的文章。 顯示所有文章

2019年8月7日 星期三

DBCP和c3p0連線timeout設置

因為預設值都是indefinitely無限制等待
如果Connection Pool滿載,應用程式要不到閒置的Connection,會造成應用程式的Block無任何反應
建議一定要設定 timeout

https://blog.csdn.net/qq_34359363/article/details/72763491
DBCP 
最小连接数 minIdle(預設值為0)
初始化连接数 initialSize(預設值為0)
最大连接数 maxTotal(預設值為8)
最大等待时间 maxWaitMillis(預設值為無限毫秒)
詳細資訊 https://commons.apache.org/proper/commons-dbcp/configuration.html
Hibernate要設定hibernate.dbcp.maxWaitMillis

c3p0    
最小连接数 minPoolSize(預設值為3)
初始化连接数 initialPoolSize(預設值為3)
最大连接数 maxPoolSize(預設值為15)
最大等待时间 maxIdleTime(預設值為無限秒)
詳細資訊 https://www.mchange.com/projects/c3p0/#maxIdleTime
Hibernate要設定hibernate.c3p0.maxIdleTime 

2012年7月20日 星期五

Hibernate Validator

http://www.hibernate.org/subprojects/validator.html

Hibernate Validator 4.x is the reference implementation for JSR 303 - Bean Validation

2010年8月7日 星期六

java.lang.NoClassDefFoundError: antlr/ANTLRException

缺少antlr*.jar
Ex:antlr-2.7.6.jar
該檔案在\hibernate-distribution-X.X.X-Final\lib\required下


Antlr和其他jar檔相比是比較特殊的,他不是函式庫,是個工具程式
利用hql.g hql-sql.g sql-gen.q文件定義了把HQL轉換成SQL的相關解析類
Hibernate的Source Code找grammar資料夾,裡面就有這三個檔案

ANTLR官方網站:
http://www.antlr.org

ref:
http://caterpillar.onlyfun.net/Gossip/HibernateGossip/setUpHibernate.html

Hibernate設定檔載入順序

properties->xml
兩個都存在,後(xml)蓋前(properties)

xml比properties多了一個功能,就是可以設定要載入哪個mapping檔進來