-->
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: subclass without descriminator
PostPosted: Mon Nov 20, 2006 12:06 pm 
Newbie

Joined: Thu Jun 22, 2006 12:51 pm
Posts: 10
Need help with Hibernate? Read this first:
http://www.hibernate.org/ForumMailingli ... AskForHelp

1.0.1.0b]

[b]Mapping documents:


Code:
<?xml version="1.0" encoding="utf-8" ?>
<hibernate-mapping xmlns="urn:nhibernate-mapping-2.0">
   
   <class name="persist_entry, model" table="persist_storage">
        <id name="identifier" unsaved-value="-1" type="string" >       
            <generator class="assigned" />
        </id>       
        <property name="expire_date" />       
        <property name="data" />         
    </class>
   
    <class name="persist_entry_digest, model" table="persist_storage">
        <id name="identifier" unsaved-value="-1" type="string" >       
            <generator class="assigned" />
        </id>       
        <property name="expire_date" />               
    </class> 
</hibernate-mapping>


Code between sessionFactory.openSession() and session.close():
Code:
ICriteria criteria = session.CreateCriteria( typeof(persist_entry_digest) );
criteria.Add( Expression.Like( "identifier", "", MatchMode.Anywhere ) );
criteria.List();


Full stack trace of any exception that occurs:
-
Name and version of the database you are using:
Sql2005

The generated SQL (show_sql=true):
Code:
exec sp_executesql N'SELECT this.identifier as identifier0_, this.expire_date as expire_d2_0_, this.data as data0_ FROM persist_storage this WHERE this.identifier like
@p0',N'@p0 nvarchar(4000)',@p0=N'%%'

exec sp_executesql N'SELECT this.identifier as identifier0_, this.expire_date as expire_d2_0_ FROM persist_storage this WHERE this.identifier like @p0',N'@p0
nvarchar(4000)',@p0=N'%%'


Model classes
Code:
public class persist_entry:persist_entry_digest
    {
     
     
        public byte[] data;
   
   
    }
    public class persist_entry_digest
    {
       
        public string identifier;
        public nullable_datetime expire_date;
       
     
    }



I want load List of persist_entry_digest with above code.
But it load all entities twice. as persist_entry_digest and as persist_entry

i don't want use descriminator for this case. But sometimes i want load restricted version of persist_entry - without data - data is binary and can by huge.


Top
 Profile  
 
 Post subject:
PostPosted: Tue Nov 21, 2006 2:44 pm 
Newbie

Joined: Thu Jun 22, 2006 12:51 pm
Posts: 10
up


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.