Can we specify the transactionManagent/transactionAttribute(like required or Requiresnew ) to mention how the Container must manage transactions for a method
when a client invokes the method of session bean with JDBC. if yes can someone point me a brief example of that.
I am under impression that declarative transactionManagent in session bean can be used
only when we are using session beans with Entity beans.
It is perfectly possible to specify transaction demarcation annotations on session EJBs or on their individual methods using the @TransactionAttribute annotation or via entries in
ejb-jar.xml.You can find the basics addressed in the Java EE tutorial on container-managed transactions. Other places to obtain examples would be the OpenEJB project, which describes the usage of the annotations, and also testing for session EJB methods that uses these annotations.
As far, as the scope of declarative transaction management uses are concerned, they are not restricted to entity beans (if you are referring to EJB 2.x entity beans, which no sensible project would use nowadays). You could use them with lower-level protocols like plain JDBC or other transactional protocols, and with higher-level frameworks like JPA, as long as the underlying datasources that you are using, support transactional access, i.e. allows for enlisting and delisting of the datasources in the transactions using the JTA APIs.