[jboss-jira] [JBoss JIRA] (AS7-5714) JPA "Session Open Count" statistic appears to be bogus

Jess Sightler (JIRA) jira-events at lists.jboss.org
Tue Oct 9 12:19:07 EDT 2012


Jess Sightler created AS7-5714:
----------------------------------

             Summary: JPA "Session Open Count" statistic appears to be bogus
                 Key: AS7-5714
                 URL: https://issues.jboss.org/browse/AS7-5714
             Project: Application Server 7
          Issue Type: Bug
          Components: JPA / Hibernate
    Affects Versions: 7.1.2.Final (EAP)
            Reporter: Jess Sightler
            Assignee: Scott Marlow
            Priority: Minor


After running a small sample app, Session Open Count in the admin console displays 900006. Session close count is 1 (as expected). Memory usage does not significantly increase.

The sample app exposes an EntityManager like this:

@Produces
public EntityManager getEntityManager() {
    System.out.println("Getting entity manager!");
    return entityManager;
}

A JAX-RS service then injects the entity manager, and performs a few simple queries:

@Inject
private EntityManager entityManager;

@GET()
@Produces("text/plain")
public String sayHello() {
	try {
		userTransaction.begin();
		Car car = new Car();
		car.setCarName("Name: " + System.currentTimeMillis());
		entityManager.persist(car);
		
		Car car2 = new Car();
		car2.setCarName("Name: " + System.currentTimeMillis());
		entityManager.persist(car2);
		
		for (int i = 0; i < 900000; i++) {
			Query q = entityManager.createQuery("select c from Car c");
			List<Car> resultList = q.getResultList();
			for (Car c : resultList) {
                System.out.println("Car: " + c);
			}
		}
    return "stub";
}

I don't see any way that this could actually be opening this many sessions.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira


More information about the jboss-jira mailing list