Win a copy of The Little Book of Impediments (e-book only) this week in the Agile and Other Processes forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

JPQL/ SQL return Entity/ db record

 
Deepika Joshi
Ranch Hand
Posts: 268
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
EJB 3 in Action

page 342,
SQL query returns database records and a JPA query returns entities.

page 345,
public Query createNativeQuery(String sqlString,Class result-class);
Creates a dynamic query using a native SQL statement that retrieves a single entity type.

public Query createNativeQuery(String sqlString,String result-setMapping);
Creates a dynamic query using a native SQL statement that retrieves a result set with multiple entity types.

As per statement on 342, I thought it would be db record (resultset) kind thing but instead 345 says Entity/ Entities....
 
Niranjan Deshpande
Ranch Hand
Posts: 1277
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Deepika,

Statement on page 342 is to distinguish SQL v/s JPQL. Hence it's says SQL queries (when executed against a database) return db records, while JPQL queries return entities.

Now, the methods on page 345, they execute a native sql. But note that it's been executed as a EJB3.0 query. Hence the statement 'it returns an entity type'

hth..
 
Deepika Joshi
Ranch Hand
Posts: 268
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
yes ih
thanks....
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic