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

  • Home
  • SEARCH
  • 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 1050141
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T16:43:34+00:00 2026-05-16T16:43:34+00:00

In our SOA application we have several customers’ data in the same database and

  • 0

In our SOA application we have several customers’ data in the same database and in the same tables.

To control access, we have a column that describes this relationship. This column isn’t represented in the domain model, however. I know about query only properties – so, for querying – it is working perfectly.

However, how do I write to this column when saving new rows/entities?

Code:

public class Customer
{
    public virtual long Id{get;private set;}
    public virtual string AccountNumber{get;set;}
}

Mapping:

<class Name="Customer">
  <id name="Id">
    <generator class="native"/>
  </id>
  <property name="AccountNumber"/>
  <property name="Partition" access="noop" not-null="true"/>
</class>
  • 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-16T16:43:34+00:00Added an answer on May 16, 2026 at 4:43 pm

    I’m not sure to understand from where the value that should be inserted will come from if not set when creating entities (assuming they would provide the appropriate attribute of course) but…

    One option would be to use an IInterceptor to alter the SQL during OnPrepareStatement and add whatever you want in case of INSERT.

    using System;
    using System.Collections;
    using NHibernate.SqlCommand;
    using NHibernate.Type;
    
    namespace NHibernate
    {
        [Serializable]
        public class MyInterceptor : IInterceptor
        {
            ...
    
            public SqlString OnPrepareStatement(SqlString sql)
            {
                ///Do what is required here to alter the SQL string
                return sql;
            }
        }
    }
    

    And apply your interceptor either at the session level or globally.

    Reference

    • NHibernate Reference Guide
      • 9.10. Interceptors
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

We have a Data Access service in our SOA WCF system. This service is
We have a web application that uses SQL Server 2008 as the database. Our
Our application is a Java-GWT application that uses Guice-Persist and Guice-Servlet extensively. We have
We have our Data Access Layer setup to use repositories, services, and specifications (for
We have developed SOA architecure for our intranet application, so our web-start java applications
Our client follows SOA principles and have design web services that are very fine
This week, several of our .NET (C#) web applications have been thowing the error
I have a web application that I'm writing (C#, MSSQL) and I need to
I have a semi-large web application that we run locally and I need to
I have a Resource Handler that needs to access lower level beans that work

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.