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 07:59 Go to next message
sahkiuvl v is currently offline sahkiuvl v
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 11:32 Go to previous message
James Sutherland is currently offline James Sutherland
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 Aug 01 11:58:39 EDT 2014

Powered by FUDForum. Page generated in 0.02037 seconds