Seam not releasing connections from the pool
yasudevil Jun 30, 2009 10:02 PMHi I'm using Seam Managed Persistence in my application.
I have a page with 2 select boxes that are populates trough a method call from a Sem Managed SFSB.
This two methods have only this signature
entityManager.createQuery("select o from Usuario o").getResultList();I can't find the source of my problem but after some use of the SFSB my connections from the pool ends all used up.
This is my SFSB source code.
@Stateful
@Name("connectorAction")
@Local(ConnectorActionInterface.class)
@Remote(ConnectorActionInterface.class)
@Scope(ScopeType.CONVERSATION)
public class ConnectorAction implements ConnectorActionInterface {
/**
* EntityManager
*/
@In
protected EntityManager entityManager;
/**
* Connector properties
*/
@In @Out
protected Connector connector;
/**
* Selected connector
*/
private Integer selectedConnectorId;
/**
* List of connectors
*/
@DataModel
protected List<Connector> connectorList;
/**
* Factory for Connector type
* @return list of connector type
*/
@Factory("connectorTypeList")
@SuppressWarnings(value = "unchecked")
@End
public List<ConnectorType> typeListFactory() {
return entityManager.createQuery("select o from ConnectorType o").getResultList();
}
/**
* Factory for Connector Direction
* @return list of connector direction
*/
@Factory("connectorDirectionList")
@SuppressWarnings(value = "unchecked")
@End
public List<ConnectorDirection> directionListFactory() {
return entityManager.createQuery("select o from ConnectorDirection o").getResultList();
}
/**
* Insert a connector
*
* @return connector search
*/
@Override
public String insert() {
return "ok";
}
/**
* Searches a connector
*
* @return connector search
*/
@SuppressWarnings("unchecked")
//@Factory("connectorList")
@Override
public List<Connector> search() {
HibernateSessionProxy session = ((HibernateSessionProxy) entityManager.getDelegate());
Example example = Example.create(connector).excludeZeroes() // exclude zero valued properties
.ignoreCase() // perform case insensitive string comparisons
.enableLike(MatchMode.ANYWHERE); // match string anywhere on the fields
connectorList = session.createCriteria(Connector.class).add(example).list();
return connectorList;
}
/**
* Select a connector
*
* @param selectedConnector selected connector
* @return String jsf control
*/
@Override
@Begin(join = true)
public String selectConnector(Connector selectedConnector) {
selectedConnectorId = selectedConnector.getId();
connector = selectedConnector;
return "goNewConnector";
}
/**
* Creates a connector
*
* @return String jsf control
*/
@Override
@End
public String create() {
connector.setServiceInterfaceType(
(ServiceInterfaceType) entityManager.find(ServiceInterfaceType.class, 1));
entityManager.persist(connector);
return "created";
}
/**
* Removes a connector
*
* @return String jsf control
*/
@Override
@End
public String remove() {
connector = entityManager.find(Connector.class, selectedConnectorId);
entityManager.remove(connector);
return "created";
}
/**
* Removing instances
*/
@Remove
@Override
@End
public void destroy() {
connector = null;
connectorList = null;
}
}