-->
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.  [ 1 post ] 
Author Message
 Post subject: problem with BigDecimal values
PostPosted: Sun Aug 23, 2009 10:32 am 
Newbie

Joined: Fri Feb 27, 2009 10:38 pm
Posts: 2
Hi forum,

When I use big decimal values I can't find record into database... but if I use float objects works...

hibernate 3.2.6.ga
hibernate-annotations 3.3.1.GA
hibernate-commons-annotations 3.3.0.ga
hibernate-validator 3.0.0.ga

Oracle XE with Oracle10gDialect or OracleDialect...

Code:
   @Column(name = "salary", nullable = true, precision = 8, scale = 2, columnDefinition="NUMBER(8,2)")
   private BigDecimal salary;


Code:
   Employee employee = new Employee();
   employee.setId(3);
   employee.setSalary(new BigDecimal(10.19));

   employeeDAO.put(employee); // save object

   List<Employee> res = employeeDAO.findByExample(employee); // object not found


Code:
   @SuppressWarnings("unchecked")
   public List<T> findByExample(final T example) {
      return getHibernateTemplate().executeFind(new HibernateCallback() {
         public Object doInHibernate(Session session)
               throws HibernateException, SQLException {
            Criteria c = session.createCriteria(clazz);
            c.add(Example.create(example).enableLike(MatchMode.ANYWHERE).ignoreCase());
            return c.list();
         }
      });
   }


Thanks very much for any thoughts or comments,
Lucas


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

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.