Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » EclipseLink » Query Money/BigDecimal Datatype(Query Money/BigDecimal Datatype)
Query Money/BigDecimal Datatype [message #990849] Fri, 14 December 2012 12:59 Go to next message
sahkiuvl v is currently offline sahkiuvl vFriend
Messages: 1
Registered: December 2012
Junior Member


I am trying to query a table for finding a MRP price.

BigDecimal mpr = 5.5;

Query query = em.createQuery("SELECT p FROM Product p WHERE p.mrp=:mrp");
query.set("mrp",mrp);


in the above i get a error

Caused by: org.postgresql.util.PSQLException: ERROR: operator does not exist: money = numeric


in normal sql syntax i would be using

select * FROM a.product WHERE mpr='5.5';


So now my question is how do i frame the search for a Money DataType in the database.
Re: Query Money/BigDecimal Datatype [message #991520 is a reply to message #990849] Wed, 19 December 2012 16:32 Go to previous message
James Sutherland is currently offline James SutherlandFriend
Messages: 1939
Registered: July 2009
Location: Ottawa, Canada
Senior Member

I would recommend using NUMERIC instead of MONEY.

Postgres does not seem to allow BigDecimal to be bound to a MONEY column, you will need to figure out what type is wants, and use a Converter to convert to this type.

You could also disable parameter binding for this query ("eclipselink.jdbc.bind-parameters"="false"), as dynamic queries seem to work.


James : Wiki : Book : Blog : Twitter
Previous Topic:Multitenancy + Tenants hierarchy
Next Topic:hooks
Goto Forum:
  


Current Time: Fri Apr 26 09:15:46 GMT 2024

Powered by FUDForum. Page generated in 0.03205 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top