Am 27.01.2010 23:36, schrieb dShaman:
>
> I was able to get a Java based client up using Hbase which seems to work just
> fine, but when I stuck a JDO layer on top via DataNucleus, I got some weird
> behavior during update. It seemed liked I could insert records, delete
> records, and read records, but when I try to do an update, the record gets
> removed!
>
> Has anyone else had an issue like this? My testing code was pretty
> primitive so I'm wondering if it might be a configuration issue with
> hbase/zookeeper or something else:
>
> public void test() {
> File propsFile = new
> File(AbstractPersistenceTest.DATA_NUCLEUS_PROPERTIES);
> PersistenceManagerFactory pmf =
> JDOHelper.getPersistenceManagerFactory(propsFile);
> PersistenceManager pm = pmf.getPersistenceManager();
>
> Transaction tx = pm.currentTransaction();
> Fake entity = null;
> try {
> tx.begin();
> entity = createEntity();
> pm.makePersistent(entity);
> tx.commit();
> } finally {
> if (tx.isActive()) {
> tx.rollback();
> }
> }
>
> String oldUUID = entity.getId();
> String updatedName = "New Name";
> tx = pm.currentTransaction();
> try {
> tx.begin();
> Fake readEntity = null;
> readEntity = (Fake)pm.getObjectById(entity.getClass(), entity.getId());
>
> readEntity.setName(updatedName);
> tx.commit();
> } finally {
> if (tx.isActive()) {
> tx.rollback();
> }
> }
>
> Fake updatedEntity = (Fake)pm.getObjectById(entity.getClass(), oldUUID);
> // fails here. can't find record
> assertEquals(updatedName, updatedEntity.getName());
> }