How do you update multiple items in a JSP that are only checked...

I have list of items in my jsp pages and that are being generated by the following code
and I want to be able to update multiple records that have a checkbox checked:
I have a method to update the status and employee name that uses hibernate that takes the taskID
as a paratmeter to update associated status and comments, but my issue is how to do it with multiple records:
private void updateTaskList(Long taskId, String status, String comments) {
TaskList taskList = (TaskList) HibernateUtil.getSessionFactory()
               .getCurrentSession().load(TaskList.class, personId);
taskList.setStatus(status);
taskList.setComment(comments);
HibernateUtil.getSessionFactory().getCurrentSession().update(taskList);
HibernateUtil.getSessionFactory().getCurrentSession().save(taskList);
<table border="0" cellpadding="2" cellspacing="2" width="98%" class="border">     
     <tr align="left">
          <th></th>
          <th>Employee Name</th>
          <th>Status</th>
          <th>Comment</th>
     </tr>
     <%
          List result = (List) request.getAttribute("result");
     %>
     <%
     for (Iterator itr=searchresult.iterator(); itr.hasNext(); )
          com.dao.hibernate.TaskList taskList = (com.dao.hibernate.TaskList)itr.next();
     %>     
     <tr>
          <td> <input type="checkbox" name="taskID" value=""> </td>
          <td>
               <%=taskList.empName()%> </td>           
          <td>          
               <select value="Status">
               <option value="<%=taskList.getStatus()%>"><%=taskList.getStatus()%></option>
                    <option value="New">New</option>
                    <option value="Fixed">Fixed</option>
                    <option value="Closed">Closed</option>
               </select>          
</td>
          <td>               
               <input type="text" name="Comments" MAXLENGTH="20" size="20"
               value="<%=taskList.getComments()%>"></td>
     </tr>
<%}%>
_________________________________________________________________

org.hibernate.exception.GenericJDBCException: could not load an entity: [com.dao.hibernate.WorkList#2486]
org.hibernate.exception.SQLStateConverter.handledNonSpecificException(SQLStateConverter.java:91)
org.hibernate.exception.SQLStateConverter.convert(SQLStateConverter.java:79)
org.hibernate.exception.JDBCExceptionHelper.convert(JDBCExceptionHelper.java:43)
org.hibernate.loader.Loader.loadEntity(Loader.java:1799)
org.hibernate.loader.entity.AbstractEntityLoader.load(AbstractEntityLoader.java:93)
org.hibernate.loader.entity.AbstractEntityLoader.load(AbstractEntityLoader.java:81)
org.hibernate.persister.entity.AbstractEntityPersister.load(AbstractEntityPersister.java:2730)
org.hibernate.event.def.DefaultLoadEventListener.loadFromDatasource(DefaultLoadEventListener.java:365)
org.hibernate.event.def.DefaultLoadEventListener.doLoad(DefaultLoadEventListener.java:346)
org.hibernate.event.def.DefaultLoadEventListener.load(DefaultLoadEventListener.java:123)
org.hibernate.event.def.DefaultLoadEventListener.proxyOrLoad(DefaultLoadEventListener.java:161)
org.hibernate.event.def.DefaultLoadEventListener.onLoad(DefaultLoadEventListener.java:87)
org.hibernate.impl.SessionImpl.fireLoad(SessionImpl.java:889)
org.hibernate.impl.SessionImpl.load(SessionImpl.java:808)
org.hibernate.impl.SessionImpl.load(SessionImpl.java:801)
com.web.UpdateWorkListAction.execute(Unknown Source)
org.apache.struts.action.RequestProcessor.processActionPerform(RequestProcessor.java:431)
org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:236)
org.apache.struts.action.ActionServlet.process(ActionServlet.java:1196)
org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:432)
javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
javax.servlet.http.HttpServlet.service(HttpServlet.java:810)
org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96)
before I was running a single update as below and it worked fine:
session.beginTransaction();
int taskId = Integer.parseInt(request.getParameter("taskId"));
String action_taken = request.getParameter("action_taken");
WorkListErrors worklistErrors
= (WorkListErrors) session.load(WorkListErrors.class, new Integer(taskId));
worklistErrors.setAction_taken(action_taken);
session.update(worklistErrors);
session.save(worklistErrors);
session.getTransaction().commit();
but when I try an an update on multiple records it does work when I have a check box checked :
session.beginTransaction();
int taskId = Integer.parseInt(request.getParameter("taskId"));
String action_taken = request.getParameter("action_taken");
WorkListErrors worklistErrors
= (WorkListErrors) session.load(WorkListErrors.class, new Integer(taskId));
worklistErrors.setAction_taken(action_taken);
session.update(worklistErrors);
session.save(worklistErrors);
session.getTransaction().commit();
session.beginTransaction();
String[] tickedTaskId = request.getParameterValues("tickedTaskId");
String[] taskId = request.getParameterValues("taskId");
String[] action_taken = request.getParameterValues("action_taken");
for(int i=0; i<tickedTaskId.length; i++) {
for(int j = 0; j < taskId.length; j++) {
if(tickedTaskId.equals(taskId[j])) {
WorkListErrors worklistErrors
= (WorkListErrors) session.load(WorkListErrors.class, tickedTaskId[i]);
worklistErrors.setAction_taken(action_taken[j]);
session.update(worklistErrors);
session.save(worklistErrors);
session.getTransaction().commit();
/*Close session */
session.close();

Similar Messages

  • How do you update multiple files in P6?

    I have 4 project schedule files to update, all of them are part of the same project. Each file is one area of the project. There are relationships within each file, but there are also relationships among the files. So, if for example you update an activity and press F9, it may affect an activity that is on another file. What is the the best approach to update a project schedule like this in P6? Do you open each file, update it and then press F9? or, do you open all of the files, update and then press F9 with all the files open? Thanks.

    I have 4 project schedule files to update, all of them are part of the same project. Each file is one area of the project. There are relationships within each file, but there are also relationships among the files. So, if for example you update an activity and press F9, it may affect an activity that is on another file. What is the the best approach to update a project schedule like this in P6? Do you open each file, update it and then press F9? or, do you open all of the files, update and then press F9 with all the files open? Thanks.

  • How do you set new items within a JComboBox that is within a JTable

    I have searched and searched for the answer to this and do not thing there is one. I have a JTable that has 5 columns. 2 of the columns use DefaultCellRenderers where a JComboBox is used. One of the columns has a value of different football positions. The other has a value of the different players. When a user enters a particular position such as Kickers I want all the Kickers to be showin within the Players JComboBox within the table.
    The problem is that I ONLY want the cell to be modified within that row and column that the position was changed. I have found ways to modify the component but it modifies it for the whole Column. I only want it to be modified for the player cell within the row that the Position was modified. Bottom line is that I just want to modify the JComboBox's components.
    If anyone has had this challenge before please advise.

    I'm not sure I fully understood what you wanted. Does the following little program help you?import javax.swing.*;
    import javax.swing.table.DefaultTableModel;
    import javax.swing.table.TableColumnModel;
    import java.awt.*;
    * User: weebib
    * Date: 29 janv. 2005
    * Time: 23:37:57
    public class FootballTable extends JPanel {
         private static final String[] COLUMN_NAMES = {"Position", "Name"};
         private static final String[] POSITIONS = {"goal", "arriere", "milieu", "avant"};
         private static final String[] GOALS = {"goal1", "goal2", "goal3"};
         private static final String[] ARRIERES = {"arriere1", "arriere2", "arriere3"};
         private static final String[] MILIEUX = {"milieu1", "milieu2", "milieu3"};
         private static final String[] AVANTS = {"avant1", "avant2", "avant3"};
         public FootballTable() {
              super(new BorderLayout());
              DefaultTableModel model = new DefaultTableModel(COLUMN_NAMES, 10);
              final JTable table = new JTable(model);
              TableColumnModel columnModel = table.getColumnModel();
              columnModel.getColumn(0).setCellEditor(new DefaultCellEditor(new JComboBox(POSITIONS)));
              columnModel.getColumn(1).setCellEditor(new DefaultCellEditor(new JComboBox()) {
                   public Component getTableCellEditorComponent(JTable table, Object value, boolean isSelected, int row, int column) {
                        JComboBox nameComboBox = (JComboBox)super.getTableCellEditorComponent(table, value, isSelected, row, column);
                        Object position = table.getValueAt(row, 0);
                        if (position == null) {
                             nameComboBox.setModel(new DefaultComboBoxModel());
                        } else if (position.equals("goal")) {
                             nameComboBox.setModel(new DefaultComboBoxModel(GOALS));
                        } else if (position.equals("arriere")) {
                             nameComboBox.setModel(new DefaultComboBoxModel(ARRIERES));
                        } else if (position.equals("milieu")) {
                             nameComboBox.setModel(new DefaultComboBoxModel(MILIEUX));
                        } else if (position.equals("avant")) {
                             nameComboBox.setModel(new DefaultComboBoxModel(AVANTS));
                        } else {
                             nameComboBox.setModel(new DefaultComboBoxModel());
                        return nameComboBox;
              add(new JScrollPane(table), BorderLayout.CENTER);
         public static void main(String[] args) {
              try {
                   UIManager.setLookAndFeel(UIManager.getCrossPlatformLookAndFeelClassName());
              } catch (Exception e) {
                   e.printStackTrace();
              final JFrame frame = new JFrame(FootballTable.class.getName());
              frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
              frame.setContentPane(new FootballTable());
              SwingUtilities.invokeLater(new Runnable() {
                   public void run() {
                        frame.setSize(400, 300);
                        frame.show();
    }Sorry for the French words, I have no idea how they are called in english (and too lazy to search).
    There is another solution. You also can override the table's prepareEditor method and add the relevant code before returning the Component.

  • How do you view on iPhone events from iCal that are six months out?

    I am trying to synch my iCal with an iPhone. When I synch the calendar it will only show events for the next few weeks. How do I get my iPhone calendar to show events from iCal that are six or eight months out?
    Thanks

    Corey,
    Welcome to Apple Discussions.
    What calendars have you chosen to sync in iTunes>Info>Calendars?
    What happens in iTunes if you select your iPhone under "Devices," then choose Info>Advanced>Replace information on this iPhone>: and check "Calendars"/"Sync?"
    ;~)

  • How do you get Itunes to sync an album that exists only on the iPad?

    Easy enough to sync iTunes albums to the iPad, but how about albums that currently exist only on the iPad? How do you get iTunes to import photo albums it doesn't currently know about? For example I have an app that saves it's files to an album called 'Saved'. I want iTunes to make a local computer copy during 'sync'. I was transferring files from the iPad to the computer via WiFi, but at least on my iPad, WiFi is extremely unreliable, often dropping the connection during data transfers. I finally gave up and decided to do this via USB until Apple gets their act together.

    Easy enough to sync iTunes albums to the iPad, but how about albums that currently exist only on the iPad?
    If you are transferring photos from iPhoto on your Mac, you mean the iPhoto albums that are available to select under the Photos tab for your iPad sync preferences? if so, this is a one way transfer process only - from your computer to your iPad.
    iTunes does not handle the import of photos from your iPad, which can include photos imported from a digital camera or from a digital camera's storage card with the Camera Connection Kit, or a photo saved from a received email, from a website, or by a 3rd party app that is capable of saving a photo in the same location.
    It sounds like the app developer has allowed for transferring photos saved by the app in the app's "Saved" area to your computer via an available wi-fi network that both your computer and iPad are connected to. Unless the app developer allows for saving the photos from the app's "Saved" area to the same location where a photo saved from a received email or from a website is stored, there is no way to import these photos via iPhoto or the Image Capture application on your Mac, which is used for importing photos, not iTunes.

  • How do you select multiple items in iPhoto?

    I insert my sd card into my mac and iphoto shows every single pictures in it. However, I just want to import a few different pictures but the only options were either select one or import all. I am pretty sure there is a way to select more than 1 picture

    Hold down the Shift key when selecting more than one image.

  • This might seem minor, but in Screen saver, how do you change the photos from your iPhoto that are those predetermined files on System Preferences?

    I am trying to get new photos or images into the files (or whatever they are) on Screensaver that load when you screen saver becomes active. How exactly do you do that?

    "If the screen saver doesn’t have an installer, drag it to /Library/Screen Savers at the top level of your internal disk. This makes the screen saver available to all users. If you want it available only to a specific user, drag it to the Library folder in that user’s home folder (the one with the user’s name)." was in the Installing and Uninstalling Screen Savers section.
    A quick look around showed me that System (System/Library/Screen Savers) also holds some of the Apple images.

  • How to Update multiple items in other list using event handler?

    Hi All,
    If i update a item in a list, then i should update multiple items in another list need to be update. How to achive using event receivers?

    Hi Sam,
    According to your description, my understanding is that you want to update multiple items in another list when updated a list item.
    In the event receiver, you can update the multiple item using Client Object Model.
    Here is a code snippet for your reference:
    public override void ItemUpdated(SPItemEventProperties properties)
    string siteUrl = "http://sp2013sps/sites/test/";
    ClientContext clientContext = new ClientContext(siteUrl);
    List oList = clientContext.Web.Lists.GetByTitle("another list name");
    ListItem oListItem = oList.GetItemById(1);
    oListItem["Title"] = "Hello World Updated!";
    oListItem.Update();
    clientContext.ExecuteQuery();
    Best regards,<o:p></o:p>
    Zhengyu Guo
    Zhengyu Guo
    TechNet Community Support

  • SPD 2013 - Copy Document action - how do you update the copied list item's metadata?

    SharePoint 2013 Designer no longer has the Copy List Item Action, it only has a Copy Document action. It seems that this action provides no way of saving the copied documents list item ID. How do you update the list item after it has been copied??
    Any help is appreciated.
    Greg Pierson

    Hi,
    According to your post, my understanding is that you wanted to copy the list item in SharePoint 2013.
    The Copy List Item is
    available only on the SharePoint 2010 Workflow platform, you can create a SharePoint 2010 workflow using the SharePoint 2010 workflow platform to achieve it.
    You can also use the Content and Structure to copy the list items: Site Settings->Site Administration->Content and Structure.
    Thanks & Regards,
    Jason
    Jason Guo
    TechNet Community Support

  • How do I select multiple items on blackberry phone?

    How do I select multiple items on blackberry phone?

    Multiple items of what?
    1. If any post helps you please click the below the post(s) that helped you.
    2. Please resolve your thread by marking the post "Solution?" which solved it for you!
    3. Install free BlackBerry Protect today for backups of contacts and data.
    4. Guide to Unlocking your BlackBerry & Unlock Codes
    Join our BBM Channels (Beta)
    BlackBerry Support Forums Channel
    PIN: C0001B7B4   Display/Scan Bar Code
    Knowledge Base Updates
    PIN: C0005A9AA   Display/Scan Bar Code

  • How do you have multiple apple id's with one itunes

    how do you have multiple apple id's with one itunes

    I have multiple IDs and use the single computer sharing itunes. By 'sharing' I mean we open the pc, open itunes and log in with our individual ID as required.
    While Im logged in I plug in  my device. I transfer my purchases from my device as per the file menu (not the check for auto downloads). I move them as required to whichever playlist I like.
    Then when my son wants to use itunes or update his device, he logs in, plugs in his device, transfers purchases from his device, puts whatever music he wants into his playlist and/or drags direct to the device regardless of who purchased it and then syncs.
    Im not sure how it works associating the pc with only one ID or all that other business- I know I don't fiddle with any of that.

  • How do you highlight multiple documents rapidly, rather than having to click on the document and on "command" one at a time?

    How do you highlight multiple documents rapidly, rather than having to click on the document and on "command" one at a time? Right now, when I'm trying to highlight documents to export, I have to click on each document individually. Is there a way to highlight one document while scrolling down the list until all desired documents are highlighted? I would like to rapidly be able to do this to save time when I am exporting or saving multiple files from my documents to an external drive, CD-Rom or cloud storage.

    Click on the first item
    Hold the Shift key
    Click on the Last Item.
    All the items in between will be selected.

  • How do I delete multiple items at once instead of one at a time?

    How do I delete multiple items at once instead of one at a time? I have several duplicate items in my library and would like to delete the duplicates. Thanks!

    You can select multiple items using shift to select a range and control to add or remove items from it.
    Regarding duplciates, Apple's official advice is here... HT2905 - How to find and remove duplicate items in your iTunes library. It is a manual process and the article fails to explain some of the potential pitfalls.
    Use Shift > View > Show Exact Duplicate Items to display duplicates as this is normally a more useful selection. You need to manually select all but one of each group of identical tracks to remove. Sorting the list by Date Added may make it easier to select the appropriate tracks, however this works best when performed immediately after the dupes have been created.  If you have multiple entries in iTunes connected to the same file on the hard drive then don't send to the recycle bin. This can happen, for example, if you start iTunes with a disconnected external drive, then connect it, reimport from your media folder, then restart iTunes.
    Use my DeDuper script if you're not sure, don't want to do it by hand, or want to preserve ratings, play counts and playlist membership. See this thread for background. Please take note of the warning to backup your library before deduping, whether you do so by hand or using my script, in case something goes wrong.
    (If you don't see the menu bar press ALT to show it temporarily or CTRL+B to keep it displayed)
    tt2

  • How do you select multiple files at one time

    How do you select multiple files at one time

    Select one, and then either command-click another, or in list/column view, Shift-click the item at the other end of the range you want to select. Alternatively, click on a spot in the screen and drag the cursor until all the files are selected.
    (114308)

  • Solaris 11 IPS:  How do you post multiple versions of the same package?

    How do you post multiple versions of the same software package on a single IPS instance(port)? Oracle was able to do it here with versions 151 and 175 of S11:
    http://pkg.oracle.com/solaris/release/
    Unfortunately, based on my searches, no where in the documentation (http://www.oracle.com/technetwork/server-storage/solaris11/technologies/ips-323421.html) does it explain to the development community how this is done. The best I can do is create pkg repo instances on different ports to host each different software version.
    We are trying to deploy an IPS repository for our drivers and utilities that our customers can link to and pull updates from. We have been able to post a software package to the repository using the command:
    pkgsend publish -s http://localhost:1234 -d ./ Appv1.p5m
    This posts the package on the IPS repository instance at port 1234 on the server. However, we would like to post multiple versions of the package on the server at the same URL. Why the same URL? So that our customers and end-users need only point to a single URL to pull down our software rather than having to add a new URL to the publisher list each time we have an update. We want at least 5 of the previous software versions to be available on the server. Posting each version of the application or driver on a different IPS instance on a different port will require customers to add multiple URLs to their publisher list and they also will not be able to initiate remote scans for updates.
    Has anybody been able to do this? Is any documentation forthcoming?
    Edited by: user13489824 on Jun 25, 2012 10:17 AM

    dhduvall: Thanks for your response. Yes, one would think that as long as the version numbers are different, you should be able to accumulate multiple versions of a package in a repository. It looks like Oracle has done it in their S11 repository unfortunately, as far as I know, they have not shared the steps on how to do this. I would like to publish two versions of the same package. I.E. two different manifests with two different fmri.pkg version strings and two different binaries.
    If I publish one package after another like this:
    pkgsend publish -s http://localhost:1234 Appv1.p5m
    pkgsend publish -s http://localhost:1234 Appv2.p5m
    Then only the second package shows up in the repository, as if it over-wrote the first one.
    Running pkgsend with two manifest, like this:
    pkgsend publish -s http://localhost:1234 Appv1.p5m Appv2.p5m
    Will cause pkgsend to combine the packages and manifests as if they were a single package... not what I am trying to do.
    Both approaches are complete without errors but neither achieves what I am trying to do.
    alan.pae: Thank you. Unfortunately, the link didn't really help. I've read Oracle's white papers and IPS developer guide so I'm familiar with the topics covered.
    Lex: Yes, I know. I specified the versions in the pkg.fmri value string.

Maybe you are looking for

  • Customer/ Vendor list for Italy (RFIDITCVL)

    Dear all, Does anyone has an idea about the new modification requirements for the report RFIDITCVL?This tax report needs to be changed according to the Italian tax authorities till October 2011 but there is no SAP note for it yet. Please let me know

  • WRT54G connect to Comcast cable - SUCCESS

    There are so many of us asking for help to get WRT54Gs to connect to the internet, I thought I'd post a success notice. Mine is a V5.  It has progressed from simple connecting to encrypted connecting, and has been running several days at each. What s

  • Spotify is hijacked by free youtube to mp3 convertor when it tries to update and re open

    I have been having this problem for a few weeks now. The only solution is to uninstall spotify and re-install it. This would cure the problem for a few days but now it will not even cure it for a few minutes. If I reboot windows and open up Spotify t

  • Intercompany Matching and Eliminations

    Hi All, We are trying to configure Intercompany Matching and Eliminations in application LEGAL following the docs: HTG Intercompnay Matching and BPC Intercompany Booking in Business Rules (both for MS Version), but we can't make any elimination (the

  • Columns with identical constraints

    Hi, There is a table testtbl: create table testtbl   (prim_key number,    f1 char(1),    constraint testtbl_pk primary key (prim_key),    constraint testtbl_f1_ck check (f1 in ('0','1'))    );Columns f2, ..., f9 with the same check constraint as f1 n