Hello,
i'm trying to implement a custom loaderunder hibernate 3 for a LAnguageList objet which i can only access using stored procedures. here is my mapping for this object
<class name="LanguageList" >
<id name="languageCode" type="java.lang.String">
<generator class="assigned"/>
</id>
<property name="languageLabel" type="java.lang.String" />
<loader query-ref="languageload"/>
</class>
associated query-ref is defined like this:
<sql-query name="languageload" callable="true">
<return alias="language" class="com.project.hibernate.beans.LanguageList">
<return-property name="languageCode" column="LANGUAGE_CODE"/>
<return-property name="languageLabel" column="LANGUAGE_LABEL" />
</return>
{ ? = call languageload(?)}
</sql-query>
and the associated PL/SQL procedure is done like that:
CREATE OR REPLACE FUNCTION languageload(id IN VARCHAR2)
RETURN SYS_REFCURSOR
AS
st_cursor SYS_REFCURSOR;
BEGIN
OPEN st_cursor FOR
SELECT LANGUAGE_CODE, LANGUAGE_LABEL, FROM LANGUAGE_LIST WHERE LANGUAGE_CODE =id;
RETURN st_cursor;
END;
the problem is that when i'm trying to save objects containing a LanguageList Object as a reference, hibernate tries to load a snapshot of LanguageList object before saving and fail with the following trace:
24281 [http-8080-3] DEBUG org.hibernate.persister.entity.BasicEntityPersister - Getting current persistent state for: [com.project.hibernate.beans.LanguageList#FRA]
24516 [http-8080-3] WARN org.hibernate.util.JDBCExceptionReporter - SQL Error: 942, SQLState: 42000
24516 [http-8080-3] ERROR org.hibernate.util.JDBCExceptionReporter - ORA-00942: table or view does not exist
Hibernate Exceptioncould not retrieve snapshot: [com.project.hibernate.beans.LanguageList#FRA]
24531 [http-8080-3] WARN org.apache.struts.action.RequestProcessor - Unhandled Exception thrown: class java.lang.RuntimeException
24547 [http-8080-3] ERROR org.apache.catalina.core.ContainerBase.[Catalina].[localhost].[/ligd].[action] - "Servlet.service()" pour la servlet action a généré une exception
java.lang.RuntimeException: org.hibernate.exception.SQLGrammarException: could not retrieve snapshot: [com.project.hibernate.beans.LanguageList#FRA]
it seems that my custom loader is simply ignored....
Is there a way to define custom commands for retrieveing a snapshot or a version select of an object???
i atteched the org.hibernate.persister.entity debug for this object in case it would help:
24031 [http-8080-3] DEBUG org.hibernate.persister.entity.BasicEntityPersister - Static SQL for entity: com.project.hibernate.beans.LanguageList
24031 [http-8080-3] DEBUG org.hibernate.persister.entity.BasicEntityPersister - Version select: select languageCode from LanguageList where languageCode =?
24031 [http-8080-3] DEBUG org.hibernate.persister.entity.BasicEntityPersister - Snapshot select: select languageli_.languageCode, languageli_.languageLabel as language2_83_ from LanguageList languageli_ where languageli_.languageCode=?
24031 [http-8080-3] DEBUG org.hibernate.persister.entity.BasicEntityPersister - Insert 0: insert into LanguageList (languageLabel, languageCode) values (?, ?)
24031 [http-8080-3] DEBUG org.hibernate.persister.entity.BasicEntityPersister - Update 0: update LanguageList set languageLabel=? where languageCode=?
24031 [http-8080-3] DEBUG org.hibernate.persister.entity.BasicEntityPersister - Delete 0: delete from LanguageList where languageCode=?
Thanks
|