'I'm getting error NHibernate.MappingException could it be a many-to-many relationship error
In .Net Core, I need to establish many-to-many relations and one-to-many relations with NHibernate xml mapping, but when I establish these relations, I get an error. When I searched, I could not find many sources. I have no idea where the problem originates from. I would appreciate if you could help me about this issue.
full explanation of the error I got: XmlSchemaValidationException: The element 'list' in namespace 'urn:nhibernate-mapping-2.2' cannot contain text. List of possible elements expected: 'meta, subselect, cache, synchronize, comment, key' in namespace 'urn:nhibernate-mapping-2.2'.
public class API_KEY: IEntities
{
public virtual int API_KEY_ID { get; set; }
public virtual string KEY { get; set; }
public virtual int USER_ID { get; set; }
public virtual int COMPANY_ID { get; set; }
public virtual string APP_URL { get; set; }
public virtual int STATUS { get; set; }
//Relational Properties
public virtual COMPANY COMPANY { get; set; }
public virtual API_KEYS_USER API_KEYS_USER { get; set; }
public virtual List<ROLE_API_KEY> ROLE_API_KEY { get; set; }
public virtual API_KEY_LOG API_KEY_LOG { get; set; }
}
<class name="API_KEY" table="API_KEY">
<id name="API_KEY_ID" column="API_KEY_ID">
<generator class="sequence">
<param name="sequence">SEQ_API_KEY_ID</param>
</generator>
</id>
<property name="KEY"/>
<property name="USER_ID" column="USER_ID"/>
<property name="COMPANY_ID" column="COMPANY_ID" />
<property name="APP_URL" />
<property name="STATUS" />
<list name="ROLE" table="ROLE_API_KEY" lazy="false">
<key column="ROLE_ID"/>
<many-to-many column="ROLE_ID" class="ROLE" />
</list>
<many-to-one name="API_KEYS_USER" class="API_KEYS_USER"
column="API_KEYS_USER_ID" not-null="true"/>
<many-to-one name="COMPANY" class="COMPANY"
column="COMPANY_ID" not-null="true"/>
</class>
</hibernate-mapping>
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
