File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes JDBC and Relational Databases and the fly likes Select all row values using JPA Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Head First Android this week in the Android forum!
JavaRanch » Java Forums » Databases » JDBC and Relational Databases
Bookmark "Select all row values using JPA" Watch "Select all row values using JPA" New topic
Author

Select all row values using JPA

Eswar Nec
Ranch Hand

Joined: May 02, 2010
Posts: 105
Hi,
I retrieve all records from table using JPA.
1. I use the following query.

The above line give the exception. The exception is
org.hibernate.hql.ast.QuerySyntaxException: unexpected token: * near line 1, column 8 [SELECT * FROM samplejpa.entities.UMUserType]

2. But I use the follwing query, it will give the perfect result


Why the first one give the exception..What is difference between 1 & 2

Thanks in advance


Wake up! Don't let your smile be snatched away by anybody!
Regards, Eswar
Christophe Verré
Sheriff

Joined: Nov 24, 2005
Posts: 14688
    
  16

The first one is not a JPA query, it's a native query.


[My Blog]
All roads lead to JavaRanch
Eswar Nec
Ranch Hand

Joined: May 02, 2010
Posts: 105
Thanks for your response.
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: Select all row values using JPA
 
It's not a secret anymore!