# diffDatabaseToChangeLog problem with Decimal

**URL:** <https://forum.liquibase.org/t/diffdatabasetochangelog-problem-with-decimal/1552>\
**Category:** General Discussion\
**Created:** [July 12, 2011, 1:36am UTC](https://forum.liquibase.org/t/diffdatabasetochangelog-problem-with-decimal/1552 "2011-07-12T01:36:00Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![emiliobg](https://avatars.discourse-cdn.com/v4/letter/e/ea666f/32.png) [@emiliobg](https://forum.liquibase.org/u/emiliobg)\
**Post date:** [July 12, 2011, 1:36am UTC](https://forum.liquibase.org/t/diffdatabasetochangelog-problem-with-decimal/1552/1 "2011-07-12T01:36:00Z")

</div>

Hi Nathan, thanks for the reply.

currently use hbm2ddl for generate sql, but I want to change liquibase.

BigDecimal error occurs when run diffDatabaseToChangeLog between 2 schemas from the database. I have a schema with the latest version of the database in development and another with the production version.

---

<div class="post-metadata">

**Author:** ![emiliobg](https://avatars.discourse-cdn.com/v4/letter/e/ea666f/32.png) [@emiliobg](https://forum.liquibase.org/u/emiliobg)\
**Post date:** [July 12, 2011, 1:36am UTC](https://forum.liquibase.org/t/diffdatabasetochangelog-problem-with-decimal/1552/2 "2011-07-12T01:36:00Z")

</div>

Is there any way to use&nbsp;liquibae&nbsp;if I use hibernate with usertype?

any idea?

---

<div class="post-metadata">

**Author:** ![emiliobg](https://avatars.discourse-cdn.com/v4/letter/e/ea666f/32.png) [@emiliobg](https://forum.liquibase.org/u/emiliobg)\
**Post date:** [July 12, 2011, 1:36am UTC](https://forum.liquibase.org/t/diffdatabasetochangelog-problem-with-decimal/1552/3 "2011-07-12T01:36:00Z")

</div>

Actually I have 2 problems

1.- I tried using hibernate diffDatabaseToChangeLog with but as I use usertype &nbsp;I get an error.

Is there any way to use liquibase if I use hibernate usertype?

2.- To get the delta between objects in hibernate and database development, I create the full database in another schema and I use diffDatabaseToChangeLog to get the changelog. doing this gives me the following error:

1. liquibase.exception.UnexpectedLiquibaseException: Unknown object type java.math.BigDecimal

ant task

1. 
2. 
3.  

any idea?

I use MySQL 5.1, the data type is&nbsp;DECIMAL(15,3),

liquibase-2.0.1.jar

liquibase-hibernate-2.0.0.jar

---

<div class="post-metadata">

**Author:** ![nvoxland](https://avatars.discourse-cdn.com/v4/letter/n/87869e/32.png) [@nvoxland](https://forum.liquibase.org/u/nvoxland)\
**Post date:** [July 12, 2011, 1:36am UTC](https://forum.liquibase.org/t/diffdatabasetochangelog-problem-with-decimal/1552/4 "2011-07-12T01:36:00Z")

</div>

Unfortunately, the hibernate diff may not work with usertypes. I have not tried them, so we may need to do something specific, beyond the standard hbm2ddl logic we normally use. Is the BigDecimal error in question #2 the error you were seeing due to the usertype?  
  
Nathan

---

<div class="post-metadata">

**Author:** ![sonata82](https://avatars.discourse-cdn.com/v4/letter/s/45deac/32.png) [@sonata82](https://forum.liquibase.org/u/sonata82)\
**Post date:** [July 12, 2011, 1:36am UTC](https://forum.liquibase.org/t/diffdatabasetochangelog-problem-with-decimal/1552/5 "2011-07-12T01:36:00Z")

</div>

I had the same error while comparing two schemas.&nbsp;

One schema had an extra NUMERIC column which contained a default value of 0. This was translated two java.math.BigDecimal, but while creating the “MissingColumnChange” the datatype has to be transferred back to a database type, which for BigDecimal throws an exception.

I extended the getDataType method to return getNumberType in case of object being an instanceof BigDecimal. So far, the problem seems to be solved.

---

<div class="post-metadata">

**Author:** ![Guest](https://avatars.discourse-cdn.com/v4/letter/g/8dc957/32.png) [@Guest](https://forum.liquibase.org/u/Guest)\
**Post date:** [July 12, 2011, 1:36am UTC](https://forum.liquibase.org/t/diffdatabasetochangelog-problem-with-decimal/1552/6 "2011-07-12T01:36:00Z")

</div>

I experienced the same issue without using it with Hibernate, on postgres.  
  
The original schema has a new field, type double not null default 0.00. When I run the diffChangeLog I receive:  
  
Liquibase Update Failed: Unknown object type java.math.BigDecimal  
SEVERE 10/3/12 9:47 AM:liquibase: Unknown object type java.math.BigDecimal  
liquibase.exception.UnexpectedLiquibaseException: Unknown object type java.math.BigDecimal  
&nbsp;&nbsp;&nbsp; at liquibase.database.typeconversion.core.AbstractTypeConverter.getDataType(AbstractTypeConverter.java:60)  
&nbsp;&nbsp;&nbsp; at liquibase.diff.DiffResult.addMissingColumnChanges(DiffResult.java:856)  
&nbsp;&nbsp;&nbsp; at liquibase.diff.DiffResult.printChangeLog(DiffResult.java:484)  
&nbsp;&nbsp;&nbsp; at liquibase.diff.DiffResult.printChangeLog(DiffResult.java:411)  
&nbsp;&nbsp;&nbsp; at liquibase.integration.commandline.CommandLineUtils.doDiffToChangeLog(CommandLineUtils.java:134)  
&nbsp;&nbsp;&nbsp; at liquibase.integration.commandline.Main.doMigration(Main.java:757)  
&nbsp;&nbsp;&nbsp; at liquibase.integration.commandline.Main.main(Main.java:134)  
  
It succeeded when I removed both the default value and the “not null” constraint.

---

<div class="post-metadata">

**Author:** ![rahulsom](https://avatars.discourse-cdn.com/v4/letter/r/a9a28c/32.png) [@rahulsom](https://forum.liquibase.org/u/rahulsom)\
**Post date:** [July 12, 2011, 1:36am UTC](https://forum.liquibase.org/t/diffdatabasetochangelog-problem-with-decimal/1552/7 "2011-07-12T01:36:00Z")

</div>

I’m running into this after I created several domain classes in grails. It would be helpful if the exception points out where in the changelog the problem is. Right now I am clueless.
