[JBoss Seam] - Re: Drools (JBoss Rules) Hibernate Query and EntityManager
by ellenzhao
@damianharvey:
You can tie Seam and Drools like this:
In your conversation bean, you say:
| ...
| @In
| private RuleBase myRuleBase; // you must have already this rule base defined in your component.xml. Please refer to Seam manual.
|
| ...
|
| public void eatCheese(){
| // you can also use stateful rule session here. Please refer to Drools' manual
| StatelessSession ruleSession = myRuleBase.newStatelessSession();
| ruleSession.setGlobal("entityManager", entityManager);
| ruleSession.setGlobal("anotherResource", anotherResource);
| ...
| ruleSession.execute(cheeseList);
| }
|
| ...
|
|
In your .drl file, you can define the entityManager as global so all your rules in that rule package can share this single entityManager. You can ask entityManager to fetch the data you want at LHS and do things like entityManager.flush() at RHS.
Enjoy!
Ellen
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4065864#4065864
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4065864
18Â years, 9Â months
[JNDI/Naming/Network] - Exception while Storing Event in Database : Could not get JD
by smaskar
I am persisting data into the MSSQL Server 2005 database using the JNDI lookup. I can insert the single record at a time, but when I ran the test program for 10 or 20 records i am getting the following exception on Jboss
Configuration details : JBoss, Spring, MSSQL server 2005, Jdk 5
JNDI mapping from JBOSS
<?xml version="1.0" encoding="UTF-8"?>
<local-tx-datasource>
<jndi-name>jdbc/miramar</jndi-name>
<!-- allows DS to be accessed remotely -->
<use-java-context>false</use-java-context>
<connection-url>jdbc:inetdae7:localhost:1434?database=miramar&secureLevel=0</connection-url>
<driver-class>com.inet.tds.TdsDriver</driver-class>
<user-name>sa</user-name>
admin123
<min-pool-size>5</min-pool-size>
<max-pool-size>50</max-pool-size>
<type-mapping>MS SQLSERVER2000</type-mapping>
</local-tx-datasource>
Exception :
14:07:06,812 INFO [myMDB] Exception while Storing Event in Database : Could not get JDBC Connection; nested exception is org.jboss.util.Neste
dSQLException: Could not create connection; - nested throwable: (com.inet.tds.r: java.net.SocketExceptionjava.net.SocketException: Connection reset); - neste
d throwable: (org.jboss.resource.JBossResourceException: Could not create connection; - nested throwable: (com.inet.tds.r: java.net.SocketExceptionjava.net.S
ocketException: Connection reset))
14:07:06,812 INFO [STDOUT] org.jboss.util.NestedSQLException: Could not create connection; - nested throwable: (com.inet.tds.r: java.net.SocketExceptionjava
.net.SocketException: Connection reset); - nested throwable: (org.jboss.resource.JBossResourceException: Could not create connection; - nested throwable: (co
m.inet.tds.r: java.net.SocketExceptionjava.net.SocketException: Connection reset))
14:07:06,812 INFO [STDOUT] at org.jboss.resource.adapter.jdbc.WrapperDataSource.getConnection(WrapperDataSource.java:107)
14:07:06,812 INFO [STDOUT] at org.springframework.jdbc.datasource.DataSourceUtils.doGetConnection(DataSourceUtils.java:112)
14:07:06,812 INFO [STDOUT] at org.springframework.jdbc.datasource.DataSourceUtils.getConnection(DataSourceUtils.java:77)
14:07:06,812 INFO [STDOUT] at org.springframework.orm.ibatis.SqlMapClientTemplate.execute(SqlMapClientTemplate.java:177)
14:07:06,812 INFO [STDOUT] at org.springframework.orm.ibatis.SqlMapClientTemplate.insert(SqlMapClientTemplate.java:356)
14:07:06,812 INFO [STDOUT] at com.org.project.gen.MyDAOImpl.insert(MyDAOImpl.java:25)
14:07:06,812 INFO [STDOUT] at com.org.project.geo.MyTabletDAO.addEvent(MyTabletDAO.java:137)
14:07:06,812 INFO [STDOUT] at com.org.project.mdb.myMDB.onMessage(myMDB.java:72)
14:07:06,812 INFO [STDOUT] at sun.reflect.GeneratedMethodAccessor68.invoke(Unknown Source)
14:07:06,812 INFO [STDOUT] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
14:07:06,812 INFO [STDOUT] at java.lang.reflect.Method.invoke(Method.java:585)
14:07:06,812 INFO [STDOUT] at org.jboss.invocation.Invocation.performCall(Invocation.java:345)
14:07:06,812 INFO [STDOUT] at org.jboss.ejb.MessageDrivenContainer$ContainerInterceptor.invoke(MessageDrivenContainer.java:475)
14:07:06,812 INFO [STDOUT] at org.jboss.resource.connectionmanager.CachedConnectionInterceptor.invoke(CachedConnectionInterceptor.java:185)
14:07:06,812 INFO [STDOUT] at org.jboss.ejb.plugins.MessageDrivenInstanceInterceptor.invoke(MessageDrivenInstanceInterceptor.java:87)
14:07:06,812 INFO [STDOUT] at org.jboss.ejb.plugins.CallValidationInterceptor.invoke(CallValidationInterceptor.java:48)
14:07:06,812 INFO [STDOUT] at org.jboss.ejb.plugins.AbstractTxInterceptor.invokeNext(AbstractTxInterceptor.java:105)
14:07:06,812 INFO [STDOUT] at org.jboss.ejb.plugins.TxInterceptorCMT.runWithTransactions(TxInterceptorCMT.java:335)
14:07:06,812 INFO [STDOUT] at org.jboss.ejb.plugins.TxInterceptorCMT.invoke(TxInterceptorCMT.java:166)
14:07:06,812 INFO [STDOUT] at org.jboss.ejb.plugins.RunAsSecurityInterceptor.invoke(RunAsSecurityInterceptor.java:94)
14:07:06,812 INFO [STDOUT] at org.jboss.ejb.plugins.LogInterceptor.invoke(LogInterceptor.java:192)
14:07:06,812 INFO [STDOUT] at org.jboss.ejb.plugins.ProxyFactoryFinderInterceptor.invoke(ProxyFactoryFinderInterceptor.java:122)
14:07:06,812 INFO [STDOUT] at org.jboss.ejb.MessageDrivenContainer.internalInvoke(MessageDrivenContainer.java:389)
14:07:06,812 INFO [STDOUT] at org.jboss.ejb.Container.invoke(Container.java:873)
14:07:06,812 INFO [STDOUT] at org.jboss.ejb.plugins.jms.JMSContainerInvoker.invoke(JMSContainerInvoker.java:1090)
14:07:06,812 INFO [STDOUT] at org.jboss.ejb.plugins.jms.JMSContainerInvoker$MessageListenerImpl.onMessage(JMSContainerInvoker.java:1392)
14:07:06,812 INFO [STDOUT] at org.jboss.jms.asf.StdServerSession.onMessage(StdServerSession.java:256)
14:07:06,812 INFO [STDOUT] at com.tibco.tibjms.TibjmsSession._submit(TibjmsSession.java:3567)
14:07:06,812 INFO [STDOUT] at com.tibco.tibjms.TibjmsSession._dispatchAsyncMessage(TibjmsSession.java:1963)
14:07:06,812 INFO [STDOUT] at com.tibco.tibjms.TibjmsSession._run(TibjmsSession.java:3054)
14:07:06,812 INFO [STDOUT] at com.tibco.tibjms.TibjmsSession.run(TibjmsSession.java:4204)
14:07:06,812 INFO [STDOUT] at org.jboss.jms.asf.StdServerSession.run(StdServerSession.java:180)
14:07:06,812 INFO [STDOUT] at EDU.oswego.cs.dl.util.concurrent.PooledExecutor$Worker.run(PooledExecutor.java:748)
14:07:06,812 INFO [STDOUT] at java.lang.Thread.run(Thread.java:595)
14:07:06,812 INFO [STDOUT] Caused by: org.jboss.resource.JBossResourceException: Could not create connection; - nested throwable: (com.inet.tds.r: java.net.
SocketExceptionjava.net.SocketException: Connection reset)
14:07:06,812 INFO [STDOUT] at org.jboss.resource.adapter.jdbc.local.LocalManagedConnectionFactory.createManagedConnection(LocalManagedConnectionFactory.
java:161)
14:07:06,812 INFO [STDOUT] at org.jboss.resource.connectionmanager.InternalManagedConnectionPool.createConnectionEventListener(InternalManagedConnection
Pool.java:508)
14:07:06,812 INFO [STDOUT] at org.jboss.resource.connectionmanager.InternalManagedConnectionPool.getConnection(InternalManagedConnectionPool.java:207)
14:07:06,812 INFO [STDOUT] at org.jboss.resource.connectionmanager.JBossManagedConnectionPool$BasePool.getConnection(JBossManagedConnectionPool.java:534
)
14:07:06,812 INFO [STDOUT] at org.jboss.resource.connectionmanager.BaseConnectionManager2.getManagedConnection(BaseConnectionManager2.java:395)
14:07:06,812 INFO [STDOUT] at org.jboss.resource.connectionmanager.TxConnectionManager.getManagedConnection(TxConnectionManager.java:297)
14:07:06,812 INFO [STDOUT] at org.jboss.resource.connectionmanager.BaseConnectionManager2.allocateConnection(BaseConnectionManager2.java:447)
14:07:06,812 INFO [STDOUT] at org.jboss.resource.connectionmanager.BaseConnectionManager2$ConnectionManagerProxy.allocateConnection(BaseConnectionManage
r2.java:874)
14:07:06,812 INFO [STDOUT] at org.jboss.resource.adapter.jdbc.WrapperDataSource.getConnection(WrapperDataSource.java:103)
14:07:06,812 INFO [STDOUT] ... 33 more
14:07:06,812 INFO [STDOUT] Caused by: com.inet.tds.r: java.net.SocketExceptionjava.net.SocketException: Connection reset
14:07:06,812 INFO [STDOUT] at com.inet.tds.k.createSQLException(Unknown Source)
14:07:06,812 INFO [STDOUT] at com.inet.tds.TdsConnection.a(Unknown Source)
14:07:06,812 INFO [STDOUT] at com.inet.tds.TdsConnection.a(Unknown Source)
14:07:06,812 INFO [STDOUT] at com.inet.tds.TdsConnection.(Unknown Source)
14:07:06,812 INFO [STDOUT] at com.inet.tds.q.(Unknown Source)
14:07:06,812 INFO [STDOUT] at com.inet.tds.k.createConnection(Unknown Source)
14:07:06,812 INFO [STDOUT] at com.inet.tds.TdsDriver.connect(Unknown Source)
14:07:06,812 INFO [STDOUT] at org.jboss.resource.adapter.jdbc.local.LocalManagedConnectionFactory.createManagedConnection(LocalManagedConnectionFactory.
java:151)
14:07:06,812 INFO [STDOUT] ... 41 more
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4065862#4065862
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4065862
18Â years, 9Â months
[JBoss Seam] - selectitems-1.1.1beta2 problem
by grdzeli_kaci
hi Peter Muir,
i tried to use your selectitems-1.1.1beta2, but i got an error like this :
| avax.faces.el.PropertyNotFoundException: javax.el.PropertyNotFoundException: /home.xhtml @23,117 label="#{application.remark}": Property 'remark' not found on type org.apache.catalina.core.ApplicationContextFacade
| at javax.faces.component.ValueBindingValueExpressionAdapter.getValue(ValueBindingValueExpressionAdapter.java:104)
| at org.jboss.seam.ui.component.html.HtmlSelectItems.getLabel(HtmlSelectItems.java:108)
| at org.jboss.seam.ui.component.UISelectItems.asSelectItems(UISelectItems.java:154)
| at org.jboss.seam.ui.component.UISelectItems.getValue(UISelectItems.java:99)
| at com.sun.faces.renderkit.RenderKitUtils.getSelectItems(RenderKitUtils.java:323)
| at com.sun.faces.renderkit.html_basic.MenuRenderer.getOptionNumber(MenuRenderer.java:675)
|
| /code]
|
| but remark into my bean exist, here is my example :
| 1.components.xml
|
|
| | <framework:entity-home name="applicationHome"
| | entity-class="com.liliko.billing.businesslayer.beans.entity.jits.Application" />
| | <factory name="application" value="#{applicationHome.instance}" />
| | <framework:entity-query name="applications" ejbql="select a from Application a"/>
| |
| |
| 2.Application Bean:
|
| |
| | @Entity
| | @Table(name = "APPLICATION",schema="JITS")
| |
| | public class Application implements Serializable {
| |
| | @Id
| | @Column(name = "ID", nullable = false)
| | private BigDecimal id;
| |
| | @Column(name = "CODE")
| | private BigInteger code;
| |
| | @Column(name = "REMARK")
| | private String remark;
| |
| | @Column(name = "REC_STATUS")
| | private BigInteger recStatus;
| |
| | @Column(name = "REG_DATE")
| | @Temporal(TemporalType.DATE)
| | private Date regDate;
| |
| | @Column(name = "UPD_DATE")
| | @Temporal(TemporalType.DATE)
| | private Date updDate;
| |
| | @JoinColumn(name = "DESCRIPTION_ID", referencedColumnName = "ID")
| | @ManyToOne
| | private Description descriptionId;
| |
| | @JoinColumn(name = "USER_ID", referencedColumnName = "ID")
| | @ManyToOne
| | private Users userId;
| |
| | @OneToMany(mappedBy = "applicationId")
| | private Collection<ApplicationsConfig> applicationsConfigCollection;
| |
| | /** Creates a new instance of Application */
| | public Application() {
| | }
| |
| | public Application(BigDecimal id) {
| | this.id = id;
| | }
| | public BigDecimal getId() {
| | return this.id;
| | }
| | public void setId(BigDecimal id) {
| | this.id = id;
| | }
| | public BigInteger getCode() {
| | return this.code;
| | }
| | public void setCode(BigInteger code) {
| | this.code = code;
| | }
| | public String getRemark() {
| | return this.remark;
| | }
| | public void setRemark(String remark) {
| | this.remark = remark;
| | }
| |
| | public BigInteger getRecStatus() {
| | return this.recStatus;
| | }
| |
| | public void setRecStatus(BigInteger recStatus) {
| | this.recStatus = recStatus;
| | }
| | public Date getRegDate() {
| | return this.regDate;
| | }
| | public void setRegDate(Date regDate) {
| | this.regDate = regDate;
| | }
| | public Date getUpdDate() {
| | return this.updDate;
| | }
| | public void setUpdDate(Date updDate) {
| | this.updDate = updDate;
| | }
| | public Description getDescriptionId() {
| | return this.descriptionId;
| | }
| | public void setDescriptionId(Description descriptionId) {
| | this.descriptionId = descriptionId;
| | }
| | public Users getUserId() {
| | return this.userId;
| | }
| | public void setUserId(Users userId) {
| | this.userId = userId;
| | }
| | public Collection<ApplicationsConfig> getApplicationsConfigCollection() {
| | return this.applicationsConfigCollection;
| | }
| | public void setApplicationsConfigCollection(Collection<ApplicationsConfig> applicationsConfigCollection) {
| | this.applicationsConfigCollection = applicationsConfigCollection;
| | }
| | @Override
| | public int hashCode() {
| | int hash = 0;
| | hash += (this.id != null ? this.id.hashCode() : 0);
| | return hash;
| | }
| | @Override
| | public boolean equals(Object object) {
| | // TODO: Warning - this method won't work in the case the id fields are not set
| | if (!(object instanceof Application)) {
| | return false;
| | }
| | Application other = (Application)object;
| | if (this.id != other.id && (this.id == null || !this.id.equals(other.id))) return false;
| | return true;
| | }
| | @Override
| | public String toString() {
| | return "tmp.Application[id=" + id + "]";
| | }
| |
| | }
| |
| 3. and view.xhtml :
|
| | <h:selectOneMenu>
| | <s:selectItems value="#{applications.resultList}" var="application" label="#{application.remark}" />
| | <si:convertEntity entityClass="com.liliko.billing.businesslayer.beans.entity.jits.Application"/>
| | </h:selectOneMenu>
| |
|
| did i something incorrect ????
|
| ___________
| Regards,
| Paata.
|
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4065856#4065856
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4065856
18Â years, 9Â months