Skip to content

Instantly share code, notes, and snippets.

@jsanda
Created October 23, 2012 02:48
Show Gist options
  • Save jsanda/3936385 to your computer and use it in GitHub Desktop.
Save jsanda/3936385 to your computer and use it in GitHub Desktop.
@Stateless
public class MySessionBean {
@Resource(name="CassandraDS", mappedName="java:jboss/datasources/CassandraDS")
private DataSource dataSource;
@TransactionAttribute(TransactionAttributeType.NOT_SUPPORTED)
public void useCassandraDS() {
try {
Connection connection = dataSource.getConnection();
...
} catch (Exception e) {
// handle exceptions
...
} finally {
// close statements, connections
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment