Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 486033
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T01:27:44+00:00 2026-05-13T01:27:44+00:00

I have a method that will return a list of suggested orders. If the

  • 0

I have a method that will return a list of suggested orders. If the user passes a null that criteria is ignored.

public IList<SuggestedOrderItem> GetSuggestedOrderItemByCriteria
        (
            int? itemNumber,
            int? deptNumber            
        )
    {
        try
        {
            NHibernate.ICriteria criteria = NHibernateSession.CreateCriteria(typeof(Core.SuggestedOrderItem));

            if (itemNumber.HasValue)
                criteria.CreateCriteria("Item", "Item").Add(Expression.Eq("Item.ItemNumber", itemNumber.Value));

            if (deptNumber.HasValue)
                criteria.CreateCriteria("Item.Department", "Department").Add(Expression.Eq("Department.DepartmentNumber", deptNumber.Value));

            return criteria.List<Core.SuggestedOrderItem>();
        }
        catch (NHibernate.HibernateException he)
        {
            DataAccessException dae = new DataAccessException("NHibernate Exception", he);
            throw dae;                
        }

    }

If I provide a criteria, everything works fine. By fine I mean it retrieves the correct suggested orders and they all have different version numbers. If all the criteria are null it retrieves all suggested orders as it should, however the version numbers are all the same. Another developer is working on the UI and he’s calling the above method to populate a screen with all orders so the user can select one to modify. When I get his update request though I am refusing it as the version number does not match the actual version for the object. This is how the version column looks in the mapping file:

<version name="Version" type="Int64" generated="always" column="ORA_ROWSCN" access="property" unsaved-value="0"/>

Thank you very much for any assistance!

UPDATE:

I downloaded nhprof to see if the sql query being generated in each case was different. Regardless of if I pass no criteria or I do provide a criteria they are exactly the same except for a where clause. When I ran each of the queries in a db editor, I got the same results I was seeing from my service. Is this some kind of strange oracle issue? If I include a where clause I get different ora_rowscn numbers, otherwise they are all the same.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-13T01:27:44+00:00Added an answer on May 13, 2026 at 1:27 am

    It turns there is some kind of issue when using ANSI Sql (I am hitting an oracle 10g db). I added the following property to my app.config to try to get nhibernate to not use ANSI:

    <property name="use_outer_join">false</property>
    

    However, this did not help. I then added:

    <property name="max_fetch_depth">0</property>
    

    There are now more db hits, but the version numbers are coming back as expected.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a data structure that looks like this: public class Node { public
So I have a Blog object which has a list of tag objects (
We have built an internal tool that generates the whole data access, each table
I have set a test using Moq 3.0. I need to test a method
I have a list of words. Lets say they are 'Apple', 'Orange', and 'Pear'.
TL;DR: The question is: Do you know of a cross-platform library that I can
I am trying to use Scala to find the parameter to a function that
I have two entities: Location Post It's a 1.. * between Location and Post
This example illustrates a mystery I encountered in an application I am building. The
Given two IEnumerable s of the same size, how can I convert it to

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.