JBoss Community

Re: JBoss5.1.0 + JPA = Object not persists

created by Amit Ajmani in Beginner's Corner - View the full discussion

How do you annotate your SLSB?

 

Answer :

here is my SLSB :

 

 

 

 

 

 

 

@Remote

public interface UserService {

 

 

 

   public List<User> getRegisteredUsers();

 

 

 

   public void registerUser(User user);

 

}

 

 

 

 

 

@Stateless

@TransactionManagement(TransactionManagementType.CONTAINER)

public class UserServiceImpl implements UserService {

 

 

// this is a simple POJO class containing business logic

private UserServiceCoreImpl coreService;

 

public UserServiceImpl(){

     coreService = new UserServiceCoreImpl();

}

publicList<User> getRegisteredUsers(){

     coreService.getRegisteredUsers();

....

}

 

 

   // performs a database INSERT operation

   public void registerUser(User user){

     coreService.registerUser(user);

}

}

 



 

Where do you add @TransactionAttribute? At class or method level and what do you use REQUIRED, SUPPORTS?

 

Answer : At the class level as you can see from above code snippet.

 

Reply to this message by going to Community

Start a new discussion in Beginner's Corner at Community