cleanup Hibernate work

This commit is contained in:
Eugen Paraschiv 2017-12-02 18:24:28 +02:00
parent 79cf459013
commit c2e8eb2ccc
3 changed files with 8 additions and 20 deletions

View File

@ -21,7 +21,7 @@ import java.util.Properties;
@Configuration
@EnableTransactionManagement
@PropertySource({ "classpath:persistence-h2.properties" })
@PropertySource({ "classpath:persistence-mysql.properties" })
@ComponentScan({ "com.baeldung.persistence" })
public class PersistenceConfig {

View File

@ -4,24 +4,12 @@
"http://hibernate.org/dtd/hibernate-configuration-3.0.dtd">
<hibernate-configuration>
<session-factory>
<property name="hibernate.connection.driver_class">
com.mysql.jdbc.Driver
</property>
<property name="hibernate.connection.password">
buddhinisam123
</property>
<property name="hibernate.connection.url">
jdbc:mysql://localhost:3306/spring_hibernate_many_to_many
</property>
<property name="hibernate.connection.username">
root
</property>
<property name="hibernate.dialect">
org.hibernate.dialect.MySQLDialect
</property>
<property name="hibernate.current_session_context_class">
thread
</property>
<property name="hibernate.connection.driver_class">com.mysql.jdbc.Driver</property>
<property name="hibernate.connection.password">tutorialmy5ql</property>
<property name="hibernate.connection.url">jdbc:mysql://localhost:3306/spring_hibernate_many_to_many</property>
<property name="hibernate.connection.username">tutorialuser</property>
<property name="hibernate.dialect">org.hibernate.dialect.MySQLDialect</property>
<property name="hibernate.current_session_context_class">thread</property>
<property name="hibernate.show_sql">true</property>
</session-factory>
</hibernate-configuration>

View File

@ -4,7 +4,6 @@ import com.baeldung.hibernate.immutable.entities.Event;
import com.baeldung.hibernate.immutable.entities.EventGeneratedId;
import com.baeldung.hibernate.immutable.util.HibernateUtil;
import com.google.common.collect.Sets;
import org.hibernate.CacheMode;
import org.hibernate.Session;
import org.junit.*;
import org.junit.rules.ExpectedException;
@ -98,6 +97,7 @@ public class HibernateImmutableIntegrationTest {
public void updateEventGenerated() {
createEventGenerated();
EventGeneratedId eventGeneratedId = (EventGeneratedId) session.createQuery("FROM EventGeneratedId WHERE name LIKE '%John%'").list().get(0);
eventGeneratedId.setName("Mike");
session.update(eventGeneratedId);
session.flush();