java - org.hibernate.QueryException: Not all named parameters have been set:[] -


i'm getting extremely strange behavior out of jpa 2.0

i'm trying build query looks likes, employeid , empdepartment long values passing through java arguments

query query=em.createquery("select e employee e e.empid = :empid , e.empdepartment = :empdepartment"); query.setparameter("empid" ,employeid); query.setparameter("empdepartment",empdepartment); 

but above query doesnt work first time, generating above error when second time trigged same method again every thing went smoothly, happens each , every time, reason it?

you try this:

query query=em.createquery("select e employee e e.empid = ? ,  e.empdepartment = ?"); query.setparameter(1, employeid); query.setparameter(2, empdepartment); 

if not working either, there can problem query content well, not replacement of parameters. maybe the types not correct. parameter type inferred context.


Comments

Popular posts from this blog

css - Which browser returns the correct result for getBoundingClientRect of an SVG element? -

gcc - Calling fftR4() in c from assembly -

.htaccess - Matching full URL in RewriteCond -