Debug Persistence Layer

Log traces

Consider using existing logging facility to debug persistence layer. You can enable trace messages for the whole persistence layer using "com.heiler.ppm.persistence" logging category in log4j.xml:

<category name="com.heiler.ppm.persistence">
<priority value="TRACE"/>
</category>

The log output can be too noisy, to make it more clear you can enable logging only for the main components (use TRACE level).

Most usefull:

  • com.heiler.ppm.persistence.server.internal.mediator - trace all read/write operations (including entity type names and db keys) performed by the default mediators implementations

  • com.heiler.ppm.persistence.server.internal.persister.ORMPersister - trace business dataGraphs content and derived change summaries which are used to write data into DB

Other components:

  • com.heiler.ppm.persistence.db.internal.DataSourceRegistryImpl - data source contributions / Hibernate initialization

  • com.heiler.ppm.persistence.db.internal.PersistenceUnitInfoFactory - persistence entities(classes) initialization / JPA initialization

  • com.heiler.ppm.persistence.db.internal.metamodel.PersistenceMetamodelImpl - persistence metamodel initialization (can be very noisy)

  • com.heiler.ppm.persistence.server.internal.persister.PersisterExtensionRegistryImpl - trace persistence layer extensions instantiation

  • com.heiler.ppm.persistence.server.internal.mapping.RepositoryMappingFactory - repository persistence mappings configuration

  • com.heiler.ppm.persistence.server.internal.filter - autogenerated hibernate filters

  • com.heiler.ppm.fragment.server.hql - fragment based on HQL statements

Search:

  • com.heiler.ppm.search.server.internal.service - to analyse problems/error/exceptions in the entity search engine. In the log messages you can find dump of the search expression tree, HQL, SQL and HQL parameters. Dumped XML can be used to reproduce search queries in unit tests (use HPM xml serilization utils to convert it into search query).

External:

  • org.hibernate - hibernate logging which can be useful to find configuration problems coursed by default settings in hibernate

Extension tracing

To trace persistence layer contributed extensions set the following categories to TRACE level:

  • com.heiler.ppm.persistence.server.internal.persister.ORMPersister

  • com.heiler.ppm.persistence.server.internal.persister.PersisterExtensionUtils

  • com.heiler.ppm.persistence.server.mediator.utils.DeleterUtils

  • com.heiler.ppm.persistence.server.mediator.utils.MediatorUtils

  • com.heiler.ppm.persistence.server.internal.mediator.GenSubMediator

SQL traces

SQL traces are sql commands produced by hibernate and UDA. To active SQL traces for all data sources and all data access methods set db.default.debug.show_sql property to true (in server.properties).

You can configure SQL traces pro data sources by setting hibernate.show_sql in the hibernate config (<dataSource>.properties.template.<DB> file) and <property name="debug" value="true" /> in the UDA config (uda-config.xml.template.<DB> file)

To trace sql parameter values produced by HQL processor set org.hibernate.type log4j category to TRACE.

JDBC Driver trace

Microsoft JDBC driver logs

Microsoft JDBC driver is using java standard logging facilities. See online docs how to enable and configure logs http://msdn.microsoft.com/en-us/library/ms378517(v=sql.90).aspx