facebook

Hibernate Troubles

  1. MyEclipse IDE
  2.  > 
  3. Off Topic
Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #271113 Reply

    wordybird
    Member

    What I am trying to do is delete all the items in a join table with an given FK ‘id’.

    The code I use to do this follows and I always get the same error.

    How would this be accomplished?

    
            try{
                    trans = pgjDao.getSession().beginTransaction();
                    PermissionsGroupJoin exp = new PermissionsGroupJoin();
                    
                    List pgjList = pgjDao.findByProperty("permissionsGroup", id );
                    
                    for(int i=0; i < pgjList.size(); i++ ){
                        pgjDao.delete( (PermissionsGroupJoin)pgjList.get(i) );
                    }
                    
                    trans.commit();
                    pgjDao.getSession().close();
                
            } catch (Exception e) {
                trans.rollback();                                                                // On error, rollback the transaction.
                e.printStackTrace();
                return false;
            } finally {
                if (pgjDao != null) {
                    pgjDao.getSession().close();
                }
            }
    

    java.lang.ClassCastException: java.lang.Integer
    at org.hibernate.type.EntityType.toLoggableString(EntityType.java:154)
    at org.hibernate.pretty.Printer.toString(Printer.java:65)
    at org.hibernate.engine.QueryParameters.traceParameters(QueryParameters.java:256)
    at org.hibernate.engine.query.HQLQueryPlan.performList(HQLQueryPlan.java:149)
    at org.hibernate.impl.SessionImpl.list(SessionImpl.java:1106)
    at org.hibernate.impl.QueryImpl.list(QueryImpl.java:79)
    at com.tcn.skunk.db.PermissionsGroupJoinDAO.findByProperty(PermissionsGroupJoinDAO.java:80)
    at backoffice.functions.PermissionsFunctions.savePermissionsGroup(PermissionsFunctions.java:318)
    at backoffice.gui.permissions.ManageGroupPermissionsWindow.doSave(ManageGroupPermissionsWindow.java:190)
    at backoffice.gui.permissions.ManageGroupPermissionsWindow.access$300(ManageGroupPermissionsWindow.java:39)
    at backoffice.gui.permissions.ManageGroupPermissionsWindow$2.actionPerformed(ManageGroupPermissionsWindow.java:324)
    at nextapp.echo2.app.button.AbstractButton.fireActionPerformed(AbstractButton.java:135)
    at nextapp.echo2.app.button.AbstractButton$1.actionPerformed(AbstractButton.java:100)
    at nextapp.echo2.app.button.DefaultButtonModel.fireActionPerformed(DefaultButtonModel.java:70)
    at nextapp.echo2.app.button.DefaultButtonModel.doAction(DefaultButtonModel.java:58)
    at nextapp.echo2.app.button.AbstractButton.doAction(AbstractButton.java:121)
    at nextapp.echo2.app.button.AbstractButton.processInput(AbstractButton.java:506)
    at nextapp.echo2.app.update.ClientUpdateManager.process(ClientUpdateManager.java:116)
    at nextapp.echo2.app.update.UpdateManager.processClientUpdates(UpdateManager.java:89)
    at nextapp.echo2.webcontainer.ContainerSynchronizeService.renderUpdate(ContainerSynchronizeService.java:472)
    at nextapp.echo2.webrender.service.SynchronizeService.service(SynchronizeService.java:279)
    at nextapp.echo2.webrender.WebRenderServlet.process(WebRenderServlet.java:273)
    at backoffice.backofficeServlet.process(backofficeServlet.java:24)
    at nextapp.echo2.webrender.WebRenderServlet.doPost(WebRenderServlet.java:189)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:154)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:92)
    at com.caucho.server.dispatch.ServletFilterChain.doFilter(ServletFilterChain.java:106)
    at com.caucho.server.webapp.WebAppFilterChain.doFilter(WebAppFilterChain.java:178)
    at com.caucho.server.dispatch.ServletInvocation.service(ServletInvocation.java:229)
    at com.caucho.server.http.HttpRequest.handleRequest(HttpRequest.java:259)
    at com.caucho.server.port.TcpConnection.run(TcpConnection.java:386)
    at com.caucho.util.ThreadPool.runTasks(ThreadPool.java:490)
    at com.caucho.util.ThreadPool.run(ThreadPool.java:423)
    at java.lang.Thread.run(Thread.java:613)

    #271133 Reply

    Riyad Kalla
    Member

    Moving to OT > Soft Dev

Viewing 2 posts - 1 through 2 (of 2 total)
Reply To: Hibernate Troubles

You must be logged in to post in the forum log in