Spring Data repository with empty IN clause.

The problem I’ve stabled upon started with a spring data repository like this: public interface SampleRepository extends CrudRepository<Sample, Integer>{ @Query("select s from Sample s where s.id in :ids") List<Sample> queryIn(@Param("ids") List<Integer> ids); } Actual query was of course more complicated that this. Complex enough to justify not using a query method. The problem emerges when you run this method with an empty collection as argument: repository.queryIn(Collections.emptyList()); The result is database dependent. [Read More]

Exploaded WAR with Maven and Eclipse

The aim: setup a maven war project and JBoss7/WildFly so that the only thing needed to see your changes is touch my.war.dodeploy and F5 in the browser. Setting up Maven First thing to do is to setup outputDirectory, so that Eclipse will put the class files instantly in the right place: <project> <build> <outputDirectory>${basedir}/src/main/webapp/WEB-INF/classes</outputDirectory> ... Now you need to update Eclipse .project file: mvn eclipse:eclipse If you haven’t done that already, now’s the time to do File > Import > Existing Projects into Workspace in Eclipse. [Read More]