Tag: Maven
-
Hibernate: Migrating from XML-Based Configuration to Annotation-Based Configuration
Overview At some point of time, as your project scope grows, the Hibernate mapping XML files are going to get to a point where it becomes very difficult to maintain. This is where the annotation-based configuration comes in. It took me a few years to convince myself that annotation-based configuration is the way to go.… Read More…
-
java.lang.OutOfMemoryError: PermGen space When Running Maven on IntelliJ
NOTE This is not a Groovy related problem, but I’m using it to illustrate my problem and solution here. PROBLEM I recently tried mixing some Groovy code into my existing JEE project. I created a simple POGO that looks as sophisticated as this:- Then, I configured one of my controllers to invoke that POGO:- After… Read More…
-
java.lang.NoSuchMethodError: javax/persistence/OneToMany.orphanRemoval()Z
PROBLEM You configure Hibernate using annotations and set orphanRemoval property in @OneToMany. When you run the application, the application server throws the following exception:- In my case, I’m getting this exception when I run on Websphere Application Server (WAS) 7.5. SOLUTION The orphanRemoval property in @OneToMany requires JPA 2.x to work. If you already have… Read More…
-
Understanding How Maven Dependencies Work
Let’s assume we have the following dependencies:- In this example, both dbunit and spring-core have a dependency on commons-logging, but they rely on a different version:- Based on the above configuration, what version of commons-logging does Maven choose? If your answer is v1.1.1, then you are absolutely right…. that you need to read the Maven… Read More…
-
Using Spring Web Services and JAXB to Invoke Web Service Based on WSDL
There are several ways to consume a web service based on a WSDL from Java. After trying a couple of approaches, I’m currently leaning towards Spring Web Services and JAXB. The biggest advantage of using both Spring Web Services and JAXB to consume a web service is the flexibility to change the web service URL… Read More…
-
Managing Log4j Configuration for Both Development and Production Environments
PROBLEM Most of the time, we set the Log4j’s log levels to something lower (debug or info) during our local development. Once it is ready for production, we normally set the Log4j’s log levels to something higher (warn or even error) to prevent meaningless information from flooding the server log. One way to do this… Read More…