foreignAutoCreate = true and updating the object

71 views
Skip to first unread message

Sergey Gaidaichuck

unread,
Oct 30, 2012, 10:29:00 AM10/30/12
to ormlite...@googlegroups.com
Si i have some Entity with fields:
@DatabaseField(columnName = BLOB_NAME_1, foreign = true, foreignAutoCreate = true, foreignAutoRefresh = true, maxForeignAutoRefreshLevel = 1)
private TestEntityAttachment blob1;
@DatabaseField(columnName = BLOB_NAME_2, foreign = true, foreignAutoCreate = true, foreignAutoRefresh = true, maxForeignAutoRefreshLevel = 1)
private TestEntityAttachment blob2;

@DatabaseTable(tableName = "test_entity_attachment")
public static class TestEntityAttachment extends Attachment {}

And in base Attachment class i have
@DatabaseField(generatedId = true, allowGeneratedIdInsert = true)
private UUID id;

After that i create and initialize Entity
Entity e = new Entity();
e.setBlob1(...);

and called createOrUpdate() dao function. blob1 is auto created. It's good.
But after that i query this Entity and setBlob2(....) and again called for createOrUpdate(). And in this case blob2 is not saved in db table, and entity 'blob2_id' is null.




Reply all
Reply to author
Forward
0 new messages