[JBoss Seam] - Re: Stateless search to stateful conversation
by justinwalsh
Hi,
I've tried this. When the page action is executed, the request parameter is not present yet. A simple example:
ViewDocument:
| @Local
| public interface ViewDocument {
| void selectDocument();
| void destroy();
| }
|
ViewDocumentAction:
| @Stateful
| @Name("viewDocumentAction")
| @Scope(ScopeType.CONVERSATION)
| public class ViewDocumentAction implements ViewDocument {
|
| @RequestParameter
| private Integer documentId;
|
| @Begin
| public void selectDocument() {
| System.out.println("documentId [" + documentId + "]");
| if (documentId == null) {
| throw new IllegalStateException("DocumentId is null");
| }
| }
|
| @Remove @Destroy @End
| public void destroy() {
|
| }
|
| }
|
Invoked from:
| <h:outputLink value="viewDocument.seam" id="viewDocument">
| <h:outputText value="[View Document]"/>
| <f:param name="documentId" value="1" />
| </h:outputLink>
|
pages.xml
| <pages>
| <page view-id="/viewDocument.xhtml" action="#{viewDocumentAction.selectDocument}"/>
| </pages>
|
06:26:49,735 INFO [STDOUT] documentId [null]
06:26:49,735 ERROR [[Faces Servlet]] Servlet.service() for servlet Faces Servlet
threw exception
javax.faces.el.EvaluationException: Exception while invoking expression #{viewDocumentAction.selectDocument}
....
Caused by: javax.ejb.EJBException: java.lang.IllegalStateException: DocumentId is null
at org.jboss.ejb3.tx.Ejb3TxPolicy.handleExceptionInOurTx(Ejb3TxPolicy.ja
va:69)
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3959419#3959419
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3959419
19 years, 9 months
[EJB 3.0] - broken column mapping exception on @OneToOne mapping
by gus888
Hi all,
I got an exception on my entity mappings. The codes are as follows:table test (
| id
| name
| )
|
| table deleted_test (
| test_id
| person_id
| deleted_date
| )
|
| @Embeddable
| class PK {
| int test_id;
| int person_id;
| ...
| }
|
| @Entity
| @Table(name="deleted_test")
| class DeletedTest {
| PK pk;
| Test test;
| Person person;
| ...
| @EmbeddedId
| public PK getPk(){
| return pk;
| }
| ...setPk...
|
| @OneToOne(cascade=CascadeType.ALL,fetch=FetchType.EAGER)
| @JoinColumn(name="Test_ID", nullable = false, insertable = false, updatable = false)
| public Test getTest() {
| return test;
| }
| public void setTest(Test Test) {
| this.test = test;
| }
|
| @ManyToOne
| @JoinColumn(name="PERSON_ID", nullable=false, insertable = false, updatable = false)
| public Person getPerson() {
| return person;
| }
|
| public void setPerson(Person person) {
| this.person = person;
| }
| ...
| }
When I run it on JBoss4.0.4GA and EJB3 RC8, I always got the following exceptions:
org.hibernate.MappingException: broken column mapping for: test.id of: DeletedTest
| at org.hibernate.persister.entity.AbstractPropertyMapping.initPropertyPaths(AbstractPropertyMapping.java:122)
| at org.hibernate.persister.entity.AbstractPropertyMapping.initIdentifierPropertyPaths(AbstractPropertyMapping.java:176)
| at org.hibernate.persister.entity.AbstractPropertyMapping.initPropertyPaths(AbstractPropertyMapping.java:160)
| at org.hibernate.persister.entity.AbstractEntityPersister.initOrdinaryPropertyPaths(AbstractEntityPersister.java:1628)
| at org.hibernate.persister.entity.AbstractEntityPersister.initPropertyPaths(AbstractEntityPersister.java:1656)
| at org.hibernate.persister.entity.AbstractEntityPersister.postConstruct(AbstractEntityPersister.java:2699)
| at org.hibernate.persister.entity.SingleTableEntityPersister.<init>(SingleTableEntityPersister.java:386)
| at org.hibernate.persister.PersisterFactory.createClassPersister(PersisterFactory.java:55)
| at org.hibernate.impl.SessionFactoryImpl.<init>(SessionFactoryImpl.java:223)
| at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1213)
| at org.hibernate.ejb.Ejb3Configuration.buildEntityManagerFactory(Ejb3Configuration.java:631)
| at org.hibernate.ejb.Ejb3Configuration.createEntityManagerFactory(Ejb3Configuration.java:760)
| at org.hibernate.ejb.Ejb3Configuration.createContainerEntityManagerFactory(Ejb3Configuration.java:350)
| at org.hibernate.ejb.HibernatePersistence.createContainerEntityManagerFactory(HibernatePersistence.java:119)
| at org.jboss.ejb3.entity.PersistenceUnitDeployment.start(PersistenceUnitDeployment.java:264)
| at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
| at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
| at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
| at java.lang.reflect.Method.invoke(Method.java:585)
| at org.jboss.ejb3.ServiceDelegateWrapper.startService(ServiceDelegateWrapper.java:99)
| at org.jboss.system.ServiceMBeanSupport.jbossInternalStart(ServiceMBeanSupport.java:289)
| at org.jboss.system.ServiceMBeanSupport.jbossInternalLifecycle(ServiceMBeanSupport.java:245)
| at sun.reflect.GeneratedMethodAccessor3.invoke(Unknown Source)
| at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
| at java.lang.reflect.Method.invoke(Method.java:585)
| at org.jboss.mx.interceptor.ReflectedDispatcher.invoke(ReflectedDispatcher.java:155)
|
However,if I changed the test mapping to ManyToOne from OneToOne, no exceptions occured. I want to know the OneToOne mapping here is wrong or not. I appreciate any directions. Thank you in advance.
GUS
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3959415#3959415
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3959415
19 years, 9 months
[EJB/JBoss] - HASingleton Services on 4.0.4 not working
by markfrench
Hi,
I have a number of schedulable services which need to run as HA Singletons. I have added the following line to their service descriptors:
jboss.ha:service=HASingletonDeployer,type=Barrier
When I fire up jboss they are created but never scheduled at all. Removing the above attribute and they run as expected. The following are the service descriptors:
| <?xml version="1.0" encoding="UTF-8"?>
| <server>
| <classpath codebase="lib" archives="scheduler-plugin.jar"/>
|
| <mbean code="org.jboss.varia.scheduler.Scheduler"
| name="eventmanager:service=FrequencyEventScheduler">
| <depend>jboss.ha:service=HASingletonDeployer,type=Barrier</depend>
| <attribute name="StartAtStartup">true</attribute>
| <attribute name="SchedulableClass">com.transtoll.modules.eventmanager.schedulables.jboss.FrequencyEventSchedulable</attribute>
| <attribute name="InitialStartDate">NOW</attribute>
| <attribute name="InitialRepetitions">-1</attribute>
| <attribute name="SchedulePeriod">60000</attribute>
| <depends>eventmanager:service=initialisation</depends>
| </mbean>
|
| <mbean code="org.jboss.varia.scheduler.Scheduler"
| name="eventmanager:service=MetricEventScheduler">
| <depend>jboss.ha:service=HASingletonDeployer,type=Barrier</depend>
| <attribute name="StartAtStartup">true</attribute>
| <attribute name="SchedulableClass">com.transtoll.modules.eventmanager.schedulables.jboss.MetricEventSchedulable</attribute>
| <attribute name="InitialStartDate">NOW</attribute>
| <attribute name="InitialRepetitions">-1</attribute>
| <attribute name="SchedulePeriod">60000</attribute>
| <depends>eventmanager:service=initialisation</depends>
| </mbean>
|
| <mbean code="org.jboss.varia.scheduler.Scheduler"
| name="eventmanager:service=DurationEventScheduler">
| <depend>jboss.ha:service=HASingletonDeployer,type=Barrier</depend>
| <attribute name="StartAtStartup">true</attribute>
| <attribute name="SchedulableClass">com.transtoll.modules.eventmanager.schedulables.jboss.DurationEventSchedulable</attribute>
| <attribute name="InitialStartDate">NOW</attribute>
| <attribute name="InitialRepetitions">-1</attribute>
| <attribute name="SchedulePeriod">60000</attribute>
| <depends>eventmanager:service=initialisation</depends>
| </mbean>
|
| <mbean code="org.jboss.varia.scheduler.Scheduler"
| name="eventmanager:service=MetricPersistenceScheduler">
| <depend>jboss.ha:service=HASingletonDeployer,type=Barrier</depend>
| <attribute name="StartAtStartup">true</attribute>
| <attribute name="SchedulableClass">com.transtoll.modules.eventmanager.schedulables.jboss.MetricPersistenceSchedulable</attribute>
| <attribute name="InitialStartDate">NOW</attribute>
| <attribute name="InitialRepetitions">-1</attribute>
| <attribute name="SchedulePeriod">60000</attribute>
| <depends>eventmanager:service=initialisation</depends>
| </mbean>
| </server>
Any thoughts as to what I'm doing wrong?
Cheers
Mark
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3959413#3959413
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3959413
19 years, 9 months