[JBoss Seam] - Re: Dynamic user for database connection
by ajaystl
Hello Wiberto, I would need to do something similar, where I would need to make a user specific connection to Oracle when the user logs in to the application. Can you please post the relevant pieces of code ? Thx in advance !
"wiberto" wrote : I had to do something along the same lines, where my database information was specific to each user logging in.
|
| What I ended up doing was implementing my own Persistence Context manager and that object got a User object injected that had some database information then on the getEntityManager I would create my own datasource and used the HibernatePersistence API directly. Then in the entity class I would specify the component to use when injecting the EntityManager.
|
| Let me know if this is what you want I can post an example.
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4097642#4097642
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4097642
18Â years, 8Â months
[JBoss Seam] - Re: Using Seam and Groovy together question
by norman.richardsï¼ jboss.com
The main advantage is simply being able to write in Groovy. If you can write a component more quickly using less code that is more understandable, that's a win. Groovy development doesn't require a compile step, which might make your development faster. Basically, if you prefer Groovy, for whatever reason, Seam is there for you. I think being able to write a facelets template that talks directly to a groovy component is pretty neat thing, but if you don't already have a need/desire to use Groovy, stick with Java. There's no obligation to make use of it.
We don't provide any direct integration with other Groovy technologies like GSP, but we'd welcome any Groovy users out there to try it out and report back. We're rather eager to make Seam more groovy.
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4097640#4097640
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4097640
18Â years, 8Â months
[JBoss Seam] - passing variables to a SFSB method from JSF component
by asookazian
Is it possible to pass variables to a SFSB from a JSF as follows?:
<h:column>
| <f:facet name="header">Account Approved?</f:facet>
|
| <h:selectOneRadio value="#{myRow[1].icomsAccountApproved}" onclick="processNote(this, #{myAuditList.getRowIndex()}, 'accountApproved')">
| <f:selectItems value="#{securityAuditAction.securityAuditRadioButtons}" />
| </h:selectOneRadio>
| <h:graphicImage value="/img/icon_edit.gif" onclick="editNote(this);" rendered="noteAction.checkGraphic(#{myAuditList.getRowIndex()}, 'accountApproved')"/>
| </h:column>
I'm interested in showing/hiding the graphic based on ceratin conditions that will be evaluated in the SFSB method call. Is that the proper way to pass two variables to the SFSB method?
Also, I will need to do this evaluation on page rendering for several of these same graphics for multiple cells in the dataTable. The purpose of the graphic is to allow the user to edit an existing comment they had previously entered. Thus, the graphic only displays once they have entered a comment/note for that particular cell. thx.
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4097638#4097638
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4097638
18Â years, 8Â months
[Messaging, JMS & JBossMQ] - Message Driven Bean consuming response
by ddurstï¼ mechdrives.com
I am currently running JBoss 4.04.GA.
I am trying to create a Message Driven Bean that onMessage persists some data using the local interface of a session bean and then sends the JMS client a response.
The problem: When I send the response message from the MDB, the MDB picks this message up from the Queue and starts onMessage again (Hence it consumes the response). I know there has to be a really simple fix for this but I am just missing it.
Thanks in advance.
Here is my code for the MDB:
public void onMessage(Message message) {
ObjectMessage msg = null;
Queue queue = null;
QueueConnection connection = null;
QueueSession session = null;
MessageProducer producer = null;
try {
if (message instanceof ObjectMessage) {
msg = (ObjectMessage) message;
Order e = (Order) msg.getObject();
System.out.println("Received new Order");
e = save(e);
System.out.println("Created new Order: "+e.getId());
sendResponse(e,msg.getJMSReplyTo());
}
} catch (JMSException e) {
e.printStackTrace();
mdc.setRollbackOnly();
} catch (Throwable te) {
te.printStackTrace();
}
}
public void sendResponse(Order order, Destination destination) {
ObjectMessage msg = null;
Queue queue = null;
QueueConnection connection = null;
QueueSession session = null;
MessageProducer producer = null;
try {
InitialContext ctx = new InitialContext();
queue = (Queue) ctx.lookup("queue/mdb");
QueueConnectionFactory factory = (QueueConnectionFactory) ctx.lookup("ConnectionFactory");
connection = factory.createQueueConnection();
session = connection.createQueueSession(false, QueueSession.AUTO_ACKNOWLEDGE);
producer = session.createProducer(destination);
ObjectMessage outMessage = session.createObjectMessage();
outMessage.setStringProperty("RECIPIENT", "CLIENT");
outMessage.setObject(order);
System.out.println("Sending response");
producer.send(destination,outMessage);
System.out.println("Response sent");
producer.close();
} catch (JMSException e) {
e.printStackTrace();
mdc.setRollbackOnly();
} catch (Throwable te) {
te.printStackTrace();
}
}
Here is my code for the JMS Client:
public Order submitOrder(Order order) {
Queue queue = null;
QueueConnection connection = null;
QueueSession session = null;
MessageProducer producer = null;
QueueReceiver consumer = null;
try {
InitialContext ctx = new InitialContext();
queue = (Queue) ctx.lookup("queue/mdb");
QueueConnectionFactory factory =
(QueueConnectionFactory) ctx.lookup("ConnectionFactory");
connection = factory.createQueueConnection();
session = connection.createQueueSession(false,
QueueSession.AUTO_ACKNOWLEDGE);
consumer = session.createReceiver(queue);
producer = session.createProducer(queue);
ObjectMessage outMessage = session.createObjectMessage();
outMessage.setObject(order);
producer.send(outMessage);
producer.close();
Message inMessage = consumer.receive(2000);
if(inMessage != null) {
if(inMessage instanceof ObjectMessage) {
ObjectMessage msg = (ObjectMessage)inMessage;
if(msg.getObject() instanceof Order) {
return (Order) msg.getObject();
}
}
}
connection.close();
} catch (JMSException ex) {
ex.printStackTrace();
} catch (NamingException ex) {
ex.printStackTrace();
}
return null;
}
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4097634#4097634
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4097634
18Â years, 8Â months