Hello,
I am trying to use my existing Hbm xml files from a Weblogic Project in a JBOSS-SEAM 2.1.1.GA Project with Eclipse as IDE.
The mapping/Set definitions loads correctly but while checking the query -- Could Not Determine Type Null is thrown.
My Hbm.xml
==================
<!DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/Hibernate Mapping DTD 3.0//EN"
"http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">
<hibernate-mapping>
<!--
Auto-generated mapping file from
the hibernate.org cfg2hbm engine
-->
<class name="com.test.domain.Artist" table="ARTIST" schema="APP_INTS" lazy="false">
<id name="artistId" type="long">
<column name="ARTIST_ID" precision="10" scale="0" />
<generator class="sequence">
<param name="sequence">APP_INTS.ARTIST_SEQ</param>
</generator>
</id>
<property name="lastName" type="string">
<column name="LAST_NAME" length="25" not-null="true" />
</property>
<property name="firstName" type="string">
<column name="FIRST_NAME" length="25" />
</property>
<property name="productArtistId" type="long">
<column name="PRODUCT_ARTIST_ID" precision="10" scale="0" />
</property>
<!--set name="titleAwards" inverse="true">
<key>
<column name="ARTIST_ID" precision="10" scale="0" />
</key>
<one-to-many class="com.test.TitleAward" />
</set>
<set name="titleArtists" inverse="true">
<key>
<column name="ARTIST_ID" precision="10" scale="0" not-null="true" />
</key>
<one-to-many class="com.test.TitleArtist" />
</set-->
</class>
<sql-query name="searchAjaxArtistName">
<return-scalar column="ARTIST_ID" type="long"/>
<return-scalar column="artistname" type="string"/>
select distinct a.artist_id, a.first_name||' '||a.last_name artistname
from artist a,title_artist ta where ta.artist_id = a.artist_id and (upper(a.last_name)
like upper (:ARTISTLASTNAME) OR upper(a.first_name) like upper(:ARTISTFIRSTNAME) )
</sql-query>
<sql-query name="searchAjaxArtistFirstLastName">
<return-scalar column="ARTIST_ID" type="long"/>
<return-scalar column="artistname" type="string"/>
select distinct a.artist_id, a.first_name||' '||a.last_name artistname
from artist a,title_artist ta where ta.artist_id = a.artist_id and
( (upper(a.first_name) like upper(:ARTISTFIRSTNAME) and upper(a.last_name) like upper(:ARTISTLASTNAME))
OR (upper(a.first_name) like upper(:ARTISTLASTNAME) and upper(a.last_name) like upper(:ARTISTFIRSTNAME)) )
</sql-query>
</hibernate-mapping>
Mapping Loads
=================
13:29:29,468 INFO [Ejb3Configuration] [PersistenceUnit: JPAMigration] no META-INF/orm.xml found
13:29:29,765 INFO [HbmBinder] Mapping class: com.test.Artist -> ARTIST
Exception
============================
3:29:29,812 WARN [ServiceController] Problem starting service persistence.units:ear=JPAMigration-ear.ear,unitName=JPAMigration
org.hibernate.MappingException: could not determine type null
at org.hibernate.cfg.ResultSetMappingBinder.buildResultSetMappingDefinition(ResultSetMappingBinder.java:63)
at org.hibernate.cfg.NamedSQLQuerySecondPass.doSecondPass(NamedSQLQuerySecondPass.java:78)
at org.hibernate.cfg.Configuration.secondPassCompile(Configuration.java:1139)
at org.hibernate.cfg.AnnotationConfiguration.secondPassCompile(AnnotationConfiguration.java:307)
at org.hibernate.cfg.Configuration.buildMappings(Configuration.java:1115)
at org.hibernate.ejb.Ejb3Configuration.buildMappings(Ejb3Configuration.java:1233)
at org.hibernate.ejb.EventListenerConfigurator.configure(EventListenerConfigurator.java:154)
at org.hibernate.ejb.Ejb3Configuration.configure(Ejb3Configuration.java:869)
at org.hibernate.ejb.Ejb3Configuration.configure(Ejb3Configuration.java:407)
at org.hibernate.ejb.HibernatePersistence.createContainerEntityManagerFactory(HibernatePersistence.java:126)
at org.jboss.ejb3.entity.PersistenceUnitDeployment.start(PersistenceUnitDeployment.java:246)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
Any Ideas where I am going wrong ? I checked the ResultSetMappingBinder code and their is a check for the return-scalar column -- if it is null then only the error is thrown. How can I be sure about the query?
|