Caused by: org.postgresql.util.PSQLException: ERROR: syntax error at or near "merge".

2018-03-07 Thread Vinodh NV
Sir,

I am facing the error Caused by: org.postgresql.util.PSQLException: ERROR:
syntax error at or near "merge". when I execute the below  query in
postgres database. The same works fine in Oracle.

merge into net n using dual on (n.id=:id) when matched then update set
Status=:status, lastStatusDate=:lastStatusDate, errorMessage=:errorMessage,
errorDetails=:errorDetails when not matched then insert (id,Status,
lastStatusDate, errorMessage, errorDetails) values
(:id,:status,:lastStatusDate,:errorMessage,:errorDetails)";


Can you please let me know how to resolve it?

Thanks,
Vinodh.


Require assistance in Postgres + Hibernate : Error: java.math.BigInteger cannot be cast to java.math.BigDecimal

2018-02-13 Thread Vinodh NV
Hi,

Require assistance on the below:

Code snippet:
Map ic;
//Populate values for ic
long count = ((BigDecimal)ic.get(“EB”)).longValue();


Getting the below error:
java.math.BigInteger cannot be cast to java.math.BigDecimal
®java.lang.ClassCastException: java.math.BigInteger cannot be cast to
java.math.BigDecimal

Since this is not part of a query doing select cast (EB as bigint) will not
help in this case:

Can u let me know the solution for this?

Regards,
Vinodh


Re: Require assistance in Postgres + Hibernate : Error: java.math.BigInteger cannot be cast to java.math.BigDecimal

2018-02-13 Thread Vinodh NV
Thanks for the update Francisco. I had one more query:
In Oracle the syntax for calling a stored procedure is
   Session sess = (Session) entityManager.getDelegate();
sess.createSQLQuery("{ call reset() }").executeUpdate();

Can you please let me know if the below equivalent for postgres is correct?
   Session sess = (Session) entityManager.getDelegate();
sess.createSQLQuery("select reset()");

Regards,
Vinodh



On Tue, Feb 13, 2018 at 5:12 PM, Francisco Olarte 
wrote:

> On Tue, Feb 13, 2018 at 12:39 PM, rob stone  wrote:
> >> long count = ((BigDecimal)ic.get(“EB”)).longValue();
> ..
> > The method is documented as:-
> > public static BigDecimal valueOf(long val)
>
> His problem seems to be the opposit, he does not have the long value
> and wants it.
>
> Francisco Olarte.
>


Postgres hangs for the query "lock table in exclusive mode"

2018-02-22 Thread Vinodh NV
Hi,


Postgres hangs for the query "lock table  in exclusive mode"
Can you please let me know what could be the reason and how to resolve it?


Regards,
Vinodh.