| Oracle® Containers for J2EE Enterprise JavaBeans Developer's Guide 10g Release 3 (10.1.3) B14428-01 |
|
![]() Previous |
![]() Next |
Using EntityManager methods createQuery and createNativeQuery(String sqlString, Class resultType), you can create a Query object dynamically at runtime (see "Using Java").
Using the Query methods getResultList, getSingleResult, or executeUpdate you can execute the query (see "Executing a Query").
For more information, see:
"Creating a Dynamic TopLink Expression Query with the EntityManager"
"Creating a Dynamic Native SQL Query with the EntityManager"
Example 8-4 shows how to create a dynamic EJB QL query with parameters and how to execute the query. In this example, the query returns multiple results so we use Query method getResultList.