Iam trying get records from DB based on request parameter. Here is my code
at line 1 iam getting exception:
com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: Unknown column 'O0001' in 'where clause'
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)...........
I executed same Query in MySQL, there it is working, and the Query is SELECT * FROM tablename WHERE id='O0001'; How will i write same Query(passing request parameter instead of entering manually) in createQuery()
Iam new to Hibernate. Can someone help me in finding the solution.
Please UseCodeTags when posting code or configuration. I have added them for you this time so you can see the difference in readability.
Try using named parameters.
This assumes that your OrderBean object has a property named 'id' also if this is the case are you really expecting a list here or a single result. If the latter have a look at doing something like this instead.