[JBoss Seam] - Re: how to use PropertyChangeListener on entity beans for dr
by gavin.kingï¼ jboss.com
Email from Mark:
anonymous wrote :
| I chatted to the guy, on irc, he just didn't realise you can call
| session.update( myObjHandle ) - and that the update( myObj ) call can
| even be done via a hibernate save listener, so think he's all happy now.
| No need to notify the engine each time a single property changes.
|
| session.update( myObjectHandle ) actually works by using something
| called "shadow facts". We proxy inserted objects and create a shallow
| cache of each field value. When you call update it actually retracts
| using the old cached field values.
|
| You can turn shadow facts off, but then you cannot use session.update(
| myObjectHandle) instead you have to call session.modifyRetract(
| myObjectHandle) before the first setter is called, and
| session.modifyInsert( myObjectHandle, myObject ) after the last setter
| is applied. Turning shadow facts off improves performance about 10%,
| depending on how many fields you have, and uses slightly more memory.
|
| After we do 4.0, maybe we can look on how we can solve problems like
| this, for better integration. PropertyChangeListeners are not very
| efficient, we don't really want to notify the engine each time a field
| changed. In MVEL we have the following syntax:
| modify ( person ) { age+= 1, location = "london" }
|
| I call this a block setter. The engine is notified before the first
| setter and after the last setter - i.e. it basically auto calls
| modifyRetract and modifyInsert for you.
|
| Anyway I'd be interested to hear ideas you have on this. Two I can think
| of are hooking into the hibernate save() method and some how hooking
| into a transaction block. So that at the start of the transaction block
| all used facts are retracted from the network, and re-insert at the end
| of the network; or just simply calling update( objectHandle ) at the end
| of the transaction block.
|
| In later issues we will track the actual fields changed, in a
| consequence using MVEL, this allows for more efficient network
| re-evaluation. maybe using AOP (like jgroups) we can achieve something
| similar with seam and hibernate - although have to be sure that the cost
| of the AOP stuff, isn't higher than the full network evaluation.
|
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4074574#4074574
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4074574
18Â years, 11Â months
[Messaging, JMS & JBossMQ] - Re: JMSSecurityException when trying to subscribe to a tempo
by hicks
"rosama77" wrote : Yeah, we have a lot of problems, but as adrian said, this is just investigating, knowing more about Jboss, this is a new area of opportunity and humans not are a encyclopedia, are they?.
|
| And finally this forum is loosing its purpose, just technical matters not human, well in this case, what do you think?.
|
| Have a nice day both of you, don't get complicated .
|
I agree, this is a tech forum which covers issues related to JBoss MQ.
I asked a question which wasn't in the FAQ, hadn't been asked before, and I get a load of crap from Mr high-and-mighty JBoss. Hardly a professional attitude is it?
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4074573#4074573
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4074573
18Â years, 11Â months
[EJB 3.0] - Re: Foreign key error
by neisann
Hi,
I have a JSP page that receives the data entered by the user. This page uses JSF.
* register.jsp:
| <%@ page language="java" contentType="text/html; charset=ISO-8859-1"
| pageEncoding="ISO-8859-1"%>
| <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
| <%@ taglib uri="http://java.sun.com/jsf/html" prefix="h" %>
| <%@ taglib uri="http://java.sun.com/jsf/core" prefix="f" %>
| <%@ page errorPage="errorpage.jsp" %>
| ...
| <f:facet name="footer">
| <h:panelGroup>
| <h:commandButton value="#{msg.submit}"
| action="#{registrationBean.register}" />
| <h:commandButton value="#{msg.reset}" type="reset"/>
| </h:panelGroup>
| </f:facet>
| ...
| <h:outputLabel for="title" value="#{msg.registrationTitle}"/>
| <h:panelGroup>
| <h:inputText id="title" value="#{registrationBean.person.title}"
| maxlength="45" size="10"/><f:verbatim><br/></f:verbatim>
| <h:outputText value=" "/><h:message for="title" styleClass="formUserError"/>
| </h:panelGroup>
|
| <h:outputLabel for="firstName" value="#{msg.registrationName}"/>
| <h:panelGroup>
| <h:inputText id="firstName" value="#{registrationBean.person.firstName}"
| maxlength="255" size="30"/><f:verbatim><br/></f:verbatim>
| <h:outputText value=" "/><h:message for="firstName" styleClass="formUserError"/>
| </h:panelGroup>
| ...
| <h:outputLabel for="line1" value="#{msg.registrationAddress1}"/>
| <h:panelGroup>
| <h:inputText id="line1" value="#{registrationBean.person.address.line1}"
| maxlength="255" size="50"/> <f:verbatim><br/></f:verbatim>
| <h:outputText value=" "/><h:message for="line1" styleClass="formUserError"/>
| </h:panelGroup>
|
| <h:outputLabel for="postcode" value="#{msg.registrationPostcode}"/>
| <h:panelGroup>
| <h:inputText id="postcode" value="#{registrationBean.person.address.postcode}"
| maxlength="50" size="20"/><f:verbatim><br/></f:verbatim>
| <h:outputText value=" "/><h:message for="postcode" styleClass="formUserError"/>
| </h:panelGroup>
|
| <h:outputLabel for="country" value="#{msg.registrationCountry}"/>
| <h:panelGroup>
| <h:inputText id="country" value="#{registrationBean.person.address.country}"
| maxlength="150" size="40"/><f:verbatim><br/></f:verbatim>
| <h:outputText value=" "/><h:message for="country" styleClass="formUserError"/>
| </h:panelGroup>
|
The JSF configuration is:
* faces-config.xml:
| <managed-bean>
| <managed-bean-name>registrationBean</managed-bean-name>
| <managed-bean-class>app.web.Register</managed-bean-class>
| <managed-bean-scope>request</managed-bean-scope>
| <managed-property>
| <property-name>person</property-name>
| <value>#{registeringPersonBean}</value>
| </managed-property>
| </managed-bean>
|
| <managed-bean>
| <managed-bean-name>registeringPersonBean</managed-bean-name>
| <managed-bean-class>app.server.entities.Person</managed-bean-class>
| <managed-bean-scope>none</managed-bean-scope>
| <managed-property>
| <property-name>address</property-name>
| <value>#{addressBean}</value>
| </managed-property>
| <managed-property>
| <property-name>gender</property-name>
| <value>Undisclosed</value>
| </managed-property>
| <managed-property>
| <property-name>maritalStatus</property-name>
| <value>Undisclosed</value>
| </managed-property>
| </managed-bean>
|
| <managed-bean>
| <managed-bean-name>addressBean</managed-bean-name>
| <managed-bean-class>app.server.entities.Address</managed-bean-class>
| <managed-bean-scope>none</managed-bean-scope>
| </managed-bean>
|
So when the user enters the data in the JSP/JSF page and press submit the class Register.java is called with the Person ejb data filled, is that correct? As the Person ejb has the methods getAddress and setAddress, shouldn?t the entity manager create the records in the table Address and in the table Person?
Thank you again.
Nei
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4074570#4074570
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4074570
18Â years, 11Â months
[JBoss Seam] - jBoss Seam 2.0 Beta 1 Asynchronicity issues
by vadger
Hello,
I'm trying to launch asynchronicity and I've faced with a number of problems.
What I've done:
| @Stateless
| @Name("prevedMedved")
| public class PrevedBean implements IPreved {
|
| @Logger
| private Log log;
|
| @In(create = true)
| TaskHandler taskHandler;
|
| @Observer("org.jboss.seam.postInitialization")
| public void sayPreved() {
| log.info("PREVEEED MEDVEEEEEED!!!!! ##################");
| log.info("IBVOKING TASKING4 after 1 minute");
| Calendar cal = Calendar.getInstance();
| cal.setTime(new Date());
| cal.add(Calendar.MINUTE, 1);
| taskHandler.sayGreeting("PREVED, KROSAV4EGI", cal.getTime(), 1000L);
| }
| }
| @Local
| public interface TaskHandler {
| @Asynchronous
| void sayGreeting(String greeting, @Expiration Date date, @IntervalDuration Long interval);
| }
|
| @AutoCreate
| @Name("taskHandler")
| public class TaskHandlerBean implements TaskHandler {
|
| @Logger
| Log log;
|
| @Override
| public void sayGreeting(String greeting, Date date, Long interval) {
| log.info("greeting: #0 at #1", greeting, new Date());
| }
|
| }
I just tried to make tasking by example given in documentation.
When the method sayPreved is being invoked after deployment the method sayGreeting is invoked immediatly - not after 1 minute as I expected. In addition I don't see any recurrent invocation. What am I doing wrong?
Another issue. I tried to add <async:timer-service-dispatcher/> to the components.xml as it is written in documentation to use EJB3 Timer. In application deployment I got initilization exception:
.....
Caused by: org.dom4j.DocumentException: Error on line 44 of document : The prefix "async" for element "async:timer-service-dispatcher" is not bound. Nested exception: The prefix "async" for element "async:timer-service-dispatcher" is not bound.
at org.dom4j.io.SAXReader.read(SAXReader.java:482)
at org.dom4j.io.SAXReader.read(SAXReader.java:343)
at org.jboss.seam.util.XML.getRootElement(XML.java:16)
at org.jboss.seam.init.Initialization.initComponentsFromXmlDocument(Initialization.java:130)
As I understand, the schema location for async is not specified. Is it bug?
Thanks
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4074567#4074567
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4074567
18Â years, 11Â months