For this specific scenario, I'm loading a Organization object using session.get(Organization.class, pk);
Organization has a SET mapped for orgTypes. (One organization has many orgTypes) I'm not using lazy loading for now, so hibernate is loading all the orgTypes for that specific organization. That's the query you see below. Thanks again, Marcelo. -----Original Message----- From: Gavin King [mailto:[EMAIL PROTECTED] Sent: Thursday, October 28, 2004 11:37 AM To: Caldas, Marcelo Cc: [EMAIL PROTECTED] Subject: Re: [Hibernate] where clause for collections. And this is what? A collection loader? A HQL query? Caldas, Marcelo wrote: >Here's a snapshot of what's going on: > >Hibernate: select orgtypes0_.organization_id as organiza5___, >orgtypes0_.organization_type_id as organiza1___, >orgtypes0_.organization_type_id as organiza1_2_, orgtypes0_._version as >_version2_, orgtypes0_.primary_ind as primary_3_2_, >orgtypes0_.organization_type as organiza4_2_, orgtypes0_.organization_id >as organiza5_2_, orgtypes0_._created_timestamp as _created6_2_, >orgtypes0_._created_by as _created7_2_, orgtypes0_._modified_timestamp >as _modifie8_2_, orgtypes0_._modified_by as _modifie9_2_, >orgtypes0_._active_ind as _active10_2_, vocabulary1_.vocabulary_id as >vocabula1_0_, vocabulary1_._version as _version0_, >vocabulary1_.vocabulary_type_id as vocabula3_0_, >vocabulary1_.abbreviation as abbrevia4_0_, vocabulary1_.private_ind as >private_5_0_, vocabulary1_.name as name0_, vocabulary1_.description as >descript7_0_, vocabulary1_._created_timestamp as _created8_0_, >vocabulary1_._created_by as _created9_0_, >vocabulary1_._modified_timestamp as _modifi10_0_, >vocabulary1_._modified_by as _modifi11_0_, vocabulary1_._active_ind as >_active12_0_, vocabulary2_.vocabulary_type_id as vocabula1_1_, >vocabulary2_._version as _version1_, vocabulary2_.controlled_ind as >controll3_1_, vocabulary2_.app_code as app_code1_, vocabulary2_.name as >name1_, vocabulary2_.description as descript6_1_, >vocabulary2_._created_timestamp as _created7_1_, >vocabulary2_._created_by as _created8_1_, >vocabulary2_._modified_timestamp as _modifie9_1_, >vocabulary2_._modified_by as _modifi10_1_, vocabulary2_._active_ind as >_active11_1_ from ORGANIZATION_TYPE orgtypes0_ left outer join >VOCABULARY vocabulary1_ on >orgtypes0_.organization_type=vocabulary1_.vocabulary_id left outer join >VOCABULARY_TYPE vocabulary2_ on >vocabulary1_.vocabulary_type_id=vocabulary2_.vocabulary_type_id where >orgtypes0_.organization_id=? and _active_ind=1 > >Oct 27, 2004 2:04:14 PM net.sf.hibernate.util.JDBCExceptionReporter >logExceptions >WARNING: SQL Error: 209, SQLState: S1000 >Oct 27, 2004 2:04:14 PM net.sf.hibernate.util.JDBCExceptionReporter >logExceptions >SEVERE: Ambiguous column name '_active_ind'. >Oct 27, 2004 2:04:14 PM net.sf.hibernate.util.JDBCExceptionReporter >logExceptions >WARNING: SQL Error: 209, SQLState: S1000 >Oct 27, 2004 2:04:14 PM net.sf.hibernate.util.JDBCExceptionReporter >logExceptions >SEVERE: Ambiguous column name '_active_ind'. >Oct 27, 2004 2:04:14 PM net.sf.hibernate.JDBCException <init> >SEVERE: could not initialize collection: >[gov.phindir.platform.organization.tran >sferObjects.PhindirOrganization.orgTypes#23] >java.sql.SQLException: Ambiguous column name '_active_ind'. > >As you can see, the first line reads select "orgtypes0_" >And last line where "_active_ind-1", but I have an _active_ind on every >single table part of that from clause. > > > >-----Original Message----- >From: [EMAIL PROTECTED] >[mailto:[EMAIL PROTECTED] On Behalf Of Gavin >King >Sent: Wednesday, October 27, 2004 9:49 AM >To: Caldas, Marcelo >Cc: [EMAIL PROTECTED] >Subject: Re: [Hibernate] where clause for collections. > >Caldas, Marcelo wrote: > > > >>And then I use the where="active_ind=1" to retrieve only active >> >> >children. > > >>First problem is I'm getting "ambiguous column name 'active_ind'" >>because most of the tables have an active_ind column - same name. >> >> >> >Hibernate should automatically prefix the column name. What does the >generated SQL look like? > > > -- Gavin King +61 410 534 454 +1 404 822 8349 callto://gavinking Hibernate [EMAIL PROTECTED] http://hibernate.org JBoss Inc [EMAIL PROTECTED] http://jboss.com ------------------------------------------------------- This Newsletter Sponsored by: Macrovision For reliable Linux application installations, use the industry's leading setup authoring tool, InstallShield X. Learn more and evaluate today. http://clk.atdmt.com/MSI/go/ins0030000001msi/direct/01/ _______________________________________________ hibernate-devel mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/hibernate-devel