Update of /cvsroot/nhibernate/nhibernate/src/NHibernate.DomainModel/NHSpecific In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv21841/NHSpecific Added Files: AuditComponent.cs BasicClass.cs BasicClass.hbm.xml Child.cs Child.hbm.xml ClassWithCompositeId.cs ClassWithCompositeId.hbm.xml CompositeId.cs JoinedSubclass.hbm.xml JoinedSubclassBase.cs JoinedSubclassOne.cs Node.cs Node.hbm.xml Parent.cs Parent.hbm.xml ParentComparer.cs SexType.cs SexType.hbm.xml SimpleComponent.cs SimpleComponent.hbm.xml Subclass.hbm.xml Team.cs Team.hbm.xml UnsavedType.cs UnsavedType.hbm.xml Log Message: Move the new class I made to use to get NHibernate testing up and going to their own namespace because there was some name conflicts with h2.0.3 classes. --- NEW FILE: SimpleComponent.cs --- using System; namespace NHibernate.DomainModel.NHSpecific { /// <summary> /// Summary description for SimpleComponent. /// </summary> public class SimpleComponent { private int _key; private string _name; private string _address; private int _count; private DateTime _date; private AuditComponent _audit; public SimpleComponent() { _audit = new AuditComponent(); } public int Key { get {return _key;} set {_key = value;} } public string Name { get { return _name; } set { _name = value; } } public string Address { get { return _address; } set { _address = value; } } public int Count { get { return _count; } set { _count = value; } } public DateTime Date { get { return _date; } set { _date = value; } } public AuditComponent Audit { get {return _audit;} set {_audit = value;} } } } --- NEW FILE: Node.hbm.xml --- <?xml version="1.0" encoding="utf-8" ?> <hibernate-mapping xmlns="urn:nhibernate-mapping-2.0"> <class name="NHibernate.DomainModel.NHSpecific.Node, NHibernate.DomainModel"> <id name="Id" column="id" type="String(10)"> <generator class="assigned" /> </id> <set name="DestinationNodes" table="node_link" lazy="true"> <key column="from_node_id" /> <many-to-many column="to_node_id" class="NHibernate.DomainModel.NHSpecific.Node, NHibernate.DomainModel" /> </set> <set name="PreviousNodes" table="node_link" inverse="true"> <key column="to_node_id" /> <many-to-many column="from_node_id" class="NHibernate.DomainModel.NHSpecific.Node, NHibernate.DomainModel" /> </set> </class> </hibernate-mapping> --- NEW FILE: JoinedSubclassOne.cs --- using System; namespace NHibernate.DomainModel.NHSpecific { /// <summary> /// Summary description for JoinedSubclassOne. /// </summary> public class JoinedSubclassOne: JoinedSubclassBase { private long _oneTestLong; public JoinedSubclassOne() {} public long OneTestLong { get {return _oneTestLong;} set {_oneTestLong = value;} } } } --- NEW FILE: Subclass.hbm.xml --- <?xml version="1.0"?> <hibernate-mapping xmlns="urn:nhibernate-mapping-2.0"> <class name="NHibernate.DomainModel.NHSpecific.JoinedSubclassBase, NHibernate.DomainModel" table="one_tab" discriminator-value="SUPER" > <id name="Id" type="Int32" column="class_id" > <generator class="assigned" /> </id> <discriminator column="disc_column" type="String" /> <property name="TestLong" column="test_long" type="Int64" /> <property name="TestString" column="test_string" type="String" /> <property name="TestDateTime" column="test_date_time" type="DateTime" /> <subclass name="NHibernate.DomainModel.NHSpecific.JoinedSubclassOne, NHibernate.DomainModel" discriminator-value="SUB" > <property name="OneTestLong" column="one_test_long" type="Int64" /> </subclass> </class> </hibernate-mapping> --- NEW FILE: SexType.hbm.xml --- <?xml version="1.0" ?> <hibernate-mapping xmlns="urn:nhibernate-mapping-2.0"> <class name="NHibernate.DomainModel.NHSpecific.SexType, NHibernate.DomainModel" table="s_type" > <id name="Id" column="id"> <generator class="identity" /> </id> <property name="TypeName" type="String" column="type_name" /> <property name="NonpublicString" type="String" column="nonpublic_string" /> </class> </hibernate-mapping> --- NEW FILE: SimpleComponent.hbm.xml --- <?xml version="1.0" ?> <hibernate-mapping xmlns="urn:nhibernate-mapping-2.0"> <class name="NHibernate.DomainModel.NHSpecific.SimpleComponent, NHibernate.DomainModel" table="simp_com" > <id name="Key" type="Int64" column="`i[d]_`" > <generator class="assigned" /> </id> <property name="Name" /> <property name="Address" /> <property name="Count" column="count_" not-null="true" unique="true" /> <property name="Date" column="`d[at]e_`" /> <component name="Audit" class="NHibernate.DomainModel.NHSpecific.AuditComponent, NHibernate.DomainModel"> <property name="CreatedUserId" column="created_user_id" /> <property name="CreatedDate" column="created_date" /> <property name="UpdatedUserId" column="updated_user_id" /> <property name="UpdatedDate" column="updated_date" /> </component> </class> </hibernate-mapping> --- NEW FILE: BasicClass.cs --- using System; using System.Collections; namespace NHibernate.DomainModel.NHSpecific { [Serializable] public class SerializableClass { public int _classId; public string _classString; public override int GetHashCode() { // not a good method, but all that is needed for this Class // to be used by tests. return base.GetHashCode(); } public override bool Equals(object obj) { SerializableClass lhs = obj as SerializableClass; if(lhs==null) return false; if(this==lhs) return true; if(this._classId.Equals(lhs._classId) && this._classString.Equals(this._classString)) return true; return false; } } /// <summary> /// Summary description for BasicClass. /// </summary> [Serializable] public class BasicClass { private int _id; private byte[] _binaryProperty; private bool _booleanProperty; private byte _byteProperty; private char _characterProperty; private System.Type _classProperty; private System.Globalization.CultureInfo _cultureInfoProperty; private DateTime _dateTimeProperty; private decimal _decimalProperty; private double _doubleProperty; private short _int16Property; private int _int32Property; private long _int64Property; private SerializableClass _serializableProperty; private float _singleProperty; private string _stringProperty; private DateTime _ticksProperty; private bool _trueFalseProperty; private bool _yesNoProperty; private string[] _stringArray; private int[] _int32Array; private IList _stringBag; private IList _stringList; private IDictionary _stringMap; private IDictionary _stringSet; private object _dummyObject = new object(); public BasicClass() { _serializableProperty = new SerializableClass(); _serializableProperty._classId = 5; _serializableProperty._classString = "serialize me"; } public int Id { get { return _id;} set { _id = value;} } public byte[] BinaryProperty { get {return _binaryProperty;} set {_binaryProperty = value;} } public bool BooleanProperty { get {return _booleanProperty;} set {_booleanProperty = value;} } public byte ByteProperty { get {return _byteProperty;} set {_byteProperty = value;} } public char CharacterProperty { get {return _characterProperty ;} set {_characterProperty = value;} } public System.Type ClassProperty { get {return _classProperty;} set {_classProperty = value;} } public System.Globalization.CultureInfo CultureInfoProperty { get {return _cultureInfoProperty;} set {_cultureInfoProperty = value;} } public DateTime DateTimeProperty { get {return _dateTimeProperty;} set {_dateTimeProperty = value;} } public decimal DecimalProperty { get {return _decimalProperty;} set {_decimalProperty = value;} } public double DoubleProperty { get {return _doubleProperty;} set {_doubleProperty = value;} } public short Int16Property { get {return _int16Property;} set {_int16Property = value;} } public int Int32Property { get {return _int32Property;} set {_int32Property = value;} } public long Int64Property { get {return _int64Property;} set {_int64Property = value;} } public SerializableClass SerializableProperty { get {return _serializableProperty;} set {_serializableProperty = value;} } public float SingleProperty { get {return _singleProperty;} set {_singleProperty = value;} } public string StringProperty { get {return _stringProperty;} set {_stringProperty = value;} } public DateTime TicksProperty { get {return _ticksProperty;} set {_ticksProperty = value;} } public bool TrueFalseProperty { get {return _trueFalseProperty;} set {_trueFalseProperty = value;} } public bool YesNoProperty { get {return _yesNoProperty;} set {_yesNoProperty = value;} } public string[] StringArray { get { return _stringArray; } set { _stringArray = value; } } public int[] Int32Array { get { return _int32Array; } set { _int32Array = value; } } public IList StringBag { get { return _stringBag; } set { _stringBag = value; } } public IList StringList { get { return _stringList; } set { _stringList = value; } } public IDictionary StringMap { get { return _stringMap; } set { _stringMap = value; } } public IDictionary StringSet { get { return _stringSet; } set { _stringSet = value; } } public void AddToStringSet(string stringValue) { if(StringSet==null) StringSet = new Hashtable(); StringSet[stringValue] = _dummyObject; } } } --- NEW FILE: UnsavedType.hbm.xml --- (This appears to be a binary file; contents omitted.) --- NEW FILE: Parent.hbm.xml --- <?xml version="1.0" ?> <hibernate-mapping xmlns="urn:nhibernate-mapping-2.0"> <class name="NHibernate.DomainModel.NHSpecific.Parent, NHibernate.DomainModel" table="par" > <id name="Id" column="id"> <generator class="assigned" /> </id> <property name="AdultName" type="String" column="adult_name" /> <set name="AdultFriends" table="par_frnd" sort="NHibernate.DomainModel.NHSpecific.ParentComparer, NHibernate.DomainModel"> <key column="parent_id" /> <many-to-many column="parent_friend_id" class="NHibernate.DomainModel.NHSpecific.Parent, NHibernate.DomainModel" /> </set> </class> </hibernate-mapping> --- NEW FILE: SexType.cs --- using System; namespace NHibernate.DomainModel.NHSpecific { /// <summary> /// Summary description for SexType. /// </summary> public class SexType { private int _id; private string _typeName; private string _nonpublicString; public SexType() { } public int Id { get {return _id;} set {_id = value;} } public string TypeName { get {return _typeName;} set {_typeName = value;} } private string NonpublicString { get { if(_typeName.Equals("Male")) return "MALE"; else if(_typeName.Equals("Female")) return "FEMALE"; else return "UNKNOWN"; } set {_nonpublicString = value;} } } } --- NEW FILE: Child.hbm.xml --- <?xml version="1.0" ?> <hibernate-mapping xmlns="urn:nhibernate-mapping-2.0"> <class name="NHibernate.DomainModel.NHSpecific.Child, NHibernate.DomainModel" table="child" > <id name="Id" column="id"> <generator class="assigned" /> </id> <property name="FullName" type="String(45)" column="full_name" /> <property name="FavoriteDate" type="DateTime" column="favorite_date" /> <many-to-one name="Sex" class="NHibernate.DomainModel.NHSpecific.SexType, NHibernate.DomainModel" column="sex_type_id"/> <map name="Parents" table="c_prnt" lazy="true"> <key column="child_id" /> <index column="which_parent" type="String" /> <many-to-many column="parent_id" class="NHibernate.DomainModel.NHSpecific.Parent, NHibernate.DomainModel" /> </map> <list name="Siblings" table="c_sibs" lazy="true"> <key column="child_id" /> <index column="which_sibling" /> <many-to-many column="sibling_child_id" class="NHibernate.DomainModel.NHSpecific.Child, NHibernate.DomainModel" /> </list> <!-- This is not too acurate of real world situations because we can't have a link back and forth, maybe it is - if I think someone is my friend but they don't think I am their friend ;) --> <array name="Friends" table="c_frnds"> <key column="child_id" /> <index column="friend_index" /> <many-to-many column="friend_id" class="NHibernate.DomainModel.NHSpecific.Child, NHibernate.DomainModel" /> </array> </class> </hibernate-mapping> --- NEW FILE: Child.cs --- using System; using System.Collections; namespace NHibernate.DomainModel.NHSpecific { /// <summary> /// Summary description for Child. /// </summary> public class Child { private int _id; private string _fullName; private IDictionary _parents; private SexType _sex; private IList _siblings; private Child[] _friends; private System.DateTime _favoriteDate; public Child() { _friends = new Child[3]; } public int Id { get {return _id;} set {_id = value;} } public string FullName { get {return _fullName;} set {_fullName = value;} } public IList Siblings { get { if(_siblings==null) _siblings = new ArrayList(); return _siblings; } set {_siblings = value;} } public Child FirstSibling { get{ return (Child)Siblings[0]; } set {Siblings.Insert(0, value);} } public Child SecondSibling { get{ return (Child)Siblings[1]; } set {Siblings.Insert(1, value);} } public IDictionary Parents { get { if(_parents==null) _parents = new Hashtable(); return _parents; } set {_parents = value;} } public Parent Mom { get { return (Parent)Parents["mom"];} set { if(Parents.Contains("mom")==false) { Parents.Add("mom", value); } else { Parents["mom"] = value; } } } public Parent Dad { get { return (Parent)Parents["dad"];} set { if(Parents.Contains("dad")==false) { Parents.Add("dad", value); } else { Parents["dad"] = value; } } } public SexType Sex { get { return _sex;} set { _sex = value;} } public Child[] Friends { get { return _friends;} set { _friends = value;} } public System.DateTime FavoriteDate{ get {return _favoriteDate;} set {_favoriteDate = value;} } } } --- NEW FILE: Node.cs --- using System; using System.Collections; namespace NHibernate.DomainModel.NHSpecific { /// <summary> /// Summary description for Node. /// </summary> public class Node { private string _id; private IDictionary _previousNodes; private IDictionary _destinationNodes; private Node() { } public Node(string id) { _destinationNodes = new Hashtable(); _previousNodes = new Hashtable(); _id = id; } public string Id { get { return _id; } set { _id = value; } } /// <summary> /// The Nodes that lead into this Node. /// </summary> /// <remarks> /// I would not recommend that mapping of set be made public because /// under the scene they rely on Dictionaries, but this is in here for /// testing. /// /// Any modifications to the "inverse" side should not be persisted - unless /// the modifications are also made to the non-inverse side. /// </remarks> public IDictionary PreviousNodes { get { return _previousNodes; } set { _previousNodes = value; } } private void AddPreviousNode(Node previousNode) { PreviousNodes.Add(previousNode, null); } /// <summary> /// The Nodes this Node can go To. /// </summary> /// <remarks> /// I would not recommend that mapping of set be made public because /// under the scene they rely on Dictionaries, but this is in here for /// testing. The DestinationNodes is the Property that controls which /// modifications get persisted. /// </remarks> public IDictionary DestinationNodes { get { return _destinationNodes; } set { _destinationNodes = value; } } /// <summary> /// This is the only way to hook nodes together right now. /// </summary> /// <param name="node">A Node this Node can go to.</param> public void AddDestinationNode(Node destinationNode) { DestinationNodes.Add(destinationNode, null); // let the destinationNode know that it can be one of the // previous Nodes was this Node destinationNode.AddPreviousNode(this); } public override int GetHashCode() { return _id.GetHashCode(); } public override bool Equals(object obj) { Node rhs = obj as Node; if(rhs==null) return false; return _id.Equals(rhs.Id); } } } --- NEW FILE: ParentComparer.cs --- using System; using System.Collections; namespace NHibernate.DomainModel.NHSpecific { /// <summary> /// Summary description for ParentComparer. /// </summary> public class ParentComparer : IComparer { public ParentComparer() { } #region IComparer Members public int Compare(Parent x, Parent y) { if(x==null && y==null) return 0; //TODO: don't know if my logic is good, but good enough for compile if(x==null && y!=null) return -1; if(x!=null && y==null) return 1; return x.Id - y.Id; } int IComparer.Compare(object x, object y) { Parent xParent = x as Parent; Parent yParent = y as Parent; return Compare(xParent, yParent); } #endregion } } --- NEW FILE: ClassWithCompositeId.hbm.xml --- <?xml version="1.0"?> <hibernate-mapping xmlns="urn:nhibernate-mapping-2.0"> <class name="NHibernate.DomainModel.NHSpecific.ClassWithCompositeId, NHibernate.DomainModel" table="class_w_com_id" > <composite-id name="Id" class="NHibernate.DomainModel.NHSpecific.CompositeId, NHibernate.DomainModel"> <key-property name="KeyString" column="string_" type="String(20)" /> <key-property name="KeyShort" column="short_"/> <key-property name="KeyDateTime" column="date_" type="DateTime"/> </composite-id> <property name="OneProperty" column="one_property"/> </class> </hibernate-mapping> --- NEW FILE: AuditComponent.cs --- using System; namespace NHibernate.DomainModel.NHSpecific { /// <summary> /// Summary description for AuditComponent. /// </summary> public class AuditComponent{ private string _createdUserId; private System.DateTime _createdDate; private string _updatedUserId; private System.DateTime _updatedDate; public AuditComponent() { } public string CreatedUserId { get {return _createdUserId;} set {_createdUserId = value;} } public System.DateTime CreatedDate { get {return _createdDate;} set {_createdDate = value;} } public string UpdatedUserId { get {return _updatedUserId;} set {_updatedUserId = value;} } public System.DateTime UpdatedDate { get {return _updatedDate;} set {_updatedDate = value;} } } } --- NEW FILE: Parent.cs --- using System; using System.Collections; namespace NHibernate.DomainModel.NHSpecific { /// <summary> /// Summary description for Parent. /// </summary> public class Parent { private int _id; private string _adultName; private IDictionary _children; private IDictionary _adultFriends; public Parent() { _adultFriends = new SortedList(new ParentComparer()); } public int Id { get {return _id;} set {_id = value;} } public string AdultName { get {return _adultName;} set {_adultName = value;} } public IDictionary Children { get {return _children;} set {_children = value;} } public IDictionary AdultFriends { get {return _adultFriends;} set {_adultFriends = value;} } public void AddFriend(Parent friend) { _adultFriends.Add(friend, friend); } } } --- NEW FILE: UnsavedType.cs --- using System; namespace NHibernate.DomainModel.NHSpecific { /// <summary> /// Summary description for UnsavedType. /// </summary> public class UnsavedType { private int _id = 0; private string _typeName; public UnsavedType() { } public int Id { get {return _id;} set {_id = value;} } public string TypeName { get {return _typeName;} set {_typeName = value;} } } } --- NEW FILE: Team.cs --- using System; using System.Collections; namespace NHibernate.DomainModel.NHSpecific { /// <summary> /// Summary description for Team. /// </summary> public class Team { private int _id; private string _name; private IList _players; public Team() { } public int Id { get {return _id;} set {_id = value;} } public string Name { get {return _name;} set {_name = value;} } public IList Players { get {return _players;} set {_players = value;} } } } --- NEW FILE: Team.hbm.xml --- (This appears to be a binary file; contents omitted.) --- NEW FILE: JoinedSubclassBase.cs --- using System; namespace NHibernate.DomainModel.NHSpecific { /// <summary> /// Summary description for JoinedSubclassBase. /// </summary> public class JoinedSubclassBase { private int _id; private long _testLong; private string _testString; private System.DateTime _testDate; public JoinedSubclassBase() { } public int Id { get {return _id;} set {_id = value;} } public long TestLong { get {return _testLong;} set {_testLong = value;} } public string TestString { get {return _testString;} set {_testString = value;} } public System.DateTime TestDateTime { get {return _testDate;} set {_testDate = value;} } } } --- NEW FILE: JoinedSubclass.hbm.xml --- <?xml version="1.0"?> <hibernate-mapping xmlns="urn:nhibernate-mapping-2.0"> <class name="NHibernate.DomainModel.NHSpecific.JoinedSubclassBase, NHibernate.DomainModel" table="j_sc" > <id name="Id" type="Int32" unsaved-value="null" column="joined_subclass_id" > <generator class="native" /> </id> <property name="TestLong" column="test_long" type="Int64" /> <property name="TestString" column="test_string" type="String" /> <property name="TestDateTime" column="test_date_time" type="DateTime" /> <joined-subclass name="NHibernate.DomainModel.NHSpecific.JoinedSubclassOne, NHibernate.DomainModel" table="j_sc_one" > <key column="joined_subclass_id" /> <property name="OneTestLong" column="one_test_long" type="Int64" /> </joined-subclass> </class> </hibernate-mapping> --- NEW FILE: CompositeId.cs --- using System; namespace NHibernate.DomainModel.NHSpecific { /// <summary> /// Summary description for CompositeId. /// </summary> public class CompositeId { private string _keyString; private short _keyShort; private System.DateTime _keyDateTime; public CompositeId() { } public CompositeId(string keyString, short keyShort, System.DateTime keyDateTime) { _keyString = keyString; _keyShort = keyShort; _keyDateTime = keyDateTime; } public string KeyString { get { return _keyString;} set { _keyString = value;} } public short KeyShort { get { return _keyShort;} set {_keyShort = value;} } public System.DateTime KeyDateTime { get { return _keyDateTime;} set {_keyDateTime = value;} } public override int GetHashCode() { return _keyString.GetHashCode(); } public override bool Equals(object obj) { CompositeId otherObj = obj as CompositeId; if(otherObj==null) return false; if(otherObj.KeyString.Equals(this.KeyString)) return true; return false; } } } --- NEW FILE: BasicClass.hbm.xml --- <?xml version="1.0" encoding="utf-8" ?> <hibernate-mapping xmlns="urn:nhibernate-mapping-2.0"> <class name="NHibernate.DomainModel.NHSpecific.BasicClass, NHibernate.DomainModel" table="bc"> <id name="Id" column="id"> <generator class="assigned" /> </id> <property name="BinaryProperty" type="Byte[]" column="bin_p"/> <property name="BooleanProperty" type="Boolean" column="bool_p"/> <property name="ByteProperty" type="Byte" column="byte_p"/> <property name="CharacterProperty" type="Char" column="char_p"/> <property name="ClassProperty" type="Type" column="class_p"/> <property name="CultureInfoProperty" type="CultureInfo" column="cinfo_p"/> <property name="DateTimeProperty" type="DateTime" column="dtm_p"/> <property name="DecimalProperty" type="Decimal(19,5)" column="decm_p"/> <property name="DoubleProperty" type="Double" column="dbl_p"/> <property name="Int16Property" type="Int16" column="shrt_p" /> <property name="Int32Property" type="Int32" column="int_p"/> <property name="Int64Property" type="Int64" column="lng_p"/> <property name="SerializableProperty" type="NHibernate.DomainModel.NHSpecific.SerializableClass, NHibernate.DomainModel(1000)" column="ser_p"/> <property name="SingleProperty" type="Single" column="flt_p"/> <property name="StringProperty" type="String" column="str_p"/> <property name="TicksProperty" type="Ticks" column="ticks_p"/> <property name="TrueFalseProperty" type="TrueFalse" column="tf_p"/> <property name="YesNoProperty" type="YesNo" column="yn_p"/> <array name="StringArray" table="bc_starr" > <key column="bc_id" /> <index column="sa_idx" /> <element column="str_val" type="String(100)" /> </array> <primitive-array name="Int32Array" table="bc_inarr"> <key column="bc_id" /> <index column="inta_idx" /> <element column="int32_val" type="Int32" /> </primitive-array> <bag name="StringBag" table="bc_stbag"> <key column="bc_id" /> <element column="str_value" type="String(25)" /> </bag> <list name="StringList" table="bc_stlst"> <key column="bc_id" /> <index column="lst_idx" /> <element column="str_val" type="String(300)" /> </list> <map name="StringMap" table="bc_stmap" > <key column="bc_id"/> <index column="strm_idx" type="String(10)" /> <element column="str_val" type="String(50)" /> </map> <set name="StringSet" table="bc_stset"> <key column="bc_id" /> <element column="str_val" type="String(25)"/> </set> </class> </hibernate-mapping> --- NEW FILE: ClassWithCompositeId.cs --- using System; namespace NHibernate.DomainModel.NHSpecific { /// <summary> /// Summary description for ClassWithCompositeId. /// </summary> public class ClassWithCompositeId { private CompositeId _id; private int _oneProperty; public ClassWithCompositeId(){} public CompositeId Id { get {return _id;} set {_id = value;} } public int OneProperty { get {return _oneProperty;} set {_oneProperty = value;} } } } |