RLH-19 - Use UserDto in init query
All checks were successful
continuous-integration/drone Build is passing

This commit is contained in:
Bea 2024-11-11 16:11:47 +01:00
parent 5a706e56ae
commit 211aa26df1

View File

@ -7,6 +7,7 @@ import org.hibernate.Transaction;
import org.springframework.boot.SpringApplication; import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication; import org.springframework.boot.autoconfigure.SpringBootApplication;
import wtf.beatrice.releasehive.db.HibernateManager; import wtf.beatrice.releasehive.db.HibernateManager;
import wtf.beatrice.releasehive.dtos.UserDto;
import wtf.beatrice.releasehive.models.User; import wtf.beatrice.releasehive.models.User;
import java.util.List; import java.util.List;
@ -30,7 +31,7 @@ public class HiveMain {
Session session = HibernateManager.getSession(); Session session = HibernateManager.getSession();
Transaction transaction = session.beginTransaction(); Transaction transaction = session.beginTransaction();
List<User> users = session.createQuery("FROM User", User.class).getResultList(); List<UserDto> users = session.createQuery("FROM User", UserDto.class).getResultList();
transaction.commit(); transaction.commit();
StringBuilder usersListBuilder = new StringBuilder("["); StringBuilder usersListBuilder = new StringBuilder("[");