-
Recent Posts
Recent Comments
- sherif sadek on Understanding Hibernate session flushing
- Koushik Paul on Hibernate query limitations and correlated sub queries
- Joseph Albert on Showing unused TestNG tests
- Iván on Maven offline build fails to resolve artifacts in your local repository
- Peter on Comparing two MySQL databases
Archives
- October 2024
- July 2024
- June 2024
- May 2024
- January 2024
- October 2023
- July 2023
- January 2023
- July 2022
- September 2021
- August 2021
- July 2021
- June 2021
- May 2021
- December 2020
- June 2020
- May 2020
- January 2019
- November 2018
- September 2017
- June 2017
- September 2016
- August 2016
- February 2016
- July 2015
- November 2014
- October 2014
- August 2014
- April 2014
- February 2014
- December 2013
- November 2013
- May 2013
- February 2013
- January 2013
- October 2012
- September 2012
- July 2012
- April 2012
- February 2012
- January 2012
- November 2011
- October 2011
- August 2011
- July 2011
- June 2011
- May 2011
- April 2011
- March 2011
- February 2011
- January 2011
- November 2010
- October 2010
Categories
Meta
Category Archives: Java
Type conversion and NoTypeConversionAvailableException in Apache Camel
In Camel, type conversion of a message body can be done using the tag: <convertBodyTo type=”com.something.SomeClass”/> Camel docs on type converter: https://camel.apache.org/manual/type-converter.html Type converters are loaded from the classpath, so the imports of your OSGI module will affect what converters … Continue reading
Using test fixtures in Gradle and Maven
In Maven if you want to reuse text fixtures from one module in another module, you use the jar plugin and build a test jar. You have to specify what classes and other resources to include. Gradle has a dedicated … Continue reading
Memory leak with Spring integration test context caching
I’ve recently had to debug another out of memory with our Spring integration tests. The tests are configured to create a heapdump on out of memory so I loaded it up with the Eclipse Memory Analyser and this is what … Continue reading
Enforcing Spring role based security with a custom PMD rule
Spring makes it easy to have role based security with its @PreAuthorize annotation. But how do you make sure that developers remember to add a security annotation? I like using PMD to do static analysis checks on our code and … Continue reading
Posted in Java, PMD, Spring, Static Analysis
Tagged Java, PMD, Spring, static-analysis
Leave a comment
Hibernate Best Practices – using sequences for bulk inserts
For many database tables, an auto increment column is used for the primary key. This is fine for inserting single values, but if you want to bulk insert hundreds or thousands of values and you need to refer to the … Continue reading
Java XML processing with JAXB and special characters
When processing XML, it is important to understand that there are two kinds of special characters: Characters that are permitted, but must either be escaped or inside a CDATA block. Control characters that are not permitted at all. Characters that … Continue reading
Hibernate internals – how does pagination work?
Hibernate supports pagination for all query types – HQL, Criteria and SQL, via the query setMaxResults() and setFirstResult() methods, but how does this work under the covers? Well, assuming your database supports it, it will add a row_number() to your … Continue reading
Memory leak with TestNG and Spring DirtiesContext annotation
We recently added some new integration tests to our test suite. All three tests were Spring integration tests. Normally in a Spring integration test, the entire code for a test method operates in a single transaction, and at the end … Continue reading
IntelliJ Hints and Tips
Most useful keyboard shortcuts (these are for Mac): CMD + O Open class CMD + SHIFT + OOpen file CMD + F Find in file CMD + R Replace in file CMD + SHIFT + F Find in path CMD … Continue reading
log4j in maven tests
If you want to specify log4j configuration when running tests via Maven, you can do so by updating the Maven surefire plugin configuration to point to a specific log4j configuration file. For log4j v2 the appropriate parameter is called log4j.configuration. … Continue reading