1 Reply Latest reply on Jun 3, 2011 5:52 AM by Leo van den berg

    Seam Delete Method no working - Is Something Wrong?

    Olalekan Ogunleye Newbie
      Hi All,

      I have tried everything possible but it seems like its not working. May be I am doing something wrong I don't know but can someone please help point me to anything that I am doing wrong.
      Before I was using ordinary seam and when I used this method to delete it was working fine by deleting the data from my database.

      I have switched to seam framework where I used Home and Entity and I wanted to use this delete method but it is not working. I tried also to used the remove method from and It is not working. Below is the error and the error log that I am getting. Can somebody please tell me what I am doing wrong or point me to an example that show how this is done.

      Thank you

      Delete Method

      public class UserList extends EntityQuery<Subscriber> implements UserListInterface{

      private EntityManager entityManager;

           private Subscriber subscriber;

           List<Subscriber> subscribers;

           public void subscriberList(){
                System.out.println("SubscriberList called");
                subscribers = entityManager.createQuery("Select s from Subscriber s").getResultList();

      public void deleteUser() {
                subscriber = new Subscriber();
                subscriber = entityManager.find(Subscriber.class, subscriber.getSubscriberId());




      import javax.ejb.Local;
      public interface UserListInterface {
           //public boolean delete(Subscriber deleteSubscriber) throws SQLException;
           public void deleteSubscriber();
           public void showDetails();


      </s:link> |
                      <s:link id="delete" value="Delete" action="#{subscriberList.deleteSubscriber}" onclick="return confirmDelete()">

        • 1. Re: Seam Delete Method no working - Is Something Wrong?
          Leo van den berg Master


          hi look closely to your code again and see my remarks:

          @Transactional // Should be inside a Transaction !!
          public void deleteUser() {
             // subscriber = new Subscriber(); // You're creating a new object, and then ask the database to find it?
            subscriber = entityManager.find(Subscriber.class, subscriber.getSubscriberId()); // If you take out the previous lijne, it will find the object 
            subscribers.remove(subscriber.getSubscriberId()); // Is this a reference to the ID, should be a reference to a subscriber
            entityManager.flush(); // add this line if you have manual flushing

          Hopefully this helps,