I'm having a problem in my junit test while accessing my spring data jpa repository. I'm using the findByProperty functionality. But it hangs while accessing it.
My Entity:
@Entity
@Table(name = "TC_ORDER")
public class Order extends AbstractCatalog{
@Id
@GeneratedValue(strategy = GenerationType.AUTO)
@Column(name = "ORDER_SID")
private Long id;
}
My Abstractcatalog:
@MappedSuperclass
public abstract class AbstractCatalog {
@Column(unique = true, nullable = false, name = "CODE",updatable=false)
private String code;
public void setCode(final String code) {
this.code = code;
}
public String getCode() {
return this.code;
}
}
Spring data jpa repository:
public interface OrderRepository extends AbstractCatalogRepository<Order> {
}
AbstractCatalogRepository:
@NoRepositoryBean
public interface AbstractCatalogRepository<T extends AbstractCatalog> extends
CustomRepository<T, Serializable> {
T findByCode(String code);
}
The junit test:
@Inject
private OrderRepository orderRepository;
@Test
public void orderCatalogisComplete() throws Exception {
Assert.assertNotNull(orderRepository); // OK
Assert.assertEquals(18,orderRepository.count()); //OK
}
@Test
public void searchForSL1InDb(){
Order sl1 = orderRepository.findByCode("SL-1"); // HANGS HERE
Assert.assertNotNull(sl1);
}
}
This is the relevant resulting logging:
...preceding spring integration logging (also used in my project)...
13:49:19.828 INFO o.s.i.m.IntegrationMBeanExporter start 357 - started org.springframework.integration.monitor.IntegrationMBeanExporter@1202f4d
13:49:19.828 INFO o.s.c.s.DefaultLifecycleProcessor start 334 - Starting beans in phase 2147483647
And there it hangs..
I've run into a similar issue, if you are logging elsewhere, check your other log location as there might be another message from a component that makes the build hang - in my case it was cobertura.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With