Actually, hibernate.cfg.xml

<?xml version="1.0" encoding="UTF-8" ?> <!DOCTYPE hibernate-configuration PUBLIC "-//Hibernate/Hibernate Configuration DTD 3.0//EN" "http://www.hibernate.org/dtd/hibernate-configuration-3.0.dtd"> <hibernate-configuration> <session-factory> <property name="hibernate.connection.driver_class">org.postgresql.Driver</property> <property name="hibernate.connection.url">jdbc:postgresql://localhost/botweb</property> <property name="hibernate.connection.username">postgres</property> <property name="hibernate.connection.password">passwordHere</property> <property name="hibernate.dialect">org.hibernate.dialect.PostgreSQLDialect</property> <property name="show_sql">true</property> <property name="hibernate.hbm2ddl.auto">create-drop</property> <mapping class="com.alex4321.botweb.models.Robot" /> <mapping class="com.alex4321.botweb.models.Visitor" /> <mapping class="com.alex4321.botweb.models.Conversation" /> <mapping class="com.alex4321.botweb.models.ConversationItem" /> </session-factory> </hibernate-configuration> 

Code

 @Entity class BaseEntity { ... } @Entity class Visitor { public String data; ... } Session session = AnnotationConfiguration().configure().buildSessionFactory().openSession() Visitor visitor = Visitor(); visitor.data = "TEST"; session.saveOrUpdate(visitor); 

In the terminal

 Hibernate: select visitor_.data from Visitor visitor_ where visitor_.data=? Hibernate: insert into Visitor (data) values (?) 
  • We don’t need to know the password to your server :). Did you try to use get and set methods to change the value of data? - Mikhail Chibel

0