-->
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.  [ 12 posts ] 
Author Message
 Post subject: Column name not found in result set
PostPosted: Fri Jun 04, 2004 8:38 am 
Beginner
Beginner

Joined: Mon Jan 05, 2004 12:48 pm
Posts: 31
hi all,

spring 1.0.1
hibernate 2.1.2
firebird 1.5.0.4290
firebirdSQL 1.5 - jdbc driver

hibernate.dialect = net.sf.hibernate.dialect.FirebirdDialect

I use native SQL method:
Code:
   public List getAdminSurveysByMasterUsernameSQL(final String userName) throws
       DataAccessException {
      return getHibernateTemplate().executeFind(
          new HibernateCallback() {
         public Object doInHibernate(net.sf.hibernate.Session session) throws
             net.sf.hibernate.HibernateException, SQLException {
            String sql =
                "select " +
                "{survey.*} " +
                "from Admin_Surveys {survey}, " +
                "User_Details {sadmin}, " +
                "Master_Details {master} " +
                "left outer join Accounts {account} on {master}.master_id={account}.uid " +
                "where ( " +
                "        {account}.username = '" + userName + "'" +
                "    and {survey}.uid={sadmin}.user_id " +
                "    and {sadmin}.master_id={master}.master_id" +
                ") " +
                "order by  {survey}.Survey_Name";
            String[] aliases = {
                "survey", "sadmin", "master", "account"};
            Class[] clazzes = new Class[] {
                AdminSurvey.class, UserDetails.class, MasterDetails.class,
                Account.class};

            Query sqlQuery = session.createSQLQuery(sql, aliases, clazzes);
            return sqlQuery.list();
         }
      }
      );
   }


And got exception at getting resul set. JDBC driver complaints on unknown column name of a table - 'uid1_'. It does not exist in deed. The sql query generated works fine when queried directly DB meanwhile. Obviousely the column name is generated somewhere later than query completed namely. Where? What for? Is it concerned to hibernate or jdbc driver?
Any guess appreciated.

2004-06-04 16:03:23,246 DEBUG [net.sf.hibernate.impl.SessionImpl] - <opened session>
2004-06-04 16:03:23,256 DEBUG [net.sf.hibernate.transaction.JDBCTransaction] - <begin>
2004-06-04 16:03:23,256 DEBUG [net.sf.hibernate.transaction.JDBCTransaction] - <current autocommit status:false>
2004-06-04 16:03:23,387 DEBUG [net.sf.hibernate.impl.SessionImpl] - <SQL query: select {survey.*} from Admin_Surveys {survey}, User_Details {sadmin}, Master_Details {master} left outer join Accounts {account} on {master}.master_id={account}.uid where ( {account}.username = 'acinausa' and {survey}.uid={sadmin}.user_id and {sadmin}.master_id={master}.master_id) order by {survey}.Survey_Name>
2004-06-04 16:03:23,397 DEBUG [net.sf.hibernate.impl.BatcherImpl] - <about to open: 0 open PreparedStatements, 0 open ResultSets>
2004-06-04 16:03:23,397 DEBUG [net.sf.hibernate.SQL] - <select survey.sid as sid0_, survey.uid as uid0_, survey.Parent_sid as Parent_sid0_, survey.Survey_Name as Survey_N4_0_, survey.Date_Of_Creation as Date_Of_5_0_, survey.Status as Status0_, survey.Date_Of_Status_Update as Date_Of_7_0_, survey.Tree as Tree0_, survey.History as History0_, survey.Comment as Comment0_ from Admin_Surveys survey, User_Details sadmin, Master_Details master left outer join Accounts account on master.master_id=account.uid where ( account.username = 'acinausa' and survey.uid=sadmin.user_id and sadmin.master_id=master.master_id) order by survey.Survey_Name>
Hibernate: select survey.sid as sid0_, survey.uid as uid0_, survey.Parent_sid as Parent_sid0_, survey.Survey_Name as Survey_N4_0_, survey.Date_Of_Creation as Date_Of_5_0_, survey.Status as Status0_, survey.Date_Of_Status_Update as Date_Of_7_0_, survey.Tree as Tree0_, survey.History as History0_, survey.Comment as Comment0_ from Admin_Surveys survey, User_Details sadmin, Master_Details master left outer join Accounts account on master.master_id=account.uid where ( account.username = 'acinausa' and survey.uid=sadmin.user_id and sadmin.master_id=master.master_id) order by survey.Survey_Name
2004-06-04 16:03:23,397 DEBUG [net.sf.hibernate.impl.BatcherImpl] - <preparing statement>
2004-06-04 16:03:23,767 DEBUG [net.sf.hibernate.loader.Loader] - <processing result set>
2004-06-04 16:03:23,787 DEBUG [net.sf.hibernate.util.JDBCExceptionReporter] - <SQL Exception>
org.firebirdsql.jdbc.FBSQLException: Column name uid1_ not found in result set. at org.firebirdsql.jdbc.FBResultSet.findColumn(FBResultSet.java:682)
at org.firebirdsql.jdbc.FBResultSet.getField(FBResultSet.java:389)
at org.firebirdsql.jdbc.FBResultSet.getLong(FBResultSet.java:450)
at org.apache.commons.dbcp.DelegatingResultSet.getLong(DelegatingResultSet.java:221)
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:950)
at net.sf.hibernate.loader.Loader.list(Loader.java:941)
at net.sf.hibernate.loader.SQLLoader.list(SQLLoader.java:92)
at net.sf.hibernate.impl.SessionImpl.findBySQL(SessionImpl.java:3764)
at net.sf.hibernate.impl.SQLQueryImpl.list(SQLQueryImpl.java:52)
at com.volin.sas.hibernate.HibernateSurveyFactory$1.doInHibernate(HibernateSurveyFactory.java:136)
at org.springframework.orm.hibernate.HibernateTemplate.execute(HibernateTemplate.java:150)
at org.springframework.orm.hibernate.HibernateTemplate.executeFind(HibernateTemplate.java:170)
at com.volin.sas.hibernate.HibernateSurveyFactory.getAdminSurveysByMasterUsernameSQL(HibernateSurveyFactory.java:112)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:324)
at org.springframework.aop.framework.AopProxyUtils.invokeJoinpointUsingReflection(AopProxyUtils.java:59)
at org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:149)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:118)
at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:169)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:138)
at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:148)
at $Proxy5.getAdminSurveysByMasterUsernameSQL(Unknown Source)
.....................


Top
 Profile  
 
 Post subject:
PostPosted: Fri Jun 04, 2004 1:21 pm 
Beginner
Beginner

Joined: Mon Jan 05, 2004 12:48 pm
Posts: 31
Well, a little bit more info provided by firebird jdbc driver logging. Also I looked at hibernate sources and found smth interesting in comments about getKeyFromResultSet:
Quote:
Warning: this method is side-effecty.

and at line 352:
Quote:
//problematic for <key-many-to-one>!


I do not use <key-many-to-one> anyway. This is a full log:

==============================================
2004-06-04 21:06:35,418 DEBUG [net.sf.hibernate.impl.SessionImpl] - <opened session>
2004-06-04 21:06:35,498 DEBUG [net.sf.hibernate.transaction.JDBCTransaction] - <begin>
2004-06-04 21:06:35,498 DEBUG [net.sf.hibernate.transaction.JDBCTransaction] - <current autocommit status:false>
2004-06-04 21:06:35,548 DEBUG [net.sf.hibernate.impl.SessionImpl] - <SQL query: select {survey.*} from Admin_Surveys {survey}, User_Details {sadmin}, Master_Details {master} left outer join Accounts {account} on {master}.master_id={account}.uid where ( {account}.username = 'acinausa' and {survey}.uid={sadmin}.user_id and {sadmin}.master_id={master}.master_id) order by {survey}.Survey_Name>
2004-06-04 21:06:35,558 DEBUG [net.sf.hibernate.impl.BatcherImpl] - <about to open: 0 open PreparedStatements, 0 open ResultSets>
2004-06-04 21:06:35,558 DEBUG [net.sf.hibernate.SQL] - <select survey.sid as sid0_, survey.uid as uid0_, survey.Parent_sid as Parent_sid0_, survey.Survey_Name as Survey_N4_0_, survey.Date_Of_Creation as Date_Of_5_0_, survey.Status as Status0_, survey.Date_Of_Status_Update as Date_Of_7_0_, survey.Tree as Tree0_, survey.History as History0_, survey.Comment as Comment0_ from Admin_Surveys survey, User_Details sadmin, Master_Details master left outer join Accounts account on master.master_id=account.uid where ( account.username = 'acinausa' and survey.uid=sadmin.user_id and sadmin.master_id=master.master_id) order by survey.Survey_Name>
Hibernate: select survey.sid as sid0_, survey.uid as uid0_, survey.Parent_sid as Parent_sid0_, survey.Survey_Name as Survey_N4_0_, survey.Date_Of_Creation as Date_Of_5_0_, survey.Status as Status0_, survey.Date_Of_Status_Update as Date_Of_7_0_, survey.Tree as Tree0_, survey.History as History0_, survey.Comment as Comment0_ from Admin_Surveys survey, User_Details sadmin, Master_Details master left outer join Accounts account on master.master_id=account.uid where ( account.username = 'acinausa' and survey.uid=sadmin.user_id and sadmin.master_id=master.master_id) order by survey.Survey_Name
2004-06-04 21:06:35,558 DEBUG [net.sf.hibernate.impl.BatcherImpl] - <preparing statement>
2004-06-04 21:06:35,608 DEBUG [org.firebirdsql.jca.FBManagedConnection] - <start called: org.firebirdsql.jca.FBLocalTransaction$FBLocalXid@187275d>
2004-06-04 21:06:35,618 DEBUG [org.firebirdsql.jgds.GDS_Impl] - <op_transaction >
2004-06-04 21:06:35,618 DEBUG [org.firebirdsql.jgds.GDS_Impl] - <sent>
2004-06-04 21:06:35,618 DEBUG [org.firebirdsql.jgds.GDS_Impl] - <op_response >
2004-06-04 21:06:35,618 DEBUG [org.firebirdsql.jgds.GDS_Impl] - <op_response resp_object: 1>
2004-06-04 21:06:35,618 DEBUG [org.firebirdsql.jgds.GDS_Impl] - <op_response resp_blob_id: 0>
2004-06-04 21:06:35,618 DEBUG [org.firebirdsql.jgds.GDS_Impl] - <op_response resp_data size: 0>
2004-06-04 21:06:35,618 DEBUG [org.firebirdsql.jgds.GDS_Impl] - <readStatusVector arg:isc_arg_gds int: 0>
2004-06-04 21:06:35,618 DEBUG [org.firebirdsql.jgds.GDS_Impl] - <received>
2004-06-04 21:06:35,618 DEBUG [org.firebirdsql.jgds.GDS_Impl] - <op_allocate_statement >
2004-06-04 21:06:35,628 DEBUG [org.firebirdsql.jgds.GDS_Impl] - <sent>
2004-06-04 21:06:35,628 DEBUG [org.firebirdsql.jgds.GDS_Impl] - <op_response >
2004-06-04 21:06:35,628 DEBUG [org.firebirdsql.jgds.GDS_Impl] - <op_response resp_object: 2>
2004-06-04 21:06:35,628 DEBUG [org.firebirdsql.jgds.GDS_Impl] - <op_response resp_blob_id: 0>
2004-06-04 21:06:35,628 DEBUG [org.firebirdsql.jgds.GDS_Impl] - <op_response resp_data size: 0>
2004-06-04 21:06:35,628 DEBUG [org.firebirdsql.jgds.GDS_Impl] - <readStatusVector arg:isc_arg_gds int: 0>
2004-06-04 21:06:35,628 DEBUG [org.firebirdsql.jgds.GDS_Impl] - <received>
2004-06-04 21:06:35,638 DEBUG [org.firebirdsql.jca.FBManagedConnection] - <preparing sql: select survey.sid as sid0_, survey.uid as uid0_, survey.Parent_sid as Parent_sid0_, survey.Survey_Name as Survey_N4_0_, survey.Date_Of_Creation as Date_Of_5_0_, survey.Status as Status0_, survey.Date_Of_Status_Update as Date_Of_7_0_, survey.Tree as Tree0_, survey.History as History0_, survey.Comment as Comment0_ from Admin_Surveys survey, User_Details sadmin, Master_Details master left outer join Accounts account on master.master_id=account.uid where ( account.username = 'acinausa' and survey.uid=sadmin.user_id and sadmin.master_id=master.master_id) order by survey.Survey_Name>
2004-06-04 21:06:35,638 DEBUG [org.firebirdsql.jgds.GDS_Impl] - <op_prepare_statement >
2004-06-04 21:06:35,658 DEBUG [org.firebirdsql.jgds.GDS_Impl] - <sent>
2004-06-04 21:06:35,658 DEBUG [org.firebirdsql.jgds.GDS_Impl] - <op_response >
2004-06-04 21:06:35,658 DEBUG [org.firebirdsql.jgds.GDS_Impl] - <op_response resp_object: 0>
2004-06-04 21:06:35,658 DEBUG [org.firebirdsql.jgds.GDS_Impl] - <op_response resp_blob_id: 0>
2004-06-04 21:06:35,658 DEBUG [org.firebirdsql.jgds.GDS_Impl] - <op_response resp_data size: 1024>
2004-06-04 21:06:35,658 DEBUG [org.firebirdsql.jgds.GDS_Impl] - <readStatusVector arg:isc_arg_gds int: 0>
2004-06-04 21:06:35,658 DEBUG [org.firebirdsql.jgds.GDS_Impl] - <received>
2004-06-04 21:06:35,658 DEBUG [org.firebirdsql.jgds.GDS_Impl] - <parseSqlInfo started>
2004-06-04 21:06:35,658 DEBUG [org.firebirdsql.jgds.GDS_Impl] - <parseSqlInfo: first 2 bytes are 1796 or: 4, 7>
2004-06-04 21:06:35,658 DEBUG [org.firebirdsql.jgds.GDS_Impl] - <xsqlda.sqln read as 10>
2004-06-04 21:06:35,658 DEBUG [org.firebirdsql.jgds.GDS_Impl] - <new xsqlvar 0>
2004-06-04 21:06:35,668 DEBUG [org.firebirdsql.jgds.GDS_Impl] - <isc_info_sql_type 580>
2004-06-04 21:06:35,668 DEBUG [org.firebirdsql.jgds.GDS_Impl] - <isc_info_sql_sub_type 1>
2004-06-04 21:06:35,668 DEBUG [org.firebirdsql.jgds.GDS_Impl] - <isc_info_sql_scale 0>
2004-06-04 21:06:35,668 DEBUG [org.firebirdsql.jgds.GDS_Impl] - <isc_info_sql_length 8>
2004-06-04 21:06:35,668 DEBUG [org.firebirdsql.jgds.GDS_Impl] - <isc_info_sql_field SID>
2004-06-04 21:06:35,668 DEBUG [org.firebirdsql.jgds.GDS_Impl] - <isc_info_sql_relation ADMIN_SURVEYS>
2004-06-04 21:06:35,668 DEBUG [org.firebirdsql.jgds.GDS_Impl] - <isc_info_sql_owner SYSDBA>
2004-06-04 21:06:35,668 DEBUG [org.firebirdsql.jgds.GDS_Impl] - <isc_info_sql_alias SID0_>
2004-06-04 21:06:35,668 DEBUG [org.firebirdsql.jgds.GDS_Impl] - <new xsqlvar 1>
2004-06-04 21:06:35,668 DEBUG [org.firebirdsql.jgds.GDS_Impl] - <isc_info_sql_type 580>
2004-06-04 21:06:35,668 DEBUG [org.firebirdsql.jgds.GDS_Impl] - <isc_info_sql_sub_type 1>
2004-06-04 21:06:35,668 DEBUG [org.firebirdsql.jgds.GDS_Impl] - <isc_info_sql_scale 0>
2004-06-04 21:06:35,668 DEBUG [org.firebirdsql.jgds.GDS_Impl] - <isc_info_sql_length 8>
2004-06-04 21:06:35,668 DEBUG [org.firebirdsql.jgds.GDS_Impl] - <isc_info_sql_field UID>
2004-06-04 21:06:35,668 DEBUG [org.firebirdsql.jgds.GDS_Impl] - <isc_info_sql_relation ADMIN_SURVEYS>
2004-06-04 21:06:35,668 DEBUG [org.firebirdsql.jgds.GDS_Impl] - <isc_info_sql_owner SYSDBA>
2004-06-04 21:06:35,668 DEBUG [org.firebirdsql.jgds.GDS_Impl] - <isc_info_sql_alias UID0_>
2004-06-04 21:06:35,668 DEBUG [org.firebirdsql.jgds.GDS_Impl] - <new xsqlvar 2>
2004-06-04 21:06:35,668 DEBUG [org.firebirdsql.jgds.GDS_Impl] - <isc_info_sql_type 581>
2004-06-04 21:06:35,668 DEBUG [org.firebirdsql.jgds.GDS_Impl] - <isc_info_sql_sub_type 1>
2004-06-04 21:06:35,678 DEBUG [org.firebirdsql.jgds.GDS_Impl] - <isc_info_sql_scale 0>
2004-06-04 21:06:35,678 DEBUG [org.firebirdsql.jgds.GDS_Impl] - <isc_info_sql_length 8>
2004-06-04 21:06:35,678 DEBUG [org.firebirdsql.jgds.GDS_Impl] - <isc_info_sql_field PARENT_SID>
2004-06-04 21:06:35,678 DEBUG [org.firebirdsql.jgds.GDS_Impl] - <isc_info_sql_relation ADMIN_SURVEYS>
2004-06-04 21:06:35,678 DEBUG [org.firebirdsql.jgds.GDS_Impl] - <isc_info_sql_owner SYSDBA>
2004-06-04 21:06:35,678 DEBUG [org.firebirdsql.jgds.GDS_Impl] - <isc_info_sql_alias PARENT_SID0_>
2004-06-04 21:06:35,678 DEBUG [org.firebirdsql.jgds.GDS_Impl] - <new xsqlvar 3>
2004-06-04 21:06:35,678 DEBUG [org.firebirdsql.jgds.GDS_Impl] - <isc_info_sql_type 448>
2004-06-04 21:06:35,678 DEBUG [org.firebirdsql.jgds.GDS_Impl] - <isc_info_sql_sub_type 0>
2004-06-04 21:06:35,678 DEBUG [org.firebirdsql.jgds.GDS_Impl] - <isc_info_sql_scale 0>
2004-06-04 21:06:35,678 DEBUG [org.firebirdsql.jgds.GDS_Impl] - <isc_info_sql_length 300>
2004-06-04 21:06:35,678 DEBUG [org.firebirdsql.jgds.GDS_Impl] - <isc_info_sql_field SURVEY_NAME>
2004-06-04 21:06:35,678 DEBUG [org.firebirdsql.jgds.GDS_Impl] - <isc_info_sql_relation ADMIN_SURVEYS>
2004-06-04 21:06:35,689 DEBUG [org.firebirdsql.jgds.GDS_Impl] - <isc_info_sql_owner SYSDBA>
2004-06-04 21:06:35,689 DEBUG [org.firebirdsql.jgds.GDS_Impl] - <isc_info_sql_alias SURVEY_N4_0_>
2004-06-04 21:06:35,689 DEBUG [org.firebirdsql.jgds.GDS_Impl] - <new xsqlvar 4>
2004-06-04 21:06:35,689 DEBUG [org.firebirdsql.jgds.GDS_Impl] - <isc_info_sql_type 510>
2004-06-04 21:06:35,689 DEBUG [org.firebirdsql.jgds.GDS_Impl] - <isc_info_sql_sub_type 0>
2004-06-04 21:06:35,689 DEBUG [org.firebirdsql.jgds.GDS_Impl] - <isc_info_sql_scale 0>
2004-06-04 21:06:35,689 DEBUG [org.firebirdsql.jgds.GDS_Impl] - <isc_info_sql_length 8>
2004-06-04 21:06:35,689 DEBUG [org.firebirdsql.jgds.GDS_Impl] - <isc_info_sql_field DATE_OF_CREATION>
2004-06-04 21:06:35,689 DEBUG [org.firebirdsql.jgds.GDS_Impl] - <isc_info_sql_relation ADMIN_SURVEYS>
2004-06-04 21:06:35,699 DEBUG [org.firebirdsql.jgds.GDS_Impl] - <isc_info_sql_owner SYSDBA>
2004-06-04 21:06:35,699 DEBUG [org.firebirdsql.jgds.GDS_Impl] - <isc_info_sql_alias DATE_OF_5_0_>
2004-06-04 21:06:35,699 DEBUG [org.firebirdsql.jgds.GDS_Impl] - <new xsqlvar 5>
2004-06-04 21:06:35,699 DEBUG [org.firebirdsql.jgds.GDS_Impl] - <isc_info_sql_type 448>
2004-06-04 21:06:35,699 DEBUG [org.firebirdsql.jgds.GDS_Impl] - <isc_info_sql_sub_type 0>
2004-06-04 21:06:35,699 DEBUG [org.firebirdsql.jgds.GDS_Impl] - <isc_info_sql_scale 0>
2004-06-04 21:06:35,699 DEBUG [org.firebirdsql.jgds.GDS_Impl] - <isc_info_sql_length 2>
2004-06-04 21:06:35,699 DEBUG [org.firebirdsql.jgds.GDS_Impl] - <isc_info_sql_field STATUS>
2004-06-04 21:06:35,699 DEBUG [org.firebirdsql.jgds.GDS_Impl] - <isc_info_sql_relation ADMIN_SURVEYS>
2004-06-04 21:06:35,699 DEBUG [org.firebirdsql.jgds.GDS_Impl] - <isc_info_sql_owner SYSDBA>
2004-06-04 21:06:35,699 DEBUG [org.firebirdsql.jgds.GDS_Impl] - <isc_info_sql_alias STATUS0_>
2004-06-04 21:06:35,699 DEBUG [org.firebirdsql.jgds.GDS_Impl] - <new xsqlvar 6>
2004-06-04 21:06:35,699 DEBUG [org.firebirdsql.jgds.GDS_Impl] - <isc_info_sql_type 511>
2004-06-04 21:06:35,699 DEBUG [org.firebirdsql.jgds.GDS_Impl] - <isc_info_sql_sub_type 0>
2004-06-04 21:06:35,699 DEBUG [org.firebirdsql.jgds.GDS_Impl] - <isc_info_sql_scale 0>
2004-06-04 21:06:35,699 DEBUG [org.firebirdsql.jgds.GDS_Impl] - <isc_info_sql_length 8>
2004-06-04 21:06:35,699 DEBUG [org.firebirdsql.jgds.GDS_Impl] - <isc_info_sql_field DATE_OF_STATUS_UPDATE>
2004-06-04 21:06:35,699 DEBUG [org.firebirdsql.jgds.GDS_Impl] - <isc_info_sql_relation ADMIN_SURVEYS>
2004-06-04 21:06:35,699 DEBUG [org.firebirdsql.jgds.GDS_Impl] - <isc_info_sql_owner SYSDBA>
2004-06-04 21:06:35,709 DEBUG [org.firebirdsql.jgds.GDS_Impl] - <isc_info_sql_alias DATE_OF_7_0_>
2004-06-04 21:06:35,709 DEBUG [org.firebirdsql.jgds.GDS_Impl] - <new xsqlvar 7>
2004-06-04 21:06:35,719 DEBUG [org.firebirdsql.jgds.GDS_Impl] - <isc_info_sql_type 521>
2004-06-04 21:06:35,719 DEBUG [org.firebirdsql.jgds.GDS_Impl] - <isc_info_sql_sub_type 0>
2004-06-04 21:06:35,719 DEBUG [org.firebirdsql.jgds.GDS_Impl] - <isc_info_sql_scale 0>
2004-06-04 21:06:35,719 DEBUG [org.firebirdsql.jgds.GDS_Impl] - <isc_info_sql_length 8>
2004-06-04 21:06:35,719 DEBUG [org.firebirdsql.jgds.GDS_Impl] - <isc_info_sql_field TREE>
2004-06-04 21:06:35,719 DEBUG [org.firebirdsql.jgds.GDS_Impl] - <isc_info_sql_relation ADMIN_SURVEYS>
2004-06-04 21:06:35,719 DEBUG [org.firebirdsql.jgds.GDS_Impl] - <isc_info_sql_owner SYSDBA>
2004-06-04 21:06:35,719 DEBUG [org.firebirdsql.jgds.GDS_Impl] - <isc_info_sql_alias TREE0_>
2004-06-04 21:06:35,719 DEBUG [org.firebirdsql.jgds.GDS_Impl] - <new xsqlvar 8>
2004-06-04 21:06:35,719 DEBUG [org.firebirdsql.jgds.GDS_Impl] - <isc_info_sql_type 521>
2004-06-04 21:06:35,719 DEBUG [org.firebirdsql.jgds.GDS_Impl] - <isc_info_sql_sub_type 0>
2004-06-04 21:06:35,719 DEBUG [org.firebirdsql.jgds.GDS_Impl] - <isc_info_sql_scale 0>
2004-06-04 21:06:35,719 DEBUG [org.firebirdsql.jgds.GDS_Impl] - <isc_info_sql_length 8>
2004-06-04 21:06:35,719 DEBUG [org.firebirdsql.jgds.GDS_Impl] - <isc_info_sql_field HISTORY>
2004-06-04 21:06:35,719 DEBUG [org.firebirdsql.jgds.GDS_Impl] - <isc_info_sql_relation ADMIN_SURVEYS>
2004-06-04 21:06:35,729 DEBUG [org.firebirdsql.jgds.GDS_Impl] - <isc_info_sql_owner SYSDBA>
2004-06-04 21:06:35,729 DEBUG [org.firebirdsql.jgds.GDS_Impl] - <isc_info_sql_alias HISTORY0_>
2004-06-04 21:06:35,729 DEBUG [org.firebirdsql.jgds.GDS_Impl] - <new xsqlvar 9>
2004-06-04 21:06:35,729 DEBUG [org.firebirdsql.jgds.GDS_Impl] - <isc_info_sql_type 448>
2004-06-04 21:06:35,729 DEBUG [org.firebirdsql.jgds.GDS_Impl] - <isc_info_sql_sub_type 0>
2004-06-04 21:06:35,729 DEBUG [org.firebirdsql.jgds.GDS_Impl] - <isc_info_sql_scale 0>
2004-06-04 21:06:35,729 DEBUG [org.firebirdsql.jgds.GDS_Impl] - <isc_info_sql_length 300>
2004-06-04 21:06:35,729 DEBUG [org.firebirdsql.jgds.GDS_Impl] - <isc_info_sql_field COMMENT>
2004-06-04 21:06:35,729 DEBUG [org.firebirdsql.jgds.GDS_Impl] - <isc_info_sql_relation ADMIN_SURVEYS>
2004-06-04 21:06:35,729 DEBUG [org.firebirdsql.jgds.GDS_Impl] - <isc_info_sql_owner SYSDBA>
2004-06-04 21:06:35,729 DEBUG [org.firebirdsql.jgds.GDS_Impl] - <isc_info_sql_alias COMMENT0_>
2004-06-04 21:06:35,729 DEBUG [org.firebirdsql.jgds.GDS_Impl] - <parseSqlInfo ended>
2004-06-04 21:06:35,729 DEBUG [org.firebirdsql.jgds.GDS_Impl] - <op_info_sql >
2004-06-04 21:06:35,729 DEBUG [org.firebirdsql.jgds.GDS_Impl] - <sent>
2004-06-04 21:06:35,729 DEBUG [org.firebirdsql.jgds.GDS_Impl] - <op_response >
2004-06-04 21:06:35,729 DEBUG [org.firebirdsql.jgds.GDS_Impl] - <op_response resp_object: 2>
2004-06-04 21:06:35,729 DEBUG [org.firebirdsql.jgds.GDS_Impl] - <op_response resp_blob_id: 0>
2004-06-04 21:06:35,729 DEBUG [org.firebirdsql.jgds.GDS_Impl] - <op_response resp_data size: 1024>
2004-06-04 21:06:35,729 DEBUG [org.firebirdsql.jgds.GDS_Impl] - <readStatusVector arg:isc_arg_gds int: 0>
2004-06-04 21:06:35,739 DEBUG [org.firebirdsql.jgds.GDS_Impl] - <received>
2004-06-04 21:06:35,739 DEBUG [org.firebirdsql.jgds.GDS_Impl] - <parseSqlInfo started>
2004-06-04 21:06:35,739 DEBUG [org.firebirdsql.jgds.GDS_Impl] - <parseSqlInfo: first 2 bytes are 1797 or: 5, 7>
2004-06-04 21:06:35,739 DEBUG [org.firebirdsql.jgds.GDS_Impl] - <xsqlda.sqln read as 0>
2004-06-04 21:06:35,739 DEBUG [org.firebirdsql.jgds.GDS_Impl] - <parseSqlInfo ended>
2004-06-04 21:06:35,739 DEBUG [org.firebirdsql.jgds.GDS_Impl] - <op_execute >
2004-06-04 21:06:35,749 DEBUG [org.firebirdsql.jgds.GDS_Impl] - <sent>
2004-06-04 21:06:35,749 DEBUG [org.firebirdsql.jgds.GDS_Impl] - <op_response >
2004-06-04 21:06:35,749 DEBUG [org.firebirdsql.jgds.GDS_Impl] - <op_response resp_object: 1>
2004-06-04 21:06:35,749 DEBUG [org.firebirdsql.jgds.GDS_Impl] - <op_response resp_blob_id: 0>
2004-06-04 21:06:35,749 DEBUG [org.firebirdsql.jgds.GDS_Impl] - <op_response resp_data size: 0>
2004-06-04 21:06:35,749 DEBUG [org.firebirdsql.jgds.GDS_Impl] - <readStatusVector arg:isc_arg_gds int: 0>
2004-06-04 21:06:35,749 DEBUG [org.firebirdsql.jgds.GDS_Impl] - <received>
2004-06-04 21:06:35,879 DEBUG [net.sf.hibernate.loader.Loader] - <processing result set>
2004-06-04 21:06:35,879 DEBUG [org.firebirdsql.jgds.GDS_Impl] - <op_fetch >
2004-06-04 21:06:35,879 DEBUG [org.firebirdsql.jgds.GDS_Impl] - <sent>
2004-06-04 21:06:35,879 DEBUG [org.firebirdsql.jgds.GDS_Impl] - <all rows successfully fetched>
2004-06-04 21:06:35,889 DEBUG [net.sf.hibernate.util.JDBCExceptionReporter] - <SQL Exception>
org.firebirdsql.jdbc.FBSQLException: Column name uid1_ not found in result set.
at org.firebirdsql.jdbc.FBResultSet.findColumn(FBResultSet.java:682)
at org.firebirdsql.jdbc.FBResultSet.getField(FBResultSet.java:389)
at org.firebirdsql.jdbc.FBResultSet.getLong(FBResultSet.java:450)
at org.apache.commons.dbcp.DelegatingResultSet.getLong(DelegatingResultSet.java:221)
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:950)
at net.sf.hibernate.loader.Loader.list(Loader.java:941)
at net.sf.hibernate.loader.SQLLoader.list(SQLLoader.java:92)
at net.sf.hibernate.impl.SessionImpl.findBySQL(SessionImpl.java:3764)
at net.sf.hibernate.impl.SQLQueryImpl.list(SQLQueryImpl.java:52)
at com.volin.sas.hibernate.HibernateSurveyFactory$1.doInHibernate(HibernateSurveyFactory.java:136)
............................................


Top
 Profile  
 
 Post subject:
PostPosted: Fri Jun 04, 2004 1:30 pm 
Beginner
Beginner

Joined: Mon Jan 05, 2004 12:48 pm
Posts: 31
Hi all,
It's me again :-))
Also at line 204 where getKeyFromResultSet is called i read:
Quote:
//TODO: the i==cols-1 bit depends upon subclass implementation (very bad)

Does it mean that i got exactly in bad peice of hibernate code?
Thanks,
Sergei.


Top
 Profile  
 
 Post subject:
PostPosted: Fri Jun 04, 2004 1:34 pm 
Hibernate Team
Hibernate Team

Joined: Tue Sep 09, 2003 2:10 pm
Posts: 3246
Location: Passau, Germany
You are using createSQLQuery for something it can not do. It expects to have all classes defined as aliases to be returned.


Top
 Profile  
 
 Post subject:
PostPosted: Fri Jun 04, 2004 2:18 pm 
Beginner
Beginner

Joined: Mon Jan 05, 2004 12:48 pm
Posts: 31
Aha, all classes... Even if i want just a few... Well, if i knew.. And it seems not documented. Forgive me if i'm wrong :-)
Anyway thanks a lot!


Top
 Profile  
 
 Post subject:
PostPosted: Fri Jun 04, 2004 2:40 pm 
Beginner
Beginner

Joined: Mon Jan 05, 2004 12:48 pm
Posts: 31
Nope!
I used query:
Code:
            String sql =
                "select " +
                "{survey.*}, {sadmin.*}, {master.*}, {account.*} " +
                "from Admin_Surveys {survey}, " +
                "User_Details {sadmin}, " +
                "Master_Details {master} " +
                "left outer join Accounts {account} on {master}.master_id={account}.uid " +
                "where ( " +
                "        {account}.username = '" + userName + "'" +
                "    and {survey}.uid={sadmin}.user_id " +
                "    and {sadmin}.master_id={master}.master_id" +
                ") " +
                "order by  {survey}.Survey_Name";


and another exception:
2004-06-04 22:35:09,189 DEBUG [net.sf.hibernate.impl.SessionImpl] - <opened session>
2004-06-04 22:35:09,209 DEBUG [net.sf.hibernate.transaction.JDBCTransaction] - <begin>
2004-06-04 22:35:09,209 DEBUG [net.sf.hibernate.transaction.JDBCTransaction] - <current autocommit status:false>
2004-06-04 22:35:09,269 DEBUG [net.sf.hibernate.impl.SessionImpl] - <SQL query: select {survey.*}, {sadmin.*}, {master.*}, {account.*} from Admin_Surveys {survey}, User_Details {sadmin}, Master_Details {master} left outer join Accounts {account} on {master}.master_id={account}.uid where ( {account}.username = 'acinausa' and {survey}.uid={sadmin}.user_id and {sadmin}.master_id={master}.master_id) order by {survey}.Survey_Name>
2004-06-04 22:35:09,289 DEBUG [net.sf.hibernate.impl.BatcherImpl] - <about to open: 0 open PreparedStatements, 0 open ResultSets>
2004-06-04 22:35:09,289 DEBUG [net.sf.hibernate.SQL] - <select survey.sid as sid0_, survey.uid as uid0_, survey.Parent_sid as Parent_sid0_, survey.Survey_Name as Survey_N4_0_, survey.Date_Of_Creation as Date_Of_5_0_, survey.Status as Status0_, survey.Date_Of_Status_Update as Date_Of_7_0_, survey.Tree as Tree0_, survey.History as History0_, survey.Comment as Comment0_, sadmin.user_id as uid1_, sadmin.Access as Access2_1_, sadmin.master_id as master_id2_1_, sadmin.Org_Code as Org_Code2_1_, sadmin.Org_Name as Org_Name2_1_, sadmin.Org_Email as Org_Email2_1_, sadmin.Org_Web_URL as Org_Web_7_2_1_, sadmin.Org_Phone_Country_Code as Org_Phon8_2_1_, sadmin.Org_Phone_Area_Code as Org_Phon9_2_1_, sadmin.Org_Phone_Number as Org_Pho10_2_1_, sadmin.Org_Phone_Extention as Org_Pho11_2_1_, sadmin.Org_Fax_Country_Code as Org_Fax12_2_1_, sadmin.Org_Fax_Area_Code as Org_Fax13_2_1_, sadmin.Org_Fax_Number as Org_Fax14_2_1_, sadmin.Org_Fax_Extention as Org_Fax15_2_1_, sadmin.Org_Address as Org_Add16_2_1_, sadmin.Org_City as Org_City2_1_, sadmin.Org_Province as Org_Pro18_2_1_, sadmin.Org_Country as Org_Cou19_2_1_, sadmin.Org_ISO_Code as Org_ISO20_2_1_, sadmin.Org_Zip as Org_Zip2_1_, sadmin.Title as Title2_1_, sadmin.Prefix as Prefix2_1_, sadmin.First_Name as First_Name2_1_, sadmin.Middle_Name as Middle_25_2_1_, sadmin.Last_Name as Last_Name2_1_, sadmin.Suffix as Suffix2_1_, sadmin.Person_Email as Person_28_2_1_, sadmin.Person_Position as Person_29_2_1_, sadmin.Person_Department as Person_30_2_1_, sadmin.Person_Phone_Country_Code as Person_31_2_1_, sadmin.Person_Phone_Area_Code as Person_32_2_1_, sadmin.Person_Phone_Number as Person_33_2_1_, sadmin.Person_Phone_Extention as Person_34_2_1_, sadmin.Person_Fax_Country_Code as Person_35_2_1_, sadmin.Person_Fax_Area_Code as Person_36_2_1_, sadmin.Person_Fax_Number as Person_37_2_1_, sadmin.Person_Fax_Extention as Person_38_2_1_, sadmin.RegId as RegId2_1_, sadmin.RegIp as RegIp2_1_, sadmin.Status as Status2_1_, sadmin.Date_Of_Registration as Date_Of42_2_1_, sadmin.Date_Of_Activation as Date_Of43_2_1_, sadmin.Date_Of_Deactivation as Date_Of44_2_1_, sadmin.Date_Of_Update as Date_Of45_2_1_, sadmin.History as History2_1_, sadmin_1_.username as username0_1_, sadmin_1_.passwd as passwd0_1_, sadmin_1_.acc_type as acc_type0_1_, master.master_id as uid2_, master.License_Period as License_2_1_2_, master.License_Number_Of_Surveys as License_3_1_2_, master.License_Number_Of_Admins as License_4_1_2_, master.License_Number_Of_Editors as License_5_1_2_, master.License_Number_Of_Users as License_6_1_2_, master.Org_Code as Org_Code1_2_, master.Org_Name as Org_Name1_2_, master.Org_Email as Org_Email1_2_, master.Org_Web_URL as Org_Web10_1_2_, master.Org_Phone_Country_Code as Org_Pho11_1_2_, master.Org_Phone_Area_Code as Org_Pho12_1_2_, master.Org_Phone_Number as Org_Pho13_1_2_, master.Org_Phone_Extention as Org_Pho14_1_2_, master.Org_Fax_Country_Code as Org_Fax15_1_2_, master.Org_Fax_Area_Code as Org_Fax16_1_2_, master.Org_Fax_Number as Org_Fax17_1_2_, master.Org_Fax_Extention as Org_Fax18_1_2_, master.Billing_Address as Billing19_1_2_, master.Billing_City as Billing20_1_2_, master.Billing_Province as Billing21_1_2_, master.Billing_Country as Billing22_1_2_, master.Billing_ISO_Code as Billing23_1_2_, master.Billing_Zip as Billing24_1_2_, master.Org_Address as Org_Add25_1_2_, master.Org_City as Org_City1_2_, master.Org_Province as Org_Pro27_1_2_, master.Org_Country as Org_Cou28_1_2_, master.Org_ISO_Code as Org_ISO29_1_2_, master.Org_Zip as Org_Zip1_2_, master.Title as Title1_2_, master.Prefix as Prefix1_2_, master.First_Name as First_Name1_2_, master.Middle_Name as Middle_34_1_2_, master.Last_Name as Last_Name1_2_, master.Suffix as Suffix1_2_, master.Person_Email as Person_37_1_2_, master.Person_Position as Person_38_1_2_, master.Person_Department as Person_39_1_2_, master.Person_Phone_Country_Code as Person_40_1_2_, master.Person_Phone_Area_Code as Person_41_1_2_, master.Person_Phone_Number as Person_42_1_2_, master.Person_Phone_Extention as Person_43_1_2_, master.Person_Fax_Country_Code as Person_44_1_2_, master.Person_Fax_Area_Code as Person_45_1_2_, master.Person_Fax_Number as Person_46_1_2_, master.Person_Fax_Extention as Person_47_1_2_, master.RegId as RegId1_2_, master.RegIp as RegIp1_2_, master.Status as Status1_2_, master.Date_Of_Registration as Date_Of51_1_2_, master.Date_Of_Activation as Date_Of52_1_2_, master.Date_Of_Deactivation as Date_Of53_1_2_, master.Date_Of_Update as Date_Of54_1_2_, master.History as History1_2_, master_1_.username as username0_2_, master_1_.passwd as passwd0_2_, master_1_.acc_type as acc_type0_2_, account.uid as uid3_, case when account_1_.master_id is not null then 1 when account_2_.user_id is not null then 2 when account.uid is not null then 0 end as clazz_3_, account.username as username0_3_, account.passwd as passwd0_3_, account.acc_type as acc_type0_3_, account_1_.License_Period as License_2_1_3_, account_1_.License_Number_Of_Surveys as License_3_1_3_, account_1_.License_Number_Of_Admins as License_4_1_3_, account_1_.License_Number_Of_Editors as License_5_1_3_, account_1_.License_Number_Of_Users as License_6_1_3_, account_1_.Org_Code as Org_Code1_3_, account_1_.Org_Name as Org_Name1_3_, account_1_.Org_Email as Org_Email1_3_, account_1_.Org_Web_URL as Org_Web10_1_3_, account_1_.Org_Phone_Country_Code as Org_Pho11_1_3_, account_1_.Org_Phone_Area_Code as Org_Pho12_1_3_, account_1_.Org_Phone_Number as Org_Pho13_1_3_, account_1_.Org_Phone_Extention as Org_Pho14_1_3_, account_1_.Org_Fax_Country_Code as Org_Fax15_1_3_, account_1_.Org_Fax_Area_Code as Org_Fax16_1_3_, account_1_.Org_Fax_Number as Org_Fax17_1_3_, account_1_.Org_Fax_Extention as Org_Fax18_1_3_, account_1_.Billing_Address as Billing19_1_3_, account_1_.Billing_City as Billing20_1_3_, account_1_.Billing_Province as Billing21_1_3_, account_1_.Billing_Country as Billing22_1_3_, account_1_.Billing_ISO_Code as Billing23_1_3_, account_1_.Billing_Zip as Billing24_1_3_, account_1_.Org_Address as Org_Add25_1_3_, account_1_.Org_City as Org_City1_3_, account_1_.Org_Province as Org_Pro27_1_3_, account_1_.Org_Country as Org_Cou28_1_3_, account_1_.Org_ISO_Code as Org_ISO29_1_3_, account_1_.Org_Zip as Org_Zip1_3_, account_1_.Title as Title1_3_, account_1_.Prefix as Prefix1_3_, account_1_.First_Name as First_Name1_3_, account_1_.Middle_Name as Middle_34_1_3_, account_1_.Last_Name as Last_Name1_3_, account_1_.Suffix as Suffix1_3_, account_1_.Person_Email as Person_37_1_3_, account_1_.Person_Position as Person_38_1_3_, account_1_.Person_Department as Person_39_1_3_, account_1_.Person_Phone_Country_Code as Person_40_1_3_, account_1_.Person_Phone_Area_Code as Person_41_1_3_, account_1_.Person_Phone_Number as Person_42_1_3_, account_1_.Person_Phone_Extention as Person_43_1_3_, account_1_.Person_Fax_Country_Code as Person_44_1_3_, account_1_.Person_Fax_Area_Code as Person_45_1_3_, account_1_.Person_Fax_Number as Person_46_1_3_, account_1_.Person_Fax_Extention as Person_47_1_3_, account_1_.RegId as RegId1_3_, account_1_.RegIp as RegIp1_3_, account_1_.Status as Status1_3_, account_1_.Date_Of_Registration as Date_Of51_1_3_, account_1_.Date_Of_Activation as Date_Of52_1_3_, account_1_.Date_Of_Deactivation as Date_Of53_1_3_, account_1_.Date_Of_Update as Date_Of54_1_3_, account_1_.History as History1_3_, account_2_.Access as Access2_3_, account_2_.master_id as master_id2_3_, account_2_.Org_Code as Org_Code2_3_, account_2_.Org_Name as Org_Name2_3_, account_2_.Org_Email as Org_Email2_3_, account_2_.Org_Web_URL as Org_Web_7_2_3_, account_2_.Org_Phone_Country_Code as Org_Phon8_2_3_, account_2_.Org_Phone_Area_Code as Org_Phon9_2_3_, account_2_.Org_Phone_Number as Org_Pho10_2_3_, account_2_.Org_Phone_Extention as Org_Pho11_2_3_, account_2_.Org_Fax_Country_Code as Org_Fax12_2_3_, account_2_.Org_Fax_Area_Code as Org_Fax13_2_3_, account_2_.Org_Fax_Number as Org_Fax14_2_3_, account_2_.Org_Fax_Extention as Org_Fax15_2_3_, account_2_.Org_Address as Org_Add16_2_3_, account_2_.Org_City as Org_City2_3_, account_2_.Org_Province as Org_Pro18_2_3_, account_2_.Org_Country as Org_Cou19_2_3_, account_2_.Org_ISO_Code as Org_ISO20_2_3_, account_2_.Org_Zip as Org_Zip2_3_, account_2_.Title as Title2_3_, account_2_.Prefix as Prefix2_3_, account_2_.First_Name as First_Name2_3_, account_2_.Middle_Name as Middle_25_2_3_, account_2_.Last_Name as Last_Name2_3_, account_2_.Suffix as Suffix2_3_, account_2_.Person_Email as Person_28_2_3_, account_2_.Person_Position as Person_29_2_3_, account_2_.Person_Department as Person_30_2_3_, account_2_.Person_Phone_Country_Code as Person_31_2_3_, account_2_.Person_Phone_Area_Code as Person_32_2_3_, account_2_.Person_Phone_Number as Person_33_2_3_, account_2_.Person_Phone_Extention as Person_34_2_3_, account_2_.Person_Fax_Country_Code as Person_35_2_3_, account_2_.Person_Fax_Area_Code as Person_36_2_3_, account_2_.Person_Fax_Number as Person_37_2_3_, account_2_.Person_Fax_Extention as Person_38_2_3_, account_2_.RegId as RegId2_3_, account_2_.RegIp as RegIp2_3_, account_2_.Status as Status2_3_, account_2_.Date_Of_Registration as Date_Of42_2_3_, account_2_.Date_Of_Activation as Date_Of43_2_3_, account_2_.Date_Of_Deactivation as Date_Of44_2_3_, account_2_.Date_Of_Update as Date_Of45_2_3_, account_2_.History as History2_3_ from Admin_Surveys survey, User_Details sadmin, Master_Details master left outer join Accounts account on master.master_id=account.uid where ( account.username = 'acinausa' and survey.uid=sadmin.user_id and sadmin.master_id=master.master_id) order by survey.Survey_Name>
Hibernate: select survey.sid as sid0_, survey.uid as uid0_, survey.Parent_sid as Parent_sid0_, survey.Survey_Name as Survey_N4_0_, survey.Date_Of_Creation as Date_Of_5_0_, survey.Status as Status0_, survey.Date_Of_Status_Update as Date_Of_7_0_, survey.Tree as Tree0_, survey.History as History0_, survey.Comment as Comment0_, sadmin.user_id as uid1_, sadmin.Access as Access2_1_, sadmin.master_id as master_id2_1_, sadmin.Org_Code as Org_Code2_1_, sadmin.Org_Name as Org_Name2_1_, sadmin.Org_Email as Org_Email2_1_, sadmin.Org_Web_URL as Org_Web_7_2_1_, sadmin.Org_Phone_Country_Code as Org_Phon8_2_1_, sadmin.Org_Phone_Area_Code as Org_Phon9_2_1_, sadmin.Org_Phone_Number as Org_Pho10_2_1_, sadmin.Org_Phone_Extention as Org_Pho11_2_1_, sadmin.Org_Fax_Country_Code as Org_Fax12_2_1_, sadmin.Org_Fax_Area_Code as Org_Fax13_2_1_, sadmin.Org_Fax_Number as Org_Fax14_2_1_, sadmin.Org_Fax_Extention as Org_Fax15_2_1_, sadmin.Org_Address as Org_Add16_2_1_, sadmin.Org_City as Org_City2_1_, sadmin.Org_Province as Org_Pro18_2_1_, sadmin.Org_Country as Org_Cou19_2_1_, sadmin.Org_ISO_Code as Org_ISO20_2_1_, sadmin.Org_Zip as Org_Zip2_1_, sadmin.Title as Title2_1_, sadmin.Prefix as Prefix2_1_, sadmin.First_Name as First_Name2_1_, sadmin.Middle_Name as Middle_25_2_1_, sadmin.Last_Name as Last_Name2_1_, sadmin.Suffix as Suffix2_1_, sadmin.Person_Email as Person_28_2_1_, sadmin.Person_Position as Person_29_2_1_, sadmin.Person_Department as Person_30_2_1_, sadmin.Person_Phone_Country_Code as Person_31_2_1_, sadmin.Person_Phone_Area_Code as Person_32_2_1_, sadmin.Person_Phone_Number as Person_33_2_1_, sadmin.Person_Phone_Extention as Person_34_2_1_, sadmin.Person_Fax_Country_Code as Person_35_2_1_, sadmin.Person_Fax_Area_Code as Person_36_2_1_, sadmin.Person_Fax_Number as Person_37_2_1_, sadmin.Person_Fax_Extention as Person_38_2_1_, sadmin.RegId as RegId2_1_, sadmin.RegIp as RegIp2_1_, sadmin.Status as Status2_1_, sadmin.Date_Of_Registration as Date_Of42_2_1_, sadmin.Date_Of_Activation as Date_Of43_2_1_, sadmin.Date_Of_Deactivation as Date_Of44_2_1_, sadmin.Date_Of_Update as Date_Of45_2_1_, sadmin.History as History2_1_, sadmin_1_.username as username0_1_, sadmin_1_.passwd as passwd0_1_, sadmin_1_.acc_type as acc_type0_1_, master.master_id as uid2_, master.License_Period as License_2_1_2_, master.License_Number_Of_Surveys as License_3_1_2_, master.License_Number_Of_Admins as License_4_1_2_, master.License_Number_Of_Editors as License_5_1_2_, master.License_Number_Of_Users as License_6_1_2_, master.Org_Code as Org_Code1_2_, master.Org_Name as Org_Name1_2_, master.Org_Email as Org_Email1_2_, master.Org_Web_URL as Org_Web10_1_2_, master.Org_Phone_Country_Code as Org_Pho11_1_2_, master.Org_Phone_Area_Code as Org_Pho12_1_2_, master.Org_Phone_Number as Org_Pho13_1_2_, master.Org_Phone_Extention as Org_Pho14_1_2_, master.Org_Fax_Country_Code as Org_Fax15_1_2_, master.Org_Fax_Area_Code as Org_Fax16_1_2_, master.Org_Fax_Number as Org_Fax17_1_2_, master.Org_Fax_Extention as Org_Fax18_1_2_, master.Billing_Address as Billing19_1_2_, master.Billing_City as Billing20_1_2_, master.Billing_Province as Billing21_1_2_, master.Billing_Country as Billing22_1_2_, master.Billing_ISO_Code as Billing23_1_2_, master.Billing_Zip as Billing24_1_2_, master.Org_Address as Org_Add25_1_2_, master.Org_City as Org_City1_2_, master.Org_Province as Org_Pro27_1_2_, master.Org_Country as Org_Cou28_1_2_, master.Org_ISO_Code as Org_ISO29_1_2_, master.Org_Zip as Org_Zip1_2_, master.Title as Title1_2_, master.Prefix as Prefix1_2_, master.First_Name as First_Name1_2_, master.Middle_Name as Middle_34_1_2_, master.Last_Name as Last_Name1_2_, master.Suffix as Suffix1_2_, master.Person_Email as Person_37_1_2_, master.Person_Position as Person_38_1_2_, master.Person_Department as Person_39_1_2_, master.Person_Phone_Country_Code as Person_40_1_2_, master.Person_Phone_Area_Code as Person_41_1_2_, master.Person_Phone_Number as Person_42_1_2_, master.Person_Phone_Extention as Person_43_1_2_, master.Person_Fax_Country_Code as Person_44_1_2_, master.Person_Fax_Area_Code as Person_45_1_2_, master.Person_Fax_Number as Person_46_1_2_, master.Person_Fax_Extention as Person_47_1_2_, master.RegId as RegId1_2_, master.RegIp as RegIp1_2_, master.Status as Status1_2_, master.Date_Of_Registration as Date_Of51_1_2_, master.Date_Of_Activation as Date_Of52_1_2_, master.Date_Of_Deactivation as Date_Of53_1_2_, master.Date_Of_Update as Date_Of54_1_2_, master.History as History1_2_, master_1_.username as username0_2_, master_1_.passwd as passwd0_2_, master_1_.acc_type as acc_type0_2_, account.uid as uid3_, case when account_1_.master_id is not null then 1 when account_2_.user_id is not null then 2 when account.uid is not null then 0 end as clazz_3_, account.username as username0_3_, account.passwd as passwd0_3_, account.acc_type as acc_type0_3_, account_1_.License_Period as License_2_1_3_, account_1_.License_Number_Of_Surveys as License_3_1_3_, account_1_.License_Number_Of_Admins as License_4_1_3_, account_1_.License_Number_Of_Editors as License_5_1_3_, account_1_.License_Number_Of_Users as License_6_1_3_, account_1_.Org_Code as Org_Code1_3_, account_1_.Org_Name as Org_Name1_3_, account_1_.Org_Email as Org_Email1_3_, account_1_.Org_Web_URL as Org_Web10_1_3_, account_1_.Org_Phone_Country_Code as Org_Pho11_1_3_, account_1_.Org_Phone_Area_Code as Org_Pho12_1_3_, account_1_.Org_Phone_Number as Org_Pho13_1_3_, account_1_.Org_Phone_Extention as Org_Pho14_1_3_, account_1_.Org_Fax_Country_Code as Org_Fax15_1_3_, account_1_.Org_Fax_Area_Code as Org_Fax16_1_3_, account_1_.Org_Fax_Number as Org_Fax17_1_3_, account_1_.Org_Fax_Extention as Org_Fax18_1_3_, account_1_.Billing_Address as Billing19_1_3_, account_1_.Billing_City as Billing20_1_3_, account_1_.Billing_Province as Billing21_1_3_, account_1_.Billing_Country as Billing22_1_3_, account_1_.Billing_ISO_Code as Billing23_1_3_, account_1_.Billing_Zip as Billing24_1_3_, account_1_.Org_Address as Org_Add25_1_3_, account_1_.Org_City as Org_City1_3_, account_1_.Org_Province as Org_Pro27_1_3_, account_1_.Org_Country as Org_Cou28_1_3_, account_1_.Org_ISO_Code as Org_ISO29_1_3_, account_1_.Org_Zip as Org_Zip1_3_, account_1_.Title as Title1_3_, account_1_.Prefix as Prefix1_3_, account_1_.First_Name as First_Name1_3_, account_1_.Middle_Name as Middle_34_1_3_, account_1_.Last_Name as Last_Name1_3_, account_1_.Suffix as Suffix1_3_, account_1_.Person_Email as Person_37_1_3_, account_1_.Person_Position as Person_38_1_3_, account_1_.Person_Department as Person_39_1_3_, account_1_.Person_Phone_Country_Code as Person_40_1_3_, account_1_.Person_Phone_Area_Code as Person_41_1_3_, account_1_.Person_Phone_Number as Person_42_1_3_, account_1_.Person_Phone_Extention as Person_43_1_3_, account_1_.Person_Fax_Country_Code as Person_44_1_3_, account_1_.Person_Fax_Area_Code as Person_45_1_3_, account_1_.Person_Fax_Number as Person_46_1_3_, account_1_.Person_Fax_Extention as Person_47_1_3_, account_1_.RegId as RegId1_3_, account_1_.RegIp as RegIp1_3_, account_1_.Status as Status1_3_, account_1_.Date_Of_Registration as Date_Of51_1_3_, account_1_.Date_Of_Activation as Date_Of52_1_3_, account_1_.Date_Of_Deactivation as Date_Of53_1_3_, account_1_.Date_Of_Update as Date_Of54_1_3_, account_1_.History as History1_3_, account_2_.Access as Access2_3_, account_2_.master_id as master_id2_3_, account_2_.Org_Code as Org_Code2_3_, account_2_.Org_Name as Org_Name2_3_, account_2_.Org_Email as Org_Email2_3_, account_2_.Org_Web_URL as Org_Web_7_2_3_, account_2_.Org_Phone_Country_Code as Org_Phon8_2_3_, account_2_.Org_Phone_Area_Code as Org_Phon9_2_3_, account_2_.Org_Phone_Number as Org_Pho10_2_3_, account_2_.Org_Phone_Extention as Org_Pho11_2_3_, account_2_.Org_Fax_Country_Code as Org_Fax12_2_3_, account_2_.Org_Fax_Area_Code as Org_Fax13_2_3_, account_2_.Org_Fax_Number as Org_Fax14_2_3_, account_2_.Org_Fax_Extention as Org_Fax15_2_3_, account_2_.Org_Address as Org_Add16_2_3_, account_2_.Org_City as Org_City2_3_, account_2_.Org_Province as Org_Pro18_2_3_, account_2_.Org_Country as Org_Cou19_2_3_, account_2_.Org_ISO_Code as Org_ISO20_2_3_, account_2_.Org_Zip as Org_Zip2_3_, account_2_.Title as Title2_3_, account_2_.Prefix as Prefix2_3_, account_2_.First_Name as First_Name2_3_, account_2_.Middle_Name as Middle_25_2_3_, account_2_.Last_Name as Last_Name2_3_, account_2_.Suffix as Suffix2_3_, account_2_.Person_Email as Person_28_2_3_, account_2_.Person_Position as Person_29_2_3_, account_2_.Person_Department as Person_30_2_3_, account_2_.Person_Phone_Country_Code as Person_31_2_3_, account_2_.Person_Phone_Area_Code as Person_32_2_3_, account_2_.Person_Phone_Number as Person_33_2_3_, account_2_.Person_Phone_Extention as Person_34_2_3_, account_2_.Person_Fax_Country_Code as Person_35_2_3_, account_2_.Person_Fax_Area_Code as Person_36_2_3_, account_2_.Person_Fax_Number as Person_37_2_3_, account_2_.Person_Fax_Extention as Person_38_2_3_, account_2_.RegId as RegId2_3_, account_2_.RegIp as RegIp2_3_, account_2_.Status as Status2_3_, account_2_.Date_Of_Registration as Date_Of42_2_3_, account_2_.Date_Of_Activation as Date_Of43_2_3_, account_2_.Date_Of_Deactivation as Date_Of44_2_3_, account_2_.Date_Of_Update as Date_Of45_2_3_, account_2_.History as History2_3_ from Admin_Surveys survey, User_Details sadmin, Master_Details master left outer join Accounts account on master.master_id=account.uid where ( account.username = 'acinausa' and survey.uid=sadmin.user_id and sadmin.master_id=master.master_id) order by survey.Survey_Name
2004-06-04 22:35:09,359 DEBUG [net.sf.hibernate.impl.BatcherImpl] - <preparing statement>
2004-06-04 22:35:09,580 DEBUG [net.sf.hibernate.util.JDBCExceptionReporter] - <SQL Exception>
org.firebirdsql.jdbc.FBSQLException: GDS Exception. 335544569. Dynamic SQL Error
SQL error code = -206
Column unknown
SADMIN_1_.USERNAME
At line 1, column 2130.
at org.firebirdsql.jdbc.AbstractPreparedStatement.<init>(AbstractPreparedStatement.java:91)
at org.firebirdsql.jdbc.FBPreparedStatement.<init>(FBPreparedStatement.java:34)
at org.firebirdsql.jdbc.AbstractConnection.prepareStatement(AbstractConnection.java:682)
at org.firebirdsql.jdbc.AbstractConnection.prepareStatement(AbstractConnection.java:232)
at org.apache.commons.dbcp.DelegatingConnection.prepareStatement(DelegatingConnection.java:216)
at org.apache.commons.dbcp.PoolingDataSource$PoolGuardConnectionWrapper.prepareStatement(PoolingDataSource.java:323)
at net.sf.hibernate.impl.BatcherImpl.getPreparedStatement(BatcherImpl.java:249)
at net.sf.hibernate.impl.BatcherImpl.getPreparedStatement(BatcherImpl.java:223)
at net.sf.hibernate.impl.BatcherImpl.prepareQueryStatement(BatcherImpl.java:65)
at net.sf.hibernate.loader.Loader.prepareQueryStatement(Loader.java:704)
at net.sf.hibernate.loader.Loader.doQuery(Loader.java:185)
at net.sf.hibernate.loader.Loader.doQueryAndInitializeNonLazyCollections(Loader.java:133)
at net.sf.hibernate.loader.Loader.doList(Loader.java:950)
at net.sf.hibernate.loader.Loader.list(Loader.java:941)
at net.sf.hibernate.loader.SQLLoader.list(SQLLoader.java:92)
at net.sf.hibernate.impl.SessionImpl.findBySQL(SessionImpl.java:3764)
at net.sf.hibernate.impl.SQLQueryImpl.list(SQLQueryImpl.java:52)
at com.volin.sas.hibernate.HibernateSurveyFactory$1.doInHibernate(HibernateSurveyFactory.java:136)
....................................


Top
 Profile  
 
 Post subject:
PostPosted: Fri Jun 04, 2004 2:46 pm 
Beginner
Beginner

Joined: Mon Jan 05, 2004 12:48 pm
Posts: 31
Sorry for long logging - the query generated by hibernate was wrong!


Top
 Profile  
 
 Post subject:
PostPosted: Fri Jun 04, 2004 2:47 pm 
Beginner
Beginner

Joined: Mon Jan 05, 2004 12:48 pm
Posts: 31
... and really awfull. i do not need so much info returned :-((


Top
 Profile  
 
 Post subject:
PostPosted: Fri Jun 04, 2004 3:27 pm 
Beginner
Beginner

Joined: Mon Jan 05, 2004 12:48 pm
Posts: 31
I subdivided a large query into 2 sub-query and finally got what i wanted.
Thanks!


Top
 Profile  
 
 Post subject:
PostPosted: Fri Jun 04, 2004 4:00 pm 
Beginner
Beginner

Joined: Mon Jan 05, 2004 12:48 pm
Posts: 31
Actually the reason to use native sql is that i want to use CASE clause in SELECT query. But now i see that it is very likely impossible becuase of demand of using aliases for ALL properties.
E.g. if SQL query is:
Code:
  SELECT
    o.ID,
    o.Description,
    CASE
      WHEN (o.Status IS NULL) THEN 'new'
      WHEN (o.Status = 1) THEN 'confirmed'
      WHEN (o.Status = 3) THEN 'in production'
      WHEN (o.Status = 4) THEN 'ready'
      WHEN (o.Status = 5) THEN 'shipped'
      ELSE 'unknown status ''' || o.Status || ''''
    END
  FROM
    Orders o


then how it could look in createSQLQuery? Is there any workaround for that? Or should I drop this idea for a while till richer Hibernate abilities?

Thank, Sergei.


Top
 Profile  
 
 Post subject:
PostPosted: Fri Jun 04, 2004 4:14 pm 
Hibernate Team
Hibernate Team

Joined: Thu Dec 18, 2003 9:55 am
Posts: 1977
Location: France
why not mapping status column as statusId and manage an unmapped business property statusString

in the setStatusId you'll put your logic "case" to fill statusString....

_________________
Anthony,
Get value thanks to your skills: http://www.redhat.com/certification


Top
 Profile  
 
 Post subject:
PostPosted: Fri Jun 04, 2004 5:52 pm 
Beginner
Beginner

Joined: Mon Jan 05, 2004 12:48 pm
Posts: 31
No way. It will require the getter for statusString and thus violate the signiture of a bean..
The better is to declare status property as String from the beginning and do whatever need in setStatus methode.
It works for me. Thanks for the prompt response :-)


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 12 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.