-->
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.  [ 3 posts ] 
Author Message
 Post subject: Variable gets created with the same name twice
PostPosted: Fri Nov 18, 2005 11:51 am 
Newbie

Joined: Fri Jul 08, 2005 4:39 am
Posts: 4
Hibernate version:
2.1.6

Mapping documents:
<hibernate-mapping package="xxx.domain">

<class name="BostotteSisteSakDO" table="SISTE_SAKER" polymorphism="explicit">
<id name="idSisteSaker" column="ID_SISTE_SAKER" type="integer">
<generator class="native"/>
</id>

<property name="navn" column="NAVN" type="string" />
<property name="famnr" column="PERSONNUMMER" type="string" />
<property name="aksessert" column="AKSESSERT" type="timestamp" />
<property name="bruker" column="BRUKER_ID" type="integer" not-null="true" />
<property name="lopenrSak" column="LOPENR_SAK" type="integer" />
<property name="logiskSlettet" column="LOGISK_SLETTET_F" type="true_false" not-null="true" />

<!-- many-to-one name="bruker" column="BRUKER_ID" class="Bruker" /-->
<many-to-one name="kodeSakStatus" column="STATUS_K" class="xxx.kode.KodeSakStatus" not-null="true" />
<many-to-one name="kodeSakType" column="SAKSTYPE_K" class="xxx.kode.KodeSakType" />
<many-to-one name="kommune" column="KOMMUNE_NR" class="xxx.domain.BostotteKommuneDO" />

<component name="termin" class="xxx.domain.BostotteTerminDO">
<property name="termin" column="TERMIN" />
<property name="terminar" column="TERMIN_AR" />
</component>

</class>

</hibernate-mapping>

Code between sessionFactory.openSession() and session.close():
We use Spring:
hibernateTemplate.saveOrUpdate(sisteSak);

Full stack trace of any exception that occurs:
2005-10-27 10:22:05,649 INFO [STDOUT] Hibernate: insert into SISTE_SAKER (NAVN, PERSONNUMMER, AKSESSERT, BRUKER_ID, LOPENR_SAK, LOGISK_SLETTET_F, STATUS_K, SAKSTYPE_K, KOMMUNE_NR, TERMIN, TERMIN_AR) values (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)

2005-10-27 10:22:05,649 DEBUG [net.sf.hibernate.type.StringType] binding 'ET NAVN' to parameter: 1
2005-10-27 10:22:05,649 DEBUG [net.sf.hibernate.type.StringType] binding '11093638489' to parameter: 2
2005-10-27 10:22:05,649 DEBUG [net.sf.hibernate.type.TimestampType] binding '2005-10-27 10:22:05' to parameter: 3
2005-10-27 10:22:05,649 DEBUG [net.sf.hibernate.type.IntegerType] binding '42' to parameter: 4
2005-10-27 10:22:05,649 DEBUG [net.sf.hibernate.type.IntegerType] binding '0' to parameter: 5
2005-10-27 10:22:05,649 DEBUG [net.sf.hibernate.type.TrueFalseType] binding 'false' to parameter: 6
2005-10-27 10:22:05,649 DEBUG [net.sf.hibernate.engine.Cascades] id unsaved-value strategy NULL
2005-10-27 10:22:05,649 DEBUG [net.sf.hibernate.type.StringType] binding 'J' to parameter: 7
2005-10-27 10:22:05,649 DEBUG [net.sf.hibernate.engine.Cascades] id unsaved-value strategy NULL
2005-10-27 10:22:05,649 DEBUG [net.sf.hibernate.type.StringType] binding 'O' to parameter: 8
2005-10-27 10:22:05,649 DEBUG [net.sf.hibernate.engine.Cascades] id unsaved-value strategy NULL
2005-10-27 10:22:05,649 DEBUG [net.sf.hibernate.type.StringType] binding '0807' to parameter: 9
2005-10-27 10:22:05,649 DEBUG [net.sf.hibernate.type.StringType] binding '2' to parameter: 10
2005-10-27 10:22:05,649 DEBUG [net.sf.hibernate.type.StringType] binding '2005' to parameter: 11
2005-10-27 10:22:05,664 DEBUG [net.sf.hibernate.util.JDBCExceptionReporter] SQL Exception
com.sybase.jdbc2.jdbc.SybSQLException: ASA Error -261: There is already a variable named '@p0'
at com.sybase.jdbc2.tds.Tds.processEed(Tds.java:2538)
at com.sybase.jdbc2.tds.Tds.nextResult(Tds.java:1922)
at com.sybase.jdbc2.jdbc.ResultGetter.nextResult(ResultGetter.java:69)
at com.sybase.jdbc2.jdbc.SybStatement.nextResult(SybStatement.java:201)
at com.sybase.jdbc2.jdbc.SybStatement.nextResult(SybStatement.java:182)
at com.sybase.jdbc2.jdbc.SybStatement.executeLoop(SybStatement.java:1667)
at com.sybase.jdbc2.jdbc.SybStatement.execute(SybStatement.java:1659)
at com.sybase.jdbc2.jdbc.SybPreparedStatement.execute(SybPreparedStatement.java:580)
at org.apache.commons.dbcp.DelegatingPreparedStatement.execute(DelegatingPreparedStatement.java:230)
at net.sf.hibernate.persister.EntityPersister.insert(EntityPersister.java:508)
at net.sf.hibernate.persister.EntityPersister.insert(EntityPersister.java:432)
at net.sf.hibernate.impl.ScheduledIdentityInsertion.execute(ScheduledIdentityInsertion.java:29)
at net.sf.hibernate.impl.SessionImpl.doSave(SessionImpl.java:932)
at net.sf.hibernate.impl.SessionImpl.doSave(SessionImpl.java:857)
at net.sf.hibernate.impl.SessionImpl.saveWithGeneratedIdentifier(SessionImpl.java:775)
at net.sf.hibernate.impl.SessionImpl.save(SessionImpl.java:738)
at net.sf.hibernate.impl.SessionImpl.saveOrUpdate(SessionImpl.java:1388)
at org.springframework.orm.hibernate.HibernateTemplate$16.doInHibernate(HibernateTemplate.java:532)
at org.springframework.orm.hibernate.HibernateTemplate.execute(HibernateTemplate.java:312)
at org.springframework.orm.hibernate.HibernateTemplate.saveOrUpdate(HibernateTemplate.java:529)

Name and version of the database you are using:
Sybase ASA 9.0.2.2451


This error only happens very rarely in our training environment. It is the same error every time reffering to the variable with the name @p0. Last time this happened we logged into the web application with the same user that got this error and tried to do an action that caused the same error. THe same thing happened. Other users have no problem inserting into the table. When we restarted JBoss, everything worked fine again. Does anyone know what might cause this? I have asked Sybase to help me out with this issue as well but I thougt might have som information on this here. Is there a way to put on some more logging so that we could see exactly when Hibernate is generating this variable.


Top
 Profile  
 
 Post subject:
PostPosted: Fri Nov 18, 2005 3:56 pm 
Newbie

Joined: Fri Jul 08, 2005 4:39 am
Posts: 4
The following example statement will generate the error.

This is an example of the type of statement that is causing the error.

begin
declare @p0 int;
declare @p1 char(5);
declare @p0 char(5);
set @p0 = 1;
set @p1 = 'Mark';
set @p0 = 'Rob';
insert into test
values(@p0, @p1, @p0);
end;

The following is the extract from the manual.

ASA Error -261: There is already a variable named '@p0'

Probable cause
You attempted to CREATE a variable with the name of another variable that already exists.


Top
 Profile  
 
 Post subject:
PostPosted: Sat Nov 19, 2005 4:58 am 
Expert
Expert

Joined: Mon Jul 04, 2005 5:19 pm
Posts: 720
have you considered the possibility that this is a bug in the driver ;)


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