This week's giveaway is in the EJB and other Java EE Technologies forum.
We're giving away four copies of EJB 3 in Action and have Debu Panda, Reza Rahman, Ryan Cuprak, and Michael Remijan on-line!
See this thread for details.
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 EJB 3 in Action this week in the EJB and other Java EE Technologies 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?
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: How to use CreateNativeQuery to query single value from SQL database value?
 
Similar Threads
JPQL
my result holding null values
using string as column name in select query?
How to delete the row from the Database by using while loop in servlet
issue to pass the dynamic value in query