[JBoss Seam] - use seam gen to connect to mssql server
by JoviJojo
Hi all,
i used seam gen to generate a new seam project for my application. in the seam gen setup dialog, i wanted to directly connect to mssql server, i am VERY POSITIVE that i used the right driver class and right connection url, but i can NEVER connect to sql server directly.
HOWEVER, if i tried to connect to hypersonic database first, then modify the ds.xml file so that it will connect to mssql server, then it WORKED.
has anybody anywhere mentioned that using seam gen you can only connect to hypersonic database first? and NOT DIRECTLY to other database? the only way to connect to other databases is to modify the ds.xml file? this is my experience anyway using seam gen.
it does not make any sense this way, so please somebody could answer this question,
many thanks, Joan
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4000925#4000925
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4000925
19 years, 3 months
[Management, JMX/JBoss] - Re: Listing all EJBs through JMX
by danieldestro
Finally I achieved what I wanted.
The code bellow shows all the "ejb-jar.xml" deployed in the container.
package test;
|
| import java.lang.reflect.Method;
| import java.util.*;
| import javax.management.*;
| import org.jboss.jmx.adaptor.control.*;
| import org.jboss.mx.server.*;
| import org.jboss.mx.util.*;
|
| public class Test {
| public void getDeploymentDescriptors() {
| String query = "jboss.management.local:*,j2eeType=EJBModule";
| MBeanServer server = (MBeanServer) MBeanServerLocator.locateJBoss();
| Set matches = server.queryMBeans( new ObjectName( query ), null );
| Iterator it = matches.iterator();
| while( it.hasNext() ) {
| ObjectInstance soi = (ServerObjectInstance) it.next();
| ObjectName objName = soi.getObjectName();
|
| String objectNameString = objName.toString();
| MBeanInfo mbeanInfo = server.getMBeanInfo(objName);
| MBeanAttributeInfo[] attributeInfo = mbeanInfo.getAttributes();
|
| for( int a=0; a < attributeInfo.length; a++ ) {
| MBeanAttributeInfo attrInfo = attributeInfo[a];
| if( !"deploymentDescriptor".equals( attrInfo.getName() ) ) {
| continue;
| }
| AttrResultInfo attrResult = Server.getMBeanAttributeResultInfo(objectNameString, attrInfo);
| String attrValue = attrResult.getAsText();
|
| //prints out the "ejb-jar.xml"
| System.out.println( attrValue );
| }
| }
| }
| }
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4000917#4000917
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4000917
19 years, 3 months
[JBoss Seam] - Refresh entities
by hispeedsurfer
How can I refresh entities in the following case.
I have a page that contains:
<div class="entry">
| <a4j:log hotkey="M" />
| <a4j:commandButton value="Reload" reRender="Sensor"/>
| <div class="label">Sensor:</div>
| <div class="input">
| <a4j:region renderRegionOnly="false">
| <h:selectOneMenu id="Sensor" value="#{messkette.sensor}"
| converter="#{selectItemHelfer}" required="true" disabled="#{gesperrt}">
| <f:selectItems value="#{messketteEditor.alleSensorenMitBlank}" />
| <a4j:support event="onchange" reRender="Funktion, Sensormessbereich, Einheit, Sensorwarnung" />
| </h:selectOneMenu>
| </a4j:region>
| <h:message for="Sensor" styleClass="message" />
| <div><h:outputText id="Sensorwarnung" value="#{messketteEditor.sensorWarnung}" styleClass="kursiv" /></div>
| </div>
| </div
Sometimes I need to edit or create a entry from database in a second instance of web browser. So the list in messketteEditor has changed. But when I perform the Reload commandButton the outcome is the same with no changes.
What I have to do tell the Entitymanger to refresh the list from database.
Here the function that will be executet when a entity is changed or created
public String speichern() {
|
| checkKorrekterAufruf();
|
| if (!vorSpeichern()) {
| ejbCtx.setRollbackOnly();
| return null;
| }
|
| try {
|
| String message = "";
|
| T entity = getEntity();
|
| if (neu) {
| //Neues Entity, anlegen
| em.persist(entity);
| message = angelegtMessage();
| loggeAenderung(getEntity(), "angelegt");
| } else {
| //Bestehendes Entity, Änderungen übernehmen
| setEntity(em.merge(entity));
| message = bearbeitetMessage();
| loggeAenderung(getEntity(), "bearbeitet");
| }
|
| nachSpeichern();System.out.println(entity);
|
| em.flush();
|
| addMessage(message);
|
| } catch (Exception ex) {
| ejbCtx.setRollbackOnly();
| addWarning(speichernError() + " " + exceptionListe(ex));
| System.out.println(ex.getMessage());
| ex.printStackTrace();
|
| return null;
| }
|
| return zurueckOutcome;
| }
and this is the code to return the list
private List<StandardEntity> listeHolen(Class<? extends StandardEntity> klasse, String where, String order) {
|
| String klassenName = klasse.getName();
|
| String query = "from " + klassenName;
| if (where != null)
| query += " where " + where;
| if (order != null)
| query += " order by " + order;
|
| List<StandardEntity> liste;
|
| try {
| liste = (List<StandardEntity>) em.createQuery(query).getResultList();
| } catch (Exception ex) {
| //Im Fehlerfall (z.B. nichts gefunden) leere Liste erzeugen
| ex.printStackTrace();
| liste = new Vector<StandardEntity>();
| }
|
| return liste;
| }
Is there a solution for this case?
Thanks
andi
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4000915#4000915
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4000915
19 years, 3 months