-->
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.  [ 2 posts ] 
Author Message
 Post subject: Error with sql generated by hibernate after upgrade to 2.1.3
PostPosted: Tue May 04, 2004 3:37 pm 
Newbie

Joined: Wed Nov 12, 2003 4:57 pm
Posts: 14
Location: New York City
I upgraded to hibernate 2.1.3 from 2.0.1 .

After the upgrade, I have begun receiving the following error followed by a HUMONGOUS stack trace

exception was logged java.sql.SQLException: ORA-00904: "EDITORIA1_"."EDITORIAL_TYPE_ID": invalid identifier


The following is the sql that generates the sql exception:


------------------------------------------------------

select features0_.content_editorial_id as content_1___,
features0_.destination_id as destinat2___,
editorial1_.content_id as content_id0_,
case when editorial1__2_.content_id is not null then 1 when editorial1_.content_id is not null then 0 end as clazz_0_,
editorial1_.title as title23_0_,
editorial1_.copy as copy23_0_,
editorial1_.summary as summary23_0_,
editorial1_.issue_date as issue_date23_0_,
editorial1_.issue_number as issue_nu6_23_0_,
editorial1_.editorial_type_id as editoria7_23_0_,
editorial1__1_.live_date as live_date6_0_,
editorial1__1_.expire_date as expire_d3_6_0_,
editorial1__1_.archived as archived6_0_,
editorial1__1_.searchable as searchable6_0_,
editorial1__1_.source_id as source_id6_0_,
editorial1__1_.email as email6_0_,
editorial1__1_.byline as byline6_0_,
editorial1__1_.source_type_id as source_t9_6_0_,
editorial1__1_.content_type_id as content10_6_0_,
editorial1__2_.partner_deal_url as partner_2_25_0_,
editorial1__2_.partner_url as partner_3_25_0_,
editorial1__2_.restrictions as restrict4_25_0_,
editorial1__2_.booking_rules as booking_5_25_0_,
editorial1__2_.deal_source_type_id as deal_sou6_25_0_,
editorialt2_.editorial_type_id as editoria1_1_,
editorialt2_.name as name1_,
sourcetype3_.source_type_id as source_t1_2_,
sourcetype3_.name as name2_,
sourcetype3_.url_name as url_name2_,
sourcetype3_.image as image2_,
contenttyp4_.content_type_id as content_1_3_,
contenttyp4_.name as name3_,
dealsource5_.deal_source_type_id as deal_sou1_4_,
dealsource5_.name as name4_,
dealsource5_.url_name as url_name4_ from Editorial_Destination features0_

inner join Editorial editorial1_ on features0_.content_editorial_id=editorial1_.content_id left
outer join content editorial1__1_ on editorial1_.content_id=editorial1__1_.content_id left
outer join Deal editorial1__2_ on editorial1_.content_id=editorial1__2_.content_id left
outer join Editorial_Type editorialt2_ on editorial1_.editorial_type_id=editorialt2_.editorial_type_id left
outer join Source_Type sourcetype3_ on editorial1__1_.source_type_id=sourcetype3_.source_type_id left
outer join Content_Type contenttyp4_ on editorial1__1_.content_type_id=contenttyp4_.content_type_id left
outer join Deal_Source_Type dealsource5_ on editorial1__2_.deal_source_type_id=dealsource5_.deal_source_type_id

where features0_.destination_id='?' and editoria1_.editorial_type_id='2'

------------------------------------------------------

I replaced the ? with a valid destination_id and ran it in a sql client standalone and got a sql error.

The error is with the final "and editoria1_.editorial_type_id='2'" .

Here is the part of the mapping file that is appropriate for this query:
----------------------------------------------------------
<joined-subclass name="com.amg.concierge.data.domain.content.editorial.Editorial" table="Editorial" >

<key column="content_id"/>

<property name="title" column="title" not-null="false" type="string"/>
<property name="copy" column="copy" not-null="false" type="com.amg.concierge.data.persistence.StringClobType"/>
<property name="summary" column="summary" not-null="false" type="com.amg.concierge.data.persistence.StringClobType"/>
<property name="issueDate" column="issue_date" not-null="false" type="timestamp"/>
<property name="issueNumber" column="issue_number" not-null="false" type="string"/>

<many-to-one name="editorialType" column="editorial_type_id" />

<set name="destinations" table="Editorial_Destination" inverse="false" cascade="none" lazy="true">

<key column="content_editorial_id"/>
<many-to-many class="com.amg.concierge.data.domain.Destination" column="destination_id" />
</set>

<joined-subclass name="com.amg.concierge.data.domain.content.editorial.Deal" table="Deal" >

<key column="content_id"/>

<property name="partnerDealURL" column="partner_deal_url" not-null="false" type="string"/>
<property name="partnerURL" column="partner_url" not-null="false" type="string"/>
<property name="restrictions" column="restrictions" not-null="false" type="com.amg.concierge.data.persistence.StringClobType"/>
<property name="bookingRules" column="booking_rules" not-null="false" type="com.amg.concierge.data.persistence.StringClobType"/>

<many-to-one name="dealSourceType" column="deal_source_type_id" />
<set name="dealTypes" table="Deal_Deal_Type" inverse="false" lazy="true">

<key column="editorial_id"/>
<many-to-many class="com.amg.concierge.data.domain.content.attributes.DealType" column="deal_type_id" />
</set>
</joined-subclass>
</joined-subclass>

<joined-subclass name="com.amg.concierge.data.domain.content.editorial.Feature" table="Editorial" >

<key column="content_id"/>

<property name="title" column="title" not-null="false" type="string"/>
<property name="copy" column="copy" not-null="false" type="com.amg.concierge.data.persistence.StringClobType"/>
<property name="summary" column="summary" not-null="false" type="com.amg.concierge.data.persistence.StringClobType"/>
<property name="issueDate" column="issue_date" not-null="false" type="timestamp"/>
<property name="issueNumber" column="issue_number" not-null="false" type="string"/>

<many-to-one name="editorialType" column="editorial_type_id" />

<set name="destinations" table="Editorial_Destination" inverse="false" cascade="none" lazy="true">

<key column="content_editorial_id"/>
<many-to-many class="com.amg.concierge.data.domain.Destination" column="destination_id" />
</set>
</joined-subclass>

----------------------------------------------------

I was just wondering if there is some known bug with the inner join sql generator in 2.1.3? Or perhaps there is some mapping that works in 2.0.1 that doesnt fly in 2.1.3?


Top
 Profile  
 
 Post subject:
PostPosted: Tue May 04, 2004 3:42 pm 
Newbie

Joined: Wed Nov 12, 2003 4:57 pm
Posts: 14
Location: New York City
I think I actually found it:

I found the following mapping:

<set name="features" table="Editorial_Destination" cascade="none" inverse="true" lazy="true" where="editoria1_.editorial_type_id=2">

<key column="destination_id"/>
<many-to-many class="com.amg.concierge.data.domain.content.editorial.Editorial" column="content_editorial_id" />
</set>

If memory serves me, I was told this was a hack workaround so that I could have a collection return a subset of a collection. I guess the syntax of the hack changed.


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