Permalink
Browse files

Full port of mapping schema from H3.2.6 (removed unused generic xsd)

Breaking Changes:
-jcs-cache tag removed (use "cache" tag)
-default value for "insert" discriminator attribute is true (must specify false in case of null-notNull discriminator; see UpDown.hbm.xml)
-unsaved-value enum in some certain cases like timestamp and compositeId

Cauncil:
remove nhibernate-mapping.xsx after update before open the new schema in VS

SVN: trunk@3594
  • Loading branch information...
1 parent 117a5de commit 69ee312cf0d8d101b71ba2fb696b2dca0914e282 @fabiomaulo fabiomaulo committed Jul 2, 2008
View
2 src/NHibernate.DomainModel/Container.hbm.xml
@@ -122,7 +122,7 @@
table="LCCBAG"
cascade="save-update"
>
- <jcs-cache usage="read-write" />
+ <cache usage="read-write" />
<key column="container_id" />
<many-to-many
column="contained_id"
View
2 src/NHibernate.DomainModel/Immutable.hbm.xml
@@ -1,7 +1,7 @@
<?xml version="1.0" ?>
<hibernate-mapping xmlns="urn:nhibernate-mapping-2.2" default-lazy="false">
<class name="NHibernate.DomainModel.Immutable, NHibernate.DomainModel" table="immut" mutable="false">
- <jcs-cache usage="read-only" />
+ <cache usage="read-only" />
<id name="Id" column="id_" length="64">
<generator class="uuid.hex" />
</id>
View
2 src/NHibernate.DomainModel/UpDown.hbm.xml
@@ -5,7 +5,7 @@
<key-property name="Id1"/>
<key-property name="Id2"/>
</composite-id>
- <discriminator column="value_" type="long" not-null="false"/>
+ <discriminator column="value_" type="long" not-null="false" insert="false"/>
<subclass name="NHibernate.DomainModel.Down" discriminator-value="not null">
<property name="Value" column="value_" type="long"/>
</subclass>
View
6 src/NHibernate.Test/NHibernate.Test-2.0.csproj
@@ -50,10 +50,6 @@
<SpecificVersion>False</SpecificVersion>
<HintPath>..\..\lib\net\2.0\log4net.dll</HintPath>
</Reference>
- <Reference Include="nmock, Version=1.0.1536.20687, Culture=neutral">
- <SpecificVersion>False</SpecificVersion>
- <HintPath>..\..\lib\net\nmock.dll</HintPath>
- </Reference>
<Reference Include="nunit.core, Version=2.2.8.0, Culture=neutral, PublicKeyToken=96d09a1eb7f44a77, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\..\lib\net\2.0\nunit.core.dll</HintPath>
@@ -1272,7 +1268,7 @@
</ItemGroup>
<ItemGroup>
<EmbeddedResource Include="NHSpecificTest\CriteriaFromHql\Mappings.hbm.xml" />
- <Content Include="NHSpecificTest\NH1347\Mappings.hbm.xml" />
+ <EmbeddedResource Include="NHSpecificTest\NH1347\Mappings.hbm.xml" />
<EmbeddedResource Include="NHSpecificTest\NH693\EmptyTableName.hbm.xml" />
<EmbeddedResource Include="NHSpecificTest\NH693\SpaceTableName.hbm.xml" />
</ItemGroup>
View
4,927 src/NHibernate/Cfg/MappingSchema/Hbm.generated.cs
3,046 additions, 1,881 deletions not shown because the diff is too large. Please use a local Git client to view these changes.
View
13 src/NHibernate/Cfg/MappingSchema/HbmClass.cs
@@ -2,29 +2,24 @@ namespace NHibernate.Cfg.MappingSchema
{
partial class HbmClass
{
- public HbmCacheType Cache
- {
- get { return Item; }
- }
-
public HbmId Id
{
- get { return Item1 as HbmId; }
+ get { return Item as HbmId; }
}
public HbmCompositeId CompositeId
{
- get { return Item1 as HbmCompositeId; }
+ get { return Item as HbmCompositeId; }
}
public HbmVersion Version
{
- get { return Item2 as HbmVersion; }
+ get { return Item1 as HbmVersion; }
}
public HbmTimestamp Timestamp
{
- get { return Item2 as HbmTimestamp; }
+ get { return Item1 as HbmTimestamp; }
}
}
}
View
24 src/NHibernate/Cfg/MappingSchema/HbmDefinition.cs
@@ -1,24 +0,0 @@
-using System.Collections.Generic;
-
-namespace NHibernate.Cfg.MappingSchema
-{
- partial class HbmDefinition : HbmBase
- {
- public Dictionary<string, string> FindParameters()
- {
- Dictionary<string, string> parameters = new Dictionary<string, string>(10);
-
- if (param != null)
- {
- foreach (HbmParam hbmParam in param)
- {
- string name = hbmParam.name;
- string text = JoinString(hbmParam.Text);
-
- parameters.Add(name, text);
- }
- }
- return parameters;
- }
- }
-}
View
2 src/NHibernate/Cfg/MappingSchema/HbmFilterDef.cs
@@ -9,7 +9,7 @@ public string GetDefaultCondition()
public HbmFilterParam[] ListParameters()
{
- return filterparam ?? new HbmFilterParam[0];
+ return Items ?? new HbmFilterParam[0];
}
}
}
View
2 src/NHibernate/Cfg/XmlHbmBinding/AuxiliaryDatabaseObjectFactory.cs
@@ -43,8 +43,6 @@ private static IAuxiliaryDatabaseObject CreateCustomObject(Mappings mappings, Hb
IAuxiliaryDatabaseObject customObject = (IAuxiliaryDatabaseObject)Activator.CreateInstance(customType);
- Dictionary<string, string> parameters = definitionSchema.FindParameters();
- customObject.SetParameterValues(parameters);
foreach (string dialectName in databaseObjectSchema.FindDialectScopeNames())
{
customObject.AddDialectScope(dialectName);
View
4 src/NHibernate/Cfg/XmlHbmBinding/ClassCompositeIdBinder.cs
@@ -274,8 +274,8 @@ private void BindProperty(HbmKeyManyToOne keyManyToOneSchema, Mapping.Property p
private void BindSimpleValue(HbmKeyProperty keyPropertySchema, SimpleValue model, bool isNullable, string path)
{
- if (keyPropertySchema.type != null)
- model.TypeName = keyPropertySchema.type;
+ if (keyPropertySchema.type1 != null)
+ model.TypeName = keyPropertySchema.type1;
BindColumns(keyPropertySchema, model, isNullable, true, path);
}
View
24 src/NHibernate/Cfg/XmlHbmBinding/ClassDiscriminatorBinder.cs
@@ -1,6 +1,5 @@
using NHibernate.Cfg.MappingSchema;
using NHibernate.Mapping;
-using NHibernate.Type;
namespace NHibernate.Cfg.XmlHbmBinding
{
@@ -28,12 +27,8 @@ public ClassDiscriminatorBinder(ClassBinder parent)
}
rootClass.IsPolymorphic = true;
-
- if (discriminatorSchema.force)
- rootClass.IsForceDiscriminator = true;
-
- if (discriminatorSchema.insertSpecified && !discriminatorSchema.insert)
- rootClass.IsDiscriminatorInsertable = false;
+ rootClass.IsForceDiscriminator = discriminatorSchema.force;
+ rootClass.IsDiscriminatorInsertable = discriminatorSchema.insert;
}
private void BindSimpleValue(HbmDiscriminator discriminatorSchema, SimpleValue discriminator)
@@ -56,34 +51,35 @@ private void BindColumns(HbmDiscriminator discriminatorSchema, SimpleValue discr
Table table = discriminator.Table;
//COLUMN(S)
- if (discriminatorSchema.column1 != null)
+ if (discriminatorSchema.column != null)
{
Column col = new Column();
col.Value = discriminator;
BindColumn(discriminatorSchema, col);
- col.Name = mappings.NamingStrategy.ColumnName(discriminatorSchema.column1);
+ col.Name = mappings.NamingStrategy.ColumnName(discriminatorSchema.column);
if (table != null)
table.AddColumn(col);
discriminator.AddColumn(col);
}
- else if (discriminatorSchema.column != null)
+ else if (discriminatorSchema.Item != null && discriminatorSchema.Item is HbmColumn)
{
+ HbmColumn theCol = (HbmColumn)discriminatorSchema.Item;
Column col = new Column();
col.Value = discriminator;
- BindColumn(discriminatorSchema.column, col, false);
+ BindColumn(theCol, col, false);
- col.Name = mappings.NamingStrategy.ColumnName(discriminatorSchema.column.name);
+ col.Name = mappings.NamingStrategy.ColumnName(theCol.name);
if (table != null)
table.AddColumn(col);
//table=null -> an association, fill it in later
discriminator.AddColumn(col);
- BindIndex(discriminatorSchema.column.index, table, col);
- BindUniqueKey(discriminatorSchema.column.uniquekey, table, col);
+ BindIndex(theCol.index, table, col);
+ BindUniqueKey(theCol.uniquekey, table, col);
}
if (discriminator.ColumnSpan == 0)
View
2 src/NHibernate/Cfg/XmlHbmBinding/ClassIdBinder.cs
@@ -39,7 +39,7 @@ public void BindId(HbmId idSchema, PersistentClass rootClass, Table table)
private static SimpleValue CreateIdentifier(HbmId idSchema, PersistentClass rootClass, Table table)
{
SimpleValue iv = new SimpleValue(table);
- iv.TypeName = idSchema.type;
+ iv.TypeName = idSchema.type1;
rootClass.Identifier = iv;
return iv;
View
4 src/NHibernate/Cfg/XmlHbmBinding/NamedQueryBinder.cs
@@ -24,9 +24,9 @@ public void AddQuery(HbmQuery querySchema)
log.DebugFormat("Named query: {0} -> {1}", queryName, queryText);
- bool cacheable = querySchema.cacheableSpecified ? querySchema.cacheable : false;
+ bool cacheable = querySchema.cacheable;
string region = querySchema.cacheregion;
- int timeout = querySchema.timeoutSpecified ? querySchema.timeout : RowSelection.NoValue;
+ int timeout = string.IsNullOrEmpty(querySchema.timeout) ? RowSelection.NoValue : int.Parse(querySchema.timeout);
int fetchSize = querySchema.fetchsizeSpecified ? querySchema.fetchsize : -1;
bool readOnly = querySchema.readonlySpecified ? querySchema.@readonly : false;
string comment = null;
View
6 src/NHibernate/Cfg/XmlHbmBinding/NamedSQLQueryBinder.cs
@@ -23,13 +23,13 @@ public void AddSqlQuery(HbmSqlQuery querySchema)
{
string queryName = querySchema.name;
string queryText = querySchema.GetText();
- bool cacheable = querySchema.cacheableSpecified ? querySchema.cacheable: false;
+ bool cacheable = querySchema.cacheable;
string region = querySchema.cacheregion;
- int timeout = querySchema.timeoutSpecified ? querySchema.timeout : RowSelection.NoValue;
+ int timeout = string.IsNullOrEmpty(querySchema.timeout) ? RowSelection.NoValue : int.Parse(querySchema.timeout);
int fetchSize = querySchema.fetchsizeSpecified ? querySchema.fetchsize : -1;
bool readOnly = querySchema.readonlySpecified ? querySchema.@readonly : false;
string comment = null;
- bool callable = querySchema.callableSpecified ? querySchema.callable : false;
+ bool callable = querySchema.callable;
string resultSetRef = querySchema.resultsetref;
FlushMode flushMode = FlushModeConverter.GetFlushMode(querySchema);
View
4 src/NHibernate/Cfg/XmlHbmBinding/ResultSetMappingBinder.cs
@@ -118,7 +118,7 @@ private NativeSQLQueryJoinReturn CreateJoinReturn(HbmReturnJoin returnJoinSchema
string roleProperty = returnJoinSchema.property.Substring(dot + 1);
//FIXME: get the PersistentClass
- IDictionary<string, string[]> propertyResults = BindPropertyResults(returnJoinSchema.alias, null, returnJoinSchema.Items, null);
+ IDictionary<string, string[]> propertyResults = BindPropertyResults(returnJoinSchema.alias, null, returnJoinSchema.returnproperty, null);
return new NativeSQLQueryJoinReturn(returnJoinSchema.alias, roleOwnerAlias, roleProperty,
propertyResults, // TODO: bindpropertyresults(alias, returnElem)
@@ -139,7 +139,7 @@ private NativeSQLQueryCollectionReturn CreateLoadCollectionReturn(HbmLoadCollect
string ownerPropertyName = loadCollectionSchema.role.Substring(dot + 1);
//FIXME: get the PersistentClass
- IDictionary<string, string[]> propertyResults = BindPropertyResults(loadCollectionSchema.alias, null, loadCollectionSchema.Items, null);
+ IDictionary<string, string[]> propertyResults = BindPropertyResults(loadCollectionSchema.alias, null, loadCollectionSchema.returnproperty, null);
return new NativeSQLQueryCollectionReturn(loadCollectionSchema.alias, ownerClassName, ownerPropertyName,
propertyResults, GetLockMode(loadCollectionSchema.lockmode));
View
11 src/NHibernate/Cfg/XmlHbmBinding/RootClassBinder.cs
@@ -44,7 +44,7 @@ public void Bind(XmlNode node, HbmClass classSchema)
rootClass.IsExplicitPolymorphism = classSchema.polymorphism == HbmPolymorphismType.Explicit;
- BindCache(classSchema.Cache, rootClass);
+ BindCache(classSchema.cache, rootClass);
new ClassIdBinder(this).BindId(classSchema.Id, rootClass, table);
new ClassCompositeIdBinder(this).BindCompositeId(classSchema.CompositeId, rootClass);
new ClassDiscriminatorBinder(this).BindDiscriminator(classSchema.discriminator, rootClass, table);
@@ -86,8 +86,7 @@ private void BindTimestamp(HbmTimestamp timestampSchema, PersistentClass rootCla
if (property.Generation == PropertyGeneration.Insert)
throw new MappingException("'generated' attribute cannot be 'insert' for versioning property");
-
- simpleValue.NullValue = timestampSchema.unsavedvalue;
+ simpleValue.NullValue = timestampSchema.unsavedvalue == HbmTimestampUnsavedvalue.Null ? null : "undefined";
rootClass.Version = property;
rootClass.AddProperty(property);
}
@@ -225,12 +224,12 @@ private void BindColumns(HbmVersion versionSchema, SimpleValue model, bool isNul
{
Table table = model.Table;
- if (versionSchema.column != null)
+ if (versionSchema.column1 != null)
{
Column col = new Column();
col.Value = model;
BindColumn(col, isNullable);
- col.Name = mappings.NamingStrategy.ColumnName(versionSchema.column);
+ col.Name = mappings.NamingStrategy.ColumnName(versionSchema.column1);
if (table != null)
table.AddColumn(col);
@@ -295,7 +294,7 @@ public static void MakeVersion(XmlNode node, SimpleValue model)
model.NullValue = null;
}
- private static void BindCache(HbmCacheType cacheSchema, RootClass rootClass)
+ private static void BindCache(HbmCache cacheSchema, RootClass rootClass)
{
if (cacheSchema != null)
{
View
6 src/NHibernate/Engine/UnsavedValueFactory.cs
@@ -62,14 +62,10 @@ private static object Instantiate(ConstructorInfo constructor)
{
return IdentifierValue.SaveNull;
}
- // TODO: H3 only, IdentifierValue.IsUnsaved may return true/false/null in H3
- // and SaveUndefined always returns null.
- /*
else if( "undefined" == unsavedValue )
{
- return Cascades.IdentifierValue.SaveUndefined;
+ return IdentifierValue.Undefined;
}
- */
else if ("none" == unsavedValue)
{
return IdentifierValue.SaveNone;
View
7 src/NHibernate/NHibernate-2.0.csproj
@@ -422,9 +422,6 @@
<Compile Include="WrongClassException.cs" />
</ItemGroup>
<ItemGroup>
- <EmbeddedResource Include="nhibernate-generic.xsd">
- <SubType>Designer</SubType>
- </EmbeddedResource>
<Compile Include="Action\BulkOperationCleanupAction.cs" />
<Compile Include="Action\CollectionAction.cs" />
<Compile Include="Action\CollectionRecreateAction.cs" />
@@ -493,7 +490,6 @@
<Compile Include="Cfg\MappingSchema\HbmBase.cs" />
<Compile Include="Cfg\MappingSchema\HbmClass.cs" />
<Compile Include="Cfg\MappingSchema\HbmDatabaseObject.cs" />
- <Compile Include="Cfg\MappingSchema\HbmDefinition.cs" />
<Compile Include="Cfg\MappingSchema\HbmMapping.cs" />
<Compile Include="Cfg\MappingSchema\HbmMeta.cs" />
<Compile Include="Cfg\MappingSchema\HbmParam.cs" />
@@ -1076,9 +1072,6 @@
<None Include="nhibernate-configuration.xsx">
<DependentUpon>nhibernate-configuration.xsd</DependentUpon>
</None>
- <None Include="nhibernate-generic.xsx">
- <DependentUpon>nhibernate-generic.xsd</DependentUpon>
- </None>
<EmbeddedResource Include="nhibernate-mapping.xsd">
<SubType>Designer</SubType>
</EmbeddedResource>
View
177 src/NHibernate/nhibernate-generic.xsd
@@ -1,177 +0,0 @@
-<xs:schema xmlns:xs='http://www.w3.org/2001/XMLSchema'>
- <xs:annotation>
- -- This schema was automatically generated by Syntext Dtd2Schema --
- -- conversion tool (from file: hibernate-generic.dtd) --
- -- Copyright (C) 2002, 2003 Syntext Inc. See http://www.syntext.com for updates. --
- </xs:annotation>
- <xs:element name='array'>
- <xs:complexType>
- <xs:sequence>
- <xs:choice minOccurs='0' maxOccurs='unbounded'>
- <xs:element ref='element'/>
- <xs:element ref='subcollection'/>
- <xs:element ref='composite-element'/>
- <xs:element ref='array'/>
- </xs:choice>
- </xs:sequence>
- <xs:attribute name='element-type'/>
- <xs:attribute name='index-type'/>
- <xs:attribute name='role'/>
- <xs:attribute name='name' use='required'/>
- </xs:complexType>
- </xs:element>
- <xs:element name='collection'>
- <xs:complexType>
- <xs:sequence>
- <xs:choice minOccurs='0' maxOccurs='unbounded'>
- <xs:element ref='element'/>
- <xs:element ref='subcollection'/>
- <xs:element ref='composite-element'/>
- <xs:element ref='array'/>
- </xs:choice>
- </xs:sequence>
- <xs:attribute name='class'/>
- <xs:attribute name='element-type'/>
- <xs:attribute name='index-type'/>
- <xs:attribute name='role'/>
- <xs:attribute name='name' use='required'/>
- <xs:attribute name='lazy'>
- <xs:simpleType>
- <xs:restriction base='xs:string'>
- <xs:enumeration value='initialized'/>
- <xs:enumeration value='uninitialized'/>
- <xs:enumeration value='now-initialized'/>
- </xs:restriction>
- </xs:simpleType>
- </xs:attribute>
- </xs:complexType>
- </xs:element>
- <xs:element name='component'>
- <xs:complexType>
- <xs:sequence>
- <xs:choice minOccurs='0' maxOccurs='unbounded'>
- <xs:element ref='property'/>
- <xs:element ref='component'/>
- <xs:element ref='collection'/>
- <xs:element ref='array'/>
- </xs:choice>
- </xs:sequence>
- <xs:attribute name='class'/>
- <xs:attribute name='name' use='required'/>
- </xs:complexType>
- </xs:element>
- <xs:element name='composite-element'>
- <xs:complexType>
- <xs:sequence>
- <xs:choice minOccurs='0' maxOccurs='unbounded'>
- <xs:element ref='property'/>
- <xs:element ref='component'/>
- <xs:element ref='collection'/>
- <xs:element ref='array'/>
- </xs:choice>
- </xs:sequence>
- <xs:attribute name='class'/>
- <xs:attribute name='index'/>
- </xs:complexType>
- </xs:element>
- <xs:element name='element'>
- <xs:complexType mixed='true'>
- <xs:attribute name='index'/>
- <xs:attribute name='class'/>
- <xs:attribute name='package'/>
- <xs:attribute name='proxy'>
- <xs:simpleType>
- <xs:restriction base='xs:string'>
- <xs:enumeration value='initialized'/>
- <xs:enumeration value='uninitialized'/>
- <xs:enumeration value='now-initialized'/>
- </xs:restriction>
- </xs:simpleType>
- </xs:attribute>
- <xs:attribute name='uid'/>
- </xs:complexType>
- </xs:element>
- <xs:element name='hibernate-generic'>
- <xs:complexType>
- <xs:sequence>
- <xs:element ref='object' minOccurs='0' maxOccurs='unbounded'/>
- </xs:sequence>
- <xs:attribute name='datetime'/>
- </xs:complexType>
- </xs:element>
- <xs:element name='object'>
- <xs:complexType>
- <xs:sequence>
- <xs:element ref='uid' minOccurs='0'/>
- <xs:choice minOccurs='0' maxOccurs='unbounded'>
- <xs:element ref='property'/>
- <xs:element ref='component'/>
- <xs:element ref='collection'/>
- <xs:element ref='array'/>
- </xs:choice>
- </xs:sequence>
- <xs:attribute name='class' use='required'/>
- <xs:attribute name='package' use='required'/>
- <xs:attribute name='proxy'>
- <xs:simpleType>
- <xs:restriction base='xs:string'>
- <xs:enumeration value='initialized'/>
- <xs:enumeration value='uninitialized'/>
- <xs:enumeration value='now-initialized'/>
- </xs:restriction>
- </xs:simpleType>
- </xs:attribute>
- <xs:attribute name='uid'/>
- </xs:complexType>
- </xs:element>
- <xs:element name='property'>
- <xs:complexType mixed='true'>
- <xs:attribute name='name' use='required'/>
- <xs:attribute name='type'/>
- <xs:attribute name='class'/>
- <xs:attribute name='package'/>
- <xs:attribute name='proxy'>
- <xs:simpleType>
- <xs:restriction base='xs:string'>
- <xs:enumeration value='initialized'/>
- <xs:enumeration value='uninitialized'/>
- <xs:enumeration value='now-initialized'/>
- </xs:restriction>
- </xs:simpleType>
- </xs:attribute>
- <xs:attribute name='uid'/>
- </xs:complexType>
- </xs:element>
- <xs:element name='subcollection'>
- <xs:complexType>
- <xs:sequence>
- <xs:choice minOccurs='0' maxOccurs='unbounded'>
- <xs:element ref='element'/>
- <xs:element ref='subcollection'/>
- <xs:element ref='composite-element'/>
- <xs:element ref='array'/>
- </xs:choice>
- </xs:sequence>
- <xs:attribute name='class'/>
- <xs:attribute name='element-type'/>
- <xs:attribute name='index-type'/>
- <xs:attribute name='role'/>
- <xs:attribute name='index'/>
- <xs:attribute name='lazy'>
- <xs:simpleType>
- <xs:restriction base='xs:string'>
- <xs:enumeration value='initialized'/>
- <xs:enumeration value='uninitialized'/>
- <xs:enumeration value='now-initialized'/>
- </xs:restriction>
- </xs:simpleType>
- </xs:attribute>
- </xs:complexType>
- </xs:element>
- <xs:element name='uid'>
- <xs:complexType mixed='true'>
- <xs:attribute name='type'/>
- <xs:attribute name='name'/>
- </xs:complexType>
- </xs:element>
-</xs:schema>
View
2,066 src/NHibernate/nhibernate-mapping.xsd
1,222 additions, 844 deletions not shown because the diff is too large. Please use a local Git client to view these changes.

0 comments on commit 69ee312

Please sign in to comment.