@Test public void testForeignNull() throws Exception { Dao<Foreign, Integer> dao = createDao(Foreign.class, true); Foreign foreign = new Foreign(); foreign.foo = null; assertEquals(1, dao.create(foreign)); Foreign foreign2 = dao.queryForId(foreign.id); assertNotNull(foreign2); assertNull(foreign2.foo); }
private static InstanceHolder getInstanceHolder() { try { Init.load(); Foreign foreign = new Foreign(); if ((foreign.getVersion() & 0xffff00) != (VERSION_MAJOR << 16 | VERSION_MINOR << 8)) { String msg = String.format("incorrect native library version %d.%d, expected %d.%d", (foreign.getVersion() >> 16 & 0xff), (foreign.getVersion() >> 8 & 0xff), VERSION_MAJOR, VERSION_MINOR); return new InValidInstanceHolder(new UnsatisfiedLinkError(msg)); } foreign.init(); return new ValidInstanceHolder(foreign); } catch (Throwable throwable) { return new InValidInstanceHolder(throwable); } }
private static InstanceHolder getInstanceHolder() { try { Init.load(); Foreign foreign = new Foreign(); if ((foreign.getVersion() & 0xffff00) != (VERSION_MAJOR << 16 | VERSION_MINOR << 8)) { String msg = String.format("incorrect native library version %d.%d, expected %d.%d", (foreign.getVersion() >> 16 & 0xff), (foreign.getVersion() >> 8 & 0xff), VERSION_MAJOR, VERSION_MINOR); return new InValidInstanceHolder(new UnsatisfiedLinkError(msg)); } foreign.init(); return new ValidInstanceHolder(foreign); } catch (Throwable throwable) { return new InValidInstanceHolder(throwable); } }
private static InstanceHolder getInstanceHolder() { try { Init.load(); Foreign foreign = new Foreign(); if ((foreign.getVersion() & 0xffff00) != (VERSION_MAJOR << 16 | VERSION_MINOR << 8)) { String msg = String.format("incorrect native library version %d.%d, expected %d.%d", (foreign.getVersion() >> 16 & 0xff), (foreign.getVersion() >> 8 & 0xff), VERSION_MAJOR, VERSION_MINOR); return new InValidInstanceHolder(new UnsatisfiedLinkError(msg)); } foreign.init(); return new ValidInstanceHolder(foreign); } catch (Throwable throwable) { return new InValidInstanceHolder(throwable); } }