tweaking params

This commit is contained in:
Athou
2013-06-06 10:57:58 +02:00
parent be6db080fd
commit 66abb68097
3 changed files with 11 additions and 6 deletions

View File

@@ -13,6 +13,9 @@ import javax.persistence.criteria.CriteriaQuery;
import javax.persistence.criteria.Root;
import javax.persistence.metamodel.Attribute;
import org.hibernate.Session;
import org.hibernate.ejb.EntityManagerImpl;
import com.commafeed.backend.model.AbstractModel;
import com.google.common.reflect.TypeToken;
import com.uaihebert.factory.EasyCriteriaFactory;
@@ -36,12 +39,10 @@ public abstract class GenericDAO<T extends AbstractModel> {
public void saveOrUpdate(Collection<? extends AbstractModel> models) {
int i = 0;
EntityManagerImpl impl = (EntityManagerImpl) em.getDelegate();
Session session = impl.getSession();
for (AbstractModel model : models) {
if (model.getId() == null) {
em.persist(model);
} else {
em.merge(model);
}
session.saveOrUpdate(model);
if (i % 20 == 0) {
em.flush();

View File

@@ -10,7 +10,11 @@
<shared-cache-mode>ENABLE_SELECTIVE</shared-cache-mode>
<properties>
<property name="hibernate.hbm2ddl.auto" value="update" />
<property name="format_sql" value="true" />
<property name="use_sql_comments" value="true" />
<property name="hibernate.show_sql" value="${jpa.show_sql}" />
<property name="hibernate.dialect" value="${jpa.dialect}" />
<property name="hibernate.default_batch_fetch_size" value="100" />

View File

@@ -12,7 +12,7 @@
<!--
<Resource id="MySQL" type="DataSource">
JdbcDriver com.mysql.jdbc.Driver
JdbcUrl jdbc:mysql://localhost/commafeed?useUnicode=true&amp;characterEncoding=UTF-8&amp;autoReconnect=true&amp;failOverReadOnly=false&amp;maxReconnects=20
JdbcUrl jdbc:mysql://localhost/commafeed?useUnicode=true&amp;characterEncoding=UTF-8&amp;autoReconnect=true&amp;failOverReadOnly=false&amp;maxReconnects=20&amp;rewriteBatchedStatements=true
UserName cf
Password cf
MaxActive 50