-->
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.  [ 1 post ] 
Author Message
 Post subject: Version increment problem. Parameter index out of bounds...
PostPosted: Wed Dec 07, 2005 10:40 pm 
Newbie

Joined: Wed Dec 07, 2005 10:05 pm
Posts: 2
Hi,

I'm having problems with excluding a property from the automatic version increment. In the below stack-trace the tree_version property has optimistic-lock set to false. I guess whats happening is that the hibernate engine expects to find a sql-query that reads:
update rnode set tree_version=? where node_id=? and version=?
but only finds:
update rnode set tree_version=? where node_id=?

What I'm trying to accomplish is to have the automatic versioning only reflect changes made to the actual node properties and use the tree_version property to record movements of nodes in the tree. When I select a node in the gui I need to be able to spot if only the properties have changed or the node itself has been moved.

Code:
2005-12-08 09:55:50,986 DEBUG org.hibernate.event.def.AbstractFlushingEventListener - executing flush
2005-12-08 09:55:50,986 DEBUG org.hibernate.persister.entity.BasicEntityPersister - Updating entity: [se.elanders.repository.model.RNode#1]
2005-12-08 09:55:50,986 DEBUG org.hibernate.persister.entity.BasicEntityPersister - Existing version: 0 -> New version: 0
2005-12-08 09:55:50,986 DEBUG org.hibernate.jdbc.AbstractBatcher - about to open PreparedStatement (open PreparedStatements: 0, globally: 0)
2005-12-08 09:55:50,986 DEBUG org.hibernate.SQL - update rnode set tree_version=? where node_id=?
Hibernate: update rnode set tree_version=? where node_id=?
2005-12-08 09:55:50,986 DEBUG org.hibernate.jdbc.AbstractBatcher - preparing statement
2005-12-08 09:55:50,986 DEBUG org.hibernate.persister.entity.BasicEntityPersister - Dehydrating entity: [se.elanders.repository.model.RNode#1]
2005-12-08 09:55:50,986 DEBUG org.hibernate.type.LongType - binding '1' to parameter: 1
2005-12-08 09:55:50,986 DEBUG org.hibernate.type.LongType - binding '1' to parameter: 2
2005-12-08 09:55:50,986 DEBUG org.hibernate.type.LongType - binding '0' to parameter: 3
2005-12-08 09:55:50,986 DEBUG org.hibernate.jdbc.AbstractBatcher - about to close PreparedStatement (open PreparedStatements: 1, globally: 1)
2005-12-08 09:55:50,986 DEBUG org.hibernate.jdbc.AbstractBatcher - closing statement
2005-12-08 09:55:50,986 DEBUG org.hibernate.util.JDBCExceptionReporter - could not update: [se.elanders.repository.model.RNode#1] [update rnode set tree_version=? where node_id=?]
java.sql.SQLException: Parameter index out of bounds. 3 is not between valid values of 1 and 2


The mapping is as follows...
Code:
<hibernate-mapping package="se.elanders.repository.model">
  <class name="RNode" lazy="false" table="rnode" dynamic-update="true" dynamic-insert="true">
    <id name="nodeId" type="long" unsaved-value="null">
      <column name="node_id" not-null="true" unique="true"/>
      <generator class="native"/>
    </id>
    <version name="version" type="long" column="version"/>
    <property name="lft" type="long" column="lft" optimistic-lock="false"/>
    <property name="rgt" type="long" column="rgt" optimistic-lock="false"/>
    <property name="treeVersion" type="long" column="tree_version" optimistic-lock="false"/>
    <many-to-one name="parent" entity-name="se.elanders.repository.model.RNode" cascade="none" foreign-key="RNode_nodeId" lazy="true">
      <column name="parent_node_id"/>
    </many-to-one>
    <many-to-one name="object" entity-name="se.elanders.repository.model.RObject" cascade="none" foreign-key="RNode_RObject_objectId" lazy="true">
      <column name="object_id"/>
    </many-to-one>
  </class>
</hibernate-mapping>


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

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.