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 classesCode:
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.