cleanup Hibernate work
This commit is contained in:
parent
79cf459013
commit
c2e8eb2ccc
|
@ -21,7 +21,7 @@ import java.util.Properties;
|
||||||
|
|
||||||
@Configuration
|
@Configuration
|
||||||
@EnableTransactionManagement
|
@EnableTransactionManagement
|
||||||
@PropertySource({ "classpath:persistence-h2.properties" })
|
@PropertySource({ "classpath:persistence-mysql.properties" })
|
||||||
@ComponentScan({ "com.baeldung.persistence" })
|
@ComponentScan({ "com.baeldung.persistence" })
|
||||||
public class PersistenceConfig {
|
public class PersistenceConfig {
|
||||||
|
|
||||||
|
|
|
@ -4,24 +4,12 @@
|
||||||
"http://hibernate.org/dtd/hibernate-configuration-3.0.dtd">
|
"http://hibernate.org/dtd/hibernate-configuration-3.0.dtd">
|
||||||
<hibernate-configuration>
|
<hibernate-configuration>
|
||||||
<session-factory>
|
<session-factory>
|
||||||
<property name="hibernate.connection.driver_class">
|
<property name="hibernate.connection.driver_class">com.mysql.jdbc.Driver</property>
|
||||||
com.mysql.jdbc.Driver
|
<property name="hibernate.connection.password">tutorialmy5ql</property>
|
||||||
</property>
|
<property name="hibernate.connection.url">jdbc:mysql://localhost:3306/spring_hibernate_many_to_many</property>
|
||||||
<property name="hibernate.connection.password">
|
<property name="hibernate.connection.username">tutorialuser</property>
|
||||||
buddhinisam123
|
<property name="hibernate.dialect">org.hibernate.dialect.MySQLDialect</property>
|
||||||
</property>
|
<property name="hibernate.current_session_context_class">thread</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.show_sql">true</property>
|
<property name="hibernate.show_sql">true</property>
|
||||||
</session-factory>
|
</session-factory>
|
||||||
</hibernate-configuration>
|
</hibernate-configuration>
|
||||||
|
|
|
@ -4,7 +4,6 @@ import com.baeldung.hibernate.immutable.entities.Event;
|
||||||
import com.baeldung.hibernate.immutable.entities.EventGeneratedId;
|
import com.baeldung.hibernate.immutable.entities.EventGeneratedId;
|
||||||
import com.baeldung.hibernate.immutable.util.HibernateUtil;
|
import com.baeldung.hibernate.immutable.util.HibernateUtil;
|
||||||
import com.google.common.collect.Sets;
|
import com.google.common.collect.Sets;
|
||||||
import org.hibernate.CacheMode;
|
|
||||||
import org.hibernate.Session;
|
import org.hibernate.Session;
|
||||||
import org.junit.*;
|
import org.junit.*;
|
||||||
import org.junit.rules.ExpectedException;
|
import org.junit.rules.ExpectedException;
|
||||||
|
@ -98,6 +97,7 @@ public class HibernateImmutableIntegrationTest {
|
||||||
public void updateEventGenerated() {
|
public void updateEventGenerated() {
|
||||||
createEventGenerated();
|
createEventGenerated();
|
||||||
EventGeneratedId eventGeneratedId = (EventGeneratedId) session.createQuery("FROM EventGeneratedId WHERE name LIKE '%John%'").list().get(0);
|
EventGeneratedId eventGeneratedId = (EventGeneratedId) session.createQuery("FROM EventGeneratedId WHERE name LIKE '%John%'").list().get(0);
|
||||||
|
|
||||||
eventGeneratedId.setName("Mike");
|
eventGeneratedId.setName("Mike");
|
||||||
session.update(eventGeneratedId);
|
session.update(eventGeneratedId);
|
||||||
session.flush();
|
session.flush();
|
||||||
|
|
Loading…
Reference in New Issue