wood burning stoves 2.0*
The moose likes JDBC and the fly likes How to use CreateNativeQuery to query single value from SQL database value? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of The Java EE 7 Tutorial Volume 1 or Volume 2 this week in the Java EE forum
or jQuery UI in Action in the JavaScript forum!
JavaRanch » Java Forums » Databases » JDBC
Bookmark "How to use CreateNativeQuery to query single value from SQL database value?" Watch "How to use CreateNativeQuery to query single value from SQL database value?" New topic
Author

How to use CreateNativeQuery to query single value from SQL database value?

Jan Pahlen
Greenhorn

Joined: Apr 06, 2011
Posts: 1
Hi all,

using a CRUD and want to access a certain value in the databse. what I tried is:

Query query = em.createNativeQuery("select o from Table o where o.IDfield= '938'");
Table o = (Table)query.getSingleResult();

but this fails.

Any suggestions?
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
 
subject: How to use CreateNativeQuery to query single value from SQL database value?