-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 
Author Message
 Post subject: Error when updating database
PostPosted: Sat Jun 25, 2005 3:22 am 
Beginner
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


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.