decimal (precision, scale)

20 views
Skip to first unread message

Yitzchok (adminjew)

unread,
Dec 1, 2008, 12:09:52 PM12/1/08
to nhu...@googlegroups.com
Is doing this the only way to get SchemaExport to generate precision, scale? (is there a shorter way)

<property name="SomeName" not-null="false">
      <column name="SomeName" sql-type="decimal(4,2)"/>
</property>



Thanks
Yitzchok

Fabio Maulo

unread,
Dec 1, 2008, 12:35:59 PM12/1/08
to nhu...@googlegroups.com
<property name="something" type="decimal(4,2)" />
don't work ?

not-null=false is the default
for column name the default is the same name of property
sql-type NH know the default sql-type for a given type

2008/12/1 Yitzchok (adminjew) <admi...@gmail.com>



--
Fabio Maulo

Yitzchok (adminjew)

unread,
Dec 1, 2008, 12:47:38 PM12/1/08
to nhu...@googlegroups.com
I tried this first
    <property name="SomeName" type="decimal(4,2)"/>

and I get
NHibernate.MappingException: Could not determine type for: decimal(4,2), for columns: NHibernate.Mapping.Column(SomeName)"

I used <column /> because I needed access to sql-type (so I also have to set the name)

if I use type="Decimal(4,2)" then I get DECIMAL(19,5)

Yitzchok


On Mon, Dec 1, 2008 at 12:35 PM, Fabio Maulo <fabio...@gmail.com> wrote:
decimal(4,2)

Fabio Maulo

unread,
Dec 1, 2008, 12:57:18 PM12/1/08
to nhu...@googlegroups.com
bug.
Probably we forgot to update the XML parser to parse "precision,scale" because I remember that I change the dialect to support it.

2008/12/1 Yitzchok (adminjew) <admi...@gmail.com>



--
Fabio Maulo

Yitzchok (adminjew)

unread,
Dec 1, 2008, 3:56:06 PM12/1/08
to nhu...@googlegroups.com
This is what I found in the source (MsSql2000Dialect.cs Line: 59)

...
            // TODO: figure out if this is the good way to fix the problem
            // with exporting a DECIMAL column
            // NUMERIC(precision, scale) has a hardcoded precision of 19, even though it can range from 1 to 38
            // and the scale has to be 0 <= scale <= precision.
            // I think how I might handle it is keep the type="Decimal(29,5)" and make them specify a
            // sql-type="decimal(20,5)" if they need to do that.  The Decimal parameter and ddl will get generated
            // correctly with minimal work.
            RegisterColumnType(DbType.Decimal, "DECIMAL(19,5)");
...


Should I log this into JIRA?


Yitzchok

Fabio Maulo

unread,
Dec 1, 2008, 4:09:50 PM12/1/08
to nhu...@googlegroups.com
2008/12/1 Yitzchok (adminjew) <admi...@gmail.com>


Should I log this into JIRA?

Yes.
--
Fabio Maulo

Yitzchok (adminjew)

unread,
Dec 1, 2008, 4:37:31 PM12/1/08
to nhu...@googlegroups.com
Here it is

http://jira.nhibernate.org/browse/NH-1594
I added a test case and a patch file


Yitzchok

Fabio Maulo

unread,
Dec 1, 2008, 5:12:49 PM12/1/08
to nhu...@googlegroups.com
2008/12/1 Yitzchok (adminjew) <admi...@gmail.com>

Here it is

http://jira.nhibernate.org/browse/NH-1594
I added a test case and a patch file

This was an example of a very good bug report.
Thanks.
Fabio Maulo
Reply all
Reply to author
Forward
0 new messages