-->
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: sql-insert tag Exception
PostPosted: Tue Aug 30, 2005 1:16 pm 
Newbie

Joined: Fri Aug 26, 2005 4:13 pm
Posts: 2
I wanted to use custom query to insert data into the table. But I am getting an exception
Quote:
bind variable does not exist
.

Can someone help me identify what I'm missing?.

Here is the Log File:

2005-08-30 13:03:03,062 WARN [org.hibernate.util.JDBCExceptionReporter] - <SQL Error: 1006, SQLState: 72000>
2005-08-30 13:03:03,062 ERROR [org.hibernate.util.JDBCExceptionReporter] - <ORA-01006: bind variable does not exist

Hibernate: select hibernate_sequence.nextval from dual
Hibernate:
insert into TEMP_SKILA_NOTIFICATION (NOTIFICATION_TYPE,
NOTIFICATION_DATE, NOTIFICATION_STATUS,
NOTIFICATION_ID)
values (?, ?, ?,hibernate_sequence.nextval)

2005-08-30 13:03:03,062 WARN [org.hibernate.util.JDBCExceptionReporter] - <SQL Error: 1006, SQLState: 72000>
2005-08-30 13:03:03,062 ERROR [org.hibernate.util.JDBCExceptionReporter] - <ORA-01006: bind variable does not exist
>
2005-08-30 13:03:03,062 ERROR [org.hibernate.event.def.AbstractFlushingEventListener] - <Could not synchronize database state with session>
org.hibernate.exception.GenericJDBCException: could not insert: [com.skila.iworksite.notify.model.TempSkilaNotification]
at org.hibernate.exception.ErrorCodeConverter.handledNonSpecificException(ErrorCodeConverter.java:92)
at org.hibernate.exception.ErrorCodeConverter.convert(ErrorCodeConverter.java:80)
at org.hibernate.exception.JDBCExceptionHelper.convert(JDBCExceptionHelper.java:43)
at org.hibernate.persister.entity.BasicEntityPersister.insert(BasicEntityPersister.java:1869)
at org.hibernate.persister.entity.BasicEntityPersister.insert(BasicEntityPersister.java:2200)
at org.hibernate.action.EntityInsertAction.execute(EntityInsertAction.java:46)
at org.hibernate.engine.ActionQueue.execute(ActionQueue.java:239)
at org.hibernate.engine.ActionQueue.executeActions(ActionQueue.java:223)
at org.hibernate.engine.ActionQueue.executeActions(ActionQueue.java:136)
at org.hibernate.event.def.AbstractFlushingEventListener.performExecutions(AbstractFlushingEventListener.java:274)
at org.hibernate.event.def.DefaultAutoFlushEventListener.onAutoFlush(DefaultAutoFlushEventListener.java:48)
at org.hibernate.impl.SessionImpl.autoFlushIfRequired(SessionImpl.java:711)
Quote:


Hibernate Mappings

Mapping for a test table:

Code:
<hibernate-mapping package="com.skila.iworksite.notify.model">

    <class name="TempSkilaNotification" table="TEMP_SKILA_NOTIFICATION">
        <id name="notificationId" column="NOTIFICATION_ID" type="long">
            <generator class="native"/>
        </id>

        <property name="notificationType" column="NOTIFICATION_TYPE" type="string" />
        <property name="notificationDate" column="NOTIFICATION_DATE" type="date" />
        <property name="notificationStatus" column="NOTIFICATION_STATUS" type="string" />
        <sql-insert>
         insert into TEMP_SKILA_NOTIFICATION (NOTIFICATION_TYPE,
         NOTIFICATION_DATE, NOTIFICATION_STATUS,
         NOTIFICATION_ID)
         values (?, ?, ?,hibernate_sequence.nextval)
      </sql-insert>
    </class>
    <query name="tempSkilaNoti.userNotification">
      <![CDATA[
       from TempSkilaNotification skilaNoti
       where skilaNoti.notificationStatus=:status
    ]]>
   </query>
</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.