-->
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.  [ 4 posts ] 
Author Message
 Post subject: Informix dialact produces wrong SQL "catalog"
PostPosted: Mon Feb 06, 2006 7:44 pm 
Newbie

Joined: Fri Feb 11, 2005 2:13 pm
Posts: 11
Hibernate version:3.1.2

Mapping documents:
<hibernate-mapping>
<class name="com.intrado.domain.accessors.I911MsagCr" table="i911_msag_cr" schema="informix" catalog="dms">
<id name="id" type="int">
<column name="id" />
<generator class="assigned" />
</id>
<property name="lastStatusCode" type="short">
<column name="last_status_code" not-null="true" />
</property>
..........
</class>
</hibernate-mapping>






Name and version of the database you are using:
Informix Dynamic Server
9.40.FC6
IBM Informix JDBC Driver for IBM Informix Dynamic Server
3.00.JC1
/b]

[b]The generated SQL (show_sql=true):
select i911msagcr0_.id as id0_0_, i911msagcr0_.last_status_code as last2_0_0_, i911msagcr0_.is_orig_by_cv_f as is3_0_0_, i911msagcr0_.is_pending_f as is4_0_0_, i911msagcr0_.cview_id as cview5_0_0_, i911msagcr0_.type as type0_0_, i911msagcr0_.msag_rowid as msag7_0_0_, i911msagcr0_.dbname as dbname0_0_, i911msagcr0_.low_hous_nm as low9_0_0_, i911msagcr0_.old_low_hous_nm as old10_0_0_, i911msagcr0_.high_hous_nm as high11_0_0_, i911msagcr0_.old_high_hous_nm as old12_0_0_, i911msagcr0_.odd_even as odd13_0_0_, i911msagcr0_.old_odd_even as old14_0_0_, i911msagcr0_.prefix_dir as prefix15_0_0_, i911msagcr0_.old_prefix_dir as old16_0_0_, i911msagcr0_.street_name as street17_0_0_, i911msagcr0_.old_street_name as old18_0_0_, i911msagcr0_.suffix_dir as suffix19_0_0_, i911msagcr0_.old_suffix_dir as old20_0_0_, i911msagcr0_.community as community0_0_, i911msagcr0_.old_community as old22_0_0_, i911msagcr0_.county as county0_0_, i911msagcr0_.old_county as old24_0_0_, i911msagcr0_.state as state0_0_, i911msagcr0_.old_state as old26_0_0_, i911msagcr0_.esn as esn0_0_, i911msagcr0_.old_esn as old28_0_0_, i911msagcr0_.exchange as exchange0_0_, i911msagcr0_.old_exchange as old30_0_0_, i911msagcr0_.msag_comment as msag31_0_0_, i911msagcr0_.old_msag_comment as old32_0_0_, i911msagcr0_.tn_comment as tn33_0_0_, i911msagcr0_.old_tn_comment as old34_0_0_, i911msagcr0_.police_elt as police35_0_0_, i911msagcr0_.old_police_elt as old36_0_0_, i911msagcr0_.fire_elt as fire37_0_0_, i911msagcr0_.old_fire_elt as old38_0_0_, i911msagcr0_.ems_elt as ems39_0_0_, i911msagcr0_.old_ems_elt as old40_0_0_, i911msagcr0_.muni_elt as muni41_0_0_, i911msagcr0_.old_muni_elt as old42_0_0_, i911msagcr0_.t_user_id as t43_0_0_, i911msagcr0_.t_org_id as t44_0_0_, i911msagcr0_.t_user_name as t45_0_0_, i911msagcr0_.t_org_name as t46_0_0_, i911msagcr0_.t_cview_name as t47_0_0_, i911msagcr0_.t_status_code as t48_0_0_, i911msagcr0_.t_fwd_to_org_id as t49_0_0_, i911msagcr0_.t_dms_error as t50_0_0_, i911msagcr0_.t_remarks as t51_0_0_, i911msagcr0_.orig_org_id as orig52_0_0_, i911msagcr0_.orig_date as orig53_0_0_, i911msagcr0_.mod_date as mod54_0_0_, i911msagcr0_.orig_user_id as orig55_0_0_ from dms.informix.i911_msag_cr i911msagcr0_ where i911msagcr0_.id=?


The above SQL is wrong for the Informix dialact. The mapping above(truncated for brevity) shows that catalog is set to "dms". The issue is that that when SQL is created in the "from" in the SQL above, the catalog name is seperated from the table name with a period(dms.informix.i911_msag_cr i911msagcr0_ ), In infromix instead of "dms.", the separation should be using the colon(':'), "dms: ".

I am assuming this is a bug, but wanted to make sure that I am not doing anything wrong. I do get the following exception:



Code:


org.hibernate.exception.SQLGrammarException: could not load an entity: [com.intrado.domain.accessors.I911MsagCr#470]
   at org.hibernate.exception.SQLStateConverter.convert(SQLStateConverter.java:65)
   at org.hibernate.exception.JDBCExceptionHelper.convert(JDBCExceptionHelper.java:43)
   at org.hibernate.loader.Loader.loadEntity(Loader.java:1799)
   at org.hibernate.loader.entity.AbstractEntityLoader.load(AbstractEntityLoader.java:93)
   at org.hibernate.loader.entity.AbstractEntityLoader.load(AbstractEntityLoader.java:81)
   at org.hibernate.persister.entity.AbstractEntityPersister.load(AbstractEntityPersister.java:2730)
   at org.hibernate.event.def.DefaultLoadEventListener.loadFromDatasource(DefaultLoadEventListener.java:365)
   at org.hibernate.event.def.DefaultLoadEventListener.doLoad(DefaultLoadEventListener.java:346)
   at org.hibernate.event.def.DefaultLoadEventListener.load(DefaultLoadEventListener.java:123)
   at org.hibernate.event.def.DefaultLoadEventListener.proxyOrLoad(DefaultLoadEventListener.java:177)
   at org.hibernate.event.def.DefaultLoadEventListener.onLoad(DefaultLoadEventListener.java:87)
   at org.hibernate.impl.SessionImpl.fireLoad(SessionImpl.java:891)
   at org.hibernate.impl.SessionImpl.get(SessionImpl.java:828)
   at org.hibernate.impl.SessionImpl.get(SessionImpl.java:821)
   at com.intrado.MsagCrTester.main(MsagCrTester.java:36)
   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 com.intellij.rt.execution.application.AppMain.main(AppMain.java:86)
Caused by: java.sql.SQLException: A syntax error has occurred.
   at com.informix.util.IfxErrMsg.getSQLException(IfxErrMsg.java:373)
   at com.informix.jdbc.IfxSqli.a(IfxSqli.java:3207)
   at com.informix.jdbc.IfxSqli.E(IfxSqli.java:3517)
   at com.informix.jdbc.IfxSqli.dispatchMsg(IfxSqli.java:2352)
   at com.informix.jdbc.IfxSqli.receiveMessage(IfxSqli.java:2268)
   at com.informix.jdbc.IfxSqli.executePrepare(IfxSqli.java:1152)
   at com.informix.jdbc.IfxPreparedStatement.e(IfxPreparedStatement.java:318)
   at com.informix.jdbc.IfxPreparedStatement.a(IfxPreparedStatement.java:295)
   at com.informix.jdbc.IfxPreparedStatement.<init>(IfxPreparedStatement.java:165)
   at com.informix.jdbc.IfxSqliConnect.h(IfxSqliConnect.java:5880)
   at com.informix.jdbc.IfxSqliConnect.prepareStatement(IfxSqliConnect.java:1991)
   at org.hibernate.jdbc.AbstractBatcher.getPreparedStatement(AbstractBatcher.java:442)
   at org.hibernate.jdbc.AbstractBatcher.getPreparedStatement(AbstractBatcher.java:368)
   at org.hibernate.jdbc.AbstractBatcher.prepareQueryStatement(AbstractBatcher.java:105)
   at org.hibernate.loader.Loader.prepareQueryStatement(Loader.java:1561)
   at org.hibernate.loader.Loader.doQuery(Loader.java:661)
   at org.hibernate.loader.Loader.doQueryAndInitializeNonLazyCollections(Loader.java:224)
   at org.hibernate.loader.Loader.loadEntity(Loader.java:1785)
   ... 17 more




Top
 Profile  
 
 Post subject: Same Error Here
PostPosted: Fri Jul 06, 2007 5:43 pm 
Newbie

Joined: Fri Jul 06, 2007 5:39 pm
Posts: 5
I get exactly the same problem. I'm also using IDS 9.4, but JDBC 3.00jc3. I think it's a bug in the Hibernate code, but who knows.

If anyone's actually reading this, I'll be happy to post configs/logs, but it's the same thing as the previous one.


Top
 Profile  
 
 Post subject: Extension to Previous Post
PostPosted: Fri Jul 06, 2007 5:46 pm 
Newbie

Joined: Fri Jul 06, 2007 5:39 pm
Posts: 5
I did come across one or two completely vague third-hand mentions about Hibernate supposedly being non-compatible with Informix 9.4, but can't find any details.


Top
 Profile  
 
 Post subject: Found Workaround
PostPosted: Fri Jul 06, 2007 6:13 pm 
Newbie

Joined: Fri Jul 06, 2007 5:39 pm
Posts: 5
Turns out you can work around it by fully, correctly qualifying the table name in your mapping file.

So, your mapping file would have a class line like this:

<class name="com.intrado.domain.accessors.I911MsagCr" table="dms:informix.i911_msag_cr">

http://opensource.atlassian.com/project ... e/HHH-1476

May very well be a bug, who knows? At least this works for now.


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