Overview
Other MyFaces Extensions
- ExtVal
- Ext-Script
- [Orchestra]
- [Portlet Bridge]
Community
Development
Sponsorship
Your browser does not support iframes
...
The configuration itself is provided by implementing the CODI DataSourceConfig class. The DataSourceConfig determines whether a JNDI path, a JDBC connection or another DataSource should get used, by just returning the proper values. You can use all the flexible CDI and CODI mechanisms like @ProjectStageActivated, @ExpressionActivated, @Alternative, @Specializes, etc and even if/then/else,... to find the perfect settings for your current runtime environment!
This helper allows to execute CDI-unmanaged code blocks in a @Transactional manner. E.g. with the test modules provided by MyFaces CODI you can inject CDI beans and therefore transactional services into a JUnit test. So it's possible to use existing implementations e.g. to create sample data for unit tests or to remove such entries again. If a service doesn't (or shouldn't) provide the needed functionality e.g. for deleting entities, it's possible to use TransactionHelper
for such additional logic which should be executed within a transaction.
Note | ||
---|---|---|
| ||
Please be aware that this helper only works for |
Code Block | ||||||
---|---|---|---|---|---|---|
| ||||||
MyReslt result = TransactionHelper.getInstance().executeTransactional(new Callable<MyReslt>() {
public MyReslt call() throws Exception
{
EntityManager entityManager = BeanManagerProvider.getInstance().getContextualReference(EntityManager.class);
entityManager.remove(...);
return entityManager.find(...);
}
});
|