Which one is better among following(EJB 3 JPA)
//Query
a). getEntityManager().createQuery(\"select o from User o\");
//Named Query where
Named queries are the same as queries. They are named only to let them be reusable + they can be declared in various places eg. in class mappings, conf files etc(so you can change query without changing actaul code)
Native queries are just native queries right, you have to do all the things that JPA Queries do for you eg. Binding and quoting values etc. + they use DBMP independent syntax (JPQL in your case) so changing database system (lets saq from MySQL to Postgresql or H2) will require less work as it does not (not always) require to rewrite native queries.