-->
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.  [ 6 posts ] 
Author Message
 Post subject: Oracle Invalid Column Name exception
PostPosted: Tue Jun 15, 2004 12:42 pm 
Newbie

Joined: Tue Jun 15, 2004 10:45 am
Posts: 18
Location: Boston, USA
Hi,

I have searched through the forums to find similar issues and seen a few which are similar to my issue but no clear resolution. Any help would be appreciated:

Each time I run the code below I receive and Invalid Column Exception although the generated code is correct (I have run it through SQL*Plus successfully)

My environment is:
Hibernate 2.1.4
Oracle 7

I have provided detailed output information below.

Thanks in advance!

Quinton


Here is my MAPPING file (generated through Middlegen) (sorry for the length):
Code:
<?xml version="1.0"?>
<!DOCTYPE hibernate-mapping PUBLIC
    "-//Hibernate/Hibernate Mapping DTD 2.0//EN"
    "http://hibernate.sourceforge.net/hibernate-mapping-2.0.dtd" >
   
<hibernate-mapping>
<!--
    Created by the Middlegen Hibernate plugin

    http://boss.bekk.no/boss/middlegen/
    http://hibernate.sourceforge.net/
-->

<class
    name="edu.mit.admissions.model.ApbecEducationalCounselor"
    table="APBEC_EDUCATIONAL_COUNSELOR"
>
    <meta attribute="class-description" inherit="false">
       @hibernate.class
        table="APBEC_EDUCATIONAL_COUNSELOR"
    </meta>

    <id
        name="alumSeqNum"
        type="java.lang.Long"
        column="ALUM_SEQ_NUM"
    >
        <meta attribute="field-description">
           @hibernate.id
            generator-class="assigned"
            type="java.lang.Long"
            column="ALUM_SEQ_NUM"

        </meta>
        <generator class="assigned" />
    </id>

    <property
        name="mailName"
        type="java.lang.String"
        column="MAIL_NAME"
        not-null="true"
        length="30"
    >
        <meta attribute="field-description">
           @hibernate.property
            column="MAIL_NAME"
            length="30"
            not-null="true"
        </meta>   
    </property>
    <property
        name="firstName"
        type="java.lang.String"
        column="FIRST_NAME"
        not-null="true"
        length="30"
    >
        <meta attribute="field-description">
           @hibernate.property
            column="FIRST_NAME"
            length="30"
            not-null="true"
        </meta>   
    </property>
    <property
        name="lastName"
        type="java.lang.String"
        column="LAST_NAME"
        not-null="true"
        length="30"
    >
        <meta attribute="field-description">
           @hibernate.property
            column="LAST_NAME"
            length="30"
            not-null="true"
        </meta>   
    </property>
    <property
        name="homeStreetAddress1"
        type="java.lang.String"
        column="HOME_STREET_ADDRESS1"
        length="30"
    >
        <meta attribute="field-description">
           @hibernate.property
            column="HOME_STREET_ADDRESS1"
            length="30"
        </meta>   
    </property>
    <property
        name="homeStreetAddress2"
        type="java.lang.String"
        column="HOME_STREET_ADDRESS2"
        length="30"
    >
        <meta attribute="field-description">
           @hibernate.property
            column="HOME_STREET_ADDRESS2"
            length="30"
        </meta>   
    </property>
    <property
        name="homeCity"
        type="java.lang.String"
        column="HOME_CITY"
        length="30"
    >
        <meta attribute="field-description">
           @hibernate.property
            column="HOME_CITY"
            length="30"
        </meta>   
    </property>
    <property
        name="homeState"
        type="java.lang.String"
        column="HOME_STATE"
        length="30"
    >
        <meta attribute="field-description">
           @hibernate.property
            column="HOME_STATE"
            length="30"
        </meta>   
    </property>
    <property
        name="homeZip"
        type="java.lang.String"
        column="HOME_ZIP"
        length="10"
    >
        <meta attribute="field-description">
           @hibernate.property
            column="HOME_ZIP"
            length="10"
        </meta>   
    </property>
    <property
        name="homeCountry"
        type="java.lang.String"
        column="HOME_COUNTRY"
        length="30"
    >
        <meta attribute="field-description">
           @hibernate.property
            column="HOME_COUNTRY"
            length="30"
        </meta>   
    </property>
    <property
        name="homePhone"
        type="java.lang.String"
        column="HOME_PHONE"
        length="13"
    >
        <meta attribute="field-description">
           @hibernate.property
            column="HOME_PHONE"
            length="13"
        </meta>   
    </property>
    <property
        name="companyName"
        type="java.lang.String"
        column="COMPANY_NAME"
        length="30"
    >
        <meta attribute="field-description">
           @hibernate.property
            column="COMPANY_NAME"
            length="30"
        </meta>   
    </property>
    <property
        name="companyName2"
        type="java.lang.String"
        column="COMPANY_NAME2"
        length="30"
    >
        <meta attribute="field-description">
           @hibernate.property
            column="COMPANY_NAME2"
            length="30"
        </meta>   
    </property>
    <property
        name="busStreet1"
        type="java.lang.String"
        column="BUS_STREET1"
        length="30"
    >
        <meta attribute="field-description">
           @hibernate.property
            column="BUS_STREET1"
            length="30"
        </meta>   
    </property>
    <property
        name="busStreet2"
        type="java.lang.String"
        column="BUS_STREET2"
        length="30"
    >
        <meta attribute="field-description">
           @hibernate.property
            column="BUS_STREET2"
            length="30"
        </meta>   
    </property>
    <property
        name="busCity"
        type="java.lang.String"
        column="BUS_CITY"
        length="30"
    >
        <meta attribute="field-description">
           @hibernate.property
            column="BUS_CITY"
            length="30"
        </meta>   
    </property>
    <property
        name="busState"
        type="java.lang.String"
        column="BUS_STATE"
        length="30"
    >
        <meta attribute="field-description">
           @hibernate.property
            column="BUS_STATE"
            length="30"
        </meta>   
    </property>
    <property
        name="busZip"
        type="java.lang.String"
        column="BUS_ZIP"
        length="10"
    >
        <meta attribute="field-description">
           @hibernate.property
            column="BUS_ZIP"
            length="10"
        </meta>   
    </property>
    <property
        name="busCountry"
        type="java.lang.String"
        column="BUS_COUNTRY"
        length="30"
    >
        <meta attribute="field-description">
           @hibernate.property
            column="BUS_COUNTRY"
            length="30"
        </meta>   
    </property>
    <property
        name="busPhone"
        type="java.lang.String"
        column="BUS_PHONE"
        length="13"
    >
        <meta attribute="field-description">
           @hibernate.property
            column="BUS_PHONE"
            length="13"
        </meta>   
    </property>
    <property
        name="busPhoneExt"
        type="java.lang.String"
        column="BUS_PHONE_EXT"
        length="5"
    >
        <meta attribute="field-description">
           @hibernate.property
            column="BUS_PHONE_EXT"
            length="5"
        </meta>   
    </property>
    <property
        name="emailAddress"
        type="java.lang.String"
        column="EMAIL_ADDRESS"
        length="60"
    >
        <meta attribute="field-description">
           @hibernate.property
            column="EMAIL_ADDRESS"
            length="60"
        </meta>   
    </property>
    <property
        name="emailRelease"
        type="java.lang.String"
        column="EMAIL_RELEASE"
        length="1"
    >
        <meta attribute="field-description">
           @hibernate.property
            column="EMAIL_RELEASE"
            length="1"
        </meta>   
    </property>
    <property
        name="phonePref"
        type="java.lang.String"
        column="PHONE_PREF"
        length="1"
    >
        <meta attribute="field-description">
           @hibernate.property
            column="PHONE_PREF"
            length="1"
        </meta>   
    </property>
    <property
        name="mailPref"
        type="java.lang.String"
        column="MAIL_PREF"
        length="1"
    >
        <meta attribute="field-description">
           @hibernate.property
            column="MAIL_PREF"
            length="1"
        </meta>   
    </property>
    <property
        name="refPref"
        type="java.lang.String"
        column="REF_PREF"
        not-null="true"
        length="1"
    >
        <meta attribute="field-description">
           @hibernate.property
            column="REF_PREF"
            length="1"
            not-null="true"
        </meta>   
    </property>
    <property
        name="chairCode"
        type="java.lang.String"
        column="CHAIR_CODE"
        length="1"
    >
        <meta attribute="field-description">
           @hibernate.property
            column="CHAIR_CODE"
            length="1"
        </meta>   
    </property>
    <property
        name="degreeMajorDefault"
        type="java.lang.String"
        column="DEGREE_MAJOR_DEFAULT"
        length="2"
    >
        <meta attribute="field-description">
           @hibernate.property
            column="DEGREE_MAJOR_DEFAULT"
            length="2"
        </meta>   
    </property>
    <property
        name="degreeYearDefault"
        type="java.lang.Integer"
        column="DEGREE_YEAR_DEFAULT"
        length="4"
    >
        <meta attribute="field-description">
           @hibernate.property
            column="DEGREE_YEAR_DEFAULT"
            length="4"
        </meta>   
    </property>

    <!-- associations -->

</class>
</hibernate-mapping>



here is my criteria code:
Code:
tx = hbnsession.beginTransaction();
            ec = new ApbecEducationalCounselor();
            ec.setAlumSeqNum(new Long(alumID));
            List ecList =
                hbnsession.createCriteria(edu.mit.admissions.model.ApbecEducationalCounselor.class)
                .add(Example.create(ec))
                .list();
           
           
             ec = (ApbecEducationalCounselor)ecList.get(0);
            tx.commit();


whenever I run this I recieve the following exception:

Code:
WARN ExecuteThread: '13' for queue: 'weblogic.kernel.Default' net.sf.hibernate.util.JDBCExceptionReporter - SQL Error: 17006, SQLState: null

ERROR ExecuteThread: '13' for queue: 'weblogic.kernel.Default' net.sf.hibernate.util.JDBCExceptionReporter - Invalid column name

WARN ExecuteThread: '13' for queue: 'weblogic.kernel.Default' net.sf.hibernate.util.JDBCExceptionReporter - SQL Error: 17006, SQLState: null

ERROR ExecuteThread: '13' for queue: 'weblogic.kernel.Default' net.sf.hibernate.util.JDBCExceptionReporter - Invalid column name

ERROR ExecuteThread: '13' for queue: 'weblogic.kernel.Default' net.sf.hibernate.util.JDBCExceptionReporter - Could not execute query

java.sql.SQLException: Invalid column name

   at oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java:134)

   at oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java:179)

   at oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java:269)

   at oracle.jdbc.driver.OracleStatement.get_column_index(OracleStatement.java:6240)

   at oracle.jdbc.driver.OracleResultSetImpl.findColumn(OracleResultSetImpl.java:1557)

   at oracle.jdbc.driver.OracleResultSet.getLong(OracleResultSet.java:1540)

   at weblogic.jdbc.wrapper.ResultSet_oracle_jdbc_driver_OracleResultSetImpl.getLong(Unknown Source)

   at net.sf.hibernate.type.LongType.get(LongType.java:18)

   at net.sf.hibernate.type.NullableType.nullSafeGet(NullableType.java:62)

   at net.sf.hibernate.type.NullableType.nullSafeGet(NullableType.java:53)

   at net.sf.hibernate.loader.Loader.getKeyFromResultSet(Loader.java:352)

   at net.sf.hibernate.loader.Loader.doQuery(Loader.java:203)

   at net.sf.hibernate.loader.Loader.doQueryAndInitializeNonLazyCollections(Loader.java:133)

   at net.sf.hibernate.loader.Loader.doList(Loader.java:955)

   at net.sf.hibernate.loader.Loader.list(Loader.java:946)

   at net.sf.hibernate.hql.QueryTranslator.list(QueryTranslator.java:834)

   at net.sf.hibernate.impl.SessionImpl.find(SessionImpl.java:1536)

   at net.sf.hibernate.impl.QueryImpl.list(QueryImpl.java:39)

   at edu.mit.admissions.ectrack.counselor.ejb.CounselorBeanSession.getPersonalDetails(Unknown Source)


I have copied and pasted the generated sql (see below) which works fine through SQL*Plus

Code:
SELECT this.ALUM_SEQ_NUM AS ALUM_SEQ1_0_,
this.MAIL_NAME AS MAIL_NAME0_,
this.FIRST_NAME AS FIRST_NAME0_,
this.LAST_NAME AS LAST_NAME0_,
this.HOME_STREET_ADDRESS1 AS HOME_STR5_0_,
this.HOME_STREET_ADDRESS2 AS HOME_STR6_0_,
this.HOME_CITY AS HOME_CITY0_,
this.HOME_STATE AS HOME_STATE0_,
this.HOME_ZIP AS HOME_ZIP0_,
this.HOME_COUNTRY AS HOME_CO10_0_,
this.HOME_PHONE AS HOME_PHONE0_,
this.COMPANY_NAME AS COMPANY12_0_,
this.COMPANY_NAME2 AS COMPANY13_0_,
this.BUS_STREET1 AS BUS_STR14_0_,
this.BUS_STREET2 AS BUS_STR15_0_,
this.BUS_CITY AS BUS_CITY0_,
this.BUS_STATE AS BUS_STATE0_,
this.BUS_ZIP AS BUS_ZIP0_,
this.BUS_COUNTRY AS BUS_COU19_0_,
this.BUS_PHONE AS BUS_PHONE0_,
this.BUS_PHONE_EXT AS BUS_PHO21_0_,
this.EMAIL_ADDRESS AS EMAIL_A22_0_,
this.EMAIL_RELEASE AS EMAIL_R23_0_,
this.PHONE_PREF AS PHONE_PREF0_,
this.MAIL_PREF AS MAIL_PREF0_,
this.REF_PREF AS REF_PREF0_,
this.CHAIR_CODE AS CHAIR_CODE0_,
this.DEGREE_MAJOR_DEFAULT AS DEGREE_28_0_,
this.DEGREE_YEAR_DEFAULT AS DEGREE_29_0_
FROM APBEC_EDUCATIONAL_COUNSELOR this WHERE (1=1)

_________________
Quinton Wall

"The most difficult thing in the world is to know how to do a thing and to watch somebody else doing it wrong,without comment" -
- T.H. White


Top
 Profile  
 
 Post subject:
PostPosted: Tue Jun 15, 2004 1:19 pm 
Newbie

Joined: Fri Apr 23, 2004 4:18 pm
Posts: 15
Location: Oslo, Norway
Could it be related to maximum identifer length on Oracle? If I remember correctly the length of a table name and any one of its columns must not exceed 31 (?) characters.

For what it's worth, the Oracle error message I've seen on this on Oracle 8/9 is different from the one you get on Oracle 7.

Maybe not, then...




Top
 Profile  
 
 Post subject:
PostPosted: Tue Jun 15, 2004 1:24 pm 
Newbie

Joined: Tue Jun 15, 2004 10:45 am
Posts: 18
Location: Boston, USA
I am not sure but I shall try renaming the columns and see what happens.

Thanks for the suggestion

--Quinton

btw it seems to complain when it is trying to get the index so perhaps

table name + index name is > 31 chars (which it definately is!)

APBEC_EDUCATIONAL_COUNSELOR.APBEC_EDUCATIONAL_COUNSELOR_PK

_________________
Quinton Wall

"The most difficult thing in the world is to know how to do a thing and to watch somebody else doing it wrong,without comment" -
- T.H. White


Top
 Profile  
 
 Post subject:
PostPosted: Tue Jun 15, 2004 2:00 pm 
Newbie

Joined: Tue Jun 15, 2004 10:45 am
Posts: 18
Location: Boston, USA

_________________
Quinton Wall

"The most difficult thing in the world is to know how to do a thing and to watch somebody else doing it wrong,without comment" -
- T.H. White


Top
 Profile  
 
 Post subject:
PostPosted: Tue Jun 15, 2004 4:29 pm 
Newbie

Joined: Tue Jun 15, 2004 10:45 am
Posts: 18
Location: Boston, USA
well after some more investigation.... I am still recieving an error from Oracle stating ORA-01003: no statement parsed.

Any clues?

_________________
Quinton Wall

"The most difficult thing in the world is to know how to do a thing and to watch somebody else doing it wrong,without comment" -
- T.H. White


Top
 Profile  
 
 Post subject:
PostPosted: Tue Jun 15, 2004 4:46 pm 
Newbie

Joined: Fri Apr 23, 2004 4:18 pm
Posts: 15
Location: Oslo, Norway
I have not seen that error message before.

Try http://groups.google.com/groups?hl=en&lr=&ie=UTF-8&q=+ORA-01003+no+statement+parsed&btnG=Search.




Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 6 posts ] 

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.