Search |
|||||||||
TopLink Essentials enhancements - category-specific logging level and cascade refresh query hintPosted by guruwons on July 6, 2007 at 7:39 PM PDT
Recently I've implemented two minor but useful features for TopLink Essentials(TLE) v2 b54(or GlassFish v2 b54). One is the category-specific logging level configuration[1] which is useful for who want to see only SQL logs and the other is the cascade refresh query hint[2] which control the cascade scope of the refresh query dynamically.
Let's see what these are... Category-specific logging levelConfiguring logging level for a PU(Persistence Unit) could be done by "toplink.logging.level" property like below.<persistence-unit name="pu1"> To see SQLs triggerred by TLE the logging level should be FINE. However this will print other many FINE logs which may be of little interest to normal users. This is like all-or-nothing choice. Fortunately the logging platform of TLE basically supports categories for different types of logs - "sql", "connection", "transaction" and so on. This enable users to watch interested logs of specific categories. Especially the "sql" category is the most interesting one. However there had been no easy way to configure the logging level for the specific category. So I've added the following new category logging level property and connected it with logger code.
Cascade refresh query hint for refresh queryTLE provides the query hint toplink.refresh to fetch up-to-date entities from database like below. Query query = em.createQuery("SELECT e FROM Employee e WHERE e.id = :id");The associated entities will be refreshed also if they are specified with cascade=REFRESH. However the cascade metadata is static configuration which can not be changed in runtime and there may be some cases to apply different cascade options - do not cascade or cascade to all associations from time to time regardless of predefined cascade option. That is, more dynamic cascade refresh option can be useful. Hence I added the following query hint.
At this time CascadePrivateParts option has no difference from CascadeAllParts for Java Persistence Entity, but when using underlying TopLink feature this could behave different in the future. Other existing properties and query hints are documented in http://www.oracle.com/technology/products/ias/toplink/JPA/essentials/toplink-jpa-extensions.html Have fun with this enhancements and please comment how you feel. [1] GlassFish Issue#1338 [2] GlassFish Issue#3269 »
Related Topics >>
J2EE Comments
Comments are listed in date ascending order (oldest first)
|
|||||||||
|
|