Skip to content

Commit

Permalink
hibernate-cascade-solution V1.1
Browse files Browse the repository at this point in the history
  • Loading branch information
Nikname2303 committed Apr 2, 2024
1 parent 0f879c7 commit 9ddb629
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 15 deletions.
10 changes: 5 additions & 5 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -25,14 +25,14 @@
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.hibernate.orm</groupId>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-core</artifactId>
<version>6.4.4.Final</version>
<version>6.2.7.Final</version>
</dependency>
<dependency>
<groupId>com.mysql</groupId>
<artifactId>mysql-connector-j</artifactId>
<version>8.3.0</version>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
<version>8.0.33</version>
</dependency>
<dependency>
<groupId>org.hsqldb</groupId>
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/core/basesyntax/dao/impl/UserDaoImpl.java
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ public User get(Long id) {
@Override
public List<User> getAll() {
try (Session session = factory.openSession()) {
String hql = "FROM Comment";
String hql = "FROM User";
Query<User> fromUser = session.createQuery(hql, User.class);
if (fromUser != null) {
return fromUser.getResultList();
Expand Down
12 changes: 3 additions & 9 deletions src/main/resources/hibernate.cfg.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,18 +6,12 @@
<hibernate-configuration>
<session-factory>
<property name="hibernate.dialect">org.hibernate.dialect.MySQL8Dialect</property>
<property name="connection.url">jdbc:mysql://localhost/hibernate?serverTimezone=UTC</property>
<property name="connection.url">jdbc:mysql://localhost/cinema?serverTimezone=UTC</property>
<property name="connection.driver_class">com.mysql.cj.jdbc.Driver</property>
<property name="connection.username">root</property>
<property name="connection.password">MySQL1234</property>
<property name="connection.username">ma_admin</property>
<property name="connection.password">1234</property>
<property name="show_sql">true</property>
<property name="hbm2ddl.auto">update</property>

<mapping class="core.basesyntax.model.Comment"/>
<mapping class="core.basesyntax.model.Smile"/>
<mapping class="core.basesyntax.model.Message"/>
<mapping class="core.basesyntax.model.MessageDetails"/>
<mapping class="core.basesyntax.model.User"/>

</session-factory>
</hibernate-configuration>

0 comments on commit 9ddb629

Please sign in to comment.