File tree Expand file tree Collapse file tree
persistence-modules/spring-hibernate-5/src
test/java/com/baeldung/hibernate/immutable Expand file tree Collapse file tree Original file line number Diff line number Diff line change 2121
2222@ Configuration
2323@ EnableTransactionManagement
24- @ PropertySource ({ "classpath:persistence-h2 .properties" })
24+ @ PropertySource ({ "classpath:persistence-mysql .properties" })
2525@ ComponentScan ({ "com.baeldung.persistence" })
2626public class PersistenceConfig {
2727
Original file line number Diff line number Diff line change 44 "http://hibernate.org/dtd/hibernate-configuration-3.0.dtd">
55<hibernate-configuration >
66 <session-factory >
7- <property name =" hibernate.connection.driver_class" >
8- com.mysql.jdbc.Driver
9- </property >
10- <property name =" hibernate.connection.password" >
11- buddhinisam123
12- </property >
13- <property name =" hibernate.connection.url" >
14- jdbc:mysql://localhost:3306/spring_hibernate_many_to_many
15- </property >
16- <property name =" hibernate.connection.username" >
17- root
18- </property >
19- <property name =" hibernate.dialect" >
20- org.hibernate.dialect.MySQLDialect
21- </property >
22- <property name =" hibernate.current_session_context_class" >
23- thread
24- </property >
7+ <property name =" hibernate.connection.driver_class" >com.mysql.jdbc.Driver</property >
8+ <property name =" hibernate.connection.password" >tutorialmy5ql</property >
9+ <property name =" hibernate.connection.url" >jdbc:mysql://localhost:3306/spring_hibernate_many_to_many</property >
10+ <property name =" hibernate.connection.username" >tutorialuser</property >
11+ <property name =" hibernate.dialect" >org.hibernate.dialect.MySQLDialect</property >
12+ <property name =" hibernate.current_session_context_class" >thread</property >
2513 <property name =" hibernate.show_sql" >true</property >
2614 </session-factory >
2715</hibernate-configuration >
Original file line number Diff line number Diff line change 44import com .baeldung .hibernate .immutable .entities .EventGeneratedId ;
55import com .baeldung .hibernate .immutable .util .HibernateUtil ;
66import com .google .common .collect .Sets ;
7- import org .hibernate .CacheMode ;
87import org .hibernate .Session ;
98import org .junit .*;
109import org .junit .rules .ExpectedException ;
@@ -98,6 +97,7 @@ public void deleteCascade() {
9897 public void updateEventGenerated () {
9998 createEventGenerated ();
10099 EventGeneratedId eventGeneratedId = (EventGeneratedId ) session .createQuery ("FROM EventGeneratedId WHERE name LIKE '%John%'" ).list ().get (0 );
100+
101101 eventGeneratedId .setName ("Mike" );
102102 session .update (eventGeneratedId );
103103 session .flush ();
You can’t perform that action at this time.
0 commit comments