I have the following problem: when I try to insert an object into the Hibernate database, it gets stuck, the error does not return, the object is not saved correctly.
Debugging it, I found out that it hangs on
Hibernate: select nextval('hibernate_sequence')
I am using PostgreSQL as a database.
My configuration file:
<hibernate-mapping>
<class name="src.MyClass" table="MyClass">
<cache usage="read-write"/>
<id name="id" column="classid">
<generator class="native" />
</id>
<property name="name" column="name" not-null="true" unique="true" length="160"/>
</class>
</hibernate-mapping>
@Override
public void save( Myclass mc)
{
Session session = sessionFactory.getCurrentSession();
session.save( mc);
}
The SELECT command works.
I'm not sure what I am missing. Also, using the built-in SQL Insert command, it works.
source
share