forked from Archives/Athou_commafeed
tweaking params
This commit is contained in:
@@ -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();
|
||||
|
||||
@@ -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" />
|
||||
|
||||
|
||||
@@ -12,7 +12,7 @@
|
||||
<!--
|
||||
<Resource id="MySQL" type="DataSource">
|
||||
JdbcDriver com.mysql.jdbc.Driver
|
||||
JdbcUrl jdbc:mysql://localhost/commafeed?useUnicode=true&characterEncoding=UTF-8&autoReconnect=true&failOverReadOnly=false&maxReconnects=20
|
||||
JdbcUrl jdbc:mysql://localhost/commafeed?useUnicode=true&characterEncoding=UTF-8&autoReconnect=true&failOverReadOnly=false&maxReconnects=20&rewriteBatchedStatements=true
|
||||
UserName cf
|
||||
Password cf
|
||||
MaxActive 50
|
||||
|
||||
Reference in New Issue
Block a user