Skip to content

Commit

Permalink
Merge pull request #228 from justinhrobbins/feature_227
Browse files Browse the repository at this point in the history
closes #227
  • Loading branch information
justinhrobbins committed Jan 16, 2016
2 parents 963f327 + 045bcee commit 03b923f
Show file tree
Hide file tree
Showing 3 changed files with 39 additions and 71 deletions.
1 change: 0 additions & 1 deletion FlashCards_Config/src/main/resources/default.properties
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
#Profiles
repository.profile=spring-data
security.profile=security-http
database.profile=embedded
tests.data.profile=test-data

# DataSource properties
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,78 +13,45 @@
<bean
class="org.springframework.dao.annotation.PersistenceExceptionTranslationPostProcessor" />

<beans profile="mysql">
<bean id="entityManagerFactory"
class="org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean">
<property name="jpaVendorAdapter" ref="jpaVendorAdapter" />
<property name="jpaProperties">
<props>
<prop key="hibernate.connection.provider_class">${hibernate.connection.provider_class}</prop>
<prop key="hibernate.hikari.dataSourceClassName">${hibernate.hikari.dataSourceClassName}</prop>
<prop key="hibernate.hikari.dataSource.url">${hibernate.hikari.dataSource.url}</prop>
<prop key="hibernate.hikari.dataSource.user">${hibernate.hikari.dataSource.user}</prop>
<prop key="hibernate.hikari.dataSource.password">${hibernate.hikari.dataSource.password}</prop>
<prop key="hibernate.hikari.dataSource.cachePrepStmts">${hibernate.hikari.dataSource.cachePrepStmts}</prop>
<prop key="hibernate.hikari.dataSource.prepStmtCacheSize">${hibernate.hikari.dataSource.prepStmtCacheSize}</prop>
<prop key="hibernate.hikari.dataSource.prepStmtCacheSqlLimit">${hibernate.hikari.dataSource.prepStmtCacheSqlLimit}</prop>
<prop key="hibernate.hikari.maximumPoolSize">${hibernate.hikari.maximumPoolSize}</prop>
<prop key="hibernate.hbm2ddl.auto">${hibernate.hbm2ddl.auto}</prop>
<prop key="hibernate.show_sql">${hibernate.show_sql}</prop>
<prop key="hibernate.format_sql">${hibernate.format_sql}</prop>
<prop key="hibernate.jdbc.batch_size property">${hibernate.jdbc.batch_size}</prop>
<prop key="hibernate.order_inserts">${hibernate.order_inserts}</prop>
<prop key="org.hibernate.flushMode">${org.hibernate.flushMode}</prop>
<prop key="use_sql_comments">${use_sql_comments}</prop>
</props>
</property>
</bean>

<bean id="jpaVendorAdapter"
class="org.springframework.orm.jpa.vendor.HibernateJpaVendorAdapter">
<property name="database" value="${jpaVendorAdapter.database}" />
<property name="databasePlatform" value="${jpaVendorAdapter.databasePlatform}" />
</bean>

<!-- data source is only used by jdbc initializer. it should be moved into a confing bean -->
<bean id="dataSource" class="com.mchange.v2.c3p0.ComboPooledDataSource"
destroy-method="close">
<property name="driverClass" value="com.mysql.jdbc.Driver" />
<property name="jdbcUrl" value="jdbc:mysql://localhost:3306/flashcardapp_db?useConfigs=maxPerformance&amp;rewriteBatchedStatements=true" />
<property name="user" value="fcuser_c3po" />
<property name="password" value="flashcard" />
</bean>
</beans>

<beans profile="embedded">
<bean id="jpaVendorAdapter"
class="org.springframework.orm.jpa.vendor.HibernateJpaVendorAdapter">
<property name="database" value="H2" />
<property name="databasePlatform" value="org.hibernate.dialect.H2Dialect" />
</bean>
<bean id="entityManagerFactory"
class="org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean">
<property name="jpaVendorAdapter" ref="jpaVendorAdapter" />
<property name="jpaProperties">
<props>
<prop key="hibernate.connection.provider_class">${hibernate.connection.provider_class}</prop>
<prop key="hibernate.hikari.dataSourceClassName">${hibernate.hikari.dataSourceClassName}</prop>
<prop key="hibernate.hikari.dataSource.url">${hibernate.hikari.dataSource.url}</prop>
<prop key="hibernate.hikari.dataSource.user">${hibernate.hikari.dataSource.user}</prop>
<prop key="hibernate.hikari.dataSource.password">${hibernate.hikari.dataSource.password}</prop>
<prop key="hibernate.hikari.dataSource.cachePrepStmts">${hibernate.hikari.dataSource.cachePrepStmts}</prop>
<prop key="hibernate.hikari.dataSource.prepStmtCacheSize">${hibernate.hikari.dataSource.prepStmtCacheSize}</prop>
<prop key="hibernate.hikari.dataSource.prepStmtCacheSqlLimit">${hibernate.hikari.dataSource.prepStmtCacheSqlLimit}</prop>
<prop key="hibernate.hikari.maximumPoolSize">${hibernate.hikari.maximumPoolSize}</prop>
<prop key="hibernate.hbm2ddl.auto">${hibernate.hbm2ddl.auto}</prop>
<prop key="hibernate.show_sql">${hibernate.show_sql}</prop>
<prop key="hibernate.format_sql">${hibernate.format_sql}</prop>
<prop key="hibernate.jdbc.batch_size property">${hibernate.jdbc.batch_size}</prop>
<prop key="hibernate.order_inserts">${hibernate.order_inserts}</prop>
<prop key="org.hibernate.flushMode">${org.hibernate.flushMode}</prop>
<prop key="use_sql_comments">${use_sql_comments}</prop>
</props>
</property>
</bean>

<bean id="dataSource" class="com.mchange.v2.c3p0.ComboPooledDataSource"
destroy-method="close">
<property name="driverClass" value="org.h2.Driver" />
<property name="jdbcUrl" value="jdbc:h2:mem:flashcardsDb;MVCC=true" />
</bean>
<bean id="jpaVendorAdapter"
class="org.springframework.orm.jpa.vendor.HibernateJpaVendorAdapter">
<property name="database" value="${jpaVendorAdapter.database}" />
<property name="databasePlatform" value="${jpaVendorAdapter.databasePlatform}" />
</bean>

<bean id="entityManagerFactory"
class="org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean">
<property name="dataSource" ref="dataSource" />
<property name="jpaVendorAdapter" ref="jpaVendorAdapter" />
<property name="jpaProperties">
<props>
<prop key="hibernate.hbm2ddl.auto">${hibernate.hbm2ddl.auto}</prop>
<prop key="hibernate.show_sql">${hibernate.show_sql}</prop>
<prop key="hibernate.format_sql">${hibernate.format_sql}</prop>
<prop key="hibernate.jdbc.batch_size property">${hibernate.jdbc.batch_size}</prop>
<prop key="hibernate.order_inserts">${hibernate.order_inserts}</prop>
<prop key="org.hibernate.flushMode">${org.hibernate.flushMode}</prop>
<prop key="use_sql_comments">${use_sql_comments}</prop>
</props>
</property>
</bean>
</beans>
<!-- data source is only used by jdbc initializer. it should be moved into a confing bean -->
<bean id="dataSource" class="com.mchange.v2.c3p0.ComboPooledDataSource"
destroy-method="close">
<property name="driverClass" value="com.mysql.jdbc.Driver" />
<property name="jdbcUrl" value="jdbc:mysql://localhost:3306/flashcardapp_db?useConfigs=maxPerformance&amp;rewriteBatchedStatements=true" />
<property name="user" value="fcuser_c3po" />
<property name="password" value="flashcard" />
</bean>

<beans profile="minimal-test-data">
<jdbc:initialize-database>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Component;

import com.google.common.collect.Lists;
Expand All @@ -24,6 +25,7 @@
import scala.PartialFunction;
import scala.runtime.BoxedUnit;

@Scope("prototype")
@Component("batchSavingCoordinator")
public class BatchSavingCoordinator extends AbstractActor
{
Expand Down

0 comments on commit 03b923f

Please sign in to comment.