-->
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.  [ 3 posts ] 
Author Message
 Post subject: Join Problem
PostPosted: Mon Apr 23, 2007 7:38 am 
Newbie

Joined: Mon Mar 12, 2007 5:34 am
Posts: 7
I have two tables: Customer and License. The tables are joined by the table Customer_License.

I have created a mapping for both the Customer and the License Class. The mappings are working fine.

I want to join both classes using the Customer License table.

The Customer Class:

Code:
    public class Customer
    {
        private int customerId;
        private string company;
        private List<Person> contactPerson;
        private License license;

        public int CustomerId
        {
            get { return customerId; }
            set { customerId = value; }
        }

        public string Company
        {
            get { return company; }
            set { company = value; }
        }

        public List<Person> ContactPerson
        {
            get
            {
                List<Person> contactPersonList = new List<Person>();

                foreach (Person untypedSetting in this.UntypedPerson)
                {
                    contactPersonList.Add(untypedSetting);
                }

                return contactPersonList;
            }
            set { contactPerson = value; }
        }

        public License License
        {
            get { return license; }
            set { license = value; }
        }

        #region nhibernate

        protected IList personUntyped = new ArrayList();

        /// <summary>
        /// Collection of all values including expired and future values.
        /// </summary>
        public IList<Person> UntypedPerson
        {
            get { return new ListWrapper<Person>(personUntyped); }
        }

        /// <summary>
        /// Untyped version of the Settings property for NHibernate compatibility
        /// </summary>
        private IList PersonUntyped
        {
            get { return personUntyped; }
            set { personUntyped = value; }
        }

        #endregion
    }


the Customor mapping file:

Code:
<?xml version="1.0" encoding="utf-8" ?>
<hibernate-mapping xmlns="urn:nhibernate-mapping-2.0" schema="prosys">
   <class name="Wervis.Send2SMS.Business.Customer, Wervis.Send2SMS.Business" table="GL_Customer">
      <id name="CustomerId" type="Int32" column="CustomerId">
         <generator class="identity" />
      </id>

      <join table="GL_Customer_license">
         <key column="CustomerId" unique="false" />
         <many-to-one name="License" column="LicenseId" not-null="true" unique="true" class="Wervis.Send2SMS.Business.License, Wervis.Send2SMS.Business" />
      </join>

      <property name="Company" column="Company" type="String" />
      
      <bag name="PersonUntyped" table="S2_Customer_Person">
         <key column="CustomerId"/>
         <many-to-many class="Wervis.Send2SMS.Business.Person, Wervis.Send2SMS.Business" column="PersonId"/>
      </bag>

   </class>
</hibernate-mapping>


When i test the mapping i get the following error:

Quote:
The element 'class' in namespace 'urn:nhibernate-mapping-2.0' has invalid child element 'join'


Does anybody now what i am doing wrong?


Top
 Profile  
 
 Post subject:
PostPosted: Fri Apr 27, 2007 5:54 pm 
Newbie

Joined: Thu Oct 26, 2006 4:02 pm
Posts: 12
I think the join element is only supported in the Java version and in the trunk. It didn't make it in to 1.2.


Top
 Profile  
 
 Post subject:
PostPosted: Sun Apr 29, 2007 10:00 am 
Newbie

Joined: Mon Jan 29, 2007 2:03 am
Posts: 11
Quote:
urn:nhibernate-mapping-2.0 -> urn:nhibernate-mapping-2.2

hi

NH1.0x uses 2.0 while NH1.2x uses 2.2, the Join syntax AFAIK didn't make it in the release 1.2, but is available only on the trunk..

hth


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 3 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.