Hello!
I have the Entity Listener, and I want to inject a SessionContext into it:
public class EntityBeanListener {
private @Resource SessionContext context;
...
@PostPersist
void afterInsert(Object obj) {
Queue q = (Queue) context.lookup("queue/MyOwnQueue");
QueueConnectionFactory factory = (QueueConnectionFactory) context.lookup("ConnectionFactory");
QueueConnection cnn = factory.createQueueConnection();
QueueSession session = cnn.createQueueSession(false, QueueSession.AUTO_ACKNOWLEDGE);
TextMessage msg = session.createTextMessage("Inserted");
QueueSender sender = session.createSender(q);
sender.send(msg);
};
.....
};