title: hibernate delete with string type collection
body: <p>I am stuck over hibernate delete having collection type that is giving exception with foreign constraints. </p>
  
  <p>Here is my Hibernate table</p>
  
  <pre><code>@Entity
  @Table
  public class FrontRequest implements Serializable {
  
      private static final long serialVersionUID = 1L;
  
  
      @Id
      @GeneratedValue(strategy= GenerationType.AUTO)
      private Long tutorfront_id;
  
      @Column
      private String tutorialType;
  
      @Column
      private String tutorialLevel;
  
      @ElementCollection(fetch=FetchType.EAGER)
      @Fetch(value = FetchMode.SELECT)
      private Collection&lt;String&gt; tutorialSubjects= new HashSet&lt;String&gt;();
  
      @Column
      private String tutorialCity;
  
      @Column
      private String noOfStudent;
  
      @Column
      private String classWeek;
  
      @Column
      private String tutionFee;
  
      @Column
      private String tutionFeerate;
  
      @Column
      private String tutorSex;
  
      @Column
      private String tutorEducation;
  
  
      @Column
      private Date postingDate;
  
      @Column
      private String studentSchool;
  }
  </code></pre>
  
  <p>and here is my service method to delete the object</p>
  
  <pre><code>public boolean removeFrontRequest(Long id) {
          // TODO Auto-generated method stub
          Session session= SessionFactoryImpl.returnService().getCurrentSession();
          Transaction tx;
  
          if(session.getTransaction() != null
                  &amp;&amp; session.getTransaction().isActive()){
              tx=session.getTransaction();
          }
          else{
              tx= session.beginTransaction();
          }
  
  
          try{
  
              Query query=session.createQuery("from FrontRequest where tutorfront_id =:id");
              query.setParameter("id", id);
               FrontRequest frontRequest=(FrontRequest) query.list().get(0);
               session.delete(frontRequest);
               if(!tx.wasCommitted()) {
                      tx.commit();
               }
          }
          catch(Exception e){
          return false;
          }
          return true;
      }
  </code></pre>
  
  <p>But it is giving exception with lock: 
  SQL Error: 1205, SQLState: 40001
  <strong>Lock wait timeout exceeded; try restarting transaction</strong></p>
  
  <p>Please can you suggest where I am doing wrong. Here..</p>
  
  <p>Thanks</p>