-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 4 posts ] 
Author Message
 Post subject: Problem with precision/scale and big_decimal on PostgreSQL 8
PostPosted: Mon Jul 11, 2005 9:45 pm 
Newbie

Joined: Tue Jul 05, 2005 11:47 pm
Posts: 15
Location: Argentina
Hello,

I'm rather new to Hibernate and I am having problems mapping BigDecimals to a PostgreSQL database. While Hibernate maps them correctly to numerics, it seems to ignore my precision/scale specification completely. I also tried to used the length parameter instead of precision, but the outcome is the same. I searched the web and this forum but no one seems to be having the same problem, so it has to be something I am doing wrong and I fail to realize what it is.

Any help would be really appreciated.

Regards,

Diego

-----

Hibernate version:
3.0.5

Mapping documents:

This is the xml file for the mapping:
Code:
<?xml version="1.0"?>
<!DOCTYPE hibernate-mapping PUBLIC
   "-//Hibernate/Hibernate Mapping DTD 3.0//EN"
   "http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">

<hibernate-mapping>
    <class name="com.anankesoftware.test.TestClass" table="testclass">
        <id name="id" column="id" access="field">
            <generator class="sequence"/>
        </id>
        <property name="aBigDecimal" type="big_decimal" column="a_big_decimal" precision="10" scale="2"/> 
    </class>
</hibernate-mapping>


This is the class I am trying to map:
Code:
public class TestClass {
    private long id;
    private BigDecimal aBigDecimal;

    public BigDecimal getaBigDecimal() {
        return aBigDecimal;
    }

    public void setaBigDecimal(BigDecimal aBigDecimal) {
        this.aBigDecimal = aBigDecimal;
    }

    public TestClass() {
    }
}


This is the table it generates:
Code:
CREATE TABLE testclass
(
  id int8 NOT NULL,
  a_big_decimal numeric,
  CONSTRAINT testclass_pkey PRIMARY KEY (id)
)



Name and version of the database you are using:
PostgreSQL 8.0.2


Top
 Profile  
 
 Post subject:
PostPosted: Mon Jul 11, 2005 9:56 pm 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 12:50 pm
Posts: 5130
Location: Melbourne, Australia
oops, fixed in cvs


Top
 Profile  
 
 Post subject:
PostPosted: Mon Jul 11, 2005 10:02 pm 
Newbie

Joined: Tue Jul 05, 2005 11:47 pm
Posts: 15
Location: Argentina
Thank you very much, you saved the rest of my hair :)


Top
 Profile  
 
 Post subject:
PostPosted: Fri Sep 09, 2005 11:54 am 
Newbie

Joined: Fri Sep 09, 2005 11:47 am
Posts: 4
gavin wrote:
oops, fixed in cvs


Hi,

I'm totally new to Hibernate, and I'm facing this problem with Hibernate 3.05 and Postgresql 8.03.
You said that this has been fixed in CVS: if I download 3.1 beta2 I'll get this patch too?

Thanks a lot,

Giovanni


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 4 posts ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.