OK, I sort of found a solution to this. My objective was to call my method, which retrieves a 3-dimensional array of Beans from the database, on every FacesServlet request, but only upon FacesServlet requests. I did not want the db stuff to run when the object was instantiated as a result of an Ibatis resultMap, which is unfortunately what happened when I put the db stuff in the bean's init method.
Therefore, to solve the problem, I put the db retrieval code in a special property of the managedbean, and declared it as a managed-property in my faces-config.xml. It's a bit funny to have DB retrieval code in a bean's "get" method, but hey, it works. Now the database code is called only at the MyFaces request, but not when the bean is created by Ibatis. Thanks, Heather Buch hbuch4 wrote: > > Is there any way to prevent Ibatis from calling the init method of my > ManagedBean, when it creates a new bean for a ResultMap? > > I only want to call the ManagedBean's init method when it is being > instantiated through MyFaces, NOT through Ibatis. The only solution I > thought of was, before the init method, to iterate through the stack trace > and skip over if it finds: > > at com.ibatis.common.beans.ClassInfo.instantiateClass > > but execute if: > > at org.apache.myfaces.shared_impl.util.ClassUtils.newInstance > > but this seems a little clunky..... > > any ideas? > > thanks, Heather Buch > -- View this message in context: http://www.nabble.com/don%27t-call-Managed-Bean-init-method-tp18989735p19001456.html Sent from the iBATIS - User - Java mailing list archive at Nabble.com.
