use of io.crnk.jpa.model.SequenceEntity in project crnk-framework by crnk-project.
the class JpaEntityRepositoryTestBase method testSequencePrimaryKey.
@Test
public void testSequencePrimaryKey() throws InstantiationException, IllegalAccessException {
JpaEntityRepository<SequenceEntity, Long> sequenceRepo = new JpaEntityRepository<>(module, JpaRepositoryConfig.create(SequenceEntity.class));
QuerySpec querySpec = new QuerySpec(SequenceEntity.class);
List<SequenceEntity> list = sequenceRepo.findAll(querySpec);
Assert.assertEquals(0, list.size());
SequenceEntity entity = new SequenceEntity();
entity.setStringValue("someValue");
entity = sequenceRepo.create(entity);
Assert.assertNotNull(entity.getId());
Assert.assertNotEquals(0L, entity.getId().longValue());
entity.setStringValue("someUpdatedValue");
entity = sequenceRepo.save(entity);
Assert.assertEquals("someUpdatedValue", entity.getStringValue());
}
Aggregations