This week's book giveaway is in the OCAJP 8 forum. We're giving away four copies of OCA Java SE 8 Programmer I Study Guide and have Edward Finegan & Robert Liguori on-line! See this thread for details.
Hi there I have a for loop going through an ArrayList of Maps. In each iteration all the data in the map is converted into a new EJB using a custom create method. The problem is that the java/ejb container/whatever can't keep up and the database connections just mushroom until exceptions are thrown. How do a manually close the bean to free up the resources? Is the fact that the arraylist might contain over 8,000 maps an issue? And don't say a word about BMP as this is out of the question!! At present I have (in shorthand)
There is nothing you can do to "release" a bean. Bean instances are managed by the container and it uses its own set of proprietary algorithms to determine when and which beans should be evicted from memory. Coming back to your design, if you are inserting 8000 records in a single transaction perhaps you should try to hit the database directly. Entity beans are quite expensive and more so in situations like this one. Have you considered batch inserts using plain old JDBC?
Open Group Certified Distinguished IT Architect. Open Group Certified Master IT Architect. Sun Certified Architect (SCEA).