[jboss-user] [Beginner's Corner] - Re: JBoss5.1.0 + JPA = Object not persists

Amit Ajmani do-not-reply at jboss.com
Wed Oct 5 08:09:29 EDT 2011


Amit Ajmani [http://community.jboss.org/people/amitajmani1] created the discussion

"Re: JBoss5.1.0 + JPA = Object not persists"

To view the discussion, visit: http://community.jboss.org/message/630205#630205

--------------------------------------------------------------
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();
}
 *public*List<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
[http://community.jboss.org/message/630205#630205]

Start a new discussion in Beginner's Corner at Community
[http://community.jboss.org/choose-container!input.jspa?contentType=1&containerType=14&container=2075]

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/jboss-user/attachments/20111005/c550faf9/attachment-0001.html 


More information about the jboss-user mailing list