This content has been marked as final.
Show 5 replies
-
1. Re: How to configure batch/fetch size
azhurakousky Jul 21, 2006 10:36 PM (in response to qbacomarch)Yes you should do it in persistance.xml
Try this:<persistence> . . . . . . . . <properties> <property name="hibernate.jdbc.batch_size" value="25"/> . . . . . . . </properties> . . . . . . . . </persistence>
Regards
Oleg Zhurakousky -
2. Re: How to configure batch/fetch size
qbacomarch Jul 24, 2006 4:18 AM (in response to qbacomarch)Well, I tried this, but it didn't work.
Here's my persistence.xml<?xml version="1.0" encoding="UTF-8"?> <persistence version="1.0" xmlns="http://java.sun.com/xml/ns/persistence"> <persistence-unit name="DBTestOne-ejb" transaction-type="JTA"> <provider>org.hibernate.ejb.HibernatePersistence</provider> <jta-data-source>OracleDS</jta-data-source> <class>DBTest.EJBTestEntity</class> <properties> <property name="hibernate.jdbc.batch_size" value="25"/> </properties> </persistence-unit> </persistence>
The database logs show, that there are 73 rows in 8 fetches.
Here's the code of the session bean thath queries the database:@Stateless public class EJBTestSessionBean implements DBTest.EJBTestSessionRemote { @PersistenceContext EntityManager em; public EJBTestSessionBean() {} public Collection<EJBTestEntity> getEJBTestEntity(){ Query query; query = em.createQuery("from EJBTestEntity t"); / return query.getResultList(); } }
-
3. Re: How to configure batch/fetch size
azhurakousky Jul 24, 2006 8:48 AM (in response to qbacomarch)Believe me, I hate to say it, but it does work for me here. . .
Do you have any other EJB3 configuration deployed?
Here is what I get:08:34:54,743 INFO [SettingsFactory] JDBC batch size: 19
and here is my persistance.xml<?xml version="1.0" encoding="UTF-8"?> <persistence> <persistence-unit name="tempdb"> <provider>org.hibernate.ejb.HibernatePersistence</provider> <jta-data-source>java:/MySqlDS</jta-data-source> <properties> <property name="hibernate.jdbc.batch_size" value="19"/> </properties> </persistence-unit> </persistence>
-
4. Re: How to configure batch/fetch size
qbacomarch Jul 25, 2006 4:28 AM (in response to qbacomarch)Finally, I found a solution to this.
The property to set in persistence.xml is "hibernate.jdbc.fetch_size".
Thank You azhurakousky, You were very helpful to me :) -
5. Re: How to configure batch/fetch size
azhurakousky Jul 25, 2006 7:14 AM (in response to qbacomarch)Ahh. . .
So it wasn't a "batch size", but a "fetch_size". Different property, but I am glad you found a way
Oleg