From: <fab...@us...> - 2009-05-03 22:24:56
|
Revision: 4228 http://nhibernate.svn.sourceforge.net/nhibernate/?rev=4228&view=rev Author: fabiomaulo Date: 2009-05-03 22:24:46 +0000 (Sun, 03 May 2009) Log Message: ----------- Port of classes and mappings for AST tests (at least for BulkUpdates) Modified Paths: -------------- trunk/nhibernate/src/NHibernate.Test/HQL/Ast/Animal.hbm.xml trunk/nhibernate/src/NHibernate.Test/HQL/Ast/BulkManipulation.cs trunk/nhibernate/src/NHibernate.Test/HQL/Ast/EntityWithCrazyCompositeKey.hbm.xml trunk/nhibernate/src/NHibernate.Test/HQL/Ast/FooBarCopy.hbm.xml trunk/nhibernate/src/NHibernate.Test/HQL/Ast/KeyManyToOneEntity.hbm.xml trunk/nhibernate/src/NHibernate.Test/HQL/Ast/Multi.hbm.xml trunk/nhibernate/src/NHibernate.Test/HQL/Ast/SimpleEntityWithAssociation.hbm.xml trunk/nhibernate/src/NHibernate.Test/HQL/Ast/Vehicle.hbm.xml trunk/nhibernate/src/NHibernate.Test/HQL/Ast/Versions.hbm.xml trunk/nhibernate/src/NHibernate.Test/NHibernate.Test.csproj Added Paths: ----------- trunk/nhibernate/src/NHibernate.Test/HQL/Ast/Address.cs trunk/nhibernate/src/NHibernate.Test/HQL/Ast/Animal.cs trunk/nhibernate/src/NHibernate.Test/HQL/Ast/BooleanLiteralEntity.cs trunk/nhibernate/src/NHibernate.Test/HQL/Ast/Classification.cs trunk/nhibernate/src/NHibernate.Test/HQL/Ast/CrazyCompositeKey.cs trunk/nhibernate/src/NHibernate.Test/HQL/Ast/DomesticAnimal.cs trunk/nhibernate/src/NHibernate.Test/HQL/Ast/EntityWithCrazyCompositeKey.cs trunk/nhibernate/src/NHibernate.Test/HQL/Ast/Human.cs trunk/nhibernate/src/NHibernate.Test/HQL/Ast/IntegerVersioned.cs trunk/nhibernate/src/NHibernate.Test/HQL/Ast/Joiner.cs trunk/nhibernate/src/NHibernate.Test/HQL/Ast/KeyManyToOneEntity.cs trunk/nhibernate/src/NHibernate.Test/HQL/Ast/KeyManyToOneKeyEntity.cs trunk/nhibernate/src/NHibernate.Test/HQL/Ast/Mammal.cs trunk/nhibernate/src/NHibernate.Test/HQL/Ast/Name.cs trunk/nhibernate/src/NHibernate.Test/HQL/Ast/Reptile.cs trunk/nhibernate/src/NHibernate.Test/HQL/Ast/SimpleAssociatedEntity.cs trunk/nhibernate/src/NHibernate.Test/HQL/Ast/SimpleEntityWithAssociation.cs trunk/nhibernate/src/NHibernate.Test/HQL/Ast/StateProvince.cs trunk/nhibernate/src/NHibernate.Test/HQL/Ast/TimestampVersioned.cs trunk/nhibernate/src/NHibernate.Test/HQL/Ast/User.cs trunk/nhibernate/src/NHibernate.Test/HQL/Ast/Vehicles.cs trunk/nhibernate/src/NHibernate.Test/HQL/Ast/Zoo.cs Added: trunk/nhibernate/src/NHibernate.Test/HQL/Ast/Address.cs =================================================================== --- trunk/nhibernate/src/NHibernate.Test/HQL/Ast/Address.cs (rev 0) +++ trunk/nhibernate/src/NHibernate.Test/HQL/Ast/Address.cs 2009-05-03 22:24:46 UTC (rev 4228) @@ -0,0 +1,41 @@ +namespace NHibernate.Test.HQL.Ast +{ + public class Address + { + private string street; + private string city; + private string postalCode; + private string country; + private StateProvince stateProvince; + + public string Street + { + get { return street; } + set { street = value; } + } + + public string City + { + get { return city; } + set { city = value; } + } + + public string PostalCode + { + get { return postalCode; } + set { postalCode = value; } + } + + public string Country + { + get { return country; } + set { country = value; } + } + + public StateProvince StateProvince + { + get { return stateProvince; } + set { stateProvince = value; } + } + } +} \ No newline at end of file Added: trunk/nhibernate/src/NHibernate.Test/HQL/Ast/Animal.cs =================================================================== --- trunk/nhibernate/src/NHibernate.Test/HQL/Ast/Animal.cs (rev 0) +++ trunk/nhibernate/src/NHibernate.Test/HQL/Ast/Animal.cs 2009-05-03 22:24:46 UTC (rev 4228) @@ -0,0 +1,64 @@ +using Iesi.Collections; + +namespace NHibernate.Test.HQL.Ast +{ + public class Animal + { + private long id; + private float bodyWeight; + private ISet offspring; + private Animal mother; + private Animal father; + private string description; + private Zoo zoo; + private string serialNumber; + + public virtual long Id + { + get { return id; } + set { id = value; } + } + + public virtual float BodyWeight + { + get { return bodyWeight; } + set { bodyWeight = value; } + } + + public virtual ISet Offspring + { + get { return offspring; } + set { offspring = value; } + } + + public virtual Animal Mother + { + get { return mother; } + set { mother = value; } + } + + public virtual Animal Father + { + get { return father; } + set { father = value; } + } + + public virtual string Description + { + get { return description; } + set { description = value; } + } + + public virtual Zoo Zoo + { + get { return zoo; } + set { zoo = value; } + } + + public virtual string SerialNumber + { + get { return serialNumber; } + set { serialNumber = value; } + } + } +} \ No newline at end of file Modified: trunk/nhibernate/src/NHibernate.Test/HQL/Ast/Animal.hbm.xml =================================================================== --- trunk/nhibernate/src/NHibernate.Test/HQL/Ast/Animal.hbm.xml 2009-05-03 13:43:03 UTC (rev 4227) +++ trunk/nhibernate/src/NHibernate.Test/HQL/Ast/Animal.hbm.xml 2009-05-03 22:24:46 UTC (rev 4228) @@ -3,148 +3,148 @@ assembly="NHibernate.Test" namespace="NHibernate.Test.HQL.Ast" default-access="field"> - - <class name="Animal"> - <id name="id"> - <generator class="native"/> - </id> - <property name="description"/> - <property name="bodyWeight" column="body_weight"/> - <many-to-one name="mother" column="mother_id"/> - <many-to-one name="father" column="father_id"/> - <many-to-one name="zoo" column="zoo_id"/> - <property name="serialNumber"/> - <set name="offspring" order-by="father_id"> - <key column="mother_id"/> - <one-to-many class="Animal"/> - </set> - <joined-subclass name="Reptile"> - <key column="animal"/> - <property name="bodyTemperature"/> - <joined-subclass name="Lizard"> - <key column="reptile"/> - </joined-subclass> - </joined-subclass> - <joined-subclass name="Mammal"> - <key column="animal"/> - <property name="pregnant"/> - <property name="birthdate" type="date"/> - <joined-subclass name="DomesticAnimal"> - <key column="mammal"/> - <many-to-one name="owner"/> - <joined-subclass name="Cat"> - <key column="mammal"/> - </joined-subclass> - <joined-subclass name="Dog"> - <key column="mammal"/> - </joined-subclass> - </joined-subclass> - <joined-subclass name="Human"> - <key column="mammal"/> - <component name="name"> - <property name="first" column="name_first"/> - <property name="initial" column="name_initial"/> - <property name="last" column="name_last"/> - </component> - <property name="nickName"/> - <property name="height"/> - - <property name="intValue"/> - <property name="floatValue"/> - <property name="bigDecimalValue"/> - <property name="bigIntegerValue"/> - - <bag name="friends"> - <key column="human1"/> - <many-to-many column="human2" class="Human"/> - </bag> - <map name="family"> - <key column="human1"/> - <map-key column="relationship" type="string"/> - <many-to-many column="human2" class="Human"/> - </map> - <bag name="pets" inverse="true"> - <key column="owner"/> - <one-to-many class="DomesticAnimal"/> - </bag> - <set name="nickNames" lazy="false" table="human_nick_names" sort="natural"> - <key column="human"/> - <element column="nick_name" type="string" not-null="true"/> - </set> - <map name="addresses" table="addresses"> - <key column="human"/> - <map-key type="string" column="type"/> - <composite-element class="Address"> - <property name="street"/> - <property name="city"/> - <property name="postalCode"/> - <property name="country"/> - <many-to-one name="stateProvince" column="state_prov_id" class="StateProvince"/> - </composite-element> - </map> - </joined-subclass> - </joined-subclass> - </class> - - <class name="User" table="`User`"> - <id name="id"> - <generator class="foreign"> - <param name="property">human</param> - </generator> - </id> - <property name="userName"/> - <one-to-one name="human" constrained="true"/> - <list name="permissions"> - <key column="userId"/> - <list-index column="permissionId"/> - <element type="string" column="permissionName"/> - </list> - </class> - - <class name="Zoo" discriminator-value="Z"> - <id name="id"> - <generator class="native"/> - </id> - <discriminator column="zooType" type="character"/> - <property name="name" type="string"/> - <property name="classification" type="org.hibernate.test.hql.ClassificationType"/> - <map name="mammals"> - <key column="mammalZoo_id"/> - <index type="string" column="name"/> - <one-to-many class="Mammal"/> - </map> - <map name="animals" inverse="true"> - <key column="zoo_id"/> - <index type="string" column="serialNumber"/> - <one-to-many class="Animal"/> - </map> - <component name="address" class="Address"> - <property name="street"/> - <property name="city"/> - <property name="postalCode"/> - <property name="country"/> - <many-to-one name="stateProvince" column="state_prov_id" class="StateProvince"/> - </component> - <subclass name="PettingZoo" discriminator-value="P"/> - </class> - - <class name="StateProvince"> - <id name="id"> - <generator class="native"/> - </id> - <property name="name"/> - <property name="isoCode"/> - </class> - - <class name="Joiner"> - <id name="id"> - <generator class="native"/> - </id> - <property name="name"/> - <join table="JOINED"> - <key column="ID"/> - <property name="joinedName"/> - </join> - </class> - + + <class name="Animal"> + <id name="id"> + <generator class="native"/> + </id> + <property name="description"/> + <property name="bodyWeight" column="body_weight"/> + <many-to-one name="mother" column="mother_id"/> + <many-to-one name="father" column="father_id"/> + <many-to-one name="zoo" column="zoo_id"/> + <property name="serialNumber"/> + <set name="offspring" order-by="father_id"> + <key column="mother_id"/> + <one-to-many class="Animal"/> + </set> + <joined-subclass name="Reptile"> + <key column="animal"/> + <property name="bodyTemperature"/> + <joined-subclass name="Lizard"> + <key column="reptile"/> + </joined-subclass> + </joined-subclass> + <joined-subclass name="Mammal"> + <key column="animal"/> + <property name="pregnant"/> + <property name="birthdate" type="date"/> + <joined-subclass name="DomesticAnimal"> + <key column="mammal"/> + <many-to-one name="owner"/> + <joined-subclass name="Cat"> + <key column="mammal"/> + </joined-subclass> + <joined-subclass name="Dog"> + <key column="mammal"/> + </joined-subclass> + </joined-subclass> + <joined-subclass name="Human"> + <key column="mammal"/> + <component name="name"> + <property name="first" column="name_first"/> + <property name="initial" column="name_initial"/> + <property name="last" column="name_last"/> + </component> + <property name="nickName"/> + <property name="height"/> + + <property name="intValue"/> + <property name="floatValue"/> + <property name="bigDecimalValue"/> + <property name="bigIntegerValue"/> + + <bag name="friends"> + <key column="human1"/> + <many-to-many column="human2" class="Human"/> + </bag> + <map name="family"> + <key column="human1"/> + <map-key column="relationship" type="string"/> + <many-to-many column="human2" class="Human"/> + </map> + <bag name="pets" inverse="true"> + <key column="owner"/> + <one-to-many class="DomesticAnimal"/> + </bag> + <set name="nickNames" lazy="false" table="human_nick_names" sort="natural"> + <key column="human"/> + <element column="nick_name" type="string" not-null="true"/> + </set> + <map name="addresses" table="addresses"> + <key column="human"/> + <map-key type="string" column="type"/> + <composite-element class="Address"> + <property name="street"/> + <property name="city"/> + <property name="postalCode"/> + <property name="country"/> + <many-to-one name="stateProvince" column="state_prov_id" class="StateProvince"/> + </composite-element> + </map> + </joined-subclass> + </joined-subclass> + </class> + + <class name="User" table="`User`"> + <id name="id"> + <generator class="foreign"> + <param name="property">human</param> + </generator> + </id> + <property name="userName"/> + <one-to-one name="human" constrained="true"/> + <list name="permissions"> + <key column="userId"/> + <list-index column="permissionId"/> + <element type="string" column="permissionName"/> + </list> + </class> + + <class name="Zoo" discriminator-value="Z"> + <id name="id"> + <generator class="native"/> + </id> + <discriminator column="zooType" type="character"/> + <property name="name" type="string"/> + <property name="classification"/> + <map name="mammals"> + <key column="mammalZoo_id"/> + <index type="string" column="name"/> + <one-to-many class="Mammal"/> + </map> + <map name="animals" inverse="true"> + <key column="zoo_id"/> + <index type="string" column="serialNumber"/> + <one-to-many class="Animal"/> + </map> + <component name="address" class="Address"> + <property name="street"/> + <property name="city"/> + <property name="postalCode"/> + <property name="country"/> + <many-to-one name="stateProvince" column="state_prov_id" class="StateProvince"/> + </component> + <subclass name="PettingZoo" discriminator-value="P"/> + </class> + + <class name="StateProvince"> + <id name="id"> + <generator class="native"/> + </id> + <property name="name"/> + <property name="isoCode"/> + </class> + + <class name="Joiner"> + <id name="id"> + <generator class="native"/> + </id> + <property name="name"/> + <join table="JOINED"> + <key column="ID"/> + <property name="joinedName"/> + </join> + </class> + </hibernate-mapping> \ No newline at end of file Added: trunk/nhibernate/src/NHibernate.Test/HQL/Ast/BooleanLiteralEntity.cs =================================================================== --- trunk/nhibernate/src/NHibernate.Test/HQL/Ast/BooleanLiteralEntity.cs (rev 0) +++ trunk/nhibernate/src/NHibernate.Test/HQL/Ast/BooleanLiteralEntity.cs 2009-05-03 22:24:46 UTC (rev 4228) @@ -0,0 +1,10 @@ +namespace NHibernate.Test.HQL.Ast +{ + public class BooleanLiteralEntity + { + public virtual long Id { get; set; } + public virtual bool YesNoBoolean { get; set; } + public virtual bool TrueFalseBoolean { get; set; } + public virtual bool ZeroOneBoolean { get; set; } + } +} \ No newline at end of file Modified: trunk/nhibernate/src/NHibernate.Test/HQL/Ast/BulkManipulation.cs =================================================================== --- trunk/nhibernate/src/NHibernate.Test/HQL/Ast/BulkManipulation.cs 2009-05-03 13:43:03 UTC (rev 4227) +++ trunk/nhibernate/src/NHibernate.Test/HQL/Ast/BulkManipulation.cs 2009-05-03 22:24:46 UTC (rev 4228) @@ -1,15 +1,31 @@ +using NUnit.Framework; +using NHibernate.Hql.Ast.ANTLR; + namespace NHibernate.Test.HQL.Ast { + [TestFixture] public class BulkManipulation: BaseFixture { - // "hql/Animal.hbm.xml", - // "hql/Vehicle.hbm.xml", - // "hql/KeyManyToOneEntity.hbm.xml", - // "hql/Versions.hbm.xml", - //"hql/FooBarCopy.hbm.xml", - //"legacy/Multi.hbm.xml", - //"hql/EntityWithCrazyCompositeKey.hbm.xml", - //"hql/SimpleEntityWithAssociation.hbm.xml", - //"hql/BooleanLiteralEntity.hbm.xml" + #region Non-exists + + [Test] + public void DeleteNonExistentEntity() + { + using (ISession s = OpenSession()) + { + Assert.Throws<QuerySyntaxException>(() => s.CreateQuery("delete NonExistentEntity").ExecuteUpdate()); + } + } + + [Test] + public void UpdateNonExistentEntity() + { + using (ISession s = OpenSession()) + { + Assert.Throws<QuerySyntaxException>(() => s.CreateQuery("update NonExistentEntity e set e.someProp = ?").ExecuteUpdate()); + } + } + + #endregion } } \ No newline at end of file Added: trunk/nhibernate/src/NHibernate.Test/HQL/Ast/Classification.cs =================================================================== --- trunk/nhibernate/src/NHibernate.Test/HQL/Ast/Classification.cs (rev 0) +++ trunk/nhibernate/src/NHibernate.Test/HQL/Ast/Classification.cs 2009-05-03 22:24:46 UTC (rev 4228) @@ -0,0 +1,8 @@ +namespace NHibernate.Test.HQL.Ast +{ + public enum Classification + { + Cool = 0, + Lame = 1 + } +} \ No newline at end of file Added: trunk/nhibernate/src/NHibernate.Test/HQL/Ast/CrazyCompositeKey.cs =================================================================== --- trunk/nhibernate/src/NHibernate.Test/HQL/Ast/CrazyCompositeKey.cs (rev 0) +++ trunk/nhibernate/src/NHibernate.Test/HQL/Ast/CrazyCompositeKey.cs 2009-05-03 22:24:46 UTC (rev 4228) @@ -0,0 +1,51 @@ +namespace NHibernate.Test.HQL.Ast +{ + public class CrazyCompositeKey + { + private long id; + private long otherId; + private int? requestedHash; + + public virtual long Id + { + get { return id; } + set { id = value; } + } + + public virtual long OtherId + { + get { return otherId; } + set { otherId = value; } + } + + public override bool Equals(object obj) + { + return Equals(obj as CrazyCompositeKey); + } + + public virtual bool Equals(CrazyCompositeKey other) + { + if (ReferenceEquals(null, other)) + { + return false; + } + if (ReferenceEquals(this, other)) + { + return true; + } + return other.id == id && other.otherId == otherId; + } + + public override int GetHashCode() + { + if (!requestedHash.HasValue) + { + unchecked + { + requestedHash = (id.GetHashCode() * 397) ^ otherId.GetHashCode(); + } + } + return requestedHash.Value; + } + } +} \ No newline at end of file Added: trunk/nhibernate/src/NHibernate.Test/HQL/Ast/DomesticAnimal.cs =================================================================== --- trunk/nhibernate/src/NHibernate.Test/HQL/Ast/DomesticAnimal.cs (rev 0) +++ trunk/nhibernate/src/NHibernate.Test/HQL/Ast/DomesticAnimal.cs 2009-05-03 22:24:46 UTC (rev 4228) @@ -0,0 +1,16 @@ +namespace NHibernate.Test.HQL.Ast +{ + public class DomesticAnimal: Mammal + { + private Human owner; + + public virtual Human Owner + { + get { return owner; } + set { owner = value; } + } + } + + public class Cat : DomesticAnimal { } + public class Dog : DomesticAnimal { } +} \ No newline at end of file Added: trunk/nhibernate/src/NHibernate.Test/HQL/Ast/EntityWithCrazyCompositeKey.cs =================================================================== --- trunk/nhibernate/src/NHibernate.Test/HQL/Ast/EntityWithCrazyCompositeKey.cs (rev 0) +++ trunk/nhibernate/src/NHibernate.Test/HQL/Ast/EntityWithCrazyCompositeKey.cs 2009-05-03 22:24:46 UTC (rev 4228) @@ -0,0 +1,20 @@ +namespace NHibernate.Test.HQL.Ast +{ + public class EntityWithCrazyCompositeKey + { + private CrazyCompositeKey id; + private string name; + + public virtual CrazyCompositeKey Id + { + get { return id; } + set { id = value; } + } + + public virtual string Name + { + get { return name; } + set { name = value; } + } + } +} \ No newline at end of file Modified: trunk/nhibernate/src/NHibernate.Test/HQL/Ast/EntityWithCrazyCompositeKey.hbm.xml =================================================================== --- trunk/nhibernate/src/NHibernate.Test/HQL/Ast/EntityWithCrazyCompositeKey.hbm.xml 2009-05-03 13:43:03 UTC (rev 4227) +++ trunk/nhibernate/src/NHibernate.Test/HQL/Ast/EntityWithCrazyCompositeKey.hbm.xml 2009-05-03 22:24:46 UTC (rev 4228) @@ -3,12 +3,12 @@ assembly="NHibernate.Test" namespace="NHibernate.Test.HQL.Ast"> - <class name="EntityWithCrazyCompositeKey"> - <composite-id name="Id" class="CrazyCompositeKey"> - <key-property name="Id" column="id"/> - <key-property name="OtherId" column="other_id"/> - </composite-id> - <property name="Name"/> - </class> - + <class name="EntityWithCrazyCompositeKey"> + <composite-id name="Id" class="CrazyCompositeKey"> + <key-property name="Id" column="id"/> + <key-property name="OtherId" column="other_id"/> + </composite-id> + <property name="Name"/> + </class> + </hibernate-mapping> \ No newline at end of file Modified: trunk/nhibernate/src/NHibernate.Test/HQL/Ast/FooBarCopy.hbm.xml =================================================================== --- trunk/nhibernate/src/NHibernate.Test/HQL/Ast/FooBarCopy.hbm.xml 2009-05-03 13:43:03 UTC (rev 4227) +++ trunk/nhibernate/src/NHibernate.Test/HQL/Ast/FooBarCopy.hbm.xml 2009-05-03 22:24:46 UTC (rev 4228) @@ -1,137 +1,140 @@ <?xml version="1.0" encoding="utf-8" ?> <hibernate-mapping xmlns="urn:nhibernate-mapping-2.2" - assembly="NHibernate.Test" - namespace="NHibernate.Test.HQL.Ast" - default-lazy="false"> - - <!-- a slightly modified copy of FooBar.hbm.xml from the legacy test package --> - - <class - name="Foo" - table="`foos`" - proxy="FooProxy" - discriminator-value="F" - batch-size="4" - dynamic-insert="true" - dynamic-update="true" - select-before-update="true"> - - <id name="key" type="string"> - <column name="`foo_idcolumnname123`" length="36"/> - <generator class="uuid.hex"> - <param name="seperator">:</param> - </generator> - </id> - - <discriminator column="`foo_subclass_1234`" type="character" force="true"/> - <version name="version"/> - - <many-to-one name="foo" class="Foo"> - <column name="foo" length="36" index="fbmtoidx"/> - </many-to-one> - - <property name="long"> - <column name="long_" index="fbmtoidx" unique-key="abc" not-null="true"/> - </property> - <property name="integer"> - <column name="`integer__`" unique-key="abc" not-null="true"/> - </property> - <property name="float"> - <column name="float_" unique-key="abc" not-null="true" check="float_ > 0.0"/> - </property> - <property name="x"/> - <property name="double" column="double_"/> - - <primitive-array name="bytes" table="foobytes"> - <key column="id"/> - <index column="i"/> - <element column="byte_" type="byte"/> - </primitive-array> - - <property name="date" type="date" column="date_"/> - <property name="timestamp" type="timestamp" column="timestamp_"/> - <property name="boolean" column="boolean_"/> - <property name="bool" column="bool_"/> - <property name="null" column="null_"/> - <property name="short" column="short_"/> - <property name="char" column="char_"/> - <property name="zero" column="zero_"/> - <property name="int" column="int_"/> - <property name="string"> - <column name="string_" length="48" index="fbstridx"/> - </property> - <property name="byte" column="byte_"/> - <property name="yesno" type="yes_no"/> - <property name="blob" type="org.hibernate.test.legacy.Foo$Struct" column="blobb_"/> - <property name="nullBlob" type="serializable"/> - <property name="binary" column="bin_"/> - <property name="theLocale" access="field" column="`localeayzabc123`"/> - - <property name="formula" formula="int_/2"/> - - <property name="custom" type="org.hibernate.test.legacy.DoubleStringType" access="field"> - <column name="first_name" length="66"/> - <column name="surname" length="66"/> - </property> - <component name="nullComponent"> - <property name="name" column="null_cmpnt_"/> - </component> - - <join table="jointable"> - <key column="fooid" on-delete="cascade"/> - <property name="joinedProp"/> - </join> - - <subclass - name="Trivial" - proxy="FooProxy" - discriminator-value="T"/> - - <subclass - name="Abstract" - proxy="AbstractProxy" - discriminator-value="null"> - <set name="abstracts" batch-size="2"> - <key column="abstract_id"/> - <one-to-many class="Abstract"/> - </set> - <property name="time" column="the_time"/> - - <subclass - name="Bar" - proxy="BarProxy" - discriminator-value="B"> - <property name="barString"> - <column name="bar_string" length="24"/> - </property> - <any name="object" meta-type="character" id-type="long" cascade="all"> - <meta-value value="O" class="One"/> - <meta-value value="M" class="Many"/> - <column name="clazz" length="100"/> - <column name="gen_id"/> - </any> - <join table="bar_join_table"> - <key column="bar_id"/> - <property name="name" column="name_name"/> - </join> - </subclass> - </subclass> - </class> - - <class name="One" table="one"> - <id name="key" column="one_key"> - <generator class="native" /> - </id> - <property name="x"/> - <property column="one_value" name="value"/> - </class> - - <class name="Many" table="many"> - <id name="key" column="many_key"> - <generator class="native" /> - </id> - <property name="x"/> - </class> - -</hibernate-mapping> - + assembly="NHibernate.DomainModel" + namespace="NHibernate.DomainModel" + default-lazy="false"> + + <!-- a slightly modified copy of FooBar.hbm.xml from the legacy test package --> + + <class + name="Foo" + table="`foos`" + proxy="FooProxy" + discriminator-value="F" + batch-size="4" + dynamic-insert="true" + dynamic-update="true" + select-before-update="true"> + + <id name="key" type="string"> + <column name="`foo_idcolumnname123`" length="36"/> + <generator class="uuid.hex"> + <param name="seperator">:</param> + </generator> + </id> + + <discriminator column="`foo_subclass_1234`" type="character" force="true"/> + <version name="version"/> + + <many-to-one name="foo" class="Foo"> + <column name="foo" length="36" index="fbmtoidx"/> + </many-to-one> + + <property name="Long"> + <column name="long_" index="fbmtoidx" unique-key="abc" not-null="true"/> + </property> + <property name="Integer"> + <column name="`integer__`" unique-key="abc" not-null="true"/> + </property> + <property name="Float"> + <column name="float_" unique-key="abc" not-null="true" check="float_ > 0.0"/> + </property> + <property name="x"/> + <property name="Double" column="double_"/> + + <primitive-array name="bytes" table="foobytes"> + <key column="id"/> + <index column="i"/> + <element column="byte_" type="byte"/> + </primitive-array> + + <property name="Date" type="date" column="date_"/> + <property name="Timestamp" type="timestamp" column="timestamp_"/> + <property name="Boolean" column="boolean_"/> + <property name="Bool" column="bool_"/> + <property name="Null" column="null_"/> + <property name="Short" column="short_"/> + <property name="Char" column="char_"/> + <property name="Zero" column="zero_"/> + <property name="Int" column="int_"/> + <property name="String"> + <column name="string_" length="48" index="fbstridx"/> + </property> + <property name="Byte" column="byte_"/> + <property name="YesNo" type="yes_no"/> + <!-- + <property name="blob" type="org.hibernate.test.legacy.Foo$Struct" column="blobb_"/> + <property name="nullBlob" type="serializable"/> + <property name="binary" column="bin_"/> + --> + <property name="Locale" column="`localeayzabc123`" access="field.camelcase-underscore" type="locale"/> + + <property name="formula" formula="int_*2"/> + + <property name="Custom" type="NHibernate.DomainModel.DoubleStringType, NHibernate.DomainModel" access="field.camelcase"> + <column name="first_name" length="66"/> + <column name="surname" length="66"/> + </property> + + <component name="nullComponent"> + <property name="name" column="null_cmpnt_"/> + </component> + + <join table="jointable"> + <key column="fooid" on-delete="cascade"/> + <property name="joinedProp"/> + </join> + + <subclass + name="Trivial" + proxy="FooProxy" + discriminator-value="T"/> + + <subclass + name="Abstract" + proxy="AbstractProxy" + discriminator-value="null"> + <set name="abstracts" batch-size="2"> + <key column="abstract_id"/> + <one-to-many class="Abstract"/> + </set> + <property name="time" column="the_time"/> + + <subclass + name="Bar" + proxy="BarProxy" + discriminator-value="B"> + <property name="barString"> + <column name="bar_string" length="24"/> + </property> + <any name="object" meta-type="character" id-type="long" cascade="all"> + <meta-value value="O" class="One"/> + <meta-value value="M" class="Many"/> + <column name="clazz" length="100"/> + <column name="gen_id"/> + </any> + <join table="bar_join_table"> + <key column="bar_id"/> + <property name="name" column="name_name"/> + </join> + </subclass> + </subclass> + </class> + + <class name="One" table="one"> + <id name="key" column="one_key"> + <generator class="native" /> + </id> + <property name="x"/> + <property column="one_value" name="value"/> + </class> + + <class name="Many" table="many"> + <id name="key" column="many_key"> + <generator class="native" /> + </id> + <property name="x"/> + </class> + +</hibernate-mapping> + Added: trunk/nhibernate/src/NHibernate.Test/HQL/Ast/Human.cs =================================================================== --- trunk/nhibernate/src/NHibernate.Test/HQL/Ast/Human.cs (rev 0) +++ trunk/nhibernate/src/NHibernate.Test/HQL/Ast/Human.cs 2009-05-03 22:24:46 UTC (rev 4228) @@ -0,0 +1,95 @@ +using System.Collections; +using Iesi.Collections; + +namespace NHibernate.Test.HQL.Ast +{ + public class Human: Mammal + { + private Name name; + private string nickName; + private ICollection friends; + private ICollection pets; + private IDictionary family; + private double height; + + private long bigIntegerValue; + private decimal bigDecimalValue; + private int intValue; + private float floatValue; + + private ISet nickNames; + private IDictionary addresses; + + public virtual Name Name + { + get { return name; } + set { name = value; } + } + + public virtual string NickName + { + get { return nickName; } + set { nickName = value; } + } + + public virtual ICollection Friends + { + get { return friends; } + set { friends = value; } + } + + public virtual ICollection Pets + { + get { return pets; } + set { pets = value; } + } + + public virtual IDictionary Family + { + get { return family; } + set { family = value; } + } + + public virtual double Height + { + get { return height; } + set { height = value; } + } + + public virtual long BigIntegerValue + { + get { return bigIntegerValue; } + set { bigIntegerValue = value; } + } + + public virtual decimal BigDecimalValue + { + get { return bigDecimalValue; } + set { bigDecimalValue = value; } + } + + public virtual int IntValue + { + get { return intValue; } + set { intValue = value; } + } + + public virtual float FloatValue + { + get { return floatValue; } + set { floatValue = value; } + } + + public virtual ISet NickNames + { + get { return nickNames; } + set { nickNames = value; } + } + + public virtual IDictionary Addresses + { + get { return addresses; } + set { addresses = value; } + } + } +} \ No newline at end of file Added: trunk/nhibernate/src/NHibernate.Test/HQL/Ast/IntegerVersioned.cs =================================================================== --- trunk/nhibernate/src/NHibernate.Test/HQL/Ast/IntegerVersioned.cs (rev 0) +++ trunk/nhibernate/src/NHibernate.Test/HQL/Ast/IntegerVersioned.cs 2009-05-03 22:24:46 UTC (rev 4228) @@ -0,0 +1,27 @@ +namespace NHibernate.Test.HQL.Ast +{ + public class IntegerVersioned + { + private long id; + private int version; + private string name; + + public virtual long Id + { + get { return id; } + set { id = value; } + } + + public virtual int Version + { + get { return version; } + set { version = value; } + } + + public virtual string Name + { + get { return name; } + set { name = value; } + } + } +} \ No newline at end of file Added: trunk/nhibernate/src/NHibernate.Test/HQL/Ast/Joiner.cs =================================================================== --- trunk/nhibernate/src/NHibernate.Test/HQL/Ast/Joiner.cs (rev 0) +++ trunk/nhibernate/src/NHibernate.Test/HQL/Ast/Joiner.cs 2009-05-03 22:24:46 UTC (rev 4228) @@ -0,0 +1,27 @@ +namespace NHibernate.Test.HQL.Ast +{ + public class Joiner + { + private long id; + private string name; + private string joinedName; + + public virtual long Id + { + get { return id; } + set { id = value; } + } + + public virtual string Name + { + get { return name; } + set { name = value; } + } + + public virtual string JoinedName + { + get { return joinedName; } + set { joinedName = value; } + } + } +} \ No newline at end of file Added: trunk/nhibernate/src/NHibernate.Test/HQL/Ast/KeyManyToOneEntity.cs =================================================================== --- trunk/nhibernate/src/NHibernate.Test/HQL/Ast/KeyManyToOneEntity.cs (rev 0) +++ trunk/nhibernate/src/NHibernate.Test/HQL/Ast/KeyManyToOneEntity.cs 2009-05-03 22:24:46 UTC (rev 4228) @@ -0,0 +1,83 @@ +using System; + +namespace NHibernate.Test.HQL.Ast +{ + public class KeyManyToOneEntity + { + private Id id; + private string name; + + public virtual string Name + { + get { return name; } + set { name = value; } + } + + public class Id + { + private KeyManyToOneKeyEntity key1; + private string key2; + private int? requestedHash; + + protected Id() {} + + public Id(KeyManyToOneKeyEntity key1, string key2) + { + if (key1 == null) + { + throw new ArgumentNullException("key1"); + } + if (key2 == null) + { + throw new ArgumentNullException("key2"); + } + + this.key1 = key1; + this.key2 = key2; + + } + + public virtual KeyManyToOneKeyEntity Key1 + { + get { return key1; } + set { key1 = value; } + } + + public virtual string Key2 + { + get { return key2; } + set { key2 = value; } + } + + public override bool Equals(object obj) + { + return Equals(obj as Id); + } + + public bool Equals(Id other) + { + if (ReferenceEquals(null, other)) + { + return false; + } + if (ReferenceEquals(this, other)) + { + return true; + } + return Equals(other.key1, key1) && Equals(other.key2, key2); + } + + public override int GetHashCode() + { + if (!requestedHash.HasValue) + { + unchecked + { + requestedHash = ((key1 != null ? key1.GetHashCode() : 0) * 397) ^ (key2 != null ? key2.GetHashCode() : 0); + } + } + return requestedHash.Value; + } + } + } +} \ No newline at end of file Modified: trunk/nhibernate/src/NHibernate.Test/HQL/Ast/KeyManyToOneEntity.hbm.xml =================================================================== --- trunk/nhibernate/src/NHibernate.Test/HQL/Ast/KeyManyToOneEntity.hbm.xml 2009-05-03 13:43:03 UTC (rev 4227) +++ trunk/nhibernate/src/NHibernate.Test/HQL/Ast/KeyManyToOneEntity.hbm.xml 2009-05-03 22:24:46 UTC (rev 4228) @@ -3,19 +3,19 @@ assembly="NHibernate.Test" namespace="NHibernate.Test.HQL.Ast"> - <class name="KeyManyToOneKeyEntity"> - <id name="id" type="long" access="field" > - <generator class="native"/> - </id> - <property name="Name" type="string"/> - </class> - - <class name="KeyManyToOneEntity"> - <composite-id name="id" access="field" class="KeyManyToOneEntity$Id" unsaved-value="undefined" > - <key-many-to-one name="key1" class="KeyManyToOneKeyEntity" /> - <key-property name="key2" type="string"/> - </composite-id> - <property name="Name" type="string"/> - </class> - + <class name="KeyManyToOneKeyEntity"> + <id name="id" type="long" access="field" > + <generator class="native"/> + </id> + <property name="Name" type="string"/> + </class> + + <class name="KeyManyToOneEntity"> + <composite-id name="id" access="field" class="KeyManyToOneEntity+Id" unsaved-value="undefined" > + <key-many-to-one name="Key1" class="KeyManyToOneKeyEntity" /> + <key-property name="Key2" type="string"/> + </composite-id> + <property name="Name" type="string"/> + </class> + </hibernate-mapping> \ No newline at end of file Added: trunk/nhibernate/src/NHibernate.Test/HQL/Ast/KeyManyToOneKeyEntity.cs =================================================================== --- trunk/nhibernate/src/NHibernate.Test/HQL/Ast/KeyManyToOneKeyEntity.cs (rev 0) +++ trunk/nhibernate/src/NHibernate.Test/HQL/Ast/KeyManyToOneKeyEntity.cs 2009-05-03 22:24:46 UTC (rev 4228) @@ -0,0 +1,52 @@ +namespace NHibernate.Test.HQL.Ast +{ + public class KeyManyToOneKeyEntity + { + private long id; + private string name; + private int? requestedHash; + + protected KeyManyToOneKeyEntity() {} + + public KeyManyToOneKeyEntity(string name) + { + this.name = name; + } + + public virtual string Name + { + get { return name; } + set { name = value; } + } + + public override bool Equals(object obj) + { + return Equals(obj as KeyManyToOneKeyEntity); + } + + public virtual bool Equals(KeyManyToOneKeyEntity other) + { + if (ReferenceEquals(null, other)) + { + return false; + } + if (ReferenceEquals(this, other)) + { + return true; + } + return other.id == id && Equals(other.name, name); + } + + public override int GetHashCode() + { + if(!requestedHash.HasValue) + { + unchecked + { + requestedHash = (id.GetHashCode() * 397) ^ (name != null ? name.GetHashCode() : 0); + } + } + return requestedHash.Value; + } + } +} \ No newline at end of file Added: trunk/nhibernate/src/NHibernate.Test/HQL/Ast/Mammal.cs =================================================================== --- trunk/nhibernate/src/NHibernate.Test/HQL/Ast/Mammal.cs (rev 0) +++ trunk/nhibernate/src/NHibernate.Test/HQL/Ast/Mammal.cs 2009-05-03 22:24:46 UTC (rev 4228) @@ -0,0 +1,22 @@ +using System; + +namespace NHibernate.Test.HQL.Ast +{ + public class Mammal: Animal + { + private bool pregnant; + private DateTime birthdate; + + public virtual bool Pregnant + { + get { return pregnant; } + set { pregnant = value; } + } + + public virtual DateTime Birthdate + { + get { return birthdate; } + set { birthdate = value; } + } + } +} \ No newline at end of file Modified: trunk/nhibernate/src/NHibernate.Test/HQL/Ast/Multi.hbm.xml =================================================================== --- trunk/nhibernate/src/NHibernate.Test/HQL/Ast/Multi.hbm.xml 2009-05-03 13:43:03 UTC (rev 4227) +++ trunk/nhibernate/src/NHibernate.Test/HQL/Ast/Multi.hbm.xml 2009-05-03 22:24:46 UTC (rev 4228) @@ -1,101 +1,104 @@ <?xml version="1.0" encoding="utf-8" ?> <hibernate-mapping xmlns="urn:nhibernate-mapping-2.2" - assembly="NHibernate.Test" - namespace="NHibernate.Test.HQL.Ast" + assembly="NHibernate.DomainModel" + namespace="NHibernate.DomainModel" default-lazy="false"> - <class - name="org.hibernate.test.legacy.Top" - table="rootclass" - dynamic-insert="true" - dynamic-update="true" - select-before-update="true" - where="id1_ is not null"> - <!--cache--> - <id name="id" type="long" column="id1_" unsaved-value="0"> - <generator class="native"/> - </id> - <version name="count" column="count_"/> - <property name="name"/> - <property name="address"/> - <property name="date" column="date_"/> - <many-to-one name="top" access="field" column="top_"/> - - <joined-subclass name="org.hibernate.test.legacy.TrivialClass"> - <key column="tcid"/> - </joined-subclass> - - <joined-subclass - name="org.hibernate.test.legacy.Lower" - table="leafsubclass" - dynamic-insert="true" - dynamic-update="true"> - <key column="id__"/> - <property name="intprop" not-null="true"/> - <one-to-one name="other" class="org.hibernate.test.legacy.Lower"/> - <many-to-one name="another" column="other1" class="org.hibernate.test.legacy.Top"/> - <many-to-one name="yetanother" column="other3" class="org.hibernate.test.legacy.Lower"/> - <property name="foo"/> - <set name="set" lazy="false"> - <key column="parent"/> - <one-to-many class="org.hibernate.test.legacy.Top"/> - </set> - <bag name="bag" lazy="true" table="simple_simple"> - <key column="simple1"/> - <many-to-many column="simple2" class="org.hibernate.test.legacy.Top"/> - </bag> - <one-to-one name="mypo"/> - </joined-subclass> - - <joined-subclass name="org.hibernate.test.legacy.Multi" table="nonleafsubclass"> - <key column="sid" on-delete="cascade"/> - <property name="extraProp" column="dupe"/> - <many-to-one name="other" column="other2" class="org.hibernate.test.legacy.Multi" /> - <many-to-one name="po"/> - <property name="derived" formula="upper(dupe)"/> - - <component name="comp" class="org.hibernate.test.legacy.Multi$Component"> - <property name="cal"/> - <property name="floaty"/> - </component> - - <joined-subclass name="org.hibernate.test.legacy.SubMulti" table="leafsubsubclass"> - <key column="sid"/> - <property name="amount" column="dupe"/> - <bag name="children" lazy="true" inverse="true"> - <key column="parent"/> - <one-to-many class="org.hibernate.test.legacy.SubMulti"/> - </bag> - <many-to-one name="parent"/> - <list name="moreChildren" lazy="true"> - <key column="another_parent"/> - <index column="list_ind"/> - <one-to-many class="org.hibernate.test.legacy.SubMulti"/> - </list> - </joined-subclass> - - </joined-subclass> - - </class> - - <class - name="org.hibernate.test.legacy.Po" - dynamic-insert="true"> - <id type="long" column="id_"> - <generator class="native"/> - </id> - <property name="value" column="value_"/> - <list name="list" cascade="all"> - <key column="list_po"/> - <index column="i"/> - <one-to-many class="org.hibernate.test.legacy.SubMulti"/> - </list> - <set name="set" inverse="true" cascade="all"> - <key column="po"/> - <one-to-many class="org.hibernate.test.legacy.Multi"/> - </set> - <many-to-one name="top" column="tl" insert="false" update="false"/> - <many-to-one name="lower" column="tl"/> - </class> - + <class + name="Top" + table="rootclass" + dynamic-insert="true" + dynamic-update="true" + select-before-update="true" + where="id1_ is not null" + > + <!--<jcs-cache usage="read-write"/> --> + <!-- commented out in h2.1 test also --> + <id name="Id" type="Int64" column="id1_" unsaved-value="0"> + <generator class="native"/> + </id> + + <version name="Count" column="count_" /> + <property name="Name" /> + <property name="Address" /> + <property name="Date" column="date_" /> + <many-to-one name="top" access="field" column="`_top`"/> + <!-- changed column name because of MSSQL conflicts --> + <joined-subclass name="TrivialClass"> + <key column="tcid"/> + </joined-subclass> + + <joined-subclass name="Lower" + table="leafsubclass" dynamic-insert="true" dynamic-update="true"> + <key column="id__"/> + <property name="Intprop" not-null="true" /> + <one-to-one name="Other" class="Lower" /> + <many-to-one name="Another" column="other1" class="Top" /> + <many-to-one name="YetAnother" column="other3" class="Lower" /> + <property name="Foo"/> + <set name="Set" lazy="false"> + <key column="parent"/> + <one-to-many class="Top"/> + </set> + <bag name="Bag" lazy="true" table="simple_simple"> + <key column="simple1"/> + <many-to-many column="simple2" class="Top" + /> + </bag> + <one-to-one name="MyPo"/> + </joined-subclass> + + <joined-subclass name="Multi" table="nonleafsubclass"> + <key column="sid"/> + <property name="ExtraProp" column="dupe"/> + <many-to-one name="Other" column="other2" class="Multi" /> + <many-to-one name="Po" column="po"/> + <many-to-one name="OtherPo" /> + <property name="Derived" formula="upper(dupe)" /> + <component name="Comp" class="Multi+Component"> + <property name="Cal"/> + <property name="Floaty"/> + </component> + + <joined-subclass name="SubMulti" table="leafsubsubclass"> + <key column="sid"/> + <property name="Amount" column="dupe"/> + <bag name="Children" lazy="true" inverse="true" > + <key column="parent"/> + <one-to-many class="SubMulti"/> + </bag> + <many-to-one name="Parent" column="parent" /> + <list name="MoreChildren" lazy="true"> + <key column="another_parent"/> + <index column="list_ind"/> + <one-to-many class="SubMulti"/> + </list> + </joined-subclass> + + </joined-subclass> + + </class> + + <class name="NHibernate.DomainModel.Po, NHibernate.DomainModel" dynamic-insert="true"> + <id type="Int64" column="id_" unsaved-value="0"> + <generator class="native"/> + </id> + <property name="Value" column="value_" /> + <list name="List" cascade="all" > + <key column="list_po"/> + <index column="i"/> + <one-to-many class="NHibernate.DomainModel.SubMulti, NHibernate.DomainModel" /> + </list> + <set name="Set" inverse="true" cascade="all" lazy="true"> + <key column="po" /> + <one-to-many class="NHibernate.DomainModel.Multi, NHibernate.DomainModel" /> + </set> + <set name="EagerSet" inverse="true" cascade="all" outer-join="true"> + <key column="OtherPo" /> + <one-to-many class="NHibernate.DomainModel.Multi, NHibernate.DomainModel" /> + </set> + <many-to-one name="Top" column="t1" insert="false" update="false" /> + <many-to-one name="Lower" column="t1" /> + </class> + </hibernate-mapping> \ No newline at end of file Added: trunk/nhibernate/src/NHibernate.Test/HQL/Ast/Name.cs =================================================================== --- trunk/nhibernate/src/NHibernate.Test/HQL/Ast/Name.cs (rev 0) +++ trunk/nhibernate/src/NHibernate.Test/HQL/Ast/Name.cs 2009-05-03 22:24:46 UTC (rev 4228) @@ -0,0 +1,27 @@ +namespace NHibernate.Test.HQL.Ast +{ + public class Name + { + private string first; + private char initial; + private string last; + + public string First + { + get { return first; } + set { first = value; } + } + + public char Initial + { + get { return initial; } + set { initial = value; } + } + + public string Last + { + get { return last; } + set { last = value; } + } + } +} \ No newline at end of file Added: trunk/nhibernate/src/NHibernate.Test/HQL/Ast/Reptile.cs =================================================================== --- trunk/nhibernate/src/NHibernate.Test/HQL/Ast/Reptile.cs (rev 0) +++ trunk/nhibernate/src/NHibernate.Test/HQL/Ast/Reptile.cs 2009-05-03 22:24:46 UTC (rev 4228) @@ -0,0 +1,14 @@ +namespace NHibernate.Test.HQL.Ast +{ + public class Reptile: Animal + { + private float bodyTemperature; + public virtual float BodyTemperature + { + get { return bodyTemperature; } + set { bodyTemperature = value; } + } + } + + public class Lizard : Reptile { } +} \ No newline at end of file Added: trunk/nhibernate/src/NHibernate.Test/HQL/Ast/SimpleAssociatedEntity.cs =================================================================== --- trunk/nhibernate/src/NHibernate.Test/HQL/Ast/SimpleAssociatedEntity.cs (rev 0) +++ trunk/nhibernate/src/NHibernate.Test/HQL/Ast/SimpleAssociatedEntity.cs 2009-05-03 22:24:46 UTC (rev 4228) @@ -0,0 +1,77 @@ +namespace NHibernate.Test.HQL.Ast +{ + public class SimpleAssociatedEntity + { + private long id; + private string name; + private int? requestedHash; + private SimpleEntityWithAssociation owner; + + public virtual long Id + { + get { return id; } + set { id = value; } + } + + public virtual string Name + { + get { return name; } + set { name = value; } + } + + public virtual SimpleEntityWithAssociation Owner + { + get { return owner; } + set { owner = value; } + } + + public virtual void BindToOwner(SimpleEntityWithAssociation owner) + { + if (owner != this.owner) + { + UnbindFromCurrentOwner(); + if (owner != null) + { + owner.AssociatedEntities.Add(this); + } + } + this.owner = owner; + } + + public virtual void UnbindFromCurrentOwner() + { + if (owner != null) + { + owner.AssociatedEntities.Remove(this); + owner = null; + } + } + + public override bool Equals(object obj) + { + return Equals(obj as SimpleAssociatedEntity); + } + + public virtual bool Equals(SimpleAssociatedEntity other) + { + if (ReferenceEquals(null, other)) + { + return false; + } + if (ReferenceEquals(this, other)) + { + return true; + } + return Equals(other.Id, Id); + } + + public override int GetHashCode() + { + if (!requestedHash.HasValue) + { + requestedHash = Id.GetHashCode(); + } + return requestedHash.Value; + } + } +} \ No newline at end of file Added: trunk/nhibernate/src/NHibernate.Test/HQL/Ast/SimpleEntityWithAssociation.cs =================================================================== --- trunk/nhibernate/src/NHibernate.Test/HQL/Ast/SimpleEntityWithAssociation.cs (rev 0) +++ trunk/nhibernate/src/NHibernate.Test/HQL/Ast/SimpleEntityWithAssociation.cs 2009-05-03 22:24:46 UTC (rev 4228) @@ -0,0 +1,36 @@ +using Iesi.Collections; + +namespace NHibernate.Test.HQL.Ast +{ + public class SimpleEntityWithAssociation + { + private long id; + private string name; + private ISet associatedEntities = new HashedSet(); + private ISet manyToManyAssociatedEntities = new HashedSet(); + + public virtual long Id + { + get { return id; } + set { id = value; } + } + + public virtual string Name + { + get { return name; } + set { name = value; } + } + + public virtual ISet AssociatedEntities + { + get { return associatedEntities; } + set { associatedEntities = value; } + } + + public virtual ISet ManyToManyAssociatedEntities + { + get { return manyToManyAssociatedEntities; } + set { manyToManyAssociatedEntities = value; } + } + } +} \ No newline at end of file Modified: trunk/nhibernate/src/NHibernate.Test/HQL/Ast/SimpleEntityWithAssociation.hbm.xml =================================================================== --- trunk/nhibernate/src/NHibernate.Test/HQL/Ast/SimpleEntityWithAssociation.hbm.xml 2009-05-03 13:43:03 UTC (rev 4227) +++ trunk/nhibernate/src/NHibernate.Test/HQL/Ast/SimpleEntityWithAssociation.hbm.xml 2009-05-03 22:24:46 UTC (rev 4228) @@ -3,29 +3,29 @@ assembly="NHibernate.Test" namespace="NHibernate.Test.HQL.Ast"> - <!-- *Very* important for the test cases that these entities have identically named columns! --> - - <class name="SimpleEntityWithAssociation" table="SIMPLE_1"> - <id name="Id" column="ID" type="long"> - <generator class="native"/> - </id> - <property name="Name" column="NAME" type="string"/> - <set name="AssociatedEntities" cascade="all" inverse="true" lazy="true"> - <key column="SIMPLE_1_ID"/> - <one-to-many class="SimpleAssociatedEntity"/> - </set> - <set name="ManyToManyAssociatedEntities" cascade="save-update" inverse="false" lazy="true" table="MANY_TO_MANY"> - <key column="IN_ID"/> - <many-to-many class="SimpleEntityWithAssociation" column="OUT_ID"/> - </set> - </class> - - <class name="SimpleAssociatedEntity" table="SIMPLE_2"> - <id name="Id" column="ID" type="long"> - <generator class="native"/> - </id> - <property name="Name" column="NAME" type="string" /> - <many-to-one name="Owner" class="SimpleEntityWithAssociation" column="SIMPLE_1_ID"/> - </class> - + <!-- *Very* important for the test cases that these entities have identically named columns! --> + + <class name="SimpleEntityWithAssociation" table="SIMPLE_1"> + <id name="Id" column="ID" type="long"> + <generator class="native"/> + </id> + <property name="Name" column="NAME" type="string"/> + <set name="AssociatedEntities" cascade="all" inverse="true" lazy="true"> + <key column="SIMPLE_1_ID"/> + <one-to-many class="SimpleAssociatedEntity"/> + </set> + <set name="ManyToManyAssociatedEntities" cascade="save-update" inverse="false" lazy="true" table="MANY_TO_MANY"> + <key column="IN_ID"/> + <many-to-many class="SimpleEntityWithAssociation" column="OUT_ID"/> + </set> + </class> + + <class name="SimpleAssociatedEntity" table="SIMPLE_2"> + <id name="Id" column="ID" type="long"> + <generator class="native"/> + </id> + <property name="Name" column="NAME" type="string" /> + <many-to-one name="Owner" class="SimpleEntityWithAssociation" column="SIMPLE_1_ID"/> + </class> + </hibernate-mapping> \ No newline at end of file Added: trunk/nhibernate/src/NHibernate.Test/HQL/Ast/StateProvince.cs =================================================================== --- trunk/nhibernate/src/NHibernate.Test/HQL/Ast/StateProvince.cs (rev 0) +++ trunk/nhibernate/src/NHibernate.Test/HQL/Ast/StateProvince.cs 2009-05-03 22:24:46 UTC (rev 4228) @@ -0,0 +1,27 @@ +namespace NHibernate.Test.HQL.Ast +{ + public class StateProvince + { + private long id; + private string name; + private string isoCode; + + public virtual long Id + { + get { return id; } + set { id = value; } + } + + public virtual string Name + { + get { return name; } + set { name = value; } + } + + public virtual string IsoCode + { + get { return isoCode; } + set { isoCode = value; } + } + } +} \ No newline at end of file Added: trunk/nhibernate/src/NHibernate.Test/HQL/Ast/TimestampVersioned.cs =================================================================== --- trunk/nhibernate/src/NHibernate.Test/HQL/Ast/TimestampVersioned.cs (rev 0) +++ trunk/nhibernate/src/NHibernate.Test/HQL/Ast/TimestampVersioned.cs 2009-05-03 22:24:46 UTC (rev 4228) @@ -0,0 +1,29 @@ +using System; + +namespace NHibernate.Test.HQL.Ast +{ + public class TimestampVersioned + { + private long id; + private DateTime version; + private string name; + + public virtual long Id + { + get { return id; } + set { id = value; } + } + + public virtual DateTime Version + { + get { return version; } + set { version = value; } + } + + public virtual string Name + { + get { return name; } + set { name = value; } + } + } +} \ No newline at end of file Added: trunk/nhibernate/src/NHibernate.Test/HQL/Ast/User.cs =================================================================== --- trunk/nhibernate/src/NHibernate.Test/HQL/Ast/User.cs (rev 0) +++ trunk/nhibernate/src/NHibernate.Test/HQL/Ast/User.cs 2009-05-03 22:24:46 UTC (rev 4228) @@ -0,0 +1,36 @@ +using System.Collections; + +namespace NHibernate.Test.HQL.Ast +{ + public class User + { + private long id; + private string userName; + private Human human; + private IList permissions; + + public virtual long Id + { + get { return id; } + set { id = value; } + } + + public virtual string UserName + { + get { return userName; } + set { userName = value; } + } + + public virtual Human Human + { + get { return human; } + set { human = value; } + } + + public virtual IList Permissions + { + get { return permissions; } + set { permissions = value; } + } + } +} \ No newline at end of file Modified: trunk/nhibernate/src/NHibernate.Test/HQL/Ast/Vehicle.hbm.xml =================================================================== --- trunk/nhibernate/src/NHibernate.Test/HQL/Ast/Vehicle.hbm.xml 2009-05-03 13:43:03 UTC (rev 4227) +++ trunk/nhibernate/src/NHibernate.Test/HQL/Ast/Vehicle.hbm.xml 2009-05-03 22:24:46 UTC (rev 4228) @@ -3,27 +3,27 @@ assembly="NHibernate.Test" namespace="NHibernate.Test.HQL.Ast"> - <!-- Vehicle represents an abstract root of a union-subclass hierarchy --> - <class name="Vehicle" abstract="true"> - <id name="id" access="field" type="long"> - <generator class="increment"/> - </id> - <property name="Vin" type="string"/> - <property name="Owner" type="string"/> - - <!-- Car represents a concrete leaf of a union-subclass hierarchy with no concrete super --> - <union-subclass name="Car"/> - - <!-- Truck represents a concrete subclass in a union-subclass hierarchy with concrete subclasses and no concrete super --> - <union-subclass name="Truck"> - <!-- Both SUV and Pickup represent concrete leaf of a union-subclass hierarchy (like Car), but with a concrete super --> - <union-subclass name="SUV"/> - <union-subclass name="Pickup"/> - </union-subclass> - </class> - - <sql-query name="native-delete-car"> - <synchronize table="Car"/> - delete from CAR where owner = ? - </sql-query> + <!-- Vehicle represents an abstract root of a union-subclass hierarchy --> + <class name="Vehicle" abstract="true"> + <id name="id" access="field" type="long"> + <generator class="increment"/> + </id> + <property name="Vin" type="string"/> + <property name="Owner" type="string"/> + + <!-- Car represents a concrete leaf of a union-subclass hierarchy with no concrete super --> + <union-subclass name="Car"/> + + <!-- Truck represents a concrete subclass in a union-subclass hierarchy with concrete subclasses and no concrete super --> + <union-subclass name="Truck"> + <!-- Both SUV and Pickup represent concrete leaf of a union-subclass hierarchy (like Car), but with a concrete super --> + <union-subclass name="SUV"/> + <union-subclass name="Pickup"/> + </union-subclass> + </class> + + <sql-query name="native-delete-car"> + <synchronize table="Car"/> + delete from CAR where owner = ? + </sql-query> </hibernate-mapping> \ No newline at end of file Copied: trunk/nhibernate/src/NHibernate.Test/HQL/Ast/Vehicles.cs (from rev 4226, trunk/nhibernate/src/NHibernate.Test/BulkManipulation/Vehicles.cs) =================================================================== --- trunk/nhibernate/src/NHibernate.Test/HQL/Ast/Vehicles.cs (rev 0) +++ trunk/nhibernate/src/NHibernate.Test/HQL/Ast/Vehicles.cs 2009-05-03 22:24:46 UTC (rev 4228) @@ -0,0 +1,43 @@ +namespace NHibernate.Test.HQL.Ast +{ + public class Vehicle + { + private long id; + private string vin; + private string owner; + + public virtual long Id + { + get { return id; } + set { id = value; } + } + + public virtual string Vin + { + get { return vin; } + set { vin = value; } + } + + public virtual string Owner + { + get { return owner; } + set { owner = value; } + } + } + + public class Car : Vehicle + { + } + + public class Truck : Vehicle + { + } + + public class Pickup : Truck + { + } + + public class SUV : Truck + { + } +} \ No newline at end of file Modified: trunk/nhibernate/src/NHibernate.Test/HQL/Ast/Versions.hbm.xml =================================================================== --- trunk/nhibernate/src/NHibernate.Test/HQL/Ast/Versions.hbm.xml 2009-05-03 13:43:03 UTC (rev 4227) +++ trunk/nhibernate/src/NHibernate.Test/HQL/Ast/Versions.hbm.xml 2009-05-03 22:24:46 UTC (rev 4228) @@ -4,20 +4,20 @@ namespace="NHibernate.Test.HQL.Ast" default-access="field"> - <class name="IntegerVersioned"> - <id name="id"> - <generator class="native"/> - </id> - <version name="version" column="vers"/> - <property name="name"/> - </class> - - <class name="TimestampVersioned"> - <id name="id"> - <generator class="native"/> - </id> - <timestamp name="version" column="vers"/> - <property name="name"/> - </class> - + <class name="IntegerVersioned"> + <id name="id"> + <generator class="native"/> + </id>... [truncated message content] |