1.4.1. | I would like to have dynamic control over fetch groups at runtime. Is this possible? |
Yes, using custom fetch groups, or simply by adding the fields you want fetched to Kodo's internal fetch plan. See Section 5.6, “Fetch Groups”. | |
1.4.2. |
I want to decouple a persistent instance from its
|
There are a number of ways to decouple an instance from
the | |
1.4.3. | Can I see the SQL that Kodo is issuing to the database? |
Yes. You can enable the SQL logging channel to see all the SQL statements that are sent from the database. You can also enable the JDBC channel to see most of the JDBC operations (such as commit and rollback operations) that are exectued. For details on logging configuration, see Chapter 3, Logging. | |
1.4.4. | Can Kodo use my existing logging framework instead of its own? |
Yes. Kodo has built-in support for Log4J and the Apache
Commons Logging frameworks. In turn, the Commons Logging
framework can be configured to use JDK
1.4 | |
1.4.5. | I would like to execute my queries in raw SQL. Is this possible? |
Yes. You can execute queries in raw SQL and get the results back as either persistent objects, value arrays, or data structs. For executing SQL queries through the JPA, see Chapter 11, SQL Queries. For executing SQL queries through the JDO API, see Chapter 17, SQL Queries. | |
1.4.6. |
How do I issue a query against a |
You need to use a parameter to the query. For details, see Section 11.2, “JDOQL”. An example of this is: | |
1.4.7. | When is the object id available to be read when creating a new persistent instance? |
When you first ask for the object id (via standard APIs or by reading a primary key field), or on flush - whatever happens first. In fact, if the identity of your object depends on auto-increment columns, asking for the object id can cause an implicit flush to get the database-generated primary key value(s). Once you have flushed or retrieved the id of an object, that id is permanent. If the object uses application identity, attempting to change any primary key fields will cause an exception. | |
1.4.8. | How do I do query-by-example in Kodo? |
You can provide a template object for Kodo to compare to by using a non-persistent parameter to a query. See Example 11.8, “Query By Example” for details on how this works in JDO. |