• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

How to close a CMP Entity Bean

 
Alex Ioannou
Greenhorn
Posts: 25
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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)
 
Ajith Kallambella
Sheriff
Posts: 5782
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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?
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic