initial add of EbeanORM server based on v2.8.1

This commit is contained in:
rbygrave
2012-09-14 00:40:39 +12:00
parent 2b74d0f9d9
commit 96ce4c0ddf
1188 changed files with 135034 additions and 0 deletions
@@ -0,0 +1,44 @@
package com.avaje.tests.iud;
import junit.framework.Assert;
import junit.framework.TestCase;
import com.avaje.ebean.Ebean;
import com.avaje.tests.model.basic.EBasicVer;
public class TestInsertUpdateTrans extends TestCase {
public void test() {
Ebean.beginTransaction();
try {
EBasicVer e0 = new EBasicVer();
e0.setName("onInsert");
e0.setDescription("something");
Ebean.save(e0);
Assert.assertNotNull(e0.getId());
Assert.assertNotNull(e0.getLastUpdate());
Assert.assertEquals("onInsert", e0.getName());
e0.setName("onUpdate");
e0.setDescription("differentFromInsert");
Ebean.save(e0);
EBasicVer e1 = Ebean.find(EBasicVer.class, e0.getId());
// we should fetch back the updated data (not inserted)
Assert.assertEquals(e0.getId(), e1.getId());
Assert.assertEquals("onUpdate", e1.getName());
Assert.assertEquals("differentFromInsert", e1.getDescription());
Ebean.commitTransaction();
} finally {
Ebean.endTransaction();
}
}
}