[JBoss Seam] - Error selecting object problem
by jamesjmp
hi,
In a form I´ve a h:selectOneMenu which is filled according to the values of a List.
| <s:decorate id="firmCodeDecoration" template="layout/edit.xhtml">
| <ui:define name="label">#{messages['Firm']}</ui:define>
| <h:selectOneMenu value="#{rstReportHome.instance.firm}" required="true" id="firm">
| <s:selectItems value="#{firmList.resultList}" var="firm" label="#{firm.firmCode}" />
| <s:convertEntity/>
| <a:support event="onchange" reRender="firmCodeDecoration"/>
| </h:selectOneMenu>
| </s:decorate>
|
Component firmList is seam-gened with just a simple query this way:
| @Override
| public String getEjbql() {
| return "select firm from Firm firm";
| }
I want in my selectOneMenu to display all the values of table Firm, but I do want an extra value as well.
Let´s call it "Automatic".
I´ve added the following to component firmList:
| @Override
| public List<Firm> getResultList() {
| System.out.println("firmList getResultList!!");
| Firm auto = new Firm();
| auto.setFirmCode("AUTOMATIC");
| CfgCurrency cfgCurrency = new CfgCurrency();
| cfgCurrency.setCurrencyCode(60);
| auto.setCfgCurrency(cfgCurrency);
| List<Firm> firmas = new ArrayList<Firm>();
| firmas.add(auto);
| firmas.addAll(super.getResultList());
| System.out.println("firmas.size: "+firmas.size());
| return firmas;
| }
|
After adding this, selectOneMenu displays AUTOMATIC value as well as the rest retrieved by the query.
But when I press a button that performs persist() ajax validation displays red message besides with "Error selecting object" only If I choose Automatic option.
I guess it must be something related with s:convertEntity, but I´m not sure how to tackle it.
This is firm object:
| @Entity
| @Table(name = "FIRM", catalog = "prisk")
| public class Firm implements java.io.Serializable {
|
| private String firmCode;
| private CfgCurrency cfgCurrency;
| private String firmDescription;
| private Set<RstReport> rstReports = new HashSet<RstReport>(0);
| private Set<Fund> funds = new HashSet<Fund>(0);
|
| public Firm() {
| firmCode = "";
| firmDescription = "";
| }
|
What is the best way to add an extra value (apart from those provided by the query) to be displayed in a selectOneMenu?
If overriding getResultList is one of the ways, why I´m having that validation problem?
thanks in advance!
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4102282#4102282
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4102282
18 years, 6 months
[Performance Tuning] - checkConnection() consumes over 50% of CPU?
by 8forty
I'm using JBoss AS 4.0.5, and have a @Service bean that, when called from a client, queues units of work that are forwarded to a @Stateless bean from a timer loop. The @Stateless bean then spends a lot of time working.
When profiling the server (using yourkit), no matter how much CPU time the @Stateless bean spends on the work unit, more CPU time is spent in org.jboss.remoting.transport.socket.ServerSocketWrapper.checkConnection() (more specifically, all of the time is in ObjectInputStream.readByte()). The @Stateless bean makes occasional calls to other @Stateless and @Service beans in the same JBoss instance/JVM, but makes no network calls.
I've googled and searched the forums and haven't found anything that helps explain the purpose of the checkConnection() calls. Is there anything I can do to eliminate them, or at least reduce the load they are causing on my server?
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4102281#4102281
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4102281
18 years, 6 months
[Beginners Corner] - static library conflict
by marcobaroetto
Hello, I'm trying to deploy 2 applications under JBoss 4.0.5. Both applications use a dbmanager library wich uses a static connection pool to database.
The structure of both my apps is the following:
APPLICATION.ear/
|-- META-INF
| |-- MANIFEST.MF
| `-- application.xml
|
|-- FRONT-END.war
| |-- META-INF
| | `-- MANIFEST.MF
| |-- WEB-INF
| `-- index.jsp
|
|-- BACKEND.jar
|
|-- WEBSERVICES.war
|
|-- lib
| |--various.jar
| `-- dbmanager.jar
application.xml contains 2 web modules (FRONTEND & WEBSERVICES) and 1 java module (BACKEND).
dbmanager is used by BACKEND.jar and by the classes of WEBSERVICES.war
FRONTEND.war jsp's use BACKEND.jar
the 2 applications should connect to different databases and the connection is static so i need 2 different dbmanager jars.
The problem is the following:
- When i call a webservice of WEBSERVICES.war i noticed that the db connection used is the one of the first application deployed. It seems both applications use the same dbmanager and they get the same connection.
- When i use the BACKEND.jar from the frontend the separation is correct and the applications get different connection.
I tried to put true in
/J-Boss/server/default/deploy/ear-deployer.xml but i get the following:
- When i call a webservice of WEBSERVICES.war the separation is correct and the applications get different connection.
- When i use the BACKEND.jar from the frontend i get the exception:
java.lang.LinkageError: loader constraint violation: loader (instance of org/jboss/web/tomcat/tc5/WebAppClassLoader) previously initiated loading for a different type with name "javax/xml/namespace/QName"
at it.namespace.myapp.WebServices.clients.HelloWorldService.HelloWorldServiceSoap_BindingStub._initOperationDesc1
any hint?
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4102277#4102277
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4102277
18 years, 6 months