Home JPA equivalent for Hibernate NamedQuery's setCharacter(..), setDate(..) etc...?
Reply: 0

JPA equivalent for Hibernate NamedQuery's setCharacter(..), setDate(..) etc...?

user9005
1#
user9005 Published in September 20, 2018, 12:45 pm

I want to set Date and Character in JPA. There are special methods in Hibernate as below:

Query q = session.getNamedQuery(namedQuery);
q.setDate(0, (Date) (params[i]));
q.setCharacter(1, params[i]);
q.executeUpdate();

Is there anything in JPA as setCharacter()?

I know there is setParameter() with Date but I do not know how to do it with Character. I want to convert it into JPA query parameter like:

Query q = getEntityManager().createNamedQuery(namedQuery);
// How to set Date and Character in JPA ?
...
q.executeUpdate();
share|improve this question
  • If you have a parameter that is a Character then you call setParameter and pass a Character in! – user8558216 Feb 13 at 11:23
  • @DN1 but it takes as object using setParameter – useless'MJ Feb 13 at 11:25
  • and a Character is an Object ... – user8558216 Feb 13 at 11:26
  • Ya but i have to differentiate it in to string,Date or Char using condition.. – useless'MJ Feb 13 at 11:28
  • No idea what you mean by "differentiate it". If the query takes a String pass a String, if it takes a Character pass a Character, etc etc – user8558216 Feb 13 at 11:31

1 Answer 1

active oldest votes
up vote 1 down vote accepted
You need to login account before you can post.

About| Privacy statement| Terms of Service| Advertising| Contact us| Help| Sitemap|
Processed in 0.435939 second(s) , Gzip On .

© 2016 Powered by mzan.com design MATCHINFO