-->
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: Invalid column name
PostPosted: Tue Oct 09, 2007 11:25 am 
Newbie

Joined: Tue Oct 09, 2007 11:19 am
Posts: 1
When i use the <sql-query> approach, I get the error Invalid Column name.

================
<sql-query name="loadAll">
<return alias="ajoJob" class="com.thomson.ecommerce.attorneyjobs.framework.bean.AjoJob"/>
SELECT ajoJob.SUMMARY AS {ajoJob.summary}
FROM AJO_JOB ajoJob
</sql-query>
</hibernate-mapping>
================

See class info, mappings, etc below

Hibernate version:
3

Mapping documents:
<?xml version="1.0"?>
<!DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/Hibernate Mapping DTD 3.0//EN"
"http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">
<!-- Generated Jul 18, 2007 11:35:04 AM by Hibernate Tools 3.2.0.b9 -->
<hibernate-mapping>
<class name="com.thomson.ecommerce.attorneyjobs.framework.bean.AjoJob" table="AJO_JOB" schema="BREEZE_APP" lazy="true">
<id name="jobId" type="java.lang.Long">
<column name="JOB_ID" precision="12" scale="0" />
<generator class="sequence">
<param name="sequence">AJO_JOB_ID_SEQ</param>
</generator>
</id>
<many-to-one name="ajoJobType" class="com.thomson.ecommerce.attorneyjobs.framework.bean.AjoJobType">
<column name="JOB_TYPE_ID" precision="12" scale="0" />
</many-to-one>
<many-to-one name="seo" class="com.thomson.ecommerce.attorneyjobs.framework.bean.AjoSeo" >
<column name="SEO_ID" precision="12" scale="0" />
</many-to-one>
<many-to-one name="ajoEducationLevel" class="com.thomson.ecommerce.attorneyjobs.framework.bean.AjoEducationLevel">
<column name="EDUCATION_LEVEL_ID" precision="12" scale="0" />
</many-to-one>
<many-to-one name="ajoCompanyContact" class="com.thomson.ecommerce.attorneyjobs.framework.bean.AjoCompanyContact">
<column name="COMPANY_CONTACT_ID" precision="12" scale="0" />
</many-to-one>
<many-to-one name="ajoPositionType" class="com.thomson.ecommerce.attorneyjobs.framework.bean.AjoPositionType">
<column name="POSITION_TYPE_ID" precision="12" scale="0" />
</many-to-one>
<one-to-one name="ajoHotJob" class="com.thomson.ecommerce.attorneyjobs.framework.bean.AjoHotJob"/>
<property name="name" type="string">
<column name="NAME" length="128" />
</property>
<property name="summary" type="string">
<column name="SUMMARY" length="1024" />
</property>
<property name="description" type="text" lazy="true">
<column name="DESCRIPTION"/>
</property>
<property name="isLsjo" type="yes_no">
<column name="IS_LSJO" length="1" />
</property>
<property name="siteIndex" type="java.lang.Integer">
<column name="SITE_INDEX"/>
</property>
<property name="expireDate" type="date">
<column name="EXPIRE_DATE" length="7" />
</property>
<property name="postDate" type="date">
<column name="POST_DATE" length="7" />
</property>
<property name="notes" type="string">
<column name="NOTES" />
</property>
<property name="referenceNumber" type="string">
<column name="REFERENCE_NUMBER" length="128" />
</property>
<property name="isActive" type="yes_no">
<column name="IS_ACTIVE" length="1" />
</property>
<property name="employerDn" type="string">
<column name="EMPLOYER_DN" length="256" />
</property>
<property name="deleteDate" type="date">
<column name="DELETE_DATE" length="7" />
</property>
<property name="startSalary" type="java.lang.Double">
<column name="START_SALARY" precision="126" scale="0" />
</property>
<property name="endSalary" type="java.lang.Double">
<column name="END_SALARY" precision="126" scale="0" />
</property>
<property name="url" type="string">
<column name="URL" length="256" />
</property>
<property name="teaserDescription" type="string">
<column name="TEASER_DESCRIPTION" length="512" />
</property>
<property name="teaserSummary" type="string">
<column name="TEASER_SUMMARY" length="256" />
</property>
<property name="isDeleted" type="yes_no">
<column name="IS_DELETED" length="1" />
</property>
<property name="externalId" type="string">
<column name="EXTERNAL_ID" length="256" />
</property>
<set name="ajoJobImages" inverse="true">
<key>
<column name="JOB_ID" precision="12" scale="0" not-null="true" unique="true" />
</key>
<one-to-many class="com.thomson.ecommerce.attorneyjobs.framework.bean.AjoJobImage" />
</set>
<set name="ajoFavorites" inverse="true">
<key>
<column name="JOB_ID" precision="12" scale="0" not-null="true" />
</key>
<one-to-many class="com.thomson.ecommerce.attorneyjobs.framework.bean.AjoFavorite" />
</set>
<set name="ajoExtendedJobInfos" inverse="true">
<key>
<column name="JOB_ID" precision="12" scale="0" not-null="true" />
</key>
<one-to-many class="com.thomson.ecommerce.attorneyjobs.framework.bean.AjoExtendedJobInfo" />
</set>
<set name="ajoLocations" inverse="true" cascade="all-delete-orphan">
<key>
<column name="JOB_ID" precision="12" scale="0" not-null="true" />
</key>
<one-to-many class="com.thomson.ecommerce.attorneyjobs.framework.bean.AjoLocation" />
</set>

<set name="ajoJobSources" inverse="true" cascade="all-delete-orphan">
<key>
<column name="JOB_ID" precision="12" scale="0" not-null="true" />
</key>
<one-to-many class="com.thomson.ecommerce.attorneyjobs.framework.bean.AjoJobSource" />
</set>
<set name="ajoLinks" inverse="true" cascade="all-delete-orphan">
<key>
<column name="JOB_ID" precision="12" scale="0" />
</key>
<one-to-many class="com.thomson.ecommerce.attorneyjobs.framework.bean.AjoLink" />
</set>
<set name="ajoJobExtras" inverse="true" cascade="all-delete-orphan">
<key>
<column name="JOB_ID" precision="12" scale="0" not-null="true" />
</key>
<one-to-many class="com.thomson.ecommerce.attorneyjobs.framework.bean.AjoJobExtra" />
</set>
<set name="ajoApplies" inverse="true">
<key>
<column name="JOB_ID" precision="12" scale="0" not-null="true" />
</key>
<one-to-many class="com.thomson.ecommerce.attorneyjobs.framework.bean.AjoApply" />
</set>
</class>

<sql-query name="loadAll">
<return alias="ajoJob" class="com.thomson.ecommerce.attorneyjobs.framework.bean.AjoJob"/>
SELECT ajoJob.SUMMARY AS {ajoJob.summary}
FROM AJO_JOB ajoJob
</sql-query>
</hibernate-mapping>

Code between sessionFactory.openSession() and session.close():
SessionFactory factory = getHibernateTemplate().getSessionFactory();
org.hibernate.Session session = factory.openSession();
session.beginTransaction();
org.hibernate.Query query = session.getNamedQuery("loadAll");
if ((startIndex > 0) && (maxResults > 0)){
query.setMaxResults(maxResults);
query.setFirstResult(startIndex);
}

List list = query.list();
if (list.size() < 1){
if (log.isInfoEnabled()) log.info("AjoSearchDao.loadAll info: no search found");
if (log.isDebugEnabled()) log.debug("AjoSearchDao.loadAll debug: no search found");
}
session.getTransaction().commit();
session.close();
session = null;
return list;

Full stack trace of any exception that occurs:
org.hibernate.exception.GenericJDBCException: could not execute query
at org.hibernate.exception.SQLStateConverter.handledNonSpecificException(SQLStateConverter.java:103)
at org.hibernate.exception.SQLStateConverter.convert(SQLStateConverter.java:91)
at org.hibernate.exception.JDBCExceptionHelper.convert(JDBCExceptionHelper.java:43)
at org.hibernate.loader.Loader.doList(Loader.java:2214)
at org.hibernate.loader.Loader.listIgnoreQueryCache(Loader.java:2095)
at org.hibernate.loader.Loader.list(Loader.java:2090)
at org.hibernate.loader.custom.CustomLoader.list(CustomLoader.java:289)
at org.hibernate.impl.SessionImpl.listCustomQuery(SessionImpl.java:1695)
at org.hibernate.impl.AbstractSessionImpl.list(AbstractSessionImpl.java:142)
at org.hibernate.impl.SQLQueryImpl.list(SQLQueryImpl.java:152)
at com.thomson.ecommerce.attorneyjobs.data.dao.AjoSearchDao.loadAll(AjoSearchDao.java:659)
at com.thomson.ecommerce.attorneyjobs.data.dao.SearchDaoTest.testLoadByAjoSeoKeywords(SearchDaoTest.java:25)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:85)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:58)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:60)
at java.lang.reflect.Method.invoke(Method.java:391)
at junit.framework.TestCase.runTest(TestCase.java:154)
at junit.framework.TestCase.runBare(TestCase.java:127)
at junit.framework.TestResult$1.protect(TestResult.java:106)
at junit.framework.TestResult.runProtected(TestResult.java:124)
at junit.framework.TestResult.run(TestResult.java:109)
at junit.framework.TestCase.run(TestCase.java:118)
at junit.framework.TestSuite.runTest(TestSuite.java:208)
at junit.framework.TestSuite.run(TestSuite.java:203)
at org.eclipse.jdt.internal.junit.runner.junit3.JUnit3TestReference.run(JUnit3TestReference.java:128)
at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:460)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:673)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:386)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:196)


Name and version of the database you are using:
Oracle 10g Revision 1

The generated SQL (show_sql=true):
Hibernate: SELECT ajoJob.SUMMARY AS SUMMARY35_0_
FROM AJO_JOB ajoJob

Debug level Hibernate log excerpt:


Problems with Session and transaction handling? No


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.