Need some help making bean validation work with SDN:
Code:@NodeEntity public class Dummy { @GraphId Long id; @Indexed @NotNull String x; // want this to never be null public Dummy() {} public Dummy(String x) { this.x = x; } }Code:public interface DummyRepository extends GraphRepository<Dummy> {}context.xml is:Code:@ContextConfiguration(locations = "classpath:/context.xml") @RunWith(SpringJUnit4ClassRunner.class) public class DummyTest { @Autowired private DummyRepository dummyRepository; @Autowired private Neo4jTemplate neo4jTemplate; @Before public void dropDb() { Neo4jHelper.cleanDb(neo4jTemplate); } @Test(expected = ValidationException.class) public void testNullX() { Dummy dummy = new Dummy(null); dummyRepository.save(dummy); } }
I have hibernate-validator 4.2.0 dependency in my pom.xml. The test fails since there's no ValidationException. Anything I'm missing?Code:<context:spring-configured/> <context:annotation-config/> <bean id="validator" class="org.hibernate.validator.HibernateValidator"/> <neo4j:config storeDirectory="target/neo4j-db"/> <neo4j:repositories base-package="com.XXXXXXXXXX.repositories" /> <tx:annotation-driven mode="proxy" />


Reply With Quote
