-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 2 posts ] 
Author Message
 Post subject: strange sql statements generated
PostPosted: Sun Mar 27, 2005 6:48 am 
Newbie

Joined: Sun Mar 27, 2005 6:28 am
Posts: 2
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.3

The 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


Top
 Profile  
 
 Post subject:
PostPosted: Sun Mar 27, 2005 8:33 am 
Newbie

Joined: Sun Mar 27, 2005 6:28 am
Posts: 2
Hi there,

guess what, it's my fault. At first, I did not realize i need a transaction (even if the SystemMobile tut sais otherwise). At second I misinterpreted the generated SQL statement (I was expecting to see the parameter list also).

At leats i've shown to be able to ask a question the right way ;)

cu,
Martin


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 2 posts ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.