-->
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.  [ 2 posts ] 
Author Message
 Post subject: Hibernate maps id property to BigDecimal
PostPosted: Mon Jul 11, 2011 12:59 pm 
Newbie

Joined: Mon Jul 11, 2011 12:52 pm
Posts: 1
Hello all,

I searched about the problem, could not find a exact solution. The hibernate version is 3.2.6.

There is a Product entity. Its id property is defined as:

@Table(schema = "AAAA", name = "PRODUCT")
public class Product implements Serializable {
private static final long serialVersionUID = 1L;


@Column(name = "ID", nullable = false)
@Basic(fetch = FetchType.EAGER)
@Id
Integer id;
......

When I run a native query, it returns me a list of BigDecimal instead of Integer.

Query nQuery=entityManager.createNativeQuery("Select id from Product");
List<Object> result=nQuery.getResultList();

The result is [2002], but its type is BigDecimal.

Can you please help?


Top
 Profile  
 
 Post subject: Re: Hibernate maps id property to BigDecimal
PostPosted: Wed Jan 04, 2012 11:14 am 
Newbie

Joined: Wed Oct 27, 2010 11:13 am
Posts: 7
Hi- Did you ever find out why? I'm facing a similar issue; id is defined as Long, however, getEntityManager().createNativeQuery() returns BigDecimal instead of Long.


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 2 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.