Page tree
Skip to end of metadata
Go to start of metadata

If you are using MoSKito AOP and Hibernate in your application, this recipe explains how to add hibernate jdbc calls to monitoring.

Steps below related to configuring AOP plugin in your pom.xml:

  1.  add moskito-sql dependency
  2.  add moskito-sql as aspect library
  3.  add hibernate dependency to be weaved
  4.  add Xlint:warning property

Code snippet: 

pom.xml
...
<dependencies>
	...
	<dependency>
    	<groupId>net.anotheria</groupId>
    	<artifactId>moskito-sql</artifactId>
    	<version>${moskito.version}</version>
	</dependency>
	...
</dependencies>
...
<plugin>
    <groupId>org.codehaus.mojo</groupId>
    <artifactId>aspectj-maven-plugin</artifactId>
    ...
    <configuration>
        	...	
            <aspectLibraries>
		      ...	
              <aspectLibrary>
              	<groupId>net.anotheria</groupId>
                <artifactId>moskito-sql</artifactId>
              </aspectLibrary>
			  ...	
            </aspectLibraries>
            <weaveDependencies>
            	<weaveDependency>
                	<groupId>org.hibernate</groupId>
                    <artifactId>hibernate-core</artifactId>
                </weaveDependency>
            </weaveDependencies>
            <Xlint>warning</Xlint>
    </configuration>
	...
</plugin>
...


Compile and run your application, do some steps related to hibernate jdbc calls, find in moskito-inspect sql monitored calls: 

  • No labels