ibatis-user-java mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Larry Meadors <larry.mead...@gmail.com>
Subject Re: Delete records from Database
Date Mon, 09 May 2005 12:05:27 GMT
We need more than "my deleteEventAction doesen't work" here.

Are you getting SQLException? NullPointer? Stack trace? Referential 
constraints? Throw us a bone here. :)

Is this iBATIS 1.x? It looks like it - you should be using 2.x for new 
development.

On 5/8/05, Laura Matei <matei_laura@yahoo.com> wrote:
> 
> Hi!
> I need some help with deleting some records from the database. I have two 
> tables EVENT with column: eventId and EVENTTIMETABLE with columns: 
> eventTimeTableId and eventId. I want to delete an event with a certain Id 
> and all the timetables corresponding to that event. I will send my code... 
> if you please look at it and tell me what I do wrong because my 
> deleteEventAction doesen't work!
>   public void deleteEvent(int eventId) throws DaoException {
> try {
> eventDaoManager.startTransaction();
> eventDao.deleteEvent(eventId);
> eventDaoManager.commitTransaction();
> } catch (DaoException e) {
> try { storeDaoManager.rollbackTransaction(); } catch (Exception e2) 
>  throw ((DaoException) e.fillInStackTrace());
> }
> }
>    void deleteEvent(int eventId)
> throws DaoException;
>   public void deleteEvent(int eventId)
> throws DaoException {
> Object parameterObject = new Integer(eventId);
> executeUpdate("deleteEvent", parameterObject);
> }
>    <mapped-statement name="deleteEvent">
> delete EVENT,EVENTTIMETABLE fromEVENT,EVENTTIMETABLE where EVENT.EVENTID = 
> #value# and EVENT.EVENTID = EVENTTIMETABLE.EVENTID
> </mapped-statement>
>   public class DeleteEventAction extends BaseAction {
>   public ActionForward doPerform(ActionMapping mapping, ActionForm form, 
> HttpServletRequest request, HttpServletResponse response) throws Exception {
>   OrganizAccountForm orgAcctForm = (OrganizAccountForm) form;
> String orgUsername = orgAcctForm.getOrganizAccount().getOrgUsername();
>  int eventId = Integer.parseInt(request.getParameter("eventId"));
> 
> tugis.deleteEvent(eventId);
>   request.setAttribute("eventList", tugis.getEventsByOrgUsername
> (orgUsername));
>  return mapping.findForward("success");
> }
> }
>  <action path="/portal/deleteEvent" type="
> tugis.presentation.action.DeleteEventAction"
> name="organizAccountForm" scope="session"
> validate="true" input="/jsp/ViewRegisteredEvent.jsp">
> <forward name="success" path="/jsp/ListEvents.jsp"/>
> </action>
>   And in the JSP code:
>   <html:link paramId="eventId" paramName="event" paramProperty="eventId" 
> page="/portal/deleteEvent.do">Delete</html:link> 
>   Well, please someone take a look and help me out! Or maybe someone have 
> done something similar already and send me an example!
>  Thanks!
> Laura 
>  
> ------------------------------
> Discover Yahoo!
> Have fun online with music videos, cool games, IM & more. Check it out!<http://us.rd.yahoo.com/evt=32660/*http://discover.yahoo.com/online.html>

> 
>

Mime
View raw message