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>