Good to hear
> The only problem I had was related to Guice. A link of interest:
> https://github.com/etiennep/injected-requestfactory
>
> I have one question though: Does Twig handle @PrePersist annotation?
>
No, it only looks for its own annotations. Is this really useful? I
normally do all work on the data models in a manager (DAO) class rather
than mixing it into the model also.
I got an exception. BTW there is a typo on the exception description.
java.lang.IllegalStateException: Dectected use by more than one thread at com.google.code.twig.standard.StandardCommand.<init>(StandardCommand.java:12) at com.google.code.twig.standard.StandardFindCommand.<init>(StandardFindCommand.java:9) at com.google.code.twig.standard.TranslatorObjectDatastore.find(TranslatorObjectDatastore.java:145) at com.google.code.twig.standard.TranslatorObjectDatastore.find(TranslatorObjectDatastore.java:209)
when I call
List<Update> updates = asList(datastore.find(Update.class));
with
protected List<T> asList(QueryResultIterator<T> rs) { List<T> list = new ArrayList<T>(); while (rs.hasNext()) { list.add(rs.next()); } return list; }
That looks fine - the question is how do you use your DAO? Is that also
scoped to NO_SCOPE? It seems from the error that a DAO is being held
onto and reused between requests.
I normally scope the OD to REQUEST so I can load objects in filters and
reuse later them without thinking about if they are associated or not.
But there are also cases where it makes sense to scope to NO_SCOPE like
you have to keep operations isolated.
Yeah that will be it. Inject Provider<MyService> instead
Lucky for that new same-thread test!