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 6647691
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T00:34:02+00:00 2026-05-26T00:34:02+00:00

I have a c# .net 3.5 application using NHibernate and MySQL. My SQL tables

  • 0

I have a c# .net 3.5 application using NHibernate and MySQL.

My SQL tables are laid out in a many-to-many pattern linking configuration strings to tasks

CREATE TABLE `configstring` (
  `ConfigStringID` int(11) NOT NULL AUTO_INCREMENT,
  `ConfigString` varchar(45) NOT NULL,
  PRIMARY KEY (`ConfigStringID`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1

CREATE TABLE `task_configstring` (
  `ConfigStringID` int(11) NOT NULL,
  `TaskID` int(11) NOT NULL,
  PRIMARY KEY (`ConfigStringID`,`TaskID`),
  KEY `TaskID` (`TaskID`),
  KEY `ConfigStringID` (`ConfigStringID`),
  CONSTRAINT `ConfigStringID` FOREIGN KEY (`ConfigStringID`) REFERENCES `configstring` (`ConfigStringID`) ON DELETE NO ACTION ON UPDATE NO ACTION,
  CONSTRAINT `TaskID` FOREIGN KEY (`TaskID`) REFERENCES `task` (`TaskID`) ON DELETE NO ACTION ON UPDATE NO ACTION
) ENGINE=InnoDB DEFAULT CHARSET=latin1

CREATE TABLE `task` (
  `TaskID` int(11) NOT NULL AUTO_INCREMENT,
  PRIMARY KEY (`TaskID`)
) ENGINE=InnoDB AUTO_INCREMENT=19 DEFAULT CHARSET=latin1

I have a Task class that contains a list of configuration strings like this:

public class Task
{
    public virtual IList<string> ConfigurationStrings { get; set; }
}

The NHibernate XML mapping for this class to the database looks like this:

<?xml version="1.0" encoding="utf-8" ?>
<hibernate-mapping xmlns="urn:nhibernate-mapping-2.2"
                   assembly="QueueTest"
                   namespace="Phoenix.Action">

    <class name="Task" table="queue_task">
        <id name="Id" column="TaskID" type="int" >
            <generator class="native"/>
        </id>

        <bag name="ConfigurationStrings" table="queue_task_configstring">
            <key column="TaskID"/>

            <many-to-many column="ConfigStringID"/>

        </bag>
    </class>

</hibernate-mapping>

But, when I call Configuration().BuildSessionFactory(), I get this exception: An association from the table task_configstring does not specify the referenced entity

What’s the correct way to do a many-to-many mapping to a System.String object?

  • 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-26T00:34:02+00:00Added an answer on May 26, 2026 at 12:34 am

    Do you have a class for the ConfigString ?

    You’re missing the class name in the many-to-many mapping.

    Create a new ConfigString entity:

    class ConfigStringEntity
    {
       public virtual int ConfigStringID { get; set; }
    
       public virtual string ConfigString { get; set; }
    }
    
    <many-to-many class="ConfigStringEntity" column="ConfigStringID"/>
    

    Your list will then be a list of ConfigStringEntity.

    public class Task
    {
        public virtual IList<ConfigStringEntity> ConfigurationStrings { get; set; }
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a ASP.NET MVC application using NHibernate and the application runs fine when
I have an asp.net mvc2 application that is using StructureMap 2.6 and NHibernate 3.x.
I have a C#.NET desktop application using SQL Compact edition as data store. The
I have .NET 3.5 application wrote in C# using NHibernate. Before I has OracleClientDriver
I'm developing an application using asp.net mvc, NHibernate and DDD. I have a service
I'm using Spring.NET 1.3.2, NHibernate 3.1 and the OSIV pattern in a ASP.NET application.
We have a .Net application that initiates a transaction using NHibernate and modify data
I am using the repository pattern in nhibernate. In a asp.net mvc application. I
I have a ASP.NET MVC 3 application using NHibernate over a PostgreSQL database. There
I have an ASP.NET 4.0 application where I'm using NHibernate 3.0 with ODP.NET (newest

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.