-->
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.  [ 8 posts ] 
Author Message
 Post subject: Problem with map within a component in 2.1b6
PostPosted: Wed Nov 12, 2003 3:15 pm 
Newbie

Joined: Tue Nov 11, 2003 10:42 am
Posts: 9
It looks to me like there is a bug in 2.1b6. Can someone please confirm this?

I have a map within a component. When I attempt to load my entity, I get an SQL exception: "Invalid Column Name". It appears that the SQL hibernate is generating is not including the columns from the mapping table. This works fine in 2.0.3.

Mapping section:
Code:
  <class
     name="com.acme.server.content.entity.ContentInfoEntity"
     table="OBJECT_STACKS"
     dynamic-update="true"
     >
     <id name="id" column="OBJECT_ID" type="string">
      <generator class="com.acme.server.common.TeamsIdGenerator"/>
    </id>
    <component
      name="contentInfo"
      class="com.acme.content.ContentInfo"
      insert="false"
      update="true"
      >       
      <property name="name" column="OBJECT_NAME" type="string"/>
      <property name="contentSize" column="CONTENT_SIZE" type="java.lang.Long"/>
      <property name="contentKind" column="CONTENT_KIND" type="string"/>
      <property name="mimeType" column="MIME_TYPE" type="string"/>
      <property name="contentPath" column="OBJECT_NAME_LOCATION" type="string"/>
      <property name="status" column="STATUS" type="string"/>
      <property name="encoding" column="OBJECT_ENCODING" type="string"/>
      <property name="unitOfSize" column="UNIT" type="string"/>
      <component
        name="storageManagerId"
        class="com.acme.entity.TeamsIdentifier"
         insert="false"
         update="false"
       >
         <property name="teamsId" column="STORAGE_MANAGER_ID" type="string"/>
       </component>
       <map
         name="storageAttributesMap"
         table="CONTENT_OBJECT_STORAGE_ATTR"
         lazy="true"
         outer-join="true"
         >
         <key column="OBJECT_ID"/>
         <index column="ATTR_NAME" type="string"/>
         <element column="ATTR_VALUE" type="string"/>
       </map>
     </component>
  </class>


Hibernate SQL:
Code:
Hibernate: select this.OBJECT_ID as OBJECT_ID0_, this.OBJECT_NAME as OBJECT_N2_0_, this.CONTENT_SIZE as CONTENT_3_0_, this.CONTENT_KIND as CONTENT_4_0_, this.MIME_TYPE as MIME_TYPE0_, this.OBJECT_NAME_LOCATION as OBJECT_N6_0_, this.STATUS as STATUS0_, this.OBJECT_ENCODING as OBJECT_E8_0_, this.UNIT as UNIT0_, this.STORAGE_MANAGER_ID as STORAGE10_0_ from OBJECT_STACKS this, CONTENT_OBJECT_STORAGE_ATTR storagea1_ where this.OBJECT_ID in (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?) and this.OBJECT_ID=storagea1_.OBJECT_ID(+)


Top
 Profile  
 
 Post subject:
PostPosted: Wed Nov 12, 2003 9:57 pm 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 12:50 pm
Posts: 5130
Location: Melbourne, Australia
What ARE you doing, actually .... I think you are lying to me..... this is not a load() at all, is it? Its actually a criteria query, I think??

Please be more specific....


Top
 Profile  
 
 Post subject:
PostPosted: Thu Nov 13, 2003 4:36 pm 
Newbie

Joined: Tue Nov 11, 2003 10:42 am
Posts: 9
Sorry, I meant "load" in a very generic sense. I am indeed performing a criteria query. Is there something I am doing wrong?


Top
 Profile  
 
 Post subject:
PostPosted: Thu Nov 13, 2003 7:58 pm 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 12:50 pm
Posts: 5130
Location: Melbourne, Australia
Well, it helps enormously to show the actual query, of course.


Top
 Profile  
 
 Post subject:
PostPosted: Thu Nov 13, 2003 9:37 pm 
Newbie

Joined: Tue Nov 11, 2003 10:42 am
Posts: 9
Thanks for your help. Here's my query code. Please let me know if you need more info.

Code:
Session hibernateSession = context.getHibernateSession();
Criteria c = hibernateSession.createCriteria(ContentInfoEntity.class);
c.add(Expression.in("id", contentIdList));
if (LOGGER.isDebugEnabled())
   LOGGER.debug("Querying for content with ids in " + contentIdList);
List infoList = c.list();
LOGGER.debug("Query complete.");


contentIdList is an ArrayList of strings.


Top
 Profile  
 
 Post subject:
PostPosted: Thu Nov 13, 2003 10:44 pm 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 12:50 pm
Posts: 5130
Location: Melbourne, Australia
Well, I have really thoroughly retested this now, and it works fine for me. Are you sure about this? If you can reproduce in a very simple, isolated main() method, submit that to JIRA.


Top
 Profile  
 
 Post subject:
PostPosted: Fri Nov 14, 2003 10:07 am 
Newbie

Joined: Tue Nov 11, 2003 10:42 am
Posts: 9
I am sure, yes. I will put together a sample and submit it.

Thanks


Top
 Profile  
 
 Post subject:
PostPosted: Fri Nov 14, 2003 12:20 pm 
Newbie

Joined: Tue Nov 11, 2003 10:42 am
Posts: 9
The JIRA issue can be found here: http://opensource.atlassian.com/projects/hibernate/secure/ViewIssue.jspa?key=HB-470


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