[EJB 3.0] - need help for Transaction Attribute Types
by grdzeli_kaci
good day,
i need something like that :
| @Stateful
| @Remote(TestFasade.class)
| public class TestFasadeBean implements TestFasade {
|
| @PersistenceContext(unitName = "Oracle")
| private EntityManager oracleManager;
|
| @TransactionAttribute(??????????????)
| public void create(Test test) {
| try {
| System.out.println("start persist");
| oracleManager.persist(test);
| System.out.println("end persist");
| } catch (Exception e) {
| e.printStackTrace();
| }
| }
| @TransactionAttribute(??????????????)
| public void comit() {
| try {
| System.out.println("start comit");
| oracleManager.flush();
| System.out.println("end comit");
| } catch (Exception e) {
| e.printStackTrace();
| }
| }
| }
|
i want that first method "create" must not be flushed into database before i call commit.
is it possible, and i don't want class variable initialization.
is it possible by transaction types or something like that ?
any idea will be appreciated.
_______________________
Regards
Paata,
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4073522#4073522
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4073522
18Â years, 11Â months
[JBoss Seam] - Integration Testing with TestNG and embeddedEjb
by EagleEye
I have a lot problems to let run Integration Tests.
The main problem is to grab the loaded Components from the Container.
It seems that they are not loaded. I'm not able to get the by hand from the JNDI.
here the Request:
| new FacesRequest() {
|
| @Override
| protected void invokeApplication() {
|
| Object test = JndiUtil.lookup("mediportal/KomunikatyManagerBean/local", KomunikatyManagerBean.class);
| KomunikatyManager komunikatyManager = (KomunikatyManager) getInstance(KomunikatyManagerBean.class);
| invokeMethod("#{komunikatyManager.nowy}");
| }
|
| }.run();
|
here the console output for this component, while starting embeddedEjb:
| 12:40:11,812 INFO [Initialization] Installing components...
| 12:40:12,375 INFO [Component] Component: komunikatyManager, scope: CONVERSATION, type: STATEFUL_SESSION_BEAN, class: pl.alternativ.med.portal.komunikaty.KomunikatyManagerBean, JNDI: mediportal/KomunikatyManagerBean/local
|
and finally the error message:
| 14:07:01,609 INFO [Initialization] done initializing Seam
| Start Nowy Test-----------------------------------------
| 14:07:01,734 INFO [Ejb] stopping the embedded EJB container
| 14:07:01,765 ERROR [AbstractKernelController] Internal error during uninstall current state not found: name=jboss.j2ee:jar=test-build,name=MailMDB,service=EJB3 state=**ERROR** error=javax.naming.NameNotFoundException: DefaultJMSProvider not bound
| 14:07:01,765 ERROR [AbstractKernelController] Internal error during uninstall: toState=ControllerState@262730{Not Installed} context=name=jboss.j2ee:jar=test-build,name=MailMDB,service=EJB3 state=**ERROR** error=javax.naming.NameNotFoundException: DefaultJMSProvider not bound
| 14:07:01,765 ERROR [AbstractKernelController] Internal error during uninstall current state not found: name=jboss.j2ee:jar=test-build,name=PlikiKlientowMDB,service=EJB3 state=**ERROR** error=javax.naming.NameNotFoundException: DefaultJMSProvider not bound
| 14:07:01,765 ERROR [AbstractKernelController] Internal error during uninstall: toState=ControllerState@262730{Not Installed} context=name=jboss.j2ee:jar=test-build,name=PlikiKlientowMDB,service=EJB3 state=**ERROR** error=javax.naming.NameNotFoundException: DefaultJMSProvider not bound
| 14:07:01,796 INFO [SessionFactoryImpl] closing
| 14:07:01,796 INFO [SchemaExport] Running hbm2ddl schema export
| 14:07:01,796 INFO [SchemaExport] exporting generated schema to database
| 14:07:01,812 INFO [SchemaExport] schema export complete
| FAILED: testNowyKomunikat
| org.jbpm.util.JndiLookupException: couldn't fetch 'mediportal/KomunikatyManagerBean/local' from jndi
| at org.jbpm.util.JndiUtil.lookup(JndiUtil.java:41)
| at pl.alternativ.med.portal.test.komunikaty.KomunikatyTest$1.invokeApplication(KomunikatyTest.java:49)
| at org.jboss.seam.mock.SeamTest$Request.run(SeamTest.java:489)
| at pl.alternativ.med.portal.test.komunikaty.KomunikatyTest.testNowyKomunikat(KomunikatyTest.java:54)
| Caused by: javax.naming.NameNotFoundException: mediportal not bound
| at org.jnp.server.NamingServer.getBinding(NamingServer.java:529)
| at org.jnp.server.NamingServer.getBinding(NamingServer.java:537)
| at org.jnp.server.NamingServer.getObject(NamingServer.java:543)
| at org.jnp.server.NamingServer.lookup(NamingServer.java:267)
| at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:626)
| at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:588)
| at javax.naming.InitialContext.lookup(Unknown Source)
| at org.jbpm.util.JndiUtil.lookup(JndiUtil.java:36)
| ... 24 more
| ... Removed 21 stack frames
|
|
I'm really running out of ideas! Before the startup is looking good,
init the DS is working,
Mapping of the beans,
import of data,
I have no idea why i can't grab any of the Components or where they are gone! The configuration i have checked million times.
I would be pleased if somebody could give some new ideas or hints.
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4073520#4073520
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4073520
18Â years, 11Â months
[JBoss Seam] - Re: TestNG and Seam Documentation 12.1. Unit testing Seam co
by EagleEye
"chuckadams" wrote : You can't depend on the EJB3 container being initialized in a @BeforeClass/beforeTestClass method, because it does in fact run before the embedded container is started by SeamTest.init().
|
Yep got the same problem. But with your idea you will get the same problem. It's not workin, even the empty test class inheriting from SeamTest with a @BeforeClass/beforeTestClass method is executed before the EJB3 container being initialized. I'm couldn't solve this problem.
Not a good work around is to do the init method for the DS without any @Before.... And call this method from every test class with
| protected void initDataSource(){
| emf = Persistence.createEntityManagerFactory("mediportal");
| }
|
and call this method in every TestClass
with
| @Configuration(beforeTestClass = true)
| public void initDS() {
| initDataSource();
| }
|
That means the DS will be initialized before every TestClass. It's stupid, cuz if you would write a test suite there is no sense to init the DS in every class.
anonymous wrote :
| Speaking of things out of date, Seam is using a pretty old version of TestNG. Any plans to update it to 5.1?
|
This is also a really good question.
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4073517#4073517
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4073517
18Â years, 11Â months
[JBoss Portal] - Re: Redirect in a PageInterceptor renders the page in backgr
by staale
"Antoine_h" wrote :
|
| using a servlet filter ?
| in front of the main serlvet(s) of the portal, change/rewrite the url so the portal see it as a secured one.
| look at the portal-server war for that.
| there are for servlet (two not secured, two secured).
| should be the best way, as it does not touch the portal processing. just make it see what you want it to see.
|
| hope this can help...
|
Thanks for the post. The last idea is probably the safest way. I was blinded by the fact that it was very easy use the properties in the XX-object.xml for each page.
I can rewrite the code to work in a tomcat valve. The hard part is that I have to read the XX-object.xml by myself - or make another configuration file to enable/disable secure mode for a page.
We have a rather large system - and adding even more custom properties in separate files is probably not what my customer want right now - so im guessing a custom parser just to pick out a page name and the secure property for it might be the solution.
Ill stop writing and go coding :)
Regards,
Ståle
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4073510#4073510
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4073510
18Â years, 11Â months