> In terms of the foreign collection example at
> http://ormlite.svn.sourceforge.net/viewvc/ormlite/ormlite-jdbc/trunk/src/test/java/com/j256/ormlite/examples/foreignCollection/
> I'm attempting to create an account, populate the foreign collection
> on it, and then save the account.
Huh, I had forgotten that ForeignCollection.add() works. Funny. So the issue is that you want to create the collections without doing any database transactions. This would be pretty simple. I'm going to add a getEmptyForeignCollection() or some such to the dao.
Account account = new Account("test");
account.orders = accountDao.getEmptyForeignCollection("orders");
Would that work?
> I figure that Account.order is set by ORMLite when the account object is inserted, updated, or
> refreshed.
Not inserted nor updated. Only query or refresh would create the collection.
> If Account.orders is a Collection<Order> instead of a ForeignCollection<Order>, Jackson can
> figure that out and make a new concrete Collection<Order>
This is supposed to work. ForeignCollection extends Collection so you should be able to say Collection<Order> and under the covers you will get an eager or lazy collection.
gray