Skip to content

Entity persister

stevenzwu edited this page Jan 3, 2013 · 28 revisions

Astyanax provides entity persister APIs that is similar to Java Persistence API (JPA). Please check out "com.netflix.astyanax.entitystore" package. it replaces the now-deprecated "com.netflix.astyanax.mapping" implementation.

Here is a simple example ` final String id = "foo"; final SampleEntity origEntity = createRandomEntity(id); final EntityManager<SampleEntity, String> entityPersister = new DefaultEntityManager.Builder<SampleEntity, String>() .withEntityType(SampleEntity.class) .withKeyspace(keyspace) .withColumnFamily(CF_SAMPLE_ENTITY) .build();

entityPersister.put(origEntity); SampleEntity getEntity = entityPersister.get(id); entityPersister.delete(id); `

Clone this wiki locally