Skip to content
Advertisement

Tag: hibernate

Getting a TIMESTAMP from postgre as a LocalDatetime with HibernateORM

I have this Hibernate model I can insert a new Warning into the database with session.save(warning); session.getTransaction().commit();, warning being an instance of Warning and session being a hibernate session. However, trying to get an instance of Warning from the database like this results in the following error: java.lang.ClassCastException: class java.util.Date cannot be cast to class java.time.LocalDateTime (java.util.Date and java.time.LocalDateTime are

Alternative to using deprecated save method in hibernate

I am using the following code to save a person object into the database: I see that the save method is deprecated. What’s the alternative approach that we are supposed to use? Answer save() is deprecated since Hibernate 6.0. The javadoc suggests to use persist() instead. Deprecated. use persist(Object) Small print: save() and persist() are similar, but still different. save()

Mysql problem ,cant resolve it, cant somebody help, i using java

Yoo coderrs, have problem connect and write table to my online free database. Problem is hereUnable to create requested service and Unable to make JDBC Connection 1class package sk.hibernate; 2.class persistence.xml POM Answer I just accessed your database with the following URL: (I masked the credentials). So you missed the prefix “jdbc:” You should quickly change your username and password

How to reuse validator class in spring boot app?

I am currently writing custom validator for Spring Boot app and its idea is mainly to do some validations depending on other validations. For example, I want one field to be @NotNull if some other field is null, but the idea is to make it more generic, so that this conditional validations can be changed. For this purpose I tried

Advertisement