-->
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: ICriteria.ExcludeZeroes() does not work?
PostPosted: Thu Mar 16, 2006 12:54 pm 
Senior
Senior

Joined: Fri Jan 13, 2006 2:50 pm
Posts: 123
Location: Blumenau / SC / Brasil
Hi.

I'm using ExcludeZeroes() method from ICriteria and it's not working.

The mapping:

Code:
    ...
    <id name="Id" column="id" type="Int32">
         <generator class="assigned"/>
    </id>
    ...
    <property column="passwordformat" type="Int32" name="PasswordFormat" not-null="true" />
    ...


The code used to generate the QBE:

Code:
        public static IList ListByExample(object example)
        {
            ISession session = null;
            try
            {
                session = NHibernateHelper.OpenSession();
                ICriteria criteria = session.CreateCriteria(example.GetType());
                Example sample = Example.Create(example);
                sample.ExcludeZeroes();
                sample.ExcludeNulls();
                criteria.Add(sample);

                return criteria.List();
            }
            finally
            {
                NHibernateHelper.CloseSession(session);
            }           
        }


The SQL generated:

Code:
SELECT ... FROM nhuser this WHERE (this.passwordformat = 0 and ...)


The Int32 field is set = 0 on the constructor of the object. Using ExcludeZeroes() it still in the sql :(

Does ExcludeZeroes() not work? Should I use Nullable Types?

Thanks


Top
 Profile  
 
 Post subject:
PostPosted: Thu Mar 16, 2006 2:10 pm 
Senior
Senior

Joined: Fri Jan 13, 2006 2:50 pm
Posts: 123
Location: Blumenau / SC / Brasil
Hum, i'm sorry!

It's a NHibernate problem :)


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.