|
From: Alef A. <al...@jt...> - 2003-12-15 23:09:19
|
All, Two questions. First of all, we're having an app here based on some proprietary tech that we've wrapped in Spring. It's transparently using either POJOs or EJBs (when using EJBs the POJOs are just wrapped by en EJB, thus enabling easy clustering and more stuff like that). However, we're using the HibernateSessionFactory and don't know when to close the session when using an EJBs instead of POJOs. I found this solution on hibernate website in the documentation about spring combined with hibernate (having a ThreadLocal threadcounter that you're increasing and decreasing everytime a different EJB is entered or left). But it doesn't sounds like a decent approach (Chris Bauer - I guess - also advised against it). I could use long transactions, but that's a hassle as well. So anybody has any opinions on how to keep track of when to close the session when doing for one web-call that does an ejb-call that does another ejb-call (both of which do something hibsession related)? Ok, the second one involves the ApplicationContext. I've divided my beans across a lot of files (in order to keep them modular) and I'm loading them in all different kinds of places using the for example the ClasspathAppCtx (and providing it with an array of context locations). However, it's difficult avoiding circular references! Suppose there's two app contexts, A and B. In A there's bean 1 depending on bean 2 in B. In B, there's bean 3, depending on bean 4 in A. This is circular, however, I still want to somehow be able to do this. Basically the BeanFactory stops processing bean definitions if it can't find a bean reference that might be located in a sibbling context. I tend to state that the bean definition creation should postponed until all sibbling-contexts are resolved and maybe then try it again? Any suggestions (or just 'no not possible' will do as well :) Alef |