EJBs allow you to choose between Container Managed Transactions (CMT) and Bean Managed Transactions (BMT).
In case of CMT, its the container which manages the transactions (i.e. begin/commit/rollback) on the bean methods. EJBs allow you to mark individual methods on the beans to have specific transaction attributes. A bean developer can mark a bean method as having transaction attribute of REQUIRED (there are many other transaction attribtues available). When this method on the bean is invoked, the container will then create a new transaction (if there's no transaction in progress currently) or add this method to the currently running transaction. Any transaction aware resources (like datasources) which are used as part of this method will then be tracked within this transaction context by the container.
On the other hand, BMT leaves it to the bean developer to manage transactions (begin/commit/rollback). The first piece of code in your post is an example for BMT, where you are starting/commiting the transaction.
So the real question is - do you want CMT or BMT for your beans. Also, are you using EJB3 or EJB2.x. Based on the version, there are different ways to configure the transaction attributes on the bean methods.