apache karaf - How To Self-Invoke a beans method in OSGI -


class mytestbean {     public void requiredmethod(){          //somehow call "requiresnewmethod" new transaction          //provided container          this.requiresnewmethod(); //this not work.. no new transaction created                  }      public void requiresnewmethod(){ //code..} } 

blueprint xml :

  <bean id="mytestbean "     class="mytestbean ">     <jpa:context property="entitymanager" unitname="sample" />     <tx:transaction method="requiredmethod" value="required" />     <tx:transaction method="requiresnewmethod" value="requiresnew" />   </bean> 

when requiredmethod called jpa manager creates new transaction (if not in transaction). call method "requiresnewmethod" inside "requiredmethod" , force jpa manager create new (nested) transaction.

for example if above ejb , in ejb container

public void requiredmethod(){     sessioncontext.getbusinessobject(mytestbean.class).requiresnewmethod();  } 

you try inject own bean property of mytestbean , access way.


Comments

Popular posts from this blog

tcpdump - How to check if server received packet (acknowledged) -