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.  [ 1 post ] 
Author Message
 Post subject: Prevent of Fetching some columns/ Urgent : please help me :(
PostPosted: Wed Sep 17, 2008 7:23 am 
Newbie

Joined: Wed Sep 17, 2008 6:46 am
Posts: 1
Hi There ,

I'm using asp.net 1.1 and Nhibernate 1.2

I have kind of parent and child classes , and the problem is the child class has a byte array(byte[]) that could be very large . In fact i use this class as a picture object to fetch sql image type.


here is part of my class :

The Parent :

Code:
public class NewsEntity : BaseEntity
   {

      .
      .
      .      

      public virtual string Title
      {
         get
         {
            return title;
         }
         set { title = value; }
      }


      
      public  virtual PictureEntity Picture
      {
         get { return picture; }
         set { picture = value; }
      }


and the mapping of parent is
Code:
<id name="ID" column="Id">
      <generator class="identity" />
    </id>
   
    <property name="Title">
      <column name="Title" length="50" not-null="true" />
    </property>
   
    <property name="Description">
      <column name="Description" length="1000" not-null="false" />
    </property>

    <property name="UserID">
      <column name="UserID" sql-type = "int"  not-null="true" />
    </property>

    <property name="OrganizationID">
      <column name="OrganizationID" sql-type = "int" not-null="true" />
    </property>


   <many-to-one
            name="Picture"
            column="ImageID"
            not-null="false"/>

and the child is

Code:
   public class PictureEntity: BaseEntity
   {
      
      .
      .
      .
      .

      public virtual byte[] ThumbnailContent
      {
         get { return thumbnailContent; }
         set { thumbnailContent = value; }
      }

      public  virtual byte[] Content
      {
         get { return content; }
         set { content = value; }
      }

   }



Here is mapping of child


Code:
   <id name="ID" column="Id">
      <generator class="identity" />
    </id>
   
    <property name="FileSize">
      <column name="FileSize"  sql-type="bigint" not-null="true" />
    </property>
   
    <property name="FileName">
      <column name="FileName" length="50" not-null="true" />
    </property>
   
    <property name="FileType">
      <column name="FileType" length="50" not-null="true" />
    </property>
   
    <property name="ImageWidth">
      <column name="ImageWidth"  sql-type="int" not-null="false" />
    </property>
   
    <property name="ImageHeight">
      <column name="ImageHeight"  sql-type="int" not-null="false" />
    </property>
   
    <property name="ThumbnailWidth">
      <column name="ThumbnailWidth"  sql-type="int" not-null="false" />
    </property>
   
    <property name="ThumbnailHeight">
      <column name="ThumbnailHeight"  sql-type="int" not-null="false" />
    </property>

    <property name="ThumbnailContent"  type="BinaryBlob">
      <column name="ThumbnailValue" sql-type="IMAGE" not-null="true" />
    </property>
   
    <property name="Content" type="BinaryBlob">
      <column name="FileValue" sql-type="IMAGE" not-null="true" />
    </property>


Now , I don't want to fetch Content and ThumbnailContent when i use a collection of newsentity[The parent class] . but when i fetch one newsentity the child (picture class) load completely

Please tell me how can i do this ?
thanks a lot in advance.
Good luck


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 

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.