Beginner |
|
Joined: Thu Mar 24, 2005 6:29 am Posts: 24
|
plz help its urgent i am struck with this
Hibernate version:3.0
I am getting JDBC Exception and also session closed comment i ama attaching the code and the exception below
public static boolean createCoordinators(String catid, int[] userids, boolean recurse) { System.out.println("Printing from createCoordinators"); CategoryReviewer cr = null; String currmilli = null; String [] catids = null; String [] temp = null; int k; try{ temp = getSubCategoriesId(catid); k = getSubCategoriesId(catid).length; }catch(CategoryNotFoundException e) { e.printStackTrace(); return false; } System.out.println("Printing from createCoordinators"); catids = new String[k+1]; catids[0]=catid; if(recurse) { for(int i=1 ; i < k ; k++) { catids[i] = temp[i]; } k= k+1; } HibernateUtil.beginTransaction(); for(int i=0 ; i < userids.length ; i++) { for(int j = 0 ; j < k ; j++) { cr = new CategoryReviewer(); cr.setCategoryId(catid); String id = UniqueIdGenerator.getUniqueId(); cr.setId(id); cr.setCategoryId(catids[j]); cr.setReviewerId(userids[i]); HibernateUtil.getSession().save(cr); } } HibernateUtil.commitTransaction(); HibernateUtil.closeSession(); // your code here return true; } // end createCoordinators
org.hibernate.HibernateException: Session is closed at org.hibernate.jdbc.JDBCContext.connection(JDBCContext.java:94) at org.hibernate.transaction.JDBCTransaction.rollback(JDBCTransaction.ja va:134) at com.transversalnet.hibernate.HibernateUtil.rollbackTransaction(Hibern ateUtil.java:201) at com.transversalnet.hibernate.HibernateUtil.commitTransaction(Hibernat eUtil.java:186) at com.transversalnet.docmanager.category.CategoryManager.createCoordina tors(CategoryManager.java:382) at com.transversalnet.docmanager.category.CategoryUtil.addCategoryCoordi nators(CategoryUtil.java:84) at com.transversalnet.servlets.docmanager.CategoryControllerServlet.doGe t(CategoryControllerServlet.java:64) at com.transversalnet.servlets.docmanager.CategoryControllerServlet.doPo st(CategoryControllerServlet.java:77) at javax.servlet.http.HttpServlet.service(HttpServlet.java:709) at javax.servlet.http.HttpServlet.service(HttpServlet.java:802) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(Appl icationFilterChain.java:237) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationF
Name and version of the database you are using:
The generated SQL (show_sql=true):
Debug level Hibernate log excerpt:
Thankz in advance
|
|