kpalania-

UserModule needs to be called within the context of an already active 
Transaction.

Try something like this:


  | SessionFactory identitySessionFactory = (SessionFactory)new 
InitialContext().lookup("java:/portal/IdentitySessionFactory");
  | Session session = identitySessionFactory.openSession();
  | Transaction transaction = session.beginTransaction();
  | boolean success = false;
  | try
  | {
  |         UserModule  userModule = (UserModule) new        
InitialContext().lookup("java:portal/UserModule");
  | User user = userModule.findUserByUserName("admin");
  | 
  | //other business logic etc etc
  | 
  | success = true;
  | }
  | finally
  | {
  |          if (transaction != null)
  |          {
  |             if (success)
  |             {
  |                transaction.commit();
  |             }
  |             else
  |             {
  |                transaction.rollback();
  |             }
  |          }
  | 
  |          if (session != null)
  |          {
  |             session.close();
  |          }
  | }
  | 

This code maynot compile as is, but you get the idea ;)

Thanks

View the original post : 
http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4071367#4071367

Reply to the post : 
http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4071367
_______________________________________________
jboss-user mailing list
[email protected]
https://lists.jboss.org/mailman/listinfo/jboss-user

Reply via email to