Hi there,
i have a strange problem when I try to persist my POJOs.
Hibernate version: 2.1.8
Mapping documents: (XDoclet generated)
Code:
<hibernate-mapping>
<class
name="com.elektrolite.model.User"
table="USER"
dynamic-update="false"
dynamic-insert="false">
<id
name="id"
column="id"
type="java.lang.Integer">
<generator class="increment">
</generator>
</id>
<property
name="name"
type="java.lang.String"
column="NAME"
insert="true"
update="true"
access="property"/>
</class>
</hibernate-mapping>
Code between sessionFactory.openSession() and session.close():Code:
User user = new User();
user.setName("username");
session.save(user);
session.flush();
Name and version of the database you are using: HSQLDB 1.7.3The generated SQL (show_sql=true):Code:
Hibernate: insert into USER (NAME, id) values (?, ?)
The generated SQL-Statement is my problem. I can do what I want, I can't persist this simple object. When I manually add a row into the database table, I am able to retrieve this object via session.load(), so I assume everything is configured properly.
I tried what I could, including using code and xml generated from middlegen, I can't get session.save() and session.update() to work. I assume (and hope) this is a simple beginner's problem, even though I found nothing similar in the FAQs and forums.
Thanks in advance,
Martin