-->
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.  [ 4 posts ] 
Author Message
 Post subject: 2.1 beta4 update() generates INSERT sql
PostPosted: Thu Oct 23, 2003 7:17 pm 
Newbie

Joined: Thu Oct 23, 2003 6:39 pm
Posts: 16
Hello all
My first Hibernate project and I'm having a very strange problem:

Calls to
Code:
Session.update(Object)
generates insert sql instead for update sql as i would expect. The same happens with calls to
Code:
Session.saveOrUpdate(Object)
, regradless of id value.

Pattern:
Each persistent entity in the model has a native generated long id field, with null value indicating a new object and calls to save(). The entities also have a version field.

The model is driven by a jmx
Code:
HibernateService
MBean running inside Jboss 3.2.2. I use Statless session beans to access data, no DAO as i find the Session object to be a sufficient DAO for the project.
The beans obtain a
Code:
SessionFactory
in their
Code:
setSessionContext()
methods, and create a new Session in each business method, for instance when calling update(). The session beans are operated by remote clients.

Before I post code&config&details , is there a simple explanation to my problem?

Help much appriciated!
Thanks
Trygve


Top
 Profile  
 
 Post subject: forgot
PostPosted: Thu Oct 23, 2003 7:18 pm 
Newbie

Joined: Thu Oct 23, 2003 6:39 pm
Posts: 16
everything else works just fine (:


Top
 Profile  
 
 Post subject:
PostPosted: Fri Oct 24, 2003 12:48 pm 
Hibernate Team
Hibernate Team

Joined: Sun Sep 14, 2003 3:54 am
Posts: 7256
Location: Paris, France
Is your class immutable ?
mutable="false"

Is unsaved-value=any ?
Code:
<id
        name="propertyName"                     
        type="typename"                         
        column="column_name"                     
        unsaved-value="any">

_________________
Emmanuel


Top
 Profile  
 
 Post subject: solved
PostPosted: Sun Oct 26, 2003 5:25 pm 
Newbie

Joined: Thu Oct 23, 2003 6:39 pm
Posts: 16
Sorry to say this, but it all had to do with Junit.... tnx a lot, and sorry for the trouble.
Trygve


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 4 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.